diff options
author | Dave Airlie <airlied@redhat.com> | 2016-12-23 04:34:43 +0000 |
---|---|---|
committer | Edward O'Callaghan <funfunctor@folklore1984.net> | 2017-02-20 18:42:48 +1100 |
commit | 4089a7dfb9f9c99f73e395c99b9a338f879ab406 (patch) | |
tree | 643a259721bb522073ad8c811599eb414011e04c | |
parent | 0a44a680ff702bb4488c345db84a35c190be345e (diff) |
[rfc] spirv: work around doom shaders having load/store to sampler typesradv-doom2016
Doom appears to generate SPIR-V that loads/store samplers before
passing them to functions, this confuses NIR, but I'm not sure
it's illegal.
Workaround this by replacing the value on store with the access
chain from the src.
This gets doom a bit further.
Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 293d07d68b..f6245098f7 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1609,6 +1609,14 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode, case SpvOpStore: { struct vtn_access_chain *dest = vtn_value(b, w[1], vtn_value_type_access_chain)->access_chain; + + if (glsl_get_base_type(dest->var->type->type) == GLSL_TYPE_SAMPLER) { + struct vtn_value *val = vtn_untyped_value(b, w[2]); + dest->var = val->access_chain->var; + b->values[w[1]].value_type = vtn_value_type_invalid; + vtn_push_value(b, w[1], vtn_value_type_access_chain)->access_chain = val->access_chain; + return; + } struct vtn_ssa_value *src = vtn_ssa_value(b, w[2]); vtn_variable_store(b, src, dest); break; |