summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_jit.h
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2013-01-28 06:50:36 -0800
committerRoland Scheidegger <sroland@vmware.com>2013-01-28 06:50:36 -0800
commitc789b981b244333cfc903bcd1e2fefc010500013 (patch)
tree0f0c5375916677240e11a1046af81bb2d5443030 /src/gallium/drivers/llvmpipe/lp_jit.h
parent87592cff57feef29565150b9203e220b50623f30 (diff)
downloadexternal_mesa3d-c789b981b244333cfc903bcd1e2fefc010500013.zip
external_mesa3d-c789b981b244333cfc903bcd1e2fefc010500013.tar.gz
external_mesa3d-c789b981b244333cfc903bcd1e2fefc010500013.tar.bz2
gallivm: split sampler and texture state
Split the sampler interface to use separate sampler and texture (sampler_view) state. This is needed to support dx10-style sampling instructions. This is not quite complete since both draw/llvmpipe don't really track textures/samplers independently yet, as well as the gallivm code not quite using the right sampler or texture index respectively (but it should work for the sampling codes used by opengl). We are however losing some optimizations in the process, apply_max_lod will no longer work, and we potentially could end up with more (unnecessary) recompiles (if switching textures with/without mipmaps only so it shouldn't be too bad). v2: don't use different callback structs for sampler/sampler view functions (which just complicates things), fix up sampling code to actually use the right texture or sampler index, and similar for llvmpipe/draw actually distinguish between samplers and sampler views. v3: fix more of PIPE_MAX_SAMPLER / PIPE_MAX_SHADER_SAMPLER_VIEWS mismatches (both in draw and llvmpipe), based on feedback from José get rid of unneeded static sampler derived state.(which also fixes the only 2 piglit regressions due to a forgotten assignment), fix comments based on Brian's feedback. v4: remove some accidental unrelated whitespace changes Reviewed-by: José Fonseca <jfonseca@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_jit.h')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 5dc5bc4..3057c0d 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -58,7 +58,11 @@ struct lp_jit_texture
uint32_t row_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t img_stride[LP_MAX_TEXTURE_LEVELS];
uint32_t mip_offsets[LP_MAX_TEXTURE_LEVELS];
- /* sampler state, actually */
+};
+
+
+struct lp_jit_sampler
+{
float min_lod;
float max_lod;
float lod_bias;
@@ -76,14 +80,18 @@ enum {
LP_JIT_TEXTURE_ROW_STRIDE,
LP_JIT_TEXTURE_IMG_STRIDE,
LP_JIT_TEXTURE_MIP_OFFSETS,
- LP_JIT_TEXTURE_MIN_LOD,
- LP_JIT_TEXTURE_MAX_LOD,
- LP_JIT_TEXTURE_LOD_BIAS,
- LP_JIT_TEXTURE_BORDER_COLOR,
LP_JIT_TEXTURE_NUM_FIELDS /* number of fields above */
};
+enum {
+ LP_JIT_SAMPLER_MIN_LOD,
+ LP_JIT_SAMPLER_MAX_LOD,
+ LP_JIT_SAMPLER_LOD_BIAS,
+ LP_JIT_SAMPLER_BORDER_COLOR,
+ LP_JIT_SAMPLER_NUM_FIELDS /* number of fields above */
+};
+
/**
* This structure is passed directly to the generated fragment shader.
@@ -107,7 +115,8 @@ struct lp_jit_context
uint8_t *u8_blend_color;
float *f_blend_color;
- struct lp_jit_texture textures[PIPE_MAX_SAMPLERS];
+ struct lp_jit_texture textures[PIPE_MAX_SHADER_SAMPLER_VIEWS];
+ struct lp_jit_sampler samplers[PIPE_MAX_SAMPLERS];
};
@@ -123,6 +132,7 @@ enum {
LP_JIT_CTX_U8_BLEND_COLOR,
LP_JIT_CTX_F_BLEND_COLOR,
LP_JIT_CTX_TEXTURES,
+ LP_JIT_CTX_SAMPLERS,
LP_JIT_CTX_COUNT
};
@@ -148,6 +158,8 @@ enum {
#define lp_jit_context_textures(_gallivm, _ptr) \
lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_TEXTURES, "textures")
+#define lp_jit_context_samplers(_gallivm, _ptr) \
+ lp_build_struct_get_ptr(_gallivm, _ptr, LP_JIT_CTX_SAMPLERS, "samplers")
/**