Skip to content

Commit 71c5c4a

Browse files
committed
RenderPass setters should cache state.
1 parent cec2538 commit 71c5c4a

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

Sources/ObjectivelyGPU/RenderPass.h

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ struct RenderPass {
6565
*/
6666
RenderPassInterface *interface;
6767

68+
/**
69+
* @brief The current blend constants.
70+
*/
71+
SDL_FColor blendConstants;
72+
6873
/**
6974
* @brief The CommandBuffer this pass was begun from.
7075
* @private
@@ -79,9 +84,24 @@ struct RenderPass {
7984
SDL_GPURenderPass *pass;
8085

8186
/**
82-
* @brief The currently bound pipeline, or `NULL`.
87+
* @brief The currentl pipeline, or `NULL`.
8388
*/
8489
SDL_GPUGraphicsPipeline *pipeline;
90+
91+
/**
92+
* @brief The current scissor.
93+
*/
94+
SDL_Rect scissor;
95+
96+
/**
97+
* @brief The current stencil reference.
98+
*/
99+
Uint8 stencilReference;
100+
101+
/**
102+
* @brief The current viewport.
103+
*/
104+
SDL_GPUViewport viewport;
85105
};
86106

87107
/**
@@ -197,32 +217,32 @@ struct RenderPassInterface {
197217
RenderPass *(*init)(RenderPass *self, CommandBuffer *commands, SDL_GPURenderPass *pass);
198218

199219
/**
200-
* @fn void RenderPass::setBlendConstants(const RenderPass *self, SDL_FColor blendConstants)
220+
* @fn void RenderPass::setBlendConstants(RenderPass *self, SDL_FColor blendConstants)
201221
* @brief Sets the blend constants used by `SDL_GPU_BLENDFACTOR_CONSTANT_*` factors.
202222
* @memberof RenderPass
203223
*/
204-
void (*setBlendConstants)(const RenderPass *self, SDL_FColor blendConstants);
224+
void (*setBlendConstants)(RenderPass *self, SDL_FColor blendConstants);
205225

206226
/**
207-
* @fn void RenderPass::setScissor(const RenderPass *self, const SDL_Rect *scissor)
227+
* @fn void RenderPass::setScissor(RenderPass *self, const SDL_Rect *scissor)
208228
* @brief Sets the scissor rectangle. Pass NULL to reset to the full viewport.
209229
* @memberof RenderPass
210230
*/
211-
void (*setScissor)(const RenderPass *self, const SDL_Rect *scissor);
231+
void (*setScissor)(RenderPass *self, const SDL_Rect *scissor);
212232

213233
/**
214-
* @fn void RenderPass::setStencilReference(const RenderPass *self, Uint8 reference)
234+
* @fn void RenderPass::setStencilReference(RenderPass *self, Uint8 reference)
215235
* @brief Sets the stencil reference value used in stencil tests.
216236
* @memberof RenderPass
217237
*/
218-
void (*setStencilReference)(const RenderPass *self, Uint8 reference);
238+
void (*setStencilReference)(RenderPass *self, Uint8 reference);
219239

220240
/**
221-
* @fn void RenderPass::setViewport(const RenderPass *self, const SDL_GPUViewport *viewport)
241+
* @fn void RenderPass::setViewport(RenderPass *self, const SDL_GPUViewport *viewport)
222242
* @brief Sets the viewport. Pass NULL to reset to the full render target.
223243
* @memberof RenderPass
224244
*/
225-
void (*setViewport)(const RenderPass *self, const SDL_GPUViewport *viewport);
245+
void (*setViewport)(RenderPass *self, const SDL_GPUViewport *viewport);
226246
};
227247

228248
/**

0 commit comments

Comments
 (0)