mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 10:42:35 +02:00
fix the actual problem
This commit is contained in:
parent
b92e26722c
commit
dc3b2d97e3
5 changed files with 21 additions and 21 deletions
|
@ -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<GLsizei>(sourceSize), sourcePointer);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
glCompressedTextureSubImage3D(_id, mip, 0, yOffset, face, size.x, size.y, 1, internalFormat,
|
||||
static_cast<GLsizei>(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;
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<TextureCache>();
|
||||
auto self = _self.lock();
|
||||
if (!self) {
|
||||
return;
|
||||
}
|
||||
QMetaObject::invokeMethod(this, "attemptRequest", Qt::QueuedConnection);
|
||||
return;
|
||||
}
|
||||
|
||||
auto& backend = DependencyManager::get<TextureCache>()->getGPUContext()->getBackend();
|
||||
for (auto pair : meta.availableTextureTypes) {
|
||||
gpu::Element elFormat;
|
||||
|
|
Loading…
Reference in a new issue