1 //
2 // Copyright 2016 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 // ContextImpl:
7 // Implementation-specific functionality associated with a GL Context.
8 //
9
10 #include "libANGLE/renderer/ContextImpl.h"
11
12 #include "common/base/anglebase/no_destructor.h"
13 #include "libANGLE/Context.h"
14
15 namespace rx
16 {
ContextImpl(const gl::State & state,gl::ErrorSet * errorSet)17 ContextImpl::ContextImpl(const gl::State &state, gl::ErrorSet *errorSet)
18 : mState(state), mMemoryProgramCache(nullptr), mErrors(errorSet)
19 {}
20
~ContextImpl()21 ContextImpl::~ContextImpl() {}
22
invalidateTexture(gl::TextureType target)23 void ContextImpl::invalidateTexture(gl::TextureType target)
24 {
25 UNREACHABLE();
26 }
27
startTiling(const gl::Context * context,const gl::Rectangle & area,GLbitfield preserveMask)28 angle::Result ContextImpl::startTiling(const gl::Context *context,
29 const gl::Rectangle &area,
30 GLbitfield preserveMask)
31 {
32 UNREACHABLE();
33 return angle::Result::Stop;
34 }
35
endTiling(const gl::Context * context,GLbitfield preserveMask)36 angle::Result ContextImpl::endTiling(const gl::Context *context, GLbitfield preserveMask)
37 {
38 UNREACHABLE();
39 return angle::Result::Stop;
40 }
41
onUnMakeCurrent(const gl::Context * context)42 angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context)
43 {
44 return angle::Result::Continue;
45 }
46
handleNoopDrawEvent()47 angle::Result ContextImpl::handleNoopDrawEvent()
48 {
49 return angle::Result::Continue;
50 }
51
setMemoryProgramCache(gl::MemoryProgramCache * memoryProgramCache)52 void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
53 {
54 mMemoryProgramCache = memoryProgramCache;
55 }
56
handleError(GLenum errorCode,const char * message,const char * file,const char * function,unsigned int line)57 void ContextImpl::handleError(GLenum errorCode,
58 const char *message,
59 const char *file,
60 const char *function,
61 unsigned int line)
62 {
63 std::stringstream errorStream;
64 errorStream << "Internal error: " << gl::FmtHex(errorCode) << ": " << message;
65 mErrors->handleError(errorCode, errorStream.str().c_str(), file, function, line);
66 }
67
getContextPriority() const68 egl::ContextPriority ContextImpl::getContextPriority() const
69 {
70 return egl::ContextPriority::Medium;
71 }
72
releaseHighPowerGPU(gl::Context *)73 egl::Error ContextImpl::releaseHighPowerGPU(gl::Context *)
74 {
75 return egl::NoError();
76 }
77
reacquireHighPowerGPU(gl::Context *)78 egl::Error ContextImpl::reacquireHighPowerGPU(gl::Context *)
79 {
80 return egl::NoError();
81 }
82
acquireExternalContext(const gl::Context * context)83 void ContextImpl::acquireExternalContext(const gl::Context *context) {}
84
releaseExternalContext(const gl::Context * context)85 void ContextImpl::releaseExternalContext(const gl::Context *context) {}
86
acquireTextures(const gl::Context * context,const gl::TextureBarrierVector & textureBarriers)87 angle::Result ContextImpl::acquireTextures(const gl::Context *context,
88 const gl::TextureBarrierVector &textureBarriers)
89 {
90 UNREACHABLE();
91 return angle::Result::Stop;
92 }
93
releaseTextures(const gl::Context * context,gl::TextureBarrierVector * textureBarriers)94 angle::Result ContextImpl::releaseTextures(const gl::Context *context,
95 gl::TextureBarrierVector *textureBarriers)
96 {
97 UNREACHABLE();
98 return angle::Result::Stop;
99 }
100
getPerfMonitorCounters()101 const angle::PerfMonitorCounterGroups &ContextImpl::getPerfMonitorCounters()
102 {
103 static angle::base::NoDestructor<angle::PerfMonitorCounterGroups> sCounters;
104 return *sCounters;
105 }
106 } // namespace rx
107