/*
* Mesa 3-D graphics library
- * Version: 6.5
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
*
*/
/**
* \file swrast/swrast.h
* \brief Public interface to the software rasterization functions.
- * \author Keith Whitwell <keith@tungstengraphics.com>
+ * \author Keith Whitwell <keithw@vmware.com>
*/
#ifndef SWRAST_H
#define SWRAST_H
#include "main/mtypes.h"
+#include "swrast/s_chan.h"
+
+
+/**
+ * If non-zero use GLdouble for walking triangle edges, for better accuracy.
+ */
+#define TRIANGLE_WALK_DOUBLE 0
+
+
+/**
+ * Bits per depth buffer value (max is 32).
+ */
+#ifndef DEFAULT_SOFTWARE_DEPTH_BITS
+#define DEFAULT_SOFTWARE_DEPTH_BITS 16
+#endif
+/** Depth buffer data type */
+#if DEFAULT_SOFTWARE_DEPTH_BITS <= 16
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort
+#else
+#define DEFAULT_SOFTWARE_DEPTH_TYPE GLuint
+#endif
+
+
+/**
+ * Max image/surface/texture size.
+ */
+#define SWRAST_MAX_WIDTH 16384
+#define SWRAST_MAX_HEIGHT 16384
+
/**
* \struct SWvertex
* improve its usefulness as a fallback mechanism for hardware
* drivers.
*
- * wpos = attr[FRAG_ATTRIB_WPOS] and MUST BE THE FIRST values in the
+ * wpos = attr[VARYING_SLOT_POS] and MUST BE THE FIRST values in the
* vertex because of the tnl clipping code.
* wpos[0] and [1] are the screen-coords of SWvertex.
* primitives unaccelerated), hook in swrast_setup instead.
*/
typedef struct {
- GLfloat attrib[FRAG_ATTRIB_MAX][4];
+ GLfloat attrib[VARYING_SLOT_MAX][4];
GLchan color[4]; /** integer color */
GLfloat pointSize;
} SWvertex;
-/**
- * Fixed point data type.
- */
-typedef int GLfixed;
-
-
-#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0
+#define VARYING_SLOT_CI VARYING_SLOT_COL0
struct swrast_device_driver;
*/
extern GLboolean
-_swrast_CreateContext( GLcontext *ctx );
+_swrast_CreateContext( struct gl_context *ctx );
extern void
-_swrast_DestroyContext( GLcontext *ctx );
+_swrast_DestroyContext( struct gl_context *ctx );
/* Get a (non-const) reference to the device driver struct for swrast.
*/
extern struct swrast_device_driver *
-_swrast_GetDeviceDriverReference( GLcontext *ctx );
+_swrast_GetDeviceDriverReference( struct gl_context *ctx );
extern void
-_swrast_Bitmap( GLcontext *ctx,
+_swrast_Bitmap( struct gl_context *ctx,
GLint px, GLint py,
GLsizei width, GLsizei height,
const struct gl_pixelstore_attrib *unpack,
const GLubyte *bitmap );
extern void
-_swrast_CopyPixels( GLcontext *ctx,
- GLint srcx, GLint srcy,
- GLint destx, GLint desty,
- GLsizei width, GLsizei height,
- GLenum type );
+_swrast_CopyPixels(struct gl_context *ctx,
+ GLint srcx, GLint srcy,
+ GLint destx, GLint desty,
+ GLsizei width, GLsizei height,
+ GLenum type);
+
+extern GLboolean
+swrast_fast_copy_pixels(struct gl_context *ctx,
+ struct gl_framebuffer *srcFb,
+ struct gl_framebuffer *dstFb,
+ GLint srcX, GLint srcY, GLsizei width, GLsizei height,
+ GLint dstX, GLint dstY, GLenum type);
extern void
-_swrast_DrawPixels( GLcontext *ctx,
+_swrast_DrawPixels( struct gl_context *ctx,
GLint x, GLint y,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
const GLvoid *pixels );
extern void
-_swrast_ReadPixels( GLcontext *ctx,
- GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type,
- const struct gl_pixelstore_attrib *unpack,
- GLvoid *pixels );
-
-extern void
-_swrast_BlitFramebuffer(GLcontext *ctx,
+_swrast_BlitFramebuffer(struct gl_context *ctx,
+ struct gl_framebuffer *readFb,
+ struct gl_framebuffer *drawFb,
GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
GLbitfield mask, GLenum filter);
extern void
-_swrast_Clear(GLcontext *ctx, GLbitfield buffers);
-
-extern void
-_swrast_Accum(GLcontext *ctx, GLenum op, GLfloat value);
+_swrast_Clear(struct gl_context *ctx, GLbitfield buffers);
/* Reset the stipple counter
*/
extern void
-_swrast_ResetLineStipple( GLcontext *ctx );
+_swrast_ResetLineStipple( struct gl_context *ctx );
/**
* Indicates front/back facing for subsequent points/lines when drawing
* unfilled polygons. Needed for two-side stencil.
*/
extern void
-_swrast_SetFacing(GLcontext *ctx, GLuint facing);
+_swrast_SetFacing(struct gl_context *ctx, GLuint facing);
/* These will always render the correct point/line/triangle for the
* current state.
* For flatshaded primitives, the provoking vertex is the final one.
*/
extern void
-_swrast_Point( GLcontext *ctx, const SWvertex *v );
+_swrast_Point( struct gl_context *ctx, const SWvertex *v );
extern void
-_swrast_Line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 );
+_swrast_Line( struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1 );
extern void
-_swrast_Triangle( GLcontext *ctx, const SWvertex *v0,
+_swrast_Triangle( struct gl_context *ctx, const SWvertex *v0,
const SWvertex *v1, const SWvertex *v2 );
extern void
-_swrast_Quad( GLcontext *ctx,
+_swrast_Quad( struct gl_context *ctx,
const SWvertex *v0, const SWvertex *v1,
const SWvertex *v2, const SWvertex *v3);
extern void
-_swrast_flush( GLcontext *ctx );
+_swrast_flush( struct gl_context *ctx );
+
+extern void
+_swrast_render_primitive( struct gl_context *ctx, GLenum mode );
+
+extern void
+_swrast_render_start( struct gl_context *ctx );
+
+extern void
+_swrast_render_finish( struct gl_context *ctx );
+
+extern struct gl_texture_image *
+_swrast_new_texture_image( struct gl_context *ctx );
extern void
-_swrast_render_primitive( GLcontext *ctx, GLenum mode );
+_swrast_delete_texture_image(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
+
+extern GLboolean
+_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
+
+extern GLboolean
+_swrast_init_texture_image(struct gl_texture_image *texImage);
extern void
-_swrast_render_start( GLcontext *ctx );
+_swrast_free_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage);
extern void
-_swrast_render_finish( GLcontext *ctx );
+_swrast_map_teximage(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLuint slice,
+ GLuint x, GLuint y, GLuint w, GLuint h,
+ GLbitfield mode,
+ GLubyte **mapOut,
+ GLint *rowStrideOut);
+
+extern void
+_swrast_unmap_teximage(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ GLuint slice);
/* Tell the software rasterizer about core state changes.
*/
extern void
-_swrast_InvalidateState( GLcontext *ctx, GLbitfield new_state );
+_swrast_InvalidateState( struct gl_context *ctx, GLbitfield new_state );
/* Configure software rasterizer to match hardware rasterizer characteristics:
*/
extern void
-_swrast_allow_vertex_fog( GLcontext *ctx, GLboolean value );
+_swrast_allow_vertex_fog( struct gl_context *ctx, GLboolean value );
extern void
-_swrast_allow_pixel_fog( GLcontext *ctx, GLboolean value );
+_swrast_allow_pixel_fog( struct gl_context *ctx, GLboolean value );
/* Debug:
*/
extern void
-_swrast_print_vertex( GLcontext *ctx, const SWvertex *v );
+_swrast_print_vertex( struct gl_context *ctx, const SWvertex *v );
extern void
-_swrast_eject_texture_images(GLcontext *ctx);
+_swrast_eject_texture_images(struct gl_context *ctx);
+
+extern void
+_swrast_render_texture(struct gl_context *ctx,
+ struct gl_framebuffer *fb,
+ struct gl_renderbuffer_attachment *att);
+
+extern void
+_swrast_finish_render_texture(struct gl_context *ctx,
+ struct gl_renderbuffer *rb);
/**
* these functions. Locking in that case must be organized by the
* driver by other mechanisms.
*/
- void (*SpanRenderStart)(GLcontext *ctx);
- void (*SpanRenderFinish)(GLcontext *ctx);
+ void (*SpanRenderStart)(struct gl_context *ctx);
+ void (*SpanRenderFinish)(struct gl_context *ctx);
};