1 //
2 // Copyright 2019 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // tes31Context_override.cpp:
7 // Issue 3687: Overrides for dEQP's OpenGL ES 3.1 test context
8 //
9
10 // Keep the delta compared to dEQP at a minimum
11 // clang-format off
12
13 #include "tes31Context.hpp"
14 #include "gluRenderConfig.hpp"
15 #include "gluFboRenderContext.hpp"
16 #include "gluContextInfo.hpp"
17 #include "gluDummyRenderContext.hpp"
18 #include "tcuCommandLine.hpp"
19
20 namespace deqp
21 {
22 namespace gles31
23 {
24
Context(tcu::TestContext & testCtx,glu::ApiType apiType)25 Context::Context (tcu::TestContext& testCtx, glu::ApiType apiType)
26 : m_testCtx (testCtx)
27 , m_renderCtx (DE_NULL)
28 , m_contextInfo (DE_NULL)
29 , m_apiType (apiType)
30 {
31 if (m_testCtx.getCommandLine().getRunMode() == tcu::RUNMODE_EXECUTE)
32 createRenderContext();
33 else
34 {
35 // \todo [2016-11-15 pyry] Many tests (erroneously) inspect context type
36 // during test hierarchy construction. We should fix that
37 // and revert empty context to advertise unknown context type.
38 m_renderCtx = new glu::EmptyRenderContext(glu::ContextType(glu::ApiType::es(3,1)));
39 }
40 }
41
~Context(void)42 Context::~Context (void)
43 {
44 destroyRenderContext();
45 }
46
createRenderContext(void)47 void Context::createRenderContext (void)
48 {
49 DE_ASSERT(!m_renderCtx && !m_contextInfo);
50
51 try
52 {
53
54 // Issue 3687
55 // OpenGL ES 3.2 contexts are not fully supported yet. Creating a 3.2 context results in a number of test
56 // failures as they assume the existence of extensions that are not supported.
57 // Revert with Issue 3688
58 #if 0
59 m_renderCtx = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), m_apiType);
60 #else
61 // Override the original behavior (above) to create a 3.1 context
62 m_renderCtx = glu::createDefaultRenderContext(m_testCtx.getPlatform(), m_testCtx.getCommandLine(), glu::ApiType::es(3, 1));
63 #endif
64 m_contextInfo = glu::ContextInfo::create(*m_renderCtx);
65 }
66 catch (...)
67 {
68 destroyRenderContext();
69 throw;
70 }
71 }
72
destroyRenderContext(void)73 void Context::destroyRenderContext (void)
74 {
75 delete m_contextInfo;
76 delete m_renderCtx;
77
78 m_contextInfo = DE_NULL;
79 m_renderCtx = DE_NULL;
80 }
81
getRenderTarget(void) const82 const tcu::RenderTarget& Context::getRenderTarget (void) const
83 {
84 return m_renderCtx->getRenderTarget();
85 }
86
87 } // gles31
88 } // deqp
89
90 // clang-format on
91