summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2010-09-02 16:30:23 +0100
committerJosé Fonseca <[email protected]>2010-10-11 13:06:25 +0100
commit986cb9d5cf60bc11c7facc19017b5432b17240f7 (patch)
tree10d9b3c6276cba322ab4ef45a8efd9b35a4fdf0c
parent7c1b5772a81c4f701ae9a6208c9e34792c05d4ab (diff)
llvmpipe: Use lp_tgsi_info.
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_point.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_derived.c16
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c38
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.h3
4 files changed, 31 insertions, 30 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 31d85f43c2f..64b24a88d54 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -239,8 +239,8 @@ setup_point_coefficients( struct lp_setup_context *setup,
/* check if the sprite coord flag is set for this attribute.
* If so, set it up so it up so x and y vary from 0 to 1.
*/
- if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
- unsigned semantic_index = shader->info.input_semantic_index[slot];
+ if (shader->info.base.input_semantic_name[slot] == TGSI_SEMANTIC_GENERIC) {
+ unsigned semantic_index = shader->info.base.input_semantic_index[slot];
/* Note that sprite_coord enable is a bitfield of
* PIPE_MAX_SHADER_OUTPUTS bits.
*/
diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index bb059d04599..7f68818ab47 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c
@@ -66,14 +66,14 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, vs_index);
- for (i = 0; i < lpfs->info.num_inputs; i++) {
+ for (i = 0; i < lpfs->info.base.num_inputs; i++) {
/*
* Search for each input in current vs output:
*/
vs_index = draw_find_shader_output(llvmpipe->draw,
- lpfs->info.input_semantic_name[i],
- lpfs->info.input_semantic_index[i]);
+ lpfs->info.base.input_semantic_name[i],
+ lpfs->info.base.input_semantic_index[i]);
if (vs_index < 0) {
/*
* This can happen with sprite coordinates - the vertex
@@ -86,9 +86,9 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
/* This can be pre-computed, except for flatshade:
*/
- inputs[i].usage_mask = lpfs->info.input_usage_mask[i];
+ inputs[i].usage_mask = lpfs->info.base.input_usage_mask[i];
- switch (lpfs->info.input_interpolate[i]) {
+ switch (lpfs->info.base.input_interpolate[i]) {
case TGSI_INTERPOLATE_CONSTANT:
inputs[i].interp = LP_INTERP_CONSTANT;
break;
@@ -103,7 +103,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
break;
}
- switch (lpfs->info.input_semantic_name[i]) {
+ switch (lpfs->info.base.input_semantic_name[i]) {
case TGSI_SEMANTIC_FACE:
inputs[i].interp = LP_INTERP_FACING;
break;
@@ -145,7 +145,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, vs_index);
}
- llvmpipe->num_inputs = lpfs->info.num_inputs;
+ llvmpipe->num_inputs = lpfs->info.base.num_inputs;
draw_compute_vertex_size(vinfo);
@@ -153,7 +153,7 @@ compute_vertex_info(struct llvmpipe_context *llvmpipe)
lp_setup_set_fs_inputs(llvmpipe->setup,
inputs,
- lpfs->info.num_inputs);
+ lpfs->info.base.num_inputs);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 6bfd02061d5..6872f2d3c6a 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -238,9 +238,9 @@ generate_fs(struct llvmpipe_context *lp,
LLVMValueRef zs_value = NULL;
LLVMValueRef stencil_refs[2];
struct lp_build_mask_context mask;
- boolean simple_shader = (shader->info.file_count[TGSI_FILE_SAMPLER] == 0 &&
- shader->info.num_inputs < 3 &&
- shader->info.num_instructions < 8);
+ boolean simple_shader = (shader->info.base.file_count[TGSI_FILE_SAMPLER] == 0 &&
+ shader->info.base.num_inputs < 3 &&
+ shader->info.base.num_instructions < 8);
unsigned attrib;
unsigned chan;
unsigned cbuf;
@@ -253,8 +253,8 @@ generate_fs(struct llvmpipe_context *lp,
zs_format_desc = util_format_description(key->zsbuf_format);
assert(zs_format_desc);
- if (!shader->info.writes_z) {
- if (key->alpha.enabled || shader->info.uses_kill)
+ if (!shader->info.base.writes_z) {
+ if (key->alpha.enabled || shader->info.base.uses_kill)
/* With alpha test and kill, can do the depth test early
* and hopefully eliminate some quads. But need to do a
* special deferred depth write once the final mask value
@@ -334,12 +334,12 @@ generate_fs(struct llvmpipe_context *lp,
/* Build the actual shader */
lp_build_tgsi_soa(builder, tokens, type, &mask,
consts_ptr, interp->pos, interp->inputs,
- outputs, sampler, &shader->info);
+ outputs, sampler, &shader->info.base);
/* Alpha test */
if (key->alpha.enabled) {
- int color0 = find_output_by_semantic(&shader->info,
+ int color0 = find_output_by_semantic(&shader->info.base,
TGSI_SEMANTIC_COLOR,
0);
@@ -358,7 +358,7 @@ generate_fs(struct llvmpipe_context *lp,
/* Late Z test */
if (depth_mode & LATE_DEPTH_TEST) {
- int pos0 = find_output_by_semantic(&shader->info,
+ int pos0 = find_output_by_semantic(&shader->info.base,
TGSI_SEMANTIC_POSITION,
0);
@@ -399,11 +399,11 @@ generate_fs(struct llvmpipe_context *lp,
/* Color write */
- for (attrib = 0; attrib < shader->info.num_outputs; ++attrib)
+ for (attrib = 0; attrib < shader->info.base.num_outputs; ++attrib)
{
- if (shader->info.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR)
+ if (shader->info.base.output_semantic_name[attrib] == TGSI_SEMANTIC_COLOR)
{
- unsigned cbuf = shader->info.output_semantic_index[attrib];
+ unsigned cbuf = shader->info.base.output_semantic_index[attrib];
for(chan = 0; chan < NUM_CHANNELS; ++chan)
{
/* XXX: just initialize outputs to point at colors[] and
@@ -728,7 +728,7 @@ generate_fragment(struct llvmpipe_context *lp,
*/
boolean do_branch = ((key->depth.enabled || key->stencil[0].enabled) &&
!key->alpha.enabled &&
- !shader->info.uses_kill);
+ !shader->info.base.uses_kill);
generate_blend(&key->blend,
rt,
@@ -917,7 +917,7 @@ generate_variant(struct llvmpipe_context *lp,
!key->stencil[0].enabled &&
!key->alpha.enabled &&
!key->depth.enabled &&
- !shader->info.uses_kill
+ !shader->info.base.uses_kill
? TRUE : FALSE;
@@ -954,7 +954,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
make_empty_list(&shader->variants);
/* get/save the summary info for this shader */
- tgsi_scan_shader(templ->tokens, &shader->info);
+ lp_build_tgsi_info(templ->tokens, &shader->info);
/* we need to keep a local copy of the tokens */
shader->base.tokens = tgsi_dup_tokens(templ->tokens);
@@ -966,7 +966,7 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
return NULL;
}
- nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1;
+ nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1;
shader->variant_key_size = Offset(struct lp_fragment_shader_variant_key,
sampler[nr_samplers]);
@@ -976,8 +976,8 @@ llvmpipe_create_fs_state(struct pipe_context *pipe,
debug_printf("llvmpipe: Create fragment shader #%u %p:\n", shader->no, (void *) shader);
tgsi_dump(templ->tokens, 0);
debug_printf("usage masks:\n");
- for (attrib = 0; attrib < shader->info.num_inputs; ++attrib) {
- unsigned usage_mask = shader->info.input_usage_mask[attrib];
+ for (attrib = 0; attrib < shader->info.base.num_inputs; ++attrib) {
+ unsigned usage_mask = shader->info.base.input_usage_mask[attrib];
debug_printf(" IN[%u].%s%s%s%s\n",
attrib,
usage_mask & TGSI_WRITEMASK_X ? "x" : "",
@@ -1206,10 +1206,10 @@ make_variant_key(struct llvmpipe_context *lp,
/* This value will be the same for all the variants of a given shader:
*/
- key->nr_samplers = shader->info.file_max[TGSI_FILE_SAMPLER] + 1;
+ key->nr_samplers = shader->info.base.file_max[TGSI_FILE_SAMPLER] + 1;
for(i = 0; i < key->nr_samplers; ++i) {
- if(shader->info.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) {
+ if(shader->info.base.file_mask[TGSI_FILE_SAMPLER] & (1 << i)) {
lp_sampler_static_state(&key->sampler[i],
lp->fragment_sampler_views[i],
lp->sampler[i]);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h
index 4999b8dca1a..ddad117acac 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.h
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h
@@ -34,6 +34,7 @@
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h" /* for tgsi_shader_info */
#include "gallivm/lp_bld_sample.h" /* for struct lp_sampler_static_state */
+#include "gallivm/lp_bld_tgsi.h" /* for lp_tgsi_info */
struct tgsi_token;
@@ -96,7 +97,7 @@ struct lp_fragment_shader
{
struct pipe_shader_state base;
- struct tgsi_shader_info info;
+ struct lp_tgsi_info info;
struct lp_fs_variant_list_item variants;