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
62288d02
Commit
62288d02
authored
Feb 24, 2014
by
Matteo Bruni
Committed by
Alexandre Julliard
Feb 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Call D3DCompile() for ASCII effects.
parent
b86b3dfa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
23 deletions
+67
-23
effect.c
dlls/d3dx9_36/effect.c
+55
-21
effect.c
dlls/d3dx9_36/tests/effect.c
+12
-2
No files found.
dlls/d3dx9_36/effect.c
View file @
62288d02
...
...
@@ -26,6 +26,7 @@
#include "windef.h"
#include "wingdi.h"
#include "d3dx9_36_private.h"
#include "d3dcompiler.h"
/* Constants for special INT/FLOAT conversation */
#define INT_FLOAT_MULTI 255.0f
...
...
@@ -5188,11 +5189,13 @@ err_out:
}
static
HRESULT
d3dx9_base_effect_init
(
struct
d3dx9_base_effect
*
base
,
const
char
*
data
,
SIZE_T
data_size
,
struct
ID3DXEffectImpl
*
effect
)
const
char
*
data
,
SIZE_T
data_size
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
UINT
eflags
,
ID3DBlob
**
errors
,
struct
ID3DXEffectImpl
*
effect
)
{
DWORD
tag
,
offset
;
const
char
*
ptr
=
data
;
HRESULT
hr
;
ID3DBlob
*
bytecode
=
NULL
,
*
temp_errors
=
NULL
;
TRACE
(
"base %p, data %p, data_size %lu, effect %p
\n
"
,
base
,
data
,
data_size
,
effect
);
...
...
@@ -5203,30 +5206,55 @@ static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base,
if
(
tag
!=
d3dx9_effect_version
(
9
,
1
))
{
/* todo: compile hlsl ascii code */
FIXME
(
"HLSL ascii effects not supported, yet
\n
"
);
/* Show the start of the shader for debugging info. */
TRACE
(
"effect:
\n
%s
\n
"
,
debugstr_an
(
data
,
data_size
>
40
?
40
:
data_size
));
}
else
{
read_dword
(
&
ptr
,
&
offset
);
TRACE
(
"Offset: %x
\n
"
,
offset
);
hr
=
d3dx9_parse_effect
(
base
,
ptr
,
data_size
,
offset
);
if
(
hr
!=
D3D_OK
)
TRACE
(
"HLSL ASCII effect, trying to compile it.
\n
"
);
hr
=
D3DCompile
(
data
,
data_size
,
NULL
,
defines
,
include
,
"main"
,
"fx_2_0"
,
0
,
eflags
,
&
bytecode
,
&
temp_errors
);
if
(
FAILED
(
hr
))
{
FIXME
(
"Failed to parse effect.
\n
"
);
WARN
(
"Failed to compile ASCII effect.
\n
"
);
if
(
bytecode
)
ID3D10Blob_Release
(
bytecode
);
if
(
temp_errors
)
TRACE
(
"%s
\n
"
,
(
char
*
)
ID3D10Blob_GetBufferPointer
(
temp_errors
));
if
(
errors
)
*
errors
=
temp_errors
;
else
if
(
temp_errors
)
ID3D10Blob_Release
(
temp_errors
);
return
hr
;
}
if
(
!
bytecode
)
{
FIXME
(
"No output from effect compilation.
\n
"
);
return
D3DERR_INVALIDCALL
;
}
if
(
errors
)
*
errors
=
temp_errors
;
else
if
(
temp_errors
)
ID3D10Blob_Release
(
temp_errors
);
ptr
=
ID3D10Blob_GetBufferPointer
(
bytecode
);
read_dword
(
&
ptr
,
&
tag
);
TRACE
(
"Tag: %x
\n
"
,
tag
);
}
read_dword
(
&
ptr
,
&
offset
);
TRACE
(
"Offset: %x
\n
"
,
offset
);
hr
=
d3dx9_parse_effect
(
base
,
ptr
,
data_size
,
offset
);
if
(
bytecode
)
ID3D10Blob_Release
(
bytecode
);
if
(
hr
!=
D3D_OK
)
{
FIXME
(
"Failed to parse effect.
\n
"
);
return
hr
;
}
return
D3D_OK
;
}
static
HRESULT
d3dx9_effect_init
(
struct
ID3DXEffectImpl
*
effect
,
struct
IDirect3DDevice9
*
device
,
const
char
*
data
,
SIZE_T
data_size
,
struct
ID3DXEffectPool
*
pool
)
const
char
*
data
,
SIZE_T
data_size
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
UINT
eflags
,
ID3DBlob
**
error_messages
,
struct
ID3DXEffectPool
*
pool
)
{
HRESULT
hr
;
...
...
@@ -5241,7 +5269,8 @@ static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, struct IDirect3
IDirect3DDevice9_AddRef
(
device
);
effect
->
device
=
device
;
if
(
FAILED
(
hr
=
d3dx9_base_effect_init
(
&
effect
->
base_effect
,
data
,
data_size
,
effect
)))
if
(
FAILED
(
hr
=
d3dx9_base_effect_init
(
&
effect
->
base_effect
,
data
,
data_size
,
defines
,
include
,
eflags
,
error_messages
,
effect
)))
{
FIXME
(
"Failed to parse effect, hr %#x.
\n
"
,
hr
);
free_effect
(
effect
);
...
...
@@ -5285,7 +5314,8 @@ HRESULT WINAPI D3DXCreateEffectEx(struct IDirect3DDevice9 *device, const void *s
if
(
!
object
)
return
E_OUTOFMEMORY
;
hr
=
d3dx9_effect_init
(
object
,
device
,
srcdata
,
srcdatalen
,
pool
);
hr
=
d3dx9_effect_init
(
object
,
device
,
srcdata
,
srcdatalen
,
(
const
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
flags
,
(
ID3DBlob
**
)
compilation_errors
,
pool
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize shader reflection
\n
"
);
...
...
@@ -5310,7 +5340,9 @@ HRESULT WINAPI D3DXCreateEffect(struct IDirect3DDevice9 *device, const void *src
return
D3DXCreateEffectEx
(
device
,
srcdata
,
srcdatalen
,
defines
,
include
,
NULL
,
flags
,
pool
,
effect
,
compilation_errors
);
}
static
HRESULT
d3dx9_effect_compiler_init
(
struct
ID3DXEffectCompilerImpl
*
compiler
,
const
char
*
data
,
SIZE_T
data_size
)
static
HRESULT
d3dx9_effect_compiler_init
(
struct
ID3DXEffectCompilerImpl
*
compiler
,
const
char
*
data
,
SIZE_T
data_size
,
const
D3D_SHADER_MACRO
*
defines
,
ID3DInclude
*
include
,
UINT
eflags
,
ID3DBlob
**
error_messages
)
{
HRESULT
hr
;
...
...
@@ -5319,7 +5351,8 @@ static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compil
compiler
->
ID3DXEffectCompiler_iface
.
lpVtbl
=
&
ID3DXEffectCompiler_Vtbl
;
compiler
->
ref
=
1
;
if
(
FAILED
(
hr
=
d3dx9_base_effect_init
(
&
compiler
->
base_effect
,
data
,
data_size
,
NULL
)))
if
(
FAILED
(
hr
=
d3dx9_base_effect_init
(
&
compiler
->
base_effect
,
data
,
data_size
,
defines
,
include
,
eflags
,
error_messages
,
NULL
)))
{
FIXME
(
"Failed to parse effect, hr %#x.
\n
"
,
hr
);
free_effect_compiler
(
compiler
);
...
...
@@ -5348,7 +5381,8 @@ HRESULT WINAPI D3DXCreateEffectCompiler(const char *srcdata, UINT srcdatalen, co
if
(
!
object
)
return
E_OUTOFMEMORY
;
hr
=
d3dx9_effect_compiler_init
(
object
,
srcdata
,
srcdatalen
);
hr
=
d3dx9_effect_compiler_init
(
object
,
srcdata
,
srcdatalen
,
(
const
D3D_SHADER_MACRO
*
)
defines
,
(
ID3DInclude
*
)
include
,
flags
,
(
ID3DBlob
**
)
parse_errors
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to initialize effect compiler
\n
"
);
...
...
dlls/d3dx9_36/tests/effect.c
View file @
62288d02
...
...
@@ -156,7 +156,12 @@ static void test_create_effect_and_pool(IDirect3DDevice9 *device)
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
hr
=
D3DXCreateEffect
(
device
,
effect_desc
,
sizeof
(
effect_desc
),
NULL
,
NULL
,
0
,
NULL
,
&
effect
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Got result %x, expected 0 (D3D_OK)
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Failed to compile effect, skipping test.
\n
"
);
return
;
}
hr
=
effect
->
lpVtbl
->
QueryInterface
(
effect
,
&
IID_ID3DXBaseEffect
,
(
void
**
)
&
base
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface failed, got %x, expected %x (E_NOINTERFACE)
\n
"
,
hr
,
E_NOINTERFACE
);
...
...
@@ -265,7 +270,12 @@ static void test_create_effect_compiler(void)
ok
(
hr
==
D3DERR_INVALIDCALL
,
"Got result %x, expected %x (D3D_INVALIDCALL)
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXCreateEffectCompiler
(
effect_desc
,
0
,
NULL
,
NULL
,
0
,
&
compiler
,
NULL
);
ok
(
hr
==
D3D_OK
,
"Got result %x, expected %x (D3D_OK)
\n
"
,
hr
,
D3D_OK
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Got result %x, expected %x (D3D_OK)
\n
"
,
hr
,
D3D_OK
);
if
(
FAILED
(
hr
))
{
skip
(
"D3DXCreateEffectCompiler failed, skipping test.
\n
"
);
return
;
}
count
=
compiler
->
lpVtbl
->
Release
(
compiler
);
ok
(
count
==
0
,
"Release failed %u
\n
"
,
count
);
...
...
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