mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-21 12:00:41 +02:00
i915g: Separate declarations and program in the fragment program struct.
We need this later to fixup fragment programs properly.
This commit is contained in:
parent
094eeff199
commit
8e4540ec2a
4 changed files with 32 additions and 10 deletions
|
|
@ -104,6 +104,9 @@ struct i915_fragment_shader
|
|||
|
||||
struct draw_fragment_shader *draw_data;
|
||||
|
||||
uint *decl;
|
||||
uint decl_len;
|
||||
|
||||
uint *program;
|
||||
uint program_len;
|
||||
|
||||
|
|
|
|||
|
|
@ -1277,17 +1277,26 @@ i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p)
|
|||
|
||||
/* Copy compilation results to fragment program struct:
|
||||
*/
|
||||
assert(!ifs->decl);
|
||||
assert(!ifs->program);
|
||||
ifs->program
|
||||
= (uint *) MALLOC((program_size + decl_size) * sizeof(uint));
|
||||
if (ifs->program) {
|
||||
ifs->program_len = program_size + decl_size;
|
||||
|
||||
memcpy(ifs->program,
|
||||
ifs->decl
|
||||
= (uint *) MALLOC(decl_size * sizeof(uint));
|
||||
ifs->program
|
||||
= (uint *) MALLOC(program_size * sizeof(uint));
|
||||
|
||||
if (ifs->decl) {
|
||||
ifs->decl_len = decl_size;
|
||||
|
||||
memcpy(ifs->decl,
|
||||
p->declarations,
|
||||
decl_size * sizeof(uint));
|
||||
}
|
||||
|
||||
memcpy(ifs->program + decl_size,
|
||||
if (ifs->program) {
|
||||
ifs->program_len = program_size;
|
||||
|
||||
memcpy(ifs->program,
|
||||
p->program,
|
||||
program_size * sizeof(uint));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -608,6 +608,11 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
|
|||
{
|
||||
struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader;
|
||||
|
||||
if (ifs->decl) {
|
||||
FREE(ifs->decl);
|
||||
ifs->decl = NULL;
|
||||
}
|
||||
|
||||
if (ifs->program) {
|
||||
FREE(ifs->program);
|
||||
ifs->program = NULL;
|
||||
|
|
@ -615,6 +620,7 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
|
|||
ifs->state.tokens = NULL;
|
||||
}
|
||||
ifs->program_len = 0;
|
||||
ifs->decl_len = 0;
|
||||
|
||||
FREE(ifs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ validate_program(struct i915_context *i915, unsigned *batch_space)
|
|||
uint additional_size = i915->current.target_fixup_format ? 1 : 0;
|
||||
|
||||
/* we need more batch space if we want to emulate rgba framebuffers */
|
||||
*batch_space = i915->fs->program_len + 3 * additional_size;
|
||||
*batch_space = i915->fs->decl_len + i915->fs->program_len + 3 * additional_size;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -378,15 +378,19 @@ emit_program(struct i915_context *i915)
|
|||
/* we should always have, at least, a pass-through program */
|
||||
assert(i915->fs->program_len > 0);
|
||||
|
||||
/* output the declarations */
|
||||
{
|
||||
/* first word has the size, we have to adjust that */
|
||||
uint size = (i915->fs->program[0]);
|
||||
uint size = (i915->fs->decl[0]);
|
||||
size += need_target_fixup * 3;
|
||||
OUT_BATCH(size);
|
||||
}
|
||||
|
||||
/* output the declarations and the program */
|
||||
for (i = 1 ; i < i915->fs->program_len; i++)
|
||||
for (i = 1 ; i < i915->fs->decl_len; i++)
|
||||
OUT_BATCH(i915->fs->decl[i]);
|
||||
|
||||
/* output the program */
|
||||
for (i = 0 ; i < i915->fs->program_len; i++)
|
||||
OUT_BATCH(i915->fs->program[i]);
|
||||
|
||||
/* we emit an additional mov with swizzle to fake RGBA framebuffers */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue