Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 29 ++++++---
dlls/wined3d/arb_program_shader.c | 8 +--
dlls/wined3d/context.c | 57 +++++++++--------
dlls/wined3d/gl_compat.c | 126 +++++++++++++++++++++-----------------
dlls/wined3d/wined3d_private.h | 2 +-
5 files changed, 123 insertions(+), 99 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index 84e5360c332..a0167f0b00b 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -3983,10 +3983,11 @@ static void WINE_GLAPI invalid_generic_attrib_func(GLuint idx, const void *data)
* draw_primitive_immediate_mode(). */
static void WINE_GLAPI position_d3dcolor(const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
DWORD pos = *((const DWORD *)data);
FIXME("Add a test for fixed function position from d3dcolor type.\n");
- context_get_current()->gl_info->gl_ops.gl.p_glVertex4s(D3DCOLOR_B_R(pos),
+ gl_info->gl_ops.gl.p_glVertex4s(D3DCOLOR_B_R(pos),
D3DCOLOR_B_G(pos),
D3DCOLOR_B_B(pos),
D3DCOLOR_B_A(pos));
@@ -3994,25 +3995,27 @@ static void WINE_GLAPI position_d3dcolor(const void *data)
static void WINE_GLAPI position_float4(const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
const GLfloat *pos = data;
if (pos[3] != 0.0f && pos[3] != 1.0f)
{
float w = 1.0f / pos[3];
- context_get_current()->gl_info->gl_ops.gl.p_glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
+ gl_info->gl_ops.gl.p_glVertex4f(pos[0] * w, pos[1] * w, pos[2] * w, w);
}
else
{
- context_get_current()->gl_info->gl_ops.gl.p_glVertex3fv(pos);
+ gl_info->gl_ops.gl.p_glVertex3fv(pos);
}
}
static void WINE_GLAPI diffuse_d3dcolor(const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
DWORD diffuseColor = *((const DWORD *)data);
- context_get_current()->gl_info->gl_ops.gl.p_glColor4ub(D3DCOLOR_B_R(diffuseColor),
+ gl_info->gl_ops.gl.p_glColor4ub(D3DCOLOR_B_R(diffuseColor),
D3DCOLOR_B_G(diffuseColor),
D3DCOLOR_B_B(diffuseColor),
D3DCOLOR_B_A(diffuseColor));
@@ -4020,6 +4023,7 @@ static void WINE_GLAPI diffuse_d3dcolor(const void *data)
static void WINE_GLAPI specular_d3dcolor(const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
DWORD specularColor = *((const DWORD *)data);
GLubyte d[] =
{
@@ -4028,7 +4032,7 @@ static void WINE_GLAPI specular_d3dcolor(const void *data)
D3DCOLOR_B_B(specularColor)
};
- context_get_current()->gl_info->gl_ops.ext.p_glSecondaryColor3ubvEXT(d);
+ gl_info->gl_ops.ext.p_glSecondaryColor3ubvEXT(d);
}
static void WINE_GLAPI warn_no_specular_func(const void *data)
@@ -4038,43 +4042,48 @@ static void WINE_GLAPI warn_no_specular_func(const void *data)
static void WINE_GLAPI generic_d3dcolor(GLuint idx, const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
DWORD color = *((const DWORD *)data);
- context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nub(idx,
+ gl_info->gl_ops.ext.p_glVertexAttrib4Nub(idx,
D3DCOLOR_B_R(color), D3DCOLOR_B_G(color),
D3DCOLOR_B_B(color), D3DCOLOR_B_A(color));
}
static void WINE_GLAPI generic_short2n(GLuint idx, const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
const GLshort s[] = {((const GLshort *)data)[0], ((const GLshort *)data)[1], 0, 1};
- context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nsv(idx, s);
+ gl_info->gl_ops.ext.p_glVertexAttrib4Nsv(idx, s);
}
static void WINE_GLAPI generic_ushort2n(GLuint idx, const void *data)
{
const GLushort s[] = {((const GLushort *)data)[0], ((const GLushort *)data)[1], 0, 1};
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
- context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4Nusv(idx, s);
+ gl_info->gl_ops.ext.p_glVertexAttrib4Nusv(idx, s);
}
static void WINE_GLAPI generic_float16_2(GLuint idx, const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
float x = float_16_to_32(((const unsigned short *)data) + 0);
float y = float_16_to_32(((const unsigned short *)data) + 1);
- context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib2f(idx, x, y);
+ gl_info->gl_ops.ext.p_glVertexAttrib2f(idx, x, y);
}
static void WINE_GLAPI generic_float16_4(GLuint idx, const void *data)
{
+ const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->c.gl_info;
float x = float_16_to_32(((const unsigned short *)data) + 0);
float y = float_16_to_32(((const unsigned short *)data) + 1);
float z = float_16_to_32(((const unsigned short *)data) + 2);
float w = float_16_to_32(((const unsigned short *)data) + 3);
- context_get_current()->gl_info->gl_ops.ext.p_glVertexAttrib4f(idx, x, y, z, w);
+ gl_info->gl_ops.ext.p_glVertexAttrib4f(idx, x, y, z, w);
}
static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter *adapter)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 958c9f2b362..e1ddb8e9435 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -720,12 +720,12 @@ static void shader_arb_load_constants(void *shader_priv, struct wined3d_context
static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count)
{
- struct wined3d_context *context = context_get_current();
+ struct wined3d_context_gl *context_gl = wined3d_context_gl_get_current();
struct shader_arb_priv *priv = device->shader_priv;
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */
- if (!context || context->device != device)
+ if (!context_gl || context_gl->c.device != device)
return;
memset(priv->vshader_const_dirty + start, 1, sizeof(*priv->vshader_const_dirty) * count);
@@ -734,12 +734,12 @@ static void shader_arb_update_float_vertex_constants(struct wined3d_device *devi
static void shader_arb_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count)
{
- struct wined3d_context *context = context_get_current();
+ struct wined3d_context_gl *context_gl = wined3d_context_gl_get_current();
struct shader_arb_priv *priv = device->shader_priv;
/* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
* context. On a context switch the old context will be fully dirtified */
- if (!context || context->device != device)
+ if (!context_gl || context_gl->c.device != device)
return;
memset(priv->pshader_const_dirty + start, 1, sizeof(*priv->pshader_const_dirty) * count);
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 80124c17dbe..998aaef81b2 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -1503,17 +1503,16 @@ void context_set_tls_idx(DWORD idx)
wined3d_context_tls_idx = idx;
}
-struct wined3d_context *context_get_current(void)
+struct wined3d_context_gl *wined3d_context_gl_get_current(void)
{
return TlsGetValue(wined3d_context_tls_idx);
}
BOOL wined3d_context_gl_set_current(struct wined3d_context_gl *context_gl)
{
- struct wined3d_context *ctx = context_gl ? &context_gl->c : NULL;
- struct wined3d_context *old = context_get_current();
+ struct wined3d_context_gl *old = wined3d_context_gl_get_current();
- if (old == ctx)
+ if (old == context_gl)
{
TRACE("Already using D3D context %p.\n", context_gl);
return TRUE;
@@ -1521,22 +1520,22 @@ BOOL wined3d_context_gl_set_current(struct wined3d_context_gl *context_gl)
if (old)
{
- if (old->destroyed)
+ if (old->c.destroyed)
{
TRACE("Switching away from destroyed context %p.\n", old);
- wined3d_context_gl_cleanup(wined3d_context_gl(old));
- heap_free((void *)old->gl_info);
+ wined3d_context_gl_cleanup(old);
+ heap_free((void *)old->c.gl_info);
heap_free(old);
}
else
{
if (wglGetCurrentContext())
{
- const struct wined3d_gl_info *gl_info = old->gl_info;
+ const struct wined3d_gl_info *gl_info = old->c.gl_info;
TRACE("Flushing context %p before switching to %p.\n", old, context_gl);
gl_info->gl_ops.gl.p_glFlush();
}
- old->current = 0;
+ old->c.current = 0;
}
}
@@ -1566,7 +1565,7 @@ BOOL wined3d_context_gl_set_current(struct wined3d_context_gl *context_gl)
}
}
- return TlsSetValue(wined3d_context_tls_idx, ctx);
+ return TlsSetValue(wined3d_context_tls_idx, context_gl);
}
void wined3d_context_gl_release(struct wined3d_context_gl *context_gl)
@@ -1579,7 +1578,7 @@ void wined3d_context_gl_release(struct wined3d_context_gl *context_gl)
{
if (!context->level)
WARN("Context %p is not active.\n", context);
- else if (context != context_get_current())
+ else if (context_gl != wined3d_context_gl_get_current())
WARN("Context %p is not the current context.\n", context);
}
@@ -1623,10 +1622,10 @@ static void wined3d_context_gl_enter(struct wined3d_context_gl *context_gl)
if (!context_gl->c.level++)
{
- const struct wined3d_context *current_context = context_get_current();
+ const struct wined3d_context_gl *current_context = wined3d_context_gl_get_current();
HGLRC current_gl = wglGetCurrentContext();
- if (current_gl && (!current_context || wined3d_context_gl_const(current_context)->gl_ctx != current_gl))
+ if (current_gl && (!current_context || current_context->gl_ctx != current_gl))
{
TRACE("Another GL context (%p on device context %p) is already current.\n",
current_gl, wglGetCurrentDC());
@@ -4198,7 +4197,7 @@ static void wined3d_context_gl_activate(struct wined3d_context_gl *context_gl,
if (!context_gl->valid)
return;
- if (&context_gl->c != context_get_current())
+ if (context_gl != wined3d_context_gl_get_current())
{
if (!wined3d_context_gl_set_current(context_gl))
ERR("Failed to activate the new context.\n");
@@ -4212,22 +4211,22 @@ static void wined3d_context_gl_activate(struct wined3d_context_gl *context_gl,
struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx)
{
- struct wined3d_context *current_context = context_get_current();
- struct wined3d_context *context;
+ struct wined3d_context_gl *current_context = wined3d_context_gl_get_current();
+ struct wined3d_context_gl *context_gl;
TRACE("device %p, texture %p, sub_resource_idx %u.\n", device, texture, sub_resource_idx);
- if (current_context && current_context->destroyed)
+ if (current_context && current_context->c.destroyed)
current_context = NULL;
if (!texture)
{
if (current_context
- && current_context->current_rt.texture
- && current_context->device == device)
+ && current_context->c.current_rt.texture
+ && current_context->c.device == device)
{
- texture = current_context->current_rt.texture;
- sub_resource_idx = current_context->current_rt.sub_resource_idx;
+ texture = current_context->c.current_rt.texture;
+ sub_resource_idx = current_context->c.current_rt.sub_resource_idx;
}
else
{
@@ -4241,15 +4240,15 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
}
}
- if (current_context && current_context->current_rt.texture == texture)
+ if (current_context && current_context->c.current_rt.texture == texture)
{
- context = current_context;
+ context_gl = current_context;
}
else if (texture && !wined3d_resource_is_offscreen(&texture->resource))
{
TRACE("Rendering onscreen.\n");
- if (!(context = swapchain_get_context(texture->swapchain)))
+ if (!(context_gl = wined3d_context_gl(swapchain_get_context(texture->swapchain))))
return NULL;
}
else
@@ -4258,15 +4257,15 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
/* Stay with the current context if possible. Otherwise use the
* context for the primary swapchain. */
- if (current_context && current_context->device == device)
- context = current_context;
- else if (!(context = swapchain_get_context(device->swapchains[0])))
+ if (current_context && current_context->c.device == device)
+ context_gl = current_context;
+ else if (!(context_gl = wined3d_context_gl(swapchain_get_context(device->swapchains[0]))))
return NULL;
}
- wined3d_context_gl_activate(wined3d_context_gl(context), texture, sub_resource_idx);
+ wined3d_context_gl_activate(context_gl, texture, sub_resource_idx);
- return context;
+ return &context_gl->c;
}
struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_gl *context_gl)
diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c
index c1491d4c631..a492bd1513f 100644
--- a/dlls/wined3d/gl_compat.c
+++ b/dlls/wined3d/gl_compat.c
@@ -32,84 +32,104 @@ WINE_DEFAULT_DEBUG_CHANNEL(gl_compat);
WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
/* Start GL_ARB_multitexture emulation */
-static void WINE_GLAPI wine_glMultiTexCoord1fARB(GLenum target, GLfloat s) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord1fARB(GLenum target, GLfloat s)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1f(s);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord1f(s);
}
-static void WINE_GLAPI wine_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1fv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord1fv(v);
}
-static void WINE_GLAPI wine_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2f(s, t);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord2f(s, t);
}
-static void WINE_GLAPI wine_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2fv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord2fv(v);
}
-static void WINE_GLAPI wine_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3f(s, t, r);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord3f(s, t, r);
}
-static void WINE_GLAPI wine_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3fv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord3fv(v);
}
-static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4f(s, t, r, q);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord4f(s, t, r, q);
}
-static void WINE_GLAPI wine_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4fv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord4fv(v);
}
-static void WINE_GLAPI wine_glMultiTexCoord2svARB(GLenum target, const GLshort *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord2svARB(GLenum target, const GLshort *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2sv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord2sv(v);
}
-static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *v) {
- if(target != GL_TEXTURE0) {
- ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
+static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *v)
+{
+ if (target != GL_TEXTURE0)
+ {
+ ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported.\n");
return;
}
- context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4sv(v);
+ wined3d_context_gl_get_current()->c.gl_info->gl_ops.gl.p_glTexCoord4sv(v);
}
static void WINE_GLAPI wine_glActiveTexture(GLenum texture)
@@ -154,7 +174,7 @@ static void WINE_GLAPI wine_glEnable(GLenum cap)
{
if (cap == GL_FOG)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
ctx->fog_enabled = 1;
if (ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT)
@@ -168,7 +188,7 @@ static void WINE_GLAPI wine_glDisable(GLenum cap)
{
if (cap == GL_FOG)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
ctx->fog_enabled = 0;
if (ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT)
@@ -180,7 +200,7 @@ static void WINE_GLAPI wine_glDisable(GLenum cap)
static void (WINE_GLAPI *old_fogcoord_glFogi)(GLenum pname, GLint param);
static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
if (pname == GL_FOG_COORDINATE_SOURCE_EXT)
{
@@ -209,7 +229,7 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param)
static void (WINE_GLAPI *old_fogcoord_glFogiv)(GLenum pname, const GLint *param);
static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
if (pname == GL_FOG_COORDINATE_SOURCE_EXT)
{
@@ -238,7 +258,7 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param)
static void (WINE_GLAPI *old_fogcoord_glFogf)(GLenum pname, GLfloat param);
static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
if (pname == GL_FOG_COORDINATE_SOURCE_EXT)
{
@@ -267,7 +287,7 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param)
static void (WINE_GLAPI *old_fogcoord_glFogfv)(GLenum pname, const GLfloat *param);
static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
if (pname == GL_FOG_COORDINATE_SOURCE_EXT)
{
@@ -309,18 +329,16 @@ static void (WINE_GLAPI *old_fogcoord_glColor4f)(GLfloat r, GLfloat g, GLfloat b
static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
- struct wined3d_context *ctx = context_get_current();
- struct wined3d_context_gl *ctx_gl;
+ const struct wined3d_context_gl *ctx_gl = wined3d_context_gl_get_current();
/* This can be called from draw_test_quad() and at that point there is no
* wined3d_context current. */
- if (!ctx)
+ if (!ctx_gl)
{
old_fogcoord_glVertex4f(x, y, z, w);
return;
}
- ctx_gl = wined3d_context_gl(ctx);
if (ctx_gl->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx_gl->fog_enabled)
{
GLfloat c[4] = {ctx_gl->colour[0], ctx_gl->colour[1], ctx_gl->colour[2], ctx_gl->colour[3]};
@@ -354,18 +372,16 @@ static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
static void WINE_GLAPI wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{
- struct wined3d_context *ctx = context_get_current();
- struct wined3d_context_gl *ctx_gl;
+ struct wined3d_context_gl *ctx_gl = wined3d_context_gl_get_current();
/* This can be called from draw_test_quad() and at that point there is no
* wined3d_context current. */
- if (!ctx)
+ if (!ctx_gl)
{
old_fogcoord_glColor4f(r, g, b, a);
return;
}
- ctx_gl = wined3d_context_gl(ctx);
ctx_gl->colour[0] = r;
ctx_gl->colour[1] = g;
ctx_gl->colour[2] = b;
@@ -393,7 +409,7 @@ static void WINE_GLAPI wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte
* single precision function. */
static void WINE_GLAPI wine_glFogCoordfEXT(GLfloat f)
{
- struct wined3d_context_gl *ctx = wined3d_context_gl(context_get_current());
+ struct wined3d_context_gl *ctx = wined3d_context_gl_get_current();
ctx->fog_coord_value = f;
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 60c69f13d04..c9a234872fb 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2105,6 +2105,7 @@ void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query *que
void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_query *query) DECLSPEC_HIDDEN;
void wined3d_context_gl_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
+struct wined3d_context_gl *wined3d_context_gl_get_current(void) DECLSPEC_HIDDEN;
GLenum wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,
const struct wined3d_shader_version *shader_version, unsigned int *base, unsigned int *count) DECLSPEC_HIDDEN;
@@ -2263,7 +2264,6 @@ BOOL fbo_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_gl
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other) DECLSPEC_HIDDEN;
HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx) DECLSPEC_HIDDEN;
-struct wined3d_context *context_get_current(void) DECLSPEC_HIDDEN;
DWORD context_get_tls_idx(void) DECLSPEC_HIDDEN;
void context_gl_resource_released(struct wined3d_device *device,
GLuint name, BOOL rb_namespace) DECLSPEC_HIDDEN;
--
2.11.0