Browse Source

gpu: now shaders can only be created from a LolFx file.

legacy
Sam Hocevar sam 12 years ago
parent
commit
4fc8ce6470
2 changed files with 5 additions and 12 deletions
  1. +5
    -11
      src/gpu/shader.cpp
  2. +0
    -1
      src/gpu/shader.h

+ 5
- 11
src/gpu/shader.cpp View File

@@ -131,17 +131,6 @@ Shader *Shader::Create(char const *lolfx)
#endif
}

Shader *ret = NULL;
if (vert && frag)
ret = Create(vert, frag);

delete[] src;

return ret;
}

Shader *Shader::Create(char const *vert, char const *frag)
{
uint32_t new_vert_crc = Hash::Crc32(vert);
uint32_t new_frag_crc = Hash::Crc32(frag);

@@ -149,12 +138,17 @@ Shader *Shader::Create(char const *vert, char const *frag)
{
if (ShaderData::shaders[n]->data->vert_crc == new_vert_crc
&& ShaderData::shaders[n]->data->frag_crc == new_frag_crc)
{
delete[] src;
return ShaderData::shaders[n];
}
}

Shader *ret = new Shader(vert, frag);
ShaderData::shaders[ShaderData::nshaders] = ret;
ShaderData::nshaders++;

delete[] src;
return ret;
}



+ 0
- 1
src/gpu/shader.h View File

@@ -64,7 +64,6 @@ class Shader
{
public:
static Shader *Create(char const *lolfx);
static Shader *Create(char const *vert, char const *frag);
static void Destroy(Shader *shader);

ShaderAttrib GetAttribLocation(char const *attr, struct VertexUsage usage,


Loading…
Cancel
Save