Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
vkd3d
Manage
Activity
Members
Labels
Plan
Wiki
Bugzilla
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wine
vkd3d
Commits
78a08519
Commit
78a08519
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d-shader: Use vkd3d_get_spirv_builtin() directly.
parent
9d944ad9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/vkd3d-shader/spirv.c
+30
-40
30 additions, 40 deletions
libs/vkd3d-shader/spirv.c
with
30 additions
and
40 deletions
libs/vkd3d-shader/spirv.c
+
30
−
40
View file @
78a08519
...
...
@@ -1933,40 +1933,11 @@ static const struct vkd3d_spirv_builtin *vkd3d_get_spirv_builtin(enum vkd3d_shad
return
NULL
;
}
static
enum
vkd3d_component_type
vkd3d_component_type_for_register
(
enum
vkd3d_shader_register_type
reg_type
,
enum
vkd3d_shader_input_sysval_semantic
sysval
)
{
const
struct
vkd3d_spirv_builtin
*
builtin
;
if
((
builtin
=
vkd3d_get_spirv_builtin
(
reg_type
,
sysval
)))
return
builtin
->
component_type
;
return
VKD3D_TYPE_FLOAT
;
}
static
unsigned
int
vkd3d_component_count_for_register
(
enum
vkd3d_shader_register_type
reg_type
,
enum
vkd3d_shader_input_sysval_semantic
sysval
)
{
const
struct
vkd3d_spirv_builtin
*
builtin
;
if
((
builtin
=
vkd3d_get_spirv_builtin
(
reg_type
,
sysval
)))
return
builtin
->
component_count
;
return
0
;
}
static
void
vkd3d_dxbc_compiler_decorate_builtin
(
struct
vkd3d_dxbc_compiler
*
compiler
,
uint32_t
target_id
,
enum
vkd3d_shader_register_type
reg_type
,
enum
vkd3d_shader_input_sysval_semantic
sysval
)
uint32_t
target_id
,
SpvBuiltIn
builtin
)
{
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
const
struct
vkd3d_spirv_builtin
*
builtin_info
;
SpvBuiltIn
builtin
;
if
(
!
(
builtin_info
=
vkd3d_get_spirv_builtin
(
reg_type
,
sysval
)))
return
;
builtin
=
builtin_info
->
spirv_builtin
;
if
(
compiler
->
shader_type
==
VKD3D_SHADER_TYPE_PIXEL
&&
builtin
==
SpvBuiltInPosition
)
builtin
=
SpvBuiltInFragCoord
;
...
...
@@ -1978,6 +1949,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
{
unsigned
int
component_idx
,
component_count
,
input_component_count
;
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
const
struct
vkd3d_spirv_builtin
*
builtin
;
enum
vkd3d_component_type
component_type
;
uint32_t
val_id
=
0
,
input_id
,
var_id
;
struct
vkd3d_symbol
reg_symbol
;
...
...
@@ -1985,6 +1957,8 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
struct
rb_entry
*
entry
=
NULL
;
bool
use_private_var
=
false
;
builtin
=
vkd3d_get_spirv_builtin
(
dst
->
reg
.
type
,
sysval
);
/* vThreadIDInGroupFlattened is declared with no write mask in shader
* bytecode generated by fxc. */
if
(
!
dst
->
write_mask
&&
dst
->
reg
.
type
==
VKD3DSPR_LOCALTHREADINDEX
)
...
...
@@ -1997,19 +1971,25 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
component_idx
=
vkd3d_write_mask_get_component_idx
(
dst
->
write_mask
);
component_count
=
vkd3d_write_mask_component_count
(
dst
->
write_mask
);
}
component_type
=
vkd3d_component_type_for_register
(
dst
->
reg
.
type
,
sysval
);
if
(
!
(
input_component_count
=
vkd3d_component_count_for_register
(
dst
->
reg
.
type
,
sysval
)))
if
(
builtin
)
{
component_type
=
builtin
->
component_type
;
input_component_count
=
builtin
->
component_count
;
}
else
{
component_type
=
VKD3D_TYPE_FLOAT
;
input_component_count
=
component_count
;
}
assert
(
component_count
<=
input_component_count
);
storage_class
=
SpvStorageClassInput
;
input_id
=
vkd3d_dxbc_compiler_emit_variable
(
compiler
,
&
builder
->
global_stream
,
storage_class
,
component_type
,
input_component_count
);
vkd3d_spirv_add_iface_variable
(
builder
,
input_id
);
if
(
dst
->
reg
.
type
==
VKD3DSPR_THREADID
||
dst
->
reg
.
type
==
VKD3DSPR_LOCALTHREADID
||
dst
->
reg
.
type
==
VKD3DSPR_LOCALTHREADINDEX
||
sysval
)
if
(
builtin
)
{
vkd3d_dxbc_compiler_decorate_builtin
(
compiler
,
input_id
,
dst
->
reg
.
type
,
sysval
);
vkd3d_dxbc_compiler_decorate_builtin
(
compiler
,
input_id
,
builtin
->
spirv_builtin
);
if
(
component_idx
)
FIXME
(
"Unhandled component index %u.
\n
"
,
component_idx
);
}
...
...
@@ -2073,6 +2053,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp
const
struct
vkd3d_shader_signature_element
*
signature_element
;
const
struct
vkd3d_shader_register
*
reg
=
&
dst
->
reg
;
const
struct
vkd3d_shader_signature
*
signature
;
const
struct
vkd3d_spirv_builtin
*
builtin
;
enum
vkd3d_component_type
component_type
;
struct
vkd3d_symbol
reg_symbol
;
SpvStorageClass
storage_class
;
...
...
@@ -2081,12 +2062,21 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp
bool
use_private_variable
;
uint32_t
id
,
var_id
;
builtin
=
vkd3d_get_spirv_builtin
(
dst
->
reg
.
type
,
sysval
);
component_idx
=
vkd3d_write_mask_get_component_idx
(
dst
->
write_mask
);
component_count
=
vkd3d_write_mask_component_count
(
dst
->
write_mask
);
/* FIXME: Consider output signature when choosing component type for output variable. */
component_type
=
vkd3d_component_type_for_register
(
reg
->
type
,
sysval
);
if
(
!
(
output_component_count
=
vkd3d_component_count_for_register
(
reg
->
type
,
sysval
)))
if
(
builtin
)
{
component_type
=
builtin
->
component_type
;
output_component_count
=
builtin
->
component_count
;
}
else
{
/* FIXME: Consider output signature when choosing component type for output variable. */
component_type
=
VKD3D_TYPE_FLOAT
;
output_component_count
=
component_count
;
}
assert
(
component_count
<=
output_component_count
);
signature_element
=
NULL
;
...
...
@@ -2110,9 +2100,9 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp
id
=
vkd3d_dxbc_compiler_emit_variable
(
compiler
,
&
builder
->
global_stream
,
storage_class
,
component_type
,
component_count
);
vkd3d_spirv_add_iface_variable
(
builder
,
id
);
if
(
sysval
)
if
(
builtin
)
{
vkd3d_dxbc_compiler_decorate_builtin
(
compiler
,
id
,
reg
->
type
,
sysval
);
vkd3d_dxbc_compiler_decorate_builtin
(
compiler
,
id
,
builtin
->
spirv_builtin
);
if
(
component_idx
)
FIXME
(
"Unhandled component index %u.
\n
"
,
component_idx
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment