28
28
#include <windows.h>
30
#define WGL_WGLEXT_PROTOTYPES
33
#include <GL/wglext.h>
30
35
#include "pipe/p_compiler.h"
31
36
#include "pipe/p_context.h"
32
37
#include "pipe/p_state.h"
33
38
#include "util/u_memory.h"
39
#include "util/u_atomic.h"
34
40
#include "state_tracker/st_api.h"
36
42
#include "stw_icd.h"
121
127
INT iLayerPlane )
129
return stw_create_context_attribs(hdc, iLayerPlane, 0, 1, 0, 0, WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB);
133
stw_create_context_attribs(
136
DHGLRC hShareContext,
137
int majorVersion, int minorVersion,
138
int contextFlags, int profileMask)
123
140
int iPixelFormat;
124
141
const struct stw_pixelformat_info *pfi;
125
142
struct st_context_attribs attribs;
126
143
struct stw_context *ctx = NULL;
144
struct stw_context *shareCtx = NULL;
145
enum st_context_error ctx_err = 0;
131
150
if (iLayerPlane != 0)
134
153
iPixelFormat = GetPixelFormat(hdc);
135
154
if(!iPixelFormat)
138
157
pfi = stw_pixelformat_get_info( iPixelFormat - 1 );
159
if (hShareContext != 0) {
160
pipe_mutex_lock( stw_dev->ctx_mutex );
161
shareCtx = stw_lookup_context_locked( hShareContext );
162
pipe_mutex_unlock( stw_dev->ctx_mutex );
140
165
ctx = CALLOC_STRUCT( stw_context );
145
170
ctx->iPixelFormat = iPixelFormat;
147
172
memset(&attribs, 0, sizeof(attribs));
173
attribs.visual = pfi->stvis;
174
attribs.major = majorVersion;
175
attribs.minor = minorVersion;
176
if (contextFlags & WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB)
177
attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
178
if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
179
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
181
/* There are no profiles before OpenGL 3.2. The
182
* WGL_ARB_create_context_profile spec says:
184
* "If the requested OpenGL version is less than 3.2,
185
* WGL_CONTEXT_PROFILE_MASK_ARB is ignored and the functionality of the
186
* context is determined solely by the requested version."
188
* The spec also says:
190
* "The default value for WGL_CONTEXT_PROFILE_MASK_ARB is
191
* WGL_CONTEXT_CORE_PROFILE_BIT_ARB."
148
193
attribs.profile = ST_PROFILE_DEFAULT;
149
attribs.visual = pfi->stvis;
194
if ((majorVersion > 3 || (majorVersion == 3 && minorVersion >= 2))
195
&& ((profileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB) == 0))
196
attribs.profile = ST_PROFILE_OPENGL_CORE;
151
198
ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
152
stw_dev->smapi, &attribs, NULL);
199
stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
156
203
ctx->st->st_manager_private = (void *) ctx;
362
409
stw_notify_current_locked( struct stw_framebuffer *fb )
364
struct stw_context *ctx = stw_current_context();
366
if (ctx && ctx->current_framebuffer == fb)
367
ctx->st->notify_invalid_framebuffer(ctx->st, fb->stfb);
411
p_atomic_inc(&fb->stfb->stamp);