}
-struct ir_attribute * ir_attribute_create(struct ir_shader *shader,
- int rstart, int num, const char *name)
-{
- struct ir_attribute *a = ir_alloc(shader, sizeof(struct ir_attribute));
- DEBUG_MSG("R%d-R%d: %s", rstart, rstart + num - 1, name);
- a->name = ir_strdup(shader, name);
- a->rstart = rstart;
- a->num = num;
- assert(shader->attributes_count < ARRAY_SIZE(shader->attributes));
- shader->attributes[shader->attributes_count++] = a;
- return a;
-}
-
-struct ir_const * ir_const_create(struct ir_shader *shader,
- int cstart, float v0, float v1, float v2, float v3)
-{
- struct ir_const *c = ir_alloc(shader, sizeof(struct ir_const));
- DEBUG_MSG("C%d: %f, %f, %f, %f", cstart, v0, v1, v2, v3);
- c->val[0] = v0;
- c->val[1] = v1;
- c->val[2] = v2;
- c->val[3] = v3;
- c->cstart = cstart;
- assert(shader->consts_count < ARRAY_SIZE(shader->consts));
- shader->consts[shader->consts_count++] = c;
- return c;
-}
-
-struct ir_sampler * ir_sampler_create(struct ir_shader *shader,
- int idx, const char *name)
-{
- struct ir_sampler *s = ir_alloc(shader, sizeof(struct ir_sampler));
- DEBUG_MSG("CONST(%d): %s", idx, name);
- s->name = ir_strdup(shader, name);
- s->idx = idx;
- assert(shader->samplers_count < ARRAY_SIZE(shader->samplers));
- shader->samplers[shader->samplers_count++] = s;
- return s;
-}
-
-struct ir_uniform * ir_uniform_create(struct ir_shader *shader,
- int cstart, int num, const char *name)
-{
- struct ir_uniform *u = ir_alloc(shader, sizeof(struct ir_uniform));
- DEBUG_MSG("C%d-C%d: %s", cstart, cstart + num - 1, name);
- u->name = ir_strdup(shader, name);
- u->cstart = cstart;
- u->num = num;
- assert(shader->uniforms_count < ARRAY_SIZE(shader->uniforms));
- shader->uniforms[shader->uniforms_count++] = u;
- return u;
-}
-
-struct ir_varying * ir_varying_create(struct ir_shader *shader,
- int rstart, int num, const char *name)
-{
- struct ir_varying *v = ir_alloc(shader, sizeof(struct ir_varying));
- DEBUG_MSG("R%d-R%d: %s", rstart, rstart + num - 1, name);
- v->name = ir_strdup(shader, name);
- v->rstart = rstart;
- v->num = num;
- assert(shader->varyings_count < ARRAY_SIZE(shader->varyings));
- shader->varyings[shader->varyings_count++] = v;
- return v;
-}
-
-
struct ir_cf * ir_cf_create(struct ir_shader *shader, instr_cf_opc_t cf_type)
{
struct ir_cf *cf = ir_alloc(shader, sizeof(struct ir_cf));
#include "instr-a2xx.h"
-/* low level intermediate representation of an adreno shader program */
+/* low level intermediate representation of an adreno a2xx shader program */
struct ir_shader;
-struct ir_shader * fd_asm_parse(const char *src);
-
struct ir_shader_info {
uint16_t sizedwords;
int8_t max_reg; /* highest GPR # used by shader */
};
};
-/* somewhat arbitrary limits.. */
-#define MAX_ATTRIBUTES 32
-#define MAX_CONSTS 32
-#define MAX_SAMPLERS 32
-#define MAX_UNIFORMS 32
-#define MAX_VARYINGS 32
-
-struct ir_attribute {
- const char *name;
- int rstart; /* first register */
- int num; /* number of registers */
-};
-
-struct ir_const {
- float val[4];
- int cstart; /* first const register */
-};
-
-struct ir_sampler {
- const char *name;
- int idx;
-};
-
-struct ir_uniform {
- const char *name;
- int cstart; /* first const register */
- int num; /* number of const registers */
-};
-
-struct ir_varying {
- const char *name;
- int rstart; /* first register */
- int num; /* number of registers */
-};
-
struct ir_shader {
unsigned cfs_count;
struct ir_cf *cfs[0x56];
unsigned heap_idx;
enum ir_pred pred; /* pred inherited by newly created instrs */
-
- /* @ headers: */
- uint32_t attributes_count;
- struct ir_attribute *attributes[MAX_ATTRIBUTES];
-
- uint32_t consts_count;
- struct ir_const *consts[MAX_CONSTS];
-
- uint32_t samplers_count;
- struct ir_sampler *samplers[MAX_SAMPLERS];
-
- uint32_t uniforms_count;
- struct ir_uniform *uniforms[MAX_UNIFORMS];
-
- uint32_t varyings_count;
- struct ir_varying *varyings[MAX_VARYINGS];
-
};
struct ir_shader * ir_shader_create(void);
void * ir_shader_assemble(struct ir_shader *shader,
struct ir_shader_info *info);
-struct ir_attribute * ir_attribute_create(struct ir_shader *shader,
- int rstart, int num, const char *name);
-struct ir_const * ir_const_create(struct ir_shader *shader,
- int cstart, float v0, float v1, float v2, float v3);
-struct ir_sampler * ir_sampler_create(struct ir_shader *shader,
- int idx, const char *name);
-struct ir_uniform * ir_uniform_create(struct ir_shader *shader,
- int cstart, int num, const char *name);
-struct ir_varying * ir_varying_create(struct ir_shader *shader,
- int rstart, int num, const char *name);
-
struct ir_cf * ir_cf_create(struct ir_shader *shader, instr_cf_opc_t cf_type);
struct ir_instruction * ir_instr_create(struct ir_cf *cf, int instr_type);