glsl: add implicit half float conversions
Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540>
This commit is contained in:

committed by
Marge Bot

parent
b83477973f
commit
5803417c67
@@ -243,10 +243,18 @@ get_implicit_conversion_operation(const glsl_type *to, const glsl_type *from,
|
||||
struct _mesa_glsl_parse_state *state)
|
||||
{
|
||||
switch (to->base_type) {
|
||||
case GLSL_TYPE_FLOAT16:
|
||||
switch (from->base_type) {
|
||||
case GLSL_TYPE_INT: return ir_unop_i2f16;
|
||||
case GLSL_TYPE_UINT: return ir_unop_u2f16;
|
||||
default: return (ir_expression_operation)0;
|
||||
}
|
||||
|
||||
case GLSL_TYPE_FLOAT:
|
||||
switch (from->base_type) {
|
||||
case GLSL_TYPE_INT: return ir_unop_i2f;
|
||||
case GLSL_TYPE_UINT: return ir_unop_u2f;
|
||||
case GLSL_TYPE_FLOAT16: return ir_unop_f162f;
|
||||
default: return (ir_expression_operation)0;
|
||||
}
|
||||
|
||||
@@ -264,6 +272,7 @@ get_implicit_conversion_operation(const glsl_type *to, const glsl_type *from,
|
||||
switch (from->base_type) {
|
||||
case GLSL_TYPE_INT: return ir_unop_i2d;
|
||||
case GLSL_TYPE_UINT: return ir_unop_u2d;
|
||||
case GLSL_TYPE_FLOAT16: return ir_unop_f162d;
|
||||
case GLSL_TYPE_FLOAT: return ir_unop_f2d;
|
||||
case GLSL_TYPE_INT64: return ir_unop_i642d;
|
||||
case GLSL_TYPE_UINT64: return ir_unop_u642d;
|
||||
|
@@ -980,7 +980,8 @@ _mesa_glsl_can_implicitly_convert(const glsl_type *from, const glsl_type *desire
|
||||
return false;
|
||||
|
||||
/* int and uint can be converted to float. */
|
||||
if (glsl_type_is_float(desired) && glsl_type_is_integer_32(from))
|
||||
if (glsl_type_is_float(desired) && (glsl_type_is_integer_32(from) ||
|
||||
glsl_type_is_float_16(from)))
|
||||
return true;
|
||||
|
||||
/* With GLSL 4.0, ARB_gpu_shader5, or MESA_shader_integer_functions, int
|
||||
@@ -999,7 +1000,7 @@ _mesa_glsl_can_implicitly_convert(const glsl_type *from, const glsl_type *desire
|
||||
|
||||
/* Conversions from different types to double. */
|
||||
if ((!state || state->has_double()) && glsl_type_is_double(desired)) {
|
||||
if (glsl_type_is_float(from))
|
||||
if (glsl_type_is_float_16_32(from))
|
||||
return true;
|
||||
if (glsl_type_is_integer_32(from))
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user