freedreno/ir3: fix register usage calculations
[mesa.git] / src / gallium / auxiliary / gallivm / lp_bld_sample.h
index 803a99e3b0c4009e5b2395d739ee45eb97406d4e..be05b136edbe564be2588eab750f506a808839bd 100644 (file)
@@ -356,9 +356,7 @@ texture_dims(enum pipe_texture_target tex)
    case PIPE_TEXTURE_2D_ARRAY:
    case PIPE_TEXTURE_RECT:
    case PIPE_TEXTURE_CUBE:
-      return 2;
    case PIPE_TEXTURE_CUBE_ARRAY:
-      assert(0);
       return 2;
    case PIPE_TEXTURE_3D:
       return 3;
@@ -368,6 +366,21 @@ texture_dims(enum pipe_texture_target tex)
    }
 }
 
+static INLINE boolean
+has_layer_coord(enum pipe_texture_target tex)
+{
+   switch (tex) {
+   case PIPE_TEXTURE_1D_ARRAY:
+   case PIPE_TEXTURE_2D_ARRAY:
+   /* cube is not layered but 3rd coord (after cube mapping) behaves the same */
+   case PIPE_TEXTURE_CUBE:
+   case PIPE_TEXTURE_CUBE_ARRAY:
+      return TRUE;
+   default:
+      return FALSE;
+   }
+}
+
 
 boolean
 lp_sampler_wrap_mode_uses_border_color(unsigned mode,
@@ -457,11 +470,25 @@ lp_build_unnormalized_coords(struct lp_build_sample_context *bld,
 void
 lp_build_cube_lookup(struct lp_build_sample_context *bld,
                      LLVMValueRef *coords,
-                     const struct lp_derivatives *derivs, /* optional */
+                     const struct lp_derivatives *derivs_in, /* optional */
                      LLVMValueRef *rho,
+                     struct lp_derivatives *derivs_out, /* optional */
                      boolean need_derivs);
 
 
+void
+lp_build_cube_new_coords(struct lp_build_context *ivec_bld,
+                         LLVMValueRef face,
+                         LLVMValueRef x0,
+                         LLVMValueRef x1,
+                         LLVMValueRef y0,
+                         LLVMValueRef y1,
+                         LLVMValueRef max_coord,
+                         LLVMValueRef new_faces[4],
+                         LLVMValueRef new_xcoords[4][2],
+                         LLVMValueRef new_ycoords[4][2]);
+
+
 void
 lp_build_sample_partial_offset(struct lp_build_context *bld,
                                unsigned block_length,
@@ -533,7 +560,8 @@ lp_build_sample_nop(struct gallivm_state *gallivm,
 LLVMValueRef
 lp_build_minify(struct lp_build_context *bld,
                 LLVMValueRef base_size,
-                LLVMValueRef level);
+                LLVMValueRef level,
+                boolean lod_scalar);
 
 
 #endif /* LP_BLD_SAMPLE_H */