From: Dave Airlie Date: Mon, 23 Dec 2019 05:13:10 +0000 (+1000) Subject: llvmpipe: add support for ARB_indirect_parameters. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ee9879335e6c798dff4cacef9096265912268ce4;p=mesa.git llvmpipe: add support for ARB_indirect_parameters. This just adds support for getting the draw count from the indirect buffer. Reviewed-by: Roland Scheidegger Tested-by: Marge Bot Part-of: --- diff --git a/.gitlab-ci/piglit/quick_gl.txt b/.gitlab-ci/piglit/quick_gl.txt index fb73a0685a2..71b2bf168a6 100644 --- a/.gitlab-ci/piglit/quick_gl.txt +++ b/.gitlab-ci/piglit/quick_gl.txt @@ -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 diff --git a/docs/features.txt b/docs/features.txt index 055815f5394..c1d24f3a7fe 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -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) diff --git a/src/gallium/auxiliary/util/u_draw.c b/src/gallium/auxiliary/util/u_draw.c index 4627d2bdbc4..a2ce0e39483 100644 --- a/src/gallium/auxiliary/util/u_draw.c +++ b/src/gallium/auxiliary/util/u_draw.c @@ -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]; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index a96901f860e..8d167b99d32 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -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: