Add tests for new relaxed storage restrictions.

This commit is contained in:
Erin Maus
2026-07-23 05:55:47 -04:00
parent d9ee9a40ac
commit 6411883565
2 changed files with 69 additions and 3 deletions
+3 -3
View File
@@ -1632,9 +1632,9 @@ void Graphics::initCapabilities()
capabilities.features[FEATURE_TEXEL_BUFFER] = gl.isBufferUsageSupported(BUFFERUSAGE_TEXEL);
capabilities.features[FEATURE_COPY_TEXTURE_TO_BUFFER] = gl.isCopyTextureToBufferSupported();
capabilities.features[FEATURE_INDIRECT_DRAW] = capabilities.features[FEATURE_GLSL4];
capabilities.features[FEATURE_VERTEX_WRITE] = true;
capabilities.features[FEATURE_PIXEL_WRITE] = true;
capabilities.features[FEATURE_IMAGE_ATOMICS] = true;
capabilities.features[FEATURE_VERTEX_WRITE] = capabilities.features[FEATURE_GLSL4];
capabilities.features[FEATURE_PIXEL_WRITE] = capabilities.features[FEATURE_GLSL4];
capabilities.features[FEATURE_IMAGE_ATOMICS] = capabilities.features[FEATURE_GLSL4];
static_assert(FEATURE_MAX_ENUM == 16, "Graphics::initCapabilities must be updated when adding a new graphics feature!");
capabilities.limits[LIMIT_POINT_SIZE] = gl.getMaxPointSize();
+66
View File
@@ -1003,6 +1003,72 @@ love.test.graphics.Shader = function(test)
else
test:assertTrue(true, "skip shader IO test")
end
if love.graphics.getSupported().glsl4 and love.graphics.getSupported().vertexwrite and love.graphics.getSupported().pixelwrite then
local success, message = pcall(love.graphics.newShader, [[
#pragma language glsl4
buffer ColorBuffer
{
vec4 colors[];
};
void effect()
{
colors[0] = VaryingColor;
love_PixelColor = colors[0];
}
]])
test:assertFalse(success, "shader should not compile")
test:assertEquals("Shader validation error:\nStorage Buffer block 'ColorBuffer' must be marked as readonly in vertex and pixel shaders unless explicitly enabled.", message)
success, message = pcall(love.graphics.newShader, [[
#pragma language glsl4
buffer ColorBuffer
{
vec4 colors[];
};
void effect()
{
colors[0] = VaryingColor;
love_PixelColor = colors[0];
}
]], { write = true })
test:assertTrue(success, "shader should compile")
success, message = pcall(love.graphics.newShader, [[
#pragma language glsl4
layout(rgba32f) uniform image2D RGBAImage;
void effect()
{
love_PixelColor = VaryingColor * imageLoad(RGBAImage, ivec2(gl_FragCoord.xy));
}
]])
test:assertFalse(success, "shader should not compile")
test:assertEquals("Shader validation error:\nStorage Texture uniform variables (image2D, etc) are only allowed in compute shaders unless explicitly enabled.", message)
success, message = pcall(love.graphics.newShader, [[
#pragma language glsl4
layout(rgba32f) uniform image2D RGBAImage;
void effect()
{
love_PixelColor = VaryingColor * imageLoad(RGBAImage, ivec2(gl_FragCoord.xy));
}
]], { write = true })
test:assertTrue(success, "shader should compile")
else
test:assertTrue(true, "skip feature test")
end
end