From: Mikko Rasa Date: Sun, 25 Sep 2022 14:49:15 +0000 (+0300) Subject: Add flat interpolation qualifier for integer inputs in fragment shader X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=46e04b29e95019e4f384d321d29adea1e5fa3ea9;p=libs%2Fgl.git Add flat interpolation qualifier for integer inputs in fragment shader --- diff --git a/source/glsl/generate.cpp b/source/glsl/generate.cpp index cc427d05..635d9f15 100644 --- a/source/glsl/generate.cpp +++ b/source/glsl/generate.cpp @@ -2,6 +2,7 @@ #include #include #include "generate.h" +#include "reflect.h" using namespace std; @@ -105,6 +106,11 @@ VariableDeclaration *InterfaceGenerator::generate_interface(VariableDeclaration VariableDeclaration* iface_var = new VariableDeclaration; iface_var->sampling = var.sampling; + if(stage->type==Stage::FRAGMENT && iface=="in") + if(BasicTypeDeclaration *basic = dynamic_cast(var.type_declaration)) + if(BasicTypeDeclaration *elem = get_element_type(*basic)) + if(elem->kind==BasicTypeDeclaration::INT) + iface_var->interpolation = "flat"; iface_var->interface = iface; iface_var->type = var.type; iface_var->name = name;