aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_program.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-09-29 17:10:50 -0700
committerKristian Høgsberg Kristensen <[email protected]>2015-10-01 14:24:29 -0700
commit005c8e01062e8e88a86904b955d5422742bd32e7 (patch)
treec32b3e01c2dd93257dc7255a8f3aa99a60551035 /src/mesa/drivers/dri/i965/brw_program.c
parent337caee91078e3d83ff01b929a44a74600cde6a7 (diff)
parentcb758b892a7e62ff1f6187f2ca9ac543ff70a096 (diff)
Merge branch 'master' of ../mesa into vulkan
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_program.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index 5a54cd39076..fa59338950a 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -588,3 +588,22 @@ brw_dump_ir(const char *stage, struct gl_shader_program *shader_prog,
_mesa_print_program(prog);
}
}
+
+void
+brw_setup_tex_for_precompile(struct brw_context *brw,
+ struct brw_sampler_prog_key_data *tex,
+ struct gl_program *prog)
+{
+ const bool has_shader_channel_select = brw->is_haswell || brw->gen >= 8;
+ unsigned sampler_count = _mesa_fls(prog->SamplersUsed);
+ for (unsigned i = 0; i < sampler_count; i++) {
+ if (!has_shader_channel_select && (prog->ShadowSamplers & (1 << i))) {
+ /* Assume DEPTH_TEXTURE_MODE is the default: X, X, X, 1 */
+ tex->swizzles[i] =
+ MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE);
+ } else {
+ /* Color sampler: assume no swizzling. */
+ tex->swizzles[i] = SWIZZLE_XYZW;
+ }
+ }
+}