diff options
author | Hans-Kristian Arntzen <post@arntzen-software.no> | 2022-08-24 11:36:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-24 11:36:48 +0300 |
commit | c93ee9261ed38be0b37b7cc40e2c5c47eaf5615d (patch) | |
tree | bf82009112e0a6d03643eb0d23e49bb4bc1b2d7f | |
parent | 61c603f3baa5270e04bcfb6acf83c654e3c57679 (diff) | |
parent | f40dba4919ea7c6b72091120863c8aaf232aeed6 (diff) |
Merge pull request #2005 from atyuwen/master
Don't rename remapped variables like 'gl_LastFragDepthARM'
-rw-r--r-- | spirv_cross_parsed_ir.cpp | 4 | ||||
-rw-r--r-- | spirv_glsl.cpp | 2 | ||||
-rw-r--r-- | spirv_glsl.hpp | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/spirv_cross_parsed_ir.cpp b/spirv_cross_parsed_ir.cpp index d399d415..3b4d6e5c 100644 --- a/spirv_cross_parsed_ir.cpp +++ b/spirv_cross_parsed_ir.cpp @@ -330,6 +330,10 @@ void ParsedIR::fixup_reserved_names() { for (uint32_t id : meta_needing_name_fixup) { + // Don't rename remapped variables like 'gl_LastFragDepthARM'. + if (ids[id].get_type() == TypeVariable && get<SPIRVariable>(id).remapped_variable) + continue; + auto &m = meta[id]; sanitize_identifier(m.decoration.alias, false, false); for (auto &memb : m.members) diff --git a/spirv_glsl.cpp b/spirv_glsl.cpp index fb961c8f..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 = true; + 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; |