summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/lima/lima_program.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2022-09-02 05:18:14 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2022-09-02 05:18:14 +0000
commit5f66494d31f735486b8222ecfa0a0c9046e92543 (patch)
treef699ac8d7f6d510c30bded04f96a1209344f6a47 /lib/mesa/src/gallium/drivers/lima/lima_program.c
parent17a5b543e3479aaa779cc68345c46d437edd05d8 (diff)
Import Mesa 22.1.7
Diffstat (limited to 'lib/mesa/src/gallium/drivers/lima/lima_program.c')
-rw-r--r--lib/mesa/src/gallium/drivers/lima/lima_program.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/mesa/src/gallium/drivers/lima/lima_program.c b/lib/mesa/src/gallium/drivers/lima/lima_program.c
index a4d9b8a0e..9f65b46d3 100644
--- a/lib/mesa/src/gallium/drivers/lima/lima_program.c
+++ b/lib/mesa/src/gallium/drivers/lima/lima_program.c
@@ -62,6 +62,7 @@ static const nir_shader_compiler_options vs_nir_options = {
.lower_insert_byte = true,
.lower_insert_word = true,
.force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
+ .lower_varying_from_uniform = true,
};
static const nir_shader_compiler_options fs_nir_options = {
@@ -82,6 +83,7 @@ static const nir_shader_compiler_options fs_nir_options = {
.lower_bitops = true,
.lower_vector_cmp = true,
.force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp),
+ .lower_varying_from_uniform = true,
};
const void *
@@ -216,6 +218,7 @@ lima_program_optimize_fs_nir(struct nir_shader *s,
nir_var_shader_in | nir_var_shader_out, type_size, 0);
NIR_PASS_V(s, nir_lower_regs_to_ssa);
NIR_PASS_V(s, nir_lower_tex, tex_options);
+ NIR_PASS_V(s, lima_nir_lower_txp);
do {
progress = false;
@@ -283,7 +286,6 @@ lima_fs_compile_shader(struct lima_context *ctx,
nir_shader *nir = nir_shader_clone(fs, ufs->base.ir.nir);
struct nir_lower_tex_options tex_options = {
- .lower_txp = ~0u,
.swizzle_result = ~0u,
};
@@ -591,15 +593,19 @@ lima_update_fs_state(struct lima_context *ctx)
memcpy(key->nir_sha1, ctx->uncomp_fs->nir_sha1,
sizeof(ctx->uncomp_fs->nir_sha1));
+ uint8_t identity[4] = { PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
+ PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W };
for (int i = 0; i < lima_tex->num_textures; i++) {
struct lima_sampler_view *sampler = lima_sampler_view(lima_tex->textures[i]);
+ if (!sampler) {
+ memcpy(key->tex[i].swizzle, identity, 4);
+ continue;
+ }
for (int j = 0; j < 4; j++)
key->tex[i].swizzle[j] = sampler->swizzle[j];
}
/* Fill rest with identity swizzle */
- uint8_t identity[4] = { PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y,
- PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W };
for (int i = lima_tex->num_textures; i < ARRAY_SIZE(key->tex); i++)
memcpy(key->tex[i].swizzle, identity, 4);