[SPIR-V] Decorate whole gl_PerVertex with Invariant
Block members can be decorated with Invariant only since SPIR-V 1.5 Revision 2. In earlier versions, Invariant can be used only for variables. Mesa warns about this.
This commit is contained in:
parent
7dd715ea6f
commit
0b4f5ef286
|
@ -1226,15 +1226,13 @@ void SpirvShaderTranslator::StartVertexOrTessEvalShaderBeforeMain() {
|
||||||
builder_->makeStructType(struct_per_vertex_members, "gl_PerVertex");
|
builder_->makeStructType(struct_per_vertex_members, "gl_PerVertex");
|
||||||
builder_->addMemberName(type_struct_per_vertex,
|
builder_->addMemberName(type_struct_per_vertex,
|
||||||
kOutputPerVertexMemberPosition, "gl_Position");
|
kOutputPerVertexMemberPosition, "gl_Position");
|
||||||
builder_->addMemberDecoration(type_struct_per_vertex,
|
|
||||||
kOutputPerVertexMemberPosition,
|
|
||||||
spv::DecorationInvariant);
|
|
||||||
builder_->addMemberDecoration(type_struct_per_vertex,
|
builder_->addMemberDecoration(type_struct_per_vertex,
|
||||||
kOutputPerVertexMemberPosition,
|
kOutputPerVertexMemberPosition,
|
||||||
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
||||||
builder_->addDecoration(type_struct_per_vertex, spv::DecorationBlock);
|
builder_->addDecoration(type_struct_per_vertex, spv::DecorationBlock);
|
||||||
output_per_vertex_ = builder_->createVariable(
|
output_per_vertex_ = builder_->createVariable(
|
||||||
spv::NoPrecision, spv::StorageClassOutput, type_struct_per_vertex, "");
|
spv::NoPrecision, spv::StorageClassOutput, type_struct_per_vertex, "");
|
||||||
|
builder_->addDecoration(output_per_vertex_, spv::DecorationInvariant);
|
||||||
main_interface_.push_back(output_per_vertex_);
|
main_interface_.push_back(output_per_vertex_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1178,9 +1178,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||||
builder.makeStructType(id_vector_temp, "gl_PerVertex");
|
builder.makeStructType(id_vector_temp, "gl_PerVertex");
|
||||||
builder.addMemberName(type_struct_out_gl_per_vertex,
|
builder.addMemberName(type_struct_out_gl_per_vertex,
|
||||||
member_out_gl_per_vertex_position, "gl_Position");
|
member_out_gl_per_vertex_position, "gl_Position");
|
||||||
builder.addMemberDecoration(type_struct_out_gl_per_vertex,
|
|
||||||
member_out_gl_per_vertex_position,
|
|
||||||
spv::DecorationInvariant);
|
|
||||||
builder.addMemberDecoration(type_struct_out_gl_per_vertex,
|
builder.addMemberDecoration(type_struct_out_gl_per_vertex,
|
||||||
member_out_gl_per_vertex_position,
|
member_out_gl_per_vertex_position,
|
||||||
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
spv::DecorationBuiltIn, spv::BuiltInPosition);
|
||||||
|
@ -1188,9 +1185,6 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||||
builder.addMemberName(type_struct_out_gl_per_vertex,
|
builder.addMemberName(type_struct_out_gl_per_vertex,
|
||||||
member_out_gl_per_vertex_clip_distance,
|
member_out_gl_per_vertex_clip_distance,
|
||||||
"gl_ClipDistance");
|
"gl_ClipDistance");
|
||||||
builder.addMemberDecoration(type_struct_out_gl_per_vertex,
|
|
||||||
member_out_gl_per_vertex_clip_distance,
|
|
||||||
spv::DecorationInvariant);
|
|
||||||
builder.addMemberDecoration(
|
builder.addMemberDecoration(
|
||||||
type_struct_out_gl_per_vertex, member_out_gl_per_vertex_clip_distance,
|
type_struct_out_gl_per_vertex, member_out_gl_per_vertex_clip_distance,
|
||||||
spv::DecorationBuiltIn, spv::BuiltInClipDistance);
|
spv::DecorationBuiltIn, spv::BuiltInClipDistance);
|
||||||
|
@ -1199,6 +1193,7 @@ VkShaderModule VulkanPipelineCache::GetGeometryShader(GeometryShaderKey key) {
|
||||||
spv::Id out_gl_per_vertex =
|
spv::Id out_gl_per_vertex =
|
||||||
builder.createVariable(spv::NoPrecision, spv::StorageClassOutput,
|
builder.createVariable(spv::NoPrecision, spv::StorageClassOutput,
|
||||||
type_struct_out_gl_per_vertex, "");
|
type_struct_out_gl_per_vertex, "");
|
||||||
|
builder.addDecoration(out_gl_per_vertex, spv::DecorationInvariant);
|
||||||
main_interface.push_back(out_gl_per_vertex);
|
main_interface.push_back(out_gl_per_vertex);
|
||||||
|
|
||||||
// Begin the main function.
|
// Begin the main function.
|
||||||
|
|
Loading…
Reference in New Issue