gallivm,llvmpipe: handle TXF (texelFetch) instruction, including offsets
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_sample.h
index d8a068d5497a3f418549bae708016956b2df8fa6..7fc432cb4c2efaf237258d9d0645461d452c1a5f 100644 (file)
@@ -210,6 +210,9 @@ struct lp_build_sample_context
    /** SIMD vector width */
    unsigned vector_width;
 
+   /** number of lod values (valid are 1, length/4, length) */
+   unsigned num_lods;
+
    /** regular scalar float type */
    struct lp_type float_type;
    struct lp_build_context float_bld;
@@ -230,10 +233,18 @@ struct lp_build_sample_context
    struct lp_build_context int_coord_bld;
 
    /** Unsigned integer texture size */
+   struct lp_type int_size_in_type;
+   struct lp_build_context int_size_in_bld;
+
+   /** Float incoming texture size */
+   struct lp_type float_size_in_type;
+   struct lp_build_context float_size_in_bld;
+
+   /** Unsigned integer texture size (might be per quad) */
    struct lp_type int_size_type;
    struct lp_build_context int_size_bld;
 
-   /** Unsigned integer texture size */
+   /** Float texture size (might be per quad) */
    struct lp_type float_size_type;
    struct lp_build_context float_size_bld;
 
@@ -298,6 +309,7 @@ texture_dims(enum pipe_texture_target tex)
 {
    switch (tex) {
    case PIPE_TEXTURE_1D:
+   case PIPE_BUFFER:
       return 1;
    case PIPE_TEXTURE_2D:
    case PIPE_TEXTURE_RECT:
@@ -355,6 +367,11 @@ lp_build_get_mipmap_level(struct lp_build_sample_context *bld,
                           LLVMValueRef level);
 
 
+LLVMValueRef
+lp_build_get_mip_offsets(struct lp_build_sample_context *bld,
+                         LLVMValueRef level);
+
+
 void
 lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
                             LLVMValueRef ilevel,
@@ -365,7 +382,7 @@ lp_build_mipmap_level_sizes(struct lp_build_sample_context *bld,
 
 void
 lp_build_extract_image_sizes(struct lp_build_sample_context *bld,
-                             struct lp_type size_type,
+                             struct lp_build_context *size_bld,
                              struct lp_type coord_type,
                              LLVMValueRef size,
                              LLVMValueRef *out_width,
@@ -418,9 +435,10 @@ lp_build_sample_soa(struct gallivm_state *gallivm,
                     const struct lp_sampler_static_state *static_state,
                     struct lp_sampler_dynamic_state *dynamic_state,
                     struct lp_type fp_type,
+                    boolean is_fetch,
                     unsigned unit,
-                    unsigned num_coords,
                     const LLVMValueRef *coords,
+                    const LLVMValueRef *offsets,
                     const struct lp_derivatives *derivs,
                     LLVMValueRef lod_bias,
                     LLVMValueRef explicit_lod,
@@ -448,7 +466,6 @@ lp_build_size_query_soa(struct gallivm_state *gallivm,
 void
 lp_build_sample_nop(struct gallivm_state *gallivm, 
                     struct lp_type type,
-                    unsigned num_coords,
                     const LLVMValueRef *coords,
                     LLVMValueRef texel_out[4]);