r300-gallium: r300-fs: Moar.
This commit is contained in:
@@ -169,10 +169,7 @@ struct r300_fragment_shader {
|
|||||||
int indirections;
|
int indirections;
|
||||||
|
|
||||||
/* Indirection node offsets */
|
/* Indirection node offsets */
|
||||||
int offset0;
|
int alu_offset[4];
|
||||||
int offset1;
|
|
||||||
int offset2;
|
|
||||||
int offset3;
|
|
||||||
|
|
||||||
/* Machine instructions */
|
/* Machine instructions */
|
||||||
struct {
|
struct {
|
||||||
|
@@ -22,6 +22,14 @@
|
|||||||
|
|
||||||
#include "r300_debug.h"
|
#include "r300_debug.h"
|
||||||
|
|
||||||
|
static void r300_dump_fs(struct r300_fragment_shader* fs)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < fs->alu_instruction_count; i++) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static char* r500_fs_swiz[] = {
|
static char* r500_fs_swiz[] = {
|
||||||
" R",
|
" R",
|
||||||
" G",
|
" G",
|
||||||
|
@@ -90,12 +90,12 @@ void r300_emit_fragment_shader(struct r300_context* r300,
|
|||||||
OUT_CS_REG(R300_US_CONFIG, fs->indirections);
|
OUT_CS_REG(R300_US_CONFIG, fs->indirections);
|
||||||
OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size);
|
OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size);
|
||||||
/* XXX figure out exactly how big the sizes are on this reg */
|
/* XXX figure out exactly how big the sizes are on this reg */
|
||||||
OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
|
OUT_CS_REG(R300_US_CODE_OFFSET, 0x40);
|
||||||
/* XXX figure these ones out a bit better kthnx */
|
/* XXX figure these ones out a bit better kthnx */
|
||||||
OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
|
OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
|
||||||
OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
|
OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
|
||||||
OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
|
OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
|
||||||
OUT_CS_REG(R300_US_CODE_ADDR_3, R300_RGBA_OUT);
|
OUT_CS_REG(R300_US_CODE_ADDR_3, 0x40 | R300_RGBA_OUT);
|
||||||
|
|
||||||
for (i = 0; i < fs->alu_instruction_count; i++) {
|
for (i = 0; i < fs->alu_instruction_count; i++) {
|
||||||
OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i),
|
OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i),
|
||||||
|
@@ -278,22 +278,20 @@ static INLINE void r300_emit_maths(struct r300_fragment_shader* fs,
|
|||||||
{
|
{
|
||||||
int i = fs->alu_instruction_count;
|
int i = fs->alu_instruction_count;
|
||||||
|
|
||||||
fs->instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
|
fs->instructions[i].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
|
||||||
R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
|
R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
|
||||||
R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
|
R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
|
||||||
R300_ALU_OUTC_MAD;
|
r300_rgb_op(op);
|
||||||
fs->instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
|
fs->instructions[i].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
|
||||||
R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ;
|
R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ;
|
||||||
fs->instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
|
fs->instructions[i].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
|
||||||
R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) |
|
R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
|
||||||
R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
|
R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
|
||||||
R300_ALU_OUTA_MAD;
|
r300_alpha_op(op);
|
||||||
fs->instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
|
fs->instructions[i].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
|
||||||
R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT;
|
R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT;
|
||||||
|
|
||||||
fs->alu_instruction_count++;
|
fs->alu_instruction_count++;
|
||||||
fs->indirections = 0;
|
|
||||||
fs->shader.stack_size = 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup an ALU operation. */
|
/* Setup an ALU operation. */
|
||||||
@@ -554,11 +552,15 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void r300_fs_finalize(struct r3xx_fragment_shader* fs,
|
||||||
|
struct r300_fs_asm* assembler)
|
||||||
|
{
|
||||||
|
fs->stack_size = assembler->temp_count + assembler->temp_offset;
|
||||||
|
}
|
||||||
|
|
||||||
static void r500_fs_finalize(struct r500_fragment_shader* fs,
|
static void r500_fs_finalize(struct r500_fragment_shader* fs,
|
||||||
struct r300_fs_asm* assembler)
|
struct r300_fs_asm* assembler)
|
||||||
{
|
{
|
||||||
fs->shader.stack_size = assembler->temp_count + assembler->temp_offset;
|
|
||||||
|
|
||||||
/* XXX should this just go with OPCODE_END? */
|
/* XXX should this just go with OPCODE_END? */
|
||||||
fs->instructions[fs->instruction_count - 1].inst0 |=
|
fs->instructions[fs->instruction_count - 1].inst0 |=
|
||||||
R500_INST_LAST;
|
R500_INST_LAST;
|
||||||
@@ -627,10 +629,16 @@ void r300_translate_fragment_shader(struct r300_context* r300,
|
|||||||
debug_printf("r300: %d total constants, "
|
debug_printf("r300: %d total constants, "
|
||||||
"%d from user and %d from immediates\n", consts->count,
|
"%d from user and %d from immediates\n", consts->count,
|
||||||
consts->user_count, assembler->imm_count);
|
consts->user_count, assembler->imm_count);
|
||||||
//r500_fs_finalize(fs, assembler);
|
r300_fs_finalize(fs, assembler);
|
||||||
|
if (is_r500) {
|
||||||
|
r500_fs_finalize((struct r500_fragment_shader*)fs, assembler);
|
||||||
|
}
|
||||||
|
|
||||||
tgsi_dump(fs->state.tokens);
|
tgsi_dump(fs->state.tokens);
|
||||||
//r500_fs_dump(fs);
|
/* XXX finish r300 dumper too */
|
||||||
|
if (is_r500) {
|
||||||
|
r500_fs_dump((struct r500_fragment_shader*)fs);
|
||||||
|
}
|
||||||
|
|
||||||
tgsi_parse_free(&parser);
|
tgsi_parse_free(&parser);
|
||||||
FREE(assembler);
|
FREE(assembler);
|
||||||
|
@@ -115,8 +115,8 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
|
|||||||
*/
|
*/
|
||||||
.alu_instruction_count = 1,
|
.alu_instruction_count = 1,
|
||||||
.tex_instruction_count = 0,
|
.tex_instruction_count = 0,
|
||||||
.indirections = 1,
|
.indirections = 0,
|
||||||
.shader.stack_size = 2,
|
.shader.stack_size = 1,
|
||||||
|
|
||||||
.instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
|
.instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
|
||||||
R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
|
R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
|
||||||
|
Reference in New Issue
Block a user