vkd3d-shader: Scan sampler comparison mode.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-10-22 01:49:15 +02:00 committed by Alexandre Julliard
parent 781c5ed7c9
commit 063f0f057a
2 changed files with 15 additions and 0 deletions

View File

@ -345,6 +345,7 @@ struct vkd3d_shader_scan_info
{
unsigned int uav_read_mask : VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS;
unsigned int uav_counter_mask : VKD3D_SHADER_MAX_UNORDERED_ACCESS_VIEWS;
uint32_t sampler_comparison_mode_mask;
};
int vkd3d_shader_scan_dxbc(const struct vkd3d_shader_code *dxbc,

View File

@ -160,11 +160,25 @@ static void vkd3d_shader_scan_record_uav_counter(struct vkd3d_shader_scan_info *
scan_info->uav_counter_mask |= 1u << reg->idx[0].offset;
}
static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_info *scan_info,
const struct vkd3d_shader_instruction *instruction)
{
unsigned int sampler_index = instruction->declaration.dst.reg.idx[0].offset;
if (instruction->flags & VKD3DSI_SAMPLER_COMPARISON_MODE)
{
assert(sampler_index < CHAR_BIT * sizeof(scan_info->sampler_comparison_mode_mask));
scan_info->sampler_comparison_mode_mask |= 1u << sampler_index;
}
}
static void vkd3d_shader_scan_handle_instruction(struct vkd3d_shader_scan_info *scan_info,
const struct vkd3d_shader_instruction *instruction)
{
unsigned int i;
if (instruction->handler_idx == VKD3DSIH_DCL_SAMPLER)
vkd3d_shader_scan_sampler_declaration(scan_info, instruction);
if (vkd3d_shader_instruction_is_uav_read(instruction))
{
for (i = 0; i < instruction->dst_count; ++i)