gallium: add GREMEDY_string_marker
[mesa.git] / src / gallium / drivers / llvmpipe / lp_jit.h
index 2ecfde75a09cd1a4e9b7fcb9c7e2b90c789682fe..9db26f2cba91d20b0651411c2319e79c34585694 100644 (file)
@@ -43,6 +43,7 @@
 #include "lp_texture.h"
 
 
+struct lp_build_format_cache;
 struct lp_fragment_shader_variant;
 struct llvmpipe_screen;
 
@@ -70,6 +71,13 @@ struct lp_jit_sampler
 };
 
 
+struct lp_jit_viewport
+{
+   float min_depth;
+   float max_depth;
+};
+
+
 enum {
    LP_JIT_TEXTURE_WIDTH = 0,
    LP_JIT_TEXTURE_HEIGHT,
@@ -93,6 +101,13 @@ enum {
 };
 
 
+enum {
+   LP_JIT_VIEWPORT_MIN_DEPTH,
+   LP_JIT_VIEWPORT_MAX_DEPTH,
+   LP_JIT_VIEWPORT_NUM_FIELDS /* number of fields above */
+};
+
+
 /**
  * This structure is passed directly to the generated fragment shader.
  *
@@ -107,6 +122,7 @@ enum {
 struct lp_jit_context
 {
    const float *constants[LP_MAX_TGSI_CONST_BUFFERS];
+   int num_constants[LP_MAX_TGSI_CONST_BUFFERS];
 
    float alpha_ref_value;
 
@@ -115,6 +131,8 @@ struct lp_jit_context
    uint8_t *u8_blend_color;
    float *f_blend_color;
 
+   struct lp_jit_viewport *viewports;
+
    struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
    struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
 };
@@ -126,11 +144,13 @@ struct lp_jit_context
  */
 enum {
    LP_JIT_CTX_CONSTANTS = 0,
+   LP_JIT_CTX_NUM_CONSTANTS,
    LP_JIT_CTX_ALPHA_REF,
    LP_JIT_CTX_STENCIL_REF_FRONT,
    LP_JIT_CTX_STENCIL_REF_BACK,
    LP_JIT_CTX_U8_BLEND_COLOR,
    LP_JIT_CTX_F_BLEND_COLOR,
+   LP_JIT_CTX_VIEWPORTS,
    LP_JIT_CTX_TEXTURES,
    LP_JIT_CTX_SAMPLERS,
    LP_JIT_CTX_COUNT
@@ -140,6 +160,9 @@ enum {
 #define lp_jit_context_constants(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_CONSTANTS, "constants")
 
+#define lp_jit_context_num_constants(_gallivm, _ptr) \
+   lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_NUM_CONSTANTS, "num_constants")
+
 #define lp_jit_context_alpha_ref_value(_gallivm, _ptr) \
    lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value")
 
@@ -155,6 +178,9 @@ enum {
 #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_viewports(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_CTX_VIEWPORTS, "viewports")
+
 #define lp_jit_context_textures(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
 
@@ -164,20 +190,37 @@ enum {
 
 struct lp_jit_thread_data
 {
-   uint32_t vis_counter;
+   struct lp_build_format_cache *cache;
+   uint64_t vis_counter;
+
+   /*
+    * Non-interpolated rasterizer state passed through to the fragment shader.
+    */
+   struct {
+      uint32_t viewport_index;
+   } raster_state;
 };
 
 
 enum {
-   LP_JIT_THREAD_DATA_COUNTER = 0,
+   LP_JIT_THREAD_DATA_CACHE = 0,
+   LP_JIT_THREAD_DATA_COUNTER,
+   LP_JIT_THREAD_DATA_RASTER_STATE_VIEWPORT_INDEX,
    LP_JIT_THREAD_DATA_COUNT
 };
 
 
+#define lp_jit_thread_data_cache(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, LP_JIT_THREAD_DATA_CACHE, "cache")
+
 #define lp_jit_thread_data_counter(_gallivm, _ptr) \
    lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_THREAD_DATA_COUNTER, "counter")
 
-
+#define lp_jit_thread_data_raster_state_viewport_index(_gallivm, _ptr) \
+   lp_build_struct_get(_gallivm, _ptr, \
+                       LP_JIT_THREAD_DATA_RASTER_STATE_VIEWPORT_INDEX, \
+                       "raster_state.viewport_index")
 /**
  * typedef for fragment shader function
  *
@@ -215,7 +258,7 @@ void
 lp_jit_screen_cleanup(struct llvmpipe_screen *screen);
 
 
-void
+boolean
 lp_jit_screen_init(struct llvmpipe_screen *screen);