ReactOS  0.4.15-dev-1201-gb2cf5a4
opengl32.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wingdi.h>
#include <winddi.h>
#include <GL/gl.h>
#include <pstypes.h>
#include <wine/debug.h>
#include "icd.h"
Include dependency graph for opengl32.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wgl_context
 
struct  wgl_dc_data
 

Macros

#define WIN32_NO_STATUS
 
#define WGL_DC_OBJ_DC   0x1
 

Functions

static __inline BOOLEAN RemoveEntryList (_In_ PLIST_ENTRY Entry)
 
static __inline VOID InsertTailList (_In_ PLIST_ENTRY ListHead, _In_ PLIST_ENTRY Entry)
 
static __inline VOID InitializeListHead (_Inout_ PLIST_ENTRY ListHead)
 
void IntDeleteAllContexts (void)
 
void IntDeleteAllICDs (void)
 
FORCEINLINE const GLDISPATCHTABLEIntGetCurrentDispatchTable (void)
 
FORCEINLINE void IntSetCurrentDispatchTable (const GLDISPATCHTABLE *table)
 
FORCEINLINE void IntMakeCurrent (HGLRC hglrc, HDC hdc, struct wgl_dc_data *dc_data)
 
FORCEINLINE HGLRC IntGetCurrentRC (void)
 
FORCEINLINE HDC IntGetCurrentDC (void)
 
static struct wgl_dc_dataIntGetCurrentDcData (void)
 
FORCEINLINE void IntSetCurrentICDPrivate (void *value)
 
FORCEINLINE voidIntGetCurrentICDPrivate (void)
 
FORCEINLINE DHGLRC IntGetCurrentDHGLRC (void)
 
INT sw_DescribePixelFormat (HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr)
 
BOOL sw_SetPixelFormat (HDC hdc, struct wgl_dc_data *, INT format)
 
DHGLRC sw_CreateContext (struct wgl_dc_data *)
 
BOOL sw_DeleteContext (DHGLRC dhglrc)
 
BOOL sw_SetContext (struct wgl_dc_data *dc_data, DHGLRC dhglrc)
 
void sw_ReleaseContext (DHGLRC hglrc)
 
PROC sw_GetProcAddress (LPCSTR name)
 
BOOL sw_CopyContext (DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask)
 
BOOL sw_ShareLists (DHGLRC dhglrcSrc, DHGLRC dhglrcDst)
 
BOOL sw_SwapBuffers (HDC hdc, struct wgl_dc_data *dc_data)
 

Variables

LIST_ENTRY ContextListHead
 

Macro Definition Documentation

◆ WGL_DC_OBJ_DC

#define WGL_DC_OBJ_DC   0x1

Definition at line 84 of file opengl32.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 11 of file opengl32.h.

Function Documentation

◆ InitializeListHead()

static __inline VOID InitializeListHead ( _Inout_ PLIST_ENTRY  ListHead)
static

Definition at line 62 of file opengl32.h.

65 {
66  ListHead->Flink = ListHead->Blink = ListHead;
67 }

◆ InsertTailList()

static __inline VOID InsertTailList ( _In_ PLIST_ENTRY  ListHead,
_In_ PLIST_ENTRY  Entry 
)
static

Definition at line 46 of file opengl32.h.

50 {
51  PLIST_ENTRY OldBlink;
52  OldBlink = ListHead->Blink;
53  Entry->Flink = ListHead;
54  Entry->Blink = OldBlink;
55  OldBlink->Flink = Entry;
56  ListHead->Blink = Entry;
57 }
struct _Entry Entry
Definition: kefuncs.h:627
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
base of all file and directory entries
Definition: entries.h:82

◆ IntDeleteAllContexts()

void IntDeleteAllContexts ( void  )

Definition at line 931 of file wgl.c.

932 {
933  struct wgl_context* context;
935 
936  while (Entry != &ContextListHead)
937  {
940  Entry = Entry->Flink;
941  }
942 }
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
Definition: http.c:7094
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
LIST_ENTRY ListEntry
Definition: opengl32.h:76
base of all file and directory entries
Definition: entries.h:82
LIST_ENTRY ContextListHead
Definition: wgl.c:17

Referenced by DllMain().

◆ IntDeleteAllICDs()

void IntDeleteAllICDs ( void  )

Definition at line 357 of file icdload.c.

358 {
359  struct ICD_Data* data;
360 
362 
363  while (ICD_Data_List != NULL)
364  {
366  ICD_Data_List = data->next;
367 
368  FreeLibrary(data->hModule);
370  }
371 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION icdload_cs
Definition: icdload.c:29
smooth NULL
Definition: ftsmooth.c:416
static struct ICD_Data * ICD_Data_List
Definition: icdload.c:30
#define FreeLibrary(x)
Definition: compat.h:607
#define GetProcessHeap()
Definition: compat.h:595
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: icd.h:365
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by DllMain().

◆ IntGetCurrentDC()

FORCEINLINE HDC IntGetCurrentDC ( void  )

Definition at line 149 of file opengl32.h.

150 {
151  return NtCurrentTeb()->glReserved2;
152 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by wglGetCurrentDC().

◆ IntGetCurrentDcData()

static struct wgl_dc_data* IntGetCurrentDcData ( void  )
inlinestatic

Definition at line 156 of file opengl32.h.

157 {
158  return NtCurrentTeb()->glSectionInfo;
159 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by sw_call_window_proc().

◆ IntGetCurrentDHGLRC()

FORCEINLINE DHGLRC IntGetCurrentDHGLRC ( void  )

Definition at line 177 of file opengl32.h.

178 {
179  struct wgl_context* ctx = (struct wgl_context*)IntGetCurrentRC();
180  if(!ctx) return NULL;
181  return ctx->dhglrc;
182 }
FORCEINLINE HGLRC IntGetCurrentRC(void)
Definition: opengl32.h:142
smooth NULL
Definition: ftsmooth.c:416

Referenced by gl_get_thread_context(), and sw_call_window_proc().

◆ IntGetCurrentDispatchTable()

FORCEINLINE const GLDISPATCHTABLE* IntGetCurrentDispatchTable ( void  )

Definition at line 117 of file opengl32.h.

118 {
119  return (GLDISPATCHTABLE*)NtCurrentTeb()->glTable;
120 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by sw_DeleteContext(), tess_callback_begin(), tess_callback_end(), tess_callback_vertex(), wglUseFontBitmaps_common(), and wglUseFontOutlines_common().

◆ IntGetCurrentICDPrivate()

FORCEINLINE void* IntGetCurrentICDPrivate ( void  )

Definition at line 170 of file opengl32.h.

171 {
172  return (void*)NtCurrentTeb()->glContext;
173 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by sw_DeleteContext(), and wglGetCurrentValue().

◆ IntGetCurrentRC()

FORCEINLINE HGLRC IntGetCurrentRC ( void  )

Definition at line 142 of file opengl32.h.

143 {
144  return NtCurrentTeb()->glCurrentRC;
145 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by IntGetCurrentDHGLRC(), wglGetCurrentContext(), wglGetProcAddress(), and wglMakeCurrent().

◆ IntMakeCurrent()

FORCEINLINE void IntMakeCurrent ( HGLRC  hglrc,
HDC  hdc,
struct wgl_dc_data dc_data 
)

Definition at line 131 of file opengl32.h.

132 {
133  TEB* CurrentTeb = NtCurrentTeb();
134 
135  CurrentTeb->glCurrentRC = hglrc;
136  CurrentTeb->glReserved2 = hdc;
137  CurrentTeb->glSectionInfo = dc_data;
138 }
PVOID glCurrentRC
Definition: compat.h:732
PVOID glReserved2
Definition: compat.h:728
static HDC HGLRC hglrc
Definition: opengl.c:36
HDC hdc
Definition: main.c:9
Definition: compat.h:694
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
PVOID glSectionInfo
Definition: compat.h:729

Referenced by wglMakeCurrent().

◆ IntSetCurrentDispatchTable()

FORCEINLINE void IntSetCurrentDispatchTable ( const GLDISPATCHTABLE table)

Definition at line 124 of file opengl32.h.

125 {
126  NtCurrentTeb()->glTable = (void*)table;
127 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by set_api_table(), sw_DeleteContext(), sw_SetContext(), and wglMakeCurrent().

◆ IntSetCurrentICDPrivate()

FORCEINLINE void IntSetCurrentICDPrivate ( void value)

Definition at line 163 of file opengl32.h.

164 {
165  NtCurrentTeb()->glContext = value;
166 }
GLsizei const GLfloat * value
Definition: glext.h:6069
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

Referenced by sw_DeleteContext(), and wglSetCurrentValue().

◆ RemoveEntryList()

static __inline BOOLEAN RemoveEntryList ( _In_ PLIST_ENTRY  Entry)
static

Definition at line 31 of file opengl32.h.

33 {
34  PLIST_ENTRY OldFlink;
35  PLIST_ENTRY OldBlink;
36 
37  OldFlink = Entry->Flink;
38  OldBlink = Entry->Blink;
39  OldFlink->Blink = OldBlink;
40  OldBlink->Flink = OldFlink;
41  return (OldFlink == OldBlink);
42 }
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
base of all file and directory entries
Definition: entries.h:82

◆ sw_CopyContext()

BOOL sw_CopyContext ( DHGLRC  dhglrcSrc,
DHGLRC  dhglrcDst,
UINT  mask 
)

Definition at line 498 of file swimpl.c.

499 {
500  FIXME("Software wglCopyContext is UNIMPLEMENTED, mask %lx.\n", mask);
501  return FALSE;
502 }
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by wglCopyContext().

◆ sw_CreateContext()

DHGLRC sw_CreateContext ( struct wgl_dc_data )

Definition at line 422 of file swimpl.c.

423 {
424  struct sw_context* sw_ctx;
425  struct sw_framebuffer* fb = dc_data->sw_data;
426 
427  sw_ctx = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*sw_ctx));
428  if(!sw_ctx)
429  return NULL;
430 
431  /* Initialize the context */
432  sw_ctx->gl_ctx = gl_create_context(fb->gl_visual, NULL, sw_ctx);
433  if(!sw_ctx->gl_ctx)
434  {
435  ERR("Failed to initialize the mesa context.\n");
436  HeapFree(GetProcessHeap(), 0, sw_ctx);
437  return NULL;
438  }
439 
440  sw_ctx->fb = fb;
441 
442  /* Choose relevant default */
443  sw_ctx->Mode = fb->gl_visual->DBflag ? GL_BACK : GL_FRONT;
444 
445  return (DHGLRC)sw_ctx;
446 }
#define GL_BACK
Definition: gl.h:271
GLvisual * gl_visual
Definition: swimpl.c:223
GLenum Mode
Definition: swimpl.c:270
GLcontext * gl_ctx
Definition: swimpl.c:238
struct sw_framebuffer * fb
Definition: swimpl.c:244
#define GL_FRONT
Definition: gl.h:270
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ERR(fmt,...)
Definition: debug.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLboolean DBflag
Definition: types.h:1138
GLcontext * gl_create_context(GLvisual *visual, GLcontext *share_list, void *driver_ctx)
Definition: context.c:1093
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by wglCreateContext(), and wglCreateLayerContext().

◆ sw_DeleteContext()

BOOL sw_DeleteContext ( DHGLRC  dhglrc)

Definition at line 448 of file swimpl.c.

449 {
450  struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
451  /* Those get clobbered by _mesa_free_context_data via _glapi_set{context,dispath_table} */
452  void* icd_save = IntGetCurrentICDPrivate();
453  const GLDISPATCHTABLE* table_save = IntGetCurrentDispatchTable();
454 
455  /* Destroy everything */
456  gl_destroy_context(sw_ctx->gl_ctx);
457 
458  HeapFree(GetProcessHeap(), 0, sw_ctx);
459 
460  /* Restore this */
461  IntSetCurrentDispatchTable(table_save);
462  IntSetCurrentICDPrivate(icd_save);
463 
464  return TRUE;
465 }
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:170
#define TRUE
Definition: types.h:120
GLcontext * gl_ctx
Definition: swimpl.c:238
FORCEINLINE void IntSetCurrentICDPrivate(void *value)
Definition: opengl32.h:163
#define GetProcessHeap()
Definition: compat.h:595
void gl_destroy_context(GLcontext *ctx)
Definition: context.c:1186
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:124
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by wglCreateContext(), wglCreateLayerContext(), and wglDeleteContext().

◆ sw_DescribePixelFormat()

INT sw_DescribePixelFormat ( HDC  hdc,
INT  format,
UINT  size,
PIXELFORMATDESCRIPTOR descr 
)

Definition at line 315 of file swimpl.c.

316 {
317  INT ret;
318  const struct pixel_format *pixel_format;
319 
320  TRACE("Describing format %i.\n", format);
321 
323  if(!descr)
324  return ret;
325  if((format > ret) || (size != sizeof(*descr)))
326  return 0;
327 
328  /* Fill the structure */
329  descr->nSize = sizeof(*descr);
330  descr->nVersion = 1;
331  descr->dwFlags = pixel_format->dwFlags;
332  descr->iPixelType = pixel_format->iPixelType;
333  descr->cColorBits = pixel_format->cColorBits;
334  descr->cRedBits = pixel_format->cRedBits;
335  descr->cRedShift = pixel_format->cRedShift;
336  descr->cGreenBits = pixel_format->cGreenBits;
337  descr->cGreenShift = pixel_format->cGreenShift;
338  descr->cBlueBits = pixel_format->cBlueBits;
339  descr->cBlueShift = pixel_format->cBlueShift;
340  descr->cAlphaBits = pixel_format->cAlphaBits;
341  descr->cAlphaShift = pixel_format->cAlphaShift;
342  descr->cAccumBits = pixel_format->cAccumBits;
343  descr->cAccumRedBits = pixel_format->cAccumRedBits;
344  descr->cAccumGreenBits = pixel_format->cAccumGreenBits;
345  descr->cAccumBlueBits = pixel_format->cAccumBlueBits;
346  descr->cAccumAlphaBits = pixel_format->cAccumAlphaBits;
347  descr->cDepthBits = pixel_format->cDepthBits;
348  descr->cStencilBits = STENCIL_BITS;
349  descr->cAuxBuffers = 0;
350  descr->iLayerType = PFD_MAIN_PLANE;
351  descr->bReserved = 0;
352  descr->dwLayerMask = 0;
353  descr->dwVisibleMask = 0;
354  descr->dwDamageMask = 0;
355 
356  return ret;
357 }
BYTE cAccumGreenBits
Definition: swimpl.c:37
BYTE cGreenShift
Definition: swimpl.c:33
#define PFD_MAIN_PLANE
Definition: wingdi.h:297
BYTE cColorBits
Definition: swimpl.c:31
BYTE cAccumBits
Definition: swimpl.c:36
BYTE cAccumBlueBits
Definition: swimpl.c:37
static const struct pixel_format * get_format(INT pf_index, INT *pf_count)
Definition: swimpl.c:274
BYTE cAccumAlphaBits
Definition: swimpl.c:37
BYTE cAlphaBits
Definition: swimpl.c:35
int32_t INT
Definition: typedefs.h:58
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define STENCIL_BITS
Definition: config.h:152
BYTE cGreenBits
Definition: swimpl.c:33
DWORD dwFlags
Definition: swimpl.c:29
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
BYTE cAlphaShift
Definition: swimpl.c:35
const char * descr
Definition: boot.c:45
int ret
BYTE cRedShift
Definition: swimpl.c:32
BYTE cBlueShift
Definition: swimpl.c:34
BYTE cAccumRedBits
Definition: swimpl.c:37
BYTE cBlueBits
Definition: swimpl.c:34
BYTE cDepthBits
Definition: swimpl.c:38
BYTE iPixelType
Definition: swimpl.c:30
BYTE cRedBits
Definition: swimpl.c:32

Referenced by get_dc_data_ex(), and wglDescribePixelFormat().

◆ sw_GetProcAddress()

PROC sw_GetProcAddress ( LPCSTR  name)

Definition at line 478 of file swimpl.c.

479 {
480  /* GL_EXT_paletted_texture */
481  if (strcmp(name, "glColorTableEXT") == 0)
482  return (PROC)_mesa_ColorTableEXT;
483  if (strcmp(name, "glColorSubTableEXT") == 0)
485  if (strcmp(name, "glColorGetTableEXT") == 0)
487  if (strcmp(name, "glGetColorTableParameterivEXT") == 0)
489  if (strcmp(name, "glGetColorTableParameterfvEXT") == 0)
491  if (strcmp(name, "glAddSwapHintRectWIN") == 0)
493 
494  WARN("Asking for proc address %s, returning NULL.\n", name);
495  return NULL;
496 }
void APIENTRY _mesa_ColorTableEXT(GLenum, GLenum, GLsizei, GLenum, GLenum, const void *)
Definition: api.c:2826
#define WARN(fmt,...)
Definition: debug.h:112
void APIENTRY _mesa_GetColorTableEXT(GLenum, GLenum, GLenum, void *)
Definition: api.c:2851
void APIENTRY _mesa_ColorSubTableEXT(GLenum, GLsizei, GLsizei, GLenum, GLenum, const void *)
Definition: api.c:2839
smooth NULL
Definition: ftsmooth.c:416
void APIENTRY _mesa_GetColorTableParameterivEXT(GLenum, GLenum, GLfloat *)
static void APIENTRY _swimpl_AddSwapHintRectWIN(GLint x, GLint y, GLsizei width, GLsizei height)
Definition: swimpl.c:473
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
INT_PTR(WINAPI * PROC)()
Definition: windef.h:250
void APIENTRY _mesa_GetColorTableParameterfvEXT(GLenum, GLenum, GLint *)

Referenced by wglGetProcAddress().

◆ sw_ReleaseContext()

void sw_ReleaseContext ( DHGLRC  hglrc)

Definition at line 1477 of file swimpl.c.

1478 {
1479  struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
1480 
1481  /* Forward to mesa */
1483 
1484  /* Unhook */
1485  if(sw_ctx->hook)
1486  {
1487  UnhookWindowsHookEx(sw_ctx->hook);
1488  sw_ctx->hook = NULL;
1489  }
1490 }
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
void gl_make_current(GLcontext *ctx, GLframebuffer *buffer)
Definition: context.c:1276
HHOOK hook
Definition: swimpl.c:241

Referenced by wglMakeCurrent().

◆ sw_SetContext()

BOOL sw_SetContext ( struct wgl_dc_data dc_data,
DHGLRC  dhglrc 
)

Definition at line 1390 of file swimpl.c.

1391 {
1392  struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
1393  struct sw_framebuffer* fb = dc_data->sw_data;
1394  UINT width, height;
1395 
1396  /* Get framebuffer size */
1397  if(dc_data->flags & WGL_DC_OBJ_DC)
1398  {
1399  HWND hwnd = dc_data->owner.hwnd;
1400  RECT client_rect;
1401  if(!hwnd)
1402  {
1403  ERR("Physical DC without a window!\n");
1404  return FALSE;
1405  }
1406  if(!GetClientRect(hwnd, &client_rect))
1407  {
1408  ERR("GetClientRect failed!\n");
1409  return FALSE;
1410  }
1411 
1412  /* This is a physical DC. Setup the hook */
1415  NULL,
1416  GetCurrentThreadId());
1417 
1418  /* Calculate width & height */
1419  width = client_rect.right - client_rect.left;
1420  height = client_rect.bottom - client_rect.top;
1421  }
1422  else /* OBJ_MEMDC */
1423  {
1424  BITMAP bm;
1425  HBITMAP hbmp;
1426  HDC hdc = dc_data->owner.hdc;
1427 
1428  if(fb->gl_visual->DBflag)
1429  {
1430  ERR("Memory DC called with a double buffered format.\n");
1431  return FALSE;
1432  }
1433 
1435  if(!hbmp)
1436  {
1437  ERR("No Bitmap!\n");
1438  return FALSE;
1439  }
1440  if(GetObject(hbmp, sizeof(bm), &bm) == 0)
1441  {
1442  ERR("GetObject failed!\n");
1443  return FALSE;
1444  }
1445  width = bm.bmWidth;
1446  height = bm.bmHeight;
1447  }
1448 
1449  if(!width) width = 1;
1450  if(!height) height = 1;
1451 
1452  /* Also make the mesa context current to mesa */
1453  gl_make_current(sw_ctx->gl_ctx, fb->gl_buffer);
1454 
1455  /* Setup our functions */
1456  setup_DD_pointers(sw_ctx->gl_ctx);
1457 
1458  /* Set the viewport if this is the first time we initialize this context */
1459  if(sw_ctx->gl_ctx->Viewport.X == 0 &&
1460  sw_ctx->gl_ctx->Viewport.Y == 0 &&
1461  sw_ctx->gl_ctx->Viewport.Width == 0 &&
1462  sw_ctx->gl_ctx->Viewport.Height == 0)
1463  {
1464  gl_Viewport(sw_ctx->gl_ctx, 0, 0, width, height);
1465  }
1466 
1467  /* update the framebuffer size */
1468  gl_ResizeBuffersMESA(sw_ctx->gl_ctx);
1469 
1470  /* Use our API table */
1472 
1473  /* We're good */
1474  return TRUE;
1475 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
void gl_Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
Definition: matrix.c:1014
ULONG flags
Definition: opengl32.h:94
#define TRUE
Definition: types.h:120
HWND hwnd
Definition: opengl32.h:90
GLvisual * gl_visual
Definition: swimpl.c:223
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
GLcontext * gl_ctx
Definition: swimpl.c:238
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
void * sw_data
Definition: opengl32.h:105
static void setup_DD_pointers(GLcontext *ctx)
Definition: swimpl.c:1308
static LRESULT CALLBACK sw_call_window_proc(int nCode, WPARAM wParam, LPARAM lParam)
Definition: swimpl.c:525
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
HBITMAP hbmp
#define SetWindowsHookEx
Definition: winuser.h:5831
#define GetObject
Definition: wingdi.h:4467
#define WH_CALLWNDPROC
Definition: winuser.h:34
HDC hdc
Definition: main.c:9
#define WGL_DC_OBJ_DC
Definition: opengl32.h:84
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
union wgl_dc_data::@290 owner
#define ERR(fmt,...)
Definition: debug.h:110
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:124
Definition: bl.h:1331
struct gl_viewport_attrib Viewport
Definition: types.h:1336
void gl_make_current(GLcontext *ctx, GLframebuffer *buffer)
Definition: context.c:1276
unsigned int UINT
Definition: ndis.h:50
GLDISPATCHTABLE glDispatchTable
Definition: icd.h:357
static GLCLTPROCTABLE sw_api_table
Definition: swimpl.c:1373
void gl_ResizeBuffersMESA(GLcontext *ctx)
Definition: context.c:1497
GLframebuffer * gl_buffer
Definition: swimpl.c:224
GLboolean DBflag
Definition: types.h:1138
LONG bottom
Definition: windef.h:309
static HBITMAP
Definition: button.c:44
HHOOK hook
Definition: swimpl.c:241
#define OBJ_BITMAP
Definition: objidl.idl:1415
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:441

Referenced by wglMakeCurrent().

◆ sw_SetPixelFormat()

BOOL sw_SetPixelFormat ( HDC  hdc,
struct wgl_dc_data ,
INT  format 
)

Definition at line 359 of file swimpl.c.

360 {
361  struct sw_framebuffer* fb;
362  const struct pixel_format *pixel_format;
363 
364  /* So, someone is crazy enough to ask for sw implementation. Announce it. */
365  TRACE("OpenGL software implementation START for hdc %p, format %i!\n", hdc, format);
366 
368  if (!pixel_format)
369  return FALSE;
370 
371  /* allocate our structure */
372  fb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*fb));
373  if(!fb)
374  {
375  ERR("HeapAlloc FAILED!\n");
376  return FALSE;
377  }
378  /* Set the format */
380 
383  pixel_format->cAlphaBits != 0,
386  STENCIL_BITS,
389  ((1ul << pixel_format->cRedBits) - 1),
390  ((1ul << pixel_format->cGreenBits) - 1),
391  ((1ul << pixel_format->cBlueBits) - 1),
392  pixel_format->cAlphaBits != 0 ? ((1ul << pixel_format->cAlphaBits) - 1) : 255.0f,
397 
398  if(!fb->gl_visual)
399  {
400  ERR("Failed to allocate a GL visual.\n");
401  HeapFree(GetProcessHeap(), 0, fb);
402  return FALSE;
403  }
404 
405  /* Allocate the framebuffer structure */
407  if (!fb->gl_buffer) {
408  ERR("Failed to allocate the mesa framebuffer structure.\n");
410  HeapFree(GetProcessHeap(), 0, fb);
411  return FALSE;
412  }
413 
414  /* Save our DC */
415  fb->Hdc = hdc;
416 
417  /* Everything went fine */
418  dc_data->sw_data = fb;
419  return TRUE;
420 }
#define max(a, b)
Definition: svc.c:63
BYTE cAccumGreenBits
Definition: swimpl.c:37
BYTE cColorBits
Definition: swimpl.c:31
void gl_destroy_visual(GLvisual *vis)
Definition: context.c:1029
#define TRUE
Definition: types.h:120
GLvisual * gl_visual
Definition: swimpl.c:223
BYTE cAccumBlueBits
Definition: swimpl.c:37
static const struct pixel_format * get_format(INT pf_index, INT *pf_count)
Definition: swimpl.c:274
BYTE cAccumAlphaBits
Definition: swimpl.c:37
BYTE cAlphaBits
Definition: swimpl.c:35
GLframebuffer * gl_create_framebuffer(GLvisual *visual)
Definition: context.c:1230
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define STENCIL_BITS
Definition: config.h:152
#define PFD_DOUBLEBUFFER
Definition: wingdi.h:300
BYTE cGreenBits
Definition: swimpl.c:33
DWORD dwFlags
Definition: swimpl.c:29
#define FALSE
Definition: types.h:117
GLvisual * gl_create_visual(GLboolean rgb_flag, GLboolean alpha_flag, GLboolean db_flag, GLint depth_bits, GLint stencil_bits, GLint accum_bits, GLint index_bits, GLfloat red_scale, GLfloat green_scale, GLfloat blue_scale, GLfloat alpha_scale, GLint red_bits, GLint green_bits, GLint blue_bits, GLint alpha_bits)
Definition: context.c:936
smooth NULL
Definition: ftsmooth.c:416
#define PFD_TYPE_COLORINDEX
Definition: wingdi.h:296
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define PFD_TYPE_RGBA
Definition: wingdi.h:295
HDC hdc
Definition: main.c:9
const struct pixel_format * pixel_format
Definition: swimpl.c:226
#define ERR(fmt,...)
Definition: debug.h:110
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLframebuffer * gl_buffer
Definition: swimpl.c:224
BYTE cAccumRedBits
Definition: swimpl.c:37
BYTE cBlueBits
Definition: swimpl.c:34
BYTE cDepthBits
Definition: swimpl.c:38
BYTE iPixelType
Definition: swimpl.c:30
#define HeapFree(x, y, z)
Definition: compat.h:594
BYTE cRedBits
Definition: swimpl.c:32

Referenced by wglSetPixelFormat().

◆ sw_ShareLists()

BOOL sw_ShareLists ( DHGLRC  dhglrcSrc,
DHGLRC  dhglrcDst 
)

Definition at line 504 of file swimpl.c.

505 {
506 #if 0
507  struct sw_context* sw_ctx_src = (struct sw_context*)dhglrcSrc;
508  struct sw_context* sw_ctx_dst = (struct sw_context*)dhglrcDst;
509 
510  /* See if it was already shared */
511  if(sw_ctx_dst->gl_ctx->Shared->RefCount > 1)
512  return FALSE;
513 
514  /* Unreference the old, share the new */
515  gl_reference_shared_state(sw_ctx_dst->gl_ctx,
516  &sw_ctx_dst->gl_ctx->Shared,
517  sw_ctx_src->gl_ctx->Shared);
518 #endif
519  FIXME("Unimplemented!\n");
520  return TRUE;
521 }
#define TRUE
Definition: types.h:120
GLcontext * gl_ctx
Definition: swimpl.c:238
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
struct gl_shared_state * Shared
Definition: types.h:1265

Referenced by wglShareLists().

◆ sw_SwapBuffers()

BOOL sw_SwapBuffers ( HDC  hdc,
struct wgl_dc_data dc_data 
)

Definition at line 1492 of file swimpl.c.

1493 {
1494  struct sw_framebuffer* fb = dc_data->sw_data;
1495  char Buffer[sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)];
1496  BITMAPINFO *bmi = (BITMAPINFO*)Buffer;
1497  BYTE Bpp = fb->pixel_format->cColorBits;
1498 
1499  if (!fb->gl_visual->DBflag)
1500  return TRUE;
1501 
1502  if (!fb->BackBuffer)
1503  return FALSE;
1504 
1505  bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
1506  bmi->bmiHeader.biBitCount = Bpp;
1507  bmi->bmiHeader.biClrImportant = 0;
1508  bmi->bmiHeader.biClrUsed = 0;
1509  bmi->bmiHeader.biPlanes = 1;
1510  bmi->bmiHeader.biSizeImage = WIDTH_BYTES_ALIGN32(fb->width, Bpp) * fb->height;
1511  bmi->bmiHeader.biXPelsPerMeter = 0;
1512  bmi->bmiHeader.biYPelsPerMeter = 0;
1513  bmi->bmiHeader.biHeight = fb->height;
1514  bmi->bmiHeader.biWidth = fb->width;
1515  bmi->bmiHeader.biCompression = Bpp == 16 ? BI_BITFIELDS : BI_RGB;
1516 
1517  if (Bpp == 16)
1518  {
1519  DWORD* BitMasks = (DWORD*)(&bmi->bmiColors[0]);
1520  BitMasks[0] = 0x0000F800;
1521  BitMasks[1] = 0x000007E0;
1522  BitMasks[2] = 0x0000001F;
1523  }
1524 
1525  return SetDIBitsToDevice(fb->Hdc, 0, 0, fb->width, fb->height, 0, 0, 0, fb->height, fb->BackBuffer, bmi,
1526  fb->pixel_format->iPixelType == PFD_TYPE_COLORINDEX ? DIB_PAL_COLORS : DIB_RGB_COLORS) != 0;
1527 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1475
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:16
DWORD biClrImportant
Definition: amvideo.idl:40
#define DIB_PAL_COLORS
Definition: wingdi.h:365
#define TRUE
Definition: types.h:120
LONG biXPelsPerMeter
Definition: amvideo.idl:37
struct tagBITMAPINFOHEADER BITMAPINFOHEADER
GLvisual * gl_visual
Definition: swimpl.c:223
GLuint width
Definition: swimpl.c:230
BYTE * BackBuffer
Definition: swimpl.c:233
LONG biYPelsPerMeter
Definition: amvideo.idl:38
#define BI_BITFIELDS
Definition: mmreg.h:507
void * sw_data
Definition: opengl32.h:105
#define FALSE
Definition: types.h:117
DWORD biCompression
Definition: amvideo.idl:35
#define PFD_TYPE_COLORINDEX
Definition: wingdi.h:296
Definition: bufpool.h:45
RGBQUAD bmiColors[1]
Definition: wingdi.h:1476
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
unsigned char BYTE
Definition: xxhash.c:193
const struct pixel_format * pixel_format
Definition: swimpl.c:226
int WINAPI SetDIBitsToDevice(_In_ HDC, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ int, _In_ int, _In_ UINT, _In_ UINT, _In_ CONST VOID *, _In_ CONST BITMAPINFO *, _In_ UINT)
GLuint height
Definition: swimpl.c:230
GLboolean DBflag
Definition: types.h:1138
#define DIB_RGB_COLORS
Definition: wingdi.h:366
#define BI_RGB
Definition: precomp.h:47

Referenced by wglSwapBuffers().

Variable Documentation

◆ ContextListHead

LIST_ENTRY ContextListHead

Definition at line 17 of file wgl.c.

Referenced by DllMain(), IntDeleteAllContexts(), and wglCreateContext().