chromium/third_party/angle/src/libANGLE/Framebuffer.cpp

//
// Copyright 2002 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.
//

// Framebuffer.cpp: Implements the gl::Framebuffer class. Implements GL framebuffer
// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.

#include "libANGLE/Framebuffer.h"

#include "common/Optional.h"
#include "common/bitset_utils.h"
#include "common/utilities.h"
#include "libANGLE/Config.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/ErrorStrings.h"
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/PixelLocalStorage.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/ShareGroup.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Texture.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/FramebufferImpl.h"
#include "libANGLE/renderer/GLImplFactory.h"
#include "libANGLE/renderer/RenderbufferImpl.h"
#include "libANGLE/renderer/SurfaceImpl.h"

usingnamespaceangle;

namespace gl
{

namespace
{

// Check the |checkAttachment| in reference to |firstAttachment| for the sake of multiview
// framebuffer completeness.
FramebufferStatus CheckMultiviewStateMatchesForCompleteness(
    const FramebufferAttachment *firstAttachment,
    const FramebufferAttachment *checkAttachment)
{}

FramebufferStatus CheckAttachmentCompleteness(const Context *context,
                                              const FramebufferAttachment &attachment)
{}

FramebufferStatus CheckAttachmentSampleCounts(const Context *context,
                                              GLsizei currAttachmentSamples,
                                              GLsizei samples,
                                              bool colorAttachment)
{}

FramebufferStatus CheckAttachmentSampleCompleteness(const Context *context,
                                                    const FramebufferAttachment &attachment,
                                                    bool colorAttachment,
                                                    Optional<int> *samples,
                                                    Optional<bool> *fixedSampleLocations,
                                                    Optional<int> *renderToTextureSamples)
{}

// Needed to index into the attachment arrays/bitsets.
static_assert;
static_assert;
static_assert;

angle::Result InitAttachment(const Context *context, FramebufferAttachment *attachment)
{}

bool AttachmentOverlapsWithTexture(const FramebufferAttachment &attachment,
                                   const Texture *texture,
                                   const Sampler *sampler)
{}

constexpr ComponentType GetAttachmentComponentType(GLenum componentType)
{}

}  // anonymous namespace

bool FramebufferStatus::isComplete() const
{}

FramebufferStatus FramebufferStatus::Complete()
{}

FramebufferStatus FramebufferStatus::Incomplete(GLenum status, const char *reason)
{}

// This constructor is only used for default framebuffers.
FramebufferState::FramebufferState(rx::UniqueSerial serial)
    :{}

FramebufferState::FramebufferState(const Caps &caps, FramebufferID id, rx::UniqueSerial serial)
    :{}

FramebufferState::~FramebufferState() {}

const std::string &FramebufferState::getLabel() const
{}

const FramebufferAttachment *FramebufferState::getAttachment(const Context *context,
                                                             GLenum attachment) const
{}

uint32_t FramebufferState::getReadIndex() const
{}

const FramebufferAttachment *FramebufferState::getReadAttachment() const
{}

const FramebufferAttachment *FramebufferState::getReadPixelsAttachment(GLenum readFormat) const
{}

const FramebufferAttachment *FramebufferState::getFirstNonNullAttachment() const
{}

const FramebufferAttachment *FramebufferState::getFirstColorAttachment() const
{}

const FramebufferAttachment *FramebufferState::getDepthOrStencilAttachment() const
{}

const FramebufferAttachment *FramebufferState::getStencilOrDepthStencilAttachment() const
{}

const FramebufferAttachment *FramebufferState::getColorAttachment(size_t colorAttachment) const
{}

const FramebufferAttachment *FramebufferState::getDepthAttachment() const
{}

const FramebufferAttachment *FramebufferState::getWebGLDepthAttachment() const
{}

const FramebufferAttachment *FramebufferState::getWebGLDepthStencilAttachment() const
{}

const FramebufferAttachment *FramebufferState::getStencilAttachment() const
{}

const FramebufferAttachment *FramebufferState::getWebGLStencilAttachment() const
{}

const FramebufferAttachment *FramebufferState::getDepthStencilAttachment() const
{}

const Extents FramebufferState::getAttachmentExtentsIntersection() const
{}

bool FramebufferState::attachmentsHaveSameDimensions() const
{}

bool FramebufferState::hasSeparateDepthAndStencilAttachments() const
{}

const FramebufferAttachment *FramebufferState::getDrawBuffer(size_t drawBufferIdx) const
{}

size_t FramebufferState::getDrawBufferCount() const
{}

bool FramebufferState::colorAttachmentsAreUniqueImages() const
{}

bool FramebufferState::hasDepth() const
{}

bool FramebufferState::hasStencil() const
{}

bool FramebufferState::hasExternalTextureAttachment() const
{}

bool FramebufferState::hasYUVAttachment() const
{}

bool FramebufferState::isMultiview() const
{}

int FramebufferState::getBaseViewIndex() const
{}

Box FramebufferState::getDimensions() const
{}

Extents FramebufferState::getExtents() const
{}

bool FramebufferState::isDefault() const
{}

bool FramebufferState::isBoundAsDrawFramebuffer(const Context *context) const
{}

const FramebufferID Framebuffer::kDefaultDrawFramebufferHandle =;

Framebuffer::Framebuffer(const Context *context, rx::GLImplFactory *factory)
    :{}

Framebuffer::Framebuffer(const Context *context, rx::GLImplFactory *factory, FramebufferID id)
    :{}

Framebuffer::~Framebuffer()
{}

void Framebuffer::onDestroy(const Context *context)
{}

egl::Error Framebuffer::setSurfaces(const Context *context,
                                    egl::Surface *surface,
                                    egl::Surface *readSurface)
{}

void Framebuffer::setReadSurface(const Context *context, egl::Surface *readSurface)
{}

egl::Error Framebuffer::unsetSurfaces(const Context *context)
{}

angle::Result Framebuffer::setLabel(const Context *context, const std::string &label)
{}

const std::string &Framebuffer::getLabel() const
{}

bool Framebuffer::detachTexture(Context *context, TextureID textureId)
{}

bool Framebuffer::detachRenderbuffer(Context *context, RenderbufferID renderbufferId)
{}

bool Framebuffer::detachResourceById(Context *context, GLenum resourceType, GLuint resourceId)
{}

bool Framebuffer::detachMatchingAttachment(Context *context,
                                           FramebufferAttachment *attachment,
                                           GLenum matchType,
                                           GLuint matchId)
{}

const FramebufferAttachment *Framebuffer::getColorAttachment(size_t colorAttachment) const
{}

const FramebufferAttachment *Framebuffer::getDepthAttachment() const
{}

const FramebufferAttachment *Framebuffer::getStencilAttachment() const
{}

const FramebufferAttachment *Framebuffer::getDepthStencilAttachment() const
{}

const FramebufferAttachment *Framebuffer::getDepthOrStencilAttachment() const
{}

const FramebufferAttachment *Framebuffer::getStencilOrDepthStencilAttachment() const
{}

const FramebufferAttachment *Framebuffer::getReadColorAttachment() const
{}

GLenum Framebuffer::getReadColorAttachmentType() const
{}

const FramebufferAttachment *Framebuffer::getFirstColorAttachment() const
{}

const FramebufferAttachment *Framebuffer::getFirstNonNullAttachment() const
{}

const FramebufferAttachment *Framebuffer::getAttachment(const Context *context,
                                                        GLenum attachment) const
{}

size_t Framebuffer::getDrawbufferStateCount() const
{}

GLenum Framebuffer::getDrawBufferState(size_t drawBuffer) const
{}

const DrawBuffersVector<GLenum> &Framebuffer::getDrawBufferStates() const
{}

void Framebuffer::setDrawBuffers(size_t count, const GLenum *buffers)
{}

const FramebufferAttachment *Framebuffer::getDrawBuffer(size_t drawBuffer) const
{}

ComponentType Framebuffer::getDrawbufferWriteType(size_t drawBuffer) const
{}

ComponentTypeMask Framebuffer::getDrawBufferTypeMask() const
{}

DrawBufferMask Framebuffer::getDrawBufferMask() const
{}

bool Framebuffer::hasEnabledDrawBuffer() const
{}

GLenum Framebuffer::getReadBufferState() const
{}

void Framebuffer::setReadBuffer(GLenum buffer)
{}

size_t Framebuffer::getNumColorAttachments() const
{}

bool Framebuffer::hasDepth() const
{}

bool Framebuffer::hasStencil() const
{}

bool Framebuffer::hasExternalTextureAttachment() const
{}

bool Framebuffer::hasYUVAttachment() const
{}

bool Framebuffer::usingExtendedDrawBuffers() const
{}

void Framebuffer::invalidateCompletenessCache()
{}

const FramebufferStatus &Framebuffer::checkStatusImpl(const Context *context) const
{}

FramebufferStatus Framebuffer::checkStatusWithGLFrontEnd(const Context *context) const
{}

angle::Result Framebuffer::discard(const Context *context, size_t count, const GLenum *attachments)
{}

angle::Result Framebuffer::invalidate(const Context *context,
                                      size_t count,
                                      const GLenum *attachments)
{}

bool Framebuffer::partialClearNeedsInit(const Context *context,
                                        bool color,
                                        bool depth,
                                        bool stencil)
{}

angle::Result Framebuffer::invalidateSub(const Context *context,
                                         size_t count,
                                         const GLenum *attachments,
                                         const Rectangle &area)
{}

angle::Result Framebuffer::clear(const Context *context, GLbitfield mask)
{}

angle::Result Framebuffer::clearBufferfv(const Context *context,
                                         GLenum buffer,
                                         GLint drawbuffer,
                                         const GLfloat *values)
{}

angle::Result Framebuffer::clearBufferuiv(const Context *context,
                                          GLenum buffer,
                                          GLint drawbuffer,
                                          const GLuint *values)
{}

angle::Result Framebuffer::clearBufferiv(const Context *context,
                                         GLenum buffer,
                                         GLint drawbuffer,
                                         const GLint *values)
{}

angle::Result Framebuffer::clearBufferfi(const Context *context,
                                         GLenum buffer,
                                         GLint drawbuffer,
                                         GLfloat depth,
                                         GLint stencil)
{}

GLenum Framebuffer::getImplementationColorReadFormat(const Context *context)
{}

GLenum Framebuffer::getImplementationColorReadType(const Context *context)
{}

angle::Result Framebuffer::readPixels(const Context *context,
                                      const Rectangle &area,
                                      GLenum format,
                                      GLenum type,
                                      const PixelPackState &pack,
                                      Buffer *packBuffer,
                                      void *pixels)
{}

angle::Result Framebuffer::blit(const Context *context,
                                const Rectangle &sourceArea,
                                const Rectangle &destArea,
                                GLbitfield mask,
                                GLenum filter)
{}

int Framebuffer::getSamples(const Context *context) const
{}

int Framebuffer::getReadBufferResourceSamples(const Context *context) const
{}

angle::Result Framebuffer::getSamplePosition(const Context *context,
                                             size_t index,
                                             GLfloat *xy) const
{}

bool Framebuffer::hasValidDepthStencil() const
{}

const gl::Offset &Framebuffer::getSurfaceTextureOffset() const
{}

void Framebuffer::setAttachment(const Context *context,
                                GLenum type,
                                GLenum binding,
                                const ImageIndex &textureIndex,
                                FramebufferAttachmentObject *resource)
{}

void Framebuffer::setAttachmentMultisample(const Context *context,
                                           GLenum type,
                                           GLenum binding,
                                           const ImageIndex &textureIndex,
                                           FramebufferAttachmentObject *resource,
                                           GLsizei samples)
{}

void Framebuffer::setAttachment(const Context *context,
                                GLenum type,
                                GLenum binding,
                                const ImageIndex &textureIndex,
                                FramebufferAttachmentObject *resource,
                                GLsizei numViews,
                                GLuint baseViewIndex,
                                bool isMultiview,
                                GLsizei samplesIn)
{}

void Framebuffer::setAttachmentMultiview(const Context *context,
                                         GLenum type,
                                         GLenum binding,
                                         const ImageIndex &textureIndex,
                                         FramebufferAttachmentObject *resource,
                                         GLsizei numViews,
                                         GLint baseViewIndex)
{}

void Framebuffer::commitWebGL1DepthStencilIfConsistent(const Context *context,
                                                       GLsizei numViews,
                                                       GLuint baseViewIndex,
                                                       bool isMultiview,
                                                       GLsizei samples)
{}

void Framebuffer::setAttachmentImpl(const Context *context,
                                    GLenum type,
                                    GLenum binding,
                                    const ImageIndex &textureIndex,
                                    FramebufferAttachmentObject *resource,
                                    GLsizei numViews,
                                    GLuint baseViewIndex,
                                    bool isMultiview,
                                    GLsizei samples)
{}

void Framebuffer::updateAttachment(const Context *context,
                                   FramebufferAttachment *attachment,
                                   size_t dirtyBit,
                                   angle::ObserverBinding *onDirtyBinding,
                                   GLenum type,
                                   GLenum binding,
                                   const ImageIndex &textureIndex,
                                   FramebufferAttachmentObject *resource,
                                   GLsizei numViews,
                                   GLuint baseViewIndex,
                                   bool isMultiview,
                                   GLsizei samples)
{}

void Framebuffer::resetAttachment(const Context *context, GLenum binding)
{}

void Framebuffer::setWriteControlMode(SrgbWriteControlMode srgbWriteControlMode)
{}

angle::Result Framebuffer::syncState(const Context *context,
                                     GLenum framebufferBinding,
                                     Command command) const
{}

void Framebuffer::onSubjectStateChange(angle::SubjectIndex index, angle::SubjectMessage message)
{}

FramebufferAttachment *Framebuffer::getAttachmentFromSubjectIndex(angle::SubjectIndex index)
{}

bool Framebuffer::formsRenderingFeedbackLoopWith(const Context *context) const
{}

bool Framebuffer::formsCopyingFeedbackLoopWith(TextureID copyTextureID,
                                               GLint copyTextureLevel,
                                               GLint copyTextureLayer) const
{}

GLint Framebuffer::getDefaultWidth() const
{}

GLint Framebuffer::getDefaultHeight() const
{}

GLint Framebuffer::getDefaultSamples() const
{}

bool Framebuffer::getDefaultFixedSampleLocations() const
{}

GLint Framebuffer::getDefaultLayers() const
{}

bool Framebuffer::getFlipY() const
{}

void Framebuffer::setDefaultWidth(const Context *context, GLint defaultWidth)
{}

void Framebuffer::setDefaultHeight(const Context *context, GLint defaultHeight)
{}

void Framebuffer::setDefaultSamples(const Context *context, GLint defaultSamples)
{}

void Framebuffer::setDefaultFixedSampleLocations(const Context *context,
                                                 bool defaultFixedSampleLocations)
{}

void Framebuffer::setDefaultLayers(GLint defaultLayers)
{}

void Framebuffer::setFlipY(bool flipY)
{}

GLsizei Framebuffer::getNumViews() const
{}

GLint Framebuffer::getBaseViewIndex() const
{}

bool Framebuffer::isMultiview() const
{}

bool Framebuffer::readDisallowedByMultiview() const
{}

angle::Result Framebuffer::ensureClearAttachmentsInitialized(const Context *context,
                                                             GLbitfield mask)
{}

angle::Result Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context,
                                                                   GLenum buffer,
                                                                   GLint drawbuffer)
{}

angle::Result Framebuffer::ensureDrawAttachmentsInitialized(const Context *context)
{}

angle::Result Framebuffer::ensureReadAttachmentsInitialized(const Context *context)
{}

void Framebuffer::markAttachmentsInitialized(const DrawBufferMask &color, bool depth, bool stencil)
{}

Box Framebuffer::getDimensions() const
{}

Extents Framebuffer::getExtents() const
{}

bool Framebuffer::isFoveationEnabled() const
{}

GLuint Framebuffer::getFoveatedFeatureBits() const
{}

void Framebuffer::setFoveatedFeatureBits(const GLuint features)
{}

bool Framebuffer::isFoveationConfigured() const
{}

void Framebuffer::configureFoveation()
{}

void Framebuffer::setFocalPoint(uint32_t layer,
                                uint32_t focalPointIndex,
                                float focalX,
                                float focalY,
                                float gainX,
                                float gainY,
                                float foveaArea)
{}

const FocalPoint &Framebuffer::getFocalPoint(uint32_t layer, uint32_t focalPoint) const
{}

GLuint Framebuffer::getSupportedFoveationFeatures() const
{}

bool Framebuffer::partialBufferClearNeedsInit(const Context *context, GLenum bufferType)
{}

PixelLocalStorage &Framebuffer::getPixelLocalStorage(const Context *context)
{}

std::unique_ptr<PixelLocalStorage> Framebuffer::detachPixelLocalStorage()
{}

angle::Result Framebuffer::syncAllDrawAttachmentState(const Context *context, Command command) const
{}

angle::Result Framebuffer::syncAttachmentState(const Context *context,
                                               Command command,
                                               const FramebufferAttachment *attachment) const
{}
}  // namespace gl