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/third_party/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
onUnMakeCurrent(const gl::Context * context)28 angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context)
29 {
30 return angle::Result::Continue;
31 }
32
handleNoopDrawEvent()33 angle::Result ContextImpl::handleNoopDrawEvent()
34 {
35 return angle::Result::Continue;
36 }
37
setMemoryProgramCache(gl::MemoryProgramCache * memoryProgramCache)38 void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
39 {
40 mMemoryProgramCache = memoryProgramCache;
41 }
42
handleError(GLenum errorCode,const char * message,const char * file,const char * function,unsigned int line)43 void ContextImpl::handleError(GLenum errorCode,
44 const char *message,
45 const char *file,
46 const char *function,
47 unsigned int line)
48 {
49 std::stringstream errorStream;
50 errorStream << "Internal error: " << gl::FmtHex(errorCode) << ": " << message;
51 mErrors->handleError(errorCode, errorStream.str().c_str(), file, function, line);
52 }
53
getContextPriority() const54 egl::ContextPriority ContextImpl::getContextPriority() const
55 {
56 return egl::ContextPriority::Medium;
57 }
58
releaseHighPowerGPU(gl::Context *)59 egl::Error ContextImpl::releaseHighPowerGPU(gl::Context *)
60 {
61 return egl::NoError();
62 }
63
reacquireHighPowerGPU(gl::Context *)64 egl::Error ContextImpl::reacquireHighPowerGPU(gl::Context *)
65 {
66 return egl::NoError();
67 }
68
acquireTextures(const gl::Context * context,const gl::TextureBarrierVector & textureBarriers)69 angle::Result ContextImpl::acquireTextures(const gl::Context *context,
70 const gl::TextureBarrierVector &textureBarriers)
71 {
72 UNREACHABLE();
73 return angle::Result::Stop;
74 }
75
releaseTextures(const gl::Context * context,gl::TextureBarrierVector * textureBarriers)76 angle::Result ContextImpl::releaseTextures(const gl::Context *context,
77 gl::TextureBarrierVector *textureBarriers)
78 {
79 UNREACHABLE();
80 return angle::Result::Stop;
81 }
82
getPerfMonitorCounters()83 const angle::PerfMonitorCounterGroups &ContextImpl::getPerfMonitorCounters()
84 {
85 static angle::base::NoDestructor<angle::PerfMonitorCounterGroups> sCounters;
86 return *sCounters;
87 }
88 } // namespace rx
89