#include "xm_image.h"
#endif
#include "state_tracker/st_cb_fbo.h"
+#include "state_tracker/st_context.h"
+#include "state_tracker/st_public.h"
#include "pipe/softpipe/sp_context.h"
#include "pipe/softpipe/sp_surface.h"
struct xmesa_renderbuffer;
-/* Function pointer for clearing color buffers */
-typedef void (*ClearFunc)( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
- GLuint value );
-
-
-
/** Framebuffer pixel formats */
enum pixel_format {
PF_5R6G5B, /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */
PF_Dither, /**< Color-mapped RGB with dither */
PF_Lookup, /**< Color-mapped RGB without dither */
- PF_HPCR, /**< HP Color Recovery (ad@lms.be 30/08/95) */
PF_1Bit, /**< monochrome dithering of RGB */
PF_Grayscale, /**< Grayscale or StaticGray */
PF_Dither_5R6G5B /**< 16-bit dithered TrueColor: 5-R, 6-G, 5-B */
GLubyte PixelToG[256];
GLubyte PixelToB[256];
- /* For PF_HPCR */
- short hpcr_rgbTbl[3][256];
- GLboolean hpcr_clear_flag;
- GLubyte hpcr_clear_ximage_pattern[2][16];
- XMesaImage *hpcr_clear_ximage;
- XMesaPixmap hpcr_clear_pixmap;
-
/* For PF_1BIT */
int bitFlip;
};
/**
- * Context info, dDerived from GLcontext.
+ * Context info, derived from GLcontext.
* Basically corresponds to a GLXContext.
*/
struct xmesa_context {
- GLcontext mesa; /* the core library context (containment) */
+ struct st_context *st;
+
XMesaVisual xm_visual; /* Describes the buffers */
XMesaBuffer xm_buffer; /* current span/point/line/triangle buffer */
*/
struct xmesa_renderbuffer
{
-#if 0
- struct gl_renderbuffer Base; /* Base class */
-#else
- struct st_renderbuffer St; /**< Base class */
-#endif
+ struct st_renderbuffer St; /**< Base class (XXX temporary?) */
XMesaBuffer Parent; /**< The XMesaBuffer this renderbuffer belongs to */
XMesaDrawable drawable; /* Usually the X window ID */
GLint width4;
GLint bottom; /* used for FLIP macro, equals height - 1 */
-
- ClearFunc clearFunc;
-
- void *pSurface; /** pipe surface */
};
* Basically corresponds to a GLXDrawable.
*/
struct xmesa_buffer {
- GLframebuffer mesa_buffer; /* depth, stencil, accum, etc buffers */
- /* This MUST BE FIRST! */
+ struct st_framebuffer *stfb;
+
GLboolean wasCurrent; /* was ever the current buffer? */
XMesaVisual xm_visual; /* the X/Mesa visual */
_dither_lookup(DITH_B, (B)))]
-/**
- * If pixelformat==PF_HPCR:
- *
- * HP Color Recovery dithering (ad@lms.be 30/08/95)
- * HP has on it's 8-bit 700-series computers, a feature called
- * 'Color Recovery'. This allows near 24-bit output (so they say).
- * It is enabled by selecting the 8-bit TrueColor visual AND
- * corresponding colormap (see tkInitWindow) AND doing some special
- * dither.
- */
-extern const short xmesa_HPCR_DRGB[3][2][16];
-
-#define DITHER_HPCR( X, Y, R, G, B ) \
- ( ((xmesa->xm_visual->hpcr_rgbTbl[0][R] + xmesa_HPCR_DRGB[0][(Y)&1][(X)&15]) & 0xE0) \
- |(((xmesa->xm_visual->hpcr_rgbTbl[1][G] + xmesa_HPCR_DRGB[1][(Y)&1][(X)&15]) & 0xE0)>>3) \
- | ((xmesa->xm_visual->hpcr_rgbTbl[2][B] + xmesa_HPCR_DRGB[2][(Y)&1][(X)&15])>>6) \
- )
-
-
/**
* If pixelformat==PF_1BIT:
xmesa_find_buffer(XMesaDisplay *dpy, XMesaColormap cmap, XMesaBuffer notThis);
extern unsigned long
-xmesa_color_to_pixel( GLcontext *ctx,
+xmesa_color_to_pixel( XMesaContext xmesa,
GLubyte r, GLubyte g, GLubyte b, GLubyte a,
GLuint pixelFormat );
extern void
xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer);
-extern void
-xmesa_init_driver_functions( XMesaVisual xmvisual,
- struct dd_function_table *driver );
-
-extern void
-xmesa_update_state( GLcontext *ctx, GLbitfield new_state );
-
-extern void
-xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb,
- enum pixel_format pixelformat, GLint depth);
extern void
xmesa_destroy_buffers_on_display(XMesaDisplay *dpy);
static INLINE XMesaContext
XMESA_CONTEXT(GLcontext *ctx)
{
- return (XMesaContext) ctx;
+ return (XMesaContext) ctx->DriverCtx;
}
* XXX should use inlined function for better type safety.
*/
static INLINE XMesaBuffer
-XMESA_BUFFER(GLframebuffer *b)
+XMESA_BUFFER(GLframebuffer *fb)
{
- return (XMesaBuffer) b;
+ struct st_framebuffer *stfb = (struct st_framebuffer *) fb;
+ return (XMesaBuffer) st_framebuffer_private(stfb);
}
-#define ENABLE_EXT_texure_compression_s3tc 0 /* SW texture compression */
-
-#ifdef XFree86Server
-#define ENABLE_EXT_timer_query 0
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define ENABLE_EXT_timer_query 1 /* should have 64-bit GLuint64EXT */
-#else
-#define ENABLE_EXT_timer_query 0 /* may not have 64-bit GLuint64EXT */
-#endif
-
-
-struct pipe_surface;
struct pipe_context;
struct xmesa_surface
{
struct pipe_surface surface;
struct xmesa_renderbuffer *xrb;
+ XMesaDisplay *display;
+ BufferType type;
+ XMesaDrawable drawable;
+ XMesaImage *ximage;
+ XMesaGC gc;
};
-extern void
-xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, GLuint value);
+/** Cast wrapper */
+static INLINE struct xmesa_surface *
+xmesa_surface(struct pipe_surface *ps)
+{
+ return (struct xmesa_surface *) ps;
+}
+
extern void
-xmesa_clear_buffers(GLcontext *ctx, GLbitfield buffers, GLuint value);
+xmesa_clear(struct pipe_context *pipe, struct pipe_surface *ps, uint value);
extern struct pipe_context *
-xmesa_create_softpipe(XMesaContext xm);
+xmesa_create_context(XMesaContext xm);
extern struct pipe_surface *
xmesa_surface_alloc(struct pipe_context *pipe, GLuint format);
extern struct pipe_surface *
xmesa_new_color_surface(struct pipe_context *pipe, GLuint format);
-extern boolean
-xmesa_is_format_supported(struct pipe_context *pipe, uint format);
+
+extern void
+xmesa_get_tile(struct pipe_context *pipe, struct pipe_surface *ps,
+ uint x, uint y, uint w, uint h, void *p, int dst_stride);
+
+extern void
+xmesa_put_tile(struct pipe_context *pipe, struct pipe_surface *ps,
+ uint x, uint y, uint w, uint h, const void *p, int src_stride);
extern void
xmesa_get_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
xmesa_put_tile_rgba(struct pipe_context *pipe, struct pipe_surface *ps,
uint x, uint y, uint w, uint h, const float *p);
+
+extern struct pipe_surface *
+xmesa_create_front_surface(XMesaVisual vis, Window win);
+
+static INLINE GLuint
+xmesa_buffer_width(XMesaBuffer b)
+{
+ return b->stfb->Base.Width;
+}
+
+static INLINE GLuint
+xmesa_buffer_height(XMesaBuffer b)
+{
+ return b->stfb->Base.Height;
+}
+
+
#endif