Commit 5a3a4ac7 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Remove IWineD3DBaseTexture::GetTextureDimensions() from the public wined3d interface.

parent 2e119ecd
......@@ -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";
......
......@@ -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;
......
......@@ -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,
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -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, ...)");
......
......@@ -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;
}
}
......
......@@ -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)
......
......@@ -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,
......
......@@ -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)");
......
......@@ -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,
......
......@@ -2532,8 +2532,6 @@ interface IWineD3DBaseTexture : IWineD3DResource
HRESULT BindTexture(
[in] BOOL srgb
);
UINT GetTextureDimensions(
);
BOOL IsCondNP2(
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment