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
9fec159a
Commit
9fec159a
authored
Aug 21, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Aug 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Implement ID3DXConstantTable::SetMatrixPointerArray.
parent
51f4f013
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
2 deletions
+148
-2
shader.c
dlls/d3dx9_36/shader.c
+96
-2
shader.c
dlls/d3dx9_36/tests/shader.c
+52
-0
No files found.
dlls/d3dx9_36/shader.c
View file @
9fec159a
...
...
@@ -1079,6 +1079,100 @@ static HRESULT set_matrix_array(ID3DXConstantTable *iface, IDirect3DDevice9 *dev
return
D3D_OK
;
}
static
HRESULT
set_matrix_pointer_array
(
ID3DXConstantTable
*
iface
,
IDirect3DDevice9
*
device
,
D3DXHANDLE
constant
,
const
D3DXMATRIX
**
data
,
UINT
count
,
D3DXPARAMETER_CLASS
class
)
{
struct
ID3DXConstantTableImpl
*
This
=
impl_from_ID3DXConstantTable
(
iface
);
D3DXCONSTANT_DESC
desc
;
HRESULT
hr
;
UINT
registers_per_matrix
;
UINT
i
,
desc_count
=
1
;
UINT
num_rows
,
num_columns
;
UINT
row_offset
,
column_offset
;
FLOAT
matrix
[
16
]
=
{
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
,
0
.
0
f
,
0
.
0
f
};
hr
=
ID3DXConstantTable_GetConstantDesc
(
iface
,
constant
,
&
desc
,
&
desc_count
);
if
(
FAILED
(
hr
))
{
TRACE
(
"ID3DXConstantTable_GetConstantDesc failed: %08x
\n
"
,
hr
);
return
D3DERR_INVALIDCALL
;
}
if
(
desc
.
Class
==
D3DXPC_MATRIX_ROWS
||
desc
.
Class
==
D3DXPC_MATRIX_COLUMNS
)
{
if
(
desc
.
Class
==
class
)
{
column_offset
=
1
;
row_offset
=
4
;
}
else
{
column_offset
=
4
;
row_offset
=
1
;
}
if
(
class
==
D3DXPC_MATRIX_ROWS
)
{
num_rows
=
desc
.
Rows
;
num_columns
=
desc
.
Columns
;
}
else
{
num_rows
=
desc
.
Columns
;
num_columns
=
desc
.
Rows
;
}
registers_per_matrix
=
(
desc
.
Class
==
D3DXPC_MATRIX_ROWS
)
?
desc
.
Rows
:
desc
.
Columns
;
}
else
if
(
desc
.
Class
==
D3DXPC_SCALAR
)
{
registers_per_matrix
=
1
;
column_offset
=
1
;
row_offset
=
1
;
num_rows
=
desc
.
Rows
;
num_columns
=
desc
.
Columns
;
}
else
if
(
desc
.
Class
==
D3DXPC_VECTOR
)
{
registers_per_matrix
=
1
;
column_offset
=
1
;
row_offset
=
4
;
num_rows
=
desc
.
Rows
;
num_columns
=
desc
.
Columns
;
}
else
{
FIXME
(
"Unhandled variable class %#x
\n
"
,
desc
.
Class
);
return
D3D_OK
;
}
switch
(
desc
.
RegisterSet
)
{
case
D3DXRS_FLOAT4
:
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
registers_per_matrix
*
(
i
+
1
)
>
desc
.
RegisterCount
)
break
;
hr
=
set_float_matrix
(
matrix
,
&
desc
,
row_offset
,
column_offset
,
num_rows
,
num_columns
,
*
data
,
D3DXPT_FLOAT
,
4
);
if
(
FAILED
(
hr
))
return
hr
;
set_float_shader_constant
(
This
,
device
,
desc
.
RegisterIndex
+
i
*
registers_per_matrix
,
matrix
,
registers_per_matrix
);
data
++
;
}
break
;
default:
FIXME
(
"Unhandled register set %#x
\n
"
,
desc
.
RegisterSet
);
return
E_NOTIMPL
;
}
return
D3D_OK
;
}
static
HRESULT
WINAPI
ID3DXConstantTableImpl_SetDefaults
(
ID3DXConstantTable
*
iface
,
LPDIRECT3DDEVICE9
device
)
{
struct
ID3DXConstantTableImpl
*
This
=
impl_from_ID3DXConstantTable
(
iface
);
...
...
@@ -1242,9 +1336,9 @@ static HRESULT WINAPI ID3DXConstantTableImpl_SetMatrixPointerArray(ID3DXConstant
{
struct
ID3DXConstantTableImpl
*
This
=
impl_from_ID3DXConstantTable
(
iface
);
FIXME
(
"(%p)->(%p, %p, %p, %d): stub
\n
"
,
This
,
device
,
constant
,
matrix
,
count
);
TRACE
(
"(%p)->(%p, %p, %p, %d)
\n
"
,
This
,
device
,
constant
,
matrix
,
count
);
return
E_NOTIMPL
;
return
set_matrix_pointer_array
(
iface
,
device
,
constant
,
matrix
,
count
,
D3DXPC_MATRIX_ROWS
)
;
}
static
HRESULT
WINAPI
ID3DXConstantTableImpl_SetMatrixTranspose
(
ID3DXConstantTable
*
iface
,
LPDIRECT3DDEVICE9
device
,
...
...
dlls/d3dx9_36/tests/shader.c
View file @
9fec159a
...
...
@@ -569,6 +569,7 @@ static void test_setting_basic_table(IDirect3DDevice9 *device)
static
const
D3DXVECTOR4
f4
=
{
0
.
350
f
,
0
.
526
f
,
0
.
925
f
,
0
.
021
f
};
static
const
float
f
=
0
.
12543
f
;
static
const
int
i
=
321
;
static
const
D3DXMATRIX
*
matrix_pointer
[]
=
{
&
mvp
};
ID3DXConstantTable
*
ctable
;
...
...
@@ -712,6 +713,27 @@ static void test_setting_basic_table(IDirect3DDevice9 *device)
out
[
0
],
out
[
1
],
out
[
2
],
out
[
3
],
S
(
U
(
mvp
)).
_11
,
S
(
U
(
mvp
)).
_21
,
S
(
U
(
mvp
)).
_31
,
S
(
U
(
mvp
)).
_41
);
memset
(
out
,
0
,
sizeof
(
out
));
IDirect3DDevice9_SetVertexShaderConstantF
(
device
,
6
,
out
,
1
);
res
=
ID3DXConstantTable_SetMatrixPointerArray
(
ctable
,
device
,
"f"
,
matrix_pointer
,
1
);
ok
(
res
==
D3D_OK
,
"ID3DXConstantTable_SetMatrixPointerArray failed on variable f: got %#x
\n
"
,
res
);
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
6
,
out
,
1
);
ok
(
out
[
0
]
==
U
(
S
(
mvp
)).
_11
&&
out
[
1
]
==
0
.
0
f
&&
out
[
2
]
==
0
.
0
f
&&
out
[
3
]
==
0
.
0
f
,
"The variable f was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
"got %f, should be %f
\n
"
,
out
[
0
],
U
(
S
(
mvp
)).
_11
);
res
=
ID3DXConstantTable_SetMatrixPointerArray
(
ctable
,
device
,
"f4"
,
matrix_pointer
,
1
);
ok
(
res
==
D3D_OK
,
"ID3DXConstantTable_SetMatrixPointerArray failed on variable f4: got %#x
\n
"
,
res
);
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
7
,
out
,
1
);
ok
(
out
[
0
]
==
U
(
S
(
mvp
)).
_11
&&
out
[
1
]
==
U
(
S
(
mvp
)).
_12
&&
out
[
2
]
==
U
(
S
(
mvp
)).
_13
&&
out
[
3
]
==
U
(
S
(
mvp
)).
_14
,
"The variable f4 was not set correctly by ID3DXConstantTable_SetMatrixPointerArray, "
"got {%f, %f, %f, %f}, should be {%f, %f, %f, %f}
\n
"
,
out
[
0
],
out
[
1
],
out
[
2
],
out
[
3
],
U
(
S
(
mvp
)).
_11
,
U
(
S
(
mvp
)).
_12
,
U
(
S
(
mvp
)).
_13
,
U
(
S
(
mvp
)).
_14
);
refcnt
=
ID3DXConstantTable_Release
(
ctable
);
ok
(
refcnt
==
0
,
"The constant table reference count was %u, should be 0
\n
"
,
refcnt
);
}
...
...
@@ -723,6 +745,7 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device)
5
.
005
f
,
3
.
006
f
,
3
.
007
f
,
6
.
00
8
f
,
9
.
00
9
f
,
5
.
010
f
,
7
.
011
f
,
1
.
012
f
,
5
.
013
f
,
5
.
014
f
,
5
.
015
f
,
9
.
016
f
}}};
static
const
D3DXMATRIX
*
matrix_pointer
[]
=
{
&
fmatrix
};
ID3DXConstantTable
*
ctable
;
...
...
@@ -875,6 +898,35 @@ static void test_setting_matrices_table(IDirect3DDevice9 *device)
S
(
U
(
fmatrix
)).
_11
,
S
(
U
(
fmatrix
)).
_21
,
S
(
U
(
fmatrix
)).
_31
,
0
.
0
f
,
S
(
U
(
fmatrix
)).
_12
,
S
(
U
(
fmatrix
)).
_22
,
S
(
U
(
fmatrix
)).
_32
,
0
.
0
f
);
/* SetMatrixPointerArray */
res
=
ID3DXConstantTable_SetMatrixPointerArray
(
ctable
,
device
,
"c2x3"
,
matrix_pointer
,
1
);
ok
(
res
==
D3D_OK
,
"ID3DXConstantTable_SetMatrixPointerArray failed on variable c2x3: got %#x
\n
"
,
res
);
res
=
ID3DXConstantTable_SetMatrixPointerArray
(
ctable
,
device
,
"r2x3"
,
matrix_pointer
,
1
);
ok
(
res
==
D3D_OK
,
"ID3DXConstantTable_SetMatrixPointerArray failed on variable r2x3: got %#x
\n
"
,
res
);
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
7
,
out
,
3
);
ok
(
out
[
0
]
==
S
(
U
(
fmatrix
)).
_11
&&
out
[
1
]
==
S
(
U
(
fmatrix
)).
_21
&&
out
[
2
]
==
0
.
0
f
&&
out
[
3
]
==
0
.
0
f
&&
out
[
4
]
==
S
(
U
(
fmatrix
)).
_12
&&
out
[
5
]
==
S
(
U
(
fmatrix
)).
_22
&&
out
[
6
]
==
0
.
0
f
&&
out
[
7
]
==
0
.
0
f
&&
out
[
8
]
==
S
(
U
(
fmatrix
)).
_13
&&
out
[
9
]
==
S
(
U
(
fmatrix
)).
_23
&&
out
[
10
]
==
0
.
0
f
&&
out
[
11
]
==
0
.
0
f
,
"The variable c2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}, "
"should be {%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f}
\n
"
,
out
[
0
],
out
[
1
],
out
[
2
],
out
[
3
],
out
[
4
],
out
[
5
],
out
[
6
],
out
[
7
],
out
[
8
],
out
[
9
],
out
[
10
],
out
[
11
],
S
(
U
(
fmatrix
)).
_11
,
S
(
U
(
fmatrix
)).
_21
,
0
.
0
f
,
0
.
0
f
,
S
(
U
(
fmatrix
)).
_12
,
S
(
U
(
fmatrix
)).
_22
,
0
.
0
f
,
0
.
0
f
,
S
(
U
(
fmatrix
)).
_13
,
S
(
U
(
fmatrix
)).
_23
,
0
.
0
f
,
0
.
0
f
);
IDirect3DDevice9_GetVertexShaderConstantF
(
device
,
15
,
out
,
2
);
ok
(
out
[
0
]
==
S
(
U
(
fmatrix
)).
_11
&&
out
[
1
]
==
S
(
U
(
fmatrix
)).
_12
&&
out
[
2
]
==
S
(
U
(
fmatrix
)).
_13
&&
out
[
3
]
==
0
.
0
f
&&
out
[
4
]
==
S
(
U
(
fmatrix
)).
_21
&&
out
[
5
]
==
S
(
U
(
fmatrix
)).
_22
&&
out
[
6
]
==
S
(
U
(
fmatrix
)).
_23
&&
out
[
7
]
==
0
.
0
f
,
"The variable r2x3 was not set correctly, out={%f, %f, %f, %f; %f, %f, %f, %f}, "
"should be {%f, %f, %f, %f; %f, %f, %f, %f}
\n
"
,
out
[
0
],
out
[
1
],
out
[
2
],
out
[
3
],
out
[
4
],
out
[
5
],
out
[
6
],
out
[
7
],
S
(
U
(
fmatrix
)).
_11
,
S
(
U
(
fmatrix
)).
_12
,
S
(
U
(
fmatrix
)).
_13
,
0
.
0
f
,
S
(
U
(
fmatrix
)).
_21
,
S
(
U
(
fmatrix
)).
_22
,
S
(
U
(
fmatrix
)).
_23
,
0
.
0
f
);
ID3DXConstantTable_Release
(
ctable
);
}
...
...
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