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
c9f90256
Commit
c9f90256
authored
Aug 14, 2012
by
Józef Kucia
Committed by
Alexandre Julliard
Aug 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Introduce helper functions to operate on constant handles.
parent
93a2de1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
9 deletions
+22
-9
shader.c
dlls/d3dx9_36/shader.c
+22
-9
No files found.
dlls/d3dx9_36/shader.c
View file @
c9f90256
...
...
@@ -657,6 +657,21 @@ static DWORD calc_bytes(D3DXCONSTANT_DESC *desc)
return
4
*
desc
->
Elements
*
desc
->
Rows
*
desc
->
Columns
;
}
static
inline
int
is_constant_handle
(
D3DXHANDLE
handle
)
{
return
!
((
UINT_PTR
)
handle
>>
16
);
}
static
inline
ctab_constant
*
constant_from_handle
(
struct
ID3DXConstantTableImpl
*
table
,
D3DXHANDLE
handle
)
{
return
&
table
->
constants
[(
UINT_PTR
)
handle
-
1
];
}
static
inline
D3DXHANDLE
handle_from_constant_index
(
UINT
index
)
{
return
(
D3DXHANDLE
)(
DWORD_PTR
)(
index
+
1
);
}
/*** IUnknown methods ***/
static
HRESULT
WINAPI
ID3DXConstantTableImpl_QueryInterface
(
ID3DXConstantTable
*
iface
,
REFIID
riid
,
void
**
out
)
{
...
...
@@ -747,17 +762,15 @@ static HRESULT WINAPI ID3DXConstantTableImpl_GetConstantDesc(ID3DXConstantTable
return
D3DERR_INVALIDCALL
;
/* Applications can pass the name of the constant in place of the handle */
if
(
!
((
UINT_PTR
)
constant
>>
16
))
constant_info
=
&
This
->
constants
[(
UINT_PTR
)
constant
-
1
];
else
if
(
!
is_constant_handle
(
constant
))
{
D3DXHANDLE
c
=
ID3DXConstantTable_GetConstantByName
(
iface
,
NULL
,
constant
);
if
(
!
c
)
constant
=
ID3DXConstantTable_GetConstantByName
(
iface
,
NULL
,
constant
);
if
(
!
c
onstant
)
return
D3DERR_INVALIDCALL
;
constant_info
=
&
This
->
constants
[(
UINT_PTR
)
c
-
1
];
}
constant_info
=
constant_from_handle
(
This
,
constant
);
if
(
desc
)
*
desc
=
constant_info
->
desc
;
if
(
count
)
...
...
@@ -800,7 +813,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstant(ID3DXConstantTable *
if
(
index
>=
This
->
desc
.
Constants
)
return
NULL
;
return
(
D3DXHANDLE
)(
DWORD_PTR
)(
index
+
1
);
return
handle_from_constant_index
(
index
);
}
static
D3DXHANDLE
WINAPI
ID3DXConstantTableImpl_GetConstantByName
(
ID3DXConstantTable
*
iface
,
D3DXHANDLE
constant
,
LPCSTR
name
)
...
...
@@ -821,7 +834,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantByName(ID3DXConstantT
for
(
i
=
0
;
i
<
This
->
desc
.
Constants
;
i
++
)
if
(
!
strcmp
(
This
->
constants
[
i
].
desc
.
Name
,
name
))
return
(
D3DXHANDLE
)(
DWORD_PTR
)(
i
+
1
);
return
handle_from_constant_index
(
i
);
return
NULL
;
}
...
...
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