mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 18:18:06 +02:00
st/xlib: add HUD support for xlib/GLX
For the softpipe and llvmpipe drivers. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
f5071783c1
commit
5192262833
4 changed files with 34 additions and 0 deletions
|
|
@ -64,6 +64,8 @@
|
|||
#include "util/u_atomic.h"
|
||||
#include "util/u_inlines.h"
|
||||
|
||||
#include "hud/hud_context.h"
|
||||
|
||||
#include "xm_public.h"
|
||||
#include <GL/glx.h>
|
||||
|
||||
|
|
@ -910,6 +912,8 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list,
|
|||
|
||||
c->st->st_manager_private = (void *) c;
|
||||
|
||||
c->hud = hud_create(c->st->pipe, c->st->cso_context);
|
||||
|
||||
return c;
|
||||
|
||||
fail:
|
||||
|
|
@ -925,6 +929,10 @@ fail:
|
|||
PUBLIC
|
||||
void XMesaDestroyContext( XMesaContext c )
|
||||
{
|
||||
if (c->hud) {
|
||||
hud_destroy(c->hud);
|
||||
}
|
||||
|
||||
c->st->destroy(c->st);
|
||||
|
||||
/* FIXME: We should destroy the screen here, but if we do so, surfaces may
|
||||
|
|
@ -1224,6 +1232,13 @@ void XMesaSwapBuffers( XMesaBuffer b )
|
|||
{
|
||||
XMesaContext xmctx = XMesaGetCurrentContext();
|
||||
|
||||
/* Need to draw HUD before flushing */
|
||||
if (xmctx && xmctx->hud) {
|
||||
struct pipe_resource *back =
|
||||
xmesa_get_framebuffer_resource(b->stfb, ST_ATTACHMENT_BACK_LEFT);
|
||||
hud_draw(xmctx->hud, back);
|
||||
}
|
||||
|
||||
if (xmctx && xmctx->xm_buffer == b) {
|
||||
xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ and create a window, you must do the following to use the X/Mesa interface:
|
|||
# include <X11/Xlibint.h>
|
||||
# include <X11/Xutil.h>
|
||||
|
||||
struct hud_context;
|
||||
|
||||
typedef struct xmesa_display *XMesaDisplay;
|
||||
typedef struct xmesa_buffer *XMesaBuffer;
|
||||
typedef struct xmesa_context *XMesaContext;
|
||||
|
|
@ -305,6 +307,7 @@ struct xmesa_context {
|
|||
XMesaVisual xm_visual; /** pixel format info */
|
||||
XMesaBuffer xm_buffer; /** current drawbuffer */
|
||||
XMesaBuffer xm_read_buffer; /** current readbuffer */
|
||||
struct hud_context *hud;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -317,6 +317,18 @@ xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi)
|
|||
free(stfbi);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the pipe_surface which corresponds to the given
|
||||
* framebuffer attachment.
|
||||
*/
|
||||
struct pipe_resource *
|
||||
xmesa_get_framebuffer_resource(struct st_framebuffer_iface *stfbi,
|
||||
enum st_attachment_type att)
|
||||
{
|
||||
struct xmesa_st_framebuffer *xstfb = xmesa_st_framebuffer(stfbi);
|
||||
return xstfb->textures[att];
|
||||
}
|
||||
|
||||
void
|
||||
xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ xmesa_create_st_framebuffer(XMesaDisplay xmdpy, XMesaBuffer b);
|
|||
void
|
||||
xmesa_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
|
||||
|
||||
struct pipe_resource *
|
||||
xmesa_get_framebuffer_resource(struct st_framebuffer_iface *stfbi,
|
||||
enum st_attachment_type att);
|
||||
|
||||
void
|
||||
xmesa_swap_st_framebuffer(struct st_framebuffer_iface *stfbi);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue