aboutsummaryrefslogtreecommitdiffstats
path: root/src/broadcom
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2017-10-24 12:29:39 -0700
committerEric Anholt <[email protected]>2017-10-30 13:31:16 -0700
commiteecdbaa98578110523b04b8a4f160b8df2dea82f (patch)
treec4f4d57912314d50450b72a1b16ff643b0994609 /src/broadcom
parente798455330d15d7c99b5ebe36f7de0793aae39b5 (diff)
broadcom/vc5: Add PIPE_TEX_WRAP_CLAMP support for linear-filtered textures.
I already had the texture's wrapping set up to use different behavior for nearest or linear, so we just needed to saturate the coordinates in linear mode to get the "proper" blend between the edge and border values.
Diffstat (limited to 'src/broadcom')
-rw-r--r--src/broadcom/compiler/v3d_compiler.h5
-rw-r--r--src/broadcom/compiler/vir.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index 021c88f7b93..56a9d143e32 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -294,8 +294,9 @@ struct v3d_key {
struct {
unsigned compare_mode:1;
unsigned compare_func:3;
- unsigned wrap_s:3;
- unsigned wrap_t:3;
+ bool clamp_s:1;
+ bool clamp_t:1;
+ bool clamp_r:1;
};
struct {
uint16_t msaa_width, msaa_height;
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 99b31841b37..d9201e68dc5 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -553,6 +553,13 @@ v3d_lower_nir(struct v3d_compile *c)
for (int i = 0; i < ARRAY_SIZE(c->key->tex); i++) {
for (int j = 0; j < 4; j++)
tex_options.swizzles[i][j] = c->key->tex[i].swizzle[j];
+
+ if (c->key->tex[i].clamp_s)
+ tex_options.saturate_s |= 1 << i;
+ if (c->key->tex[i].clamp_t)
+ tex_options.saturate_t |= 1 << i;
+ if (c->key->tex[i].clamp_r)
+ tex_options.saturate_r |= 1 << i;
}
NIR_PASS_V(c->s, nir_lower_tex, &tex_options);