X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Ffinalize.cpp;h=27c352098e0c0b0206616336f431e2c84de1942d;hb=241cf36a6d7735706804bb3c517529bbe078f1ee;hp=eee8a5198efa8b2037848bcc7a34bd8cd0d333ff;hpb=e9a898f315b5d1396f196d785913a283c30940f2;p=libs%2Fgl.git diff --git a/source/glsl/finalize.cpp b/source/glsl/finalize.cpp index eee8a519..27c35209 100644 --- a/source/glsl/finalize.cpp +++ b/source/glsl/finalize.cpp @@ -12,10 +12,6 @@ namespace Msp { namespace GL { namespace SL { -StructOrganizer::StructOrganizer(): - offset(-1) -{ } - void StructOrganizer::visit(StructDeclaration &strct) { SetForScope set_offset(offset, 0); @@ -238,10 +234,6 @@ void LocationAllocator::visit(InterfaceBlock &iface) } -PrecisionConverter::PrecisionConverter(): - stage(0) -{ } - void PrecisionConverter::apply(Stage &s) { stage = &s; @@ -261,7 +253,7 @@ void PrecisionConverter::visit(Block &block) void PrecisionConverter::visit(Precision &prec) { - if(stage->required_features.gl_api==OPENGL_ES2) + if(stage->required_features.target_api==OPENGL_ES) have_default.insert(prec.type); else nodes_to_remove.insert(&prec); @@ -269,7 +261,7 @@ void PrecisionConverter::visit(Precision &prec) void PrecisionConverter::visit(VariableDeclaration &var) { - if(stage->required_features.gl_api!=OPENGL_ES2) + if(stage->required_features.target_api!=OPENGL_ES) { var.precision.clear(); return; @@ -308,10 +300,6 @@ void PrecisionConverter::visit(VariableDeclaration &var) } -LegacyConverter::LegacyConverter(): - frag_out(0) -{ } - void LegacyConverter::apply(Stage &s, const Features &feat) { stage = &s; @@ -322,7 +310,7 @@ void LegacyConverter::apply(Stage &s, const Features &feat) NodeRemover().apply(s, nodes_to_remove); if(!stage->required_features.glsl_version) - stage->required_features.glsl_version = Version(1, (stage->required_features.gl_api==OPENGL_ES2 ? 0 : 10)); + stage->required_features.glsl_version = Version(1, (stage->required_features.target_api==OPENGL_ES ? 0 : 10)); } else unsupported(format("Stage %s is not supported", Stage::get_stage_name(s.type))); @@ -372,7 +360,7 @@ bool LegacyConverter::supports_stage(Stage::Type st) const { if(st==Stage::GEOMETRY) { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else return check_version(Version(1, 50)); @@ -383,7 +371,7 @@ bool LegacyConverter::supports_stage(Stage::Type st) const bool LegacyConverter::supports_unified_interface_syntax() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else return check_version(Version(1, 30)); @@ -407,7 +395,7 @@ void LegacyConverter::visit(Assignment &assign) bool LegacyConverter::supports_unified_sampling_functions() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else return check_version(Version(1, 30)); @@ -452,7 +440,7 @@ void LegacyConverter::visit(FunctionCall &call) bool LegacyConverter::supports_interface_layouts() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else if(check_version(Version(3, 30))) return true; @@ -464,7 +452,7 @@ bool LegacyConverter::supports_interface_layouts() const bool LegacyConverter::supports_stage_interface_layouts() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else if(check_version(Version(4, 10))) return true; @@ -474,7 +462,7 @@ bool LegacyConverter::supports_stage_interface_layouts() const bool LegacyConverter::supports_centroid_sampling() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 0)); else if(check_version(Version(1, 20))) return true; @@ -484,7 +472,7 @@ bool LegacyConverter::supports_centroid_sampling() const bool LegacyConverter::supports_sample_sampling() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else if(check_version(Version(4, 0))) return true; @@ -494,7 +482,7 @@ bool LegacyConverter::supports_sample_sampling() const bool LegacyConverter::supports_uniform_location() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else if(check_version(Version(4, 30))) return true; @@ -504,7 +492,7 @@ bool LegacyConverter::supports_uniform_location() const bool LegacyConverter::supports_binding() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 10)); else return check_version(Version(4, 20)); @@ -586,12 +574,16 @@ void LegacyConverter::visit(VariableDeclaration &var) } } + if(var.name=="gl_ClipDistance") + if(const Literal *literal_size = dynamic_cast(var.array_size.get())) + stage->n_clip_distances = literal_size->value.value(); + TraversingVisitor::visit(var); } bool LegacyConverter::supports_interface_blocks(const string &iface) const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) { if(iface=="uniform") return check_version(Version(3, 0)); @@ -608,7 +600,7 @@ bool LegacyConverter::supports_interface_blocks(const string &iface) const bool LegacyConverter::supports_interface_block_location() const { - if(features.gl_api==OPENGL_ES2) + if(features.target_api==OPENGL_ES) return check_version(Version(3, 20)); else if(check_version(Version(4, 40))) return true;