glsl/mesa: add reference to gl_shader_program_data from gl_program
We also add the stubs for the standalone compiler in this change. By adding a reference here we can now refactor some code to use gl_program where we were previously awkwardly using gl_shader_program. Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
@@ -2208,6 +2208,8 @@ link_intrastage_shaders(void *mem_ctx,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_mesa_reference_shader_program_data(ctx, &gl_prog->sh.data, prog->data);
|
||||||
|
|
||||||
/* Don't use _mesa_reference_program() just take ownership */
|
/* Don't use _mesa_reference_program() just take ownership */
|
||||||
linked->Program = gl_prog;
|
linked->Program = gl_prog;
|
||||||
|
|
||||||
|
@@ -53,6 +53,15 @@ _mesa_warning(struct gl_context *ctx, const char *fmt, ...)
|
|||||||
va_end(vargs);
|
va_end(vargs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_mesa_reference_shader_program_data(struct gl_context *ctx,
|
||||||
|
struct gl_shader_program_data **ptr,
|
||||||
|
struct gl_shader_program_data *data)
|
||||||
|
{
|
||||||
|
(void) ctx;
|
||||||
|
*ptr = data;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
|
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
|
||||||
struct gl_shader *sh)
|
struct gl_shader *sh)
|
||||||
|
@@ -38,6 +38,11 @@
|
|||||||
extern "C" void
|
extern "C" void
|
||||||
_mesa_warning(struct gl_context *ctx, const char *fmtString, ... );
|
_mesa_warning(struct gl_context *ctx, const char *fmtString, ... );
|
||||||
|
|
||||||
|
extern "C" void
|
||||||
|
_mesa_reference_shader_program_data(struct gl_context *ctx,
|
||||||
|
struct gl_shader_program_data **ptr,
|
||||||
|
struct gl_shader_program_data *data);
|
||||||
|
|
||||||
extern "C" void
|
extern "C" void
|
||||||
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
|
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
|
||||||
struct gl_shader *sh);
|
struct gl_shader *sh);
|
||||||
|
@@ -1952,6 +1952,9 @@ struct gl_program
|
|||||||
struct {
|
struct {
|
||||||
/** Fields used by GLSL programs */
|
/** Fields used by GLSL programs */
|
||||||
struct {
|
struct {
|
||||||
|
/** Data shared by gl_program and gl_shader_program */
|
||||||
|
struct gl_shader_program_data *data;
|
||||||
|
|
||||||
struct gl_active_atomic_buffer **AtomicBuffers;
|
struct gl_active_atomic_buffer **AtomicBuffers;
|
||||||
|
|
||||||
/** Post-link transform feedback info. */
|
/** Post-link transform feedback info. */
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "main/framebuffer.h"
|
#include "main/framebuffer.h"
|
||||||
#include "main/hash.h"
|
#include "main/hash.h"
|
||||||
#include "main/macros.h"
|
#include "main/macros.h"
|
||||||
|
#include "main/shaderobj.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "prog_cache.h"
|
#include "prog_cache.h"
|
||||||
#include "prog_parameter.h"
|
#include "prog_parameter.h"
|
||||||
@@ -313,6 +314,7 @@ _mesa_reference_program_(struct gl_context *ctx,
|
|||||||
|
|
||||||
if (deleteFlag) {
|
if (deleteFlag) {
|
||||||
assert(ctx);
|
assert(ctx);
|
||||||
|
_mesa_reference_shader_program_data(ctx, &oldProg->sh.data, NULL);
|
||||||
ctx->Driver.DeleteProgram(ctx, oldProg);
|
ctx->Driver.DeleteProgram(ctx, oldProg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user