Align UBO sizes between code and shaders for computeraytracing, ssao, & texturearray examples

This commit is contained in:
Stephen Saunders 2022-08-08 13:46:30 -04:00
parent b60f404b0e
commit f103389d03
3 changed files with 6 additions and 2 deletions

View file

@ -55,6 +55,7 @@ public:
glm::vec3 lookat = glm::vec3(0.0f, 0.5f, 0.0f);
float fov = 10.0f;
} camera;
glm::mat4 _pad;
} ubo;
} compute;

View file

@ -11,7 +11,7 @@
#define ENABLE_VALIDATION false
#define SSAO_KERNEL_SIZE 32
#define SSAO_KERNEL_SIZE 64
#define SSAO_RADIUS 0.3f
#if defined(__ANDROID__)

View file

@ -12,6 +12,8 @@
#define ENABLE_VALIDATION false
#define MAX_LAYERS 8
// Vertex layout for this example
struct Vertex {
float pos[3];
@ -120,6 +122,7 @@ public:
textureArray.width = ktxTexture->baseWidth;
textureArray.height = ktxTexture->baseHeight;
layerCount = ktxTexture->numLayers;
assert(layerCount <= MAX_LAYERS);
ktx_uint8_t *ktxTextureData = ktxTexture_GetData(ktxTexture);
ktx_size_t ktxTextureSize = ktxTexture_GetSize(ktxTexture);
@ -475,7 +478,7 @@ public:
{
uboVS.instance = new UboInstanceData[layerCount];
uint32_t uboSize = sizeof(uboVS.matrices) + (layerCount * sizeof(UboInstanceData));
uint32_t uboSize = sizeof(uboVS.matrices) + (MAX_LAYERS * sizeof(UboInstanceData));
// Vertex shader uniform buffer block
VK_CHECK_RESULT(vulkanDevice->createBuffer(