mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 03:48:38 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into toulouse
This commit is contained in:
commit
9a1e1a001a
10 changed files with 100 additions and 97 deletions
|
@ -4418,8 +4418,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
} else if (isMeta) {
|
} else if (isMeta) {
|
||||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||||
dialogsManager->toggleAddressBar();
|
dialogsManager->toggleAddressBar();
|
||||||
} else if (isShifted) {
|
|
||||||
Menu::getInstance()->triggerOption(MenuOption::LodTools);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ using namespace gpu::gl;
|
||||||
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
|
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool GLTexelFormat::isCompressed() const {
|
bool GLTexelFormat::isCompressed(GLenum format) {
|
||||||
switch (internalFormat) {
|
switch (format) {
|
||||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_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 GLTexelFormat::evalGLTexelFormatInternal(const gpu::Element& dstFormat) {
|
||||||
GLenum result = GL_RGBA8;
|
GLenum result = GL_RGBA8;
|
||||||
switch (dstFormat.getDimension()) {
|
switch (dstFormat.getDimension()) {
|
||||||
|
|
|
@ -14,13 +14,15 @@ namespace gpu { namespace gl {
|
||||||
|
|
||||||
class GLTexelFormat {
|
class GLTexelFormat {
|
||||||
public:
|
public:
|
||||||
GLenum internalFormat;
|
GLenum internalFormat{ GL_RGBA8 };
|
||||||
GLenum format;
|
GLenum format{ GL_RGBA };
|
||||||
GLenum type;
|
GLenum type{ GL_UNSIGNED_BYTE };
|
||||||
|
|
||||||
GLTexelFormat(GLenum glinternalFormat, GLenum glformat, GLenum gltype) : internalFormat(glinternalFormat), format(glformat), type(gltype) {}
|
GLTexelFormat(GLenum glinternalFormat, GLenum glformat, GLenum gltype) : internalFormat(glinternalFormat), format(glformat), type(gltype) {}
|
||||||
GLTexelFormat(GLenum glinternalFormat) : internalFormat(glinternalFormat) {}
|
GLTexelFormat(GLenum glinternalFormat) : internalFormat(glinternalFormat) {}
|
||||||
|
|
||||||
|
static bool isCompressed(GLenum glinternalFormat);
|
||||||
|
|
||||||
bool isCompressed() const;
|
bool isCompressed() const;
|
||||||
|
|
||||||
static GLTexelFormat evalGLTexelFormat(const Element& dstFormat) {
|
static GLTexelFormat evalGLTexelFormat(const Element& dstFormat) {
|
||||||
|
|
|
@ -33,6 +33,7 @@ class GL45Backend : public GLBackend {
|
||||||
friend class Context;
|
friend class Context;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static const GLint RESOURCE_TRANSFER_TEX_UNIT { 32 };
|
||||||
static GLint MAX_COMBINED_SHADER_STORAGE_BLOCKS;
|
static GLint MAX_COMBINED_SHADER_STORAGE_BLOCKS;
|
||||||
static GLint MAX_UNIFORM_LOCATIONS;
|
static GLint MAX_UNIFORM_LOCATIONS;
|
||||||
#if GPU_BINDLESS_TEXTURES
|
#if GPU_BINDLESS_TEXTURES
|
||||||
|
|
|
@ -226,81 +226,31 @@ void GL45Texture::generateMips() const {
|
||||||
|
|
||||||
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 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;
|
Size amountCopied = sourceSize;
|
||||||
|
bool compressed = GLTexelFormat::isCompressed(internalFormat);
|
||||||
if (GL_TEXTURE_2D == _target) {
|
if (GL_TEXTURE_2D == _target) {
|
||||||
switch (internalFormat) {
|
if (compressed) {
|
||||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
glCompressedTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, internalFormat,
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
static_cast<GLsizei>(sourceSize), sourcePointer);
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
} else {
|
||||||
case GL_COMPRESSED_RED_RGTC1:
|
glTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer);
|
||||||
case GL_COMPRESSED_RG_RGTC2:
|
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
|
||||||
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
|
|
||||||
case GL_COMPRESSED_RGB8_ETC2:
|
|
||||||
case GL_COMPRESSED_SRGB8_ETC2:
|
|
||||||
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
||||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
||||||
case GL_COMPRESSED_RGBA8_ETC2_EAC:
|
|
||||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
|
||||||
case GL_COMPRESSED_R11_EAC:
|
|
||||||
case GL_COMPRESSED_SIGNED_R11_EAC:
|
|
||||||
case GL_COMPRESSED_RG11_EAC:
|
|
||||||
case GL_COMPRESSED_SIGNED_RG11_EAC:
|
|
||||||
glCompressedTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, internalFormat,
|
|
||||||
static_cast<GLsizei>(sourceSize), sourcePointer);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
glTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
} else if (GL_TEXTURE_CUBE_MAP == _target) {
|
} else if (GL_TEXTURE_CUBE_MAP == _target) {
|
||||||
switch (internalFormat) {
|
// DSA and cubemap functions are notoriously buggy. use the 4.1 compatible pathway
|
||||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
glActiveTexture(GL_TEXTURE0 + GL45Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
glBindTexture(_target, _texture);
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
auto target = GLTexture::CUBE_FACE_LAYOUT[face];
|
||||||
case GL_COMPRESSED_RED_RGTC1:
|
if (compressed) {
|
||||||
case GL_COMPRESSED_RG_RGTC2:
|
glCompressedTexSubImage2D(target, mip, 0, yOffset, size.x, size.y, internalFormat,
|
||||||
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
static_cast<GLsizei>(sourceSize), sourcePointer);
|
||||||
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
|
} else {
|
||||||
case GL_COMPRESSED_RGB8_ETC2:
|
glTexSubImage2D(target, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer);
|
||||||
case GL_COMPRESSED_SRGB8_ETC2:
|
|
||||||
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
||||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
|
||||||
case GL_COMPRESSED_RGBA8_ETC2_EAC:
|
|
||||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
|
||||||
case GL_COMPRESSED_R11_EAC:
|
|
||||||
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
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
glCompressedTextureSubImage3D(_id, mip, 0, yOffset, face, size.x, size.y, 1, internalFormat,
|
|
||||||
static_cast<GLsizei>(sourceSize), sourcePointer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
#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
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
glTextureSubImage3D(_id, mip, 0, yOffset, face, size.x, size.y, 1, format, type, sourcePointer);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
glBindTexture(_target, 0);
|
||||||
} else {
|
} else {
|
||||||
assert(false);
|
assert(false);
|
||||||
amountCopied = 0;
|
amountCopied = 0;
|
||||||
}
|
}
|
||||||
(void)CHECK_GL_ERROR();
|
(void)CHECK_GL_ERROR();
|
||||||
|
|
||||||
return amountCopied;
|
return amountCopied;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -218,12 +218,12 @@ void XMLHttpRequestClass::requestFinished() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setReadyState(DONE);
|
||||||
|
emit requestComplete();
|
||||||
|
|
||||||
disconnectFromReply(_reply);
|
disconnectFromReply(_reply);
|
||||||
_reply->deleteLater();
|
_reply->deleteLater();
|
||||||
_reply = nullptr;
|
_reply = nullptr;
|
||||||
|
|
||||||
setReadyState(DONE);
|
|
||||||
emit requestComplete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XMLHttpRequestClass::abortRequest() {
|
void XMLHttpRequestClass::abortRequest() {
|
||||||
|
|
|
@ -39,6 +39,10 @@ Q_LOGGING_CATEGORY(trace_baker, "trace.baker")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool tracingEnabled() {
|
static bool tracingEnabled() {
|
||||||
|
if (!DependencyManager::isSet<tracing::Tracer>()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Cheers, love! The cavalry's here!
|
// Cheers, love! The cavalry's here!
|
||||||
auto tracer = DependencyManager::get<tracing::Tracer>();
|
auto tracer = DependencyManager::get<tracing::Tracer>();
|
||||||
return (tracer && tracer->isEnabled());
|
return (tracer && tracer->isEnabled());
|
||||||
|
|
|
@ -24,12 +24,23 @@ static const QString CLI_OUTPUT_PARAMETER = "o";
|
||||||
static const QString CLI_TYPE_PARAMETER = "t";
|
static const QString CLI_TYPE_PARAMETER = "t";
|
||||||
static const QString CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER = "disable-texture-compression";
|
static const QString CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER = "disable-texture-compression";
|
||||||
|
|
||||||
|
QUrl OvenCLIApplication::_inputUrlParameter;
|
||||||
|
QUrl OvenCLIApplication::_outputUrlParameter;
|
||||||
|
QString OvenCLIApplication::_typeParameter;
|
||||||
|
|
||||||
OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
||||||
QCoreApplication(argc, argv)
|
QCoreApplication(argc, argv)
|
||||||
{
|
{
|
||||||
|
BakerCLI* cli = new BakerCLI(this);
|
||||||
|
QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, _inputUrlParameter),
|
||||||
|
Q_ARG(QString, _outputUrlParameter.toString()), Q_ARG(QString, _typeParameter));
|
||||||
|
}
|
||||||
|
|
||||||
|
void OvenCLIApplication::parseCommandLine(int argc, char* argv[]) {
|
||||||
// parse the command line parameters
|
// parse the command line parameters
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
|
|
||||||
|
parser.setApplicationDescription("High Fidelity Oven");
|
||||||
parser.addOptions({
|
parser.addOptions({
|
||||||
{ CLI_INPUT_PARAMETER, "Path to file that you would like to bake.", "input" },
|
{ CLI_INPUT_PARAMETER, "Path to file that you would like to bake.", "input" },
|
||||||
{ CLI_OUTPUT_PARAMETER, "Path to folder that will be used as output.", "output" },
|
{ CLI_OUTPUT_PARAMETER, "Path to folder that will be used as output.", "output" },
|
||||||
|
@ -37,25 +48,45 @@ OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
||||||
{ CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER, "Disable texture compression." }
|
{ CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER, "Disable texture compression." }
|
||||||
});
|
});
|
||||||
|
|
||||||
parser.addHelpOption();
|
auto versionOption = parser.addVersionOption();
|
||||||
parser.process(*this);
|
auto helpOption = parser.addHelpOption();
|
||||||
|
|
||||||
if (parser.isSet(CLI_INPUT_PARAMETER) && parser.isSet(CLI_OUTPUT_PARAMETER)) {
|
QStringList arguments;
|
||||||
BakerCLI* cli = new BakerCLI(this);
|
for (int i = 0; i < argc; ++i) {
|
||||||
QUrl inputUrl(QDir::fromNativeSeparators(parser.value(CLI_INPUT_PARAMETER)));
|
arguments << argv[i];
|
||||||
QUrl outputUrl(QDir::fromNativeSeparators(parser.value(CLI_OUTPUT_PARAMETER)));
|
|
||||||
QString type = parser.isSet(CLI_TYPE_PARAMETER) ? parser.value(CLI_TYPE_PARAMETER) : QString::null;
|
|
||||||
|
|
||||||
if (parser.isSet(CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER)) {
|
|
||||||
qDebug() << "Disabling texture compression";
|
|
||||||
TextureBaker::setCompressionEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
QMetaObject::invokeMethod(cli, "bakeFile", Qt::QueuedConnection, Q_ARG(QUrl, inputUrl),
|
|
||||||
Q_ARG(QString, outputUrl.toString()), Q_ARG(QString, type));
|
|
||||||
} else {
|
|
||||||
parser.showHelp();
|
|
||||||
QCoreApplication::quit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!parser.parse(arguments)) {
|
||||||
|
std::cout << parser.errorText().toStdString() << std::endl; // Avoid Qt log spam
|
||||||
|
QCoreApplication mockApp(argc, argv); // required for call to showHelp()
|
||||||
|
parser.showHelp();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(versionOption)) {
|
||||||
|
parser.showVersion();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
if (parser.isSet(helpOption)) {
|
||||||
|
QCoreApplication mockApp(argc, argv); // required for call to showHelp()
|
||||||
|
parser.showHelp();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!parser.isSet(CLI_INPUT_PARAMETER) || !parser.isSet(CLI_OUTPUT_PARAMETER)) {
|
||||||
|
std::cout << "Error: Input and Output not set" << std::endl; // Avoid Qt log spam
|
||||||
|
QCoreApplication mockApp(argc, argv); // required for call to showHelp()
|
||||||
|
parser.showHelp();
|
||||||
|
Q_UNREACHABLE();
|
||||||
|
}
|
||||||
|
|
||||||
|
_inputUrlParameter = QDir::fromNativeSeparators(parser.value(CLI_INPUT_PARAMETER));
|
||||||
|
_outputUrlParameter = QDir::fromNativeSeparators(parser.value(CLI_OUTPUT_PARAMETER));
|
||||||
|
|
||||||
|
_typeParameter = parser.isSet(CLI_TYPE_PARAMETER) ? parser.value(CLI_TYPE_PARAMETER) : QString::null;
|
||||||
|
|
||||||
|
if (parser.isSet(CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER)) {
|
||||||
|
qDebug() << "Disabling texture compression";
|
||||||
|
TextureBaker::setCompressionEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,14 @@ class OvenCLIApplication : public QCoreApplication, public Oven {
|
||||||
public:
|
public:
|
||||||
OvenCLIApplication(int argc, char* argv[]);
|
OvenCLIApplication(int argc, char* argv[]);
|
||||||
|
|
||||||
|
static void parseCommandLine(int argc, char* argv[]);
|
||||||
|
|
||||||
static OvenCLIApplication* instance() { return dynamic_cast<OvenCLIApplication*>(QCoreApplication::instance()); }
|
static OvenCLIApplication* instance() { return dynamic_cast<OvenCLIApplication*>(QCoreApplication::instance()); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
static QUrl _inputUrlParameter;
|
||||||
|
static QUrl _outputUrlParameter;
|
||||||
|
static QString _typeParameter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_OvenCLIApplication_h
|
#endif // hifi_OvenCLIApplication_h
|
||||||
|
|
|
@ -18,14 +18,19 @@
|
||||||
int main (int argc, char** argv) {
|
int main (int argc, char** argv) {
|
||||||
setupHifiApplication("Oven");
|
setupHifiApplication("Oven");
|
||||||
|
|
||||||
// init the settings interface so we can save and load settings
|
|
||||||
Setting::init();
|
|
||||||
|
|
||||||
// figure out if we're launching our GUI application or just the simple command line interface
|
// figure out if we're launching our GUI application or just the simple command line interface
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
OvenCLIApplication::parseCommandLine(argc, argv);
|
||||||
|
|
||||||
|
// init the settings interface so we can save and load settings
|
||||||
|
Setting::init();
|
||||||
|
|
||||||
OvenCLIApplication app { argc, argv };
|
OvenCLIApplication app { argc, argv };
|
||||||
return app.exec();
|
return app.exec();
|
||||||
} else {
|
} else {
|
||||||
|
// init the settings interface so we can save and load settings
|
||||||
|
Setting::init();
|
||||||
|
|
||||||
OvenGUIApplication app { argc, argv };
|
OvenGUIApplication app { argc, argv };
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue