Roll SPIRV-Headers and SPIRV-Tools

This adds new validation rules that we were breaking.
Binding and DescriptorSet can't be applied to push constants, nor to
struct members.

Bug: skia:12670
Bug: chromium:1270328
Change-Id: I332f77717b08d9945c8e5b79c5bf649a8f5f2043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474056
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
Brian Osman 2021-11-19 10:55:50 -05:00 committed by SkCQ
parent 0cdcf57f8c
commit f72c919a9a
10 changed files with 9 additions and 24 deletions

4
DEPS
View File

@ -38,8 +38,8 @@ deps = {
"third_party/externals/piex" : "https://android.googlesource.com/platform/external/piex.git@bb217acdca1cc0c16b704669dd6f91a1b509c406",
"third_party/externals/sfntly" : "https://chromium.googlesource.com/external/github.com/googlei18n/sfntly.git@b55ff303ea2f9e26702b514cf6a3196a2e3e2974",
"third_party/externals/spirv-cross" : "https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross@0e2880ab990e79ce6cc8c79c219feda42d98b1e8",
"third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@cf653e4ca4858583802b0d1656bc934edff6bd7f",
"third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@11cd875ed88484f93943071083b4821b4c3d2193",
"third_party/externals/spirv-headers" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git@814e728b30ddd0f4509233099a3ad96fd4318c07",
"third_party/externals/spirv-tools" : "https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git@4b092d2ab81854e61632bdd1e658907f0071c37e",
"third_party/externals/swiftshader" : "https://swiftshader.googlesource.com/SwiftShader@f5cf2d08ff9c05779fbd48de0e6b7088965f2955",
#"third_party/externals/v8" : "https://chromium.googlesource.com/v8/v8.git@5f1ae66d5634e43563b2d25ea652dfb94c31a3b4",
"third_party/externals/wuffs" : "https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git@600cd96cf47788ee3a74b40a6028b035c9fd6a61",

View File

@ -7,7 +7,7 @@ A a3;
struct B {
float x;
float y[2];
layout(binding=1) A z;
A z;
};
B b1, b2, b3;

View File

@ -2951,11 +2951,12 @@ SpvId SPIRVCodeGenerator::writeFunction(const FunctionDefinition& f, OutputStrea
}
void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) {
bool isPushConstant = (layout.fFlags & Layout::kPushConstant_Flag);
if (layout.fLocation >= 0) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationLocation, layout.fLocation,
fDecorationBuffer);
}
if (layout.fBinding >= 0) {
if (layout.fBinding >= 0 && !isPushConstant) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationBinding, layout.fBinding,
fDecorationBuffer);
}
@ -2963,7 +2964,7 @@ void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationIndex, layout.fIndex,
fDecorationBuffer);
}
if (layout.fSet >= 0) {
if (layout.fSet >= 0 && !isPushConstant) {
this->writeInstruction(SpvOpDecorate, target, SpvDecorationDescriptorSet, layout.fSet,
fDecorationBuffer);
}
@ -2983,18 +2984,10 @@ void SPIRVCodeGenerator::writeLayout(const Layout& layout, SpvId target, int mem
this->writeInstruction(SpvOpMemberDecorate, target, member, SpvDecorationLocation,
layout.fLocation, fDecorationBuffer);
}
if (layout.fBinding >= 0) {
this->writeInstruction(SpvOpMemberDecorate, target, member, SpvDecorationBinding,
layout.fBinding, fDecorationBuffer);
}
if (layout.fIndex >= 0) {
this->writeInstruction(SpvOpMemberDecorate, target, member, SpvDecorationIndex,
layout.fIndex, fDecorationBuffer);
}
if (layout.fSet >= 0) {
this->writeInstruction(SpvOpMemberDecorate, target, member, SpvDecorationDescriptorSet,
layout.fSet, fDecorationBuffer);
}
if (layout.fInputAttachmentIndex >= 0) {
this->writeInstruction(SpvOpDecorate, target, member, SpvDecorationInputAttachmentIndex,
layout.fInputAttachmentIndex, fDecorationBuffer);

View File

@ -17,7 +17,6 @@ OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %s RelaxedPrecision
OpDecorate %s Binding 0
OpDecorate %s DescriptorSet 0
OpMemberDecorate %_UniformBuffer 0 DescriptorSet 0
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 ColMajor
OpMemberDecorate %_UniformBuffer 0 MatrixStride 16

View File

@ -1,9 +1,7 @@
### Compilation failed:
error: SPIR-V validation error: Uniform id '5' is missing Block or BufferBlock decoration.
From Vulkan spec, section 14.5.2:
Such variables must be identified with a Block or BufferBlock decoration
%testBlock = OpTypeStruct %float
error: SPIR-V validation error: Block decoration on target <id> '4[%_arr_testBlock_int_2]' must be a structure type
OpDecorate %_arr_testBlock_int_2 Block
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"

View File

@ -13,7 +13,6 @@ OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
OpDecorate %sk_PerVertex Block
OpDecorate %pos Location 0
OpMemberDecorate %_UniformBuffer 0 DescriptorSet 0
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0

View File

@ -11,7 +11,6 @@ OpName %main "main"
OpMemberDecorate %sk_PerVertex 0 BuiltIn Position
OpMemberDecorate %sk_PerVertex 1 BuiltIn PointSize
OpDecorate %sk_PerVertex Block
OpMemberDecorate %_UniformBuffer 0 DescriptorSet 0
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpDecorate %_UniformBuffer Block
OpDecorate %8 Binding 0

View File

@ -24,7 +24,6 @@ OpMemberDecorate %A 1 Offset 4
OpDecorate %_arr_float_int_2 ArrayStride 16
OpMemberDecorate %B 0 Offset 0
OpMemberDecorate %B 1 Offset 16
OpMemberDecorate %B 2 Binding 1
OpMemberDecorate %B 2 Offset 48
OpMemberDecorate %B 2 RelaxedPrecision
OpDecorate %30 RelaxedPrecision

View File

@ -8,7 +8,7 @@ A a1;
struct B {
float x;
float y[2];
layout (binding = 1) A z;
A z;
};
B b1;
void main() {

View File

@ -18,8 +18,6 @@ OpMemberDecorate %testBlock 1 ColMajor
OpMemberDecorate %testBlock 1 MatrixStride 8
OpMemberDecorate %testBlock 1 RelaxedPrecision
OpDecorate %testBlock Block
OpDecorate %3 Binding 456
OpDecorate %3 DescriptorSet 0
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0