draw: add support for num_samples + sample_stride to the image paths
authorDave Airlie <airlied@redhat.com>
Mon, 23 Mar 2020 05:07:11 +0000 (15:07 +1000)
committerMarge Bot <eric+marge@anholt.net>
Wed, 6 May 2020 06:20:37 +0000 (06:20 +0000)
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>

src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_context.h
src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h
src/gallium/auxiliary/draw/draw_llvm_sample.c
src/gallium/drivers/llvmpipe/lp_state_sampler.c
src/mesa/state_tracker/st_draw_feedback.c

index 5d5a91c0f2ca832ffc6a7a7a645726bdbb0cf94c..b93bc6bf56f29d27926a824c3c0990f6c8b949cc 100644 (file)
@@ -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
 }
 
index d0dc7688cf02327e9d2df8611721f1808b248c8e..5919c8f2214a7fa1e7834cb460891d42e146adc7 100644 (file)
@@ -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
index 303e377ffae23d7d5110e53c3d07a36d840c5510..06bb4456521a68d117808eefa9cd6bf2ee80dd00 100644 (file)
@@ -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;
 }
 
 
index 51a2bd53d497945f823d98168e0036fa1f450f82..d327e542afb9dea7ce0166abae4d1c96489ca272 100644 (file)
@@ -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
index 0a8f345280c6ae964eb3d080c64dc7071d74da84..a30ebf5eabdb00f26994b7e7379bf755ec9a7d16 100644 (file)
@@ -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;
 
index 73f6617dbc5fee9132a1c4559e71cc02bda0bf89..65342e80eaedf516a2ad271847c29548f967690a 100644 (file)
@@ -471,7 +471,7 @@ prepare_shader_images(
                                i,
                                width, height, num_layers,
                                addr,
-                               row_stride, img_stride);
+                               row_stride, img_stride, 0, 0);
       }
    }
 }
index 4216b84b032f4655dec6a40bb52f05b67435e9d2..c70599a10c7aac8e7e74a6d4aa0c45a284217706 100644 (file)
@@ -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]);
       }
    }