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
e08c0cfc
Commit
e08c0cfc
authored
1 year ago
by
Conor McCarthy
Committed by
Alexandre Julliard
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
vkd3d-shader/dxil: Implement DX intrinsic RawBufferLoad.
parent
1bab9384
No related branches found
No related tags found
1 merge request
!583
vkd3d-shader/dxil: SRV/UAV support part 2.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libs/vkd3d-shader/dxil.c
+62
-0
62 additions, 0 deletions
libs/vkd3d-shader/dxil.c
with
62 additions
and
0 deletions
libs/vkd3d-shader/dxil.c
+
62
−
0
View file @
e08c0cfc
...
...
@@ -363,6 +363,7 @@ enum dx_intrinsic_opcode
DX_DERIV_FINEY
=
86
,
DX_LEGACY_F32TOF16
=
130
,
DX_LEGACY_F16TOF32
=
131
,
DX_RAW_BUFFER_LOAD
=
139
,
};
enum
dxil_cast_code
...
...
@@ -2078,6 +2079,8 @@ static void instruction_init_with_resource(struct vkd3d_shader_instruction *ins,
{
vsir_instruction_init
(
ins
,
&
sm6
->
p
.
location
,
handler_idx
);
ins
->
resource_type
=
resource
->
u
.
handle
.
d
->
resource_type
;
ins
->
raw
=
resource
->
u
.
handle
.
d
->
kind
==
RESOURCE_KIND_RAWBUFFER
;
ins
->
structured
=
resource
->
u
.
handle
.
d
->
kind
==
RESOURCE_KIND_STRUCTUREDBUFFER
;
}
static
struct
vkd3d_shader_src_param
*
instruction_src_params_alloc
(
struct
vkd3d_shader_instruction
*
ins
,
...
...
@@ -3100,6 +3103,15 @@ static void dst_param_io_init(struct vkd3d_shader_dst_param *param,
param
->
reg
.
dimension
=
VSIR_DIMENSION_VEC4
;
}
static
void
src_params_init_from_operands
(
struct
vkd3d_shader_src_param
*
src_params
,
const
struct
sm6_value
**
operands
,
unsigned
int
count
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
count
;
++
i
)
src_param_init_from_value
(
&
src_params
[
i
],
operands
[
i
]);
}
static
void
sm6_parser_init_signature
(
struct
sm6_parser
*
sm6
,
const
struct
shader_signature
*
s
,
enum
vkd3d_shader_register_type
reg_type
,
struct
vkd3d_shader_dst_param
*
params
)
{
...
...
@@ -3722,6 +3734,49 @@ static void sm6_parser_emit_dx_load_input(struct sm6_parser *sm6, enum dx_intrin
instruction_dst_param_init_ssa_scalar
(
ins
,
sm6
);
}
static
void
sm6_parser_emit_dx_raw_buffer_load
(
struct
sm6_parser
*
sm6
,
enum
dx_intrinsic_opcode
op
,
const
struct
sm6_value
**
operands
,
struct
function_emission_state
*
state
)
{
unsigned
int
operand_count
,
write_mask
,
component_count
=
VKD3D_VEC4_SIZE
;
struct
vkd3d_shader_instruction
*
ins
=
state
->
ins
;
struct
vkd3d_shader_src_param
*
src_params
;
const
struct
sm6_value
*
resource
;
bool
raw
;
resource
=
operands
[
0
];
if
(
!
sm6_value_validate_is_handle
(
resource
,
sm6
))
return
;
raw
=
resource
->
u
.
handle
.
d
->
kind
==
RESOURCE_KIND_RAWBUFFER
;
if
(
op
==
DX_RAW_BUFFER_LOAD
)
{
write_mask
=
sm6_value_get_constant_uint
(
operands
[
3
]);
if
(
!
write_mask
||
write_mask
>
VKD3DSP_WRITEMASK_ALL
)
{
WARN
(
"Invalid write mask %#x.
\n
"
,
write_mask
);
vkd3d_shader_parser_error
(
&
sm6
->
p
,
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND
,
"Write mask %#x for a raw/structured buffer load operation is invalid."
,
write_mask
);
return
;
}
else
if
(
write_mask
&
(
write_mask
+
1
))
{
FIXME
(
"Unhandled write mask %#x.
\n
"
,
write_mask
);
vkd3d_shader_parser_error
(
&
sm6
->
p
,
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND
,
"Write mask %#x for a raw/structured buffer load operation is unhandled."
,
write_mask
);
}
component_count
=
vsir_write_mask_component_count
(
write_mask
);
}
instruction_init_with_resource
(
ins
,
raw
?
VKD3DSIH_LD_RAW
:
VKD3DSIH_LD_STRUCTURED
,
resource
,
sm6
);
operand_count
=
2
+
!
raw
;
if
(
!
(
src_params
=
instruction_src_params_alloc
(
ins
,
operand_count
,
sm6
)))
return
;
src_params_init_from_operands
(
src_params
,
&
operands
[
1
],
operand_count
-
1
);
src_param_init_vector_from_reg
(
&
src_params
[
operand_count
-
1
],
&
resource
->
u
.
handle
.
reg
);
instruction_dst_param_init_ssa_vector
(
ins
,
component_count
,
sm6
);
}
static
void
sm6_parser_emit_dx_buffer_load
(
struct
sm6_parser
*
sm6
,
enum
dx_intrinsic_opcode
op
,
const
struct
sm6_value
**
operands
,
struct
function_emission_state
*
state
)
{
...
...
@@ -3733,6 +3788,12 @@ static void sm6_parser_emit_dx_buffer_load(struct sm6_parser *sm6, enum dx_intri
if
(
!
sm6_value_validate_is_handle
(
resource
,
sm6
))
return
;
if
(
resource
->
u
.
handle
.
d
->
kind
==
RESOURCE_KIND_RAWBUFFER
||
resource
->
u
.
handle
.
d
->
kind
==
RESOURCE_KIND_STRUCTUREDBUFFER
)
{
return
sm6_parser_emit_dx_raw_buffer_load
(
sm6
,
op
,
operands
,
state
);
}
if
(
resource
->
u
.
handle
.
d
->
kind
!=
RESOURCE_KIND_TYPEDBUFFER
)
{
WARN
(
"Resource is not a typed buffer.
\n
"
);
...
...
@@ -3884,6 +3945,7 @@ static const struct sm6_dx_opcode_info sm6_dx_op_table[] =
[
DX_LEGACY_F32TOF16
]
=
{
"i"
,
"f"
,
sm6_parser_emit_dx_unary
},
[
DX_LOAD_INPUT
]
=
{
"o"
,
"ii8i"
,
sm6_parser_emit_dx_load_input
},
[
DX_LOG
]
=
{
"g"
,
"R"
,
sm6_parser_emit_dx_unary
},
[
DX_RAW_BUFFER_LOAD
]
=
{
"o"
,
"Hii8i"
,
sm6_parser_emit_dx_raw_buffer_load
},
[
DX_ROUND_NE
]
=
{
"g"
,
"R"
,
sm6_parser_emit_dx_unary
},
[
DX_ROUND_NI
]
=
{
"g"
,
"R"
,
sm6_parser_emit_dx_unary
},
[
DX_ROUND_PI
]
=
{
"g"
,
"R"
,
sm6_parser_emit_dx_unary
},
...
...
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