diff options
author | Connor Abbott <connor.w.abbott@intel.com> | 2015-07-08 21:47:43 -0400 |
---|---|---|
committer | Connor Abbott <connor.w.abbott@intel.com> | 2015-07-08 22:03:30 -0400 |
commit | a841e2c747d71916cd6d5cdfd3e66e17912ab9d7 (patch) | |
tree | 30cef63ce575d95f2e61dc54f7dc1121d2255d35 /src | |
parent | 8640dc12dc9d4880a9d4b281d539f3d571815aad (diff) |
vk/compiler: mark inputs/outputs as read/written
This doesn't handle inputs and outputs larger than a vec4, but we plan
to add a varyiing splitting/packing pass to handle those anyways.
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/compiler.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vulkan/compiler.cpp b/src/vulkan/compiler.cpp index fb9615306e6..0a8ec87415f 100644 --- a/src/vulkan/compiler.cpp +++ b/src/vulkan/compiler.cpp @@ -951,6 +951,23 @@ anv_compile_shader_glsl(struct anv_compiler *compiler, } static void +setup_nir_io(struct gl_program *prog, + nir_shader *shader) +{ + foreach_list_typed(nir_variable, var, node, &shader->inputs) { + prog->InputsRead |= BITFIELD64_BIT(var->data.location); + } + + foreach_list_typed(nir_variable, var, node, &shader->outputs) { + /* XXX glslang gives us this but we never use it */ + if (!strcmp(var->name, "gl_PerVertex")) + continue; + + prog->OutputsWritten |= BITFIELD64_BIT(var->data.location); + } +} + +static void anv_compile_shader_spirv(struct anv_compiler *compiler, struct gl_shader_program *program, struct anv_pipeline *pipeline, uint32_t stage) @@ -982,6 +999,8 @@ anv_compile_shader_spirv(struct anv_compiler *compiler, compiler->screen->devinfo, NULL, mesa_shader->Stage); + setup_nir_io(mesa_shader->Program, mesa_shader->Program->nir); + fail_if(mesa_shader->Program->nir == NULL, "failed to translate SPIR-V to NIR\n"); |