Skip to content
Snippets Groups Projects
Commit 4e861ac4 authored by Stéphane Marchesin's avatar Stéphane Marchesin
Browse files

i915g: Add more optimizations

This patch adds liveness analysis to i915g and a couple
optimizations which benefit from it. One interesting
optimization turns (fake) indirect texture accesses into direct
texture accesses (the i915 supports a maximum of 4 indirect
texture accesses). Among other things this fixes a bunch of
piglit tests.
parent a974b915
No related branches found
No related tags found
No related merge requests found
...@@ -322,6 +322,8 @@ struct i915_token_list ...@@ -322,6 +322,8 @@ struct i915_token_list
extern struct i915_token_list* i915_optimize(const struct tgsi_token *tokens); extern struct i915_token_list* i915_optimize(const struct tgsi_token *tokens);
extern void i915_optimize_free(struct i915_token_list* tokens); extern void i915_optimize_free(struct i915_token_list *tokens);
extern uint i915_num_coords(uint tex);
#endif #endif
This diff is collapsed.
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "i915_reg.h" #include "i915_reg.h"
#include "i915_context.h" #include "i915_context.h"
#include "i915_fpc.h" #include "i915_fpc.h"
#include "i915_debug_private.h"
#include "pipe/p_shader_tokens.h" #include "pipe/p_shader_tokens.h"
#include "util/u_math.h" #include "util/u_math.h"
...@@ -179,7 +180,7 @@ static uint get_mapping(struct i915_fragment_shader* fs, int unit) ...@@ -179,7 +180,7 @@ static uint get_mapping(struct i915_fragment_shader* fs, int unit)
static uint static uint
src_vector(struct i915_fp_compile *p, src_vector(struct i915_fp_compile *p,
const struct i915_full_src_register *source, const struct i915_full_src_register *source,
struct i915_fragment_shader* fs) struct i915_fragment_shader *fs)
{ {
uint index = source->Register.Index; uint index = source->Register.Index;
uint src = 0, sem_name, sem_ind; uint src = 0, sem_name, sem_ind;
...@@ -381,8 +382,8 @@ translate_tex_src_target(struct i915_fp_compile *p, uint tex) ...@@ -381,8 +382,8 @@ translate_tex_src_target(struct i915_fp_compile *p, uint tex)
/** /**
* Return the number of coords needed to access a given TGSI_TEXTURE_* * Return the number of coords needed to access a given TGSI_TEXTURE_*
*/ */
static uint uint
texture_num_coords(struct i915_fp_compile *p, uint tex) i915_num_coords(uint tex)
{ {
switch (tex) { switch (tex) {
case TGSI_TEXTURE_SHADOW1D: case TGSI_TEXTURE_SHADOW1D:
...@@ -400,7 +401,7 @@ texture_num_coords(struct i915_fp_compile *p, uint tex) ...@@ -400,7 +401,7 @@ texture_num_coords(struct i915_fp_compile *p, uint tex)
return 3; return 3;
default: default:
i915_program_error(p, "Num coords"); debug_printf("Unknown texture target for num coords");
return 2; return 2;
} }
} }
...@@ -427,7 +428,7 @@ emit_tex(struct i915_fp_compile *p, ...@@ -427,7 +428,7 @@ emit_tex(struct i915_fp_compile *p,
sampler, sampler,
coord, coord,
opcode, opcode,
texture_num_coords(p, texture) ); i915_num_coords(texture) );
} }
...@@ -440,7 +441,7 @@ static void ...@@ -440,7 +441,7 @@ static void
emit_simple_arith(struct i915_fp_compile *p, emit_simple_arith(struct i915_fp_compile *p,
const struct i915_full_instruction *inst, const struct i915_full_instruction *inst,
uint opcode, uint numArgs, uint opcode, uint numArgs,
struct i915_fragment_shader* fs) struct i915_fragment_shader *fs)
{ {
uint arg1, arg2, arg3; uint arg1, arg2, arg3;
...@@ -465,7 +466,7 @@ static void ...@@ -465,7 +466,7 @@ static void
emit_simple_arith_swap2(struct i915_fp_compile *p, emit_simple_arith_swap2(struct i915_fp_compile *p,
const struct i915_full_instruction *inst, const struct i915_full_instruction *inst,
uint opcode, uint numArgs, uint opcode, uint numArgs,
struct i915_fragment_shader* fs) struct i915_fragment_shader *fs)
{ {
struct i915_full_instruction inst2; struct i915_full_instruction inst2;
...@@ -1108,7 +1109,7 @@ i915_translate_instruction(struct i915_fp_compile *p, ...@@ -1108,7 +1109,7 @@ i915_translate_instruction(struct i915_fp_compile *p,
static void i915_translate_token(struct i915_fp_compile *p, static void i915_translate_token(struct i915_fp_compile *p,
const union i915_full_token* token, const union i915_full_token *token,
struct i915_fragment_shader *fs) struct i915_fragment_shader *fs)
{ {
struct i915_fragment_shader *ifs = p->shader; struct i915_fragment_shader *ifs = p->shader;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment