Moves AssertPointersBound to draw commands to not forget to call it for new shaders.
In the future it allows to call AssertPointersBound in a more lazy way. This was SVN commit r26784.
This commit is contained in:
parent
d8d736f0eb
commit
2c8f4c4837
@ -60,7 +60,6 @@ inline void DrawTextureImpl(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, vertices.data());
|
||||
shader->TexCoordPointer(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, uvs.data());
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, vertices.size() / 2);
|
||||
}
|
||||
@ -255,7 +254,6 @@ void CCanvas2D::DrawLine(const std::vector<CVector2D>& points, const float width
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, vertices.data());
|
||||
shader->TexCoordPointer(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, uvs.data());
|
||||
shader->AssertPointersBound();
|
||||
|
||||
m->DeviceCommandContext->SetIndexBufferData(indices.data());
|
||||
m->DeviceCommandContext->DrawIndexed(0, indices.size(), 0);
|
||||
|
@ -183,7 +183,6 @@ void CLOSTexture::InterpolateLOS(Renderer::Backend::GL::CDeviceCommandContext* d
|
||||
};
|
||||
shader->TexCoordPointer(GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(Renderer::Backend::Format::R32G32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
g_Renderer.SetViewport(oldVp);
|
||||
|
@ -99,7 +99,6 @@ void DrawTexture(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadUVs);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, quadVertices);
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
}
|
||||
@ -574,7 +573,6 @@ void CMiniMapTexture::RenderFinalTexture(
|
||||
m_AttributePos.format, stride, base + m_AttributePos.offset);
|
||||
shader->ColorPointer(
|
||||
m_AttributeColor.format, stride, base + m_AttributeColor.offset);
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->SetIndexBuffer(m_IndexArray.GetBuffer());
|
||||
deviceCommandContext->DrawIndexed(m_IndexArray.GetOffset(), m_EntitiesDrawn * 6, 0);
|
||||
|
@ -217,8 +217,6 @@ void CParticleEmitter::RenderArray(
|
||||
shader->ColorPointer(
|
||||
m_AttributeColor.format, stride, base + m_AttributeColor.offset);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->SetIndexBuffer(m_IndexArray.GetBuffer());
|
||||
deviceCommandContext->DrawIndexed(m_IndexArray.GetOffset(), m_Particles.size() * 6, 0);
|
||||
|
||||
|
@ -128,7 +128,6 @@ void DrawTexture(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
}
|
||||
|
@ -128,7 +128,6 @@ void CDebugRenderer::DrawLine(
|
||||
|
||||
debugLineShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
debugLineShader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
@ -180,7 +179,6 @@ void CDebugRenderer::DrawCircle(const CVector3D& origin, const float radius, con
|
||||
|
||||
debugCircleShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
debugCircleShader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
@ -257,7 +255,6 @@ void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& colo
|
||||
|
||||
overlayShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
overlayShader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
|
||||
vertices.clear();
|
||||
@ -276,7 +273,6 @@ void CDebugRenderer::DrawCameraFrustum(const CCamera& camera, const CColor& colo
|
||||
|
||||
overlayShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
overlayShader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
#undef ADD
|
||||
|
||||
@ -332,7 +328,6 @@ void CDebugRenderer::DrawBoundingBox(
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 3 * sizeof(float), data.data());
|
||||
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6*6);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
@ -379,7 +374,6 @@ void CDebugRenderer::DrawBrush(const CBrush& brush, const CColor& color, bool wi
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 3 * sizeof(float), data.data());
|
||||
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, data.size() / 5);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
|
@ -226,8 +226,6 @@ void CDecalRData::RenderDecals(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, stride, &base->m_UV[0]);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
if (lastIB != batch.indices->m_Owner)
|
||||
{
|
||||
lastIB = batch.indices->m_Owner;
|
||||
|
@ -243,8 +243,6 @@ void ShaderModelVertexRenderer::RenderModel(
|
||||
base + shadermodel->m_Normal.offset);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
// Render the lot.
|
||||
const size_t numberOfFaces = mdldef->GetNumFaces();
|
||||
|
||||
|
@ -369,8 +369,6 @@ void InstancingModelRenderer::PrepareModelDef(
|
||||
str_a_skinWeights, m->imodeldef->m_BlendWeights.format, GL_TRUE,
|
||||
stride, base + m->imodeldef->m_BlendWeights.offset);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,7 +579,6 @@ void OverlayRenderer::RenderQuadOverlays(
|
||||
if (streamflags & STREAM_COLOR)
|
||||
shader->ColorPointer(m->quadAttributeColor.format, vertexStride, vertexBase + m->quadAttributeColor.offset);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->DrawIndexed(m->quadIndices.GetOffset() + batchRenderData.m_IndicesBase, batchNumQuads * 6, 0);
|
||||
|
||||
g_Renderer.GetStats().m_DrawCalls++;
|
||||
|
@ -810,8 +810,6 @@ void CPatchRData::RenderBases(
|
||||
shader->TexCoordPointer(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32B32_SFLOAT, stride, &base->m_Position[0]);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
for (IndexBufferBatches::iterator it = itv->second.begin(); it != itv->second.end(); ++it)
|
||||
{
|
||||
it->first->UploadIfNeeded(deviceCommandContext);
|
||||
@ -1042,8 +1040,6 @@ void CPatchRData::RenderBlends(
|
||||
GL_TEXTURE1, Renderer::Backend::Format::R32G32_SFLOAT, stride, &base->m_AlphaUVs[0]);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
for (IndexBufferBatches::iterator it = itv->second.begin(); it != itv->second.end(); ++it)
|
||||
{
|
||||
it->first->UploadIfNeeded(deviceCommandContext);
|
||||
@ -1113,8 +1109,6 @@ void CPatchRData::RenderStreams(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32B32_SFLOAT, stride, &base->m_Position);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
for (const std::pair<CVertexBuffer* const, StreamBatchElements>& batchIndexBuffer : streamBatch.second)
|
||||
{
|
||||
batchIndexBuffer.first->UploadIfNeeded(deviceCommandContext);
|
||||
@ -1189,8 +1183,6 @@ void CPatchRData::RenderSides(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, stride, &base->m_Position);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(patch->m_VBSides->m_Index, (GLsizei)patch->m_VBSides->m_Count);
|
||||
|
||||
// bump stats
|
||||
@ -1452,8 +1444,6 @@ void CPatchRData::RenderWaterSurface(
|
||||
&base[m_VBWater->m_Index].m_WaterData);
|
||||
}
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->SetIndexBuffer(m_VBWaterIndices->m_Owner->GetBuffer());
|
||||
deviceCommandContext->DrawIndexed(m_VBWaterIndices->m_Index, m_VBWaterIndices->m_Count, 0);
|
||||
|
||||
@ -1484,8 +1474,6 @@ void CPatchRData::RenderWaterShore(
|
||||
str_a_waterInfo, Renderer::Backend::Format::R32G32_SFLOAT, false, stride,
|
||||
&base[m_VBWaterShore->m_Index].m_WaterData);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->SetIndexBuffer(m_VBWaterIndicesShore->m_Owner->GetBuffer());
|
||||
deviceCommandContext->DrawIndexed(m_VBWaterIndicesShore->m_Index, m_VBWaterIndicesShore->m_Count, 0);
|
||||
|
||||
|
@ -232,7 +232,6 @@ void CPostprocManager::ApplyBlurDownscale2x(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
g_Renderer.SetViewport(oldVp);
|
||||
@ -290,7 +289,6 @@ void CPostprocManager::ApplyBlurGauss(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
g_Renderer.SetViewport(oldVp);
|
||||
@ -319,7 +317,6 @@ void CPostprocManager::ApplyBlurGauss(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
g_Renderer.SetViewport(oldVp);
|
||||
@ -441,7 +438,6 @@ void CPostprocManager::ApplyEffect(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, quadTex);
|
||||
shader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, quadVerts);
|
||||
shader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
|
@ -753,7 +753,6 @@ void ShadowMap::RenderDebugTexture(
|
||||
Renderer::Backend::Format::R32G32_SFLOAT, 0, boxVerts);
|
||||
texShader->TexCoordPointer(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32_SFLOAT, 0, boxUV);
|
||||
texShader->AssertPointersBound();
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
|
||||
deviceCommandContext->EndPass();
|
||||
|
@ -244,7 +244,6 @@ void SkyManager::RenderSky(
|
||||
m_AttributePosition.format, stride, base + m_AttributePosition.offset);
|
||||
shader->TexCoordPointer(
|
||||
GL_TEXTURE0, m_AttributeUV.format, stride, base + m_AttributeUV.offset);
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, m_VertexArray.GetNumberOfVertices());
|
||||
|
||||
|
@ -231,7 +231,6 @@ void TerrainOverlay::RenderTile(
|
||||
|
||||
overlayShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
overlayShader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
|
||||
@ -300,7 +299,6 @@ void TerrainOverlay::RenderTileOutline(
|
||||
|
||||
overlayShader->VertexPointer(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, 0, vertices.data());
|
||||
overlayShader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, vertices.size() / 3);
|
||||
|
||||
|
@ -212,7 +212,6 @@ void TerrainRenderer::RenderTerrainOverlayTexture(
|
||||
Renderer::Backend::Format::R32G32B32_SFLOAT, stride, waterPos);
|
||||
debugOverlayShader->TexCoordPointer(
|
||||
GL_TEXTURE0, Renderer::Backend::Format::R32G32B32_SFLOAT, stride, waterPos);
|
||||
debugOverlayShader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->Draw(0, 6);
|
||||
}
|
||||
|
@ -68,8 +68,6 @@ void CTexturedLineRData::Render(
|
||||
if (streamFlags & STREAM_UV1)
|
||||
shader->TexCoordPointer(GL_TEXTURE1, Renderer::Backend::Format::R32G32_SFLOAT, stride, &vertexBase->m_UVs[0]);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
deviceCommandContext->SetIndexBuffer(m_VBIndices->m_Owner->GetBuffer());
|
||||
deviceCommandContext->DrawIndexed(m_VBIndices->m_Index, m_VBIndices->m_Count, 0);
|
||||
|
||||
|
@ -840,8 +840,6 @@ void WaterManager::RenderWaves(
|
||||
shader->VertexAttribPointer(
|
||||
str_a_retreatPosition, Renderer::Backend::Format::R32G32B32_SFLOAT, false, stride, &base[VBchunk->m_Index].m_RetreatPosition);
|
||||
|
||||
shader->AssertPointersBound();
|
||||
|
||||
shader->Uniform(str_translation, m_ShoreWaves[a]->m_TimeDiff);
|
||||
shader->Uniform(str_width, (int)m_ShoreWaves[a]->m_Width);
|
||||
|
||||
|
@ -792,6 +792,8 @@ void CDeviceCommandContext::Draw(
|
||||
// all drawing in that case.
|
||||
if (vertexCount == 0)
|
||||
return;
|
||||
static_cast<CShaderProgram*>(m_GraphicsPipelineStateDesc.shaderProgram)
|
||||
->AssertPointersBound();
|
||||
glDrawArrays(GL_TRIANGLES, firstVertex, vertexCount);
|
||||
}
|
||||
|
||||
@ -808,6 +810,8 @@ void CDeviceCommandContext::DrawIndexed(
|
||||
{
|
||||
ENSURE(sizeof(uint16_t) * (firstIndex + indexCount) <= m_IndexBuffer->GetSize());
|
||||
}
|
||||
static_cast<CShaderProgram*>(m_GraphicsPipelineStateDesc.shaderProgram)
|
||||
->AssertPointersBound();
|
||||
// Don't use glMultiDrawElements here since it doesn't have a significant
|
||||
// performance impact and it suffers from various driver bugs (e.g. it breaks
|
||||
// in Mesa 7.10 swrast with index VBOs).
|
||||
@ -826,6 +830,8 @@ void CDeviceCommandContext::DrawIndexedInRange(
|
||||
ENSURE(m_IndexBuffer || m_IndexBufferData);
|
||||
const void* indices =
|
||||
static_cast<const void*>((static_cast<const uint8_t*>(m_IndexBufferData) + sizeof(uint16_t) * firstIndex));
|
||||
static_cast<CShaderProgram*>(m_GraphicsPipelineStateDesc.shaderProgram)
|
||||
->AssertPointersBound();
|
||||
// Draw with DrawRangeElements where available, since it might be more
|
||||
// efficient for slow hardware.
|
||||
#if CONFIG2_GLES
|
||||
|
Loading…
Reference in New Issue
Block a user