📄 r300_context.h
字号:
struct r300_state_atom pvs; /* pvs_cntl (22D0) */ struct r300_state_atom gb_enable; /* (4008) */ struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */ struct r300_state_atom ga_point_s0; /* S Texture Coordinate of Vertex 0 for Point texture stuffing (LLC) (4200) */ struct r300_state_atom ga_triangle_stipple; /* (4214) */ struct r300_state_atom ps; /* pointsize (421C) */ struct r300_state_atom ga_point_minmax; /* (4230) */ struct r300_state_atom lcntl; /* line control */ struct r300_state_atom ga_line_stipple; /* (4260) */ struct r300_state_atom shade; struct r300_state_atom polygon_mode; struct r300_state_atom fogp; /* fog parameters (4294) */ struct r300_state_atom ga_soft_reset; /* (429C) */ struct r300_state_atom zbias_cntl; struct r300_state_atom zbs; /* zbias (42A4) */ struct r300_state_atom occlusion_cntl; struct r300_state_atom cul; /* cull cntl (42B8) */ struct r300_state_atom su_depth_scale; /* (42C0) */ struct r300_state_atom rc; /* rs control (4300) */ struct r300_state_atom ri; /* rs interpolators (4310) */ struct r300_state_atom rr; /* rs route (4330) */ struct r300_state_atom sc_hyperz; /* (43A4) */ struct r300_state_atom sc_screendoor; /* (43E8) */ struct r300_state_atom fp; /* fragment program cntl + nodes (4600) */ 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) */ struct r300_state_atom at; /* alpha test (4BD4) */ struct r300_state_atom fg_depth_src; /* (4BD8) */ struct r300_state_atom fpp; /* 0x4C00 and following */ struct r300_state_atom rb3d_cctl; /* (4E00) */ struct r300_state_atom bld; /* blending (4E04) */ struct r300_state_atom cmk; /* colormask (4E0C) */ struct r300_state_atom blend_color; /* constant blend color */ struct r300_state_atom rop; /* ropcntl */ struct r300_state_atom cb; /* colorbuffer (4E28) */ struct r300_state_atom rb3d_dither_ctl; /* (4E50) */ struct r300_state_atom rb3d_aaresolve_ctl; /* (4E88) */ struct r300_state_atom rb3d_discard_src_pixel_lte_threshold; /* (4E88) I saw it only written on RV350 hardware.. */ struct r300_state_atom zs; /* zstencil control (4F00) */ struct r300_state_atom zstencil_format; struct r300_state_atom zb; /* z buffer (4F20) */ struct r300_state_atom zb_depthclearvalue; /* (4F28) */ struct r300_state_atom unk4F30; /* (4F30) */ struct r300_state_atom zb_hiz_offset; /* (4F44) */ struct r300_state_atom zb_hiz_pitch; /* (4F54) */ struct r300_state_atom vpi; /* vp instructions */ struct r300_state_atom vpp; /* vp parameters */ struct r300_state_atom vps; /* vertex point size (?) */ struct r300_state_atom vpucp[6]; /* vp user clip plane - 6 */ /* 8 texture units */ /* the state is grouped by function and not by texture unit. This makes single unit updates really awkward - we are much better off updating the whole thing at once */ struct { struct r300_state_atom filter; struct r300_state_atom filter_1; struct r300_state_atom size; struct r300_state_atom format; struct r300_state_atom pitch; struct r300_state_atom offset; struct r300_state_atom chroma_key; struct r300_state_atom border_color; } tex; struct r300_state_atom txe; /* tex enable (4104) */};/** * This structure holds the command buffer while it is being constructed. * * The first batch of commands in the buffer is always the state that needs * to be re-emitted when the context is lost. This batch can be skipped * otherwise. */struct r300_cmdbuf { int size; /* DWORDs allocated for buffer */ uint32_t *cmd_buf; int count_used; /* DWORDs filled so far */ int count_reemit; /* size of re-emission batch */};/** * State cache */struct r300_depthbuffer_state { GLfloat scale;};struct r300_stencilbuffer_state { GLboolean hw_stencil;};/* Vertex shader state *//* Perhaps more if we store programs in vmem? *//* drm_r300_cmd_header_t->vpu->count is unsigned char */#define VSF_MAX_FRAGMENT_LENGTH (255*4)/* Can be tested with colormat currently. */#define VSF_MAX_FRAGMENT_TEMPS (14)#define STATE_R300_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0)#define STATE_R300_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1)struct r300_vertex_shader_fragment { int length; union { GLuint d[VSF_MAX_FRAGMENT_LENGTH]; float f[VSF_MAX_FRAGMENT_LENGTH]; GLuint i[VSF_MAX_FRAGMENT_LENGTH]; } body;};struct r300_vertex_shader_state { struct r300_vertex_shader_fragment program;};extern int hw_tcl_on;#define COLOR_IS_RGBA#define TAG(x) r300##x#include "tnl_dd/t_dd_vertex.h"#undef TAG//#define CURRENT_VERTEX_SHADER(ctx) (ctx->VertexProgram._Current)#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->selected_vp)/* Should but doesnt work *///#define CURRENT_VERTEX_SHADER(ctx) (R300_CONTEXT(ctx)->curr_vp)/* r300_vertex_shader_state and r300_vertex_program should probably be merged together someday. * Keeping them them seperate for now should ensure fixed pipeline keeps functioning properly. */struct r300_vertex_program_key { GLuint InputsRead; GLuint OutputsWritten; GLuint OutputsAdded;};struct r300_vertex_program { struct r300_vertex_program *next; struct r300_vertex_program_key key; int translated; struct r300_vertex_shader_fragment program; int pos_end; int num_temporaries; /* Number of temp vars used by program */ int wpos_idx; int inputs[VERT_ATTRIB_MAX]; int outputs[VERT_RESULT_MAX]; int native; int ref_count; int use_ref_count;};struct r300_vertex_program_cont { struct gl_vertex_program mesa_program; /* Must be first */ struct r300_vertex_shader_fragment params; struct r300_vertex_program *progs;};#define PFS_MAX_ALU_INST 64#define PFS_MAX_TEX_INST 64#define PFS_MAX_TEX_INDIRECT 4#define PFS_NUM_TEMP_REGS 32#define PFS_NUM_CONST_REGS 16struct r300_pfs_compile_state;/** * Stores state that influences the compilation of a fragment program. */struct r300_fragment_program_external_state { struct { /** * If the sampler is used as a shadow sampler, * this field is: * 0 - GL_LUMINANCE * 1 - GL_INTENSITY * 2 - GL_ALPHA * depending on the depth texture mode. */ GLuint depth_texture_mode : 2; /** * If the sampler is used as a shadow sampler, * this field is (texture_compare_func - GL_NEVER). * [e.g. if compare function is GL_LEQUAL, this field is 3] * * Otherwise, this field is 0. */ GLuint texture_compare_func : 3; } unit[16];};struct r300_fragment_program_node { int tex_offset; /**< first tex instruction */ int tex_end; /**< last tex instruction, relative to tex_offset */ int alu_offset; /**< first ALU instruction */ int alu_end; /**< last ALU instruction, relative to alu_offset */ int flags;};/** * Stores an R300 fragment program in its compiled-to-hardware form. */struct r300_fragment_program_code { struct { int length; /**< total # of texture instructions used */ GLuint inst[PFS_MAX_TEX_INST]; } tex; struct { int length; /**< total # of ALU instructions used */ struct { GLuint inst0; GLuint inst1; GLuint inst2; GLuint inst3; } inst[PFS_MAX_ALU_INST]; } alu; struct r300_fragment_program_node node[4]; int cur_node; int first_node_has_tex; /** * Remember which program register a given hardware constant * belongs to. */ struct prog_src_register constant[PFS_NUM_CONST_REGS]; int const_nr; int max_temp_idx;};/** * Store everything about a fragment program that is needed * to render with that program. */struct r300_fragment_program { struct gl_fragment_program mesa_program; GLboolean translated; GLboolean error; struct r300_fragment_program_external_state state; struct r300_fragment_program_code code; GLboolean WritesDepth; GLuint optimization;};struct r500_pfs_compile_state;struct r500_fragment_program_external_state { struct { /** * If the sampler is used as a shadow sampler, * this field is: * 0 - GL_LUMINANCE * 1 - GL_INTENSITY * 2 - GL_ALPHA * depending on the depth texture mode. */ GLuint depth_texture_mode : 2; /** * If the sampler is used as a shadow sampler, * this field is (texture_compare_func - GL_NEVER). * [e.g. if compare function is GL_LEQUAL, this field is 3] * * Otherwise, this field is 0. */ GLuint texture_compare_func : 3; } unit[16];};struct r500_fragment_program_code { struct { GLuint inst0; GLuint inst1; GLuint inst2; GLuint inst3; GLuint inst4; GLuint inst5; } inst[512]; int inst_offset; int inst_end; /** * Remember which program register a given hardware constant * belongs to. */ struct prog_src_register constant[PFS_NUM_CONST_REGS]; int const_nr; int max_temp_idx;};struct r500_fragment_program { struct gl_fragment_program mesa_program; GLcontext *ctx; GLboolean translated; GLboolean error; struct r500_fragment_program_external_state state; struct r500_fragment_program_code code; GLboolean writes_depth; GLuint optimization;};#define R300_MAX_AOS_ARRAYS 16#define REG_COORDS 0#define REG_COLOR0 1#define REG_TEX0 2struct r300_state { struct r300_depthbuffer_state depth; struct r300_texture_state texture; int sw_tcl_inputs[VERT_ATTRIB_MAX]; struct r300_vertex_shader_state vertex_shader; struct r300_dma_region aos[R300_MAX_AOS_ARRAYS]; int aos_count; GLuint *Elts; struct r300_dma_region elt_dma; struct r300_dma_region swtcl_dma; DECLARE_RENDERINPUTS(render_inputs_bitset); /* actual render inputs that R300 was configured for. They are the same as tnl->render_inputs for fixed pipeline */ struct r300_stencilbuffer_state stencil;};#define R300_FALLBACK_NONE 0#define R300_FALLBACK_TCL 1#define R300_FALLBACK_RAST 2/* r300_swtcl.c */struct r300_swtcl_info { GLuint RenderIndex; /** * Size of a hardware vertex. This is calculated when \c ::vertex_attrs is * installed in the Mesa state vector. */ GLuint vertex_size; /** * Attributes instructing the Mesa TCL pipeline where / how to put vertex * data in the hardware buffer. */ struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; /** * Number of elements of \c ::vertex_attrs that are actually used. */ GLuint vertex_attr_count; /** * Cached pointer to the buffer where Mesa will store vertex data. */ GLubyte *verts; /* Fallback rasterization functions */ // r200_point_func draw_point; // r200_line_func draw_line; // r200_tri_func draw_tri; GLuint hw_primitive; GLenum render_primitive; GLuint numverts; /** * Offset of the 4UB color data within a hardware (swtcl) vertex. */ GLuint coloroffset; /** * Offset of the 3UB specular color data within a hardware (swtcl) vertex. */ GLuint specoffset; /** * Should Mesa project vertex data or will the hardware do it? */ GLboolean needproj; struct r300_dma_region indexed_verts;};/** * \brief R300 context structure. */struct r300_context { struct radeon_context radeon; /* parent class, must be first */ struct r300_hw_state hw; struct r300_cmdbuf cmdbuf; struct r300_state state; struct gl_vertex_program *curr_vp; struct r300_vertex_program *selected_vp; /* Vertex buffers */ struct r300_dma dma; GLboolean save_on_next_unlock; GLuint NewGLState; /* Texture object bookkeeping */ unsigned nr_heaps; driTexHeap *texture_heaps[RADEON_NR_TEX_HEAPS]; driTextureObject swapped; int texture_depth; float initialMaxAnisotropy; /* Clientdata textures; */ GLuint prefer_gart_client_texturing;#ifdef USER_BUFFERS struct r300_memory_manager *rmm;#endif GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; GLboolean disable_lowimpact_fallback; DECLARE_RENDERINPUTS(tnl_index_bitset); /* index of bits for last tnl_install_attrs */ struct r300_swtcl_info swtcl;};struct r300_buffer_object { struct gl_buffer_object mesa_obj; int id;};#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))extern void r300DestroyContext(__DRIcontextPrivate * driContextPriv);extern GLboolean r300CreateContext(const __GLcontextModes * glVisual, __DRIcontextPrivate * driContextPriv, void *sharedContextPrivate);extern void r300SelectVertexShader(r300ContextPtr r300);extern void r300InitShaderFuncs(struct dd_function_table *functions);extern int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_program_cont *vp, float *dst);#define RADEON_D_CAPTURE 0#define RADEON_D_PLAYBACK 1#define RADEON_D_PLAYBACK_RAW 2#define RADEON_D_T 3#endif /* __R300_CONTEXT_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -