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
e615c67b
Commit
e615c67b
authored
Sep 30, 2013
by
Rico Schüller
Committed by
Alexandre Julliard
Sep 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Handle FX/TX blobs in D3DXFindShaderComment().
parent
d15416a5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
7 deletions
+47
-7
shader.c
dlls/d3dx9_36/shader.c
+13
-1
shader.c
dlls/d3dx9_36/tests/shader.c
+34
-6
No files found.
dlls/d3dx9_36/shader.c
View file @
e615c67b
...
...
@@ -154,6 +154,7 @@ const char * WINAPI D3DXGetVertexShaderProfile(struct IDirect3DDevice9 *device)
HRESULT
WINAPI
D3DXFindShaderComment
(
const
DWORD
*
byte_code
,
DWORD
fourcc
,
const
void
**
data
,
UINT
*
size
)
{
const
DWORD
*
ptr
=
byte_code
;
DWORD
version
;
TRACE
(
"byte_code %p, fourcc %x, data %p, size %p
\n
"
,
byte_code
,
fourcc
,
data
,
size
);
...
...
@@ -161,7 +162,18 @@ HRESULT WINAPI D3DXFindShaderComment(const DWORD *byte_code, DWORD fourcc, const
if
(
size
)
*
size
=
0
;
if
(
!
byte_code
)
return
D3DERR_INVALIDCALL
;
if
(
!
is_valid_bytecode
(
*
byte_code
))
return
D3DXERR_INVALIDDATA
;
version
=
*
ptr
>>
16
;
if
(
version
!=
0x4658
/* FX */
&&
version
!=
0x5458
/* TX */
&&
version
!=
0x7ffe
&&
version
!=
0x7fff
&&
version
!=
0xfffe
/* VS */
&&
version
!=
0xffff
)
/* PS */
{
WARN
(
"Invalid data supplied
\n
"
);
return
D3DXERR_INVALIDDATA
;
}
while
(
*++
ptr
!=
D3DSIO_END
)
{
...
...
dlls/d3dx9_36/tests/shader.c
View file @
e615c67b
...
...
@@ -20,12 +20,23 @@
#include "wine/test.h"
#include "d3dx9.h"
#define FCC_TEXT MAKEFOURCC('T','E','X','T')
#define FCC_CTAB MAKEFOURCC('C','T','A','B')
static
const
DWORD
shader_zero
[]
=
{
0x0
};
static
const
DWORD
shader_invalid
[]
=
{
0xeeee0100
};
static
const
DWORD
shader_empty
[]
=
{
0xfffeffff
,
0x0000ffff
};
static
const
DWORD
simple_fx
[]
=
{
0x46580000
,
0x0002fffe
,
FCC_TEXT
,
0x00000000
,
0x0000ffff
};
static
const
DWORD
simple_tx
[]
=
{
0x54580000
,
0x0002fffe
,
FCC_TEXT
,
0x00000000
,
0x0000ffff
};
static
const
DWORD
simple_7ffe
[]
=
{
0x7ffe0000
,
0x0002fffe
,
FCC_TEXT
,
0x00000000
,
0x0000ffff
};
static
const
DWORD
simple_7fff
[]
=
{
0x7fff0000
,
0x0002fffe
,
FCC_TEXT
,
0x00000000
,
0x0000ffff
};
static
const
DWORD
simple_vs
[]
=
{
0xfffe0101
,
/* vs_1_1 */
0x0000001f
,
0x80000000
,
0x900f0000
,
/* dcl_position0 v0 */
...
...
@@ -44,9 +55,6 @@ static const DWORD simple_ps[] = {
0x00000005
,
0x800f0000
,
0xb0e40000
,
0x80e40000
,
/* mul r0, t0, r0 */
0x0000ffff
};
/* END */
#define FCC_TEXT MAKEFOURCC('T','E','X','T')
#define FCC_CTAB MAKEFOURCC('C','T','A','B')
static
const
DWORD
shader_with_ctab
[]
=
{
0xfffe0300
,
/* vs_3_0 */
0x0002fffe
,
FCC_TEXT
,
0x00000000
,
/* TEXT comment */
...
...
@@ -320,7 +328,7 @@ static void test_find_shader_comment(void)
hr
=
D3DXFindShaderComment
(
shader_with_ctab
,
MAKEFOURCC
(
'C'
,
'T'
,
'A'
,
'B'
),
&
data
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
shader_with_ctab
+
6
,
"Got result %p, expected %p
.
\n
"
,
data
,
shader_with_ctab
+
6
);
ok
(
data
==
shader_with_ctab
+
6
,
"Got result %p, expected %p
\n
"
,
data
,
shader_with_ctab
+
6
);
hr
=
D3DXFindShaderComment
(
shader_with_ctab
,
0
,
&
data
,
&
size
);
ok
(
hr
==
S_FALSE
,
"Got result %x, expected 1 (S_FALSE)
\n
"
,
hr
);
...
...
@@ -334,8 +342,8 @@ static void test_find_shader_comment(void)
hr
=
D3DXFindShaderComment
(
shader_with_ctab
,
MAKEFOURCC
(
'C'
,
'T'
,
'A'
,
'B'
),
&
data
,
&
size
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
shader_with_ctab
+
6
,
"Got result %p, expected %p
.
\n
"
,
data
,
shader_with_ctab
+
6
);
ok
(
size
==
28
,
"Got result %
d
, expected 28
\n
"
,
size
);
ok
(
data
==
shader_with_ctab
+
6
,
"Got result %p, expected %p
\n
"
,
data
,
shader_with_ctab
+
6
);
ok
(
size
==
28
,
"Got result %
u
, expected 28
\n
"
,
size
);
hr
=
D3DXFindShaderComment
(
shader_zero
,
MAKEFOURCC
(
'C'
,
'T'
,
'A'
,
'B'
),
&
data
,
&
size
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"Got result %x, expected %x (D3DXERR_INVALIDDATA)
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
...
...
@@ -351,6 +359,26 @@ static void test_find_shader_comment(void)
ok
(
hr
==
S_FALSE
,
"Got result %x, expected %x (S_FALSE)
\n
"
,
hr
,
S_FALSE
);
ok
(
!
data
,
"Got %p, expected NULL
\n
"
,
data
);
ok
(
!
size
,
"Got %u, expected 0
\n
"
,
size
);
hr
=
D3DXFindShaderComment
(
simple_fx
,
FCC_TEXT
,
&
data
,
&
size
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
simple_fx
+
3
,
"Got result %p, expected %p
\n
"
,
data
,
simple_fx
+
3
);
ok
(
size
==
4
,
"Got result %u, expected 4
\n
"
,
size
);
hr
=
D3DXFindShaderComment
(
simple_tx
,
FCC_TEXT
,
&
data
,
&
size
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
simple_tx
+
3
,
"Got result %p, expected %p
\n
"
,
data
,
simple_tx
+
3
);
ok
(
size
==
4
,
"Got result %u, expected 4
\n
"
,
size
);
hr
=
D3DXFindShaderComment
(
simple_7ffe
,
FCC_TEXT
,
&
data
,
&
size
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
simple_7ffe
+
3
,
"Got result %p, expected %p
\n
"
,
data
,
simple_7ffe
+
3
);
ok
(
size
==
4
,
"Got result %u, expected 4
\n
"
,
size
);
hr
=
D3DXFindShaderComment
(
simple_7fff
,
FCC_TEXT
,
&
data
,
&
size
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
ok
(
data
==
simple_7fff
+
3
,
"Got result %p, expected %p
\n
"
,
data
,
simple_7fff
+
3
);
ok
(
size
==
4
,
"Got result %u, expected 4
\n
"
,
size
);
}
static
void
test_get_shader_constant_table_ex
(
void
)
...
...
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