• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
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 
acquireExternalContext(const gl::Context * context)69 void ContextImpl::acquireExternalContext(const gl::Context *context) {}
70 
releaseExternalContext(const gl::Context * context)71 void ContextImpl::releaseExternalContext(const gl::Context *context) {}
72 
acquireTextures(const gl::Context * context,const gl::TextureBarrierVector & textureBarriers)73 angle::Result ContextImpl::acquireTextures(const gl::Context *context,
74                                            const gl::TextureBarrierVector &textureBarriers)
75 {
76     UNREACHABLE();
77     return angle::Result::Stop;
78 }
79 
releaseTextures(const gl::Context * context,gl::TextureBarrierVector * textureBarriers)80 angle::Result ContextImpl::releaseTextures(const gl::Context *context,
81                                            gl::TextureBarrierVector *textureBarriers)
82 {
83     UNREACHABLE();
84     return angle::Result::Stop;
85 }
86 
getPerfMonitorCounters()87 const angle::PerfMonitorCounterGroups &ContextImpl::getPerfMonitorCounters()
88 {
89     static angle::base::NoDestructor<angle::PerfMonitorCounterGroups> sCounters;
90     return *sCounters;
91 }
92 
drawPixelLocalStorageEXTEnable(gl::Context *,GLsizei n,const gl::PixelLocalStoragePlane[],const GLenum loadops[])93 angle::Result ContextImpl::drawPixelLocalStorageEXTEnable(gl::Context *,
94                                                           GLsizei n,
95                                                           const gl::PixelLocalStoragePlane[],
96                                                           const GLenum loadops[])
97 {
98     ASSERT(getNativePixelLocalStorageOptions().type ==
99            ShPixelLocalStorageType::PixelLocalStorageEXT);
100     UNREACHABLE();
101     return angle::Result::Stop;
102 }
103 
drawPixelLocalStorageEXTDisable(gl::Context *,const gl::PixelLocalStoragePlane[],const GLenum storeops[])104 angle::Result ContextImpl::drawPixelLocalStorageEXTDisable(gl::Context *,
105                                                            const gl::PixelLocalStoragePlane[],
106                                                            const GLenum storeops[])
107 {
108     ASSERT(getNativePixelLocalStorageOptions().type ==
109            ShPixelLocalStorageType::PixelLocalStorageEXT);
110     UNREACHABLE();
111     return angle::Result::Stop;
112 }
113 }  // namespace rx
114