r500: setup fragment program constant emission atom
authorDave Airlie <airlied@redhat.com>
Fri, 21 Mar 2008 07:05:29 +0000 (17:05 +1000)
committerAlex Deucher <alex@botch2.com>
Fri, 2 May 2008 19:13:48 +0000 (15:13 -0400)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_emit.h

index 3cfb7cf..248de7e 100644 (file)
@@ -398,7 +398,9 @@ void r300InitCmdBuf(r300ContextPtr r300)
 
        if (is_r500) {
                ALLOC_STATE(r500fp, variable, R300_FPI_CMDSIZE, 0);
-               r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0);
+               r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 0, 0);
+               ALLOC_STATE(r500fp_const, variable, R300_FPI_CMDSIZE, 0);
+               r300->hw.r500fp_const.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0, 1, 0);
        } else {
                ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
                r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
index 012c0fe..45dafd6 100644 (file)
@@ -490,6 +490,7 @@ struct r300_hw_state {
        struct r300_state_atom fpt;     /* texi - (4620) */
        struct r300_state_atom us_out_fmt;      /* (46A4) */
        struct r300_state_atom r500fp;  /* r500 fp instructions */
+       struct r300_state_atom r500fp_const;    /* r500 fp constants */
        struct r300_state_atom fpi[4];  /* fp instructions (46C0/47C0/48C0/49C0) */
        struct r300_state_atom fogs;    /* fog state (4BC0) */
        struct r300_state_atom fogc;    /* fog color (4BC8) */
index 50e7e4f..5130230 100644 (file)
@@ -74,14 +74,16 @@ static inline uint32_t cmdvpu(int addr, int count)
        return cmd.u;
 }
 
-static inline uint32_t cmdr500fp(int addr, int count)
+static inline uint32_t cmdr500fp(int addr, int count, int type, int clamp)
 {
        drm_r300_cmd_header_t cmd;
 
-       cmd.vpu.cmd_type = R300_CMD_R500FP;
-       cmd.vpu.count = count;
-       cmd.vpu.adrhi = ((unsigned int)addr & 0xFF00) >> 8;
-       cmd.vpu.adrlo = ((unsigned int)addr & 0x00FF);
+       cmd.r500fp.cmd_type = R300_CMD_R500FP;
+       cmd.r500fp.count = count;
+       cmd.r500fp.adrhi_flags = ((unsigned int)addr & 0x100) >> 8;
+       cmd.r500fp.adrhi_flags |= type ? R500FP_CONSTANT_TYPE : 0;
+       cmd.r500fp.adrhi_flags |= clamp ? R500FP_CONSTANT_CLAMP : 0;
+       cmd.r500fp.adrlo = ((unsigned int)addr & 0x00FF);
 
        return cmd.u;
 }
@@ -188,7 +190,7 @@ static inline uint32_t cmdpacify(void)
                                        __FUNCTION__);                  \
                cmd_reserved = _n+1;                                    \
                cmd_written =1;                                         \
-               cmd[0].i = cmdr500fp((dest), _n/6);                     \
+               cmd[0].i = cmdr500fp((dest), _n/6, 0, 0);               \
        } while (0);
 
 #define start_packet3(packet, count)                                   \