Revert "Fixed compiler warning C4267 'conversion from 'size_t' to 'type', possible loss of data'"
Seems to have quite a few warnings in 64-bit on my machine.
BUG=angleproject:1120
This reverts commit c5cf9bc47d0ee028adbbf9e9f94ca567eec601dc.
Change-Id: I86768b900aeba52e7a2242d9ae8949f93f1a5ba9
Reviewed-on: https://chromium-review.googlesource.com/293280
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 4fd4351..00adfc1 100644
--- a/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -35,10 +35,8 @@
size = static_cast<unsigned int>(std::numeric_limits<int>::max());
}
- GLsizei stride = static_cast<GLsizei>(ComputeVertexAttributeStride(attrib));
- return (size - attrib.offset % stride +
- (stride - static_cast<GLsizei>(ComputeVertexAttributeTypeSize(attrib)))) /
- stride;
+ GLsizei stride = ComputeVertexAttributeStride(attrib);
+ return (size - attrib.offset % stride + (stride - ComputeVertexAttributeTypeSize(attrib))) / stride;
}
static int StreamingBufferElementCount(const gl::VertexAttribute &attrib, int vertexDrawCount, int instanceDrawCount)
@@ -154,8 +152,7 @@
// Record the attribute now
translated->active = true;
translated->attribute = &vertexAttributes[attribIndex];
- translated->currentValueType =
- state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)).Type;
+ translated->currentValueType = state.getVertexAttribCurrentValue(attribIndex).Type;
translated->divisor = vertexAttributes[attribIndex].divisor;
if (vertexAttributes[attribIndex].enabled)
@@ -163,9 +160,8 @@
mActiveEnabledAttributes.push_back(translated);
// Also invalidate static buffers that don't contain matching attributes
- invalidateMatchingStaticData(
- vertexAttributes[attribIndex],
- state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)));
+ invalidateMatchingStaticData(vertexAttributes[attribIndex],
+ state.getVertexAttribCurrentValue(attribIndex));
}
else
{
@@ -203,9 +199,9 @@
mCurrentValueCache[attribIndex].buffer = new StreamingVertexBufferInterface(mFactory, CONSTANT_VERTEX_BUFFER_SIZE);
}
- gl::Error error = storeCurrentValue(
- state.getVertexAttribCurrentValue(static_cast<unsigned int>(attribIndex)),
- &(*translatedAttribs)[attribIndex], &mCurrentValueCache[attribIndex]);
+ gl::Error error = storeCurrentValue(state.getVertexAttribCurrentValue(attribIndex),
+ &(*translatedAttribs)[attribIndex],
+ &mCurrentValueCache[attribIndex]);
if (error.isError())
{
hintUnmapAllResources(vertexAttributes);
@@ -224,7 +220,7 @@
{
BufferD3D *bufferD3D = GetImplAs<BufferD3D>(buffer);
size_t typeSize = ComputeVertexAttributeTypeSize(*activeAttrib->attribute);
- bufferD3D->promoteStaticUsage(count * static_cast<int>(typeSize));
+ bufferD3D->promoteStaticUsage(count * typeSize);
}
}
@@ -267,8 +263,7 @@
{
if (staticBuffer->getBufferSize() == 0)
{
- int totalCount =
- ElementsInBuffer(attrib, static_cast<unsigned int>(bufferImpl->getSize()));
+ int totalCount = ElementsInBuffer(attrib, bufferImpl->getSize());
gl::Error error = staticBuffer->reserveVertexSpace(attrib, totalCount, 0);
if (error.isError())
{
@@ -279,9 +274,7 @@
else
{
int totalCount = StreamingBufferElementCount(attrib, count, instances);
- ASSERT(!bufferImpl ||
- ElementsInBuffer(attrib, static_cast<unsigned int>(bufferImpl->getSize())) >=
- totalCount);
+ ASSERT(!bufferImpl || ElementsInBuffer(attrib, bufferImpl->getSize()) >= totalCount);
gl::Error error = mStreamingBuffer->reserveVertexSpace(attrib, totalCount, instances);
if (error.isError())
@@ -319,7 +312,7 @@
{
translated->storage = storage;
translated->serial = storage->getSerial();
- translated->stride = static_cast<unsigned int>(ComputeVertexAttributeStride(attrib));
+ translated->stride = ComputeVertexAttributeStride(attrib);
translated->offset = static_cast<unsigned int>(attrib.offset + translated->stride * firstVertexIndex);
return gl::Error(GL_NO_ERROR);
@@ -356,10 +349,8 @@
if (!staticBuffer->lookupAttribute(attrib, &streamOffset))
{
// Convert the entire buffer
- int totalCount =
- ElementsInBuffer(attrib, static_cast<unsigned int>(storage->getSize()));
- int startIndex = static_cast<int>(attrib.offset) /
- static_cast<int>(ComputeVertexAttributeStride(attrib));
+ int totalCount = ElementsInBuffer(attrib, storage->getSize());
+ int startIndex = attrib.offset / ComputeVertexAttributeStride(attrib);
error = staticBuffer->storeVertexAttributes(attrib,
translated->currentValueType,
@@ -374,10 +365,7 @@
}
}
- unsigned int firstElementOffset =
- (static_cast<unsigned int>(attrib.offset) /
- static_cast<unsigned int>(ComputeVertexAttributeStride(attrib))) *
- outputElementSize;
+ unsigned int firstElementOffset = (attrib.offset / ComputeVertexAttributeStride(attrib)) * outputElementSize;
unsigned int startOffset = (instances == 0 || attrib.divisor == 0) ? firstVertexIndex * outputElementSize : 0;
if (streamOffset + firstElementOffset + startOffset < streamOffset)
{
@@ -448,7 +436,7 @@
translated->divisor = 0;
translated->stride = 0;
- translated->offset = static_cast<unsigned int>(cachedState->offset);
+ translated->offset = cachedState->offset;
return gl::Error(GL_NO_ERROR);
}