Edit

kc3-lang/angle/src/libANGLE/renderer/null/TextureNULL.cpp

Branch :

  • Show log

    Commit

  • Author : Jamie Madill
    Date : 2017-10-03 09:01:44
    Hash : 05b35b21
    Message : D3D11: Lazy robust resource init. This patch moves the robust resource init logic to the GL front-end. Instead of initializing texture resources immediately on creation in D3D11, it defers the clear until before a draw call in some cases, or skips the update if we can determine if a texture (or other resource) has been fully initialized. Currently lazy init is only implemented for Textures, Renderbuffers, and Surfaces. Various places where lazy resource init is triggered: * Framebuffer operations (Draw, Blit, CopyTexImage, Clear, ReadPixels) * Texture operations (SubImage, GenerateMipmap, CopyTexImage) Some efficiency gains remain to be implemented, such as when a SubImage call fills the entire object. Similarly for Blit, and a few other operations. In these cases we can skip lazy init as an optimization. Edge cases with EGLImage are mostly untested. BUG=angleproject:2107 Change-Id: I2bf3a69b1eae0d4feeb5b17daca23451f1037be8 Reviewed-on: https://chromium-review.googlesource.com/576058 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>

  • src/libANGLE/renderer/null/TextureNULL.cpp
  • //
    // Copyright 2016 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // TextureNULL.cpp:
    //    Implements the class methods for TextureNULL.
    //
    
    #include "libANGLE/renderer/null/TextureNULL.h"
    
    #include "common/debug.h"
    
    namespace rx
    {
    
    TextureNULL::TextureNULL(const gl::TextureState &state) : TextureImpl(state)
    {
    }
    
    TextureNULL::~TextureNULL()
    {
    }
    
    gl::Error TextureNULL::setImage(const gl::Context *context,
                                    GLenum target,
                                    size_t level,
                                    GLenum internalFormat,
                                    const gl::Extents &size,
                                    GLenum format,
                                    GLenum type,
                                    const gl::PixelUnpackState &unpack,
                                    const uint8_t *pixels)
    {
        // TODO(geofflang): Read all incoming pixel data (maybe hash it?) to make sure we don't read out
        // of bounds due to validation bugs.
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setSubImage(const gl::Context *context,
                                       GLenum target,
                                       size_t level,
                                       const gl::Box &area,
                                       GLenum format,
                                       GLenum type,
                                       const gl::PixelUnpackState &unpack,
                                       const uint8_t *pixels)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setCompressedImage(const gl::Context *context,
                                              GLenum target,
                                              size_t level,
                                              GLenum internalFormat,
                                              const gl::Extents &size,
                                              const gl::PixelUnpackState &unpack,
                                              size_t imageSize,
                                              const uint8_t *pixels)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setCompressedSubImage(const gl::Context *context,
                                                 GLenum target,
                                                 size_t level,
                                                 const gl::Box &area,
                                                 GLenum format,
                                                 const gl::PixelUnpackState &unpack,
                                                 size_t imageSize,
                                                 const uint8_t *pixels)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::copyImage(const gl::Context *context,
                                     GLenum target,
                                     size_t level,
                                     const gl::Rectangle &sourceArea,
                                     GLenum internalFormat,
                                     const gl::Framebuffer *source)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::copySubImage(const gl::Context *context,
                                        GLenum target,
                                        size_t level,
                                        const gl::Offset &destOffset,
                                        const gl::Rectangle &sourceArea,
                                        const gl::Framebuffer *source)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setStorage(const gl::Context *context,
                                      GLenum target,
                                      size_t levels,
                                      GLenum internalFormat,
                                      const gl::Extents &size)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setEGLImageTarget(const gl::Context *context,
                                             GLenum target,
                                             egl::Image *image)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setImageExternal(const gl::Context *context,
                                            GLenum target,
                                            egl::Stream *stream,
                                            const egl::Stream::GLTextureDescription &desc)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::generateMipmap(const gl::Context *context)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::setBaseLevel(const gl::Context *context, GLuint baseLevel)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::bindTexImage(const gl::Context *context, egl::Surface *surface)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::releaseTexImage(const gl::Context *context)
    {
        return gl::NoError();
    }
    
    void TextureNULL::syncState(const gl::Texture::DirtyBits &dirtyBits)
    {
    }
    
    gl::Error TextureNULL::setStorageMultisample(const gl::Context *context,
                                                 GLenum target,
                                                 GLsizei samples,
                                                 GLint internalformat,
                                                 const gl::Extents &size,
                                                 GLboolean fixedSampleLocations)
    {
        return gl::NoError();
    }
    
    gl::Error TextureNULL::initializeContents(const gl::Context *context,
                                              const gl::ImageIndex &imageIndex)
    {
        return gl::NoError();
    }
    
    }  // namespace rx