tor-browser

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

Context9.h (13411B)


      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 // Context9:
      7 //   D3D9-specific functionality associated with a GL Context.
      8 //
      9 
     10 #ifndef LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
     11 #define LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
     12 
     13 #include <stack>
     14 #include "libANGLE/renderer/d3d/ContextD3D.h"
     15 
     16 namespace rx
     17 {
     18 class Renderer9;
     19 
     20 class Context9 : public ContextD3D
     21 {
     22  public:
     23    Context9(const gl::State &state, gl::ErrorSet *errorSet, Renderer9 *renderer);
     24    ~Context9() override;
     25 
     26    angle::Result initialize() override;
     27    void onDestroy(const gl::Context *context) override;
     28 
     29    // Shader creation
     30    CompilerImpl *createCompiler() override;
     31    ShaderImpl *createShader(const gl::ShaderState &data) override;
     32    ProgramImpl *createProgram(const gl::ProgramState &data) override;
     33 
     34    // Framebuffer creation
     35    FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override;
     36 
     37    // Texture creation
     38    TextureImpl *createTexture(const gl::TextureState &state) override;
     39 
     40    // Renderbuffer creation
     41    RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) override;
     42 
     43    // Buffer creation
     44    BufferImpl *createBuffer(const gl::BufferState &state) override;
     45 
     46    // Vertex Array creation
     47    VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override;
     48 
     49    // Query and Fence creation
     50    QueryImpl *createQuery(gl::QueryType type) override;
     51    FenceNVImpl *createFenceNV() override;
     52    SyncImpl *createSync() override;
     53 
     54    // Transform Feedback creation
     55    TransformFeedbackImpl *createTransformFeedback(
     56        const gl::TransformFeedbackState &state) override;
     57 
     58    // Sampler object creation
     59    SamplerImpl *createSampler(const gl::SamplerState &state) override;
     60 
     61    // Program Pipeline object creation
     62    ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) override;
     63 
     64    // Memory object creation.
     65    MemoryObjectImpl *createMemoryObject() override;
     66 
     67    // Semaphore creation.
     68    SemaphoreImpl *createSemaphore() override;
     69 
     70    // Overlay creation.
     71    OverlayImpl *createOverlay(const gl::OverlayState &state) override;
     72 
     73    // Flush and finish.
     74    angle::Result flush(const gl::Context *context) override;
     75    angle::Result finish(const gl::Context *context) override;
     76 
     77    // Drawing methods.
     78    angle::Result drawArrays(const gl::Context *context,
     79                             gl::PrimitiveMode mode,
     80                             GLint first,
     81                             GLsizei count) override;
     82    angle::Result drawArraysInstanced(const gl::Context *context,
     83                                      gl::PrimitiveMode mode,
     84                                      GLint first,
     85                                      GLsizei count,
     86                                      GLsizei instanceCount) override;
     87    angle::Result drawArraysInstancedBaseInstance(const gl::Context *context,
     88                                                  gl::PrimitiveMode mode,
     89                                                  GLint first,
     90                                                  GLsizei count,
     91                                                  GLsizei instanceCount,
     92                                                  GLuint baseInstance) override;
     93 
     94    angle::Result drawElements(const gl::Context *context,
     95                               gl::PrimitiveMode mode,
     96                               GLsizei count,
     97                               gl::DrawElementsType type,
     98                               const void *indices) override;
     99    angle::Result drawElementsBaseVertex(const gl::Context *context,
    100                                         gl::PrimitiveMode mode,
    101                                         GLsizei count,
    102                                         gl::DrawElementsType type,
    103                                         const void *indices,
    104                                         GLint baseVertex) override;
    105    angle::Result drawElementsInstanced(const gl::Context *context,
    106                                        gl::PrimitiveMode mode,
    107                                        GLsizei count,
    108                                        gl::DrawElementsType type,
    109                                        const void *indices,
    110                                        GLsizei instances) override;
    111    angle::Result drawElementsInstancedBaseVertex(const gl::Context *context,
    112                                                  gl::PrimitiveMode mode,
    113                                                  GLsizei count,
    114                                                  gl::DrawElementsType type,
    115                                                  const void *indices,
    116                                                  GLsizei instances,
    117                                                  GLint baseVertex) override;
    118    angle::Result drawElementsInstancedBaseVertexBaseInstance(const gl::Context *context,
    119                                                              gl::PrimitiveMode mode,
    120                                                              GLsizei count,
    121                                                              gl::DrawElementsType type,
    122                                                              const void *indices,
    123                                                              GLsizei instances,
    124                                                              GLint baseVertex,
    125                                                              GLuint baseInstance) override;
    126    angle::Result drawRangeElements(const gl::Context *context,
    127                                    gl::PrimitiveMode mode,
    128                                    GLuint start,
    129                                    GLuint end,
    130                                    GLsizei count,
    131                                    gl::DrawElementsType type,
    132                                    const void *indices) override;
    133    angle::Result drawRangeElementsBaseVertex(const gl::Context *context,
    134                                              gl::PrimitiveMode mode,
    135                                              GLuint start,
    136                                              GLuint end,
    137                                              GLsizei count,
    138                                              gl::DrawElementsType type,
    139                                              const void *indices,
    140                                              GLint baseVertex) override;
    141    angle::Result drawArraysIndirect(const gl::Context *context,
    142                                     gl::PrimitiveMode mode,
    143                                     const void *indirect) override;
    144    angle::Result drawElementsIndirect(const gl::Context *context,
    145                                       gl::PrimitiveMode mode,
    146                                       gl::DrawElementsType type,
    147                                       const void *indirect) override;
    148 
    149    angle::Result multiDrawArrays(const gl::Context *context,
    150                                  gl::PrimitiveMode mode,
    151                                  const GLint *firsts,
    152                                  const GLsizei *counts,
    153                                  GLsizei drawcount) override;
    154    angle::Result multiDrawArraysInstanced(const gl::Context *context,
    155                                           gl::PrimitiveMode mode,
    156                                           const GLint *firsts,
    157                                           const GLsizei *counts,
    158                                           const GLsizei *instanceCounts,
    159                                           GLsizei drawcount) override;
    160    angle::Result multiDrawArraysIndirect(const gl::Context *context,
    161                                          gl::PrimitiveMode mode,
    162                                          const void *indirect,
    163                                          GLsizei drawcount,
    164                                          GLsizei stride) override;
    165    angle::Result multiDrawElements(const gl::Context *context,
    166                                    gl::PrimitiveMode mode,
    167                                    const GLsizei *counts,
    168                                    gl::DrawElementsType type,
    169                                    const GLvoid *const *indices,
    170                                    GLsizei drawcount) override;
    171    angle::Result multiDrawElementsInstanced(const gl::Context *context,
    172                                             gl::PrimitiveMode mode,
    173                                             const GLsizei *counts,
    174                                             gl::DrawElementsType type,
    175                                             const GLvoid *const *indices,
    176                                             const GLsizei *instanceCounts,
    177                                             GLsizei drawcount) override;
    178    angle::Result multiDrawElementsIndirect(const gl::Context *context,
    179                                            gl::PrimitiveMode mode,
    180                                            gl::DrawElementsType type,
    181                                            const void *indirect,
    182                                            GLsizei drawcount,
    183                                            GLsizei stride) override;
    184    angle::Result multiDrawArraysInstancedBaseInstance(const gl::Context *context,
    185                                                       gl::PrimitiveMode mode,
    186                                                       const GLint *firsts,
    187                                                       const GLsizei *counts,
    188                                                       const GLsizei *instanceCounts,
    189                                                       const GLuint *baseInstances,
    190                                                       GLsizei drawcount) override;
    191    angle::Result multiDrawElementsInstancedBaseVertexBaseInstance(const gl::Context *context,
    192                                                                   gl::PrimitiveMode mode,
    193                                                                   const GLsizei *counts,
    194                                                                   gl::DrawElementsType type,
    195                                                                   const GLvoid *const *indices,
    196                                                                   const GLsizei *instanceCounts,
    197                                                                   const GLint *baseVertices,
    198                                                                   const GLuint *baseInstances,
    199                                                                   GLsizei drawcount) override;
    200 
    201    // Device loss
    202    gl::GraphicsResetStatus getResetStatus() override;
    203 
    204    // EXT_debug_marker
    205    angle::Result insertEventMarker(GLsizei length, const char *marker) override;
    206    angle::Result pushGroupMarker(GLsizei length, const char *marker) override;
    207    angle::Result popGroupMarker() override;
    208 
    209    // KHR_debug
    210    angle::Result pushDebugGroup(const gl::Context *context,
    211                                 GLenum source,
    212                                 GLuint id,
    213                                 const std::string &message) override;
    214    angle::Result popDebugGroup(const gl::Context *context) override;
    215 
    216    // State sync with dirty bits.
    217    angle::Result syncState(const gl::Context *context,
    218                            const gl::State::DirtyBits &dirtyBits,
    219                            const gl::State::DirtyBits &bitMask,
    220                            gl::Command command) override;
    221 
    222    // Disjoint timer queries
    223    GLint getGPUDisjoint() override;
    224    GLint64 getTimestamp() override;
    225 
    226    // Context switching
    227    angle::Result onMakeCurrent(const gl::Context *context) override;
    228 
    229    // Caps queries
    230    gl::Caps getNativeCaps() const override;
    231    const gl::TextureCapsMap &getNativeTextureCaps() const override;
    232    const gl::Extensions &getNativeExtensions() const override;
    233    const gl::Limitations &getNativeLimitations() const override;
    234    ShPixelLocalStorageType getNativePixelLocalStorageType() const override;
    235 
    236    angle::Result dispatchCompute(const gl::Context *context,
    237                                  GLuint numGroupsX,
    238                                  GLuint numGroupsY,
    239                                  GLuint numGroupsZ) override;
    240    angle::Result dispatchComputeIndirect(const gl::Context *context, GLintptr indirect) override;
    241 
    242    angle::Result memoryBarrier(const gl::Context *context, GLbitfield barriers) override;
    243    angle::Result memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) override;
    244 
    245    Renderer9 *getRenderer() const { return mRenderer; }
    246 
    247    angle::Result getIncompleteTexture(const gl::Context *context,
    248                                       gl::TextureType type,
    249                                       gl::Texture **textureOut);
    250 
    251    void handleResult(HRESULT hr,
    252                      const char *message,
    253                      const char *file,
    254                      const char *function,
    255                      unsigned int line) override;
    256 
    257  private:
    258    Renderer9 *mRenderer;
    259    IncompleteTextureSet mIncompleteTextures;
    260    std::stack<std::string> mMarkerStack;
    261 };
    262 
    263 }  // namespace rx
    264 
    265 #endif  // LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_