Quiet warnings, add convenience function

This commit is contained in:
Brad Davis 2019-08-12 10:34:07 -07:00
parent 1011880698
commit 44e2037e15
2 changed files with 12 additions and 5 deletions

View file

@ -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()) {

View file

@ -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) {