-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new example: using compileManager to change between programs #311
Conversation
… storage buffers The example utils/vsgcompilemanager switches between two scenes, one that uses a storage buffer and another that does not. This switch happens every 60 frames. On the third record of the scene with the storage buffer, VSG emits the following warning: Warning: Context::reserve(const ResourceRequirements& requirements) invalid combination of required_maxSets (0) & required_descriptorPoolSizes (1) unable to allocate DescriptorPool.
@theodoregoetz is this example still useful? |
I just ran it with
I think this can be fixed by adding "readonly" on the buffers in the shader code. But beyond that, it's still a valid test, if not exactly an example per-se. Do you have a better place for test programs? |
We don't presently have test specific place, but perhaps we should have vsgExamples/tests directory alongside vsgExamples/examples? |
I have merged the vsgcompilemanager test program into a branch and moved it into vsgExamples/tests. Running 'vsgcompilemanager -d' I see: VUID-RuntimeSpirv-NonWritable-06340(ERROR / SPEC): msgNum: 269944751 - Validation Error: [ VUID-RuntimeSpirv-NonWritable-06340 ] Object 0: handle = 0x95a125000000001a, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x101707af | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] SPIR-V (VK_SHADER_STAGE_FRAGMENT_BIT) uses descriptor [Set 0, Binding 0, variable "CellColors"] (type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) which is not marked with NonWritable, but fragmentStoresAndAtomics was not enabled. The Vulkan spec states: If fragmentStoresAndAtomics is not enabled, then all storage image, storage texel buffer, and storage buffer variables in the fragment stage must be decorated with the NonWritable decoration (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-RuntimeSpirv-NonWritable-06340)
Objects: 1
[0] 0x95a125000000001a, type: 15, name: NULL
VUID-RuntimeSpirv-NonWritable-06340(ERROR / SPEC): msgNum: 269944751 - Validation Error: [ VUID-RuntimeSpirv-NonWritable-06340 ] Object 0: handle = 0x74ea280000000054, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x101707af | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] SPIR-V (VK_SHADER_STAGE_FRAGMENT_BIT) uses descriptor [Set 0, Binding 0, variable "CellColors"] (type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER or VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC) which is not marked with NonWritable, but fragmentStoresAndAtomics was not enabled. The Vulkan spec states: If fragmentStoresAndAtomics is not enabled, then all storage image, storage texel buffer, and storage buffer variables in the fragment stage must be decorated with the NonWritable decoration (https://vulkan.lunarg.com/doc/view/1.3.290.0/linux/1.3-extensions/vkspec.html#VUID-RuntimeSpirv-NonWritable-06340)
Objects: 1
[0] 0x74ea280000000054, type: 15, name: NULL I have a look into the shaders it's using. |
As you suspect, adding readonly fixed the validation error: diff --git a/tests/vsgcompilemanager/vsgcompilemanager.cpp b/tests/vsgcompilemanager/vsgcompilemanager.cpp
index 4d8fc72f..7ff48a33 100644
--- a/tests/vsgcompilemanager/vsgcompilemanager.cpp
+++ b/tests/vsgcompilemanager/vsgcompilemanager.cpp
@@ -13,7 +13,7 @@ void main() { gl_Position = (projection * modelView) * vec4(vertex, 1.0); }
std::string FRAG0{R"(
#version 450
-layout(set = 0, binding = 0) buffer CellColors { vec4[] cellColors; };
+layout(set = 0, binding = 0) readonly buffer CellColors { vec4[] cellColors; };
layout(location = 0) out vec4 color;
void main() { color = cellColors[gl_PrimitiveID]; }
)"}; |
I have now merged this test program with vsgExamples master. |
The example
utils/vsgcompilemanager
switches between two scenes, one that uses a storage buffer and another that does not. This switch happens every 60 frames. On the third time showing the scene with the storage buffer, VSG emits the following warning: