From 44e2037e15b3886af66517ae3591bcc6fd65a6e5 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Mon, 12 Aug 2019 10:34:07 -0700 Subject: [PATCH] Quiet warnings, add convenience function --- libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.cpp | 9 +++++++-- libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.h | 8 +++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.cpp b/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.cpp index fef823718f..dd365efc16 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.cpp +++ b/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.cpp @@ -33,8 +33,8 @@ using namespace gpu::gl; #define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F #endif -bool GLTexelFormat::isCompressed() const { - switch (internalFormat) { +bool GLTexelFormat::isCompressed(GLenum format) { + switch (format) { case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: @@ -92,6 +92,11 @@ bool GLTexelFormat::isCompressed() const { } } +bool GLTexelFormat::isCompressed() const { + return isCompressed(internalFormat); +} + + GLenum GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) { GLenum result = GL_RGBA8; switch (dstFormat.getDimension()) { diff --git a/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.h b/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.h index 8f37f6b604..b5c805c5b8 100644 --- a/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.h +++ b/libraries/gpu-gl-common/src/gpu/gl/GLTexelFormat.h @@ -14,13 +14,15 @@ namespace gpu { namespace gl { class GLTexelFormat { public: - GLenum internalFormat; - GLenum format; - GLenum type; + GLenum internalFormat{ GL_RGBA8 }; + GLenum format{ GL_RGBA }; + GLenum type{ GL_UNSIGNED_BYTE }; GLTexelFormat(GLenum glinternalFormat, GLenum glformat, GLenum gltype) : internalFormat(glinternalFormat), format(glformat), type(gltype) {} GLTexelFormat(GLenum glinternalFormat) : internalFormat(glinternalFormat) {} + static bool isCompressed(GLenum glinternalFormat); + bool isCompressed() const; static GLTexelFormat evalGLTexelFormat(const Element& dstFormat) {