diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-06-22 13:00:08 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-07-13 13:27:40 +0200 |
commit | ab07af81548cb47560115335088ac0912ef1d688 (patch) | |
tree | 388032c309c32fd1ed0655c3edb5a54b0eda0180 | |
parent | 0c05971920b4bea9b6480fb84f56748d5fbce81b (diff) |
spirv: translate default-block uniforms (TODO)
They are supported by SPIR-V for ARB_gl_spirv.
TODO some comments
-rw-r--r-- | src/compiler/spirv/vtn_private.h | 1 | ||||
-rw-r--r-- | src/compiler/spirv/vtn_variables.c | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h index 7cb503568f..57ea6accc3 100644 --- a/src/compiler/spirv/vtn_private.h +++ b/src/compiler/spirv/vtn_private.h @@ -320,6 +320,7 @@ enum vtn_variable_mode { vtn_variable_mode_local, vtn_variable_mode_global, vtn_variable_mode_param, + vtn_variable_mode_uniform, vtn_variable_mode_ubo, vtn_variable_mode_ssbo, vtn_variable_mode_push_constant, diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 5af27bfdb1..441ac59cf9 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -1339,8 +1339,8 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, vtn_var->mode == vtn_variable_mode_output) { is_vertex_input = false; location += vtn_var->patch ? VARYING_SLOT_PATCH0 : VARYING_SLOT_VAR0; - } else { - vtn_warn("Location must be on input or output variable"); + } else if (vtn_var->mode != vtn_variable_mode_uniform) { /* maybe also others, like samplers? */ + vtn_warn("Location must be on input, output, or uniform variable"); return; } @@ -1402,7 +1402,8 @@ vtn_storage_class_to_mode(SpvStorageClass class, mode = vtn_variable_mode_ssbo; nir_mode = 0; } else { - assert(!"Invalid uniform variable type"); + mode = vtn_variable_mode_uniform; + nir_mode = nir_var_uniform; } break; case SpvStorageClassUniformConstant: @@ -1521,12 +1522,14 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val, case vtn_variable_mode_global: case vtn_variable_mode_image: case vtn_variable_mode_sampler: + case vtn_variable_mode_uniform: case vtn_variable_mode_workgroup: /* For these, we create the variable normally */ var->var = rzalloc(b->shader, nir_variable); var->var->name = ralloc_strdup(var->var, val->name); var->var->type = var->type->type; var->var->data.mode = nir_mode; + var->var->data.location = -1; switch (var->mode) { case vtn_variable_mode_image: |