unsigned num_imm; // number of immediates
unsigned num_input; // number of inputs
unsigned aa_point_coord_index;
+ bool need_texcoord_semantic;
};
static inline struct aa_transform_context *
/* Declare new generic input/texcoord */
texIn = ts->num_input++;
- tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_GENERIC,
- ts->aa_point_coord_index, TGSI_INTERPOLATE_LINEAR);
+ if (ts->need_texcoord_semantic) {
+ tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_TEXCOORD,
+ ts->aa_point_coord_index,
+ TGSI_INTERPOLATE_LINEAR);
+ } else {
+ tgsi_transform_input_decl(ctx, texIn, TGSI_SEMANTIC_GENERIC,
+ ts->aa_point_coord_index,
+ TGSI_INTERPOLATE_LINEAR);
+ }
/* Declare extra immediates */
imm = ts->num_imm++;
*/
struct tgsi_token *
tgsi_add_aa_point(const struct tgsi_token *tokens_in,
- const int aa_point_coord_index)
+ const int aa_point_coord_index,
+ const bool need_texcoord_semantic)
{
struct aa_transform_context transform;
const uint num_new_tokens = 200; /* should be enough */
assert(aa_point_coord_index != -1);
transform.aa_point_coord_index = (unsigned)aa_point_coord_index;
+ transform.need_texcoord_semantic = need_texcoord_semantic;
transform.num_tmp = 0;
transform.num_imm = 0;
struct tgsi_token *
tgsi_add_aa_point(const struct tgsi_token *tokens_in,
- const int aa_point_coord_index);
+ const int aa_point_coord_index,
+ const bool need_texcoord_semantic);
#endif /* TGSI_AA_POINT_H */
unsigned point_coord_k; // aa point coord threshold distance
unsigned stream_out_point_pos:1; // set if to stream out original point pos
unsigned aa_point:1; // set if doing aa point
+ unsigned need_texcoord_semantic:1; // set if need texcoord semantic
unsigned out_tmp_index[PIPE_MAX_SHADER_OUTPUTS];
int max_generic; // max generic semantic index
};
else if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) {
ts->point_pos_out = decl->Range.First;
}
- else if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
+ else if (!ts->need_texcoord_semantic &&
+ decl->Semantic.Name == TGSI_SEMANTIC_GENERIC &&
decl->Semantic.Index < 32) {
ts->point_coord_decl |= 1 << decl->Semantic.Index;
ts->max_generic = MAX2(ts->max_generic, (int)decl->Semantic.Index);
}
+ else if (ts->need_texcoord_semantic &&
+ decl->Semantic.Name == TGSI_SEMANTIC_TEXCOORD) {
+ ts->point_coord_decl |= 1 << decl->Semantic.Index;
+ }
ts->num_out = MAX2(ts->num_out, range_end);
}
else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) {
*/
ts->point_coord_out = ts->num_out;
if (point_coord_enable) {
- for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
- if (en & 0x1) {
- tgsi_transform_output_decl(ctx, ts->num_out++,
- TGSI_SEMANTIC_GENERIC, i, 0);
- ts->max_generic = MAX2(ts->max_generic, (int)i);
+ if (ts->need_texcoord_semantic) {
+ for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
+ if (en & 0x1) {
+ tgsi_transform_output_decl(ctx, ts->num_out++,
+ TGSI_SEMANTIC_TEXCOORD, i, 0);
+ }
+ }
+ } else {
+ for (i = 0, en = point_coord_enable; en; en>>=1, i++) {
+ if (en & 0x1) {
+ tgsi_transform_output_decl(ctx, ts->num_out++,
+ TGSI_SEMANTIC_GENERIC, i, 0);
+ ts->max_generic = MAX2(ts->max_generic, (int)i);
+ }
}
}
}
/* add an extra generic output for aa point texcoord */
if (ts->aa_point) {
- ts->point_coord_aa = ts->max_generic + 1;
- assert((ts->point_coord_enable & (1 << ts->point_coord_aa)) == 0);
- ts->point_coord_enable |= 1 << (ts->point_coord_aa);
- tgsi_transform_output_decl(ctx, ts->num_out++, TGSI_SEMANTIC_GENERIC,
- ts->point_coord_aa, 0);
+ if (ts->need_texcoord_semantic) {
+ ts->point_coord_aa = 0;
+ } else {
+ ts->point_coord_aa = ts->max_generic + 1;
+ assert((ts->point_coord_enable & (1 << ts->point_coord_aa)) == 0);
+ ts->point_coord_enable |= 1 << (ts->point_coord_aa);
+ tgsi_transform_output_decl(ctx, ts->num_out++, TGSI_SEMANTIC_GENERIC,
+ ts->point_coord_aa, 0);
+ }
}
/* Declare extra immediates */
const unsigned point_coord_enable,
const bool sprite_origin_lower_left,
const bool stream_out_point_pos,
+ const bool need_texcoord_semantic,
int *aa_point_coord_index)
{
struct psprite_transform_context transform;
transform.stream_out_point_pos = stream_out_point_pos;
transform.point_coord_enable = point_coord_enable;
transform.aa_point = aa_point_coord_index != NULL;
+ transform.need_texcoord_semantic = need_texcoord_semantic;
transform.max_generic = -1;
/* point sprite directions based on the immediates (0, 1, 0.5, -1) */
const unsigned point_coord_enable,
const bool sprite_origin_lower_left,
const bool stream_out_point_pos,
+ const bool need_texcoord_semantic,
int *aa_point_coord_index);
#endif /* TGSI_POINT_SPRITE_H */
unsigned j;
unsigned out_index;
+ if (sem_name == TGSI_SEMANTIC_PCOORD) {
+ sem_name = TGSI_SEMANTIC_TEXCOORD;
+ sem_index = 0;
+ }
+
/* search output shader outputs for same item */
for (j = 0; j < outshader_info->num_outputs; j++) {
assert(j < ARRAY_SIZE(outshader_info->output_semantic_name));
struct svga_stream_output *streamout = NULL;
int pos_out_index = -1;
int aa_point_coord_index = -1;
+ struct pipe_screen *screen = svga->pipe.screen;
+ bool has_texcoord_semantic =
+ screen->get_param(screen, PIPE_CAP_TGSI_TEXCOORD);
assert(tokens != NULL);
memset(&key, 0, sizeof key);
key.gs.writes_psize = 1;
key.gs.sprite_coord_enable = svga->curr.rast->templ.sprite_coord_enable;
+ if (has_texcoord_semantic)
+ key.gs.sprite_coord_enable |= 0x1; /* For TGSI_SEMANTIC_PCOORD */
key.gs.sprite_origin_upper_left =
!(svga->curr.rast->templ.sprite_coord_mode == PIPE_SPRITE_COORD_LOWER_LEFT);
key.gs.sprite_coord_enable,
key.gs.sprite_origin_upper_left,
key.gs.point_pos_stream_out,
+ has_texcoord_semantic,
key.gs.aa_point ?
&aa_point_coord_index : NULL);
* Modify the FS to support anti-aliasing point.
*/
static const struct tgsi_token *
-transform_fs_aapoint(const struct tgsi_token *tokens,
+transform_fs_aapoint(struct svga_context *svga,
+ const struct tgsi_token *tokens,
int aa_coord_index)
{
+ bool need_texcoord_semantic =
+ svga->pipe.screen->get_param(svga->pipe.screen, PIPE_CAP_TGSI_TEXCOORD);
+
if (0) {
debug_printf("Before tgsi_add_aa_point ------------------\n");
tgsi_dump(tokens,0);
}
- tokens = tgsi_add_aa_point(tokens, aa_coord_index);
+ tokens = tgsi_add_aa_point(tokens, aa_coord_index, need_texcoord_semantic);
if (0) {
debug_printf("After tgsi_add_aa_point ------------------\n");
tgsi_dump(tokens, 0);
tokens = new_tokens;
}
if (key->fs.aa_point) {
- tokens = transform_fs_aapoint(tokens, key->fs.aa_point_coord_index);
+ tokens = transform_fs_aapoint(svga, tokens,
+ key->fs.aa_point_coord_index);
}
}