r300: merge r300/r500 fragment program compiler structure

This commit is contained in:
Maciej Cencora 2009-04-18 03:34:21 +02:00 committed by Dave Airlie
parent aa04e7d475
commit 33af54af0d
9 changed files with 25 additions and 34 deletions

View file

@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_common.h"
#include "main/mtypes.h"
#include "shader/prog_instruction.h"
struct r300_context;
typedef struct r300_context r300ContextRec;
@ -66,8 +67,6 @@ typedef struct r300_context *r300ContextPtr;
}
#include "r300_vertprog.h"
#include "r500_fragprog.h"
/* The blit width for texture uploads
@ -563,7 +562,7 @@ struct r300_fragment_program {
GLboolean error;
struct r300_fragment_program_external_state state;
union {
union rX00_fragment_program_code {
struct r300_fragment_program_code r300;
struct r500_fragment_program_code r500;
} code;
@ -572,6 +571,13 @@ struct r300_fragment_program {
GLuint optimization;
};
struct r300_fragment_program_compiler {
r300ContextPtr r300;
struct r300_fragment_program *fp;
union rX00_fragment_program_code *code;
struct gl_program *program;
};
#define R300_MAX_AOS_ARRAYS 16

View file

@ -417,7 +417,7 @@ void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp)
compiler.r300 = r300;
compiler.fp = r300_fp;
compiler.code = &r300_fp->code.r300;
compiler.code = &r300_fp->code;
compiler.program = _mesa_clone_program(ctx, &fp->Base);
if (RADEON_DEBUG & DEBUG_PIXEL) {

View file

@ -105,20 +105,12 @@
#endif
struct r300_fragment_program;
extern void r300TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp);
/**
* Used internally by the r300 fragment program code to store compile-time
* only data.
*/
struct r300_fragment_program_compiler {
r300ContextPtr r300;
struct r300_fragment_program *fp;
struct r300_fragment_program_code *code;
struct gl_program *program;
};
extern GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler);

View file

@ -47,7 +47,7 @@
#define PROG_CODE \
struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)data; \
struct r300_fragment_program_code *code = c->code
struct r300_fragment_program_code *code = &c->code->r300
#define error(fmt, args...) do { \
fprintf(stderr, "%s::%s(): " fmt "\n", \
@ -213,7 +213,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst)
*/
static GLboolean finish_node(struct r300_fragment_program_compiler *c)
{
struct r300_fragment_program_code *code = c->code;
struct r300_fragment_program_code *code = &c->code->r300;
struct r300_fragment_program_node *node = &code->node[code->cur_node];
if (node->alu_end < 0) {
@ -327,7 +327,7 @@ static const struct radeon_pair_handler pair_handler = {
*/
GLboolean r300FragmentProgramEmit(struct r300_fragment_program_compiler *compiler)
{
struct r300_fragment_program_code *code = compiler->code;
struct r300_fragment_program_code *code = &compiler->code->r300;
_mesa_bzero(code, sizeof(struct r300_fragment_program_code));
code->node[0].alu_end = -1;

View file

@ -61,6 +61,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_emit.h"
#include "r300_fragprog.h"
#include "r300_tex.h"
#include "r500_fragprog.h"
#include "drirenderbuffer.h"

View file

@ -34,6 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"
#include "r300_state.h"
#include "r300_swtcl.h"
#include "r300_emit.h"
#include "r300_tex.h"

View file

@ -62,8 +62,8 @@ static GLboolean transform_TEX(
struct radeon_transform_context *t,
struct prog_instruction* orig_inst, void* data)
{
struct r500_fragment_program_compiler *compiler =
(struct r500_fragment_program_compiler*)data;
struct r300_fragment_program_compiler *compiler =
(struct r300_fragment_program_compiler*)data;
struct prog_instruction inst = *orig_inst;
struct prog_instruction* tgt;
GLboolean destredirect = GL_FALSE;
@ -208,7 +208,7 @@ static void update_params(GLcontext *ctx, struct gl_fragment_program *fp)
* \todo if/when r5xx supports the radeon_program architecture, this is a
* likely candidate for code sharing.
*/
static void insert_WPOS_trailer(struct r500_fragment_program_compiler *compiler)
static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler)
{
GLuint InputsRead = compiler->fp->Base.Base.InputsRead;
@ -451,11 +451,11 @@ void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp)
}
if (!r300_fp->translated) {
struct r500_fragment_program_compiler compiler;
struct r300_fragment_program_compiler compiler;
compiler.r300 = r300;
compiler.fp = r300_fp;
compiler.code = &r300_fp->code.r500;
compiler.code = &r300_fp->code;
compiler.program = _mesa_clone_program(ctx, &fp->Base);
if (RADEON_DEBUG & DEBUG_PIXEL) {

View file

@ -45,17 +45,8 @@
#include "r300_state.h"
#include "radeon_program.h"
struct r500_fragment_program;
extern void r500TranslateFragmentShader(GLcontext *ctx, struct gl_fragment_program *fp);
struct r500_fragment_program_compiler {
r300ContextPtr r300;
struct r300_fragment_program *fp;
struct r500_fragment_program_code *code;
struct gl_program *program;
};
extern GLboolean r500FragmentProgramEmit(struct r500_fragment_program_compiler *compiler);
extern GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler);
#endif

View file

@ -49,8 +49,8 @@
#define PROG_CODE \
struct r500_fragment_program_compiler *c = (struct r500_fragment_program_compiler*)data; \
struct r500_fragment_program_code *code = c->code
struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)data; \
struct r500_fragment_program_code *code = &c->code->r500
#define error(fmt, args...) do { \
fprintf(stderr, "%s::%s(): " fmt "\n", \
@ -299,9 +299,9 @@ static const struct radeon_pair_handler pair_handler = {
.MaxHwTemps = 128
};
GLboolean r500FragmentProgramEmit(struct r500_fragment_program_compiler *compiler)
GLboolean r500FragmentProgramEmit(struct r300_fragment_program_compiler *compiler)
{
struct r500_fragment_program_code *code = compiler->code;
struct r500_fragment_program_code *code = &compiler->code->r500;
_mesa_bzero(code, sizeof(*code));
code->max_temp_idx = 1;