From 1a5dafe20e47c764f2914c341fb7b8f1fba59fb8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 9 Apr 2022 14:41:04 +0300 Subject: [PATCH] Remove Vulkan checks from feature converters Since the GLSL version is now consistent, features can be checked against it. This also makes the GLSL output behave better if used on a shader compiled for Vulkan. --- source/glsl/finalize.cpp | 44 ++++++++++------------------------------ 1 file changed, 11 insertions(+), 33 deletions(-) diff --git a/source/glsl/finalize.cpp b/source/glsl/finalize.cpp index 87e18502..fcf48c61 100644 --- a/source/glsl/finalize.cpp +++ b/source/glsl/finalize.cpp @@ -435,9 +435,7 @@ bool StructuralFeatureConverter::supports_stage(Stage::Type st) const { if(st==Stage::GEOMETRY) { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else return check_version(Version(1, 50)); @@ -448,9 +446,7 @@ bool StructuralFeatureConverter::supports_stage(Stage::Type st) const bool StructuralFeatureConverter::supports_unified_interface_syntax() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else return check_version(Version(1, 30)); @@ -488,9 +484,7 @@ void StructuralFeatureConverter::visit(Assignment &assign) bool StructuralFeatureConverter::supports_unified_sampling_functions() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else return check_version(Version(1, 30)); @@ -535,9 +529,7 @@ void StructuralFeatureConverter::visit(FunctionCall &call) bool StructuralFeatureConverter::supports_interface_blocks(const string &iface) const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) { if(iface=="uniform") return check_version(Version(3, 0)); @@ -591,9 +583,7 @@ void QualifierConverter::apply() bool QualifierConverter::supports_interface_layouts() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else if(check_version(Version(3, 30))) return true; @@ -605,9 +595,7 @@ bool QualifierConverter::supports_interface_layouts() const bool QualifierConverter::supports_stage_interface_layouts() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else if(check_version(Version(4, 10))) return true; @@ -617,9 +605,7 @@ bool QualifierConverter::supports_stage_interface_layouts() const bool QualifierConverter::supports_centroid_sampling() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else if(check_version(Version(1, 20))) return true; @@ -629,9 +615,7 @@ bool QualifierConverter::supports_centroid_sampling() const bool QualifierConverter::supports_sample_sampling() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else if(check_version(Version(4, 0))) return true; @@ -641,9 +625,7 @@ bool QualifierConverter::supports_sample_sampling() const bool QualifierConverter::supports_uniform_location() const { - if(features.target_api==VULKAN) - return false; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else if(check_version(Version(4, 30))) return true; @@ -653,9 +635,7 @@ bool QualifierConverter::supports_uniform_location() const bool QualifierConverter::supports_binding() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else return check_version(Version(4, 20)); @@ -663,9 +643,7 @@ bool QualifierConverter::supports_binding() const bool QualifierConverter::supports_interface_block_location() const { - if(features.target_api==VULKAN) - return true; - else if(features.target_api==OPENGL_ES) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else if(check_version(Version(4, 40))) return true; -- 2.45.2