mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 02:10:12 +01:00
spirv: set variables to restrict by default
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5207>
This commit is contained in:
parent
1be67d610f
commit
c344c083fc
3 changed files with 13 additions and 1 deletions
|
|
@ -4171,6 +4171,7 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
|||
break;
|
||||
}
|
||||
|
||||
b->mem_model = w[2];
|
||||
switch (w[2]) {
|
||||
case SpvMemoryModelSimple:
|
||||
case SpvMemoryModelGLSL450:
|
||||
|
|
|
|||
|
|
@ -685,6 +685,9 @@ struct vtn_builder {
|
|||
|
||||
/* when a physical memory model is choosen */
|
||||
bool physical_ptrs;
|
||||
|
||||
/* memory model specified by OpMemoryModel */
|
||||
unsigned mem_model;
|
||||
};
|
||||
|
||||
nir_ssa_def *
|
||||
|
|
|
|||
|
|
@ -1595,6 +1595,9 @@ apply_var_decoration(struct vtn_builder *b,
|
|||
case SpvDecorationRestrict:
|
||||
var_data->access |= ACCESS_RESTRICT;
|
||||
break;
|
||||
case SpvDecorationAliased:
|
||||
var_data->access &= ~ACCESS_RESTRICT;
|
||||
break;
|
||||
case SpvDecorationVolatile:
|
||||
var_data->access |= ACCESS_VOLATILE;
|
||||
break;
|
||||
|
|
@ -1635,7 +1638,6 @@ apply_var_decoration(struct vtn_builder *b,
|
|||
case SpvDecorationRowMajor:
|
||||
case SpvDecorationColMajor:
|
||||
case SpvDecorationMatrixStride:
|
||||
case SpvDecorationAliased:
|
||||
case SpvDecorationUniform:
|
||||
case SpvDecorationUniformId:
|
||||
case SpvDecorationLinkageAttributes:
|
||||
|
|
@ -2425,6 +2427,12 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
|
|||
if (var_initializer)
|
||||
var->var->pointer_initializer = var_initializer;
|
||||
|
||||
if (var->mode == vtn_variable_mode_uniform ||
|
||||
var->mode == vtn_variable_mode_ssbo) {
|
||||
/* SSBOs and images are assumed to not alias in the Simple, GLSL and Vulkan memory models */
|
||||
var->var->data.access |= b->mem_model != SpvMemoryModelOpenCL ? ACCESS_RESTRICT : 0;
|
||||
}
|
||||
|
||||
vtn_foreach_decoration(b, val, var_decoration_cb, var);
|
||||
vtn_foreach_decoration(b, val, ptr_decoration_cb, val->pointer);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue