summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-12-12 14:55:57 -0700
committerBrian <[email protected]>2007-12-12 14:55:57 -0700
commit20eae595faa20dba8a59d8a4bfd01aa6b458cecd (patch)
tree3b34a809024e6a3447d94525d7eeef25c6d7f014 /src/mesa/drivers
parenta51d0e419a285c5445061a38fdaf3aca02ad2c3c (diff)
Re-org of st_create_framebuffer() and renderbuffer format selection.
st_create_framebuffer() now takes pipe_formats for the color, depth, stencil buffers. This avoids a round-about chain of calls to pipe->is_format_supported() for window renderbuffers (their format never changes). Renderbuffer format selection code in st_format.c is simpler now too.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel_winsys/intel_screen.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.c b/src/mesa/drivers/dri/intel_winsys/intel_screen.c
index 1b520f71353..bce6c5699a1 100644
--- a/src/mesa/drivers/dri/intel_winsys/intel_screen.c
+++ b/src/mesa/drivers/dri/intel_winsys/intel_screen.c
@@ -274,11 +274,34 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
return GL_FALSE; /* not implemented */
}
else {
+ enum pipe_format colorFormat, depthFormat, stencilFormat;
struct intel_framebuffer *intelfb = CALLOC_STRUCT(intel_framebuffer);
+
if (!intelfb)
return GL_FALSE;
- intelfb->stfb = st_create_framebuffer(visual, GL_TRUE, (void*) intelfb);
+ if (visual->redBits == 5)
+ colorFormat = PIPE_FORMAT_R5G6B5_UNORM;
+ else
+ colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+ if (visual->depthBits == 16)
+ depthFormat = PIPE_FORMAT_Z16_UNORM;
+ else if (visual->depthBits == 24)
+ depthFormat = PIPE_FORMAT_S8Z24_UNORM;
+ else
+ depthFormat = PIPE_FORMAT_NONE;
+
+ if (visual->stencilBits == 8)
+ stencilFormat = PIPE_FORMAT_S8Z24_UNORM;
+ else
+ stencilFormat = PIPE_FORMAT_NONE;
+
+ intelfb->stfb = st_create_framebuffer(visual, GL_TRUE,
+ colorFormat,
+ depthFormat,
+ stencilFormat,
+ (void*) intelfb);
if (!intelfb->stfb) {
free(intelfb);
return GL_FALSE;