summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-07-20 15:10:57 -0700
committerJason Ekstrand <[email protected]>2018-07-23 00:36:39 -0700
commitd0ee0a0a5d5fb658c87fed82cbcf9b48437abb2c (patch)
tree3acca97e4292c0a8bbe78ca9e42730c63365c1e9
parentabd629eb3d4027b89c13158e90c6732b412e550e (diff)
intel/blorp: Fix blits to R8G8B8_UNORM_SRGB sRGB harder
The first fix attempt contained a nasty typo which somehow didn't get caught in review. It also didn't work as intended because the sRGB conversion was happening but then throwing away all but the red channel because it dind't know it was RGB. Really, it's my fault for trying to fix a bug without first writing tests. I've now written tests and they pass with this change. :) Fixes: 11712b9ca17 "intel/blorp: Fix blits to R8G8B8_UNORM_SRGB" Reviewed-by: Lionel Landwerlin <[email protected]>
-rw-r--r--src/intel/blorp/blorp_blit.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index a18f96a0ae1..c85ec8543a9 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -993,6 +993,8 @@ convert_color(struct nir_builder *b, nir_ssa_def *color,
value = nir_fmul(b, nir_fsat(b, nir_channel(b, color, 0)),
nir_imm_float(b, factor));
} else if (key->dst_format == ISL_FORMAT_L8_UNORM_SRGB) {
+ value = nir_format_linear_to_srgb(b, nir_channel(b, color, 0));
+ } else if (key->dst_format == ISL_FORMAT_R8G8B8_UNORM_SRGB) {
value = nir_format_linear_to_srgb(b, color);
} else if (key->dst_format == ISL_FORMAT_R9G9B9E5_SHAREDEXP) {
value = nir_format_pack_r9g9b9e5(b, color);
@@ -1000,8 +1002,14 @@ convert_color(struct nir_builder *b, nir_ssa_def *color,
unreachable("Unsupported format conversion");
}
- nir_ssa_def *u = nir_ssa_undef(b, 1, 32);
- return nir_vec4(b, value, u, u, u);
+ nir_ssa_def *out_comps[4];
+ for (unsigned i = 0; i < 4; i++) {
+ if (i < value->num_components)
+ out_comps[i] = nir_channel(b, value, i);
+ else
+ out_comps[i] = nir_ssa_undef(b, 1, 32);
+ }
+ return nir_vec(b, out_comps, 4);
}
/**
@@ -1956,7 +1964,7 @@ try_blorp_blit(struct blorp_batch *batch,
/* If it happens to be sRGB, we need to force a conversion */
if (params->dst.view.format == ISL_FORMAT_R8G8B8_UNORM_SRGB)
- wm_prog_key->dst_format = ISL_FORMAT_R9G9B9E5_SHAREDEXP;
+ wm_prog_key->dst_format = ISL_FORMAT_R8G8B8_UNORM_SRGB;
surf_fake_rgb_with_red(batch->blorp->isl_dev, &params->dst);