mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
aco: set constant_data_offset correctly in the case of merged shaders
setup_nir() is done for all shaders before any of them are selected, so
constant_data_offset could be incorrect for the first shader.
Fixes incorrect geometry in Mafia III and Max Payne 3.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2768
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6205>
(cherry picked from commit 6e70508151)
This commit is contained in:
parent
c612c06cf1
commit
6b823dfc01
2 changed files with 9 additions and 11 deletions
|
|
@ -202,7 +202,7 @@
|
|||
"description": "aco: set constant_data_offset correctly in the case of merged shaders",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": null
|
||||
},
|
||||
|
|
|
|||
|
|
@ -936,6 +936,14 @@ void init_context(isel_context *ctx, nir_shader *shader)
|
|||
|
||||
ctx->allocated.reset(allocated.release());
|
||||
ctx->cf_info.nir_to_aco.reset(nir_to_aco.release());
|
||||
|
||||
/* align and copy constant data */
|
||||
while (ctx->program->constant_data.size() % 4u)
|
||||
ctx->program->constant_data.push_back(0);
|
||||
ctx->constant_data_offset = ctx->program->constant_data.size();
|
||||
ctx->program->constant_data.insert(ctx->program->constant_data.end(),
|
||||
(uint8_t*)shader->constant_data,
|
||||
(uint8_t*)shader->constant_data + shader->constant_data_size);
|
||||
}
|
||||
|
||||
Pseudo_instruction *add_startpgm(struct isel_context *ctx)
|
||||
|
|
@ -1304,16 +1312,6 @@ lower_bit_size_callback(const nir_alu_instr *alu, void *_)
|
|||
void
|
||||
setup_nir(isel_context *ctx, nir_shader *nir)
|
||||
{
|
||||
Program *program = ctx->program;
|
||||
|
||||
/* align and copy constant data */
|
||||
while (program->constant_data.size() % 4u)
|
||||
program->constant_data.push_back(0);
|
||||
ctx->constant_data_offset = program->constant_data.size();
|
||||
program->constant_data.insert(program->constant_data.end(),
|
||||
(uint8_t*)nir->constant_data,
|
||||
(uint8_t*)nir->constant_data + nir->constant_data_size);
|
||||
|
||||
/* the variable setup has to be done before lower_io / CSE */
|
||||
setup_variables(ctx, nir);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue