wined3d: Pass a wined3d_context_gl structure to context_active_texture().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Henri Verbeet 2019-06-05 16:54:04 +04:30 committed by Alexandre Julliard
parent 8bd2730ab7
commit 899e4c7aed
9 changed files with 33 additions and 28 deletions

View File

@ -7379,7 +7379,7 @@ static void arbfp_blitter_upload_palette(struct wined3d_arbfp_blitter *blitter,
}
/* Switch back to unit 0 in which the 2D texture will be stored. */
context_active_texture(&context_gl->c, gl_info, 0);
wined3d_context_gl_active_texture(context_gl, gl_info, 0);
}
/* Context activation is done by the caller. */

View File

@ -1055,7 +1055,7 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
mapped_stage = context_gl->tex_unit_map[i];
if (mapped_stage != WINED3D_UNMAPPED_STAGE)
{
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
texture_activate_dimensions(state->textures[i], gl_info);
}
}

View File

@ -2209,7 +2209,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
*/
for (i = 1; i < gl_info->limits.textures; ++i)
{
context_active_texture(context, gl_info, i);
wined3d_context_gl_active_texture(context_gl, gl_info, i);
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV,
GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + i - 1);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, ...");
@ -2240,7 +2240,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
{
for (i = 0; i < gl_info->limits.textures; ++i)
{
context_active_texture(context, gl_info, i);
wined3d_context_gl_active_texture(context_gl, gl_info, i);
gl_info->gl_ops.gl.p_glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
checkGLcall("glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE)");
}
@ -2515,11 +2515,12 @@ void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, G
}
/* Context activation is done by the caller. */
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info, unsigned int unit)
void wined3d_context_gl_active_texture(struct wined3d_context_gl *context_gl,
const struct wined3d_gl_info *gl_info, unsigned int unit)
{
GL_EXTCALL(glActiveTexture(GL_TEXTURE0 + unit));
checkGLcall("glActiveTexture");
context->active_texture = unit;
context_gl->c.active_texture = unit;
}
void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name)
@ -2808,7 +2809,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl,
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
GL_EXTCALL(glBindSampler(0, 0));
context_active_texture(context, gl_info, 0);
wined3d_context_gl_active_texture(context_gl, gl_info, 0);
sampler = context_gl->rev_tex_unit_map[0];
if (sampler != WINED3D_UNMAPPED_STAGE)
@ -2923,7 +2924,7 @@ void wined3d_context_gl_apply_ffp_blit_state(struct wined3d_context_gl *context_
* from. */
for (i = gl_info->limits.textures - 1; i > 0 ; --i)
{
context_active_texture(context, gl_info, i);
wined3d_context_gl_active_texture(context_gl, gl_info, i);
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);
@ -2943,7 +2944,7 @@ void wined3d_context_gl_apply_ffp_blit_state(struct wined3d_context_gl *context_
}
}
context_active_texture(context, gl_info, 0);
wined3d_context_gl_active_texture(context_gl, gl_info, 0);
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_CUBE_MAP_ARB);

View File

@ -690,7 +690,7 @@ static void wined3d_device_gl_create_dummy_textures(struct wined3d_device_gl *de
* OpenGL will only allow that when a valid texture is bound.
* We emulate this by creating dummy textures and binding them
* to each texture stage when the currently set D3D texture is NULL. */
context_active_texture(&context_gl->c, gl_info, 0);
wined3d_context_gl_active_texture(context_gl, gl_info, 0);
gl_info->gl_ops.gl.p_glGenTextures(1, &textures->tex_1d);
TRACE("Dummy 1D texture given name %u.\n", textures->tex_1d);

View File

@ -12779,7 +12779,7 @@ static void glsl_blitter_upload_palette(struct wined3d_glsl_blitter *blitter,
if (!blitter->palette_texture)
gl_info->gl_ops.gl.p_glGenTextures(1, &blitter->palette_texture);
context_active_texture(&context_gl->c, gl_info, 1);
wined3d_context_gl_active_texture(context_gl, gl_info, 1);
gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_1D, blitter->palette_texture);
gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -12799,7 +12799,7 @@ static void glsl_blitter_upload_palette(struct wined3d_glsl_blitter *blitter,
GL_UNSIGNED_INT_8_8_8_8_REV, &black);
}
context_active_texture(&context_gl->c, gl_info, 0);
wined3d_context_gl_active_texture(context_gl, gl_info, 0);
}
/* Context activation is done by the caller. */

View File

@ -501,7 +501,7 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
FIXME("Attempt to enable unsupported stage!\n");
return;
}
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
}
if (context->lowest_disabled_stage > 0)
@ -579,9 +579,9 @@ static void nvrc_colorop(struct wined3d_context *context, const struct wined3d_s
BOOL usedBump = !!(context->texShaderBumpMap & 1u << (stage + 1));
if (usesBump != usedBump)
{
context_active_texture(context, gl_info, mapped_stage + 1);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage + 1);
nvts_activate_dimensions(state, stage + 1, context);
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
}
}
}
@ -639,7 +639,7 @@ static void nvts_bumpenvmat(struct wined3d_context *context, const struct wined3
*/
if (mapped_stage < gl_info->limits.textures)
{
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
/* We can't just pass a pointer to the state to GL due to the
* different matrix format (column major vs row major). */

View File

@ -827,6 +827,7 @@ static void state_specularenable(struct wined3d_context *context, const struct w
static void state_texfactor(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_color color;
unsigned int i;
@ -840,7 +841,7 @@ static void state_texfactor(struct wined3d_context *context, const struct wined3
{
/* Note the WINED3D_RS value applies to all textures, but GL has one
* per texture, so apply it now ready to be used! */
context_active_texture(context, gl_info, i);
wined3d_context_gl_active_texture(context_gl, gl_info, i);
gl_info->gl_ops.gl.p_glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &color.r);
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
@ -3128,8 +3129,9 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
static void tex_colorop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
unsigned int stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
unsigned int mapped_stage = wined3d_context_gl(context)->tex_unit_map[stage];
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
unsigned int mapped_stage = context_gl->tex_unit_map[stage];
const struct wined3d_gl_info *gl_info = context->gl_info;
TRACE("Setting color op for stage %d\n", stage);
@ -3146,7 +3148,7 @@ static void tex_colorop(struct wined3d_context *context, const struct wined3d_st
FIXME("Attempt to enable unsupported stage!\n");
return;
}
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
}
if (stage >= context->lowest_disabled_stage)
@ -3189,8 +3191,9 @@ static void tex_colorop(struct wined3d_context *context, const struct wined3d_st
void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
unsigned int stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
unsigned int mapped_stage = wined3d_context_gl(context)->tex_unit_map[stage];
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
BOOL tex_used = context->fixed_function_usage_map & (1u << stage);
unsigned int mapped_stage = context_gl->tex_unit_map[stage];
const struct wined3d_gl_info *gl_info = context->gl_info;
DWORD op, arg1, arg2, arg0;
@ -3203,7 +3206,7 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
FIXME("Attempt to enable unsupported stage!\n");
return;
}
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
}
op = state->texture_states[stage][WINED3D_TSS_ALPHA_OP];
@ -3288,7 +3291,8 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
static void transform_texture(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
unsigned int tex = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1);
unsigned int mapped_stage = wined3d_context_gl(context)->tex_unit_map[tex];
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
unsigned int mapped_stage = context_gl->tex_unit_map[tex];
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_matrix mat;
@ -3302,7 +3306,7 @@ static void transform_texture(struct wined3d_context *context, const struct wine
if (mapped_stage == WINED3D_UNMAPPED_STAGE) return;
if (mapped_stage >= gl_info->limits.textures) return;
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
gl_info->gl_ops.gl.p_glMatrixMode(GL_TEXTURE);
checkGLcall("glMatrixMode(GL_TEXTURE)");
@ -3335,7 +3339,7 @@ static void tex_coordindex(struct wined3d_context *context, const struct wined3d
WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
return;
}
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
/* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive
*
@ -3613,7 +3617,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
if (mapped_stage >= gl_info->limits.graphics_samplers)
return;
context_active_texture(context, gl_info, mapped_stage);
wined3d_context_gl_active_texture(context_gl, gl_info, mapped_stage);
if (state->textures[sampler_idx])
{

View File

@ -834,7 +834,7 @@ void wined3d_shader_resource_view_gl_bind(struct wined3d_shader_resource_view_gl
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_texture_gl *texture_gl;
context_active_texture(context, gl_info, unit);
wined3d_context_gl_active_texture(context_gl, gl_info, unit);
if (view_gl->gl_view.name)
{

View File

@ -2056,6 +2056,8 @@ static inline const struct wined3d_context_gl *wined3d_context_gl_const(const st
return CONTAINING_RECORD(context, struct wined3d_context_gl, c);
}
void wined3d_context_gl_active_texture(struct wined3d_context_gl *context_gl,
const struct wined3d_gl_info *gl_info, unsigned int unit) DECLSPEC_HIDDEN;
void wined3d_context_gl_alloc_fence(struct wined3d_context_gl *context_gl,
struct wined3d_fence *fence) DECLSPEC_HIDDEN;
void wined3d_context_gl_alloc_occlusion_query(struct wined3d_context_gl *context_gl,
@ -2231,8 +2233,6 @@ BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other) DECLSP
struct wined3d_context *context_acquire(const struct wined3d_device *device,
struct wined3d_texture *texture, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
void context_active_texture(struct wined3d_context *context, const struct wined3d_gl_info *gl_info,
unsigned int unit) DECLSPEC_HIDDEN;
void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name) DECLSPEC_HIDDEN;
void context_bind_dummy_textures(const struct wined3d_context *context) DECLSPEC_HIDDEN;
void context_copy_bo_address(struct wined3d_context *context,