aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/renderbuffer.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-07-30 17:17:44 -0600
committerBrian <[email protected]>2007-07-30 17:17:44 -0600
commit4576d754c98e3fb5d413e294d48fb70a893defcf (patch)
tree96dd5125f77209567e7ce916e5a7be07e4eced7d /src/mesa/main/renderbuffer.c
parent6558af67d380f2855b112ea3ce4dded9215c7cf7 (diff)
Lots of improvements to the surface-related code.
Z testing now works with i915 driver. Add gl_renderbuffer::surface pointer (and reverse pointer). Remove intel_surface and xmesa_surface types - no longer used.
Diffstat (limited to 'src/mesa/main/renderbuffer.c')
-rw-r--r--src/mesa/main/renderbuffer.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 6f1d7c39605..a1412ef007c 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -49,6 +49,9 @@
#include "rbadaptors.h"
+#include "pipe/softpipe/sp_z_surface.h"
+#include "pipe/p_state.h"
+
/* 32-bit color index format. Not a public format. */
#define COLOR_INDEX32 0x424243
@@ -1091,6 +1094,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
rb->PutValues = put_values_ushort;
rb->PutMonoValues = put_mono_values_ushort;
rb->DepthBits = 8 * sizeof(GLushort);
+ rb->surface = (struct pipe_surface *) softpipe_new_z_surface(16);
pixelSize = sizeof(GLushort);
break;
case GL_DEPTH_COMPONENT24:
@@ -1193,13 +1197,27 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
/* free old buffer storage */
if (rb->Data) {
- _mesa_free(rb->Data);
+ if (rb->surface) {
+ /* pipe surface */
+ }
+ else {
+ /* legacy renderbuffer */
+ _mesa_free(rb->Data);
+ }
rb->Data = NULL;
}
if (width > 0 && height > 0) {
/* allocate new buffer storage */
- rb->Data = _mesa_malloc(width * height * pixelSize);
+ if (rb->surface) {
+ /* pipe surface */
+ rb->surface->resize(rb->surface, width, height);
+ rb->Data = rb->surface->buffer.ptr;
+ }
+ else {
+ /* legacy renderbuffer */
+ rb->Data = _mesa_malloc(width * height * pixelSize);
+ }
if (rb->Data == NULL) {
rb->Width = 0;
rb->Height = 0;