From 3080194ae41128e91da59301a7e221303a2f04a5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 30 Sep 2020 19:20:19 +0200 Subject: rhi: gl: Attempt to reduce superfluous texture unit bindings Change-Id: Iccfbe5fe8688245a5ff3f7d46a173638b362a3c8 Reviewed-by: Andy Nichols --- src/gui/rhi/qrhigles2_p_p.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gui/rhi/qrhigles2_p_p.h') diff --git a/src/gui/rhi/qrhigles2_p_p.h b/src/gui/rhi/qrhigles2_p_p.h index 65fb820a36..c380f3bc08 100644 --- a/src/gui/rhi/qrhigles2_p_p.h +++ b/src/gui/rhi/qrhigles2_p_p.h @@ -577,6 +577,12 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer } } computePassState; + struct TextureUnitState { + void *ps; + uint psGeneration; + uint texture; + } textureUnitState[16]; + QVarLengthArray dataRetainPool; QVarLengthArray bufferDataRetainPool; QVarLengthArray imageRetainPool; @@ -618,6 +624,7 @@ struct QGles2CommandBuffer : public QRhiCommandBuffer currentSrbGeneration = 0; graphicsPassState.reset(); computePassState.reset(); + memset(textureUnitState, 0, sizeof(textureUnitState)); } }; @@ -807,7 +814,8 @@ public: QRhiPassResourceTracker::TextureStage stage); void executeCommandBuffer(QRhiCommandBuffer *cb); void executeBindGraphicsPipeline(QGles2CommandBuffer *cbD, QGles2GraphicsPipeline *psD); - void bindShaderResources(QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs, + void bindShaderResources(QGles2CommandBuffer *cbD, + QRhiGraphicsPipeline *maybeGraphicsPs, QRhiComputePipeline *maybeComputePs, QRhiShaderResourceBindings *srb, const uint *dynOfsPairs, int dynOfsCount); QGles2RenderTargetData *enqueueBindFramebuffer(QRhiRenderTarget *rt, QGles2CommandBuffer *cbD, -- cgit v1.2.3