aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/unichrome/via_screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/unichrome/via_screen.c')
-rw-r--r--src/mesa/drivers/dri/unichrome/via_screen.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c
index dbe7a38c3d3..e302011665e 100644
--- a/src/mesa/drivers/dri/unichrome/via_screen.c
+++ b/src/mesa/drivers/dri/unichrome/via_screen.c
@@ -28,6 +28,8 @@
#include "dri_util.h"
#include "glheader.h"
#include "context.h"
+#include "framebuffer.h"
+#include "renderbuffer.h"
#include "matrix.h"
#include "simple_list.h"
#include "vblank.h"
@@ -212,12 +214,15 @@ viaDestroyScreen(__DRIscreenPrivate *sPriv)
sPriv->private = NULL;
}
+
static GLboolean
viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
__DRIdrawablePrivate *driDrawPriv,
const __GLcontextModes *mesaVis,
GLboolean isPixmap)
{
+ viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private;
+
GLboolean swStencil = (mesaVis->stencilBits > 0 &&
mesaVis->depthBits != 24);
@@ -238,13 +243,74 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv,
return GL_FALSE;
}
else {
+#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);
+
+ /* XXX check/fix the offset/pitch parameters! */
+ {
+ driRenderbuffer *frontRb
+ = driNewRenderbuffer(GL_RGBA, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(frontRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base);
+ }
+
+ if (mesaVis->doubleBufferMode) {
+ driRenderbuffer *backRb
+ = driNewRenderbuffer(GL_RGBA, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(backRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base);
+ }
+
+ if (mesaVis->depthBits == 16) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+ else if (mesaVis->depthBits == 24) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT24, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+ else if (mesaVis->depthBits == 32) {
+ driRenderbuffer *depthRb
+ = driNewRenderbuffer(GL_DEPTH_COMPONENT32, screen->cpp,
+ 0, screen->width);
+ viaSetSpanFunctions(depthRb, mesaVis);
+ _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base);
+ }
+
+ /* no h/w stencil?
+ if (mesaVis->stencilBits > 0 && !swStencil) {
+ driRenderbuffer *stencilRb
+ = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, screen->cpp,
+ screen->depthOffset, screen->depthPitch);
+ viaSetSpanFunctions(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);
}
}