nir: Add is_null_constant to nir_constant
Indicates that the values contained within are 0s, regardless of type. Enables some optimizations. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23173>
This commit is contained in:
@@ -2530,6 +2530,11 @@ static void
|
||||
write_constant(void *dst, size_t dst_size,
|
||||
const nir_constant *c, const struct glsl_type *type)
|
||||
{
|
||||
if (c->is_null_constant) {
|
||||
memset(dst, 0, dst_size);
|
||||
return;
|
||||
}
|
||||
|
||||
if (glsl_type_is_vector_or_scalar(type)) {
|
||||
const unsigned num_components = glsl_get_vector_elements(type);
|
||||
const unsigned bit_size = glsl_get_bit_size(type);
|
||||
|
||||
Reference in New Issue
Block a user