summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2016-04-19 09:02:23 -0400
committerRob Clark <[email protected]>2016-04-19 17:14:04 -0400
commit899bd63acefd49a668e11c42d2ad92fa55aa157d (patch)
tree1afc85ddd51bf31412455d7c43fc78d35a91dd25 /src/gallium/drivers/freedreno/ir3
parenteddfc977096c63dc9699b63b05ad0e1212680fb1 (diff)
freedreno/a4xx: lower srgb in shader for astc textures
This *seems* like a hw bug, and maybe only applies to certain a4xx variants/revisions. But setting the SRGB bit in sampler view state (texconst0) causes invalid alpha for ASTC textures. Work around this by doing the srgb->linear conversion in the shader instead. This fixes 392 dEQP tests: dEQP-GLES3.functional.texture.*astc*srgb* (The remaining fails seem to be a bug w/ ASTC + linear filtering, also possibly a420.0 specific.) Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3')
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_nir.c3
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.c2
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_shader.h3
3 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_nir.c b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
index 897b3b963be..7836789de8f 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_nir.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_nir.c
@@ -58,6 +58,7 @@ ir3_key_lowers_nir(const struct ir3_shader_key *key)
{
return key->fsaturate_s | key->fsaturate_t | key->fsaturate_r |
key->vsaturate_s | key->vsaturate_t | key->vsaturate_r |
+ key->vlower_srgb | key->flower_srgb |
key->ucp_enables | key->color_two_side;
}
@@ -85,11 +86,13 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
tex_options.saturate_s = key->fsaturate_s;
tex_options.saturate_t = key->fsaturate_t;
tex_options.saturate_r = key->fsaturate_r;
+ tex_options.lower_srgb = key->flower_srgb;
break;
case SHADER_VERTEX:
tex_options.saturate_s = key->vsaturate_s;
tex_options.saturate_t = key->vsaturate_t;
tex_options.saturate_r = key->vsaturate_r;
+ tex_options.lower_srgb = key->vlower_srgb;
break;
}
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.c b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
index c05b52e7a5e..3d38088510a 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.c
@@ -223,6 +223,7 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
key.vsaturate_s = 0;
key.vsaturate_t = 0;
key.vsaturate_r = 0;
+ key.vlower_srgb = 0;
}
break;
case SHADER_VERTEX:
@@ -233,6 +234,7 @@ ir3_shader_variant(struct ir3_shader *shader, struct ir3_shader_key key)
key.fsaturate_s = 0;
key.fsaturate_t = 0;
key.fsaturate_r = 0;
+ key.flower_srgb = 0;
}
break;
}
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_shader.h b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
index c89dc29ff08..82cde51e635 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_shader.h
+++ b/src/gallium/drivers/freedreno/ir3/ir3_shader.h
@@ -104,6 +104,9 @@ struct ir3_shader_key {
* shader:
*/
uint16_t fsaturate_s, fsaturate_t, fsaturate_r;
+
+ /* bitmask of samplers which need srgb->linear lowering: */
+ uint16_t vlower_srgb, flower_srgb;
};
static inline bool