Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-08-20 17:38:34 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-08-20 18:02:39 +0300
commite23ef8753a46573bd3cbe4adfd4f49363ad7467e (patch)
tree33890b11571ad0632e76fbb8098454b2e0049ef5 /source/blender/gpu/intern
parentc85144934a7df525367e2b0db32038dc0a248797 (diff)
GPUState: Use explicit depth test enum
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_select_pick.c4
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.c4
-rw-r--r--source/blender/gpu/intern/gpu_state.cc9
3 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c
index 29e2615345c..c1a91490f5e 100644
--- a/source/blender/gpu/intern/gpu_select_pick.c
+++ b/source/blender/gpu/intern/gpu_select_pick.c
@@ -287,7 +287,7 @@ typedef struct GPUPickState {
int viewport[4];
int scissor[4];
eGPUWriteMask write_mask;
- bool depth_test;
+ eGPUDepthTest depth_test;
} GPUPickState;
static GPUPickState g_pick_state = {0};
@@ -311,7 +311,7 @@ void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, c
/* Restrict OpenGL operations for when we don't have cache */
if (ps->is_cached == false) {
ps->write_mask = GPU_write_mask_get();
- ps->depth_test = GPU_depth_test_enabled();
+ ps->depth_test = GPU_depth_test_get();
GPU_scissor_get(ps->scissor);
/* disable writing to the framebuffer */
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index 62414febb44..334f4ba927a 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -65,7 +65,7 @@ typedef struct GPUQueryState {
int viewport[4];
int scissor[4];
eGPUWriteMask write_mask;
- bool depth_test;
+ eGPUDepthTest depth_test;
} GPUQueryState;
static GPUQueryState g_query_state = {0};
@@ -91,7 +91,7 @@ void gpu_select_query_begin(
glGenQueries(g_query_state.num_of_queries, g_query_state.queries);
g_query_state.write_mask = GPU_write_mask_get();
- g_query_state.depth_test = GPU_depth_test_enabled();
+ g_query_state.depth_test = GPU_depth_test_get();
GPU_scissor_get(g_query_state.scissor);
/* disable writing to the framebuffer */
diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc
index 2c09773e8f5..1be3b06fa34 100644
--- a/source/blender/gpu/intern/gpu_state.cc
+++ b/source/blender/gpu/intern/gpu_state.cc
@@ -74,10 +74,9 @@ void GPU_provoking_vertex(eGPUProvokingVertex vert)
SET_IMMUTABLE_STATE(provoking_vert, vert);
}
-/* TODO explicit depth test. */
-void GPU_depth_test(bool enable)
+void GPU_depth_test(eGPUDepthTest test)
{
- SET_IMMUTABLE_STATE(depth_test, (enable) ? GPU_DEPTH_LESS_EQUAL : GPU_DEPTH_NONE);
+ SET_IMMUTABLE_STATE(depth_test, test);
}
void GPU_line_smooth(bool enable)
@@ -240,10 +239,10 @@ eGPUWriteMask GPU_write_mask_get()
return (eGPUWriteMask)state.write_mask;
}
-bool GPU_depth_test_enabled()
+eGPUDepthTest GPU_depth_test_get()
{
GPUState &state = GPU_context_active_get()->state_manager->state;
- return state.depth_test != GPU_DEPTH_NONE;
+ return (eGPUDepthTest)state.depth_test;
}
void GPU_scissor_get(int coords[4])