[Mesa-dev] [PATCH 4/4] st/wgl: add HUD support
Brian Paul
brianp at vmware.com
Wed Apr 3 16:39:41 PDT 2013
---
src/gallium/state_trackers/wgl/stw_context.c | 9 +++++++++
src/gallium/state_trackers/wgl/stw_context.h | 3 +++
src/gallium/state_trackers/wgl/stw_framebuffer.c | 9 +++++++++
src/gallium/state_trackers/wgl/stw_st.c | 13 +++++++++++++
src/gallium/state_trackers/wgl/stw_st.h | 4 ++++
5 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index 5e5b41f..3583fe3 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -38,6 +38,7 @@
#include "util/u_memory.h"
#include "util/u_atomic.h"
#include "state_tracker/st_api.h"
+#include "hud/hud_context.h"
#include "stw_icd.h"
#include "stw_device.h"
@@ -217,6 +218,10 @@ stw_create_context_attribs(
ctx->st->st_manager_private = (void *) ctx;
+ if (ctx->st->cso_context) {
+ ctx->hud = hud_create(ctx->st->pipe, ctx->st->cso_context);
+ }
+
pipe_mutex_lock( stw_dev->ctx_mutex );
ctx->dhglrc = handle_table_add(stw_dev->ctx_table, ctx);
pipe_mutex_unlock( stw_dev->ctx_mutex );
@@ -255,6 +260,10 @@ DrvDeleteContext(
if (curctx == ctx)
stw_dev->stapi->make_current(stw_dev->stapi, NULL, NULL, NULL);
+ if (ctx->hud) {
+ hud_destroy(ctx->hud);
+ }
+
ctx->st->destroy(ctx->st);
FREE(ctx);
diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h
index 2a4afb6..d225e23 100644
--- a/src/gallium/state_trackers/wgl/stw_context.h
+++ b/src/gallium/state_trackers/wgl/stw_context.h
@@ -30,6 +30,7 @@
#include "stw_icd.h"
+struct hud_context;
struct stw_framebuffer;
struct st_context_iface;
@@ -41,6 +42,8 @@ struct stw_context
HDC hdc;
struct stw_framebuffer *current_framebuffer;
+
+ struct hud_context *hud;
};
DHGLRC stw_create_context_attribs( HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 449c537..506672c 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -31,6 +31,7 @@
#include "pipe/p_screen.h"
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "hud/hud_context.h"
#include "state_tracker/st_api.h"
#include "stw_icd.h"
@@ -593,6 +594,7 @@ BOOL APIENTRY
DrvSwapBuffers(
HDC hdc )
{
+ struct stw_context *ctx = stw_current_context();
struct stw_framebuffer *fb;
if (!stw_dev)
@@ -607,6 +609,13 @@ DrvSwapBuffers(
return TRUE;
}
+ /* Display the HUD */
+ if (ctx && ctx->hud) {
+ struct pipe_resource *back =
+ stw_get_framebuffer_resource(fb->stfb, ST_ATTACHMENT_BACK_LEFT);
+ hud_draw(ctx->hud, back);
+ }
+
stw_flush_current_locked(fb);
return stw_st_swap_framebuffer_locked(hdc, fb->stfb);
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index dcf9587..3acf266 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -263,6 +263,19 @@ stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb)
return stw_st_framebuffer_present_locked(hdc, &stwfb->base, front);
}
+
+/**
+ * Return the pipe_resource that correspond to given buffer.
+ */
+struct pipe_resource *
+stw_get_framebuffer_resource(struct st_framebuffer_iface *stfb,
+ enum st_attachment_type att)
+{
+ struct stw_st_framebuffer *stwfb = stw_st_framebuffer(stfb);
+ return stwfb->textures[att];
+}
+
+
/**
* Create an st_api of the state tracker.
*/
diff --git a/src/gallium/state_trackers/wgl/stw_st.h b/src/gallium/state_trackers/wgl/stw_st.h
index 945d350..c2473c7 100644
--- a/src/gallium/state_trackers/wgl/stw_st.h
+++ b/src/gallium/state_trackers/wgl/stw_st.h
@@ -46,4 +46,8 @@ stw_st_destroy_framebuffer_locked(struct st_framebuffer_iface *stfb);
boolean
stw_st_swap_framebuffer_locked(HDC hdc, struct st_framebuffer_iface *stfb);
+struct pipe_resource *
+stw_get_framebuffer_resource(struct st_framebuffer_iface *stfb,
+ enum st_attachment_type att);
+
#endif /* STW_ST_H */
--
1.7.3.4
More information about the mesa-dev
mailing list