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
4171fdf4
Commit
4171fdf4
authored
Oct 28, 2023
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 06, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Add more tests for SPECULARENABLE.
Show that it affects both the vertex and fragment FFP pipelines.
parent
604bc7cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
195 additions
and
0 deletions
+195
-0
visual.c
dlls/d3d8/tests/visual.c
+195
-0
No files found.
dlls/d3d8/tests/visual.c
View file @
4171fdf4
...
...
@@ -12188,6 +12188,200 @@ static void test_mipmap_upload(void)
release_test_context
(
&
context
);
}
static
void
test_specular_shaders
(
void
)
{
struct
d3d8_test_context
context
;
struct
surface_readback
rb
;
IDirect3DDevice8
*
device
;
unsigned
int
color
;
DWORD
vs
,
ps
;
HRESULT
hr
;
static
const
DWORD
vs_code
[]
=
{
#if 0
vs_1_1
mov oPos, v0
mov oD0, v5
mov oD1, v6
#endif
0xfffe0101
,
0x00000001
,
0xc00f0000
,
0x90e40000
,
0x00000001
,
0xd00f0000
,
0x90e40005
,
0x00000001
,
0xd00f0001
,
0x90e40006
,
0x0000ffff
};
static
const
DWORD
ps_code
[]
=
{
#if 0
ps_1_1
mov r0, v1
#endif
0xffff0101
,
0x00000001
,
0x800f0000
,
0x90e40001
,
0x0000ffff
};
static
const
DWORD
decl
[]
=
{
D3DVSD_STREAM
(
0
),
D3DVSD_REG
(
D3DVSDE_POSITION
,
D3DVSDT_FLOAT3
),
D3DVSD_REG
(
D3DVSDE_NORMAL
,
D3DVSDT_FLOAT3
),
D3DVSD_REG
(
D3DVSDE_DIFFUSE
,
D3DVSDT_D3DCOLOR
),
D3DVSD_REG
(
D3DVSDE_SPECULAR
,
D3DVSDT_D3DCOLOR
),
D3DVSD_END
()
};
static
const
struct
{
struct
vec3
position
;
struct
vec3
normal
;
unsigned
int
diffuse
;
unsigned
int
specular
;
}
quad
[]
=
{
{{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
0x0000003f
,
0x00007f00
},
{{
-
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
0x0000003f
,
0x00007f00
},
{{
1
.
0
f
,
-
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
0x0000003f
,
0x00007f00
},
{{
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
},
0x0000003f
,
0x00007f00
},
};
static
const
D3DMATERIAL8
material
=
{
.
Specular
=
{
0
.
7
f
,
0
.
0
f
,
0
.
7
f
,
1
.
0
f
},
.
Power
=
2
.
0
f
,
};
static
const
D3DLIGHT8
light
=
{
.
Type
=
D3DLIGHT_DIRECTIONAL
,
.
Diffuse
=
{
0
.
0
f
,
0
.
1
f
,
0
.
1
f
,
0
.
0
f
},
.
Specular
=
{
0
.
8
f
,
0
.
8
f
,
0
.
8
f
,
0
.
0
f
},
.
Direction
=
{
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
},
};
if
(
!
init_test_context
(
&
context
))
return
;
device
=
context
.
device
;
/* Vertex shader only. */
hr
=
IDirect3DDevice8_CreateVertexShader
(
device
,
decl
,
vs_code
,
&
vs
,
0
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffff0000
,
0
.
0
,
0
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
vs
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_ZENABLE
,
FALSE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
TRUE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color
(
context
.
backbuffer
,
0x00007f3f
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
FALSE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color
(
context
.
backbuffer
,
0x0000003f
);
hr
=
IDirect3DDevice8_CreatePixelShader
(
device
,
ps_code
,
&
ps
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
/* Pixel shader only. */
hr
=
IDirect3DDevice8_SetPixelShader
(
device
,
ps
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_NORMAL
|
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetMaterial
(
device
,
&
material
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetLight
(
device
,
0
,
&
light
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_LightEnable
(
device
,
0
,
TRUE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
TRUE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
get_surface_readback
(
context
.
backbuffer
,
&
rb
);
color
=
get_readback_color
(
&
rb
,
160
,
120
);
todo_wine
ok
(
color_match
(
color
,
0x003300
,
1
),
"Got color %08x.
\n
"
,
color
);
color
=
get_readback_color
(
&
rb
,
480
,
120
);
todo_wine
ok
(
color_match
(
color
,
0x001900
,
1
),
"Got color %08x.
\n
"
,
color
);
color
=
get_readback_color
(
&
rb
,
160
,
360
);
todo_wine
ok
(
color_match
(
color
,
0x009900
,
1
),
"Got color %08x.
\n
"
,
color
);
color
=
get_readback_color
(
&
rb
,
480
,
360
);
todo_wine
ok
(
color_match
(
color
,
0x003300
,
1
),
"Got color %08x.
\n
"
,
color
);
release_surface_readback
(
&
rb
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
FALSE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color_todo
(
context
.
backbuffer
,
0x00007f00
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARMATERIALSOURCE
,
D3DMCS_MATERIAL
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color_todo
(
context
.
backbuffer
,
0x00007f00
);
/* Vertex shader and pixel shader. */
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
vs
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
TRUE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color
(
context
.
backbuffer
,
0x00007f00
);
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_SPECULARENABLE
,
FALSE
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
,
quad
,
sizeof
(
*
quad
));
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
check_rt_color
(
context
.
backbuffer
,
0x00007f00
);
release_test_context
(
&
context
);
}
START_TEST
(
visual
)
{
D3DADAPTER_IDENTIFIER8
identifier
;
...
...
@@ -12271,4 +12465,5 @@ START_TEST(visual)
test_filling_convention
();
test_managed_reset
();
test_mipmap_upload
();
test_specular_shaders
();
}
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