summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2006-01-27 14:35:24 +0000
committerAapo Tahkola <[email protected]>2006-01-27 14:35:24 +0000
commit5594ddbcfe199e7a1dc21ddf39d51364d7419902 (patch)
tree629bed0aa27a837eb766f3d0e286d525aa8e0393 /src/mesa/drivers/dri
parent58e4aa0ec9e8a7ab6b65af19102ed8bbcb0e1375 (diff)
remove broken non arb fp path
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r300/Makefile1
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_fixed_pipelines.h294
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c21
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c254
-rw-r--r--src/mesa/drivers/dri/r300/r300_texprog.c270
-rw-r--r--src/mesa/drivers/dri/r300/r300_texprog.h9
8 files changed, 0 insertions, 855 deletions
diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile
index af9d0d4efd4..3158ac8412b 100644
--- a/src/mesa/drivers/dri/r300/Makefile
+++ b/src/mesa/drivers/dri/r300/Makefile
@@ -40,7 +40,6 @@ DRIVER_SOURCES = \
r300_texmem.c \
r300_tex.c \
r300_texstate.c \
- r300_texprog.c \
r300_vertexprog.c \
r300_fragprog.c \
r300_shader.c \
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 31b643383a2..08293a00ae5 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -95,9 +95,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_mirrored_repeat", NULL},
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
-#if USE_ARB_F_P == 1
{"GL_ARB_fragment_program", NULL},
-#endif
{"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
@@ -313,7 +311,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.VertexProgram.MaxNativeParameters=256; /* r420 */
ctx->Const.VertexProgram.MaxNativeAddressRegs=1;
-#if USE_ARB_F_P
ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS;
@@ -323,7 +320,6 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
ctx->Const.FragmentProgram.MaxNativeTexIndirections = PFS_MAX_TEX_INDIRECT;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */
ctx->_MaintainTexEnvProgram = GL_TRUE;
-#endif
driInitExtensions(ctx, card_extensions, GL_TRUE);
diff --git a/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h b/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h
deleted file mode 100644
index 65e1836af47..00000000000
--- a/src/mesa/drivers/dri/r300/r300_fixed_pipelines.h
+++ /dev/null
@@ -1,294 +0,0 @@
-#ifndef __R300_FIXED_PIPELINES_H__
-#define __R300_FIXED_PIPELINES_H__
-
-/******** Flat color pipeline **********/
-static struct r300_vertex_shader_state FLAT_COLOR_VERTEX_SHADER={
- program: {
- length: 20,
-
- body:{ d: {
- EASY_VSF_OP(MUL, 0, ALL, TMP),
- VSF_PARAM(3),
- VSF_ATTR_W(0),
- EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE),
-
- EASY_VSF_OP(MUL, 1, ALL, RESULT),
- VSF_REG(1),
- VSF_ATTR_UNITY(1),
- VSF_UNITY(1),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(2),
- VSF_ATTR_Z(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(1),
- VSF_ATTR_Y(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, RESULT),
- VSF_PARAM(0),
- VSF_ATTR_X(0),
- VSF_TMP(0),
- } }
- },
-
- matrix:{
- {
- length: 16,
- body: { f: {
- 2.0,
- 0,
- 0.0,
- 0.0,
- 0,
- 2.5,
- 0,
- 0,
- 0.0,
- 0,
- -1.00,
- -1.0,
- -3.0,
- 0,
- 6.0,
- 6.0
- } }
- },
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- vector: {
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- unknown1: {
- length: 0
- },
-
- unknown2: {
- length: 0
- },
-
- program_start: 0,
- unknown_ptr1: 4,
- program_end: 4,
-
- param_offset: 0,
- param_count: 4,
-
- unknown_ptr2: 0,
- unknown_ptr3: 4
- };
-
-static struct r300_pixel_shader_state FLAT_COLOR_PIXEL_SHADER={
- program: {
- tex: {
- length: 0
- },
- alu: {
- length: 1,
- /* My understanding is that we need at least 1 instructions for pixel shader,
- in particular because alu_end==0 means there is one instruction */
- inst: {
- PFS_NOP
- }
- },
- node: {
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0}
- },
- active_nodes: 1,
- first_node_has_tex: 0,
- temp_register_count: 0,
-
- tex_offset: 0,
- tex_end: 0,
- alu_offset: 0,
- alu_end: 0
- },
-
- param_length: 0
- };
-
-
-/******** Single texture pipeline ***********/
-static struct r300_vertex_shader_state SINGLE_TEXTURE_VERTEX_SHADER={
- program: {
- length: 24,
-
- body: { d: {
- EASY_VSF_OP(MUL, 0, ALL, TMP),
- VSF_PARAM(3),
- VSF_ATTR_W(0),
- EASY_VSF_SOURCE(0, W, W, W, W, NONE, NONE),
-
- EASY_VSF_OP(MUL, 2, ALL, RESULT),
- VSF_REG(2),
- VSF_ATTR_UNITY(2),
- VSF_UNITY(2),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(2),
- VSF_ATTR_Z(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MUL, 1, ALL, RESULT),
- VSF_REG(1),
- VSF_ATTR_UNITY(1),
- VSF_UNITY(1),
-
- EASY_VSF_OP(MAD, 0, ALL, TMP),
- VSF_PARAM(1),
- VSF_ATTR_Y(0),
- VSF_TMP(0),
-
- EASY_VSF_OP(MAD, 0, ALL, RESULT),
- VSF_PARAM(0),
- VSF_ATTR_X(0),
- VSF_TMP(0),
- } }
- },
-
- matrix:{
- {
- length: 16,
- body: { f: {
- 2.0,
- 0,
- 0.0,
- 0.0,
- 0,
- 2.5,
- 0,
- 0,
- 0.0,
- 0,
- -1.00,
- -1.0,
- -3.0,
- 0,
- 6.0,
- 6.0
- } }
- },
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- vector: {
- {
- length: 0,
- },
- {
- length: 0,
- }
- },
-
- unknown1: {
- length: 0
- },
-
- unknown2: {
- length: 4,
- body: { f: {
- 0.0,
- 0.0,
- 1.0,
- 0.0
- } }
- },
-
- program_start: 0,
- unknown_ptr1: 5,
- program_end: 5,
-
- param_offset: 0,
- param_count: 4,
-
- unknown_ptr2: 0,
- unknown_ptr3: 5
- };
-
-static struct r300_pixel_shader_state SINGLE_TEXTURE_PIXEL_SHADER={
- program: {
- tex: {
- length: 1,
- inst: { 0x00018000 }
- },
- alu: {
- length: 2,
- inst:
- {
-/* I get misc problems without this after doing cold-reboot.
- This would imply that alu programming is buggy. --aet */
-#if 1
- PFS_NOP,
-#endif
-
- /* What are 0's ORed with flags ? They are register numbers that
- just happen to be 0 */
- {
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO),
- EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL),
-
-#if 0
- /* no alpha in textures */
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO),
- EASY_PFS_INSTR3(0, 1, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT)
-#endif
-
- /* alpha in textures */
- EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO),
- EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT)
- }
- }
- },
- node: {
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0},
- { 0, 0, 0, 0}
- },
-
- active_nodes: 1,
- first_node_has_tex: 1,
- temp_register_count: 1,
-
- tex_offset: 0,
- tex_end: 0,
- alu_offset: 0,
- alu_end: 0
- },
-
- param_length: 8,
- param: {
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0},
- { 0.0, 0.0, 0.0, 0.0}
- }
- };
-
-#endif
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog.c b/src/mesa/drivers/dri/r300/r300_fragprog.c
index 32d2080ce68..c82d9e98856 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog.c
@@ -48,7 +48,6 @@
#include "program.h"
#include "program_instruction.h"
#include "r300_context.h"
-#if USE_ARB_F_P == 1
#include "r300_fragprog.h"
#include "r300_reg.h"
@@ -1568,4 +1567,3 @@ static void dump_program(struct r300_fragment_program *rp)
fprintf(stderr, "00000000\n");
}
-#endif // USE_ARB_F_P == 1
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index 8f60bb3d008..582cb2cf982 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -27,10 +27,7 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
}
#endif
-#if USE_ARB_F_P == 1
case GL_FRAGMENT_PROGRAM_ARB:
-#endif
- //rmesa->current_vp = vp;
break;
default:
WARN_ONCE("Target not supported yet!\n");
@@ -41,11 +38,7 @@ static void r300BindProgram(GLcontext *ctx, GLenum target, struct program *prog)
static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
{
struct r300_vertex_program *vp;
-#if USE_ARB_F_P == 1
struct r300_fragment_program *fp;
-#else
- struct fragment_program *fp;
-#endif
struct ati_fragment_shader *afs;
switch(target){
@@ -54,22 +47,12 @@ static struct program *r300NewProgram(GLcontext *ctx, GLenum target, GLuint id)
vp=CALLOC_STRUCT(r300_vertex_program);
return _mesa_init_vertex_program(ctx, &vp->mesa_program, target, id);
case GL_FRAGMENT_PROGRAM_ARB:
-#if USE_ARB_F_P == 1
fp=CALLOC_STRUCT(r300_fragment_program);
fp->ctx = ctx;
return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
-#else
- fp=CALLOC_STRUCT(fragment_program);
- return _mesa_init_fragment_program(ctx, fp, target, id);
-#endif
case GL_FRAGMENT_PROGRAM_NV:
-#if USE_ARB_F_P == 1
fp=CALLOC_STRUCT(r300_fragment_program);
return _mesa_init_fragment_program(ctx, &fp->mesa_program, target, id);
-#else
- fp=CALLOC_STRUCT(fragment_program);
- return _mesa_init_fragment_program(ctx, fp, target, id);
-#endif
#if 00
/* _mesa_new_ati_fragment_shader() is now called instead */
case GL_FRAGMENT_SHADER_ATI:
@@ -99,9 +82,7 @@ static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
struct program *prog)
{
struct r300_vertex_program *vp=(void *)prog;
-#if USE_ARB_F_P == 1
struct r300_fragment_program *fp = (struct r300_fragment_program *) prog;
-#endif
switch(target) {
case GL_VERTEX_PROGRAM_ARB:
@@ -110,9 +91,7 @@ static void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
/*translate_vertex_shader(vp);*/
break;
case GL_FRAGMENT_PROGRAM_ARB:
-#if USE_ARB_F_P == 1
fp->translated = GL_FALSE;
-#endif
break;
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 84d92f93424..06513b17f13 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -58,12 +58,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_reg.h"
#include "r300_program.h"
#include "r300_emit.h"
-#if USE_ARB_F_P == 1
#include "r300_fragprog.h"
-#else
-#include "r300_fixed_pipelines.h"
-#include "r300_texprog.h"
-#endif
#include "r300_tex.h"
#include "r300_maos.h"
@@ -1201,7 +1196,6 @@ void r300_setup_textures(GLcontext *ctx)
fprintf(stderr, "TX_ENABLE: %08x last_hw_tmu=%d\n", r300->hw.txe.cmd[R300_TXE_ENABLE], last_hw_tmu);
}
-#if USE_ARB_F_P == 1
void r300_setup_rs_unit(GLcontext *ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
@@ -1320,77 +1314,6 @@ void r300_setup_rs_unit(GLcontext *ctx)
if (InputsRead)
WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
}
-#else
-void r300_setup_rs_unit(GLcontext *ctx)
-{
- r300ContextPtr r300 = R300_CONTEXT(ctx);
- int i, cur_reg;
- /* I'm still unsure if these are needed */
- GLuint interp_magic[8] = {
- 0x00,
- 0x40,
- 0x80,
- 0xC0,
- 0x00,
- 0x00,
- 0x00,
- 0x00
- };
- GLuint OutputsWritten;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->Base.OutputsWritten;
-
- /* This needs to be rewritten - it is a hack at best */
-
- R300_STATECHANGE(r300, ri);
- R300_STATECHANGE(r300, rc);
- R300_STATECHANGE(r300, rr);
-
- cur_reg = 0;
- r300->hw.rr.cmd[R300_RR_ROUTE_0] = 0;
-
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- r300->hw.ri.cmd[R300_RI_INTERP_0+i] = 0
- | R300_RS_INTERP_USED
- | (cur_reg << R300_RS_INTERP_SRC_SHIFT)
- | interp_magic[i];
-// fprintf(stderr, "RS_INTERP[%d] = 0x%x\n", i, r300->hw.ri.cmd[R300_RI_INTERP_0+i]);
-
- if (TMU_ENABLED(ctx, i)) {
- assert(r300->state.texture.tc_count != 0);
- r300->hw.rr.cmd[R300_RR_ROUTE_0 + cur_reg] = 0
- | R300_RS_ROUTE_ENABLE
- | i /* source INTERP */
- | (cur_reg << R300_RS_ROUTE_DEST_SHIFT);
-// fprintf(stderr, "RS_ROUTE[%d] = 0x%x\n", cur_reg, r300->hw.rr.cmd[R300_RR_ROUTE_0 + cur_reg]);
- cur_reg++;
- }
- }
- if (hw_tcl_on ? OutputsWritten & (1<<VERT_RESULT_COL0) : r300->state.render_inputs & _TNL_BIT_COLOR0)
- r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
- | R300_RS_ROUTE_0_COLOR
- | (cur_reg << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
-
-// fprintf(stderr, "ADJ_RR0 = 0x%x\n", r300->hw.rr.cmd[R300_RR_ROUTE_0]);
-
- r300->hw.rc.cmd[1] = 0
- | (cur_reg /* count */ << R300_RS_CNTL_TC_CNT_SHIFT)
- | (1 << R300_RS_CNTL_CI_CNT_SHIFT)
- | R300_RS_CNTL_0_UNKNOWN_18;
-
- if (r300->state.texture.tc_count > 0) {
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, cur_reg);
- r300->hw.rc.cmd[2] = 0xC0 | (cur_reg-1); /* index of highest */
- } else {
- r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, 1);
- r300->hw.rc.cmd[2] = 0x0;
- }
-
-
-// fprintf(stderr, "rendering with %d texture co-ordinate sets\n", cur_reg);
-}
-#endif // USE_ARB_F_P
#define vpucount(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
@@ -1737,7 +1660,6 @@ static unsigned int r300PackFloat24(float f)
return float24;
}
-#if USE_ARB_F_P == 1
void r300SetupPixelShader(r300ContextPtr rmesa)
{
GLcontext *ctx = rmesa->radeon.glCtx;
@@ -1802,182 +1724,6 @@ void r300SetupPixelShader(r300ContextPtr rmesa)
}
rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmdpacket0(R300_PFS_PARAM_0_X, rp->const_nr*4);
}
-#else
-/* just a skeleton for now.. */
-void r300GenerateTexturePixelShader(r300ContextPtr r300)
-{
- int i, mtu;
- mtu = r300->radeon.glCtx->Const.MaxTextureUnits;
- GLenum envMode;
- GLuint OutputsWritten = CURRENT_VERTEX_SHADER(r300->radeon.glCtx)->OutputsWritten;
-
- int tex_inst=0, alu_inst=0;
-
- for(i=0;i<mtu;i++){
- /* No need to proliferate {} */
- if(!TMU_ENABLED(r300->radeon.glCtx, i))continue;
-
- envMode = r300->radeon.glCtx->Texture.Unit[i].EnvMode;
- //fprintf(stderr, "envMode=%s\n", _mesa_lookup_enum_by_nr(envMode));
-
- /* Fetch textured pixel */
-
- r300->state.pixel_shader.program.tex.inst[tex_inst]=0x00018000;
- tex_inst++;
-
- switch(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeRGB){
- case GL_REPLACE:
- WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL);
- break;
- case GL_MODULATE:
- WARN_ONCE("ModeRGB==GL_MODULATE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 1, 0 | PFS_FLAG_CONST, NONE, ALL);
-
- break;
- default:
- WARN_ONCE("ModeRGB=%s is not implemented yet !\n",
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeRGB));
- /* PFS_NOP */
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst0=
- EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst1=
- EASY_PFS_INSTR1(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, NONE, ALL);
- }
- switch(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeA){
- case GL_REPLACE:
- WARN_ONCE("ModeA==GL_REPLACE is possibly broken.\n");
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 0| PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT);
-
-#if 0
- fprintf(stderr, "numArgsA=%d sourceA[0]=%s op=%d\n",
- r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->_NumArgsA,
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->SourceA[0]),
- r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->OperandA[0]-GL_SRC_ALPHA);
-#endif
- break;
- case GL_MODULATE:
- WARN_ONCE("ModeA==GL_MODULATE is possibly broken.\n");
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 1, 0 | PFS_FLAG_CONST, OUTPUT);
-
- break;
- default:
- WARN_ONCE("ModeA=%s is not implemented yet !\n",
- _mesa_lookup_enum_by_nr(r300->radeon.glCtx->Texture.Unit[i]._CurrentCombine->ModeA));
- /* PFS_NOP */
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst2=
- EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
-
- r300->state.pixel_shader.program.alu.inst[alu_inst].inst3=
- EASY_PFS_INSTR3(0, 0, 0 | PFS_FLAG_CONST, 0 | PFS_FLAG_CONST, OUTPUT);
-
- }
-
- alu_inst++;
- }
-
- r300->state.pixel_shader.program.tex.length=tex_inst;
- r300->state.pixel_shader.program.tex_offset=0;
- r300->state.pixel_shader.program.tex_end=tex_inst-1;
-
-#if 0
- /* saturate last instruction, like i915 driver does */
- r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst0|=R300_FPI0_OUTC_SAT;
- r300->state.pixel_shader.program.alu.inst[alu_inst-1].inst2|=R300_FPI2_OUTA_SAT;
-#endif
-
- r300->state.pixel_shader.program.alu.length=alu_inst;
- r300->state.pixel_shader.program.alu_offset=0;
- r300->state.pixel_shader.program.alu_end=alu_inst-1;
-}
-
-void r300SetupPixelShader(r300ContextPtr rmesa)
-{
-int i,k;
-
- /* This needs to be replaced by pixel shader generation code */
-
- /* textures enabled ? */
- if(rmesa->state.texture.tc_count>0){
-#if 1
- r300GenerateTextureFragmentShader(rmesa);
-#else
- rmesa->state.pixel_shader=SINGLE_TEXTURE_PIXEL_SHADER;
- r300GenerateTexturePixelShader(rmesa);
-#endif
- } else {
- rmesa->state.pixel_shader=FLAT_COLOR_PIXEL_SHADER;
- }
-
- R300_STATECHANGE(rmesa, fpt);
- for(i=0;i<rmesa->state.pixel_shader.program.tex.length;i++)
- rmesa->hw.fpt.cmd[R300_FPT_INSTR_0+i]=rmesa->state.pixel_shader.program.tex.inst[i];
- rmesa->hw.fpt.cmd[R300_FPT_CMD_0]=cmdpacket0(R300_PFS_TEXI_0, rmesa->state.pixel_shader.program.tex.length);
-
-#define OUTPUT_FIELD(st, reg, field) \
- R300_STATECHANGE(rmesa, st); \
- for(i=0;i<rmesa->state.pixel_shader.program.alu.length;i++) \
- rmesa->hw.st.cmd[R300_FPI_INSTR_0+i]=rmesa->state.pixel_shader.program.alu.inst[i].field;\
- rmesa->hw.st.cmd[R300_FPI_CMD_0]=cmdpacket0(reg, rmesa->state.pixel_shader.program.alu.length);
-
- OUTPUT_FIELD(fpi[0], R300_PFS_INSTR0_0, inst0);
- OUTPUT_FIELD(fpi[1], R300_PFS_INSTR1_0, inst1);
- OUTPUT_FIELD(fpi[2], R300_PFS_INSTR2_0, inst2);
- OUTPUT_FIELD(fpi[3], R300_PFS_INSTR3_0, inst3);
-#undef OUTPUT_FIELD
-
- R300_STATECHANGE(rmesa, fp);
- for(i=0;i<4;i++){
- rmesa->hw.fp.cmd[R300_FP_NODE0+i]=
- (rmesa->state.pixel_shader.program.node[i].alu_offset << R300_PFS_NODE_ALU_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].alu_end << R300_PFS_NODE_ALU_END_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.node[i].tex_end << R300_PFS_NODE_TEX_END_SHIFT)
- | ( (i==3) ? R300_PFS_NODE_LAST_NODE : 0);
- }
-
- /* PFS_CNTL_0 */
- rmesa->hw.fp.cmd[R300_FP_CNTL0]=
- (rmesa->state.pixel_shader.program.active_nodes-1)
- | (rmesa->state.pixel_shader.program.first_node_has_tex<<3);
- /* PFS_CNTL_1 */
- rmesa->hw.fp.cmd[R300_FP_CNTL1]=rmesa->state.pixel_shader.program.temp_register_count;
- /* PFS_CNTL_2 */
- rmesa->hw.fp.cmd[R300_FP_CNTL2]=
- (rmesa->state.pixel_shader.program.alu_offset << R300_PFS_CNTL_ALU_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.alu_end << R300_PFS_CNTL_ALU_END_SHIFT)
- | (rmesa->state.pixel_shader.program.tex_offset << R300_PFS_CNTL_TEX_OFFSET_SHIFT)
- | (rmesa->state.pixel_shader.program.tex_end << R300_PFS_CNTL_TEX_END_SHIFT);
-
- R300_STATECHANGE(rmesa, fpp);
- for(i=0;i<rmesa->state.pixel_shader.param_length;i++){
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+0]=r300PackFloat32(rmesa->state.pixel_shader.param[i].x);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+1]=r300PackFloat32(rmesa->state.pixel_shader.param[i].y);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+2]=r300PackFloat32(rmesa->state.pixel_shader.param[i].z);
- rmesa->hw.fpp.cmd[R300_FPP_PARAM_0+4*i+3]=r300PackFloat32(rmesa->state.pixel_shader.param[i].w);
- }
- rmesa->hw.fpp.cmd[R300_FPP_CMD_0]=cmdpacket0(R300_PFS_PARAM_0_X, rmesa->state.pixel_shader.param_length);
-
-}
-#endif
/**
* Called by Mesa after an internal state update.
diff --git a/src/mesa/drivers/dri/r300/r300_texprog.c b/src/mesa/drivers/dri/r300/r300_texprog.c
deleted file mode 100644
index 71d28db0529..00000000000
--- a/src/mesa/drivers/dri/r300/r300_texprog.c
+++ /dev/null
@@ -1,270 +0,0 @@
-#include "glheader.h"
-#include "state.h"
-#include "imports.h"
-#include "enums.h"
-#include "macros.h"
-#include "context.h"
-#include "dd.h"
-#include "simple_list.h"
-
-#include "api_arrayelt.h"
-#include "swrast/swrast.h"
-#include "swrast_setup/swrast_setup.h"
-#include "array_cache/acache.h"
-#include "tnl/tnl.h"
-#include "texformat.h"
-
-#include "radeon_ioctl.h"
-#include "radeon_state.h"
-#include "r300_context.h"
-#if USE_ARB_F_P == 0
-#include "r300_ioctl.h"
-#include "r300_state.h"
-#include "r300_reg.h"
-#include "r300_program.h"
-#include "r300_emit.h"
-#include "r300_fixed_pipelines.h"
-#include "r300_tex.h"
-#include "pixel_shader.h"
-#include "r300_texprog.h"
-
-/* TODO: we probably should have a better way to emit alu instructions */
-#define INST0 p->alu.inst[p->alu.length].inst0 =
-#define INST1 p->alu.inst[p->alu.length].inst1 =
-#define INST2 p->alu.inst[p->alu.length].inst2 =
-#define INST3 p->alu.inst[p->alu.length].inst3 =
-#define EMIT_INST p->alu.length++
-
-void emit_tex(struct r300_pixel_shader_program *p, GLuint dest, GLuint unit, GLuint src)
-{
- p->tex.inst[p->tex.length++] = 0
- | (src << R300_FPITX_SRC_SHIFT)
- | (dest << R300_FPITX_DST_SHIFT)
- | (unit << R300_FPITX_IMAGE_SHIFT)
- /* I don't know if this is needed, but the hardcoded 0x18000 set it, so I will too */
- | (3 << 15);
-// fprintf(stderr, "emit texinst: 0x%x\n", p->tex.inst[p->tex.length-1]);
-}
-
-GLuint get_source(struct r300_pixel_shader_state *ps, GLenum src, GLuint unit, GLuint tc_reg) {
- switch (src) {
- case GL_TEXTURE:
- if (!ps->have_sample) {
- emit_tex(&ps->program, tc_reg, unit, tc_reg);
- ps->have_sample = 1;
- }
- return tc_reg;
- case GL_CONSTANT:
- WARN_ONCE("TODO: Implement envcolor\n");
- return ps->color_reg;
- case GL_PRIMARY_COLOR:
- return ps->color_reg;
- case GL_PREVIOUS:
- return ps->src_previous;
- default:
- WARN_ONCE("Unknown source enum\n");
- return ps->src_previous;
- }
-}
-
-GLuint get_temp(struct r300_pixel_shader_program *p)
-{
- return p->temp_register_count++;
-}
-
-inline void emit_texenv_color(r300ContextPtr r300, struct r300_pixel_shader_state *ps,
- GLuint out, GLenum envmode, GLenum format, GLuint unit, GLuint tc_reg) {
- struct r300_pixel_shader_program *p = &ps->program;
-
- const GLuint Cp = get_source(ps, GL_PREVIOUS, unit, tc_reg);
- const GLuint Cs = get_source(ps, GL_TEXTURE, unit, tc_reg);
-
- switch(envmode) {
- case GL_DECAL: /* TODO */
- case GL_BLEND: /* TODO */
- case GL_REPLACE:
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = Cs
- INST1 EASY_PFS_INSTR1(out, Cs, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- case GL_MODULATE:
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = CpCs
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, SRC1C_XYZ, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, Cs, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- case GL_ADD:
- switch (format) {
- case GL_ALPHA:
- // Cv = Cp
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(out, Cp, PFS_FLAG_CONST, PFS_FLAG_CONST, ALL, NONE);
- break;
- default:
- // Cv = Cp + Cs
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, SRC1C_XYZ);
- INST1 EASY_PFS_INSTR1(out, Cp, Cs, PFS_FLAG_CONST, ALL, NONE);
- break;
- }
- break;
- default:
- fprintf(stderr, "%s: should never get here!\n", __func__);
- break;
- }
-
- return;
-}
-
-inline void emit_texenv_alpha(r300ContextPtr r300, struct r300_pixel_shader_state *ps,
- GLuint out, GLenum envmode, GLenum format, GLuint unit, GLuint tc_reg) {
- struct r300_pixel_shader_program *p = &ps->program;
-
- const GLuint Ap = get_source(ps, GL_PREVIOUS, unit, tc_reg);
- const GLuint As = get_source(ps, GL_TEXTURE, unit, tc_reg);
-
- switch(envmode) {
- case GL_DECAL: /* TODO */
- case GL_BLEND: /* TODO */
- case GL_REPLACE:
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- switch (format) {
- case GL_LUMINANCE:
- case GL_RGB:
- // Av = Ap
- INST3 EASY_PFS_INSTR3(out, Ap, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- default:
- INST3 EASY_PFS_INSTR3(out, As, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- }
- break;
- case GL_MODULATE:
- case GL_ADD:
- switch (format) {
- case GL_LUMINANCE:
- case GL_RGB:
- // Av = Ap
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- INST3 EASY_PFS_INSTR3(out, Ap, PFS_FLAG_CONST, PFS_FLAG_CONST, REG);
- break;
- default:
- // Av = ApAs
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, SRC1A, ZERO);
- INST3 EASY_PFS_INSTR3(out, Ap, As, PFS_FLAG_CONST, REG);
- break;
- }
- break;
- default:
- fprintf(stderr, "%s: should never get here!\n", __func__);
- break;
- }
-
- return;
-}
-
-GLuint emit_texenv(r300ContextPtr r300, GLuint tc_reg, GLuint unit)
-{
- struct r300_pixel_shader_state *ps = &r300->state.pixel_shader;
- struct r300_pixel_shader_program *p = &ps->program;
- GLcontext *ctx = r300->radeon.glCtx;
- struct gl_texture_object *texobj = ctx->Texture.Unit[unit]._Current;
- GLenum envmode = ctx->Texture.Unit[unit].EnvMode;
- GLenum format = texobj->Image[0][texobj->BaseLevel]->Format;
-
- const GLuint out = tc_reg;
- const GLuint Cf = get_source(ps, GL_PRIMARY_COLOR, unit, tc_reg);
-
- WARN_ONCE("Texture environments are currently incomplete / wrong! Help me!\n");
-// fprintf(stderr, "EnvMode = %s\n", _mesa_lookup_enum_by_nr(ctx->Texture.Unit[unit].EnvMode));
-
- switch (envmode) {
- case GL_REPLACE:
- case GL_MODULATE:
- case GL_DECAL:
- case GL_BLEND:
- case GL_ADD:
- /* Maybe these should be combined? I thought it'd be messy */
- emit_texenv_color(r300, ps, out, envmode, format, unit, tc_reg);
- emit_texenv_alpha(r300, ps, out, envmode, format, unit, tc_reg);
- EMIT_INST;
- return out;
- break;
- case GL_COMBINE:
- WARN_ONCE("EnvMode == GL_COMBINE unsupported! Help Me!!\n");
- return get_source(ps, GL_TEXTURE, unit, tc_reg);
- break;
- default:
- WARN_ONCE("Unknown EnvMode == %d, name=%s\n", envmode,
- _mesa_lookup_enum_by_nr(envmode));
- return get_source(ps, GL_TEXTURE, unit, tc_reg);
- break;
- }
-
-}
-
-void r300GenerateTextureFragmentShader(r300ContextPtr r300)
-{
- struct r300_pixel_shader_state *ps = &r300->state.pixel_shader;
- struct r300_pixel_shader_program *p = &ps->program;
- GLcontext *ctx = r300->radeon.glCtx;
- int i, tc_reg;
- GLuint OutputsWritten;
-
- if(hw_tcl_on)
- OutputsWritten = CURRENT_VERTEX_SHADER(ctx)->OutputsWritten;
-
- p->tex.length = 0;
- p->alu.length = 0;
- p->active_nodes = 1;
- p->first_node_has_tex = 1;
- p->temp_register_count = r300->state.texture.tc_count + 1; /* texcoords and colour reg */
-
- ps->color_reg = r300->state.texture.tc_count;
- ps->src_previous = ps->color_reg;
-
- tc_reg = 0;
- for (i=0;i<ctx->Const.MaxTextureUnits;i++) {
- if (TMU_ENABLED(ctx, i)) {
- ps->have_sample = 0;
- ps->src_previous = emit_texenv(r300, tc_reg, i);
- tc_reg++;
- }
- }
-
-/* Do a MOV from last output, to destination reg.. This won't be needed when we
- * have a better way of emitting alu instructions
- */
- INST0 EASY_PFS_INSTR0(MAD, SRC0C_XYZ, ONE, ZERO);
- INST1 EASY_PFS_INSTR1(0, ps->src_previous, PFS_FLAG_CONST, PFS_FLAG_CONST, NONE, ALL);
- INST2 EASY_PFS_INSTR2(MAD, SRC0A, ONE, ZERO);
- INST3 EASY_PFS_INSTR3(0, ps->src_previous, PFS_FLAG_CONST, PFS_FLAG_CONST, OUTPUT);
- EMIT_INST;
-
- p->node[3].tex_end = ps->program.tex.length - 1;
- p->node[3].tex_offset = 0;
- p->node[3].alu_end = ps->program.alu.length - 1;
- p->node[3].alu_offset = 0;
-
- p->tex_end = ps->program.tex.length - 1;
- p->tex_offset = 0;
- p->alu_end = ps->program.alu.length - 1;
- p->alu_offset = 0;
-}
-#endif // USE_ARB_F_P == 0
-
diff --git a/src/mesa/drivers/dri/r300/r300_texprog.h b/src/mesa/drivers/dri/r300/r300_texprog.h
deleted file mode 100644
index 4e91a11699f..00000000000
--- a/src/mesa/drivers/dri/r300/r300_texprog.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __R300_TEXPROG_H_
-#define __R300_TEXPROG_H_
-
-#include "r300_context.h"
-
-void r300GenerateTextureFragmentShader(r300ContextPtr r300);
-
-#endif
-