llvmpipe: add support for ARB_indirect_parameters.
authorDave Airlie <airlied@redhat.com>
Mon, 23 Dec 2019 05:13:10 +0000 (15:13 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 9 Jan 2020 00:35:44 +0000 (10:35 +1000)
This just adds support for getting the draw count from the
indirect buffer.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3234>

.gitlab-ci/piglit/quick_gl.txt
docs/features.txt
src/gallium/auxiliary/util/u_draw.c
src/gallium/drivers/llvmpipe/lp_screen.c

index fb73a0685a2a18e67e622b012d79fa60b55e8a71..71b2bf168a627441d812d142964df76ae9e1c453 100644 (file)
@@ -498,9 +498,6 @@ spec/arb_get_program_binary/xfb-varyings: skip
 spec/arb_gpu_shader_fp64/execution/arb_gpu_shader_fp64-dlist-uniforms: skip
 spec/arb_gpu_shader_fp64/execution/arb_gpu_shader_fp64-fs-non-uniform-control-flow-ssbo: skip
 spec/arb_gpu_shader_fp64/execution/arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo: skip
-spec/arb_indirect_parameters/conditional-render: skip
-spec/arb_indirect_parameters/tf-count-arrays: skip
-spec/arb_indirect_parameters/tf-count-elements: skip
 spec/arb_internalformat_query/minmax: skip
 spec/arb_internalformat_query/misc. api error checks: skip
 spec/arb_pipeline_statistics_query/arb_pipeline_statistics_query-frag: fail
@@ -539,17 +536,6 @@ spec/arb_query_buffer_object/coherency/indirect-dispatch-gl_tess_evaluation_shad
 spec/arb_query_buffer_object/coherency/indirect-dispatch-gl_transform_feedback_primitives_written: skip
 spec/arb_query_buffer_object/coherency/indirect-dispatch-gl_vertex_shader_invocations: skip
 spec/arb_query_buffer_object/coherency/indirect-dispatch-gl_vertices_submitted: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_any_samples_passed: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_any_samples_passed_conservative: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_clipping_input_primitives: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_clipping_output_primitives: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_compute_shader_invocations: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_fragment_shader_invocations: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_geometry_shader_invocations: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_geometry_shader_primitives_emitted: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_primitives_generated: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_primitives_submitted: skip
-spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_samples_passed: skip
 spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_tess_control_shader_patches: skip
 spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_tess_evaluation_shader_invocations: skip
 spec/arb_query_buffer_object/coherency/indirect-draw-count-gl_time_elapsed: skip
@@ -2221,10 +2207,10 @@ wgl/wgl-sanity: skip
 summary:
        name:  results
        ----  --------
-       pass:    19302
+       pass:    19319
        fail:      236
       crash:        2
-       skip:     1962
+       skip:     1948
     timeout:        0
        warn:        2
  incomplete:        0
@@ -2233,4 +2219,4 @@ summary:
     changes:        0
       fixes:        0
 regressions:        0
-      total:    21522
+      total:    21525
index 055815f5394c309e75b80908aa952d2f87a6ecc7..c1d24f3a7fec36b80e0064339fa44d554fd1c13f 100644 (file)
@@ -227,7 +227,7 @@ GL 4.5, GLSL 4.50 -- all DONE: nvc0, radeonsi, r600
 GL 4.6, GLSL 4.60 -- all DONE: radeonsi
 
   GL_ARB_gl_spirv                                       DONE (i965/gen7+)
-  GL_ARB_indirect_parameters                            DONE (i965/gen7+, nvc0, virgl)
+  GL_ARB_indirect_parameters                            DONE (i965/gen7+, nvc0, llvmpipe, virgl)
   GL_ARB_pipeline_statistics_query                      DONE (i965, nvc0, r600, llvmpipe, softpipe, swr)
   GL_ARB_polygon_offset_clamp                           DONE (freedreno, i965, nv50, nvc0, r600, llvmpipe, swr, virgl)
   GL_ARB_shader_atomic_counter_ops                      DONE (freedreno/a5xx+, i965/gen7+, nvc0, r600, llvmpipe, softpipe, virgl)
index 4627d2bdbc4c7ee9358b04afc6238435df516863..a2ce0e3948317e5fd7a3d3d04d31ef76dd6e2cbc 100644 (file)
@@ -143,6 +143,23 @@ util_draw_indirect(struct pipe_context *pipe,
 
    memcpy(&info, info_in, sizeof(info));
 
+   uint32_t draw_count = info_in->indirect->draw_count;
+
+   if (info_in->indirect->indirect_draw_count) {
+      struct pipe_transfer *dc_transfer;
+      uint32_t *dc_param = pipe_buffer_map_range(pipe,
+                                                 info_in->indirect->indirect_draw_count,
+                                                 info_in->indirect->indirect_draw_count_offset,
+                                                 4, PIPE_TRANSFER_READ, &dc_transfer);
+      if (!dc_transfer) {
+         debug_printf("%s: failed to map indirect draw count buffer\n", __FUNCTION__);
+         return;
+      }
+      if (dc_param[0] < draw_count)
+         draw_count = dc_param[0];
+      pipe_buffer_unmap(pipe, dc_transfer);
+   }
+
    params = (uint32_t *)
       pipe_buffer_map_range(pipe,
                             info_in->indirect->buffer,
@@ -155,7 +172,7 @@ util_draw_indirect(struct pipe_context *pipe,
       return;
    }
 
-   for (unsigned i = 0; i < info_in->indirect->draw_count; i++) {
+   for (unsigned i = 0; i < draw_count; i++) {
       info.count = params[0];
       info.instance_count = params[1];
       info.start = params[2];
index a96901f860e3fbba5f29b1418405c2dff2a8e7e6..8d167b99d32eb711e989fbd3d0fd729a68f4a54a 100644 (file)
@@ -328,6 +328,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_DRAW_PARAMETERS:
       return 1;
    case PIPE_CAP_MULTI_DRAW_INDIRECT:
+   case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
       return 1;
    case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
    case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
@@ -338,7 +339,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_FORCE_PERSAMPLE_INTERP:
    case PIPE_CAP_SHAREABLE_SHADERS:
    case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
-   case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS:
    case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
    case PIPE_CAP_INVALIDATE_BUFFER:
    case PIPE_CAP_GENERATE_MIPMAP: