[PATCH 2/4] wined3d: Remove IWineD3DBaseTexture::GetTextureDimensions() from the public wined3d interface.
Henri Verbeet
hverbeet at codeweavers.com
Fri Sep 17 04:59:39 CDT 2010
---
dlls/wined3d/arb_program_shader.c | 6 ++++--
dlls/wined3d/basetexture.c | 8 ++++----
dlls/wined3d/cubetexture.c | 10 ----------
dlls/wined3d/device.c | 6 ++----
dlls/wined3d/glsl_shader.c | 23 +++++++++++++----------
dlls/wined3d/nvidia_texture_shader.c | 6 ++++--
dlls/wined3d/shader.c | 4 ++--
dlls/wined3d/state.c | 6 +++---
dlls/wined3d/texture.c | 29 ++++++++++++-----------------
dlls/wined3d/utils.c | 14 +++++++++-----
dlls/wined3d/volumetexture.c | 10 ----------
include/wine/wined3d.idl | 2 --
12 files changed, 53 insertions(+), 71 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 2b396b9..21d19a6 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -1343,8 +1343,10 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD
break;
case WINED3DSTT_2D:
- if(device->stateBlock->textures[sampler_idx] &&
- IWineD3DBaseTexture_GetTextureDimensions(device->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
+ if (device->stateBlock->textures[sampler_idx]
+ && ((IWineD3DBaseTextureImpl *)device->stateBlock->textures[sampler_idx])->baseTexture.target
+ == GL_TEXTURE_RECTANGLE_ARB)
+ {
tex_type = "RECT";
} else {
tex_type = "2D";
diff --git a/dlls/wined3d/basetexture.c b/dlls/wined3d/basetexture.c
index 8fc28b5..bf3b4d4 100644
--- a/dlls/wined3d/basetexture.c
+++ b/dlls/wined3d/basetexture.c
@@ -184,7 +184,7 @@ HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DT
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
IWineD3DDeviceImpl *device = This->resource.device;
- UINT textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
+ GLenum textureDimensions = This->baseTexture.target;
if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) {
TRACE("(%p) : returning invalid call\n", This);
@@ -262,7 +262,7 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
HRESULT hr = WINED3D_OK;
- UINT textureDimensions;
+ GLenum textureDimensions;
BOOL isNewTexture = FALSE;
struct gl_texture *gl_tex;
TRACE("(%p) : About to bind texture\n", This);
@@ -274,7 +274,7 @@ HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surfac
gl_tex = &This->baseTexture.texture_rgb;
}
- textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
+ textureDimensions = This->baseTexture.target;
ENTER_GL();
/* Generate a texture name if we don't already have one */
if (!gl_tex->name)
@@ -389,8 +389,8 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
const struct wined3d_gl_info *gl_info)
{
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
+ GLenum textureDimensions = This->baseTexture.target;
DWORD state;
- GLint textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
BOOL cond_np2 = IWineD3DBaseTexture_IsCondNP2(iface);
DWORD aniso;
struct gl_texture *gl_tex;
diff --git a/dlls/wined3d/cubetexture.c b/dlls/wined3d/cubetexture.c
index b64eab7..2d2c04c 100644
--- a/dlls/wined3d/cubetexture.c
+++ b/dlls/wined3d/cubetexture.c
@@ -306,15 +306,6 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *i
return hr;
}
-static UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *iface)
-{
- IWineD3DCubeTextureImpl *texture = (IWineD3DCubeTextureImpl *)iface;
-
- TRACE("iface %p.\n", iface);
-
- return texture->baseTexture.target;
-}
-
static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface)
{
TRACE("iface %p.\n", iface);
@@ -451,7 +442,6 @@ static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
IWineD3DCubeTextureImpl_SetDirty,
IWineD3DCubeTextureImpl_GetDirty,
IWineD3DCubeTextureImpl_BindTexture,
- IWineD3DCubeTextureImpl_GetTextureDimensions,
IWineD3DCubeTextureImpl_IsCondNP2,
/* IWineD3DCubeTexture */
IWineD3DCubeTextureImpl_GetLevelDesc,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 54f37af..7c96247 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4360,14 +4360,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
{
IWineD3DBaseTextureImpl *t = (IWineD3DBaseTextureImpl *)texture;
LONG bind_count = InterlockedIncrement(&t->baseTexture.bindCount);
- UINT dimensions = IWineD3DBaseTexture_GetTextureDimensions(texture);
+ GLenum dimensions = t->baseTexture.target;
IWineD3DBaseTexture_AddRef(texture);
- if (!prev || dimensions != IWineD3DBaseTexture_GetTextureDimensions(prev))
- {
+ if (!prev || dimensions != ((IWineD3DBaseTextureImpl *)prev)->baseTexture.target)
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER);
- }
if (!prev && stage < gl_info->limits.texture_stages)
{
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index e757f6d..f615233 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -1062,7 +1062,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
if (pshader && ps_args->shadow & (1 << i))
{
if (device->stateBlock->textures[i]
- && IWineD3DBaseTexture_GetTextureDimensions(device->stateBlock->textures[i])
+ && ((IWineD3DBaseTextureImpl *)device->stateBlock->textures[i])->baseTexture.target
== GL_TEXTURE_RECTANGLE_ARB)
shader_addline(buffer, "uniform sampler2DRectShadow %csampler%u;\n", prefix, i);
else
@@ -1071,7 +1071,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
else
{
if (device->stateBlock->textures[i]
- && IWineD3DBaseTexture_GetTextureDimensions(device->stateBlock->textures[i])
+ && ((IWineD3DBaseTextureImpl *)device->stateBlock->textures[i])->baseTexture.target
== GL_TEXTURE_RECTANGLE_ARB)
shader_addline(buffer, "uniform sampler2DRect %csampler%u;\n", prefix, i);
else
@@ -3063,8 +3063,10 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins)
}
}
- if(deviceImpl->stateBlock->textures[sampler_idx] &&
- IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
+ if (deviceImpl->stateBlock->textures[sampler_idx]
+ && ((IWineD3DBaseTextureImpl *)deviceImpl->stateBlock->textures[sampler_idx])->baseTexture.target
+ == GL_TEXTURE_RECTANGLE_ARB)
+ {
sample_flags |= WINED3D_GLSL_SAMPLE_RECT;
}
@@ -3117,10 +3119,10 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
}
sampler_idx = ins->src[1].reg.idx;
- if(deviceImpl->stateBlock->textures[sampler_idx] &&
- IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
+ if (deviceImpl->stateBlock->textures[sampler_idx]
+ && ((IWineD3DBaseTextureImpl *)deviceImpl->stateBlock->textures[sampler_idx])->baseTexture.target
+ == GL_TEXTURE_RECTANGLE_ARB)
sample_flags |= WINED3D_GLSL_SAMPLE_RECT;
- }
shader_glsl_get_sample_function(ins->ctx, sampler_idx, sample_flags, &sample_function);
shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &coord_param);
@@ -3143,10 +3145,11 @@ static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins)
DWORD swizzle = ins->src[1].swizzle;
sampler_idx = ins->src[1].reg.idx;
- if(deviceImpl->stateBlock->textures[sampler_idx] &&
- IWineD3DBaseTexture_GetTextureDimensions(deviceImpl->stateBlock->textures[sampler_idx]) == GL_TEXTURE_RECTANGLE_ARB) {
+ if (deviceImpl->stateBlock->textures[sampler_idx]
+ && ((IWineD3DBaseTextureImpl *)deviceImpl->stateBlock->textures[sampler_idx])->baseTexture.target
+ == GL_TEXTURE_RECTANGLE_ARB)
sample_flags |= WINED3D_GLSL_SAMPLE_RECT;
- }
+
shader_glsl_get_sample_function(ins->ctx, sampler_idx, sample_flags, &sample_function);
shader_glsl_add_src_param(ins, &ins->src[0], sample_function.coord_mask, &coord_param);
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index dc873be..1cb8b84 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -43,8 +43,10 @@ static void nvts_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateb
context->texShaderBumpMap &= ~(1 << stage);
}
- if(stateblock->textures[stage]) {
- switch(IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[stage])) {
+ if (stateblock->textures[stage])
+ {
+ switch (((IWineD3DBaseTextureImpl *)stateblock->textures[stage])->baseTexture.target)
+ {
case GL_TEXTURE_2D:
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 3fe6233..ba728d4 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -2329,7 +2329,7 @@ void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseT
continue;
}
- switch (IWineD3DBaseTexture_GetTextureDimensions(textures[i]))
+ switch (((IWineD3DBaseTextureImpl *)textures[i])->baseTexture.target)
{
case GL_TEXTURE_RECTANGLE_ARB:
case GL_TEXTURE_2D:
@@ -2349,7 +2349,7 @@ void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseT
default:
FIXME("Unrecognized texture type %#x, using 2D.\n",
- IWineD3DBaseTexture_GetTextureDimensions(textures[i]));
+ ((IWineD3DBaseTextureImpl *)textures[i])->baseTexture.target);
sampler_type[i] = WINED3DSTT_2D;
}
}
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 34a417d..0b5bc3e 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -498,7 +498,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
*/
if (stateblock->textures[0])
{
- UINT texture_dimensions = IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[0]);
+ GLenum texture_dimensions = ((IWineD3DBaseTextureImpl *)stateblock->textures[0])->baseTexture.target;
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
@@ -3186,11 +3186,11 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d
if (stateblock->state.render_states[WINED3DRS_COLORKEYENABLE] && !stage && stateblock->textures[0])
{
- UINT texture_dimensions = IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[0]);
+ IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
+ GLenum texture_dimensions = texture->baseTexture.target;
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0];
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index ff57104..ce95567 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -301,16 +301,19 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
* state. The same applies to filtering. Even if the texture has only
* one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW
* fallback on macos. */
- if(IWineD3DBaseTexture_IsCondNP2(iface)) {
+ if (IWineD3DBaseTexture_IsCondNP2(iface))
+ {
+ GLenum target = This->baseTexture.target;
+
ENTER_GL();
- glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
- glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
- glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
- glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
+ glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
+ glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ checkGLcall("glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ checkGLcall("glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ checkGLcall("glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
LEAVE_GL();
gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_CLAMP;
gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_CLAMP;
@@ -323,13 +326,6 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO
return hr;
}
-static UINT WINAPI IWineD3DTextureImpl_GetTextureDimensions(IWineD3DTexture *iface) {
- IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
- TRACE("(%p)\n", This);
-
- return This->baseTexture.target;
-}
-
static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
TRACE("(%p)\n", This);
@@ -460,7 +456,6 @@ static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
IWineD3DTextureImpl_SetDirty,
IWineD3DTextureImpl_GetDirty,
IWineD3DTextureImpl_BindTexture,
- IWineD3DTextureImpl_GetTextureDimensions,
IWineD3DTextureImpl_IsCondNP2,
/* IWineD3DTexture */
IWineD3DTextureImpl_GetLevelDesc,
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 9000468..6f535a7 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -2752,8 +2752,11 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
if (ignore_textype)
{
settings->op[i].tex_type = tex_1d;
- } else {
- switch (IWineD3DBaseTexture_GetTextureDimensions((IWineD3DBaseTexture *)texture)) {
+ }
+ else
+ {
+ switch (texture->baseTexture.target)
+ {
case GL_TEXTURE_1D:
settings->op[i].tex_type = tex_1d;
break;
@@ -2808,11 +2811,11 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
if (!i && stateblock->textures[0] && stateblock->state.render_states[WINED3DRS_COLORKEYENABLE])
{
- UINT texture_dimensions = IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[0]);
+ IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
+ GLenum texture_dimensions = texture->baseTexture.target;
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
- IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)stateblock->textures[0];
IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0];
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask)
@@ -2979,7 +2982,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
if (stateblock->textures[stage])
{
- switch (IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[stage])) {
+ switch (((IWineD3DBaseTextureImpl *)stateblock->textures[stage])->baseTexture.target)
+ {
case GL_TEXTURE_2D:
glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)");
diff --git a/dlls/wined3d/volumetexture.c b/dlls/wined3d/volumetexture.c
index 742ac2f..a2c0c6d 100644
--- a/dlls/wined3d/volumetexture.c
+++ b/dlls/wined3d/volumetexture.c
@@ -242,15 +242,6 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTextur
return basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &dummy);
}
-static UINT WINAPI IWineD3DVolumeTextureImpl_GetTextureDimensions(IWineD3DVolumeTexture *iface)
-{
- IWineD3DVolumeTextureImpl *texture = (IWineD3DVolumeTextureImpl *)iface;
-
- TRACE("iface %p.\n", iface);
-
- return texture->baseTexture.target;
-}
-
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface)
{
TRACE("iface %p.\n", iface);
@@ -383,7 +374,6 @@ static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
IWineD3DVolumeTextureImpl_GetDirty,
/* not in d3d */
IWineD3DVolumeTextureImpl_BindTexture,
- IWineD3DVolumeTextureImpl_GetTextureDimensions,
IWineD3DVolumeTextureImpl_IsCondNP2,
/* volume texture */
IWineD3DVolumeTextureImpl_GetLevelDesc,
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index c0aac50..fcc6a89 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2532,8 +2532,6 @@ interface IWineD3DBaseTexture : IWineD3DResource
HRESULT BindTexture(
[in] BOOL srgb
);
- UINT GetTextureDimensions(
- );
BOOL IsCondNP2(
);
}
--
1.7.1
More information about the wine-patches
mailing list