ReactOS  0.4.13-dev-79-gcd489d8
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:640
struct _LIST_ENTRY * Blink
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
base of all file and directory entries
Definition: entries.h:82

◆ IntDeleteAllContexts()

void IntDeleteAllContexts ( void  )

Definition at line 927 of file wgl.c.

928 {
929  struct wgl_context* context;
931 
932  while (Entry != &ContextListHead)
933  {
936  Entry = Entry->Flink;
937  }
938 }
static HGLRC(WINAPI *pwglCreateContextAttribsARB)(HDC hDC
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514
Definition: http.c:6587
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:119
Definition: typedefs.h:117
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 356 of file icdload.c.

357 {
358  struct ICD_Data* data;
359 
361 
362  while (ICD_Data_List != NULL)
363  {
365  ICD_Data_List = data->next;
366 
367  FreeLibrary(data->hModule);
369  }
370 }
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:405
#define GetProcessHeap()
Definition: compat.h:395
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:394

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()->glContext;
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 }
DHGLRC dhglrc
Definition: opengl32.h:78
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()->glReserved1[0];
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->glContext = dc_data;
138 }
PVOID glCurrentRC
Definition: compat.h:522
PVOID glReserved2
Definition: compat.h:518
PVOID glContext
Definition: compat.h:523
static HDC HGLRC hglrc
Definition: opengl.c:36
HDC hdc
Definition: main.c:9
Definition: compat.h:484
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420

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()->glReserved1[0] = (ULONG_PTR)value;
166 }
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define ULONG_PTR
Definition: config.h:101

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:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
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 FIXME(fmt,...)
Definition: debug.h:110

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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ERR(fmt,...)
Definition: debug.h:109
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
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:394

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 }
#define TRUE
Definition: types.h:120
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:170
GLcontext * gl_ctx
Definition: swimpl.c:238
FORCEINLINE void IntSetCurrentICDPrivate(void *value)
Definition: opengl32.h:163
#define GetProcessHeap()
Definition: compat.h:395
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:394

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:56
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
int ret
BYTE cRedShift
Definition: swimpl.c:32
BYTE cBlueShift
Definition: swimpl.c:34
const char * descr
Definition: boot.c:42
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:111
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:36
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 1516 of file swimpl.c.

1517 {
1518  struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
1519 
1520  /* Forward to mesa */
1522 
1523  /* Unhook */
1524  if(sw_ctx->hook)
1525  {
1526  UnhookWindowsHookEx(sw_ctx->hook);
1527  sw_ctx->hook = NULL;
1528  }
1529 }
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 1429 of file swimpl.c.

1430 {
1431  struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
1432  struct sw_framebuffer* fb = dc_data->sw_data;
1433  UINT width, height;
1434 
1435  /* Get framebuffer size */
1436  if(dc_data->flags & WGL_DC_OBJ_DC)
1437  {
1438  HWND hwnd = dc_data->owner.hwnd;
1439  RECT client_rect;
1440  if(!hwnd)
1441  {
1442  ERR("Physical DC without a window!\n");
1443  return FALSE;
1444  }
1445  if(!GetClientRect(hwnd, &client_rect))
1446  {
1447  ERR("GetClientRect failed!\n");
1448  return FALSE;
1449  }
1450 
1451  /* This is a physical DC. Setup the hook */
1454  NULL,
1455  GetCurrentThreadId());
1456 
1457  /* Calculate width & height */
1458  width = client_rect.right - client_rect.left;
1459  height = client_rect.bottom - client_rect.top;
1460  }
1461  else /* OBJ_MEMDC */
1462  {
1463  BITMAP bm;
1464  HBITMAP hbmp;
1465  HDC hdc = dc_data->owner.hdc;
1466 
1467  if(fb->gl_visual->DBflag)
1468  {
1469  ERR("Memory DC called with a double buffered format.\n");
1470  return FALSE;
1471  }
1472 
1474  if(!hbmp)
1475  {
1476  ERR("No Bitmap!\n");
1477  return FALSE;
1478  }
1479  if(GetObject(hbmp, sizeof(bm), &bm) == 0)
1480  {
1481  ERR("GetObject failed!\n");
1482  return FALSE;
1483  }
1484  width = bm.bmWidth;
1485  height = bm.bmHeight;
1486  }
1487 
1488  if(!width) width = 1;
1489  if(!height) height = 1;
1490 
1491  /* Also make the mesa context current to mesa */
1492  gl_make_current(sw_ctx->gl_ctx, fb->gl_buffer);
1493 
1494  /* Setup our functions */
1495  setup_DD_pointers(sw_ctx->gl_ctx);
1496 
1497  /* Set the viewport if this is the first time we initialize this context */
1498  if(sw_ctx->gl_ctx->Viewport.X == 0 &&
1499  sw_ctx->gl_ctx->Viewport.Y == 0 &&
1500  sw_ctx->gl_ctx->Viewport.Width == 0 &&
1501  sw_ctx->gl_ctx->Viewport.Height == 0)
1502  {
1503  gl_Viewport(sw_ctx->gl_ctx, 0, 0, width, height);
1504  }
1505 
1506  /* update the framebuffer size */
1507  gl_ResizeBuffersMESA(sw_ctx->gl_ctx);
1508 
1509  /* Use our API table */
1511 
1512  /* We're good */
1513  return TRUE;
1514 }
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
#define TRUE
Definition: types.h:120
ULONG flags
Definition: opengl32.h:94
HWND hwnd
Definition: opengl32.h:90
GLvisual * gl_visual
Definition: swimpl.c:223
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
GLcontext * gl_ctx
Definition: swimpl.c:238
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
void * sw_data
Definition: opengl32.h:105
static void setup_DD_pointers(GLcontext *ctx)
Definition: swimpl.c:1347
static LRESULT CALLBACK sw_call_window_proc(int nCode, WPARAM wParam, LPARAM lParam)
Definition: swimpl.c:525
smooth NULL
Definition: ftsmooth.c:416
union wgl_dc_data::@281 owner
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
HBITMAP hbmp
#define SetWindowsHookEx
Definition: winuser.h:5722
#define GetObject
Definition: wingdi.h:4446
#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
#define ERR(fmt,...)
Definition: debug.h:109
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:1412
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:294
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:439

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
#define TRUE
Definition: types.h:120
BYTE cAccumGreenBits
Definition: swimpl.c:37
BYTE cColorBits
Definition: swimpl.c:31
void gl_destroy_visual(GLvisual *vis)
Definition: context.c:1029
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
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:395
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:109
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
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:394
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 FIXME(fmt,...)
Definition: debug.h:110
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 1531 of file swimpl.c.

1532 {
1533  struct sw_framebuffer* fb = dc_data->sw_data;
1534  char Buffer[sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)];
1535  BITMAPINFO *bmi = (BITMAPINFO*)Buffer;
1536  BYTE Bpp = fb->pixel_format->cColorBits;
1537 
1538  if (!fb->gl_visual->DBflag)
1539  return TRUE;
1540 
1541  if (!fb->BackBuffer)
1542  return FALSE;
1543 
1544  bmi->bmiHeader.biSize = sizeof(bmi->bmiHeader);
1545  bmi->bmiHeader.biBitCount = Bpp;
1546  bmi->bmiHeader.biClrImportant = 0;
1547  bmi->bmiHeader.biClrUsed = 0;
1548  bmi->bmiHeader.biPlanes = 1;
1549  bmi->bmiHeader.biSizeImage = WIDTH_BYTES_ALIGN32(fb->width, Bpp) * fb->height;
1550  bmi->bmiHeader.biXPelsPerMeter = 0;
1551  bmi->bmiHeader.biYPelsPerMeter = 0;
1552  bmi->bmiHeader.biHeight = fb->height;
1553  bmi->bmiHeader.biWidth = fb->width;
1554  bmi->bmiHeader.biCompression = Bpp == 16 ? BI_BITFIELDS : BI_RGB;
1555 
1556  if (Bpp == 16)
1557  {
1558  DWORD* BitMasks = (DWORD*)(&bmi->bmiColors[0]);
1559  BitMasks[0] = 0x0000F800;
1560  BitMasks[1] = 0x000007E0;
1561  BitMasks[2] = 0x0000001F;
1562  }
1563 
1564  return SetDIBitsToDevice(fb->Hdc, 0, 0, fb->width, fb->height, 0, 0, 0, fb->height, fb->BackBuffer, bmi,
1565  fb->pixel_format->iPixelType == PFD_TYPE_COLORINDEX ? DIB_PAL_COLORS : DIB_RGB_COLORS) != 0;
1566 }
#define TRUE
Definition: types.h:120
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1454
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:16
DWORD biClrImportant
Definition: amvideo.idl:40
#define DIB_PAL_COLORS
Definition: wingdi.h:365
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
DWORD biCompression
Definition: amvideo.idl:35
#define PFD_TYPE_COLORINDEX
Definition: wingdi.h:296
Definition: bufpool.h:45
RGBQUAD bmiColors[1]
Definition: wingdi.h:1455
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD biSizeImage
Definition: amvideo.idl:36
unsigned char BYTE
Definition: mem.h:68
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:35

Referenced by wglSwapBuffers().

Variable Documentation

◆ ContextListHead

LIST_ENTRY ContextListHead

Definition at line 17 of file wgl.c.

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