glsl: remember per-component vertex streams for packed varyings
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -917,6 +917,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertex stream output identifier.
|
* Vertex stream output identifier.
|
||||||
|
*
|
||||||
|
* For packed outputs, bit 31 is set and bits [2*i+1,2*i] indicate the
|
||||||
|
* stream of the i-th component.
|
||||||
*/
|
*/
|
||||||
unsigned stream;
|
unsigned stream;
|
||||||
|
|
||||||
|
@@ -177,6 +177,17 @@ void ir_print_visitor::visit(ir_variable *ir)
|
|||||||
if (ir->data.explicit_component)
|
if (ir->data.explicit_component)
|
||||||
snprintf(component, sizeof(component), "component=%i ", ir->data.location_frac);
|
snprintf(component, sizeof(component), "component=%i ", ir->data.location_frac);
|
||||||
|
|
||||||
|
char stream[32] = {0};
|
||||||
|
if (ir->data.stream & (1u << 31)) {
|
||||||
|
if (ir->data.stream & ~(1u << 31)) {
|
||||||
|
snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ",
|
||||||
|
ir->data.stream & 3, (ir->data.stream >> 2) & 3,
|
||||||
|
(ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3);
|
||||||
|
}
|
||||||
|
} else if (ir->data.stream) {
|
||||||
|
snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream);
|
||||||
|
}
|
||||||
|
|
||||||
const char *const cent = (ir->data.centroid) ? "centroid " : "";
|
const char *const cent = (ir->data.centroid) ? "centroid " : "";
|
||||||
const char *const samp = (ir->data.sample) ? "sample " : "";
|
const char *const samp = (ir->data.sample) ? "sample " : "";
|
||||||
const char *const patc = (ir->data.patch) ? "patch " : "";
|
const char *const patc = (ir->data.patch) ? "patch " : "";
|
||||||
@@ -187,13 +198,12 @@ void ir_print_visitor::visit(ir_variable *ir)
|
|||||||
"in ", "out ", "inout ",
|
"in ", "out ", "inout ",
|
||||||
"const_in ", "sys ", "temporary " };
|
"const_in ", "sys ", "temporary " };
|
||||||
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
|
STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
|
||||||
const char *const stream [] = {"", "stream1 ", "stream2 ", "stream3 "};
|
|
||||||
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
|
const char *const interp[] = { "", "smooth", "flat", "noperspective" };
|
||||||
STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
|
STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
|
||||||
|
|
||||||
fprintf(f, "(%s%s%s%s%s%s%s%s%s%s%s) ",
|
fprintf(f, "(%s%s%s%s%s%s%s%s%s%s%s) ",
|
||||||
binding, loc, component, cent, samp, patc, inv, prec, mode[ir->data.mode],
|
binding, loc, component, cent, samp, patc, inv, prec, mode[ir->data.mode],
|
||||||
stream[ir->data.stream],
|
stream,
|
||||||
interp[ir->data.interpolation]);
|
interp[ir->data.interpolation]);
|
||||||
|
|
||||||
print_type(f, ir->type);
|
print_type(f, ir->type);
|
||||||
|
@@ -531,6 +531,14 @@ lower_packed_varyings_visitor::lower_rvalue(ir_rvalue *rvalue,
|
|||||||
ir_dereference *packed_deref =
|
ir_dereference *packed_deref =
|
||||||
this->get_packed_varying_deref(location, unpacked_var, name,
|
this->get_packed_varying_deref(location, unpacked_var, name,
|
||||||
vertex_index);
|
vertex_index);
|
||||||
|
if (unpacked_var->data.stream != 0) {
|
||||||
|
assert(unpacked_var->data.stream < 4);
|
||||||
|
ir_variable *packed_var = packed_deref->variable_referenced();
|
||||||
|
for (unsigned i = 0; i < components; ++i) {
|
||||||
|
packed_var->data.stream |=
|
||||||
|
unpacked_var->data.stream << (2 * (location_frac + i));
|
||||||
|
}
|
||||||
|
}
|
||||||
ir_swizzle *swizzle = new(this->mem_ctx)
|
ir_swizzle *swizzle = new(this->mem_ctx)
|
||||||
ir_swizzle(packed_deref, swizzle_values, components);
|
ir_swizzle(packed_deref, swizzle_values, components);
|
||||||
if (this->mode == ir_var_shader_out) {
|
if (this->mode == ir_var_shader_out) {
|
||||||
@@ -639,6 +647,7 @@ lower_packed_varyings_visitor::get_packed_varying_deref(
|
|||||||
packed_var->data.location = location;
|
packed_var->data.location = location;
|
||||||
packed_var->data.precision = unpacked_var->data.precision;
|
packed_var->data.precision = unpacked_var->data.precision;
|
||||||
packed_var->data.always_active_io = unpacked_var->data.always_active_io;
|
packed_var->data.always_active_io = unpacked_var->data.always_active_io;
|
||||||
|
packed_var->data.stream = 1u << 31;
|
||||||
unpacked_var->insert_before(packed_var);
|
unpacked_var->insert_before(packed_var);
|
||||||
this->packed_varyings[slot] = packed_var;
|
this->packed_varyings[slot] = packed_var;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user