From e34dc8227c1fa8bc9ffcd311de701053a633a7ec Mon Sep 17 00:00:00 2001 From: Nicolai Haehnle Date: Sat, 14 Jun 2008 01:46:19 +0200 Subject: r300_fragprog: Refactor TEX transformation Streamlining source and destination registers, as well as texcoord scaling for RECT textures is now done in a radeon_program based transformation. The idea is that this will allow us to optimize away unnecessary indirections more easily. --- src/mesa/drivers/dri/r300/radeon_program.h | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'src/mesa/drivers/dri/r300/radeon_program.h') diff --git a/src/mesa/drivers/dri/r300/radeon_program.h b/src/mesa/drivers/dri/r300/radeon_program.h index 18091ac02a..3cde4d4f6f 100644 --- a/src/mesa/drivers/dri/r300/radeon_program.h +++ b/src/mesa/drivers/dri/r300/radeon_program.h @@ -41,6 +41,13 @@ enum { CLAUSE_TEX }; +enum { + PROGRAM_BUILTIN = PROGRAM_FILE_MAX /**< not a real register, but a special swizzle constant */ +}; + +#define SWIZZLE_0000 MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO) +#define SWIZZLE_1111 MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE) + /** * A clause is simply a sequence of instructions that are executed * in order. @@ -107,4 +114,50 @@ void radeonCompilerEraseClauses( int start, int end); +struct prog_instruction* radeonClauseInsertInstructions( + struct radeon_compiler *compiler, + struct radeon_clause *clause, + int position, int count); + +/** + * + */ +struct radeon_program_transform_context { + struct radeon_compiler *compiler; + + /** + * Destination clause where new instructions must be written. + */ + struct radeon_clause *dest; + + /** + * Original clause that is currently being transformed. + */ + struct radeon_clause *src; +}; + +/** + * A transformation that can be passed to \ref radeonClauseLinearTransform. + * + * The function will be called once for each instruction. + * It has to either emit the appropriate transformed code for the instruction + * and return GL_TRUE, or return GL_FALSE if it doesn't understand the + * instruction. + * + * The function gets passed the userData as last parameter. + */ +struct radeon_program_transformation { + GLboolean (*function)( + struct radeon_program_transform_context*, + struct prog_instruction*, + void*); + void *userData; +}; + +void radeonClauseLocalTransform( + struct radeon_compiler *compiler, + struct radeon_clause *clause, + int num_transformations, + struct radeon_program_transformation* transformations); + #endif -- cgit v1.2.3