gallivm,llvmpipe,draw: Support multiple constant buffers.
[mesa.git] / src / gallium / drivers / llvmpipe / lp_jit.h
index 94a2bb5ff3651f1053253ddee02db60600826c67..5dc5bc4c4bf34b2d931737e5e26fd118940aa1f5 100644 (file)
@@ -37,6 +37,7 @@
 
 
 #include "gallivm/lp_bld_struct.h"
+#include "gallivm/lp_bld_limits.h"
 
 #include "pipe/p_state.h"
 #include "lp_texture.h"
@@ -97,14 +98,14 @@ enum {
  */
 struct lp_jit_context
 {
-   const float *constants;
+   const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
 
    float alpha_ref_value;
 
    uint32_t stencil_ref_front, stencil_ref_back;
 
-   /* FIXME: store (also?) in floats */
-   uint8_t *blend_color;
+   uint8_t *u8_blend_color;
+   float *f_blend_color;
 
    struct lp_jit_texture textures[PIPE_MAX_SAMPLERS];
 };
@@ -119,14 +120,15 @@ enum {
    LP_JIT_CTX_ALPHA_REF,
    LP_JIT_CTX_STENCIL_REF_FRONT,
    LP_JIT_CTX_STENCIL_REF_BACK,
-   LP_JIT_CTX_BLEND_COLOR,
+   LP_JIT_CTX_U8_BLEND_COLOR,
+   LP_JIT_CTX_F_BLEND_COLOR,
    LP_JIT_CTX_TEXTURES,
    LP_JIT_CTX_COUNT
 };
 
 
 #define lp_jit_context_constants(_gallivm, _ptr) \
-   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
+   lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
 
 #define lp_jit_context_alpha_ref_value(_gallivm, _ptr) \
    lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
@@ -137,14 +139,33 @@ enum {
 #define lp_jit_context_stencil_ref_back_value(_gallivm, _ptr) \
    lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back")
 
-#define lp_jit_context_blend_color(_gallivm, _ptr) \
-   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_BLEND_COLOR, "blend_color")
+#define lp_jit_context_u8_blend_color(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_U8_BLEND_COLOR, "u8_blend_color")
+
+#define lp_jit_context_f_blend_color(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_F_BLEND_COLOR, "f_blend_color")
 
 #define lp_jit_context_textures(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
 
 
 
+/**
+ * typedef for fragment shader function
+ *
+ * @param context       jit context
+ * @param x             block start x
+ * @param y             block start y
+ * @param facing        is front facing
+ * @param a0            shader input a0
+ * @param dadx          shader input dadx
+ * @param dady          shader input dady
+ * @param color         color buffer
+ * @param depth         depth buffer
+ * @param mask          mask of visible pixels in block
+ * @param thread_data   task thread data
+ * @param stride        color buffer row stride in bytes
+ */
 typedef void
 (*lp_jit_frag_func)(const struct lp_jit_context *context,
                     uint32_t x,
@@ -156,7 +177,8 @@ typedef void
                     uint8_t **color,
                     void *depth,
                     uint32_t mask,
-                    uint32_t *counter);
+                    uint32_t *counter,
+                    unsigned *stride);
 
 
 void