#include "main/image.h"
#include "main/imports.h"
#include "main/mtypes.h"
+#include "main/pbo.h"
#include "main/state.h"
#include "main/texobj.h"
#include "main/teximage.h"
static void
-finish_or_flush( GLcontext *ctx )
+finish_or_flush( struct gl_context *ctx )
{
-#ifdef XFree86Server
- /* NOT_NEEDED */
-#else
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
if (xmesa) {
_glthread_LOCK_MUTEX(_xmesa_lock);
XSync( xmesa->display, False );
_glthread_UNLOCK_MUTEX(_xmesa_lock);
}
-#endif
}
static void
-clear_color( GLcontext *ctx, const GLfloat color[4] )
+clear_color( struct gl_context *ctx, const GLfloat color[4] )
{
if (ctx->DrawBuffer->Name == 0) {
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
/* Implements glColorMask() */
static void
-color_mask(GLcontext *ctx,
+color_mask(struct gl_context *ctx,
GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
XMesaBuffer xmbuf;
- const int xclass = xmesa->xm_visual->mesa_visual.visualType;
+ const int xclass = xmesa->xm_visual->visualType;
(void) amask;
if (ctx->DrawBuffer->Name != 0)
* Clear the front or back color buffer, if it's implemented with a pixmap.
*/
static void
-clear_pixmap(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_8bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_8bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_HPCR_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_HPCR_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_16bit_ximage( GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_16bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
/* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */
static void
-clear_24bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_24bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_32bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_32bit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_nbit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb,
+clear_nbit_ximage(struct gl_context *ctx, struct xmesa_renderbuffer *xrb,
GLint x, GLint y, GLint width, GLint height)
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_buffers(GLcontext *ctx, GLbitfield buffers)
+clear_buffers(struct gl_context *ctx, GLbitfield buffers)
{
if (ctx->DrawBuffer->Name == 0) {
/* this is a window system framebuffer */
}
-#ifndef XFree86Server
/* XXX these functions haven't been tested in the Xserver environment */
* Check if we can do an optimized glDrawPixels into an 8R8G8B visual.
*/
static GLboolean
-can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type)
+can_do_DrawPixels_8R8G8B(struct gl_context *ctx, GLenum format, GLenum type)
{
if (format == GL_BGRA &&
type == GL_UNSIGNED_BYTE &&
* The image format must be GL_BGRA to match the PF_8R8G8B pixel format.
*/
static void
-xmesa_DrawPixels_8R8G8B( GLcontext *ctx,
+xmesa_DrawPixels_8R8G8B( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
if (swrast->NewState)
_swrast_validate_derived( ctx );
- if (unpack->BufferObj->Name) {
+ if (_mesa_is_bufferobj(unpack->BufferObj)) {
/* unpack from PBO */
GLubyte *buf;
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
+ format, type, INT_MAX, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
XPutImage(dpy, xrb->pixmap, gc, &ximage, 0, 0, dstX, dstY, w, h);
}
- if (unpack->BufferObj->Name) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- unpack->BufferObj);
+ if (_mesa_is_bufferobj(unpack->BufferObj)) {
+ ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj);
}
}
else {
* Check if we can do an optimized glDrawPixels into an 5R6G5B visual.
*/
static GLboolean
-can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type)
+can_do_DrawPixels_5R6G5B(struct gl_context *ctx, GLenum format, GLenum type)
{
if (format == GL_RGB &&
type == GL_UNSIGNED_SHORT_5_6_5 &&
* match the PF_5R6G5B pixel format.
*/
static void
-xmesa_DrawPixels_5R6G5B( GLcontext *ctx,
+xmesa_DrawPixels_5R6G5B( struct gl_context *ctx,
GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type,
const struct gl_pixelstore_attrib *unpack,
if (swrast->NewState)
_swrast_validate_derived( ctx );
- if (unpack->BufferObj->Name) {
+ if (_mesa_is_bufferobj(unpack->BufferObj)) {
/* unpack from PBO */
GLubyte *buf;
if (!_mesa_validate_pbo_access(2, unpack, width, height, 1,
- format, type, pixels)) {
+ format, type, INT_MAX, pixels)) {
_mesa_error(ctx, GL_INVALID_OPERATION,
"glDrawPixels(invalid PBO access)");
return;
}
if (unpack->BufferObj->Name) {
- ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT,
- unpack->BufferObj);
+ ctx->Driver.UnmapBuffer(ctx, unpack->BufferObj);
}
}
else {
* Determine if we can do an optimized glCopyPixels.
*/
static GLboolean
-can_do_CopyPixels(GLcontext *ctx, GLenum type)
+can_do_CopyPixels(struct gl_context *ctx, GLenum type)
{
if (type == GL_COLOR &&
ctx->_ImageTransferState == 0 && /* no color tables, scale/bias, etc */
* We do support copying from one window to another, ala glXMakeCurrentRead.
*/
static void
-xmesa_CopyPixels( GLcontext *ctx,
+xmesa_CopyPixels( struct gl_context *ctx,
GLint srcx, GLint srcy, GLsizei width, GLsizei height,
GLint destx, GLint desty, GLenum type )
{
}
}
-#endif /* XFree86Server */
* return a meaningful GL_RENDERER string.
*/
static const GLubyte *
-get_string( GLcontext *ctx, GLenum name )
+get_string( struct gl_context *ctx, GLenum name )
{
(void) ctx;
switch (name) {
case GL_RENDERER:
-#ifdef XFree86Server
- return (const GLubyte *) "Mesa GLX Indirect";
-#else
return (const GLubyte *) "Mesa X11";
-#endif
case GL_VENDOR:
-#ifdef XFree86Server
- return (const GLubyte *) "Mesa project: www.mesa3d.org";
-#else
return NULL;
-#endif
default:
return NULL;
}
* dither enable/disable.
*/
static void
-enable( GLcontext *ctx, GLenum pname, GLboolean state )
+enable( struct gl_context *ctx, GLenum pname, GLboolean state )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] )
+clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
static void
-clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] )
+clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] )
{
int i;
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
* flags.
*/
void
-xmesa_update_state( GLcontext *ctx, GLbitfield new_state )
+xmesa_update_state( struct gl_context *ctx, GLbitfield new_state )
{
const XMesaContext xmesa = XMESA_CONTEXT(ctx);
-/**
- * Called via ctx->Driver.TestProxyTeximage(). Normally, we'd just use
- * the _mesa_test_proxy_teximage() fallback function, but we're going to
- * special-case the 3D texture case to allow textures up to 512x512x32
- * texels.
- */
-static GLboolean
-test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level,
- GLint internalFormat, GLenum format, GLenum type,
- GLint width, GLint height, GLint depth, GLint border)
-{
- if (target == GL_PROXY_TEXTURE_3D) {
- /* special case for 3D textures */
- if (width * height * depth > 512 * 512 * 64 ||
- width < 2 * border ||
- (!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(width - 2 * border) != 1) ||
- height < 2 * border ||
- (!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(height - 2 * border) != 1) ||
- depth < 2 * border ||
- (!ctx->Extensions.ARB_texture_non_power_of_two &&
- _mesa_bitcount(depth - 2 * border) != 1)) {
- /* Bad size, or too many texels */
- return GL_FALSE;
- }
- return GL_TRUE;
- }
- else {
- /* use the fallback routine for 1D, 2D, cube and rect targets */
- return _mesa_test_proxy_teximage(ctx, target, level, internalFormat,
- format, type, width, height, depth,
- border);
- }
-}
-
-
/**
* In SW, we don't really compress GL_COMPRESSED_RGB[A] textures!
*/
static gl_format
-choose_tex_format( GLcontext *ctx, GLint internalFormat,
+choose_tex_format( struct gl_context *ctx, GLint internalFormat,
GLenum format, GLenum type )
{
switch (internalFormat) {
* That problem led to the GLX_MESA_resize_buffers extension.
*/
static void
-xmesa_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
+xmesa_viewport(struct gl_context *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
{
XMesaContext xmctx = XMESA_CONTEXT(ctx);
XMesaBuffer xmdrawbuf = XMESA_BUFFER(ctx->WinSysDrawBuffer);
static struct gl_query_object *
-xmesa_new_query_object(GLcontext *ctx, GLuint id)
+xmesa_new_query_object(struct gl_context *ctx, GLuint id)
{
struct xmesa_query_object *q = CALLOC_STRUCT(xmesa_query_object);
if (q) {
static void
-xmesa_begin_query(GLcontext *ctx, struct gl_query_object *q)
+xmesa_begin_query(struct gl_context *ctx, struct gl_query_object *q)
{
if (q->Target == GL_TIME_ELAPSED_EXT) {
struct xmesa_query_object *xq = (struct xmesa_query_object *) q;
static void
-xmesa_end_query(GLcontext *ctx, struct gl_query_object *q)
+xmesa_end_query(struct gl_context *ctx, struct gl_query_object *q)
{
if (q->Target == GL_TIME_ELAPSED_EXT) {
struct xmesa_query_object *xq = (struct xmesa_query_object *) q;
}
else {
driver->Clear = clear_buffers;
-#ifndef XFree86Server
driver->CopyPixels = xmesa_CopyPixels;
if (xmvisual->undithered_pf == PF_8R8G8B &&
xmvisual->dithered_pf == PF_8R8G8B &&
else if (xmvisual->undithered_pf == PF_5R6G5B) {
driver->DrawPixels = xmesa_DrawPixels_5R6G5B;
}
-#endif
}
- driver->TestProxyTexImage = test_proxy_teximage;
+
#if ENABLE_EXT_texure_compression_s3tc
driver->ChooseTextureFormat = choose_tex_format;
#else
* functions.
* Called during context creation only.
*/
-void xmesa_register_swrast_functions( GLcontext *ctx )
+void xmesa_register_swrast_functions( struct gl_context *ctx )
{
SWcontext *swrast = SWRAST_CONTEXT( ctx );