[haiku-commits] haiku: hrev45403 - src/add-ons/opengl/swpipe

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 24 Mar 2013 02:57:20 +0100 (CET)

hrev45403 adds 1 changeset to branch 'master'
old head: 066ca38aea3742d0054963b76fd1259125bb3e5b
new head: 2b69feb92e32b49d3909e4e9ec1b65a5b144306d
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=2b69feb+%5E066ca38

----------------------------------------------------------------------------

2b69feb: swpipe: Update for new Mesa
  
  * Fix swpipe build.
  * DriverCtx went away.. lovely.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev45403
Commit:      2b69feb92e32b49d3909e4e9ec1b65a5b144306d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2b69feb
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Sun Mar 24 01:55:38 2013 UTC

----------------------------------------------------------------------------

5 files changed, 23 insertions(+), 14 deletions(-)
src/add-ons/opengl/swpipe/GalliumContext.cpp     | 17 ++++++++++++++---
src/add-ons/opengl/swpipe/GalliumContext.h       |  7 ++-----
src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp |  4 ++--
src/add-ons/opengl/swpipe/SoftwareRenderer.cpp   |  1 +
src/add-ons/opengl/swpipe/SoftwareWinsys.cpp     |  8 ++++----

----------------------------------------------------------------------------

diff --git a/src/add-ons/opengl/swpipe/GalliumContext.cpp 
b/src/add-ons/opengl/swpipe/GalliumContext.cpp
index bf8ee85..7f616e4 100644
--- a/src/add-ons/opengl/swpipe/GalliumContext.cpp
+++ b/src/add-ons/opengl/swpipe/GalliumContext.cpp
@@ -51,7 +51,9 @@ hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
 {
        TRACE("%s(glContext: %p, x: %d, y: %d, width: %d, height: %d\n", 
__func__,
                glContext, x, y, width, height);
-       struct hgl_context *context = (struct hgl_context*)glContext->DriverCtx;
+
+#if 0
+       struct hgl_context* context = DOWNCAST(hgl_context, gl_context, 
glContext);
 
        if (!context) {
                ERROR("%s: No context yet. bailing.\n", __func__);
@@ -72,6 +74,16 @@ hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
                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. 
+
+       if (draw)
+               _mesa_resize_framebuffer(glContext, draw, width, height);
+       if (read)
+               _mesa_resize_framebuffer(glContext, read, width, height);
 }
 
 
@@ -362,14 +374,13 @@ GalliumContext::CreateContext(Bitmap *bitmap)
        }
 
        // Init Gallium3D Post Processing
-       context->postProcess = pp_init(fScreen, context->postProcessEnable);
+       //context->postProcess = pp_init(fScreen, context->postProcessEnable);
 
        assert(!context->st->st_manager_private);
        context->st->st_manager_private = (void*)context;
 
        struct st_context *stContext = (struct st_context*)context->st;
        
-       stContext->ctx->DriverCtx = context;
        stContext->ctx->Driver.Viewport = hgl_viewport;
 
        // TODO: Closely review this next context logic...
diff --git a/src/add-ons/opengl/swpipe/GalliumContext.h 
b/src/add-ons/opengl/swpipe/GalliumContext.h
index 3091b14..b65803d 100644
--- a/src/add-ons/opengl/swpipe/GalliumContext.h
+++ b/src/add-ons/opengl/swpipe/GalliumContext.h
@@ -9,6 +9,8 @@
 #define GALLIUMCONTEXT_H
 
 
+#include <stddef.h>
+
 extern "C" {
 #include "state_tracker/st_api.h"
 #include "pipe/p_compiler.h"
@@ -22,11 +24,6 @@ extern "C" {
 
 #define CONTEXT_MAX 32
 
-// HACK: offsetof must be redefined before loading sp_context.h
-// in GalliumContext.cpp
-#undef offsetof
-#define offsetof( type, member ) ((size_t) &((type *)0)->member)
-
 
 typedef int64 context_id;
 
diff --git a/src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp 
b/src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp
index a66dd27..87c9739 100644
--- a/src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp
+++ b/src/add-ons/opengl/swpipe/GalliumFramebuffer.cpp
@@ -30,8 +30,8 @@ extern "C" {
 
 
 static boolean
-hgl_framebuffer_flush_front(struct st_framebuffer_iface* stfb,
-       enum st_attachment_type statt)
+hgl_framebuffer_flush_front(struct st_context_iface *stctx,
+       struct st_framebuffer_iface* stfb, enum st_attachment_type statt)
 {
        CALLED();
        // TODO: I have *NO* idea how we are going to access this data...
diff --git a/src/add-ons/opengl/swpipe/SoftwareRenderer.cpp 
b/src/add-ons/opengl/swpipe/SoftwareRenderer.cpp
index fc60df2..e9c133a 100644
--- a/src/add-ons/opengl/swpipe/SoftwareRenderer.cpp
+++ b/src/add-ons/opengl/swpipe/SoftwareRenderer.cpp
@@ -354,6 +354,7 @@ SoftwareRenderer::_AllocateBitmap()
                TRACE("%s: Can't create bitmap!\n", __func__);
                return;
        }
+
 #if 0
        // debug..
        void *data = fBitmap->Bits();
diff --git a/src/add-ons/opengl/swpipe/SoftwareWinsys.cpp 
b/src/add-ons/opengl/swpipe/SoftwareWinsys.cpp
index cd4e24b..1a0dd08 100644
--- a/src/add-ons/opengl/swpipe/SoftwareWinsys.cpp
+++ b/src/add-ons/opengl/swpipe/SoftwareWinsys.cpp
@@ -79,11 +79,11 @@ hook_winsys_displaytarget_create(struct sw_winsys* winsys,
        haikuDisplayTarget->width = width;
        haikuDisplayTarget->height = height;
 
-       //unsigned bitsPerPixel = util_format_get_blocksizebits(format);
-       unsigned colorsPerPalette = util_format_get_blocksize(format);
+       unsigned formatStride = util_format_get_stride(format, width);
+       unsigned blockSize = util_format_get_nblocksy(format, height);
 
-       haikuDisplayTarget->stride = align(width * colorsPerPalette, alignment);
-       haikuDisplayTarget->size = haikuDisplayTarget->stride * height;
+       haikuDisplayTarget->stride = align(formatStride, alignment);
+       haikuDisplayTarget->size = haikuDisplayTarget->stride * blockSize;
 
        haikuDisplayTarget->data
                = align_malloc(haikuDisplayTarget->size, alignment);


Other related posts:

  • » [haiku-commits] haiku: hrev45403 - src/add-ons/opengl/swpipe - kallisti5