OpenCL kernels also have int8/uint8.
v2: remove changes in nir_search as Jason posted a patch for that
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
DECL_TYPE(u16vec3, GL_UNSIGNED_INT16_VEC3_NV, GLSL_TYPE_UINT16, 3, 1)
DECL_TYPE(u16vec4, GL_UNSIGNED_INT16_VEC4_NV, GLSL_TYPE_UINT16, 4, 1)
+DECL_TYPE(int8_t, GL_INT8_NV, GLSL_TYPE_INT8, 1, 1)
+DECL_TYPE(i8vec2, GL_INT8_VEC2_NV, GLSL_TYPE_INT8, 2, 1)
+DECL_TYPE(i8vec3, GL_INT8_VEC3_NV, GLSL_TYPE_INT8, 3, 1)
+DECL_TYPE(i8vec4, GL_INT8_VEC4_NV, GLSL_TYPE_INT8, 4, 1)
+
+DECL_TYPE(uint8_t, GL_UNSIGNED_INT8_NV, GLSL_TYPE_UINT8, 1, 1)
+DECL_TYPE(u8vec2, GL_UNSIGNED_INT8_VEC2_NV, GLSL_TYPE_UINT8, 2, 1)
+DECL_TYPE(u8vec3, GL_UNSIGNED_INT8_VEC3_NV, GLSL_TYPE_UINT8, 3, 1)
+DECL_TYPE(u8vec4, GL_UNSIGNED_INT8_VEC4_NV, GLSL_TYPE_UINT8, 4, 1)
+
DECL_TYPE(sampler, GL_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_VOID)
DECL_TYPE(sampler1D, GL_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)
DECL_TYPE(sampler2D, GL_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
return new(mem_ctx) ir_expression(operation, op0, op1);
case GLSL_TYPE_ARRAY: {
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_SAMPLER:
case GLSL_TYPE_IMAGE:
return new(mem_ctx) ir_constant(this->type, &this->value);
case GLSL_TYPE_ERROR:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_FLOAT16:
/* All other types should have already been filtered by other
* paths in the caller.
return ts[components - 1];
}
+const glsl_type *
+glsl_type::i8vec(unsigned components)
+{
+ if (components == 0 || components > 4)
+ return error_type;
+
+ static const glsl_type *const ts[] = {
+ int8_t_type, i8vec2_type, i8vec3_type, i8vec4_type
+ };
+ return ts[components - 1];
+}
+
+
+const glsl_type *
+glsl_type::u8vec(unsigned components)
+{
+ if (components == 0 || components > 4)
+ return error_type;
+
+ static const glsl_type *const ts[] = {
+ uint8_t_type, u8vec2_type, u8vec3_type, u8vec4_type
+ };
+ return ts[components - 1];
+}
+
const glsl_type *
glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns)
{
return u16vec(rows);
case GLSL_TYPE_INT16:
return i16vec(rows);
+ case GLSL_TYPE_UINT8:
+ return u8vec(rows);
+ case GLSL_TYPE_INT8:
+ return i8vec(rows);
default:
return error_type;
}
switch (this->base_type) {
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
case GLSL_TYPE_FLOAT:
switch (this->base_type) {
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
case GLSL_TYPE_FLOAT:
GLSL_TYPE_FLOAT,
GLSL_TYPE_FLOAT16,
GLSL_TYPE_DOUBLE,
+ GLSL_TYPE_UINT8,
+ GLSL_TYPE_INT8,
GLSL_TYPE_UINT16,
GLSL_TYPE_INT16,
GLSL_TYPE_UINT64,
static const glsl_type *u64vec(unsigned components);
static const glsl_type *i16vec(unsigned components);
static const glsl_type *u16vec(unsigned components);
+ static const glsl_type *i8vec(unsigned components);
+ static const glsl_type *u8vec(unsigned components);
/**@}*/
/**
case GLSL_TYPE_INT16:
return nir_type_int16;
break;
+ case GLSL_TYPE_UINT8:
+ return nir_type_uint8;
+ case GLSL_TYPE_INT8:
+ return nir_type_int8;
case GLSL_TYPE_UINT64:
return nir_type_uint64;
break;
return glsl_type::uint16_t_type;
}
+const glsl_type *
+glsl_int8_t_type(void)
+{
+ return glsl_type::int8_t_type;
+}
+
+const glsl_type *
+glsl_uint8_t_type(void)
+{
+ return glsl_type::uint8_t_type;
+}
+
const glsl_type *
glsl_bool_type(void)
{
case GLSL_TYPE_INT16:
return 16;
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
+ return 8;
+
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
const struct glsl_type *glsl_uint64_t_type(void);
const struct glsl_type *glsl_int16_t_type(void);
const struct glsl_type *glsl_uint16_t_type(void);
+const struct glsl_type *glsl_int8_t_type(void);
+const struct glsl_type *glsl_uint8_t_type(void);
const struct glsl_type *glsl_bool_type(void);
const struct glsl_type *glsl_scalar_type(enum glsl_base_type base_type);
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
case 16:
val->type->type = (signedness ? glsl_int16_t_type() : glsl_uint16_t_type());
break;
+ case 8:
+ val->type->type = (signedness ? glsl_int8_t_type() : glsl_uint8_t_type());
+ break;
default:
vtn_fail("Invalid int bit size");
}
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
case 16:
val->constant->values->u16[0] = w[3];
break;
+ case 8:
+ val->constant->values->u8[0] = w[3];
+ break;
default:
vtn_fail("Unsupported SpvOpConstant bit size");
}
case 16:
val->constant->values[0].u16[0] = get_specialization(b, val, w[3]);
break;
+ case 8:
+ val->constant->values[0].u8[0] = get_specialization(b, val, w[3]);
+ break;
default:
vtn_fail("Unsupported SpvOpSpecConstant bit size");
}
case 16:
val->constant->values[0].u16[i] = elems[i]->values[0].u16[0];
break;
+ case 8:
+ val->constant->values[0].u8[i] = elems[i]->values[0].u8[0];
+ break;
default:
vtn_fail("Invalid SpvOpConstantComposite bit size");
}
case 16:
val->constant->values[0].u16[i] = (*c)->values[col].u16[elem + i];
break;
+ case 8:
+ val->constant->values[0].u8[i] = (*c)->values[col].u8[elem + i];
+ break;
default:
vtn_fail("Invalid SpvOpCompositeExtract bit size");
}
case 16:
(*c)->values[col].u16[elem + i] = insert->constant->values[0].u16[i];
break;
+ case 8:
+ (*c)->values[col].u8[elem + i] = insert->constant->values[0].u8[i];
+ break;
default:
vtn_fail("Invalid SpvOpCompositeInsert bit size");
}
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_INT64:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_BOOL:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
case GLSL_TYPE_FLOAT:
case GLSL_TYPE_INT16:
case GLSL_TYPE_FLOAT16:
return DIV_ROUND_UP(type->components(), 2);
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
+ return DIV_ROUND_UP(type->components(), 4);
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
return BRW_REGISTER_TYPE_D;
case GLSL_TYPE_INT16:
return BRW_REGISTER_TYPE_W;
+ case GLSL_TYPE_INT8:
+ return BRW_REGISTER_TYPE_B;
case GLSL_TYPE_UINT:
return BRW_REGISTER_TYPE_UD;
case GLSL_TYPE_UINT16:
return BRW_REGISTER_TYPE_UW;
+ case GLSL_TYPE_UINT8:
+ return BRW_REGISTER_TYPE_UB;
case GLSL_TYPE_ARRAY:
return brw_type_for_base_type(type->fields.array);
case GLSL_TYPE_STRUCT:
case GLSL_TYPE_DOUBLE:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT64:
case GLSL_TYPE_INT64:
if (type->is_matrix()) {
switch (type->base_type) {
case GLSL_TYPE_UINT:
case GLSL_TYPE_INT:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
case GLSL_TYPE_FLOAT:
/* fallthrough */
case GLSL_TYPE_UINT:
case GLSL_TYPE_UINT16:
+ case GLSL_TYPE_UINT8:
assert(ctx->Const.NativeIntegers);
format = uniform_native;
columns = 1;
/* fallthrough */
case GLSL_TYPE_INT:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_INT8:
format =
(ctx->Const.NativeIntegers) ? uniform_native : uniform_int_float;
columns = 1;
case GLSL_TYPE_FLOAT16:
case GLSL_TYPE_UINT16:
case GLSL_TYPE_INT16:
+ case GLSL_TYPE_UINT8:
+ case GLSL_TYPE_INT8:
assert(!"Invalid type in type_size");
break;
}