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>2018-04-08 19:31:21 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-04-08 19:31:50 +0300
commit9960feb7e39fa832edac79dd5130236c8fbd1b30 (patch)
tree58b7b0bf47fa0cc3046ba31159146a51b5452f30 /source/blender/gpu/intern/gpu_select_sample_query.c
parentfc6b69bedc96bb3a09385c3238d1221e7ee2e1b9 (diff)
GPU Select: Remove warnings on Intel GPU.
- Disable scissor test for fast clear. This could lead to some issues but I cannot think of one and could not find one either. - Manually wait for queries to be available instead of making the driver wait and issue warnings.
Diffstat (limited to 'source/blender/gpu/intern/gpu_select_sample_query.c')
-rw-r--r--source/blender/gpu/intern/gpu_select_sample_query.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_select_sample_query.c b/source/blender/gpu/intern/gpu_select_sample_query.c
index b8c3e164055..d9e8351c094 100644
--- a/source/blender/gpu/intern/gpu_select_sample_query.c
+++ b/source/blender/gpu/intern/gpu_select_sample_query.c
@@ -44,6 +44,8 @@
#include "BLI_utildefines.h"
+#include "PIL_time.h"
+
#include "gpu_select_private.h"
@@ -96,7 +98,7 @@ void gpu_select_query_begin(
g_query_state.id = MEM_mallocN(g_query_state.num_of_queries * sizeof(*g_query_state.id), "gpu selection ids");
glGenQueries(g_query_state.num_of_queries, g_query_state.queries);
- gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT);
+ gpuPushAttrib(GPU_DEPTH_BUFFER_BIT | GPU_VIEWPORT_BIT | GPU_SCISSOR_BIT);
/* disable writing to the framebuffer */
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
@@ -114,6 +116,7 @@ void gpu_select_query_begin(
glDepthMask(GL_FALSE);
}
else if (mode == GPU_SELECT_NEAREST_FIRST_PASS) {
+ glDisable(GL_SCISSOR_TEST); /* allows fast clear */
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
@@ -172,8 +175,21 @@ uint gpu_select_query_end(void)
glEndQuery(GL_SAMPLES_PASSED);
}
+ /* We need to sync to get the results anyway.
+ * If we don't do that the driver will do. */
+ glFinish();
+
for (i = 0; i < g_query_state.active_query; i++) {
- uint result;
+ uint result = 0;
+ /* Wait until the result is available. This can happen even if glFinish() was called. */
+ while (result == 0) {
+ glGetQueryObjectuiv(g_query_state.queries[i], GL_QUERY_RESULT_AVAILABLE, &result);
+ if (result == 0) {
+ /* (fclem) Not sure if this is better than calling
+ * glGetQueryObjectuiv() indefinitely. */
+ PIL_sleep_ms(1);
+ }
+ }
glGetQueryObjectuiv(g_query_state.queries[i], GL_QUERY_RESULT, &result);
if (result > 0) {
if (g_query_state.mode != GPU_SELECT_NEAREST_SECOND_PASS) {