tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ContextImpl.cpp (2403B)


      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 {
     17 ContextImpl::ContextImpl(const gl::State &state, gl::ErrorSet *errorSet)
     18    : mState(state), mMemoryProgramCache(nullptr), mErrors(errorSet)
     19 {}
     20 
     21 ContextImpl::~ContextImpl() {}
     22 
     23 void ContextImpl::invalidateTexture(gl::TextureType target)
     24 {
     25    UNREACHABLE();
     26 }
     27 
     28 angle::Result ContextImpl::onUnMakeCurrent(const gl::Context *context)
     29 {
     30    return angle::Result::Continue;
     31 }
     32 
     33 angle::Result ContextImpl::handleNoopDrawEvent()
     34 {
     35    return angle::Result::Continue;
     36 }
     37 
     38 void ContextImpl::setMemoryProgramCache(gl::MemoryProgramCache *memoryProgramCache)
     39 {
     40    mMemoryProgramCache = memoryProgramCache;
     41 }
     42 
     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 
     54 egl::ContextPriority ContextImpl::getContextPriority() const
     55 {
     56    return egl::ContextPriority::Medium;
     57 }
     58 
     59 egl::Error ContextImpl::releaseHighPowerGPU(gl::Context *)
     60 {
     61    return egl::NoError();
     62 }
     63 
     64 egl::Error ContextImpl::reacquireHighPowerGPU(gl::Context *)
     65 {
     66    return egl::NoError();
     67 }
     68 
     69 angle::Result ContextImpl::acquireTextures(const gl::Context *context,
     70                                           const gl::TextureBarrierVector &textureBarriers)
     71 {
     72    UNREACHABLE();
     73    return angle::Result::Stop;
     74 }
     75 
     76 angle::Result ContextImpl::releaseTextures(const gl::Context *context,
     77                                           gl::TextureBarrierVector *textureBarriers)
     78 {
     79    UNREACHABLE();
     80    return angle::Result::Stop;
     81 }
     82 
     83 const angle::PerfMonitorCounterGroups &ContextImpl::getPerfMonitorCounters()
     84 {
     85    static angle::base::NoDestructor<angle::PerfMonitorCounterGroups> sCounters;
     86    return *sCounters;
     87 }
     88 }  // namespace rx