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
f4d24492
Commit
f4d24492
authored
Dec 05, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 06, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Test clearing regarding the scissor test and colorwrite.
parent
429d0d3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
18 deletions
+107
-18
visual.c
dlls/d3d9/tests/visual.c
+85
-0
device.c
dlls/wined3d/device.c
+22
-18
No files found.
dlls/d3d9/tests/visual.c
View file @
f4d24492
...
...
@@ -277,6 +277,8 @@ static void clear_test(IDirect3DDevice9 *device)
D3DRECT
rect_negneg
;
DWORD
color
;
D3DVIEWPORT9
old_vp
,
vp
;
RECT
scissor
;
DWORD
oldColorWrite
;
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
...
...
@@ -379,6 +381,89 @@ static void clear_test(IDirect3DDevice9 *device)
ok
(
color
==
0x00ffffff
,
"(478,362) has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
482
,
362
);
ok
(
color
==
0x00ffffff
,
"(482,362) has color %08x
\n
"
,
color
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
scissor
.
left
=
160
;
scissor
.
right
=
480
;
scissor
.
top
=
120
;
scissor
.
bottom
=
360
;
hr
=
IDirect3DDevice9_SetScissorRect
(
device
,
&
scissor
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice_SetScissorRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_SCISSORTESTENABLE
,
TRUE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice_SetScissorRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xff00ff00
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
&
rect
[
1
],
D3DCLEAR_TARGET
,
0xffff0000
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_SCISSORTESTENABLE
,
FALSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice_SetScissorRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
color
=
getPixelColor
(
device
,
158
,
118
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/118 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
162
,
118
);
ok
(
color
==
0x00ffffff
,
"Pixel 162/118 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
158
,
122
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
162
,
122
);
ok
(
color
==
0x00ff0000
,
"Pixel 162/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
158
,
358
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/358 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
162
,
358
);
ok
(
color
==
0x0000ff00
,
"Pixel 162/358 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
158
,
358
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/358 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
162
,
362
);
ok
(
color
==
0x00ffffff
,
"Pixel 162/362 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
478
,
118
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/118 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
478
,
122
);
ok
(
color
==
0x0000ff00
,
"Pixel 162/118 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
482
,
122
);
ok
(
color
==
0x00ffffff
,
"Pixel 158/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
482
,
358
);
ok
(
color
==
0x00ffffff
,
"Pixel 162/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
478
,
358
);
ok
(
color
==
0x0000ff00
,
"Pixel 478/358 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
478
,
362
);
ok
(
color
==
0x00ffffff
,
"Pixel 478/118 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
482
,
358
);
ok
(
color
==
0x00ffffff
,
"Pixel 482/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
482
,
362
);
ok
(
color
==
0x00ffffff
,
"Pixel 482/122 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
318
,
238
);
ok
(
color
==
0x00ff0000
,
"Pixel 318/238 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
318
,
242
);
ok
(
color
==
0x0000ff00
,
"Pixel 318/242 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
322
,
238
);
ok
(
color
==
0x0000ff00
,
"Pixel 322/238 has color %08x
\n
"
,
color
);
color
=
getPixelColor
(
device
,
322
,
242
);
ok
(
color
==
0x0000ff00
,
"Pixel 322/242 has color %08x
\n
"
,
color
);
hr
=
IDirect3DDevice9_GetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
&
oldColorWrite
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
D3DCOLORWRITEENABLE_RED
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_COLORWRITEENABLE
,
oldColorWrite
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
/* Colorwriteenable does not affect the clear */
color
=
getPixelColor
(
device
,
320
,
240
);
ok
(
color
==
0x00ffffff
,
"Color write protected clear returned color %08x
\n
"
,
color
);
}
typedef
struct
{
...
...
dlls/wined3d/device.c
View file @
f4d24492
...
...
@@ -4816,6 +4816,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
IWineD3DSurface_LoadLocation
((
IWineD3DSurface
*
)
target
,
SFLAG_INDRAWABLE
,
NULL
);
break
;
}
if
(
This
->
stateBlock
->
renderState
[
WINED3DRS_SCISSORTESTENABLE
]
&&
(
This
->
stateBlock
->
scissorRect
.
left
>
0
||
This
->
stateBlock
->
scissorRect
.
top
>
0
||
This
->
stateBlock
->
scissorRect
.
right
<
target
->
currentDesc
.
Width
||
This
->
stateBlock
->
scissorRect
.
bottom
<
target
->
currentDesc
.
Height
))
{
IWineD3DSurface_LoadLocation
((
IWineD3DSurface
*
)
target
,
SFLAG_INDRAWABLE
,
NULL
);
break
;
}
if
(
Count
>
0
&&
pRects
&&
(
pRects
[
0
].
x1
>
0
||
pRects
[
0
].
y1
>
0
||
pRects
[
0
].
x2
<
target
->
currentDesc
.
Width
||
...
...
@@ -4868,35 +4875,32 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
glMask
=
glMask
|
GL_COLOR_BUFFER_BIT
;
}
vp_rect
.
left
=
vp
->
X
;
vp_rect
.
top
=
vp
->
Y
;
vp_rect
.
right
=
vp
->
X
+
vp
->
Width
;
vp_rect
.
bottom
=
vp
->
Y
+
vp
->
Height
;
if
(
!
(
Count
>
0
&&
pRects
))
{
if
(
This
->
render_offscreen
)
{
glScissor
(
This
->
stateBlock
->
viewport
.
X
,
This
->
stateBlock
->
viewport
.
Y
,
This
->
stateBlock
->
viewport
.
Width
,
This
->
stateBlock
->
viewport
.
Height
);
if
(
This
->
stateBlock
->
renderState
[
WINED3DRS_SCISSORTESTENABLE
])
{
IntersectRect
(
&
vp_rect
,
&
vp_rect
,
&
This
->
stateBlock
->
scissorRect
);
}
if
(
This
->
render_offscreen
)
{
glScissor
(
vp_rect
.
left
,
vp_rect
.
top
,
vp_rect
.
right
-
vp_rect
.
left
,
vp_rect
.
bottom
-
vp_rect
.
top
);
}
else
{
glScissor
(
This
->
stateBlock
->
viewport
.
X
,
(
drawable_height
-
(
This
->
stateBlock
->
viewport
.
Y
+
This
->
stateBlock
->
viewport
.
Height
)),
This
->
stateBlock
->
viewport
.
Width
,
This
->
stateBlock
->
viewport
.
Height
);
glScissor
(
vp_rect
.
left
,
drawable_height
-
vp_rect
.
bottom
,
vp_rect
.
right
-
vp_rect
.
left
,
vp_rect
.
bottom
-
vp_rect
.
top
);
}
checkGLcall
(
"glScissor"
);
glClear
(
glMask
);
checkGLcall
(
"glClear"
);
}
else
{
/* The viewport cap still applies, we have to intersect each clear rect with the viewport
* range because glClear ignores the viewport(and the viewport isn't even applied in this state)
*/
vp_rect
.
left
=
vp
->
X
;
vp_rect
.
top
=
vp
->
Y
;
vp_rect
.
right
=
vp
->
X
+
vp
->
Width
;
vp_rect
.
bottom
=
vp
->
Y
+
vp
->
Height
;
/* Now process each rect in turn */
for
(
i
=
0
;
i
<
Count
;
i
++
)
{
/* Note gl uses lower left, width/height */
IntersectRect
((
RECT
*
)
&
curRect
,
&
vp_rect
,
(
RECT
*
)
&
pRects
[
i
]);
if
(
This
->
stateBlock
->
renderState
[
WINED3DRS_SCISSORTESTENABLE
])
{
IntersectRect
((
RECT
*
)
&
curRect
,
(
RECT
*
)
&
curRect
,
&
This
->
stateBlock
->
scissorRect
);
}
TRACE
(
"(%p) Rect=(%d,%d)->(%d,%d) glRect=(%d,%d), len=%d, hei=%d
\n
"
,
This
,
pRects
[
i
].
x1
,
pRects
[
i
].
y1
,
pRects
[
i
].
x2
,
pRects
[
i
].
y2
,
curRect
.
x1
,
(
target
->
currentDesc
.
Height
-
curRect
.
y2
),
...
...
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