mesa: plug in new functions for GL_ARB_sampler_objects
authorBrian Paul <brianp@vmware.com>
Sun, 10 Apr 2011 18:48:28 +0000 (12:48 -0600)
committerBrian Paul <brianp@vmware.com>
Sun, 10 Apr 2011 19:12:49 +0000 (13:12 -0600)
Build the new sources, plug the new functions into the dispatch table,
implement display list support.  And enable extension in the gallium
state tracker.

src/mesa/SConscript
src/mesa/main/api_exec.c
src/mesa/main/dlist.c
src/mesa/main/mfeatures.h
src/mesa/sources.mak
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_extensions.c

index f98f7df7407f66c9477415bcf0154373effa992d..39388c8e493fcdb0cd991f7a74eaacdbe85a5b35 100644 (file)
@@ -100,6 +100,7 @@ main_sources = [
     'main/readpix.c',
     'main/remap.c',
     'main/renderbuffer.c',
+    'main/samplerobj.c',
     'main/scissor.c',
     'main/shaderapi.c',
     'main/shaderobj.c',
index 91cdea5bb98756c87eab01474efb890565597412..d0298df20cb2c10e77452972083dbd6e20441c04 100644 (file)
@@ -78,6 +78,9 @@
 #include "polygon.h"
 #include "queryobj.h"
 #include "readpix.h"
+#if FEATURE_ARB_sampler_objects
+#include "samplerobj.h"
+#endif
 #include "scissor.h"
 #include "stencil.h"
 #include "texenv.h"
@@ -729,6 +732,10 @@ _mesa_create_exec_table(void)
    /* GL_ARB_texture_buffer_object */
    SET_TexBufferARB(exec, _mesa_TexBuffer);
 
+#if FEATURE_ARB_sampler_objects
+   _mesa_init_sampler_object_dispatch(exec);
+#endif
+
    return exec;
 }
 
index 7e86f1d0ed0395993a25a656c20712680511831a..f66082e7fce65d9d28380dbada5ce9d472b87bc4 100644 (file)
@@ -49,6 +49,7 @@
 #include "eval.h"
 #include "framebuffer.h"
 #include "glapi/glapi.h"
+#include "glapidispatch.h"
 #include "hash.h"
 #include "image.h"
 #include "light.h"
@@ -437,6 +438,9 @@ typedef enum
    /* GL_NV_texture_barrier */
    OPCODE_TEXTURE_BARRIER_NV,
 
+   /* GL_ARB_sampler_object */
+   OPCODE_BIND_SAMPLER,
+
    /* The following three are meta instructions */
    OPCODE_ERROR,                /* raise compiled-in error */
    OPCODE_CONTINUE,
@@ -7066,6 +7070,24 @@ save_TextureBarrierNV(void)
 }
 
 
+/* GL_ARB_sampler_objects */
+static void
+save_BindSampler(GLuint unit, GLuint sampler)
+{
+   Node *n;
+   GET_CURRENT_CONTEXT(ctx);
+   ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+   n = alloc_instruction(ctx, OPCODE_BIND_SAMPLER, 2);
+   if (n) {
+      n[1].ui = unit;
+      n[2].ui = sampler;
+   }
+   if (ctx->ExecuteFlag) {
+      CALL_BindSampler(ctx->Exec, (unit, sampler));
+   }
+}
+
+
 /**
  * Save an error-generating command into display list.
  *
@@ -8249,6 +8271,10 @@ execute_list(struct gl_context *ctx, GLuint list)
             CALL_TextureBarrierNV(ctx->Exec, ());
             break;
 
+         case OPCODE_BIND_SAMPLER:
+            CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
+            break;
+
          case OPCODE_CONTINUE:
             n = (Node *) n[1].next;
             break;
@@ -9930,6 +9956,9 @@ _mesa_create_save_table(void)
    /* GL_NV_texture_barrier */
    SET_TextureBarrierNV(table, save_TextureBarrierNV);
 
+   /* GL_ARB_sampler_objects */
+   SET_BindSampler(table, save_BindSampler);
+
    /* GL_ARB_draw_buffer_blend */
    SET_BlendFunciARB(table, save_BlendFunci);
    SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei);
index 1b39f5fdd36475088e03868979ca1e6c904aaab4..33db5081419bbc8d7a0b2b2392d3408ae56978e6 100644 (file)
 #define FEATURE_ARB_framebuffer_object    (FEATURE_GL && FEATURE_EXT_framebuffer_object)
 #define FEATURE_ARB_map_buffer_range      FEATURE_GL
 #define FEATURE_ARB_pixel_buffer_object   (FEATURE_GL && FEATURE_EXT_pixel_buffer_object)
+#define FEATURE_ARB_sampler_objects       FEATURE_GL
 #define FEATURE_ARB_sync                  FEATURE_GL
 #define FEATURE_ARB_vertex_buffer_object  1
 
index fcf8ab2e7945462ceeb5c0c2d34a94f7c4fdc31b..9b2cb1a3c14ed0d0c76ed46cca289ae29b7938c7 100644 (file)
@@ -71,6 +71,7 @@ MAIN_SOURCES = \
        main/readpix.c \
        main/remap.c \
        main/renderbuffer.c \
+       main/samplerobj.c \
        main/scissor.c \
        main/shaderapi.c \
        main/shaderobj.c \
index a9461899ad5e47c172d5f6d8b337a68facf5d0da..ce78956e359fa8c95bb415d1520c6054be538e0f 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "main/imports.h"
 #include "main/context.h"
+#include "main/samplerobj.h"
 #include "main/shaderobj.h"
 #include "program/prog_cache.h"
 #include "vbo/vbo.h"
@@ -269,6 +270,7 @@ void st_destroy_context( struct st_context *st )
 void st_init_driver_functions(struct dd_function_table *functions)
 {
    _mesa_init_shader_object_functions(functions);
+   _mesa_init_sampler_object_functions(functions);
 
    st_init_accum_functions(functions);
    st_init_blit_functions(functions);
index e3277904417517c6b9c6a6f00c2d947d9293fb72..9bc9d7a10f565296c776b6609e91393f697640e0 100644 (file)
@@ -228,6 +228,7 @@ void st_init_extensions(struct st_context *st)
    ctx->Extensions.ARB_half_float_pixel = GL_TRUE;
    ctx->Extensions.ARB_map_buffer_range = GL_TRUE;
    ctx->Extensions.ARB_multisample = GL_TRUE;
+   ctx->Extensions.ARB_sampler_objects = GL_TRUE;
    ctx->Extensions.ARB_texture_border_clamp = GL_TRUE; /* XXX temp */
    ctx->Extensions.ARB_texture_compression = GL_TRUE;
    ctx->Extensions.ARB_texture_cube_map = GL_TRUE;