Commit ce436a76 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of getActiveContext().

parent 377cda97
...@@ -1986,7 +1986,3 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU ...@@ -1986,7 +1986,3 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU
FIXME("Unexpected context usage requested\n"); FIXME("Unexpected context usage requested\n");
} }
} }
WineD3DContext *getActiveContext(void) {
return last_device->activeContext;
}
...@@ -147,7 +147,7 @@ static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) { ...@@ -147,7 +147,7 @@ static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) {
static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL; static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL;
static void WINE_GLAPI wine_glEnable(GLenum cap) { static void WINE_GLAPI wine_glEnable(GLenum cap) {
if(cap == GL_FOG) { if(cap == GL_FOG) {
WineD3DContext *ctx = getActiveContext(); struct WineD3DContext *ctx = context_get_current();
ctx->fog_enabled = 1; ctx->fog_enabled = 1;
if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return; if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
} }
...@@ -157,7 +157,7 @@ static void WINE_GLAPI wine_glEnable(GLenum cap) { ...@@ -157,7 +157,7 @@ static void WINE_GLAPI wine_glEnable(GLenum cap) {
static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL; static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL;
static void WINE_GLAPI wine_glDisable(GLenum cap) { static void WINE_GLAPI wine_glDisable(GLenum cap) {
if(cap == GL_FOG) { if(cap == GL_FOG) {
WineD3DContext *ctx = getActiveContext(); struct WineD3DContext *ctx = context_get_current();
ctx->fog_enabled = 0; ctx->fog_enabled = 0;
if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return; if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
} }
...@@ -166,8 +166,9 @@ static void WINE_GLAPI wine_glDisable(GLenum cap) { ...@@ -166,8 +166,9 @@ static void WINE_GLAPI wine_glDisable(GLenum cap) {
static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL; static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL;
static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) { static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
struct WineD3DContext *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
WineD3DContext *ctx = getActiveContext();
ctx->gl_fog_source = param; ctx->gl_fog_source = param;
if(param == GL_FRAGMENT_DEPTH_EXT) { if(param == GL_FRAGMENT_DEPTH_EXT) {
if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
...@@ -177,9 +178,9 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) { ...@@ -177,9 +178,9 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
} }
} else { } else {
if(pname == GL_FOG_START) { if(pname == GL_FOG_START) {
getActiveContext()->fogstart = param; ctx->fogstart = param;
} else if(pname == GL_FOG_END) { } else if(pname == GL_FOG_END) {
getActiveContext()->fogend = param; ctx->fogend = param;
} }
old_fogcoord_glFogi(pname, param); old_fogcoord_glFogi(pname, param);
} }
...@@ -187,8 +188,8 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) { ...@@ -187,8 +188,8 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL; static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL;
static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) { static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
struct WineD3DContext *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
WineD3DContext *ctx = getActiveContext();
ctx->gl_fog_source = *param; ctx->gl_fog_source = *param;
if(*param == GL_FRAGMENT_DEPTH_EXT) { if(*param == GL_FRAGMENT_DEPTH_EXT) {
if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
...@@ -198,9 +199,9 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) { ...@@ -198,9 +199,9 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
} }
} else { } else {
if(pname == GL_FOG_START) { if(pname == GL_FOG_START) {
getActiveContext()->fogstart = *param; ctx->fogstart = *param;
} else if(pname == GL_FOG_END) { } else if(pname == GL_FOG_END) {
getActiveContext()->fogend = *param; ctx->fogend = *param;
} }
old_fogcoord_glFogiv(pname, param); old_fogcoord_glFogiv(pname, param);
} }
...@@ -208,8 +209,8 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) { ...@@ -208,8 +209,8 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL; static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL;
static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) { static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
struct WineD3DContext *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
WineD3DContext *ctx = getActiveContext();
ctx->gl_fog_source = (GLint) param; ctx->gl_fog_source = (GLint) param;
if(param == GL_FRAGMENT_DEPTH_EXT) { if(param == GL_FRAGMENT_DEPTH_EXT) {
if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
...@@ -219,9 +220,9 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) { ...@@ -219,9 +220,9 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
} }
} else { } else {
if(pname == GL_FOG_START) { if(pname == GL_FOG_START) {
getActiveContext()->fogstart = param; ctx->fogstart = param;
} else if(pname == GL_FOG_END) { } else if(pname == GL_FOG_END) {
getActiveContext()->fogend = param; ctx->fogend = param;
} }
old_fogcoord_glFogf(pname, param); old_fogcoord_glFogf(pname, param);
} }
...@@ -229,8 +230,8 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) { ...@@ -229,8 +230,8 @@ static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL; static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL;
static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) { static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) {
struct WineD3DContext *ctx = context_get_current();
if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
WineD3DContext *ctx = getActiveContext();
ctx->gl_fog_source = (GLint) *param; ctx->gl_fog_source = (GLint) *param;
if(*param == GL_FRAGMENT_DEPTH_EXT) { if(*param == GL_FRAGMENT_DEPTH_EXT) {
if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
...@@ -240,15 +241,14 @@ static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) { ...@@ -240,15 +241,14 @@ static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) {
} }
} else { } else {
if(pname == GL_FOG_COLOR) { if(pname == GL_FOG_COLOR) {
WineD3DContext *ctx = getActiveContext();
ctx->fogcolor[0] = param[0]; ctx->fogcolor[0] = param[0];
ctx->fogcolor[1] = param[1]; ctx->fogcolor[1] = param[1];
ctx->fogcolor[2] = param[2]; ctx->fogcolor[2] = param[2];
ctx->fogcolor[3] = param[3]; ctx->fogcolor[3] = param[3];
} else if(pname == GL_FOG_START) { } else if(pname == GL_FOG_START) {
getActiveContext()->fogstart = *param; ctx->fogstart = *param;
} else if(pname == GL_FOG_END) { } else if(pname == GL_FOG_END) {
getActiveContext()->fogend = *param; ctx->fogend = *param;
} }
old_fogcoord_glFogfv(pname, param); old_fogcoord_glFogfv(pname, param);
} }
...@@ -269,7 +269,7 @@ static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL ...@@ -269,7 +269,7 @@ static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL
static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL; static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL;
static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
WineD3DContext *ctx = getActiveContext(); struct WineD3DContext *ctx = context_get_current();
if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) { if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) {
GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]}; GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]};
GLfloat i; GLfloat i;
...@@ -299,7 +299,7 @@ static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) { ...@@ -299,7 +299,7 @@ static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
} }
static void wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { static void wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
WineD3DContext *ctx = getActiveContext(); struct WineD3DContext *ctx = context_get_current();
ctx->color[0] = r; ctx->color[0] = r;
ctx->color[1] = g; ctx->color[1] = g;
ctx->color[2] = b; ctx->color[2] = b;
...@@ -327,7 +327,7 @@ static void wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) { ...@@ -327,7 +327,7 @@ static void wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
* precision function * precision function
*/ */
static void wine_glFogCoordfEXT(GLfloat f) { static void wine_glFogCoordfEXT(GLfloat f) {
WineD3DContext *ctx = getActiveContext(); struct WineD3DContext *ctx = context_get_current();
ctx->fog_coord_value = f; ctx->fog_coord_value = f;
} }
static void wine_glFogCoorddEXT(GLdouble f) { static void wine_glFogCoorddEXT(GLdouble f) {
......
...@@ -1263,7 +1263,6 @@ typedef enum ContextUsage { ...@@ -1263,7 +1263,6 @@ typedef enum ContextUsage {
} ContextUsage; } ContextUsage;
void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage); void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage);
WineD3DContext *getActiveContext(void);
WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms); WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms);
void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context); void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context);
void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type); void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment