Commit 1b7ed0ef by Jamie Madill Committed by Commit Bot

D3D11: Minor optimizations to Renderer11.

This moves the skipDraw logic into applyPrimitiveType, since it's more efficient to only check the primitive type once. Also merges the draw*Impl and genericDraw* methods, since the generic* methods weren't really doing anything anymore, and all the state logic lives in StateManager::updateState. This series of small optimizations gives about a 15% improvement on the draw call benchmark for the D3D11 backend with the null driver. BUG=angleproject:1155 Change-Id: I299213da6d1bbcb08691d5b50162e6cae16cb4bb Reviewed-on: https://chromium-review.googlesource.com/666044Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 61491505
......@@ -160,7 +160,7 @@ gl::Error Context11::finish()
gl::Error Context11::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawArrays(context, mode, first, count, 0);
return mRenderer->drawArrays(context, mode, first, count, 0);
}
gl::Error Context11::drawArraysInstanced(const gl::Context *context,
......@@ -170,7 +170,7 @@ gl::Error Context11::drawArraysInstanced(const gl::Context *context,
GLsizei instanceCount)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawArrays(context, mode, first, count, instanceCount);
return mRenderer->drawArrays(context, mode, first, count, instanceCount);
}
gl::Error Context11::drawElements(const gl::Context *context,
......@@ -180,7 +180,7 @@ gl::Error Context11::drawElements(const gl::Context *context,
const void *indices)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
return mRenderer->drawElements(context, mode, count, type, indices, 0);
}
gl::Error Context11::drawElementsInstanced(const gl::Context *context,
......@@ -191,7 +191,7 @@ gl::Error Context11::drawElementsInstanced(const gl::Context *context,
GLsizei instances)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawElements(context, mode, count, type, indices, instances);
return mRenderer->drawElements(context, mode, count, type, indices, instances);
}
gl::Error Context11::drawRangeElements(const gl::Context *context,
......@@ -203,7 +203,7 @@ gl::Error Context11::drawRangeElements(const gl::Context *context,
const void *indices)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawElements(context, mode, count, type, indices, 0);
return mRenderer->drawElements(context, mode, count, type, indices, 0);
}
gl::Error Context11::drawArraysIndirect(const gl::Context *context,
......@@ -211,7 +211,7 @@ gl::Error Context11::drawArraysIndirect(const gl::Context *context,
const void *indirect)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawIndirect(context, mode, GL_NONE, indirect);
return mRenderer->drawArraysIndirect(context, mode, indirect);
}
gl::Error Context11::drawElementsIndirect(const gl::Context *context,
......@@ -220,7 +220,7 @@ gl::Error Context11::drawElementsIndirect(const gl::Context *context,
const void *indirect)
{
ANGLE_TRY(prepareForDrawCall(context, mode));
return mRenderer->genericDrawIndirect(context, mode, type, indirect);
return mRenderer->drawElementsIndirect(context, mode, type, indirect);
}
GLenum Context11::getResetStatus()
......
......@@ -146,7 +146,7 @@ class Renderer11 : public RendererD3D
HANDLE shareHandle,
const egl::AttributeMap &attribs) const override;
bool applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSize);
bool applyPrimitiveType(const gl::State &glState, GLenum mode, GLsizei count);
// lost device
bool testDeviceLost() override;
......@@ -380,23 +380,24 @@ class Renderer11 : public RendererD3D
egl::Error getEGLDevice(DeviceImpl **device) override;
gl::Error genericDrawArrays(const gl::Context *context,
GLenum mode,
GLint first,
GLsizei count,
GLsizei instances);
gl::Error drawArrays(const gl::Context *context,
GLenum mode,
GLint startVertex,
GLsizei count,
GLsizei instances);
gl::Error genericDrawElements(const gl::Context *context,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei instances);
gl::Error drawElements(const gl::Context *context,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei instances);
gl::Error genericDrawIndirect(const gl::Context *context,
GLenum mode,
GLenum type,
const void *indirect);
gl::Error drawArraysIndirect(const gl::Context *context, GLenum mode, const void *indirect);
gl::Error drawElementsIndirect(const gl::Context *context,
GLenum mode,
GLenum type,
const void *indirect);
// Necessary hack for default framebuffers in D3D.
FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override;
......@@ -460,23 +461,6 @@ class Renderer11 : public RendererD3D
bool canSelectViewInVertexShader() const override;
private:
gl::Error drawArraysImpl(const gl::Context *context,
GLenum mode,
GLint startVertex,
GLsizei count,
GLsizei instances);
gl::Error drawElementsImpl(const gl::Context *context,
GLenum mode,
GLsizei count,
GLenum type,
const void *indices,
GLsizei instances);
gl::Error drawArraysIndirectImpl(const gl::Context *context, GLenum mode, const void *indirect);
gl::Error drawElementsIndirectImpl(const gl::Context *context,
GLenum mode,
GLenum type,
const void *indirect);
void generateCaps(gl::Caps *outCaps,
gl::TextureCapsMap *outTextureCaps,
gl::Extensions *outExtensions,
......
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