new example: using compileManager to change between programs#311
Merged
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.
Collaborator
|
@theodoregoetz is this example still useful? |
Author
|
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? |
Collaborator
|
We don't presently have test specific place, but perhaps we should have vsgExamples/tests directory alongside vsgExamples/examples? |
Collaborator
|
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: NULLI have a look into the shaders it's using. |
Collaborator
|
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]; }
)"}; |
Collaborator
|
I have now merged this test program with vsgExamples master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The example
utils/vsgcompilemanagerswitches 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: