GPUState: Expose Stencil mask and test

This is to be used by framebuffer clearing.
This commit is contained in:
2020-08-23 11:06:52 +02:00
parent ed288a5786
commit 72e78df464
2 changed files with 22 additions and 0 deletions

View File

@@ -107,6 +107,7 @@ extern "C" {
void GPU_blend(eGPUBlend blend);
void GPU_face_culling(eGPUFaceCullTest culling);
void GPU_depth_test(eGPUDepthTest test);
void GPU_stencil_test(eGPUStencilTest test);
void GPU_provoking_vertex(eGPUProvokingVertex vert);
void GPU_front_facing(bool invert);
void GPU_depth_range(float near, float far);
@@ -145,6 +146,8 @@ void GPU_stencil_compare_mask_set(uint compare_mask);
eGPUBlend GPU_blend_get(void);
eGPUDepthTest GPU_depth_test_get(void);
eGPUWriteMask GPU_write_mask_get(void);
uint GPU_stencil_mask_get(void);
eGPUStencilTest GPU_stencil_test_get(void);
void GPU_flush(void);
void GPU_finish(void);

View File

@@ -79,6 +79,11 @@ void GPU_depth_test(eGPUDepthTest test)
SET_IMMUTABLE_STATE(depth_test, test);
}
void GPU_stencil_test(eGPUStencilTest test)
{
SET_IMMUTABLE_STATE(stencil_test, test);
}
void GPU_line_smooth(bool enable)
{
SET_IMMUTABLE_STATE(line_smooth, enable);
@@ -212,10 +217,12 @@ void GPU_stencil_reference_set(uint reference)
{
SET_MUTABLE_STATE(stencil_reference, (uint8_t)reference);
}
void GPU_stencil_write_mask_set(uint write_mask)
{
SET_MUTABLE_STATE(stencil_write_mask, (uint8_t)write_mask);
}
void GPU_stencil_compare_mask_set(uint compare_mask)
{
SET_MUTABLE_STATE(stencil_compare_mask, (uint8_t)compare_mask);
@@ -239,12 +246,24 @@ eGPUWriteMask GPU_write_mask_get()
return (eGPUWriteMask)state.write_mask;
}
uint GPU_stencil_mask_get()
{
GPUStateMutable &state = GPU_context_active_get()->state_manager->mutable_state;
return state.stencil_write_mask;
}
eGPUDepthTest GPU_depth_test_get()
{
GPUState &state = GPU_context_active_get()->state_manager->state;
return (eGPUDepthTest)state.depth_test;
}
eGPUStencilTest GPU_stencil_test_get()
{
GPUState &state = GPU_context_active_get()->state_manager->state;
return (eGPUStencilTest)state.stencil_test;
}
void GPU_scissor_get(int coords[4])
{
GPUStateMutable &state = GPU_context_active_get()->state_manager->mutable_state;