psl1ght
A free SDK for Sony's PS3 console
rsx_program.h
Go to the documentation of this file.
1 
5 #ifndef __RSX_PROGRAM_H__
6 #define __RSX_PROGRAM_H__
7 
8 #include <ppu-types.h>
9 
10 #define PARAM_FLOAT 0
11 #define PARAM_FLOAT2 1
12 #define PARAM_FLOAT3 2
13 #define PARAM_FLOAT4 3
14 #define PARAM_FLOAT4x4 4
15 #define PARAM_SAMPLER1D 5
16 #define PARAM_SAMPLER2D 6
17 #define PARAM_SAMPLER3D 7
18 #define PARAM_SAMPLERCUBE 8
19 #define PARAM_SAMPLERRECT 9
20 #define PARAM_UNKNOWN 0xff
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 typedef struct rsx_vp
30 {
31  u16 magic;
32  u16 num_attrib;
33  u32 attrib_off;
35  u32 input_mask;
39  u16 num_const;
40  u32 const_off;
42  u16 start_insn;
43  u16 num_insn;
44  u32 ucode_off;
46 
50 typedef struct rsx_fp
51 {
52  u16 magic;
53  u16 num_attrib;
54  u32 attrib_off;
56  u32 num_regs;
57  u32 fp_control;
59  u16 texcoords;
60  u16 texcoord2D;
61  u16 texcoord3D;
63  u16 _pad0;
65  u16 num_const;
66  u32 const_off;
68  u16 num_insn;
69  u32 ucode_off;
71 
73 typedef struct rsx_const
74 {
75  u32 name_off;
76  u32 index;
77  u8 type;
79  u8 count;
81  u8 _pad0;
83  union {
84  u32 u;
85  f32 f;
86  } values[4];
93 
95 typedef struct rsx_co_table
96 {
97  u32 num;
98  u32 offset[];
100 
102 typedef struct rsx_attrib
103 {
104  u32 name_off;
105  u32 index;
106  u8 type;
107  u8 _pad0[3];
109 
115 
121 
127 s32 rsxVertexProgramGetConst(rsxVertexProgram *vp,const char *name);
128 
134 
140 s32 rsxVertexProgramGetAttrib(rsxVertexProgram *vp,const char *name);
141 
147 
153 
159 s32 rsxFragmentProgramGetConst(rsxFragmentProgram *fp,const char *name);
160 
166 
172 s32 rsxFragmentProgramGetAttrib(rsxFragmentProgram *fp,const char *name);
173 
180 
181 #ifdef __cplusplus
182  }
183 #endif
184 
185 #endif
u32 ucode_off
offset to the shader's micro code
Definition: rsx_program.h:44
s32 rsxVertexProgramGetAttrib(rsxVertexProgram *vp, const char *name)
Get id of vertex program attribute from its name.
u32 index
program const id.
Definition: rsx_program.h:76
rsxProgramConst * rsxFragmentProgramGetConsts(rsxFragmentProgram *fp)
Get the list of fragment program consts.
struct rsx_attrib rsxProgramAttrib
Table of program attributes.
Fragment program data structure.
Definition: rsx_program.h:50
Vertex program data structure.
Definition: rsx_program.h:29
rsxProgramAttrib * rsxVertexProgramGetAttribs(rsxVertexProgram *vp)
Get the list of vertex program attributes.
u16 magic
magic identifier
Definition: rsx_program.h:52
u32 attrib_off
offset to the attribute name table
Definition: rsx_program.h:33
u16 texcoord3D
bit mask of used 3D texture coords in the fragment program
Definition: rsx_program.h:61
u16 num_insn
number of vertex shader instructions
Definition: rsx_program.h:43
u8 is_internal
internal flag.
Definition: rsx_program.h:78
u8 count
number of elements in the const.
Definition: rsx_program.h:79
u8 type
attribute type.
Definition: rsx_program.h:106
u16 num_insn
number of fragment program instructions
Definition: rsx_program.h:68
struct rsx_vp rsxVertexProgram
Vertex program data structure.
u32 num
number of elements in the array.
Definition: rsx_program.h:97
u32 input_mask
mask of input attributes in the vertex shader
Definition: rsx_program.h:35
u32 const_off
offset to the constant name table
Definition: rsx_program.h:40
rsxConstOffsetTable * rsxFragmentProgramGetConstOffsetTable(rsxFragmentProgram *fp, u32 table_off)
Get const offset table from a fragment program.
u32 ucode_off
offset to the shaders's micro code
Definition: rsx_program.h:69
u32 num_regs
number of used registers in the fragment program
Definition: rsx_program.h:56
s32 rsxVertexProgramGetConst(rsxVertexProgram *vp, const char *name)
Get id of vertex program const from its name.
u16 texcoord2D
bit mask of used 2D texture coords in the fragment program
Definition: rsx_program.h:60
u32 fp_control
fragment program control mask
Definition: rsx_program.h:57
void * rsxVertexProgramGetUCode(rsxVertexProgram *vp)
Get Ucode from RSX vertex program.
u32 output_mask
mask of result attributes passed to the fragment shader
Definition: rsx_program.h:36
Table of const offsets.
Definition: rsx_program.h:95
rsxProgramAttrib * rsxFragmentProgramGetAttribs(rsxFragmentProgram *fp)
Get the list of fragment program attributes.
u32 u
integer value.
Definition: rsx_program.h:84
s32 rsxFragmentProgramGetAttrib(rsxFragmentProgram *fp, const char *name)
Get id of fragment program attribute from its name.
struct rsx_co_table rsxConstOffsetTable
Table of const offsets.
u16 const_start
start address in vertex shader's constant block memory
Definition: rsx_program.h:38
struct rsx_fp rsxFragmentProgram
Fragment program data structure.
f32 f
float value.
Definition: rsx_program.h:85
u16 texcoords
bit mask of all used texture coords in the fragment program
Definition: rsx_program.h:59
Table of program attributes.
Definition: rsx_program.h:102
void * rsxFragmentProgramGetUCode(rsxFragmentProgram *fp, u32 *size)
Get Ucode from RSX fragment program.
s32 rsxFragmentProgramGetConst(rsxFragmentProgram *fp, const char *name)
Get id of fragment program const from its name.
struct rsx_const rsxProgramConst
Program const data structure.
u32 name_off
offset of name.
Definition: rsx_program.h:75
u16 num_const
number of used constants in the vertex program
Definition: rsx_program.h:39
u8 _pad0
unused padding byte, most be 0.
Definition: rsx_program.h:81
u32 name_off
offset of attribute name.
Definition: rsx_program.h:104
u32 attrib_off
offset to the attribute name table
Definition: rsx_program.h:54
u32 offset[]
array of const offsets.
Definition: rsx_program.h:98
u32 const_off
offset to the constant name table
Definition: rsx_program.h:66
u16 num_attrib
number of used input attributes in the fragment program
Definition: rsx_program.h:53
u16 num_const
number of used constants in the fragment program
Definition: rsx_program.h:65
u16 num_attrib
number of used input attributes in the vertex program
Definition: rsx_program.h:32
u16 magic
magic identifier
Definition: rsx_program.h:31
u16 start_insn
start address to load the vertex program to
Definition: rsx_program.h:42
union rsx_const::@0 values[4]
array of element values.
u16 _pad0
unused padding word. most be 0
Definition: rsx_program.h:63
u8 type
program const type.
Definition: rsx_program.h:77
u32 index
attribute index.
Definition: rsx_program.h:105
Program const data structure.
Definition: rsx_program.h:73
rsxProgramConst * rsxVertexProgramGetConsts(rsxVertexProgram *vp)
Get the list of vertex program consts.