glsl: use new interfaces for 64-bit checks.

This is just prep work for int64 support, changing
places where 64-bit matters no doubles.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2016-06-09 07:02:07 +10:00
parent a82b8e8b36
commit 35616a9e0e
5 changed files with 14 additions and 14 deletions

View File

@ -3393,7 +3393,7 @@ apply_layout_qualifier_to_variable(const struct ast_type_qualifier *qual,
(qual_component + components - 1) > 3) {
_mesa_glsl_error(loc, state, "component overflow (%u > 3)",
(qual_component + components - 1));
} else if (qual_component == 1 && type->is_double()) {
} else if (qual_component == 1 && type->is_64bit()) {
/* We don't bother checking for 3 as it should be caught by the
* overflow check above.
*/
@ -6843,7 +6843,7 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
}
} else {
if (layout && layout->flags.q.explicit_xfb_offset) {
unsigned align = field_type->is_double() ? 8 : 4;
unsigned align = field_type->is_64bit() ? 8 : 4;
fields[i].offset = glsl_align(block_xfb_offset, align);
block_xfb_offset +=
MAX2(xfb_stride, (int) (4 * field_type->component_slots()));

View File

@ -222,7 +222,7 @@ set_uniform_initializer(void *mem_ctx, gl_shader_program *prog,
val->array_elements[0]->type->base_type;
const unsigned int elements = val->array_elements[0]->type->components();
unsigned int idx = 0;
unsigned dmul = (base_type == GLSL_TYPE_DOUBLE) ? 2 : 1;
unsigned dmul = glsl_base_type_is_64bit(base_type) ? 2 : 1;
assert(val->type->length >= storage->array_elements);
for (unsigned int i = 0; i < storage->array_elements; i++) {

View File

@ -403,7 +403,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
*/
last_comp = 4;
} else {
unsigned dmul = var->type->is_double() ? 2 : 1;
unsigned dmul = var->type->is_64bit() ? 2 : 1;
last_comp = var->data.location_frac +
var->type->without_array()->vector_elements * dmul;
}
@ -708,7 +708,7 @@ tfeedback_decl::assign_location(struct gl_context *ctx,
+ this->matched_candidate->toplevel_var->data.location_frac
+ this->matched_candidate->offset;
const unsigned dmul =
this->matched_candidate->type->without_array()->is_double() ? 2 : 1;
this->matched_candidate->type->without_array()->is_64bit() ? 2 : 1;
if (this->matched_candidate->type->is_array()) {
/* Array variable */

View File

@ -114,7 +114,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
/* For a row-major matrix, the next column starts at the next
* element.
*/
int size_mul = deref->type->is_double() ? 8 : 4;
int size_mul = deref->type->is_64bit() ? 8 : 4;
emit_access(mem_ctx, is_write, col_deref, base_offset,
deref_offset + i * size_mul,
row_major, deref->type->matrix_columns, packing,
@ -125,7 +125,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
/* std430 doesn't round up vec2 size to a vec4 size */
if (packing == GLSL_INTERFACE_PACKING_STD430 &&
deref->type->vector_elements == 2 &&
!deref->type->is_double()) {
!deref->type->is_64bit()) {
size_mul = 8;
} else {
/* std140 always rounds the stride of arrays (and matrices) to a
@ -137,7 +137,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
* machine units, the base alignment is 4N. For vec4, base
* alignment is 4N.
*/
size_mul = (deref->type->is_double() &&
size_mul = (deref->type->is_64bit() &&
deref->type->vector_elements > 2) ? 32 : 16;
}
@ -159,7 +159,7 @@ lower_buffer_access::emit_access(void *mem_ctx,
is_write ? write_mask : (1 << deref->type->vector_elements) - 1;
insert_buffer_access(mem_ctx, deref, deref->type, offset, mask, -1);
} else {
unsigned N = deref->type->is_double() ? 8 : 4;
unsigned N = deref->type->is_64bit() ? 8 : 4;
/* We're dereffing a column out of a row-major matrix, so we
* gather the vector from each stored row.
@ -358,7 +358,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
* thread or SIMD channel is modifying the same vector.
*/
array_stride = 4;
if (deref_array->array->type->is_double())
if (deref_array->array->type->is_64bit())
array_stride *= 2;
} else if (deref_array->array->type->is_matrix() && *row_major) {
/* When loading a vector out of a row major matrix, the
@ -367,7 +367,7 @@ lower_buffer_access::setup_buffer_access(void *mem_ctx,
* vector) is handled below in emit_ubo_loads.
*/
array_stride = 4;
if (deref_array->array->type->is_double())
if (deref_array->array->type->is_64bit())
array_stride *= 2;
*matrix_columns = deref_array->array->type->matrix_columns;
} else if (deref_array->type->without_array()->is_interface()) {

View File

@ -432,7 +432,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
bool gs_input_toplevel,
unsigned vertex_index)
{
unsigned dmul = rvalue->type->is_double() ? 2 : 1;
unsigned dmul = rvalue->type->is_64bit() ? 2 : 1;
/* When gs_input_toplevel is set, we should be looking at a geometry shader
* input array.
*/
@ -480,7 +480,7 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
char right_swizzle_name[4] = { 0, 0, 0, 0 };
left_components = 4 - fine_location % 4;
if (rvalue->type->is_double()) {
if (rvalue->type->is_64bit()) {
/* We might actually end up with 0 left components! */
left_components /= 2;
}
@ -676,7 +676,7 @@ lower_packed_varyings_visitor::needs_lowering(ir_variable *var)
return false;
type = type->without_array();
if (type->vector_elements == 4 && !type->is_double())
if (type->vector_elements == 4 && !type->is_64bit())
return false;
return true;
}