Replies: 2 comments
-
|
I made some progress debugging this:
Buffer 275 contains a constant value for the byte region that is copied to NoiseImage. This is what overrides the NoiseImage with constant 1.0. So now the question is, why the CPU array of the noiseImage isn't transfered to "Buffer 275"? |
Beta Was this translation helpful? Give feedback.
-
|
I found the answer! The reason for the failed transfer was found by debugging code in Images are treated differently than buffer uniforms, and the value in the image data is not uploaded to the GPU unless the Here's the corrected code auto noiseValues = vsg::vec4Array2D::create(SSAO_NOISE_DIM, SSAO_NOISE_DIM);
noiseValues->properties.format = VK_FORMAT_R32G32B32A32_SFLOAT; // Must be set for values to be transfered!
for (uint32_t i = 0; i < SSAO_NOISE_DIM * SSAO_NOISE_DIM; ++i)
{
auto v = vsg::vec4(...); // Must match the properties.format
noiseValues->set(i, v);
}
// Create image
auto noiseImage = vsg::Image::create();
noiseImage->data = noiseValues;
noiseImage->format = noiseValues->properties.format; // Should match the value formatThis is only necessy for an texture image uniform. For other buffer uniforms, the value is always uploaded to the GPU. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
While trying to reimplement the Sascha Willem ssao.cpp program in VSG I encountered the issue that the data in the 8x8 image containing noise values that I create on the CPU side, is not uploaded to the GPU. When inspecting the texture in qrenderdoc, I can see my texture but its values are constant 1.0 and do not reflect the values that I entered on the CPU side.
Here's what I do:
I then set up the descriptor bindings for this image:
vsg::DescriptorSetLayoutBindings descriptorBindings { ..., ..., {2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr}, // samplernoise };and declare the descriptorSetLayout and the descriptor:
My fragment shader references the above binding:
I have verified that if I change the size of the
SSAO_NOISE_DIMdefine, then the new size is reflected in qrenderdoc, so apparently the pipeline is set up correctly. The only thing that is missing is that the data in qrenderdoc does not reflect the values in thenoiseValuesarray.Is there some flag to vsg::Image that indicates that the image value should be transfered to the GPU? What am I missing?
I'll create a minimum fully working example, if it will help debugging the issue.
Beta Was this translation helpful? Give feedback.
All reactions