diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-23 12:06:52 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-23 13:04:24 +0300 |
commit | 72e78df4640f1de4427b32bd3e51a394db326987 (patch) | |
tree | 3880da6261b8d17dee904dc59f86c9b43791e17a /source | |
parent | ed288a5786d66ae948b630cbc083fa9c8c9f0b89 (diff) |
GPUState: Expose Stencil mask and test
This is to be used by framebuffer clearing.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_state.h | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.cc | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 6a59baa38f0..e56df6d77a7 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -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); diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 1be3b06fa34..f8d753f9ee7 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -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; |