features: add transform_feedback3 feature

this blocks access to indexed queries if tf3 isn't enabled.

Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
macos/master
Dave Airlie 7 years ago
parent 6ff41a300c
commit 87d86715be
  1. 6
      src/vrend_decode.c
  2. 27
      src/vrend_renderer.c
  3. 4
      src/vrend_renderer.h

@ -977,8 +977,7 @@ static int vrend_decode_begin_query(struct vrend_decode_ctx *ctx, int length)
uint32_t handle = get_buf_entry(ctx, VIRGL_QUERY_BEGIN_HANDLE);
vrend_begin_query(ctx->grctx, handle);
return 0;
return vrend_begin_query(ctx->grctx, handle);
}
static int vrend_decode_end_query(struct vrend_decode_ctx *ctx, int length)
@ -988,8 +987,7 @@ static int vrend_decode_end_query(struct vrend_decode_ctx *ctx, int length)
uint32_t handle = get_buf_entry(ctx, VIRGL_QUERY_END_HANDLE);
vrend_end_query(ctx->grctx, handle);
return 0;
return vrend_end_query(ctx->grctx, handle);
}
static int vrend_decode_get_query_result(struct vrend_decode_ctx *ctx, int length)

@ -113,6 +113,7 @@ enum features_id
feat_texture_storage,
feat_texture_view,
feat_transform_feedback2,
feat_transform_feedback3,
feat_last,
};
@ -4638,6 +4639,10 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs, uint32_t flags)
set_feature(feat_transform_feedback2);
}
if (gl_ver >= 40 ||
epoxy_has_gl_extension("GL_ARB_transform_feedback3"))
set_feature(feat_transform_feedback3);
if (epoxy_has_gl_extension("GL_ARB_stencil_texturing"))
set_feature(feat_stencil_texturing);
if ((gles && gl_ver >= 30) ||
@ -7109,29 +7114,36 @@ static void vrend_destroy_query_object(void *obj_ptr)
vrend_destroy_query(query);
}
void vrend_begin_query(struct vrend_context *ctx, uint32_t handle)
int vrend_begin_query(struct vrend_context *ctx, uint32_t handle)
{
struct vrend_query *q;
q = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_QUERY);
if (!q)
return;
return EINVAL;
if (q->index > 0 && !has_feature(feat_transform_feedback3))
return EINVAL;
if (q->gltype == GL_TIMESTAMP)
return;
return 0;
if (q->index > 0)
glBeginQueryIndexed(q->gltype, q->index, q->id);
else
glBeginQuery(q->gltype, q->id);
return 0;
}
void vrend_end_query(struct vrend_context *ctx, uint32_t handle)
int vrend_end_query(struct vrend_context *ctx, uint32_t handle)
{
struct vrend_query *q;
q = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_QUERY);
if (!q)
return;
return EINVAL;
if (q->index > 0 && !has_feature(feat_transform_feedback3))
return EINVAL;
if (vrend_is_timer_query(q->gltype)) {
if (vrend_state.use_gles && q->gltype == GL_TIMESTAMP) {
@ -7142,13 +7154,14 @@ void vrend_end_query(struct vrend_context *ctx, uint32_t handle)
/* remove from active query list for this context */
glEndQuery(q->gltype);
}
return;
return 0;
}
if (q->index > 0)
glEndQueryIndexed(q->gltype, q->index);
else
glEndQuery(q->gltype);
return 0;
}
void vrend_get_query_result(struct vrend_context *ctx, uint32_t handle,
@ -7686,7 +7699,7 @@ void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
caps->v1.bset.streamout_pause_resume = 1;
}
if (epoxy_has_gl_extension("GL_ARB_transform_feedback3")) {
if (has_feature(feat_transform_feedback3)) {
glGetIntegerv(GL_MAX_TRANSFORM_FEEDBACK_BUFFERS, &max);
caps->v1.max_streamout_buffers = max;
} else if (epoxy_has_gl_extension("GL_EXT_transform_feedback")) {

@ -311,8 +311,8 @@ int vrend_create_query(struct vrend_context *ctx, uint32_t handle,
uint32_t query_type, uint32_t query_index,
uint32_t res_handle, uint32_t offset);
void vrend_begin_query(struct vrend_context *ctx, uint32_t handle);
void vrend_end_query(struct vrend_context *ctx, uint32_t handle);
int vrend_begin_query(struct vrend_context *ctx, uint32_t handle);
int vrend_end_query(struct vrend_context *ctx, uint32_t handle);
void vrend_get_query_result(struct vrend_context *ctx, uint32_t handle,
uint32_t wait);
void vrend_render_condition(struct vrend_context *ctx,

Loading…
Cancel
Save