Kaynağa Gözat

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

master
Benlitz Sam Hocevar <sam@hocevar.net> 11 yıl önce
ebeveyn
işleme
e1839e2c1d
2 değiştirilmiş dosya ile 14 ekleme ve 7 silme
  1. +2
    -4
      neercs/video/text-render.cpp
  2. +12
    -3
      neercs/video/text.lolfx

+ 2
- 4
neercs/video/text-render.cpp Dosyayı Görüntüle

@@ -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);


+ 12
- 3
neercs/video/text.lolfx Dosyayı Görüntüle

@@ -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;


Yükleniyor…
İptal
Kaydet