Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts: - new code for creating the Mesa GLframebuffer - new span/pixel read/write code Some drivers not yet updated/tested.
This commit is contained in:
parent
ebef61f5c0
commit
e4b2356c07
|
@ -27,6 +27,9 @@ GL_OES_read_format - allows one to query the fastest glReadPixels format
|
|||
|
||||
GL_ARB_pixel_buffer_object - buffer objects for pixel read/write functions.
|
||||
|
||||
GL_EXT_framebuffer_object - allows render-to-texture and provides a
|
||||
window-system indepedent Pbuffer facility
|
||||
|
||||
DirectFB driver, contributed by Claudio Ciccani. See docs/README.directfb
|
||||
for details.
|
||||
|
||||
|
@ -94,4 +97,4 @@ D3D needs updating
|
|||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
$Id: RELNOTES-6.3,v 3.8 2005/01/20 04:03:37 brianp Exp $
|
||||
$Id: RELNOTES-6.3,v 3.9 2005/05/04 20:11:35 brianp Exp $
|
||||
|
|
|
@ -62,7 +62,10 @@ extern const char *
|
|||
glFBDevGetString( int str );
|
||||
|
||||
|
||||
extern const void *
|
||||
typedef void (*GLFBDevProc)();
|
||||
|
||||
|
||||
extern const GLFBDevProc
|
||||
glFBDevGetProcAddress( const char *procName );
|
||||
|
||||
|
||||
|
|
|
@ -389,7 +389,7 @@ static void SpecialKey( int key, int x, int y )
|
|||
int main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL);
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STENCIL | GLUT_ALPHA);
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( Width, Height );
|
||||
glutCreateWindow(argv[0]);
|
||||
|
|
|
@ -26,6 +26,8 @@ SOURCES = antialias.c \
|
|||
cva.c \
|
||||
dinoshade.c \
|
||||
floattex.c \
|
||||
fbotest1.c \
|
||||
fbotexture.c \
|
||||
fogcoord.c \
|
||||
fptest1.c \
|
||||
fptexture.c \
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* Test GL_EXT_framebuffer_object
|
||||
*
|
||||
* Brian Paul
|
||||
* 7 Feb 2005
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Width = 400, Height = 400;
|
||||
static GLuint MyFB;
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("GL Error 0x%x at line %d\n", (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Display( void )
|
||||
{
|
||||
GLubyte *buffer = malloc(Width * Height * 4);
|
||||
GLenum status;
|
||||
|
||||
/* draw to user framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT1_EXT);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("Framebuffer incomplete!!!\n");
|
||||
}
|
||||
|
||||
glClearColor(0.5, 0.5, 1.0, 0.0);
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glColor3f(0, 1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(0, 0, 1);
|
||||
glVertex2f(0, 1);
|
||||
glEnd();
|
||||
|
||||
/* read from user framebuffer */
|
||||
glReadPixels(0, 0, Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
/* draw to window */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
glWindowPos2iARB(0, 0);
|
||||
glDrawPixels(Width, Height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
|
||||
|
||||
free(buffer);
|
||||
glutSwapBuffers();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape( int width, int height )
|
||||
{
|
||||
float ar = (float) width / (float) height;
|
||||
glViewport( 0, 0, width, height );
|
||||
glMatrixMode( GL_PROJECTION );
|
||||
glLoadIdentity();
|
||||
#if 0
|
||||
glFrustum( -ar, ar, -1.0, 1.0, 5.0, 25.0 );
|
||||
#else
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0 );
|
||||
#endif
|
||||
glMatrixMode( GL_MODELVIEW );
|
||||
glLoadIdentity();
|
||||
glTranslatef( 0.0, 0.0, -15.0 );
|
||||
Width = width;
|
||||
Height = height;
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key( unsigned char key, int x, int y )
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init( void )
|
||||
{
|
||||
GLuint rb;
|
||||
GLint i;
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
printf("GL_EXT_framebuffer_object not found!\n");
|
||||
/*exit(0);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
glGenFramebuffersEXT(1, &MyFB);
|
||||
assert(MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
assert(!glIsFramebufferEXT(MyFB));
|
||||
/* Note, continue to use MyFB below */
|
||||
|
||||
glGenRenderbuffersEXT(1, &rb);
|
||||
assert(rb);
|
||||
assert(glIsRenderbufferEXT(rb));
|
||||
glDeleteRenderbuffersEXT(1, &rb);
|
||||
assert(!glIsRenderbufferEXT(rb));
|
||||
rb = 42; /* an arbitrary ID */
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, rb);
|
||||
assert(glIsRenderbufferEXT(rb));
|
||||
|
||||
glGetIntegerv(GL_RENDERBUFFER_BINDING_EXT, &i);
|
||||
assert(i == rb);
|
||||
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
|
||||
assert(i == MyFB);
|
||||
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
|
||||
GL_RENDERBUFFER_EXT, rb);
|
||||
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_RGB, Width, Height);
|
||||
|
||||
CheckError(__LINE__);
|
||||
|
||||
/* restore to default */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main( int argc, char *argv[] )
|
||||
{
|
||||
glutInit( &argc, argv );
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
glutDisplayFunc( Display );
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
* Test GL_EXT_framebuffer_object render-to-texture
|
||||
*
|
||||
* Draw a teapot into a texture image with stenciling.
|
||||
* Then draw a textured quad using that texture.
|
||||
*
|
||||
* Brian Paul
|
||||
* 18 Apr 2005
|
||||
*/
|
||||
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <GL/glut.h>
|
||||
|
||||
static int Width = 400, Height = 400;
|
||||
static int TexWidth = 512, TexHeight = 512;
|
||||
static GLuint MyFB;
|
||||
static GLuint TexObj;
|
||||
static GLuint DepthRB, StencilRB;
|
||||
static GLboolean Anim = GL_FALSE;
|
||||
static GLfloat Rot = 0.0;
|
||||
|
||||
|
||||
static void
|
||||
CheckError(int line)
|
||||
{
|
||||
GLenum err = glGetError();
|
||||
if (err) {
|
||||
printf("GL Error 0x%x at line %d\n", (int) err, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Idle(void)
|
||||
{
|
||||
Rot = glutGet(GLUT_ELAPSED_TIME) * 0.05;
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
RenderTexture(void)
|
||||
{
|
||||
GLint level = 0;
|
||||
GLenum status;
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -15.0);
|
||||
|
||||
/* draw to texture */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, TexObj, level);
|
||||
|
||||
status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
printf("Framebuffer incomplete!!!\n");
|
||||
}
|
||||
|
||||
glViewport(0, 0, TexWidth, TexHeight);
|
||||
|
||||
glClearColor(0.5, 0.5, 1.0, 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
glStencilFunc(GL_NEVER, 1, ~0);
|
||||
glStencilOp(GL_REPLACE, GL_KEEP, GL_REPLACE);
|
||||
|
||||
/* draw diamond-shaped stencil pattern */
|
||||
glColor3f(0, 1, 0);
|
||||
glBegin(GL_POLYGON);
|
||||
glVertex2f(-0.2, 0.0);
|
||||
glVertex2f( 0.0, -0.2);
|
||||
glVertex2f( 0.2, 0.0);
|
||||
glVertex2f( 0.0, 0.2);
|
||||
glEnd();
|
||||
|
||||
/* draw teapot where stencil != 1 */
|
||||
glStencilFunc(GL_NOTEQUAL, 1, ~0);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
|
||||
|
||||
#if 0
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(1, 0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glColor3f(0, 1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(0, 0, 1);
|
||||
glVertex2f(0, 1);
|
||||
glEnd();
|
||||
#else
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
glPushMatrix();
|
||||
glRotatef(0.5 * Rot, 1.0, 0.0, 0.0);
|
||||
glutSolidTeapot(0.5);
|
||||
glPopMatrix();
|
||||
glDisable(GL_LIGHTING);
|
||||
#endif
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
|
||||
/* Bind normal framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
Display(void)
|
||||
{
|
||||
float ar = (float) Width / (float) Height;
|
||||
|
||||
RenderTexture();
|
||||
|
||||
/* draw textured quad in the window */
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.0, 0.0, -7.0);
|
||||
|
||||
glViewport(0, 0, Width, Height);
|
||||
|
||||
glClearColor(0.25, 0.25, 0.25, 0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
glPushMatrix();
|
||||
glRotatef(Rot, 0, 1, 0);
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glBegin(GL_POLYGON);
|
||||
glColor3f(0.25, 0.25, 0.25);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex2f(-1, -1);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex2f(1, -1);
|
||||
glColor3f(1.0, 1.0, 1.0);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex2f(1, 1);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex2f(-1, 1);
|
||||
glEnd();
|
||||
glPopMatrix();
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
glutSwapBuffers();
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Reshape(int width, int height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Key(unsigned char key, int x, int y)
|
||||
{
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 'a':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
else
|
||||
glutIdleFunc(NULL);
|
||||
break;
|
||||
case 27:
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
Init(void)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
|
||||
printf("GL_EXT_framebuffer_object not found!\n");
|
||||
exit(0);
|
||||
}
|
||||
printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
|
||||
|
||||
/* make framebuffer */
|
||||
glGenFramebuffersEXT(1, &MyFB);
|
||||
assert(MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
glDeleteFramebuffersEXT(1, &MyFB);
|
||||
assert(!glIsFramebufferEXT(MyFB));
|
||||
/* Note, continue to use MyFB below */
|
||||
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, MyFB);
|
||||
assert(glIsFramebufferEXT(MyFB));
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &i);
|
||||
assert(i == MyFB);
|
||||
|
||||
/* make depth renderbuffer */
|
||||
glGenRenderbuffersEXT(1, &DepthRB);
|
||||
assert(DepthRB);
|
||||
assert(glIsRenderbufferEXT(DepthRB));
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, DepthRB);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT,
|
||||
TexWidth, TexHeight);
|
||||
|
||||
/* make stencil renderbuffer */
|
||||
glGenRenderbuffersEXT(1, &StencilRB);
|
||||
assert(StencilRB);
|
||||
assert(glIsRenderbufferEXT(StencilRB));
|
||||
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, StencilRB);
|
||||
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX,
|
||||
TexWidth, TexHeight);
|
||||
|
||||
/* attach DepthRB to MyFB */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, DepthRB);
|
||||
|
||||
/* attach StencilRB to MyFB */
|
||||
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, StencilRB);
|
||||
|
||||
|
||||
/* bind regular framebuffer */
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
/* Make texture object/image */
|
||||
glGenTextures(1, &TexObj);
|
||||
glBindTexture(GL_TEXTURE_2D, TexObj);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, TexWidth, TexHeight, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
CheckError(__LINE__);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
glutInit(&argc, argv);
|
||||
glutInitWindowPosition(0, 0);
|
||||
glutInitWindowSize(Width, Height);
|
||||
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
|
||||
glutCreateWindow(argv[0]);
|
||||
glutReshapeFunc(Reshape);
|
||||
glutKeyboardFunc(Key);
|
||||
glutDisplayFunc(Display);
|
||||
if (Anim)
|
||||
glutIdleFunc(Idle);
|
||||
Init();
|
||||
glutMainLoop();
|
||||
return 0;
|
||||
}
|
|
@ -288,6 +288,7 @@ check_functions( const char *extensions )
|
|||
|
||||
for (entry = functions; entry->name; entry++) {
|
||||
if (entry->name[0] == '-') {
|
||||
/* XXX update for OpenGL 2.0 */
|
||||
if (entry->name[1] == '1') {
|
||||
/* check GL version X.Y */
|
||||
const char *version = (const char *) glGetString(GL_VERSION);
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
#include "imports.h"
|
||||
#include "buffers.h"
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "program.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "texcompress.h"
|
||||
#include "texformat.h"
|
||||
#include "teximage.h"
|
||||
|
@ -38,6 +40,7 @@
|
|||
#endif
|
||||
#if FEATURE_EXT_framebuffer_object
|
||||
#include "fbobject.h"
|
||||
#include "texrender.h"
|
||||
#endif
|
||||
|
||||
#include "driverfuncs.h"
|
||||
|
@ -62,7 +65,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->GetString = NULL; /* REQUIRED! */
|
||||
driver->UpdateState = NULL; /* REQUIRED! */
|
||||
driver->GetBufferSize = NULL; /* REQUIRED! */
|
||||
driver->ResizeBuffers = _swrast_alloc_buffers;
|
||||
driver->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
driver->Error = NULL;
|
||||
|
||||
driver->Finish = NULL;
|
||||
|
@ -134,7 +137,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
driver->ColorMaterial = NULL;
|
||||
driver->CullFace = NULL;
|
||||
driver->DrawBuffer = _swrast_DrawBuffer;
|
||||
driver->DrawBuffers = _swrast_DrawBuffers;
|
||||
driver->DrawBuffers = NULL; /***_swrast_DrawBuffers;***/
|
||||
driver->FrontFace = NULL;
|
||||
driver->DepthFunc = NULL;
|
||||
driver->DepthMask = NULL;
|
||||
|
@ -200,7 +203,9 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
|
|||
|
||||
#if FEATURE_EXT_framebuffer_object
|
||||
driver->NewFramebuffer = _mesa_new_framebuffer;
|
||||
driver->NewRenderbuffer = _mesa_new_renderbuffer;
|
||||
driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
|
||||
driver->RenderbufferTexture = _mesa_renderbuffer_texture;
|
||||
driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
|
||||
#endif
|
||||
|
||||
/* T&L stuff */
|
||||
|
|
|
@ -278,7 +278,8 @@ read_rgba_pixels (const GLcontext *ctx,
|
|||
* Index
|
||||
***************************************************************************/
|
||||
static void
|
||||
write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
write_index_span (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLuint index[], const GLubyte mask[])
|
||||
{
|
||||
const DMesaContext dmesa = (DMesaContext)ctx;
|
||||
|
@ -302,7 +303,8 @@ write_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
|||
|
||||
|
||||
static void
|
||||
write_index8_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
write_index8_span (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte index[], const GLubyte mask[])
|
||||
{
|
||||
const DMesaContext dmesa = (DMesaContext)ctx;
|
||||
|
@ -326,7 +328,7 @@ write_index8_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
|||
|
||||
|
||||
static void
|
||||
write_mono_index_span (const GLcontext *ctx,
|
||||
write_mono_index_span (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLuint colorIndex, const GLubyte mask[])
|
||||
{
|
||||
|
@ -351,8 +353,8 @@ write_mono_index_span (const GLcontext *ctx,
|
|||
|
||||
|
||||
static void
|
||||
read_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
||||
GLuint index[])
|
||||
read_index_span (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y, GLuint index[])
|
||||
{
|
||||
const DMesaContext dmesa = (DMesaContext)ctx;
|
||||
GLuint i, offset;
|
||||
|
@ -366,7 +368,7 @@ read_index_span (const GLcontext *ctx, GLuint n, GLint x, GLint y,
|
|||
|
||||
|
||||
static void
|
||||
write_index_pixels (const GLcontext *ctx,
|
||||
write_index_pixels (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const GLuint index[], const GLubyte mask[])
|
||||
{
|
||||
|
@ -390,7 +392,7 @@ write_index_pixels (const GLcontext *ctx,
|
|||
|
||||
|
||||
static void
|
||||
write_mono_index_pixels (const GLcontext *ctx,
|
||||
write_mono_index_pixels (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLuint colorIndex, const GLubyte mask[])
|
||||
{
|
||||
|
@ -414,9 +416,9 @@ write_mono_index_pixels (const GLcontext *ctx,
|
|||
|
||||
|
||||
static void
|
||||
read_index_pixels (const GLcontext *ctx,
|
||||
read_index_pixels (const GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLuint index[], const GLubyte mask[])
|
||||
GLuint index[], const GLubyte mask[])
|
||||
{
|
||||
const DMesaContext dmesa = (DMesaContext)ctx;
|
||||
GLuint i, _w_ = DSTRIDE, _b_ = dmesa->buffer->height - 1;
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
/* $XFree86: xc/lib/GL/mesa/src/drv/common/depthtmp.h,v 1.5 2001/03/21 16:14:20 dawes Exp $ */
|
||||
|
||||
/*
|
||||
* Notes:
|
||||
* 1. These functions plug into the gl_renderbuffer structure.
|
||||
* 2. The 'values' parameter always points to GLuint values, regardless of
|
||||
* the actual Z buffer depth.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DBG
|
||||
#define DBG 0
|
||||
#endif
|
||||
|
@ -20,12 +28,14 @@
|
|||
#endif
|
||||
|
||||
static void TAG(WriteDepthSpan)( GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLdepth *depth,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const void *values,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLuint *depth = (const GLuint *) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
@ -64,14 +74,31 @@ static void TAG(WriteDepthSpan)( GLcontext *ctx,
|
|||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
#if !HAVE_HW_DEPTH_SPANS
|
||||
|
||||
#if HAVE_HW_DEPTH_SPANS
|
||||
/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */
|
||||
static void
|
||||
TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const void *value, const GLubyte mask[] )
|
||||
{
|
||||
const GLuint depthVal = *((GLuint *) value);
|
||||
GLuint depths[MAX_WIDTH];
|
||||
GLuint i;
|
||||
for (i = 0; i < n; i++)
|
||||
depths[i] = depthVal;
|
||||
TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask);
|
||||
}
|
||||
#else
|
||||
static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLdepth depth,
|
||||
const GLubyte mask[] )
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const void *value,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLuint depth = *((GLuint *) value);
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
@ -102,15 +129,18 @@ static void TAG(WriteMonoDepthSpan)( GLcontext *ctx,
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void TAG(WriteDepthPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n,
|
||||
const GLint x[],
|
||||
const GLint y[],
|
||||
const GLdepth depth[],
|
||||
const void *values,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLuint *depth = (const GLuint *) values;
|
||||
GLuint i;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
||||
|
@ -141,11 +171,13 @@ static void TAG(WriteDepthPixels)( GLcontext *ctx,
|
|||
/* Read depth spans and pixels
|
||||
*/
|
||||
static void TAG(ReadDepthSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLdepth depth[] )
|
||||
void *values )
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLuint *depth = (GLuint *) values;
|
||||
GLint x1, n1;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
||||
|
@ -172,12 +204,15 @@ static void TAG(ReadDepthSpan)( GLcontext *ctx,
|
|||
HW_READ_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(ReadDepthPixels)( GLcontext *ctx, GLuint n,
|
||||
static void TAG(ReadDepthPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n,
|
||||
const GLint x[], const GLint y[],
|
||||
GLdepth depth[] )
|
||||
void *values )
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLuint *depth = (GLuint *) values;
|
||||
GLuint i;
|
||||
LOCAL_DEPTH_VARS;
|
||||
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
#include "mtypes.h"
|
||||
#include "drirenderbuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "imports.h"
|
||||
|
||||
|
||||
/**
|
||||
* This will get called when a window is resized.
|
||||
* Just update width, height and internal format fields for now.
|
||||
*/
|
||||
static GLboolean
|
||||
driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb,
|
||||
GLenum internalFormat, GLuint width, GLuint height)
|
||||
{
|
||||
rb->Width = width;
|
||||
rb->Height = height;
|
||||
rb->InternalFormat = internalFormat;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate a new driRenderbuffer object.
|
||||
* Individual drivers are free to implement different versions of
|
||||
* this function.
|
||||
* \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24,
|
||||
* GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now).
|
||||
* \param cpp chars or bytes per pixel
|
||||
* \param offset start of buffer with respect to framebuffer address
|
||||
* \param pitch pixels per row
|
||||
*/
|
||||
driRenderbuffer *
|
||||
driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch)
|
||||
{
|
||||
driRenderbuffer *drb;
|
||||
|
||||
assert(format == GL_RGBA ||
|
||||
format == GL_DEPTH_COMPONENT16 ||
|
||||
format == GL_DEPTH_COMPONENT24 ||
|
||||
format == GL_DEPTH_COMPONENT32 ||
|
||||
format == GL_STENCIL_INDEX8_EXT);
|
||||
|
||||
assert(cpp > 0);
|
||||
assert(pitch > 0);
|
||||
|
||||
drb = _mesa_calloc(sizeof(driRenderbuffer));
|
||||
if (drb) {
|
||||
const GLuint name = 0;
|
||||
|
||||
_mesa_init_renderbuffer(&drb->Base, name);
|
||||
|
||||
/* Make sure we're using a null-valued GetPointer routine */
|
||||
assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL);
|
||||
|
||||
drb->Base.InternalFormat = format;
|
||||
|
||||
if (format == GL_RGBA) {
|
||||
/* Color */
|
||||
drb->Base._BaseFormat = GL_RGBA;
|
||||
drb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
else if (format == GL_DEPTH_COMPONENT16) {
|
||||
/* Depth */
|
||||
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
/* we always Get/Put 32-bit Z values */
|
||||
drb->Base.DataType = GL_UNSIGNED_INT;
|
||||
}
|
||||
else if (format == GL_DEPTH_COMPONENT24) {
|
||||
/* Depth */
|
||||
drb->Base._BaseFormat = GL_DEPTH_COMPONENT;
|
||||
/* we always Get/Put 32-bit Z values */
|
||||
drb->Base.DataType = GL_UNSIGNED_INT;
|
||||
}
|
||||
else {
|
||||
/* Stencil */
|
||||
ASSERT(format == GL_STENCIL_INDEX8);
|
||||
drb->Base._BaseFormat = GL_STENCIL_INDEX;
|
||||
drb->Base.DataType = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
|
||||
/* XXX if we were allocating a user-created renderbuffer, we'd have
|
||||
* to fill in the ComponentSizes[] array too.
|
||||
*/
|
||||
|
||||
drb->Base.AllocStorage = driRenderbufferStorage;
|
||||
/* using default Delete function */
|
||||
|
||||
|
||||
/* DRI renderbuffer-specific fields: */
|
||||
drb->offset = offset;
|
||||
drb->pitch = pitch;
|
||||
drb->cpp = cpp;
|
||||
}
|
||||
return drb;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
|
||||
/**
|
||||
* A driRenderbuffer is dervied from gl_renderbuffer.
|
||||
* It describes a color buffer (front or back), a depth buffer, or stencil
|
||||
* buffer etc.
|
||||
* Specific to DRI drivers are the offset and pitch fields.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DRIRENDERBUFFER_H
|
||||
#define DRIRENDERBUFFER_H
|
||||
|
||||
#include "mtypes.h"
|
||||
|
||||
typedef struct {
|
||||
struct gl_renderbuffer Base;
|
||||
|
||||
/* Chars or bytes per pixel. If Z and Stencil are stored together this
|
||||
* will typically be 32 whether this a depth or stencil renderbuffer.
|
||||
*/
|
||||
GLint cpp;
|
||||
|
||||
/* Buffer position and pitch (row stride). Recall that for today's DRI
|
||||
* drivers, we have statically allocated color/depth/stencil buffers.
|
||||
* So this information describes the whole screen, not just a window.
|
||||
* To address pixels in a window, we need to know the window's position
|
||||
* and size with respect to the screen.
|
||||
*/
|
||||
GLint offset; /* in bytes */
|
||||
GLint pitch; /* in pixels */
|
||||
|
||||
} driRenderbuffer;
|
||||
|
||||
|
||||
driRenderbuffer *
|
||||
driNewRenderbuffer(GLenum format, GLint cpp, GLint offset, GLint pitch);
|
||||
|
||||
|
||||
#endif /* DRIRENDERBUFFER_H */
|
|
@ -56,13 +56,14 @@
|
|||
#endif
|
||||
|
||||
|
||||
static void TAG(WriteRGBASpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgba[][4],
|
||||
const GLubyte mask[] )
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -98,13 +99,14 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx,
|
|||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(WriteRGBSpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteRGBSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgb[][3],
|
||||
const GLubyte mask[] )
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -136,15 +138,14 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx,
|
|||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
|
||||
GLuint n,
|
||||
const GLint x[],
|
||||
const GLint y[],
|
||||
const GLubyte rgba[][4],
|
||||
const GLubyte mask[] )
|
||||
static void TAG(WriteRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -183,13 +184,15 @@ static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLchan color[4],
|
||||
const void *value,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *color = (const GLubyte *) value;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -221,14 +224,16 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
|
||||
static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n,
|
||||
const GLint x[], const GLint y[],
|
||||
const GLchan color[],
|
||||
const GLubyte mask[] )
|
||||
const GLint x[], const GLint y[],
|
||||
const void *value,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *color = (const GLubyte *) value;
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
INIT_MONO_PIXEL(p, color);
|
||||
|
@ -261,12 +266,14 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(ReadRGBASpan)( const GLcontext *ctx,
|
||||
static void TAG(ReadRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
void *values)
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -287,12 +294,15 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
|
||||
static void TAG(ReadRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[] )
|
||||
void *values )
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
const GLubyte *mask = NULL; /* remove someday */
|
||||
GLuint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
|
|
@ -145,13 +145,14 @@
|
|||
#include "x86/common_x86_asm.h"
|
||||
#endif
|
||||
|
||||
static void TAG(WriteRGBASpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgba[][4],
|
||||
const GLubyte mask[] )
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -187,13 +188,14 @@ static void TAG(WriteRGBASpan)( const GLcontext *ctx,
|
|||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(WriteRGBSpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteRGBSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLubyte rgb[][3],
|
||||
const GLubyte mask[] )
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -225,15 +227,14 @@ static void TAG(WriteRGBSpan)( const GLcontext *ctx,
|
|||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
|
||||
GLuint n,
|
||||
const GLint x[],
|
||||
const GLint y[],
|
||||
const GLubyte rgba[][4],
|
||||
const GLubyte mask[] )
|
||||
static void TAG(WriteRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
|
||||
GLint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -272,13 +273,14 @@ static void TAG(WriteRGBAPixels)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
|
||||
static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLchan color[4],
|
||||
const GLubyte mask[] )
|
||||
const void *value, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *color = (const GLubyte *) value;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_VARS;
|
||||
|
@ -310,14 +312,16 @@ static void TAG(WriteMonoRGBASpan)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
|
||||
static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n,
|
||||
const GLint x[], const GLint y[],
|
||||
const GLchan color[],
|
||||
const void *value,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *color = (const GLubyte *) value;
|
||||
GLint i;
|
||||
LOCAL_VARS;
|
||||
INIT_MONO_PIXEL(p, color);
|
||||
|
@ -350,12 +354,13 @@ static void TAG(WriteMonoRGBAPixels)( const GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(ReadRGBASpan)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
static void TAG(ReadRGBASpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y, void *values)
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -381,9 +386,9 @@ static void TAG(ReadRGBASpan)( const GLcontext *ctx,
|
|||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
|
||||
((SPANTMP_PIXEL_FMT == GL_RGB) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
|
||||
static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
{
|
||||
#ifndef USE_INNER_EMMS
|
||||
/* The EMMS instruction is directly in-lined here because using GCC's
|
||||
|
@ -394,6 +399,7 @@ static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
|
|||
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -429,12 +435,14 @@ static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
|
|||
#if defined(USE_SSE_ASM) && \
|
||||
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
|
||||
static void TAG2(ReadRGBASpan,_SSE2)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
void *values)
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -461,9 +469,10 @@ static void TAG2(ReadRGBASpan,_SSE2)( const GLcontext *ctx,
|
|||
#if defined(USE_SSE_ASM) && \
|
||||
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
|
||||
static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLubyte rgba[][4])
|
||||
static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
void *values)
|
||||
{
|
||||
#ifndef USE_INNER_EMMS
|
||||
/* The EMMS instruction is directly in-lined here because using GCC's
|
||||
|
@ -474,6 +483,7 @@ static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
|
|||
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -501,12 +511,15 @@ static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
|
|||
#endif
|
||||
|
||||
|
||||
static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
|
||||
static void TAG(ReadRGBAPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
GLubyte rgba[][4], const GLubyte mask[] )
|
||||
void *values )
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
|
||||
GLubyte *mask = NULL; /* remove someday */
|
||||
GLint i;
|
||||
LOCAL_VARS;
|
||||
|
||||
|
@ -537,21 +550,21 @@ static void TAG(ReadRGBAPixels)( const GLcontext *ctx,
|
|||
HW_READ_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(InitPointers)(struct swrast_device_driver *swdd)
|
||||
static void TAG(InitPointers)(struct gl_renderbuffer *rb)
|
||||
{
|
||||
swdd->WriteRGBASpan = TAG(WriteRGBASpan);
|
||||
swdd->WriteRGBSpan = TAG(WriteRGBSpan);
|
||||
swdd->WriteMonoRGBASpan = TAG(WriteMonoRGBASpan);
|
||||
swdd->WriteRGBAPixels = TAG(WriteRGBAPixels);
|
||||
swdd->WriteMonoRGBAPixels = TAG(WriteMonoRGBAPixels);
|
||||
swdd->ReadRGBAPixels = TAG(ReadRGBAPixels);
|
||||
rb->PutRow = TAG(WriteRGBASpan);
|
||||
rb->PutRowRGB = TAG(WriteRGBSpan);
|
||||
rb->PutMonoRow = TAG(WriteMonoRGBASpan);
|
||||
rb->PutValues = TAG(WriteRGBAPixels);
|
||||
rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
|
||||
rb->GetValues = TAG(ReadRGBAPixels);
|
||||
|
||||
#if defined(USE_SSE_ASM) && \
|
||||
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
|
||||
if ( cpu_has_xmm2 ) {
|
||||
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE2" );
|
||||
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE2);
|
||||
if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
|
||||
rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -559,8 +572,8 @@ static void TAG(InitPointers)(struct swrast_device_driver *swdd)
|
|||
(SPANTMP_PIXEL_FMT == GL_BGRA) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
|
||||
if ( cpu_has_xmm ) {
|
||||
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE" );
|
||||
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE);
|
||||
if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
|
||||
rb->GetRow = TAG2(ReadRGBASpan, _SSE);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
@ -570,14 +583,14 @@ static void TAG(InitPointers)(struct swrast_device_driver *swdd)
|
|||
((SPANTMP_PIXEL_FMT == GL_RGB) && \
|
||||
(SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
|
||||
if ( cpu_has_mmx ) {
|
||||
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "MMX" );
|
||||
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _MMX);
|
||||
if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
|
||||
rb->GetRow = TAG2(ReadRGBASpan, _MMX);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "C" );
|
||||
swdd->ReadRGBASpan = TAG(ReadRGBASpan);
|
||||
if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
|
||||
rb->GetRow = TAG(ReadRGBASpan);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,12 +19,13 @@
|
|||
#endif
|
||||
|
||||
static void TAG(WriteStencilSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const GLstencil *stencil,
|
||||
const GLubyte mask[] )
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *stencil = (const GLubyte *) values;
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
@ -57,15 +58,57 @@ static void TAG(WriteStencilSpan)( GLcontext *ctx,
|
|||
}
|
||||
|
||||
|
||||
static void TAG(WriteStencilPixels)( GLcontext *ctx,
|
||||
GLuint n,
|
||||
const GLint x[],
|
||||
const GLint y[],
|
||||
const GLstencil stencil[],
|
||||
const GLubyte mask[] )
|
||||
static void TAG(WriteMonoStencilSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
const void *value,
|
||||
const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte stencil = *((const GLubyte *) value);
|
||||
GLint x1;
|
||||
GLint n1;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
y = Y_FLIP(y);
|
||||
|
||||
HW_CLIPLOOP()
|
||||
{
|
||||
GLint i = 0;
|
||||
CLIPSPAN(x,y,n,x1,n1,i);
|
||||
|
||||
if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n",
|
||||
(int)i, (int)n1, (int)x1);
|
||||
|
||||
if (mask)
|
||||
{
|
||||
for (;n1>0;i++,x1++,n1--)
|
||||
if (mask[i])
|
||||
WRITE_STENCIL( x1, y, stencil );
|
||||
}
|
||||
else
|
||||
{
|
||||
for (;n1>0;i++,x1++,n1--)
|
||||
WRITE_STENCIL( x1, y, stencil );
|
||||
}
|
||||
}
|
||||
HW_ENDCLIPLOOP();
|
||||
}
|
||||
HW_WRITE_UNLOCK();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void TAG(WriteStencilPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n,
|
||||
const GLint x[], const GLint y[],
|
||||
const void *values, const GLubyte mask[] )
|
||||
{
|
||||
HW_WRITE_LOCK()
|
||||
{
|
||||
const GLubyte *stencil = (const GLubyte *) values;
|
||||
GLuint i;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
|
@ -91,11 +134,13 @@ static void TAG(WriteStencilPixels)( GLcontext *ctx,
|
|||
/* Read stencil spans and pixels
|
||||
*/
|
||||
static void TAG(ReadStencilSpan)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, GLint x, GLint y,
|
||||
GLstencil stencil[])
|
||||
void *values)
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte *stencil = (GLubyte *) values;
|
||||
GLint x1,n1;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
|
@ -115,12 +160,14 @@ static void TAG(ReadStencilSpan)( GLcontext *ctx,
|
|||
HW_READ_UNLOCK();
|
||||
}
|
||||
|
||||
static void TAG(ReadStencilPixels)( GLcontext *ctx, GLuint n,
|
||||
const GLint x[], const GLint y[],
|
||||
GLstencil stencil[] )
|
||||
static void TAG(ReadStencilPixels)( GLcontext *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint n, const GLint x[], const GLint y[],
|
||||
void *values )
|
||||
{
|
||||
HW_READ_LOCK()
|
||||
{
|
||||
GLubyte *stencil = (GLubyte *) values;
|
||||
GLuint i;
|
||||
LOCAL_STENCIL_VARS;
|
||||
|
||||
|
|
|
@ -44,9 +44,12 @@
|
|||
#include "driver.h"
|
||||
#include "drm.h"
|
||||
#include "utils.h"
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
#include "buffers.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "array_cache/acache.h"
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
@ -153,10 +156,10 @@ set_buffer( GLcontext *ctx, GLframebuffer *buffer, GLuint bufferBit )
|
|||
|
||||
|
||||
switch (bufferBit) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
fbdrawable->currentBuffer = fbdrawable->frontBuffer;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
fbdrawable->currentBuffer = fbdrawable->backBuffer;
|
||||
break;
|
||||
default:
|
||||
|
@ -171,7 +174,7 @@ init_core_functions( struct dd_function_table *functions )
|
|||
{
|
||||
functions->GetString = get_string;
|
||||
functions->UpdateState = update_state;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetBufferSize = get_buffer_size;
|
||||
functions->Viewport = viewport;
|
||||
|
||||
|
@ -279,7 +282,67 @@ init_core_functions( struct dd_function_table *functions )
|
|||
#define FETCH_CI_PIXEL(CI, P) \
|
||||
CI = P[0]
|
||||
|
||||
#include "swrast/s_spantemp.h"
|
||||
#include "swrast/s_spantemp.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
ASSERT(drb->Base.InternalFormat == GL_RGBA);
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = read_rgba_span_B5G6R5;
|
||||
drb->Base.GetValues = read_rgba_pixels_B5G6R5;
|
||||
drb->Base.PutRow = write_rgba_span_B5G6R5;
|
||||
drb->Base.PutMonoRow = write_monorgba_span_B5G6R5;
|
||||
drb->Base.PutRowRGB = write_rgb_span_B5G6R5;
|
||||
drb->Base.PutValues = write_rgba_pixels_B5G6R5;
|
||||
drb->Base.PutMonoValues = write_monorgba_pixels_B5G6R5;
|
||||
}
|
||||
else if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = read_rgba_span_B5G5R5;
|
||||
drb->Base.GetValues = read_rgba_pixels_B5G5R5;
|
||||
drb->Base.PutRow = write_rgba_span_B5G5R5;
|
||||
drb->Base.PutMonoRow = write_monorgba_span_B5G5R5;
|
||||
drb->Base.PutRowRGB = write_rgb_span_B5G5R5;
|
||||
drb->Base.PutValues = write_rgba_pixels_B5G5R5;
|
||||
drb->Base.PutMonoValues = write_monorgba_pixels_B5G5R5;
|
||||
}
|
||||
else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8
|
||||
&& vis->alphaBits == 8) {
|
||||
drb->Base.GetRow = read_rgba_span_B8G8R8A8;
|
||||
drb->Base.GetValues = read_rgba_pixels_B8G8R8A8;
|
||||
drb->Base.PutRow = write_rgba_span_B8G8R8A8;
|
||||
drb->Base.PutMonoRow = write_monorgba_span_B8G8R8A8;
|
||||
drb->Base.PutRowRGB = write_rgb_span_B8G8R8A8;
|
||||
drb->Base.PutValues = write_rgba_pixels_B8G8R8A8;
|
||||
drb->Base.PutMonoValues = write_monorgba_pixels_B8G8R8A8;
|
||||
}
|
||||
else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8
|
||||
&& vis->alphaBits == 0) {
|
||||
drb->Base.GetRow = read_rgba_span_B8G8R8;
|
||||
drb->Base.GetValues = read_rgba_pixels_B8G8R8;
|
||||
drb->Base.PutRow = write_rgba_span_B8G8R8;
|
||||
drb->Base.PutMonoRow = write_monorgba_span_B8G8R8;
|
||||
drb->Base.PutRowRGB = write_rgb_span_B8G8R8;
|
||||
drb->Base.PutValues = write_rgba_pixels_B8G8R8;
|
||||
drb->Base.PutMonoValues = write_monorgba_pixels_B8G8R8;
|
||||
}
|
||||
else if (vis->indexBits == 8) {
|
||||
drb->Base.GetRow = read_index_span_CI8;
|
||||
drb->Base.GetValues = read_index_pixels_CI8;
|
||||
drb->Base.PutRow = write_index_span_CI8;
|
||||
drb->Base.PutMonoRow = write_monoindex_span_CI8;
|
||||
drb->Base.PutValues = write_index_pixels_CI8;
|
||||
drb->Base.PutMonoValues = write_monoindex_pixels_CI8;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* hardware z/stencil/etc someday */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Initialize the driver specific screen private data.
|
||||
|
@ -377,60 +440,6 @@ fbCreateContext( const __GLcontextModes *glVisual,
|
|||
struct swrast_device_driver *swdd;
|
||||
swdd = _swrast_GetDeviceDriverReference( ctx );
|
||||
swdd->SetBuffer = set_buffer;
|
||||
if (!glVisual->rgbMode) {
|
||||
swdd->WriteCI32Span = write_index32_span_CI8;
|
||||
swdd->WriteCI8Span = write_index8_span_CI8;
|
||||
swdd->WriteMonoCISpan = write_monoindex_span_CI8;
|
||||
swdd->WriteCI32Pixels = write_index_pixels_CI8;
|
||||
swdd->WriteMonoCIPixels = write_monoindex_pixels_CI8;
|
||||
swdd->ReadCI32Span = read_index_span_CI8;
|
||||
swdd->ReadCI32Pixels = read_index_pixels_CI8;
|
||||
}
|
||||
else if (glVisual->rgbBits == 24 &&
|
||||
glVisual->alphaBits == 0) {
|
||||
swdd->WriteRGBASpan = write_rgba_span_B8G8R8;
|
||||
swdd->WriteRGBSpan = write_rgb_span_B8G8R8;
|
||||
swdd->WriteMonoRGBASpan = write_monorgba_span_B8G8R8;
|
||||
swdd->WriteRGBAPixels = write_rgba_pixels_B8G8R8;
|
||||
swdd->WriteMonoRGBAPixels = write_monorgba_pixels_B8G8R8;
|
||||
swdd->ReadRGBASpan = read_rgba_span_B8G8R8;
|
||||
swdd->ReadRGBAPixels = read_rgba_pixels_B8G8R8;
|
||||
}
|
||||
else if (glVisual->rgbBits == 32 &&
|
||||
glVisual->alphaBits == 8) {
|
||||
swdd->WriteRGBASpan = write_rgba_span_B8G8R8A8;
|
||||
swdd->WriteRGBSpan = write_rgb_span_B8G8R8A8;
|
||||
swdd->WriteMonoRGBASpan = write_monorgba_span_B8G8R8A8;
|
||||
swdd->WriteRGBAPixels = write_rgba_pixels_B8G8R8A8;
|
||||
swdd->WriteMonoRGBAPixels = write_monorgba_pixels_B8G8R8A8;
|
||||
swdd->ReadRGBASpan = read_rgba_span_B8G8R8A8;
|
||||
swdd->ReadRGBAPixels = read_rgba_pixels_B8G8R8A8;
|
||||
}
|
||||
else if (glVisual->rgbBits == 16 &&
|
||||
glVisual->alphaBits == 0) {
|
||||
swdd->WriteRGBASpan = write_rgba_span_B5G6R5;
|
||||
swdd->WriteRGBSpan = write_rgb_span_B5G6R5;
|
||||
swdd->WriteMonoRGBASpan = write_monorgba_span_B5G6R5;
|
||||
swdd->WriteRGBAPixels = write_rgba_pixels_B5G6R5;
|
||||
swdd->WriteMonoRGBAPixels = write_monorgba_pixels_B5G6R5;
|
||||
swdd->ReadRGBASpan = read_rgba_span_B5G6R5;
|
||||
swdd->ReadRGBAPixels = read_rgba_pixels_B5G6R5;
|
||||
}
|
||||
else if (glVisual->rgbBits == 15 &&
|
||||
glVisual->alphaBits == 0) {
|
||||
swdd->WriteRGBASpan = write_rgba_span_B5G5R5;
|
||||
swdd->WriteRGBSpan = write_rgb_span_B5G5R5;
|
||||
swdd->WriteMonoRGBASpan = write_monorgba_span_B5G5R5;
|
||||
swdd->WriteRGBAPixels = write_rgba_pixels_B5G5R5;
|
||||
swdd->WriteMonoRGBAPixels = write_monorgba_pixels_B5G5R5;
|
||||
swdd->ReadRGBASpan = read_rgba_span_B5G5R5;
|
||||
swdd->ReadRGBAPixels = read_rgba_pixels_B5G5R5;
|
||||
}
|
||||
else {
|
||||
_mesa_printf("bad pixelformat rgb %d alpha %d\n",
|
||||
glVisual->rgbBits,
|
||||
glVisual->alphaBits );
|
||||
}
|
||||
}
|
||||
|
||||
/* use default TCL pipeline */
|
||||
|
@ -454,7 +463,7 @@ fbDestroyContext( __DRIcontextPrivate *driContextPriv )
|
|||
|
||||
/* check if we're deleting the currently bound context */
|
||||
if (fbmesa == current) {
|
||||
_mesa_make_current2(NULL, NULL, NULL);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Free fb context resources */
|
||||
|
@ -498,6 +507,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
if (!fbdrawable)
|
||||
return 0;
|
||||
|
||||
#if 0
|
||||
fbdrawable->mesa_framebuffer = (void *)
|
||||
_mesa_create_framebuffer( mesaVis,
|
||||
swDepth,
|
||||
|
@ -509,6 +519,42 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
_mesa_free(fbdrawable);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
fbdrawable->mesa_framebuffer = _mesa_create_framebuffer(mesaVis);
|
||||
if (!fbdrawable->mesa_framebuffer) {
|
||||
_mesa_free(fbdrawable);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* XXX double-check these parameters (bpp vs cpp, etc) */
|
||||
{
|
||||
driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, spriv->bpp,
|
||||
spriv->fbOrigin,
|
||||
spriv->fbStride);
|
||||
fbSetSpanFunctions(drb, mesaVis);
|
||||
_mesa_add_renderbuffer(fbdrawable->mesa_framebuffer,
|
||||
BUFFER_FRONT_LEFT, &drb->Base);
|
||||
}
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
/* XXX what are the correct origin/stride values? */
|
||||
driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, spriv->bpp,
|
||||
spriv->fbOrigin,
|
||||
spriv->fbStride);
|
||||
fbSetSpanFunctions(drb, mesaVis);
|
||||
_mesa_add_renderbuffer(fbdrawable->mesa_framebuffer,
|
||||
BUFFER_BACK_LEFT, &drb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fbdrawable->mesa_framebuffer,
|
||||
GL_FALSE, /* color */
|
||||
swDepth,
|
||||
swStencil,
|
||||
swAccum,
|
||||
swAlpha,
|
||||
GL_FALSE /* aux */);
|
||||
|
||||
#endif
|
||||
|
||||
driDrawPriv->driverPrivate = fbdrawable;
|
||||
|
||||
fbdrawable->frontBuffer = fbdrawable->currentBuffer = spriv->fbMap;
|
||||
|
@ -591,11 +637,11 @@ fbMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
|
||||
newFbCtx->dri.drawable = driDrawPriv;
|
||||
|
||||
_mesa_make_current2( newFbCtx->glCtx,
|
||||
((fbDrawablePtr)driDrawPriv->driverPrivate)->mesa_framebuffer,
|
||||
((fbDrawablePtr)driReadPriv->driverPrivate)->mesa_framebuffer);
|
||||
_mesa_make_current( newFbCtx->glCtx,
|
||||
((fbDrawablePtr)driDrawPriv->driverPrivate)->mesa_framebuffer,
|
||||
((fbDrawablePtr)driReadPriv->driverPrivate)->mesa_framebuffer);
|
||||
} else {
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -267,7 +267,7 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
{
|
||||
ffbContextPtr fmesa = FFB_CONTEXT(ctx);
|
||||
__DRIdrawablePrivate *dPriv = fmesa->driDrawable;
|
||||
unsigned int stcmask = DD_STENCIL_BIT;
|
||||
unsigned int stcmask = BUFFER_BIT_STENCIL;
|
||||
|
||||
#ifdef CLEAR_TRACE
|
||||
fprintf(stderr, "ffbDDClear: mask(%08x) all(%d) "
|
||||
|
@ -277,7 +277,7 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
if (!(fmesa->ffb_sarea->flags & FFB_DRI_FFB2PLUS))
|
||||
stcmask = 0;
|
||||
|
||||
if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT | DD_DEPTH_BIT | stcmask)) {
|
||||
if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT | BUFFER_BIT_DEPTH | stcmask)) {
|
||||
ffb_fbcPtr ffb = fmesa->regs;
|
||||
unsigned int fbc, ppc;
|
||||
|
||||
|
@ -288,20 +288,20 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
FFB_PPC_ZS_CONST | FFB_PPC_CS_CONST);
|
||||
|
||||
/* Y/X enables must be both on or both off. */
|
||||
if (mask & (DD_DEPTH_BIT | stcmask)) {
|
||||
if (mask & (BUFFER_BIT_DEPTH | stcmask)) {
|
||||
fbc |= (FFB_FBC_ZE_ON | FFB_FBC_YE_ON | FFB_FBC_WB_C);
|
||||
} else
|
||||
fbc |= FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF;
|
||||
|
||||
/* All RGB enables must be both on or both off. */
|
||||
if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
if (fmesa->back_buffer == 0)
|
||||
fbc |= FFB_FBC_WB_B;
|
||||
else
|
||||
fbc |= FFB_FBC_WB_A;
|
||||
}
|
||||
if (mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
if (fmesa->back_buffer == 0)
|
||||
fbc |= FFB_FBC_WB_A;
|
||||
else
|
||||
|
@ -321,9 +321,9 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
ffb->cmp = 0x80808080;
|
||||
ffb->rop = FFB_ROP_NEW;
|
||||
|
||||
if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT))
|
||||
if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT))
|
||||
ffb->fg = fmesa->clear_pixel;
|
||||
if (mask & DD_DEPTH_BIT)
|
||||
if (mask & BUFFER_BIT_DEPTH)
|
||||
ffb->constz = fmesa->clear_depth;
|
||||
if (mask & stcmask)
|
||||
ffb->consty = fmesa->clear_stencil;
|
||||
|
@ -344,8 +344,8 @@ void ffbDDClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
UNLOCK_HARDWARE(fmesa);
|
||||
|
||||
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT |
|
||||
DD_DEPTH_BIT | stcmask);
|
||||
mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT |
|
||||
BUFFER_BIT_DEPTH | stcmask);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
|
|
|
@ -522,14 +522,14 @@ static void ffbDDSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
|
|||
#endif
|
||||
fbc &= ~(FFB_FBC_RB_MASK);
|
||||
switch (bufferBit) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if (fmesa->back_buffer == 0)
|
||||
fbc |= FFB_FBC_RB_B;
|
||||
else
|
||||
fbc |= FFB_FBC_RB_A;
|
||||
break;
|
||||
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if (fmesa->back_buffer == 0)
|
||||
fbc |= FFB_FBC_RB_A;
|
||||
else
|
||||
|
|
|
@ -515,8 +515,8 @@ ffbMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
* we need to clear all the hw buffers.
|
||||
*/
|
||||
ffbDDClear(fmesa->glCtx,
|
||||
(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT |
|
||||
DD_DEPTH_BIT | DD_STENCIL_BIT),
|
||||
(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT |
|
||||
BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL),
|
||||
1, 0, 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -268,10 +268,10 @@ static void gammaSetBuffer( GLcontext *ctx,
|
|||
gammaContextPtr gmesa = GAMMA_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
gmesa->readOffset = 0;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
gmesa->readOffset = gmesa->driScreen->fbHeight * gmesa->driScreen->fbWidth * gmesa->gammaScreen->cpp;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -230,12 +230,12 @@ static void gammaDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
VALIDATE_DRAWABLE_INFO_NO_LOCK(gmesa);
|
||||
#endif
|
||||
|
||||
if (mask & DD_DEPTH_BIT) {
|
||||
if (mask & BUFFER_BIT_DEPTH) {
|
||||
/* Turn off writes the FB */
|
||||
CHECK_DMA_BUFFER(gmesa, 1);
|
||||
WRITE(gmesa->buf, FBWriteMode, FBWriteModeDisable);
|
||||
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
|
||||
/*
|
||||
* Turn Rectangle2DControl off when the window is not clipped
|
||||
|
@ -349,13 +349,13 @@ static void gammaDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
}
|
||||
}
|
||||
|
||||
if (mask & (DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)) {
|
||||
if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)) {
|
||||
int y = gmesa->driScreen->fbHeight - gmesa->driDrawable->y - gmesa->driDrawable->h;
|
||||
int x = gmesa->driDrawable->x;
|
||||
int w = gmesa->driDrawable->w;
|
||||
int h = gmesa->driDrawable->h;
|
||||
|
||||
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
|
||||
mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
|
||||
|
||||
if (x < 0) { w -= -x; x = 0; }
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "matrix.h"
|
||||
#include "simple_list.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
#include "imports.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
|
@ -245,7 +246,7 @@ i810CreateContext( const __GLcontextModes *mesaVis,
|
|||
ctx->Const.PointSizeGranularity = 1.0;
|
||||
|
||||
ctx->Driver.GetBufferSize = i810BufferSize;
|
||||
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||
ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
|
||||
ctx->Driver.GetString = i810GetString;
|
||||
|
||||
/* Who owns who?
|
||||
|
@ -384,11 +385,12 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa )
|
|||
|
||||
static void i810XMesaWindowMoved( i810ContextPtr imesa )
|
||||
{
|
||||
switch (imesa->glCtx->Color._DrawDestMask[0]) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
/* Determine current color drawing buffer */
|
||||
switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
i810XMesaSetFrontClipRects( imesa );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
i810XMesaSetBackClipRects( imesa );
|
||||
break;
|
||||
default:
|
||||
|
@ -424,16 +426,16 @@ i810MakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
*/
|
||||
imesa->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_make_current2(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
_mesa_make_current(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
|
||||
/* Are these necessary?
|
||||
*/
|
||||
i810XMesaWindowMoved( imesa );
|
||||
}
|
||||
else {
|
||||
_mesa_make_current(0,0);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
@ -445,11 +447,12 @@ i810UpdatePageFlipping( i810ContextPtr imesa )
|
|||
GLcontext *ctx = imesa->glCtx;
|
||||
int front = 0;
|
||||
|
||||
switch (ctx->Color._DrawDestMask[0]) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
/* Determine current color drawing buffer */
|
||||
switch (ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
front = 1;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
front = 0;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -63,20 +63,20 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
I810_FIREVERTICES( imesa );
|
||||
|
||||
if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0U) {
|
||||
if ((mask & BUFFER_BIT_FRONT_LEFT) && colorMask == ~0U) {
|
||||
clear.flags |= I810_FRONT;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0U) {
|
||||
if ((mask & BUFFER_BIT_BACK_LEFT) && colorMask == ~0U) {
|
||||
clear.flags |= I810_BACK;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if (mask & DD_DEPTH_BIT) {
|
||||
if (mask & BUFFER_BIT_DEPTH) {
|
||||
if (ctx->Depth.Mask)
|
||||
clear.flags |= I810_DEPTH;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if (clear.flags) {
|
||||
|
|
|
@ -36,7 +36,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "fbobject.h"
|
||||
#include "matrix.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "simple_list.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -330,22 +333,64 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a buffer which corresponds to the window.
|
||||
*/
|
||||
static GLboolean
|
||||
i810CreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE /* s/w alpha planes */);
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
/*screen->frontOffset*/0, screen->backPitch);
|
||||
i810SetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
i810SetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->backPitch);
|
||||
i810SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,13 +123,13 @@ static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer,
|
|||
(void) buffer;
|
||||
|
||||
switch(bufferBit) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if ( imesa->sarea->pf_current_page == 1)
|
||||
imesa->readMap = imesa->i810Screen->back.map;
|
||||
else
|
||||
imesa->readMap = (char*)imesa->driScreen->pFB;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if ( imesa->sarea->pf_current_page == 1)
|
||||
imesa->readMap = (char*)imesa->driScreen->pFB;
|
||||
else
|
||||
|
@ -165,6 +165,7 @@ void i810InitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
swdd->SetBuffer = i810SetBuffer;
|
||||
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = i810WriteRGBASpan_565;
|
||||
swdd->WriteRGBSpan = i810WriteRGBSpan_565;
|
||||
swdd->WriteMonoRGBASpan = i810WriteMonoRGBASpan_565;
|
||||
|
@ -172,12 +173,60 @@ void i810InitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565;
|
||||
swdd->ReadRGBASpan = i810ReadRGBASpan_565;
|
||||
swdd->ReadRGBAPixels = i810ReadRGBAPixels_565;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = i810ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = i810WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = i810ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = i810WriteDepthPixels_16;
|
||||
#endif
|
||||
|
||||
swdd->SpanRenderStart = i810SpanRenderStart;
|
||||
swdd->SpanRenderFinish = i810SpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
/* always 565 RGB */
|
||||
drb->Base.GetRow = i810ReadRGBASpan_565;
|
||||
drb->Base.GetValues = i810ReadRGBAPixels_565;
|
||||
drb->Base.PutRow = i810WriteRGBASpan_565;
|
||||
drb->Base.PutRowRGB = i810WriteRGBSpan_565;
|
||||
drb->Base.PutMonoRow = i810WriteMonoRGBASpan_565;
|
||||
drb->Base.PutValues = i810WriteRGBAPixels_565;
|
||||
drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = i810ReadDepthSpan_16;
|
||||
drb->Base.GetValues = i810ReadDepthPixels_16;
|
||||
drb->Base.PutRow = i810WriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = i810WriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = i810WriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
/* should never get here */
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
#ifndef _I810_SPAN_H
|
||||
#define _I810_SPAN_H
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void i810InitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void i810SpanRenderFinish( GLcontext *ctx );
|
||||
extern void i810SpanRenderStart( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -285,11 +285,11 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
front = 1;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
front = 0;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "matrix.h"
|
||||
#include "simple_list.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
#include "imports.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
|
@ -305,7 +306,7 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis,
|
|||
ctx->Const.PointSizeGranularity = 1.0;
|
||||
|
||||
ctx->Driver.GetBufferSize = i830BufferSize;
|
||||
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||
ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
|
||||
ctx->Driver.GetString = i830DDGetString;
|
||||
|
||||
/* Who owns who? */
|
||||
|
@ -476,11 +477,11 @@ void i830XMesaSetBackClipRects( i830ContextPtr imesa )
|
|||
|
||||
static void i830XMesaWindowMoved( i830ContextPtr imesa )
|
||||
{
|
||||
switch (imesa->glCtx->Color._DrawDestMask[0]) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
i830XMesaSetFrontClipRects( imesa );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
i830XMesaSetBackClipRects( imesa );
|
||||
break;
|
||||
default:
|
||||
|
@ -527,11 +528,11 @@ GLboolean i830MakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
|
||||
imesa->driReadable = driReadPriv;
|
||||
|
||||
_mesa_make_current2(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
_mesa_make_current(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
} else {
|
||||
_mesa_make_current(0,0);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -186,7 +186,7 @@ static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
|
|||
old_vertex_prim = imesa->hw_primitive;
|
||||
imesa->hw_primitive = PRIM3D_TRIFAN;
|
||||
|
||||
if(mask & DD_FRONT_LEFT_BIT) {
|
||||
if(mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
|
||||
|
||||
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
|
||||
|
@ -248,7 +248,7 @@ static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
|
|||
i830FlushPrimsLocked( imesa );
|
||||
}
|
||||
|
||||
if(mask & DD_BACK_LEFT_BIT) {
|
||||
if(mask & BUFFER_BIT_BACK_LEFT) {
|
||||
GLuint tmp = sarea->ContextState[I830_CTXREG_ENABLES_2];
|
||||
|
||||
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
|
||||
|
@ -311,7 +311,7 @@ static void i830ClearWithTris(GLcontext *ctx, GLbitfield mask,
|
|||
i830FlushPrimsLocked( imesa );
|
||||
}
|
||||
|
||||
if(mask & DD_STENCIL_BIT) {
|
||||
if(mask & BUFFER_BIT_STENCIL) {
|
||||
GLuint s_mask = ctx->Stencil.WriteMask[0];
|
||||
|
||||
sarea->dirty |= (I830_UPLOAD_CTX | I830_UPLOAD_BUFFERS |
|
||||
|
@ -433,40 +433,40 @@ static void i830Clear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
I830_FIREVERTICES( imesa );
|
||||
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
if(colorMask == ~0) {
|
||||
clear.flags |= I830_FRONT;
|
||||
} else {
|
||||
tri_mask |= DD_FRONT_LEFT_BIT;
|
||||
tri_mask |= BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if (mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
if(colorMask == ~0) {
|
||||
clear.flags |= I830_BACK;
|
||||
} else {
|
||||
tri_mask |= DD_BACK_LEFT_BIT;
|
||||
tri_mask |= BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if (mask & DD_DEPTH_BIT) {
|
||||
if (mask & BUFFER_BIT_DEPTH) {
|
||||
clear.flags |= I830_DEPTH;
|
||||
clear.clear_depthmask = imesa->depth_clear_mask;
|
||||
clear.clear_depth = (GLuint)(ctx->Depth.Clear * imesa->ClearDepth);
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if((mask & DD_STENCIL_BIT) && imesa->hw_stencil) {
|
||||
if((mask & BUFFER_BIT_STENCIL) && imesa->hw_stencil) {
|
||||
if (ctx->Stencil.WriteMask[0] != 0xff) {
|
||||
tri_mask |= DD_STENCIL_BIT;
|
||||
tri_mask |= BUFFER_BIT_STENCIL;
|
||||
} else {
|
||||
clear.flags |= I830_DEPTH;
|
||||
clear.clear_depthmask |= imesa->stencil_clear_mask;
|
||||
clear.clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
|
||||
}
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
|
||||
/* First check for clears that need to happen with triangles */
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#include "context.h"
|
||||
#include "matrix.h"
|
||||
#include "simple_list.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "i830_screen.h"
|
||||
#include "i830_dri.h"
|
||||
|
@ -54,6 +56,7 @@
|
|||
|
||||
#include "utils.h"
|
||||
#include "xmlpool.h"
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
PUBLIC const char __driConfigOptions[] =
|
||||
DRI_CONF_BEGIN
|
||||
|
@ -310,27 +313,94 @@ static void i830DestroyScreen(__DRIscreenPrivate *sPriv)
|
|||
sPriv->private = NULL;
|
||||
}
|
||||
|
||||
|
||||
static GLboolean i830CreateBuffer(__DRIscreenPrivate *driScrnPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
i830ScreenPrivate *screen = (i830ScreenPrivate *) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
|
||||
mesaVis->depthBits != 24);
|
||||
#else
|
||||
GLboolean swStencil = mesaVis->stencilBits > 0;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE /* s/w alpha planes */);
|
||||
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
/*screen->frontOffset*/0, screen->backPitch);
|
||||
i830SetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
i830SetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->backPitch);
|
||||
i830SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
if (mesaVis->stencilBits == 8) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->backPitch);
|
||||
i830SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else {
|
||||
/* not really 32-bit Z, but use GL_DEPTH_COMPONENT32 anyway */
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
|
||||
screen->depthOffset, screen->backPitch);
|
||||
i830SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->backPitch);
|
||||
i830SetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,10 +275,10 @@ static void i830SetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
|
|||
imesa->mesa_drawable = (colorBuffer == imesa->driDrawable->driverPrivate)
|
||||
? imesa->driDrawable : imesa->driReadable;
|
||||
|
||||
if (bufferBit == DD_FRONT_LEFT_BIT) {
|
||||
if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
|
||||
imesa->drawMap = (char *)imesa->driScreen->pFB;
|
||||
imesa->readMap = (char *)imesa->driScreen->pFB;
|
||||
} else if (bufferBit == DD_BACK_LEFT_BIT) {
|
||||
} else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
|
||||
imesa->drawMap = imesa->i830Screen->back.map;
|
||||
imesa->readMap = imesa->i830Screen->back.map;
|
||||
} else {
|
||||
|
@ -316,6 +316,7 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch (i830Screen->fbFormat) {
|
||||
case DV_PF_555:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = i830WriteRGBASpan_555;
|
||||
swdd->WriteRGBSpan = i830WriteRGBSpan_555;
|
||||
swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_555;
|
||||
|
@ -323,14 +324,15 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_555;
|
||||
swdd->ReadRGBASpan = i830ReadRGBASpan_555;
|
||||
swdd->ReadRGBAPixels = i830ReadRGBAPixels_555;
|
||||
|
||||
swdd->ReadDepthSpan = i830ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = i830WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = i830ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = i830WriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DV_PF_565:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = i830WriteRGBASpan_565;
|
||||
swdd->WriteRGBSpan = i830WriteRGBSpan_565;
|
||||
swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_565;
|
||||
|
@ -338,14 +340,15 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_565;
|
||||
swdd->ReadRGBASpan = i830ReadRGBASpan_565;
|
||||
swdd->ReadRGBAPixels = i830ReadRGBAPixels_565;
|
||||
|
||||
swdd->ReadDepthSpan = i830ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = i830WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = i830ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = i830WriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DV_PF_8888:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = i830WriteRGBASpan_8888;
|
||||
swdd->WriteRGBSpan = i830WriteRGBSpan_8888;
|
||||
swdd->WriteMonoRGBASpan = i830WriteMonoRGBASpan_8888;
|
||||
|
@ -353,22 +356,26 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = i830WriteMonoRGBAPixels_8888;
|
||||
swdd->ReadRGBASpan = i830ReadRGBASpan_8888;
|
||||
swdd->ReadRGBAPixels = i830ReadRGBAPixels_8888;
|
||||
#endif
|
||||
|
||||
if(imesa->hw_stencil) {
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = i830ReadDepthSpan_24_8;
|
||||
swdd->WriteDepthSpan = i830WriteDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = i830ReadDepthPixels_24_8;
|
||||
swdd->WriteDepthPixels = i830WriteDepthPixels_24_8;
|
||||
|
||||
swdd->WriteStencilSpan = i830WriteStencilSpan_24_8;
|
||||
swdd->ReadStencilSpan = i830ReadStencilSpan_24_8;
|
||||
swdd->WriteStencilPixels = i830WriteStencilPixels_24_8;
|
||||
swdd->ReadStencilPixels = i830ReadStencilPixels_24_8;
|
||||
#endif
|
||||
} else {
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = i830ReadDepthSpan_24;
|
||||
swdd->WriteDepthSpan = i830WriteDepthSpan_24;
|
||||
swdd->ReadDepthPixels = i830ReadDepthPixels_24;
|
||||
swdd->WriteDepthPixels = i830WriteDepthPixels_24;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -376,3 +383,77 @@ void i830DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->SpanRenderStart = i830SpanRenderStart;
|
||||
swdd->SpanRenderFinish = i830SpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
i830SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = i830ReadRGBASpan_555;
|
||||
drb->Base.GetValues = i830ReadRGBAPixels_555;
|
||||
drb->Base.PutRow = i830WriteRGBASpan_555;
|
||||
drb->Base.PutRowRGB = i830WriteRGBSpan_555;
|
||||
drb->Base.PutMonoRow = i830WriteMonoRGBASpan_555;
|
||||
drb->Base.PutValues = i830WriteRGBAPixels_555;
|
||||
drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_555;
|
||||
}
|
||||
else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = i830ReadRGBASpan_565;
|
||||
drb->Base.GetValues = i830ReadRGBAPixels_565;
|
||||
drb->Base.PutRow = i830WriteRGBASpan_565;
|
||||
drb->Base.PutRowRGB = i830WriteRGBSpan_565;
|
||||
drb->Base.PutMonoRow = i830WriteMonoRGBASpan_565;
|
||||
drb->Base.PutValues = i830WriteRGBAPixels_565;
|
||||
drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_565;
|
||||
}
|
||||
else {
|
||||
assert(vis->redBits == 8);
|
||||
assert(vis->greenBits == 8);
|
||||
assert(vis->blueBits == 8);
|
||||
drb->Base.GetRow = i830ReadRGBASpan_8888;
|
||||
drb->Base.GetValues = i830ReadRGBAPixels_8888;
|
||||
drb->Base.PutRow = i830WriteRGBASpan_8888;
|
||||
drb->Base.PutRowRGB = i830WriteRGBSpan_8888;
|
||||
drb->Base.PutMonoRow = i830WriteMonoRGBASpan_8888;
|
||||
drb->Base.PutValues = i830WriteRGBAPixels_8888;
|
||||
drb->Base.PutMonoValues = i830WriteMonoRGBAPixels_8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = i830ReadDepthSpan_16;
|
||||
drb->Base.GetValues = i830ReadDepthPixels_16;
|
||||
drb->Base.PutRow = i830WriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = i830WriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = i830WriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = i830ReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = i830ReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = i830WriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = i830WriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = i830WriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
|
||||
/* not _really_ 32-bit Z */
|
||||
drb->Base.GetRow = i830ReadDepthSpan_24;
|
||||
drb->Base.GetValues = i830ReadDepthPixels_24;
|
||||
drb->Base.PutRow = i830WriteDepthSpan_24;
|
||||
drb->Base.PutMonoRow = i830WriteMonoDepthSpan_24;
|
||||
drb->Base.PutValues = i830WriteDepthPixels_24;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = i830ReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = i830ReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = i830WriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = i830WriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = i830WriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,14 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef _I830_SPAN_H
|
||||
#define _I830_SPAN_H
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void i830DDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void i830SpanRenderFinish( GLcontext *ctx );
|
||||
extern void i830SpanRenderStart( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
i830SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -802,17 +802,17 @@ static void i830DrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
i830ContextPtr imesa = I830_CONTEXT(ctx);
|
||||
|
||||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
* _ColorDrawBufferMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
I830_FIREVERTICES(imesa);
|
||||
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
|
||||
imesa->BufferSetup[I830_DESTREG_CBUFADDR] = imesa->i830Screen->fbOffset;
|
||||
i830XMesaSetFrontClipRects( imesa );
|
||||
FALLBACK( imesa, I830_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
I830_FIREVERTICES(imesa);
|
||||
I830_STATECHANGE(imesa, I830_UPLOAD_BUFFERS);
|
||||
imesa->BufferSetup[I830_DESTREG_CBUFADDR] =
|
||||
|
|
|
@ -386,7 +386,7 @@ i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
* The active cliprects will be applied as for any other geometry.
|
||||
*/
|
||||
|
||||
if(mask & DD_FRONT_LEFT_BIT) {
|
||||
if(mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
set_no_depth_stencil_write( i830 );
|
||||
set_color_mask( i830, GL_TRUE );
|
||||
set_draw_offset( i830, screen->frontOffset );
|
||||
|
@ -396,7 +396,7 @@ i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(mask & DD_BACK_LEFT_BIT) {
|
||||
if(mask & BUFFER_BIT_BACK_LEFT) {
|
||||
set_no_depth_stencil_write( i830 );
|
||||
set_color_mask( i830, GL_TRUE );
|
||||
set_draw_offset( i830, screen->backOffset );
|
||||
|
@ -407,7 +407,7 @@ i830ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(mask & DD_STENCIL_BIT) {
|
||||
if(mask & BUFFER_BIT_STENCIL) {
|
||||
set_stencil_replace( i830,
|
||||
intel->ctx.Stencil.WriteMask[0],
|
||||
intel->ctx.Stencil.Clear);
|
||||
|
|
|
@ -475,7 +475,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
* The active cliprects will be applied as for any other geometry.
|
||||
*/
|
||||
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
set_no_depth_stencil_write( i915 );
|
||||
set_color_mask( i915, GL_TRUE );
|
||||
set_draw_offset( i915, screen->frontOffset );
|
||||
|
@ -486,7 +486,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
set_no_depth_stencil_write( i915 );
|
||||
set_color_mask( i915, GL_TRUE );
|
||||
set_draw_offset( i915, screen->backOffset );
|
||||
|
@ -497,7 +497,7 @@ i915ClearWithTris(intelContextPtr intel, GLbitfield mask,
|
|||
0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if(mask & DD_STENCIL_BIT) {
|
||||
if (mask & BUFFER_BIT_STENCIL) {
|
||||
set_stencil_replace( i915,
|
||||
intel->ctx.Stencil.WriteMask[0],
|
||||
intel->ctx.Stencil.Clear);
|
||||
|
|
|
@ -512,11 +512,11 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
clear_color = intel->ClearColor;
|
||||
clear_depth = 0;
|
||||
|
||||
if (flags & DD_DEPTH_BIT) {
|
||||
if (flags & BUFFER_BIT_DEPTH) {
|
||||
clear_depth = (GLuint)(ctx->Depth.Clear * intel->ClearDepth);
|
||||
}
|
||||
|
||||
if (flags & DD_STENCIL_BIT) {
|
||||
if (flags & BUFFER_BIT_STENCIL) {
|
||||
clear_depth |= (ctx->Stencil.Clear & 0xff) << 24;
|
||||
}
|
||||
|
||||
|
@ -531,8 +531,8 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
XY_COLOR_BLT_WRITE_ALPHA |
|
||||
XY_COLOR_BLT_WRITE_RGB);
|
||||
D_CMD = XY_COLOR_BLT_CMD;
|
||||
if (flags & DD_DEPTH_BIT) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
|
||||
if (flags & DD_STENCIL_BIT) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
|
||||
if (flags & BUFFER_BIT_DEPTH) D_CMD |= XY_COLOR_BLT_WRITE_RGB;
|
||||
if (flags & BUFFER_BIT_STENCIL) D_CMD |= XY_COLOR_BLT_WRITE_ALPHA;
|
||||
break;
|
||||
default:
|
||||
BR13 = (0xF0 << 16) | (pitch * cpp) | (1<<24);
|
||||
|
@ -552,9 +552,9 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
if ( intel->sarea->pf_current_page == 1 ) {
|
||||
GLuint tmp = flags;
|
||||
|
||||
flags &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
|
||||
if ( tmp & DD_FRONT_LEFT_BIT ) flags |= DD_BACK_LEFT_BIT;
|
||||
if ( tmp & DD_BACK_LEFT_BIT ) flags |= DD_FRONT_LEFT_BIT;
|
||||
flags &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
|
||||
if ( tmp & BUFFER_BIT_FRONT_LEFT ) flags |= BUFFER_BIT_BACK_LEFT;
|
||||
if ( tmp & BUFFER_BIT_BACK_LEFT ) flags |= BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
for (i = 0 ; i < intel->numClipRects ; i++)
|
||||
|
@ -590,7 +590,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
b.y2 > intelScreen->height)
|
||||
continue;
|
||||
|
||||
if ( flags & DD_FRONT_LEFT_BIT ) {
|
||||
if ( flags & BUFFER_BIT_FRONT_LEFT ) {
|
||||
BEGIN_BATCH( 6);
|
||||
OUT_BATCH( CMD );
|
||||
OUT_BATCH( BR13 );
|
||||
|
@ -601,7 +601,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
ADVANCE_BATCH();
|
||||
}
|
||||
|
||||
if ( flags & DD_BACK_LEFT_BIT ) {
|
||||
if ( flags & BUFFER_BIT_BACK_LEFT ) {
|
||||
BEGIN_BATCH( 6);
|
||||
OUT_BATCH( CMD );
|
||||
OUT_BATCH( BR13 );
|
||||
|
@ -612,7 +612,7 @@ void intelClearWithBlit(GLcontext *ctx, GLbitfield flags, GLboolean all,
|
|||
ADVANCE_BATCH();
|
||||
}
|
||||
|
||||
if ( flags & (DD_STENCIL_BIT | DD_DEPTH_BIT) ) {
|
||||
if ( flags & (BUFFER_BIT_STENCIL | BUFFER_BIT_DEPTH) ) {
|
||||
BEGIN_BATCH( 6);
|
||||
OUT_BATCH( D_CMD );
|
||||
OUT_BATCH( BR13 );
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "matrix.h"
|
||||
#include "simple_list.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
#include "imports.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
|
@ -235,7 +236,7 @@ void intelInitDriverFunctions( struct dd_function_table *functions )
|
|||
functions->Clear = intelClear;
|
||||
functions->Finish = intelFinish;
|
||||
functions->GetBufferSize = intelBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = intelGetString;
|
||||
functions->UpdateState = intelInvalidateState;
|
||||
functions->CopyColorTable = _swrast_CopyColorTable;
|
||||
|
@ -493,11 +494,11 @@ void intelSetBackClipRects( intelContextPtr intel )
|
|||
|
||||
void intelWindowMoved( intelContextPtr intel )
|
||||
{
|
||||
switch (intel->ctx.Color._DrawDestMask[0]) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
intelSetFrontClipRects( intel );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
intelSetBackClipRects( intel );
|
||||
break;
|
||||
default:
|
||||
|
@ -525,11 +526,11 @@ GLboolean intelMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
intelWindowMoved( intel );
|
||||
}
|
||||
|
||||
_mesa_make_current2(&intel->ctx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
_mesa_make_current(&intel->ctx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
} else {
|
||||
_mesa_make_current(0,0);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -348,41 +348,41 @@ void intelClear(GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
*/
|
||||
intelFlush( &intel->ctx );
|
||||
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
if (colorMask == ~0) {
|
||||
blit_mask |= DD_FRONT_LEFT_BIT;
|
||||
blit_mask |= BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
else {
|
||||
tri_mask |= DD_FRONT_LEFT_BIT;
|
||||
tri_mask |= BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
if (colorMask == ~0) {
|
||||
blit_mask |= DD_BACK_LEFT_BIT;
|
||||
blit_mask |= BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
else {
|
||||
tri_mask |= DD_BACK_LEFT_BIT;
|
||||
tri_mask |= BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask & DD_DEPTH_BIT) {
|
||||
blit_mask |= DD_DEPTH_BIT;
|
||||
if (mask & BUFFER_BIT_DEPTH) {
|
||||
blit_mask |= BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if (mask & DD_STENCIL_BIT) {
|
||||
if (mask & BUFFER_BIT_STENCIL) {
|
||||
if (!intel->hw_stencil) {
|
||||
swrast_mask |= DD_STENCIL_BIT;
|
||||
swrast_mask |= BUFFER_BIT_STENCIL;
|
||||
}
|
||||
else if (ctx->Stencil.WriteMask[0] != 0xff) {
|
||||
tri_mask |= DD_STENCIL_BIT;
|
||||
tri_mask |= BUFFER_BIT_STENCIL;
|
||||
}
|
||||
else {
|
||||
blit_mask |= DD_STENCIL_BIT;
|
||||
blit_mask |= BUFFER_BIT_STENCIL;
|
||||
}
|
||||
}
|
||||
|
||||
swrast_mask |= (mask & DD_ACCUM_BIT);
|
||||
swrast_mask |= (mask & BUFFER_BIT_ACCUM);
|
||||
|
||||
if (blit_mask)
|
||||
intelClearWithBlit( ctx, blit_mask, all, cx, cy, cw, ch );
|
||||
|
|
|
@ -27,7 +27,9 @@
|
|||
|
||||
#include "glheader.h"
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "matrix.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "simple_list.h"
|
||||
#include "utils.h"
|
||||
#include "xmlpool.h"
|
||||
|
@ -233,24 +235,78 @@ static void intelDestroyScreen(__DRIscreenPrivate *sPriv)
|
|||
sPriv->private = NULL;
|
||||
}
|
||||
|
||||
|
||||
static GLboolean intelCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
intelScreenPrivate *screen = (intelScreenPrivate *) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
} else {
|
||||
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
|
||||
mesaVis->depthBits != 24);
|
||||
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE /* s/w alpha planes */);
|
||||
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
intelSetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
intelSetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
intelSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
intelSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
intelSetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,10 +247,10 @@ static void intelSetBuffer(GLcontext *ctx, GLframebuffer *colorBuffer,
|
|||
GLuint bufferBit)
|
||||
{
|
||||
intelContextPtr intel = INTEL_CONTEXT(ctx);
|
||||
if (bufferBit == DD_FRONT_LEFT_BIT) {
|
||||
if (bufferBit == BUFFER_BIT_FRONT_LEFT) {
|
||||
intel->drawMap = (char *)intel->driScreen->pFB;
|
||||
intel->readMap = (char *)intel->driScreen->pFB;
|
||||
} else if (bufferBit == DD_BACK_LEFT_BIT) {
|
||||
} else if (bufferBit == BUFFER_BIT_BACK_LEFT) {
|
||||
intel->drawMap = intel->intelScreen->back.map;
|
||||
intel->readMap = intel->intelScreen->back.map;
|
||||
} else {
|
||||
|
@ -288,6 +288,7 @@ void intelInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch (intelScreen->fbFormat) {
|
||||
case DV_PF_555:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = intelWriteRGBASpan_555;
|
||||
swdd->WriteRGBSpan = intelWriteRGBSpan_555;
|
||||
swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_555;
|
||||
|
@ -295,14 +296,15 @@ void intelInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_555;
|
||||
swdd->ReadRGBASpan = intelReadRGBASpan_555;
|
||||
swdd->ReadRGBAPixels = intelReadRGBAPixels_555;
|
||||
|
||||
swdd->ReadDepthSpan = intelReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = intelWriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = intelReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = intelWriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DV_PF_565:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = intelWriteRGBASpan_565;
|
||||
swdd->WriteRGBSpan = intelWriteRGBSpan_565;
|
||||
swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_565;
|
||||
|
@ -310,14 +312,15 @@ void intelInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_565;
|
||||
swdd->ReadRGBASpan = intelReadRGBASpan_565;
|
||||
swdd->ReadRGBAPixels = intelReadRGBAPixels_565;
|
||||
|
||||
swdd->ReadDepthSpan = intelReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = intelWriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = intelReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = intelWriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case DV_PF_8888:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = intelWriteRGBASpan_8888;
|
||||
swdd->WriteRGBSpan = intelWriteRGBSpan_8888;
|
||||
swdd->WriteMonoRGBASpan = intelWriteMonoRGBASpan_8888;
|
||||
|
@ -325,7 +328,6 @@ void intelInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = intelWriteMonoRGBAPixels_8888;
|
||||
swdd->ReadRGBASpan = intelReadRGBASpan_8888;
|
||||
swdd->ReadRGBAPixels = intelReadRGBAPixels_8888;
|
||||
|
||||
swdd->ReadDepthSpan = intelReadDepthSpan_24_8;
|
||||
swdd->WriteDepthSpan = intelWriteDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = intelReadDepthPixels_24_8;
|
||||
|
@ -335,9 +337,75 @@ void intelInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadStencilSpan = intelReadStencilSpan_24_8;
|
||||
swdd->WriteStencilPixels = intelWriteStencilPixels_24_8;
|
||||
swdd->ReadStencilPixels = intelReadStencilPixels_24_8;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
swdd->SpanRenderStart = intelSpanRenderStart;
|
||||
swdd->SpanRenderFinish = intelSpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
intelSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = intelReadRGBASpan_555;
|
||||
drb->Base.GetValues = intelReadRGBAPixels_555;
|
||||
drb->Base.PutRow = intelWriteRGBASpan_555;
|
||||
drb->Base.PutRowRGB = intelWriteRGBSpan_555;
|
||||
drb->Base.PutMonoRow = intelWriteMonoRGBASpan_555;
|
||||
drb->Base.PutValues = intelWriteRGBAPixels_555;
|
||||
drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_555;
|
||||
}
|
||||
else if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = intelReadRGBASpan_565;
|
||||
drb->Base.GetValues = intelReadRGBAPixels_565;
|
||||
drb->Base.PutRow = intelWriteRGBASpan_565;
|
||||
drb->Base.PutRowRGB = intelWriteRGBSpan_565;
|
||||
drb->Base.PutMonoRow = intelWriteMonoRGBASpan_565;
|
||||
drb->Base.PutValues = intelWriteRGBAPixels_565;
|
||||
drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_565;
|
||||
}
|
||||
else {
|
||||
assert(vis->redBits == 8);
|
||||
assert(vis->greenBits == 8);
|
||||
assert(vis->blueBits == 8);
|
||||
drb->Base.GetRow = intelReadRGBASpan_8888;
|
||||
drb->Base.GetValues = intelReadRGBAPixels_8888;
|
||||
drb->Base.PutRow = intelWriteRGBASpan_8888;
|
||||
drb->Base.PutRowRGB = intelWriteRGBSpan_8888;
|
||||
drb->Base.PutMonoRow = intelWriteMonoRGBASpan_8888;
|
||||
drb->Base.PutValues = intelWriteRGBAPixels_8888;
|
||||
drb->Base.PutMonoValues = intelWriteMonoRGBAPixels_8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = intelReadDepthSpan_16;
|
||||
drb->Base.GetValues = intelReadDepthPixels_16;
|
||||
drb->Base.PutRow = intelWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = intelWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = intelWriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = intelReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = intelReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = intelWriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = intelWriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = intelWriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = intelReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = intelReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = intelWriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = intelWriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = intelWriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,14 @@
|
|||
#ifndef _INTEL_SPAN_H
|
||||
#define _INTEL_SPAN_H
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void intelInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void intelSpanRenderFinish( GLcontext *ctx );
|
||||
extern void intelSpanRenderStart( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
intelSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -170,12 +170,12 @@ static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
intelScreenPrivate *screen = intel->intelScreen;
|
||||
int front = 0;
|
||||
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
front = 1;
|
||||
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
front = 0;
|
||||
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
|
|
|
@ -306,14 +306,14 @@ mach64MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
mach64CalcViewport( newMach64Ctx->glCtx );
|
||||
}
|
||||
|
||||
_mesa_make_current2( newMach64Ctx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newMach64Ctx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
|
||||
newMach64Ctx->new_state |= MACH64_NEW_CLIP;
|
||||
} else {
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
|
||||
#include "context.h"
|
||||
#include "utils.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#define DRIVER_DATE "20030502"
|
||||
|
||||
|
@ -126,7 +127,7 @@ static void mach64DDFinish( GLcontext *ctx )
|
|||
void mach64InitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = mach64DDGetBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = mach64DDGetString;
|
||||
functions->Finish = mach64DDFinish;
|
||||
functions->Flush = mach64DDFlush;
|
||||
|
|
|
@ -683,19 +683,19 @@ static void mach64DDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
mmesa->new_state = save_state & ~(MACH64_NEW_MASKS | MACH64_NEW_CLIP);
|
||||
}
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT ) {
|
||||
flags |= MACH64_FRONT;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_BACK_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_BACK_LEFT ) {
|
||||
flags |= MACH64_BACK;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) {
|
||||
if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
|
||||
flags |= MACH64_DEPTH;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if ( mask )
|
||||
|
|
|
@ -69,7 +69,7 @@ void mach64GetLock( mach64ContextPtr mmesa, GLuint flags )
|
|||
|
||||
if ( mmesa->lastStamp != dPriv->lastStamp ) {
|
||||
mmesa->lastStamp = dPriv->lastStamp;
|
||||
if (mmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT)
|
||||
if (mmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
|
||||
mach64SetCliprects( mmesa->glCtx, GL_BACK_LEFT );
|
||||
else
|
||||
mach64SetCliprects( mmesa->glCtx, GL_FRONT_LEFT );
|
||||
|
|
|
@ -33,9 +33,12 @@
|
|||
#include "mach64_ioctl.h"
|
||||
#include "mach64_tris.h"
|
||||
#include "mach64_vb.h"
|
||||
#include "mach64_span.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "imports.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "vblank.h"
|
||||
|
@ -355,6 +358,7 @@ mach64DestroyScreen( __DRIscreenPrivate *driScreen )
|
|||
driScreen->private = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Create and initialize the Mesa and driver specific pixmap buffer
|
||||
* data.
|
||||
*/
|
||||
|
@ -364,16 +368,62 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
mach64ScreenPtr screen = (mach64ScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer( mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0 );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
mach64SetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
mach64SetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mach64SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mach64SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,15 +200,15 @@ static void mach64DDSetBuffer( GLcontext *ctx,
|
|||
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
|
||||
fprintf(stderr,"%s: DD_FRONT_LEFT_BIT\n", __FUNCTION__);
|
||||
fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
|
||||
mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->frontOffset;
|
||||
mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->frontPitch;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
|
||||
fprintf(stderr,"%s: DD_BACK_LEFT_BIT\n", __FUNCTION__);
|
||||
fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
|
||||
mmesa->drawOffset = mmesa->readOffset = mmesa->mach64Screen->backOffset;
|
||||
mmesa->drawPitch = mmesa->readPitch = mmesa->mach64Screen->backPitch;
|
||||
break;
|
||||
|
@ -220,12 +220,14 @@ static void mach64DDSetBuffer( GLcontext *ctx,
|
|||
|
||||
void mach64DDInitSpanFuncs( GLcontext *ctx )
|
||||
{
|
||||
#if 0
|
||||
mach64ContextPtr mmesa = MACH64_CONTEXT(ctx);
|
||||
#endif
|
||||
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
|
||||
|
||||
swdd->SetBuffer = mach64DDSetBuffer;
|
||||
|
||||
|
||||
#if 0
|
||||
switch ( mmesa->mach64Screen->cpp ) {
|
||||
case 2:
|
||||
swdd->WriteRGBASpan = mach64WriteRGBASpan_RGB565;
|
||||
|
@ -251,13 +253,15 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Depth buffer is always 16 bit */
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = mach64ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = mach64WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = mach64ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = mach64WriteDepthPixels_16;
|
||||
|
||||
#endif
|
||||
/* No hardware stencil buffer */
|
||||
swdd->ReadStencilSpan = NULL;
|
||||
swdd->WriteStencilSpan = NULL;
|
||||
|
@ -272,3 +276,58 @@ void mach64DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadCI32Span = NULL;
|
||||
swdd->ReadCI32Pixels = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = mach64ReadRGBASpan_RGB565;
|
||||
drb->Base.GetValues = mach64ReadRGBAPixels_RGB565;
|
||||
drb->Base.PutRow = mach64WriteRGBASpan_RGB565;
|
||||
drb->Base.PutRowRGB = mach64WriteRGBSpan_RGB565;
|
||||
drb->Base.PutMonoRow = mach64WriteMonoRGBASpan_RGB565;
|
||||
drb->Base.PutValues = mach64WriteRGBAPixels_RGB565;
|
||||
drb->Base.PutMonoValues = mach64WriteMonoRGBAPixels_RGB565;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = mach64ReadRGBASpan_ARGB8888;
|
||||
drb->Base.GetValues = mach64ReadRGBAPixels_ARGB8888;
|
||||
drb->Base.PutRow = mach64WriteRGBASpan_ARGB8888;
|
||||
drb->Base.PutRowRGB = mach64WriteRGBSpan_ARGB8888;
|
||||
drb->Base.PutMonoRow = mach64WriteMonoRGBASpan_ARGB8888;
|
||||
drb->Base.PutValues = mach64WriteRGBAPixels_ARGB8888;
|
||||
drb->Base.PutMonoValues = mach64WriteMonoRGBAPixels_ARGB8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = mach64ReadDepthSpan_16;
|
||||
drb->Base.GetValues = mach64ReadDepthPixels_16;
|
||||
drb->Base.PutRow = mach64WriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = mach64WriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = mach64WriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
/* never */
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
/* never */
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
#ifndef __MACH64_SPAN_H__
|
||||
#define __MACH64_SPAN_H__
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void mach64DDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
mach64SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -732,18 +732,18 @@ static void mach64DDDrawBuffer( GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
mach64SetCliprects( ctx, GL_FRONT_LEFT );
|
||||
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
|
||||
fprintf(stderr,"%s: DD_FRONT_LEFT_BIT\n", __FUNCTION__);
|
||||
fprintf(stderr,"%s: BUFFER_BIT_FRONT_LEFT\n", __FUNCTION__);
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
FALLBACK( mmesa, MACH64_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
mach64SetCliprects( ctx, GL_BACK_LEFT );
|
||||
if (MACH64_DEBUG & DEBUG_VERBOSE_MSG)
|
||||
fprintf(stderr,"%s: DD_BACK_LEFT_BIT\n", __FUNCTION__);
|
||||
fprintf(stderr,"%s: BUFFER_BIT_BACK_LEFT\n", __FUNCTION__);
|
||||
break;
|
||||
default:
|
||||
/* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "matrix.h"
|
||||
#include "simple_list.h"
|
||||
#include "imports.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
@ -55,7 +57,6 @@
|
|||
#include "mga_xmesa.h"
|
||||
#include "mga_dri.h"
|
||||
|
||||
|
||||
#include "utils.h"
|
||||
#include "vblank.h"
|
||||
|
||||
|
@ -721,6 +722,8 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
mgaScreenPrivate *screen = (mgaScreenPrivate *) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
|
@ -728,12 +731,81 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
|
||||
mesaVis->depthBits != 24);
|
||||
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0 );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
mgaSetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
mgaSetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mgaSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
/* XXX is this right? */
|
||||
if (mesaVis->stencilBits) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mgaSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mgaSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
}
|
||||
else if (mesaVis->depthBits == 32) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mgaSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
mgaSetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
|
@ -799,12 +871,12 @@ mgaMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
|
||||
mmesa->driReadable = driReadPriv;
|
||||
|
||||
_mesa_make_current2(mmesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
_mesa_make_current(mmesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
}
|
||||
else {
|
||||
_mesa_make_current(NULL, NULL);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -83,6 +83,17 @@ typedef struct mga_screen_private_s {
|
|||
} mgaScreenPrivate;
|
||||
|
||||
|
||||
/**
|
||||
* mgaRenderbuffer, derived from Mesa's gl_renderbuffer
|
||||
*/
|
||||
typedef struct {
|
||||
struct gl_renderbuffer Base;
|
||||
/* XXX per-window info should go here */
|
||||
int foo, bar;
|
||||
} mgaRenderbuffer;
|
||||
|
||||
|
||||
|
||||
#include "mgacontext.h"
|
||||
|
||||
extern void mgaGetLock( mgaContextPtr mmesa, GLuint flags );
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "mm.h"
|
||||
#include "mgacontext.h"
|
||||
|
@ -92,6 +93,6 @@ static void mgaBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height)
|
|||
void mgaInitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = mgaBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = mgaGetString;
|
||||
}
|
||||
|
|
|
@ -175,30 +175,30 @@ mgaClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
FLUSH_BATCH( mmesa );
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT ) {
|
||||
flags |= MGA_FRONT;
|
||||
color_mask = mmesa->setup.plnwt;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_BACK_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_BACK_LEFT ) {
|
||||
flags |= MGA_BACK;
|
||||
color_mask = mmesa->setup.plnwt;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ( (mask & DD_DEPTH_BIT) && ctx->Depth.Mask ) {
|
||||
if ( (mask & BUFFER_BIT_DEPTH) && ctx->Depth.Mask ) {
|
||||
flags |= MGA_DEPTH;
|
||||
clear_depth = (mmesa->ClearDepth & mmesa->depth_clear_mask);
|
||||
depth_mask |= mmesa->depth_clear_mask;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if ( (mask & DD_STENCIL_BIT) && mmesa->hw_stencil ) {
|
||||
if ( (mask & BUFFER_BIT_STENCIL) && mmesa->hw_stencil ) {
|
||||
flags |= MGA_DEPTH;
|
||||
clear_depth |= (ctx->Stencil.Clear & mmesa->stencil_clear_mask);
|
||||
depth_mask |= mmesa->stencil_clear_mask;
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
|
||||
if ( flags ) {
|
||||
|
|
|
@ -204,9 +204,9 @@ static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
|
|||
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
|
||||
unsigned int offset;
|
||||
|
||||
assert((bufferBit == DD_FRONT_LEFT_BIT) || (bufferBit == DD_BACK_LEFT_BIT));
|
||||
assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
|
||||
|
||||
offset = (bufferBit == DD_FRONT_LEFT_BIT)
|
||||
offset = (bufferBit == BUFFER_BIT_FRONT_LEFT)
|
||||
? mmesa->mgaScreen->frontOffset
|
||||
: mmesa->mgaScreen->backOffset;
|
||||
|
||||
|
@ -237,15 +237,17 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch (mmesa->mgaScreen->cpp) {
|
||||
case 2:
|
||||
#if 0
|
||||
mgaInitPointers_565( swdd );
|
||||
|
||||
swdd->ReadDepthSpan = mgaReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = mgaWriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = mgaReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = mgaWriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#if 0
|
||||
mgaInitPointers_8888( swdd );
|
||||
|
||||
if (!mmesa->hw_stencil) {
|
||||
|
@ -264,6 +266,57 @@ void mgaDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadStencilPixels = mgaReadStencilPixels_24_8;
|
||||
swdd->WriteStencilPixels = mgaWriteStencilPixels_24_8;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
mgaInitPointers_565(&drb->Base);
|
||||
}
|
||||
else {
|
||||
mgaInitPointers_8888(&drb->Base);
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = mgaReadDepthSpan_16;
|
||||
drb->Base.GetValues = mgaReadDepthPixels_16;
|
||||
drb->Base.PutRow = mgaWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = mgaWriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = mgaReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = mgaReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = mgaWriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = mgaWriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
|
||||
drb->Base.GetRow = mgaReadDepthSpan_32;
|
||||
drb->Base.GetValues = mgaReadDepthPixels_32;
|
||||
drb->Base.PutRow = mgaWriteDepthSpan_32;
|
||||
drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_32;
|
||||
drb->Base.PutValues = mgaWriteDepthPixels_32;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = mgaReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = mgaReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = mgaWriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = mgaWriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = mgaWriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#ifndef _MGA_SPAN_H
|
||||
#define _MGA_SPAN_H
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void mgaDDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
mgaSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -825,15 +825,15 @@ static void mgaDDDrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
mmesa->setup.dstorg = mmesa->mgaScreen->frontOffset;
|
||||
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
|
||||
mmesa->draw_buffer = MGA_FRONT;
|
||||
mgaXMesaSetFrontClipRects( mmesa );
|
||||
FALLBACK( ctx, MGA_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
mmesa->setup.dstorg = mmesa->mgaScreen->backOffset;
|
||||
mmesa->draw_buffer = MGA_BACK;
|
||||
mmesa->dirty |= MGA_UPLOAD_CONTEXT;
|
||||
|
|
|
@ -337,13 +337,13 @@ r128MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
driDrawableInitVBlank( driDrawPriv, newR128Ctx->vblank_flags );
|
||||
newR128Ctx->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_make_current2( newR128Ctx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newR128Ctx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
newR128Ctx->new_state |= R128_NEW_WINDOW | R128_NEW_CLIP;
|
||||
} else {
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -40,6 +40,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "swrast/swrast.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -140,7 +141,7 @@ static void r128Finish( GLcontext *ctx )
|
|||
void r128InitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = r128GetBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = r128GetString;
|
||||
functions->Finish = r128Finish;
|
||||
functions->Flush = r128Flush;
|
||||
|
|
|
@ -429,25 +429,25 @@ static void r128Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
rmesa->new_state = save_state & ~R128_NEW_MASKS;
|
||||
}
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT ) {
|
||||
flags |= R128_FRONT;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_BACK_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_BACK_LEFT ) {
|
||||
flags |= R128_BACK;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ( ( mask & DD_DEPTH_BIT ) && ctx->Depth.Mask ) {
|
||||
if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) {
|
||||
flags |= R128_DEPTH;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
#if 0
|
||||
/* FIXME: Add stencil support */
|
||||
if ( mask & DD_STENCIL_BIT ) {
|
||||
if ( mask & BUFFER_BIT_STENCIL ) {
|
||||
flags |= DRM_R128_DEPTH_BUFFER;
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ r128UpdatePageFlipping( r128ContextPtr rmesa )
|
|||
|
||||
rmesa->doPageFlip = rmesa->sarea->pfAllowPageFlip;
|
||||
|
||||
use_back = (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT);
|
||||
use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
|
||||
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
|
||||
|
||||
if ( R128_DEBUG & DEBUG_VERBOSE_API )
|
||||
|
|
|
@ -37,10 +37,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "r128_context.h"
|
||||
#include "r128_ioctl.h"
|
||||
#include "r128_span.h"
|
||||
#include "r128_tris.h"
|
||||
|
||||
#include "context.h"
|
||||
#include "imports.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "vblank.h"
|
||||
|
@ -260,16 +263,62 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
r128ScreenPtr screen = (r128ScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer( mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0 );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
r128SetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
r128SetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
r128SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
r128SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ static void r128DDSetBuffer( GLcontext *ctx,
|
|||
r128ContextPtr rmesa = R128_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if ( rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->backOffset;
|
||||
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->backPitch;
|
||||
|
@ -344,7 +344,7 @@ static void r128DDSetBuffer( GLcontext *ctx,
|
|||
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
|
||||
}
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if ( rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->drawOffset = rmesa->readOffset = rmesa->r128Screen->frontOffset;
|
||||
rmesa->drawPitch = rmesa->readPitch = rmesa->r128Screen->frontPitch;
|
||||
|
@ -368,11 +368,15 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->r128Screen->cpp ) {
|
||||
case 2:
|
||||
#if 0
|
||||
r128InitPointers_RGB565( swdd );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#if 0
|
||||
r128InitPointers_ARGB8888( swdd );
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -381,17 +385,21 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->glCtx->Visual.depthBits ) {
|
||||
case 16:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = r128ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = r128WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = r128ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = r128WriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 24:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = r128ReadDepthSpan_24_8;
|
||||
swdd->WriteDepthSpan = r128WriteDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = r128ReadDepthPixels_24_8;
|
||||
swdd->WriteDepthPixels = r128WriteDepthPixels_24_8;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -406,3 +414,44 @@ void r128DDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadCI32Span = NULL;
|
||||
swdd->ReadCI32Pixels = NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
r128InitPointers_RGB565(&drb->Base);
|
||||
}
|
||||
else {
|
||||
r128InitPointers_ARGB8888(&drb->Base);
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = r128ReadDepthSpan_16;
|
||||
drb->Base.GetValues = r128ReadDepthPixels_16;
|
||||
drb->Base.PutRow = r128WriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = r128WriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = r128WriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = r128ReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = r128ReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = r128WriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = r128WriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = r128WriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef __R128_SPAN_H__
|
||||
#define __R128_SPAN_H__
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void r128DDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
r128SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -714,13 +714,13 @@ static void r128DDDrawBuffer( GLcontext *ctx, GLenum mode )
|
|||
FLUSH_BATCH( rmesa );
|
||||
|
||||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
* _ColorDrawBufferMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
FALLBACK( rmesa, R128_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -40,6 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "imports.h"
|
||||
#include "matrix.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
#include "state.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
|
@ -192,7 +193,7 @@ static const struct tnl_pipeline_stage *r200_pipeline[] = {
|
|||
static void r200InitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = r200GetBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = r200GetString;
|
||||
|
||||
functions->Error = NULL;
|
||||
|
@ -455,7 +456,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
|||
/* plug in a few more device driver functions */
|
||||
/* XXX these should really go right after _mesa_init_driver_functions() */
|
||||
r200InitPixelFuncs( ctx );
|
||||
#if 0
|
||||
r200InitSpanFuncs( ctx );
|
||||
#endif
|
||||
r200InitTnlFuncs( ctx );
|
||||
r200InitState( rmesa );
|
||||
r200InitSwtcl( ctx );
|
||||
|
@ -533,7 +536,7 @@ void r200DestroyContext( __DRIcontextPrivate *driContextPriv )
|
|||
/* check if we're deleting the currently bound context */
|
||||
if (rmesa == current) {
|
||||
R200_FIREVERTICES( rmesa );
|
||||
_mesa_make_current2(NULL, NULL, NULL);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Free r200 context resources */
|
||||
|
@ -642,9 +645,9 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
r200UpdateViewportOffset( newCtx->glCtx );
|
||||
}
|
||||
|
||||
_mesa_make_current2( newCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
if (newCtx->vb.enabled)
|
||||
r200VtxfmtMakeCurrent( newCtx->glCtx );
|
||||
|
@ -655,7 +658,7 @@ r200MakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
} else {
|
||||
if (R200_DEBUG & DEBUG_DRI)
|
||||
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
|
||||
_mesa_make_current( NULL, NULL );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
if (R200_DEBUG & DEBUG_DRI)
|
||||
|
|
|
@ -600,26 +600,26 @@ static void r200Clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
r200Flush( ctx );
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT ) {
|
||||
flags |= RADEON_FRONT;
|
||||
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_BACK_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_BACK_LEFT ) {
|
||||
flags |= RADEON_BACK;
|
||||
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_DEPTH_BIT ) {
|
||||
if ( mask & BUFFER_BIT_DEPTH ) {
|
||||
flags |= RADEON_DEPTH;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if ( (mask & DD_STENCIL_BIT) && rmesa->state.stencil.hwBuffer ) {
|
||||
if ( (mask & BUFFER_BIT_STENCIL) && rmesa->state.stencil.hwBuffer ) {
|
||||
flags |= RADEON_STENCIL;
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
|
||||
if ( mask ) {
|
||||
|
|
|
@ -53,7 +53,7 @@ r200UpdatePageFlipping( r200ContextPtr rmesa )
|
|||
int use_back;
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
|
||||
use_back = (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT);
|
||||
use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
|
||||
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
|
||||
|
||||
if (use_back) {
|
||||
|
@ -101,7 +101,7 @@ void r200GetLock( r200ContextPtr rmesa, GLuint flags )
|
|||
|
||||
if ( rmesa->lastStamp != dPriv->lastStamp ) {
|
||||
r200UpdatePageFlipping( rmesa );
|
||||
if (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT)
|
||||
if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
|
||||
r200SetCliprects( rmesa, GL_BACK_LEFT );
|
||||
else
|
||||
r200SetCliprects( rmesa, GL_FRONT_LEFT );
|
||||
|
|
|
@ -40,14 +40,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#define STANDALONE_MMIO
|
||||
#include "r200_screen.h"
|
||||
#include "r200_context.h"
|
||||
#include "r200_ioctl.h"
|
||||
#include "r200_span.h"
|
||||
#include "radeon_macros.h"
|
||||
#include "radeon_reg.h"
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
#include "utils.h"
|
||||
#include "vblank.h"
|
||||
#include "GL/internal/dri_interface.h"
|
||||
|
@ -525,10 +529,9 @@ r200InitDriver( __DRIscreenPrivate *sPriv )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create and initialize the Mesa and driver specific pixmap buffer
|
||||
* data.
|
||||
* data. This is called to setup rendering to a particular window.
|
||||
*
|
||||
* \todo This function (and its interface) will need to be updated to support
|
||||
* pbuffers.
|
||||
|
@ -539,6 +542,8 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
r200ScreenPtr screen = (r200ScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
|
@ -548,12 +553,64 @@ r200CreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const GLboolean swAccum = mesaVis->accumRedBits > 0;
|
||||
const GLboolean swStencil = mesaVis->stencilBits > 0 &&
|
||||
mesaVis->depthBits != 24;
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer( mesaVis,
|
||||
swDepth,
|
||||
swStencil,
|
||||
swAccum,
|
||||
swAlpha );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
r200SetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
r200SetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
r200SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
r200SetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
r200SetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
swDepth,
|
||||
swStencil,
|
||||
swAccum,
|
||||
swAlpha,
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#define DBG 0
|
||||
|
||||
#define LOCAL_VARS \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
r200ScreenPtr r200Screen = rmesa->r200Screen; \
|
||||
__DRIscreenPrivate *sPriv = rmesa->dri.screen; \
|
||||
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
|
||||
|
@ -55,7 +55,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
GLuint height = dPriv->h; \
|
||||
char *buf = (char *)(sPriv->pFB + \
|
||||
rmesa->state.color.drawOffset + \
|
||||
(dPriv->x * r200Screen->cpp) + \
|
||||
(dPriv->x * r200Screen->cpp) + \
|
||||
(dPriv->y * pitch)); \
|
||||
char *read_buf = (char *)(sPriv->pFB + \
|
||||
rmesa->state.pixel.readOffset + \
|
||||
|
@ -65,14 +65,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
(void) read_buf; (void) buf; (void) p
|
||||
|
||||
#define LOCAL_DEPTH_VARS \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
r200ContextPtr rmesa = R200_CONTEXT(ctx); \
|
||||
r200ScreenPtr r200Screen = rmesa->r200Screen; \
|
||||
__DRIscreenPrivate *sPriv = rmesa->dri.screen; \
|
||||
__DRIdrawablePrivate *dPriv = rmesa->dri.drawable; \
|
||||
GLuint height = dPriv->h; \
|
||||
GLuint xo = dPriv->x; \
|
||||
GLuint yo = dPriv->y; \
|
||||
char *buf = (char *)(sPriv->pFB + r200Screen->depthOffset); \
|
||||
char *buf = (char *)(sPriv->pFB + r200Screen->depthOffset); \
|
||||
(void) buf
|
||||
|
||||
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
|
||||
|
@ -212,6 +212,7 @@ static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
|
|||
|
||||
/* 16-bit depth buffer functions
|
||||
*/
|
||||
|
||||
#define WRITE_DEPTH( _x, _y, d ) \
|
||||
*(GLushort *)(buf + r200_mba_z16( rmesa, _x + xo, _y + yo )) = d;
|
||||
|
||||
|
@ -221,8 +222,10 @@ static GLuint r200_mba_z16( r200ContextPtr rmesa, GLint x, GLint y )
|
|||
#define TAG(x) r200##x##_16
|
||||
#include "depthtmp.h"
|
||||
|
||||
|
||||
/* 24 bit depth, 8 bit stencil depthbuffer functions
|
||||
*/
|
||||
|
||||
#define WRITE_DEPTH( _x, _y, d ) \
|
||||
do { \
|
||||
GLuint offset = r200_mba_z32( rmesa, _x + xo, _y + yo ); \
|
||||
|
@ -279,7 +282,7 @@ static void r200SetBuffer( GLcontext *ctx,
|
|||
r200ContextPtr rmesa = R200_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->state.pixel.readOffset = rmesa->r200Screen->backOffset;
|
||||
rmesa->state.pixel.readPitch = rmesa->r200Screen->backPitch;
|
||||
|
@ -292,7 +295,7 @@ static void r200SetBuffer( GLcontext *ctx,
|
|||
rmesa->state.color.drawPitch = rmesa->r200Screen->frontPitch;
|
||||
}
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if ( rmesa->doPageFlip && rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->state.pixel.readOffset = rmesa->r200Screen->frontOffset;
|
||||
rmesa->state.pixel.readPitch = rmesa->r200Screen->frontPitch;
|
||||
|
@ -358,11 +361,15 @@ void r200InitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->r200Screen->cpp ) {
|
||||
case 2:
|
||||
#if 0
|
||||
r200InitPointers_RGB565( swdd );
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#if 0
|
||||
r200InitPointers_ARGB8888( swdd );
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -371,22 +378,25 @@ void r200InitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->glCtx->Visual.depthBits ) {
|
||||
case 16:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = r200ReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = r200WriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = r200ReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = r200WriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 24:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = r200ReadDepthSpan_24_8;
|
||||
swdd->WriteDepthSpan = r200WriteDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = r200ReadDepthPixels_24_8;
|
||||
swdd->WriteDepthPixels = r200WriteDepthPixels_24_8;
|
||||
|
||||
swdd->ReadStencilSpan = r200ReadStencilSpan_24_8;
|
||||
swdd->WriteStencilSpan = r200WriteStencilSpan_24_8;
|
||||
swdd->ReadStencilPixels = r200ReadStencilPixels_24_8;
|
||||
swdd->WriteStencilPixels = r200WriteStencilPixels_24_8;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -396,3 +406,45 @@ void r200InitSpanFuncs( GLcontext *ctx )
|
|||
swdd->SpanRenderStart = r200SpanRenderStart;
|
||||
swdd->SpanRenderFinish = r200SpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
r200SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
r200InitPointers_RGB565(&drb->Base);
|
||||
}
|
||||
else {
|
||||
r200InitPointers_ARGB8888(&drb->Base);
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = r200ReadDepthSpan_16;
|
||||
drb->Base.GetValues = r200ReadDepthPixels_16;
|
||||
drb->Base.PutRow = r200WriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = r200WriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = r200WriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = r200ReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = r200ReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = r200WriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = r200WriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = r200WriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = r200ReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = r200ReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = r200WriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = r200WriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = r200WriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef __R200_SPAN_H__
|
||||
#define __R200_SPAN_H__
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void r200InitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
r200SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1796,12 +1796,12 @@ static void r200DrawBuffer( GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
r200SetCliprects( rmesa, GL_FRONT_LEFT );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
FALLBACK( rmesa, R200_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
r200SetCliprects( rmesa, GL_BACK_LEFT );
|
||||
break;
|
||||
|
|
|
@ -16,6 +16,7 @@ COMMON_SOURCES = \
|
|||
../common/vblank.c \
|
||||
../common/xmlconfig.c \
|
||||
../common/dri_util.c \
|
||||
../common/drirenderbuffer.c \
|
||||
../common/glcontextmodes.c
|
||||
|
||||
DRIVER_SOURCES = \
|
||||
|
|
|
@ -42,6 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "imports.h"
|
||||
#include "matrix.h"
|
||||
#include "extensions.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
@ -182,7 +183,7 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = {
|
|||
static void radeonInitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = radeonGetBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = radeonGetString;
|
||||
}
|
||||
|
||||
|
@ -491,7 +492,7 @@ void radeonDestroyContext( __DRIcontextPrivate *driContextPriv )
|
|||
/* check if we're deleting the currently bound context */
|
||||
if (rmesa == current) {
|
||||
RADEON_FIREVERTICES( rmesa );
|
||||
_mesa_make_current2(NULL, NULL, NULL);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
/* Free radeon context resources */
|
||||
|
@ -603,9 +604,9 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
radeonUpdateViewportOffset( newCtx->glCtx );
|
||||
}
|
||||
|
||||
_mesa_make_current2( newCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
if (newCtx->vb.enabled)
|
||||
radeonVtxfmtMakeCurrent( newCtx->glCtx );
|
||||
|
@ -613,7 +614,7 @@ radeonMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
} else {
|
||||
if (RADEON_DEBUG & DEBUG_DRI)
|
||||
fprintf(stderr, "%s ctx is null\n", __FUNCTION__);
|
||||
_mesa_make_current( NULL, NULL );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
if (RADEON_DEBUG & DEBUG_DRI)
|
||||
|
|
|
@ -1048,26 +1048,26 @@ static void radeonClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
radeonFlush( ctx );
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT ) {
|
||||
flags |= RADEON_FRONT;
|
||||
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_BACK_LEFT_BIT ) {
|
||||
if ( mask & BUFFER_BIT_BACK_LEFT ) {
|
||||
flags |= RADEON_BACK;
|
||||
color_mask = rmesa->hw.msk.cmd[MSK_RB3D_PLANEMASK];
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ( mask & DD_DEPTH_BIT ) {
|
||||
if ( mask & BUFFER_BIT_DEPTH ) {
|
||||
flags |= RADEON_DEPTH;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if ( (mask & DD_STENCIL_BIT) && rmesa->state.stencil.hwBuffer ) {
|
||||
if ( (mask & BUFFER_BIT_STENCIL) && rmesa->state.stencil.hwBuffer ) {
|
||||
flags |= RADEON_STENCIL;
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
|
||||
if ( mask ) {
|
||||
|
|
|
@ -56,7 +56,7 @@ radeonUpdatePageFlipping( radeonContextPtr rmesa )
|
|||
|
||||
rmesa->doPageFlip = rmesa->sarea->pfState;
|
||||
|
||||
use_back = (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT);
|
||||
use_back = (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT);
|
||||
use_back ^= (rmesa->sarea->pfCurrentPage == 1);
|
||||
|
||||
if ( RADEON_DEBUG & DEBUG_VERBOSE )
|
||||
|
@ -108,7 +108,7 @@ void radeonGetLock( radeonContextPtr rmesa, GLuint flags )
|
|||
|
||||
if ( rmesa->lastStamp != dPriv->lastStamp ) {
|
||||
radeonUpdatePageFlipping( rmesa );
|
||||
if (rmesa->glCtx->Color._DrawDestMask[0] == DD_BACK_LEFT_BIT)
|
||||
if (rmesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_BACK_LEFT)
|
||||
radeonSetCliprects( rmesa, GL_BACK_LEFT );
|
||||
else
|
||||
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
|
||||
|
|
|
@ -38,15 +38,20 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
#include "glheader.h"
|
||||
#include "imports.h"
|
||||
#include "mtypes.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#define STANDALONE_MMIO
|
||||
#include "radeon_context.h"
|
||||
#include "radeon_screen.h"
|
||||
#include "radeon_macros.h"
|
||||
#include "radeon_span.h"
|
||||
|
||||
#include "utils.h"
|
||||
#include "context.h"
|
||||
#include "vblank.h"
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
#include "GL/internal/dri_interface.h"
|
||||
|
||||
|
@ -451,10 +456,8 @@ radeonInitDriver( __DRIscreenPrivate *sPriv )
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create and initialize the Mesa and driver specific pixmap buffer
|
||||
* data.
|
||||
* Create the Mesa framebuffer and renderbuffers for a given window/drawable.
|
||||
*
|
||||
* \todo This function (and its interface) will need to be updated to support
|
||||
* pbuffers.
|
||||
|
@ -465,6 +468,8 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
radeonScreenPtr screen = (radeonScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
|
@ -474,12 +479,64 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const GLboolean swAccum = mesaVis->accumRedBits > 0;
|
||||
const GLboolean swStencil = mesaVis->stencilBits > 0 &&
|
||||
mesaVis->depthBits != 24;
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer( mesaVis,
|
||||
swDepth,
|
||||
swStencil,
|
||||
swAccum,
|
||||
swAlpha );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
radeonSetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
radeonSetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
radeonSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
radeonSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
radeonSetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
swDepth,
|
||||
swStencil,
|
||||
swAccum,
|
||||
swAlpha,
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,4 @@ typedef struct {
|
|||
driOptionCache optionCache;
|
||||
} radeonScreenRec, *radeonScreenPtr;
|
||||
|
||||
extern radeonScreenPtr radeonCreateScreen( __DRIscreenPrivate *sPriv );
|
||||
extern void radeonDestroyScreen( __DRIscreenPrivate *sPriv );
|
||||
|
||||
#endif /* __RADEON_SCREEN_H__ */
|
||||
|
|
|
@ -313,7 +313,7 @@ static void radeonSetBuffer( GLcontext *ctx,
|
|||
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
if ( rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->state.pixel.readOffset = rmesa->radeonScreen->backOffset;
|
||||
rmesa->state.pixel.readPitch = rmesa->radeonScreen->backPitch;
|
||||
|
@ -326,7 +326,7 @@ static void radeonSetBuffer( GLcontext *ctx,
|
|||
rmesa->state.color.drawPitch = rmesa->radeonScreen->frontPitch;
|
||||
}
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
if ( rmesa->sarea->pfCurrentPage == 1 ) {
|
||||
rmesa->state.pixel.readOffset = rmesa->radeonScreen->frontOffset;
|
||||
rmesa->state.pixel.readPitch = rmesa->radeonScreen->frontPitch;
|
||||
|
@ -375,6 +375,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->radeonScreen->cpp ) {
|
||||
case 2:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = radeonWriteRGBASpan_RGB565;
|
||||
swdd->WriteRGBSpan = radeonWriteRGBSpan_RGB565;
|
||||
swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_RGB565;
|
||||
|
@ -382,9 +383,11 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_RGB565;
|
||||
swdd->ReadRGBASpan = radeonReadRGBASpan_RGB565;
|
||||
swdd->ReadRGBAPixels = radeonReadRGBAPixels_RGB565;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 4:
|
||||
#if 0
|
||||
swdd->WriteRGBASpan = radeonWriteRGBASpan_ARGB8888;
|
||||
swdd->WriteRGBSpan = radeonWriteRGBSpan_ARGB8888;
|
||||
swdd->WriteMonoRGBASpan = radeonWriteMonoRGBASpan_ARGB8888;
|
||||
|
@ -392,6 +395,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoRGBAPixels = radeonWriteMonoRGBAPixels_ARGB8888;
|
||||
swdd->ReadRGBASpan = radeonReadRGBASpan_ARGB8888;
|
||||
swdd->ReadRGBAPixels = radeonReadRGBAPixels_ARGB8888;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -400,13 +404,16 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
switch ( rmesa->glCtx->Visual.depthBits ) {
|
||||
case 16:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = radeonReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = radeonWriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = radeonReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = radeonWriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 24:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = radeonReadDepthSpan_24_8;
|
||||
swdd->WriteDepthSpan = radeonWriteDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = radeonReadDepthPixels_24_8;
|
||||
|
@ -416,6 +423,7 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteStencilSpan = radeonWriteStencilSpan_24_8;
|
||||
swdd->ReadStencilPixels = radeonReadStencilPixels_24_8;
|
||||
swdd->WriteStencilPixels = radeonWriteStencilPixels_24_8;
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -425,3 +433,56 @@ void radeonInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->SpanRenderStart = radeonSpanRenderStart;
|
||||
swdd->SpanRenderFinish = radeonSpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
radeonSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = radeonReadRGBASpan_RGB565;
|
||||
drb->Base.GetValues = radeonReadRGBAPixels_RGB565;
|
||||
drb->Base.PutRow = radeonWriteRGBASpan_RGB565;
|
||||
drb->Base.PutRowRGB = radeonWriteRGBSpan_RGB565;
|
||||
drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_RGB565;
|
||||
drb->Base.PutValues = radeonWriteRGBAPixels_RGB565;
|
||||
drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_RGB565;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = radeonReadRGBASpan_ARGB8888;
|
||||
drb->Base.GetValues = radeonReadRGBAPixels_ARGB8888;
|
||||
drb->Base.PutRow = radeonWriteRGBASpan_ARGB8888;
|
||||
drb->Base.PutRowRGB = radeonWriteRGBSpan_ARGB8888;
|
||||
drb->Base.PutMonoRow = radeonWriteMonoRGBASpan_ARGB8888;
|
||||
drb->Base.PutValues = radeonWriteRGBAPixels_ARGB8888;
|
||||
drb->Base.PutMonoValues = radeonWriteMonoRGBAPixels_ARGB8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = radeonReadDepthSpan_16;
|
||||
drb->Base.GetValues = radeonReadDepthPixels_16;
|
||||
drb->Base.PutRow = radeonWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = radeonWriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = radeonReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = radeonReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = radeonWriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = radeonWriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = radeonWriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = radeonReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = radeonReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = radeonWriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = radeonWriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = radeonWriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef __RADEON_SPAN_H__
|
||||
#define __RADEON_SPAN_H__
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
extern void radeonInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void radeonSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1661,12 +1661,12 @@ static void radeonDrawBuffer( GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
radeonSetCliprects( rmesa, GL_FRONT_LEFT );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
FALLBACK( rmesa, RADEON_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
radeonSetCliprects( rmesa, GL_BACK_LEFT );
|
||||
break;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mtypes.h"
|
||||
#include "drm.h"
|
||||
#include "mm.h"
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
/* Flags for context */
|
||||
#define S3V_FRONT_BUFFER 0x00000001
|
||||
|
@ -162,6 +163,7 @@ void s3vGetLock( s3vContextPtr vmesa, GLuint flags );
|
|||
void s3vInitExtensions( GLcontext *ctx );
|
||||
void s3vInitDriverFuncs( GLcontext *ctx );
|
||||
void s3vInitSpanFuncs( GLcontext *ctx );
|
||||
void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
void s3vInitState( s3vContextPtr vmesa );
|
||||
void s3vInitHW( s3vContextPtr vmesa );
|
||||
void s3vInitStateFuncs( GLcontext *ctx );
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#endif
|
||||
|
||||
#include "context.h"
|
||||
#include "framebuffer.h"
|
||||
#include "swrast/swrast.h"
|
||||
|
||||
#define S3V_DATE "20020207"
|
||||
|
@ -96,7 +97,7 @@ void s3vInitDriverFuncs( GLcontext *ctx )
|
|||
ctx->Driver.CopyPixels = _swrast_CopyPixels;
|
||||
ctx->Driver.DrawPixels = _swrast_DrawPixels;
|
||||
ctx->Driver.ReadPixels = _swrast_ReadPixels;
|
||||
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||
ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
|
||||
|
||||
/* Swrast hooks for imaging extensions:
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* Author: Max Lingua <sunmax@libero.it>
|
||||
*/
|
||||
|
||||
#include "mtypes.h"
|
||||
|
||||
typedef struct _s3vRegion {
|
||||
drm_handle_t handle;
|
||||
drmSize size;
|
||||
|
@ -34,3 +36,4 @@ typedef struct {
|
|||
int textureSize;
|
||||
int logTextureGranularity;
|
||||
} s3vScreenRec, *s3vScreenPtr;
|
||||
|
||||
|
|
|
@ -232,10 +232,10 @@ static void s3vSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer,
|
|||
s3vContextPtr vmesa = S3V_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
vmesa->drawOffset = vmesa->readOffset = 0;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
vmesa->drawOffset = vmesa->readOffset = vmesa->driScreen->fbHeight *
|
||||
vmesa->driScreen->fbWidth *
|
||||
vmesa->s3vScreen->cpp;
|
||||
|
@ -251,6 +251,7 @@ void s3vInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
swdd->SetBuffer = s3vSetBuffer;
|
||||
|
||||
#if 0
|
||||
switch ( vmesa->s3vScreen->cpp ) {
|
||||
case 2:
|
||||
swdd->WriteRGBASpan = s3vWriteRGBASpan_RGB555;
|
||||
|
@ -279,14 +280,17 @@ void s3vInitSpanFuncs( GLcontext *ctx )
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch ( vmesa->glCtx->Visual.depthBits ) {
|
||||
case 15:
|
||||
case 16:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = s3vReadDepthSpan_16;
|
||||
swdd->WriteDepthSpan = s3vWriteDepthSpan_16;
|
||||
swdd->ReadDepthPixels = s3vReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = s3vWriteDepthPixels_16;
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if 0
|
||||
|
@ -307,3 +311,56 @@ void s3vInitSpanFuncs( GLcontext *ctx )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = s3vReadRGBASpan_RGB555;
|
||||
drb->Base.GetValues = s3vReadRGBAPixels_RGB555;
|
||||
drb->Base.PutRow = s3vWriteRGBASpan_RGB555;
|
||||
drb->Base.PutRowRGB = s3vWriteRGBSpan_RGB555;
|
||||
drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_RGB555;
|
||||
drb->Base.PutValues = s3vWriteRGBAPixels_RGB555;
|
||||
drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_RGB555;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = s3vReadRGBASpan_ARGB8888;
|
||||
drb->Base.GetValues = s3vReadRGBAPixels_ARGB8888;
|
||||
drb->Base.PutRow = s3vWriteRGBASpan_ARGB8888;
|
||||
drb->Base.PutRowRGB = s3vWriteRGBSpan_ARGB8888;
|
||||
drb->Base.PutMonoRow = s3vWriteMonoRGBASpan_ARGB8888;
|
||||
drb->Base.PutValues = s3vWriteRGBAPixels_ARGB8888;
|
||||
drb->Base.PutMonoValues = s3vWriteMonoRGBAPixels_ARGB8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = s3vReadDepthSpan_16;
|
||||
drb->Base.GetValues = s3vReadDepthPixels_16;
|
||||
drb->Base.PutRow = s3vWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = s3vWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = s3vWriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = NULL;
|
||||
drb->Base.GetValues = NULL;
|
||||
drb->Base.PutRow = NULL;
|
||||
drb->Base.PutMonoRow = NULL;
|
||||
drb->Base.PutValues = NULL;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
DMAOUT(vmesa->DestXY);
|
||||
DMAFINISH();
|
||||
|
||||
if (mask & DD_DEPTH_BIT) { /* depth */
|
||||
DEBUG(("DD_DEPTH_BIT\n"));
|
||||
if (mask & BUFFER_BIT_DEPTH) { /* depth */
|
||||
DEBUG(("BUFFER_BIT_DEPTH\n"));
|
||||
|
||||
_stride = ((cw+31)&~31) * 2;
|
||||
|
||||
|
@ -142,7 +142,7 @@ static void s3vDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
DMAFINISH();
|
||||
|
||||
DEBUG(("vmesa->ClearDepth = 0x%x\n", vmesa->ClearDepth));
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if (!vmesa->NotClipped) {
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "context.h"
|
||||
#include "matrix.h"
|
||||
#include "s3v_dri.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "swrast_setup/swrast_setup.h"
|
||||
|
@ -57,10 +59,13 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
|
@ -68,6 +73,58 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0
|
||||
);
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->frontPitch);
|
||||
s3vSetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->backPitch);
|
||||
s3vSetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
s3vSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->depthPitch);
|
||||
s3vSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
/* no h/w stencil yet?
|
||||
if (mesaVis->stencilBits > 0) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
|
||||
s3vSetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
*/
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
@ -205,7 +262,7 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
*/
|
||||
|
||||
/*
|
||||
_mesa_make_current2( newVirgeCtx->glCtx,
|
||||
_mesa_make_current( newVirgeCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
|
@ -221,13 +278,11 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */
|
||||
|
||||
_mesa_make_current2( newVirgeCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newVirgeCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
if (!newVirgeCtx->glCtx->Viewport.Width) {
|
||||
_mesa_set_viewport(newVirgeCtx->glCtx, 0, 0,
|
||||
|
@ -245,23 +300,23 @@ s3vMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
|
||||
newVirgeCtx->new_state |= S3V_NEW_CLIP;
|
||||
|
||||
if (1) {
|
||||
cx = dPriv->x;
|
||||
cw = dPriv->w;
|
||||
cy = dPriv->y;
|
||||
ch = dPriv->h;
|
||||
}
|
||||
if (1) {
|
||||
cx = dPriv->x;
|
||||
cw = dPriv->w;
|
||||
cy = dPriv->y;
|
||||
ch = dPriv->h;
|
||||
}
|
||||
|
||||
x1 = y1 = 0;
|
||||
x2 = cw-1;
|
||||
y2 = ch-1;
|
||||
|
||||
x1 = y1 = 0;
|
||||
x2 = cw-1;
|
||||
y2 = ch-1;
|
||||
|
||||
/* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
|
||||
dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
|
||||
src_stride = vmesa->driScreen->fbWidth * 2;
|
||||
dest_stride = ((x2+31)&~31) * 2;
|
||||
/* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp;
|
||||
dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */
|
||||
src_stride = vmesa->driScreen->fbWidth * 2;
|
||||
dest_stride = ((x2+31)&~31) * 2;
|
||||
} else {
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -80,6 +80,16 @@ typedef struct {
|
|||
} savageScreenPrivate;
|
||||
|
||||
|
||||
/**
|
||||
* savageRenderbuffer, derived from Mesa's gl_renderbuffer
|
||||
*/
|
||||
typedef struct {
|
||||
struct gl_renderbuffer Base;
|
||||
/* XXX per-window info should go here */
|
||||
int foo, bar;
|
||||
} savageRenderbuffer;
|
||||
|
||||
|
||||
#include "savagecontext.h"
|
||||
|
||||
extern void savageGetLock( savageContextPtr imesa, GLuint flags );
|
||||
|
|
|
@ -29,7 +29,8 @@
|
|||
#include "savagecontext.h"
|
||||
#include "context.h"
|
||||
#include "matrix.h"
|
||||
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "simple_list.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
@ -588,25 +589,85 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static GLboolean
|
||||
savageCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
||||
__DRIdrawablePrivate *driDrawPriv,
|
||||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap)
|
||||
{
|
||||
savageScreenPrivate *screen = (savageScreenPrivate *) driScrnPriv->private;
|
||||
|
||||
if (isPixmap) {
|
||||
return GL_FALSE; /* not implemented */
|
||||
}
|
||||
else {
|
||||
GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24;
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)
|
||||
_mesa_create_framebuffer(mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0 );
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
/*
|
||||
* XXX: this value needs to be set according to the config file
|
||||
* setting. But we don't get that until we create a rendering
|
||||
* context!!!!
|
||||
*/
|
||||
GLboolean float_depth = GL_FALSE;
|
||||
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->frontOffset, screen->aperturePitch);
|
||||
savageSetSpanFunctions(frontRb, mesaVis, float_depth);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
screen->backOffset, screen->aperturePitch);
|
||||
savageSetSpanFunctions(backRb, mesaVis, float_depth);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
screen->depthOffset, screen->aperturePitch);
|
||||
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
screen->depthOffset, screen->aperturePitch);
|
||||
savageSetSpanFunctions(depthRb, mesaVis, float_depth);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->stencilBits > 0 && !swStencil) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
|
||||
screen->depthOffset, screen->aperturePitch);
|
||||
savageSetSpanFunctions(stencilRb, mesaVis, float_depth);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
swStencil,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -670,11 +731,11 @@ static void savageXMesaWindowMoved( savageContextPtr imesa )
|
|||
if (0)
|
||||
fprintf(stderr, "savageXMesaWindowMoved\n\n");
|
||||
|
||||
switch (imesa->glCtx->Color._DrawDestMask[0]) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
savageXMesaSetFrontClipRects( imesa );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
savageXMesaSetBackClipRects( imesa );
|
||||
break;
|
||||
default:
|
||||
|
@ -742,15 +803,15 @@ savageMakeCurrent(__DRIcontextPrivate *driContextPriv,
|
|||
imesa->mesa_drawable = driDrawPriv;
|
||||
imesa->dirty = ~0;
|
||||
|
||||
_mesa_make_current2(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
_mesa_make_current(imesa->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate);
|
||||
|
||||
savageXMesaWindowMoved( imesa );
|
||||
}
|
||||
else
|
||||
{
|
||||
_mesa_make_current(NULL, NULL);
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
}
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
|
||||
#include "mtypes.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -113,6 +114,6 @@ static void savageBufferSize(GLframebuffer *buffer, GLuint *width, GLuint *heigh
|
|||
void savageDDInitDriverFuncs( GLcontext *ctx )
|
||||
{
|
||||
ctx->Driver.GetBufferSize = savageBufferSize;
|
||||
ctx->Driver.ResizeBuffers = _swrast_alloc_buffers;
|
||||
ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer;
|
||||
ctx->Driver.GetString = savageDDGetString;
|
||||
}
|
||||
|
|
|
@ -367,28 +367,28 @@ static void savageDDClear( GLcontext *ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
flags = 0;
|
||||
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
flags |= SAVAGE_FRONT;
|
||||
mask &= ~DD_FRONT_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_FRONT_LEFT;
|
||||
}
|
||||
|
||||
if (mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
flags |= SAVAGE_BACK;
|
||||
mask &= ~DD_BACK_LEFT_BIT;
|
||||
mask &= ~BUFFER_BIT_BACK_LEFT;
|
||||
}
|
||||
|
||||
if ((mask & DD_DEPTH_BIT) && ctx->Depth.Mask) {
|
||||
if ((mask & BUFFER_BIT_DEPTH) && ctx->Depth.Mask) {
|
||||
flags |= SAVAGE_DEPTH;
|
||||
depthMask |=
|
||||
(imesa->savageScreen->zpp == 2) ? 0xffffffff : 0x00ffffff;
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
}
|
||||
|
||||
if((mask & DD_STENCIL_BIT) && imesa->hw_stencil)
|
||||
if((mask & BUFFER_BIT_STENCIL) && imesa->hw_stencil)
|
||||
{
|
||||
flags |= SAVAGE_DEPTH;
|
||||
depthMask |= 0xff000000;
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
}
|
||||
|
||||
savageFlushVertices(imesa);
|
||||
|
|
|
@ -230,9 +230,9 @@ static void savageDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
|
|||
savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
|
||||
char *map;
|
||||
|
||||
assert((bufferBit == DD_FRONT_LEFT_BIT) || (bufferBit == DD_BACK_LEFT_BIT));
|
||||
assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT));
|
||||
|
||||
map = (bufferBit == DD_FRONT_LEFT_BIT)
|
||||
map = (bufferBit == BUFFER_BIT_FRONT_LEFT)
|
||||
? imesa->apertureBase[TARGET_FRONT]
|
||||
: imesa->apertureBase[TARGET_BACK];
|
||||
|
||||
|
@ -306,15 +306,18 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
|
|||
|
||||
swdd->SetBuffer = savageDDSetBuffer;
|
||||
|
||||
#if 0
|
||||
switch (imesa->savageScreen->cpp)
|
||||
{
|
||||
case 2: savageInitPointers_565( swdd ); break;
|
||||
case 4: savageInitPointers_8888( swdd );
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (imesa->savageScreen->zpp)
|
||||
{
|
||||
case 2:
|
||||
#if 0
|
||||
if (imesa->float_depth) {
|
||||
swdd->ReadDepthSpan = savageReadDepthSpan_16f;
|
||||
swdd->WriteDepthSpan = savageWriteDepthSpan_16f;
|
||||
|
@ -328,9 +331,10 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadDepthPixels = savageReadDepthPixels_16;
|
||||
swdd->WriteDepthPixels = savageWriteDepthPixels_16;
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
#if 0
|
||||
if (imesa->float_depth) {
|
||||
swdd->ReadDepthSpan = savageReadDepthSpan_8_24f;
|
||||
swdd->WriteDepthSpan = savageWriteDepthSpan_8_24f;
|
||||
|
@ -348,6 +352,7 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteStencilSpan = savageWriteStencilSpan_8_24;
|
||||
swdd->ReadStencilPixels = savageReadStencilPixels_8_24;
|
||||
swdd->WriteStencilPixels = savageWriteStencilPixels_8_24;
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -369,3 +374,64 @@ void savageDDInitSpanFuncs( GLcontext *ctx )
|
|||
ctx->Driver.DrawPixels = savageDrawPixels;
|
||||
ctx->Driver.ReadPixels = savageReadPixels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis,
|
||||
GLboolean float_depth)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
savageInitPointers_565(&drb->Base);
|
||||
}
|
||||
else {
|
||||
savageInitPointers_8888(&drb->Base);
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
if (float_depth) {
|
||||
drb->Base.GetRow = savageReadDepthSpan_16f;
|
||||
drb->Base.GetValues = savageReadDepthPixels_16f;
|
||||
drb->Base.PutRow = savageWriteDepthSpan_16f;
|
||||
drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16f;
|
||||
drb->Base.PutValues = savageWriteDepthPixels_16f;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = savageReadDepthSpan_16;
|
||||
drb->Base.GetValues = savageReadDepthPixels_16;
|
||||
drb->Base.PutRow = savageWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = savageWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = savageWriteDepthPixels_16;
|
||||
}
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
if (float_depth) {
|
||||
drb->Base.GetRow = savageReadDepthSpan_8_24f;
|
||||
drb->Base.GetValues = savageReadDepthPixels_8_24f;
|
||||
drb->Base.PutRow = savageWriteDepthSpan_8_24f;
|
||||
drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24f;
|
||||
drb->Base.PutValues = savageWriteDepthPixels_8_24f;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = savageReadDepthSpan_8_24;
|
||||
drb->Base.GetValues = savageReadDepthPixels_8_24;
|
||||
drb->Base.PutRow = savageWriteDepthSpan_8_24;
|
||||
drb->Base.PutMonoRow = savageWriteMonoDepthSpan_8_24;
|
||||
drb->Base.PutValues = savageWriteDepthPixels_8_24;
|
||||
}
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = savageReadStencilSpan_8_24;
|
||||
drb->Base.GetValues = savageReadStencilPixels_8_24;
|
||||
drb->Base.PutRow = savageWriteStencilSpan_8_24;
|
||||
drb->Base.PutMonoRow = savageWriteMonoStencilSpan_8_24;
|
||||
drb->Base.PutValues = savageWriteStencilPixels_8_24;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,16 @@
|
|||
#ifndef _SAVAGE_SPAN_H
|
||||
#define _SAVAGE_SPAN_H
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
|
||||
extern void savageDDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
savageSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis,
|
||||
GLboolean float_depth);
|
||||
|
||||
|
||||
/*
|
||||
* Savage 16-bit float depth format with zExpOffset=16:
|
||||
* 4 bit unsigned exponent, 12 bit mantissa
|
||||
|
@ -125,4 +133,5 @@ static __inline GLdouble savageDecodeFloat24( GLuint x )
|
|||
}
|
||||
#undef _1
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -644,8 +644,8 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
/*
|
||||
* _DrawDestMask is easier to cope with than <mode>.
|
||||
*/
|
||||
switch ( ctx->Color._DrawDestMask[0] ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
imesa->IsDouble = GL_FALSE;
|
||||
imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->frontOffset>>11;
|
||||
|
||||
|
@ -653,7 +653,7 @@ static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
|
|||
savageXMesaSetFrontClipRects( imesa );
|
||||
FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_FALSE );
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
imesa->IsDouble = GL_TRUE;
|
||||
imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->backOffset>>11;
|
||||
imesa->NotFirstFrame = GL_FALSE;
|
||||
|
|
|
@ -119,9 +119,9 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
|
|||
|
||||
/* Mask out any non-existent buffers */
|
||||
if (ctx->Visual.depthBits == 0 || !ctx->Depth.Mask)
|
||||
mask &= ~DD_DEPTH_BIT;
|
||||
mask &= ~BUFFER_BIT_DEPTH;
|
||||
if (ctx->Visual.stencilBits == 0)
|
||||
mask &= ~DD_STENCIL_BIT;
|
||||
mask &= ~BUFFER_BIT_STENCIL;
|
||||
|
||||
LOCK_HARDWARE();
|
||||
|
||||
|
@ -132,21 +132,21 @@ sisDDClear( GLcontext * ctx, GLbitfield mask, GLboolean all,
|
|||
/* XXX: Appears to be broken with stencil. */
|
||||
if ((smesa->current.hwCapEnable2 & (MASK_AlphaMaskWriteEnable |
|
||||
MASK_ColorMaskWriteEnable) &&
|
||||
(mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0) ||
|
||||
(ctx->Stencil.WriteMask[0] < 0xff && (mask & DD_STENCIL_BIT) != 0) )
|
||||
(mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0) ||
|
||||
(ctx->Stencil.WriteMask[0] < 0xff && (mask & BUFFER_BIT_STENCIL) != 0) )
|
||||
{
|
||||
mask = sis_3D_Clear( ctx, mask, x1, y1, width1, height1 );
|
||||
}
|
||||
|
||||
if ( mask & DD_FRONT_LEFT_BIT || mask & DD_BACK_LEFT_BIT) {
|
||||
if ( mask & BUFFER_BIT_FRONT_LEFT || mask & BUFFER_BIT_BACK_LEFT) {
|
||||
sis_clear_color_buffer( ctx, mask, x1, y1, width1, height1 );
|
||||
mask &= ~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT);
|
||||
mask &= ~(BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT);
|
||||
}
|
||||
|
||||
if (mask & (DD_DEPTH_BIT | DD_STENCIL_BIT)) {
|
||||
if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) {
|
||||
if (smesa->depthbuffer != NULL)
|
||||
sis_clear_z_stencil_buffer( ctx, mask, x1, y1, width1, height1 );
|
||||
mask &= ~(DD_DEPTH_BIT | DD_STENCIL_BIT);
|
||||
mask &= ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL);
|
||||
}
|
||||
|
||||
UNLOCK_HARDWARE();
|
||||
|
@ -204,9 +204,9 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
|
|||
int count;
|
||||
drm_clip_rect_t *pExtents;
|
||||
|
||||
bClrColor = (mask & (DD_BACK_LEFT_BIT | DD_FRONT_LEFT_BIT)) != 0;
|
||||
bClrDepth = (mask & DD_DEPTH_BIT) != 0;
|
||||
bClrStencil = (mask & DD_STENCIL_BIT) != 0;
|
||||
bClrColor = (mask & (BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT)) != 0;
|
||||
bClrDepth = (mask & BUFFER_BIT_DEPTH) != 0;
|
||||
bClrStencil = (mask & BUFFER_BIT_STENCIL) != 0;
|
||||
|
||||
if (smesa->GlobalFlag & GFLAG_RENDER_STATES)
|
||||
sis_update_render_state( smesa );
|
||||
|
@ -252,7 +252,7 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
|
|||
dirtyflags |= GFLAG_STENCILSETTING;
|
||||
}
|
||||
|
||||
if (mask & DD_FRONT_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_FRONT_LEFT) {
|
||||
pExtents = smesa->driDrawable->pClipRects;
|
||||
count = smesa->driDrawable->numClipRects;
|
||||
} else {
|
||||
|
@ -321,14 +321,14 @@ sis_3D_Clear( GLcontext * ctx, GLbitfield mask,
|
|||
|
||||
mEndPrimitive();
|
||||
|
||||
/* If DD_FRONT_LEFT_BIT is set, we've only cleared the front buffer so far */
|
||||
if ((mask & DD_FRONT_LEFT_BIT) != 0 && (mask & DD_BACK_LEFT_BIT) != 0)
|
||||
sis_3D_Clear( ctx, DD_BACK_LEFT_BIT, x, y, width, height );
|
||||
/* If BUFFER_BIT_FRONT_LEFT is set, we've only cleared the front buffer so far */
|
||||
if ((mask & BUFFER_BIT_FRONT_LEFT) != 0 && (mask & BUFFER_BIT_BACK_LEFT) != 0)
|
||||
sis_3D_Clear( ctx, BUFFER_BIT_BACK_LEFT, x, y, width, height );
|
||||
|
||||
smesa->GlobalFlag |= dirtyflags;
|
||||
|
||||
return mask & ~(DD_DEPTH_BIT | DD_STENCIL_BIT | DD_BACK_LEFT_BIT |
|
||||
DD_FRONT_LEFT_BIT);
|
||||
return mask & ~(BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL | BUFFER_BIT_BACK_LEFT |
|
||||
BUFFER_BIT_FRONT_LEFT);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -368,7 +368,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
|||
ENGPACKET stEngPacket;
|
||||
|
||||
/* Clear back buffer */
|
||||
if (mask & DD_BACK_LEFT_BIT) {
|
||||
if (mask & BUFFER_BIT_BACK_LEFT) {
|
||||
smesa->cbClearPacket.stdwDestPos.wY = y;
|
||||
smesa->cbClearPacket.stdwDestPos.wX = x;
|
||||
smesa->cbClearPacket.stdwDim.wWidth = (GLshort) width;
|
||||
|
@ -378,7 +378,7 @@ sis_clear_color_buffer( GLcontext *ctx, GLenum mask, GLint x, GLint y,
|
|||
sis_bitblt_clear_cmd( smesa, &smesa->cbClearPacket );
|
||||
}
|
||||
|
||||
if ((mask & DD_FRONT_LEFT_BIT) == 0)
|
||||
if ((mask & BUFFER_BIT_FRONT_LEFT) == 0)
|
||||
return;
|
||||
|
||||
/* Clear front buffer */
|
||||
|
|
|
@ -306,14 +306,14 @@ sisMakeCurrent( __DRIcontextPrivate *driContextPriv,
|
|||
|
||||
newSisCtx->driDrawable = driDrawPriv;
|
||||
|
||||
_mesa_make_current2( newSisCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
_mesa_make_current( newSisCtx->glCtx,
|
||||
(GLframebuffer *) driDrawPriv->driverPrivate,
|
||||
(GLframebuffer *) driReadPriv->driverPrivate );
|
||||
|
||||
sisUpdateBufferSize( newSisCtx );
|
||||
sisUpdateClipping( newSisCtx->glCtx );
|
||||
} else {
|
||||
_mesa_make_current( 0, 0 );
|
||||
_mesa_make_current( NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
|
|
|
@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "sis_tris.h"
|
||||
|
||||
#include "swrast/swrast.h"
|
||||
#include "framebuffer.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -172,9 +173,9 @@ sisUpdateBufferSize( sisContextPtr smesa )
|
|||
void
|
||||
sisInitDriverFuncs( struct dd_function_table *functions )
|
||||
{
|
||||
functions->GetBufferSize = sisGetBufferSize;
|
||||
functions->ResizeBuffers = _swrast_alloc_buffers;
|
||||
functions->GetString = sisGetString;
|
||||
functions->Finish = sisFinish;
|
||||
functions->Flush = sisFlush;
|
||||
functions->GetBufferSize = sisGetBufferSize;
|
||||
functions->ResizeBuffers = _mesa_resize_framebuffer;
|
||||
functions->GetString = sisGetString;
|
||||
functions->Finish = sisFinish;
|
||||
functions->Flush = sisFlush;
|
||||
}
|
||||
|
|
|
@ -34,10 +34,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include "context.h"
|
||||
#include "utils.h"
|
||||
#include "imports.h"
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
|
||||
#include "sis_context.h"
|
||||
#include "sis_dri.h"
|
||||
#include "sis_lock.h"
|
||||
#include "sis_span.h"
|
||||
|
||||
#include "xmlpool.h"
|
||||
|
||||
|
@ -196,6 +199,7 @@ sisDestroyScreen( __DRIscreenPrivate *sPriv )
|
|||
sPriv->private = NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Create and initialize the Mesa and driver specific pixmap buffer
|
||||
* data.
|
||||
*/
|
||||
|
@ -205,15 +209,79 @@ sisCreateBuffer( __DRIscreenPrivate *driScrnPriv,
|
|||
const __GLcontextModes *mesaVis,
|
||||
GLboolean isPixmap )
|
||||
{
|
||||
sisScreenPtr screen = (sisScreenPtr) driScrnPriv->private;
|
||||
|
||||
if (isPixmap)
|
||||
return GL_FALSE; /* not implemented */
|
||||
|
||||
#if 0
|
||||
driDrawPriv->driverPrivate = (void *)_mesa_create_framebuffer(
|
||||
mesaVis,
|
||||
GL_FALSE, /* software depth buffer? */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
mesaVis->alphaBits > 0 ); /* XXX */
|
||||
#else
|
||||
struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis);
|
||||
|
||||
/* XXX double-check the Offset/Pitch parameters! */
|
||||
{
|
||||
driRenderbuffer *frontRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
0, driScrnPriv->fbStride);
|
||||
sisSetSpanFunctions(frontRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->doubleBufferMode) {
|
||||
driRenderbuffer *backRb
|
||||
= driNewRenderbuffer(GL_RGBA, screen->cpp,
|
||||
0, driScrnPriv->fbStride);
|
||||
sisSetSpanFunctions(backRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
|
||||
}
|
||||
|
||||
if (mesaVis->depthBits == 16) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
|
||||
0, driScrnPriv->fbStride);
|
||||
sisSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 24) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
|
||||
0, driScrnPriv->fbStride);
|
||||
sisSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
else if (mesaVis->depthBits == 32) {
|
||||
driRenderbuffer *depthRb
|
||||
= driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
|
||||
0, driScrnPriv->fbStride);
|
||||
sisSetSpanFunctions(depthRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
|
||||
}
|
||||
|
||||
/* no h/w stencil?
|
||||
if (mesaVis->stencilBits > 0) {
|
||||
driRenderbuffer *stencilRb
|
||||
= driNewRenderbuffer(GL_STENCIL_INDEX8_EXT);
|
||||
sisSetSpanFunctions(stencilRb, mesaVis);
|
||||
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base);
|
||||
}
|
||||
*/
|
||||
|
||||
_mesa_add_soft_renderbuffers(fb,
|
||||
GL_FALSE, /* color */
|
||||
GL_FALSE, /* depth */
|
||||
mesaVis->stencilBits > 0,
|
||||
mesaVis->accumRedBits > 0,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */);
|
||||
driDrawPriv->driverPrivate = (void *) fb;
|
||||
#endif
|
||||
|
||||
return (driDrawPriv->driverPrivate != NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -205,11 +205,11 @@ static void sisDDSetBuffer( GLcontext *ctx,
|
|||
sisContextPtr smesa = SIS_CONTEXT(ctx);
|
||||
|
||||
switch ( bufferBit ) {
|
||||
case DD_FRONT_LEFT_BIT:
|
||||
case BUFFER_BIT_FRONT_LEFT:
|
||||
smesa->drawOffset = smesa->readOffset = smesa->frontOffset;
|
||||
smesa->drawPitch = smesa->readPitch = smesa->frontPitch;
|
||||
break;
|
||||
case DD_BACK_LEFT_BIT:
|
||||
case BUFFER_BIT_BACK_LEFT:
|
||||
smesa->drawOffset = smesa->readOffset = smesa->backOffset;
|
||||
smesa->drawPitch = smesa->readPitch = smesa->backPitch;
|
||||
break;
|
||||
|
@ -246,6 +246,7 @@ sisDDInitSpanFuncs( GLcontext *ctx )
|
|||
switch (smesa->zFormat)
|
||||
{
|
||||
case SiS_ZFORMAT_Z16:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = sisReadDepthSpan_16;
|
||||
swdd->ReadDepthPixels = sisReadDepthPixels_16;
|
||||
swdd->WriteDepthSpan = sisWriteDepthSpan_16;
|
||||
|
@ -255,8 +256,10 @@ sisDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadStencilPixels = NULL;
|
||||
swdd->WriteStencilSpan = NULL;
|
||||
swdd->WriteStencilPixels = NULL;
|
||||
#endif
|
||||
break;
|
||||
case SiS_ZFORMAT_Z32:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = sisReadDepthSpan_32;
|
||||
swdd->ReadDepthPixels = sisReadDepthPixels_32;
|
||||
swdd->WriteDepthSpan = sisWriteDepthSpan_32;
|
||||
|
@ -266,8 +269,10 @@ sisDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadStencilPixels = NULL;
|
||||
swdd->WriteStencilSpan = NULL;
|
||||
swdd->WriteStencilPixels = NULL;
|
||||
#endif
|
||||
break;
|
||||
case SiS_ZFORMAT_S8Z24:
|
||||
#if 0
|
||||
swdd->ReadDepthSpan = sisReadDepthSpan_24_8;
|
||||
swdd->ReadDepthPixels = sisReadDepthPixels_24_8;
|
||||
swdd->WriteDepthSpan = sisWriteDepthSpan_24_8;
|
||||
|
@ -277,9 +282,11 @@ sisDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->ReadStencilPixels = sisReadStencilPixels_24_8;
|
||||
swdd->WriteStencilSpan = sisWriteStencilSpan_24_8;
|
||||
swdd->WriteStencilPixels = sisWriteStencilPixels_24_8;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
switch ( smesa->bytesPerPixel )
|
||||
{
|
||||
case 2:
|
||||
|
@ -312,7 +319,70 @@ sisDDInitSpanFuncs( GLcontext *ctx )
|
|||
swdd->WriteMonoCIPixels = NULL;
|
||||
swdd->ReadCI32Span = NULL;
|
||||
swdd->ReadCI32Pixels = NULL;
|
||||
#endif
|
||||
|
||||
swdd->SpanRenderStart = sisSpanRenderStart;
|
||||
swdd->SpanRenderFinish = sisSpanRenderFinish;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Plug in the Get/Put routines for the given driRenderbuffer.
|
||||
*/
|
||||
void
|
||||
sisSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis)
|
||||
{
|
||||
if (drb->Base.InternalFormat == GL_RGBA) {
|
||||
if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) {
|
||||
drb->Base.GetRow = sisReadRGBASpan_565;
|
||||
drb->Base.GetValues = sisReadRGBAPixels_565;
|
||||
drb->Base.PutRow = sisWriteRGBASpan_565;
|
||||
drb->Base.PutRowRGB = sisWriteRGBSpan_565;
|
||||
drb->Base.PutMonoRow = sisWriteMonoRGBASpan_565;
|
||||
drb->Base.PutValues = sisWriteRGBAPixels_565;
|
||||
drb->Base.PutMonoValues = sisWriteMonoRGBAPixels_565;
|
||||
}
|
||||
else {
|
||||
drb->Base.GetRow = sisReadRGBASpan_8888;
|
||||
drb->Base.GetValues = sisReadRGBAPixels_8888;
|
||||
drb->Base.PutRow = sisWriteRGBASpan_8888;
|
||||
drb->Base.PutRowRGB = sisWriteRGBSpan_8888;
|
||||
drb->Base.PutMonoRow = sisWriteMonoRGBASpan_8888;
|
||||
drb->Base.PutValues = sisWriteRGBAPixels_8888;
|
||||
drb->Base.PutMonoValues = sisWriteMonoRGBAPixels_8888;
|
||||
}
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) {
|
||||
drb->Base.GetRow = sisReadDepthSpan_16;
|
||||
drb->Base.GetValues = sisReadDepthPixels_16;
|
||||
drb->Base.PutRow = sisWriteDepthSpan_16;
|
||||
drb->Base.PutMonoRow = sisWriteMonoDepthSpan_16;
|
||||
drb->Base.PutValues = sisWriteDepthPixels_16;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) {
|
||||
drb->Base.GetRow = sisReadDepthSpan_24_8;
|
||||
drb->Base.GetValues = sisReadDepthPixels_24_8;
|
||||
drb->Base.PutRow = sisWriteDepthSpan_24_8;
|
||||
drb->Base.PutMonoRow = sisWriteMonoDepthSpan_24_8;
|
||||
drb->Base.PutValues = sisWriteDepthPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) {
|
||||
drb->Base.GetRow = sisReadDepthSpan_32;
|
||||
drb->Base.GetValues = sisReadDepthPixels_32;
|
||||
drb->Base.PutRow = sisWriteDepthSpan_32;
|
||||
drb->Base.PutMonoRow = sisWriteMonoDepthSpan_32;
|
||||
drb->Base.PutValues = sisWriteDepthPixels_32;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) {
|
||||
drb->Base.GetRow = sisReadStencilSpan_24_8;
|
||||
drb->Base.GetValues = sisReadStencilPixels_24_8;
|
||||
drb->Base.PutRow = sisWriteStencilSpan_24_8;
|
||||
drb->Base.PutMonoRow = sisWriteMonoStencilSpan_24_8;
|
||||
drb->Base.PutValues = sisWriteStencilPixels_24_8;
|
||||
drb->Base.PutMonoValues = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,9 +32,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef __SIS_SPAN_H__
|
||||
#define __SIS_SPAN_H__
|
||||
|
||||
#include "drirenderbuffer.h"
|
||||
|
||||
|
||||
extern void sisSpanRenderStart( GLcontext *ctx );
|
||||
extern void sisSpanRenderFinish( GLcontext *ctx );
|
||||
|
||||
extern void sisDDInitSpanFuncs( GLcontext *ctx );
|
||||
|
||||
extern void
|
||||
sisSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis);
|
||||
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue