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
5d49dea3
Commit
5d49dea3
authored
Apr 23, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Apr 24, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Add a test for NP2 stretchrect.
parent
1c9f1f8d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
2 deletions
+109
-2
visual.c
dlls/d3d9/tests/visual.c
+104
-0
surface.c
dlls/wined3d/surface.c
+5
-2
No files found.
dlls/d3d9/tests/visual.c
View file @
5d49dea3
...
...
@@ -8951,6 +8951,109 @@ out:
if
(
shader
)
IDirect3DVertexShader9_Release
(
shader
);
}
static
void
np2_stretch_rect_test
(
IDirect3DDevice9
*
device
)
{
IDirect3DSurface9
*
src
=
NULL
,
*
dst
=
NULL
,
*
backbuffer
=
NULL
;
IDirect3DTexture9
*
dsttex
=
NULL
;
HRESULT
hr
;
DWORD
color
;
D3DRECT
r1
=
{
0
,
0
,
50
,
50
};
D3DRECT
r2
=
{
50
,
0
,
100
,
50
};
D3DRECT
r3
=
{
50
,
50
,
100
,
100
};
D3DRECT
r4
=
{
0
,
50
,
50
,
100
};
const
float
quad
[]
=
{
-
1
.
0
,
-
1
.
0
,
0
.
1
,
0
.
0
,
0
.
0
,
1
.
0
,
-
1
.
0
,
0
.
1
,
1
.
0
,
0
.
0
,
-
1
.
0
,
1
.
0
,
0
.
1
,
0
.
0
,
1
.
0
,
1
.
0
,
1
.
0
,
0
.
1
,
1
.
0
,
1
.
0
,
};
hr
=
IDirect3DDevice9_GetBackBuffer
(
device
,
0
,
0
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetBackBuffer failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_CreateRenderTarget
(
device
,
100
,
100
,
D3DFMT_A8R8G8B8
,
D3DMULTISAMPLE_NONE
,
0
,
TRUE
,
&
src
,
NULL
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_CreateRenderTarget failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_CreateTexture
(
device
,
25
,
25
,
1
,
D3DUSAGE_RENDERTARGET
,
D3DFMT_A8R8G8B8
,
D3DPOOL_DEFAULT
,
&
dsttex
,
NULL
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_CreateTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
src
||
!
dsttex
)
{
skip
(
"One or more test resources could not be created
\n
"
);
goto
cleanup
;
}
hr
=
IDirect3DTexture9_GetSurfaceLevel
(
dsttex
,
0
,
&
dst
);
ok
(
hr
==
D3D_OK
,
"IDirect3DTexture9_GetSurfaceLevel failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
NULL
,
D3DCLEAR_TARGET
,
0xff00ffff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
/* Clear the StretchRect destination for debugging */
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
dst
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
NULL
,
D3DCLEAR_TARGET
,
0xffff00ff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
src
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
&
r1
,
D3DCLEAR_TARGET
,
0xffff0000
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
&
r2
,
D3DCLEAR_TARGET
,
0xff00ff00
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
&
r3
,
D3DCLEAR_TARGET
,
0xff0000ff
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Clear
(
device
,
1
,
&
r4
,
D3DCLEAR_TARGET
,
0xff000000
,
0
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
/* Stretchrect before setting the render target back to the backbuffer. This will make Wine use
* the target -> texture GL blit path
*/
hr
=
IDirect3DDevice9_StretchRect
(
device
,
src
,
NULL
,
dst
,
NULL
,
D3DTEXF_POINT
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_StretchRect failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
IDirect3DSurface9_Release
(
dst
);
hr
=
IDirect3DDevice9_SetRenderTarget
(
device
,
0
,
backbuffer
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderTarget failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
(
IDirect3DBaseTexture9
*
)
dsttex
);
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_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_SELECTARG1
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLORARG1
,
D3DTA_TEXTURE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_BeginScene failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
SUCCEEDED
(
hr
))
{
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
float
)
*
5
);
ok
(
SUCCEEDED
(
hr
),
"DrawPrimitiveUP failed (%08x)
\n
"
,
hr
);
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_EndScene failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
}
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Present failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
color
=
getPixelColor
(
device
,
160
,
360
);
ok
(
color
==
0x00ff0000
,
"stretchrect: Pixel 160,360 has color 0x%08x, expected 0x00ff0000
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
360
);
ok
(
color
==
0x0000ff00
,
"stretchrect: Pixel 480,360 has color 0x%08x, expected 0x0000ff00
\n
"
,
color
);
color
=
getPixelColor
(
device
,
480
,
120
);
ok
(
color
==
0x000000ff
,
"stretchrect: Pixel 480,120 has color 0x%08x, expected 0x000000ff
\n
"
,
color
);
color
=
getPixelColor
(
device
,
160
,
120
);
ok
(
color
==
0x00000000
,
"stretchrect: Pixel 160,120 has color 0x%08x, expected 0x00000000
\n
"
,
color
);
hr
=
IDirect3DDevice9_SetTexture
(
device
,
0
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetTextureStageState
(
device
,
0
,
D3DTSS_COLOROP
,
D3DTOP_DISABLE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetTexture failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
cleanup:
if
(
src
)
IDirect3DSurface9_Release
(
src
);
if
(
backbuffer
)
IDirect3DSurface9_Release
(
backbuffer
);
if
(
dsttex
)
IDirect3DTexture9_Release
(
dsttex
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
...
...
@@ -9045,6 +9148,7 @@ START_TEST(visual)
}
pointsize_test
(
device_ptr
);
tssargtemp_test
(
device_ptr
);
np2_stretch_rect_test
(
device_ptr
);
if
(
caps
.
VertexShaderVersion
>=
D3DVS_VERSION
(
1
,
1
))
{
...
...
dlls/wined3d/surface.c
View file @
5d49dea3
...
...
@@ -2791,8 +2791,11 @@ static inline void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *This, IWine
Src
->
Flags
&=
~
SFLAG_INTEXTURE
;
}
glReadBuffer
(
GL_BACK
);
checkGLcall
(
"glReadBuffer(GL_BACK)"
);
if
(
swapchain
)
{
glReadBuffer
(
surface_get_gl_buffer
(
SrcSurface
,
(
IWineD3DSwapChain
*
)
swapchain
));
}
else
{
glReadBuffer
(
myDevice
->
offscreenBuffer
);
}
/* TODO: Only back up the part that will be overwritten */
glCopyTexSubImage2D
(
texture_target
,
0
,
...
...
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