Changeset 2922


Ignore:
Timestamp:
Sep 14, 2013, 7:42:46 PM (6 years ago)
Author:
benlitz
Message:

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

Location:
trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/demos/tutorial/01_triangle.cpp

    r2816 r2922  
    3939        {
    4040            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(01_triangle));
    41             m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
     41            m_coord = m_shader->GetAttribLocation(VertexUsage::Position, 0);
    4242
    4343            m_vdecl = new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));
  • trunk/demos/tutorial/02_cube.cpp

    r2816 r2922  
    7676
    7777            m_mvp = m_shader->GetUniformLocation("in_Matrix");
    78             m_coord = m_shader->GetAttribLocation("in_Vertex",
    79                                                   VertexUsage::Position, 0);
    80             m_color = m_shader->GetAttribLocation("in_Color",
    81                                                   VertexUsage::Color, 0);
     78            m_coord = m_shader->GetAttribLocation(VertexUsage::Position, 0);
     79            m_color = m_shader->GetAttribLocation(VertexUsage::Color, 0);
    8280
    8381            m_vdecl =
  • trunk/demos/tutorial/02_cube.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Color;
    77uniform mat4 in_Matrix;
     
    1010void main(void)
    1111{
    12     gl_Position = in_Matrix * vec4(in_Vertex, 1.0);
     12    gl_Position = in_Matrix * vec4(in_Position, 1.0);
    1313    pass_Color = in_Color;
    1414}
  • trunk/demos/tutorial/07_input.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Color;
    77uniform mat4 in_Matrix;
     
    1010void main(void)
    1111{
    12     gl_Position = in_Matrix * vec4(in_Vertex, 1.0);
     12    gl_Position = in_Matrix * vec4(in_Position, 1.0);
    1313    pass_Color = in_Color;
    1414}
  • trunk/demos/tutorial/08_fbo.cpp

    r2816 r2922  
    5959        {
    6060            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(08_fbo));
    61             m_coord = m_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
     61            m_coord = m_shader->GetAttribLocation(VertexUsage::Position, 0);
    6262            m_uni_flag = m_shader->GetUniformLocation("in_Flag");
    6363            m_uni_point = m_shader->GetUniformLocation("in_Point");
  • trunk/demos/tutorial/11_fractal.cpp

    r2816 r2922  
    464464            m_shader = Shader::Create(LOLFX_RESOURCE_NAME(11_fractal));
    465465
    466             m_vertexattrib = m_shader->GetAttribLocation("a_Vertex", VertexUsage::Position, 0);
    467             m_texattrib = m_shader->GetAttribLocation("a_TexCoord", VertexUsage::TexCoord, 0);
     466            m_vertexattrib = m_shader->GetAttribLocation(VertexUsage::Position, 0);
     467            m_texattrib = m_shader->GetAttribLocation(VertexUsage::TexCoord, 0);
    468468            m_texeluni = m_shader->GetUniformLocation("u_TexelSize");
    469469            m_screenuni = m_shader->GetUniformLocation("u_ScreenSize");
  • trunk/demos/tutorial/11_fractal.lolfx

    r2816 r2922  
    77uniform vec4 u_ScreenSize;
    88
    9 attribute vec2 a_TexCoord;
    10 attribute vec2 a_Vertex;
     9attribute vec2 in_TexCoord;
     10attribute vec2 in_Position;
    1111
    1212varying vec4 v_CenterX, v_CenterY, v_IndexX, v_IndexY;
     
    1414void main(void)
    1515{
    16     gl_Position = vec4(a_Vertex, 0.0, 1.0);
     16    gl_Position = vec4(in_Position, 0.0, 1.0);
    1717    /* Center point in [-.5,.5], apply zoom and translation
    1818     * transformation, and go back to texture coordinates
     
    3434                       u_ZoomSettings[2][1],
    3535                       u_ZoomSettings[3][1]);
    36     v_CenterX = zoomscale * a_TexCoord.x + zoomtx
     36    v_CenterX = zoomscale * in_TexCoord.x + zoomtx
    3737              + offsets.xyxy * u_TexelSize.x;
    38     v_CenterY = zoomscale * a_TexCoord.y - zoomty
     38    v_CenterY = zoomscale * in_TexCoord.y - zoomty
    3939              + offsets.xyyx * u_TexelSize.y;
    4040    /* Precompute the multiple of one texel where our ideal
  • trunk/demos/tutorial/12_texture_to_screen.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec2 in_position;
     5attribute vec2 in_Position;
    66
    77varying vec2 pass_position;
     
    99void main()
    1010{
    11     pass_position = in_position;
    12     gl_Position = vec4(in_position, 0.0, 1.0);
     11    pass_position = in_Position;
     12    gl_Position = vec4(in_Position, 0.0, 1.0);
    1313}
    1414
  • trunk/demos/tutorial/12_voronoi.lolfx

    r2816 r2922  
    66#version 120
    77
    8 attribute vec2 in_position;
     8attribute vec2 in_Position;
    99
    1010uniform vec2 in_screen_res;
     
    1717{
    1818    //JFA ALGO
    19     pass_pos = ((vec2(1.0) + in_position) * 0.5);
     19    pass_pos = ((vec2(1.0) + in_Position) * 0.5);
    2020
    2121    float k = in_step;
     
    3131    pass_p[7] = p2 + vec2( k,  k);
    3232
    33     gl_Position = vec4(in_position, 0.0, 1.0);
     33    gl_Position = vec4(in_Position, 0.0, 1.0);
    3434}
    3535
  • trunk/demos/tutorial/12_voronoi_setup.lolfx

    r2816 r2922  
    66#version 120
    77
    8 attribute vec2 in_position;
     8attribute vec2 in_Position;
    99
    1010uniform vec2 in_screen_res;
     
    1414void main()
    1515{
    16     pass_position = ((vec2(1.0) + in_position) * 0.5 * in_screen_res);
    17     gl_Position = vec4(in_position, 0.0, 1.0);
     16    pass_position = ((vec2(1.0) + in_Position) * 0.5 * in_screen_res);
     17    gl_Position = vec4(in_Position, 0.0, 1.0);
    1818}
    1919
  • trunk/src/easymesh/easymesh.cpp

    r2879 r2922  
    6262
    6363//-----------------------------------------------------------------------------
    64 void GpuShaderData::AddAttribute(const lol::String &new_attribute, VertexUsage usage, int index)
    65 {
    66     m_shader_attrib.Push(new_attribute, m_shader->GetAttribLocation(new_attribute.C(), usage, index));
     64void GpuShaderData::AddAttribute(VertexUsage usage, int index)
     65{
     66    m_shader_attrib.Push(m_shader->GetAttribLocation(usage, index));
    6767}
    6868
     
    7777
    7878//-----------------------------------------------------------------------------
    79 ShaderAttrib const *GpuShaderData::GetAttribute(const lol::String &attribute)
     79ShaderAttrib const *GpuShaderData::GetAttribute(VertexUsage usage, int index)
    8080{
    8181    for (int i = 0; i < m_shader_attrib.Count(); ++i)
    82         if (m_shader_attrib[i].m1 == attribute)
    83             return &m_shader_attrib[i].m2;
     82        if (m_shader_attrib[i].GetUsage() == usage && m_shader_attrib[i].GetIndex() == index)
     83            return &m_shader_attrib[i];
    8484    return nullptr;
    8585}
     
    199199           VertexUsage::GetNameList(vflags).C());
    200200
    201     if (has_position)   gpudata->AddAttribute(gpudata->GetInVertexName(),   VertexUsage::Position, 0);
    202     if (has_normal)     gpudata->AddAttribute(gpudata->GetInNormalName(),   VertexUsage::Normal, 0);
    203     if (has_color)      gpudata->AddAttribute(gpudata->GetInColorName(),    VertexUsage::Color, 0);
    204     if (has_texcoord)   gpudata->AddAttribute(gpudata->GetInTexCoordName(), VertexUsage::TexCoord, 0);
     201    if (has_position)   gpudata->AddAttribute(VertexUsage::Position, 0);
     202    if (has_normal)     gpudata->AddAttribute(VertexUsage::Normal, 0);
     203    if (has_color)      gpudata->AddAttribute(VertexUsage::Color, 0);
     204    if (has_texcoord)   gpudata->AddAttribute(VertexUsage::TexCoord, 0);
    205205
    206206    SetupVertexData(gpudata->m_vert_decl_flags, src_mesh);
     
    409409    ShaderAttrib Attribs[4] = { lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib(), lol::ShaderAttrib() };
    410410
    411     if (has_position)   Attribs[idx++] = *gpu_sd.GetAttribute(gpu_sd.GetInVertexName());
    412     if (has_normal)     Attribs[idx++] = *gpu_sd.GetAttribute(gpu_sd.GetInNormalName());
    413     if (has_color)      Attribs[idx++] = *gpu_sd.GetAttribute(gpu_sd.GetInColorName());
    414     if (has_texcoord)   Attribs[idx++] = *gpu_sd.GetAttribute(gpu_sd.GetInTexCoordName());
     411    if (has_position)   Attribs[idx++] = *gpu_sd.GetAttribute(VertexUsage::Position, 0);
     412    if (has_normal)     Attribs[idx++] = *gpu_sd.GetAttribute(VertexUsage::Normal, 0);
     413    if (has_color)      Attribs[idx++] = *gpu_sd.GetAttribute(VertexUsage::Color, 0);
     414    if (has_texcoord)   Attribs[idx++] = *gpu_sd.GetAttribute(VertexUsage::TexCoord, 0);
    415415
    416416    vdecl->SetStream(vbo, Attribs[0], Attribs[1], Attribs[2], Attribs[3]);
  • trunk/src/easymesh/easymesh.h

    r2816 r2922  
    7878    //--
    7979    void AddUniform(const lol::String &new_uniform);
    80     void AddAttribute(const lol::String &new_attribute, VertexUsage usage, int index);
     80    void AddAttribute(VertexUsage usage, int index);
    8181    ShaderUniform const *GetUniform(const lol::String &uniform);
    82     ShaderAttrib const *GetAttribute(const lol::String &attribute);
     82    ShaderAttrib const *GetAttribute(VertexUsage usage, int index);
    8383    //--
    8484    virtual void SetupShaderDatas(mat4 const &model) { UNUSED(model); }
    8585    //--
    86     virtual lol::String GetInVertexName()   { return lol::String("in_Vertex");   }
    87     virtual lol::String GetInNormalName()   { return lol::String("in_Normal");   }
    88     virtual lol::String GetInColorName()    { return lol::String("in_Color");    }
    89     virtual lol::String GetInTexCoordName() { return lol::String("in_TexCoord"); }
    9086
    9187protected:
     
    9490    DebugRenderMode                     m_render_mode;
    9591    Array<lol::String, ShaderUniform>   m_shader_uniform;
    96     Array<lol::String, ShaderAttrib>    m_shader_attrib;
     92    Array<ShaderAttrib>                 m_shader_attrib;
    9793};
    9894
  • trunk/src/easymesh/shiny.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    1818void main(void)
    1919{
    20     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     20    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2121    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2222
  • trunk/src/easymesh/shiny_SK.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    2222void main(void)
    2323{
    24     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     24    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2525    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2626
  • trunk/src/easymesh/shinydebugUV.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    2020void main(void)
    2121{
    22     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     22    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2323    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2424
  • trunk/src/easymesh/shinydebuglighting.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    1818void main(void)
    1919{
    20     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     20    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2121    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2222
  • trunk/src/easymesh/shinydebugnormal.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    1818void main(void)
    1919{
    20     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     20    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2121    vec3 tnorm = normalize(in_Normal);
    2222
  • trunk/src/easymesh/shinydebugwireframe.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    1818void main(void)
    1919{
    20     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     20    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2121    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2222
  • trunk/src/gpu/shader.cpp

    r2827 r2922  
    4040{
    4141
     42static const char* attribute_names[] = {
     43    "in_Position",
     44    "in_BlendWeight",
     45    "in_BlendIndices",
     46    "in_Normal",
     47    "in_PointSize",
     48    "in_TexCoord",
     49    "in_TexCoordExt",
     50    "in_Tangent",
     51    "in_Binormal",
     52    "in_TessFactor",
     53    "in_PositionT",
     54    "in_Color",
     55    "in_Fog",
     56    "in_Depth",
     57    "in_Sample"
     58};
     59
    4260/*
    4361 * Shader implementation class
     
    6280    GLuint prog_id, vert_id, frag_id;
    6381    // Benlitz: using a simple array could be faster since there is never more than a few attribute locations to store
    64     Map<String, GLint> attrib_locations;
     82    Map<uint64_t, GLint> attrib_locations;
    6583#else
    6684    CGprogram vert_id, frag_id;
     
    323341        Log::Debug("link log for program: %s", errbuf);
    324342    }
     343
     344    GLint validated;
    325345    glValidateProgram(data->prog_id);
    326 #endif
    327 }
    328 
    329 ShaderAttrib Shader::GetAttribLocation(char const *attr,
    330                                        VertexUsage usage, int index) const
     346    glGetProgramiv(data->prog_id, GL_VALIDATE_STATUS, &validated);
     347    if (validated != GL_TRUE)
     348    {
     349        Log::Error("failed to validate program");
     350    }
     351
     352    GLint num_attribs;
     353    glGetProgramiv(data->prog_id, GL_ACTIVE_ATTRIBUTES, &num_attribs);
     354
     355    GLint max_len;
     356    glGetProgramiv(data->prog_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_len);
     357
     358    char* name_buffer = new char[max_len];
     359    for (int i = 0; i < num_attribs; ++i)
     360    {
     361        int attrib_len;
     362        int attrib_size;
     363        int attrib_type;
     364        glGetActiveAttrib(data->prog_id, i, max_len, &attrib_len, (GLint*)&attrib_size, (GLenum*)&attrib_type, name_buffer);
     365
     366        String name(name_buffer);
     367        int index = 0;
     368        VertexUsage usage = VertexUsage::Max;
     369        for (int j = 0; j < VertexUsage::Max; ++j)
     370        {
     371            if (name.StartsWith(attribute_names[j]))
     372            {
     373                usage = VertexUsage(j);
     374                char* idx_ptr = name.C() + strlen(attribute_names[j]);
     375                index = strtol(idx_ptr, nullptr, 10);
     376                break;
     377            }
     378        }
     379
     380        if (usage == VertexUsage::Max || index == LONG_MIN || index == LONG_MAX)
     381        {
     382            Log::Error("unable to parse attribute sementic from name: %s", name_buffer);
     383        }
     384        else
     385        {
     386            GLint location = glGetAttribLocation(data->prog_id, name_buffer);
     387            uint64_t flags = (uint64_t)(uint16_t)usage << 16;
     388            flags |= (uint64_t)(uint16_t)index;
     389            // TODO: this is here just in case. Remove this once everything has been correctly tested
     390#ifdef _DEBUG
     391            if (data->attrib_locations.HasKey(flags))
     392            {
     393                Log::Error("an error occured while parsing attribute sementics");
     394            }
     395#endif
     396            data->attrib_locations[flags] = location;
     397        }
     398    }
     399
     400    delete[] name_buffer;
     401#endif
     402}
     403
     404ShaderAttrib Shader::GetAttribLocation(VertexUsage usage, int index) const
    331405{
    332406    ShaderAttrib ret;
     
    337411    GLint l;
    338412
    339     if (!data->attrib_locations.TryGetValue(attr, l))
    340     {
    341         l = glGetAttribLocation(data->prog_id, attr);
    342         if (l < 0)
    343         {
    344             Log::Warn("tried to query invalid attribute: %s\n", attr);
    345         }
    346         else
    347         {
    348             data->attrib_locations[String(attr)] = l;
    349         }
     413    if (!data->attrib_locations.TryGetValue(ret.m_flags, l))
     414    {
     415        Log::Error("queried attribute is unavailable for this shader");
    350416    }
    351417    ret.m_flags |= (uint64_t)(uint32_t)l << 32;
  • trunk/src/gpu/testmaterial.lolfx

    r2816 r2922  
    7171
    7272/* Valid with my GLSL compiler */
    73 //#pragma lolfx semantic(in_Vertex, POSITION)
     73//#pragma lolfx semantic(in_Position, POSITION)
    7474//#pragma lolfx semantic(in_Normal, NORMAL)
    7575//#pragma lolfx semantic(in_Color, COLOR)
    76 attribute vec3 in_Vertex;
     76attribute vec3 in_Position;
    7777attribute vec3 in_Normal;
    7878attribute vec4 in_Color;
  • trunk/src/gradient.cpp

    r2816 r2922  
    8989    ShaderUniform uni_mat;
    9090    ShaderAttrib attr_pos, attr_col;
    91     attr_pos = data->shader->GetAttribLocation("in_Vertex", VertexUsage::Position, 0);
    92     attr_col = data->shader->GetAttribLocation("in_Color", VertexUsage::Color, 0);
     91    attr_pos = data->shader->GetAttribLocation(VertexUsage::Position, 0);
     92    attr_col = data->shader->GetAttribLocation(VertexUsage::Color, 0);
    9393
    9494    data->shader->Bind();
  • trunk/src/gradient.lolfx

    r2816 r2922  
    33#version 130
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec4 in_Color;
    77varying vec4 pass_Color;
     
    1414{
    1515    gl_Position = proj_matrix * view_matrix * model_matrix
    16                 * vec4(in_Vertex, 1.0);
     16                * vec4(in_Position, 1.0);
    1717    pass_Color = in_Color;
    1818}
  • trunk/src/lol/gpu/shader.h

    r2921 r2922  
    158158    static void Destroy(Shader *shader);
    159159
    160     ShaderAttrib GetAttribLocation(char const *attr, struct VertexUsage usage,
    161                                    int index) const;
     160    ShaderAttrib GetAttribLocation(struct VertexUsage usage, int index) const;
    162161
    163162    ShaderUniform GetUniformLocation(char const *uni) const;
  • trunk/src/scene.cpp

    r2898 r2922  
    203203    ShaderUniform uni_mat, uni_tex, uni_texsize;
    204204    ShaderAttrib attr_pos, attr_tex;
    205     attr_pos = data->m_tile_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    206     attr_tex = data->m_tile_shader->GetAttribLocation("in_TexCoord", VertexUsage::TexCoord, 0);
     205    attr_pos = data->m_tile_shader->GetAttribLocation(VertexUsage::Position, 0);
     206    attr_tex = data->m_tile_shader->GetAttribLocation(VertexUsage::TexCoord, 0);
    207207
    208208    data->m_tile_shader->Bind();
     
    308308    ShaderUniform uni_mat, uni_tex;
    309309    ShaderAttrib attr_pos, attr_col;
    310     attr_pos = data->m_line_shader->GetAttribLocation("in_Position", VertexUsage::Position, 0);
    311     attr_col = data->m_line_shader->GetAttribLocation("in_Color", VertexUsage::Color, 0);
     310    attr_pos = data->m_line_shader->GetAttribLocation(VertexUsage::Position, 0);
     311    attr_col = data->m_line_shader->GetAttribLocation(VertexUsage::Color, 0);
    312312
    313313    data->m_line_shader->Bind();
  • trunk/test/front_camera_sprite.lolfx

    r2894 r2922  
    33#version 120
    44
    5 attribute vec3 in_vertex;
    6 attribute vec4 in_color;
    7 attribute vec4 in_texcoord;
     5attribute vec3 in_Position;
     6attribute vec4 in_Color;
     7attribute vec4 in_TexCoord;
    88
    99uniform mat4  in_model_view;
     
    1717void main(void)
    1818{
    19     vec4 vertex = in_model_view * vec4(in_vertex - vec3(0.0,0.5,0.0), 1.0);
     19    vec4 vertex = in_model_view * vec4(in_Position - vec3(0.0,0.5,0.0), 1.0);
    2020
    21     vec3 v_offset = vec3(1.0 * in_texcoord.z, -1.0 * in_texcoord.w, 0.0);
     21    vec3 v_offset = vec3(1.0 * in_TexCoord.z, -1.0 * in_TexCoord.w, 0.0);
    2222
    2323    float sinX = sin(in_sprite_orientation);
     
    3232
    3333    //pass datas
    34     pass_texcoord = in_texcoord;
    35     pass_color = in_color;
     34    pass_texcoord = in_TexCoord;
     35    pass_color = in_Color;
    3636
    3737    gl_Position = in_proj * vertex;
  • trunk/test/shinyfur.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    1919void main(void)
    2020{
    21     vec4 vertex = vec4(in_Vertex + (in_Normal * in_Damage), 1.0);
     21    vec4 vertex = vec4(in_Position + (in_Normal * in_Damage), 1.0);
    2222    float dam_perc = in_Damage / (0.1 * 40);
    2323    vec3 vGravity = vec3(0.0, -0.981, 0.0) * 2.0;
  • trunk/test/shinymvtexture.lolfx

    r2816 r2922  
    33#version 120
    44
    5 attribute vec3 in_Vertex;
     5attribute vec3 in_Position;
    66attribute vec3 in_Normal;
    77attribute vec4 in_Color;
     
    2020void main(void)
    2121{
    22     vec4 vertex = in_ModelView * vec4(in_Vertex, 1.0);
     22    vec4 vertex = in_ModelView * vec4(in_Position, 1.0);
    2323    vec3 tnorm = normalize(in_NormalMat * in_Normal);
    2424
  • trunk/tools/neercs/video/text-render.cpp

    r2816 r2922  
    4848
    4949    m_shader = Shader::Create(LOLFX_RESOURCE_NAME(text));
    50     m_color = m_shader->GetAttribLocation("in_Attr",
    51                                           VertexUsage::Color, 0);
    52     m_char = m_shader->GetAttribLocation("in_Char",
    53                                          VertexUsage::Color, 1);
     50    m_color = m_shader->GetAttribLocation(VertexUsage::Color, 0);
     51    m_char = m_shader->GetAttribLocation(VertexUsage::Color, 1);
    5452#if !HAVE_SHADER_4
    5553    m_vertexid = m_shader->GetAttribLocation("in_VertexID",
  • trunk/tools/neercs/video/text.lolfx

    r2816 r2922  
    66
    77#if HAVE_SHADER_4
    8 in uint in_Char, in_Attr;
     8in uint in_Color0, in_Color1;
    99#else
    10 attribute vec4 in_Char, in_Attr;
    11 attribute float in_VertexID;
     10attribute vec4 in_Color0, in_Color1;
     11attribute float in_Position;
    1212#   define out varying
    1313#endif
     
    2222void main()
    2323{
     24#if HAVE_SHADER_4
     25        uint in_Attr = in_Color0;
     26    uint in_Char = in_Color1;
     27#else
     28        vec4 in_Attr = in_Color0;
     29    vec4 in_Char = in_Color1;
     30    float in_VertexID = in_Position;
     31#endif
     32
    2433#if HAVE_SHADER_4
    2534    float u = float(in_Char & 0xfu) / 32.0 + 0.0;
Note: See TracChangeset for help on using the changeset viewer.