From f40dba4919ea7c6b72091120863c8aaf232aeed6 Mon Sep 17 00:00:00 2001 From: Yuwen Wu Date: Wed, 24 Aug 2022 11:07:12 +0800 Subject: [PATCH] GLSL: added an option to disable row-major-load workaround. --- spirv_glsl.cpp | 2 +- spirv_glsl.hpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index 1b679fc9..0a723708 100644 --- a/spirv_glsl.cpp +++ b/spirv_glsl.cpp @@ -649,7 +649,7 @@ string CompilerGLSL::compile() { // only NV_gpu_shader5 supports divergent indexing on OpenGL, and it does so without extra qualifiers backend.nonuniform_qualifier = ""; - backend.needs_row_major_load_workaround = !options.es; + backend.needs_row_major_load_workaround = options.enable_row_major_load_workaround; } backend.allow_precision_qualifiers = options.vulkan_semantics || options.es; backend.force_gl_in_out_block = true; diff --git a/spirv_glsl.hpp b/spirv_glsl.hpp index a798737c..d967b456 100644 --- a/spirv_glsl.hpp +++ b/spirv_glsl.hpp @@ -145,6 +145,12 @@ public: // compares. bool relax_nan_checks = false; + // Loading row-major matrices from UBOs on older AMD Windows OpenGL drivers is problematic. + // To load these types correctly, we must generate a wrapper. them in a dummy function which only purpose is to + // ensure row_major decoration is actually respected. + // This workaround may cause significant performance degeneration on some Android devices. + bool enable_row_major_load_workaround = true; + // If non-zero, controls layout(num_views = N) in; in GL_OVR_multiview2. uint32_t ovr_multiview_view_count = 0;