diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c index 62be40d0d01..344daf6a3c1 100644 --- a/dlls/wined3d/ati_fragment_shader.c +++ b/dlls/wined3d/ati_fragment_shader.c @@ -28,6 +28,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); WINE_DECLARE_DEBUG_CHANNEL(d3d); +#define GLINFO_LOCATION (*gl_info) + /* GL locking for state handlers is done by the caller. */ /* Some private defines, Constant associations, etc. @@ -190,7 +192,6 @@ static const char *debug_mask(GLuint mask) { default: return "Unexpected writemask"; } } -#define GLINFO_LOCATION (*gl_info) static void wrap_op1(const struct wined3d_gl_info *gl_info, GLuint op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod) @@ -796,11 +797,10 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con checkGLcall("GL_EXTCALL(glEndFragmentShaderATI())"); return ret; } -#undef GLINFO_LOCATION -#define GLINFO_LOCATION stateblock->device->adapter->gl_info static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { + const struct wined3d_gl_info *gl_info = context->gl_info; IWineD3DDeviceImpl *This = stateblock->device; const struct atifs_ffp_desc *desc; struct ffp_frag_settings settings; @@ -818,14 +818,14 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st return; } new_desc->num_textures_used = 0; - for (i = 0; i < context->gl_info->limits.texture_stages; ++i) + for (i = 0; i < gl_info->limits.texture_stages; ++i) { if(settings.op[i].cop == WINED3DTOP_DISABLE) break; new_desc->num_textures_used = i; } memcpy(&new_desc->parent.settings, &settings, sizeof(settings)); - new_desc->shader = gen_ati_shader(settings.op, context->gl_info); + new_desc->shader = gen_ati_shader(settings.op, gl_info); add_ffp_frag_shader(&priv->fragment_shaders, &new_desc->parent); TRACE("Allocated fixed function replacement shader descriptor %p\n", new_desc); desc = new_desc; @@ -849,6 +849,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { + const struct wined3d_gl_info *gl_info = context->gl_info; float col[4]; D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col); @@ -859,6 +860,7 @@ static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *statebloc static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); + const struct wined3d_gl_info *gl_info = context->gl_info; float mat[2][2]; mat[0][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT00]); @@ -912,8 +914,6 @@ static void atifs_apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *statebl } } -#undef GLINFO_LOCATION - static const struct StateEntryTemplate atifs_fragmentstate_template[] = { {STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor_atifs }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3DRS_FOGCOLOR), { STATE_RENDER(WINED3DRS_FOGCOLOR), state_fogcolor }, WINED3D_GL_EXT_NONE }, @@ -1126,11 +1126,11 @@ static HRESULT atifs_alloc(IWineD3DDevice *iface) { return WINED3D_OK; } -#define GLINFO_LOCATION This->adapter->gl_info /* Context activation is done by the caller. */ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context) { IWineD3DDeviceImpl *This = context; + const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; struct atifs_ffp_desc *entry_ati = WINE_RB_ENTRY_VALUE(entry, struct atifs_ffp_desc, parent.entry); ENTER_GL(); @@ -1150,7 +1150,6 @@ static void atifs_free(IWineD3DDevice *iface) { HeapFree(GetProcessHeap(), 0, priv); This->fragment_priv = NULL; } -#undef GLINFO_LOCATION static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup) {