diff options
author | Maciej Cencora <[email protected]> | 2009-04-18 03:16:16 +0200 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2009-04-19 22:14:42 +1000 |
commit | aa04e7d475f6d6028c06c42bedc3c7d37ee78a0e (patch) | |
tree | 63251750cb5655b422f60b05f6287f6c2b90dd79 /src/mesa/drivers/dri/r300/r300_shader.c | |
parent | 27d4546f600cb444f07a4d510a328540ff37f761 (diff) |
r300: merge r300/r500 fragment program structures
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_shader.c')
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_shader.c | 55 |
1 files changed, 10 insertions, 45 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c index ef0b5d037f4..68fd8cd21e2 100644 --- a/src/mesa/drivers/dri/r300/r300_shader.c +++ b/src/mesa/drivers/dri/r300/r300_shader.c @@ -9,10 +9,8 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, GLuint id) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp; - struct r300_fragment_program *r300_fp; - struct r500_fragment_program *r500_fp; + struct r300_fragment_program *fp; switch (target) { case GL_VERTEX_STATE_PROGRAM_NV: @@ -20,28 +18,12 @@ static struct gl_program *r300NewProgram(GLcontext * ctx, GLenum target, vp = CALLOC_STRUCT(r300_vertex_program_cont); return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id); - case GL_FRAGMENT_PROGRAM_ARB: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - r500_fp = CALLOC_STRUCT(r500_fragment_program); - r500_fp->ctx = ctx; - return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, - target, id); - } else { - r300_fp = CALLOC_STRUCT(r300_fragment_program); - return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, - target, id); - } case GL_FRAGMENT_PROGRAM_NV: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - r500_fp = CALLOC_STRUCT(r500_fragment_program); - return _mesa_init_fragment_program(ctx, &r500_fp->mesa_program, - target, id); - } else { - r300_fp = CALLOC_STRUCT(r300_fragment_program); - return _mesa_init_fragment_program(ctx, &r300_fp->mesa_program, - target, id); - } + case GL_FRAGMENT_PROGRAM_ARB: + fp = CALLOC_STRUCT(r300_fragment_program); + return _mesa_init_fragment_program(ctx, &fp->Base, target, id); + default: _mesa_problem(ctx, "Bad target in r300NewProgram"); } @@ -57,20 +39,15 @@ static void r300DeleteProgram(GLcontext * ctx, struct gl_program *prog) static void r300ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { - r300ContextPtr rmesa = R300_CONTEXT(ctx); struct r300_vertex_program_cont *vp = (void *)prog; struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)prog; - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)prog; switch (target) { case GL_VERTEX_PROGRAM_ARB: vp->progs = NULL; break; case GL_FRAGMENT_PROGRAM_ARB: - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) - r500_fp->translated = GL_FALSE; - else - r300_fp->translated = GL_FALSE; + r300_fp->translated = GL_FALSE; break; } @@ -83,23 +60,11 @@ r300IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) { if (target == GL_FRAGMENT_PROGRAM_ARB) { r300ContextPtr rmesa = R300_CONTEXT(ctx); - struct gl_fragment_program * fp = (struct gl_fragment_program *) prog; - - if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - struct r500_fragment_program *r500_fp = (struct r500_fragment_program *)fp; - - if (!r500_fp->translated) - rmesa->vtbl.TranslateFragmentShader(ctx, fp); - - return !r500_fp->error; - } else { - struct r300_fragment_program *r300_fp = (struct r300_fragment_program *)fp; - - if (!r300_fp->translated) - rmesa->vtbl.TranslateFragmentShader(ctx, fp); + struct r300_fragment_program *fp = (struct r300_fragment_program *)prog; + if (!fp->translated) + rmesa->vtbl.TranslateFragmentShader(ctx, &fp->Base); - return !r300_fp->error; - } + return !fp->error; } else return GL_TRUE; } |