mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
nouveau: Use glsl_type C helpers
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707>
This commit is contained in:
parent
2cbc318193
commit
cc809d4de9
1 changed files with 10 additions and 10 deletions
|
|
@ -889,13 +889,13 @@ static uint16_t
|
||||||
calcSlots(const glsl_type *type, Program::Type stage, const shader_info &info,
|
calcSlots(const glsl_type *type, Program::Type stage, const shader_info &info,
|
||||||
bool input, const nir_variable *var)
|
bool input, const nir_variable *var)
|
||||||
{
|
{
|
||||||
if (!type->is_array())
|
if (!glsl_type_is_array(type))
|
||||||
return type->count_attribute_slots(false);
|
return glsl_count_attribute_slots(type, false);
|
||||||
|
|
||||||
uint16_t slots;
|
uint16_t slots;
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case Program::TYPE_GEOMETRY:
|
case Program::TYPE_GEOMETRY:
|
||||||
slots = type->count_attribute_slots(false);
|
slots = glsl_count_attribute_slots(type, false);
|
||||||
if (input)
|
if (input)
|
||||||
slots /= info.gs.vertices_in;
|
slots /= info.gs.vertices_in;
|
||||||
break;
|
break;
|
||||||
|
|
@ -903,12 +903,12 @@ calcSlots(const glsl_type *type, Program::Type stage, const shader_info &info,
|
||||||
case Program::TYPE_TESSELLATION_EVAL:
|
case Program::TYPE_TESSELLATION_EVAL:
|
||||||
// remove first dimension
|
// remove first dimension
|
||||||
if (var->data.patch || (!input && stage == Program::TYPE_TESSELLATION_EVAL))
|
if (var->data.patch || (!input && stage == Program::TYPE_TESSELLATION_EVAL))
|
||||||
slots = type->count_attribute_slots(false);
|
slots = glsl_count_attribute_slots(type, false);
|
||||||
else
|
else
|
||||||
slots = type->fields.array->count_attribute_slots(false);
|
slots = glsl_count_attribute_slots(type->fields.array, false);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
slots = type->count_attribute_slots(false);
|
slots = glsl_count_attribute_slots(type, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -917,10 +917,10 @@ calcSlots(const glsl_type *type, Program::Type stage, const shader_info &info,
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
getMaskForType(const glsl_type *type, uint8_t slot) {
|
getMaskForType(const glsl_type *type, uint8_t slot) {
|
||||||
uint16_t comp = type->without_array()->components();
|
uint16_t comp = glsl_get_components(glsl_without_array(type));
|
||||||
comp = comp ? comp : 4;
|
comp = comp ? comp : 4;
|
||||||
|
|
||||||
if (glsl_base_type_is_64bit(type->without_array()->base_type)) {
|
if (glsl_base_type_is_64bit(glsl_without_array(type)->base_type)) {
|
||||||
comp *= 2;
|
comp *= 2;
|
||||||
if (comp > 4) {
|
if (comp > 4) {
|
||||||
if (slot % 2)
|
if (slot % 2)
|
||||||
|
|
@ -1018,7 +1018,7 @@ bool Converter::assignSlots() {
|
||||||
assert(glsl_type_is_scalar(type->fields.array));
|
assert(glsl_type_is_scalar(type->fields.array));
|
||||||
assert(slots == glsl_get_length(type));
|
assert(slots == glsl_get_length(type));
|
||||||
}
|
}
|
||||||
assert(!glsl_base_type_is_64bit(type->without_array()->base_type));
|
assert(!glsl_base_type_is_64bit(glsl_without_array(type)->base_type));
|
||||||
|
|
||||||
uint32_t comps = BITFIELD_RANGE(var->data.location_frac, slots);
|
uint32_t comps = BITFIELD_RANGE(var->data.location_frac, slots);
|
||||||
assert(!(comps & ~0xff));
|
assert(!(comps & ~0xff));
|
||||||
|
|
@ -1122,7 +1122,7 @@ bool Converter::assignSlots() {
|
||||||
assert(glsl_type_is_scalar(type->fields.array));
|
assert(glsl_type_is_scalar(type->fields.array));
|
||||||
assert(slots == glsl_get_length(type));
|
assert(slots == glsl_get_length(type));
|
||||||
}
|
}
|
||||||
assert(!glsl_base_type_is_64bit(type->without_array()->base_type));
|
assert(!glsl_base_type_is_64bit(glsl_without_array(type)->base_type));
|
||||||
|
|
||||||
uint32_t comps = BITFIELD_RANGE(var->data.location_frac, slots);
|
uint32_t comps = BITFIELD_RANGE(var->data.location_frac, slots);
|
||||||
assert(!(comps & ~0xff));
|
assert(!(comps & ~0xff));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue