mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-07 06:08:16 +02:00
vk: Use binding instead of index in uniform layout qualifiers
This more closely matches what the Vulkan docs say to do.
This commit is contained in:
parent
e37a89136f
commit
edff076188
5 changed files with 13 additions and 15 deletions
|
|
@ -2647,14 +2647,14 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
|
|||
}
|
||||
|
||||
if (qual->flags.q.vk_set) {
|
||||
if (!qual->flags.q.explicit_index)
|
||||
if (!qual->flags.q.explicit_binding)
|
||||
_mesa_glsl_error(loc, state,
|
||||
"Vulkan descriptor set layout requires both group and index "
|
||||
"qualifiers");
|
||||
"Vulkan descriptor set layout requires both set "
|
||||
"and binding qualifiers");
|
||||
|
||||
var->data.vk_set = true;
|
||||
var->data.set = qual->set;
|
||||
var->data.index = qual->index;
|
||||
var->data.binding = qual->binding;
|
||||
} else if (qual->flags.q.explicit_location) {
|
||||
validate_explicit_location(qual, var, state, loc);
|
||||
} else if (qual->flags.q.explicit_index) {
|
||||
|
|
@ -5794,7 +5794,7 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
|
||||
var->data.vk_set = this->layout.flags.q.vk_set;
|
||||
var->data.set = this->layout.set;
|
||||
var->data.index = this->layout.index;
|
||||
var->data.binding = this->layout.binding;
|
||||
|
||||
state->symbols->add_variable(var);
|
||||
instructions->push_tail(var);
|
||||
|
|
@ -5870,7 +5870,7 @@ ast_interface_block::hir(exec_list *instructions,
|
|||
|
||||
var->data.vk_set = this->layout.flags.q.vk_set;
|
||||
var->data.set = this->layout.set;
|
||||
var->data.index = this->layout.index;
|
||||
var->data.binding = this->layout.binding;
|
||||
|
||||
state->symbols->add_variable(var);
|
||||
instructions->push_tail(var);
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
|
|||
|
||||
if (q.flags.q.vk_set) {
|
||||
this->set = q.set;
|
||||
this->index = q.index;
|
||||
this->binding = q.binding;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1424,9 +1424,7 @@ layout_qualifier_id:
|
|||
}
|
||||
}
|
||||
|
||||
if ((state->ARB_shading_language_420pack_enable ||
|
||||
state->has_atomic_counters()) &&
|
||||
match_layout_qualifier("binding", $1, state) == 0) {
|
||||
if (match_layout_qualifier("binding", $1, state) == 0) {
|
||||
$$.flags.q.explicit_binding = 1;
|
||||
$$.binding = $3;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ anv_device_init_meta_blit_state(struct anv_device *device)
|
|||
VkShader fs = GLSL_VK_SHADER(device, FRAGMENT,
|
||||
out vec4 f_color;
|
||||
in vec4 v_tex_coord;
|
||||
layout(set = 0, index = 0) uniform sampler2D u_tex;
|
||||
layout(set = 0, binding = 0) uniform sampler2D u_tex;
|
||||
void main()
|
||||
{
|
||||
f_color = texture2D(u_tex, v_tex_coord.xy);
|
||||
|
|
|
|||
|
|
@ -103,13 +103,13 @@ create_pipeline(VkDevice device, VkPipeline *pipeline,
|
|||
static const char vs_source[] = GLSL(
|
||||
layout(location = 0) in vec4 a_position;
|
||||
layout(location = 1) in vec4 a_color;
|
||||
layout(set = 0, index = 0) uniform block1 {
|
||||
layout(set = 0, binding = 0) uniform block1 {
|
||||
vec4 color;
|
||||
} u1;
|
||||
layout(set = 0, index = 1) uniform block2 {
|
||||
layout(set = 0, binding = 1) uniform block2 {
|
||||
vec4 color;
|
||||
} u2;
|
||||
layout(set = 1, index = 0) uniform block3 {
|
||||
layout(set = 1, binding = 0) uniform block3 {
|
||||
vec4 color;
|
||||
} u3;
|
||||
out vec4 v_color;
|
||||
|
|
@ -122,7 +122,7 @@ create_pipeline(VkDevice device, VkPipeline *pipeline,
|
|||
static const char fs_source[] = GLSL(
|
||||
out vec4 f_color;
|
||||
in vec4 v_color;
|
||||
layout(set = 0, index = 0) uniform sampler2D tex;
|
||||
layout(set = 0, binding = 0) uniform sampler2D tex;
|
||||
void main()
|
||||
{
|
||||
f_color = v_color + texture2D(tex, vec2(0.1, 0.1));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue