Commit 0894288d by Qin Jiajia Committed by Commit Bot

D3D11: Refactor trifan and line loop parameters.

Use baseVertex as the parameter of drawLineLoop and drawTriangleFan. The old name is not clear for its usage. BUG=angleproject:1724 Change-Id: I529a157f055eba9d62952093f37eabb8398697db Reviewed-on: https://chromium-review.googlesource.com/430255 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent c1a5d16e
......@@ -1873,7 +1873,7 @@ gl::Error Renderer11::drawArraysImpl(const gl::ContextState &data,
if (mode == GL_LINE_LOOP)
{
return drawLineLoop(data, count, GL_NONE, nullptr, nullptr, instances);
return drawLineLoop(data, count, GL_NONE, nullptr, 0, instances);
}
if (mode == GL_TRIANGLE_FAN)
......@@ -1932,16 +1932,17 @@ gl::Error Renderer11::drawElementsImpl(const gl::ContextState &data,
const GLvoid *indices,
GLsizei instances)
{
int minIndex = static_cast<int>(indexInfo.indexRange.start);
int startVertex = static_cast<int>(indexInfo.indexRange.start);
int baseVertex = -startVertex;
if (mode == GL_LINE_LOOP)
{
return drawLineLoop(data, count, type, indices, &indexInfo, instances);
return drawLineLoop(data, count, type, indices, baseVertex, instances);
}
if (mode == GL_TRIANGLE_FAN)
{
return drawTriangleFan(data, count, type, indices, minIndex, instances);
return drawTriangleFan(data, count, type, indices, baseVertex, instances);
}
const ProgramD3D *programD3D = GetImplAs<ProgramD3D>(data.getState().getProgram());
......@@ -1961,13 +1962,13 @@ gl::Error Renderer11::drawElementsImpl(const gl::ContextState &data,
for (GLsizei i = 0; i < instances; i++)
{
ANGLE_TRY(
mInputLayoutCache.updateVertexOffsetsForPointSpritesEmulation(minIndex, i));
mInputLayoutCache.updateVertexOffsetsForPointSpritesEmulation(startVertex, i));
mDeviceContext->DrawIndexedInstanced(6, elementsToRender, 0, 0, 0);
}
}
else
{
mDeviceContext->DrawIndexedInstanced(count, instances, 0, -minIndex, 0);
mDeviceContext->DrawIndexedInstanced(count, instances, 0, baseVertex, 0);
}
return gl::NoError();
}
......@@ -1989,7 +1990,7 @@ gl::Error Renderer11::drawElementsImpl(const gl::ContextState &data,
}
else
{
mDeviceContext->DrawIndexed(count, 0, -minIndex);
mDeviceContext->DrawIndexed(count, 0, baseVertex);
}
return gl::NoError();
}
......@@ -1998,7 +1999,7 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
GLsizei count,
GLenum type,
const GLvoid *indexPointer,
const TranslatedIndexData *indexInfo,
int baseVertex,
int instances)
{
const auto &glState = data.getState();
......@@ -2072,16 +2073,15 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
mAppliedIBOffset = offset;
}
INT baseVertexLocation = (indexInfo ? -static_cast<int>(indexInfo->indexRange.start) : 0);
UINT indexCount = static_cast<UINT>(mScratchIndexDataBuffer.size());
if (instances > 0)
{
mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, baseVertexLocation, 0);
mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, baseVertex, 0);
}
else
{
mDeviceContext->DrawIndexed(indexCount, 0, baseVertexLocation);
mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
}
return gl::NoError();
......@@ -2091,7 +2091,7 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
GLsizei count,
GLenum type,
const GLvoid *indices,
int minIndex,
int baseVertex,
int instances)
{
gl::VertexArray *vao = data.getState().getVertexArray();
......@@ -2167,11 +2167,11 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
if (instances > 0)
{
mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, -minIndex, 0);
mDeviceContext->DrawIndexedInstanced(indexCount, instances, 0, baseVertex, 0);
}
else
{
mDeviceContext->DrawIndexed(indexCount, 0, -minIndex);
mDeviceContext->DrawIndexed(indexCount, 0, baseVertex);
}
return gl::NoError();
......
......@@ -394,7 +394,8 @@ class Renderer11 : public RendererD3D
const GLvoid *indices,
GLsizei instances);
void generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps,
void generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap *outTextureCaps,
gl::Extensions *outExtensions,
gl::Limitations *outLimitations) const override;
......@@ -404,13 +405,13 @@ class Renderer11 : public RendererD3D
GLsizei count,
GLenum type,
const GLvoid *indices,
const TranslatedIndexData *indexInfo,
int baseVertex,
int instances);
gl::Error drawTriangleFan(const gl::ContextState &data,
GLsizei count,
GLenum type,
const GLvoid *indices,
int minIndex,
int baseVertex,
int instances);
gl::Error applyShaders(const gl::ContextState &data, GLenum drawMode);
......
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