gallivm: consolidate draw/lp texture type.
authorDave Airlie <airlied@redhat.com>
Fri, 26 Aug 2022 06:36:37 +0000 (16:36 +1000)
committerMarge Bot <emma+marge@anholt.net>
Sat, 29 Apr 2023 02:57:19 +0000 (02:57 +0000)
This just makes the type creation, struct and fields the same.

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

src/gallium/auxiliary/draw/draw_llvm.c
src/gallium/auxiliary/draw/draw_llvm.h
src/gallium/auxiliary/draw/draw_llvm_sample.c
src/gallium/auxiliary/gallivm/lp_bld_jit_types.c
src/gallium/auxiliary/gallivm/lp_bld_jit_types.h
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_jit.h

index 8b3a152..07dd648 100644 (file)
@@ -145,75 +145,6 @@ create_jit_dvbuffer_type(struct gallivm_state *gallivm,
 
 
 /**
- * Create LLVM type for struct draw_jit_texture
- */
-static LLVMTypeRef
-create_jit_texture_type(struct gallivm_state *gallivm, const char *struct_name)
-{
-   LLVMTargetDataRef target = gallivm->target;
-   LLVMTypeRef texture_type;
-   LLVMTypeRef elem_types[DRAW_JIT_TEXTURE_NUM_FIELDS];
-   LLVMTypeRef int32_type = LLVMInt32TypeInContext(gallivm->context);
-
-   elem_types[DRAW_JIT_TEXTURE_WIDTH]  =
-   elem_types[DRAW_JIT_TEXTURE_HEIGHT] =
-   elem_types[DRAW_JIT_TEXTURE_DEPTH] =
-   elem_types[DRAW_JIT_TEXTURE_NUM_SAMPLES] =
-   elem_types[DRAW_JIT_TEXTURE_SAMPLE_STRIDE] =
-   elem_types[DRAW_JIT_TEXTURE_FIRST_LEVEL] =
-   elem_types[DRAW_JIT_TEXTURE_LAST_LEVEL] = int32_type;
-   elem_types[DRAW_JIT_TEXTURE_BASE] =
-      LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0);
-   elem_types[DRAW_JIT_TEXTURE_ROW_STRIDE] =
-   elem_types[DRAW_JIT_TEXTURE_IMG_STRIDE] =
-   elem_types[DRAW_JIT_TEXTURE_MIP_OFFSETS] =
-      LLVMArrayType(int32_type, PIPE_MAX_TEXTURE_LEVELS);
-
-   texture_type = LLVMStructTypeInContext(gallivm->context, elem_types,
-                                          ARRAY_SIZE(elem_types), 0);
-
-   (void) target; /* silence unused var warning for non-debug build */
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, width,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_WIDTH);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, height,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_HEIGHT);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, depth,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_DEPTH);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, base,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_BASE);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, row_stride,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_ROW_STRIDE);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, img_stride,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_IMG_STRIDE);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, first_level,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_FIRST_LEVEL);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, last_level,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_LAST_LEVEL);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, mip_offsets,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_MIP_OFFSETS);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, num_samples,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_NUM_SAMPLES);
-   LP_CHECK_MEMBER_OFFSET(struct draw_jit_texture, sample_stride,
-                          target, texture_type,
-                          DRAW_JIT_TEXTURE_SAMPLE_STRIDE);
-
-   LP_CHECK_STRUCT_SIZE(struct draw_jit_texture, target, texture_type);
-
-   return texture_type;
-}
-
-
-/**
  * Create LLVM type for struct draw_jit_sampler
  */
 static LLVMTypeRef
@@ -319,7 +250,7 @@ static LLVMTypeRef
 create_jit_context_type(struct gallivm_state *gallivm, const char *struct_name)
 {
    LLVMTypeRef buffer_type = lp_build_create_jit_buffer_type(gallivm);
-   LLVMTypeRef texture_type = create_jit_texture_type(gallivm, "texture");
+   LLVMTypeRef texture_type = lp_build_create_jit_texture_type(gallivm);
    LLVMTypeRef sampler_type = create_jit_sampler_type(gallivm, "sampler");
    LLVMTypeRef image_type = create_jit_image_type(gallivm, "image");
 
@@ -2508,7 +2439,7 @@ draw_llvm_set_mapped_texture(struct draw_context *draw,
                              uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS],
                              uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS])
 {
-   struct draw_jit_texture *jit_tex;
+   struct lp_jit_texture *jit_tex;
 
    switch (shader_stage) {
    case PIPE_SHADER_VERTEX:
@@ -2697,7 +2628,7 @@ create_gs_jit_types(struct draw_gs_llvm_variant *var)
    struct gallivm_state *gallivm = var->gallivm;
    LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
 
-   texture_type = create_jit_texture_type(gallivm, "texture");
+   texture_type = lp_build_create_jit_texture_type(gallivm);
    sampler_type = create_jit_sampler_type(gallivm, "sampler");
    image_type = create_jit_image_type(gallivm, "image");
    buffer_type = lp_build_create_jit_buffer_type(gallivm);
@@ -3083,7 +3014,7 @@ create_tcs_jit_types(struct draw_tcs_llvm_variant *var)
    struct gallivm_state *gallivm = var->gallivm;
    LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
 
-   texture_type = create_jit_texture_type(gallivm, "texture");
+   texture_type = lp_build_create_jit_texture_type(gallivm);
    sampler_type = create_jit_sampler_type(gallivm, "sampler");
    image_type = create_jit_image_type(gallivm, "image");
    buffer_type = lp_build_create_jit_buffer_type(gallivm);
@@ -3742,7 +3673,7 @@ create_tes_jit_types(struct draw_tes_llvm_variant *var)
    struct gallivm_state *gallivm = var->gallivm;
    LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
 
-   texture_type = create_jit_texture_type(gallivm, "texture");
+   texture_type = lp_build_create_jit_texture_type(gallivm);
    sampler_type = create_jit_sampler_type(gallivm, "sampler");
    image_type = create_jit_image_type(gallivm, "image");
    buffer_type = lp_build_create_jit_buffer_type(gallivm);
index f82a6a6..042d806 100644 (file)
@@ -48,22 +48,6 @@ struct llvm_geometry_shader;
 struct llvm_tess_ctrl_shader;
 struct llvm_tess_eval_shader;
 
-struct draw_jit_texture
-{
-   uint32_t width;
-   uint32_t height;
-   uint32_t depth;
-   const void *base;
-   uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t first_level;
-   uint32_t last_level;
-   uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t num_samples;
-   uint32_t sample_stride;
-};
-
-
 struct draw_sampler_static_state
 {
    /*
@@ -104,22 +88,6 @@ struct draw_jit_image
 };
 
 enum {
-   DRAW_JIT_TEXTURE_WIDTH = 0,
-   DRAW_JIT_TEXTURE_HEIGHT,
-   DRAW_JIT_TEXTURE_DEPTH,
-   DRAW_JIT_TEXTURE_BASE,
-   DRAW_JIT_TEXTURE_ROW_STRIDE,
-   DRAW_JIT_TEXTURE_IMG_STRIDE,
-   DRAW_JIT_TEXTURE_FIRST_LEVEL,
-   DRAW_JIT_TEXTURE_LAST_LEVEL,
-   DRAW_JIT_TEXTURE_MIP_OFFSETS,
-   DRAW_JIT_TEXTURE_NUM_SAMPLES,
-   DRAW_JIT_TEXTURE_SAMPLE_STRIDE,
-   DRAW_JIT_TEXTURE_NUM_FIELDS  /* number of fields above */
-};
-
-
-enum {
    DRAW_JIT_SAMPLER_MIN_LOD,
    DRAW_JIT_SAMPLER_MAX_LOD,
    DRAW_JIT_SAMPLER_LOD_BIAS,
@@ -164,7 +132,7 @@ struct draw_jit_context
    float (*planes) [DRAW_TOTAL_CLIP_PLANES][4];
    struct pipe_viewport_state *viewports;
 
-   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+   struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
    struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
 
@@ -249,7 +217,7 @@ struct draw_gs_jit_context
 
    /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
     * DRAW_JIT_CTX_SAMPLERS positions in the struct */
-   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+   struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
    struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
 
@@ -305,7 +273,7 @@ struct draw_tcs_jit_context {
    int dummy2;
    /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
     * DRAW_JIT_CTX_SAMPLERS positions in the struct */
-   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+   struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
    struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
 
@@ -342,7 +310,7 @@ struct draw_tes_jit_context {
    int dummy2;
    /* There two need to be exactly at DRAW_JIT_CTX_TEXTURES and
     * DRAW_JIT_CTX_SAMPLERS positions in the struct */
-   struct draw_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+   struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS];
    struct draw_jit_image images[PIPE_MAX_SHADER_IMAGES];
 
index 19e9937..79c7925 100644 (file)
@@ -288,17 +288,17 @@ draw_llvm_image_member(struct gallivm_state *gallivm,
    }
 
 
-DRAW_LLVM_TEXTURE_MEMBER(width,      DRAW_JIT_TEXTURE_WIDTH, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(height,     DRAW_JIT_TEXTURE_HEIGHT, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(depth,      DRAW_JIT_TEXTURE_DEPTH, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(first_level,DRAW_JIT_TEXTURE_FIRST_LEVEL, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(last_level, DRAW_JIT_TEXTURE_LAST_LEVEL, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(base_ptr,   DRAW_JIT_TEXTURE_BASE, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(row_stride, DRAW_JIT_TEXTURE_ROW_STRIDE, FALSE)
-DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(img_stride, DRAW_JIT_TEXTURE_IMG_STRIDE, FALSE)
-DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(mip_offsets, DRAW_JIT_TEXTURE_MIP_OFFSETS, FALSE)
-DRAW_LLVM_TEXTURE_MEMBER(num_samples, DRAW_JIT_TEXTURE_NUM_SAMPLES, TRUE)
-DRAW_LLVM_TEXTURE_MEMBER(sample_stride, DRAW_JIT_TEXTURE_SAMPLE_STRIDE, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(width,      LP_JIT_TEXTURE_WIDTH, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(height,     LP_JIT_TEXTURE_HEIGHT, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(depth,      LP_JIT_TEXTURE_DEPTH, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(first_level,LP_JIT_TEXTURE_FIRST_LEVEL, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(last_level, LP_JIT_TEXTURE_LAST_LEVEL, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(base_ptr,   LP_JIT_TEXTURE_BASE, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(row_stride, LP_JIT_TEXTURE_ROW_STRIDE, FALSE)
+DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(img_stride, LP_JIT_TEXTURE_IMG_STRIDE, FALSE)
+DRAW_LLVM_TEXTURE_MEMBER_OUTTYPE(mip_offsets, LP_JIT_TEXTURE_MIP_OFFSETS, FALSE)
+DRAW_LLVM_TEXTURE_MEMBER(num_samples, LP_JIT_TEXTURE_NUM_SAMPLES, TRUE)
+DRAW_LLVM_TEXTURE_MEMBER(sample_stride, LP_JIT_TEXTURE_SAMPLE_STRIDE, TRUE)
 
 #define DRAW_LLVM_SAMPLER_MEMBER(_name, _index, _emit_load)  \
    static LLVMValueRef \
index 2a4ecf7..969c384 100644 (file)
@@ -95,3 +95,65 @@ lp_llvm_buffer_num_elements(struct gallivm_state *gallivm,
 {
    return lp_llvm_buffer_member(gallivm, buffers_ptr, buffers_offset, buffers_limit, LP_JIT_BUFFER_NUM_ELEMENTS, "num_elements");
 }
+
+LLVMTypeRef
+lp_build_create_jit_texture_type(struct gallivm_state *gallivm)
+{
+   LLVMContextRef lc = gallivm->context;
+   LLVMTypeRef texture_type;
+   LLVMTypeRef elem_types[LP_JIT_TEXTURE_NUM_FIELDS];
+
+   /* struct lp_jit_texture */
+   elem_types[LP_JIT_TEXTURE_WIDTH]  =
+   elem_types[LP_JIT_TEXTURE_HEIGHT] =
+   elem_types[LP_JIT_TEXTURE_DEPTH] =
+   elem_types[LP_JIT_TEXTURE_NUM_SAMPLES] =
+   elem_types[LP_JIT_TEXTURE_SAMPLE_STRIDE] =
+   elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] =
+   elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc);
+   elem_types[LP_JIT_TEXTURE_BASE] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
+   elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
+   elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
+   elem_types[LP_JIT_TEXTURE_MIP_OFFSETS] =
+      LLVMArrayType(LLVMInt32TypeInContext(lc), PIPE_MAX_TEXTURE_LEVELS);
+
+   texture_type = LLVMStructTypeInContext(lc, elem_types,
+                                          ARRAY_SIZE(elem_types), 0);
+
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, width,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_WIDTH);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, height,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_HEIGHT);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_DEPTH);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, base,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_BASE);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_ROW_STRIDE);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, img_stride,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_IMG_STRIDE);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, first_level,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_FIRST_LEVEL);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_LAST_LEVEL);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, mip_offsets,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_MIP_OFFSETS);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, num_samples,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_NUM_SAMPLES);
+   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, sample_stride,
+                          gallivm->target, texture_type,
+                          LP_JIT_TEXTURE_SAMPLE_STRIDE);
+   LP_CHECK_STRUCT_SIZE(struct lp_jit_texture,
+                        gallivm->target, texture_type);
+   return texture_type;
+}
index 557ce3a..3fc79db 100644 (file)
@@ -52,5 +52,37 @@ lp_llvm_buffer_num_elements(struct gallivm_state *gallivm,
                             LLVMValueRef buffers_ptr,
                             LLVMValueRef buffers_offset, unsigned buffers_limit);
 
+struct lp_jit_texture
+{
+   uint32_t width;        /* same as number of elements */
+   uint32_t height;
+   uint32_t depth;        /* doubles as array size */
+   const void *base;
+   uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
+   uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
+   uint32_t first_level;
+   uint32_t last_level;
+   uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
+   uint32_t num_samples;
+   uint32_t sample_stride;
+};
+
+enum {
+   LP_JIT_TEXTURE_WIDTH = 0,
+   LP_JIT_TEXTURE_HEIGHT,
+   LP_JIT_TEXTURE_DEPTH,
+   LP_JIT_TEXTURE_BASE,
+   LP_JIT_TEXTURE_ROW_STRIDE,
+   LP_JIT_TEXTURE_IMG_STRIDE,
+   LP_JIT_TEXTURE_FIRST_LEVEL,
+   LP_JIT_TEXTURE_LAST_LEVEL,
+   LP_JIT_TEXTURE_MIP_OFFSETS,
+   LP_JIT_TEXTURE_NUM_SAMPLES,
+   LP_JIT_TEXTURE_SAMPLE_STRIDE,
+   LP_JIT_TEXTURE_NUM_FIELDS  /* number of fields above */
+};
+
+LLVMTypeRef
+lp_build_create_jit_texture_type(struct gallivm_state *gallivm);
 
 #endif
index 277543d..7715e7f 100644 (file)
 #include "lp_jit.h"
 
 static LLVMTypeRef
-create_jit_texture_type(struct gallivm_state *gallivm)
-{
-   LLVMContextRef lc = gallivm->context;
-   LLVMTypeRef texture_type;
-   LLVMTypeRef elem_types[LP_JIT_TEXTURE_NUM_FIELDS];
-
-   /* struct lp_jit_texture */
-   elem_types[LP_JIT_TEXTURE_WIDTH]  =
-   elem_types[LP_JIT_TEXTURE_HEIGHT] =
-   elem_types[LP_JIT_TEXTURE_DEPTH] =
-   elem_types[LP_JIT_TEXTURE_NUM_SAMPLES] =
-   elem_types[LP_JIT_TEXTURE_SAMPLE_STRIDE] =
-   elem_types[LP_JIT_TEXTURE_FIRST_LEVEL] =
-   elem_types[LP_JIT_TEXTURE_LAST_LEVEL] = LLVMInt32TypeInContext(lc);
-   elem_types[LP_JIT_TEXTURE_BASE] = LLVMPointerType(LLVMInt8TypeInContext(lc), 0);
-   elem_types[LP_JIT_TEXTURE_ROW_STRIDE] =
-   elem_types[LP_JIT_TEXTURE_IMG_STRIDE] =
-   elem_types[LP_JIT_TEXTURE_MIP_OFFSETS] =
-      LLVMArrayType(LLVMInt32TypeInContext(lc), PIPE_MAX_TEXTURE_LEVELS);
-
-   texture_type = LLVMStructTypeInContext(lc, elem_types,
-                                          ARRAY_SIZE(elem_types), 0);
-
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, width,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_WIDTH);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, height,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_HEIGHT);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, depth,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_DEPTH);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, base,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_BASE);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, row_stride,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_ROW_STRIDE);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, img_stride,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_IMG_STRIDE);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, first_level,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_FIRST_LEVEL);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, last_level,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_LAST_LEVEL);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, mip_offsets,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_MIP_OFFSETS);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, num_samples,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_NUM_SAMPLES);
-   LP_CHECK_MEMBER_OFFSET(struct lp_jit_texture, sample_stride,
-                          gallivm->target, texture_type,
-                          LP_JIT_TEXTURE_SAMPLE_STRIDE);
-   LP_CHECK_STRUCT_SIZE(struct lp_jit_texture,
-                        gallivm->target, texture_type);
-   return texture_type;
-}
-
-static LLVMTypeRef
 create_jit_sampler_type(struct gallivm_state *gallivm)
 {
    LLVMContextRef lc = gallivm->context;
@@ -213,7 +151,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp)
    }
 
    buffer_type = lp_build_create_jit_buffer_type(gallivm);
-   texture_type = create_jit_texture_type(gallivm);
+   texture_type = lp_build_create_jit_texture_type(gallivm);
    sampler_type = create_jit_sampler_type(gallivm);
    image_type = create_jit_image_type(gallivm);
 
@@ -419,7 +357,7 @@ lp_jit_create_cs_types(struct lp_compute_shader_variant *lp)
    LLVMTypeRef texture_type, sampler_type, image_type, buffer_type;
 
    buffer_type = lp_build_create_jit_buffer_type(gallivm);
-   texture_type = create_jit_texture_type(gallivm);
+   texture_type = lp_build_create_jit_texture_type(gallivm);
    sampler_type = create_jit_sampler_type(gallivm);
    image_type = create_jit_image_type(gallivm);
 
index 4505231..a94a562 100644 (file)
@@ -50,23 +50,6 @@ struct lp_compute_shader_variant;
 struct lp_rast_state;
 struct llvmpipe_screen;
 
-
-struct lp_jit_texture
-{
-   uint32_t width;        /* same as number of elements */
-   uint32_t height;
-   uint32_t depth;        /* doubles as array size */
-   const void *base;
-   uint32_t row_stride[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t img_stride[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t first_level;
-   uint32_t last_level;
-   uint32_t mip_offsets[PIPE_MAX_TEXTURE_LEVELS];
-   uint32_t num_samples;
-   uint32_t sample_stride;
-};
-
-
 struct lp_jit_sampler
 {
    float min_lod;
@@ -97,22 +80,6 @@ struct lp_jit_image
 };
 
 enum {
-   LP_JIT_TEXTURE_WIDTH = 0,
-   LP_JIT_TEXTURE_HEIGHT,
-   LP_JIT_TEXTURE_DEPTH,
-   LP_JIT_TEXTURE_BASE,
-   LP_JIT_TEXTURE_ROW_STRIDE,
-   LP_JIT_TEXTURE_IMG_STRIDE,
-   LP_JIT_TEXTURE_FIRST_LEVEL,
-   LP_JIT_TEXTURE_LAST_LEVEL,
-   LP_JIT_TEXTURE_MIP_OFFSETS,
-   LP_JIT_TEXTURE_NUM_SAMPLES,
-   LP_JIT_TEXTURE_SAMPLE_STRIDE,
-   LP_JIT_TEXTURE_NUM_FIELDS  /* number of fields above */
-};
-
-
-enum {
    LP_JIT_SAMPLER_MIN_LOD,
    LP_JIT_SAMPLER_MAX_LOD,
    LP_JIT_SAMPLER_LOD_BIAS,