mesa: reimplement IROUND(), add F_TO_I()
[mesa.git] / src / mesa / main / shaderobj.c
index 1eba75697f7070c1ad42d592a27a4c102b240044..7eb6f0bdab05a637fdf3677b44b40023334fb616 100644 (file)
@@ -35,9 +35,9 @@
 #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"
 
@@ -241,6 +241,8 @@ _mesa_init_shader_program(struct gl_context *ctx, struct gl_shader_program *prog
    prog->RefCount = 1;
 
    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;
@@ -275,18 +277,16 @@ void
 _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) {
+      _mesa_uniform_detach_all_driver_storage(shProg->UniformStorage);
+      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);
@@ -315,6 +315,16 @@ _mesa_free_shader_program_data(struct gl_context *ctx,
       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 */
    for (i = 0; i < shProg->NumShaders; i++) {
       _mesa_reference_shader(ctx, &shProg->Shaders[i], NULL);