summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharmaine Lee <[email protected]>2016-04-19 18:12:17 -0700
committerBrian Paul <[email protected]>2016-04-25 12:59:29 -0600
commit676931640fe6c97f6a5702196c39f8de36b22a64 (patch)
tree3e99cae951f1cddd942aab6f24ae25decc01210a
parentd7a6c1a4769774a0a86cc75090d5d3089f248a7d (diff)
svga: fix assert with PIPE_QUERY_OCCLUSION_PREDICATE for non-vgpu10
With this patch, when running in hardware version 11, we'll use SVGA3D_QUERYTYPE_OCCLUSION query type for PIPE_QUERY_OCCLUSION_PREDICATE and return TRUE if samples-passed count is greater than 0. Fixes glretrace/solidworks2012_viewport running in hardware version 11. Reviewed-by: Brian Paul <[email protected]>
-rw-r--r--src/gallium/drivers/svga/svga_pipe_query.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c
index c7eb3f63e58..c1bd8ec3a0d 100644
--- a/src/gallium/drivers/svga/svga_pipe_query.c
+++ b/src/gallium/drivers/svga/svga_pipe_query.c
@@ -705,9 +705,13 @@ svga_create_query(struct pipe_context *pipe,
}
break;
case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
- define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionPredicateQueryResult));
+ if (svga_have_vgpu10(svga)) {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSIONPREDICATE;
+ define_query_vgpu10(svga, sq, sizeof(SVGADXOcclusionPredicateQueryResult));
+ } else {
+ sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION;
+ define_query_vgpu9(svga, sq);
+ }
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
@@ -777,6 +781,7 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
/* make sure to also destroy any associated predicate query */
if (sq->predicate)
@@ -787,11 +792,6 @@ svga_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
}
sws->fence_reference(sws, &sq->fence, NULL);
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- destroy_query_vgpu10(svga, sq);
- sws->fence_reference(sws, &sq->fence, NULL);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -854,6 +854,7 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
ret = begin_query_vgpu10(svga, sq);
/* also need to start the associated occlusion predicate query */
@@ -869,11 +870,6 @@ svga_begin_query(struct pipe_context *pipe, struct pipe_query *q)
assert(ret == PIPE_OK);
(void) ret;
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- ret = begin_query_vgpu10(svga, sq);
- assert(ret == PIPE_OK);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -967,6 +963,7 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
switch (sq->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
+ case PIPE_QUERY_OCCLUSION_PREDICATE:
if (svga_have_vgpu10(svga)) {
ret = end_query_vgpu10(svga, sq);
/* also need to end the associated occlusion predicate query */
@@ -987,11 +984,6 @@ svga_end_query(struct pipe_context *pipe, struct pipe_query *q)
*/
svga_context_flush(svga, NULL);
break;
- case PIPE_QUERY_OCCLUSION_PREDICATE:
- assert(svga_have_vgpu10(svga));
- ret = end_query_vgpu10(svga, sq);
- assert(ret == PIPE_OK);
- break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
case PIPE_QUERY_SO_STATISTICS:
@@ -1090,11 +1082,16 @@ svga_get_query_result(struct pipe_context *pipe,
}
break;
case PIPE_QUERY_OCCLUSION_PREDICATE: {
- SVGADXOcclusionPredicateQueryResult occResult;
- assert(svga_have_vgpu10(svga));
- ret = get_query_result_vgpu10(svga, sq, wait,
- (void *)&occResult, sizeof(occResult));
- vresult->b = occResult.anySamplesRendered != 0;
+ if (svga_have_vgpu10(svga)) {
+ SVGADXOcclusionPredicateQueryResult occResult;
+ ret = get_query_result_vgpu10(svga, sq, wait,
+ (void *)&occResult, sizeof(occResult));
+ vresult->b = occResult.anySamplesRendered != 0;
+ } else {
+ uint64_t count;
+ ret = get_query_result_vgpu9(svga, sq, wait, (uint64_t *)&count);
+ vresult->b = count != 0;
+ }
break;
}
case PIPE_QUERY_SO_STATISTICS: {