17ec681f3Smrg/************************************************************************** 27ec681f3Smrg * 37ec681f3Smrg * Copyright 2008-2009 VMware, Inc. 47ec681f3Smrg * All Rights Reserved. 57ec681f3Smrg * 67ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 77ec681f3Smrg * copy of this software and associated documentation files (the 87ec681f3Smrg * "Software"), to deal in the Software without restriction, including 97ec681f3Smrg * without limitation the rights to use, copy, modify, merge, publish, 107ec681f3Smrg * distribute, sub license, and/or sell copies of the Software, and to 117ec681f3Smrg * permit persons to whom the Software is furnished to do so, subject to 127ec681f3Smrg * the following conditions: 137ec681f3Smrg * 147ec681f3Smrg * The above copyright notice and this permission notice (including the 157ec681f3Smrg * next paragraph) shall be included in all copies or substantial portions 167ec681f3Smrg * of the Software. 177ec681f3Smrg * 187ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 197ec681f3Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 207ec681f3Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 217ec681f3Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR 227ec681f3Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 237ec681f3Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 247ec681f3Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 257ec681f3Smrg * 267ec681f3Smrg **************************************************************************/ 277ec681f3Smrg 287ec681f3Smrg#ifndef STW_WINSYS_H 297ec681f3Smrg#define STW_WINSYS_H 307ec681f3Smrg 317ec681f3Smrg#include <windows.h> /* for HDC */ 327ec681f3Smrg 337ec681f3Smrg#include "pipe/p_compiler.h" 347ec681f3Smrg#include "frontend/api.h" 357ec681f3Smrg 367ec681f3Smrgstruct pipe_screen; 377ec681f3Smrgstruct pipe_context; 387ec681f3Smrgstruct pipe_resource; 397ec681f3Smrg 407ec681f3Smrgstruct stw_shared_surface; 417ec681f3Smrg 427ec681f3Smrgtypedef enum 437ec681f3Smrg{ 447ec681f3Smrg stw_pfd_gdi_support = 1 << 0, 457ec681f3Smrg stw_pfd_double_buffer = 1 << 1, 467ec681f3Smrg} stw_pfd_flag; 477ec681f3Smrg 487ec681f3Smrgstruct stw_winsys_framebuffer 497ec681f3Smrg{ 507ec681f3Smrg void 517ec681f3Smrg (*destroy)(struct stw_winsys_framebuffer *fb, 527ec681f3Smrg struct pipe_context *context); 537ec681f3Smrg 547ec681f3Smrg boolean 557ec681f3Smrg (*present)(struct stw_winsys_framebuffer *fb); 567ec681f3Smrg 577ec681f3Smrg void 587ec681f3Smrg (*resize)(struct stw_winsys_framebuffer *fb, 597ec681f3Smrg struct pipe_context *context, 607ec681f3Smrg struct pipe_resource *templ); 617ec681f3Smrg 627ec681f3Smrg struct pipe_resource * 637ec681f3Smrg (*get_resource)(struct stw_winsys_framebuffer *fb, 647ec681f3Smrg enum st_attachment_type statt); 657ec681f3Smrg}; 667ec681f3Smrg 677ec681f3Smrgstruct stw_winsys 687ec681f3Smrg{ 697ec681f3Smrg struct pipe_screen * 707ec681f3Smrg (*create_screen)( HDC hDC ); 717ec681f3Smrg 727ec681f3Smrg /* XXX is it actually possible to have non-zero level/layer ??? */ 737ec681f3Smrg /** 747ec681f3Smrg * Present the color buffer to the window associated with the device context. 757ec681f3Smrg */ 767ec681f3Smrg void 777ec681f3Smrg (*present)( struct pipe_screen *screen, 787ec681f3Smrg struct pipe_context *context, 797ec681f3Smrg struct pipe_resource *res, 807ec681f3Smrg HDC hDC ); 817ec681f3Smrg 827ec681f3Smrg /** 837ec681f3Smrg * Locally unique identifier (LUID) of the graphics adapter. 847ec681f3Smrg * 857ec681f3Smrg * @sa GLCBPRESENTBUFFERSDATA::AdapterLuid; 867ec681f3Smrg */ 877ec681f3Smrg boolean 887ec681f3Smrg (*get_adapter_luid)( struct pipe_screen *screen, 897ec681f3Smrg HDC hDC, 907ec681f3Smrg LUID *pAdapterLuid ); 917ec681f3Smrg 927ec681f3Smrg /** 937ec681f3Smrg * Open a shared surface (optional). 947ec681f3Smrg * 957ec681f3Smrg * @sa GLCBPRESENTBUFFERSDATA::hSharedSurface; 967ec681f3Smrg */ 977ec681f3Smrg struct stw_shared_surface * 987ec681f3Smrg (*shared_surface_open)(struct pipe_screen *screen, 997ec681f3Smrg HANDLE hSharedSurface); 1007ec681f3Smrg 1017ec681f3Smrg /** 1027ec681f3Smrg * Close a shared surface (optional). 1037ec681f3Smrg */ 1047ec681f3Smrg void 1057ec681f3Smrg (*shared_surface_close)(struct pipe_screen *screen, 1067ec681f3Smrg struct stw_shared_surface *surface); 1077ec681f3Smrg 1087ec681f3Smrg /** 1097ec681f3Smrg * Compose into a shared surface (optional). 1107ec681f3Smrg * 1117ec681f3Smrg * Blit the color buffer into a shared surface. 1127ec681f3Smrg * 1137ec681f3Smrg * @sa GLPRESENTBUFFERSDATA::PresentHistoryToken. 1147ec681f3Smrg */ 1157ec681f3Smrg void 1167ec681f3Smrg (*compose)( struct pipe_screen *screen, 1177ec681f3Smrg struct pipe_resource *res, 1187ec681f3Smrg struct stw_shared_surface *dest, 1197ec681f3Smrg LPCRECT pRect, 1207ec681f3Smrg ULONGLONG PresentHistoryToken ); 1217ec681f3Smrg 1227ec681f3Smrg /** 1237ec681f3Smrg * Query whether the driver can support GDI and/or double-buffering in its 1247ec681f3Smrg * pixel formats (optional). 1257ec681f3Smrg */ 1267ec681f3Smrg unsigned 1277ec681f3Smrg (*get_pfd_flags)( struct pipe_screen *screen ); 1287ec681f3Smrg 1297ec681f3Smrg /** 1307ec681f3Smrg * Create a winsys-specific object for a given DC's framebuffer 1317ec681f3Smrg */ 1327ec681f3Smrg struct stw_winsys_framebuffer * 1337ec681f3Smrg (*create_framebuffer)( struct pipe_screen *screen, 1347ec681f3Smrg HWND hWnd, 1357ec681f3Smrg int iPixelFormat ); 1367ec681f3Smrg 1377ec681f3Smrg /** 1387ec681f3Smrg * Get the name of the screen that was created 1397ec681f3Smrg */ 1407ec681f3Smrg const char * 1417ec681f3Smrg (*get_name)(void); 1427ec681f3Smrg}; 1437ec681f3Smrg 1447ec681f3Smrgboolean 1457ec681f3Smrgstw_init(const struct stw_winsys *stw_winsys); 1467ec681f3Smrg 1477ec681f3Smrgboolean 1487ec681f3Smrgstw_init_thread(void); 1497ec681f3Smrg 1507ec681f3Smrgvoid 1517ec681f3Smrgstw_cleanup_thread(void); 1527ec681f3Smrg 1537ec681f3Smrgvoid 1547ec681f3Smrgstw_cleanup(void); 1557ec681f3Smrg 1567ec681f3Smrg#endif /* STW_WINSYS_H */ 157