Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
dbd338c0
Commit
dbd338c0
authored
Jul 25, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: WINED3DSAMP_MAXMIPLEVEL fixes.
parent
9ae22f1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
203 additions
and
7 deletions
+203
-7
visual.c
dlls/d3d9/tests/visual.c
+188
-0
basetexture.c
dlls/wined3d/basetexture.c
+15
-7
No files found.
dlls/d3d9/tests/visual.c
View file @
dbd338c0
...
...
@@ -1184,6 +1184,186 @@ static void present_test(IDirect3DDevice9 *device)
ok
(
color
==
0x00ff0000
,
"Present failed: Got color 0x%08x, expected 0x00ff0000.
\n
"
,
color
);
}
static
void
fill_surface
(
IDirect3DSurface9
*
surface
,
DWORD
color
)
{
D3DSURFACE_DESC
desc
;
D3DLOCKED_RECT
l
;
HRESULT
hr
;
unsigned
int
x
,
y
;
DWORD
*
mem
;
memset
(
&
desc
,
0
,
sizeof
(
desc
));
memset
(
&
l
,
0
,
sizeof
(
l
));
hr
=
IDirect3DSurface9_GetDesc
(
surface
,
&
desc
);
ok
(
hr
==
D3D_OK
,
"IDirect3DSurface9_GetDesc failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DSurface9_LockRect
(
surface
,
&
l
,
NULL
,
D3DLOCK_DISCARD
);
ok
(
hr
==
D3D_OK
,
"IDirect3DSurface9_LockRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
FAILED
(
hr
))
return
;
for
(
y
=
0
;
y
<
desc
.
Height
;
y
++
)
{
mem
=
(
DWORD
*
)
((
BYTE
*
)
l
.
pBits
+
y
*
l
.
Pitch
);
for
(
x
=
0
;
x
<
l
.
Pitch
/
sizeof
(
DWORD
);
x
++
)
{
mem
[
x
]
=
color
;
}
}
hr
=
IDirect3DSurface9_UnlockRect
(
surface
);
ok
(
hr
==
D3D_OK
,
"IDirect3DSurface9_UnlockRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
}
static
void
maxmip_test
(
IDirect3DDevice9
*
device
)
{
IDirect3DTexture9
*
texture
=
NULL
;
IDirect3DSurface9
*
surface
=
NULL
;
HRESULT
hr
;
DWORD
color
;
const
float
quads
[]
=
{
-
1
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
-
1
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
0
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
-
1
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
-
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
-
1
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
0
.
0
,
1
.
0
,
0
.
0
,
1
.
0
,
1
.
0
,
};
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
128
,
128
,
3
,
0
,
D3DFMT_A8R8G8B8
,
D3DPOOL_MANAGED
,
&
texture
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
texture
)
{
skip
(
"Failed to create test texture
\n
"
);
return
;
}
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
texture
,
0
,
&
surface
);
fill_surface
(
surface
,
0xffff0000
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
texture
,
1
,
&
surface
);
fill_surface
(
surface
,
0xff00ff00
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
texture
,
2
,
&
surface
);
fill_surface
(
surface
,
0xff0000ff
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
texture
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_TEX1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetFVF failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MIPFILTER
,
D3DTEXF_NONE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_BeginScene
(
device
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
0
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
20
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
2
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
40
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
3
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
60
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
}
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
/* With mipmapping disabled, the max mip level is ignored, only level 0 is used */
color
=
getPixelColor
(
device
,
160
,
360
);
ok
(
color
==
0x00FF0000
,
"MapMip 0, no mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
160
,
120
);
ok
(
color
==
0x00FF0000
,
"MapMip 3, no mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
120
);
ok
(
color
==
0x00FF0000
,
"MapMip 2, no mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
360
);
ok
(
color
==
0x00FF0000
,
"MapMip 1, no mipfilter has color %08x
\n
"
,
color
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MIPFILTER
,
D3DTEXF_POINT
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_BeginScene
(
device
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
0
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
20
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
2
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
40
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
3
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
&
quads
[
60
],
5
*
sizeof
(
float
));
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
}
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MIPFILTER
,
D3DTEXF_NONE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
/* Max Mip level 0-2 sample from the specified texture level, Max Mip level 3(> levels in texture)
* samples from the highest level in the texture(level 2)
*/
color
=
getPixelColor
(
device
,
160
,
360
);
ok
(
color
==
0x00FF0000
,
"MapMip 0, point mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
160
,
120
);
ok
(
color
==
0x000000FF
,
"MapMip 3, point mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
120
);
ok
(
color
==
0x000000FF
,
"MapMip 2, point mipfilter has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
360
);
ok
(
color
==
0x0000FF00
,
"MapMip 1, point mipfilter has color %08x
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetSamplerState
(
device
,
0
,
D3DSAMP_MAXMIPLEVEL
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetSamplerState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
IDirect3DTexture9_Release
(
texture
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
...
...
@@ -1249,6 +1429,14 @@ START_TEST(visual)
skip
(
"No cube texture support
\n
"
);
}
present_test
(
device_ptr
);
if
(
caps
.
TextureCaps
&
D3DPTEXTURECAPS_MIPMAP
)
{
maxmip_test
(
device_ptr
);
}
else
{
skip
(
"No mipmap support
\n
"
);
}
if
(
caps
.
VertexShaderVersion
>=
D3DVS_VERSION
(
2
,
0
))
{
...
...
dlls/wined3d/basetexture.c
View file @
dbd338c0
...
...
@@ -403,10 +403,15 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
break
;
case
WINED3DSAMP_MINFILTER
:
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
samplerStates
[
WINED3DSAMP_MIPFILTER
];
case
WINED3DSAMP_MAXMIPLEVEL
:
case
WINED3DSAMP_MIPFILTER
:
/* fall through */
{
GLint
glValue
;
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
=
samplerStates
[
WINED3DSAMP_MIPFILTER
];
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
=
samplerStates
[
WINED3DSAMP_MINFILTER
];
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
=
samplerStates
[
WINED3DSAMP_MAXMIPLEVEL
];
*
state
=
samplerStates
[
textureObjectSamplerStates
[
i
].
state
];
if
(
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MINFILTER
]
<
WINED3DTEXF_NONE
||
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
<
WINED3DTEXF_NONE
||
...
...
@@ -428,14 +433,17 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
],
glValue
);
glTexParameteri
(
textureDimensions
,
GL_TEXTURE_MIN_FILTER
,
glValue
);
checkGLcall
(
"glTexParameter GL_TEXTURE_MIN_FILTER, ..."
);
if
(
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MIPFILTER
]
==
WINED3DTEXF_NONE
)
{
glValue
=
0
;
}
else
if
(
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
]
>=
This
->
baseTexture
.
levels
)
{
glValue
=
This
->
baseTexture
.
levels
-
1
;
}
else
{
glValue
=
This
->
baseTexture
.
states
[
WINED3DTEXSTA_MAXMIPLEVEL
];
}
glTexParameteri
(
textureDimensions
,
GL_TEXTURE_BASE_LEVEL
,
glValue
);
}
break
;
case
WINED3DSAMP_MAXMIPLEVEL
:
*
state
=
samplerStates
[
textureObjectSamplerStates
[
i
].
state
];
/**
* Not really the same, but the more apprioprate than nothing
*/
glTexParameteri
(
textureDimensions
,
GL_TEXTURE_BASE_LEVEL
,
*
state
);
break
;
case
WINED3DSAMP_MAXANISOTROPY
:
*
state
=
samplerStates
[
textureObjectSamplerStates
[
i
].
state
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment