gallium/tgsi/draw/softpipe: remodel shader const/buffer bindings.
authorDave Airlie <airlied@redhat.com>
Wed, 7 Jun 2023 05:00:56 +0000 (15:00 +1000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 02:10:54 +0000 (02:10 +0000)
This remodels things around a buffer object.

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

16 files changed:
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/draw/draw_gs.h
src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline_llvm.c
src/gallium/auxiliary/draw/draw_vs.h
src/gallium/auxiliary/draw/draw_vs_exec.c
src/gallium/auxiliary/draw/draw_vs_llvm.c
src/gallium/auxiliary/draw/draw_vs_variant.c
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_exec.h
src/gallium/drivers/softpipe/sp_compute.c
src/gallium/drivers/softpipe/sp_context.h
src/gallium/drivers/softpipe/sp_quad_fs.c
src/gallium/drivers/softpipe/sp_state_shader.c

index 64409e2..7d848f1 100644 (file)
@@ -463,20 +463,20 @@ draw_set_mapped_constant_buffer(struct draw_context *draw,
 
    switch (shader_type) {
    case PIPE_SHADER_VERTEX:
-      draw->pt.user.vs_constants[slot] = buffer;
-      draw->pt.user.vs_constants_size[slot] = size;
+      draw->pt.user.vs_constants[slot].ptr = buffer;
+      draw->pt.user.vs_constants[slot].size = size;
       break;
    case PIPE_SHADER_GEOMETRY:
-      draw->pt.user.gs_constants[slot] = buffer;
-      draw->pt.user.gs_constants_size[slot] = size;
+      draw->pt.user.gs_constants[slot].ptr = buffer;
+      draw->pt.user.gs_constants[slot].size = size;
       break;
    case PIPE_SHADER_TESS_CTRL:
-      draw->pt.user.tcs_constants[slot] = buffer;
-      draw->pt.user.tcs_constants_size[slot] = size;
+      draw->pt.user.tcs_constants[slot].ptr = buffer;
+      draw->pt.user.tcs_constants[slot].size = size;
       break;
    case PIPE_SHADER_TESS_EVAL:
-      draw->pt.user.tes_constants[slot] = buffer;
-      draw->pt.user.tes_constants_size[slot] = size;
+      draw->pt.user.tes_constants[slot].ptr = buffer;
+      draw->pt.user.tes_constants[slot].size = size;
       break;
    default:
       assert(0 && "invalid shader type in draw_set_mapped_constant_buffer");
@@ -500,20 +500,20 @@ draw_set_mapped_shader_buffer(struct draw_context *draw,
 
    switch (shader_type) {
    case PIPE_SHADER_VERTEX:
-      draw->pt.user.vs_ssbos[slot] = buffer;
-      draw->pt.user.vs_ssbos_size[slot] = size;
+      draw->pt.user.vs_ssbos[slot].ptr = buffer;
+      draw->pt.user.vs_ssbos[slot].size = size;
       break;
    case PIPE_SHADER_GEOMETRY:
-      draw->pt.user.gs_ssbos[slot] = buffer;
-      draw->pt.user.gs_ssbos_size[slot] = size;
+      draw->pt.user.gs_ssbos[slot].ptr = buffer;
+      draw->pt.user.gs_ssbos[slot].size = size;
       break;
    case PIPE_SHADER_TESS_CTRL:
-      draw->pt.user.tcs_ssbos[slot] = buffer;
-      draw->pt.user.tcs_ssbos_size[slot] = size;
+      draw->pt.user.tcs_ssbos[slot].ptr = buffer;
+      draw->pt.user.tcs_ssbos[slot].size = size;
       break;
    case PIPE_SHADER_TESS_EVAL:
-      draw->pt.user.tes_ssbos[slot] = buffer;
-      draw->pt.user.tes_ssbos_size[slot] = size;
+      draw->pt.user.tes_ssbos[slot].ptr = buffer;
+      draw->pt.user.tes_ssbos[slot].size = size;
       break;
    default:
       assert(0 && "invalid shader type in draw_set_mapped_shader_buffer");
index df905f8..0e376fc 100644 (file)
@@ -196,12 +196,11 @@ tgsi_fetch_gs_input(struct draw_geometry_shader *shader,
 
 static void
 tgsi_gs_prepare(struct draw_geometry_shader *shader,
-                const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS])
+                const struct draw_buffer_info *constants)
 {
    struct tgsi_exec_machine *machine = shader->machine;
    tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
-                                  constants, constants_size);
+                                  (const struct tgsi_exec_consts_info *)constants);
 }
 
 
@@ -380,8 +379,7 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader,
 
 static void
 llvm_gs_prepare(struct draw_geometry_shader *shader,
-                const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS])
+                const struct draw_buffer_info *constants)
 {
 }
 
@@ -566,8 +564,7 @@ gs_tri_adj(struct draw_geometry_shader *shader,
  */
 void
 draw_geometry_shader_run(struct draw_geometry_shader *shader,
-                         const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                         const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS],
+                         const struct draw_buffer_info *constants,
                          const struct draw_vertex_info *input_verts,
                          const struct draw_prim_info *input_prim,
                          const struct tgsi_shader_info *input_info,
@@ -670,7 +667,7 @@ draw_geometry_shader_run(struct draw_geometry_shader *shader,
    }
 #endif
 
-   shader->prepare(shader, constants, constants_size);
+   shader->prepare(shader, constants);
 
    if (input_prim->linear)
       gs_run(shader, input_prim, input_verts,
index 48aa023..31c9f48 100644 (file)
@@ -121,8 +121,7 @@ struct draw_geometry_shader {
                          float (**p_output)[4]);
 
    void (*prepare)(struct draw_geometry_shader *shader,
-                   const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                   const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS]);
+                   const struct draw_buffer_info *constants);
    void (*run)(struct draw_geometry_shader *shader,
                unsigned input_primitives, unsigned *out_prims);
 };
@@ -139,8 +138,7 @@ draw_geometry_shader_new_instance(struct draw_geometry_shader *gs);
  */
 void
 draw_geometry_shader_run(struct draw_geometry_shader *shader,
-                         const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                         const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS],
+                         const struct draw_buffer_info *constants,
                          const struct draw_vertex_info *input_verts,
                          const struct draw_prim_info *input_prim,
                          const struct tgsi_shader_info *input_info,
index 9110093..7be0db0 100644 (file)
@@ -117,6 +117,11 @@ struct draw_vertex_buffer {
 /* maximum number of shader variants we can cache */
 #define DRAW_MAX_SHADER_VARIANTS 512
 
+struct draw_buffer_info {
+   const void *ptr;
+   unsigned size;
+};
+
 /**
  * Private context for the drawing module.
  */
@@ -217,24 +222,15 @@ struct draw_context
          struct draw_vertex_buffer vbuffer[PIPE_MAX_ATTRIBS];
 
          /** constant buffers for each shader stage */
-         const void *vs_constants[PIPE_MAX_CONSTANT_BUFFERS];
-         unsigned vs_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
-         const void *gs_constants[PIPE_MAX_CONSTANT_BUFFERS];
-         unsigned gs_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
-         const void *tcs_constants[PIPE_MAX_CONSTANT_BUFFERS];
-         unsigned tcs_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
-         const void *tes_constants[PIPE_MAX_CONSTANT_BUFFERS];
-         unsigned tes_constants_size[PIPE_MAX_CONSTANT_BUFFERS];
-
-         /** shader buffers for each shader stage */
-         const void *vs_ssbos[PIPE_MAX_SHADER_BUFFERS];
-         unsigned vs_ssbos_size[PIPE_MAX_SHADER_BUFFERS];
-         const void *gs_ssbos[PIPE_MAX_SHADER_BUFFERS];
-         unsigned gs_ssbos_size[PIPE_MAX_SHADER_BUFFERS];
-         const void *tcs_ssbos[PIPE_MAX_SHADER_BUFFERS];
-         unsigned tcs_ssbos_size[PIPE_MAX_SHADER_BUFFERS];
-         const void *tes_ssbos[PIPE_MAX_SHADER_BUFFERS];
-         unsigned tes_ssbos_size[PIPE_MAX_SHADER_BUFFERS];
+         struct draw_buffer_info vs_constants[PIPE_MAX_CONSTANT_BUFFERS];
+         struct draw_buffer_info gs_constants[PIPE_MAX_CONSTANT_BUFFERS];
+         struct draw_buffer_info tcs_constants[PIPE_MAX_CONSTANT_BUFFERS];
+         struct draw_buffer_info tes_constants[PIPE_MAX_CONSTANT_BUFFERS];
+
+         struct draw_buffer_info vs_ssbos[PIPE_MAX_SHADER_BUFFERS];
+         struct draw_buffer_info gs_ssbos[PIPE_MAX_SHADER_BUFFERS];
+         struct draw_buffer_info tcs_ssbos[PIPE_MAX_SHADER_BUFFERS];
+         struct draw_buffer_info tes_ssbos[PIPE_MAX_SHADER_BUFFERS];
 
          /* pointer to planes */
          float (*planes)[DRAW_TOTAL_CLIP_PLANES][4];
index 3e49436..fdda41d 100644 (file)
@@ -195,8 +195,7 @@ emit(struct pt_emit *emit,
 
 static void
 draw_vertex_shader_run(struct draw_vertex_shader *vshader,
-                       const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                       unsigned const_size[PIPE_MAX_CONSTANT_BUFFERS],
+                       const struct draw_buffer_info *constants,
                        const struct draw_fetch_info *fetch_info,
                        const struct draw_vertex_info *input_verts,
                        struct draw_vertex_info *output_verts)
@@ -213,7 +212,6 @@ draw_vertex_shader_run(struct draw_vertex_shader *vshader,
                        (const float (*)[4])input_verts->verts->data,
                        (      float (*)[4])output_verts->verts->data,
                        constants,
-                       const_size,
                        input_verts->count,
                        input_verts->vertex_size,
                        input_verts->vertex_size,
@@ -273,7 +271,6 @@ fetch_pipeline_generic(struct draw_pt_middle_end *middle,
    if (fpme->opt & PT_SHADE) {
       draw_vertex_shader_run(vshader,
                              draw->pt.user.vs_constants,
-                             draw->pt.user.vs_constants_size,
                              fetch_info,
                              vert_info,
                              &vs_vert_info);
@@ -289,7 +286,6 @@ fetch_pipeline_generic(struct draw_pt_middle_end *middle,
    if ((fpme->opt & PT_SHADE) && gshader) {
       draw_geometry_shader_run(gshader,
                                draw->pt.user.gs_constants,
-                               draw->pt.user.gs_constants_size,
                                vert_info,
                                prim_info,
                                &vshader->info,
index f3d18e9..ffefb3f 100644 (file)
@@ -406,9 +406,9 @@ llvm_middle_end_prepare(struct draw_pt_middle_end *middle,
 
 
 static unsigned
-get_num_consts_robust(struct draw_context *draw, unsigned *sizes, unsigned idx)
+get_num_consts_robust(struct draw_context *draw, struct draw_buffer_info *bufs, unsigned idx)
 {
-   uint64_t const_bytes = sizes[idx];
+   uint64_t const_bytes = bufs[idx].size;
 
    if (const_bytes < sizeof(float))
       return 0;
@@ -416,7 +416,6 @@ get_num_consts_robust(struct draw_context *draw, unsigned *sizes, unsigned idx)
    return DIV_ROUND_UP(const_bytes, draw->constant_buffer_stride);
 }
 
-
 /**
  * Bind/update constant buffer pointers, clip planes and viewport dims.
  * These are "light weight" parameters which aren't baked into the
@@ -438,16 +437,16 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
        * shader expects 16-byte allocations, the fix is likely to move
        * to LOAD intrinsic in the future and remove the vec4 constraint.
        */
-      int num_consts = get_num_consts_robust(draw, draw->pt.user.vs_constants_size, i);
-      llvm->vs_jit_resources.constants[i].f = draw->pt.user.vs_constants[i];
+      int num_consts = get_num_consts_robust(draw, draw->pt.user.vs_constants, i);
+      llvm->vs_jit_resources.constants[i].f = draw->pt.user.vs_constants[i].ptr;
       llvm->vs_jit_resources.constants[i].num_elements = num_consts;
       if (num_consts == 0) {
          llvm->vs_jit_resources.constants[i].f = fake_const_buf;
       }
    }
    for (i = 0; i < ARRAY_SIZE(llvm->vs_jit_resources.ssbos); ++i) {
-      int num_ssbos = draw->pt.user.vs_ssbos_size[i];
-      llvm->vs_jit_resources.ssbos[i].u = draw->pt.user.vs_ssbos[i];
+      int num_ssbos = draw->pt.user.vs_ssbos[i].size;
+      llvm->vs_jit_resources.ssbos[i].u = draw->pt.user.vs_ssbos[i].ptr;
       llvm->vs_jit_resources.ssbos[i].num_elements = num_ssbos;
       if (num_ssbos == 0) {
          llvm->vs_jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
@@ -455,16 +454,16 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
    }
 
    for (i = 0; i < ARRAY_SIZE(llvm->gs_jit_resources.constants); ++i) {
-      int num_consts = get_num_consts_robust(draw, draw->pt.user.gs_constants_size, i);
-      llvm->gs_jit_resources.constants[i].f = draw->pt.user.gs_constants[i];
+      int num_consts = get_num_consts_robust(draw, draw->pt.user.gs_constants, i);
+      llvm->gs_jit_resources.constants[i].f = draw->pt.user.gs_constants[i].ptr;
       llvm->gs_jit_resources.constants[i].num_elements = num_consts;
       if (num_consts == 0) {
          llvm->gs_jit_resources.constants[i].f = fake_const_buf;
       }
    }
    for (i = 0; i < ARRAY_SIZE(llvm->gs_jit_resources.ssbos); ++i) {
-      int num_ssbos = draw->pt.user.gs_ssbos_size[i];
-      llvm->gs_jit_resources.ssbos[i].u = draw->pt.user.gs_ssbos[i];
+      int num_ssbos = draw->pt.user.gs_ssbos[i].size;
+      llvm->gs_jit_resources.ssbos[i].u = draw->pt.user.gs_ssbos[i].ptr;
       llvm->gs_jit_resources.ssbos[i].num_elements = num_ssbos;
       if (num_ssbos == 0) {
          llvm->gs_jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
@@ -472,16 +471,16 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
    }
 
    for (i = 0; i < ARRAY_SIZE(llvm->tcs_jit_resources.constants); ++i) {
-      int num_consts = get_num_consts_robust(draw, draw->pt.user.tcs_constants_size, i);
-      llvm->tcs_jit_resources.constants[i].f = draw->pt.user.tcs_constants[i];
+      int num_consts = get_num_consts_robust(draw, draw->pt.user.tcs_constants, i);
+      llvm->tcs_jit_resources.constants[i].f = draw->pt.user.tcs_constants[i].ptr;
       llvm->tcs_jit_resources.constants[i].num_elements = num_consts;
       if (num_consts == 0) {
          llvm->tcs_jit_resources.constants[i].f = fake_const_buf;
       }
    }
    for (i = 0; i < ARRAY_SIZE(llvm->tcs_jit_resources.ssbos); ++i) {
-      int num_ssbos = draw->pt.user.tcs_ssbos_size[i];
-      llvm->tcs_jit_resources.ssbos[i].u = draw->pt.user.tcs_ssbos[i];
+      int num_ssbos = draw->pt.user.tcs_ssbos[i].size;
+      llvm->tcs_jit_resources.ssbos[i].u = draw->pt.user.tcs_ssbos[i].ptr;
       llvm->tcs_jit_resources.ssbos[i].num_elements = num_ssbos;
       if (num_ssbos == 0) {
          llvm->tcs_jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
@@ -489,16 +488,16 @@ llvm_middle_end_bind_parameters(struct draw_pt_middle_end *middle)
    }
 
    for (i = 0; i < ARRAY_SIZE(llvm->tes_jit_resources.constants); ++i) {
-      int num_consts = get_num_consts_robust(draw, draw->pt.user.tes_constants_size, i);
-      llvm->tes_jit_resources.constants[i].f = draw->pt.user.tes_constants[i];
+      int num_consts = get_num_consts_robust(draw, draw->pt.user.tes_constants, i);
+      llvm->tes_jit_resources.constants[i].f = draw->pt.user.tes_constants[i].ptr;
       llvm->tes_jit_resources.constants[i].num_elements = num_consts;
       if (num_consts == 0) {
          llvm->tes_jit_resources.constants[i].f = fake_const_buf;
       }
    }
    for (i = 0; i < ARRAY_SIZE(llvm->tes_jit_resources.ssbos); ++i) {
-      int num_ssbos = draw->pt.user.tes_ssbos_size[i];
-      llvm->tes_jit_resources.ssbos[i].u = draw->pt.user.tes_ssbos[i];
+      int num_ssbos = draw->pt.user.tes_ssbos[i].size;
+      llvm->tes_jit_resources.ssbos[i].u = draw->pt.user.tes_ssbos[i].ptr;
       llvm->tes_jit_resources.ssbos[i].num_elements = num_ssbos;
       if (num_ssbos == 0) {
          llvm->tes_jit_resources.ssbos[i].u = (const uint32_t *)fake_const_buf;
@@ -681,7 +680,6 @@ llvm_pipeline_generic(struct draw_pt_middle_end *middle,
       struct draw_vertex_shader *vshader = draw->vs.vertex_shader;
       draw_geometry_shader_run(gshader,
                                draw->pt.user.gs_constants,
-                               draw->pt.user.gs_constants_size,
                                vert_info,
                                prim_info,
                                tes_shader ? &tes_shader->info : &vshader->info,
index 1edf505..168165a 100644 (file)
@@ -131,8 +131,7 @@ struct draw_vertex_shader {
    void (*run_linear)(struct draw_vertex_shader *shader,
                       const float (*input)[4],
                       float (*output)[4],
-                      const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                      const unsigned const_size[PIPE_MAX_CONSTANT_BUFFERS],
+                      const struct draw_buffer_info *constants,
                       unsigned count,
                       unsigned input_stride,
                       unsigned output_stride,
index 5476f40..862c94b 100644 (file)
@@ -92,8 +92,7 @@ static void
 vs_exec_run_linear(struct draw_vertex_shader *shader,
                    const float (*input)[4],
                    float (*output)[4],
-                   const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                    const unsigned const_size[PIPE_MAX_CONSTANT_BUFFERS],
+                   const struct draw_buffer_info *constants,
                    unsigned count,
                    unsigned input_stride,
                    unsigned output_stride,
@@ -107,7 +106,7 @@ vs_exec_run_linear(struct draw_vertex_shader *shader,
 
    assert(!shader->draw->llvm);
    tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
-                                  constants, const_size);
+                                  (const struct tgsi_exec_consts_info *)constants);
 
    if (shader->info.uses_instanceid) {
       unsigned i = machine->SysSemanticToIndex[TGSI_SEMANTIC_INSTANCEID];
index d1b4662..e4ea36f 100644 (file)
@@ -53,8 +53,7 @@ static void
 vs_llvm_run_linear(struct draw_vertex_shader *shader,
                    const float (*input)[4],
                    float (*output)[4],
-                   const void *constants[PIPE_MAX_CONSTANT_BUFFERS],
-                   const unsigned constants_size[PIPE_MAX_CONSTANT_BUFFERS],
+                   const struct draw_buffer_info *constants,
                    unsigned count,
                    unsigned input_stride,
                    unsigned output_stride,
index 74ebf14..7294172 100644 (file)
@@ -176,7 +176,6 @@ vsvg_run_elts(struct draw_vs_variant *variant,
                              temp_buffer,
                              temp_buffer,
                              vsvg->base.vs->draw->pt.user.vs_constants,
-                             vsvg->base.vs->draw->pt.user.vs_constants_size,
                              count,
                              temp_vertex_stride,
                              temp_vertex_stride, NULL);
@@ -240,7 +239,6 @@ vsvg_run_linear(struct draw_vs_variant *variant,
                              temp_buffer,
                              temp_buffer,
                              vsvg->base.vs->draw->pt.user.vs_constants,
-                             vsvg->base.vs->draw->pt.user.vs_constants_size,
                              count,
                              temp_vertex_stride,
                              temp_vertex_stride, NULL);
index abafc6d..a0bd848 100644 (file)
@@ -1005,14 +1005,13 @@ print_temp(const struct tgsi_exec_machine *mach, uint index)
 void
 tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
                                unsigned num_bufs,
-                               const void **bufs,
-                               const unsigned *buf_sizes)
+                               const struct tgsi_exec_consts_info *bufs)
 {
    unsigned i;
 
    for (i = 0; i < num_bufs; i++) {
-      mach->Consts[i] = bufs[i];
-      mach->ConstsSize[i] = buf_sizes[i];
+      mach->Consts[i] = bufs[i].ptr;
+      mach->ConstsSize[i] = bufs[i].size;
    }
 }
 
index 1b463f5..d0b90e4 100644 (file)
@@ -255,6 +255,11 @@ struct tgsi_call_record
    uint ReturnAddr;
 };
 
+/* should match draw_buffer_info */
+struct tgsi_exec_consts_info {
+   const void *ptr;
+   unsigned size;
+};
 
 /* Switch-case block state. */
 struct tgsi_switch_record {
@@ -425,8 +430,7 @@ tgsi_exec_machine_run(
 extern void
 tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
                                unsigned num_bufs,
-                               const void **bufs,
-                               const unsigned *buf_sizes);
+                               const struct tgsi_exec_consts_info *bufs);
 
 
 static inline int
index b36acb7..15f0f3e 100644 (file)
@@ -212,8 +212,7 @@ softpipe_launch_grid(struct pipe_context *context,
                        (struct tgsi_image *)softpipe->tgsi.image[PIPE_SHADER_COMPUTE],
                        (struct tgsi_buffer *)softpipe->tgsi.buffer[PIPE_SHADER_COMPUTE]);
             tgsi_exec_set_constant_buffers(machines[idx], PIPE_MAX_CONSTANT_BUFFERS,
-                                           softpipe->mapped_constants[PIPE_SHADER_COMPUTE],
-                                           softpipe->const_buffer_size[PIPE_SHADER_COMPUTE]);
+                                           softpipe->mapped_constants[PIPE_SHADER_COMPUTE]);
             idx++;
          }
       }
index bf8e4aa..26c79a4 100644 (file)
@@ -39,6 +39,7 @@
 #include "sp_quad_pipe.h"
 #include "sp_setup.h"
 
+#include "tgsi/tgsi_exec.h"
 
 struct softpipe_vbuf_render;
 struct draw_context;
@@ -108,8 +109,7 @@ struct softpipe_context {
    ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS];
 
    /** Mapped constant buffers */
-   const void *mapped_constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
-   unsigned const_buffer_size[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
+   struct tgsi_exec_consts_info mapped_constants[PIPE_SHADER_TYPES][PIPE_MAX_CONSTANT_BUFFERS];
 
    /** Vertex format */
    struct sp_setup_info setup_info;
index 26e7434..735ac0f 100644 (file)
@@ -110,8 +110,7 @@ shade_quads(struct quad_stage *qs,
    unsigned i, nr_quads = 0;
 
    tgsi_exec_set_constant_buffers(machine, PIPE_MAX_CONSTANT_BUFFERS,
-                         softpipe->mapped_constants[PIPE_SHADER_FRAGMENT],
-                         softpipe->const_buffer_size[PIPE_SHADER_FRAGMENT]);
+                                  softpipe->mapped_constants[PIPE_SHADER_FRAGMENT]);
 
    machine->InterpCoefs = quads[0]->coef;
 
index 1796a3e..a2ff6af 100644 (file)
@@ -393,8 +393,8 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
       draw_set_mapped_constant_buffer(softpipe->draw, shader, index, data, size);
    }
 
-   softpipe->mapped_constants[shader][index] = data;
-   softpipe->const_buffer_size[shader][index] = size;
+   softpipe->mapped_constants[shader][index].ptr = data;
+   softpipe->mapped_constants[shader][index].size = size;
 
    softpipe->dirty |= SP_NEW_CONSTANTS;