mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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) {
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
dialogsManager->toggleAddressBar();
|
||||
} else if (isShifted) {
|
||||
Menu::getInstance()->triggerOption(MenuOption::LodTools);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ using namespace gpu::gl;
|
|||
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
|
||||
#endif
|
||||
|
||||
bool GLTexelFormat::isCompressed() const {
|
||||
switch (internalFormat) {
|
||||
bool GLTexelFormat::isCompressed(GLenum format) {
|
||||
switch (format) {
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_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 result = GL_RGBA8;
|
||||
switch (dstFormat.getDimension()) {
|
||||
|
|
|
@ -14,13 +14,15 @@ namespace gpu { namespace gl {
|
|||
|
||||
class GLTexelFormat {
|
||||
public:
|
||||
GLenum internalFormat;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
GLenum internalFormat{ GL_RGBA8 };
|
||||
GLenum format{ GL_RGBA };
|
||||
GLenum type{ GL_UNSIGNED_BYTE };
|
||||
|
||||
GLTexelFormat(GLenum glinternalFormat, GLenum glformat, GLenum gltype) : internalFormat(glinternalFormat), format(glformat), type(gltype) {}
|
||||
GLTexelFormat(GLenum glinternalFormat) : internalFormat(glinternalFormat) {}
|
||||
|
||||
static bool isCompressed(GLenum glinternalFormat);
|
||||
|
||||
bool isCompressed() const;
|
||||
|
||||
static GLTexelFormat evalGLTexelFormat(const Element& dstFormat) {
|
||||
|
|
|
@ -33,6 +33,7 @@ class GL45Backend : public GLBackend {
|
|||
friend class Context;
|
||||
|
||||
public:
|
||||
static const GLint RESOURCE_TRANSFER_TEX_UNIT { 32 };
|
||||
static GLint MAX_COMBINED_SHADER_STORAGE_BLOCKS;
|
||||
static GLint MAX_UNIFORM_LOCATIONS;
|
||||
#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 amountCopied = sourceSize;
|
||||
bool compressed = GLTexelFormat::isCompressed(internalFormat);
|
||||
if (GL_TEXTURE_2D == _target) {
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_RED_RGTC1:
|
||||
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;
|
||||
if (compressed) {
|
||||
glCompressedTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, internalFormat,
|
||||
static_cast<GLsizei>(sourceSize), sourcePointer);
|
||||
} else {
|
||||
glTextureSubImage2D(_id, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer);
|
||||
}
|
||||
} else if (GL_TEXTURE_CUBE_MAP == _target) {
|
||||
switch (internalFormat) {
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_RED_RGTC1:
|
||||
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:
|
||||
#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;
|
||||
// DSA and cubemap functions are notoriously buggy. use the 4.1 compatible pathway
|
||||
glActiveTexture(GL_TEXTURE0 + GL45Backend::RESOURCE_TRANSFER_TEX_UNIT);
|
||||
glBindTexture(_target, _texture);
|
||||
auto target = GLTexture::CUBE_FACE_LAYOUT[face];
|
||||
if (compressed) {
|
||||
glCompressedTexSubImage2D(target, mip, 0, yOffset, size.x, size.y, internalFormat,
|
||||
static_cast<GLsizei>(sourceSize), sourcePointer);
|
||||
} else {
|
||||
glTexSubImage2D(target, mip, 0, yOffset, size.x, size.y, format, type, sourcePointer);
|
||||
}
|
||||
glBindTexture(_target, 0);
|
||||
} else {
|
||||
assert(false);
|
||||
amountCopied = 0;
|
||||
}
|
||||
(void)CHECK_GL_ERROR();
|
||||
|
||||
return amountCopied;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,12 +218,12 @@ void XMLHttpRequestClass::requestFinished() {
|
|||
}
|
||||
}
|
||||
|
||||
setReadyState(DONE);
|
||||
emit requestComplete();
|
||||
|
||||
disconnectFromReply(_reply);
|
||||
_reply->deleteLater();
|
||||
_reply = nullptr;
|
||||
|
||||
setReadyState(DONE);
|
||||
emit requestComplete();
|
||||
}
|
||||
|
||||
void XMLHttpRequestClass::abortRequest() {
|
||||
|
|
|
@ -39,6 +39,10 @@ Q_LOGGING_CATEGORY(trace_baker, "trace.baker")
|
|||
#endif
|
||||
|
||||
static bool tracingEnabled() {
|
||||
if (!DependencyManager::isSet<tracing::Tracer>()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cheers, love! The cavalry's here!
|
||||
auto tracer = DependencyManager::get<tracing::Tracer>();
|
||||
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_DISABLE_TEXTURE_COMPRESSION_PARAMETER = "disable-texture-compression";
|
||||
|
||||
QUrl OvenCLIApplication::_inputUrlParameter;
|
||||
QUrl OvenCLIApplication::_outputUrlParameter;
|
||||
QString OvenCLIApplication::_typeParameter;
|
||||
|
||||
OvenCLIApplication::OvenCLIApplication(int argc, char* 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
|
||||
QCommandLineParser parser;
|
||||
|
||||
parser.setApplicationDescription("High Fidelity Oven");
|
||||
parser.addOptions({
|
||||
{ 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" },
|
||||
|
@ -37,25 +48,45 @@ OvenCLIApplication::OvenCLIApplication(int argc, char* argv[]) :
|
|||
{ CLI_DISABLE_TEXTURE_COMPRESSION_PARAMETER, "Disable texture compression." }
|
||||
});
|
||||
|
||||
parser.addHelpOption();
|
||||
parser.process(*this);
|
||||
auto versionOption = parser.addVersionOption();
|
||||
auto helpOption = parser.addHelpOption();
|
||||
|
||||
if (parser.isSet(CLI_INPUT_PARAMETER) && parser.isSet(CLI_OUTPUT_PARAMETER)) {
|
||||
BakerCLI* cli = new BakerCLI(this);
|
||||
QUrl inputUrl(QDir::fromNativeSeparators(parser.value(CLI_INPUT_PARAMETER)));
|
||||
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();
|
||||
QStringList arguments;
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
arguments << argv[i];
|
||||
}
|
||||
|
||||
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:
|
||||
OvenCLIApplication(int argc, char* argv[]);
|
||||
|
||||
static void parseCommandLine(int argc, char* argv[]);
|
||||
|
||||
static OvenCLIApplication* instance() { return dynamic_cast<OvenCLIApplication*>(QCoreApplication::instance()); }
|
||||
|
||||
private:
|
||||
static QUrl _inputUrlParameter;
|
||||
static QUrl _outputUrlParameter;
|
||||
static QString _typeParameter;
|
||||
};
|
||||
|
||||
#endif // hifi_OvenCLIApplication_h
|
||||
|
|
|
@ -18,14 +18,19 @@
|
|||
int main (int argc, char** argv) {
|
||||
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
|
||||
if (argc > 1) {
|
||||
OvenCLIApplication::parseCommandLine(argc, argv);
|
||||
|
||||
// init the settings interface so we can save and load settings
|
||||
Setting::init();
|
||||
|
||||
OvenCLIApplication app { argc, argv };
|
||||
return app.exec();
|
||||
} else {
|
||||
// init the settings interface so we can save and load settings
|
||||
Setting::init();
|
||||
|
||||
OvenGUIApplication app { argc, argv };
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue