draw: remove old hard-coded shader length limits

This commit is contained in:
Brian Paul 2010-02-02 21:34:06 -07:00
parent 439036739d
commit 6f2e9651a1
3 changed files with 20 additions and 12 deletions

View file

@ -48,6 +48,10 @@
#include "draw_pipe.h"
/** Approx number of new tokens for instructions in aa_transform_inst() */
#define NUM_NEW_TOKENS 50
/**
* Max texture level for the alpha texture used for antialiasing
*/
@ -337,11 +341,10 @@ generate_aaline_fs(struct aaline_stage *aaline)
const struct pipe_shader_state *orig_fs = &aaline->fs->state;
struct pipe_shader_state aaline_fs;
struct aa_transform_context transform;
#define MAX 1000
const uint newLen = tgsi_num_tokens(orig_fs->tokens) + NUM_NEW_TOKENS;
aaline_fs = *orig_fs; /* copy to init */
aaline_fs.tokens = MALLOC(sizeof(struct tgsi_token) * MAX);
aaline_fs.tokens = tgsi_alloc_tokens(newLen);
if (aaline_fs.tokens == NULL)
return FALSE;
@ -357,7 +360,7 @@ generate_aaline_fs(struct aaline_stage *aaline)
tgsi_transform_shader(orig_fs->tokens,
(struct tgsi_token *) aaline_fs.tokens,
MAX, &transform.base);
newLen, &transform.base);
#if 0 /* DEBUG */
tgsi_dump(orig_fs->tokens, 0);

View file

@ -53,6 +53,10 @@
#include "draw_pipe.h"
/** Approx number of new tokens for instructions in aa_transform_inst() */
#define NUM_NEW_TOKENS 200
/*
* Enabling NORMALIZE might give _slightly_ better results.
* Basically, it controls whether we compute distance as d=sqrt(x*x+y*y) or
@ -494,11 +498,10 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
const struct pipe_shader_state *orig_fs = &aapoint->fs->state;
struct pipe_shader_state aapoint_fs;
struct aa_transform_context transform;
#define MAX 1000
const uint newLen = tgsi_num_tokens(orig_fs->tokens) + NUM_NEW_TOKENS;
aapoint_fs = *orig_fs; /* copy to init */
aapoint_fs.tokens = MALLOC(sizeof(struct tgsi_token) * MAX);
aapoint_fs.tokens = tgsi_alloc_tokens(newLen);
if (aapoint_fs.tokens == NULL)
return FALSE;
@ -514,7 +517,7 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
tgsi_transform_shader(orig_fs->tokens,
(struct tgsi_token *) aapoint_fs.tokens,
MAX, &transform.base);
newLen, &transform.base);
#if 0 /* DEBUG */
printf("draw_aapoint, orig shader:\n");

View file

@ -49,6 +49,9 @@
#include "draw_pipe.h"
/** Approx number of new tokens for instructions in pstip_transform_inst() */
#define NUM_NEW_TOKENS 50
/**
* Subclass of pipe_shader_state to carry extra fragment shader info.
@ -327,11 +330,10 @@ generate_pstip_fs(struct pstip_stage *pstip)
/*struct draw_context *draw = pstip->stage.draw;*/
struct pipe_shader_state pstip_fs;
struct pstip_transform_context transform;
#define MAX 1000
const uint newLen = tgsi_num_tokens(orig_fs->tokens) + NUM_NEW_TOKENS;
pstip_fs = *orig_fs; /* copy to init */
pstip_fs.tokens = MALLOC(sizeof(struct tgsi_token) * MAX);
pstip_fs.tokens = tgsi_alloc_tokens(newLen);
if (pstip_fs.tokens == NULL)
return FALSE;
@ -346,7 +348,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
tgsi_transform_shader(orig_fs->tokens,
(struct tgsi_token *) pstip_fs.tokens,
MAX, &transform.base);
newLen, &transform.base);
#if 0 /* DEBUG */
tgsi_dump(orig_fs->tokens, 0);