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
7d0d8c02
Commit
7d0d8c02
authored
Oct 06, 2009
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Make the individual stateblock tests responsible for checking data.
parent
875d3b97
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
426 additions
and
307 deletions
+426
-307
stateblock.c
dlls/d3d9/tests/stateblock.c
+426
-307
No files found.
dlls/d3d9/tests/stateblock.c
View file @
7d0d8c02
...
...
@@ -123,23 +123,14 @@ struct state_test
const
void
*
test_data_in
;
const
void
*
test_data_out
;
/* The poison data is the data to preinitialize the return buffer to */
const
void
*
poison_data
;
/* Return buffer */
void
*
return_data
;
/* Size of the data samples above */
unsigned
int
data_size
;
/* Test resource management handlers */
HRESULT
(
*
setup_handler
)
(
struct
state_test
*
test
);
void
(
*
teardown_handler
)
(
struct
state_test
*
test
);
/* Test data handlers */
void
(
*
set_handler
)
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
const
void
*
data_in
);
void
(
*
get_handler
)
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
void
*
data_out
);
void
(
*
print_handler
)
(
const
struct
state_test
*
test
,
const
void
*
data
);
void
(
*
check_data
)(
IDirect3DDevice9
*
device
,
unsigned
int
chain_stage
,
const
struct
state_test
*
test
,
const
void
*
expected_
data
);
/* Test arguments */
const
void
*
test_arg
;
...
...
@@ -198,53 +189,22 @@ static void execute_test_chain(IDirect3DDevice9 *device, struct state_test *test
trace
(
"Test %s, Stage %u in error state, aborting
\n
"
,
test
[
i
].
test_name
,
j
);
break
;
}
else
if
(
outcome
&
EVENT_CHECK_TEST
||
outcome
&
EVENT_CHECK_DEFAULT
||
outcome
&
EVENT_CHECK_INITIAL
)
{
for
(
i
=
0
;
i
<
ntests
;
i
++
)
{
memcpy
(
test
[
i
].
return_data
,
test
[
i
].
poison_data
,
test
[
i
].
data_size
);
test
[
i
].
get_handler
(
device
,
&
test
[
i
],
test
[
i
].
return_data
);
if
(
outcome
&
EVENT_CHECK_TEST
)
{
BOOL
test_failed
=
memcmp
(
test
[
i
].
test_data_out
,
test
[
i
].
return_data
,
test
[
i
].
data_size
);
ok
(
!
test_failed
,
"Test %s, Stage %u: returned data does not match test data [csize=%u]
\n
"
,
test
[
i
].
test_name
,
j
,
test
[
i
].
data_size
);
if
(
test_failed
&&
test
[
i
].
print_handler
)
{
trace
(
"Returned data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
return_data
);
trace
(
"Test data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
test_data_out
);
}
}
else
if
(
outcome
&
(
EVENT_CHECK_TEST
|
EVENT_CHECK_DEFAULT
|
EVENT_CHECK_INITIAL
))
{
for
(
i
=
0
;
i
<
ntests
;
++
i
)
{
if
(
outcome
&
EVENT_CHECK_TEST
)
{
test
[
i
].
check_data
(
device
,
j
,
&
test
[
i
],
test
[
i
].
test_data_out
);
}
else
if
(
outcome
&
EVENT_CHECK_DEFAULT
)
{
BOOL
test_failed
=
memcmp
(
test
[
i
].
default_data
,
test
[
i
].
return_data
,
test
[
i
].
data_size
);
ok
(
!
test_failed
,
"Test %s, Stage %u: returned data does not match default data [csize=%u]
\n
"
,
test
[
i
].
test_name
,
j
,
test
[
i
].
data_size
);
if
(
test_failed
&&
test
[
i
].
print_handler
)
{
trace
(
"Returned data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
return_data
);
trace
(
"Default data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
default_data
);
}
test
[
i
].
check_data
(
device
,
j
,
&
test
[
i
],
test
[
i
].
default_data
);
}
else
if
(
outcome
&
EVENT_CHECK_INITIAL
)
{
BOOL
test_failed
=
memcmp
(
test
[
i
].
initial_data
,
test
[
i
].
return_data
,
test
[
i
].
data_size
);
ok
(
!
test_failed
,
"Test %s, Stage %u: returned data does not match initial data [csize=%u]
\n
"
,
test
[
i
].
test_name
,
j
,
test
[
i
].
data_size
);
if
(
test_failed
&&
test
[
i
].
print_handler
)
{
trace
(
"Returned data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
return_data
);
trace
(
"Initial data was:
\n
"
);
test
[
i
].
print_handler
(
&
test
[
i
],
test
[
i
].
initial_data
);
}
test
[
i
].
check_data
(
device
,
j
,
&
test
[
i
],
test
[
i
].
initial_data
);
}
}
}
...
...
@@ -482,22 +442,26 @@ struct shader_constant_context
struct
shader_constant_data
return_data_buffer
;
};
static
void
shader_constant_print_handler
(
const
struct
state_test
*
test
,
const
void
*
data
)
static
const
struct
shader_constant_data
shader_constant_poison_data
=
{
const
struct
shader_constant_data
*
scdata
=
data
;
trace
(
"Integer constant = { %#x, %#x, %#x, %#x }
\n
"
,
scdata
->
int_constant
[
0
],
scdata
->
int_constant
[
1
],
scdata
->
int_constant
[
2
],
scdata
->
int_constant
[
3
]);
{
0x1337c0de
,
0x1337c0de
,
0x1337c0de
,
0x1337c0de
},
{
1
.
0
f
,
2
.
0
f
,
3
.
0
f
,
4
.
0
f
},
{
FALSE
,
TRUE
,
FALSE
,
TRUE
},
};
trace
(
"Float constant = { %f, %f, %f, %f }
\n
"
,
scdata
->
float_constant
[
0
],
scdata
->
float_constant
[
1
],
scdata
->
float_constant
[
2
],
scdata
->
float_constant
[
3
]);
static
const
struct
shader_constant_data
shader_constant_default_data
=
{
{
0
,
0
,
0
,
0
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
,
0
,
0
,
0
},
};
trace
(
"Boolean constants = [ %#x, %#x, %#x, %#x ]
\n
"
,
scdata
->
bool_constant
[
0
],
scdata
->
bool_constant
[
1
],
scdata
->
bool_constant
[
2
],
scdata
->
bool_constant
[
3
]);
}
static
const
struct
shader_constant_data
shader_constant_test_data
=
{
{
0xdead0000
,
0xdead0001
,
0xdead0002
,
0xdead0003
},
{
5
.
0
f
,
6
.
0
f
,
7
.
0
f
,
8
.
0
f
},
{
TRUE
,
FALSE
,
FALSE
,
TRUE
},
};
static
void
shader_constant_set_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
const
void
*
data
)
{
...
...
@@ -524,49 +488,63 @@ static void shader_constant_set_handler(IDirect3DDevice9 *device, const struct s
}
}
static
void
shader_constant_get_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
void
*
data
)
static
void
shader_constant_check_data
(
IDirect3DDevice9
*
device
,
unsigned
int
chain_stage
,
const
struct
state_test
*
test
,
const
void
*
expected_data
)
{
struct
shader_constant_data
value
=
shader_constant_poison_data
;
const
struct
shader_constant_data
*
scdata
=
expected_data
;
const
struct
shader_constant_arg
*
scarg
=
test
->
test_arg
;
struct
shader_constant_data
*
scdata
=
data
;
HRESULT
hret
;
unsigned
int
index
=
scarg
->
idx
;
if
(
!
scarg
->
pshader
)
{
hret
=
IDirect3DDevice9_GetVertexShaderConstantI
(
device
,
index
,
scdata
->
int_constant
,
1
);
ok
(
hret
==
D3D_OK
,
"GetVertexShaderConstantI returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
index
,
scdata
->
float_constant
,
1
);
ok
(
hret
==
D3D_OK
,
"GetVertexShaderConstantF returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetVertexShaderConstantB
(
device
,
index
,
scdata
->
bool_constant
,
4
);
ok
(
hret
==
D3D_OK
,
"GetVertexShaderConstantB returned %#x.
\n
"
,
hret
);
HRESULT
hr
;
}
else
{
hret
=
IDirect3DDevice9_GetPixelShaderConstantI
(
device
,
index
,
scdata
->
int_constant
,
1
);
ok
(
hret
==
D3D_OK
,
"GetPixelShaderConstantI returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetPixelShaderConstantF
(
device
,
index
,
scdata
->
float_constant
,
1
);
ok
(
hret
==
D3D_OK
,
"GetPixelShaderConstantF returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetPixelShaderConstantB
(
device
,
index
,
scdata
->
bool_constant
,
4
);
ok
(
hret
==
D3D_OK
,
"GetPixelShaderConstantB returned %#x.
\n
"
,
hret
);
if
(
!
scarg
->
pshader
)
{
hr
=
IDirect3DDevice9_GetVertexShaderConstantI
(
device
,
scarg
->
idx
,
value
.
int_constant
,
1
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexShaderConstantI returned %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
scarg
->
idx
,
value
.
float_constant
,
1
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexShaderConstantF returned %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetVertexShaderConstantB
(
device
,
scarg
->
idx
,
value
.
bool_constant
,
4
);
ok
(
SUCCEEDED
(
hr
),
"GetVertexShaderConstantB returned %#x.
\n
"
,
hr
);
}
else
{
hr
=
IDirect3DDevice9_GetPixelShaderConstantI
(
device
,
scarg
->
idx
,
value
.
int_constant
,
1
);
ok
(
SUCCEEDED
(
hr
),
"GetPixelShaderConstantI returned %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetPixelShaderConstantF
(
device
,
scarg
->
idx
,
value
.
float_constant
,
1
);
ok
(
SUCCEEDED
(
hr
),
"GetPixelShaderConstantF returned %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice9_GetPixelShaderConstantB
(
device
,
scarg
->
idx
,
value
.
bool_constant
,
4
);
ok
(
SUCCEEDED
(
hr
),
"GetPixelShaderConstantB returned %#x.
\n
"
,
hr
);
}
}
static
const
struct
shader_constant_data
shader_constant_poison_data
=
{
{
0x1337c0de
,
0x1337c0de
,
0x1337c0de
,
0x1337c0de
},
{
1
.
0
f
,
2
.
0
f
,
3
.
0
f
,
4
.
0
f
},
{
FALSE
,
TRUE
,
FALSE
,
TRUE
}
};
static
const
struct
shader_constant_data
shader_constant_default_data
=
{
{
0
,
0
,
0
,
0
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
,
0
,
0
,
0
}
};
static
const
struct
shader_constant_data
shader_constant_test_data
=
{
{
0xdead0000
,
0xdead0001
,
0xdead0002
,
0xdead0003
},
{
5
.
0
f
,
6
.
0
f
,
7
.
0
f
,
8
.
0
f
},
{
TRUE
,
FALSE
,
FALSE
,
TRUE
}
};
ok
(
!
memcmp
(
scdata
->
int_constant
,
value
.
int_constant
,
sizeof
(
scdata
->
int_constant
)),
"Chain stage %u, %s integer constant:
\n
"
"
\t
{%#x, %#x, %#x, %#x} expected
\n
"
"
\t
{%#x, %#x, %#x, %#x} received
\n
"
,
chain_stage
,
scarg
->
pshader
?
"pixel shader"
:
"vertex_shader"
,
scdata
->
int_constant
[
0
],
scdata
->
int_constant
[
1
],
scdata
->
int_constant
[
2
],
scdata
->
int_constant
[
3
],
value
.
int_constant
[
0
],
value
.
int_constant
[
1
],
value
.
int_constant
[
2
],
value
.
int_constant
[
3
]);
ok
(
!
memcmp
(
scdata
->
float_constant
,
value
.
float_constant
,
sizeof
(
scdata
->
float_constant
)),
"Chain stage %u, %s float constant:
\n
"
"
\t
{%.8e, %.8e, %.8e, %.8e} expected
\n
"
"
\t
{%.8e, %.8e, %.8e, %.8e} received
\n
"
,
chain_stage
,
scarg
->
pshader
?
"pixel shader"
:
"vertex_shader"
,
scdata
->
float_constant
[
0
],
scdata
->
float_constant
[
1
],
scdata
->
float_constant
[
2
],
scdata
->
float_constant
[
3
],
value
.
float_constant
[
0
],
value
.
float_constant
[
1
],
value
.
float_constant
[
2
],
value
.
float_constant
[
3
]);
ok
(
!
memcmp
(
scdata
->
bool_constant
,
value
.
bool_constant
,
sizeof
(
scdata
->
bool_constant
)),
"Chain stage %u, %s boolean constant:
\n
"
"
\t
{%#x, %#x, %#x, %#x} expected
\n
"
"
\t
{%#x, %#x, %#x, %#x} received
\n
"
,
chain_stage
,
scarg
->
pshader
?
"pixel shader"
:
"vertex_shader"
,
scdata
->
bool_constant
[
0
],
scdata
->
bool_constant
[
1
],
scdata
->
bool_constant
[
2
],
scdata
->
bool_constant
[
3
],
value
.
bool_constant
[
0
],
value
.
bool_constant
[
1
],
value
.
bool_constant
[
2
],
value
.
bool_constant
[
3
]);
}
static
HRESULT
shader_constant_setup_handler
(
struct
state_test
*
test
)
{
...
...
@@ -574,14 +552,10 @@ static HRESULT shader_constant_setup_handler(struct state_test *test)
if
(
ctx
==
NULL
)
return
E_FAIL
;
test
->
test_context
=
ctx
;
test
->
return_data
=
&
ctx
->
return_data_buffer
;
test
->
test_data_in
=
&
shader_constant_test_data
;
test
->
test_data_out
=
&
shader_constant_test_data
;
test
->
default_data
=
&
shader_constant_default_data
;
test
->
initial_data
=
&
shader_constant_default_data
;
test
->
poison_data
=
&
shader_constant_poison_data
;
test
->
data_size
=
sizeof
(
struct
shader_constant_data
);
return
D3D_OK
;
}
...
...
@@ -596,9 +570,8 @@ static void shader_constants_queue_test(struct state_test *test, const struct sh
test
->
setup_handler
=
shader_constant_setup_handler
;
test
->
teardown_handler
=
shader_constant_teardown_handler
;
test
->
set_handler
=
shader_constant_set_handler
;
test
->
get_handler
=
shader_constant_get_handler
;
test
->
print_handler
=
shader_constant_print_handler
;
test
->
test_name
=
test_arg
->
pshader
?
"set_get_pshader_constants"
:
"set_get_vshader_constants"
;
test
->
check_data
=
shader_constant_check_data
;
test
->
test_name
=
test_arg
->
pshader
?
"set_get_pshader_constants"
:
"set_get_vshader_constants"
;
test
->
test_arg
=
test_arg
;
}
...
...
@@ -622,36 +595,88 @@ struct light_context
struct
light_data
return_data_buffer
;
};
static
void
light_print_handler
(
const
struct
state_test
*
test
,
const
void
*
data
)
static
const
struct
light_data
light_poison_data
=
{
const
struct
light_data
*
ldata
=
data
;
{
0x1337c0de
,
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
3
.
3
f
,
4
.
4
f
,
5
.
5
f
},
{
6
.
6
f
,
7
.
7
f
,
8
.
8
f
},
12
.
12
f
,
13
.
13
f
,
14
.
14
f
,
15
.
15
f
,
16
.
16
f
,
17
.
17
f
,
18
.
18
f
,
},
TRUE
,
0x1337c0de
,
0x1337c0de
,
};
trace
(
"Get Light return value: %#x
\n
"
,
ldata
->
get_light_result
);
trace
(
"Get Light enable return value: %#x
\n
"
,
ldata
->
get_enabled_result
);
trace
(
"Light Enabled = %u
\n
"
,
ldata
->
enabled
);
trace
(
"Light Type = %u
\n
"
,
ldata
->
light
.
Type
);
trace
(
"Light Diffuse = { %f, %f, %f, %f }
\n
"
,
ldata
->
light
.
Diffuse
.
r
,
ldata
->
light
.
Diffuse
.
g
,
ldata
->
light
.
Diffuse
.
b
,
ldata
->
light
.
Diffuse
.
a
);
trace
(
"Light Specular = { %f, %f, %f, %f}
\n
"
,
ldata
->
light
.
Specular
.
r
,
ldata
->
light
.
Specular
.
g
,
ldata
->
light
.
Specular
.
b
,
ldata
->
light
.
Specular
.
a
);
trace
(
"Light Ambient = { %f, %f, %f, %f }
\n
"
,
ldata
->
light
.
Ambient
.
r
,
ldata
->
light
.
Ambient
.
g
,
ldata
->
light
.
Ambient
.
b
,
ldata
->
light
.
Ambient
.
a
);
trace
(
"Light Position = { %f, %f, %f }
\n
"
,
ldata
->
light
.
Position
.
x
,
ldata
->
light
.
Position
.
y
,
ldata
->
light
.
Position
.
z
);
trace
(
"Light Direction = { %f, %f, %f }
\n
"
,
ldata
->
light
.
Direction
.
x
,
ldata
->
light
.
Direction
.
y
,
ldata
->
light
.
Direction
.
z
);
trace
(
"Light Range = %f
\n
"
,
ldata
->
light
.
Range
);
trace
(
"Light Fallof = %f
\n
"
,
ldata
->
light
.
Falloff
);
trace
(
"Light Attenuation0 = %f
\n
"
,
ldata
->
light
.
Attenuation0
);
trace
(
"Light Attenuation1 = %f
\n
"
,
ldata
->
light
.
Attenuation1
);
trace
(
"Light Attenuation2 = %f
\n
"
,
ldata
->
light
.
Attenuation2
);
trace
(
"Light Theta = %f
\n
"
,
ldata
->
light
.
Theta
);
trace
(
"Light Phi = %f
\n
"
,
ldata
->
light
.
Phi
);
}
static
const
struct
light_data
light_default_data
=
{
{
D3DLIGHT_DIRECTIONAL
,
{
1
.
0
f
,
1
.
0
f
,
1
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
},
{
0
.
0
f
,
0
.
0
f
,
1
.
0
f
},
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
},
FALSE
,
D3D_OK
,
D3D_OK
,
};
/* This is used for the initial read state (before a write causes side effects).
* The proper return status is D3DERR_INVALIDCALL. */
static
const
struct
light_data
light_initial_data
=
{
{
0x1337c0de
,
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
7
.
0
f
,
4
.
0
f
,
2
.
0
f
,
1
.
0
f
},
{
3
.
3
f
,
4
.
4
f
,
5
.
5
f
},
{
6
.
6
f
,
7
.
7
f
,
8
.
8
f
},
12
.
12
f
,
13
.
13
f
,
14
.
14
f
,
15
.
15
f
,
16
.
16
f
,
17
.
17
f
,
18
.
18
f
,
},
TRUE
,
D3DERR_INVALIDCALL
,
D3DERR_INVALIDCALL
,
};
static
const
struct
light_data
light_test_data_in
=
{
{
1
,
{
2
.
0
f
,
2
.
0
f
,
2
.
0
f
,
2
.
0
f
},
{
3
.
0
f
,
3
.
0
f
,
3
.
0
f
,
3
.
0
f
},
{
4
.
0
f
,
4
.
0
f
,
4
.
0
f
,
4
.
0
f
},
{
5
.
0
f
,
5
.
0
f
,
5
.
0
f
},
{
6
.
0
f
,
6
.
0
f
,
6
.
0
f
},
7
.
0
f
,
8
.
0
f
,
9
.
0
f
,
10
.
0
f
,
11
.
0
f
,
12
.
0
f
,
13
.
0
f
,
},
TRUE
,
D3D_OK
,
D3D_OK
};
/* SetLight will use 128 as the "enabled" value */
static
const
struct
light_data
light_test_data_out
=
{
{
1
,
{
2
.
0
f
,
2
.
0
f
,
2
.
0
f
,
2
.
0
f
},
{
3
.
0
f
,
3
.
0
f
,
3
.
0
f
,
3
.
0
f
},
{
4
.
0
f
,
4
.
0
f
,
4
.
0
f
,
4
.
0
f
},
{
5
.
0
f
,
5
.
0
f
,
5
.
0
f
},
{
6
.
0
f
,
6
.
0
f
,
6
.
0
f
},
7
.
0
f
,
8
.
0
f
,
9
.
0
f
,
10
.
0
f
,
11
.
0
f
,
12
.
0
f
,
13
.
0
f
,
},
128
,
D3D_OK
,
D3D_OK
,
};
static
void
light_set_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
const
void
*
data
)
{
...
...
@@ -667,69 +692,93 @@ static void light_set_handler(IDirect3DDevice9 *device, const struct state_test
ok
(
hret
==
D3D_OK
,
"SetLightEnable returned %#x.
\n
"
,
hret
);
}
static
void
light_get_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
void
*
data
)
static
void
light_check_data
(
IDirect3DDevice9
*
device
,
unsigned
int
chain_stage
,
const
struct
state_test
*
test
,
const
void
*
expected_data
)
{
const
struct
light_arg
*
larg
=
test
->
test_arg
;
struct
light_data
*
ldata
=
data
;
HRESULT
hret
;
unsigned
int
index
=
larg
->
idx
;
hret
=
IDirect3DDevice9_GetLightEnable
(
device
,
index
,
&
ldata
->
enabled
);
ldata
->
get_enabled_result
=
hret
;
hret
=
IDirect3DDevice9_GetLight
(
device
,
index
,
&
ldata
->
light
);
ldata
->
get_light_result
=
hret
;
const
struct
light_data
*
ldata
=
expected_data
;
struct
light_data
value
;
value
=
light_poison_data
;
value
.
get_enabled_result
=
IDirect3DDevice9_GetLightEnable
(
device
,
larg
->
idx
,
&
value
.
enabled
);
value
.
get_light_result
=
IDirect3DDevice9_GetLight
(
device
,
larg
->
idx
,
&
value
.
light
);
ok
(
value
.
get_enabled_result
==
ldata
->
get_enabled_result
,
"Chain stage %u: expected get_enabled_result %#x, got %#x.
\n
"
,
chain_stage
,
ldata
->
get_enabled_result
,
value
.
get_enabled_result
);
ok
(
value
.
get_light_result
==
ldata
->
get_light_result
,
"Chain stage %u: expected get_light_result %#x, got %#x.
\n
"
,
chain_stage
,
ldata
->
get_light_result
,
value
.
get_light_result
);
ok
(
value
.
enabled
==
ldata
->
enabled
,
"Chain stage %u: expected enabled %#x, got %#x.
\n
"
,
chain_stage
,
ldata
->
enabled
,
value
.
enabled
);
ok
(
value
.
light
.
Type
==
ldata
->
light
.
Type
,
"Chain stage %u: expected light.Type %#x, got %#x.
\n
"
,
chain_stage
,
ldata
->
light
.
Type
,
value
.
light
.
Type
);
ok
(
!
memcmp
(
&
value
.
light
.
Diffuse
,
&
ldata
->
light
.
Diffuse
,
sizeof
(
value
.
light
.
Diffuse
)),
"Chain stage %u, light.Diffuse:
\n\t
{%.8e, %.8e, %.8e, %.8e} expected
\n
"
"
\t
{%.8e, %.8e, %.8e, %.8e} received.
\n
"
,
chain_stage
,
ldata
->
light
.
Diffuse
.
r
,
ldata
->
light
.
Diffuse
.
g
,
ldata
->
light
.
Diffuse
.
b
,
ldata
->
light
.
Diffuse
.
a
,
value
.
light
.
Diffuse
.
r
,
value
.
light
.
Diffuse
.
g
,
value
.
light
.
Diffuse
.
b
,
value
.
light
.
Diffuse
.
a
);
ok
(
!
memcmp
(
&
value
.
light
.
Specular
,
&
ldata
->
light
.
Specular
,
sizeof
(
value
.
light
.
Specular
)),
"Chain stage %u, light.Specular:
\n\t
{%.8e, %.8e, %.8e, %.8e} expected
\n
"
"
\t
{%.8e, %.8e, %.8e, %.8e} received.
\n
"
,
chain_stage
,
ldata
->
light
.
Specular
.
r
,
ldata
->
light
.
Specular
.
g
,
ldata
->
light
.
Specular
.
b
,
ldata
->
light
.
Specular
.
a
,
value
.
light
.
Specular
.
r
,
value
.
light
.
Specular
.
g
,
value
.
light
.
Specular
.
b
,
value
.
light
.
Specular
.
a
);
ok
(
!
memcmp
(
&
value
.
light
.
Ambient
,
&
ldata
->
light
.
Ambient
,
sizeof
(
value
.
light
.
Ambient
)),
"Chain stage %u, light.Ambient:
\n\t
{%.8e, %.8e, %.8e, %.8e} expected
\n
"
"
\t
{%.8e, %.8e, %.8e, %.8e} received.
\n
"
,
chain_stage
,
ldata
->
light
.
Ambient
.
r
,
ldata
->
light
.
Ambient
.
g
,
ldata
->
light
.
Ambient
.
b
,
ldata
->
light
.
Ambient
.
a
,
value
.
light
.
Ambient
.
r
,
value
.
light
.
Ambient
.
g
,
value
.
light
.
Ambient
.
b
,
value
.
light
.
Ambient
.
a
);
ok
(
!
memcmp
(
&
value
.
light
.
Position
,
&
ldata
->
light
.
Position
,
sizeof
(
value
.
light
.
Position
)),
"Chain stage %u, light.Position:
\n\t
{%.8e, %.8e, %.8e} expected
\n\t
{%.8e, %.8e, %.8e} received.
\n
"
,
chain_stage
,
ldata
->
light
.
Position
.
x
,
ldata
->
light
.
Position
.
y
,
ldata
->
light
.
Position
.
z
,
value
.
light
.
Position
.
x
,
value
.
light
.
Position
.
y
,
value
.
light
.
Position
.
z
);
ok
(
!
memcmp
(
&
value
.
light
.
Direction
,
&
ldata
->
light
.
Direction
,
sizeof
(
value
.
light
.
Direction
)),
"Chain stage %u, light.Direction:
\n\t
{%.8e, %.8e, %.8e} expected
\n\t
{%.8e, %.8e, %.8e} received.
\n
"
,
chain_stage
,
ldata
->
light
.
Direction
.
x
,
ldata
->
light
.
Direction
.
y
,
ldata
->
light
.
Direction
.
z
,
value
.
light
.
Direction
.
x
,
value
.
light
.
Direction
.
y
,
value
.
light
.
Direction
.
z
);
ok
(
value
.
light
.
Range
==
ldata
->
light
.
Range
,
"Chain stage %u: expected light.Range %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Range
,
value
.
light
.
Range
);
ok
(
value
.
light
.
Falloff
==
ldata
->
light
.
Falloff
,
"Chain stage %u: expected light.Falloff %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Falloff
,
value
.
light
.
Falloff
);
ok
(
value
.
light
.
Attenuation0
==
ldata
->
light
.
Attenuation0
,
"Chain stage %u: expected light.Attenuation0 %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Attenuation0
,
value
.
light
.
Attenuation0
);
ok
(
value
.
light
.
Attenuation1
==
ldata
->
light
.
Attenuation1
,
"Chain stage %u: expected light.Attenuation1 %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Attenuation1
,
value
.
light
.
Attenuation1
);
ok
(
value
.
light
.
Attenuation2
==
ldata
->
light
.
Attenuation2
,
"Chain stage %u: expected light.Attenuation2 %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Attenuation2
,
value
.
light
.
Attenuation2
);
ok
(
value
.
light
.
Theta
==
ldata
->
light
.
Theta
,
"Chain stage %u: expected light.Theta %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Theta
,
value
.
light
.
Theta
);
ok
(
value
.
light
.
Phi
==
ldata
->
light
.
Phi
,
"Chain stage %u: expected light.Phi %.8e, got %.8e.
\n
"
,
chain_stage
,
ldata
->
light
.
Phi
,
value
.
light
.
Phi
);
}
static
const
struct
light_data
light_poison_data
=
{
{
0x1337c0de
,
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
3
.
3
f
,
4
.
4
f
,
5
.
5
f
},{
6
.
6
f
,
7
.
7
f
,
8
.
8
f
},
12
.
12
f
,
13
.
13
f
,
14
.
14
f
,
15
.
15
f
,
16
.
16
f
,
17
.
17
f
,
18
.
18
f
},
1
,
0x1337c0de
,
0x1337c0de
};
static
const
struct
light_data
light_default_data
=
{
{
D3DLIGHT_DIRECTIONAL
,
{
1
.
0
,
1
.
0
,
1
.
0
,
0
.
0
},
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
},
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
},
{
0
.
0
,
0
.
0
,
0
.
0
},
{
0
.
0
,
0
.
0
,
1
.
0
},
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
},
0
,
D3D_OK
,
D3D_OK
};
/* This is used for the initial read state (before a write causes side effects)
* The proper return status is D3DERR_INVALIDCALL */
static
const
struct
light_data
light_initial_data
=
{
{
0x1337c0de
,
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
7
.
0
,
4
.
0
,
2
.
0
,
1
.
0
},
{
3
.
3
f
,
4
.
4
f
,
5
.
5
f
},
{
6
.
6
f
,
7
.
7
f
,
8
.
8
f
},
12
.
12
f
,
13
.
13
f
,
14
.
14
f
,
15
.
15
f
,
16
.
16
f
,
17
.
17
f
,
18
.
18
f
},
1
,
D3DERR_INVALIDCALL
,
D3DERR_INVALIDCALL
};
static
const
struct
light_data
light_test_data_in
=
{
{
1
,
{
2
.
0
,
2
.
0
,
2
.
0
,
2
.
0
},
{
3
.
0
,
3
.
0
,
3
.
0
,
3
.
0
},
{
4
.
0
,
4
.
0
,
4
.
0
,
4
.
0
},
{
5
.
0
,
5
.
0
,
5
.
0
},
{
6
.
0
,
6
.
0
,
6
.
0
},
7
.
0
,
8
.
0
,
9
.
0
,
10
.
0
,
11
.
0
,
12
.
0
,
13
.
0
},
1
,
D3D_OK
,
D3D_OK
};
/* SetLight will use 128 as the "enabled" value */
static
const
struct
light_data
light_test_data_out
=
{
{
1
,
{
2
.
0
,
2
.
0
,
2
.
0
,
2
.
0
},
{
3
.
0
,
3
.
0
,
3
.
0
,
3
.
0
},
{
4
.
0
,
4
.
0
,
4
.
0
,
4
.
0
},
{
5
.
0
,
5
.
0
,
5
.
0
},
{
6
.
0
,
6
.
0
,
6
.
0
},
7
.
0
,
8
.
0
,
9
.
0
,
10
.
0
,
11
.
0
,
12
.
0
,
13
.
0
},
128
,
D3D_OK
,
D3D_OK
};
static
HRESULT
light_setup_handler
(
struct
state_test
*
test
)
{
struct
light_context
*
ctx
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
ctx
));
if
(
ctx
==
NULL
)
return
E_FAIL
;
test
->
test_context
=
ctx
;
test
->
return_data
=
&
ctx
->
return_data_buffer
;
test
->
test_data_in
=
&
light_test_data_in
;
test
->
test_data_out
=
&
light_test_data_out
;
test
->
default_data
=
&
light_default_data
;
test
->
initial_data
=
&
light_initial_data
;
test
->
poison_data
=
&
light_poison_data
;
test
->
data_size
=
sizeof
(
struct
light_data
);
return
D3D_OK
;
}
...
...
@@ -744,8 +793,7 @@ static void lights_queue_test(struct state_test *test, const struct light_arg *t
test
->
setup_handler
=
light_setup_handler
;
test
->
teardown_handler
=
light_teardown_handler
;
test
->
set_handler
=
light_set_handler
;
test
->
get_handler
=
light_get_handler
;
test
->
print_handler
=
light_print_handler
;
test
->
check_data
=
light_check_data
;
test
->
test_name
=
"set_get_light"
;
test
->
test_arg
=
test_arg
;
}
...
...
@@ -767,28 +815,125 @@ struct transform_context
struct
transform_data
return_data_buffer
;
};
static
inline
void
print_matrix
(
const
char
*
name
,
const
D3DMATRIX
*
matrix
)
{
trace
(
"%s Matrix = {
\n
"
,
name
);
trace
(
" %f %f %f %f
\n
"
,
U
(
*
matrix
).
m
[
0
][
0
],
U
(
*
matrix
).
m
[
1
][
0
],
U
(
*
matrix
).
m
[
2
][
0
],
U
(
*
matrix
).
m
[
3
][
0
]);
trace
(
" %f %f %f %f
\n
"
,
U
(
*
matrix
).
m
[
0
][
1
],
U
(
*
matrix
).
m
[
1
][
1
],
U
(
*
matrix
).
m
[
2
][
1
],
U
(
*
matrix
).
m
[
3
][
1
]);
trace
(
" %f %f %f %f
\n
"
,
U
(
*
matrix
).
m
[
0
][
2
],
U
(
*
matrix
).
m
[
1
][
2
],
U
(
*
matrix
).
m
[
2
][
2
],
U
(
*
matrix
).
m
[
3
][
2
]);
trace
(
" %f %f %f %f
\n
"
,
U
(
*
matrix
).
m
[
0
][
3
],
U
(
*
matrix
).
m
[
1
][
3
],
U
(
*
matrix
).
m
[
2
][
3
],
U
(
*
matrix
).
m
[
3
][
3
]);
trace
(
"}
\n
"
);
}
static
const
struct
transform_data
transform_default_data
=
{
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
{{{
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
}}},
};
static
void
transform_print_handler
(
const
struct
state_test
*
test
,
const
void
*
data
)
static
const
struct
transform_data
transform_poison_data
=
{
const
struct
transform_data
*
tdata
=
data
;
{{{
1
.
0
f
,
2
.
0
f
,
3
.
0
f
,
4
.
0
f
,
5
.
0
f
,
6
.
0
f
,
7
.
0
f
,
8
.
0
f
,
9
.
0
f
,
10
.
0
f
,
11
.
0
f
,
12
.
0
f
,
13
.
0
f
,
14
.
0
f
,
15
.
0
f
,
16
.
0
f
,
}}},
{{{
17
.
0
f
,
18
.
0
f
,
19
.
0
f
,
20
.
0
f
,
21
.
0
f
,
22
.
0
f
,
23
.
0
f
,
24
.
0
f
,
25
.
0
f
,
26
.
0
f
,
27
.
0
f
,
28
.
0
f
,
29
.
0
f
,
30
.
0
f
,
31
.
0
f
,
32
.
0
f
,
}}},
{{{
33
.
0
f
,
34
.
0
f
,
35
.
0
f
,
36
.
0
f
,
37
.
0
f
,
38
.
0
f
,
39
.
0
f
,
40
.
0
f
,
41
.
0
f
,
42
.
0
f
,
43
.
0
f
,
44
.
0
f
,
45
.
0
f
,
46
.
0
f
,
47
.
0
f
,
48
.
0
f
}}},
{{{
49
.
0
f
,
50
.
0
f
,
51
.
0
f
,
52
.
0
f
,
53
.
0
f
,
54
.
0
f
,
55
.
0
f
,
56
.
0
f
,
57
.
0
f
,
58
.
0
f
,
59
.
0
f
,
60
.
0
f
,
61
.
0
f
,
62
.
0
f
,
63
.
0
f
,
64
.
0
f
,
}}},
{{{
64
.
0
f
,
66
.
0
f
,
67
.
0
f
,
68
.
0
f
,
69
.
0
f
,
70
.
0
f
,
71
.
0
f
,
72
.
0
f
,
73
.
0
f
,
74
.
0
f
,
75
.
0
f
,
76
.
0
f
,
77
.
0
f
,
78
.
0
f
,
79
.
0
f
,
80
.
0
f
,
}}},
{{{
81
.
0
f
,
82
.
0
f
,
83
.
0
f
,
84
.
0
f
,
85
.
0
f
,
86
.
0
f
,
87
.
0
f
,
88
.
0
f
,
89
.
0
f
,
90
.
0
f
,
91
.
0
f
,
92
.
0
f
,
93
.
0
f
,
94
.
0
f
,
95
.
0
f
,
96
.
0
f
,
}}},
};
print_matrix
(
"View"
,
&
tdata
->
view
);
print_matrix
(
"Projection"
,
&
tdata
->
projection
);
print_matrix
(
"Texture0"
,
&
tdata
->
texture0
);
print_matrix
(
"Texture7"
,
&
tdata
->
texture7
);
print_matrix
(
"World0"
,
&
tdata
->
world0
);
print_matrix
(
"World255"
,
&
tdata
->
world255
);
}
static
const
struct
transform_data
transform_test_data
=
{
{{{
1
.
2
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
14
.
15
f
,
-
1
.
5
f
,
23
.
56
f
,
12
.
89
f
,
44
.
56
f
,
-
1
.
0
f
,
2
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
,
}}},
{{{
9
.
2
f
,
38
.
7
f
,
-
6
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
77
.
15
f
,
-
1
.
5
f
,
23
.
56
f
,
12
.
89
f
,
14
.
56
f
,
-
1
.
0
f
,
12
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
,
}}},
{{{
10
.
2
f
,
3
.
4
f
,
0
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
14
.
15
f
,
-
1
.
5
f
,
23
.
54
f
,
12
.
9
f
,
44
.
56
f
,
-
1
.
0
f
,
2
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
,
}}},
{{{
1
.
2
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
12
.
89
f
,
23
.
56
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
4
.
4
f
,
2
.
5
f
,
}}},
{{{
1
.
2
f
,
31
.
41
f
,
58
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
12
.
89
f
,
11
.
56
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
44
.
4
f
,
2
.
5
f
,
}}},
{{{
1
.
20
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
0
f
,
10
.
11
f
,
-
12
.
156
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
1
.
829
f
,
23
.
6
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
41
.
4
f
,
2
.
5
f
,
}}},
};
static
void
transform_set_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
const
void
*
data
)
{
...
...
@@ -814,81 +959,71 @@ static void transform_set_handler(IDirect3DDevice9 *device, const struct state_t
ok
(
hret
==
D3D_OK
,
"SetTransform returned %#x.
\n
"
,
hret
);
}
static
void
transform_get_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
void
*
data
)
static
void
compare_matrix
(
const
char
*
name
,
unsigned
int
chain_stage
,
const
D3DMATRIX
*
received
,
const
D3DMATRIX
*
expected
)
{
struct
transform_data
*
tdata
=
data
;
HRESULT
hret
;
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_VIEW
,
&
tdata
->
view
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_PROJECTION
,
&
tdata
->
projection
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_TEXTURE0
,
&
tdata
->
texture0
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_TEXTURE0
+
texture_stages
-
1
,
&
tdata
->
texture7
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_WORLD
,
&
tdata
->
world0
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
hret
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_WORLDMATRIX
(
255
),
&
tdata
->
world255
);
ok
(
hret
==
D3D_OK
,
"GetTransform returned %#x.
\n
"
,
hret
);
ok
(
!
memcmp
(
expected
,
received
,
sizeof
(
*
expected
)),
"Chain stage %u, matrix %s:
\n
"
"
\t
{
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t
} expected
\n
"
"
\t
{
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t\t
%.8e, %.8e, %.8e, %.8e,
\n
"
"
\t
} received
\n
"
,
chain_stage
,
name
,
U
(
*
expected
).
m
[
0
][
0
],
U
(
*
expected
).
m
[
1
][
0
],
U
(
*
expected
).
m
[
2
][
0
],
U
(
*
expected
).
m
[
3
][
0
],
U
(
*
expected
).
m
[
0
][
1
],
U
(
*
expected
).
m
[
1
][
1
],
U
(
*
expected
).
m
[
2
][
1
],
U
(
*
expected
).
m
[
3
][
1
],
U
(
*
expected
).
m
[
0
][
2
],
U
(
*
expected
).
m
[
1
][
2
],
U
(
*
expected
).
m
[
2
][
2
],
U
(
*
expected
).
m
[
3
][
2
],
U
(
*
expected
).
m
[
0
][
3
],
U
(
*
expected
).
m
[
1
][
3
],
U
(
*
expected
).
m
[
2
][
3
],
U
(
*
expected
).
m
[
3
][
3
],
U
(
*
received
).
m
[
0
][
0
],
U
(
*
received
).
m
[
1
][
0
],
U
(
*
received
).
m
[
2
][
0
],
U
(
*
received
).
m
[
3
][
0
],
U
(
*
received
).
m
[
0
][
1
],
U
(
*
received
).
m
[
1
][
1
],
U
(
*
received
).
m
[
2
][
1
],
U
(
*
received
).
m
[
3
][
1
],
U
(
*
received
).
m
[
0
][
2
],
U
(
*
received
).
m
[
1
][
2
],
U
(
*
received
).
m
[
2
][
2
],
U
(
*
received
).
m
[
3
][
2
],
U
(
*
received
).
m
[
0
][
3
],
U
(
*
received
).
m
[
1
][
3
],
U
(
*
received
).
m
[
2
][
3
],
U
(
*
received
).
m
[
3
][
3
]);
}
static
const
struct
transform_data
transform_default_data
=
{
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
},
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
},
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
},
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
},
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
},
{
{
{
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
}
}
}
};
static
const
struct
transform_data
transform_poison_data
=
{
{
{
{
1
.
0
f
,
2
.
0
f
,
3
.
0
f
,
4
.
0
f
,
5
.
0
f
,
6
.
0
f
,
7
.
0
f
,
8
.
0
f
,
9
.
0
f
,
10
.
0
f
,
11
.
0
f
,
12
.
0
f
,
13
.
0
f
,
14
.
0
f
,
15
.
0
f
,
16
.
0
f
}
}
},
{
{
{
17
.
0
f
,
18
.
0
f
,
19
.
0
f
,
20
.
0
f
,
21
.
0
f
,
22
.
0
f
,
23
.
0
f
,
24
.
0
f
,
25
.
0
f
,
26
.
0
f
,
27
.
0
f
,
28
.
0
f
,
29
.
0
f
,
30
.
0
f
,
31
.
0
f
,
32
.
0
f
}
}
},
{
{
{
33
.
0
f
,
34
.
0
f
,
35
.
0
f
,
36
.
0
f
,
37
.
0
f
,
38
.
0
f
,
39
.
0
f
,
40
.
0
f
,
41
.
0
f
,
42
.
0
f
,
43
.
0
f
,
44
.
0
f
,
45
.
0
f
,
46
.
0
f
,
47
.
0
f
,
48
.
0
f
}
}
},
{
{
{
49
.
0
f
,
50
.
0
f
,
51
.
0
f
,
52
.
0
f
,
53
.
0
f
,
54
.
0
f
,
55
.
0
f
,
56
.
0
f
,
57
.
0
f
,
58
.
0
f
,
59
.
0
f
,
60
.
0
f
,
61
.
0
f
,
62
.
0
f
,
63
.
0
f
,
64
.
0
f
}
}
},
{
{
{
64
.
0
f
,
66
.
0
f
,
67
.
0
f
,
68
.
0
f
,
69
.
0
f
,
70
.
0
f
,
71
.
0
f
,
72
.
0
f
,
73
.
0
f
,
74
.
0
f
,
75
.
0
f
,
76
.
0
f
,
77
.
0
f
,
78
.
0
f
,
79
.
0
f
,
80
.
0
f
}
}
},
{
{
{
81
.
0
f
,
82
.
0
f
,
83
.
0
f
,
84
.
0
f
,
85
.
0
f
,
86
.
0
f
,
87
.
0
f
,
88
.
0
f
,
89
.
0
f
,
90
.
0
f
,
91
.
0
f
,
92
.
0
f
,
93
.
0
f
,
94
.
0
f
,
95
.
0
f
,
96
.
0
f
}
}
},
};
static
const
struct
transform_data
transform_test_data
=
static
void
transform_check_data
(
IDirect3DDevice9
*
device
,
unsigned
int
chain_stage
,
const
struct
state_test
*
test
,
const
void
*
expected_data
)
{
{
{
{
1
.
2
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
14
.
15
f
,
-
1
.
5
f
,
23
.
56
f
,
12
.
89
f
,
44
.
56
f
,
-
1
.
0
f
,
2
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
}
}
},
{
{
{
9
.
2
f
,
38
.
7
f
,
-
6
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
77
.
15
f
,
-
1
.
5
f
,
23
.
56
f
,
12
.
89
f
,
14
.
56
f
,
-
1
.
0
f
,
12
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
}
}
},
{
{
{
10
.
2
f
,
3
.
4
f
,
0
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
14
.
15
f
,
-
1
.
5
f
,
23
.
54
f
,
12
.
9
f
,
44
.
56
f
,
-
1
.
0
f
,
2
.
3
f
,
0
.
0
f
,
4
.
4
f
,
5
.
5
f
}
}
},
{
{
{
1
.
2
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
12
.
89
f
,
23
.
56
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
4
.
4
f
,
2
.
5
f
}
}
},
{
{
{
1
.
2
f
,
31
.
41
f
,
58
.
6
f
,
7
.
2
f
,
10
.
11
f
,
-
12
.
13
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
12
.
89
f
,
11
.
56
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
44
.
4
f
,
2
.
5
f
}
}
},
const
struct
transform_data
*
tdata
=
expected_data
;
D3DMATRIX
value
;
HRESULT
hr
;
{
{
{
1
.
20
f
,
3
.
4
f
,
-
5
.
6
f
,
7
.
0
f
,
10
.
11
f
,
-
12
.
156
f
,
-
14
.
5
f
,
-
1
.
5
f
,
2
.
56
f
,
1
.
829
f
,
23
.
6
f
,
-
1
.
0
f
,
112
.
3
f
,
0
.
0
f
,
41
.
4
f
,
2
.
5
f
}
}
},
};
value
=
transform_poison_data
.
view
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_VIEW
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"View"
,
chain_stage
,
&
value
,
&
tdata
->
view
);
value
=
transform_poison_data
.
projection
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_PROJECTION
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"Projection"
,
chain_stage
,
&
value
,
&
tdata
->
projection
);
value
=
transform_poison_data
.
texture0
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_TEXTURE0
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"Texture0"
,
chain_stage
,
&
value
,
&
tdata
->
texture0
);
value
=
transform_poison_data
.
texture7
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_TEXTURE0
+
texture_stages
-
1
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"Texture7"
,
chain_stage
,
&
value
,
&
tdata
->
texture7
);
value
=
transform_poison_data
.
world0
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_WORLD
,
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"World0"
,
chain_stage
,
&
value
,
&
tdata
->
world0
);
value
=
transform_poison_data
.
world255
;
hr
=
IDirect3DDevice9_GetTransform
(
device
,
D3DTS_WORLDMATRIX
(
255
),
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetTransform returned %#x.
\n
"
,
hr
);
compare_matrix
(
"World255"
,
chain_stage
,
&
value
,
&
tdata
->
world255
);
}
static
HRESULT
transform_setup_handler
(
struct
state_test
*
test
)
{
...
...
@@ -896,14 +1031,10 @@ static HRESULT transform_setup_handler(struct state_test *test)
if
(
ctx
==
NULL
)
return
E_FAIL
;
test
->
test_context
=
ctx
;
test
->
return_data
=
&
ctx
->
return_data_buffer
;
test
->
test_data_in
=
&
transform_test_data
;
test
->
test_data_out
=
&
transform_test_data
;
test
->
default_data
=
&
transform_default_data
;
test
->
initial_data
=
&
transform_default_data
;
test
->
poison_data
=
&
transform_poison_data
;
test
->
data_size
=
sizeof
(
struct
transform_data
);
return
D3D_OK
;
}
...
...
@@ -918,8 +1049,7 @@ static void transform_queue_test(struct state_test *test)
test
->
setup_handler
=
transform_setup_handler
;
test
->
teardown_handler
=
transform_teardown_handler
;
test
->
set_handler
=
transform_set_handler
;
test
->
get_handler
=
transform_get_handler
;
test
->
print_handler
=
transform_print_handler
;
test
->
check_data
=
transform_check_data
;
test
->
test_name
=
"set_get_transforms"
;
test
->
test_arg
=
NULL
;
}
...
...
@@ -1067,27 +1197,21 @@ static void render_state_set_handler(IDirect3DDevice9 *device, const struct stat
}
}
static
void
render_state_get_handler
(
IDirect3DDevice9
*
device
,
const
struct
state_test
*
test
,
void
*
data
)
static
void
render_state_check_data
(
IDirect3DDevice9
*
device
,
unsigned
int
chain_stage
,
const
struct
state_test
*
test
,
const
void
*
expected_data
)
{
struct
render_state_data
*
rsdata
=
data
;
HRESULT
hret
;
unsigned
int
i
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
render_state_indices
)
/
sizeof
(
*
render_state_indices
);
++
i
)
{
hret
=
IDirect3DDevice9_GetRenderState
(
device
,
render_state_indices
[
i
],
&
rsdata
->
states
[
i
]);
ok
(
hret
==
D3D_OK
,
"GetRenderState returned %#x.
\n
"
,
hret
);
}
}
static
void
render_state_print_handler
(
const
struct
state_test
*
test
,
const
void
*
data
)
{
const
struct
render_state_data
*
rsdata
=
data
;
const
struct
render_state_context
*
ctx
=
test
->
test_context
;
const
struct
render_state_data
*
rsdata
=
expected_data
;
unsigned
int
i
;
HRESULT
hr
;
for
(
i
=
0
;
i
<
sizeof
(
render_state_indices
)
/
sizeof
(
*
render_state_indices
);
++
i
)
{
trace
(
"Index = %u, Value = %#x
\n
"
,
i
,
rsdata
->
states
[
i
]);
DWORD
value
=
ctx
->
poison_data_buffer
.
states
[
i
];
hr
=
IDirect3DDevice9_GetRenderState
(
device
,
render_state_indices
[
i
],
&
value
);
ok
(
SUCCEEDED
(
hr
),
"GetRenderState returned %#x.
\n
"
,
hr
);
ok
(
value
==
rsdata
->
states
[
i
],
"Chain stage %u, render state %#x: expected %#x, got %#x.
\n
"
,
chain_stage
,
render_state_indices
[
i
],
rsdata
->
states
[
i
],
value
);
}
}
...
...
@@ -1335,19 +1459,15 @@ static HRESULT render_state_setup_handler(struct state_test *test)
if
(
ctx
==
NULL
)
return
E_FAIL
;
test
->
test_context
=
ctx
;
test
->
return_data
=
&
ctx
->
return_data_buffer
;
test
->
default_data
=
&
ctx
->
default_data_buffer
;
test
->
initial_data
=
&
ctx
->
default_data_buffer
;
test
->
test_data_in
=
&
ctx
->
test_data_buffer
;
test
->
test_data_out
=
&
ctx
->
test_data_buffer
;
test
->
poison_data
=
&
ctx
->
poison_data_buffer
;
render_state_default_data_init
(
rsarg
,
&
ctx
->
default_data_buffer
);
render_state_test_data_init
(
&
ctx
->
test_data_buffer
);
render_state_poison_data_init
(
&
ctx
->
poison_data_buffer
);
test
->
data_size
=
sizeof
(
struct
render_state_data
);
return
D3D_OK
;
}
...
...
@@ -1361,8 +1481,7 @@ static void render_states_queue_test(struct state_test *test, const struct rende
test
->
setup_handler
=
render_state_setup_handler
;
test
->
teardown_handler
=
render_state_teardown_handler
;
test
->
set_handler
=
render_state_set_handler
;
test
->
get_handler
=
render_state_get_handler
;
test
->
print_handler
=
render_state_print_handler
;
test
->
check_data
=
render_state_check_data
;
test
->
test_name
=
"set_get_render_states"
;
test
->
test_arg
=
test_arg
;
}
...
...
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