Prep work to add shader variant support.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
/* fill in ps inputs into shader object */
static void
-fill_in_ps_inputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_ps_inputs(struct etna_shader_variant *sobj, struct etna_compile *c)
{
struct etna_shader_io_file *sf = &sobj->infile;
/* fill in output mapping for ps into shader object */
static void
-fill_in_ps_outputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_ps_outputs(struct etna_shader_variant *sobj, struct etna_compile *c)
{
sobj->outfile.num_reg = 0;
/* fill in inputs for vs into shader object */
static void
-fill_in_vs_inputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_vs_inputs(struct etna_shader_variant *sobj, struct etna_compile *c)
{
struct etna_shader_io_file *sf = &sobj->infile;
/* build two-level output index [Semantic][Index] for fast linking */
static void
-build_output_index(struct etna_shader *sobj)
+build_output_index(struct etna_shader_variant *sobj)
{
int total = 0;
int offset = 0;
/* fill in outputs for vs into shader object */
static void
-fill_in_vs_outputs(struct etna_shader *sobj, struct etna_compile *c)
+fill_in_vs_outputs(struct etna_shader_variant *sobj, struct etna_compile *c)
{
struct etna_shader_io_file *sf = &sobj->outfile;
}
static void
-copy_uniform_state_to_shader(struct etna_compile *c, struct etna_shader *sobj)
+copy_uniform_state_to_shader(struct etna_compile *c, struct etna_shader_variant *sobj)
{
uint32_t count = c->imm_size;
struct etna_shader_uniform_info *uinfo = &sobj->uniforms;
etna_set_shader_uniforms_dirty_flags(sobj);
}
-struct etna_shader *
+struct etna_shader_variant *
etna_compile_shader(const struct etna_specs *specs,
const struct tgsi_token *tokens)
{
*/
bool ret;
struct etna_compile *c;
- struct etna_shader *shader;
+ struct etna_shader_variant *shader;
struct tgsi_lowering_config lconfig = {
.lower_SCS = specs->has_sin_cos_sqrt,
if (!c)
return NULL;
- shader = CALLOC_STRUCT(etna_shader);
+ shader = CALLOC_STRUCT(etna_shader_variant);
if (!shader)
goto out;
extern const char *tgsi_swizzle_names[];
void
-etna_dump_shader(const struct etna_shader *shader)
+etna_dump_shader(const struct etna_shader_variant *shader)
{
if (shader->processor == PIPE_SHADER_VERTEX)
printf("VERT\n");
}
void
-etna_destroy_shader(struct etna_shader *shader)
+etna_destroy_shader(struct etna_shader_variant *shader)
{
assert(shader);
}
static const struct etna_shader_inout *
-etna_shader_vs_lookup(const struct etna_shader *sobj,
+etna_shader_vs_lookup(const struct etna_shader_variant *sobj,
const struct etna_shader_inout *in)
{
if (in->semantic.Index < sobj->output_count_per_semantic[in->semantic.Name])
bool
etna_link_shader(struct etna_shader_link_info *info,
- const struct etna_shader *vs, const struct etna_shader *fs)
+ const struct etna_shader_variant *vs, const struct etna_shader_variant *fs)
{
/* For each fragment input we need to find the associated vertex shader
* output, which can be found by matching on semantic name and index. A
};
/* shader object, for linking */
-struct etna_shader {
+struct etna_shader_variant {
uint32_t id; /* for debug */
uint processor; /* TGSI_PROCESSOR_... */
struct etna_varying varyings[ETNA_NUM_INPUTS];
};
-struct etna_shader *
+struct etna_shader_variant *
etna_compile_shader(const struct etna_specs *specs, const struct tgsi_token *tokens);
void
-etna_dump_shader(const struct etna_shader *shader);
+etna_dump_shader(const struct etna_shader_variant *shader);
bool
etna_link_shader(struct etna_shader_link_info *info,
- const struct etna_shader *vs, const struct etna_shader *fs);
+ const struct etna_shader_variant *vs, const struct etna_shader_variant *fs);
void
-etna_destroy_shader(struct etna_shader *shader);
+etna_destroy_shader(struct etna_shader_variant *shader);
#endif
const char *filename;
struct tgsi_token toks[65536];
struct tgsi_parse_context parse;
- struct etna_shader *shader_obj;
+ struct etna_shader_variant *shader_obj;
void *ptr;
size_t size;
#include "util/slab.h"
struct pipe_screen;
-struct etna_shader;
+struct etna_shader_variant;
struct etna_index_buffer {
struct pipe_index_buffer ib;
struct etna_index_buffer index_buffer;
/* pointers to the bound state. these are mainly kept around for the blitter */
- struct etna_shader *vs;
- struct etna_shader *fs;
+ struct etna_shader_variant *vs;
+ struct etna_shader_variant *fs;
/* saved parameter-like state. these are mainly kept around for the blitter */
struct pipe_framebuffer_state framebuffer_s;
*/
static bool
etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
- const struct etna_shader *vs, const struct etna_shader *fs)
+ const struct etna_shader_variant *vs, const struct etna_shader_variant *fs)
{
struct etna_shader_link_info link = { };
static bool
etna_shader_update_vs_inputs(struct etna_context *ctx,
struct compiled_shader_state *cs,
- const struct etna_shader *vs,
+ const struct etna_shader_variant *vs,
const struct compiled_vertex_elements_state *ves)
{
unsigned num_temps, cur_temp, num_vs_inputs;
}
static inline const char *
-etna_shader_stage(struct etna_shader *shader)
+etna_shader_stage(struct etna_shader_variant *shader)
{
switch (shader->processor) {
case PIPE_SHADER_VERTEX: return "VERT";
}
static void
-dump_shader_info(struct etna_shader *shader, struct pipe_debug_callback *debug)
+dump_shader_info(struct etna_shader_variant *shader, struct pipe_debug_callback *debug)
{
if (!unlikely(etna_mesa_debug & ETNA_DBG_SHADERDB))
return;
const struct pipe_shader_state *pss)
{
struct etna_context *ctx = etna_context(pctx);
- struct etna_shader *shader = etna_compile_shader(&ctx->specs, pss->tokens);
+ struct etna_shader_variant *shader = etna_compile_shader(&ctx->specs, pss->tokens);
static uint32_t id;
shader->id = id++;
etna_bind_fs_state(struct pipe_context *pctx, void *fss_)
{
struct etna_context *ctx = etna_context(pctx);
- struct etna_shader *fss = fss_;
+ struct etna_shader_variant *fss = fss_;
if (ctx->fs == fss) /* skip if already bound */
return;
etna_bind_vs_state(struct pipe_context *pctx, void *vss_)
{
struct etna_context *ctx = etna_context(pctx);
- struct etna_shader *vss = vss_;
+ struct etna_shader_variant *vss = vss_;
if (ctx->vs == vss) /* skip if already bound */
return;
void
etna_uniforms_write(const struct etna_context *ctx,
- const struct etna_shader *sobj,
+ const struct etna_shader_variant *sobj,
struct pipe_constant_buffer *cb, uint32_t *uniforms,
unsigned *size)
{
}
void
-etna_set_shader_uniforms_dirty_flags(struct etna_shader *sobj)
+etna_set_shader_uniforms_dirty_flags(struct etna_shader_variant *sobj)
{
uint32_t dirty = 0;
#include <stdint.h>
struct etna_context;
-struct etna_shader;
+struct etna_shader_variant;
struct pipe_constant_buffer;
void
etna_uniforms_write(const struct etna_context *ctx,
- const struct etna_shader *sobj,
+ const struct etna_shader_variant *sobj,
struct pipe_constant_buffer *cb, uint32_t *uniforms,
unsigned *size);
void
-etna_set_shader_uniforms_dirty_flags(struct etna_shader *sobj);
+etna_set_shader_uniforms_dirty_flags(struct etna_shader_variant *sobj);
#endif /* ETNAVIV_UNIFORMS_H_ */