瀏覽代碼

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

legacy
Sam Hocevar sam 12 年之前
父節點
當前提交
4fc8ce6470
共有 2 個文件被更改,包括 5 次插入12 次删除
  1. +5
    -11
      src/gpu/shader.cpp
  2. +0
    -1
      src/gpu/shader.h

+ 5
- 11
src/gpu/shader.cpp 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存