Switch to use a single triangle when drawing screen quads for a slight cache locality improvement

This commit is contained in:
Magnus Norddahl 2020-08-18 11:42:50 +02:00
parent 0f86f3a62a
commit 8306af298f
3 changed files with 5 additions and 5 deletions

View file

@ -49,7 +49,7 @@ void FGLRenderer::RenderScreenQuad()
{
auto buffer = static_cast<GLVertexBuffer *>(screen->mVertexData->GetBufferObjects().first);
buffer->Bind(nullptr);
glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 4);
glDrawArrays(GL_TRIANGLE_STRIP, FFlatVertexBuffer::PRESENT_INDEX, 3);
}
void FGLRenderer::PostProcessScene(int fixedcm, float flash, const std::function<void()> &afterBloomDrawEndScene2D)

View file

@ -63,9 +63,9 @@ FFlatVertexBuffer::FFlatVertexBuffer(int width, int height)
// and this is for the postprocessing copy operation
vbo_shadowdata[8].Set(-1.0f, -1.0f, 0, 0.0f, 0.0f);
vbo_shadowdata[9].Set(-1.0f, 1.0f, 0, 0.0f, 1.f);
vbo_shadowdata[10].Set(1.0f, -1.0f, 0, 1.f, 0.0f);
vbo_shadowdata[11].Set(1.0f, 1.0f, 0, 1.f, 1.f);
vbo_shadowdata[9].Set(3.0f, -1.0f, 0, 2.f, 0.0f);
vbo_shadowdata[10].Set(-1.0f, 3.0f, 0, 0.0f, 2.f);
vbo_shadowdata[11].Set(3.0f, 3.0f, 0, 2.f, 2.f); // Note: not used anymore
// The next two are the stencil caps.
vbo_shadowdata[12].Set(-32767.0f, 32767.0f, -32767.0f, 0, 0);

View file

@ -565,7 +565,7 @@ void VkPPRenderState::RenderScreenQuad(VkPPRenderPassSetup *passSetup, VulkanDes
cmdbuffer->setStencilReference(VK_STENCIL_FRONT_AND_BACK, screen->stencilValue);
if (pushConstantsSize > 0)
cmdbuffer->pushConstants(passSetup->PipelineLayout.get(), VK_SHADER_STAGE_FRAGMENT_BIT, 0, pushConstantsSize, pushConstants);
cmdbuffer->draw(4, 1, FFlatVertexBuffer::PRESENT_INDEX, 0);
cmdbuffer->draw(3, 1, FFlatVertexBuffer::PRESENT_INDEX, 0);
cmdbuffer->endRenderPass();
}