mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
wined3d: Preload textures before applying states.
This commit is contained in:
parent
7ff576bbab
commit
31d51fb175
@ -2214,6 +2214,7 @@ static void context_apply_state(struct wined3d_context *context, IWineD3DDeviceI
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_FindTexUnitMap(device);
|
||||
device_preload_textures(device);
|
||||
|
||||
ENTER_GL();
|
||||
for (i = 0; i < context->numDirtyEntries; ++i)
|
||||
|
@ -370,6 +370,50 @@ void device_stream_info_from_strided(const struct wined3d_gl_info *gl_info,
|
||||
}
|
||||
}
|
||||
|
||||
static void device_preload_texture(IWineD3DStateBlockImpl *stateblock, unsigned int idx)
|
||||
{
|
||||
IWineD3DBaseTextureImpl *texture;
|
||||
enum WINED3DSRGB srgb;
|
||||
|
||||
if (!(texture = (IWineD3DBaseTextureImpl *)stateblock->textures[idx])) return;
|
||||
srgb = stateblock->samplerState[idx][WINED3DSAMP_SRGBTEXTURE] ? SRGB_SRGB : SRGB_RGB;
|
||||
texture->baseTexture.internal_preload((IWineD3DBaseTexture *)texture, srgb);
|
||||
}
|
||||
|
||||
void device_preload_textures(IWineD3DDeviceImpl *device)
|
||||
{
|
||||
IWineD3DStateBlockImpl *stateblock = device->stateBlock;
|
||||
unsigned int i;
|
||||
|
||||
if (use_vs(stateblock))
|
||||
{
|
||||
for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i)
|
||||
{
|
||||
if (((IWineD3DBaseShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.sampler_type[i])
|
||||
device_preload_texture(stateblock, MAX_FRAGMENT_SAMPLERS + i);
|
||||
}
|
||||
}
|
||||
|
||||
if (use_ps(stateblock))
|
||||
{
|
||||
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i)
|
||||
{
|
||||
if (((IWineD3DBaseShaderImpl *)stateblock->pixelShader)->baseShader.reg_maps.sampler_type[i])
|
||||
device_preload_texture(stateblock, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WORD ffu_map = device->fixed_function_usage_map;
|
||||
|
||||
for (i = 0; ffu_map; ffu_map >>= 1, ++i)
|
||||
{
|
||||
if (ffu_map & 1)
|
||||
device_preload_texture(stateblock, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* IUnknown parts follows
|
||||
**********************************************************/
|
||||
|
@ -3527,7 +3527,6 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
|
||||
if(stateblock->textures[sampler]) {
|
||||
BOOL srgb = stateblock->samplerState[sampler][WINED3DSAMP_SRGBTEXTURE];
|
||||
IWineD3DBaseTextureImpl *tex_impl = (IWineD3DBaseTextureImpl *) stateblock->textures[sampler];
|
||||
tex_impl->baseTexture.internal_preload(stateblock->textures[sampler], srgb ? SRGB_SRGB : SRGB_RGB);
|
||||
IWineD3DBaseTexture_BindTexture(stateblock->textures[sampler], srgb);
|
||||
basetexture_apply_state_changes(stateblock->textures[sampler],
|
||||
stateblock->textureState[sampler], stateblock->samplerState[sampler], gl_info);
|
||||
|
@ -1620,6 +1620,7 @@ struct IWineD3DDeviceImpl
|
||||
HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d,
|
||||
UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags,
|
||||
IUnknown *parent, IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN;
|
||||
void device_preload_textures(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN;
|
||||
LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window,
|
||||
UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN;
|
||||
void device_resource_add(IWineD3DDeviceImpl *This, IWineD3DResource *resource) DECLSPEC_HIDDEN;
|
||||
|
Loading…
Reference in New Issue
Block a user