summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/v3d/v3d_context.h
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2018-12-26 20:56:49 -0800
committerEric Anholt <[email protected]>2019-01-27 08:30:03 -0800
commitc496b60ed8cec0f3a9df35ee96f8765fe38853b7 (patch)
treedb6d29a50efe725c9cf7d73aaf9b46d409312786 /src/gallium/drivers/v3d/v3d_context.h
parent5fe4250a2c7294d4d552759ccce43314dc61189f (diff)
v3d: Create separate sampler states for the various blend formats.
The sampler border color is encoded in the TMU's blending format (half floats, 32-bit floats, or integers) and must be clamped to the format's range unorm/snorm/int ranges by the driver. Additionally, the TMU doesn't know about how we're abusing the swizzle to support BGRA, A, and LA, so we have to pre-swizzle the border color for those. We don't really want to spend half a kb on sampler states in most cases, so skip generating the variants when the border color is unused or is 0,0,0,0.
Diffstat (limited to 'src/gallium/drivers/v3d/v3d_context.h')
-rw-r--r--src/gallium/drivers/v3d/v3d_context.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/gallium/drivers/v3d/v3d_context.h b/src/gallium/drivers/v3d/v3d_context.h
index 1b37681c702..f8f0e64ef9d 100644
--- a/src/gallium/drivers/v3d/v3d_context.h
+++ b/src/gallium/drivers/v3d/v3d_context.h
@@ -88,6 +88,35 @@ void v3d_job_add_bo(struct v3d_job *job, struct v3d_bo *bo);
#define VC5_MAX_FS_INPUTS 64
+enum v3d_sampler_state_variant {
+ V3D_SAMPLER_STATE_BORDER_0,
+ V3D_SAMPLER_STATE_F16,
+ V3D_SAMPLER_STATE_F16_UNORM,
+ V3D_SAMPLER_STATE_F16_SNORM,
+ V3D_SAMPLER_STATE_F16_BGRA,
+ V3D_SAMPLER_STATE_F16_BGRA_UNORM,
+ V3D_SAMPLER_STATE_F16_BGRA_SNORM,
+ V3D_SAMPLER_STATE_F16_A,
+ V3D_SAMPLER_STATE_F16_A_SNORM,
+ V3D_SAMPLER_STATE_F16_A_UNORM,
+ V3D_SAMPLER_STATE_F16_LA,
+ V3D_SAMPLER_STATE_F16_LA_UNORM,
+ V3D_SAMPLER_STATE_F16_LA_SNORM,
+ V3D_SAMPLER_STATE_32,
+ V3D_SAMPLER_STATE_32_UNORM,
+ V3D_SAMPLER_STATE_32_SNORM,
+ V3D_SAMPLER_STATE_32_A,
+ V3D_SAMPLER_STATE_32_A_UNORM,
+ V3D_SAMPLER_STATE_32_A_SNORM,
+ V3D_SAMPLER_STATE_1010102U,
+ V3D_SAMPLER_STATE_16U,
+ V3D_SAMPLER_STATE_16I,
+ V3D_SAMPLER_STATE_8I,
+ V3D_SAMPLER_STATE_8U,
+
+ V3D_SAMPLER_STATE_VARIANT_COUNT,
+};
+
struct v3d_sampler_view {
struct pipe_sampler_view base;
uint32_t p0;
@@ -99,6 +128,8 @@ struct v3d_sampler_view {
/* V3D 4.x: Texture state struct. */
struct v3d_bo *bo;
+ enum v3d_sampler_state_variant sampler_variant;
+
/* Actual texture to be read by this sampler view. May be different
* from base.texture in the case of having a shadow tiled copy of a
* raster texture.
@@ -115,7 +146,9 @@ struct v3d_sampler_state {
uint8_t texture_shader_state[32];
/* V3D 4.x: Sampler state struct. */
struct pipe_resource *sampler_state;
- uint32_t sampler_state_offset;
+ uint32_t sampler_state_offset[V3D_SAMPLER_STATE_VARIANT_COUNT];
+
+ bool border_color_variants;
};
struct v3d_texture_stateobj {