diff options
author | Alexander von Gluck IV <[email protected]> | 2014-08-29 15:06:09 +0000 |
---|---|---|
committer | Alexander von Gluck IV <[email protected]> | 2014-08-30 19:35:24 -0400 |
commit | 7b6ea6ab8ce7afef1b3a992be5287a9210c0e095 (patch) | |
tree | 0b66dd9a8745c3e3319299b24740fce3153b4429 /src/gallium/targets | |
parent | 15da8d076110c39d3ce34ac45edf0f3c9ab13b7f (diff) |
st/hgl: Move st_visual create/destroy into hgl state_tracker
Diffstat (limited to 'src/gallium/targets')
-rw-r--r-- | src/gallium/targets/haiku-softpipe/GalliumContext.cpp | 102 | ||||
-rw-r--r-- | src/gallium/targets/haiku-softpipe/GalliumContext.h | 2 |
2 files changed, 5 insertions, 99 deletions
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp index ed4171282d8..5df5234bcbc 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp @@ -103,95 +103,6 @@ GalliumContext::~GalliumContext() } -struct st_visual* -GalliumContext::CreateVisual() -{ - struct st_visual* visual = CALLOC_STRUCT(st_visual); - if (!visual) { - ERROR("%s: Couldn't allocate st_visual\n", __func__); - return NULL; - } - - // Calculate visual configuration - const GLboolean rgbFlag = ((fOptions & BGL_INDEX) == 0); - const GLboolean alphaFlag = ((fOptions & BGL_ALPHA) == BGL_ALPHA); - const GLboolean dblFlag = ((fOptions & BGL_DOUBLE) == BGL_DOUBLE); - const GLboolean stereoFlag = false; - const GLint depth = (fOptions & BGL_DEPTH) ? 24 : 0; - const GLint stencil = (fOptions & BGL_STENCIL) ? 8 : 0; - const GLint accum = (fOptions & BGL_ACCUM) ? 16 : 0; - const GLint red = rgbFlag ? 8 : 5; - const GLint green = rgbFlag ? 8 : 5; - const GLint blue = rgbFlag ? 8 : 5; - const GLint alpha = alphaFlag ? 8 : 0; - - TRACE("rgb :\t%d\n", (bool)rgbFlag); - 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("red :\t%d\n", red); - TRACE("green :\t%d\n", green); - TRACE("blue :\t%d\n", blue); - TRACE("alpha :\t%d\n", alpha); - - // Determine color format - if (red == 8) { - if (alpha == 8) - visual->color_format = PIPE_FORMAT_A8R8G8B8_UNORM; - else - visual->color_format = PIPE_FORMAT_X8R8G8B8_UNORM; - } else { - // TODO: I think this should be RGB vs BGR - visual->color_format = PIPE_FORMAT_B5G6R5_UNORM; - } - - // Determine depth stencil format - switch (depth) { - default: - case 0: - visual->depth_stencil_format = PIPE_FORMAT_NONE; - break; - case 16: - visual->depth_stencil_format = PIPE_FORMAT_Z16_UNORM; - break; - case 24: - if ((fOptions & BGL_STENCIL) != 0) - visual->depth_stencil_format = PIPE_FORMAT_S8_UINT_Z24_UNORM; - else - visual->depth_stencil_format = PIPE_FORMAT_X8Z24_UNORM; - break; - case 32: - visual->depth_stencil_format = PIPE_FORMAT_Z32_UNORM; - break; - } - - visual->accum_format = (fOptions & BGL_ACCUM) - ? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE; - - visual->buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK; - visual->render_buffer = ST_ATTACHMENT_FRONT_LEFT; - - if (dblFlag) { - visual->buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK; - visual->render_buffer = ST_ATTACHMENT_BACK_LEFT; - } - - if (stereoFlag) { - visual->buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK; - if (dblFlag) - visual->buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK; - } - - if ((fOptions & BGL_DEPTH) || (fOptions & BGL_STENCIL)) - visual->buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK; - - return visual; -} - - status_t GalliumContext::CreateScreen() { @@ -251,12 +162,9 @@ GalliumContext::CreateContext(Bitmap *bitmap) context->manager = hgl_create_st_manager(fScreen); // Create state tracker visual - context->stVisual = CreateVisual(); - if (context->stVisual == NULL) { - ERROR("%s: Couldn't create state_tracker visual!\n", __func__); - return -1; - } + context->stVisual = hgl_create_st_visual(fOptions); + // Create state tracker framebuffers context->draw = hgl_create_st_framebuffer(context); context->read = hgl_create_st_framebuffer(context); @@ -310,7 +218,7 @@ GalliumContext::CreateContext(Bitmap *bitmap) break; } - FREE(context->stVisual); + hgl_destroy_st_visual(context->stVisual); FREE(context); return -1; } @@ -371,14 +279,14 @@ GalliumContext::DestroyContext(context_id contextID) if (fContext[contextID]->postProcess) pp_free(fContext[contextID]->postProcess); - // Delete framebuffer objects + // Delete state tracker framebuffer objects if (fContext[contextID]->read) delete fContext[contextID]->read; if (fContext[contextID]->draw) delete fContext[contextID]->draw; if (fContext[contextID]->stVisual) - FREE(fContext[contextID]->stVisual); + hgl_destroy_st_visual(fContext[contextID]->stVisual); if (fContext[contextID]->manager) hgl_destroy_st_manager(fContext[contextID]->manager); diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.h b/src/gallium/targets/haiku-softpipe/GalliumContext.h index cf8895e6826..6f8a4d0bda3 100644 --- a/src/gallium/targets/haiku-softpipe/GalliumContext.h +++ b/src/gallium/targets/haiku-softpipe/GalliumContext.h @@ -33,8 +33,6 @@ public: void Lock(); void Unlock(); - struct st_visual* CreateVisual(); - context_id CreateContext(Bitmap* bitmap); void DestroyContext(context_id contextID); context_id GetCurrentContext() { return fCurrentContext; }; |