virgl: fix command args buffers

When I added indirect draw support, I forgot to add support
for the binding flag for command args, we need this later,
but in order to introduce support without breaking things,
we should fix the bug first and add a separate cap for it.

Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Dave Airlie 6 years ago
parent 660a02af5a
commit 479a6eb4e0
  1. 2
      src/virgl_hw.h
  2. 9
      src/vrend_renderer.c

@ -241,6 +241,7 @@ enum virgl_formats {
#define VIRGL_CAP_TRANSFER (1 << 17)
#define VIRGL_CAP_FBO_MIXED_COLOR_FORMATS (1 << 18)
#define VIRGL_CAP_FAKE_FP64 (1 << 19)
#define VIRGL_CAP_BIND_COMMAND_ARGS (1 << 20)
/* virgl bind flags - these are compatible with mesa 10.5 gallium.
* but are fixed, no other should be passed to virgl either.
@ -252,6 +253,7 @@ enum virgl_formats {
#define VIRGL_BIND_INDEX_BUFFER (1 << 5)
#define VIRGL_BIND_CONSTANT_BUFFER (1 << 6)
#define VIRGL_BIND_DISPLAY_TARGET (1 << 7)
#define VIRGL_BIND_COMMAND_ARGS (1 << 8)
#define VIRGL_BIND_STREAM_OUTPUT (1 << 11)
#define VIRGL_BIND_SHADER_BUFFER (1 << 14)
#define VIRGL_BIND_QUERY_BUFFER (1 << 15)

@ -5758,6 +5758,7 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
args->bind == VIRGL_BIND_VERTEX_BUFFER ||
args->bind == VIRGL_BIND_CONSTANT_BUFFER ||
args->bind == VIRGL_BIND_QUERY_BUFFER ||
args->bind == VIRGL_BIND_COMMAND_ARGS ||
args->bind == VIRGL_BIND_SHADER_BUFFER) {
if (args->target != PIPE_BUFFER)
return -1;
@ -5765,6 +5766,8 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
return -1;
if (args->bind == VIRGL_BIND_QUERY_BUFFER && !has_feature(feat_qbo))
return -1;
if (args->bind == VIRGL_BIND_COMMAND_ARGS && !has_feature(feat_indirect_draw))
return -1;
} else {
if (!((args->bind & VIRGL_BIND_SAMPLER_VIEW) ||
(args->bind & VIRGL_BIND_DEPTH_STENCIL) ||
@ -6010,6 +6013,9 @@ int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *a
} else if (args->bind == VIRGL_BIND_QUERY_BUFFER) {
gr->target = GL_QUERY_BUFFER;
vrend_create_buffer(gr, args->width);
} else if (args->bind == VIRGL_BIND_COMMAND_ARGS) {
gr->target = GL_DRAW_INDIRECT_BUFFER;
vrend_create_buffer(gr, args->width);
} else if (args->target == PIPE_BUFFER && (args->bind == 0 || args->bind == VIRGL_BIND_SHADER_BUFFER)) {
gr->target = GL_ARRAY_BUFFER_ARB;
vrend_create_buffer(gr, args->width);
@ -8713,6 +8719,9 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver, union virgl_c
/* We want to expose ARB_gpu_shader_fp64 when running on top of ES */
if (vrend_state.use_gles)
caps->v2.capability_bits |= VIRGL_CAP_FAKE_FP64;
if (has_feature(feat_indirect_draw))
caps->v2.capability_bits |= VIRGL_CAP_BIND_COMMAND_ARGS;
}
void vrend_renderer_fill_caps(uint32_t set, UNUSED uint32_t version,

Loading…
Cancel
Save