intel/compiler: add scale_factors to sampler_prog_key_data
authorTapani Pälli <tapani.palli@intel.com>
Mon, 11 Feb 2019 08:06:09 +0000 (10:06 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 12 Feb 2019 06:42:25 +0000 (08:42 +0200)
Patch propagates given scale_factors to lowering options.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/intel/compiler/brw_compiler.h
src/intel/compiler/brw_nir.c
src/mesa/drivers/dri/i965/brw_wm.c

index 61a4528d372c8783153c7f4efd0410d8d03941c0..560f2c3c6ba673c96d5cb1d7b804a6c8ae54a51e 100644 (file)
@@ -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];
 };
 
 /**
index 9dbf06004a4f1b24dd0392612c36c90c3f7d34a8..d0b1ba6e3d21afd39ad48c488fb4e8fca1afef1c 100644 (file)
@@ -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);
index 7bbb61663449edd05537bf05819e691ce5d44ee0..9092c560451c618a0cf4042077b4db72c1a88b34 100644 (file)
@@ -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];