Fix rendering for the closing line of line loops.

Trac #19035 Signed-off-by: Nicolas Capens Line loops via DrawArrays were incorrect because the vertex buffer already has the vertex offset factored in. Line loops via DrawElements were incorrect because the vertex buffer was offset by the minIndex. We need to use the same minIndex when rendering the closing loop. git-svn-id: https://angleproject.googlecode.com/svn/trunk@892 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 7a2fdc9c
#define MAJOR_VERSION 0
#define MINOR_VERSION 0
#define BUILD_VERSION 0
#define BUILD_REVISION 891
#define BUILD_REVISION 892
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -2797,7 +2797,7 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count)
if (mode == GL_LINE_LOOP) // Draw the last segment separately
{
drawClosingLine(first, first + count - 1);
drawClosingLine(0, count - 1, 0);
}
}
}
......@@ -2862,7 +2862,7 @@ void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *
if (mode == GL_LINE_LOOP) // Draw the last segment separately
{
drawClosingLine(count, type, indices);
drawClosingLine(count, type, indices, indexInfo.minIndex);
}
}
}
......@@ -2914,7 +2914,7 @@ void Context::sync(bool block)
}
}
void Context::drawClosingLine(unsigned int first, unsigned int last)
void Context::drawClosingLine(unsigned int first, unsigned int last, int minIndex)
{
IDirect3DIndexBuffer9 *indexBuffer = NULL;
bool succeeded = false;
......@@ -2968,7 +2968,7 @@ void Context::drawClosingLine(unsigned int first, unsigned int last)
mDevice->SetIndices(mClosingIB->getBuffer());
mAppliedIBSerial = mClosingIB->getSerial();
mDevice->DrawIndexedPrimitive(D3DPT_LINELIST, 0, 0, last, offset, 1);
mDevice->DrawIndexedPrimitive(D3DPT_LINELIST, -minIndex, minIndex, last, offset, 1);
}
else
{
......@@ -2977,7 +2977,7 @@ void Context::drawClosingLine(unsigned int first, unsigned int last)
}
}
void Context::drawClosingLine(GLsizei count, GLenum type, const void *indices)
void Context::drawClosingLine(GLsizei count, GLenum type, const void *indices, int minIndex)
{
unsigned int first = 0;
unsigned int last = 0;
......@@ -3006,7 +3006,7 @@ void Context::drawClosingLine(GLsizei count, GLenum type, const void *indices)
default: UNREACHABLE();
}
drawClosingLine(first, last);
drawClosingLine(first, last, minIndex);
}
void Context::recordInvalidEnum()
......
......@@ -431,8 +431,8 @@ class Context
void sync(bool block); // flush/finish
// Draw the last segment of a line loop
void drawClosingLine(unsigned int first, unsigned int last);
void drawClosingLine(GLsizei count, GLenum type, const void *indices);
void drawClosingLine(unsigned int first, unsigned int last, int minIndex);
void drawClosingLine(GLsizei count, GLenum type, const void *indices, int minIndex);
void recordInvalidEnum();
void recordInvalidValue();
......
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