Path: blob/21.2-virgl/src/gallium/frontends/wgl/stw_winsys.h
4561 views
/**************************************************************************1*2* Copyright 2008-2009 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627#ifndef STW_WINSYS_H28#define STW_WINSYS_H2930#include <windows.h> /* for HDC */3132#include "pipe/p_compiler.h"33#include "frontend/api.h"3435struct pipe_screen;36struct pipe_context;37struct pipe_resource;3839struct stw_shared_surface;4041typedef enum42{43stw_pfd_gdi_support = 1 << 0,44stw_pfd_double_buffer = 1 << 1,45} stw_pfd_flag;4647struct stw_winsys_framebuffer48{49void50(*destroy)(struct stw_winsys_framebuffer *fb,51struct pipe_context *context);5253boolean54(*present)(struct stw_winsys_framebuffer *fb);5556void57(*resize)(struct stw_winsys_framebuffer *fb,58struct pipe_context *context,59struct pipe_resource *templ);6061struct pipe_resource *62(*get_resource)(struct stw_winsys_framebuffer *fb,63enum st_attachment_type statt);64};6566struct stw_winsys67{68struct pipe_screen *69(*create_screen)( HDC hDC );7071/* XXX is it actually possible to have non-zero level/layer ??? */72/**73* Present the color buffer to the window associated with the device context.74*/75void76(*present)( struct pipe_screen *screen,77struct pipe_context *context,78struct pipe_resource *res,79HDC hDC );8081/**82* Locally unique identifier (LUID) of the graphics adapter.83*84* @sa GLCBPRESENTBUFFERSDATA::AdapterLuid;85*/86boolean87(*get_adapter_luid)( struct pipe_screen *screen,88HDC hDC,89LUID *pAdapterLuid );9091/**92* Open a shared surface (optional).93*94* @sa GLCBPRESENTBUFFERSDATA::hSharedSurface;95*/96struct stw_shared_surface *97(*shared_surface_open)(struct pipe_screen *screen,98HANDLE hSharedSurface);99100/**101* Close a shared surface (optional).102*/103void104(*shared_surface_close)(struct pipe_screen *screen,105struct stw_shared_surface *surface);106107/**108* Compose into a shared surface (optional).109*110* Blit the color buffer into a shared surface.111*112* @sa GLPRESENTBUFFERSDATA::PresentHistoryToken.113*/114void115(*compose)( struct pipe_screen *screen,116struct pipe_resource *res,117struct stw_shared_surface *dest,118LPCRECT pRect,119ULONGLONG PresentHistoryToken );120121/**122* Query whether the driver can support GDI and/or double-buffering in its123* pixel formats (optional).124*/125unsigned126(*get_pfd_flags)( struct pipe_screen *screen );127128/**129* Create a winsys-specific object for a given DC's framebuffer130*/131struct stw_winsys_framebuffer *132(*create_framebuffer)( struct pipe_screen *screen,133HDC hDC,134int iPixelFormat );135};136137boolean138stw_init(const struct stw_winsys *stw_winsys);139140boolean141stw_init_thread(void);142143void144stw_cleanup_thread(void);145146void147stw_cleanup(void);148149#endif /* STW_WINSYS_H */150151152