mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 03:13:09 +02:00
Fix ktx dependencies
This commit is contained in:
parent
b20fcbfcdb
commit
aca7ad27c6
8 changed files with 14 additions and 7 deletions
|
@ -171,6 +171,7 @@ void GL45ResourceTexture::populateTransferQueue() {
|
||||||
auto targetMip = sourceMip - _allocatedMip;
|
auto targetMip = sourceMip - _allocatedMip;
|
||||||
auto mipDimensions = _gpuObject.evalMipDimensions(sourceMip);
|
auto mipDimensions = _gpuObject.evalMipDimensions(sourceMip);
|
||||||
for (uint8_t face = 0; face < maxFace; ++face) {
|
for (uint8_t face = 0; face < maxFace; ++face) {
|
||||||
|
qDebug() << "populateTransferQueue " << QString::fromStdString(_gpuObject.source()) << sourceMip << " " << targetMip;
|
||||||
if (!_gpuObject.isStoredMipFaceAvailable(sourceMip, face)) {
|
if (!_gpuObject.isStoredMipFaceAvailable(sourceMip, face)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -321,6 +321,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string _filename;
|
std::string _filename;
|
||||||
|
//storage::FileStorage _cacheFile;
|
||||||
ktx::KTXDescriptorPointer _ktxDescriptor;
|
ktx::KTXDescriptorPointer _ktxDescriptor;
|
||||||
friend class Texture;
|
friend class Texture;
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,6 +60,7 @@ KtxStorage::KtxStorage(const std::string& filename) : _filename(filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const {
|
PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const {
|
||||||
|
qDebug() << "getMipFace: " << QString::fromStdString(_filename) << ": " << level << " " << face;
|
||||||
storage::StoragePointer result;
|
storage::StoragePointer result;
|
||||||
auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face);
|
auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face);
|
||||||
auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face);
|
auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face);
|
||||||
|
@ -75,11 +76,10 @@ Size KtxStorage::getMipFaceSize(uint16 level, uint8 face) const {
|
||||||
|
|
||||||
|
|
||||||
bool KtxStorage::isMipAvailable(uint16 level, uint8 face) const {
|
bool KtxStorage::isMipAvailable(uint16 level, uint8 face) const {
|
||||||
return true;
|
|
||||||
auto numLevels = _ktxDescriptor->header.numberOfMipmapLevels;
|
auto numLevels = _ktxDescriptor->header.numberOfMipmapLevels;
|
||||||
auto minLevel = 7 > numLevels ? 0 : numLevels - 10;
|
auto minLevel = 7 > numLevels ? 0 : numLevels - 10;
|
||||||
auto avail = level >= minLevel;
|
auto avail = level >= minLevel;
|
||||||
qDebug() << "isMipAvailable: " << level << " " << face << avail << minLevel << " " << _ktxDescriptor->header.numberOfMipmapLevels;
|
qDebug() << "isMipAvailable: " << QString::fromStdString(_filename) << ": " << level << " " << face << avail << minLevel << " " << _ktxDescriptor->header.numberOfMipmapLevels;
|
||||||
//return true;
|
//return true;
|
||||||
return level > _ktxDescriptor->header.numberOfMipmapLevels - 7;
|
return level > _ktxDescriptor->header.numberOfMipmapLevels - 7;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
#include <gpu/Batch.h>
|
#include <gpu/Batch.h>
|
||||||
|
|
||||||
#include <ktx/KTX.h>
|
|
||||||
|
|
||||||
#include <image/Image.h>
|
#include <image/Image.h>
|
||||||
|
|
||||||
|
@ -473,9 +472,11 @@ void NetworkTexture::maybeCreateKTX() {
|
||||||
_file = file;
|
_file = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ktxDescriptor.reset(new ktx::KTXDescriptor(memKtx->toDescriptor()));
|
||||||
|
|
||||||
//auto texture = gpu::Texture::serializeHeader("test.ktx", *header, keyValues);
|
//auto texture = gpu::Texture::serializeHeader("test.ktx", *header, keyValues);
|
||||||
gpu::TexturePointer texture;
|
gpu::TexturePointer texture;
|
||||||
texture.reset(gpu::Texture::unserialize(_file->getFilepath(), memKtx->toDescriptor()));
|
texture.reset(gpu::Texture::unserialize(_file->getFilepath(), *_ktxDescriptor));
|
||||||
texture->setKtxBacking(file->getFilepath());
|
texture->setKtxBacking(file->getFilepath());
|
||||||
|
|
||||||
// We replace the texture with the one stored in the cache. This deals with the possible race condition of two different
|
// We replace the texture with the one stored in the cache. This deals with the possible race condition of two different
|
||||||
|
@ -496,6 +497,7 @@ void NetworkTexture::downloadFinished(const QByteArray& data) {
|
||||||
|
|
||||||
void NetworkTexture::loadContent(const QByteArray& content) {
|
void NetworkTexture::loadContent(const QByteArray& content) {
|
||||||
if (_sourceIsKTX) {
|
if (_sourceIsKTX) {
|
||||||
|
assert(false);
|
||||||
if (_ktxLoadState == LOADING_HEADER) {
|
if (_ktxLoadState == LOADING_HEADER) {
|
||||||
// TODO Handle case where we already have the source hash texture on disk
|
// TODO Handle case where we already have the source hash texture on disk
|
||||||
// TODO Handle case where data isn't as large as the ktx header
|
// TODO Handle case where data isn't as large as the ktx header
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <ResourceCache.h>
|
#include <ResourceCache.h>
|
||||||
#include <model/TextureMap.h>
|
#include <model/TextureMap.h>
|
||||||
#include <image/Image.h>
|
#include <image/Image.h>
|
||||||
|
#include <ktx/KTX.h>
|
||||||
|
|
||||||
#include "KTXCache.h"
|
#include "KTXCache.h"
|
||||||
|
|
||||||
|
@ -102,6 +103,8 @@ private:
|
||||||
ResourceRequest* _ktxMipRequest { nullptr };
|
ResourceRequest* _ktxMipRequest { nullptr };
|
||||||
QByteArray _ktxHeaderData;
|
QByteArray _ktxHeaderData;
|
||||||
QByteArray _ktxHighMipData;
|
QByteArray _ktxHighMipData;
|
||||||
|
ktx::KTXDescriptorPointer _ktxDescriptor;
|
||||||
|
|
||||||
|
|
||||||
int _originalWidth { 0 };
|
int _originalWidth { 0 };
|
||||||
int _originalHeight { 0 };
|
int _originalHeight { 0 };
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
set(TARGET_NAME procedural)
|
set(TARGET_NAME procedural)
|
||||||
AUTOSCRIBE_SHADER_LIB(gpu model)
|
AUTOSCRIBE_SHADER_LIB(gpu model)
|
||||||
setup_hifi_library()
|
setup_hifi_library()
|
||||||
link_hifi_libraries(shared gpu gpu-gl networking model model-networking image)
|
link_hifi_libraries(shared gpu gpu-gl networking model model-networking ktx image)
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,6 @@ if (NOT ANDROID)
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
link_hifi_libraries(shared networking octree gpu ui procedural model model-networking recording avatars fbx entities controllers animation audio physics image)
|
link_hifi_libraries(shared networking octree gpu ui procedural model model-networking ktx recording avatars fbx entities controllers animation audio physics image)
|
||||||
# ui includes gl, but link_hifi_libraries does not use transitive includes, so gl must be explicit
|
# ui includes gl, but link_hifi_libraries does not use transitive includes, so gl must be explicit
|
||||||
include_hifi_library_headers(gl)
|
include_hifi_library_headers(gl)
|
||||||
|
|
|
@ -13,7 +13,7 @@ if (WIN32)
|
||||||
setup_hifi_plugin(OpenGL Script Qml Widgets)
|
setup_hifi_plugin(OpenGL Script Qml Widgets)
|
||||||
link_hifi_libraries(shared gl networking controllers ui
|
link_hifi_libraries(shared gl networking controllers ui
|
||||||
plugins display-plugins ui-plugins input-plugins script-engine
|
plugins display-plugins ui-plugins input-plugins script-engine
|
||||||
render-utils model gpu gpu-gl render model-networking fbx image)
|
render-utils model gpu gpu-gl render model-networking fbx ktx image)
|
||||||
|
|
||||||
include_hifi_library_headers(octree)
|
include_hifi_library_headers(octree)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue