Commit 7a041518 by Cooper Partin Committed by Geoff Lang

Fixed FL9_3 shaders that use glPointSize without GL_POINTS mode

This change fixes rendering on FL9_3 with shaders that reference glPointSize and are not used with GL_POINTS rendering mode. A TDR occurs on some hardware because of missing vertex buffers specified by the vertex layout. Change-Id: Ie49b75f7177c32c7f021a0409d15c27b18140c4b Reviewed-on: https://chromium-review.googlesource.com/299719Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCooper Partin <coopp@microsoft.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 04b89c97
......@@ -456,7 +456,10 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
// PointSprite quad.
// An index buffer also needs to be created and applied because rendering instanced
// data on D3D11 FL9_3 requires DrawIndexedInstanced() to be used.
if (instancedPointSpritesActive)
// Shaders that contain gl_PointSize and used without the GL_POINTS rendering mode
// require a vertex buffer because some drivers cannot handle missing vertex data
// and will TDR the system.
if (programUsesInstancedPointSprites)
{
HRESULT result = S_OK;
const UINT pointSpriteVertexStride = sizeof(float) * 5;
......@@ -491,7 +494,10 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
}
mCurrentBuffers[nextAvailableIndex] = mPointSpriteVertexBuffer;
mCurrentVertexStrides[nextAvailableIndex] = pointSpriteVertexStride;
// Set the stride to 0 if GL_POINTS mode is not being used to instruct the driver
// to avoid indexing into the vertex buffer.
mCurrentVertexStrides[nextAvailableIndex] =
instancedPointSpritesActive ? pointSpriteVertexStride : 0;
mCurrentVertexOffsets[nextAvailableIndex] = 0;
if (!mPointSpriteIndexBuffer)
......@@ -519,11 +525,16 @@ gl::Error InputLayoutCache::applyVertexBuffers(const std::vector<TranslatedAttri
}
}
// The index buffer is applied here because Instanced PointSprite emulation uses
// the a non-indexed rendering path in ANGLE (DrawArrays). This means that applyIndexBuffer()
// on the renderer will not be called and setting this buffer here ensures that the rendering
// path will contain the correct index buffers.
mDeviceContext->IASetIndexBuffer(mPointSpriteIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
if (instancedPointSpritesActive)
{
// The index buffer is applied here because Instanced PointSprite emulation uses
// the a non-indexed rendering path in ANGLE (DrawArrays). This means that
// applyIndexBuffer()
// on the renderer will not be called and setting this buffer here ensures that the
// rendering
// path will contain the correct index buffers.
mDeviceContext->IASetIndexBuffer(mPointSpriteIndexBuffer, DXGI_FORMAT_R16_UINT, 0);
}
}
if (moveFirstIndexedIntoSlotZero)
......
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