v2: fix a few minor issues spotted by Jose.
Reviewed-by: José Fonseca <jfonseca@vmware.com>
#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"
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 );
return ctx->dhglrc;
no_hglrc:
+ if (ctx->hud) {
+ hud_destroy(ctx->hud);
+ }
ctx->st->destroy(ctx->st);
no_st_ctx:
FREE(ctx);
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);
#include <windows.h>
+struct hud_context;
struct stw_framebuffer;
struct st_context_iface;
HDC hdc;
struct stw_framebuffer *current_framebuffer;
+
+ struct hud_context *hud;
};
DHGLRC stw_create_context_attribs( HDC hdc, INT iLayerPlane, DHGLRC hShareContext,
#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"
DrvSwapBuffers(
HDC hdc )
{
+ struct stw_context *ctx;
struct stw_framebuffer *fb;
if (!stw_dev)
return TRUE;
}
+ /* Display the HUD */
+ ctx = stw_current_context();
+ 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);
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.
*/
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 */