Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/wined3d/stateblock.c | 22 ++++++++++++++++++++++ dlls/wined3d/wined3d.spec | 1 + include/wine/wined3d.h | 1 + 3 files changed, 24 insertions(+)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 967a44262c..cd87809496 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1485,6 +1485,28 @@ void CDECL wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock stateblock->changed.textureState[stage] |= 1u << state; }
+void CDECL wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, + UINT stage, struct wined3d_texture *texture) +{ + TRACE("stateblock %p, stage %u, texture %p.\n", stateblock, stage, texture); + + if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) + stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS); + + if (stage >= ARRAY_SIZE(stateblock->stateblock_state.textures)) + { + WARN("Ignoring invalid stage %u.\n", stage); + return; + } + + if (texture) + wined3d_texture_incref(texture); + if (stateblock->stateblock_state.textures[stage]) + wined3d_texture_decref(stateblock->stateblock_state.textures[stage]); + stateblock->stateblock_state.textures[stage] = texture; + stateblock->changed.textures |= 1u << stage; +} + static void init_default_render_states(DWORD rs[WINEHIGHEST_RENDER_STATE + 1], const struct wined3d_d3d_info *d3d_info) { union diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec index 6fba7b5661..d0ba31bf4e 100644 --- a/dlls/wined3d/wined3d.spec +++ b/dlls/wined3d/wined3d.spec @@ -266,6 +266,7 @@ @ cdecl wined3d_stateblock_set_ps_consts_i(ptr long long ptr) @ cdecl wined3d_stateblock_set_render_state(ptr long long) @ cdecl wined3d_stateblock_set_sampler_state(ptr long long long) +@ cdecl wined3d_stateblock_set_texture(ptr long ptr) @ cdecl wined3d_stateblock_set_texture_stage_state(ptr long long long) @ cdecl wined3d_stateblock_set_vertex_declaration(ptr ptr) @ cdecl wined3d_stateblock_set_vertex_shader(ptr ptr) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e328386d6f..a567cfd2f1 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -2674,6 +2674,7 @@ void __cdecl wined3d_stateblock_set_render_state(struct wined3d_stateblock *stat enum wined3d_render_state state, DWORD value); void __cdecl wined3d_stateblock_set_sampler_state(struct wined3d_stateblock *stateblock, UINT sampler_idx, enum wined3d_sampler_state state, DWORD value); +void __cdecl wined3d_stateblock_set_texture(struct wined3d_stateblock *stateblock, UINT stage, struct wined3d_texture *texture); void __cdecl wined3d_stateblock_set_texture_stage_state(struct wined3d_stateblock *stateblock, UINT stage, enum wined3d_texture_stage_state state, DWORD value); void __cdecl wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock,