From: Dave Airlie Date: Mon, 23 Mar 2020 05:07:11 +0000 (+1000) Subject: draw: add support for num_samples + sample_stride to the image paths X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc3641d6162c0e876351ee36536f44581260dac0;p=mesa.git draw: add support for num_samples + sample_stride to the image paths Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index 5d5a91c0f2c..b93bc6bf56f 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -1193,7 +1193,9 @@ draw_set_mapped_image(struct draw_context *draw, uint32_t width, uint32_t height, uint32_t depth, const void *base_ptr, uint32_t row_stride, - uint32_t img_stride) + uint32_t img_stride, + uint32_t num_samples, + uint32_t sample_stride) { #ifdef LLVM_AVAILABLE if (draw->llvm) @@ -1202,7 +1204,8 @@ draw_set_mapped_image(struct draw_context *draw, idx, width, height, depth, base_ptr, - row_stride, img_stride); + row_stride, img_stride, + num_samples, sample_stride); #endif } diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index d0dc7688cf0..5919c8f2214 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -212,7 +212,9 @@ draw_set_mapped_image(struct draw_context *draw, uint32_t width, uint32_t height, uint32_t depth, const void *base_ptr, uint32_t row_stride, - uint32_t img_stride); + uint32_t img_stride, + uint32_t num_samples, + uint32_t sample_stride); /* * Vertex shader functions diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 303e377ffae..06bb4456521 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -260,7 +260,9 @@ create_jit_image_type(struct gallivm_state *gallivm, const char *struct_name) elem_types[DRAW_JIT_IMAGE_HEIGHT] = elem_types[DRAW_JIT_IMAGE_DEPTH] = elem_types[DRAW_JIT_IMAGE_ROW_STRIDE] = - elem_types[DRAW_JIT_IMAGE_IMG_STRIDE] = int32_type; + elem_types[DRAW_JIT_IMAGE_IMG_STRIDE] = + elem_types[DRAW_JIT_IMAGE_NUM_SAMPLES] = + elem_types[DRAW_JIT_IMAGE_SAMPLE_STRIDE] = int32_type; elem_types[DRAW_JIT_IMAGE_BASE] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); @@ -286,6 +288,12 @@ create_jit_image_type(struct gallivm_state *gallivm, const char *struct_name) LP_CHECK_MEMBER_OFFSET(struct draw_jit_image, img_stride, target, image_type, DRAW_JIT_IMAGE_IMG_STRIDE); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_image, num_samples, + target, image_type, + DRAW_JIT_IMAGE_NUM_SAMPLES); + LP_CHECK_MEMBER_OFFSET(struct draw_jit_image, sample_stride, + target, image_type, + DRAW_JIT_IMAGE_SAMPLE_STRIDE); LP_CHECK_STRUCT_SIZE(struct draw_jit_image, target, image_type); @@ -2467,7 +2475,9 @@ draw_llvm_set_mapped_image(struct draw_context *draw, uint32_t width, uint32_t height, uint32_t depth, const void *base_ptr, uint32_t row_stride, - uint32_t img_stride) + uint32_t img_stride, + uint32_t num_samples, + uint32_t sample_stride) { struct draw_jit_image *jit_image; @@ -2500,6 +2510,8 @@ draw_llvm_set_mapped_image(struct draw_context *draw, jit_image->row_stride = row_stride; jit_image->img_stride = img_stride; + jit_image->num_samples = num_samples; + jit_image->sample_stride = sample_stride; } diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 51a2bd53d49..d327e542afb 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -97,6 +97,8 @@ struct draw_jit_image const void *base; uint32_t row_stride; uint32_t img_stride; + uint32_t num_samples; + uint32_t sample_stride; }; enum { @@ -137,6 +139,8 @@ enum { DRAW_JIT_IMAGE_BASE, DRAW_JIT_IMAGE_ROW_STRIDE, DRAW_JIT_IMAGE_IMG_STRIDE, + DRAW_JIT_IMAGE_NUM_SAMPLES, + DRAW_JIT_IMAGE_SAMPLE_STRIDE, DRAW_JIT_IMAGE_NUM_FIELDS /* number of fields above */ }; @@ -915,5 +919,7 @@ draw_llvm_set_mapped_image(struct draw_context *draw, uint32_t width, uint32_t height, uint32_t depth, const void *base_ptr, uint32_t row_stride, - uint32_t img_stride); + uint32_t img_stride, + uint32_t num_samples, + uint32_t sample_stride); #endif diff --git a/src/gallium/auxiliary/draw/draw_llvm_sample.c b/src/gallium/auxiliary/draw/draw_llvm_sample.c index 0a8f345280c..a30ebf5eabd 100644 --- a/src/gallium/auxiliary/draw/draw_llvm_sample.c +++ b/src/gallium/auxiliary/draw/draw_llvm_sample.c @@ -290,6 +290,8 @@ DRAW_LLVM_IMAGE_MEMBER(depth, DRAW_JIT_IMAGE_DEPTH, TRUE) DRAW_LLVM_IMAGE_MEMBER(base_ptr, DRAW_JIT_IMAGE_BASE, TRUE) DRAW_LLVM_IMAGE_MEMBER(row_stride, DRAW_JIT_IMAGE_ROW_STRIDE, TRUE) DRAW_LLVM_IMAGE_MEMBER(img_stride, DRAW_JIT_IMAGE_IMG_STRIDE, TRUE) +DRAW_LLVM_IMAGE_MEMBER(num_samples, DRAW_JIT_IMAGE_NUM_SAMPLES, TRUE) +DRAW_LLVM_IMAGE_MEMBER(sample_stride, DRAW_JIT_IMAGE_SAMPLE_STRIDE, TRUE) static void draw_llvm_sampler_soa_destroy(struct lp_build_sampler_soa *sampler) @@ -427,6 +429,8 @@ draw_llvm_image_soa_create(const struct draw_image_static_state *static_state) image->dynamic_state.base.base_ptr = draw_llvm_image_base_ptr; image->dynamic_state.base.row_stride = draw_llvm_image_row_stride; image->dynamic_state.base.img_stride = draw_llvm_image_img_stride; + image->dynamic_state.base.num_samples = draw_llvm_image_num_samples; + image->dynamic_state.base.sample_stride = draw_llvm_image_sample_stride; image->dynamic_state.static_state = static_state; diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 73f6617dbc5..65342e80eae 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -471,7 +471,7 @@ prepare_shader_images( i, width, height, num_layers, addr, - row_stride, img_stride); + row_stride, img_stride, 0, 0); } } } diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 4216b84b032..c70599a10c7 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -417,7 +417,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, } draw_set_mapped_image(draw, PIPE_SHADER_VERTEX, i, width, height, - num_layers, addr, row_stride, img_stride); + num_layers, addr, row_stride, img_stride, 0, 0); } draw_set_images(draw, PIPE_SHADER_VERTEX, images, prog->info.num_images); @@ -446,7 +446,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, /* unmap images */ for (unsigned i = 0; i < prog->info.num_images; i++) { if (img_transfer[i]) { - draw_set_mapped_image(draw, PIPE_SHADER_VERTEX, i, 0, 0, 0, NULL, 0, 0); + draw_set_mapped_image(draw, PIPE_SHADER_VERTEX, i, 0, 0, 0, NULL, 0, 0, 0, 0); pipe_transfer_unmap(pipe, img_transfer[i]); } }