Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

swpipe: Cleanup; Store GalliumContext

* Store GalliumContext in st_manager_private
  • Loading branch information...
commit d31319b9412cea4f421d0ea2807ebac262668948 1 parent 2b69feb
@kallisti5 kallisti5 authored
View
37 src/add-ons/opengl/swpipe/GalliumContext.cpp
@@ -49,37 +49,14 @@ static void
hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
GLsizei width, GLsizei height)
{
- TRACE("%s(glContext: %p, x: %d, y: %d, width: %d, height: %d\n", __func__,
+ TRACE("%s(glContext: %p, x: %d, y: %d, w: %d, h: %d\n", __func__,
glContext, x, y, width, height);
-#if 0
- struct hgl_context* context = DOWNCAST(hgl_context, gl_context, glContext);
-
- if (!context) {
- ERROR("%s: No context yet. bailing.\n", __func__);
- return;
- }
-
- int32 bitmapWidth;
- int32 bitmapHeight;
-
- get_bitmap_size(context->bitmap, &bitmapWidth, &bitmapHeight);
-
- if (width != bitmapWidth || height != bitmapHeight) {
- struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
- struct gl_framebuffer *read = glContext->WinSysReadBuffer;
-
- if (draw)
- _mesa_resize_framebuffer(glContext, draw, bitmapWidth, bitmapHeight);
- if (read)
- _mesa_resize_framebuffer(glContext, read, bitmapWidth, bitmapHeight);
- }
-#endif
struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
struct gl_framebuffer *read = glContext->WinSysReadBuffer;
- // TODO: SLOW! We need to check for changes in size here.
-
+ // TODO: SLOW! We need to check for changes in bitmap vs gl_framebuffer
+ // size before doing a _mesa_resize_framebuffer.
if (draw)
_mesa_resize_framebuffer(glContext, draw, width, height);
if (read)
@@ -313,8 +290,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
// Convert Mesa calculated visual into state tracker visual
context->stVisual = hgl_fill_st_visual(glVisual);
- context->draw = new GalliumFramebuffer(context->stVisual);
- context->read = new GalliumFramebuffer(context->stVisual);
+ context->draw = new GalliumFramebuffer(context->stVisual, (void*)this);
+ context->read = new GalliumFramebuffer(context->stVisual, (void*)this);
if (!context->draw || !context->read) {
ERROR("%s: Problem allocating framebuffer!\n", __func__);
@@ -377,7 +354,7 @@ GalliumContext::CreateContext(Bitmap *bitmap)
//context->postProcess = pp_init(fScreen, context->postProcessEnable);
assert(!context->st->st_manager_private);
- context->st->st_manager_private = (void*)context;
+ context->st->st_manager_private = (void*)this;
struct st_context *stContext = (struct st_context*)context->st;
@@ -470,7 +447,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, context_id contextID)
if (!bitmap) {
api->make_current(context->api, NULL, NULL, NULL);
- return B_ERROR;
+ return B_OK;
}
// Everything seems valid, lets set the new context.
View
4 src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp
@@ -60,7 +60,8 @@ hgl_framebuffer_validate(struct st_framebuffer_iface* stfb,
}
-GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual)
+GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual,
+ void* privateContext)
:
fBuffer(NULL)
{
@@ -73,6 +74,7 @@ GalliumFramebuffer::GalliumFramebuffer(struct st_visual* visual)
fBuffer->visual = visual;
fBuffer->flush_front = hgl_framebuffer_flush_front;
fBuffer->validate = hgl_framebuffer_validate;
+ fBuffer->st_manager_private = privateContext;
pipe_mutex_init(fMutex);
}
View
3  src/add-ons/opengl/swpipe/GalliumFramebuffer.h
@@ -18,7 +18,8 @@ extern "C" {
class GalliumFramebuffer {
public:
- GalliumFramebuffer(struct st_visual* visual);
+ GalliumFramebuffer(struct st_visual* visual,
+ void* privateContext);
~GalliumFramebuffer();
status_t Lock();
status_t Unlock();
View
2  src/add-ons/opengl/swpipe/SoftwareWinsys.cpp
@@ -64,7 +64,7 @@ hook_winsys_displaytarget_create(struct sw_winsys* winsys,
unsigned textureUsage, enum pipe_format format, unsigned width,
unsigned height, unsigned alignment, unsigned* stride)
{
- CALLED();
+ TRACE("%s: %dx%d\n", __func__, width, height);
struct haiku_displaytarget* haikuDisplayTarget
= CALLOC_STRUCT(haiku_displaytarget);
Please sign in to comment.
Something went wrong with that request. Please try again.