Commit 7f8cdf13 by Geoff Lang

Fix indices not being offset to the bound vertex buffer when drawing indexed points in D3D9.

bug=angle:535 Change-Id: I5b86874cddbd3b90fe141e94085f5a4afb9f3db3 Reviewed-on: https://chromium-review.googlesource.com/178891Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarShannon Woods <shannonwoods@chromium.org>
parent 9a8d004a
......@@ -1454,7 +1454,7 @@ void Renderer9::drawElements(GLenum mode, GLsizei count, GLenum type, const GLvo
if (mode == GL_POINTS)
{
drawIndexedPoints(count, type, indices, elementArrayBuffer);
drawIndexedPoints(count, type, indices, indexInfo.minIndex, elementArrayBuffer);
}
else if (mode == GL_LINE_LOOP)
{
......@@ -1658,16 +1658,16 @@ void Renderer9::drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices,
}
template <typename T>
static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices)
static void drawPoints(IDirect3DDevice9* device, GLsizei count, const GLvoid *indices, int minIndex)
{
for (int i = 0; i < count; i++)
{
unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]);
unsigned int indexValue = static_cast<unsigned int>(static_cast<const T*>(indices)[i]) - minIndex;
device->DrawPrimitive(D3DPT_POINTLIST, indexValue, 1);
}
}
void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer)
void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer)
{
// Drawing index point lists is unsupported in d3d9, fall back to a regular DrawPrimitive call
// for each individual point. This call is not expected to happen often.
......@@ -1681,9 +1681,9 @@ void Renderer9::drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indi
switch (type)
{
case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices); break;
case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices); break;
case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices); break;
case GL_UNSIGNED_BYTE: drawPoints<GLubyte>(mDevice, count, indices, minIndex); break;
case GL_UNSIGNED_SHORT: drawPoints<GLushort>(mDevice, count, indices, minIndex); break;
case GL_UNSIGNED_INT: drawPoints<GLuint>(mDevice, count, indices, minIndex); break;
default: UNREACHABLE();
}
}
......
......@@ -205,7 +205,7 @@ class Renderer9 : public Renderer
void applyUniformnbv(gl::Uniform *targetUniform, const GLint *v);
void drawLineLoop(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, gl::Buffer *elementArrayBuffer);
void drawIndexedPoints(GLsizei count, GLenum type, const GLvoid *indices, int minIndex, gl::Buffer *elementArrayBuffer);
void getMultiSampleSupport(D3DFORMAT format, bool *multiSampleArray);
bool copyToRenderTarget(IDirect3DSurface9 *dest, IDirect3DSurface9 *source, bool fromManaged);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment