+#define lp_jit_context_ssbos(_gallivm, _ptr) \
+ lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SSBOS, "ssbos")
+
+#define lp_jit_context_num_ssbos(_gallivm, _ptr) \
+ lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_NUM_SSBOS, "num_ssbos")
+
+struct lp_jit_thread_data
+{
+ struct lp_build_format_cache *cache;
+ uint64_t vis_counter;
+ uint64_t ps_invocations;
+
+ /*
+ * Non-interpolated rasterizer state passed through to the fragment shader.
+ */
+ struct {
+ uint32_t viewport_index;
+ } raster_state;
+};
+
+
+enum {
+ LP_JIT_THREAD_DATA_CACHE = 0,
+ LP_JIT_THREAD_DATA_COUNTER,
+ LP_JIT_THREAD_DATA_INVOCATIONS,
+ 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_invocations(_gallivm, _ptr) \
+ lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_THREAD_DATA_INVOCATIONS, "invocs")
+
+#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
+ *
+ * @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
+ * @param depth_stride depth buffer row stride in bytes
+ */