Skip to content

Validator: Support VK_EXT_scalar_block_layout - #2074

Closed
dneto0 wants to merge 4 commits into
KhronosGroup:masterfrom
dneto0:dneto-vk-ext-scalar-block-layout
Closed

Validator: Support VK_EXT_scalar_block_layout#2074
dneto0 wants to merge 4 commits into
KhronosGroup:masterfrom
dneto0:dneto-vk-ext-scalar-block-layout

Conversation

@dneto0

@dneto0 dneto0 commented Nov 16, 2018

Copy link
Copy Markdown
Collaborator

Adds validator option to specify scalar block layout rules.

Both VK_KHR_relax_block_layout and VK_EXT_scalar_block_layout can be
enabled at the same time. But scalar block layout is as permissive
as relax block layout.

Also, scalar block layout does not require padding at the end of a
struct.

Cleanup: The internal getSize method does not need a round-up argument,
so remove it.

FYI: This is part of the rollout of VK_EXT_scalar_block_layout: KhronosGroup/Vulkan-Docs#854

@dneto0
dneto0 requested a review from alan-baker November 16, 2018 15:44
@dneto0

dneto0 commented Nov 16, 2018

Copy link
Copy Markdown
Collaborator Author

I expect the shaderc smoke test to fail because this MR changes the validation message to be more specific about which layout rules are in effect.

This is the one change to the Glslang validation results in its baseResults. (Basically "standard" -> "relaxed")

With diff:
@@ -147,5 +147,5 @@
 
 error: SPIRV-Tools Validation Errors
-error: Structure id 50 decorated as BufferBlock for variable in Uniform storage class must follow standard storage buffer layout rules: member 7 at offset 128 overlaps previous member ending at offset 171
+error: Structure id 50 decorated as BufferBlock for variable in Uniform storage class must follow relaxed storage buffer layout rules: member 7 at offset 128 overlaps previous member ending at offset 171
   %tbufName = OpTypeStruct %v4float %int %float %float %float %float %float %float %mat3v4float %mat3v4float %mat3v4float %mat3v4float
 

[  FAILED  ] ToSpirv/HlslCompileTest.FromFile/hlsl_buffer_frag, where GetParam() = 16-byte object <9B-A6 DB-D6 68-55 00-00 85-A5 DB-D6 68-55 00-00> (4 ms)

cc: @johnkslang This will be another update to the Glslang base results validation output.

@alan-baker alan-baker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need a test for an otherwise unacceptable array stride. Something like putting an array of a struct of float3 in a uniform buffer. The array stride should be 12 instead of 16.

Comment thread source/val/validate_decorations.cpp
Comment thread source/spirv_validator_options.h
Adds validator option to specify scalar block layout rules.

Both VK_KHR_relax_block_layout and VK_EXT_scalar_block_layout can be
enabled at the same time.  But scalar block layout is as permissive
as relax block layout.

Also, scalar block layout does not require padding at the end of a
struct.

Cleanup: The internal getSize method does not need a round-up argument,
so remove it.
@dneto0
dneto0 force-pushed the dneto-vk-ext-scalar-block-layout branch from f36524e to 5c5da85 Compare November 16, 2018 20:06
@dneto0

dneto0 commented Nov 16, 2018

Copy link
Copy Markdown
Collaborator Author

Rebased and pushed into master as 8e9be30

@dneto0 dneto0 closed this Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants