Browse Source

Fix a crash on exit caused by shader deletion.

legacy
Sam Hocevar 5 years ago
parent
commit
00d7d2a774
2 changed files with 1 additions and 6 deletions
  1. +1
    -1
      src/lol/gpu/shader.h
  2. +0
    -5
      src/mesh/mesh.cpp

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

@@ -314,7 +314,7 @@ private:
class ShaderData;

//Shader ----------------------------------------------------------------------
class Shader : public Entity
class Shader
{
public:
static std::shared_ptr<Shader> Create(std::string const &name, std::string const &code);


+ 0
- 5
src/mesh/mesh.cpp View File

@@ -61,13 +61,10 @@ SubMesh::SubMesh(std::shared_ptr<Shader> shader, std::shared_ptr<VertexDeclarati
m_shader(shader),
m_vdecl(vdecl)
{
Ticker::Ref(m_shader.get());
}

SubMesh::~SubMesh()
{
Ticker::Unref(m_shader.get());
// TODO: cleanup
}

void SubMesh::SetMeshPrimitive(MeshPrimitive mesh_primitive)
@@ -77,9 +74,7 @@ void SubMesh::SetMeshPrimitive(MeshPrimitive mesh_primitive)

void SubMesh::SetShader(std::shared_ptr<Shader> shader)
{
Ticker::Unref(m_shader.get());
m_shader = shader;
Ticker::Ref(m_shader.get());
}

std::shared_ptr<Shader> SubMesh::GetShader()


Loading…
Cancel
Save