mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
i965: Initialize registers.
The test (file == BAD_FILE) works on registers for which the constructor has not run because BAD_FILE is zero. The next commit will move BAD_FILE in the enum so that it's no longer zero. In the case of this->outputs, the constructor was being run implicitly, and we were unnecessarily memsetting is to zero. Reviewed-by: Emil Velikov <emil.velikov@collabora.co.uk> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
7638e75cf9
commit
dba309fc14
3 changed files with 18 additions and 2 deletions
|
|
@ -262,6 +262,10 @@ void
|
|||
fs_visitor::nir_emit_system_values()
|
||||
{
|
||||
nir_system_values = ralloc_array(mem_ctx, fs_reg, SYSTEM_VALUE_MAX);
|
||||
for (unsigned i = 0; i < SYSTEM_VALUE_MAX; i++) {
|
||||
nir_system_values[i] = fs_reg();
|
||||
}
|
||||
|
||||
nir_foreach_overload(nir, overload) {
|
||||
assert(strcmp(overload->function->name, "main") == 0);
|
||||
assert(overload->impl);
|
||||
|
|
@ -272,7 +276,11 @@ fs_visitor::nir_emit_system_values()
|
|||
void
|
||||
fs_visitor::nir_emit_impl(nir_function_impl *impl)
|
||||
{
|
||||
nir_locals = reralloc(mem_ctx, nir_locals, fs_reg, impl->reg_alloc);
|
||||
nir_locals = ralloc_array(mem_ctx, fs_reg, impl->reg_alloc);
|
||||
for (unsigned i = 0; i < impl->reg_alloc; i++) {
|
||||
nir_locals[i] = fs_reg();
|
||||
}
|
||||
|
||||
foreach_list_typed(nir_register, reg, node, &impl->registers) {
|
||||
unsigned array_elems =
|
||||
reg->num_array_elems == 0 ? 1 : reg->num_array_elems;
|
||||
|
|
|
|||
|
|
@ -1190,7 +1190,6 @@ fs_visitor::init()
|
|||
this->nir_ssa_values = NULL;
|
||||
|
||||
memset(&this->payload, 0, sizeof(this->payload));
|
||||
memset(this->outputs, 0, sizeof(this->outputs));
|
||||
memset(this->output_components, 0, sizeof(this->output_components));
|
||||
this->source_depth_to_render_target = false;
|
||||
this->runtime_check_aads_emit = false;
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@ void
|
|||
vec4_visitor::nir_setup_system_values()
|
||||
{
|
||||
nir_system_values = ralloc_array(mem_ctx, dst_reg, SYSTEM_VALUE_MAX);
|
||||
for (unsigned i = 0; i < SYSTEM_VALUE_MAX; i++) {
|
||||
nir_system_values[i] = dst_reg();
|
||||
}
|
||||
|
||||
nir_foreach_overload(nir, overload) {
|
||||
assert(strcmp(overload->function->name, "main") == 0);
|
||||
|
|
@ -118,6 +121,9 @@ void
|
|||
vec4_visitor::nir_setup_inputs()
|
||||
{
|
||||
nir_inputs = ralloc_array(mem_ctx, src_reg, nir->num_inputs);
|
||||
for (unsigned i = 0; i < nir->num_inputs; i++) {
|
||||
nir_inputs[i] = dst_reg();
|
||||
}
|
||||
|
||||
nir_foreach_variable(var, &nir->inputs) {
|
||||
int offset = var->data.driver_location;
|
||||
|
|
@ -148,6 +154,9 @@ void
|
|||
vec4_visitor::nir_emit_impl(nir_function_impl *impl)
|
||||
{
|
||||
nir_locals = ralloc_array(mem_ctx, dst_reg, impl->reg_alloc);
|
||||
for (unsigned i = 0; i < impl->reg_alloc; i++) {
|
||||
nir_locals[i] = dst_reg();
|
||||
}
|
||||
|
||||
foreach_list_typed(nir_register, reg, node, &impl->registers) {
|
||||
unsigned array_elems =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue