};
-struct svga_arl_consts {
+struct svga_arl_consts
+{
int number;
int idx;
int swizzle;
int arl_num;
};
-/* Internal functions:
- */
+/**
+ * This is the context/state used during TGSI->SVGA shader translation.
+ */
struct svga_shader_emitter
{
unsigned size;
int nr_hw_float_const;
int nr_hw_int_const;
int nr_hw_temp;
-
+
int insn_offset;
int internal_temp_count;
};
-boolean svga_shader_emit_dword( struct svga_shader_emitter *emit,
- unsigned dword );
+boolean
+svga_shader_emit_dword(struct svga_shader_emitter *emit, unsigned dword);
-boolean svga_shader_emit_dwords( struct svga_shader_emitter *emit,
- const unsigned *dwords,
- unsigned nr );
+boolean
+svga_shader_emit_dwords(struct svga_shader_emitter *emit,
+ const unsigned *dwords, unsigned nr);
-boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit,
- unsigned opcode );
+boolean
+svga_shader_emit_opcode(struct svga_shader_emitter *emit,
+ unsigned opcode);
-boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
- const struct tgsi_token *tokens );
+boolean
+svga_shader_emit_instructions(struct svga_shader_emitter *emit,
+ const struct tgsi_token *tokens);
-boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit,
- const struct tgsi_full_declaration *decl );
-
-
-static INLINE boolean emit_instruction( struct svga_shader_emitter *emit,
- SVGA3dShaderInstToken opcode )
-{
- return svga_shader_emit_opcode( emit, opcode.value );
-}
+boolean
+svga_translate_decl_sm30(struct svga_shader_emitter *emit,
+ const struct tgsi_full_declaration *decl);
#define TRANSLATE_SWIZZLE(x,y,z,w) ((x) | ((y) << 2) | ((z) << 4) | ((w) << 6))
TRANSLATE_SWIZZLE(TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W)
+/** Emit the given SVGA3dShaderInstToken opcode */
+static INLINE boolean
+emit_instruction(struct svga_shader_emitter *emit,
+ SVGA3dShaderInstToken opcode)
+{
+ return svga_shader_emit_opcode(emit, opcode.value);
+}
+
+/** Generate a SVGA3dShaderInstToken for the given SVGA3D shader opcode */
static INLINE SVGA3dShaderInstToken
-inst_token( unsigned opcode )
+inst_token(unsigned opcode)
{
SVGA3dShaderInstToken inst;
* Note that this function is used to create tokens for output registers,
* temp registers AND constants (see emit_def_const()).
*/
-static INLINE SVGA3dShaderDestToken
-dst_register( unsigned file,
- int number )
+static INLINE SVGA3dShaderDestToken
+dst_register(unsigned file, int number)
{
SVGA3dShaderDestToken dest;
dest.shfScale = 0;
dest.type_lower = file & 0x7;
dest.reserved0 = 1; /* is_reg */
-
+
return dest;
}
+
+/**
+ * Apply a writemask to the given SVGA3dShaderDestToken, returning a
+ * new SVGA3dShaderDestToken.
+ */
static INLINE SVGA3dShaderDestToken
-writemask( SVGA3dShaderDestToken dest,
- unsigned mask )
+writemask(SVGA3dShaderDestToken dest, unsigned mask)
{
assert(dest.mask & mask);
dest.mask &= mask;
}
-static INLINE SVGA3dShaderSrcToken
-src_token( unsigned file, int number )
+/** Create a SVGA3dShaderSrcToken given a register file and number */
+static INLINE SVGA3dShaderSrcToken
+src_token(unsigned file, int number)
{
SVGA3dShaderSrcToken src;
}
-static INLINE struct src_register
-src_register( unsigned file, int number )
+/** Create a src_register given a register file and register number */
+static INLINE struct src_register
+src_register(unsigned file, int number)
{
struct src_register src;
-
- src.base = src_token( file, number );
+
+ src.base = src_token(file, number);
src.indirect.value = 0;
return src;
}
-static INLINE SVGA3dShaderDestToken dst( struct src_register src )
+/** Translate src_register into SVGA3dShaderDestToken */
+static INLINE SVGA3dShaderDestToken
+dst(struct src_register src)
{
- return dst_register( SVGA3dShaderGetRegType( src.base.value ),
- src.base.num );
+ return dst_register(SVGA3dShaderGetRegType(src.base.value), src.base.num);
}
-static INLINE struct src_register src( SVGA3dShaderDestToken dst )
+
+/** Translate SVGA3dShaderDestToken to a src_register */
+static INLINE struct src_register
+src(SVGA3dShaderDestToken dst)
{
- return src_register( SVGA3dShaderGetRegType( dst.value ),
- dst.num );
+ return src_register(SVGA3dShaderGetRegType(dst.value), dst.num);
}
-
#endif