From e1839e2c1dfcec85fbb9ed3f1b5eda79825b767b Mon Sep 17 00:00:00 2001 From: Benlitz Date: Sat, 14 Sep 2013 17:42:46 +0000 Subject: [PATCH] gpu: removed attribute name, everything works using semantic only now. For glsl, semantic is determined from the attribute name which must follow this pattern: in_[Semantic][index], index being optional. Note: this may break most of the projects although I tried to updated every shader accordingly --- neercs/video/text-render.cpp | 6 ++---- neercs/video/text.lolfx | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/neercs/video/text-render.cpp b/neercs/video/text-render.cpp index 914ee2d..1a4ac90 100644 --- a/neercs/video/text-render.cpp +++ b/neercs/video/text-render.cpp @@ -47,10 +47,8 @@ void TextRender::Init() ivec2(256, 256), ivec2(1)); m_shader = Shader::Create(LOLFX_RESOURCE_NAME(text)); - m_color = m_shader->GetAttribLocation("in_Attr", - VertexUsage::Color, 0); - m_char = m_shader->GetAttribLocation("in_Char", - VertexUsage::Color, 1); + m_color = m_shader->GetAttribLocation(VertexUsage::Color, 0); + m_char = m_shader->GetAttribLocation(VertexUsage::Color, 1); #if !HAVE_SHADER_4 m_vertexid = m_shader->GetAttribLocation("in_VertexID", VertexUsage::Position, 0); diff --git a/neercs/video/text.lolfx b/neercs/video/text.lolfx index 56a16da..4bec7a7 100644 --- a/neercs/video/text.lolfx +++ b/neercs/video/text.lolfx @@ -5,10 +5,10 @@ #define HAVE_SHADER_4 1 #if HAVE_SHADER_4 -in uint in_Char, in_Attr; +in uint in_Color0, in_Color1; #else -attribute vec4 in_Char, in_Attr; -attribute float in_VertexID; +attribute vec4 in_Color0, in_Color1; +attribute float in_Position; # define out varying #endif @@ -21,6 +21,15 @@ uniform mat4 u_Transform; void main() { +#if HAVE_SHADER_4 + uint in_Attr = in_Color0; + uint in_Char = in_Color1; +#else + vec4 in_Attr = in_Color0; + vec4 in_Char = in_Color1; + float in_VertexID = in_Position; +#endif + #if HAVE_SHADER_4 float u = float(in_Char & 0xfu) / 32.0 + 0.0; float v = float((in_Char >> 4u) & 0xfu) / 32.0 + 0.5;