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
1474f5cc
Commit
1474f5cc
authored
Nov 02, 2022
by
Fan Wenjie
Committed by
Alexandre Julliard
Jan 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Compile sm1 bytecode to spirv.
parent
9e094def
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
20 deletions
+29
-20
shader.c
dlls/wined3d/shader.c
+7
-8
shader_spirv.c
dlls/wined3d/shader_spirv.c
+21
-12
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/shader.c
View file @
1474f5cc
...
...
@@ -2395,7 +2395,6 @@ static void shader_trace(const void *code, size_t size, enum vkd3d_shader_source
static
HRESULT
shader_init
(
struct
wined3d_shader
*
shader
,
struct
wined3d_device
*
device
,
const
struct
wined3d_shader_desc
*
desc
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
)
{
enum
vkd3d_shader_source_type
source_type
;
HRESULT
hr
;
TRACE
(
"byte_code %p, byte_code_size %#lx.
\n
"
,
desc
->
byte_code
,
(
long
)
desc
->
byte_code_size
);
...
...
@@ -2424,8 +2423,8 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
const
DWORD
*
ptr
;
void
*
fe_data
;
source_type
=
VKD3D_SHADER_SOURCE_D3D_BYTECODE
;
if
(
!
(
shader
->
frontend
=
shader_select_frontend
(
source_type
)))
s
hader
->
s
ource_type
=
VKD3D_SHADER_SOURCE_D3D_BYTECODE
;
if
(
!
(
shader
->
frontend
=
shader_select_frontend
(
s
hader
->
s
ource_type
)))
{
FIXME
(
"Unable to find frontend for shader.
\n
"
);
hr
=
WINED3DERR_INVALIDCALL
;
...
...
@@ -2471,10 +2470,10 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
shader
->
byte_code_size
=
desc
->
byte_code_size
;
max_version
=
shader_max_version_from_feature_level
(
device
->
cs
->
c
.
state
->
feature_level
);
if
(
FAILED
(
hr
=
wined3d_shader_extract_from_dxbc
(
shader
,
max_version
,
&
source_type
)))
if
(
FAILED
(
hr
=
wined3d_shader_extract_from_dxbc
(
shader
,
max_version
,
&
s
hader
->
s
ource_type
)))
goto
fail
;
if
(
!
(
shader
->
frontend
=
shader_select_frontend
(
source_type
)))
if
(
!
(
shader
->
frontend
=
shader_select_frontend
(
s
hader
->
s
ource_type
)))
{
FIXME
(
"Unable to find frontend for shader.
\n
"
);
hr
=
WINED3DERR_INVALIDCALL
;
...
...
@@ -2484,10 +2483,10 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
if
(
TRACE_ON
(
d3d_shader
))
{
if
(
source_type
==
VKD3D_SHADER_SOURCE_D3D_BYTECODE
)
shader_trace
(
shader
->
function
,
shader
->
functionLength
,
source_type
);
if
(
s
hader
->
s
ource_type
==
VKD3D_SHADER_SOURCE_D3D_BYTECODE
)
shader_trace
(
shader
->
function
,
shader
->
functionLength
,
s
hader
->
s
ource_type
);
else
shader_trace
(
shader
->
byte_code
,
shader
->
byte_code_size
,
source_type
);
shader_trace
(
shader
->
byte_code
,
shader
->
byte_code_size
,
s
hader
->
s
ource_type
);
}
...
...
dlls/wined3d/shader_spirv.c
View file @
1474f5cc
...
...
@@ -228,9 +228,9 @@ static void shader_spirv_init_shader_interface_vk(struct wined3d_shader_spirv_sh
}
static
VkShaderModule
shader_spirv_compile_shader
(
struct
wined3d_context_vk
*
context_vk
,
const
struct
wined3d_shader_desc
*
shader_desc
,
enum
wined3d_shader_type
shader
_type
,
const
struct
shader_spirv_compile_arguments
*
args
,
const
struct
shader_spirv_resource_bindings
*
bindin
gs
,
const
struct
wined3d_stream_output_desc
*
so_desc
)
const
struct
wined3d_shader_desc
*
shader_desc
,
enum
vkd3d_shader_source_type
source
_type
,
enum
wined3d_shader_type
shader_type
,
const
struct
shader_spirv_compile_arguments
*
ar
gs
,
const
struct
shader_spirv_resource_bindings
*
bindings
,
const
struct
wined3d_stream_output_desc
*
so_desc
)
{
struct
wined3d_shader_spirv_compile_args
compile_args
;
struct
wined3d_shader_spirv_shader_interface
iface
;
...
...
@@ -252,7 +252,7 @@ static VkShaderModule shader_spirv_compile_shader(struct wined3d_context_vk *con
info
.
next
=
&
compile_args
.
spirv_target
;
info
.
source
.
code
=
shader_desc
->
byte_code
;
info
.
source
.
size
=
shader_desc
->
byte_code_size
;
info
.
source_type
=
VKD3D_SHADER_SOURCE_DXBC_TPF
;
info
.
source_type
=
source_type
;
info
.
target_type
=
VKD3D_SHADER_TARGET_SPIRV_BINARY
;
info
.
options
=
spirv_compile_options
;
info
.
option_count
=
ARRAY_SIZE
(
spirv_compile_options
);
...
...
@@ -338,11 +338,19 @@ static struct shader_spirv_graphics_program_variant_vk *shader_spirv_find_graphi
variant_vk
->
compile_args
=
args
;
variant_vk
->
binding_base
=
binding_base
;
shader_desc
.
byte_code
=
shader
->
byte_code
;
shader_desc
.
byte_code_size
=
shader
->
byte_code_size
;
if
(
shader
->
source_type
==
VKD3D_SHADER_SOURCE_D3D_BYTECODE
)
{
shader_desc
.
byte_code
=
shader
->
function
;
shader_desc
.
byte_code_size
=
shader
->
functionLength
;
}
else
{
shader_desc
.
byte_code
=
shader
->
byte_code
;
shader_desc
.
byte_code_size
=
shader
->
byte_code_size
;
}
if
(
!
(
variant_vk
->
vk_module
=
shader_spirv_compile_shader
(
context_vk
,
&
shader_desc
,
shader_type
,
&
args
,
bindings
,
so_desc
)))
if
(
!
(
variant_vk
->
vk_module
=
shader_spirv_compile_shader
(
context_vk
,
&
shader_desc
,
shader
->
source_type
,
shader_type
,
&
args
,
bindings
,
so_desc
)))
return
NULL
;
++
program_vk
->
variant_count
;
...
...
@@ -370,8 +378,8 @@ static struct shader_spirv_compute_program_vk *shader_spirv_find_compute_program
shader_desc
.
byte_code
=
shader
->
byte_code
;
shader_desc
.
byte_code_size
=
shader
->
byte_code_size
;
if
(
!
(
program
->
vk_module
=
shader_spirv_compile_shader
(
context_vk
,
&
shader_desc
,
WINED3D_SHADER_TYPE_COMPUTE
,
NULL
,
bindings
,
NULL
)))
if
(
!
(
program
->
vk_module
=
shader_spirv_compile_shader
(
context_vk
,
&
shader_desc
,
shader
->
source_type
,
WINED3D_SHADER_TYPE_COMPUTE
,
NULL
,
bindings
,
NULL
)))
return
NULL
;
if
(
!
(
layout
=
wined3d_context_vk_get_pipeline_layout
(
context_vk
,
...
...
@@ -692,7 +700,7 @@ static void shader_spirv_scan_shader(struct wined3d_shader *shader,
info
.
next
=
descriptor_info
;
info
.
source
.
code
=
shader
->
byte_code
;
info
.
source
.
size
=
shader
->
byte_code_size
;
info
.
source_type
=
VKD3D_SHADER_SOURCE_DXBC_TPF
;
info
.
source_type
=
shader
->
source_type
;
info
.
target_type
=
VKD3D_SHADER_TARGET_SPIRV_BINARY
;
info
.
options
=
spirv_compile_options
;
info
.
option_count
=
ARRAY_SIZE
(
spirv_compile_options
);
...
...
@@ -1049,7 +1057,8 @@ static uint64_t shader_spirv_compile(struct wined3d_context *context, const stru
enum
wined3d_shader_type
shader_type
)
{
struct
shader_spirv_resource_bindings
bindings
=
{
0
};
return
(
uint64_t
)
shader_spirv_compile_shader
(
wined3d_context_vk
(
context
),
shader_desc
,
shader_type
,
NULL
,
&
bindings
,
NULL
);
return
(
uint64_t
)
shader_spirv_compile_shader
(
wined3d_context_vk
(
context
),
shader_desc
,
VKD3D_SHADER_SOURCE_DXBC_TPF
,
shader_type
,
NULL
,
&
bindings
,
NULL
);
}
static
const
struct
wined3d_shader_backend_ops
spirv_shader_backend_vk
=
...
...
dlls/wined3d/wined3d_private.h
View file @
1474f5cc
...
...
@@ -4251,6 +4251,7 @@ struct wined3d_shader
void
*
byte_code
;
unsigned
int
byte_code_size
;
BOOL
load_local_constsF
;
enum
vkd3d_shader_source_type
source_type
;
const
struct
wined3d_shader_frontend
*
frontend
;
void
*
frontend_data
;
void
*
backend_data
;
...
...
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