On 2014-12-27 11:41, Ilia Mirkin wrote:
On Sat, Dec 27, 2014 at 1:13 AM, Alexander von Gluck IV
<kallis...@unixzen.com> wrote:
---
src/gallium/state_trackers/hgl/hgl.c | 48
+++++++++++++--------------------
1 files changed, 19 insertions(+), 29 deletions(-)
diff --git a/src/gallium/state_trackers/hgl/hgl.c
b/src/gallium/state_trackers/hgl/hgl.c
index 4d7c479..0b30290 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -232,9 +232,10 @@ hgl_create_st_visual(ulong options)
const GLboolean alphaFlag = ((options & BGL_ALPHA) ==
BGL_ALPHA);
const GLboolean dblFlag = ((options & BGL_DOUBLE) ==
BGL_DOUBLE);
const GLboolean stereoFlag = false;
- const GLint depth = (options & BGL_DEPTH) ? 24 : 0;
- const GLint stencil = (options & BGL_STENCIL) ? 8 : 0;
- const GLint accum = (options & BGL_ACCUM) ? 16 : 0;
+ const GLboolean depthFlag = ((options & BGL_DEPTH) ==
BGL_DEPTH);
+ const GLboolean stencilFlag = ((options & BGL_STENCIL) ==
BGL_STENCIL);
+ const GLboolean accumFlag = ((options & BGL_ACCUM) ==
BGL_ACCUM);
+
const GLint red = rgbFlag ? 8 : 5;
const GLint green = rgbFlag ? 8 : 5;
const GLint blue = rgbFlag ? 8 : 5;
@@ -244,9 +245,9 @@ hgl_create_st_visual(ulong options)
TRACE("alpha :\t%d\n", (bool)alphaFlag);
TRACE("dbl :\t%d\n", (bool)dblFlag);
TRACE("stereo :\t%d\n", (bool)stereoFlag);
- TRACE("depth :\t%d\n", depth);
- TRACE("stencil :\t%d\n", stencil);
- TRACE("accum :\t%d\n", accum);
+ TRACE("depth :\t%d\n", (bool)depthFlag);
+ TRACE("stencil :\t%d\n", (bool)stencilFlag);
+ TRACE("accum :\t%d\n", (bool)accumFlag);
TRACE("red :\t%d\n", red);
TRACE("green :\t%d\n", green);
TRACE("blue :\t%d\n", blue);
@@ -254,34 +255,23 @@ hgl_create_st_visual(ulong options)
// Determine color format
if (red == 8) {
+ // Color format
if (alpha == 8)
- visual->color_format =
PIPE_FORMAT_A8R8G8B8_UNORM;
+ visual->color_format =
PIPE_FORMAT_B8G8R8A8_UNORM;
else
- visual->color_format =
PIPE_FORMAT_X8R8G8B8_UNORM;
+ visual->color_format =
PIPE_FORMAT_B8G8R8X8_UNORM;
+
+ // Depth buffer
+ if (depthFlag)
+ visual->depth_stencil_format =
PIPE_FORMAT_Z32_UNORM;
I guess you only work with llvmpipe which supports whatever, but I
don't think a lot of hw drivers support Z32_UNORM. Z24 is much more
common. Some hardware also supports Z16 and Z32_FLOAT (and
Z32_FLOAT_S8X24_UNORM for depth/stencil combined version).
Thanks :-). If Z24 is a lot more common i'll go with that one for now.
I'm interested to see if we could figure out something with dri3 and C++
in Haiku
for hardware support, but that seems pretty far off.
Further you appear to have dropped the stencil format here entirely.
If that's expected, perhaps get rid of the stencilFlag above?
Yeah, I mostly left it there in-case we wanted to set something based on
it
in the future, that BGL_STENCIL may not be obvious to non-Haiku people
:-)
Here are the list of flags our OpenGL Kit accepts for new GL contexts:
BGL_RGB Use RGB graphics instead of indexed color (8-bit). This
is the default if beither BGL_RGB nor BGL_INDEX is specified.
BGL_INDEX Use indexed color (8-bit graphics). Not currently supported.
BGL_SINGLE Use single-buffering; all rendering is done directly to the
display. This is not currently supported by the BeOS implementation of
OpenGL. This is the default
BGL_DOUBLE Use double-buffered graphics. All rendering is done to an
off-screen buffer and only becomes visible when the SwapBuffers()
function is called.
BGL_ACCUM Requests that the view have an accumulation buffer.
BGL_ALPHA Requests that the view's color buffer include an alpha
component.
BGL_DEPTH Requests that the view have a depth buffer.
BGL_STENCIL Requests that the view have a stencil buffer.
Right now i'm trying to get rid of the last of the _mesa_* calls from
the gallium target
as they're cheating a bit.
-- Alex
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev