ctx.endSection();
}
- void image_store (NegativeTestContext& ctx, gls::TextureTestUtil::TextureType imageType)
-void image_store (NegativeTestContext& ctx)
++void image_store (NegativeTestContext& ctx, glu::TextureTestUtil::TextureType imageType)
{
const tcu::TextureFormat formats[] =
{
ctx.endSection();
}
- void image_load (NegativeTestContext& ctx, gls::TextureTestUtil::TextureType imageType)
-void image_load (NegativeTestContext& ctx)
++void image_load (NegativeTestContext& ctx, glu::TextureTestUtil::TextureType imageType)
{
const tcu::TextureFormat formats[] =
{
ctx.endSection();
}
- void image_atomic (NegativeTestContext& ctx, gls::TextureTestUtil::TextureType imageType)
-void image_atomic (NegativeTestContext& ctx)
++void image_atomic (NegativeTestContext& ctx, glu::TextureTestUtil::TextureType imageType)
{
const tcu::TextureFormat formats[] =
{
ctx.endSection();
}
- void image_atomic_exchange (NegativeTestContext& ctx, gls::TextureTestUtil::TextureType imageType)
-void image_atomic_exchange (NegativeTestContext& ctx)
++void image_atomic_exchange (NegativeTestContext& ctx, glu::TextureTestUtil::TextureType imageType)
{
const tcu::TextureFormat formats[] =
{
ctx.endSection();
}
- image_load(ctx, (gls::TextureTestUtil::TextureType)Type);
+// Re-routing function template for generating the standard negative
+// test function signature with texture type added.
+
+template <int Type>
+void loadFuncWrapper (NegativeTestContext& ctx)
+{
- image_store(ctx, (gls::TextureTestUtil::TextureType)Type);
++ image_load(ctx, (glu::TextureTestUtil::TextureType)Type);
+}
+
+template <int Type>
+void storeFuncWrapper (NegativeTestContext& ctx)
+{
- image_atomic(ctx, (gls::TextureTestUtil::TextureType)Type);
++ image_store(ctx, (glu::TextureTestUtil::TextureType)Type);
+}
+
+template <int Type>
+void atomicFuncWrapper (NegativeTestContext& ctx)
+{
- image_atomic_exchange(ctx, (gls::TextureTestUtil::TextureType)Type);
++ image_atomic(ctx, (glu::TextureTestUtil::TextureType)Type);
+}
+
+template <int Type>
+void atomicExchangeFuncWrapper (NegativeTestContext& ctx)
+{
++ image_atomic_exchange(ctx, (glu::TextureTestUtil::TextureType)Type);
+}
+
} // anonymous
-std::vector<FunctionContainer> getNegativeShaderImageLoadStoreTestFunctions (void)
+// Set of texture types to create tests for.
+#define CREATE_TEST_FUNC_PER_TEXTURE_TYPE(NAME, FUNC) const FunctionContainer NAME[] = \
+ { \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_2D>, "texture_2d", "Texture2D negative tests."}, \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_3D>, "texture_3d", "Texture3D negative tests."}, \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_CUBE>, "cube", "Cube texture negative tests."}, \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_2D_ARRAY>, "2d_array", "2D array texture negative tests."}, \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_BUFFER>, "buffer", "Buffer negative tests."}, \
- {FUNC<gls::TextureTestUtil::TEXTURETYPE_CUBE_ARRAY>, "cube_array", "Cube array texture negative tests."} \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_2D>, "texture_2d", "Texture2D negative tests."}, \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_3D>, "texture_3d", "Texture3D negative tests."}, \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_CUBE>, "cube", "Cube texture negative tests."}, \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_2D_ARRAY>, "2d_array", "2D array texture negative tests."}, \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_BUFFER>, "buffer", "Buffer negative tests."}, \
++ {FUNC<glu::TextureTestUtil::TEXTURETYPE_CUBE_ARRAY>, "cube_array", "Cube array texture negative tests."} \
+ }
+
+std::vector<FunctionContainer> getNegativeShaderImageLoadTestFunctions (void)
{
- const FunctionContainer funcs[] =
- {
- {image_store, "image_store", "Test incorrect usage of imageStore()" },
- {image_load, "image_load", "Test incorrect usage of imageLoad()" },
- {image_atomic, "image_atomic", "Test incorrect usage of imageAtomic*()" },
- {image_atomic_exchange, "image_atomic_exchange", "Test incorrect usage of imageAtomicExchange()" },
- };
+ CREATE_TEST_FUNC_PER_TEXTURE_TYPE(funcs, loadFuncWrapper);
+ return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
+}
+std::vector<FunctionContainer> getNegativeShaderImageStoreTestFunctions (void)
+{
+ CREATE_TEST_FUNC_PER_TEXTURE_TYPE(funcs, storeFuncWrapper);
+ return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
+}
+
+std::vector<FunctionContainer> getNegativeShaderImageAtomicTestFunctions (void)
+{
+ CREATE_TEST_FUNC_PER_TEXTURE_TYPE(funcs, atomicFuncWrapper);
+ return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
+}
+
+std::vector<FunctionContainer> getNegativeShaderImageAtomicExchangeTestFunctions (void)
+{
+ CREATE_TEST_FUNC_PER_TEXTURE_TYPE(funcs, atomicExchangeFuncWrapper);
return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs));
}