From 8240c3f76112d9c1b300eb50211886dda732ef3e Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 27 Apr 2017 18:05:52 -0700 Subject: [PATCH] Fixing the spam issue triggered by the external textures, removed 2 warnings --- libraries/gpu-gl/src/gpu/gl/GLTexelFormat.h | 3 +++ libraries/gpu-gl/src/gpu/gl/GLTexture.cpp | 2 +- libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp | 4 ++-- libraries/gpu/src/gpu/Texture.cpp | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.h b/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.h index 1edc10395c..8f37f6b604 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.h +++ b/libraries/gpu-gl/src/gpu/gl/GLTexelFormat.h @@ -18,6 +18,9 @@ public: GLenum format; GLenum type; + GLTexelFormat(GLenum glinternalFormat, GLenum glformat, GLenum gltype) : internalFormat(glinternalFormat), format(glformat), type(gltype) {} + GLTexelFormat(GLenum glinternalFormat) : internalFormat(glinternalFormat) {} + bool isCompressed() const; static GLTexelFormat evalGLTexelFormat(const Element& dstFormat) { diff --git a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp index 95815993c2..05c194405b 100644 --- a/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl/GLTexture.cpp @@ -103,7 +103,7 @@ GLTexture::GLTexture(const std::weak_ptr& backend, const Texture& tex GLObject(backend, texture, id), _source(texture.source()), _target(getGLTextureType(texture)), - _texelFormat(GLTexelFormat::evalGLTexelFormat(texture.getTexelFormat(), texture.getStoredMipFormat())) + _texelFormat(GLTexelFormat::evalGLTexelFormatInternal(texture.getTexelFormat())) { Backend::setGPUObject(texture, this); } diff --git a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp index f199d210b3..1f2cb20d04 100644 --- a/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl41/GL41BackendTexture.cpp @@ -358,7 +358,7 @@ void GL41VariableAllocationTexture::promote() { // Collect the size of the first face, and then compute the total size offset needed for this mip level glGetTexLevelParameteriv(faceTargets.front(), sourceLevel, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &sourceMip._faceSize); - sourceMip._size = faceTargets.size() * sourceMip._faceSize; + sourceMip._size = (GLint) faceTargets.size() * sourceMip._faceSize; sourceMip._offset = bufferOffset; bufferOffset += sourceMip._size; } @@ -482,7 +482,7 @@ void GL41VariableAllocationTexture::demote() { // Collect the size of the first face, and then compute the total size offset needed for this mip level glGetTexLevelParameteriv(faceTargets.front(), sourceLevel, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &sourceMip._faceSize); - sourceMip._size = faceTargets.size() * sourceMip._faceSize; + sourceMip._size = (GLint) faceTargets.size() * sourceMip._faceSize; sourceMip._offset = bufferOffset; bufferOffset += sourceMip._size; } diff --git a/libraries/gpu/src/gpu/Texture.cpp b/libraries/gpu/src/gpu/Texture.cpp index 353bcbc8f1..b12ae5bc97 100755 --- a/libraries/gpu/src/gpu/Texture.cpp +++ b/libraries/gpu/src/gpu/Texture.cpp @@ -216,6 +216,7 @@ void Texture::MemoryStorage::assignMipFaceData(uint16 level, uint8 face, const s TexturePointer Texture::createExternal(const ExternalRecycler& recycler, const Sampler& sampler) { TexturePointer tex = std::make_shared(TextureUsageType::EXTERNAL); tex->_type = TEX_2D; + tex->_texelFormat = Element::COLOR_RGBA_32; tex->_maxMipLevel = 0; tex->_sampler = sampler; tex->setExternalRecycler(recycler);