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
d01ae151
Commit
d01ae151
authored
Mar 10, 2024
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 12, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Set correct compilation target for effects profiles.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
e21244f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
41 deletions
+47
-41
compiler.c
dlls/d3dcompiler_43/compiler.c
+46
-31
effect.c
dlls/d3dx9_36/tests/effect.c
+1
-10
No files found.
dlls/d3dcompiler_43/compiler.c
View file @
d01ae151
...
...
@@ -397,29 +397,12 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena
return
hr
;
}
HRESULT
WINAPI
D3DCompile2
(
const
void
*
data
,
SIZE_T
data_size
,
const
char
*
filename
,
const
D3D_SHADER_MACRO
*
macros
,
ID3DInclude
*
include
,
const
char
*
entry_point
,
const
char
*
profile
,
UINT
flags
,
UINT
effect_flags
,
UINT
secondary_flags
,
const
void
*
secondary_data
,
SIZE_T
secondary_data_size
,
ID3DBlob
**
shader_blob
,
ID3DBlob
**
messages_blob
)
static
enum
vkd3d_shader_target_type
get_target_for_profile
(
const
char
*
profile
)
{
struct
d3dcompiler_include_from_file
include_from_file
;
struct
vkd3d_shader_preprocess_info
preprocess_info
;
struct
vkd3d_shader_hlsl_source_info
hlsl_info
;
struct
vkd3d_shader_compile_option
options
[
4
];
struct
vkd3d_shader_compile_info
compile_info
;
struct
vkd3d_shader_compile_option
*
option
;
struct
vkd3d_shader_code
byte_code
;
const
D3D_SHADER_MACRO
*
macro
;
size_t
profile_len
,
i
;
char
*
messages
;
HRESULT
hr
;
int
ret
;
static
const
char
*
const
d3dbc_profiles
[]
=
{
"fx_2_"
,
"ps.1."
,
"ps.2."
,
"ps.3."
,
...
...
@@ -439,6 +422,50 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
"tx_1_"
,
};
static
const
char
*
const
fx_profiles
[]
=
{
"fx_2_0"
,
"fx_4_0"
,
"fx_4_1"
,
"fx_5_0"
,
};
profile_len
=
strlen
(
profile
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
d3dbc_profiles
);
++
i
)
{
size_t
len
=
strlen
(
d3dbc_profiles
[
i
]);
if
(
len
<=
profile_len
&&
!
memcmp
(
profile
,
d3dbc_profiles
[
i
],
len
))
return
VKD3D_SHADER_TARGET_D3D_BYTECODE
;
}
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
fx_profiles
);
++
i
)
{
if
(
!
strcmp
(
profile
,
fx_profiles
[
i
]))
return
VKD3D_SHADER_TARGET_FX
;
}
return
VKD3D_SHADER_TARGET_DXBC_TPF
;
}
HRESULT
WINAPI
D3DCompile2
(
const
void
*
data
,
SIZE_T
data_size
,
const
char
*
filename
,
const
D3D_SHADER_MACRO
*
macros
,
ID3DInclude
*
include
,
const
char
*
entry_point
,
const
char
*
profile
,
UINT
flags
,
UINT
effect_flags
,
UINT
secondary_flags
,
const
void
*
secondary_data
,
SIZE_T
secondary_data_size
,
ID3DBlob
**
shader_blob
,
ID3DBlob
**
messages_blob
)
{
struct
d3dcompiler_include_from_file
include_from_file
;
struct
vkd3d_shader_preprocess_info
preprocess_info
;
struct
vkd3d_shader_hlsl_source_info
hlsl_info
;
struct
vkd3d_shader_compile_option
options
[
4
];
struct
vkd3d_shader_compile_info
compile_info
;
struct
vkd3d_shader_compile_option
*
option
;
struct
vkd3d_shader_code
byte_code
;
const
D3D_SHADER_MACRO
*
macro
;
char
*
messages
;
HRESULT
hr
;
int
ret
;
TRACE
(
"data %p, data_size %Iu, filename %s, macros %p, include %p, entry_point %s, "
"profile %s, flags %#x, effect_flags %#x, secondary_flags %#x, secondary_data %p, "
"secondary_data_size %Iu, shader_blob %p, messages_blob %p.
\n
"
,
...
...
@@ -477,24 +504,12 @@ HRESULT WINAPI D3DCompile2(const void *data, SIZE_T data_size, const char *filen
compile_info
.
source
.
code
=
data
;
compile_info
.
source
.
size
=
data_size
;
compile_info
.
source_type
=
VKD3D_SHADER_SOURCE_HLSL
;
compile_info
.
target_type
=
VKD3D_SHADER_TARGET_DXBC_TPF
;
compile_info
.
target_type
=
get_target_for_profile
(
profile
)
;
compile_info
.
options
=
options
;
compile_info
.
option_count
=
1
;
compile_info
.
log_level
=
VKD3D_SHADER_LOG_INFO
;
compile_info
.
source_name
=
filename
;
profile_len
=
strlen
(
profile
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
d3dbc_profiles
);
++
i
)
{
size_t
len
=
strlen
(
d3dbc_profiles
[
i
]);
if
(
len
<=
profile_len
&&
!
memcmp
(
profile
,
d3dbc_profiles
[
i
],
len
))
{
compile_info
.
target_type
=
VKD3D_SHADER_TARGET_D3D_BYTECODE
;
break
;
}
}
preprocess_info
.
type
=
VKD3D_SHADER_STRUCTURE_TYPE_PREPROCESS_INFO
;
preprocess_info
.
next
=
&
hlsl_info
;
preprocess_info
.
macros
=
(
const
struct
vkd3d_shader_macro
*
)
macros
;
...
...
dlls/d3dx9_36/tests/effect.c
View file @
d01ae151
...
...
@@ -257,12 +257,7 @@ static void test_create_effect_and_pool(IDirect3DDevice9 *device)
ok
(
hr
==
D3D_OK
,
"Got result %lx, expected 0 (D3D_OK)
\n
"
,
hr
);
hr
=
D3DXCreateEffect
(
device
,
effect_desc
,
sizeof
(
effect_desc
),
NULL
,
NULL
,
0
,
NULL
,
&
effect
,
NULL
);
todo_wine
ok
(
hr
==
D3D_OK
,
"Got result %lx, expected 0 (D3D_OK)
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"Failed to compile effect, skipping test.
\n
"
);
return
;
}
ok
(
hr
==
D3D_OK
,
"Got result %lx, expected 0 (D3D_OK)
\n
"
,
hr
);
hr
=
effect
->
lpVtbl
->
QueryInterface
(
effect
,
&
IID_ID3DXBaseEffect
,
(
void
**
)
&
base
);
ok
(
hr
==
E_NOINTERFACE
,
"QueryInterface failed, got %lx, expected %lx (E_NOINTERFACE)
\n
"
,
hr
,
E_NOINTERFACE
);
...
...
@@ -8041,15 +8036,12 @@ static void test_create_effect_from_file(void)
/* This is apparently broken on native, it ends up using the wrong include. */
hr
=
D3DXCreateEffectFromFileExW
(
device
,
filename_w
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
&
effect
,
&
messages
);
todo_wine
ok
(
hr
==
E_FAIL
,
"Unexpected error, hr %#lx.
\n
"
,
hr
);
if
(
messages
)
{
trace
(
"D3DXCreateEffectFromFileExW messages:
\n
%s"
,
(
char
*
)
ID3DXBuffer_GetBufferPointer
(
messages
));
ID3DXBuffer_Release
(
messages
);
}
if
(
effect
)
effect
->
lpVtbl
->
Release
(
effect
);
delete_file
(
"effect1.fx"
);
delete_file
(
"effect2.fx"
);
...
...
@@ -8067,7 +8059,6 @@ static void test_create_effect_from_file(void)
* is "ID3DXEffectCompiler: There were no techniques" */
hr
=
D3DXCreateEffectFromFileExW
(
device
,
filename_w
,
NULL
,
&
include
.
ID3DXInclude_iface
,
NULL
,
0
,
NULL
,
&
effect
,
&
messages
);
todo_wine
ok
(
hr
==
E_FAIL
,
"D3DXInclude test failed with error %#lx.
\n
"
,
hr
);
if
(
messages
)
{
...
...
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