#include "main/mfeatures.h"
#include "main/mtypes.h"
#include "main/shaderobj.h"
+#include "main/uniforms.h"
#include "program/program.h"
#include "program/prog_parameter.h"
-#include "program/prog_uniform.h"
+#include "program/hash_table.h"
#include "ralloc.h"
/**********************************************************************/
{
prog->Type = GL_SHADER_PROGRAM_MESA;
prog->RefCount = 1;
- prog->Attributes = _mesa_new_parameter_list();
+
+ prog->AttributeBindings = string_to_uint_map_ctor();
+ prog->FragDataBindings = string_to_uint_map_ctor();
+ prog->FragDataIndexBindings = string_to_uint_map_ctor();
+
#if FEATURE_ARB_geometry_shader4
prog->Geom.VerticesOut = 0;
prog->Geom.InputType = GL_TRIANGLES;
prog->Geom.OutputType = GL_TRIANGLE_STRIP;
#endif
+
+ prog->InfoLog = ralloc_strdup(prog, "");
}
/**
_mesa_clear_shader_program_data(struct gl_context *ctx,
struct gl_shader_program *shProg)
{
- _mesa_reference_vertprog(ctx, &shProg->VertexProgram, NULL);
- _mesa_reference_fragprog(ctx, &shProg->FragmentProgram, NULL);
- _mesa_reference_geomprog(ctx, &shProg->GeometryProgram, NULL);
-
- if (shProg->Uniforms) {
- _mesa_free_uniform_list(shProg->Uniforms);
- shProg->Uniforms = NULL;
+ if (shProg->UniformStorage) {
+ unsigned i;
+ for (i = 0; i < shProg->NumUserUniformStorage; ++i)
+ _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
+ ralloc_free(shProg->UniformStorage);
+ shProg->NumUserUniformStorage = 0;
+ shProg->UniformStorage = NULL;
}
- if (shProg->Varying) {
- _mesa_free_parameter_list(shProg->Varying);
- shProg->Varying = NULL;
+ if (shProg->UniformHash) {
+ string_to_uint_map_dtor(shProg->UniformHash);
+ shProg->UniformHash = NULL;
}
+
+ assert(shProg->InfoLog != NULL);
+ ralloc_free(shProg->InfoLog);
+ shProg->InfoLog = ralloc_strdup(shProg, "");
}
_mesa_clear_shader_program_data(ctx, shProg);
- if (shProg->Attributes) {
- _mesa_free_parameter_list(shProg->Attributes);
- shProg->Attributes = NULL;
+ if (shProg->AttributeBindings) {
+ string_to_uint_map_dtor(shProg->AttributeBindings);
+ shProg->AttributeBindings = NULL;
+ }
+
+ if (shProg->FragDataBindings) {
+ string_to_uint_map_dtor(shProg->FragDataBindings);
+ shProg->FragDataBindings = NULL;
+ }
+
+ if (shProg->FragDataIndexBindings) {
+ string_to_uint_map_dtor(shProg->FragDataIndexBindings);
+ shProg->FragDataIndexBindings = NULL;
}
/* detach shaders */
shProg->Shaders = NULL;
}
- if (shProg->InfoLog) {
- ralloc_free(shProg->InfoLog);
- shProg->InfoLog = NULL;
- }
-
/* Transform feedback varying vars */
for (i = 0; i < shProg->TransformFeedback.NumVarying; i++) {
free(shProg->TransformFeedback.VaryingNames[i]);