intel/compiler: Always apply sample mask on Vulkan.
[mesa.git] / src / gallium / targets / haiku-softpipe / GalliumContext.cpp
index df222f6580a9ea4aa7d91940eed619800f793a8f..ead238194bf6e06066d4db2c3ea1d91f7451e48c 100644 (file)
 //#include "state_tracker/st_cb_flush.h"
 #include "state_tracker/st_context.h"
 #include "state_tracker/st_gl_api.h"
-#include "state_tracker/sw_winsys.h"
+#include "frontend/sw_winsys.h"
 #include "sw/hgl/hgl_sw_winsys.h"
 #include "util/u_atomic.h"
 #include "util/u_memory.h"
+#include "util/u_framebuffer.h"
 
 #include "target-helpers/inline_sw_helper.h"
 #include "target-helpers/inline_debug_helper.h"
@@ -69,7 +70,7 @@ GalliumContext::~GalliumContext()
                DestroyContext(i);
        Unlock();
 
-       pipe_mutex_destroy(fMutex);
+       mtx_destroy(&fMutex);
 
        // TODO: Destroy fScreen
 }
@@ -242,7 +243,7 @@ GalliumContext::DestroyContext(context_id contextID)
                return;
 
        if (fContext[contextID]->st) {
-               fContext[contextID]->st->flush(fContext[contextID]->st, 0, NULL);
+               fContext[contextID]->st->flush(fContext[contextID]->st, 0, NULL, NULL, NULL);
                fContext[contextID]->st->destroy(fContext[contextID]->st);
        }
 
@@ -296,7 +297,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, context_id contextID)
 
        if (oldContextID > 0 && oldContextID != contextID) {
                fContext[oldContextID]->st->flush(fContext[oldContextID]->st,
-                       ST_FLUSH_FRONT, NULL);
+                       ST_FLUSH_FRONT, NULL, NULL, NULL);
        }
 
        // We need to lock and unlock framebuffers before accessing them
@@ -332,36 +333,17 @@ GalliumContext::SwapBuffers(context_id contextID)
                ERROR("%s: context not found\n", __func__);
                return B_ERROR;
        }
+       context->st->flush(context->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
 
-       // TODO: Where did st_notify_swapbuffers go?
-       //st_notify_swapbuffers(context->draw->stfbi);
-
-       context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
-
-       struct st_context *stContext = (struct st_context*)context->st;
-
-       unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs;
-       for (unsigned i = 0; i < nColorBuffers; i++) {
-               pipe_surface* surface = stContext->state.framebuffer.cbufs[i];
-               if (!surface) {
-                       ERROR("%s: Color buffer %d invalid!\n", __func__, i);
-                       continue;
-               }
-
-               TRACE("%s: Flushing color buffer #%d\n", __func__, i);
-
-               // We pass our destination bitmap to flush_fronbuffer which passes it
-               // to the private winsys display call.
-               fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
-                       context->bitmap, NULL);
+       struct hgl_buffer* buffer = hgl_st_framebuffer(context->draw->stfbi);
+       pipe_surface* surface = buffer->surface;
+       if (!surface) {
+               ERROR("%s: Invalid drawable surface!\n", __func__);
+               return B_ERROR;
        }
 
-       #if 0
-       // TODO... should we flush the z stencil buffer?
-       pipe_surface* zSurface = stContext->state.framebuffer.zsbuf;
-       fScreen->flush_frontbuffer(fScreen, zSurface->texture, 0, 0,
+       fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
                context->bitmap, NULL);
-       #endif
 
        return B_OK;
 }
@@ -406,7 +388,7 @@ void
 GalliumContext::Lock()
 {
        CALLED();
-       pipe_mutex_lock(fMutex);
+       mtx_lock(&fMutex);
 }
 
 
@@ -414,6 +396,6 @@ void
 GalliumContext::Unlock()
 {
        CALLED();
-       pipe_mutex_unlock(fMutex);
+       mtx_unlock(&fMutex);
 }
 /* vim: set tabstop=4: */