diff --git a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp index 4aff76df21..81a6b100d0 100644 --- a/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp +++ b/libraries/gpu-gl/src/gpu/gl45/GL45BackendTexture.cpp @@ -220,6 +220,10 @@ void GL45Texture::generateMips() const { (void)CHECK_GL_ERROR(); } +// (NOTE: it seems to work now, but for posterity:) DSA ARB does not work on AMD, so use EXT +// unless EXT is not available on the driver +#define AMD_CUBE_MAP_EXT_WORKAROUND 0 + Size GL45Texture::copyMipFaceLinesFromTexture(uint16_t mip, uint8_t face, const uvec3& size, uint32_t yOffset, GLenum internalFormat, GLenum format, GLenum type, Size sourceSize, const void* sourcePointer) const { Size amountCopied = sourceSize; if (GL_TEXTURE_2D == _target) { @@ -267,22 +271,26 @@ Size GL45Texture::copyMipFaceLinesFromTexture(uint16_t mip, uint8_t face, const case GL_COMPRESSED_SIGNED_R11_EAC: case GL_COMPRESSED_RG11_EAC: case GL_COMPRESSED_SIGNED_RG11_EAC: +#if AMD_CUBE_MAP_EXT_WORKAROUND if (glCompressedTextureSubImage2DEXT) { auto target = GLTexture::CUBE_FACE_LAYOUT[face]; glCompressedTextureSubImage2DEXT(_id, target, mip, 0, yOffset, size.x, size.y, internalFormat, static_cast(sourceSize), sourcePointer); - } else { + } else +#endif + { glCompressedTextureSubImage3D(_id, mip, 0, yOffset, face, size.x, size.y, 1, internalFormat, static_cast(sourceSize), sourcePointer); } break; default: - // DSA ARB does not work on AMD, so use EXT - // unless EXT is not available on the driver +#if AMD_CUBE_MAP_EXT_WORKAROUND if (glTextureSubImage2DEXT) { auto target = GLTexture::CUBE_FACE_LAYOUT[face]; glTextureSubImage2DEXT(_id, target, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer); - } else { + } else +#endif + { glTextureSubImage3D(_id, mip, 0, yOffset, face, size.x, size.y, 1, format, type, sourcePointer); } break; diff --git a/libraries/gpu/src/gpu/Format.cpp b/libraries/gpu/src/gpu/Format.cpp index 7e277ae488..013a5ac4a6 100644 --- a/libraries/gpu/src/gpu/Format.cpp +++ b/libraries/gpu/src/gpu/Format.cpp @@ -26,8 +26,8 @@ const Element Element::COLOR_COMPRESSED_BCX_SRGB { TILE4x4, COMPRESSED, COMPRESS const Element Element::COLOR_COMPRESSED_BCX_SRGBA_MASK { TILE4x4, COMPRESSED, COMPRESSED_BC1_SRGBA }; const Element Element::COLOR_COMPRESSED_BCX_SRGBA { TILE4x4, COMPRESSED, COMPRESSED_BC3_SRGBA }; const Element Element::COLOR_COMPRESSED_BCX_XY { TILE4x4, COMPRESSED, COMPRESSED_BC5_XY }; -const Element Element::COLOR_COMPRESSED_BCX_SRGBA_HIGH { TILE4x4, COMPRESSED, COMPRESSED_BC7_SRGBA }; const Element Element::COLOR_COMPRESSED_BCX_HDR_RGB { TILE4x4, COMPRESSED, COMPRESSED_BC6_RGB }; +const Element Element::COLOR_COMPRESSED_BCX_SRGBA_HIGH { TILE4x4, COMPRESSED, COMPRESSED_BC7_SRGBA }; const Element Element::COLOR_COMPRESSED_ETC2_RGB { TILE4x4, COMPRESSED, COMPRESSED_ETC2_RGB }; const Element Element::COLOR_COMPRESSED_ETC2_SRGB { TILE4x4, COMPRESSED, COMPRESSED_ETC2_SRGB }; diff --git a/libraries/gpu/src/gpu/FrameReader.cpp b/libraries/gpu/src/gpu/FrameReader.cpp index 812f4db7cc..740ec2b26f 100644 --- a/libraries/gpu/src/gpu/FrameReader.cpp +++ b/libraries/gpu/src/gpu/FrameReader.cpp @@ -18,7 +18,6 @@ #include "Batch.h" #include "TextureTable.h" - #include "FrameIOKeys.h" namespace gpu { @@ -324,6 +323,13 @@ TexturePointer Deserializer::readTexture(const json& node, uint32_t external) { readOptional(ktxFile, node, keys::ktxFile); Element ktxTexelFormat, ktxMipFormat; if (!ktxFile.empty()) { + // If we get a texture that starts with ":" we need to re-route it to the resources directory + if (ktxFile.at(0) == ':') { + QString frameReaderPath = __FILE__; + frameReaderPath.replace("\\", "/"); + frameReaderPath.replace("libraries/gpu/src/gpu/framereader.cpp", "interface/resources", Qt::CaseInsensitive); + ktxFile.replace(0, 1, frameReaderPath.toStdString()); + } if (QFileInfo(ktxFile.c_str()).isRelative()) { ktxFile = basedir + ktxFile; } diff --git a/libraries/image/src/image/TextureProcessing.h b/libraries/image/src/image/TextureProcessing.h index b4036ddd9f..c1817a08a6 100644 --- a/libraries/image/src/image/TextureProcessing.h +++ b/libraries/image/src/image/TextureProcessing.h @@ -57,6 +57,7 @@ namespace TextureUsage { * @typedef {number} TextureCache.TextureType */ enum Type { + // NOTE: add new texture types at the bottom here DEFAULT_TEXTURE, STRICT_TEXTURE, ALBEDO_TEXTURE, diff --git a/libraries/material-networking/src/material-networking/TextureCache.cpp b/libraries/material-networking/src/material-networking/TextureCache.cpp index b15632c6be..8ffcad0c69 100644 --- a/libraries/material-networking/src/material-networking/TextureCache.cpp +++ b/libraries/material-networking/src/material-networking/TextureCache.cpp @@ -1065,21 +1065,6 @@ void NetworkTexture::loadMetaContent(const QByteArray& content) { return; } - // Version 0 ktx skyboxes and ambient maps don't work on AMD anymore, so we fallback to the original texture - if (meta.version == 0 && _type == image::TextureUsage::Type::SKY_TEXTURE || - _type == image::TextureUsage::Type::AMBIENT_TEXTURE && !meta.original.isEmpty()) { - _currentlyLoadingResourceType = ResourceType::ORIGINAL; - _activeUrl = _activeUrl.resolved(meta.original); - - auto textureCache = DependencyManager::get(); - auto self = _self.lock(); - if (!self) { - return; - } - QMetaObject::invokeMethod(this, "attemptRequest", Qt::QueuedConnection); - return; - } - auto& backend = DependencyManager::get()->getGPUContext()->getBackend(); for (auto pair : meta.availableTextureTypes) { gpu::Element elFormat;