ReactOS 0.4.16-dev-306-g647d351
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}
base of all file and directory entries
Definition: entries.h:83
Definition: typedefs.h:120
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121

◆ 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
Definition: http.c:7252
LIST_ENTRY ListEntry
Definition: opengl32.h:76
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
LIST_ENTRY ContextListHead
Definition: wgl.c:17
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
Definition: wgl.c:514

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}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define FreeLibrary(x)
Definition: compat.h:748
#define HeapFree(x, y, z)
Definition: compat.h:735
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static CRITICAL_SECTION icdload_cs
Definition: icdload.c:29
static struct ICD_Data * ICD_Data_List
Definition: icdload.c:30
Definition: icd.h:366
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by DllMain().

◆ IntGetCurrentDC()

FORCEINLINE HDC IntGetCurrentDC ( void  )

Definition at line 149 of file opengl32.h.

150{
151 return NtCurrentTeb()->glReserved2;
152}
#define NtCurrentTeb

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}

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

Referenced by gl_get_thread_context(), and sw_call_window_proc().

◆ IntGetCurrentDispatchTable()

◆ IntGetCurrentICDPrivate()

FORCEINLINE void * IntGetCurrentICDPrivate ( void  )

Definition at line 170 of file opengl32.h.

171{
172 return (void*)NtCurrentTeb()->glContext;
173}

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}

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}
HDC hdc
Definition: main.c:9
static HDC HGLRC hglrc
Definition: opengl.c:36
Definition: compat.h:836
PVOID glCurrentRC
Definition: compat.h:873
PVOID glSectionInfo
Definition: compat.h:870
PVOID glReserved2
Definition: compat.h:869

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}

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}
Definition: pdh_main.c:94

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}

◆ 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}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define FALSE
Definition: types.h:117
GLenum GLint GLuint mask
Definition: glext.h:6028

Referenced by wglCopyContext().

◆ sw_CreateContext()

DHGLRC sw_CreateContext ( struct wgl_dc_data 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 ERR(fmt,...)
Definition: precomp.h:57
GLcontext * gl_create_context(GLvisual *visual, GLcontext *share_list, void *driver_ctx)
Definition: context.c:1093
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define GL_BACK
Definition: gl.h:271
#define GL_FRONT
Definition: gl.h:270
GLboolean DBflag
Definition: types.h:1138
GLenum Mode
Definition: swimpl.c:270
GLcontext * gl_ctx
Definition: swimpl.c:238
struct sw_framebuffer * fb
Definition: swimpl.c:244
GLvisual * gl_visual
Definition: swimpl.c:223
void * sw_data
Definition: opengl32.h:105

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
void gl_destroy_context(GLcontext *ctx)
Definition: context.c:1186
FORCEINLINE void IntSetCurrentDispatchTable(const GLDISPATCHTABLE *table)
Definition: opengl32.h:124
FORCEINLINE void IntSetCurrentICDPrivate(void *value)
Definition: opengl32.h:163
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
FORCEINLINE void * IntGetCurrentICDPrivate(void)
Definition: opengl32.h:170

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}
#define STENCIL_BITS
Definition: config.h:152
GLsizeiptr size
Definition: glext.h:5919
const char * descr
Definition: boot.c:45
#define TRACE(s)
Definition: solgame.cpp:4
Definition: format.c:58
BYTE cAccumGreenBits
Definition: swimpl.c:37
BYTE cGreenBits
Definition: swimpl.c:33
BYTE cAlphaShift
Definition: swimpl.c:35
BYTE cGreenShift
Definition: swimpl.c:33
BYTE iPixelType
Definition: swimpl.c:30
BYTE cDepthBits
Definition: swimpl.c:38
BYTE cRedShift
Definition: swimpl.c:32
BYTE cAccumRedBits
Definition: swimpl.c:37
BYTE cAccumBlueBits
Definition: swimpl.c:37
BYTE cAccumBits
Definition: swimpl.c:36
DWORD dwFlags
Definition: swimpl.c:29
BYTE cColorBits
Definition: swimpl.c:31
BYTE cAlphaBits
Definition: swimpl.c:35
BYTE cAccumAlphaBits
Definition: swimpl.c:37
BYTE cBlueBits
Definition: swimpl.c:34
BYTE cBlueShift
Definition: swimpl.c:34
BYTE cRedBits
Definition: swimpl.c:32
static const struct pixel_format * get_format(INT pf_index, INT *pf_count)
Definition: swimpl.c:274
int32_t INT
Definition: typedefs.h:58
int ret
#define PFD_MAIN_PLANE
Definition: wingdi.h:298

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)
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}
#define PROC(name)
Definition: WinHttpOpen.c:37
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WARN(fmt,...)
Definition: precomp.h:61
Definition: name.c:39
void APIENTRY _mesa_GetColorTableParameterivEXT(GLenum, GLenum, GLfloat *)
void APIENTRY _mesa_GetColorTableParameterfvEXT(GLenum, GLenum, GLint *)
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
static void APIENTRY _swimpl_AddSwapHintRectWIN(GLint x, GLint y, GLsizei width, GLsizei height)
Definition: swimpl.c:473
void APIENTRY _mesa_ColorTableEXT(GLenum, GLenum, GLsizei, GLenum, GLenum, const void *)
Definition: api.c:2826

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}
void gl_make_current(GLcontext *ctx, GLframebuffer *buffer)
Definition: context.c:1276
HHOOK hook
Definition: swimpl.c:241
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)

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,
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 */
1469
1470 /* Use our API table */
1472
1473 /* We're good */
1474 return TRUE;
1475}
HBITMAP hbmp
void gl_ResizeBuffersMESA(GLcontext *ctx)
Definition: context.c:1497
void gl_Viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height)
Definition: matrix.c:1014
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
unsigned int UINT
Definition: ndis.h:50
#define OBJ_BITMAP
Definition: objidl.idl:1415
#define WGL_DC_OBJ_DC
Definition: opengl32.h:84
Definition: bl.h:1331
GLDISPATCHTABLE glDispatchTable
Definition: icd.h:357
struct gl_viewport_attrib Viewport
Definition: types.h:1336
GLframebuffer * gl_buffer
Definition: swimpl.c:224
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
ULONG flags
Definition: opengl32.h:94
union wgl_dc_data::@293 owner
HWND hwnd
Definition: opengl32.h:90
static LRESULT CALLBACK sw_call_window_proc(int nCode, WPARAM wParam, LPARAM lParam)
Definition: swimpl.c:525
static void setup_DD_pointers(GLcontext *ctx)
Definition: swimpl.c:1308
static GLCLTPROCTABLE sw_api_table
Definition: swimpl.c:1373
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:428
#define GetObject
Definition: wingdi.h:4468
#define SetWindowsHookEx
Definition: winuser.h:5868
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WH_CALLWNDPROC
Definition: winuser.h:34

Referenced by wglMakeCurrent().

◆ sw_SetPixelFormat()

BOOL sw_SetPixelFormat ( HDC  hdc,
struct wgl_dc_data 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
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}
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
GLframebuffer * gl_create_framebuffer(GLvisual *visual)
Definition: context.c:1230
void gl_destroy_visual(GLvisual *vis)
Definition: context.c:1029
const struct pixel_format * pixel_format
Definition: swimpl.c:226
#define max(a, b)
Definition: svc.c:63
#define PFD_TYPE_COLORINDEX
Definition: wingdi.h:297
#define PFD_TYPE_RGBA
Definition: wingdi.h:296
#define PFD_DOUBLEBUFFER
Definition: wingdi.h:301

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}
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,
1527}
Definition: bufpool.h:45
#define BI_RGB
Definition: precomp.h:56
unsigned long DWORD
Definition: ntddk_ex.h:95
#define BI_BITFIELDS
Definition: mmreg.h:507
GLuint height
Definition: swimpl.c:230
GLuint width
Definition: swimpl.c:230
BYTE * BackBuffer
Definition: swimpl.c:233
ULONG biClrImportant
Definition: precomp.h:52
USHORT biBitCount
Definition: precomp.h:46
LONG biYPelsPerMeter
Definition: precomp.h:50
ULONG biCompression
Definition: precomp.h:47
LONG biXPelsPerMeter
Definition: precomp.h:49
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
RGBQUAD bmiColors[1]
Definition: wingdi.h:1477
#define WIDTH_BYTES_ALIGN32(cx, bpp)
Definition: swimpl.c:16
#define DIB_RGB_COLORS
Definition: wingdi.h:367
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)
#define DIB_PAL_COLORS
Definition: wingdi.h:366
unsigned char BYTE
Definition: xxhash.c:193

Referenced by wglSwapBuffers().

Variable Documentation

◆ ContextListHead

LIST_ENTRY ContextListHead
extern

Definition at line 17 of file wgl.c.

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