Use the x11 driver as a test harness for the softpipe/state_tracker code.
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 24 May 2007 09:44:53 +0000 (10:44 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 24 May 2007 09:44:53 +0000 (10:44 +0100)
This has some limitations as we currently require a mapped framebuffer,
so it only really works with double-buffered ximage rgba8888 windows.

src/mesa/drivers/x11/Makefile [new file with mode: 0644]
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/x11/xm_dd.c
src/mesa/drivers/x11/xm_span.c
src/mesa/drivers/x11/xm_tri.c
src/mesa/drivers/x11/xmesaP.h
src/mesa/main/mtypes.h
src/mesa/sources

diff --git a/src/mesa/drivers/x11/Makefile b/src/mesa/drivers/x11/Makefile
new file mode 100644 (file)
index 0000000..0ab1dc6
--- /dev/null
@@ -0,0 +1,2 @@
+default:
+       cd ../.. ; make
\ No newline at end of file
index a07d0a90cf326a389384882f29f5040a0bc422f7..af1a169a766975c31df61d8c69e417c69685c0f0 100644 (file)
@@ -80,6 +80,9 @@
 #include "tnl/t_pipeline.h"
 #include "drivers/common/driverfuncs.h"
 
+#include "softpipe/state_tracker/st_public.h"
+#include "softpipe/generic/g_context.h"
+
 /**
  * Global X driver lock
  */
@@ -1556,6 +1559,10 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
    xmesa_register_swrast_functions( mesaCtx );
    _swsetup_Wakeup(mesaCtx);
 
+
+   st_create_context( mesaCtx,
+                     generic_create() );
+   
    return c;
 }
 
@@ -1758,6 +1765,8 @@ PUBLIC
 GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
                              XMesaBuffer readBuffer )
 {
+   _mesa_printf("%s %p %p %p\n", __FUNCTION__, drawBuffer, readBuffer );
+   
    if (c) {
       if (!drawBuffer || !readBuffer)
          return GL_FALSE;  /* must specify buffers! */
index c8546236fbf3644b222a96e16149e7ddab152265..63e7115e8093121f91c5db552a41f668c20d212a 100644 (file)
@@ -53,6 +53,8 @@
 #include "tnl/tnl.h"
 #include "tnl/t_context.h"
 
+#include "softpipe/generic/g_context.h"
+#include "softpipe/state_tracker/st_public.h"
 
 
 /*
@@ -828,6 +830,9 @@ xmesa_update_state( GLcontext *ctx, GLbitfield new_state )
    _vbo_InvalidateState( ctx, new_state );
    _swsetup_InvalidateState( ctx, new_state );
 
+   st_invalidate_state( ctx, new_state );
+
+
    if (ctx->DrawBuffer->Name != 0)
       return;
 
index a24966b3aeb41ec5f4d645f349855b2ccfaad751..3776891e2eca5c7d44ac50d80c18f1e1fffd0280 100644 (file)
@@ -1303,6 +1303,17 @@ static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS )
 }
 
 
+
+static void *get_pointer_4_ximage( GLcontext *ctx, 
+                                  struct gl_renderbuffer *rb, 
+                                  GLint x, GLint y )
+{
+   GET_XRB(xrb);
+   return PIXEL_ADDR4(xrb, x, y);
+}
+
+
+
 /*
  * Write a span of PF_8A8B8G8R-format pixels to an ximage.
  */
@@ -4593,6 +4604,7 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
          xrb->Base.PutMonoRow    = put_mono_row_8A8B8G8R_ximage;
          xrb->Base.PutValues     = put_values_8A8B8G8R_ximage;
          xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage;
+        xrb->Base.GetPointer    = get_pointer_4_ximage;
       }
       break;
    case PF_8A8R8G8B:
@@ -4609,6 +4621,7 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
          xrb->Base.PutMonoRow    = put_mono_row_8A8R8G8B_ximage;
          xrb->Base.PutValues     = put_values_8A8R8G8B_ximage;
          xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage;
+        xrb->Base.GetPointer    = get_pointer_4_ximage;
       }
       break;
    case PF_8R8G8B:
index 95c6d7c1d20a80faa234d4d2f64485c953771001..6158ef30f9199158c37992dc868ba83ec9754b2d 100644 (file)
@@ -1443,6 +1443,46 @@ do {                                   \
 #endif
 
 
+
+GLboolean xmesa_get_cbuf_details( GLcontext *ctx,
+                                 void **ptr,
+                                 GLuint *cpp,
+                                 GLint *stride,
+                                 GLuint *format )
+{
+   XMesaContext xmesa = XMESA_CONTEXT(ctx);
+   struct gl_framebuffer *fb = ctx->DrawBuffer;
+   struct gl_renderbuffer *crb = fb->_ColorDrawBuffers[0][0];
+   struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(crb->Wrapped);
+
+   *ptr = crb->GetPointer(ctx, crb, 0, 0);
+   *stride = ((GLubyte *)crb->GetPointer(ctx, crb, 0, 1) - 
+             (GLubyte *)crb->GetPointer(ctx, crb, 0, 0));
+
+   if (!ptr) 
+      goto bad;
+
+   switch (xmesa->pixelformat) {
+   case PF_8A8B8G8R:
+   case PF_8A8R8G8B:
+      *format = 1;             /* whatever */
+      *cpp = 4;
+      break;
+   default:
+      goto bad;
+   }
+
+   return GL_TRUE;
+
+ bad:
+   *ptr = NULL;
+   *stride = 0;
+   *format = 0;
+   return GL_FALSE;   
+}
+
+
+
 /**
  * Return pointer to line drawing function, or NULL if we should use a
  * swrast fallback.
index 01988867476a2f97d87e15a3e89c1e3f9621dc30..8f0bd34f47442ad95b62a4d4e1fe81da812c5f6a 100644 (file)
@@ -578,4 +578,11 @@ extern void xmesa_register_swrast_functions( GLcontext *ctx );
 #define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */
 #endif
 
+
+GLboolean xmesa_get_cbuf_details( GLcontext *ctx,
+                                 void **ptr,
+                                 GLuint *cpp,
+                                 GLint *stride,
+                                 GLuint *format );
+
 #endif
index 71215d5470937458579aed8594198f1b7f84150c..2a8556388cecb334a0897f5005773efd7d49aafd 100644 (file)
@@ -126,6 +126,7 @@ struct gl_pixelstore_attrib;
 struct gl_texture_format;
 struct gl_texture_image;
 struct gl_texture_object;
+struct st_context;
 typedef struct __GLcontextRec GLcontext;
 typedef struct __GLcontextModesRec GLvisual;
 typedef struct gl_framebuffer GLframebuffer;
@@ -3069,7 +3070,7 @@ struct __GLcontextRec
    void *swsetup_context;
    void *swtnl_context;
    void *swtnl_im;
-   void *acache_context;
+   struct st_context *st;
    void *aelt_context;
    /*@}*/
 };
index dbfc01d0edfb2270ee27b4e930a2ad2d2b4ef90c..8138fb627dc813093fd7e6db67366813ee9becb6 100644 (file)
@@ -149,6 +149,40 @@ VBO_SOURCES = \
        vbo/vbo_save_draw.c \
        vbo/vbo_save_loopback.c 
 
+VF_SOURCES = \
+       vf/vf.c \
+       vf/vf_generic.c \
+       vf/vf_sse.c
+
+SOFTPIPE_SOURCES = \
+       softpipe/generic/g_context.c \
+       softpipe/generic/g_draw.c \
+       softpipe/generic/g_prim_clip.c \
+       softpipe/generic/g_prim_cull.c \
+       softpipe/generic/g_prim_flatshade.c \
+       softpipe/generic/g_prim_offset.c \
+       softpipe/generic/g_prim_setup.c \
+       softpipe/generic/g_prim_twoside.c \
+       softpipe/generic/g_prim_unfilled.c \
+       softpipe/generic/g_state_clip.c \
+       softpipe/generic/g_state_derived.c \
+       softpipe/generic/g_state_fs.c \
+       softpipe/generic/g_state_setup.c \
+       softpipe/generic/g_state_surface.c \
+       softpipe/generic/g_surface.c \
+       softpipe/generic/g_tile_fs.c \
+       softpipe/generic/g_tile_output.c \
+       softpipe/state_tracker/st_atom.c \
+       softpipe/state_tracker/st_atom_clip.c \
+       softpipe/state_tracker/st_atom_fs.c \
+       softpipe/state_tracker/st_atom_setup.c \
+       softpipe/state_tracker/st_atom_cbuf.c \
+       softpipe/state_tracker/st_atom_viewport.c \
+       softpipe/state_tracker/st_cb_program.c \
+       softpipe/state_tracker/st_draw.c \
+       softpipe/state_tracker/st_context.c 
+
+
 
 SHADER_SOURCES = \
        shader/arbprogparse.c \
@@ -294,6 +328,8 @@ SOLO_SOURCES = \
        $(MAIN_SOURCES)         \
        $(MATH_SOURCES)         \
        $(VBO_SOURCES)          \
+       $(VF_SOURCES)           \
+       $(SOFTPIPE_SOURCES)             \
        $(TNL_SOURCES)          \
        $(SHADER_SOURCES)       \
        $(SWRAST_SOURCES)       \