wined3d: Factor out wined3d_texture_set_lod() function.
This commit is contained in:
parent
2e088045b5
commit
9492a10f44
3 changed files with 29 additions and 18 deletions
|
@ -3321,28 +3321,14 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
|
|||
unsigned int CDECL wined3d_stateblock_set_texture_lod(struct wined3d_stateblock *stateblock,
|
||||
struct wined3d_texture *texture, unsigned int lod)
|
||||
{
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int old = texture->lod;
|
||||
unsigned int old;
|
||||
|
||||
TRACE("texture %p, lod %u.\n", texture, lod);
|
||||
|
||||
/* The d3d9:texture test shows that SetLOD is ignored on non-managed
|
||||
* textures. The call always returns 0, and GetLOD always returns 0. */
|
||||
resource = &texture->resource;
|
||||
if (!(resource->usage & WINED3DUSAGE_MANAGED))
|
||||
old = wined3d_texture_set_lod(texture, lod);
|
||||
|
||||
if (old != lod)
|
||||
{
|
||||
TRACE("Ignoring LOD on texture with resource access %s.\n",
|
||||
wined3d_debug_resource_access(resource->access));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lod >= texture->level_count)
|
||||
lod = texture->level_count - 1;
|
||||
|
||||
if (texture->lod != lod)
|
||||
{
|
||||
texture->lod = lod;
|
||||
|
||||
for (unsigned int i = 0; i < WINED3D_MAX_COMBINED_SAMPLERS; ++i)
|
||||
{
|
||||
/* Mark the texture as changed. The next time the appplication
|
||||
|
|
|
@ -1784,6 +1784,30 @@ unsigned int CDECL wined3d_texture_get_lod(const struct wined3d_texture *texture
|
|||
return texture->lod;
|
||||
}
|
||||
|
||||
unsigned int CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, unsigned int lod)
|
||||
{
|
||||
struct wined3d_resource *resource;
|
||||
unsigned int old = texture->lod;
|
||||
|
||||
TRACE("texture %p, returning %u.\n", texture, texture->lod);
|
||||
|
||||
/* The d3d9:texture test shows that SetLOD is ignored on non-managed
|
||||
* textures. The call always returns 0, and GetLOD always returns 0. */
|
||||
resource = &texture->resource;
|
||||
if (!(resource->usage & WINED3DUSAGE_MANAGED))
|
||||
{
|
||||
TRACE("Ignoring LOD on texture with resource access %s.\n",
|
||||
wined3d_debug_resource_access(resource->access));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lod >= texture->level_count)
|
||||
lod = texture->level_count - 1;
|
||||
|
||||
texture->lod = lod;
|
||||
return old;
|
||||
}
|
||||
|
||||
UINT CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture)
|
||||
{
|
||||
TRACE("texture %p, returning %u.\n", texture, texture->level_count);
|
||||
|
|
|
@ -2883,6 +2883,7 @@ ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture);
|
|||
HRESULT __cdecl wined3d_texture_get_dc(struct wined3d_texture *texture, unsigned int sub_resource_idx, HDC *dc);
|
||||
unsigned int __cdecl wined3d_texture_get_level_count(const struct wined3d_texture *texture);
|
||||
unsigned int __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture);
|
||||
unsigned int __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, unsigned int lod);
|
||||
HRESULT __cdecl wined3d_texture_get_overlay_position(const struct wined3d_texture *texture,
|
||||
unsigned int sub_resource_idx, LONG *x, LONG *y);
|
||||
void * __cdecl wined3d_texture_get_parent(const struct wined3d_texture *texture);
|
||||
|
|
Loading…
Add table
Reference in a new issue