From: Mikko Rasa Date: Sun, 21 Feb 2021 23:50:19 +0000 (+0200) Subject: Check that requested shader stages are supported X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b482f6d59aca2b4f1d9e2cbcc0f596d62c057509;hp=836eeb313874d4f0c406f154ecb0dff366f362c4;p=libs%2Fgl.git Check that requested shader stages are supported --- diff --git a/source/glsl/compatibility.cpp b/source/glsl/compatibility.cpp index 34073862..07698394 100644 --- a/source/glsl/compatibility.cpp +++ b/source/glsl/compatibility.cpp @@ -88,6 +88,8 @@ void LegacyConverter::apply(Stage &s, const Features &feat) { stage = &s; features = feat; + if(!supports_stage(s.type)) + throw unsupported_shader(format("Stage %s is not supported", Stage::get_stage_name(s.type))); visit(s.content); } @@ -121,6 +123,19 @@ bool LegacyConverter::check_extension(bool Features::*extension) const return true; } +bool LegacyConverter::supports_stage(Stage::Type st) const +{ + if(st==Stage::GEOMETRY) + { + if(features.gl_api==OPENGL_ES2) + return check_version(Version(3, 20)); + else + return check_version(Version(1, 50)); + } + else + return true; +} + bool LegacyConverter::supports_unified_interface_syntax() const { if(features.gl_api==OPENGL_ES2) diff --git a/source/glsl/compatibility.h b/source/glsl/compatibility.h index d3a3a74c..f91f1882 100644 --- a/source/glsl/compatibility.h +++ b/source/glsl/compatibility.h @@ -60,6 +60,7 @@ private: virtual void visit(Block &); bool check_version(const Version &) const; bool check_extension(bool Features::*) const; + bool supports_stage(Stage::Type) const; bool supports_unified_interface_syntax() const; virtual void visit(VariableReference &); virtual void visit(Assignment &);