wined3d: Pass an IWineD3DBaseTextureImpl pointer to basetexture_bind().
This commit is contained in:
parent
bf108ac872
commit
32779a2232
|
@ -243,23 +243,23 @@ BOOL basetexture_set_dirty(IWineD3DBaseTextureImpl *texture, BOOL dirty)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Context activation is done by the caller. */
|
/* Context activation is done by the caller. */
|
||||||
HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc)
|
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc)
|
||||||
{
|
{
|
||||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
|
||||||
HRESULT hr = WINED3D_OK;
|
HRESULT hr = WINED3D_OK;
|
||||||
GLenum textureDimensions;
|
GLenum textureDimensions;
|
||||||
BOOL isNewTexture = FALSE;
|
BOOL isNewTexture = FALSE;
|
||||||
struct gl_texture *gl_tex;
|
struct gl_texture *gl_tex;
|
||||||
TRACE("(%p) : About to bind texture\n", This);
|
|
||||||
|
|
||||||
This->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */
|
TRACE("texture %p, srgb %#x, set_surface_desc %p.\n", texture, srgb, set_surface_desc);
|
||||||
if(srgb) {
|
|
||||||
gl_tex = &This->baseTexture.texture_srgb;
|
texture->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */
|
||||||
} else {
|
if (srgb)
|
||||||
gl_tex = &This->baseTexture.texture_rgb;
|
gl_tex = &texture->baseTexture.texture_srgb;
|
||||||
}
|
else
|
||||||
|
gl_tex = &texture->baseTexture.texture_rgb;
|
||||||
|
|
||||||
|
textureDimensions = texture->baseTexture.target;
|
||||||
|
|
||||||
textureDimensions = This->baseTexture.target;
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
/* Generate a texture name if we don't already have one */
|
/* Generate a texture name if we don't already have one */
|
||||||
if (!gl_tex->name)
|
if (!gl_tex->name)
|
||||||
|
@ -268,7 +268,8 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
|
||||||
glGenTextures(1, &gl_tex->name);
|
glGenTextures(1, &gl_tex->name);
|
||||||
checkGLcall("glGenTextures");
|
checkGLcall("glGenTextures");
|
||||||
TRACE("Generated texture %d\n", gl_tex->name);
|
TRACE("Generated texture %d\n", gl_tex->name);
|
||||||
if (This->resource.pool == WINED3DPOOL_DEFAULT) {
|
if (texture->resource.pool == WINED3DPOOL_DEFAULT)
|
||||||
|
{
|
||||||
/* Tell opengl to try and keep this texture in video ram (well mostly) */
|
/* Tell opengl to try and keep this texture in video ram (well mostly) */
|
||||||
GLclampf tmp;
|
GLclampf tmp;
|
||||||
tmp = 0.9f;
|
tmp = 0.9f;
|
||||||
|
@ -288,10 +289,11 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
|
||||||
gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1;
|
gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1;
|
||||||
gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0;
|
gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0;
|
||||||
gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE;
|
gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE;
|
||||||
basetexture_set_dirty(This, TRUE);
|
basetexture_set_dirty(texture, TRUE);
|
||||||
isNewTexture = TRUE;
|
isNewTexture = TRUE;
|
||||||
|
|
||||||
if(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP) {
|
if (texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)
|
||||||
|
{
|
||||||
/* This means double binding the texture at creation, but keeps the code simpler all
|
/* This means double binding the texture at creation, but keeps the code simpler all
|
||||||
* in all, and the run-time path free from additional checks
|
* in all, and the run-time path free from additional checks
|
||||||
*/
|
*/
|
||||||
|
@ -319,9 +321,9 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
|
||||||
*/
|
*/
|
||||||
if (textureDimensions != GL_TEXTURE_RECTANGLE_ARB)
|
if (textureDimensions != GL_TEXTURE_RECTANGLE_ARB)
|
||||||
{
|
{
|
||||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", This->baseTexture.level_count - 1);
|
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture->baseTexture.level_count - 1);
|
||||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count - 1);
|
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, texture->baseTexture.level_count - 1);
|
||||||
checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count)");
|
checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, texture->baseTexture.level_count)");
|
||||||
}
|
}
|
||||||
if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
|
if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
|
||||||
/* Cubemaps are always set to clamp, regardless of the sampler state. */
|
/* Cubemaps are always set to clamp, regardless of the sampler state. */
|
||||||
|
|
|
@ -283,7 +283,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *i
|
||||||
|
|
||||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||||
|
|
||||||
hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc);
|
hr = basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &set_gl_texture_desc);
|
||||||
if (set_gl_texture_desc && SUCCEEDED(hr))
|
if (set_gl_texture_desc && SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count;
|
UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count;
|
||||||
|
|
|
@ -274,7 +274,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
|
||||||
|
|
||||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||||
|
|
||||||
hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc);
|
hr = basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &set_gl_texture_desc);
|
||||||
if (set_gl_texture_desc && SUCCEEDED(hr)) {
|
if (set_gl_texture_desc && SUCCEEDED(hr)) {
|
||||||
UINT i;
|
UINT i;
|
||||||
struct gl_texture *gl_tex;
|
struct gl_texture *gl_tex;
|
||||||
|
|
|
@ -237,7 +237,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTextur
|
||||||
|
|
||||||
TRACE("iface %p, srgb %#x.\n", iface, srgb);
|
TRACE("iface %p, srgb %#x.\n", iface, srgb);
|
||||||
|
|
||||||
return basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &dummy);
|
return basetexture_bind((IWineD3DBaseTextureImpl *)iface, srgb, &dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
|
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
|
||||||
|
|
|
@ -1912,7 +1912,7 @@ typedef struct IWineD3DBaseTextureImpl
|
||||||
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
|
void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
|
||||||
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
|
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1],
|
||||||
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
|
||||||
HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
|
HRESULT basetexture_bind(IWineD3DBaseTextureImpl *texture, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN;
|
||||||
void basetexture_cleanup(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
void basetexture_cleanup(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
||||||
void basetexture_generate_mipmaps(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
void basetexture_generate_mipmaps(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
||||||
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTextureImpl *texture) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue