#include "libANGLE/renderer/gl/TextureGL.h"
#include "common/bitset_utils.h"
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/Context.h"
#include "libANGLE/MemoryObject.h"
#include "libANGLE/State.h"
#include "libANGLE/Surface.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/renderer/gl/BlitGL.h"
#include "libANGLE/renderer/gl/BufferGL.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.h"
#include "libANGLE/renderer/gl/FunctionsGL.h"
#include "libANGLE/renderer/gl/ImageGL.h"
#include "libANGLE/renderer/gl/MemoryObjectGL.h"
#include "libANGLE/renderer/gl/StateManagerGL.h"
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include "libANGLE/renderer/gl/formatutilsgl.h"
#include "libANGLE/renderer/gl/renderergl_utils.h"
#include "platform/autogen/FeaturesGL_autogen.h"
CheckedNumeric;
namespace rx
{
namespace
{
constexpr const size_t kUploadTextureDataInChunksUploadSize = …;
size_t GetLevelInfoIndex(gl::TextureTarget target, size_t level)
{ … }
bool IsLUMAFormat(GLenum format)
{ … }
LUMAWorkaroundGL GetLUMAWorkaroundInfo(GLenum originalFormat, GLenum destinationFormat)
{ … }
bool GetDepthStencilWorkaround(GLenum format)
{ … }
bool GetEmulatedAlphaChannel(const angle::FeaturesGL &features,
const gl::InternalFormat &originalInternalFormat)
{ … }
LevelInfoGL GetLevelInfo(const angle::FeaturesGL &features,
const gl::InternalFormat &originalInternalFormat,
GLenum destinationInternalFormat)
{ … }
gl::Texture::DirtyBits GetLevelWorkaroundDirtyBits()
{ … }
size_t GetMaxLevelInfoCountForTextureType(gl::TextureType type)
{ … }
bool FormatHasBorderColorWorkarounds(GLenum format)
{ … }
}
LUMAWorkaroundGL::LUMAWorkaroundGL() : … { … }
LUMAWorkaroundGL::LUMAWorkaroundGL(bool enabled_, GLenum workaroundFormat_)
: … { … }
LevelInfoGL::LevelInfoGL() : … { … }
LevelInfoGL::LevelInfoGL(GLenum sourceFormat_,
GLenum nativeInternalFormat_,
bool depthStencilWorkaround_,
const LUMAWorkaroundGL &lumaWorkaround_,
bool emulatedAlphaChannel_)
: … { … }
TextureGL::TextureGL(const gl::TextureState &state, GLuint id)
: … { … }
TextureGL::~TextureGL()
{ … }
void TextureGL::onDestroy(const gl::Context *context)
{ … }
angle::Result TextureGL::setImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::setImageHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::reserveTexImageToBeFilled(const gl::Context *context,
gl::TextureTarget target,
size_t level,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type)
{ … }
angle::Result TextureGL::setSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
gl::Buffer *unpackBuffer,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::setSubImageRowByRowWorkaround(const gl::Context *context,
gl::TextureTarget target,
size_t level,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const gl::Buffer *unpackBuffer,
size_t maxBytesUploadedPerChunk,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::setSubImagePaddingWorkaround(const gl::Context *context,
gl::TextureTarget target,
size_t level,
const gl::Box &area,
GLenum format,
GLenum type,
const gl::PixelUnpackState &unpack,
const gl::Buffer *unpackBuffer,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::setCompressedImage(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::setCompressedSubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Box &area,
GLenum format,
const gl::PixelUnpackState &unpack,
size_t imageSize,
const uint8_t *pixels)
{ … }
angle::Result TextureGL::copyImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Rectangle &sourceArea,
GLenum internalFormat,
gl::Framebuffer *source)
{ … }
angle::Result TextureGL::copySubImage(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
const gl::Rectangle &sourceArea,
gl::Framebuffer *source)
{ … }
angle::Result TextureGL::copyTexture(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
GLenum type,
GLint sourceLevel,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{ … }
angle::Result TextureGL::copySubTexture(const gl::Context *context,
const gl::ImageIndex &index,
const gl::Offset &destOffset,
GLint sourceLevel,
const gl::Box &sourceBox,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{ … }
angle::Result TextureGL::copySubTextureHelper(const gl::Context *context,
gl::TextureTarget target,
size_t level,
const gl::Offset &destOffset,
GLint sourceLevel,
const gl::Rectangle &sourceArea,
const gl::InternalFormat &destFormat,
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source)
{ … }
angle::Result TextureGL::setStorage(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size)
{ … }
angle::Result TextureGL::setImageExternal(const gl::Context *context,
const gl::ImageIndex &index,
GLenum internalFormat,
const gl::Extents &size,
GLenum format,
GLenum type)
{ … }
angle::Result TextureGL::setStorageMultisample(const gl::Context *context,
gl::TextureType type,
GLsizei samples,
GLint internalformat,
const gl::Extents &size,
bool fixedSampleLocations)
{ … }
angle::Result TextureGL::setStorageExternalMemory(const gl::Context *context,
gl::TextureType type,
size_t levels,
GLenum internalFormat,
const gl::Extents &size,
gl::MemoryObject *memoryObject,
GLuint64 offset,
GLbitfield createFlags,
GLbitfield usageFlags,
const void *imageCreateInfoPNext)
{ … }
angle::Result TextureGL::setImageExternal(const gl::Context *context,
gl::TextureType type,
egl::Stream *stream,
const egl::Stream::GLTextureDescription &desc)
{ … }
angle::Result TextureGL::generateMipmap(const gl::Context *context)
{ … }
angle::Result TextureGL::clearImage(const gl::Context *context,
GLint level,
GLenum format,
GLenum type,
const uint8_t *data)
{ … }
angle::Result TextureGL::clearSubImage(const gl::Context *context,
GLint level,
const gl::Box &area,
GLenum format,
GLenum type,
const uint8_t *data)
{ … }
angle::Result TextureGL::bindTexImage(const gl::Context *context, egl::Surface *surface)
{ … }
angle::Result TextureGL::releaseTexImage(const gl::Context *context)
{ … }
angle::Result TextureGL::setEGLImageTarget(const gl::Context *context,
gl::TextureType type,
egl::Image *image)
{ … }
GLint TextureGL::getNativeID() const
{ … }
angle::Result TextureGL::syncState(const gl::Context *context,
const gl::Texture::DirtyBits &dirtyBits,
gl::Command source)
{ … }
bool TextureGL::hasAnyDirtyBit() const
{ … }
angle::Result TextureGL::setBaseLevel(const gl::Context *context, GLuint baseLevel)
{ … }
angle::Result TextureGL::setMaxLevel(const gl::Context *context, GLuint maxLevel)
{ … }
angle::Result TextureGL::setMinFilter(const gl::Context *context, GLenum filter)
{ … }
angle::Result TextureGL::setMagFilter(const gl::Context *context, GLenum filter)
{ … }
angle::Result TextureGL::setSwizzle(const gl::Context *context, GLint swizzle[4])
{ … }
angle::Result TextureGL::setBuffer(const gl::Context *context, GLenum internalFormat)
{ … }
GLenum TextureGL::getNativeInternalFormat(const gl::ImageIndex &index) const
{ … }
bool TextureGL::hasEmulatedAlphaChannel(const gl::ImageIndex &index) const
{ … }
angle::Result TextureGL::recreateTexture(const gl::Context *context)
{ … }
angle::Result TextureGL::syncTextureStateSwizzle(const gl::Context *context,
const FunctionsGL *functions,
GLenum name,
GLenum value,
GLenum *currentlyAppliedValue)
{ … }
void TextureGL::setLevelInfo(const gl::Context *context,
gl::TextureTarget target,
size_t level,
size_t levelCount,
const LevelInfoGL &levelInfo)
{ … }
void TextureGL::setLevelInfo(const gl::Context *context,
gl::TextureType type,
size_t level,
size_t levelCount,
const LevelInfoGL &levelInfo)
{ … }
const LevelInfoGL &TextureGL::getLevelInfo(gl::TextureTarget target, size_t level) const
{ … }
const LevelInfoGL &TextureGL::getBaseLevelInfo() const
{ … }
gl::TextureType TextureGL::getType() const
{ … }
angle::Result TextureGL::initializeContents(const gl::Context *context,
GLenum binding,
const gl::ImageIndex &imageIndex)
{ … }
GLint TextureGL::getRequiredExternalTextureImageUnits(const gl::Context *context)
{ … }
}