Test framebuffer completeness when layered rendering
authorMikko Tiusanen <mikko.tiusanen@siru.fi>
Tue, 16 Mar 2021 08:16:05 +0000 (10:16 +0200)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Wed, 26 May 2021 11:34:48 +0000 (11:34 +0000)
Added OpenGL ES tests for rendering to layered (cube map) framebuffer.

VK-GL-CTS issue: 2801

Components: OpenGL
Change-Id: I1cede4806af33520612b7335d553df7da119520e

external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.5.x/gles32-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/3.2.6.x/gles32-khr-master.txt
external/openglcts/data/mustpass/gles/khronos_mustpass/master/gles32-khr-master.txt
external/openglcts/modules/common/glcFramebufferCompleteness.cpp

index 4d6deaa..4f15af3 100644 (file)
@@ -1161,6 +1161,9 @@ KHR-GLES32.core.framebuffer_completeness.expect_equal_numsamples
 KHR-GLES32.core.framebuffer_completeness.status_tracking
 KHR-GLES32.core.framebuffer_completeness.mutable_texture_missing_attachment_level
 KHR-GLES32.core.framebuffer_completeness.immutable_texture_any_level_as_attachment
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_valid_size_and_format
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_formats
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_sizes
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgba4_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_int_10_a2
index 4d6deaa..4f15af3 100644 (file)
@@ -1161,6 +1161,9 @@ KHR-GLES32.core.framebuffer_completeness.expect_equal_numsamples
 KHR-GLES32.core.framebuffer_completeness.status_tracking
 KHR-GLES32.core.framebuffer_completeness.mutable_texture_missing_attachment_level
 KHR-GLES32.core.framebuffer_completeness.immutable_texture_any_level_as_attachment
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_valid_size_and_format
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_formats
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_sizes
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgba4_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_int_10_a2
index 4d6deaa..4f15af3 100644 (file)
@@ -1161,6 +1161,9 @@ KHR-GLES32.core.framebuffer_completeness.expect_equal_numsamples
 KHR-GLES32.core.framebuffer_completeness.status_tracking
 KHR-GLES32.core.framebuffer_completeness.mutable_texture_missing_attachment_level
 KHR-GLES32.core.framebuffer_completeness.immutable_texture_any_level_as_attachment
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_valid_size_and_format
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_formats
+KHR-GLES32.core.framebuffer_completeness.cube_map_layered_attachment_different_sizes
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgba4_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_byte
 KHR-GLES32.core.texture_compatibility.texsubimage_format_rgb5_a1_unsigned_int_10_a2
index ec13254..82f08c4 100644 (file)
@@ -211,6 +211,7 @@ static const GLenum         cubemapTextureTargets[] =
 
 const glu::ApiType             apiES30                                 = glu::ApiType::es(3, 0);
 const glu::ApiType             apiES31                                 = glu::ApiType::es(3, 1);
+const glu::ApiType             apiES32                                 = glu::ApiType::es(3, 2);
 
 bool isDifferentRboSampleCountsSupported(TestContext& testContext, GLint& maxSamples)
 {
@@ -1170,6 +1171,97 @@ const TestParams         tests[]                                 =
                                });
                }
        },
+       {
+               "cube_map_layered_attachment_valid_size_and_format",                                                                    // string                                       name
+               "Cube map attachment with images of same size, same format and square should be valid", // string                                       description
+               apiES32,                                                                                                                                                                // glu::ApiType                         apiType
+               1,                                                                                                                                                                              // size_t                                       numFboIds
+               1,                                                                                                                                                                              // size_t                                       numTexIds
+               0,                                                                                                                                                                              // size_t                                       numRboIds
+               {                                                                                                                                                                               // vector<TestStep>                     initialSteps
+                       {
+                               [](TestContext& context)
+                               {
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, context.texIds[0]);
+                                       for(const auto target : cubemapTextureTargets)
+                                               context.texImage2D(target, 0, GL_RGBA8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, 0);
+
+                                       context.bindFramebuffer(GL_FRAMEBUFFER, context.fboIds[0]);
+                                       context.gl.framebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, context.texIds[0], 0);
+                                       GLU_EXPECT_NO_ERROR(context.gl.getError(), "glFramebufferTexture() failed");
+                               },
+                               expectedStatusConstant(GL_FRAMEBUFFER_COMPLETE),
+                       }
+               },
+               DE_NULL,                                                                                                                                                                // StepsGeneratorFn                     stepsGenerator
+       },
+       {
+               "cube_map_layered_attachment_different_formats",                                                                                // string                                       name
+               "Cube map attachment with images of the same size, square but different formats"
+               " should be incomplete",                                                                                                                                // string                                       description
+               apiES32,                                                                                                                                                                // glu::ApiType                         apiType
+               1,                                                                                                                                                                              // size_t                                       numFboIds
+               1,                                                                                                                                                                              // size_t                                       numTexIds
+               0,                                                                                                                                                                              // size_t                                       numRboIds
+               {                                                                                                                                                                               // vector<TestStep>                     initialSteps
+                       {
+                               [](TestContext& context)
+                               {
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, context.texIds[0]);
+                                       for(size_t i = 0; i < DE_LENGTH_OF_ARRAY(cubemapTextureTargets); ++i)
+                                               context.texImage2D(cubemapTextureTargets[i], 0, (i % 2) ? GL_RGBA8 : GL_RGB8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, (i % 2) ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, 0);
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, 0);
+
+                                       context.bindFramebuffer(GL_FRAMEBUFFER, context.fboIds[0]);
+                                       context.gl.framebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, context.texIds[0], 0);
+                                       GLU_EXPECT_NO_ERROR(context.gl.getError(), "glFramebufferTexture() failed");
+                               },
+                               expectedStatusConstant(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
+                       },
+                       {
+                               [](TestContext& context)
+                               {
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, context.texIds[0]);
+                                       for(size_t i = 0; i < DE_LENGTH_OF_ARRAY(cubemapTextureTargets); ++i)
+                                               context.texImage2D(cubemapTextureTargets[i], 0, (i % 2) ? GL_RGBA8 : GL_SRGB8_ALPHA8, TEXTURE_WIDTH, TEXTURE_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, 0);
+
+                                       context.bindFramebuffer(GL_FRAMEBUFFER, context.fboIds[0]);
+                                       context.gl.framebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, context.texIds[0], 0);
+                                       GLU_EXPECT_NO_ERROR(context.gl.getError(), "glFramebufferTexture() failed");
+                               },
+                               expectedStatusConstant(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
+                       }
+               },
+               DE_NULL,                                                                                                                                                                // StepsGeneratorFn                     stepsGenerator
+       },
+       {
+               "cube_map_layered_attachment_different_sizes",                                                                                  // string                                       name
+               "Cube map with images of different sizes, same format and all square should"
+               " be incomplete",                                                                                                                                               // string                                       description
+               apiES32,                                                                                                                                                                // glu::ApiType                         apiType
+               1,                                                                                                                                                                              // size_t                                       numFboIds
+               1,                                                                                                                                                                              // size_t                                       numTexIds
+               0,                                                                                                                                                                              // size_t                                       numRboIds
+               {                                                                                                                                                                               // vector<TestStep>                     initialSteps
+                       {
+                               [](TestContext& context)
+                               {
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, context.texIds[0]);
+                                       for(size_t i = 0; i < DE_LENGTH_OF_ARRAY(cubemapTextureTargets); ++i)
+                                               context.texImage2D(cubemapTextureTargets[i], 0, GL_RGBA8, (i % 2) ? TEXTURE_WIDTH : TEXTURE_WIDTH / 2, (i % 2) ? TEXTURE_HEIGHT : TEXTURE_HEIGHT / 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
+                                       context.bindTexture(GL_TEXTURE_CUBE_MAP, 0);
+
+                                       context.bindFramebuffer(GL_FRAMEBUFFER, context.fboIds[0]);
+                                       context.gl.framebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, context.texIds[0], 0);
+                                       GLU_EXPECT_NO_ERROR(context.gl.getError(), "glFramebufferTexture() failed");
+                               },
+                               expectedStatusConstant(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT),
+                       },
+               },
+               DE_NULL,                                                                                                                                                                // StepsGeneratorFn                     stepsGenerator
+       }
 };
 
 class FramebufferCompletenessTestCase : public deqp::TestCase