mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 08:40:11 +01:00
d3d12: Compare shader key common parts with memcmp, instead of if's
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21610>
This commit is contained in:
parent
623a01827c
commit
e4ba343ac9
1 changed files with 8 additions and 19 deletions
|
|
@ -803,18 +803,13 @@ d3d12_compare_shader_keys(struct d3d12_selection_context* sel_ctx, const d3d12_s
|
|||
default:
|
||||
unreachable("invalid stage");
|
||||
}
|
||||
|
||||
if (expect->input_clip_size != have->input_clip_size)
|
||||
|
||||
|
||||
if (memcmp(&expect->next_varying_inputs,
|
||||
&have->next_varying_inputs,
|
||||
offsetof(d3d12_shader_key, vs) - offsetof(d3d12_shader_key, next_varying_inputs)) != 0)
|
||||
return false;
|
||||
|
||||
if (expect->tex_saturate_s != have->tex_saturate_s ||
|
||||
expect->tex_saturate_r != have->tex_saturate_r ||
|
||||
expect->tex_saturate_t != have->tex_saturate_t)
|
||||
return false;
|
||||
|
||||
if (expect->samples_int_textures != have->samples_int_textures)
|
||||
return false;
|
||||
|
||||
|
||||
if (expect->n_texture_states != have->n_texture_states)
|
||||
return false;
|
||||
|
||||
|
|
@ -837,21 +832,15 @@ d3d12_compare_shader_keys(struct d3d12_selection_context* sel_ctx, const d3d12_s
|
|||
expect->n_images * sizeof(struct d3d12_image_format_conversion_info)))
|
||||
return false;
|
||||
|
||||
if (expect->invert_depth != have->invert_depth ||
|
||||
expect->halfz != have->halfz)
|
||||
return false;
|
||||
|
||||
/* Because we only add varyings we check that a shader has at least the expected in-
|
||||
* and outputs. */
|
||||
|
||||
if (!d3d12_compare_varying_info(expect->required_varying_inputs,
|
||||
have->required_varying_inputs) ||
|
||||
expect->next_varying_inputs != have->next_varying_inputs)
|
||||
have->required_varying_inputs))
|
||||
return false;
|
||||
|
||||
if (!d3d12_compare_varying_info(expect->required_varying_outputs,
|
||||
have->required_varying_outputs) ||
|
||||
expect->prev_varying_outputs != have->prev_varying_outputs)
|
||||
have->required_varying_outputs))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue