summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2019-02-11 10:06:09 +0200
committerTapani Pälli <[email protected]>2019-02-12 08:42:25 +0200
commit3da858a6b990c51615067df42d1fdc203bbe8ed5 (patch)
tree60f49d466f0c43b5626fa89a62b36d72c9e9b45a /src
parent722f96bfc83b7ab2981756e5d887d0dc8ee1b4f0 (diff)
intel/compiler: add scale_factors to sampler_prog_key_data
Patch propagates given scale_factors to lowering options. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/compiler/brw_compiler.h3
-rw-r--r--src/intel/compiler/brw_nir.c4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c1
3 files changed, 8 insertions, 0 deletions
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 61a4528d372..560f2c3c6ba 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -196,6 +196,9 @@ struct brw_sampler_prog_key_data {
uint32_t yx_xuxv_image_mask;
uint32_t xy_uxvx_image_mask;
uint32_t ayuv_image_mask;
+
+ /* Scale factor for each texture. */
+ float scale_factors[32];
};
/**
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 9dbf06004a4..d0b1ba6e3d2 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -964,6 +964,10 @@ brw_nir_apply_sampler_key(nir_shader *nir,
tex_options.lower_xy_uxvx_external = key_tex->xy_uxvx_image_mask;
tex_options.lower_ayuv_external = key_tex->ayuv_image_mask;
+ /* Setup array of scaling factors for each texture. */
+ memcpy(&tex_options.scale_factors, &key_tex->scale_factors,
+ sizeof(tex_options.scale_factors));
+
if (nir_lower_tex(nir, &tex_options)) {
nir_validate_shader(nir, "after nir_lower_tex");
nir = brw_nir_optimize(nir, compiler, is_scalar, false);
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 7bbb6166344..9092c560451 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -309,6 +309,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const int s = u_bit_scan(&mask);
key->swizzles[s] = SWIZZLE_NOOP;
+ key->scale_factors[s] = 0.0f;
int unit_id = prog->SamplerUnits[s];
const struct gl_texture_unit *unit = &ctx->Texture.Unit[unit_id];