search_position = token_position + text_length;
}
-RobustBufferAccessBehaviorBaseTestCase::RobustBufferAccessBehaviorBaseTestCase(deqp::Context& context, const glw::GLchar* name, const glw::GLchar* description) :
- TestCase(context, name, description)
+
+class RobustnessEnabledContext
+{
+public:
+ RobustnessEnabledContext(deqp::Context& context, const tcu::CommandLine& commandLine, tcu::Platform& platform);
+
+ ~RobustnessEnabledContext(void);
+
+protected:
+ deqp::Context& m_context;
+
+ glu::RenderContext* m_renderContext;
+ glu::RenderContext* m_previousRenderContext;
+};
+
+RobustnessEnabledContext::RobustnessEnabledContext(deqp::Context& context, const tcu::CommandLine& commandLine, tcu::Platform& platform)
+ : m_context (context)
+ , m_renderContext (DE_NULL)
{
- m_newRenderContext = DE_NULL;
- if (context.getContextInfo().isExtensionSupported("GL_ARB_robustness") && context.getContextInfo().isExtensionSupported("GL_ARB_robust_buffer_access_behavior"))
+ if (!context.getContextInfo().isExtensionSupported("GL_ARB_robustness") || !context.getContextInfo().isExtensionSupported("GL_ARB_robust_buffer_access_behavior"))
{
- const tcu::CommandLine& commandLine = m_testCtx.getCommandLine();
- if (commandLine.getSurfaceType() == tcu::SURFACETYPE_WINDOW && commandLine.getRunMode() == tcu::RUNMODE_EXECUTE)
- {
- glu::RenderConfig renderCfg(glu::ContextType(context.getRenderContext().getType().getAPI(), glu::CONTEXT_ROBUST));
- glu::parseRenderConfig(&renderCfg, commandLine);
+ throw tcu::NotSupportedError("GL_ARB_robustness and GL_ARB_robust_buffer_access_behavior must be supported to run this test case");
+ }
- m_newRenderContext = createRenderContext(m_testCtx.getPlatform(), commandLine, renderCfg);
- m_previousRenderContext = &m_context.getRenderContext();
- m_context.setRenderContext(m_newRenderContext);
- }
+ {
+ glu::RenderConfig renderCfg(glu::ContextType(m_context.getRenderContext().getType().getAPI(), glu::CONTEXT_ROBUST));
+ glu::parseRenderConfig(&renderCfg, commandLine);
+
+ m_renderContext = createRenderContext(platform, commandLine, renderCfg);
+ m_previousRenderContext = &m_context.getRenderContext();
+ m_context.setRenderContext(m_renderContext);
}
}
-RobustBufferAccessBehaviorBaseTestCase::~RobustBufferAccessBehaviorBaseTestCase()
+RobustnessEnabledContext::~RobustnessEnabledContext()
{
- if (m_newRenderContext != DE_NULL)
+ if (m_renderContext != DE_NULL)
+ {
m_context.setRenderContext(m_previousRenderContext);
+
+ delete m_renderContext;
+
+ m_context.getRenderContext().makeCurrent();
+ }
}
/** Constructor
* @param context Test context
**/
VertexBufferObjectsTest::VertexBufferObjectsTest(deqp::Context& context)
- : RobustBufferAccessBehaviorBaseTestCase(context, "vertex_buffer_objects", "Verifies that out-of-bound reads from VB result in zero")
+ : TestCase(context, "vertex_buffer_objects", "Verifies that out-of-bound reads from VB result in zero")
{
/* Nothing to be done */
}
* @param context Test context
**/
VertexBufferObjectsTest::VertexBufferObjectsTest(deqp::Context& context, const char* name, const char* description)
- : RobustBufferAccessBehaviorBaseTestCase(context, name, description)
+ : TestCase(context, name, description)
{
/* Nothing to be done */
}
**/
tcu::TestNode::IterateResult VertexBufferObjectsTest::iterate()
{
- if (m_newRenderContext == DE_NULL)
- {
- m_context.getTestContext().setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Robustness not supported");
- return TestNode::STOP;
- }
+ RobustnessEnabledContext context(m_context, m_testCtx.getCommandLine(), m_testCtx.getPlatform());
static const GLuint invalid_elements[] = {
9, 1, 2, 10, 2, 3, 11, 3, 4, 12, 4, 5, 13, 5, 6, 14, 6, 7, 15, 7, 8, 16, 8, 1,
* @param context Test context
**/
TexelFetchTest::TexelFetchTest(deqp::Context& context)
- : RobustBufferAccessBehaviorBaseTestCase(context, "texel_fetch", "Verifies that out-of-bound fetches from texture result in zero")
+ : TestCase(context, "texel_fetch", "Verifies that out-of-bound fetches from texture result in zero")
, m_test_case(R8)
{
/* Nothing to be done */
* @param context Test context
**/
TexelFetchTest::TexelFetchTest(deqp::Context& context, const glw::GLchar* name, const glw::GLchar* description)
- : RobustBufferAccessBehaviorBaseTestCase(context, name, description), m_test_case(R8)
+ : TestCase(context, name, description), m_test_case(R8)
{
/* Nothing to be done */
}
**/
tcu::TestNode::IterateResult TexelFetchTest::iterate()
{
- if (m_newRenderContext == DE_NULL)
- {
- m_context.getTestContext().setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Robustness not supported");
- return TestNode::STOP;
- }
+ RobustnessEnabledContext context(m_context, m_testCtx.getCommandLine(), m_testCtx.getPlatform());
/* Constants */
static const GLuint height = 16;
**/
tcu::TestNode::IterateResult ImageLoadStoreTest::iterate()
{
- if (m_newRenderContext == DE_NULL)
- {
- m_context.getTestContext().setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Robustness not supported");
- return TestNode::STOP;
- }
+ RobustnessEnabledContext context(m_context, m_testCtx.getCommandLine(), m_testCtx.getPlatform());
/* Constants */
static const GLuint height = 16;
* @param context Test context
**/
StorageBufferTest::StorageBufferTest(deqp::Context& context)
- : RobustBufferAccessBehaviorBaseTestCase(context, "storage_buffer", "Verifies that out-of-bound access to SSBO is discared or resutls in 0")
+ : TestCase(context, "storage_buffer", "Verifies that out-of-bound access to SSBO is discared or resutls in 0")
, m_test_case(VALID)
, m_hasKhrRobustBufferAccess(false)
{
* @param context Test context
**/
StorageBufferTest::StorageBufferTest(deqp::Context& context, const glw::GLchar* name, const glw::GLchar* description)
- : RobustBufferAccessBehaviorBaseTestCase(context, name, description), m_test_case(VALID)
+ : TestCase(context, name, description), m_test_case(VALID)
{
/* Nothing to be done */
}
**/
tcu::TestNode::IterateResult StorageBufferTest::iterate()
{
- if (m_newRenderContext == DE_NULL)
- {
- m_context.getTestContext().setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Robustness not supported");
- return TestNode::STOP;
- }
+ RobustnessEnabledContext context(m_context, m_testCtx.getCommandLine(), m_testCtx.getPlatform());
/* GL entry points */
const Functions& gl = m_context.getRenderContext().getFunctions();
* @param context Test context
**/
UniformBufferTest::UniformBufferTest(deqp::Context& context)
- : RobustBufferAccessBehaviorBaseTestCase(context, "uniform_buffer", "Verifies that out-of-bound access to UBO resutls in 0"), m_test_case(VALID)
+ : TestCase(context, "uniform_buffer", "Verifies that out-of-bound access to UBO resutls in 0"), m_test_case(VALID)
{
/* Nothing to be done here */
}
* @param context Test context
**/
UniformBufferTest::UniformBufferTest(deqp::Context& context, const glw::GLchar* name, const glw::GLchar* description)
- : RobustBufferAccessBehaviorBaseTestCase(context, name, description), m_test_case(VALID)
+ : TestCase(context, name, description), m_test_case(VALID)
{
/* Nothing to be done */
}
**/
tcu::TestNode::IterateResult UniformBufferTest::iterate()
{
- if (m_newRenderContext == DE_NULL)
- {
- m_context.getTestContext().setTestResult(QP_TEST_RESULT_NOT_SUPPORTED, "Robustness not supported");
- return TestNode::STOP;
- }
+ RobustnessEnabledContext context(m_context, m_testCtx.getCommandLine(), m_testCtx.getPlatform());
static const GLfloat destination_data[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
/* The source buffer is packed std140 so we need vec4s */