d3d9: Retrieve textures from the primary stateblock.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b33177355e
commit
aa18b69a66
|
@ -2516,6 +2516,7 @@ static HRESULT WINAPI d3d9_device_GetTexture(IDirect3DDevice9Ex *iface, DWORD st
|
|||
{
|
||||
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
|
||||
struct wined3d_texture *wined3d_texture = NULL;
|
||||
const struct wined3d_stateblock_state *state;
|
||||
struct d3d9_texture *texture_impl;
|
||||
|
||||
TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture);
|
||||
|
@ -2523,8 +2524,19 @@ static HRESULT WINAPI d3d9_device_GetTexture(IDirect3DDevice9Ex *iface, DWORD st
|
|||
if (!texture)
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
|
||||
stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
|
||||
|
||||
if (stage >= ARRAY_SIZE(state->textures))
|
||||
{
|
||||
WARN("Ignoring invalid stage %u.\n", stage);
|
||||
*texture = NULL;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
wined3d_mutex_lock();
|
||||
if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage)))
|
||||
state = wined3d_stateblock_get_state(device->state);
|
||||
if ((wined3d_texture = state->textures[stage]))
|
||||
{
|
||||
texture_impl = wined3d_texture_get_parent(wined3d_texture);
|
||||
*texture = &texture_impl->IDirect3DBaseTexture9_iface;
|
||||
|
@ -2815,16 +2827,15 @@ static float WINAPI d3d9_device_GetNPatchMode(IDirect3DDevice9Ex *iface)
|
|||
/* wined3d critical section must be taken by the caller. */
|
||||
static void d3d9_generate_auto_mipmaps(struct d3d9_device *device)
|
||||
{
|
||||
const struct wined3d_stateblock_state *state = wined3d_stateblock_get_state(device->state);
|
||||
struct wined3d_texture *texture;
|
||||
unsigned int i, stage, map;
|
||||
unsigned int i, map;
|
||||
|
||||
map = device->auto_mipmaps;
|
||||
while (map)
|
||||
{
|
||||
i = wined3d_bit_scan(&map);
|
||||
|
||||
stage = i >= 16 ? i - 16 + D3DVERTEXTEXTURESAMPLER0 : i;
|
||||
if ((texture = wined3d_device_get_texture(device->wined3d_device, stage)))
|
||||
if ((texture = state->textures[i]))
|
||||
d3d9_texture_gen_auto_mipmap(wined3d_texture_get_parent(texture));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,9 +116,9 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface)
|
|||
{
|
||||
struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
|
||||
struct wined3d_texture *wined3d_texture;
|
||||
unsigned int i, offset, stride, stage;
|
||||
struct wined3d_buffer *wined3d_buffer;
|
||||
struct d3d9_vertexbuffer *buffer;
|
||||
unsigned int i, offset, stride;
|
||||
enum wined3d_format_id format;
|
||||
struct d3d9_texture *texture;
|
||||
struct d3d9_device *device;
|
||||
|
@ -151,9 +151,7 @@ static HRESULT WINAPI d3d9_stateblock_Apply(IDirect3DStateBlock9 *iface)
|
|||
device->auto_mipmaps = 0;
|
||||
for (i = 0; i < D3D9_MAX_TEXTURE_UNITS; ++i)
|
||||
{
|
||||
stage = i >= 16 ? i - 16 + D3DVERTEXTEXTURESAMPLER0 : i;
|
||||
|
||||
if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage))
|
||||
if ((wined3d_texture = wined3d_stateblock_get_state(device->state)->textures[i])
|
||||
&& (texture = wined3d_texture_get_parent(wined3d_texture))
|
||||
&& texture->usage & D3DUSAGE_AUTOGENMIPMAP)
|
||||
device->auto_mipmaps |= 1u << i;
|
||||
|
|
Loading…
Reference in New Issue