Skip to content

Commit

Permalink
Validation layer is complaining about missing readonly specifier on b…
Browse files Browse the repository at this point in the history
…uffers in GLSL
  • Loading branch information
dpjudas committed Dec 7, 2024
1 parent db4472b commit 6867b0e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
14 changes: 7 additions & 7 deletions wadsrc/static/shaders/lightmap/binding_lightmapper.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

layout(set = 0, binding = 0) uniform Uniforms
layout(set = 0, binding = 0) uniform readonly Uniforms
{
vec3 SunDir;
float Padding1;
Expand Down Expand Up @@ -42,11 +42,11 @@ struct LightInfo
float Padding3;
};

layout(set = 0, binding = 1) buffer SurfaceIndexBuffer { uint surfaceIndices[]; };
layout(set = 0, binding = 2) buffer SurfaceBuffer { SurfaceInfo surfaces[]; };
layout(set = 0, binding = 3) buffer LightBuffer { LightInfo lights[]; };
layout(set = 0, binding = 4) buffer LightIndexBuffer { int lightIndexes[]; };
layout(set = 0, binding = 5) buffer PortalBuffer { PortalInfo portals[]; };
layout(set = 0, binding = 1) buffer readonly SurfaceIndexBuffer { uint surfaceIndices[]; };
layout(set = 0, binding = 2) buffer readonly SurfaceBuffer { SurfaceInfo surfaces[]; };
layout(set = 0, binding = 3) buffer readonly LightBuffer { LightInfo lights[]; };
layout(set = 0, binding = 4) buffer readonly LightIndexBuffer { int lightIndexes[]; };
layout(set = 0, binding = 5) buffer readonly PortalBuffer { PortalInfo portals[]; };

struct LightmapRaytracePC
{
Expand All @@ -66,4 +66,4 @@ struct LightmapRaytracePC
float TileHeight;
};

layout(std430, set = 0, binding = 6) buffer ConstantsBuffer { LightmapRaytracePC constants[]; };
layout(std430, set = 0, binding = 6) buffer readonly ConstantsBuffer { LightmapRaytracePC constants[]; };
6 changes: 3 additions & 3 deletions wadsrc/static/shaders/lightmap/binding_raytrace.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct CollisionNode
int padding3;
};

layout(std430, set = 1, binding = 0) buffer NodeBuffer
layout(std430, set = 1, binding = 0) buffer readonly NodeBuffer
{
int nodesRoot;
int nodebufferPadding1;
Expand All @@ -36,5 +36,5 @@ struct SurfaceVertex // Note: this must always match the FFlatVertex struct
vec2 luv;
};

layout(std430, set = 1, binding = 1) buffer VertexBuffer { SurfaceVertex vertices[]; };
layout(std430, set = 1, binding = 2) buffer ElementBuffer { int elements[]; };
layout(std430, set = 1, binding = 1) buffer readonly VertexBuffer { SurfaceVertex vertices[]; };
layout(std430, set = 1, binding = 2) buffer readonly ElementBuffer { int elements[]; };
16 changes: 8 additions & 8 deletions wadsrc/static/shaders/lightmap/binding_viewer.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ struct LightInfo
float Padding3;
};

layout(set = 0, binding = 0, std430) buffer SurfaceIndexBuffer { uint surfaceIndices[]; };
layout(set = 0, binding = 1, std430) buffer SurfaceBuffer { SurfaceInfo surfaces[]; };
layout(set = 0, binding = 2, std430) buffer LightBuffer { LightInfo lights[]; };
layout(set = 0, binding = 3, std430) buffer LightIndexBuffer { int lightIndexes[]; };
layout(set = 0, binding = 4, std430) buffer PortalBuffer { PortalInfo portals[]; };
layout(set = 0, binding = 0, std430) buffer readonly SurfaceIndexBuffer { uint surfaceIndices[]; };
layout(set = 0, binding = 1, std430) buffer readonly SurfaceBuffer { SurfaceInfo surfaces[]; };
layout(set = 0, binding = 2, std430) buffer readonly LightBuffer { LightInfo lights[]; };
layout(set = 0, binding = 3, std430) buffer readonly LightIndexBuffer { int lightIndexes[]; };
layout(set = 0, binding = 4, std430) buffer readonly PortalBuffer { PortalInfo portals[]; };

#if defined(USE_RAYQUERY)

Expand All @@ -58,7 +58,7 @@ struct CollisionNode
int padding3;
};

layout(set = 0, binding = 5, std430) buffer NodeBuffer
layout(set = 0, binding = 5, std430) buffer readonly NodeBuffer
{
int nodesRoot;
int nodebufferPadding1;
Expand All @@ -77,8 +77,8 @@ struct SurfaceVertex // Note: this must always match the FFlatVertex struct
vec2 luv;
};

layout(set = 0, binding = 6, std430) buffer VertexBuffer { SurfaceVertex vertices[]; };
layout(set = 0, binding = 7, std430) buffer ElementBuffer { int elements[]; };
layout(set = 0, binding = 6, std430) buffer readonly VertexBuffer { SurfaceVertex vertices[]; };
layout(set = 0, binding = 7, std430) buffer readonly ElementBuffer { int elements[]; };

layout(set = 1, binding = 0) uniform sampler2D textures[];

Expand Down
6 changes: 3 additions & 3 deletions wadsrc/static/shaders/scene/binding_fixed.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct CollisionNode
int element_index;
int padding3;
};
layout(std430, set = 0, binding = 5) buffer NodeBuffer
layout(std430, set = 0, binding = 5) buffer readonly NodeBuffer
{
int nodesRoot;
int nodebufferPadding1;
Expand All @@ -35,7 +35,7 @@ struct SurfaceVertex // Note: this must always match the FFlatVertex struct
vec2 uv;
vec2 luv;
};
layout(std430, set = 0, binding = 6) buffer VertexBuffer { SurfaceVertex vertices[]; };
layout(std430, set = 0, binding = 7) buffer ElementBuffer { int elements[]; };
layout(std430, set = 0, binding = 6) buffer readonly VertexBuffer { SurfaceVertex vertices[]; };
layout(std430, set = 0, binding = 7) buffer readonly ElementBuffer { int elements[]; };
#endif
#endif
22 changes: 11 additions & 11 deletions wadsrc/static/shaders/scene/binding_rsbuffers.glsl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

// This must match the HWViewpointUniforms struct
layout(set = 1, binding = 0, std140) uniform ViewpointUBO
layout(set = 1, binding = 0, std140) uniform readonly ViewpointUBO
{
mat4 ProjectionMatrix;
mat4 ViewMatrix;
Expand All @@ -21,7 +21,7 @@ layout(set = 1, binding = 0, std140) uniform ViewpointUBO
int uLightTilesWidth; // Levelmesh light tiles
};

layout(set = 1, binding = 1, std140) uniform MatricesUBO
layout(set = 1, binding = 1, std140) uniform readonly MatricesUBO
{
mat4 ModelMatrix;
mat4 NormalModelMatrix;
Expand Down Expand Up @@ -93,52 +93,52 @@ struct Fogball

#ifdef USE_LEVELMESH

layout(set = 1, binding = 2, std430) buffer SurfaceUniformsSSO
layout(set = 1, binding = 2, std430) buffer readonly SurfaceUniformsSSO
{
SurfaceUniforms data[];
};

layout(set = 1, binding = 3, std430) buffer SurfaceLightUniformsSSO
layout(set = 1, binding = 3, std430) buffer readonly SurfaceLightUniformsSSO
{
SurfaceLightUniforms lightdata[];
};

layout(set = 1, binding = 4, std430) buffer LightBufferSSO
layout(set = 1, binding = 4, std430) buffer readonly LightBufferSSO
{
vec4 lights[];
};

layout(set = 1, binding = 5, std140) uniform FogballBufferUBO
layout(set = 1, binding = 5, std140) uniform readonly FogballBufferUBO
{
Fogball fogballs[MAX_FOGBALL_DATA];
};

// bone matrix buffers
layout(set = 1, binding = 6, std430) buffer BoneBufferSSO
layout(set = 1, binding = 6, std430) buffer readonly BoneBufferSSO
{
mat4 bones[];
};

#else

layout(set = 1, binding = 2, std140) uniform SurfaceUniformsUBO
layout(set = 1, binding = 2, std140) uniform readonly SurfaceUniformsUBO
{
SurfaceUniforms data[MAX_SURFACE_UNIFORMS];
};

// light buffers
layout(set = 1, binding = 3, std140) uniform LightBufferUBO
layout(set = 1, binding = 3, std140) uniform readonly LightBufferUBO
{
vec4 lights[MAX_LIGHT_DATA];
};

layout(set = 1, binding = 4, std140) uniform FogballBufferUBO
layout(set = 1, binding = 4, std140) uniform readonly FogballBufferUBO
{
Fogball fogballs[MAX_FOGBALL_DATA];
};

// bone matrix buffers
layout(set = 1, binding = 5, std430) buffer BoneBufferSSO
layout(set = 1, binding = 5, std430) buffer readonly BoneBufferSSO
{
mat4 bones[];
};
Expand Down

0 comments on commit 6867b0e

Please sign in to comment.