[Mesa-dev] [PATCH 15/65] glsl: call _mesa_reference_program rather than bumping ref manually
Timothy Arceri
timothy.arceri at collabora.com
Fri Apr 29 13:33:14 UTC 2016
---
src/compiler/glsl/shader_cache.cpp | 5 +++--
src/compiler/glsl/standalone_scaffolding.cpp | 8 ++++++++
src/compiler/glsl/standalone_scaffolding.h | 4 ++++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp
index 04199fc..98015c4 100644
--- a/src/compiler/glsl/shader_cache.cpp
+++ b/src/compiler/glsl/shader_cache.cpp
@@ -48,6 +48,7 @@
extern "C" {
#include "main/shaderobj.h"
#include "main/enums.h"
+#include "program/program.h"
}
static void
@@ -473,14 +474,14 @@ shader_cache_read_program_metadata(struct gl_context *ctx,
linked = ctx->Driver.NewShader(NULL, 0, GL_VERTEX_SHADER);
glprog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, prog->Name);
read_shader_metadata(&metadata, glprog, linked);
- glprog->RefCount++;
+ _mesa_reference_program(ctx, &linked->Program, glprog);
_mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_VERTEX],
linked);
linked = ctx->Driver.NewShader(NULL, 0, GL_FRAGMENT_SHADER);
glprog = ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, prog->Name);
read_shader_metadata(&metadata, glprog, linked);
- glprog->RefCount++;
+ _mesa_reference_program(ctx, &linked->Program, glprog);
_mesa_reference_shader(ctx, &prog->_LinkedShaders[MESA_SHADER_FRAGMENT],
linked);
diff --git a/src/compiler/glsl/standalone_scaffolding.cpp b/src/compiler/glsl/standalone_scaffolding.cpp
index ead77eb..fffe6cc 100644
--- a/src/compiler/glsl/standalone_scaffolding.cpp
+++ b/src/compiler/glsl/standalone_scaffolding.cpp
@@ -62,6 +62,14 @@ _mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
}
void
+_mesa_reference_program_(struct gl_context *ctx, struct gl_program **ptr,
+ struct gl_program *prog)
+{
+ (void) ctx;
+ *ptr = prog;
+}
+
+void
_mesa_shader_debug(struct gl_context *, GLenum, GLuint *,
const char *)
{
diff --git a/src/compiler/glsl/standalone_scaffolding.h b/src/compiler/glsl/standalone_scaffolding.h
index 31c69a3..38bd76a 100644
--- a/src/compiler/glsl/standalone_scaffolding.h
+++ b/src/compiler/glsl/standalone_scaffolding.h
@@ -42,6 +42,10 @@ extern "C" void
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
struct gl_shader *sh);
+extern "C" void
+_mesa_reference_program_(struct gl_context *ctx, struct gl_program **ptr,
+ struct gl_program *prog);
+
extern "C" struct gl_shader *
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
--
2.5.5
More information about the mesa-dev
mailing list