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
5b8d1fbd
Commit
5b8d1fbd
authored
7 years ago
by
Józef Kucia
Browse files
Options
Downloads
Patches
Plain Diff
libs/vkd3d-shader: Implement sample_c_lz.
parent
3019a3e8
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
+29
-6
29 additions, 6 deletions
libs/vkd3d-shader/spirv.c
with
29 additions
and
6 deletions
libs/vkd3d-shader/spirv.c
+
29
−
6
View file @
5b8d1fbd
...
...
@@ -1266,13 +1266,18 @@ static uint32_t vkd3d_spirv_build_op_image_sample_implicit_lod(struct vkd3d_spir
SpvOpImageSampleImplicitLod
,
result_type
,
w
,
i
);
}
static
uint32_t
vkd3d_spirv_build_op_image_sample_dref
_implicit_lod
(
struct
vkd3d_spirv_builder
*
builder
,
uint32_t
result_type
,
uint32_t
sampled_image_id
,
uint32_t
coordinate_id
,
uint32_t
dref_id
,
uint32_t
image_operands
,
const
uint32_t
*
operands
,
unsigned
int
operand_count
)
static
uint32_t
vkd3d_spirv_build_op_image_sample_dref
(
struct
vkd3d_spirv_builder
*
builder
,
SpvOp
op
,
uint32_t
result_type
,
uint32_t
sampled_image_id
,
uint32_t
coordinate_id
,
uint32_t
dref_id
,
uint32_t
image_operands
,
const
uint32_t
*
operands
,
unsigned
int
operand_count
)
{
unsigned
int
i
=
0
,
j
;
uint32_t
w
[
10
];
if
(
op
==
SpvOpImageSampleDrefExplicitLod
)
assert
(
image_operands
&
SpvImageOperandsLodMask
);
else
assert
(
op
==
SpvOpImageSampleDrefImplicitLod
);
w
[
i
++
]
=
sampled_image_id
;
w
[
i
++
]
=
coordinate_id
;
w
[
i
++
]
=
dref_id
;
...
...
@@ -1284,7 +1289,7 @@ static uint32_t vkd3d_spirv_build_op_image_sample_dref_implicit_lod(struct vkd3d
w
[
i
++
]
=
operands
[
j
];
}
return
vkd3d_spirv_build_op_trv
(
builder
,
&
builder
->
function_stream
,
SpvOpImageSampleDrefImplicitLod
,
result_type
,
w
,
i
);
op
,
result_type
,
w
,
i
);
}
static
uint32_t
vkd3d_spirv_build_op_image_fetch
(
struct
vkd3d_spirv_builder
*
builder
,
...
...
@@ -4411,11 +4416,27 @@ static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compil
struct
vkd3d_spirv_builder
*
builder
=
&
compiler
->
spirv_builder
;
const
struct
vkd3d_shader_src_param
*
src
=
instruction
->
src
;
struct
vkd3d_shader_dst_param
dst
=
*
instruction
->
dst
;
SpvImageOperandsMask
operands_mask
=
0
;
unsigned
int
image_operand_count
=
0
;
struct
vkd3d_shader_image
image
;
uint32_t
image_operands
[
1
];
SpvOp
op
;
if
(
vkd3d_shader_instruction_has_texel_offset
(
instruction
))
FIXME
(
"Texel offset not supported.
\n
"
);
if
(
instruction
->
handler_idx
==
VKD3DSIH_SAMPLE_C_LZ
)
{
op
=
SpvOpImageSampleDrefExplicitLod
;
operands_mask
|=
SpvImageOperandsLodMask
;
image_operands
[
image_operand_count
++
]
=
vkd3d_dxbc_compiler_get_constant_float
(
compiler
,
0
.
0
f
);
}
else
{
op
=
SpvOpImageSampleDrefImplicitLod
;
}
vkd3d_dxbc_compiler_prepare_sampled_image
(
compiler
,
&
image
,
&
src
[
1
].
reg
,
&
src
[
2
].
reg
,
VKD3D_IMAGE_FLAG_DEPTH
);
sampled_type_id
=
vkd3d_spirv_get_type_id
(
builder
,
image
.
sampled_type
,
VKD3D_VEC4_SIZE
);
...
...
@@ -4425,8 +4446,9 @@ static void vkd3d_dxbc_compiler_emit_sample_c(struct vkd3d_dxbc_compiler *compil
type_id
=
vkd3d_spirv_get_type_id
(
builder
,
VKD3D_TYPE_FLOAT
,
VKD3D_VEC4_SIZE
);
coordinate_id
=
vkd3d_spirv_build_op_composite_insert
(
builder
,
type_id
,
ref_id
,
coordinate_id
,
&
image
.
resource_type_info
->
coordinate_component_count
,
1
);
val_id
=
vkd3d_spirv_build_op_image_sample_dref_implicit_lod
(
builder
,
sampled_type_id
,
image
.
sampled_image_id
,
coordinate_id
,
ref_id
,
SpvImageOperandsMaskNone
,
NULL
,
0
);
val_id
=
vkd3d_spirv_build_op_image_sample_dref
(
builder
,
op
,
sampled_type_id
,
image
.
sampled_image_id
,
coordinate_id
,
ref_id
,
operands_mask
,
image_operands
,
image_operand_count
);
val_id
=
vkd3d_dxbc_compiler_emit_swizzle
(
compiler
,
val_id
,
image
.
sampled_type
,
src
[
1
].
swizzle
,
dst
.
write_mask
);
...
...
@@ -5162,6 +5184,7 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
vkd3d_dxbc_compiler_emit_sample
(
compiler
,
instruction
);
break
;
case
VKD3DSIH_SAMPLE_C
:
case
VKD3DSIH_SAMPLE_C_LZ
:
vkd3d_dxbc_compiler_emit_sample_c
(
compiler
,
instruction
);
break
;
case
VKD3DSIH_LD_RAW
:
...
...
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