summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/egl/drivers/dri/Makefile69
-rw-r--r--src/egl/drivers/dri/egldri.c1205
-rw-r--r--src/egl/drivers/dri/egldri.h116
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c1
-rw-r--r--src/egl/drivers/glx/egl_glx.c243
-rw-r--r--src/egl/main/Makefile2
-rw-r--r--src/egl/main/SConscript1
-rw-r--r--src/egl/main/eglapi.c2
-rw-r--r--src/egl/main/eglconfig.h2
-rw-r--r--src/egl/main/eglconfigutil.c128
-rw-r--r--src/egl/main/eglconfigutil.h19
-rw-r--r--src/egl/main/eglcontext.c108
-rw-r--r--src/egl/main/eglmode.c2
-rw-r--r--src/egl/main/eglscreen.c2
-rw-r--r--src/gallium/auxiliary/Makefile1
-rw-r--r--src/gallium/auxiliary/SConscript1
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h13
-rw-r--r--src/gallium/auxiliary/draw/draw_pipe_aaline.c3
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c17
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.c15
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_const.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_debug.h1
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_aos.c14
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_format_soa.c6
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c1
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.c36
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_logic.h4
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_pack.c2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c12
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_struct.c85
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_struct.h41
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.c26
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_swizzle.h2
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi.h35
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c1176
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c46
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer.h6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c8
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c3
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c8
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c7
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c7
-rw-r--r--src/gallium/auxiliary/tgsi/tgsi_exec.h30
-rw-r--r--src/gallium/auxiliary/util/u_caps.c28
-rw-r--r--src/gallium/auxiliary/util/u_caps.h4
-rw-r--r--src/gallium/auxiliary/util/u_format.c56
-rw-r--r--src/gallium/auxiliary/util/u_format.h42
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h1
-rw-r--r--src/gallium/auxiliary/util/u_linear.h1
-rw-r--r--src/gallium/docs/source/context.rst8
-rw-r--r--src/gallium/drivers/cell/ppu/cell_screen.c17
-rw-r--r--src/gallium/drivers/failover/fo_context.c1
-rw-r--r--src/gallium/drivers/galahad/glhd_context.c20
-rw-r--r--src/gallium/drivers/galahad/glhd_objects.h2
-rw-r--r--src/gallium/drivers/galahad/glhd_screen.c12
-rw-r--r--src/gallium/drivers/i915/i915_screen.c46
-rw-r--r--src/gallium/drivers/i965/brw_screen.c45
-rw-r--r--src/gallium/drivers/identity/id_screen.c12
-rw-r--r--src/gallium/drivers/llvmpipe/Makefile1
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.c11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_interp.c83
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_interp.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_debug.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_perf.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c52
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.h8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.c351
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast.h93
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_debug.c410
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_priv.h74
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_tri.c241
-rw-r--r--src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h11
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c372
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.h221
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c52
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c599
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_coef.c35
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_coef.h5
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c35
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_context.h24
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_line.c32
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_point.c28
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c248
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_vbuf.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c100
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.h15
-rw-r--r--src/gallium/drivers/llvmpipe/lp_surface.c8
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c2
-rw-r--r--src/gallium/drivers/llvmpipe/sse_mathfun.h49
-rw-r--r--src/gallium/drivers/nouveau/nouveau_class.h10059
-rw-r--r--src/gallium/drivers/nouveau/nouveau_winsys.h1
-rw-r--r--src/gallium/drivers/nouveau/nv_m2mf.xml.h155
-rw-r--r--src/gallium/drivers/nouveau/nv_object.xml.h231
-rw-r--r--src/gallium/drivers/nv50/nv50_context.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_formats.c2
-rw-r--r--src/gallium/drivers/nv50/nv50_program.h1
-rw-r--r--src/gallium/drivers/nv50/nv50_reg.h1824
-rw-r--r--src/gallium/drivers/nv50/nv50_screen.c66
-rw-r--r--src/gallium/drivers/nvfx/Makefile8
-rw-r--r--src/gallium/drivers/nvfx/SConscript6
-rw-r--r--src/gallium/drivers/nvfx/nv01_2d.xml.h1343
-rw-r--r--src/gallium/drivers/nvfx/nv04_2d.c136
-rw-r--r--src/gallium/drivers/nvfx/nv04_2d.h22
-rw-r--r--src/gallium/drivers/nvfx/nv30-40_3d.xml.h2022
-rw-r--r--src/gallium/drivers/nvfx/nv30_fragtex.c24
-rw-r--r--src/gallium/drivers/nvfx/nv30_vertprog.h6
-rw-r--r--src/gallium/drivers/nvfx/nv40_fragtex.c30
-rw-r--r--src/gallium/drivers/nvfx/nv40_vertprog.h1
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.c11
-rw-r--r--src/gallium/drivers/nvfx/nvfx_context.h32
-rw-r--r--src/gallium/drivers/nvfx/nvfx_draw.c244
-rw-r--r--src/gallium/drivers/nvfx/nvfx_fragprog.c202
-rw-r--r--src/gallium/drivers/nvfx/nvfx_fragtex.c84
-rw-r--r--src/gallium/drivers/nvfx/nvfx_miptree.c1
-rw-r--r--src/gallium/drivers/nvfx/nvfx_push.c28
-rw-r--r--src/gallium/drivers/nvfx/nvfx_query.c31
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.c255
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.h5
-rw-r--r--src/gallium/drivers/nvfx/nvfx_shader.h13
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.c68
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state.h20
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_blend.c22
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_emit.c309
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_fb.c108
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_rasterizer.c9
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_scissor.c23
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_stipple.c11
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_viewport.c35
-rw-r--r--src/gallium/drivers/nvfx/nvfx_state_zsa.c21
-rw-r--r--src/gallium/drivers/nvfx/nvfx_surface.c214
-rw-r--r--src/gallium/drivers/nvfx/nvfx_surface.h0
-rw-r--r--src/gallium/drivers/nvfx/nvfx_tex.h54
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vbo.c112
-rw-r--r--src/gallium/drivers/nvfx/nvfx_vertprog.c505
-rw-r--r--src/gallium/drivers/r300/r300_blit.c10
-rw-r--r--src/gallium/drivers/r300/r300_context.h12
-rw-r--r--src/gallium/drivers/r300/r300_debug.c39
-rw-r--r--src/gallium/drivers/r300/r300_emit.c25
-rw-r--r--src/gallium/drivers/r300/r300_emit.h6
-rw-r--r--src/gallium/drivers/r300/r300_flush.c2
-rw-r--r--src/gallium/drivers/r300/r300_fs.c21
-rw-r--r--src/gallium/drivers/r300/r300_render.c205
-rw-r--r--src/gallium/drivers/r300/r300_screen.c96
-rw-r--r--src/gallium/drivers/r300/r300_screen.h3
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c9
-rw-r--r--src/gallium/drivers/r300/r300_texture.c16
-rw-r--r--src/gallium/drivers/r300/r300_texture_desc.c3
-rw-r--r--src/gallium/drivers/r300/r300_vs.c6
-rw-r--r--src/gallium/drivers/r600/Makefile5
-rw-r--r--src/gallium/drivers/r600/eg_asm.c84
-rw-r--r--src/gallium/drivers/r600/eg_hw_states.c1070
-rw-r--r--src/gallium/drivers/r600/eg_sq.h485
-rw-r--r--src/gallium/drivers/r600/eg_state_inlines.h434
-rw-r--r--src/gallium/drivers/r600/eg_states_inc.h454
-rw-r--r--src/gallium/drivers/r600/evergreend.h1442
-rw-r--r--src/gallium/drivers/r600/r600_asm.c321
-rw-r--r--src/gallium/drivers/r600/r600_asm.h10
-rw-r--r--src/gallium/drivers/r600/r600_buffer.c7
-rw-r--r--src/gallium/drivers/r600/r600_context.c267
-rw-r--r--src/gallium/drivers/r600/r600_context.h88
-rw-r--r--src/gallium/drivers/r600/r600_draw.c57
-rw-r--r--src/gallium/drivers/r600/r600_hw_states.c1125
-rw-r--r--src/gallium/drivers/r600/r600_opcodes.h396
-rw-r--r--src/gallium/drivers/r600/r600_query.c4
-rw-r--r--src/gallium/drivers/r600/r600_screen.c108
-rw-r--r--src/gallium/drivers/r600/r600_screen.h1
-rw-r--r--src/gallium/drivers/r600/r600_shader.c643
-rw-r--r--src/gallium/drivers/r600/r600_shader.h1
-rw-r--r--src/gallium/drivers/r600/r600_sq.h179
-rw-r--r--src/gallium/drivers/r600/r600_state.c1287
-rw-r--r--src/gallium/drivers/r600/r600_state_inlines.h122
-rw-r--r--src/gallium/drivers/r600/r600_states_inc.h543
-rw-r--r--src/gallium/drivers/r600/r600_texture.c45
-rw-r--r--src/gallium/drivers/r600/r600d.h7
-rw-r--r--src/gallium/drivers/r600/r700_asm.c37
-rw-r--r--src/gallium/drivers/r600/radeon.h419
-rw-r--r--src/gallium/drivers/rbug/rbug_screen.c12
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c55
-rw-r--r--src/gallium/drivers/svga/svga_screen.c127
-rw-r--r--src/gallium/drivers/trace/tr_screen.c25
-rw-r--r--src/gallium/include/pipe/p_compiler.h1
-rw-r--r--src/gallium/include/pipe/p_defines.h46
-rw-r--r--src/gallium/include/pipe/p_screen.h6
-rw-r--r--src/gallium/include/pipe/p_shader_tokens.h2
-rw-r--r--src/gallium/include/state_tracker/st_api.h79
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.c46
-rw-r--r--src/gallium/state_trackers/dri/common/dri_context.h4
-rw-r--r--src/gallium/state_trackers/dri/common/dri_screen.c2
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c96
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c10
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_api.c43
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_loader.h4
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d_st.h29
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_api.c7
-rw-r--r--src/gallium/state_trackers/glx/xlib/xm_st.c8
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c11
-rw-r--r--src/gallium/state_trackers/wgl/stw_context.c7
-rw-r--r--src/gallium/targets/egl-gdi/egl-static.c86
-rw-r--r--src/gallium/targets/egl/Makefile3
-rw-r--r--src/gallium/targets/egl/egl.c99
-rw-r--r--src/gallium/targets/egl/egl.h44
-rw-r--r--src/gallium/targets/egl/st_GL.c20
-rw-r--r--src/gallium/targets/egl/st_GLESv1_CM.c6
-rw-r--r--src/gallium/targets/egl/st_GLESv2.c6
-rw-r--r--src/gallium/targets/egl/st_OpenVG.c2
-rw-r--r--src/gallium/targets/libgl-xlib/Makefile13
-rw-r--r--src/gallium/targets/libgl-xlib/SConscript4
-rw-r--r--src/gallium/targets/libgl-xlib/xlib.c12
-rw-r--r--src/gallium/tests/graw/SConscript1
-rw-r--r--src/gallium/tests/graw/shader-leak.c266
-rw-r--r--src/gallium/tests/graw/tri.c31
-rw-r--r--src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh18
-rw-r--r--src/gallium/tests/unit/Makefile1
-rw-r--r--src/gallium/tests/unit/SConscript1
-rw-r--r--src/gallium/tests/unit/u_format_compatible_test.c76
-rw-r--r--src/gallium/winsys/r600/drm/eg_states.h449
-rw-r--r--src/gallium/winsys/r600/drm/gen_eg_states.py39
-rw-r--r--src/gallium/winsys/r600/drm/gen_r600_states.py39
-rw-r--r--src/gallium/winsys/r600/drm/r600_state.c261
-rw-r--r--src/gallium/winsys/r600/drm/r600_states.h48
-rw-r--r--src/gallium/winsys/r600/drm/r600d.h9
-rw-r--r--src/gallium/winsys/r600/drm/radeon.c25
-rw-r--r--src/gallium/winsys/r600/drm/radeon_bo.c8
-rw-r--r--src/gallium/winsys/r600/drm/radeon_ctx.c25
-rw-r--r--src/gallium/winsys/r600/drm/radeon_draw.c2
-rw-r--r--src/gallium/winsys/r600/drm/radeon_priv.h3
-rw-r--r--src/gallium/winsys/r600/drm/radeon_state.c4
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_buffer.c60
-rw-r--r--src/gallium/winsys/svga/drm/vmw_screen_svga.c2
-rw-r--r--src/gallium/winsys/sw/null/null_sw_winsys.c2
-rw-r--r--src/glsl/Makefile7
-rw-r--r--src/glsl/Makefile.am7
-rw-r--r--src/glsl/README46
-rw-r--r--src/glsl/SConscript7
-rw-r--r--src/glsl/TODO26
-rw-r--r--src/glsl/ast_function.cpp2
-rw-r--r--src/glsl/ast_to_hir.cpp63
-rw-r--r--src/glsl/builtin_function.cpp3460
-rw-r--r--src/glsl/builtin_types.h23
-rw-r--r--src/glsl/builtin_variables.h7
-rw-r--r--src/glsl/builtins/ir/atan49
-rw-r--r--src/glsl/builtins/ir/distance10
-rw-r--r--src/glsl/builtins/ir/dot2
-rw-r--r--src/glsl/builtins/ir/equal72
-rw-r--r--src/glsl/builtins/ir/faceforward2
-rw-r--r--src/glsl/builtins/ir/greaterThan54
-rw-r--r--src/glsl/builtins/ir/greaterThanEqual54
-rw-r--r--src/glsl/builtins/ir/length2
-rw-r--r--src/glsl/builtins/ir/lessThan54
-rw-r--r--src/glsl/builtins/ir/lessThanEqual54
-rw-r--r--src/glsl/builtins/ir/matrixCompMult54
-rw-r--r--src/glsl/builtins/ir/mix18
-rw-r--r--src/glsl/builtins/ir/noise18
-rw-r--r--src/glsl/builtins/ir/noise275
-rw-r--r--src/glsl/builtins/ir/noise387
-rw-r--r--src/glsl/builtins/ir/noise4111
-rw-r--r--src/glsl/builtins/ir/normalize2
-rw-r--r--src/glsl/builtins/ir/notEqual72
-rw-r--r--src/glsl/builtins/ir/outerProduct54
-rw-r--r--src/glsl/builtins/ir/reflect2
-rw-r--r--src/glsl/builtins/ir/refract14
-rw-r--r--src/glsl/builtins/ir/smoothstep38
-rw-r--r--src/glsl/builtins/ir/step36
-rw-r--r--src/glsl/builtins/ir/transpose162
-rw-r--r--src/glsl/builtins/profiles/100.frag300
-rw-r--r--src/glsl/builtins/profiles/100.vert300
-rwxr-xr-xsrc/glsl/builtins/tools/generate_builtins.py6
-rw-r--r--src/glsl/glcpp/glcpp-parse.c446
-rw-r--r--src/glsl/glcpp/glcpp-parse.h7
-rw-r--r--src/glsl/glcpp/glcpp-parse.y10
-rw-r--r--src/glsl/glcpp/glcpp.c3
-rw-r--r--src/glsl/glcpp/glcpp.h4
-rw-r--r--src/glsl/glcpp/pp.c4
-rw-r--r--src/glsl/glsl_lexer.cpp424
-rw-r--r--src/glsl/glsl_lexer.lpp24
-rw-r--r--src/glsl/glsl_parser.cpp1450
-rw-r--r--src/glsl/glsl_parser.h18
-rw-r--r--src/glsl/glsl_parser.ypp127
-rw-r--r--src/glsl/glsl_parser_extras.cpp82
-rw-r--r--src/glsl/glsl_parser_extras.h3
-rw-r--r--src/glsl/glsl_types.cpp19
-rw-r--r--src/glsl/glsl_types.h8
-rw-r--r--src/glsl/ir.cpp44
-rw-r--r--src/glsl/ir.h48
-rw-r--r--src/glsl/ir_algebraic.cpp2
-rw-r--r--src/glsl/ir_clone.cpp4
-rw-r--r--src/glsl/ir_constant_expression.cpp40
-rw-r--r--src/glsl/ir_constant_propagation.cpp18
-rw-r--r--src/glsl/ir_copy_propagation.cpp26
-rw-r--r--src/glsl/ir_hierarchical_visitor.cpp1
-rw-r--r--src/glsl/ir_hierarchical_visitor.h7
-rw-r--r--src/glsl/ir_hv_accept.cpp9
-rw-r--r--src/glsl/ir_if_return.cpp246
-rw-r--r--src/glsl/ir_if_simplification.cpp2
-rw-r--r--src/glsl/ir_import_prototypes.cpp2
-rw-r--r--src/glsl/ir_lower_jumps.cpp544
-rw-r--r--src/glsl/ir_mat_op_to_vec.cpp8
-rw-r--r--src/glsl/ir_mod_to_fract.cpp2
-rw-r--r--src/glsl/ir_optimization.h6
-rw-r--r--src/glsl/ir_print_visitor.cpp29
-rw-r--r--src/glsl/ir_reader.cpp76
-rw-r--r--src/glsl/ir_rvalue_visitor.cpp7
-rw-r--r--src/glsl/ir_validate.cpp66
-rw-r--r--src/glsl/ir_variable.cpp75
-rw-r--r--src/glsl/ir_visitor.h17
-rw-r--r--src/glsl/linker.cpp13
-rw-r--r--src/glsl/list.h40
-rw-r--r--src/glsl/loop_analysis.cpp496
-rw-r--r--src/glsl/loop_analysis.h230
-rw-r--r--src/glsl/loop_controls.cpp301
-rw-r--r--src/glsl/loop_unroll.cpp187
-rw-r--r--src/glsl/lower_noise.cpp71
-rw-r--r--src/glsl/main.cpp55
-rw-r--r--src/glsl/opt_redundant_jumps.cpp111
-rw-r--r--src/glx/Makefile6
-rw-r--r--src/glx/dri2.c10
-rw-r--r--src/glx/dri2_glx.c16
-rw-r--r--src/glx/dri_common.c25
-rw-r--r--src/glx/dri_common.h3
-rw-r--r--src/glx/dri_glx.c4
-rw-r--r--src/glx/drisw_glx.c4
-rw-r--r--src/glx/glx_pbuffer.c14
-rw-r--r--src/glx/glxclient.h10
-rw-r--r--src/glx/glxcmds.c64
-rw-r--r--src/glx/glxcurrent.c24
-rw-r--r--src/glx/glxext.c14
-rw-r--r--src/glx/indirect.c6
-rw-r--r--src/glx/indirect.h2
-rw-r--r--src/glx/indirect_glx.c16
-rw-r--r--src/glx/indirect_init.c2
-rw-r--r--src/glx/indirect_vertex_array.c4
-rw-r--r--src/mapi/glapi/gen-es/es_EXT.xml4
-rw-r--r--src/mapi/glapi/gen/Makefile2
-rw-r--r--src/mapi/glapi/gen/gl_API.xml8
-rw-r--r--src/mapi/glapi/glapi_priv.h2
-rw-r--r--src/mapi/glapi/glapidispatch.h2
-rw-r--r--src/mapi/glapi/glapitable.h2
-rw-r--r--src/mapi/glapi/glapitemp.h4
-rw-r--r--src/mesa/Makefile55
-rw-r--r--src/mesa/drivers/common/driverfuncs.c16
-rw-r--r--src/mesa/drivers/common/meta.c2
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c5
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c7
-rw-r--r--src/mesa/drivers/dri/i915/i915_fragprog.c15
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c9
-rw-r--r--src/mesa/drivers/dri/i965/brw_eu_emit.c141
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp69
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp3
-rw-r--r--src/mesa/drivers/dri/i965/brw_program.c16
-rw-r--r--src/mesa/drivers/dri/i965/brw_vs_emit.c8
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_glsl.c1120
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c3
-rw-r--r--src/mesa/drivers/dri/intel/intel_extensions_es2.c1
-rw-r--r--[l---------]src/mesa/drivers/dri/nouveau/nouveau_class.h4954
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_context.c5
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_context.c1
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_frag.c36
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_frag.c31
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tnl.c50
-rw-r--r--src/mesa/drivers/dri/r200/Makefile1
l---------src/mesa/drivers/dri/r200/radeon_buffer_objects.c1
l---------src/mesa/drivers/dri/r200/radeon_buffer_objects.h1
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r300_fragprog.c81
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r300_fragprog.h4
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c54
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c33
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c191
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c297
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c5
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog.c5
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog.h6
-rw-r--r--src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c60
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.c33
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_compiler.h24
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c128
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h6
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c19
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c30
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h8
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_optimize.c359
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c62
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c187
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c65
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.c9
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program.h23
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c6
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h5
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h36
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c177
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h42
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_print.c135
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c39
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h3
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c2
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.h2
-rw-r--r--src/mesa/drivers/dri/r300/r300_blit.c11
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c5
-rw-r--r--src/mesa/drivers/dri/r300/r300_vertprog.c7
-rw-r--r--src/mesa/drivers/dri/r600/Makefile1
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_blit.c1789
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_blit.h54
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_blit_shaders.h71
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_chip.c456
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_context.c34
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_fragprog.c20
-rw-r--r--src/mesa/drivers/dri/r600/evergreen_vertprog.c19
-rw-r--r--src/mesa/drivers/dri/r600/r600_blit.c8
-rw-r--r--src/mesa/drivers/dri/r600/r600_cmdbuf.h2
-rw-r--r--src/mesa/drivers/dri/r600/r600_context.c14
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.c449
-rw-r--r--src/mesa/drivers/dri/r600/r700_assembler.h2
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.c29
-rw-r--r--src/mesa/drivers/dri/r600/r700_chip.h2
-rw-r--r--src/mesa/drivers/dri/r600/r700_fragprog.c7
-rw-r--r--src/mesa/drivers/dri/r600/r700_shader.c13
-rw-r--r--src/mesa/drivers/dri/r600/r700_vertprog.c8
-rw-r--r--src/mesa/drivers/dri/radeon/Makefile1
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_common_context.c3
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_pixel_read.c42
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_queryobj.c2
-rw-r--r--src/mesa/drivers/dri/swrast/swrast.c4
-rw-r--r--src/mesa/main/accum.h7
-rw-r--r--src/mesa/main/api_exec.c12
-rw-r--r--src/mesa/main/colortab.h9
-rw-r--r--src/mesa/main/compiler.h12
-rw-r--r--src/mesa/main/context.c9
-rw-r--r--src/mesa/main/convolve.h8
-rw-r--r--src/mesa/main/dlist.c10
-rw-r--r--src/mesa/main/dlist.h11
-rw-r--r--src/mesa/main/drawpix.h9
-rw-r--r--src/mesa/main/drawtex.h9
-rw-r--r--src/mesa/main/extensions.c3
-rw-r--r--src/mesa/main/fbobject.c16
-rw-r--r--src/mesa/main/feedback.h7
-rw-r--r--src/mesa/main/get.c17
-rw-r--r--src/mesa/main/glheader.h22
-rw-r--r--src/mesa/main/light.c6
-rw-r--r--src/mesa/main/mfeatures.h3
-rw-r--r--src/mesa/main/mtypes.h41
-rw-r--r--src/mesa/main/nvprogram.c4
-rw-r--r--src/mesa/main/queryobj.h13
-rw-r--r--src/mesa/main/rastpos.h7
-rw-r--r--src/mesa/main/shaderapi.c26
-rw-r--r--src/mesa/main/shaderobj.c12
-rw-r--r--src/mesa/main/shaderobj.h31
-rw-r--r--src/mesa/main/shared.c6
-rw-r--r--src/mesa/main/syncobj.c15
-rw-r--r--src/mesa/main/syncobj.h46
-rw-r--r--src/mesa/main/texenv.c119
-rw-r--r--src/mesa/main/texenvprogram.c2
-rw-r--r--src/mesa/main/texgen.h7
-rw-r--r--src/mesa/main/teximage.c4
-rw-r--r--src/mesa/main/varray.c4
-rw-r--r--src/mesa/main/varray.h4
-rw-r--r--src/mesa/main/version.c6
-rw-r--r--src/mesa/program/ir_to_mesa.cpp177
-rw-r--r--src/mesa/program/prog_statevars.c2
-rw-r--r--src/mesa/program/program.c8
-rw-r--r--src/mesa/program/program.h33
-rw-r--r--src/mesa/program/program_parse.tab.c2
-rw-r--r--src/mesa/program/program_parse.y2
-rw-r--r--src/mesa/sources.mak1
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c2
-rw-r--r--src/mesa/state_tracker/st_extensions.c67
-rw-r--r--src/mesa/state_tracker/st_gl_api.h2
-rw-r--r--src/mesa/state_tracker/st_manager.c123
-rw-r--r--src/mesa/swrast/s_readpix.c3
-rw-r--r--src/mesa/swrast/s_span.c6
479 files changed, 38849 insertions, 22582 deletions
diff --git a/src/egl/drivers/dri/Makefile b/src/egl/drivers/dri/Makefile
deleted file mode 100644
index c3aacff1cf..0000000000
--- a/src/egl/drivers/dri/Makefile
+++ /dev/null
@@ -1,69 +0,0 @@
-# src/egl/drivers/dri/Makefile
-
-TOP = ../../../..
-include $(TOP)/configs/current
-
-
-### Include directories
-INCLUDE_DIRS = \
- -I. \
- -I/usr/include \
- $(shell pkg-config --cflags-only-I libdrm) \
- -I$(TOP)/include \
- -I$(TOP)/include/GL/internal \
- -I$(TOP)/src/mapi \
- -I$(TOP)/src/mesa \
- -I$(TOP)/src/mesa/main \
- -I$(TOP)/src/mesa/math \
- -I$(TOP)/src/mesa/transform \
- -I$(TOP)/src/mesa/shader \
- -I$(TOP)/src/mesa/swrast \
- -I$(TOP)/src/mesa/swrast_setup \
- -I$(TOP)/src/egl/main \
- -I$(TOP)/src/mesa/drivers/dri/common
-
-
-HEADERS = egldri.h
-
-SOURCES = egldri.c
-
-OBJECTS = $(SOURCES:.c=.o)
-
-DRM_LIB = `pkg-config --libs libdrm`
-
-
-.c.o:
- $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
-
-
-
-default: depend library Makefile
-
-
-# EGLdri Library
-library: $(TOP)/$(LIB_DIR)/libEGLdri.so
-
-$(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
- $(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \
- -major 1 -minor 0 \
- -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
-
-install:
- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
- $(MINSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR)
-
-clean:
- -rm -f *.o
- -rm -f *.so
- -rm -f depend depend.bak
-
-depend: $(SOURCES) $(HEADERS)
- @ echo "running $(MKDEP)"
- @ rm -f depend
- @ touch depend
- $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) \
- $(SOURCES) $(HEADERS) >/dev/null 2>/dev/null
-
-include depend
-# DO NOT DELETE
-
diff --git a/src/egl/drivers/dri/egldri.c b/src/egl/drivers/dri/egldri.c
deleted file mode 100644
index 6a8bf89985..0000000000
--- a/src/egl/drivers/dri/egldri.c
+++ /dev/null
@@ -1,1205 +0,0 @@
-/**
- * Generic EGL driver for DRI. This is basically an "adaptor" driver
- * that allows libEGL to load/use regular DRI drivers.
- *
- * This file contains all the code needed to interface DRI-based drivers
- * with libEGL.
- *
- * There's a lot of dependencies on fbdev and the /sys/ filesystem.
- */
-
-
-#include <dirent.h>
-#include <stdio.h>
-#include <string.h>
-#include <linux/fb.h>
-#include <assert.h>
-#include <dlfcn.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
-
-#include "egldriver.h"
-#include "egldisplay.h"
-#include "eglcontext.h"
-#include "eglconfig.h"
-#include "eglconfigutil.h"
-#include "eglsurface.h"
-#include "eglscreen.h"
-#include "eglglobals.h"
-#include "egllog.h"
-#include "eglmode.h"
-
-#include "egldri.h"
-
-const char *sysfs = "/sys/class";
-
-static const int empty_attribute_list[1] = { None };
-
-
-
-/**
- * Given a card number, return the name of the DRI driver to use.
- * This generally means reading the contents of
- * /sys/class/drm/cardX/dri_library_name, where X is the card number
- */
-static EGLBoolean
-driver_name_from_card_number(int card, char *driverName, int maxDriverName)
-{
- char path[2000];
- FILE *f;
- int length;
-
- snprintf(path, sizeof(path), "%s/drm/card%d/dri_library_name", sysfs, card);
-
- f = fopen(path, "r");
- if (!f)
- return EGL_FALSE;
-
- fgets(driverName, maxDriverName, f);
- fclose(f);
-
- if ((length = strlen(driverName)) > 1) {
- /* remove the trailing newline from sysfs */
- driverName[length - 1] = '\0';
- strncat(driverName, "_dri", maxDriverName);
- return EGL_TRUE;
- }
- else {
- return EGL_FALSE;
- }
-}
-
-
-
-/**
- * The bootstrap function.
- * Return a new driDriver object and plug in API functions.
- * This function, in turn, loads a specific DRI driver (ex: r200_dri.so).
- */
-_EGLDriver *
-_eglMain(_EGLDisplay *dpy, const char *args)
-{
-#if 1
- const int card = args ? atoi(args) : 0;
- _EGLDriver *driver = NULL;
- char driverName[1000];
-
- if (!driver_name_from_card_number(card, driverName, sizeof(driverName))) {
- _eglLog(_EGL_WARNING,
- "Unable to determine driver name for card %d\n", card);
- return NULL;
- }
-
- _eglLog(_EGL_DEBUG, "Driver name: %s\n", driverName);
-
- driver = _eglOpenDriver(dpy, driverName, args);
-
- return driver;
-
-#else
-
- int length;
- char path[NAME_MAX];
- struct dirent *dirent;
-#if 1
- FILE *file;
-#endif
- DIR *dir;
- _EGLDriver *driver = NULL;;
-
- snprintf(path, sizeof(path), "%s/drm", sysfs);
- if (!(dir = opendir(path))) {
- _eglLog(_EGL_WARNING, "%s DRM devices not found.", path);
- return EGL_FALSE;
- }
-
- /* loop over dir entries looking for cardX where "X" is in the
- * dpy->DriverName ":X" string.
- */
- while ((dirent = readdir(dir))) {
-
- if (strncmp(&dirent->d_name[0], "card", 4) != 0)
- continue;
- if (strcmp(&dirent->d_name[4], &driverName[1]) != 0)
- continue;
-
- snprintf(path, sizeof(path), "%s/drm/card%s/dri_library_name",
- sysfs, &driverName[1]);
- _eglLog(_EGL_INFO, "Opening %s", path);
-#if 1
- file = fopen(path, "r");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s", path);
- return NULL;
- }
- fgets(path, sizeof(path), file);
- fclose(file);
-#else
- strcpy(path, "r200\n");
-#endif
- if ((length = strlen(path)) > 0)
- path[length - 1] = '\0'; /* remove the trailing newline from sysfs */
- strncat(path, "_dri", sizeof(path));
-
- driver = _eglOpenDriver(dpy, path);
-
- break;
- }
- closedir(dir);
-
- return driver;
-#endif
-}
-
-
-/**
- * Called by eglCreateContext via drv->API.CreateContext().
- */
-static EGLContext
-_eglDRICreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- EGLContext share_list, const EGLint *attrib_list)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *c, *share;
- void *sharePriv;
- _EGLConfig *conf;
- __GLcontextModes visMode;
-
- c = (driContext *) calloc(1, sizeof(*c));
- if (!c)
- return EGL_NO_CONTEXT;
-
- conf = _eglLookupConfig(drv, dpy, config);
- assert(conf);
-
- if (!_eglInitContext(drv, &c->Base, conf, attrib_list)) {
- free(c);
- return EGL_NO_CONTEXT;
- }
-
- if (share_list != EGL_NO_CONTEXT) {
- _EGLContext *shareCtx = _eglLookupContext(share_list);
- if (!shareCtx) {
- _eglError(EGL_BAD_CONTEXT, "eglCreateContext(share_list)");
- return EGL_FALSE;
- }
- }
- share = Lookup_driContext(share_list);
- if (share)
- sharePriv = share->driContext.private;
- else
- sharePriv = NULL;
-
- _eglConfigToContextModesRec(conf, &visMode);
-
- c->driContext.private = disp->driScreen.createNewContext(disp, &visMode,
- GLX_WINDOW_BIT, sharePriv, &c->driContext);
- if (!c->driContext.private) {
- free(c);
- return EGL_FALSE;
- }
-
- /* link to display */
- _eglLinkContext(&c->Base, &disp->Base);
-
- return _eglGetContextHandle(&c->Base);
-}
-
-
-static EGLBoolean
-_eglDRIMakeCurrent(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw,
- EGLSurface read, EGLContext context)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *ctx = Lookup_driContext(context);
- EGLBoolean b;
- __DRIid drawBuf = (__DRIid) draw;
- __DRIid readBuf = (__DRIid) read;
-
- b = _eglMakeCurrent(drv, dpy, draw, read, context);
- if (!b)
- return EGL_FALSE;
-
- if (ctx) {
- ctx->driContext.bindContext(disp, 0, drawBuf, readBuf, &ctx->driContext);
- }
- else {
- /* what's this??? */
- /* _mesa_make_current( NULL, NULL, NULL );*/
- }
- return EGL_TRUE;
-}
-
-
-static EGLSurface
-_eglDRICreatePbufferSurface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
- const EGLint *attrib_list)
-{
- driSurface *surf;
- _EGLConfig *conf;
-
- conf = _eglLookupConfig(drv, dpy, config);
- assert(conf);
-
- surf = (driSurface *) calloc(1, sizeof(*surf));
- if (!surf) {
- return EGL_NO_SURFACE;
- }
-
- if (!_eglInitSurface(drv, &surf->Base, EGL_PBUFFER_BIT,
- conf, attrib_list)) {
- free(surf);
- return EGL_NO_SURFACE;
- }
-
- /* create software-based pbuffer */
- {
-#if 0
- GLcontext *ctx = NULL; /* this _should_ be OK */
-#endif
- __GLcontextModes visMode;
- _EGLConfig *conf = _eglLookupConfig(drv, dpy, config);
- assert(conf); /* bad config should be caught earlier */
- _eglConfigToContextModesRec(conf, &visMode);
-
-#if 0
- surf->mesa_framebuffer = _mesa_create_framebuffer(&visMode);
- _mesa_add_soft_renderbuffers(surf->mesa_framebuffer,
- GL_TRUE, /* color bufs */
- visMode.haveDepthBuffer,
- visMode.haveStencilBuffer,
- visMode.haveAccumBuffer,
- GL_FALSE, /* alpha */
- GL_FALSE /* aux */ );
-
- /* set pbuffer/framebuffer size */
- _mesa_resize_framebuffer(ctx, surf->mesa_framebuffer,
- surf->Base.Width, surf->Base.Height);
-#endif
- }
-
- _eglLinkSurface(&surf->Base, _eglLookupDisplay(dpy));
-
- return surf->Base.Handle;
-}
-
-
-static EGLBoolean
-_eglDRIDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driSurface *fs = Lookup_driSurface(surface);
-
- _eglUnlinkSurface(&fs->Base);
-
- fs->drawable.destroyDrawable(disp, fs->drawable.private);
-
- if (!_eglIsSurfaceBound(&fs->Base))
- free(fs);
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-_eglDRIDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext context)
-{
- driDisplay *disp = Lookup_driDisplay(dpy);
- driContext *fc = Lookup_driContext(context);
-
- _eglUnlinkContext(&fc->Base);
-
- fc->driContext.destroyContext(disp, 0, fc->driContext.private);
-
- if (!_eglIsContextBound(&fc->Base))
- free(fc);
- return EGL_TRUE;
-}
-
-
-/**
- * Create a drawing surface which can be directly displayed on a screen.
- */
-static EGLSurface
-_eglDRICreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
- const EGLint *attrib_list)
-{
- _EGLConfig *config = _eglLookupConfig(drv, dpy, cfg);
- driDisplay *disp = Lookup_driDisplay(dpy);
- driSurface *surface;
- __GLcontextModes visMode;
- __DRIid drawBuf;
-
- surface = (driSurface *) calloc(1, sizeof(*surface));
- if (!surface) {
- return EGL_NO_SURFACE;
- }
-
- /* init base class, do error checking, etc. */
- if (!_eglInitSurface(drv, &surface->Base, EGL_SCREEN_BIT_MESA,
- config, attrib_list)) {
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- _eglLinkSurface(&surface->Base &disp->Base);
-
-
- /*
- * XXX this is where we should allocate video memory for the surface!
- */
-
-
- /* convert EGLConfig to GLvisual */
- _eglConfigToContextModesRec(config, &visMode);
-
- drawBuf = (__DRIid) _eglGetSurfaceHandle(&surface->Base);
-
- /* Create a new DRI drawable */
- if (!disp->driScreen.createNewDrawable(disp, &visMode, drawBuf,
- &surface->drawable, GLX_WINDOW_BIT,
- empty_attribute_list)) {
- _eglUnlinkSurface(&surface->Base);
- free(surface);
- return EGL_NO_SURFACE;
- }
-
- return surface->Base.Handle;
-}
-
-
-/**
- * Set the fbdev colormap to a simple linear ramp.
- */
-static void
-_eglDRILoadColormap(driScreen *scrn)
-{
- char path[ NAME_MAX ];
- char *buffer;
- int i, fd;
-
- /* cmap attribute uses 256 lines of 16 bytes.
- * Allocate one extra char for the \0 added by sprintf()
- */
- if ( !( buffer = malloc( 256 * 16 + 1 ) ) ) {
- _eglLog(_EGL_WARNING, "Out of memory in _eglDRILoadColormap");
- return;
- }
-
- /* cmap attribute uses 256 lines of 16 bytes */
- for ( i = 0; i < 256; i++ ) {
- int c = (i << 8) | i; /* expand to 16-bit value */
- sprintf(&buffer[i * 16], "%02x%c%04x%04x%04x\n", i, ' ', c, c, c);
- }
-
- snprintf(path, sizeof(path), "%s/graphics/%s/color_map", sysfs, scrn->fb);
- if ( !( fd = open( path, O_RDWR ) ) ) {
- _eglLog(_EGL_WARNING, "Unable to open %s to set colormap", path);
- return;
- }
- write( fd, buffer, 256 * 16 );
- close( fd );
-
- free( buffer );
-}
-
-
-/**
- * Show the given surface on the named screen.
- * If surface is EGL_NO_SURFACE, disable the screen's output.
- * Called via eglShowSurfaceMESA().
- */
-EGLBoolean
-_eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy,
- EGLScreenMESA screen,
- EGLSurface surface, EGLModeMESA m)
-{
- driDisplay *display = Lookup_driDisplay(dpy);
- driScreen *scrn = Lookup_driScreen(dpy, screen);
- driSurface *surf = Lookup_driSurface(surface);
- _EGLMode *mode = _eglLookupMode(dpy, m);
- FILE *file;
- char fname[NAME_MAX], buffer[1000];
- int temp;
-
- _eglLog(_EGL_DEBUG, "Enter _eglDRIShowScreenSurface");
-
- /* This will check that surface, screen, and mode are valid.
- * Also, it checks that the surface is large enough for the mode, etc.
- */
- if (!_eglShowScreenSurfaceMESA(drv, dpy, screen, surface, m))
- return EGL_FALSE;
-
- assert(surface == EGL_NO_SURFACE || surf);
- assert(m == EGL_NO_MODE_MESA || mode);
- assert(scrn);
-
- /*
- * Blank/unblank screen depending on if m == EGL_NO_MODE_MESA
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "kernel patch?? chown all fb sysfs attrib to allow"
- " write - %s\n", fname);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d",
- (m == EGL_NO_MODE_MESA ? VESA_POWERDOWN : VESA_VSYNC_SUSPEND));
- fputs(buffer, file);
- fclose(file);
-
- if (m == EGL_NO_MODE_MESA) {
- /* all done! */
- return EGL_TRUE;
- }
-
- _eglLog(_EGL_INFO, "Setting display mode to %d x %d, %d bpp",
- mode->Width, mode->Height, display->bpp);
-
- /*
- * Set the display mode
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/mode", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s to set mode", fname);
- return EGL_FALSE;
- }
- /* note: nothing happens without the \n! */
- snprintf(buffer, sizeof(buffer), "%s\n", mode->Name);
- fputs(buffer, file);
- fclose(file);
- _eglLog(_EGL_INFO, "Set mode to %s in %s", mode->Name, fname);
-
- /*
- * Set display bpp
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/bits_per_pixel",
- sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s to set bpp", fname);
- return EGL_FALSE;
- }
- display->bpp = GET_CONFIG_ATTRIB(surf->Base.Config, EGL_BUFFER_SIZE);
- display->cpp = display->bpp / 8;
- snprintf(buffer, sizeof(buffer), "%d", display->bpp);
- fputs(buffer, file);
- fclose(file);
-
- /*
- * Unblank display
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/blank", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- if (!file) {
- _eglLog(_EGL_WARNING, "Failed to open %s", fname);
- return EGL_FALSE;
- }
- snprintf(buffer, sizeof(buffer), "%d", VESA_NO_BLANKING);
- fputs(buffer, file);
- fclose(file);
-
- /*
- * Set fbdev buffer virtual size to surface's size.
- */
- snprintf(fname, sizeof(fname), "%s/graphics/%s/virtual_size", sysfs, scrn->fb);
- file = fopen(fname, "r+");
- snprintf(buffer, sizeof(buffer), "%d,%d", surf->Base.Width, surf->Base.Height);
- fputs(buffer, file);
- rewind(file);
- fgets(buffer, sizeof(buffer), file);
- sscanf(buffer, "%d,%d", &display->virtualWidth, &display->virtualHeight);
- fclose(file);
-
- /*
- * round up pitch as needed
- */
- temp = display->virtualWidth;
- switch (display->bpp / 8) {
- case 1: temp = (display->virtualWidth + 127) & ~127; break;
- case 2: temp = (display->virtualWidth + 31) & ~31; break;
- case 3:
- case 4: temp = (display->virtualWidth + 15) & ~15; break;
- default:
- _eglLog(_EGL_WARNING, "Bad display->bpp = %d in _eglDRIShowScreenSurface");
- }
- display->virtualWidth = temp;
-
- /*
- * sanity check
- */
- if (surf->Base.Width < display->virtualWidth ||
- surf->Base.Height < display->virtualHeight) {
- /* this case _should_ have been caught at the top of this function */
- _eglLog(_EGL_WARNING, "too small of surface in _eglDRIShowScreenSurfaceMESA "
- "%d x %d < %d x %d",
- surf->Base.Width,
- surf->Base.Height,
- display->virtualWidth,
- display->virtualHeight);
- /*
- return EGL_FALSE;
- */
- }
-
- /* This used to be done in the _eglDRICreateScreens routine. */
- _eglDRILoadColormap(scrn);
-
- return EGL_TRUE;
-}
-
-
-/**
- * Called by eglSwapBuffers via the drv->API.SwapBuffers() pointer.
- *
- * If the backbuffer is on a videocard, this is extraordinarily slow!
- */
-static EGLBoolean
-_eglDRISwapBuffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
-{
- driSurface *drawable = Lookup_driSurface(draw);
-
- /* this does error checking */
- if (!_eglSwapBuffers(drv, dpy, draw))
- return EGL_FALSE;
-
- drawable->drawable.swapBuffers(NULL, drawable->drawable.private);
-
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglDRIGetDisplayInfo(driDisplay *dpy)
-{
- char path[ NAME_MAX ];
- FILE *file;
- int i, rc;
- drmSetVersion sv;
- drm_magic_t magic;
-
- snprintf( path, sizeof( path ), "%s/graphics/fb%d/device/device", sysfs, dpy->minor );
- file = fopen( path, "r" );
- if (!file) {
- _eglLog(_EGL_WARNING, "Unable to open %s", path);
- return EGL_FALSE;
- }
- fgets( path, sizeof( path ), file );
- sscanf( path, "%x", &dpy->chipset );
- fclose( file );
-
- sprintf(path, DRM_DEV_NAME, DRM_DIR_NAME, dpy->minor);
- if ( ( dpy->drmFD = open(path, O_RDWR, 0) ) < 0 ) {
- _eglLog(_EGL_WARNING, "drmOpen failed.");
- return EGL_FALSE;
- }
-
- /* Set the interface version, asking for 1.2 */
- sv.drm_di_major = 1;
- sv.drm_di_minor = 2;
- sv.drm_dd_major = -1;
- if ((rc = drmSetInterfaceVersion(dpy->drmFD, &sv)))
- return EGL_FALSE;
-
- /* self authorize */
- if (drmGetMagic(dpy->drmFD, &magic))
- return EGL_FALSE;
- if (drmAuthMagic(dpy->drmFD, magic))
- return EGL_FALSE;
-
- /* Map framebuffer and SAREA */
- for (i = 0; ; i++) {
- drm_handle_t handle, offset;
- drmSize size;
- drmMapType type;
- drmMapFlags flags;
- int mtrr;
-
- if (drmGetMap(dpy->drmFD, i, &offset, &size, &type, &flags,
- &handle, &mtrr))
- break;
-
- if (type == DRM_FRAME_BUFFER) {
- rc = drmMap( dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pFB);
- if (rc < 0) {
- _eglLog(_EGL_WARNING, "drmMap DRM_FAME_BUFFER failed");
- return EGL_FALSE;
- }
- dpy->fbSize = size;
- _eglLog(_EGL_INFO, "Found framebuffer size: %d", dpy->fbSize);
- }
- else if (type == DRM_SHM) {
- rc = drmMap(dpy->drmFD, offset, size, (drmAddressPtr) &dpy->pSAREA);
- if (rc < 0 ) {
- _eglLog(_EGL_WARNING, "drmMap DRM_SHM failed.");
- return EGL_FALSE;
- }
- dpy->SAREASize = SAREA_MAX;
- _eglLog(_EGL_DEBUG, "mapped SAREA 0x%08lx to %p, size %d",
- (unsigned long) offset, dpy->pSAREA, dpy->SAREASize );
- }
- }
-
- if (!dpy->pFB) {
- _eglLog(_EGL_WARNING, "failed to map framebuffer");
- return EGL_FALSE;
- }
-
- if (!dpy->pSAREA) {
- /* if this happens, make sure you're using the most recent DRM modules */
- _eglLog(_EGL_WARNING, "failed to map SAREA");
- return EGL_FALSE;
- }
-
- memset( dpy->pSAREA, 0, dpy->SAREASize );
-
- return EGL_TRUE;
-}
-
-
- /* Return the DRI per screen structure */
-static __DRIscreen *
-__eglFindDRIScreen(__DRInativeDisplay *ndpy, int scrn)
-{
- driDisplay *disp = (driDisplay *)ndpy;
- return &disp->driScreen;
-}
-
-
-static GLboolean
-__eglCreateContextWithConfig(__DRInativeDisplay* ndpy, int screen,
- int configID, void* context,
- drm_context_t * hHWContext)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreen *) pDRIScreen->private;
- if (psp->fd) {
- if (drmCreateContext(psp->fd, hHWContext)) {
- _eglLog(_EGL_WARNING, "drmCreateContext failed.");
- return GL_FALSE;
- }
- *(void**)context = (void*) *hHWContext;
- }
-#if 0
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
-
- pDRIScreen = __glXFindDRIScreen(dpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
-
- psp = (__DRIscreen *) pDRIScreen->private;
-
- if (psp->fd) {
- if (drmCreateContext(psp->fd, hHWContext)) {
- _eglLog(_EGL_WARNING, "drmCreateContext failed.");
- return GL_FALSE;
- }
- *(void**)contextID = (void*) *hHWContext;
- }
-#endif
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglDestroyContext( __DRInativeDisplay * ndpy, int screen, __DRIid context )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreen *) pDRIScreen->private;
- if (psp->fd)
- drmDestroyContext(psp->fd, context);
-
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglCreateDrawable(__DRInativeDisplay * ndpy, int screen,
- __DRIid drawable, drm_drawable_t * hHWDrawable)
-{
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreen *) pDRIScreen->private;
- if (psp->fd) {
- if (drmCreateDrawable(psp->fd, hHWDrawable)) {
- _eglLog(_EGL_WARNING, "drmCreateDrawable failed.");
- return GL_FALSE;
- }
- }
- return GL_TRUE;
-}
-
-
-static GLboolean
-__eglDestroyDrawable( __DRInativeDisplay * ndpy, int screen, __DRIid drawable )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreen *) pDRIScreen->private;
- if (psp->fd)
- drmDestroyDrawable(psp->fd, drawable);
-
- return GL_TRUE;
-}
-
-static GLboolean
-__eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
- unsigned int* index, unsigned int* stamp,
- int* X, int* Y, int* W, int* H,
- int* numClipRects, drm_clip_rect_t ** pClipRects,
- int* backX, int* backY,
- int* numBackClipRects, drm_clip_rect_t ** pBackClipRects )
-{
- __DRIscreen *pDRIScreen;
- __DRIscreen *psp;
- driSurface *surf = Lookup_driSurface((EGLSurface) drawable);
-
- pDRIScreen = __eglFindDRIScreen(ndpy, screen);
-
- if ( (pDRIScreen == NULL) || (pDRIScreen->private == NULL) ) {
- return GL_FALSE;
- }
- psp = (__DRIscreen *) pDRIScreen->private;
- *X = 0;
- *Y = 0;
- *W = surf->Base.Width;
- *H = surf->Base.Height;
-
- *backX = 0;
- *backY = 0;
- *numBackClipRects = 0;
- *pBackClipRects = NULL;
-
- *numClipRects = 1;
- *pClipRects = malloc(sizeof(**pClipRects));
- **pClipRects = (drm_clip_rect_t){0, 0, surf->Base.Width, surf->Base.Height};
-
- psp->pSAREA->drawableTable[0].stamp = 1;
- *stamp = 1;
-#if 0
- GLXDrawable drawable = (GLXDrawable) draw;
- drm_clip_rect_t * cliprect;
- Display* display = (Display*)dpy;
- __DRIcontext *pcp = (__DRIcontext *)CurrentContext->driContext.private;
- if (drawable == 0) {
- return GL_FALSE;
- }
-
- cliprect = (drm_clip_rect_t*) malloc(sizeof(drm_clip_rect_t));
- cliprect->x1 = drawable->x;
- cliprect->y1 = drawable->y;
- cliprect->x2 = drawable->x + drawable->w;
- cliprect->y2 = drawable->y + drawable->h;
-
- /* the drawable index is by client id */
- *index = display->clientID;
-
- *stamp = pcp->driScreenPriv->pSAREA->drawableTable[display->clientID].stamp;
- *x = drawable->x;
- *y = drawable->y;
- *width = drawable->w;
- *height = drawable->h;
- *numClipRects = 1;
- *pClipRects = cliprect;
-
- *backX = drawable->x;
- *backY = drawable->y;
- *numBackClipRects = 0;
- *pBackClipRects = 0;
-#endif
- return GL_TRUE;
-}
-
-
-/**
- * Implement \c __DRIinterfaceMethods::getProcAddress.
- */
-static __DRIfuncPtr
-get_proc_address(const char * proc_name)
-{
- return NULL;
-}
-
-
-/**
- * Destroy a linked list of \c __GLcontextModes structures created by
- * \c _gl_context_modes_create.
- *
- * \param modes Linked list of structures to be destroyed. All structres
- * in the list will be freed.
- */
-static void
-__egl_context_modes_destroy(__GLcontextModes *modes)
-{
- while ( modes != NULL ) {
- __GLcontextModes * const next = modes->next;
-
- free( modes );
- modes = next;
- }
-}
-
-
-/**
- * Allocate a linked list of \c __GLcontextModes structures. The fields of
- * each structure will be initialized to "reasonable" default values. In
- * most cases this is the default value defined by table 3.4 of the GLX
- * 1.3 specification. This means that most values are either initialized to
- * zero or \c GLX_DONT_CARE (which is -1). As support for additional
- * extensions is added, the new values will be initialized to appropriate
- * values from the extension specification.
- *
- * \param count Number of structures to allocate.
- * \param minimum_size Minimum size of a structure to allocate. This allows
- * for differences in the version of the
- * \c __GLcontextModes stucture used in libGL and in a
- * DRI-based driver.
- * \returns A pointer to the first element in a linked list of \c count
- * stuctures on success, or \c NULL on failure.
- *
- * \warning Use of \c minimum_size does \b not guarantee binary compatibility.
- * The fundamental assumption is that if the \c minimum_size
- * specified by the driver and the size of the \c __GLcontextModes
- * structure in libGL is the same, then the meaning of each byte in
- * the structure is the same in both places. \b Be \b careful!
- * Basically this means that fields have to be added in libGL and
- * then propagated to drivers. Drivers should \b never arbitrarilly
- * extend the \c __GLcontextModes data-structure.
- */
-static __GLcontextModes *
-__egl_context_modes_create(unsigned count, size_t minimum_size)
-{
- const size_t size = (minimum_size > sizeof( __GLcontextModes ))
- ? minimum_size : sizeof( __GLcontextModes );
- __GLcontextModes * base = NULL;
- __GLcontextModes ** next;
- unsigned i;
-
- next = & base;
- for ( i = 0 ; i < count ; i++ ) {
- *next = (__GLcontextModes *) malloc( size );
- if ( *next == NULL ) {
- __egl_context_modes_destroy( base );
- base = NULL;
- break;
- }
-
- (void) memset( *next, 0, size );
- (*next)->visualID = GLX_DONT_CARE;
- (*next)->visualType = GLX_DONT_CARE;
- (*next)->visualRating = GLX_NONE;
- (*next)->transparentPixel = GLX_NONE;
- (*next)->transparentRed = GLX_DONT_CARE;
- (*next)->transparentGreen = GLX_DONT_CARE;
- (*next)->transparentBlue = GLX_DONT_CARE;
- (*next)->transparentAlpha = GLX_DONT_CARE;
- (*next)->transparentIndex = GLX_DONT_CARE;
- (*next)->xRenderable = GLX_DONT_CARE;
- (*next)->fbconfigID = GLX_DONT_CARE;
- (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML;
-
- next = & ((*next)->next);
- }
-
- return base;
-}
-
-
-static GLboolean
-__eglWindowExists(__DRInativeDisplay *dpy, __DRIid draw)
-{
- return EGL_TRUE;
-}
-
-
-/**
- * Get the unadjusted system time (UST). Currently, the UST is measured in
- * microseconds since Epoc. The actual resolution of the UST may vary from
- * system to system, and the units may vary from release to release.
- * Drivers should not call this function directly. They should instead use
- * \c glXGetProcAddress to obtain a pointer to the function.
- *
- * \param ust Location to store the 64-bit UST
- * \returns Zero on success or a negative errno value on failure.
- *
- * \sa glXGetProcAddress, PFNGLXGETUSTPROC
- *
- * \since Internal API version 20030317.
- */
-static int
-__eglGetUST(int64_t *ust)
-{
- struct timeval tv;
-
- if ( ust == NULL ) {
- return -EFAULT;
- }
-
- if ( gettimeofday( & tv, NULL ) == 0 ) {
- ust[0] = (tv.tv_sec * 1000000) + tv.tv_usec;
- return 0;
- }
- else {
- return -errno;
- }
-}
-
-/**
- * Determine the refresh rate of the specified drawable and display.
- *
- * \param dpy Display whose refresh rate is to be determined.
- * \param drawable Drawable whose refresh rate is to be determined.
- * \param numerator Numerator of the refresh rate.
- * \param demoninator Denominator of the refresh rate.
- * \return If the refresh rate for the specified display and drawable could
- * be calculated, True is returned. Otherwise False is returned.
- *
- * \note This function is implemented entirely client-side. A lot of other
- * functionality is required to export GLX_OML_sync_control, so on
- * XFree86 this function can be called for direct-rendering contexts
- * when GLX_OML_sync_control appears in the client extension string.
- */
-static GLboolean
-__eglGetMSCRate(__DRInativeDisplay * dpy, __DRIid drawable,
- int32_t * numerator, int32_t * denominator)
-{
- return EGL_TRUE;
-}
-
-
-/**
- * Table of functions exported by the loader to the driver.
- */
-static const __DRIinterfaceMethods interface_methods = {
- get_proc_address,
-
- __egl_context_modes_create,
- __egl_context_modes_destroy,
-
- __eglFindDRIScreen,
- __eglWindowExists,
-
- __eglCreateContextWithConfig,
- __eglDestroyContext,
-
- __eglCreateDrawable,
- __eglDestroyDrawable,
- __eglGetDrawableInfo,
-
- __eglGetUST,
- __eglGetMSCRate,
-};
-
-
-static int
-__glXGetInternalVersion(void)
-{
- return 20050725;
-}
-
-static const char createNewScreenName[] = "__driCreateNewScreen_20050727";
-
-
-/**
- * Do per-display initialization.
- */
-EGLBoolean
-_eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer)
-{
- PFNCREATENEWSCREENFUNC createNewScreen;
- int api_ver = __glXGetInternalVersion();
- __DRIversion ddx_version;
- __DRIversion dri_version;
- __DRIversion drm_version;
- drmVersionPtr version;
-
- version = drmGetVersion( dpy->drmFD );
- if ( version ) {
- drm_version.major = version->version_major;
- drm_version.minor = version->version_minor;
- drm_version.patch = version->version_patchlevel;
- drmFreeVersion( version );
- }
- else {
- drm_version.major = -1;
- drm_version.minor = -1;
- drm_version.patch = -1;
- }
-
- /*
- * Get device name (like "tdfx") and the ddx version numbers.
- * We'll check the version in each DRI driver's "createScreen"
- * function.
- */
- ddx_version.major = 4;
- ddx_version.minor = 0;
- ddx_version.patch = 0;
-
- /*
- * Get the DRI X extension version.
- */
- dri_version.major = 4;
- dri_version.minor = 0;
- dri_version.patch = 0;
-
- createNewScreen = ( PFNCREATENEWSCREENFUNC ) dlsym( dpy->Base.Driver->LibHandle, createNewScreenName );
- if ( !createNewScreen ) {
- _eglLog(_EGL_WARNING, "Couldn't find %s function in the driver.",
- createNewScreenName );
- return EGL_FALSE;
- }
-
- dpy->driScreen.private = createNewScreen( dpy, 0, &dpy->driScreen, NULL,
- &ddx_version, &dri_version,
- &drm_version, framebuffer,
- dpy->pSAREA, dpy->drmFD,
- api_ver,
- & interface_methods,
- NULL);
- if (!dpy->driScreen.private) {
- _eglLog(_EGL_WARNING, "egldri.c: DRI create new screen failed");
- return EGL_FALSE;
- }
-
- DRM_UNLOCK( dpy->drmFD, dpy->pSAREA, dpy->serverContext );
-
- return EGL_TRUE;
-}
-
-
-/**
- * Create all the EGL screens for the given display.
- */
-EGLBoolean
-_eglDRICreateScreens(driDisplay *dpy)
-{
- const int numScreens = 1; /* XXX fix this someday */
- int i;
-
- for (i = 0; i < numScreens; i++) {
- char path[ NAME_MAX ];
- FILE *file;
- driScreen *s;
-
- /* Create a screen */
- if ( !( s = ( driScreen * ) calloc( 1, sizeof( *s ) ) ) )
- return EGL_FALSE;
-
- snprintf( s->fb, NAME_MAX, "fb%d", dpy->minor );
- _eglInitScreen( &s->Base );
-
- _eglAddScreen( &dpy->Base, &s->Base );
-
- /* Create the screen's mode list */
- snprintf( path, sizeof( path ), "%s/graphics/%s/modes", sysfs, s->fb );
- file = fopen( path, "r" );
- while ( fgets( path, sizeof( path ), file ) ) {
- unsigned int x, y, r;
- char c;
- path[ strlen( path ) - 1 ] = '\0'; /* strip off \n from sysfs */
- sscanf( path, "%c:%ux%u-%u", &c, &x, &y, &r );
- _eglAddNewMode( &s->Base, x, y, r * 1000, path );
- }
- fclose( file );
-
- /*
- * NOTE: we used to set the colormap here, but that didn't work reliably.
- * Some entries near the start of the table would get corrupted by later
- * mode changes.
- */
- }
-
- return EGL_TRUE;
-}
-
-
-EGLBoolean
-_eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy,
- EGLint *major, EGLint *minor)
-{
- _EGLDisplay *disp = _eglLookupDisplay(dpy);
- driDisplay *display;
- const char *driverName = (const char *) disp->NativeDisplay;
-
- assert(disp);
-
- /* Create new driDisplay object to replace the _EGLDisplay that was
- * previously created.
- */
- display = calloc(1, sizeof(*display));
- display->Base = *disp;
- _eglSaveDisplay(&display->Base);
- free(disp);
-
- *major = 1;
- *minor = 0;
-
- sscanf(driverName + 1, "%d", &display->minor);
-
- drv->Initialized = EGL_TRUE;
- return EGL_TRUE;
-}
-
-
-static EGLBoolean
-_eglDRITerminate(_EGLDriver *drv, EGLDisplay dpy)
-{
- driDisplay *display = Lookup_driDisplay(dpy);
- _eglCleanupDisplay(&display->Base);/*rename that function*/
- free(display);
- free(drv);
- return EGL_TRUE;
-}
-
-
-/**
- * Plug in the DRI-specific functions into the driver's dispatch table.
- * Also, enable some EGL extensions.
- */
-void
-_eglDRIInitDriverFallbacks(_EGLDriver *drv)
-{
- _eglInitDriverFallbacks(drv);
-
- drv->API.Initialize = _eglDRIInitialize;
- drv->API.Terminate = _eglDRITerminate;
- drv->API.CreateContext = _eglDRICreateContext;
- drv->API.MakeCurrent = _eglDRIMakeCurrent;
- drv->API.CreatePbufferSurface = _eglDRICreatePbufferSurface;
- drv->API.DestroySurface = _eglDRIDestroySurface;
- drv->API.DestroyContext = _eglDRIDestroyContext;
- drv->API.CreateScreenSurfaceMESA = _eglDRICreateScreenSurfaceMESA;
- drv->API.ShowScreenSurfaceMESA = _eglDRIShowScreenSurfaceMESA;
- drv->API.SwapBuffers = _eglDRISwapBuffers;
-
- /* enable supported extensions */
- drv->Extensions.MESA_screen_surface = EGL_TRUE;
- drv->Extensions.MESA_copy_context = EGL_TRUE;
-}
diff --git a/src/egl/drivers/dri/egldri.h b/src/egl/drivers/dri/egldri.h
deleted file mode 100644
index 54a9a4ea26..0000000000
--- a/src/egl/drivers/dri/egldri.h
+++ /dev/null
@@ -1,116 +0,0 @@
-#ifndef EGLDRI_INCLUDED
-#define EGLDRI_INCLUDED
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include "egldisplay.h"
-#include "eglscreen.h"
-#include "eglsurface.h"
-#include "eglcontext.h"
-
-#include "dri_util.h"
-#include "drm_sarea.h"
-
-/**
- * dri display-specific driver class derived from _EGLDisplay
- */
-typedef struct dri_display
-{
- _EGLDisplay Base; /**< base class */
- void *pFB;
- int drmFD; /**< \brief DRM device file descriptor */
- int minor;
- unsigned long hFrameBuffer;
-
- int virtualWidth;
- int virtualHeight;
- int fbSize;
- int bpp;
- int cpp;
- int card_type;
- int SAREASize;
- drm_sarea_t *pSAREA;
- unsigned int serverContext; /**< \brief DRM context only active on server */
- unsigned long FBStart; /**< \brief physical address of the framebuffer */
- void *driverClientMsg;
- int driverClientMsgSize;
- unsigned chipset;
- void *driverPrivate;
- drm_magic_t magic;
-
- __DRIscreen driScreen;
-
-} driDisplay;
-
-
-/**
- * dri driver-specific screen class derived from _EGLScreen
- */
-typedef struct dri_screen
-{
- _EGLScreen Base;
- char fb[NAME_MAX]; /** the screen name, like "fb0" */
-} driScreen;
-
-
-/**
- * dri driver-specific surface class derived from _EGLSurface
- */
-typedef struct dri_surface
-{
- _EGLSurface Base; /* base class/object */
- __DRIdrawable drawable;
-} driSurface;
-
-
-/**
- * dri driver-specific context class derived from _EGLContext
- */
-typedef struct dri_context
-{
- _EGLContext Base; /* base class/object */
- __DRIcontext driContext; /**< \brief context dependent methods */
-} driContext;
-
-
-
-static inline driDisplay *
-Lookup_driDisplay(EGLDisplay dpy)
-{
- _EGLDisplay *d = _eglLookupDisplay(dpy);
- return (driDisplay *) d;
-}
-
-
-static inline driScreen *
-Lookup_driScreen(EGLDisplay dpy, EGLScreenMESA screen)
-{
- _EGLScreen *s = _eglLookupScreen(dpy, screen);
- return (driScreen *) s;
-}
-
-
-static inline driContext *
-Lookup_driContext(EGLContext ctx)
-{
- _EGLContext *c = _eglLookupContext(ctx);
- return (driContext *) c;
-}
-
-
-static inline driSurface *
-Lookup_driSurface(EGLSurface surf)
-{
- _EGLSurface *s = _eglLookupSurface(surf);
- return (driSurface *) s;
-}
-
-extern void _eglDRIInitDriverFallbacks(_EGLDriver *drv);
-extern EGLBoolean _eglDRIShowScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLScreenMESA screen, EGLSurface surface, EGLModeMESA m);
-extern EGLBoolean _eglDRIInitialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor);
-extern EGLBoolean _eglDRIGetDisplayInfo(driDisplay *dpy);
-extern EGLBoolean _eglDRICreateDisplay(driDisplay *dpy, __DRIframebuffer *framebuffer);
-extern EGLBoolean _eglDRICreateScreens(driDisplay *dpy);
-
-#endif /* EGLDRI_INCLUDED */
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2b78bcc763..856029091a 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -889,6 +889,7 @@ const int i915_chip_ids[] = {
0x29b2, /* PCI_CHIP_Q35_G */
0x29c2, /* PCI_CHIP_G33_G */
0x29d2, /* PCI_CHIP_Q33_G */
+ 0xa011, /* Pineview */
};
const int i965_chip_ids[] = {
diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c
index b4a40d1437..b2076e2e3f 100644
--- a/src/egl/drivers/glx/egl_glx.c
+++ b/src/egl/drivers/glx/egl_glx.c
@@ -37,8 +37,8 @@
#include <string.h>
#include <X11/Xlib.h>
#include <GL/glx.h>
+#include <EGL/egl.h>
-#include "eglconfigutil.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldefines.h"
@@ -127,48 +127,34 @@ GLX_egl_config_index(_EGLConfig *conf)
}
-#define MAP_ATTRIB(attr, memb) \
- { attr, offsetof(__GLcontextModes, memb) }
-
-
static const struct {
int attr;
- int offset;
+ int egl_attr;
} fbconfig_attributes[] = {
/* table 3.1 of GLX 1.4 */
- MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID),
- MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits),
- MAP_ATTRIB(GLX_LEVEL, level),
- MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode),
- MAP_ATTRIB(GLX_STEREO, stereoMode),
- MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers),
- MAP_ATTRIB(GLX_RED_SIZE, redBits),
- MAP_ATTRIB(GLX_GREEN_SIZE, greenBits),
- MAP_ATTRIB(GLX_BLUE_SIZE, blueBits),
- MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits),
- MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits),
- MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits),
- MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits),
- MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits),
- MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits),
- MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits),
- MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers),
- MAP_ATTRIB(GLX_SAMPLES, samples),
- MAP_ATTRIB(GLX_RENDER_TYPE, renderType),
- MAP_ATTRIB(GLX_DRAWABLE_TYPE, drawableType),
- MAP_ATTRIB(GLX_X_RENDERABLE, xRenderable),
- MAP_ATTRIB(GLX_X_VISUAL_TYPE, visualType),
- MAP_ATTRIB(GLX_CONFIG_CAVEAT, visualRating),
- MAP_ATTRIB(GLX_TRANSPARENT_TYPE, transparentPixel),
- MAP_ATTRIB(GLX_TRANSPARENT_INDEX_VALUE, transparentIndex),
- MAP_ATTRIB(GLX_TRANSPARENT_RED_VALUE, transparentRed),
- MAP_ATTRIB(GLX_TRANSPARENT_GREEN_VALUE, transparentGreen),
- MAP_ATTRIB(GLX_TRANSPARENT_BLUE_VALUE, transparentBlue),
- MAP_ATTRIB(GLX_TRANSPARENT_ALPHA_VALUE, transparentAlpha),
- MAP_ATTRIB(GLX_MAX_PBUFFER_WIDTH, maxPbufferWidth),
- MAP_ATTRIB(GLX_MAX_PBUFFER_HEIGHT, maxPbufferHeight),
- MAP_ATTRIB(GLX_MAX_PBUFFER_PIXELS, maxPbufferPixels),
- MAP_ATTRIB(GLX_VISUAL_ID, visualID),
+ { GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
+ { GLX_LEVEL, EGL_LEVEL },
+ { GLX_RED_SIZE, EGL_RED_SIZE },
+ { GLX_GREEN_SIZE, EGL_GREEN_SIZE },
+ { GLX_BLUE_SIZE, EGL_BLUE_SIZE },
+ { GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
+ { GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
+ { GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
+ { GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
+ { GLX_SAMPLES, EGL_SAMPLES },
+ { GLX_RENDER_TYPE, EGL_RENDERABLE_TYPE },
+ { GLX_X_RENDERABLE, EGL_NATIVE_RENDERABLE },
+ { GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
+ { GLX_CONFIG_CAVEAT, EGL_CONFIG_CAVEAT },
+ { GLX_TRANSPARENT_TYPE, EGL_TRANSPARENT_TYPE },
+ { GLX_TRANSPARENT_RED_VALUE, EGL_TRANSPARENT_RED_VALUE },
+ { GLX_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_GREEN_VALUE },
+ { GLX_TRANSPARENT_BLUE_VALUE, EGL_TRANSPARENT_BLUE_VALUE },
+ { GLX_MAX_PBUFFER_WIDTH, EGL_MAX_PBUFFER_WIDTH },
+ { GLX_MAX_PBUFFER_HEIGHT, EGL_MAX_PBUFFER_HEIGHT },
+ { GLX_MAX_PBUFFER_PIXELS, EGL_MAX_PBUFFER_PIXELS },
+ { GLX_VISUAL_ID, EGL_NATIVE_VISUAL_ID },
+ { GLX_X_VISUAL_TYPE, EGL_NATIVE_VISUAL_TYPE },
};
@@ -176,14 +162,12 @@ static EGLBoolean
convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
struct GLX_egl_config *GLX_conf)
{
- __GLcontextModes mode;
- int err = 0, attr, val, i;
-
- memset(&mode, 0, sizeof(mode));
+ int err = 0, attr, egl_attr, val, i;
+ EGLint conformant, config_caveat, surface_type;
for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) {
- int offset = fbconfig_attributes[i].offset;
attr = fbconfig_attributes[i].attr;
+ egl_attr = fbconfig_attributes[i].egl_attr;
err = glXGetFBConfigAttrib(dpy, fbconfig, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
@@ -192,113 +176,84 @@ convert_fbconfig(Display *dpy, GLXFBConfig fbconfig,
}
break;
}
- *((int *) ((char *) &mode + offset)) = val;
+
+ _eglSetConfigKey(&GLX_conf->Base, egl_attr, val);
}
if (err)
return EGL_FALSE;
/* must have rgba bit */
- if (!(mode.renderType & GLX_RGBA_BIT))
+ glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &val);
+ if (!(val & GLX_RGBA_BIT))
return EGL_FALSE;
+ conformant = EGL_OPENGL_BIT;
+ glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &val);
+ if (val == GLX_SLOW_CONFIG)
+ config_caveat = EGL_SLOW_CONFIG;
+ if (val == GLX_NON_CONFORMANT_CONFIG)
+ conformant &= ~EGL_OPENGL_BIT;
+ if (!(conformant & EGL_OPENGL_ES_BIT))
+ config_caveat = EGL_NON_CONFORMANT_CONFIG;
+
+ _eglSetConfigKey(&GLX_conf->Base, EGL_CONFIG_CAVEAT, config_caveat);
+
+ surface_type = 0;
+ glXGetFBConfigAttrib(dpy, fbconfig, GLX_DRAWABLE_TYPE, &val);
+ if (val & GLX_WINDOW_BIT)
+ surface_type |= EGL_WINDOW_BIT;
+ if (val & GLX_PIXMAP_BIT)
+ surface_type |= EGL_PIXMAP_BIT;
+ if (val & GLX_PBUFFER_BIT)
+ surface_type |= EGL_PBUFFER_BIT;
+
/* pixmap and pbuffer surfaces must be single-buffered in EGL */
- if (mode.doubleBufferMode) {
- mode.drawableType &= ~(GLX_PIXMAP_BIT | GLX_PBUFFER_BIT);
- if (!mode.drawableType)
+ glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &val);
+ GLX_conf->double_buffered = val;
+ if (GLX_conf->double_buffered) {
+ surface_type &= ~(EGL_PIXMAP_BIT | EGL_PBUFFER_BIT);
+ if (!surface_type)
return EGL_FALSE;
}
- mode.rgbMode = GL_TRUE;
- mode.haveAccumBuffer = (mode.accumRedBits +
- mode.accumGreenBits +
- mode.accumBlueBits +
- mode.accumAlphaBits > 0);
- mode.haveDepthBuffer = (mode.depthBits > 0);
- mode.haveStencilBuffer = (mode.stencilBits > 0);
+ _eglSetConfigKey(&GLX_conf->Base, EGL_SURFACE_TYPE, surface_type);
- GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
- return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
- EGL_OPENGL_BIT, EGL_OPENGL_BIT);
+ return EGL_TRUE;
}
-
static const struct {
int attr;
- int offset;
+ int egl_attr;
} visual_attributes[] = {
/* table 3.7 of GLX 1.4 */
/* no GLX_USE_GL */
- MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits),
- MAP_ATTRIB(GLX_LEVEL, level),
- MAP_ATTRIB(GLX_RGBA, rgbMode),
- MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode),
- MAP_ATTRIB(GLX_STEREO, stereoMode),
- MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers),
- MAP_ATTRIB(GLX_RED_SIZE, redBits),
- MAP_ATTRIB(GLX_GREEN_SIZE, greenBits),
- MAP_ATTRIB(GLX_BLUE_SIZE, blueBits),
- MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits),
- MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits),
- MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits),
- MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits),
- MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits),
- MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits),
- MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits),
- MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers),
- MAP_ATTRIB(GLX_SAMPLES, samples),
- MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID),
- /* GLX_EXT_visual_rating */
- MAP_ATTRIB(GLX_VISUAL_CAVEAT_EXT, visualRating),
+ { GLX_BUFFER_SIZE, EGL_BUFFER_SIZE },
+ { GLX_LEVEL, EGL_LEVEL },
+ { GLX_RED_SIZE, EGL_RED_SIZE },
+ { GLX_GREEN_SIZE, EGL_GREEN_SIZE },
+ { GLX_BLUE_SIZE, EGL_BLUE_SIZE },
+ { GLX_ALPHA_SIZE, EGL_ALPHA_SIZE },
+ { GLX_DEPTH_SIZE, EGL_DEPTH_SIZE },
+ { GLX_STENCIL_SIZE, EGL_STENCIL_SIZE },
+ { GLX_SAMPLE_BUFFERS, EGL_SAMPLE_BUFFERS },
+ { GLX_SAMPLES, EGL_SAMPLES },
};
-
-static int
-get_visual_type(const XVisualInfo *vis)
-{
- int klass;
-
-#if defined(__cplusplus) || defined(c_plusplus)
- klass = vis->c_class;
-#else
- klass = vis->class;
-#endif
-
- switch (klass) {
- case TrueColor:
- return GLX_TRUE_COLOR;
- case DirectColor:
- return GLX_DIRECT_COLOR;
- case PseudoColor:
- return GLX_PSEUDO_COLOR;
- case StaticColor:
- return GLX_STATIC_COLOR;
- case GrayScale:
- return GLX_GRAY_SCALE;
- case StaticGray:
- return GLX_STATIC_GRAY;
- default:
- return GLX_NONE;
- }
-}
-
-
static EGLBoolean
convert_visual(Display *dpy, XVisualInfo *vinfo,
struct GLX_egl_config *GLX_conf)
{
- __GLcontextModes mode;
- int err, attr, val, i;
+ int err, attr, egl_attr, val, i;
+ EGLint conformant, config_caveat, surface_type;
/* the visual must support OpenGL */
err = glXGetConfig(dpy, vinfo, GLX_USE_GL, &val);
if (err || !val)
return EGL_FALSE;
- memset(&mode, 0, sizeof(mode));
-
for (i = 0; i < ARRAY_SIZE(visual_attributes); i++) {
- int offset = visual_attributes[i].offset;
attr = visual_attributes[i].attr;
+ egl_attr = fbconfig_attributes[i].egl_attr;
err = glXGetConfig(dpy, vinfo, attr, &val);
if (err) {
if (err == GLX_BAD_ATTRIBUTE) {
@@ -307,38 +262,42 @@ convert_visual(Display *dpy, XVisualInfo *vinfo,
}
break;
}
- *((int *) ((char *) &mode + offset)) = val;
+
+ _eglSetConfigKey(&GLX_conf->Base, egl_attr, val);
}
if (err)
return EGL_FALSE;
- /* must be RGB mode */
- if (!mode.rgbMode)
+ glXGetConfig(dpy, vinfo, GLX_RGBA, &val);
+ if (!val)
return EGL_FALSE;
- mode.visualID = vinfo->visualid;
- mode.visualType = get_visual_type(vinfo);
- mode.redMask = vinfo->red_mask;
- mode.greenMask = vinfo->green_mask;
- mode.blueMask = vinfo->blue_mask;
+ conformant = EGL_OPENGL_BIT;
+ glXGetConfig(dpy, vinfo, GLX_VISUAL_CAVEAT_EXT, &val);
+ if (val == GLX_SLOW_CONFIG)
+ config_caveat = EGL_SLOW_CONFIG;
+ if (val == GLX_NON_CONFORMANT_CONFIG)
+ conformant &= ~EGL_OPENGL_BIT;
+ if (!(conformant & EGL_OPENGL_ES_BIT))
+ config_caveat = EGL_NON_CONFORMANT_CONFIG;
- mode.drawableType = GLX_WINDOW_BIT;
+ _eglSetConfigKey(&GLX_conf->Base, EGL_CONFIG_CAVEAT, config_caveat);
+ _eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_VISUAL_ID, vinfo->visualid);
+ _eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_VISUAL_TYPE, vinfo->class);
+
+ /* pixmap and pbuffer surfaces must be single-buffered in EGL */
+ glXGetConfig(dpy, vinfo, GLX_DOUBLEBUFFER, &val);
+ GLX_conf->double_buffered = val;
+ surface_type = EGL_WINDOW_BIT;
/* pixmap surfaces must be single-buffered in EGL */
- if (!mode.doubleBufferMode)
- mode.drawableType |= GLX_PIXMAP_BIT;
-
- mode.renderType = GLX_RGBA_BIT;
- mode.xRenderable = GL_TRUE;
- mode.haveAccumBuffer = (mode.accumRedBits +
- mode.accumGreenBits +
- mode.accumBlueBits +
- mode.accumAlphaBits > 0);
- mode.haveDepthBuffer = (mode.depthBits > 0);
- mode.haveStencilBuffer = (mode.stencilBits > 0);
-
- GLX_conf->double_buffered = (mode.doubleBufferMode != 0);
- return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode,
- EGL_OPENGL_BIT, EGL_OPENGL_BIT);
+ if (!GLX_conf->double_buffered)
+ surface_type |= EGL_PIXMAP_BIT;
+
+ _eglSetConfigKey(&GLX_conf->Base, EGL_SURFACE_TYPE, surface_type);
+
+ _eglSetConfigKey(&GLX_conf->Base, EGL_NATIVE_RENDERABLE, EGL_TRUE);
+
+ return EGL_TRUE;
}
diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
index d92fbf6d9a..baee1a2f9d 100644
--- a/src/egl/main/Makefile
+++ b/src/egl/main/Makefile
@@ -12,7 +12,6 @@ INCLUDE_DIRS = -I$(TOP)/include
HEADERS = \
eglcompiler.h \
eglconfig.h \
- eglconfigutil.h \
eglcontext.h \
eglcurrent.h \
egldefines.h \
@@ -33,7 +32,6 @@ SOURCES = \
eglapi.c \
eglarray.c \
eglconfig.c \
- eglconfigutil.c \
eglcontext.c \
eglcurrent.c \
egldisplay.c \
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 06846475ba..45d40e2650 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -24,7 +24,6 @@ if env['platform'] != 'winddk':
'eglapi.c',
'eglarray.c',
'eglconfig.c',
- 'eglconfigutil.c',
'eglcontext.c',
'eglcurrent.c',
'egldisplay.c',
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 31c5419bbc..829d700b24 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -405,7 +405,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
if (config)
_EGL_CHECK_CONFIG(disp, conf, EGL_NO_CONTEXT, drv);
else
- drv = _eglCheckDisplay(disp, __FUNCTION__);
+ _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv);
if (!share && share_list != EGL_NO_CONTEXT)
RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h
index ca63c40d3d..0ad58cf473 100644
--- a/src/egl/main/eglconfig.h
+++ b/src/egl/main/eglconfig.h
@@ -117,7 +117,7 @@ static INLINE _EGLConfig *
_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy)
{
_EGLConfig *conf = (_EGLConfig *) config;
- if (!_eglCheckConfigHandle(config, dpy))
+ if (!dpy || !_eglCheckConfigHandle(config, dpy))
conf = NULL;
return conf;
}
diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c
deleted file mode 100644
index e416b190f0..0000000000
--- a/src/egl/main/eglconfigutil.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Extra utility functions related to EGL configs.
- */
-
-
-#include <stdlib.h>
-#include <string.h>
-#include "eglconfigutil.h"
-
-
-/**
- * Convert an _EGLConfig to a __GLcontextModes object.
- * NOTE: This routine may be incomplete - we're only making sure that
- * the fields needed by Mesa (for _mesa_create_context/framebuffer) are
- * set correctly.
- */
-void
-_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode)
-{
- memset(mode, 0, sizeof(*mode));
-
- mode->rgbMode = GL_TRUE; /* no color index */
- mode->colorIndexMode = GL_FALSE;
- mode->doubleBufferMode = GL_TRUE; /* always DB for now */
- mode->stereoMode = GL_FALSE;
-
- mode->redBits = GET_CONFIG_ATTRIB(config, EGL_RED_SIZE);
- mode->greenBits = GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE);
- mode->blueBits = GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE);
- mode->alphaBits = GET_CONFIG_ATTRIB(config, EGL_ALPHA_SIZE);
- mode->rgbBits = GET_CONFIG_ATTRIB(config, EGL_BUFFER_SIZE);
-
- /* no rgba masks - fix? */
-
- mode->depthBits = GET_CONFIG_ATTRIB(config, EGL_DEPTH_SIZE);
- mode->haveDepthBuffer = mode->depthBits > 0;
-
- mode->stencilBits = GET_CONFIG_ATTRIB(config, EGL_STENCIL_SIZE);
- mode->haveStencilBuffer = mode->stencilBits > 0;
-
- /* no accum */
-
- mode->level = GET_CONFIG_ATTRIB(config, EGL_LEVEL);
- mode->samples = GET_CONFIG_ATTRIB(config, EGL_SAMPLES);
- mode->sampleBuffers = GET_CONFIG_ATTRIB(config, EGL_SAMPLE_BUFFERS);
-
- /* surface type - not really needed */
- mode->visualType = GLX_TRUE_COLOR;
- mode->renderType = GLX_RGBA_BIT;
-}
-
-
-/**
- * Convert a __GLcontextModes object to an _EGLConfig.
- */
-EGLBoolean
-_eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
- EGLint conformant, EGLint renderable_type)
-{
- EGLint config_caveat, surface_type;
-
- /* must be RGBA */
- if (!m->rgbMode || !(m->renderType & GLX_RGBA_BIT))
- return EGL_FALSE;
-
- config_caveat = EGL_NONE;
- if (m->visualRating == GLX_SLOW_CONFIG)
- config_caveat = EGL_SLOW_CONFIG;
-
- if (m->visualRating == GLX_NON_CONFORMANT_CONFIG)
- conformant &= ~EGL_OPENGL_BIT;
- if (!(conformant & EGL_OPENGL_ES_BIT))
- config_caveat = EGL_NON_CONFORMANT_CONFIG;
-
- surface_type = 0;
- if (m->drawableType & GLX_WINDOW_BIT)
- surface_type |= EGL_WINDOW_BIT;
- if (m->drawableType & GLX_PIXMAP_BIT)
- surface_type |= EGL_PIXMAP_BIT;
- if (m->drawableType & GLX_PBUFFER_BIT)
- surface_type |= EGL_PBUFFER_BIT;
-
- SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, m->rgbBits);
- SET_CONFIG_ATTRIB(conf, EGL_RED_SIZE, m->redBits);
- SET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE, m->greenBits);
- SET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE, m->blueBits);
- SET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE, m->alphaBits);
-
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, m->bindToTextureRgb);
- SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, m->bindToTextureRgba);
- SET_CONFIG_ATTRIB(conf, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
- SET_CONFIG_ATTRIB(conf, EGL_CONFIG_CAVEAT, config_caveat);
-
- SET_CONFIG_ATTRIB(conf, EGL_CONFORMANT, conformant);
- SET_CONFIG_ATTRIB(conf, EGL_DEPTH_SIZE, m->depthBits);
- SET_CONFIG_ATTRIB(conf, EGL_LEVEL, m->level);
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_WIDTH, m->maxPbufferWidth);
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_HEIGHT, m->maxPbufferHeight);
- SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_PIXELS, m->maxPbufferPixels);
-
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, m->xRenderable);
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, m->visualID);
-
- if (m->visualType != GLX_NONE)
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType);
- else
- SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE);
-
- SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, renderable_type);
- SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, m->sampleBuffers);
- SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, m->samples);
- SET_CONFIG_ATTRIB(conf, EGL_STENCIL_SIZE, m->stencilBits);
-
- SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type);
-
- /* what to do with GLX_TRANSPARENT_INDEX? */
- if (m->transparentPixel == GLX_TRANSPARENT_RGB) {
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RGB);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE, m->transparentRed);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE, m->transparentGreen);
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE, m->transparentBlue);
- }
- else {
- SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_NONE);
- }
-
- return EGL_TRUE;
-}
diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h
deleted file mode 100644
index c6f4819960..0000000000
--- a/src/egl/main/eglconfigutil.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef EGLCONFIGUTIL_INCLUDED
-#define EGLCONFIGUTIL_INCLUDED
-
-
-#include "GL/gl.h"
-#include "GL/internal/glcore.h"
-#include "eglconfig.h"
-
-
-PUBLIC void
-_eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode);
-
-
-PUBLIC EGLBoolean
-_eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m,
- EGLint conformant, EGLint renderable_type);
-
-
-#endif /* EGLCONFIGUTIL_INCLUDED */
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index e72664c23c..bc22913d40 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -205,70 +205,6 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
/**
- * Bind the context to the surfaces. Return the surfaces that are "orphaned".
- * That is, when the context is not NULL, return the surfaces it previously
- * bound to; when the context is NULL, the same surfaces are returned.
- */
-static void
-_eglBindContextToSurfaces(_EGLContext *newCtx,
- _EGLSurface **draw, _EGLSurface **read)
-{
- _EGLSurface *newDraw = *draw, *newRead = *read;
- _EGLContext *oldCtx;
-
- /*
- * The goal is to bind a newCtx to newDraw. Since newDraw may already have
- * a binding context (oldCtx), and newCtx may already be bound to another
- * surface (oldDraw), the old bindings are broken first and the new one is
- * created.
- */
- if (newDraw) {
- oldCtx = newDraw->CurrentContext;
- if (newCtx != oldCtx) {
- if (oldCtx) {
- assert(oldCtx->DrawSurface == newDraw);
- oldCtx->DrawSurface = NULL;
- }
-
- newDraw->CurrentContext = newCtx;
- }
- }
-
- if (newCtx) {
- _EGLSurface *oldDraw = newCtx->DrawSurface;
- if (oldDraw)
- oldDraw->CurrentContext = NULL;
-
- newCtx->DrawSurface = newDraw;
- *draw = oldDraw;
- }
-
- /* likewise */
- if (newRead && newRead != newDraw) {
- oldCtx = newRead->CurrentContext;
- if (newCtx != oldCtx) {
- if (oldCtx) {
- assert(oldCtx->ReadSurface == newRead);
- oldCtx->ReadSurface = NULL;
- }
-
- newRead->CurrentContext = newCtx;
- }
- }
-
- if (newCtx) {
- _EGLSurface *oldRead = newCtx->ReadSurface;
- if (oldRead)
- oldRead->CurrentContext = NULL;
-
- newCtx->ReadSurface = newRead;
- *read = oldRead;
- }
-
-}
-
-
-/**
* Bind the context to the thread and return the previous context.
*
* Note that the context may be NULL.
@@ -387,36 +323,54 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read)
/**
* Bind the context to the current thread and given surfaces. Return the
- * previously bound context and the surfaces it bound to. Each argument is
- * both input and output.
+ * "orphaned" context and surfaces. Each argument is both input and output.
*/
EGLBoolean
_eglBindContext(_EGLContext **ctx, _EGLSurface **draw, _EGLSurface **read)
{
_EGLThreadInfo *t = _eglGetCurrentThread();
_EGLContext *newCtx = *ctx, *oldCtx;
+ _EGLSurface *newDraw = *draw, *newRead = *read;
- if (!_eglCheckMakeCurrent(newCtx, *draw, *read))
+ if (!_eglCheckMakeCurrent(newCtx, newDraw, newRead))
return EGL_FALSE;
/* bind the new context */
oldCtx = _eglBindContextToThread(newCtx, t);
- if (newCtx)
- _eglBindContextToSurfaces(newCtx, draw, read);
-
- /* unbind the old context from its binding surfaces */
- if (oldCtx && oldCtx != newCtx) {
- assert(!*draw && !*read);
-
+ /* break old bindings */
+ if (oldCtx) {
+ *ctx = oldCtx;
*draw = oldCtx->DrawSurface;
*read = oldCtx->ReadSurface;
- _eglBindContextToSurfaces(NULL, draw, read);
+ if (*draw)
+ (*draw)->CurrentContext = NULL;
+ if (*read)
+ (*read)->CurrentContext = NULL;
+
+ oldCtx->DrawSurface = NULL;
+ oldCtx->ReadSurface = NULL;
+ }
+
+ /* establish new bindings */
+ if (newCtx) {
+ if (newDraw)
+ newDraw->CurrentContext = newCtx;
+ if (newRead)
+ newRead->CurrentContext = newCtx;
+
+ newCtx->DrawSurface = newDraw;
+ newCtx->ReadSurface = newRead;
}
- *ctx = oldCtx;
- /* draw and read have been updated in _eglBindContextToSurfaces */
+ /* an old context or surface is not orphaned if it is still bound */
+ if (*ctx == newCtx)
+ *ctx = NULL;
+ if (*draw == newDraw || *draw == newRead)
+ *draw = NULL;
+ if (*read == newDraw || *read == newRead)
+ *read = NULL;
return EGL_TRUE;
}
diff --git a/src/egl/main/eglmode.c b/src/egl/main/eglmode.c
index 37594cdb42..ed107d5d7a 100644
--- a/src/egl/main/eglmode.c
+++ b/src/egl/main/eglmode.c
@@ -25,7 +25,7 @@ _eglLookupMode(EGLModeMESA mode, _EGLDisplay *disp)
{
EGLint scrnum;
- if (!disp->Screens)
+ if (!disp || !disp->Screens)
return NULL;
/* loop over all screens on the display */
diff --git a/src/egl/main/eglscreen.c b/src/egl/main/eglscreen.c
index 8b8966f3ff..9e39335cc7 100644
--- a/src/egl/main/eglscreen.c
+++ b/src/egl/main/eglscreen.c
@@ -69,7 +69,7 @@ _eglLookupScreen(EGLScreenMESA screen, _EGLDisplay *display)
{
EGLint i;
- if (!display->Screens)
+ if (!display || !display->Screens)
return NULL;
for (i = 0; i < display->Screens->Size; i++) {
diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile
index eb86d83d2a..5388f4ecd5 100644
--- a/src/gallium/auxiliary/Makefile
+++ b/src/gallium/auxiliary/Makefile
@@ -171,6 +171,7 @@ GALLIVM_SOURCES = \
gallivm/lp_bld_sample_soa.c \
gallivm/lp_bld_struct.c \
gallivm/lp_bld_swizzle.c \
+ gallivm/lp_bld_tgsi_aos.c \
gallivm/lp_bld_tgsi_soa.c \
gallivm/lp_bld_type.c \
draw/draw_llvm.c \
diff --git a/src/gallium/auxiliary/SConscript b/src/gallium/auxiliary/SConscript
index 6210ada990..ba8be2efd1 100644
--- a/src/gallium/auxiliary/SConscript
+++ b/src/gallium/auxiliary/SConscript
@@ -222,6 +222,7 @@ if env['llvm']:
'gallivm/lp_bld_sample_soa.c',
'gallivm/lp_bld_struct.c',
'gallivm/lp_bld_swizzle.c',
+ 'gallivm/lp_bld_tgsi_aos.c',
'gallivm/lp_bld_tgsi_soa.c',
'gallivm/lp_bld_type.c',
'draw/draw_llvm.c',
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index 4c780e4dcb..4f0d30123a 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -39,6 +39,7 @@
#include "pipe/p_state.h"
+#include "tgsi/tgsi_exec.h"
struct pipe_context;
struct draw_context;
@@ -225,4 +226,16 @@ boolean draw_need_pipeline(const struct draw_context *draw,
const struct pipe_rasterizer_state *rasterizer,
unsigned prim );
+static INLINE int
+draw_get_shader_param(unsigned shader, enum pipe_cap param)
+{
+ switch(shader) {
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_GEOMETRY:
+ return tgsi_exec_get_shader_param(param);
+ default:
+ return 0;
+ }
+}
+
#endif /* DRAW_CONTEXT_H */
diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index c0135f5bb7..eac21110be 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -373,8 +373,7 @@ generate_aaline_fs(struct aaline_stage *aaline)
aaline->fs->sampler_unit = transform.freeSampler;
- aaline->fs->aaline_fs
- = aaline->driver_create_fs_state(pipe, &aaline_fs);
+ aaline->fs->aaline_fs = aaline->driver_create_fs_state(pipe, &aaline_fs);
if (aaline->fs->aaline_fs == NULL)
goto fail;
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.h b/src/gallium/auxiliary/draw/draw_vs_aos.h
index 1911242f82..68e8295b5e 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.h
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.h
@@ -32,6 +32,8 @@
#define DRAW_VS_AOS_H
#include "pipe/p_config.h"
+#include "tgsi/tgsi_exec.h"
+#include "draw_vs.h"
#ifdef PIPE_ARCH_X86
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index e0d30be98d..dce3c3745b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -56,6 +56,7 @@
#include "lp_bld_intr.h"
#include "lp_bld_logic.h"
#include "lp_bld_pack.h"
+#include "lp_bld_debug.h"
#include "lp_bld_arit.h"
@@ -1850,9 +1851,11 @@ lp_build_pow(struct lp_build_context *bld,
LLVMValueRef y)
{
/* TODO: optimize the constant case */
- if(LLVMIsConstant(x) && LLVMIsConstant(y))
+ if (gallivm_debug & GALLIVM_DEBUG_PERF &&
+ LLVMIsConstant(x) && LLVMIsConstant(y)) {
debug_printf("%s: inefficient/imprecise constant arithmetic\n",
__FUNCTION__);
+ }
return lp_build_exp2(bld, lp_build_mul(bld, lp_build_log2(bld, x), y));
}
@@ -1907,9 +1910,11 @@ lp_build_polynomial(struct lp_build_context *bld,
assert(lp_check_value(bld->type, x));
/* TODO: optimize the constant case */
- if(LLVMIsConstant(x))
+ if (gallivm_debug & GALLIVM_DEBUG_PERF &&
+ LLVMIsConstant(x)) {
debug_printf("%s: inefficient/imprecise constant arithmetic\n",
__FUNCTION__);
+ }
for (i = num_coeffs; i--; ) {
LLVMValueRef coeff;
@@ -1981,9 +1986,11 @@ lp_build_exp2_approx(struct lp_build_context *bld,
if(p_exp2_int_part || p_frac_part || p_exp2) {
/* TODO: optimize the constant case */
- if(LLVMIsConstant(x))
+ if (gallivm_debug & GALLIVM_DEBUG_PERF &&
+ LLVMIsConstant(x)) {
debug_printf("%s: inefficient/imprecise constant arithmetic\n",
__FUNCTION__);
+ }
assert(type.floating && type.width == 32);
@@ -2096,9 +2103,11 @@ lp_build_log2_approx(struct lp_build_context *bld,
if(p_exp || p_floor_log2 || p_log2) {
/* TODO: optimize the constant case */
- if(LLVMIsConstant(x))
+ if (gallivm_debug & GALLIVM_DEBUG_PERF &&
+ LLVMIsConstant(x)) {
debug_printf("%s: inefficient/imprecise constant arithmetic\n",
__FUNCTION__);
+ }
assert(type.floating && type.width == 32);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.c b/src/gallium/auxiliary/gallivm/lp_bld_const.c
index e42ff31ac7..dd839c0bea 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.c
@@ -382,9 +382,12 @@ lp_build_const_aos(struct lp_type type,
}
+/**
+ * @param mask TGSI_WRITEMASK_xxx
+ */
LLVMValueRef
lp_build_const_mask_aos(struct lp_type type,
- const boolean cond[4])
+ unsigned mask)
{
LLVMTypeRef elem_type = LLVMIntType(type.width);
LLVMValueRef masks[LP_MAX_VECTOR_LENGTH];
@@ -392,9 +395,13 @@ lp_build_const_mask_aos(struct lp_type type,
assert(type.length <= LP_MAX_VECTOR_LENGTH);
- for(j = 0; j < type.length; j += 4)
- for(i = 0; i < 4; ++i)
- masks[j + i] = LLVMConstInt(elem_type, cond[i] ? ~0 : 0, 0);
+ for (j = 0; j < type.length; j += 4) {
+ for( i = 0; i < 4; ++i) {
+ masks[j + i] = LLVMConstInt(elem_type,
+ mask & (1 << i) ? ~0ULL : 0,
+ 1);
+ }
+ }
return LLVMConstVector(masks, type.length);
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_const.h b/src/gallium/auxiliary/gallivm/lp_bld_const.h
index 7ee8fff140..6b1fc590c1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_const.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_const.h
@@ -104,7 +104,7 @@ lp_build_const_aos(struct lp_type type,
LLVMValueRef
lp_build_const_mask_aos(struct lp_type type,
- const boolean cond[4]);
+ unsigned mask);
static INLINE LLVMValueRef
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.h b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
index 858002b34f..369c1bbf09 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_debug.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.h
@@ -40,6 +40,7 @@
#define GALLIVM_DEBUG_IR 0x2
#define GALLIVM_DEBUG_ASM 0x4
#define GALLIVM_DEBUG_NO_OPT 0x8
+#define GALLIVM_DEBUG_PERF 0x10
#ifdef DEBUG
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
index 92123e09d3..6b9189e1da 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_aos.c
@@ -46,6 +46,7 @@
#include "lp_bld_conv.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_gather.h"
+#include "lp_bld_debug.h"
#include "lp_bld_format.h"
@@ -449,6 +450,11 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
* integer conversions.
*/
+ if (gallivm_debug & GALLIVM_DEBUG_PERF && !type.floating) {
+ debug_printf("%s: unpacking %s with floating point\n",
+ __FUNCTION__, format_desc->short_name);
+ }
+
lp_build_conv(builder,
lp_float32_vec4_type(),
type,
@@ -513,6 +519,10 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_8unorm",
format_desc->short_name);
+ if (gallivm_debug & GALLIVM_DEBUG_PERF) {
+ debug_printf("%s: falling back to %s\n", __FUNCTION__, name);
+ }
+
/*
* Declare and bind format_desc->fetch_rgba_8unorm().
*/
@@ -612,6 +622,10 @@ lp_build_fetch_rgba_aos(LLVMBuilderRef builder,
util_snprintf(name, sizeof name, "util_format_%s_fetch_rgba_float",
format_desc->short_name);
+ if (gallivm_debug & GALLIVM_DEBUG_PERF) {
+ debug_printf("%s: falling back to %s\n", __FUNCTION__, name);
+ }
+
/*
* Declare and bind format_desc->fetch_rgba_float().
*/
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
index c724a4453e..ce7e54afc7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_format_soa.c
@@ -37,6 +37,7 @@
#include "lp_bld_conv.h"
#include "lp_bld_swizzle.h"
#include "lp_bld_gather.h"
+#include "lp_bld_debug.h"
#include "lp_bld_format.h"
@@ -387,6 +388,11 @@ lp_build_fetch_rgba_soa(LLVMBuilderRef builder,
unsigned k, chan;
struct lp_type tmp_type;
+ if (gallivm_debug & GALLIVM_DEBUG_PERF) {
+ debug_printf("%s: scalar unpacking of %s\n",
+ __FUNCTION__, format_desc->short_name);
+ }
+
tmp_type = type;
tmp_type.length = 4;
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 60d8bcfa55..761f33b578 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -43,6 +43,7 @@ static const struct debug_named_value lp_bld_debug_flags[] = {
{ "ir", GALLIVM_DEBUG_IR, NULL },
{ "asm", GALLIVM_DEBUG_ASM, NULL },
{ "nopt", GALLIVM_DEBUG_NO_OPT, NULL },
+ { "perf", GALLIVM_DEBUG_PERF, NULL },
DEBUG_NAMED_VALUE_END
};
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
index 7d7db3b0d9..a959bd4ad4 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
@@ -40,6 +40,7 @@
#include "lp_bld_type.h"
#include "lp_bld_const.h"
#include "lp_bld_intr.h"
+#include "lp_bld_debug.h"
#include "lp_bld_logic.h"
@@ -325,8 +326,10 @@ lp_build_compare(LLVMBuilderRef builder,
res = LLVMGetUndef(int_vec_type);
- debug_printf("%s: warning: using slow element-wise int"
- " vector comparison\n", __FUNCTION__);
+ if (gallivm_debug & GALLIVM_DEBUG_PERF) {
+ debug_printf("%s: using slow element-wise int"
+ " vector comparison\n", __FUNCTION__);
+ }
for(i = 0; i < type.length; ++i) {
LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0);
@@ -482,24 +485,30 @@ lp_build_select(struct lp_build_context *bld,
}
+/**
+ * Return mask ? a : b;
+ *
+ * mask is a TGSI_WRITEMASK_xxx.
+ */
LLVMValueRef
lp_build_select_aos(struct lp_build_context *bld,
+ unsigned mask,
LLVMValueRef a,
- LLVMValueRef b,
- const boolean cond[4])
+ LLVMValueRef b)
{
const struct lp_type type = bld->type;
const unsigned n = type.length;
unsigned i, j;
+ assert((mask & ~0xf) == 0);
assert(lp_check_value(type, a));
assert(lp_check_value(type, b));
if(a == b)
return a;
- if(cond[0] && cond[1] && cond[2] && cond[3])
+ if((mask & 0xf) == 0xf)
return a;
- if(!cond[0] && !cond[1] && !cond[2] && !cond[3])
+ if((mask & 0xf) == 0x0)
return b;
if(a == bld->undef || b == bld->undef)
return bld->undef;
@@ -522,7 +531,9 @@ lp_build_select_aos(struct lp_build_context *bld,
for(j = 0; j < n; j += 4)
for(i = 0; i < 4; ++i)
- shuffles[j + i] = LLVMConstInt(elem_type, (cond[i] ? 0 : n) + j + i, 0);
+ shuffles[j + i] = LLVMConstInt(elem_type,
+ (mask & (1 << i) ? 0 : n) + j + i,
+ 0);
return LLVMBuildShuffleVector(bld->builder, a, b, LLVMConstVector(shuffles, n), "");
}
@@ -531,16 +542,17 @@ lp_build_select_aos(struct lp_build_context *bld,
/* XXX: Unfortunately select of vectors do not work */
/* Use a select */
LLVMTypeRef elem_type = LLVMInt1Type();
- LLVMValueRef cond[LP_MAX_VECTOR_LENGTH];
+ LLVMValueRef cond_vec[LP_MAX_VECTOR_LENGTH];
for(j = 0; j < n; j += 4)
for(i = 0; i < 4; ++i)
- cond[j + i] = LLVMConstInt(elem_type, cond[i] ? 1 : 0, 0);
+ cond_vec[j + i] = LLVMConstInt(elem_type,
+ mask & (1 << i) ? 1 : 0, 0);
- return LLVMBuildSelect(bld->builder, LLVMConstVector(cond, n), a, b, "");
+ return LLVMBuildSelect(bld->builder, LLVMConstVector(cond_vec, n), a, b, "");
#else
- LLVMValueRef mask = lp_build_const_mask_aos(type, cond);
- return lp_build_select(bld, mask, a, b);
+ LLVMValueRef mask_vec = lp_build_const_mask_aos(type, mask);
+ return lp_build_select(bld, mask_vec, a, b);
#endif
}
}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.h b/src/gallium/auxiliary/gallivm/lp_bld_logic.h
index 4e7b4c9938..111daad971 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_logic.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.h
@@ -77,9 +77,9 @@ lp_build_select(struct lp_build_context *bld,
LLVMValueRef
lp_build_select_aos(struct lp_build_context *bld,
+ unsigned mask,
LLVMValueRef a,
- LLVMValueRef b,
- const boolean cond[4]);
+ LLVMValueRef b);
LLVMValueRef
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_pack.c b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
index b7b630f2e8..f7eb7148ab 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_pack.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_pack.c
@@ -111,8 +111,6 @@ lp_build_const_pack_shuffle(unsigned n)
assert(n <= LP_MAX_VECTOR_LENGTH);
- /* TODO: cache results in a static table */
-
for(i = 0; i < n; ++i)
elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
index 1f39d9c98b..baf0402f56 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c
@@ -2190,9 +2190,8 @@ lp_build_sample_soa(LLVMBuilderRef builder,
lp_build_sample_nop(&bld, texel_out);
}
else if (util_format_fits_8unorm(bld.format_desc) &&
- bld.format_desc->nr_channels > 1 &&
(static_state->target == PIPE_TEXTURE_2D ||
- static_state->target == PIPE_TEXTURE_RECT) &&
+ static_state->target == PIPE_TEXTURE_RECT) &&
static_state->min_img_filter == PIPE_TEX_FILTER_LINEAR &&
static_state->mag_img_filter == PIPE_TEX_FILTER_LINEAR &&
static_state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE &&
@@ -2203,6 +2202,15 @@ lp_build_sample_soa(LLVMBuilderRef builder,
row_stride_array, data_array, texel_out);
}
else {
+ if (gallivm_debug & GALLIVM_DEBUG_PERF &&
+ (static_state->min_img_filter != PIPE_TEX_FILTER_NEAREST ||
+ static_state->mag_img_filter != PIPE_TEX_FILTER_NEAREST ||
+ static_state->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) &&
+ util_format_fits_8unorm(bld.format_desc)) {
+ debug_printf("%s: using floating point linear filtering for %s\n",
+ __FUNCTION__, bld.format_desc->short_name);
+ }
+
lp_build_sample_general(&bld, unit, s, t, r, ddx, ddy,
lod_bias, explicit_lod,
width, height, depth,
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.c b/src/gallium/auxiliary/gallivm/lp_bld_struct.c
index 3998ac374f..4693c2de6f 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_struct.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.c
@@ -49,6 +49,8 @@ lp_build_struct_get_ptr(LLVMBuilderRef builder,
{
LLVMValueRef indices[2];
LLVMValueRef member_ptr;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind);
indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
indices[1] = LLVMConstInt(LLVMInt32Type(), member, 0);
member_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
@@ -65,8 +67,91 @@ lp_build_struct_get(LLVMBuilderRef builder,
{
LLVMValueRef member_ptr;
LLVMValueRef res;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMStructTypeKind);
member_ptr = lp_build_struct_get_ptr(builder, ptr, member, name);
res = LLVMBuildLoad(builder, member_ptr, "");
lp_build_name(res, "%s.%s", LLVMGetValueName(ptr), name);
return res;
}
+
+
+LLVMValueRef
+lp_build_array_get_ptr(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index)
+{
+ LLVMValueRef indices[2];
+ LLVMValueRef element_ptr;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
+ indices[0] = LLVMConstInt(LLVMInt32Type(), 0, 0);
+ indices[1] = index;
+ element_ptr = LLVMBuildGEP(builder, ptr, indices, Elements(indices), "");
+#ifdef DEBUG
+ lp_build_name(element_ptr, "&%s[%s]",
+ LLVMGetValueName(ptr), LLVMGetValueName(index));
+#endif
+ return element_ptr;
+}
+
+
+LLVMValueRef
+lp_build_array_get(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index)
+{
+ LLVMValueRef element_ptr;
+ LLVMValueRef res;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
+ element_ptr = lp_build_array_get_ptr(builder, ptr, index);
+ res = LLVMBuildLoad(builder, element_ptr, "");
+#ifdef DEBUG
+ lp_build_name(res, "%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index));
+#endif
+ return res;
+}
+
+
+void
+lp_build_array_set(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index,
+ LLVMValueRef value)
+{
+ LLVMValueRef element_ptr;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ assert(LLVMGetTypeKind(LLVMGetElementType(LLVMTypeOf(ptr))) == LLVMArrayTypeKind);
+ element_ptr = lp_build_array_get_ptr(builder, ptr, index);
+ LLVMBuildStore(builder, value, element_ptr);
+}
+
+
+LLVMValueRef
+lp_build_pointer_get(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index)
+{
+ LLVMValueRef element_ptr;
+ LLVMValueRef res;
+ assert(LLVMGetTypeKind(LLVMTypeOf(ptr)) == LLVMPointerTypeKind);
+ element_ptr = LLVMBuildGEP(builder, ptr, &index, 1, "");
+ res = LLVMBuildLoad(builder, element_ptr, "");
+#ifdef DEBUG
+ lp_build_name(res, "%s[%s]", LLVMGetValueName(ptr), LLVMGetValueName(index));
+#endif
+ return res;
+}
+
+
+void
+lp_build_pointer_set(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index,
+ LLVMValueRef value)
+{
+ LLVMValueRef element_ptr;
+ element_ptr = LLVMBuildGEP(builder, ptr, &index, 1, "");
+ LLVMBuildStore(builder, value, element_ptr);
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_struct.h b/src/gallium/auxiliary/gallivm/lp_bld_struct.h
index 147336edb4..eb87a8eee9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_struct.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_struct.h
@@ -71,5 +71,46 @@ lp_build_struct_get(LLVMBuilderRef builder,
unsigned member,
const char *name);
+/**
+ * Get value pointer to an array element.
+ */
+LLVMValueRef
+lp_build_array_get_ptr(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index);
+
+/**
+ * Get the value of an array element.
+ */
+LLVMValueRef
+lp_build_array_get(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index);
+
+/**
+ * Set the value of an array element.
+ */
+void
+lp_build_array_set(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index,
+ LLVMValueRef value);
+
+/**
+ * Get the value of an array element.
+ */
+LLVMValueRef
+lp_build_pointer_get(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index);
+
+/**
+ * Set the value of an array element.
+ */
+void
+lp_build_pointer_set(LLVMBuilderRef builder,
+ LLVMValueRef ptr,
+ LLVMValueRef index,
+ LLVMValueRef value);
#endif /* !LP_BLD_STRUCT_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
index 20cf96ca66..d4d2f2b307 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.c
@@ -95,10 +95,13 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
}
+/**
+ * Swizzle one channel into all other three channels.
+ */
LLVMValueRef
-lp_build_broadcast_aos(struct lp_build_context *bld,
- LLVMValueRef a,
- unsigned channel)
+lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
+ LLVMValueRef a,
+ unsigned channel)
{
const struct lp_type type = bld->type;
const unsigned n = type.length;
@@ -139,13 +142,10 @@ lp_build_broadcast_aos(struct lp_build_context *bld,
{ 1, -2},
{-1, -2}
};
- boolean cond[4];
unsigned i;
- memset(cond, 0, sizeof cond);
- cond[channel] = 1;
-
- a = LLVMBuildAnd(bld->builder, a, lp_build_const_mask_aos(type, cond), "");
+ a = LLVMBuildAnd(bld->builder, a,
+ lp_build_const_mask_aos(type, 1 << channel), "");
/*
* Build a type where each element is an integer that cover the four
@@ -206,7 +206,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
case PIPE_SWIZZLE_GREEN:
case PIPE_SWIZZLE_BLUE:
case PIPE_SWIZZLE_ALPHA:
- return lp_build_broadcast_aos(bld, a, swizzles[0]);
+ return lp_build_swizzle_scalar_aos(bld, a, swizzles[0]);
case PIPE_SWIZZLE_ZERO:
return bld->zero;
case PIPE_SWIZZLE_ONE:
@@ -282,7 +282,7 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
*/
LLVMValueRef res;
struct lp_type type4;
- boolean cond[4];
+ unsigned cond = 0;
unsigned chan;
int shift;
@@ -290,9 +290,11 @@ lp_build_swizzle_aos(struct lp_build_context *bld,
* Start with a mixture of 1 and 0.
*/
for (chan = 0; chan < 4; ++chan) {
- cond[chan] = swizzles[chan] == PIPE_SWIZZLE_ONE ? TRUE : FALSE;
+ if (swizzles[chan] == PIPE_SWIZZLE_ONE) {
+ cond |= 1 << chan;
+ }
}
- res = lp_build_select_aos(bld, bld->one, bld->zero, cond);
+ res = lp_build_select_aos(bld, cond, bld->one, bld->zero);
/*
* Build a type where each element is an integer that cover the four
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
index 315e1bcb54..f9b6a5e725 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_swizzle.h
@@ -60,7 +60,7 @@ lp_build_broadcast_scalar(struct lp_build_context *bld,
* all four channel.
*/
LLVMValueRef
-lp_build_broadcast_aos(struct lp_build_context *bld,
+lp_build_swizzle_scalar_aos(struct lp_build_context *bld,
LLVMValueRef a,
unsigned channel);
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
index 4d415b6d41..97318b3456 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.h
@@ -45,6 +45,15 @@ struct lp_build_context;
struct lp_build_mask_context;
+enum lp_build_tex_modifier {
+ LP_BLD_TEX_MODIFIER_NONE = 0,
+ LP_BLD_TEX_MODIFIER_PROJECTED,
+ LP_BLD_TEX_MODIFIER_LOD_BIAS,
+ LP_BLD_TEX_MODIFIER_EXPLICIT_LOD,
+ LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV
+};
+
+
/**
* Sampler code generation interface.
*
@@ -73,6 +82,20 @@ struct lp_build_sampler_soa
};
+struct lp_build_sampler_aos
+{
+ LLVMValueRef
+ (*emit_fetch_texel)( struct lp_build_sampler_aos *sampler,
+ struct lp_build_context *bld,
+ unsigned target, /* TGSI_TEXTURE_* */
+ unsigned unit,
+ LLVMValueRef coords,
+ LLVMValueRef ddx,
+ LLVMValueRef ddy,
+ enum lp_build_tex_modifier modifier);
+};
+
+
void
lp_build_tgsi_soa(LLVMBuilderRef builder,
const struct tgsi_token *tokens,
@@ -86,4 +109,16 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
const struct tgsi_shader_info *info);
+void
+lp_build_tgsi_aos(LLVMBuilderRef builder,
+ const struct tgsi_token *tokens,
+ struct lp_type type,
+ const unsigned char swizzles[4],
+ LLVMValueRef consts_ptr,
+ const LLVMValueRef *inputs,
+ LLVMValueRef *outputs,
+ struct lp_build_sampler_aos *sampler,
+ const struct tgsi_shader_info *info);
+
+
#endif /* LP_BLD_TGSI_H */
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
new file mode 100644
index 0000000000..d5f963be58
--- /dev/null
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c
@@ -0,0 +1,1176 @@
+/**************************************************************************
+ *
+ * Copyright 2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+/**
+ * @file
+ * TGSI to LLVM IR translation -- AoS.
+ *
+ * FIXME:
+ * - No control flow support: the existing control flow code should be factored
+ * out into from the SoA code into a common module and shared.
+ * - No derivatives. Derivate logic should be pluggable, just like the samplers.
+ *
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "pipe/p_config.h"
+#include "pipe/p_shader_tokens.h"
+#include "util/u_debug.h"
+#include "util/u_math.h"
+#include "util/u_memory.h"
+#include "tgsi/tgsi_dump.h"
+#include "tgsi/tgsi_info.h"
+#include "tgsi/tgsi_parse.h"
+#include "tgsi/tgsi_util.h"
+#include "tgsi/tgsi_scan.h"
+#include "lp_bld_type.h"
+#include "lp_bld_const.h"
+#include "lp_bld_arit.h"
+#include "lp_bld_logic.h"
+#include "lp_bld_swizzle.h"
+#include "lp_bld_flow.h"
+#include "lp_bld_quad.h"
+#include "lp_bld_tgsi.h"
+#include "lp_bld_limits.h"
+#include "lp_bld_debug.h"
+
+
+#define LP_MAX_INSTRUCTIONS 256
+
+
+struct lp_build_tgsi_aos_context
+{
+ struct lp_build_context base;
+
+ /* Builder for integer masks and indices */
+ struct lp_build_context int_bld;
+
+ /*
+ * AoS swizzle used:
+ * - swizzles[0] = red index
+ * - swizzles[1] = green index
+ * - swizzles[2] = blue index
+ * - swizzles[3] = alpha index
+ */
+ unsigned char swizzles[4];
+ unsigned char inv_swizzles[4];
+
+ LLVMValueRef consts_ptr;
+ const LLVMValueRef *inputs;
+ LLVMValueRef *outputs;
+
+ struct lp_build_sampler_aos *sampler;
+
+ LLVMValueRef immediates[LP_MAX_TGSI_IMMEDIATES];
+ LLVMValueRef temps[LP_MAX_TGSI_TEMPS];
+ LLVMValueRef addr[LP_MAX_TGSI_ADDRS];
+ LLVMValueRef preds[LP_MAX_TGSI_PREDS];
+
+ /* We allocate/use this array of temps if (1 << TGSI_FILE_TEMPORARY) is
+ * set in the indirect_files field.
+ * The temps[] array above is unused then.
+ */
+ LLVMValueRef temps_array;
+
+ /** bitmask indicating which register files are accessed indirectly */
+ unsigned indirect_files;
+
+ struct tgsi_full_instruction *instructions;
+ uint max_instructions;
+};
+
+
+/**
+ * Wrapper around lp_build_swizzle_aos which translates swizzles to another
+ * ordering.
+ */
+static LLVMValueRef
+swizzle_aos(struct lp_build_tgsi_aos_context *bld,
+ LLVMValueRef a,
+ unsigned swizzle_x,
+ unsigned swizzle_y,
+ unsigned swizzle_z,
+ unsigned swizzle_w)
+{
+ unsigned char swizzles[4];
+
+ assert(swizzle_x < 4);
+ assert(swizzle_y < 4);
+ assert(swizzle_z < 4);
+ assert(swizzle_w < 4);
+
+ swizzles[bld->inv_swizzles[0]] = bld->swizzles[swizzle_x];
+ swizzles[bld->inv_swizzles[1]] = bld->swizzles[swizzle_y];
+ swizzles[bld->inv_swizzles[2]] = bld->swizzles[swizzle_z];
+ swizzles[bld->inv_swizzles[3]] = bld->swizzles[swizzle_w];
+
+ return lp_build_swizzle_aos(&bld->base, a, swizzles);
+}
+
+
+static LLVMValueRef
+swizzle_scalar_aos(struct lp_build_tgsi_aos_context *bld,
+ LLVMValueRef a,
+ unsigned chan)
+{
+ chan = bld->swizzles[chan];
+ return lp_build_swizzle_scalar_aos(&bld->base, a, chan);
+}
+
+
+/**
+ * Register fetch.
+ */
+static LLVMValueRef
+emit_fetch(
+ struct lp_build_tgsi_aos_context *bld,
+ const struct tgsi_full_instruction *inst,
+ unsigned src_op)
+{
+ struct lp_type type = bld->base.type;
+ const struct tgsi_full_src_register *reg = &inst->Src[src_op];
+ LLVMValueRef res;
+ unsigned chan;
+
+ assert(!reg->Register.Indirect);
+
+ /*
+ * Fetch the from the register file.
+ */
+
+ switch (reg->Register.File) {
+ case TGSI_FILE_CONSTANT:
+ /*
+ * Get the constants components
+ */
+
+ res = bld->base.undef;
+ for (chan = 0; chan < 4; ++chan) {
+ LLVMValueRef index;
+ LLVMValueRef scalar_ptr;
+ LLVMValueRef scalar;
+ LLVMValueRef swizzle;
+
+ index = LLVMConstInt(LLVMInt32Type(),
+ reg->Register.Index*4 + chan,
+ 0);
+
+ scalar_ptr = LLVMBuildGEP(bld->base.builder, bld->consts_ptr,
+ &index, 1, "");
+
+ scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, "");
+
+ lp_build_name(scalar, "const[%u].%c", reg->Register.Index, "xyzw"[chan]);
+
+ /*
+ * NOTE: constants array is always assumed to be RGBA
+ */
+
+ swizzle = LLVMConstInt(LLVMInt32Type(), chan, 0);
+
+ res = LLVMBuildInsertElement(bld->base.builder, res, scalar, swizzle, "");
+ }
+
+ /*
+ * Broadcast the first quaternion to all others.
+ *
+ * XXX: could be factored into a reusable function.
+ */
+
+ if (type.length > 4) {
+ LLVMValueRef shuffles[LP_MAX_VECTOR_LENGTH];
+ unsigned i;
+
+ for (chan = 0; chan < 4; ++chan) {
+ shuffles[chan] = LLVMConstInt(LLVMInt32Type(), chan, 0);
+ }
+
+ for (i = 4; i < type.length; ++i) {
+ shuffles[i] = shuffles[i % 4];
+ }
+
+ res = LLVMBuildShuffleVector(bld->base.builder,
+ res, bld->base.undef,
+ LLVMConstVector(shuffles, type.length),
+ "");
+ }
+ break;
+
+ case TGSI_FILE_IMMEDIATE:
+ res = bld->immediates[reg->Register.Index];
+ assert(res);
+ break;
+
+ case TGSI_FILE_INPUT:
+ res = bld->inputs[reg->Register.Index];
+ assert(res);
+ break;
+
+ case TGSI_FILE_TEMPORARY:
+ {
+ LLVMValueRef temp_ptr;
+ temp_ptr = bld->temps[reg->Register.Index];
+ res = LLVMBuildLoad(bld->base.builder, temp_ptr, "");
+ if (!res)
+ return bld->base.undef;
+ }
+ break;
+
+ default:
+ assert(0 && "invalid src register in emit_fetch()");
+ return bld->base.undef;
+ }
+
+ /*
+ * Apply sign modifier.
+ */
+
+ if (reg->Register.Absolute) {
+ res = lp_build_abs(&bld->base, res);
+ }
+
+ if(reg->Register.Negate) {
+ res = lp_build_negate(&bld->base, res);
+ }
+
+ /*
+ * Swizzle the argument
+ */
+
+ res = swizzle_aos(bld, res,
+ reg->Register.SwizzleX,
+ reg->Register.SwizzleY,
+ reg->Register.SwizzleZ,
+ reg->Register.SwizzleW);
+
+ return res;
+}
+
+
+/**
+ * Register store.
+ */
+static void
+emit_store(
+ struct lp_build_tgsi_aos_context *bld,
+ const struct tgsi_full_instruction *inst,
+ unsigned index,
+ LLVMValueRef value)
+{
+ const struct tgsi_full_dst_register *reg = &inst->Dst[index];
+ LLVMValueRef mask = NULL;
+ LLVMValueRef ptr;
+
+ /*
+ * Saturate the value
+ */
+
+ switch (inst->Instruction.Saturate) {
+ case TGSI_SAT_NONE:
+ break;
+
+ case TGSI_SAT_ZERO_ONE:
+ value = lp_build_max(&bld->base, value, bld->base.zero);
+ value = lp_build_min(&bld->base, value, bld->base.one);
+ break;
+
+ case TGSI_SAT_MINUS_PLUS_ONE:
+ value = lp_build_max(&bld->base, value, lp_build_const_vec(bld->base.type, -1.0));
+ value = lp_build_min(&bld->base, value, bld->base.one);
+ break;
+
+ default:
+ assert(0);
+ }
+
+ /*
+ * Translate the register file
+ */
+
+ assert(!reg->Register.Indirect);
+
+ switch (reg->Register.File) {
+ case TGSI_FILE_OUTPUT:
+ ptr = bld->outputs[reg->Register.Index];
+ break;
+
+ case TGSI_FILE_TEMPORARY:
+ ptr = bld->temps[reg->Register.Index];
+ break;
+
+ case TGSI_FILE_ADDRESS:
+ ptr = bld->addr[reg->Indirect.Index];
+ break;
+
+ case TGSI_FILE_PREDICATE:
+ ptr = bld->preds[reg->Register.Index];
+ break;
+
+ default:
+ assert(0);
+ return;
+ }
+
+ /*
+ * Predicate
+ */
+
+ if (inst->Instruction.Predicate) {
+ LLVMValueRef pred;
+
+ assert(inst->Predicate.Index < LP_MAX_TGSI_PREDS);
+
+ pred = LLVMBuildLoad(bld->base.builder,
+ bld->preds[inst->Predicate.Index], "");
+
+ /*
+ * Convert the value to an integer mask.
+ */
+ pred = lp_build_compare(bld->base.builder,
+ bld->base.type,
+ PIPE_FUNC_NOTEQUAL,
+ pred,
+ bld->base.zero);
+
+ if (inst->Predicate.Negate) {
+ pred = LLVMBuildNot(bld->base.builder, pred, "");
+ }
+
+ pred = swizzle_aos(bld, pred,
+ inst->Predicate.SwizzleX,
+ inst->Predicate.SwizzleY,
+ inst->Predicate.SwizzleZ,
+ inst->Predicate.SwizzleW);
+
+ if (mask) {
+ mask = LLVMBuildAnd(bld->base.builder, mask, pred, "");
+ } else {
+ mask = pred;
+ }
+ }
+
+ /*
+ * Writemask
+ */
+
+ if (reg->Register.WriteMask != TGSI_WRITEMASK_XYZW) {
+ LLVMValueRef writemask;
+
+ writemask = lp_build_const_mask_aos(bld->base.type, reg->Register.WriteMask);
+
+ if (mask) {
+ mask = LLVMBuildAnd(bld->base.builder, mask, writemask, "");
+ } else {
+ mask = writemask;
+ }
+ }
+
+ if (mask) {
+ LLVMValueRef orig_value;
+
+ orig_value = LLVMBuildLoad(bld->base.builder, ptr, "");
+ value = lp_build_select(&bld->base,
+ mask, value, orig_value);
+ }
+
+ LLVMBuildStore(bld->base.builder, value, ptr);
+}
+
+
+/**
+ * High-level instruction translators.
+ */
+
+static LLVMValueRef
+emit_tex(struct lp_build_tgsi_aos_context *bld,
+ const struct tgsi_full_instruction *inst,
+ enum lp_build_tex_modifier modifier)
+{
+ unsigned target;
+ unsigned unit;
+ LLVMValueRef coords;
+ LLVMValueRef ddx;
+ LLVMValueRef ddy;
+
+ if (!bld->sampler) {
+ _debug_printf("warning: found texture instruction but no sampler generator supplied\n");
+ return bld->base.undef;
+ }
+
+ target = inst->Texture.Texture;
+
+ coords = emit_fetch( bld, inst, 0 );
+
+ if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
+ ddx = emit_fetch( bld, inst, 1 );
+ ddy = emit_fetch( bld, inst, 2 );
+ unit = inst->Src[3].Register.Index;
+ } else {
+#if 0
+ ddx = lp_build_ddx( &bld->base, coords );
+ ddy = lp_build_ddy( &bld->base, coords );
+#else
+ /* TODO */
+ ddx = bld->base.one;
+ ddy = bld->base.one;
+#endif
+ unit = inst->Src[1].Register.Index;
+ }
+
+ return bld->sampler->emit_fetch_texel(bld->sampler,
+ &bld->base,
+ target, unit,
+ coords, ddx, ddy,
+ modifier);
+}
+
+
+static void
+emit_declaration(
+ struct lp_build_tgsi_aos_context *bld,
+ const struct tgsi_full_declaration *decl)
+{
+ LLVMTypeRef vec_type = lp_build_vec_type(bld->base.type);
+
+ unsigned first = decl->Range.First;
+ unsigned last = decl->Range.Last;
+ unsigned idx;
+
+ for (idx = first; idx <= last; ++idx) {
+ switch (decl->Declaration.File) {
+ case TGSI_FILE_TEMPORARY:
+ assert(idx < LP_MAX_TGSI_TEMPS);
+ if (bld->indirect_files & (1 << TGSI_FILE_TEMPORARY)) {
+ LLVMValueRef array_size = LLVMConstInt(LLVMInt32Type(),
+ last + 1, 0);
+ bld->temps_array = lp_build_array_alloca(bld->base.builder,
+ vec_type, array_size, "");
+ } else {
+ bld->temps[idx] = lp_build_alloca(bld->base.builder,
+ vec_type, "");
+ }
+ break;
+
+ case TGSI_FILE_OUTPUT:
+ bld->outputs[idx] = lp_build_alloca(bld->base.builder,
+ vec_type, "");
+ break;
+
+ case TGSI_FILE_ADDRESS:
+ assert(idx < LP_MAX_TGSI_ADDRS);
+ bld->addr[idx] = lp_build_alloca(bld->base.builder,
+ vec_type, "");
+ break;
+
+ case TGSI_FILE_PREDICATE:
+ assert(idx < LP_MAX_TGSI_PREDS);
+ bld->preds[idx] = lp_build_alloca(bld->base.builder,
+ vec_type, "");
+ break;
+
+ default:
+ /* don't need to declare other vars */
+ break;
+ }
+ }
+}
+
+
+/**
+ * Emit LLVM for one TGSI instruction.
+ * \param return TRUE for success, FALSE otherwise
+ */
+static boolean
+emit_instruction(
+ struct lp_build_tgsi_aos_context *bld,
+ const struct tgsi_full_instruction *inst,
+ const struct tgsi_opcode_info *info,
+ int *pc)
+{
+ LLVMValueRef src0, src1, src2;
+ LLVMValueRef tmp0, tmp1;
+ LLVMValueRef dst0;
+
+ /*
+ * Stores and write masks are handled in a general fashion after the long
+ * instruction opcode switch statement.
+ *
+ * Although not stricitly necessary, we avoid generating instructions for
+ * channels which won't be stored, in cases where's that easy. For some
+ * complex instructions, like texture sampling, it is more convenient to
+ * assume a full writemask and then let LLVM optimization passes eliminate
+ * redundant code.
+ */
+
+ (*pc)++;
+
+ assert(info->num_dst <= 1);
+ if (info->num_dst) {
+ dst0 = bld->base.undef;
+ }
+
+ switch (inst->Instruction.Opcode) {
+ case TGSI_OPCODE_ARL:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_floor(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_MOV:
+ dst0 = emit_fetch(bld, inst, 0);
+ break;
+
+ case TGSI_OPCODE_LIT:
+ return FALSE;
+
+ case TGSI_OPCODE_RCP:
+ /* TGSI_OPCODE_RECIP */
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_rcp(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_RSQ:
+ /* TGSI_OPCODE_RECIPSQRT */
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = lp_build_abs(&bld->base, src0);
+ dst0 = lp_build_rsqrt(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_EXP:
+ return FALSE;
+
+ case TGSI_OPCODE_LOG:
+ return FALSE;
+
+ case TGSI_OPCODE_MUL:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ dst0 = lp_build_mul(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_ADD:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ dst0 = lp_build_add(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_DP3:
+ /* TGSI_OPCODE_DOT3 */
+ return FALSE;
+
+ case TGSI_OPCODE_DP4:
+ /* TGSI_OPCODE_DOT4 */
+ return FALSE;
+
+ case TGSI_OPCODE_DST:
+ return FALSE;
+
+ case TGSI_OPCODE_MIN:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ dst0 = lp_build_max(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_MAX:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ dst0 = lp_build_max(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_SLT:
+ /* TGSI_OPCODE_SETLT */
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_LESS, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_SGE:
+ /* TGSI_OPCODE_SETGE */
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_GEQUAL, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_MAD:
+ /* TGSI_OPCODE_MADD */
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ src2 = emit_fetch(bld, inst, 2);
+ tmp0 = lp_build_mul(&bld->base, src0, src1);
+ dst0 = lp_build_add(&bld->base, tmp0, src2);
+ break;
+
+ case TGSI_OPCODE_SUB:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ dst0 = lp_build_sub(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_LRP:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ src2 = emit_fetch(bld, inst, 2);
+ tmp0 = lp_build_sub(&bld->base, src1, src2);
+ tmp0 = lp_build_mul(&bld->base, src0, tmp0);
+ dst0 = lp_build_add(&bld->base, tmp0, src2);
+ break;
+
+ case TGSI_OPCODE_CND:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ src2 = emit_fetch(bld, inst, 2);
+ tmp1 = lp_build_const_vec(bld->base.type, 0.5);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, src2, tmp1);
+ dst0 = lp_build_select(&bld->base, tmp0, src0, src1);
+ break;
+
+ case TGSI_OPCODE_DP2A:
+ return FALSE;
+
+ case TGSI_OPCODE_FRC:
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = lp_build_floor(&bld->base, src0);
+ dst0 = lp_build_sub(&bld->base, src0, tmp0);
+ break;
+
+ case TGSI_OPCODE_CLAMP:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ src2 = emit_fetch(bld, inst, 2);
+ tmp0 = lp_build_max(&bld->base, src0, src1);
+ dst0 = lp_build_min(&bld->base, tmp0, src2);
+ break;
+
+ case TGSI_OPCODE_FLR:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_floor(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_ROUND:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_round(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_EX2:
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = lp_build_swizzle_scalar_aos(&bld->base, src0, TGSI_SWIZZLE_X);
+ dst0 = lp_build_exp2(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_LG2:
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = swizzle_scalar_aos(bld, src0, TGSI_SWIZZLE_X);
+ dst0 = lp_build_log2(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_POW:
+ src0 = emit_fetch(bld, inst, 0);
+ src0 = swizzle_scalar_aos(bld, src0, TGSI_SWIZZLE_X);
+ src1 = emit_fetch(bld, inst, 1);
+ src1 = swizzle_scalar_aos(bld, src1, TGSI_SWIZZLE_X);
+ dst0 = lp_build_pow(&bld->base, src0, src1);
+ break;
+
+ case TGSI_OPCODE_XPD:
+ return FALSE;
+
+ case TGSI_OPCODE_ABS:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_abs(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_RCC:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+
+ case TGSI_OPCODE_DPH:
+ return FALSE;
+
+ case TGSI_OPCODE_COS:
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = swizzle_scalar_aos(bld, src0, TGSI_SWIZZLE_X);
+ dst0 = lp_build_cos(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_DDX:
+ return FALSE;
+
+ case TGSI_OPCODE_DDY:
+ return FALSE;
+
+ case TGSI_OPCODE_KILP:
+ /* predicated kill */
+ return FALSE;
+
+ case TGSI_OPCODE_KIL:
+ /* conditional kill */
+ return FALSE;
+
+ case TGSI_OPCODE_PK2H:
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_PK2US:
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_PK4B:
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_PK4UB:
+ return FALSE;
+
+ case TGSI_OPCODE_RFL:
+ return FALSE;
+
+ case TGSI_OPCODE_SEQ:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_EQUAL, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_SFL:
+ dst0 = bld->base.zero;
+ break;
+
+ case TGSI_OPCODE_SGT:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_GREATER, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_SIN:
+ src0 = emit_fetch(bld, inst, 0);
+ tmp0 = swizzle_scalar_aos(bld, src0, TGSI_SWIZZLE_X);
+ dst0 = lp_build_sin(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_SLE:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_LEQUAL, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_SNE:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_NOTEQUAL, src0, src1);
+ dst0 = lp_build_select(&bld->base, tmp0, bld->base.one, bld->base.zero);
+ break;
+
+ case TGSI_OPCODE_STR:
+ dst0 = bld->base.one;
+ break;
+
+ case TGSI_OPCODE_TEX:
+ dst0 = emit_tex(bld, inst, LP_BLD_TEX_MODIFIER_NONE);
+ break;
+
+ case TGSI_OPCODE_TXD:
+ dst0 = emit_tex(bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV);
+ break;
+
+ case TGSI_OPCODE_UP2H:
+ /* deprecated */
+ assert (0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_UP2US:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_UP4B:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_UP4UB:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_X2D:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_ARA:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_ARR:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_round(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_BRA:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_CAL:
+ return FALSE;
+
+ case TGSI_OPCODE_RET:
+ return FALSE;
+
+ case TGSI_OPCODE_END:
+ *pc = -1;
+ break;
+
+ case TGSI_OPCODE_SSG:
+ /* TGSI_OPCODE_SGN */
+ tmp0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_sgn(&bld->base, tmp0);
+ break;
+
+ case TGSI_OPCODE_CMP:
+ src0 = emit_fetch(bld, inst, 0);
+ src1 = emit_fetch(bld, inst, 1);
+ src2 = emit_fetch(bld, inst, 2);
+ tmp0 = lp_build_cmp(&bld->base, PIPE_FUNC_LESS, src0, bld->base.zero);
+ dst0 = lp_build_select(&bld->base, tmp0, src1, src2);
+ break;
+
+ case TGSI_OPCODE_SCS:
+ return FALSE;
+
+ case TGSI_OPCODE_TXB:
+ dst0 = emit_tex(bld, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS);
+ break;
+
+ case TGSI_OPCODE_NRM:
+ /* fall-through */
+ case TGSI_OPCODE_NRM4:
+ return FALSE;
+
+ case TGSI_OPCODE_DIV:
+ /* deprecated */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_DP2:
+ return FALSE;
+
+ case TGSI_OPCODE_TXL:
+ dst0 = emit_tex(bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD);
+ break;
+
+ case TGSI_OPCODE_TXP:
+ dst0 = emit_tex(bld, inst, LP_BLD_TEX_MODIFIER_PROJECTED);
+ break;
+
+ case TGSI_OPCODE_BRK:
+ return FALSE;
+
+ case TGSI_OPCODE_IF:
+ return FALSE;
+
+ case TGSI_OPCODE_BGNLOOP:
+ return FALSE;
+
+ case TGSI_OPCODE_BGNSUB:
+ return FALSE;
+
+ case TGSI_OPCODE_ELSE:
+ return FALSE;
+
+ case TGSI_OPCODE_ENDIF:
+ return FALSE;
+
+ case TGSI_OPCODE_ENDLOOP:
+ return FALSE;
+
+ case TGSI_OPCODE_ENDSUB:
+ return FALSE;
+
+ case TGSI_OPCODE_PUSHA:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_POPA:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_CEIL:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_ceil(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_I2F:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_NOT:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_TRUNC:
+ src0 = emit_fetch(bld, inst, 0);
+ dst0 = lp_build_trunc(&bld->base, src0);
+ break;
+
+ case TGSI_OPCODE_SHL:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_ISHR:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_AND:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_OR:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_MOD:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_XOR:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_SAD:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_TXF:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_TXQ:
+ /* deprecated? */
+ assert(0);
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_CONT:
+ return FALSE;
+
+ case TGSI_OPCODE_EMIT:
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_ENDPRIM:
+ return FALSE;
+ break;
+
+ case TGSI_OPCODE_NOP:
+ break;
+
+ default:
+ return FALSE;
+ }
+
+ if (info->num_dst) {
+ emit_store(bld, inst, 0, dst0);
+ }
+
+ return TRUE;
+}
+
+
+void
+lp_build_tgsi_aos(LLVMBuilderRef builder,
+ const struct tgsi_token *tokens,
+ struct lp_type type,
+ const unsigned char swizzles[4],
+ LLVMValueRef consts_ptr,
+ const LLVMValueRef *inputs,
+ LLVMValueRef *outputs,
+ struct lp_build_sampler_aos *sampler,
+ const struct tgsi_shader_info *info)
+{
+ struct lp_build_tgsi_aos_context bld;
+ struct tgsi_parse_context parse;
+ uint num_immediates = 0;
+ uint num_instructions = 0;
+ unsigned chan;
+ int pc = 0;
+
+ /* Setup build context */
+ memset(&bld, 0, sizeof bld);
+ lp_build_context_init(&bld.base, builder, type);
+ lp_build_context_init(&bld.int_bld, builder, lp_int_type(type));
+
+ for (chan = 0; chan < 4; ++chan) {
+ bld.swizzles[chan] = swizzles[chan];
+ bld.inv_swizzles[swizzles[chan]] = chan;
+ }
+
+ bld.inputs = inputs;
+ bld.outputs = outputs;
+ bld.consts_ptr = consts_ptr;
+ bld.sampler = sampler;
+ bld.indirect_files = info->indirect_files;
+ bld.instructions = (struct tgsi_full_instruction *)
+ MALLOC(LP_MAX_INSTRUCTIONS * sizeof(struct tgsi_full_instruction));
+ bld.max_instructions = LP_MAX_INSTRUCTIONS;
+
+ if (!bld.instructions) {
+ return;
+ }
+
+ tgsi_parse_init(&parse, tokens);
+
+ while (!tgsi_parse_end_of_tokens(&parse)) {
+ tgsi_parse_token(&parse);
+
+ switch(parse.FullToken.Token.Type) {
+ case TGSI_TOKEN_TYPE_DECLARATION:
+ /* Inputs already interpolated */
+ emit_declaration(&bld, &parse.FullToken.FullDeclaration);
+ break;
+
+ case TGSI_TOKEN_TYPE_INSTRUCTION:
+ {
+ /* save expanded instruction */
+ if (num_instructions == bld.max_instructions) {
+ struct tgsi_full_instruction *instructions;
+ instructions = REALLOC(bld.instructions,
+ bld.max_instructions
+ * sizeof(struct tgsi_full_instruction),
+ (bld.max_instructions + LP_MAX_INSTRUCTIONS)
+ * sizeof(struct tgsi_full_instruction));
+ if (!instructions) {
+ break;
+ }
+ bld.instructions = instructions;
+ bld.max_instructions += LP_MAX_INSTRUCTIONS;
+ }
+
+ memcpy(bld.instructions + num_instructions,
+ &parse.FullToken.FullInstruction,
+ sizeof(bld.instructions[0]));
+
+ num_instructions++;
+ }
+
+ break;
+
+ case TGSI_TOKEN_TYPE_IMMEDIATE:
+ /* simply copy the immediate values into the next immediates[] slot */
+ {
+ const uint size = parse.FullToken.FullImmediate.Immediate.NrTokens - 1;
+ float imm[4];
+ assert(size <= 4);
+ assert(num_immediates < LP_MAX_TGSI_IMMEDIATES);
+ for (chan = 0; chan < 4; ++chan) {
+ imm[chan] = 0.0f;
+ }
+ for (chan = 0; chan < size; ++chan) {
+ unsigned swizzle = bld.swizzles[chan];
+ imm[swizzle] = parse.FullToken.FullImmediate.u[chan].Float;
+ }
+ bld.immediates[num_immediates] =
+ lp_build_const_aos(type,
+ imm[0], imm[1], imm[2], imm[3],
+ NULL);
+ num_immediates++;
+ }
+ break;
+
+ case TGSI_TOKEN_TYPE_PROPERTY:
+ break;
+
+ default:
+ assert(0);
+ }
+ }
+
+ while (pc != -1) {
+ struct tgsi_full_instruction *instr = bld.instructions + pc;
+ const struct tgsi_opcode_info *opcode_info =
+ tgsi_get_opcode_info(instr->Instruction.Opcode);
+ if (!emit_instruction(&bld, instr, opcode_info, &pc))
+ _debug_printf("warning: failed to translate tgsi opcode %s to LLVM\n",
+ opcode_info->mnemonic);
+ }
+
+ if (0) {
+ LLVMBasicBlockRef block = LLVMGetInsertBlock(builder);
+ LLVMValueRef function = LLVMGetBasicBlockParent(block);
+ debug_printf("11111111111111111111111111111 \n");
+ tgsi_dump(tokens, 0);
+ lp_debug_dump_value(function);
+ debug_printf("2222222222222222222222222222 \n");
+ }
+ tgsi_parse_free(&parse);
+
+ if (0) {
+ LLVMModuleRef module = LLVMGetGlobalParent(
+ LLVMGetBasicBlockParent(LLVMGetInsertBlock(bld.base.builder)));
+ LLVMDumpModule(module);
+ }
+
+ FREE(bld.instructions);
+}
+
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index 0e07f7f3f3..cd5b132b41 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -612,7 +612,6 @@ emit_fetch(
break;
case TGSI_UTIL_SIGN_SET:
- /* TODO: Use bitwese OR for floating point */
res = lp_build_abs( &bld->base, res );
/* fall through */
case TGSI_UTIL_SIGN_TOGGLE:
@@ -817,18 +816,10 @@ emit_store(
* High-level instruction translators.
*/
-enum tex_modifier {
- TEX_MODIFIER_NONE = 0,
- TEX_MODIFIER_PROJECTED,
- TEX_MODIFIER_LOD_BIAS,
- TEX_MODIFIER_EXPLICIT_LOD,
- TEX_MODIFIER_EXPLICIT_DERIV
-};
-
static void
emit_tex( struct lp_build_tgsi_soa_context *bld,
const struct tgsi_full_instruction *inst,
- enum tex_modifier modifier,
+ enum lp_build_tex_modifier modifier,
LLVMValueRef *texel)
{
unsigned unit;
@@ -868,11 +859,11 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
return;
}
- if (modifier == TEX_MODIFIER_LOD_BIAS) {
+ if (modifier == LP_BLD_TEX_MODIFIER_LOD_BIAS) {
lod_bias = emit_fetch( bld, inst, 0, 3 );
explicit_lod = NULL;
}
- else if (modifier == TEX_MODIFIER_EXPLICIT_LOD) {
+ else if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_LOD) {
lod_bias = NULL;
explicit_lod = emit_fetch( bld, inst, 0, 3 );
}
@@ -881,21 +872,21 @@ emit_tex( struct lp_build_tgsi_soa_context *bld,
explicit_lod = NULL;
}
- if (modifier == TEX_MODIFIER_PROJECTED) {
+ if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED) {
oow = emit_fetch( bld, inst, 0, 3 );
oow = lp_build_rcp(&bld->base, oow);
}
for (i = 0; i < num_coords; i++) {
coords[i] = emit_fetch( bld, inst, 0, i );
- if (modifier == TEX_MODIFIER_PROJECTED)
+ if (modifier == LP_BLD_TEX_MODIFIER_PROJECTED)
coords[i] = lp_build_mul(&bld->base, coords[i], oow);
}
for (i = num_coords; i < 3; i++) {
coords[i] = bld->base.undef;
}
- if (modifier == TEX_MODIFIER_EXPLICIT_DERIV) {
+ if (modifier == LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV) {
for (i = 0; i < num_coords; i++) {
ddx[i] = emit_fetch( bld, inst, 1, i );
ddy[i] = emit_fetch( bld, inst, 2, i );
@@ -1628,11 +1619,11 @@ emit_instruction(
break;
case TGSI_OPCODE_TEX:
- emit_tex( bld, inst, TEX_MODIFIER_NONE, dst0 );
+ emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_NONE, dst0 );
break;
case TGSI_OPCODE_TXD:
- emit_tex( bld, inst, TEX_MODIFIER_EXPLICIT_DERIV, dst0 );
+ emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_DERIV, dst0 );
break;
case TGSI_OPCODE_UP2H:
@@ -1736,7 +1727,7 @@ emit_instruction(
break;
case TGSI_OPCODE_TXB:
- emit_tex( bld, inst, TEX_MODIFIER_LOD_BIAS, dst0 );
+ emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_LOD_BIAS, dst0 );
break;
case TGSI_OPCODE_NRM:
@@ -1841,11 +1832,11 @@ emit_instruction(
break;
case TGSI_OPCODE_TXL:
- emit_tex( bld, inst, TEX_MODIFIER_EXPLICIT_LOD, dst0 );
+ emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_EXPLICIT_LOD, dst0 );
break;
case TGSI_OPCODE_TXP:
- emit_tex( bld, inst, TEX_MODIFIER_PROJECTED, dst0 );
+ emit_tex( bld, inst, LP_BLD_TEX_MODIFIER_PROJECTED, dst0 );
break;
case TGSI_OPCODE_BRK:
@@ -2063,11 +2054,16 @@ lp_build_tgsi_soa(LLVMBuilderRef builder,
{
/* save expanded instruction */
if (num_instructions == bld.max_instructions) {
- bld.instructions = REALLOC(bld.instructions,
- bld.max_instructions
- * sizeof(struct tgsi_full_instruction),
- (bld.max_instructions + LP_MAX_INSTRUCTIONS)
- * sizeof(struct tgsi_full_instruction));
+ struct tgsi_full_instruction *instructions;
+ instructions = REALLOC(bld.instructions,
+ bld.max_instructions
+ * sizeof(struct tgsi_full_instruction),
+ (bld.max_instructions + LP_MAX_INSTRUCTIONS)
+ * sizeof(struct tgsi_full_instruction));
+ if (!instructions) {
+ break;
+ }
+ bld.instructions = instructions;
bld.max_instructions += LP_MAX_INSTRUCTIONS;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
index a6c50dcf0c..5a13f39849 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h
@@ -130,7 +130,7 @@ struct pb_vtbl
* flags is bitmask of PB_USAGE_CPU_READ/WRITE.
*/
void *(*map)( struct pb_buffer *buf,
- unsigned flags );
+ unsigned flags, void *flush_ctx );
void (*unmap)( struct pb_buffer *buf );
@@ -164,13 +164,13 @@ struct pb_vtbl
*/
static INLINE void *
pb_map(struct pb_buffer *buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
assert(buf);
if(!buf)
return NULL;
assert(pipe_is_referenced(&buf->base.reference));
- return buf->vtbl->map(buf, flags);
+ return buf->vtbl->map(buf, flags, flush_ctx);
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index d6cf640582..c310f28f51 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -624,7 +624,7 @@ fenced_buffer_copy_storage_to_gpu_locked(struct fenced_buffer *fenced_buf)
assert(fenced_buf->data);
assert(fenced_buf->buffer);
- map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_WRITE);
+ map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_WRITE, NULL);
if(!map)
return PIPE_ERROR;
@@ -644,7 +644,7 @@ fenced_buffer_copy_storage_to_cpu_locked(struct fenced_buffer *fenced_buf)
assert(fenced_buf->data);
assert(fenced_buf->buffer);
- map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_READ);
+ map = pb_map(fenced_buf->buffer, PB_USAGE_CPU_READ, NULL);
if(!map)
return PIPE_ERROR;
@@ -674,7 +674,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
static void *
fenced_buffer_map(struct pb_buffer *buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
struct fenced_buffer *fenced_buf = fenced_buffer(buf);
struct fenced_manager *fenced_mgr = fenced_buf->mgr;
@@ -712,7 +712,7 @@ fenced_buffer_map(struct pb_buffer *buf,
}
if(fenced_buf->buffer) {
- map = pb_map(fenced_buf->buffer, flags);
+ map = pb_map(fenced_buf->buffer, flags, flush_ctx);
}
else {
assert(fenced_buf->data);
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
index b706f429be..c2322eed19 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
@@ -70,7 +70,8 @@ malloc_buffer_destroy(struct pb_buffer *buf)
static void *
malloc_buffer_map(struct pb_buffer *buf,
- unsigned flags)
+ unsigned flags,
+ void *flush_ctx)
{
return malloc_buffer(buf)->data;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
index 88501e8d72..b4d8107372 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
@@ -167,10 +167,10 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
static void *
pb_cache_buffer_map(struct pb_buffer *_buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
struct pb_cache_buffer *buf = pb_cache_buffer(_buf);
- return pb_map(buf->buffer, flags);
+ return pb_map(buf->buffer, flags, flush_ctx);
}
@@ -242,7 +242,7 @@ pb_cache_is_buffer_compat(struct pb_cache_buffer *buf,
if(!pb_check_usage(desc->usage, buf->base.base.usage))
return FALSE;
- map = pb_map(buf->buffer, PB_USAGE_DONTBLOCK);
+ map = pb_map(buf->buffer, PB_USAGE_DONTBLOCK, NULL);
if (!map) {
return FALSE;
}
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
index 0dc5b31a75..7604e75af8 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
@@ -158,7 +158,7 @@ pb_debug_buffer_fill(struct pb_debug_buffer *buf)
{
uint8_t *map;
- map = pb_map(buf->buffer, PB_USAGE_CPU_WRITE);
+ map = pb_map(buf->buffer, PB_USAGE_CPU_WRITE, NULL);
assert(map);
if(map) {
fill_random_pattern(map, buf->underflow_size);
@@ -181,7 +181,7 @@ pb_debug_buffer_check(struct pb_debug_buffer *buf)
map = pb_map(buf->buffer,
PB_USAGE_CPU_READ |
- PB_USAGE_UNSYNCHRONIZED);
+ PB_USAGE_UNSYNCHRONIZED, NULL);
assert(map);
if(map) {
boolean underflow, overflow;
@@ -247,14 +247,14 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
static void *
pb_debug_buffer_map(struct pb_buffer *_buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
void *map;
pb_debug_buffer_check(buf);
- map = pb_map(buf->buffer, flags);
+ map = pb_map(buf->buffer, flags, flush_ctx);
if(!map)
return NULL;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
index faf7c35267..88da786216 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
@@ -108,11 +108,14 @@ mm_buffer_destroy(struct pb_buffer *buf)
static void *
mm_buffer_map(struct pb_buffer *buf,
- unsigned flags)
+ unsigned flags,
+ void *flush_ctx)
{
struct mm_buffer *mm_buf = mm_buffer(buf);
struct mm_pb_manager *mm = mm_buf->mgr;
+ /* XXX: it will be necessary to remap here to propagate flush_ctx */
+
return (unsigned char *) mm->map + mm_buf->block->ofs;
}
@@ -269,7 +272,7 @@ mm_bufmgr_create_from_buffer(struct pb_buffer *buffer,
mm->map = pb_map(mm->buffer,
PB_USAGE_CPU_READ |
- PB_USAGE_CPU_WRITE);
+ PB_USAGE_CPU_WRITE, NULL);
if(!mm->map)
goto failure;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
index 31f1ebbeb7..694a092f3c 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c
@@ -103,13 +103,13 @@ pb_ondemand_buffer_destroy(struct pb_buffer *_buf)
static void *
pb_ondemand_buffer_map(struct pb_buffer *_buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
struct pb_ondemand_buffer *buf = pb_ondemand_buffer(_buf);
if(buf->buffer) {
assert(!buf->data);
- return pb_map(buf->buffer, flags);
+ return pb_map(buf->buffer, flags, flush_ctx);
}
else {
assert(buf->data);
@@ -150,7 +150,7 @@ pb_ondemand_buffer_instantiate(struct pb_ondemand_buffer *buf)
if(!buf->buffer)
return PIPE_ERROR_OUT_OF_MEMORY;
- map = pb_map(buf->buffer, PB_USAGE_CPU_READ);
+ map = pb_map(buf->buffer, PB_USAGE_CPU_READ, NULL);
if(!map) {
pb_reference(&buf->buffer, NULL);
return PIPE_ERROR;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
index fdcce42878..2f7c7389ff 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
@@ -118,12 +118,14 @@ pool_buffer_destroy(struct pb_buffer *buf)
static void *
-pool_buffer_map(struct pb_buffer *buf, unsigned flags)
+pool_buffer_map(struct pb_buffer *buf, unsigned flags, void *flush_ctx)
{
struct pool_buffer *pool_buf = pool_buffer(buf);
struct pool_pb_manager *pool = pool_buf->mgr;
void *map;
+ /* XXX: it will be necessary to remap here to propagate flush_ctx */
+
pipe_mutex_lock(pool->mutex);
map = (unsigned char *) pool->map + pool_buf->start;
pipe_mutex_unlock(pool->mutex);
@@ -285,7 +287,7 @@ pool_bufmgr_create(struct pb_manager *provider,
pool->map = pb_map(pool->buffer,
PB_USAGE_CPU_READ |
- PB_USAGE_CPU_WRITE);
+ PB_USAGE_CPU_WRITE, NULL);
if(!pool->map)
goto failure;
diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
index 7a3305aaf3..176f9aa38a 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
@@ -227,10 +227,13 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
static void *
pb_slab_buffer_map(struct pb_buffer *_buf,
- unsigned flags)
+ unsigned flags,
+ void *flush_ctx)
{
struct pb_slab_buffer *buf = pb_slab_buffer(_buf);
+ /* XXX: it will be necessary to remap here to propagate flush_ctx */
+
++buf->mapCount;
return (void *) ((uint8_t *) buf->slab->virtual + buf->start);
}
@@ -316,7 +319,7 @@ pb_slab_create(struct pb_slab_manager *mgr)
* through this address so it is required that the buffer is pinned. */
slab->virtual = pb_map(slab->bo,
PB_USAGE_CPU_READ |
- PB_USAGE_CPU_WRITE);
+ PB_USAGE_CPU_WRITE, NULL);
if(!slab->virtual) {
ret = PIPE_ERROR_OUT_OF_MEMORY;
goto out_err1;
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
index 6dee362d58..9d62c1d7e7 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
@@ -377,6 +377,36 @@ tgsi_exec_set_constant_buffers(struct tgsi_exec_machine *mach,
const unsigned *buf_sizes);
+static INLINE int
+tgsi_exec_get_shader_param(enum pipe_shader_cap param)
+{
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return INT_MAX;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return TGSI_EXEC_MAX_NESTING;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return TGSI_EXEC_MAX_INPUT_ATTRIBS;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return TGSI_EXEC_MAX_CONST_BUFFER;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return PIPE_MAX_CONSTANT_BUFFERS;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return TGSI_EXEC_NUM_TEMPS;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return TGSI_EXEC_NUM_ADDRS;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return TGSI_EXEC_NUM_PREDS;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
#if defined __cplusplus
} /* extern "C" */
#endif
diff --git a/src/gallium/auxiliary/util/u_caps.c b/src/gallium/auxiliary/util/u_caps.c
index 94d5bd3027..e209a98b70 100644
--- a/src/gallium/auxiliary/util/u_caps.c
+++ b/src/gallium/auxiliary/util/u_caps.c
@@ -75,6 +75,14 @@ util_check_caps_out(struct pipe_screen *screen, const unsigned *list, int *out)
return FALSE;
}
break;
+ case UTIL_CAPS_CHECK_SHADER:
+ tmpi = screen->get_shader_param(screen, list[i] >> 24, list[i] & ((1 << 24) - 1));
+ ++i;
+ if (tmpi < (int)list[i++]) {
+ *out = i - 3;
+ return FALSE;
+ }
+ break;
case UTIL_CAPS_CHECK_UNIMPLEMENTED:
*out = i - 1;
return FALSE;
@@ -188,17 +196,17 @@ static unsigned caps_opengl_2_1[] = {
/* Shader Model 3 */
static unsigned caps_sm3[] = {
- UTIL_CHECK_INT(MAX_FS_INSTRUCTIONS, 512),
- UTIL_CHECK_INT(MAX_FS_INPUTS, 10),
- UTIL_CHECK_INT(MAX_FS_TEMPS, 32),
- UTIL_CHECK_INT(MAX_FS_ADDRS, 1),
- UTIL_CHECK_INT(MAX_FS_CONSTS, 224),
+ UTIL_CHECK_SHADER(FRAGMENT, MAX_INSTRUCTIONS, 512),
+ UTIL_CHECK_SHADER(FRAGMENT, MAX_INPUTS, 10),
+ UTIL_CHECK_SHADER(FRAGMENT, MAX_TEMPS, 32),
+ UTIL_CHECK_SHADER(FRAGMENT, MAX_ADDRS, 1),
+ UTIL_CHECK_SHADER(FRAGMENT, MAX_CONSTS, 224),
- UTIL_CHECK_INT(MAX_VS_INSTRUCTIONS, 512),
- UTIL_CHECK_INT(MAX_VS_INPUTS, 16),
- UTIL_CHECK_INT(MAX_VS_TEMPS, 32),
- UTIL_CHECK_INT(MAX_VS_ADDRS, 2),
- UTIL_CHECK_INT(MAX_VS_CONSTS, 256),
+ UTIL_CHECK_SHADER(VERTEX, MAX_INSTRUCTIONS, 512),
+ UTIL_CHECK_SHADER(VERTEX, MAX_INPUTS, 16),
+ UTIL_CHECK_SHADER(VERTEX, MAX_TEMPS, 32),
+ UTIL_CHECK_SHADER(VERTEX, MAX_ADDRS, 2),
+ UTIL_CHECK_SHADER(VERTEX, MAX_CONSTS, 256),
UTIL_CHECK_TERMINATE
};
diff --git a/src/gallium/auxiliary/util/u_caps.h b/src/gallium/auxiliary/util/u_caps.h
index b1074f9eb2..7bd2380041 100644
--- a/src/gallium/auxiliary/util/u_caps.h
+++ b/src/gallium/auxiliary/util/u_caps.h
@@ -38,6 +38,7 @@ enum u_caps_check_enum {
UTIL_CAPS_CHECK_INT,
UTIL_CAPS_CHECK_FLOAT,
UTIL_CAPS_CHECK_FORMAT,
+ UTIL_CAPS_CHECK_SHADER,
UTIL_CAPS_CHECK_UNIMPLEMENTED,
};
@@ -54,6 +55,9 @@ enum u_caps_check_enum {
#define UTIL_CHECK_FORMAT(format) \
UTIL_CAPS_CHECK_FORMAT, PIPE_FORMAT_##format
+#define UTIL_CHECK_SHADER(shader, cap, higher) \
+ UTIL_CAPS_CHECK_SHADER, (PIPE_SHADER_##shader << 24) | PIPE_SHADER_CAP_##cap, (unsigned)(higher)
+
#define UTIL_CHECK_UNIMPLEMENTED \
UTIL_CAPS_CHECK_UNIMPLEMENTED
diff --git a/src/gallium/auxiliary/util/u_format.c b/src/gallium/auxiliary/util/u_format.c
index 43d09f1960..a4ee91b0cf 100644
--- a/src/gallium/auxiliary/util/u_format.c
+++ b/src/gallium/auxiliary/util/u_format.c
@@ -121,6 +121,54 @@ util_format_write_4ub(enum pipe_format format, const uint8_t *src, unsigned src_
boolean
+util_is_format_compatible(const struct util_format_description *src_desc,
+ const struct util_format_description *dst_desc)
+{
+ unsigned chan;
+
+ if (src_desc->format == dst_desc->format) {
+ return TRUE;
+ }
+
+ if (src_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN ||
+ dst_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN) {
+ return FALSE;
+ }
+
+ if (src_desc->block.bits != dst_desc->block.bits ||
+ src_desc->nr_channels != dst_desc->nr_channels ||
+ src_desc->colorspace != dst_desc->colorspace) {
+ return FALSE;
+ }
+
+ for (chan = 0; chan < 4; ++chan) {
+ if (src_desc->channel[chan].size !=
+ dst_desc->channel[chan].size) {
+ return FALSE;
+ }
+ }
+
+ for (chan = 0; chan < 4; ++chan) {
+ enum util_format_swizzle swizzle = dst_desc->swizzle[chan];
+
+ if (swizzle < 4) {
+ if (src_desc->swizzle[chan] != swizzle) {
+ return FALSE;
+ }
+ if ((src_desc->channel[swizzle].type !=
+ dst_desc->channel[swizzle].type) ||
+ (src_desc->channel[swizzle].normalized !=
+ dst_desc->channel[swizzle].normalized)) {
+ return FALSE;
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+
+boolean
util_format_fits_8unorm(const struct util_format_description *format_desc)
{
unsigned chan;
@@ -193,7 +241,10 @@ util_format_translate(enum pipe_format dst_format,
unsigned dst_step;
unsigned src_step;
- if (dst_format == src_format) {
+ dst_format_desc = util_format_description(dst_format);
+ src_format_desc = util_format_description(src_format);
+
+ if (util_is_format_compatible(src_format_desc, dst_format_desc)) {
/*
* Trivial case.
*/
@@ -204,9 +255,6 @@ util_format_translate(enum pipe_format dst_format,
return;
}
- dst_format_desc = util_format_description(dst_format);
- src_format_desc = util_format_description(src_format);
-
assert(dst_x % dst_format_desc->block.width == 0);
assert(dst_y % dst_format_desc->block.height == 0);
assert(src_x % src_format_desc->block.width == 0);
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index 8e786a390a..03b73c0e98 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -440,6 +440,48 @@ util_format_is_depth_and_stencil(enum pipe_format format)
desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE;
}
+
+/**
+ * Give the RGBA colormask of the channels that can be represented in this
+ * format.
+ *
+ * That is, the channels whose values are preserved.
+ */
+static INLINE unsigned
+util_format_colormask(const struct util_format_description *desc)
+{
+ unsigned colormask;
+ unsigned chan;
+
+ switch (desc->colorspace) {
+ case UTIL_FORMAT_COLORSPACE_RGB:
+ case UTIL_FORMAT_COLORSPACE_SRGB:
+ case UTIL_FORMAT_COLORSPACE_YUV:
+ colormask = 0;
+ for (chan = 0; chan < 4; ++chan) {
+ if (desc->swizzle[chan] < 4) {
+ colormask |= (1 << chan);
+ }
+ }
+ return colormask;
+ case UTIL_FORMAT_COLORSPACE_ZS:
+ return 0;
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
+
+/**
+ * Whether the src format can be blitted to destation format with a simple
+ * memcpy.
+ */
+boolean
+util_is_format_compatible(const struct util_format_description *src_desc,
+ const struct util_format_description *dst_desc);
+
+
/**
* Whether this format is a rgab8 variant.
*
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index 78473bf35a..6ed39561fb 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -399,7 +399,6 @@ static INLINE boolean util_get_offset(
}
}
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/util/u_linear.h b/src/gallium/auxiliary/util/u_linear.h
index 42c40b2aa7..81ffc9fb27 100644
--- a/src/gallium/auxiliary/util/u_linear.h
+++ b/src/gallium/auxiliary/util/u_linear.h
@@ -33,6 +33,7 @@
#ifndef U_LINEAR_H
#define U_LINEAR_H
+#include "pipe/p_compiler.h"
#include "pipe/p_format.h"
struct u_linear_format_block
diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 8250c30f2a..5342fc25dc 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -263,9 +263,11 @@ apart from any 3D state in the context. Blitting functionality may be
moved to a separate abstraction at some point in the future.
``resource_copy_region`` blits a region of a subresource of a resource to a
-region of another subresource of a resource, provided that both resources have the
-same format. The source and destination may be the same resource, but overlapping
-blits are not permitted.
+region of another subresource of a resource, provided that both resources have
+the same format, or compatible formats, i.e., formats for which copying the
+bytes from the source resource unmodified to the destination resource will
+achieve the same effect of a textured quad blitter. The source and destination
+may be the same resource, but overlapping blits are not permitted.
``resource_resolve`` resolves a multisampled resource into a non-multisampled
one. Formats and dimensions must match. This function must be present if a driver
diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c
index 0f12e0667e..8d2b4b9643 100644
--- a/src/gallium/drivers/cell/ppu/cell_screen.c
+++ b/src/gallium/drivers/cell/ppu/cell_screen.c
@@ -90,8 +90,6 @@ cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1; /* XXX not really true */
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
return 0; /* XXX to do */
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 1;
@@ -105,6 +103,20 @@ cell_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
+static int
+cell_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ return tgsi_exec_get_shader_param(param);
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_GEOMETRY:
+ return draw_get_shader_param(shader, param);
+ default:
+ return 0;
+ }
+}
static float
cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
@@ -200,6 +212,7 @@ cell_create_screen(struct sw_winsys *winsys)
screen->base.get_name = cell_get_name;
screen->base.get_vendor = cell_get_vendor;
screen->base.get_param = cell_get_param;
+ screen->base.get_shader_param = cell_get_shader_param;
screen->base.get_paramf = cell_get_paramf;
screen->base.is_format_supported = cell_is_format_supported;
screen->base.context_create = cell_create_context;
diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c
index 761a0fce72..ec3609291e 100644
--- a/src/gallium/drivers/failover/fo_context.c
+++ b/src/gallium/drivers/failover/fo_context.c
@@ -116,6 +116,7 @@ struct pipe_context *failover_create( struct pipe_context *hw,
failover->pipe.get_name = hw->get_name;
failover->pipe.get_vendor = hw->get_vendor;
failover->pipe.get_param = hw->get_param;
+ failover->pipe.get_shader_param = hw->get_shader_param;
failover->pipe.get_paramf = hw->get_paramf;
#endif
diff --git a/src/gallium/drivers/galahad/glhd_context.c b/src/gallium/drivers/galahad/glhd_context.c
index 383c448926..ff6d2aa00a 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -54,6 +54,10 @@ galahad_draw_vbo(struct pipe_context *_pipe,
struct galahad_context *glhd_pipe = galahad_context(_pipe);
struct pipe_context *pipe = glhd_pipe->pipe;
+ /* XXX we should check that all bound resources are unmapped
+ * before drawing.
+ */
+
pipe->draw_vbo(pipe, info);
}
@@ -465,11 +469,11 @@ galahad_set_constant_buffer(struct pipe_context *_pipe,
if (index &&
index >=
- pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS)) {
+ pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS)) {
glhd_error("Access to constant buffer %u requested, "
"but only %d are supported",
index,
- pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_CONST_BUFFERS));
+ pipe->screen->get_shader_param(pipe->screen, shader, PIPE_SHADER_CAP_MAX_CONST_BUFFERS));
}
/* XXX hmm? unwrap the input state */
@@ -860,6 +864,10 @@ galahad_context_transfer_map(struct pipe_context *_context,
struct pipe_context *context = glhd_context->pipe;
struct pipe_transfer *transfer = glhd_transfer->transfer;
+ struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource);
+
+ glhd_resource->map_count++;
+
return context->transfer_map(context,
transfer);
}
@@ -890,6 +898,14 @@ galahad_context_transfer_unmap(struct pipe_context *_context,
struct galahad_transfer *glhd_transfer = galahad_transfer(_transfer);
struct pipe_context *context = glhd_context->pipe;
struct pipe_transfer *transfer = glhd_transfer->transfer;
+ struct galahad_resource *glhd_resource = galahad_resource(_transfer->resource);
+
+ if (glhd_resource->map_count < 1) {
+ glhd_warn("context::transfer_unmap() called too many times"
+ " (count = %d)\n", glhd_resource->map_count);
+ }
+
+ glhd_resource->map_count--;
context->transfer_unmap(context,
transfer);
diff --git a/src/gallium/drivers/galahad/glhd_objects.h b/src/gallium/drivers/galahad/glhd_objects.h
index 935803915d..dc74c5bebc 100644
--- a/src/gallium/drivers/galahad/glhd_objects.h
+++ b/src/gallium/drivers/galahad/glhd_objects.h
@@ -42,6 +42,8 @@ struct galahad_resource
struct pipe_resource base;
struct pipe_resource *resource;
+
+ int map_count;
};
diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c
index 75e4c2d82e..288941b106 100644
--- a/src/gallium/drivers/galahad/glhd_screen.c
+++ b/src/gallium/drivers/galahad/glhd_screen.c
@@ -79,6 +79,17 @@ galahad_screen_get_param(struct pipe_screen *_screen,
param);
}
+static int
+galahad_screen_get_shader_param(struct pipe_screen *_screen,
+ unsigned shader, enum pipe_shader_cap param)
+{
+ struct galahad_screen *glhd_screen = galahad_screen(_screen);
+ struct pipe_screen *screen = glhd_screen->screen;
+
+ return screen->get_shader_param(screen, shader,
+ param);
+}
+
static float
galahad_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
@@ -341,6 +352,7 @@ galahad_screen_create(struct pipe_screen *screen)
glhd_screen->base.get_name = galahad_screen_get_name;
glhd_screen->base.get_vendor = galahad_screen_get_vendor;
glhd_screen->base.get_param = galahad_screen_get_param;
+ glhd_screen->base.get_shader_param = galahad_screen_get_shader_param;
glhd_screen->base.get_paramf = galahad_screen_get_paramf;
glhd_screen->base.is_format_supported = galahad_screen_is_format_supported;
glhd_screen->base.context_create = galahad_screen_context_create;
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 77345d5f71..a3e7c5c577 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -26,6 +26,7 @@
**************************************************************************/
+#include "draw/draw_context.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_string.h"
@@ -139,6 +140,50 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
+static int
+i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader) {
+ case PIPE_SHADER_VERTEX:
+ return draw_get_shader_param(shader, param);
+ case PIPE_SHADER_FRAGMENT:
+ break;
+ default:
+ return 0;
+ }
+
+ /* XXX: these are just shader model 2.0 values, fix this! */
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ return 96;
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ return 64;
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ return 32;
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 8;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return 0;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 10;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 32;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 12; /* XXX: 12 -> 32 ? */
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 0;
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
static float
i915_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
@@ -320,6 +365,7 @@ i915_screen_create(struct i915_winsys *iws)
is->base.get_name = i915_get_name;
is->base.get_vendor = i915_get_vendor;
is->base.get_param = i915_get_param;
+ is->base.get_shader_param = i915_get_shader_param;
is->base.get_paramf = i915_get_paramf;
is->base.is_format_supported = i915_is_format_supported;
diff --git a/src/gallium/drivers/i965/brw_screen.c b/src/gallium/drivers/i965/brw_screen.c
index bdfead73cc..864b21fa53 100644
--- a/src/gallium/drivers/i965/brw_screen.c
+++ b/src/gallium/drivers/i965/brw_screen.c
@@ -197,6 +197,50 @@ brw_get_param(struct pipe_screen *screen, enum pipe_cap param)
}
}
+static int
+brw_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader) {
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_FRAGMENT:
+ case PIPE_SHADER_GEOMETRY:
+ break;
+ default:
+ return 0;
+ }
+
+ /* XXX: these are just shader model 4.0 values, fix this! */
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ return 65536;
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ return 65536;
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ return 65536;
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 65536;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return 65536;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 32;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 4096;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return PIPE_MAX_CONSTANT_BUFFERS;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 4096;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ assert(0);
+ return 0;
+ }
+}
+
static float
brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
{
@@ -410,6 +454,7 @@ brw_screen_create(struct brw_winsys_screen *sws)
bscreen->base.get_name = brw_get_name;
bscreen->base.get_vendor = brw_get_vendor;
bscreen->base.get_param = brw_get_param;
+ bscreen->base.get_shader_param = brw_get_shader_param;
bscreen->base.get_paramf = brw_get_paramf;
bscreen->base.is_format_supported = brw_is_format_supported;
bscreen->base.context_create = brw_create_context;
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index f71585e06f..5fb464b414 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -76,6 +76,17 @@ identity_screen_get_param(struct pipe_screen *_screen,
param);
}
+static int
+identity_screen_get_shader_param(struct pipe_screen *_screen,
+ unsigned shader, enum pipe_shader_cap param)
+{
+ struct identity_screen *id_screen = identity_screen(_screen);
+ struct pipe_screen *screen = id_screen->screen;
+
+ return screen->get_shader_param(screen, shader,
+ param);
+}
+
static float
identity_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
@@ -304,6 +315,7 @@ identity_screen_create(struct pipe_screen *screen)
id_screen->base.get_name = identity_screen_get_name;
id_screen->base.get_vendor = identity_screen_get_vendor;
id_screen->base.get_param = identity_screen_get_param;
+ id_screen->base.get_shader_param = identity_screen_get_shader_param;
id_screen->base.get_paramf = identity_screen_get_paramf;
id_screen->base.is_format_supported = identity_screen_is_format_supported;
id_screen->base.context_create = identity_screen_context_create;
diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile
index dec874623e..55b877b4ab 100644
--- a/src/gallium/drivers/llvmpipe/Makefile
+++ b/src/gallium/drivers/llvmpipe/Makefile
@@ -22,6 +22,7 @@ C_SOURCES = \
lp_perf.c \
lp_query.c \
lp_rast.c \
+ lp_rast_debug.c \
lp_rast_tri.c \
lp_scene.c \
lp_scene_queue.c \
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index 8d57db72cf..650435f0f1 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -55,6 +55,7 @@ llvmpipe = env.ConvenienceLibrary(
'lp_perf.c',
'lp_query.c',
'lp_rast.c',
+ 'lp_rast_debug.c',
'lp_rast_tri.c',
'lp_scene.c',
'lp_scene_queue.c',
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
index 8514030cde..e28efe778f 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.c
@@ -44,21 +44,20 @@
void
lp_build_alpha_test(LLVMBuilderRef builder,
- const struct pipe_alpha_state *state,
+ unsigned func,
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef alpha,
LLVMValueRef ref)
{
struct lp_build_context bld;
+ LLVMValueRef test;
lp_build_context_init(&bld, builder, type);
- if(state->enabled) {
- LLVMValueRef test = lp_build_cmp(&bld, state->func, alpha, ref);
+ test = lp_build_cmp(&bld, func, alpha, ref);
- lp_build_name(test, "alpha_mask");
+ lp_build_name(test, "alpha_mask");
- lp_build_mask_update(mask, test);
- }
+ lp_build_mask_update(mask, test);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
index 0f99fec65e..44603b418c 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
@@ -44,7 +44,7 @@ struct lp_build_mask_context;
void
lp_build_alpha_test(LLVMBuilderRef builder,
- const struct pipe_alpha_state *state,
+ unsigned func,
struct lp_type type,
struct lp_build_mask_context *mask,
LLVMValueRef alpha,
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
index 09e9833057..b5924cbb7d 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_blend_aos.c
@@ -197,7 +197,7 @@ lp_build_blend_swizzle(struct lp_build_blend_aos_context *bld,
swizzled_rgb = rgb;
break;
case LP_BUILD_BLEND_SWIZZLE_AAAA:
- swizzled_rgb = lp_build_broadcast_aos(&bld->base, rgb, alpha_swizzle);
+ swizzled_rgb = lp_build_swizzle_scalar_aos(&bld->base, rgb, alpha_swizzle);
break;
default:
assert(0);
@@ -205,9 +205,8 @@ lp_build_blend_swizzle(struct lp_build_blend_aos_context *bld,
}
if (rgb != alpha) {
- boolean cond[4] = {0, 0, 0, 0};
- cond[alpha_swizzle] = 1;
- swizzled_rgb = lp_build_select_aos(&bld->base, alpha, swizzled_rgb, cond);
+ swizzled_rgb = lp_build_select_aos(&bld->base, 1 << alpha_swizzle,
+ alpha, swizzled_rgb);
}
return swizzled_rgb;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
index 2cf6f38c4b..2a374f8c39 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c
@@ -75,6 +75,33 @@
*/
+/**
+ * Do one perspective divide per quad.
+ *
+ * For perspective interpolation, the final attribute value is given
+ *
+ * a' = a/w = a * oow
+ *
+ * where
+ *
+ * a = a0 + dadx*x + dady*y
+ * w = w0 + dwdx*x + dwdy*y
+ * oow = 1/w = 1/(w0 + dwdx*x + dwdy*y)
+ *
+ * Instead of computing the division per pixel, with this macro we compute the
+ * division on the upper left pixel of each quad, and use a linear
+ * approximation in the remaining pixels, given by:
+ *
+ * da'dx = (dadx - dwdx*a)*oow
+ * da'dy = (dady - dwdy*a)*oow
+ *
+ * Ironically, this actually makes things slower -- probably because the
+ * divide hardware unit is rarely used, whereas the multiply unit is typically
+ * already saturated.
+ */
+#define PERSPECTIVE_DIVIDE_PER_QUAD 0
+
+
static const unsigned char quad_offset_x[4] = {0, 1, 0, 1};
static const unsigned char quad_offset_y[4] = {0, 0, 1, 1};
@@ -107,7 +134,6 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
LLVMValueRef i1 = LLVMConstInt(LLVMInt32Type(), 1, 0);
LLVMValueRef i2 = LLVMConstInt(LLVMInt32Type(), 2, 0);
LLVMValueRef i3 = LLVMConstInt(LLVMInt32Type(), 3, 0);
- LLVMValueRef oow = NULL;
unsigned attrib;
unsigned chan;
@@ -213,22 +239,22 @@ coeffs_init(struct lp_build_interp_soa_context *bld,
a = LLVMBuildFAdd(builder, a, dadq2, "");
+#if PERSPECTIVE_DIVIDE_PER_QUAD
/*
- * a *= 1 / w
- * dadq *= 1 / w
+ * a *= 1 / w
*/
if (interp == LP_INTERP_PERSPECTIVE) {
LLVMValueRef w = bld->a[0][3];
assert(attrib != 0);
assert(bld->mask[0] & TGSI_WRITEMASK_W);
- if (!oow) {
- oow = lp_build_rcp(coeff_bld, w);
- lp_build_name(oow, "oow");
+ if (!bld->oow) {
+ bld->oow = lp_build_rcp(coeff_bld, w);
+ lp_build_name(bld->oow, "oow");
}
- a = lp_build_mul(coeff_bld, a, oow);
- dadq = lp_build_mul(coeff_bld, dadq, oow);
+ a = lp_build_mul(coeff_bld, a, bld->oow);
}
+#endif
attrib_name(a, attrib, chan, ".a");
attrib_name(dadq, attrib, chan, ".dadq");
@@ -250,6 +276,7 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
{
struct lp_build_context *coeff_bld = &bld->coeff_bld;
LLVMValueRef shuffle = lp_build_const_int_vec(coeff_bld->type, quad_index);
+ LLVMValueRef oow = NULL;
unsigned attrib;
unsigned chan;
@@ -270,6 +297,8 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
a = bld->attribs[0][chan];
}
else {
+ LLVMValueRef dadq;
+
a = bld->a[attrib][chan];
/*
@@ -280,10 +309,46 @@ attribs_update(struct lp_build_interp_soa_context *bld, int quad_index)
a, coeff_bld->undef, shuffle, "");
/*
+ * Get the derivatives.
+ */
+
+ dadq = bld->dadq[attrib][chan];
+
+#if PERSPECTIVE_DIVIDE_PER_QUAD
+ if (interp == LP_INTERP_PERSPECTIVE) {
+ LLVMValueRef dwdq = bld->dadq[0][3];
+
+ if (oow == NULL) {
+ assert(bld->oow);
+ oow = LLVMBuildShuffleVector(coeff_bld->builder,
+ bld->oow, coeff_bld->undef,
+ shuffle, "");
+ }
+
+ dadq = lp_build_sub(coeff_bld,
+ dadq,
+ lp_build_mul(coeff_bld, a, dwdq));
+ dadq = lp_build_mul(coeff_bld, dadq, oow);
+ }
+#endif
+
+ /*
* Add the derivatives
*/
- a = lp_build_add(coeff_bld, a, bld->dadq[attrib][chan]);
+ a = lp_build_add(coeff_bld, a, dadq);
+
+#if !PERSPECTIVE_DIVIDE_PER_QUAD
+ if (interp == LP_INTERP_PERSPECTIVE) {
+ if (oow == NULL) {
+ LLVMValueRef w = bld->attribs[0][3];
+ assert(attrib != 0);
+ assert(bld->mask[0] & TGSI_WRITEMASK_W);
+ oow = lp_build_rcp(coeff_bld, w);
+ }
+ a = lp_build_mul(coeff_bld, a, oow);
+ }
+#endif
attrib_name(a, attrib, chan, "");
}
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.h b/src/gallium/drivers/llvmpipe/lp_bld_interp.h
index 2905513301..3054030f73 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_interp.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.h
@@ -64,6 +64,8 @@ struct lp_build_interp_soa_context
LLVMValueRef a [1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
LLVMValueRef dadq[1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
+ LLVMValueRef oow;
+
LLVMValueRef attribs[1 + PIPE_MAX_SHADER_INPUTS][NUM_CHANNELS];
/*
diff --git a/src/gallium/drivers/llvmpipe/lp_debug.h b/src/gallium/drivers/llvmpipe/lp_debug.h
index a928ee38be..add43e4fca 100644
--- a/src/gallium/drivers/llvmpipe/lp_debug.h
+++ b/src/gallium/drivers/llvmpipe/lp_debug.h
@@ -48,6 +48,7 @@ st_print_current(void);
#define DEBUG_COUNTERS 0x800
#define DEBUG_SCENE 0x1000
#define DEBUG_FENCE 0x2000
+#define DEBUG_MEM 0x4000
#ifdef DEBUG
diff --git a/src/gallium/drivers/llvmpipe/lp_perf.h b/src/gallium/drivers/llvmpipe/lp_perf.h
index c28652fc30..b23a100b87 100644
--- a/src/gallium/drivers/llvmpipe/lp_perf.h
+++ b/src/gallium/drivers/llvmpipe/lp_perf.h
@@ -74,7 +74,7 @@ extern struct lp_counters lp_count;
#define LP_COUNT_GET(counter) (lp_count.counter)
#else
#define LP_COUNT(counter)
-#define LP_COUNT_ADD(counter, incr) (void) incr
+#define LP_COUNT_ADD(counter, incr) (void)(incr)
#define LP_COUNT_GET(counter) 0
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 67fd797af2..ff0e207a54 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -54,9 +54,6 @@ llvmpipe_create_query(struct pipe_context *pipe,
assert(type == PIPE_QUERY_OCCLUSION_COUNTER);
pq = CALLOC_STRUCT( llvmpipe_query );
- if (pq) {
- pipe_mutex_init(pq->mutex);
- }
return (struct pipe_query *) pq;
}
@@ -66,12 +63,20 @@ static void
llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
{
struct llvmpipe_query *pq = llvmpipe_query(q);
- /* query might still be in process if we never waited for the result */
- if (!pq->done) {
- llvmpipe_finish(pipe, __FUNCTION__);
+
+ /* Ideally we would refcount queries & not get destroyed until the
+ * last scene had finished with us.
+ */
+ if (pq->fence) {
+ if (!lp_fence_issued(pq->fence))
+ llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
+
+ if (!lp_fence_signalled(pq->fence))
+ lp_fence_wait(pq->fence);
+
+ lp_fence_reference(&pq->fence, NULL);
}
- pipe_mutex_destroy(pq->mutex);
FREE(pq);
}
@@ -84,22 +89,31 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
{
struct llvmpipe_query *pq = llvmpipe_query(q);
uint64_t *result = (uint64_t *)vresult;
+ int i;
+
+ if (!pq->fence) {
+ assert(0); /* query not in issued state */
+ return FALSE;
+ }
- if (!pq->done) {
- if (wait) {
- llvmpipe_finish(pipe, __FUNCTION__);
- }
- /* this is a bit inconsequent but should be ok */
- else {
+ if (!lp_fence_signalled(pq->fence)) {
+ if (!lp_fence_issued(pq->fence))
llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
- }
+
+ if (!wait)
+ return FALSE;
+
+ lp_fence_wait(pq->fence);
}
- if (pq->done) {
- *result = pq->result;
+ /* Sum the results from each of the threads:
+ */
+ *result = 0;
+ for (i = 0; i < LP_MAX_THREADS; i++) {
+ *result += pq->count[i];
}
- return pq->done;
+ return TRUE;
}
@@ -113,10 +127,12 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q)
* flush the scene now. Real apps shouldn't re-use a query in a
* frame of rendering.
*/
- if (pq->binned) {
+ if (pq->fence && !lp_fence_issued(pq->fence)) {
llvmpipe_finish(pipe, __FUNCTION__);
}
+
+ memset(pq->count, 0, sizeof(pq->count));
lp_setup_begin_query(llvmpipe->setup, pq);
llvmpipe->active_query_count++;
diff --git a/src/gallium/drivers/llvmpipe/lp_query.h b/src/gallium/drivers/llvmpipe/lp_query.h
index 721c41cb5c..e93842a2fd 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.h
+++ b/src/gallium/drivers/llvmpipe/lp_query.h
@@ -43,13 +43,7 @@ struct llvmpipe_context;
struct llvmpipe_query {
uint64_t count[LP_MAX_THREADS]; /**< a counter for each thread */
- uint64_t result; /**< total of all counters */
-
- pipe_mutex mutex;
- unsigned num_tiles, tile_count;
-
- boolean done;
- boolean binned; /**< has this query been binned in the scene? */
+ struct lp_fence *fence; /* fence from last scene this was binned in */
};
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index b1c306bbe9..d7e6415e13 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -30,6 +30,7 @@
#include "util/u_math.h"
#include "util/u_rect.h"
#include "util/u_surface.h"
+#include "util/u_pack_color.h"
#include "lp_scene_queue.h"
#include "lp_debug.h"
@@ -57,39 +58,12 @@ static void
lp_rast_begin( struct lp_rasterizer *rast,
struct lp_scene *scene )
{
- const struct pipe_framebuffer_state *fb = &scene->fb;
- int i;
rast->curr_scene = scene;
LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
- rast->state.nr_cbufs = scene->fb.nr_cbufs;
-
- for (i = 0; i < rast->state.nr_cbufs; i++) {
- struct pipe_surface *cbuf = scene->fb.cbufs[i];
- llvmpipe_resource_map(cbuf->texture,
- cbuf->face,
- cbuf->level,
- cbuf->zslice,
- LP_TEX_USAGE_READ_WRITE,
- LP_TEX_LAYOUT_LINEAR);
- }
-
- if (fb->zsbuf) {
- struct pipe_surface *zsbuf = scene->fb.zsbuf;
- rast->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->level);
- rast->zsbuf.blocksize =
- util_format_get_blocksize(zsbuf->texture->format);
-
- rast->zsbuf.map = llvmpipe_resource_map(zsbuf->texture,
- zsbuf->face,
- zsbuf->level,
- zsbuf->zslice,
- LP_TEX_USAGE_READ_WRITE,
- LP_TEX_LAYOUT_NONE);
- }
-
+ lp_scene_begin_rasterization( scene );
lp_scene_bin_iter_begin( scene );
}
@@ -97,29 +71,7 @@ lp_rast_begin( struct lp_rasterizer *rast,
static void
lp_rast_end( struct lp_rasterizer *rast )
{
- struct lp_scene *scene = rast->curr_scene;
- unsigned i;
-
- /* Unmap color buffers */
- for (i = 0; i < rast->state.nr_cbufs; i++) {
- struct pipe_surface *cbuf = scene->fb.cbufs[i];
- llvmpipe_resource_unmap(cbuf->texture,
- cbuf->face,
- cbuf->level,
- cbuf->zslice);
- }
-
- /* Unmap z/stencil buffer */
- if (rast->zsbuf.map) {
- struct pipe_surface *zsbuf = scene->fb.zsbuf;
- llvmpipe_resource_unmap(zsbuf->texture,
- zsbuf->face,
- zsbuf->level,
- zsbuf->zslice);
- rast->zsbuf.map = NULL;
- }
-
- lp_scene_reset( rast->curr_scene );
+ lp_scene_end_rasterization( rast->curr_scene );
rast->curr_scene = NULL;
@@ -138,26 +90,23 @@ lp_rast_end( struct lp_rasterizer *rast )
*/
static void
lp_rast_tile_begin(struct lp_rasterizer_task *task,
- unsigned x, unsigned y)
+ const struct cmd_bin *bin)
{
- struct lp_rasterizer *rast = task->rast;
- struct lp_scene *scene = rast->curr_scene;
+ const struct lp_scene *scene = task->scene;
enum lp_texture_usage usage;
- LP_DBG(DEBUG_RAST, "%s %d,%d\n", __FUNCTION__, x, y);
-
- assert(x % TILE_SIZE == 0);
- assert(y % TILE_SIZE == 0);
+ LP_DBG(DEBUG_RAST, "%s %d,%d\n", __FUNCTION__, bin->x, bin->y);
- task->x = x;
- task->y = y;
+ task->bin = bin;
+ task->x = bin->x * TILE_SIZE;
+ task->y = bin->y * TILE_SIZE;
/* reset pointers to color tile(s) */
memset(task->color_tiles, 0, sizeof(task->color_tiles));
/* get pointer to depth/stencil tile */
{
- struct pipe_surface *zsbuf = rast->curr_scene->fb.zsbuf;
+ struct pipe_surface *zsbuf = task->scene->fb.zsbuf;
if (zsbuf) {
struct llvmpipe_resource *lpt = llvmpipe_resource(zsbuf->texture);
@@ -173,11 +122,14 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task,
zsbuf->face + zsbuf->zslice,
zsbuf->level,
usage,
- x, y);
+ task->x,
+ task->y);
/* Get actual pointer to the tile data. Note that depth/stencil
* data is tiled differently than color data.
*/
- task->depth_tile = lp_rast_get_depth_block_pointer(task, x, y);
+ task->depth_tile = lp_rast_get_depth_block_pointer(task,
+ task->x,
+ task->y);
assert(task->depth_tile);
}
@@ -192,11 +144,11 @@ lp_rast_tile_begin(struct lp_rasterizer_task *task,
* Clear the rasterizer's current color tile.
* This is a bin command called during bin processing.
*/
-void
+static void
lp_rast_clear_color(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
const uint8_t *clear_color = arg.clear_color;
unsigned i;
@@ -211,7 +163,7 @@ lp_rast_clear_color(struct lp_rasterizer_task *task,
clear_color[1] == clear_color[2] &&
clear_color[2] == clear_color[3]) {
/* clear to grayscale value {x, x, x, x} */
- for (i = 0; i < rast->state.nr_cbufs; i++) {
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
uint8_t *ptr =
lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
memset(ptr, clear_color[0], TILE_SIZE * TILE_SIZE * 4);
@@ -224,7 +176,7 @@ lp_rast_clear_color(struct lp_rasterizer_task *task,
* works.
*/
const unsigned chunk = TILE_SIZE / 4;
- for (i = 0; i < rast->state.nr_cbufs; i++) {
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
uint8_t *c =
lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
unsigned j;
@@ -246,22 +198,25 @@ lp_rast_clear_color(struct lp_rasterizer_task *task,
}
+
+
+
+
/**
* Clear the rasterizer's current z/stencil tile.
* This is a bin command called during bin processing.
*/
-void
+static void
lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
- struct lp_rasterizer *rast = task->rast;
- const struct lp_rast_clearzs *clearzs = arg.clear_zstencil;
- unsigned clear_value = clearzs->clearzs_value;
- unsigned clear_mask = clearzs->clearzs_mask;
+ const struct lp_scene *scene = task->scene;
+ unsigned clear_value = arg.clear_zstencil.value;
+ unsigned clear_mask = arg.clear_zstencil.mask;
const unsigned height = TILE_SIZE / TILE_VECTOR_HEIGHT;
const unsigned width = TILE_SIZE * TILE_VECTOR_HEIGHT;
- const unsigned block_size = rast->zsbuf.blocksize;
- const unsigned dst_stride = rast->zsbuf.stride * TILE_VECTOR_HEIGHT;
+ const unsigned block_size = scene->zsbuf.blocksize;
+ const unsigned dst_stride = scene->zsbuf.stride * TILE_VECTOR_HEIGHT;
uint8_t *dst;
unsigned i, j;
@@ -327,15 +282,13 @@ lp_rast_clear_zstencil(struct lp_rasterizer_task *task,
* threading/parallelism.
* This is a bin command which is stored in all bins.
*/
-void
-lp_rast_store_linear_color( struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
+static void
+lp_rast_store_linear_color( struct lp_rasterizer_task *task )
{
- struct lp_rasterizer *rast = task->rast;
- struct lp_scene *scene = rast->curr_scene;
+ const struct lp_scene *scene = task->scene;
unsigned buf;
- for (buf = 0; buf < rast->state.nr_cbufs; buf++) {
+ for (buf = 0; buf < scene->fb.nr_cbufs; buf++) {
struct pipe_surface *cbuf = scene->fb.cbufs[buf];
const unsigned face_slice = cbuf->face + cbuf->zslice;
const unsigned level = cbuf->level;
@@ -359,17 +312,22 @@ lp_rast_store_linear_color( struct lp_rasterizer_task *task,
* completely contained inside a triangle.
* This is a bin command called during bin processing.
*/
-void
+static void
lp_rast_shade_tile(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
const unsigned tile_x = task->x, tile_y = task->y;
unsigned x, y;
+ if (inputs->disable) {
+ /* This command was partially binned and has been disabled */
+ return;
+ }
+
LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
/* render the whole 64x64 tile in 4x4 chunks */
@@ -380,7 +338,7 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
unsigned i;
/* color buffer */
- for (i = 0; i < rast->state.nr_cbufs; i++)
+ for (i = 0; i < scene->fb.nr_cbufs; i++)
color[i] = lp_rast_get_color_block_pointer(task, i,
tile_x + x, tile_y + y);
@@ -410,17 +368,17 @@ lp_rast_shade_tile(struct lp_rasterizer_task *task,
* completely contained inside a triangle, and the shader is opaque.
* This is a bin command called during bin processing.
*/
-void
+static void
lp_rast_shade_tile_opaque(struct lp_rasterizer_task *task,
const union lp_rast_cmd_arg arg)
{
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
unsigned i;
LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
/* this will prevent converting the layout from tiled to linear */
- for (i = 0; i < rast->state.nr_cbufs; i++) {
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
(void)lp_rast_get_color_tile_pointer(task, i, LP_TEX_USAGE_WRITE_ALL);
}
@@ -442,7 +400,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task,
{
const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
void *depth;
unsigned i;
@@ -457,7 +415,7 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task,
assert((y % 4) == 0);
/* color buffer */
- for (i = 0; i < rast->state.nr_cbufs; i++) {
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
color[i] = lp_rast_get_color_block_pointer(task, i, x, y);
assert(lp_check_alignment(color[i], 16));
}
@@ -486,6 +444,38 @@ lp_rast_shade_quads_mask(struct lp_rasterizer_task *task,
/**
+ * Begin a new occlusion query.
+ * This is a bin command put in all bins.
+ * Called per thread.
+ */
+static void
+lp_rast_begin_query(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ struct llvmpipe_query *pq = arg.query_obj;
+
+ assert(task->query == NULL);
+ task->vis_counter = 0;
+ task->query = pq;
+}
+
+
+/**
+ * End the current occlusion query.
+ * This is a bin command put in all bins.
+ * Called per thread.
+ */
+static void
+lp_rast_end_query(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ task->query->count[task->thread_index] += task->vis_counter;
+ task->query = NULL;
+}
+
+
+
+/**
* Set top row and left column of the tile's pixels to white. For debugging.
*/
static void
@@ -546,10 +536,10 @@ lp_rast_tile_end(struct lp_rasterizer_task *task)
{
#ifdef DEBUG
if (LP_DEBUG & (DEBUG_SHOW_SUBTILES | DEBUG_SHOW_TILES)) {
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
unsigned buf;
- for (buf = 0; buf < rast->state.nr_cbufs; buf++) {
+ for (buf = 0; buf < scene->fb.nr_cbufs; buf++) {
uint8_t *color = lp_rast_get_color_block_pointer(task, buf,
task->x, task->y);
@@ -563,83 +553,56 @@ lp_rast_tile_end(struct lp_rasterizer_task *task)
(void) outline_subtiles;
#endif
- {
+ lp_rast_store_linear_color(task);
+
+ if (task->query) {
union lp_rast_cmd_arg dummy = {0};
- lp_rast_store_linear_color(task, dummy);
+ lp_rast_end_query(task, dummy);
}
/* debug */
memset(task->color_tiles, 0, sizeof(task->color_tiles));
task->depth_tile = NULL;
-}
-
-
-
-/**
- * Signal on a fence. This is called during bin execution/rasterization.
- * Called per thread.
- */
-void
-lp_rast_fence(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
-{
- struct lp_fence *fence = arg.fence;
- lp_fence_signal(fence);
-}
-
-/**
- * Begin a new occlusion query.
- * This is a bin command put in all bins.
- * Called per thread.
- */
-void
-lp_rast_begin_query(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
-{
- /* Reset the per-task counter */
- task->vis_counter = 0;
+ task->bin = NULL;
}
-
-/**
- * End the current occlusion query.
- * This is a bin command put in all bins.
- * Called per thread.
- */
-void
-lp_rast_end_query(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg)
+static lp_rast_cmd_func dispatch[LP_RAST_OP_MAX] =
{
- struct llvmpipe_query *pq = arg.query_obj;
-
- pipe_mutex_lock(pq->mutex);
- {
- /* Accumulate the visible fragment counter from this tile in
- * the query object.
- */
- pq->count[task->thread_index] += task->vis_counter;
+ lp_rast_clear_color,
+ lp_rast_clear_zstencil,
+ lp_rast_triangle_1,
+ lp_rast_triangle_2,
+ lp_rast_triangle_3,
+ lp_rast_triangle_4,
+ lp_rast_triangle_5,
+ lp_rast_triangle_6,
+ lp_rast_triangle_7,
+ lp_rast_triangle_8,
+ lp_rast_triangle_3_4,
+ lp_rast_triangle_3_16,
+ lp_rast_shade_tile,
+ lp_rast_shade_tile_opaque,
+ lp_rast_begin_query,
+ lp_rast_end_query,
+};
- /* check if this is the last tile in the scene */
- pq->tile_count++;
- if (pq->tile_count == pq->num_tiles) {
- uint i;
- /* sum the per-thread counters for the query */
- pq->result = 0;
- for (i = 0; i < LP_MAX_THREADS; i++) {
- pq->result += pq->count[i];
- }
+static void
+do_rasterize_bin(struct lp_rasterizer_task *task,
+ const struct cmd_bin *bin)
+{
+ const struct cmd_block *block;
+ unsigned k;
- /* reset counters (in case this query is re-used in the scene) */
- memset(pq->count, 0, sizeof(pq->count));
+ if (0)
+ lp_debug_bin(bin);
- pq->tile_count = 0;
- pq->binned = FALSE;
- pq->done = TRUE;
+ for (block = bin->head; block; block = block->next) {
+ for (k = 0; k < block->count; k++) {
+ dispatch[block->cmd[k]]( task, block->arg[k] );
}
}
- pipe_mutex_unlock(pq->mutex);
}
@@ -652,74 +615,26 @@ lp_rast_end_query(struct lp_rasterizer_task *task,
*/
static void
rasterize_bin(struct lp_rasterizer_task *task,
- const struct cmd_bin *bin,
- int x, int y)
+ const struct cmd_bin *bin )
{
- const struct cmd_block_list *commands = &bin->commands;
- struct cmd_block *block;
- unsigned k;
+ lp_rast_tile_begin( task, bin );
- lp_rast_tile_begin( task, x * TILE_SIZE, y * TILE_SIZE );
-
- /* simply execute each of the commands in the block list */
- for (block = commands->head; block; block = block->next) {
- for (k = 0; k < block->count; k++) {
- block->cmd[k]( task, block->arg[k] );
- }
- }
+ do_rasterize_bin(task, bin);
lp_rast_tile_end(task);
- /* Free data for this bin.
- */
- lp_scene_bin_reset( task->rast->curr_scene, x, y);
-}
-
-#define RAST(x) { lp_rast_##x, #x }
-
-static struct {
- lp_rast_cmd cmd;
- const char *name;
-} cmd_names[] =
-{
- RAST(clear_color),
- RAST(clear_zstencil),
- RAST(triangle_1),
- RAST(triangle_2),
- RAST(triangle_3),
- RAST(triangle_4),
- RAST(triangle_5),
- RAST(triangle_6),
- RAST(triangle_7),
- RAST(shade_tile),
- RAST(shade_tile_opaque),
- RAST(store_linear_color),
- RAST(fence),
- RAST(begin_query),
- RAST(end_query),
-};
-
-static void
-debug_bin( const struct cmd_bin *bin )
-{
- const struct cmd_block *head = bin->commands.head;
- int i, j;
-
- for (i = 0; i < head->count; i++) {
- debug_printf("%d: ", i);
- for (j = 0; j < Elements(cmd_names); j++) {
- if (head->cmd[i] == cmd_names[j].cmd) {
- debug_printf("%s\n", cmd_names[j].name);
- break;
- }
- }
- if (j == Elements(cmd_names))
- debug_printf("...other\n");
+ /* Debug/Perf flags:
+ */
+ if (bin->head->count == 1) {
+ if (bin->head->cmd[0] == LP_RAST_OP_SHADE_TILE_OPAQUE)
+ LP_COUNT(nr_pure_shade_opaque_64);
+ else if (bin->head->cmd[0] == LP_RAST_OP_SHADE_TILE)
+ LP_COUNT(nr_pure_shade_64);
}
-
}
+
/* An empty bin is one that just loads the contents of the tile and
* stores them again unchanged. This typically happens when bins have
* been flushed for some reason in the middle of a frame, or when
@@ -730,12 +645,10 @@ debug_bin( const struct cmd_bin *bin )
static boolean
is_empty_bin( const struct cmd_bin *bin )
{
- if (0) debug_bin(bin);
- return bin->commands.head->count == 0;
+ return bin->head == NULL;
}
-
/**
* Rasterize/execute all bins within a scene.
* Called per thread.
@@ -744,6 +657,7 @@ static void
rasterize_scene(struct lp_rasterizer_task *task,
struct lp_scene *scene)
{
+ task->scene = scene;
/* loop over scene bins, rasterize each */
#if 0
{
@@ -758,19 +672,20 @@ rasterize_scene(struct lp_rasterizer_task *task,
#else
{
struct cmd_bin *bin;
- int x, y;
assert(scene);
- while ((bin = lp_scene_bin_iter_next(scene, &x, &y))) {
+ while ((bin = lp_scene_bin_iter_next(scene))) {
if (!is_empty_bin( bin ))
- rasterize_bin(task, bin, x, y);
+ rasterize_bin(task, bin);
}
}
#endif
if (scene->fence) {
- lp_rast_fence(task, lp_rast_arg_fence(scene->fence));
+ lp_fence_signal(scene->fence);
}
+
+ task->scene = NULL;
}
@@ -790,8 +705,6 @@ lp_rast_queue_scene( struct lp_rasterizer *rast,
rasterize_scene( &rast->tasks[0], scene );
- lp_scene_reset( scene );
-
lp_rast_end( rast );
rast->curr_scene = NULL;
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h
index b4564ef33b..5767667935 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast.h
@@ -79,6 +79,8 @@ struct lp_rast_state {
*/
struct lp_rast_shader_inputs {
float facing; /** Positive for front-facing, negative for back-facing */
+ boolean disable:1; /** Partially binned, disable this command */
+ boolean opaque:1; /** Is opaque */
float (*a0)[4];
float (*dadx)[4];
@@ -87,10 +89,6 @@ struct lp_rast_shader_inputs {
const struct lp_rast_state *state;
};
-struct lp_rast_clearzs {
- unsigned clearzs_value;
- unsigned clearzs_mask;
-};
struct lp_rast_plane {
/* one-pixel sized trivial accept offsets for each plane */
@@ -150,7 +148,10 @@ union lp_rast_cmd_arg {
} triangle;
const struct lp_rast_state *set_state;
uint8_t clear_color[4];
- const struct lp_rast_clearzs *clear_zstencil;
+ struct {
+ unsigned value;
+ unsigned mask;
+ } clear_zstencil;
struct lp_fence *fence;
struct llvmpipe_query *query_obj;
};
@@ -194,10 +195,20 @@ lp_rast_arg_fence( struct lp_fence *fence )
static INLINE union lp_rast_cmd_arg
-lp_rast_arg_clearzs( const struct lp_rast_clearzs *clearzs )
+lp_rast_arg_clearzs( unsigned value, unsigned mask )
{
union lp_rast_cmd_arg arg;
- arg.clear_zstencil = clearzs;
+ arg.clear_zstencil.value = value;
+ arg.clear_zstencil.mask = mask;
+ return arg;
+}
+
+
+static INLINE union lp_rast_cmd_arg
+lp_rast_arg_query( struct llvmpipe_query *pq )
+{
+ union lp_rast_cmd_arg arg;
+ arg.query_obj = pq;
return arg;
}
@@ -215,52 +226,32 @@ lp_rast_arg_null( void )
* These get put into bins by the setup code and are called when
* the bins are executed.
*/
+#define LP_RAST_OP_CLEAR_COLOR 0x0
+#define LP_RAST_OP_CLEAR_ZSTENCIL 0x1
+#define LP_RAST_OP_TRIANGLE_1 0x2
+#define LP_RAST_OP_TRIANGLE_2 0x3
+#define LP_RAST_OP_TRIANGLE_3 0x4
+#define LP_RAST_OP_TRIANGLE_4 0x5
+#define LP_RAST_OP_TRIANGLE_5 0x6
+#define LP_RAST_OP_TRIANGLE_6 0x7
+#define LP_RAST_OP_TRIANGLE_7 0x8
+#define LP_RAST_OP_TRIANGLE_8 0x9
+#define LP_RAST_OP_TRIANGLE_3_4 0xa
+#define LP_RAST_OP_TRIANGLE_3_16 0xb
+#define LP_RAST_OP_SHADE_TILE 0xc
+#define LP_RAST_OP_SHADE_TILE_OPAQUE 0xd
+#define LP_RAST_OP_BEGIN_QUERY 0xe
+#define LP_RAST_OP_END_QUERY 0xf
+
+#define LP_RAST_OP_MAX 0x10
+#define LP_RAST_OP_MASK 0xff
-void lp_rast_clear_color( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_clear_zstencil( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_triangle_1( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_2( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_3( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_4( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_5( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_6( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_7( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-void lp_rast_triangle_8( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_shade_tile( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_shade_tile_opaque( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_fence( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_store_linear_color( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-
-void lp_rast_begin_query(struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
-void lp_rast_end_query(struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
-
void
-lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
- const union lp_rast_cmd_arg arg);
+lp_debug_bins( struct lp_scene *scene );
+void
+lp_debug_draw_bins_by_cmd_length( struct lp_scene *scene );
+void
+lp_debug_draw_bins_by_coverage( struct lp_scene *scene );
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_debug.c b/src/gallium/drivers/llvmpipe/lp_rast_debug.c
new file mode 100644
index 0000000000..9fc78645a3
--- /dev/null
+++ b/src/gallium/drivers/llvmpipe/lp_rast_debug.c
@@ -0,0 +1,410 @@
+#include "util/u_math.h"
+#include "lp_rast_priv.h"
+#include "lp_state_fs.h"
+
+static INLINE int u_bit_scan(unsigned *mask)
+{
+ int i = ffs(*mask) - 1;
+ *mask &= ~(1 << i);
+ return i;
+}
+
+struct tile {
+ int coverage;
+ int overdraw;
+ char data[TILE_SIZE][TILE_SIZE];
+};
+
+static char get_label( int i )
+{
+ static const char *cmd_labels = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ unsigned max_label = (2*26+10);
+
+ if (i < max_label)
+ return cmd_labels[i];
+ else
+ return '?';
+}
+
+
+
+static const char *cmd_names[LP_RAST_OP_MAX] =
+{
+ "clear_color",
+ "clear_zstencil",
+ "triangle_1",
+ "triangle_2",
+ "triangle_3",
+ "triangle_4",
+ "triangle_5",
+ "triangle_6",
+ "triangle_7",
+ "triangle_8",
+ "triangle_3_4",
+ "triangle_3_16",
+ "shade_tile",
+ "shade_tile_opaque",
+ "begin_query",
+ "end_query",
+};
+
+static const char *cmd_name(unsigned cmd)
+{
+ assert(Elements(cmd_names) > cmd);
+ return cmd_names[cmd];
+}
+
+static const struct lp_fragment_shader_variant *
+get_variant( const struct cmd_block *block,
+ int k )
+{
+ if (block->cmd[k] == LP_RAST_OP_SHADE_TILE ||
+ block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE)
+ return block->arg[k].shade_tile->state->variant;
+
+ if (block->cmd[k] == LP_RAST_OP_TRIANGLE_1 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_2 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_3 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_4 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_5 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_6 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_7)
+ return block->arg[k].triangle.tri->inputs.state->variant;
+
+ return NULL;
+}
+
+
+static boolean
+is_blend( const struct cmd_block *block,
+ int k )
+{
+ const struct lp_fragment_shader_variant *variant = get_variant(block, k);
+
+ if (variant)
+ return variant->key.blend.rt[0].blend_enable;
+
+ return FALSE;
+}
+
+
+
+static void
+debug_bin( const struct cmd_bin *bin )
+{
+ const struct cmd_block *head = bin->head;
+ int i, j = 0;
+
+ debug_printf("bin %d,%d:\n", bin->x, bin->y);
+
+ while (head) {
+ for (i = 0; i < head->count; i++, j++) {
+ debug_printf("%d: %s %s\n", j,
+ cmd_name(head->cmd[i]),
+ is_blend(head, i) ? "blended" : "");
+ }
+ head = head->next;
+ }
+}
+
+
+static void plot(struct tile *tile,
+ int x, int y,
+ char val,
+ boolean blend)
+{
+ if (tile->data[x][y] == ' ')
+ tile->coverage++;
+ else
+ tile->overdraw++;
+
+ tile->data[x][y] = val;
+}
+
+
+
+
+
+
+static int
+debug_shade_tile(int x, int y,
+ const union lp_rast_cmd_arg arg,
+ struct tile *tile,
+ char val)
+{
+ const struct lp_rast_shader_inputs *inputs = arg.shade_tile;
+ boolean blend = inputs->state->variant->key.blend.rt[0].blend_enable;
+ unsigned i,j;
+
+ if (inputs->disable)
+ return 0;
+
+ for (i = 0; i < TILE_SIZE; i++)
+ for (j = 0; j < TILE_SIZE; j++)
+ plot(tile, i, j, val, blend);
+
+ return TILE_SIZE * TILE_SIZE;
+}
+
+static int
+debug_clear_tile(int x, int y,
+ const union lp_rast_cmd_arg arg,
+ struct tile *tile,
+ char val)
+{
+ unsigned i,j;
+
+ for (i = 0; i < TILE_SIZE; i++)
+ for (j = 0; j < TILE_SIZE; j++)
+ plot(tile, i, j, val, FALSE);
+
+ return TILE_SIZE * TILE_SIZE;
+
+}
+
+
+static int
+debug_triangle(int tilex, int tiley,
+ const union lp_rast_cmd_arg arg,
+ struct tile *tile,
+ char val)
+{
+ const struct lp_rast_triangle *tri = arg.triangle.tri;
+ unsigned plane_mask = arg.triangle.plane_mask;
+ struct lp_rast_plane plane[8];
+ int x, y;
+ int count = 0;
+ unsigned i, nr_planes = 0;
+ boolean blend = tri->inputs.state->variant->key.blend.rt[0].blend_enable;
+
+ if (tri->inputs.disable) {
+ /* This triangle was partially binned and has been disabled */
+ return 0;
+ }
+
+ while (plane_mask) {
+ plane[nr_planes] = tri->plane[u_bit_scan(&plane_mask)];
+ plane[nr_planes].c = (plane[nr_planes].c +
+ plane[nr_planes].dcdy * tiley -
+ plane[nr_planes].dcdx * tilex);
+ nr_planes++;
+ }
+
+ for(y = 0; y < TILE_SIZE; y++)
+ {
+ for(x = 0; x < TILE_SIZE; x++)
+ {
+ for (i = 0; i < nr_planes; i++)
+ if (plane[i].c <= 0)
+ goto out;
+
+ plot(tile, x, y, val, blend);
+ count++;
+
+ out:
+ for (i = 0; i < nr_planes; i++)
+ plane[i].c -= plane[i].dcdx;
+ }
+
+ for (i = 0; i < nr_planes; i++) {
+ plane[i].c += plane[i].dcdx * TILE_SIZE;
+ plane[i].c += plane[i].dcdy;
+ }
+ }
+ return count;
+}
+
+
+
+
+
+static void
+do_debug_bin( struct tile *tile,
+ const struct cmd_bin *bin,
+ boolean print_cmds)
+{
+ unsigned k, j = 0;
+ const struct cmd_block *block;
+
+ int tx = bin->x * TILE_SIZE;
+ int ty = bin->y * TILE_SIZE;
+
+ memset(tile->data, ' ', sizeof tile->data);
+ tile->coverage = 0;
+ tile->overdraw = 0;
+
+ for (block = bin->head; block; block = block->next) {
+ for (k = 0; k < block->count; k++, j++) {
+ boolean blend = is_blend(block, k);
+ char val = get_label(j);
+ int count = 0;
+
+ if (print_cmds)
+ debug_printf("%c: %15s", val, cmd_name(block->cmd[k]));
+
+ if (block->cmd[k] == LP_RAST_OP_CLEAR_COLOR ||
+ block->cmd[k] == LP_RAST_OP_CLEAR_ZSTENCIL)
+ count = debug_clear_tile(tx, ty, block->arg[k], tile, val);
+
+ if (block->cmd[k] == LP_RAST_OP_SHADE_TILE ||
+ block->cmd[k] == LP_RAST_OP_SHADE_TILE_OPAQUE)
+ count = debug_shade_tile(tx, ty, block->arg[k], tile, val);
+
+ if (block->cmd[k] == LP_RAST_OP_TRIANGLE_1 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_2 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_3 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_4 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_5 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_6 ||
+ block->cmd[k] == LP_RAST_OP_TRIANGLE_7)
+ count = debug_triangle(tx, ty, block->arg[k], tile, val);
+
+ if (print_cmds) {
+ debug_printf(" % 5d", count);
+
+ if (blend)
+ debug_printf(" blended");
+
+ debug_printf("\n");
+ }
+ }
+ }
+}
+
+void
+lp_debug_bin( const struct cmd_bin *bin)
+{
+ struct tile tile;
+ int x,y;
+
+ if (bin->head) {
+ do_debug_bin(&tile, bin, TRUE);
+
+ debug_printf("------------------------------------------------------------------\n");
+ for (y = 0; y < TILE_SIZE; y++) {
+ for (x = 0; x < TILE_SIZE; x++) {
+ debug_printf("%c", tile.data[y][x]);
+ }
+ debug_printf("|\n");
+ }
+ debug_printf("------------------------------------------------------------------\n");
+
+ debug_printf("each pixel drawn avg %f times\n",
+ ((float)tile.overdraw + tile.coverage)/(float)tile.coverage);
+ }
+}
+
+
+
+
+
+
+/** Return number of bytes used for a single bin */
+static unsigned
+lp_scene_bin_size( const struct lp_scene *scene, unsigned x, unsigned y )
+{
+ struct cmd_bin *bin = lp_scene_get_bin((struct lp_scene *) scene, x, y);
+ const struct cmd_block *cmd;
+ unsigned size = 0;
+ for (cmd = bin->head; cmd; cmd = cmd->next) {
+ size += (cmd->count *
+ (sizeof(uint8_t) + sizeof(union lp_rast_cmd_arg)));
+ }
+ return size;
+}
+
+
+
+void
+lp_debug_draw_bins_by_coverage( struct lp_scene *scene )
+{
+ unsigned x, y;
+ unsigned total = 0;
+ unsigned possible = 0;
+ static unsigned long long _total;
+ static unsigned long long _possible;
+
+ for (x = 0; x < scene->tiles_x; x++)
+ debug_printf("-");
+ debug_printf("\n");
+
+ for (y = 0; y < scene->tiles_y; y++) {
+ for (x = 0; x < scene->tiles_x; x++) {
+ struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
+ const char *bits = "0123456789";
+ struct tile tile;
+
+ if (bin->head) {
+ //lp_debug_bin(bin);
+
+ do_debug_bin(&tile, bin, FALSE);
+
+ total += tile.coverage;
+ possible += 64*64;
+
+ if (tile.coverage == 64*64)
+ debug_printf("*");
+ else if (tile.coverage) {
+ int bit = tile.coverage/(64.0*64.0)*10;
+ debug_printf("%c", bits[MIN2(bit,10)]);
+ }
+ else
+ debug_printf("?");
+ }
+ else {
+ debug_printf(" ");
+ }
+ }
+ debug_printf("|\n");
+ }
+
+ for (x = 0; x < scene->tiles_x; x++)
+ debug_printf("-");
+ debug_printf("\n");
+
+ debug_printf("this tile total: %u possible %u: percentage: %f\n",
+ total,
+ possible,
+ total * 100.0 / (float)possible);
+
+ _total += total;
+ _possible += possible;
+
+ debug_printf("overall total: %llu possible %llu: percentage: %f\n",
+ _total,
+ _possible,
+ _total * 100.0 / (double)_possible);
+}
+
+
+void
+lp_debug_draw_bins_by_cmd_length( struct lp_scene *scene )
+{
+ unsigned x, y;
+
+ for (y = 0; y < scene->tiles_y; y++) {
+ for (x = 0; x < scene->tiles_x; x++) {
+ const char *bits = " ...,-~:;=o+xaw*#XAWWWWWWWWWWWWWWWW";
+ int sz = lp_scene_bin_size(scene, x, y);
+ int sz2 = util_unsigned_logbase2(sz);
+ debug_printf("%c", bits[MIN2(sz2,32)]);
+ }
+ debug_printf("\n");
+ }
+}
+
+
+void
+lp_debug_bins( struct lp_scene *scene )
+{
+ unsigned x, y;
+
+ for (y = 0; y < scene->tiles_y; y++) {
+ for (x = 0; x < scene->tiles_x; x++) {
+ struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
+ if (bin->head) {
+ debug_bin(bin);
+ }
+ }
+ }
+}
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
index fae7f6d3dc..7370119e96 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h
@@ -69,13 +69,16 @@ extern const struct lp_rast_state *jit_state;
struct lp_rasterizer;
-
+struct cmd_bin;
/**
* Per-thread rasterization state
*/
struct lp_rasterizer_task
{
+ const struct cmd_bin *bin;
+
+ struct lp_scene *scene;
unsigned x, y; /**< Pos of this tile in framebuffer, in pixels */
uint8_t *color_tiles[PIPE_MAX_COLOR_BUFS];
@@ -89,6 +92,7 @@ struct lp_rasterizer_task
/* occlude counter for visiable pixels */
uint32_t vis_counter;
+ struct llvmpipe_query *query;
pipe_semaphore work_ready;
pipe_semaphore work_done;
@@ -104,33 +108,9 @@ struct lp_rasterizer
{
boolean exit_flag;
- /* Framebuffer stuff
- */
- struct {
- uint8_t *map;
- unsigned stride;
- unsigned blocksize;
- } zsbuf;
-
- struct {
- unsigned nr_cbufs;
- unsigned clear_color;
- unsigned clear_depth;
- char clear_stencil;
- } state;
-
/** The incoming queue of scenes ready to rasterize */
struct lp_scene_queue *full_scenes;
- /**
- * The outgoing queue of processed scenes to return to setup module
- *
- * XXX: while scenes are per-context but the rasterizer is
- * (potentially) shared, these empty scenes should be returned to
- * the context which created them rather than retained here.
- */
- /* struct lp_scene_queue *empty_scenes; */
-
/** The scene currently being rasterized by the threads */
struct lp_scene *curr_scene;
@@ -164,13 +144,13 @@ static INLINE void *
lp_rast_get_depth_block_pointer(struct lp_rasterizer_task *task,
unsigned x, unsigned y)
{
- const struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
void *depth;
assert((x % TILE_VECTOR_WIDTH) == 0);
assert((y % TILE_VECTOR_HEIGHT) == 0);
- if (!rast->zsbuf.map) {
+ if (!scene->zsbuf.map) {
/* Either out of memory or no zsbuf. Can't tell without access
* to the state. Just use dummy tile memory, but don't print
* the oom warning as this most likely because there is no
@@ -179,9 +159,9 @@ lp_rast_get_depth_block_pointer(struct lp_rasterizer_task *task,
return lp_dummy_tile;
}
- depth = (rast->zsbuf.map +
- rast->zsbuf.stride * y +
- rast->zsbuf.blocksize * x * TILE_VECTOR_HEIGHT);
+ depth = (scene->zsbuf.map +
+ scene->zsbuf.stride * y +
+ scene->zsbuf.blocksize * x * TILE_VECTOR_HEIGHT);
assert(lp_check_alignment(depth, 16));
return depth;
@@ -195,14 +175,14 @@ static INLINE uint8_t *
lp_rast_get_color_tile_pointer(struct lp_rasterizer_task *task,
unsigned buf, enum lp_texture_usage usage)
{
- struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
assert(task->x % TILE_SIZE == 0);
assert(task->y % TILE_SIZE == 0);
- assert(buf < rast->state.nr_cbufs);
+ assert(buf < scene->fb.nr_cbufs);
if (!task->color_tiles[buf]) {
- struct pipe_surface *cbuf = rast->curr_scene->fb.cbufs[buf];
+ struct pipe_surface *cbuf = scene->fb.cbufs[buf];
struct llvmpipe_resource *lpt;
assert(cbuf);
lpt = llvmpipe_resource(cbuf->texture);
@@ -263,7 +243,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
const struct lp_rast_shader_inputs *inputs,
unsigned x, unsigned y )
{
- const struct lp_rasterizer *rast = task->rast;
+ const struct lp_scene *scene = task->scene;
const struct lp_rast_state *state = inputs->state;
struct lp_fragment_shader_variant *variant = state->variant;
uint8_t *color[PIPE_MAX_COLOR_BUFS];
@@ -271,7 +251,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
unsigned i;
/* color buffer */
- for (i = 0; i < rast->state.nr_cbufs; i++)
+ for (i = 0; i < scene->fb.nr_cbufs; i++)
color[i] = lp_rast_get_color_block_pointer(task, i, x, y);
depth = lp_rast_get_depth_block_pointer(task, x, y);
@@ -291,5 +271,29 @@ lp_rast_shade_quads_all( struct lp_rasterizer_task *task,
END_JIT_CALL();
}
+void lp_rast_triangle_1( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_2( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_3( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_4( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_5( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_6( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_7( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void lp_rast_triangle_8( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+
+void lp_rast_triangle_3_4(struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+
+void lp_rast_triangle_3_16( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+void
+lp_debug_bin( const struct cmd_bin *bin );
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
index dbaa8e023a..a1f309d4b0 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c
@@ -68,36 +68,6 @@ block_full_16(struct lp_rasterizer_task *task,
}
#if !defined(PIPE_ARCH_SSE)
-static INLINE unsigned
-build_mask(int c, int dcdx, int dcdy)
-{
- int mask = 0;
-
- int c0 = c;
- int c1 = c0 + dcdx;
- int c2 = c1 + dcdx;
- int c3 = c2 + dcdx;
-
- mask |= ((c0 + 0 * dcdy) >> 31) & (1 << 0);
- mask |= ((c0 + 1 * dcdy) >> 31) & (1 << 2);
- mask |= ((c0 + 2 * dcdy) >> 31) & (1 << 8);
- mask |= ((c0 + 3 * dcdy) >> 31) & (1 << 10);
- mask |= ((c1 + 0 * dcdy) >> 31) & (1 << 1);
- mask |= ((c1 + 1 * dcdy) >> 31) & (1 << 3);
- mask |= ((c1 + 2 * dcdy) >> 31) & (1 << 9);
- mask |= ((c1 + 3 * dcdy) >> 31) & (1 << 11);
- mask |= ((c2 + 0 * dcdy) >> 31) & (1 << 4);
- mask |= ((c2 + 1 * dcdy) >> 31) & (1 << 6);
- mask |= ((c2 + 2 * dcdy) >> 31) & (1 << 12);
- mask |= ((c2 + 3 * dcdy) >> 31) & (1 << 14);
- mask |= ((c3 + 0 * dcdy) >> 31) & (1 << 5);
- mask |= ((c3 + 1 * dcdy) >> 31) & (1 << 7);
- mask |= ((c3 + 2 * dcdy) >> 31) & (1 << 13);
- mask |= ((c3 + 3 * dcdy) >> 31) & (1 << 15);
-
- return mask;
-}
-
static INLINE unsigned
build_mask_linear(int c, int dcdx, int dcdy)
@@ -142,6 +112,23 @@ build_masks(int c,
*partmask |= build_mask_linear(c + cdiff, dcdx, dcdy);
}
+void
+lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ union lp_rast_cmd_arg arg2;
+ arg2.triangle.tri = arg.triangle.tri;
+ arg2.triangle.plane_mask = (1<<3)-1;
+ lp_rast_triangle_3(task, arg2);
+}
+
+void
+lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ lp_rast_triangle_3_16(task, arg);
+}
+
#else
#include <emmintrin.h>
#include "util/u_sse.h"
@@ -220,79 +207,28 @@ build_mask_linear(int c, int dcdx, int dcdy)
}
static INLINE unsigned
-build_mask(int c, int dcdx, int dcdy)
+sign_bits4(const __m128i *cstep, int cdiff)
{
- __m128i step = _mm_setr_epi32(0, dcdx, dcdy, dcdx + dcdy);
- __m128i c0 = _mm_set1_epi32(c);
-
- /* Get values across the quad
- */
- __m128i cstep0 = _mm_add_epi32(c0, step);
-
- /* Scale up step for moving between quads.
- */
- __m128i step4 = _mm_add_epi32(step, step);
- /* Get values for the remaining quads:
+ /* Adjust the step values
*/
- __m128i cstep1 = _mm_add_epi32(cstep0,
- _mm_shuffle_epi32(step4, _MM_SHUFFLE(1,1,1,1)));
- __m128i cstep2 = _mm_add_epi32(cstep0,
- _mm_shuffle_epi32(step4, _MM_SHUFFLE(2,2,2,2)));
- __m128i cstep3 = _mm_add_epi32(cstep2,
- _mm_shuffle_epi32(step4, _MM_SHUFFLE(1,1,1,1)));
+ __m128i cio4 = _mm_set1_epi32(cdiff);
+ __m128i cstep0 = _mm_add_epi32(cstep[0], cio4);
+ __m128i cstep1 = _mm_add_epi32(cstep[1], cio4);
+ __m128i cstep2 = _mm_add_epi32(cstep[2], cio4);
+ __m128i cstep3 = _mm_add_epi32(cstep[3], cio4);
- /* pack pairs of results into epi16
+ /* Pack down to epi8
*/
__m128i cstep01 = _mm_packs_epi32(cstep0, cstep1);
__m128i cstep23 = _mm_packs_epi32(cstep2, cstep3);
-
- /* pack into epi8, preserving sign bits
- */
__m128i result = _mm_packs_epi16(cstep01, cstep23);
- /* extract sign bits to create mask
+ /* Extract the sign bits
*/
return _mm_movemask_epi8(result);
}
-#endif
-
-
-
-
-#define TAG(x) x##_1
-#define NR_PLANES 1
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_2
-#define NR_PLANES 2
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_3
-#define NR_PLANES 3
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_4
-#define NR_PLANES 4
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_5
-#define NR_PLANES 5
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_6
-#define NR_PLANES 6
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_7
-#define NR_PLANES 7
-#include "lp_rast_tri_tmp.h"
-
-#define TAG(x) x##_8
-#define NR_PLANES 8
-#include "lp_rast_tri_tmp.h"
-
/* Special case for 3 plane triangle which is contained entirely
* within a 16x16 block.
@@ -304,29 +240,32 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
const struct lp_rast_triangle *tri = arg.triangle.tri;
const struct lp_rast_plane *plane = tri->plane;
unsigned mask = arg.triangle.plane_mask;
- const int x = task->x + (mask & 0xf) * 16;
- const int y = task->y + (mask >> 4) * 16;
+ const int x = task->x + (mask & 0xff);
+ const int y = task->y + (mask >> 8);
unsigned outmask, inmask, partmask, partial_mask;
unsigned j;
- int c[3];
+ __m128i cstep4[3][4];
outmask = 0; /* outside one or more trivial reject planes */
partmask = 0; /* outside one or more trivial accept planes */
for (j = 0; j < 3; j++) {
- c[j] = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x;
+ const int dcdx = -plane[j].dcdx * 4;
+ const int dcdy = plane[j].dcdy * 4;
+ __m128i xdcdy = _mm_set1_epi32(dcdy);
+
+ cstep4[j][0] = _mm_setr_epi32(0, dcdx, dcdx*2, dcdx*3);
+ cstep4[j][1] = _mm_add_epi32(cstep4[j][0], xdcdy);
+ cstep4[j][2] = _mm_add_epi32(cstep4[j][1], xdcdy);
+ cstep4[j][3] = _mm_add_epi32(cstep4[j][2], xdcdy);
{
- const int dcdx = -plane[j].dcdx * 4;
- const int dcdy = plane[j].dcdy * 4;
+ const int c = plane[j].c + plane[j].dcdy * y - plane[j].dcdx * x;
const int cox = plane[j].eo * 4;
const int cio = plane[j].ei * 4 - 1;
- build_masks(c[j] + cox,
- cio - cox,
- dcdx, dcdy,
- &outmask, /* sign bits from c[i][0..15] + cox */
- &partmask); /* sign bits from c[i][0..15] + cio */
+ outmask |= sign_bits4(cstep4[j], c + cox);
+ partmask |= sign_bits4(cstep4[j], c + cio);
}
}
@@ -352,16 +291,20 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
int iy = (i >> 2) * 4;
int px = x + ix;
int py = y + iy;
- int cx[3];
+ unsigned mask = 0xffff;
partial_mask &= ~(1 << i);
- for (j = 0; j < 3; j++)
- cx[j] = (c[j]
- - plane[j].dcdx * ix
- + plane[j].dcdy * iy);
+ for (j = 0; j < 3; j++) {
+ const int cx = (plane[j].c
+ - plane[j].dcdx * px
+ + plane[j].dcdy * py) * 4;
+
+ mask &= ~sign_bits4(cstep4[j], cx);
+ }
- do_block_4_3(task, tri, plane, px, py, cx);
+ if (mask)
+ lp_rast_shade_quads_mask(task, &tri->inputs, px, py, mask);
}
/* Iterate over fulls:
@@ -378,3 +321,87 @@ lp_rast_triangle_3_16(struct lp_rasterizer_task *task,
block_full_4(task, tri, px, py);
}
}
+
+
+void
+lp_rast_triangle_3_4(struct lp_rasterizer_task *task,
+ const union lp_rast_cmd_arg arg)
+{
+ const struct lp_rast_triangle *tri = arg.triangle.tri;
+ const struct lp_rast_plane *plane = tri->plane;
+ unsigned mask = arg.triangle.plane_mask;
+ const int x = task->x + (mask & 0xff);
+ const int y = task->y + (mask >> 8);
+ unsigned j;
+
+ /* Iterate over partials:
+ */
+ {
+ unsigned mask = 0xffff;
+
+ for (j = 0; j < 3; j++) {
+ const int cx = (plane[j].c
+ - plane[j].dcdx * x
+ + plane[j].dcdy * y);
+
+ const int dcdx = -plane[j].dcdx;
+ const int dcdy = plane[j].dcdy;
+ __m128i xdcdy = _mm_set1_epi32(dcdy);
+
+ __m128i cstep0 = _mm_setr_epi32(cx, cx + dcdx, cx + dcdx*2, cx + dcdx*3);
+ __m128i cstep1 = _mm_add_epi32(cstep0, xdcdy);
+ __m128i cstep2 = _mm_add_epi32(cstep1, xdcdy);
+ __m128i cstep3 = _mm_add_epi32(cstep2, xdcdy);
+
+ __m128i cstep01 = _mm_packs_epi32(cstep0, cstep1);
+ __m128i cstep23 = _mm_packs_epi32(cstep2, cstep3);
+ __m128i result = _mm_packs_epi16(cstep01, cstep23);
+
+ /* Extract the sign bits
+ */
+ mask &= ~_mm_movemask_epi8(result);
+ }
+
+ if (mask)
+ lp_rast_shade_quads_mask(task, &tri->inputs, x, y, mask);
+ }
+}
+
+
+#endif
+
+
+
+
+#define TAG(x) x##_1
+#define NR_PLANES 1
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_2
+#define NR_PLANES 2
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_3
+#define NR_PLANES 3
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_4
+#define NR_PLANES 4
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_5
+#define NR_PLANES 5
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_6
+#define NR_PLANES 6
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_7
+#define NR_PLANES 7
+#include "lp_rast_tri_tmp.h"
+
+#define TAG(x) x##_8
+#define NR_PLANES 8
+#include "lp_rast_tri_tmp.h"
+
diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
index 99a0bae45d..9830a43ba5 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
+++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h
@@ -50,9 +50,9 @@ TAG(do_block_4)(struct lp_rasterizer_task *task,
int j;
for (j = 0; j < NR_PLANES; j++) {
- mask &= ~build_mask(c[j] - 1,
- -plane[j].dcdx,
- plane[j].dcdy);
+ mask &= ~build_mask_linear(c[j] - 1,
+ -plane[j].dcdx,
+ plane[j].dcdy);
}
/* Now pass to the shader:
@@ -162,6 +162,11 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task,
unsigned outmask, inmask, partmask, partial_mask;
unsigned j = 0;
+ if (tri->inputs.disable) {
+ /* This triangle was partially binned and has been disabled */
+ return;
+ }
+
outmask = 0; /* outside one or more trivial reject planes */
partmask = 0; /* outside one or more trivial accept planes */
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 15a09b7100..c0732e4ab7 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -30,17 +30,20 @@
#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_simple_list.h"
+#include "util/u_format.h"
#include "lp_scene.h"
-#include "lp_scene_queue.h"
#include "lp_fence.h"
+#include "lp_debug.h"
-/** List of texture references */
-struct texture_ref {
- struct pipe_resource *texture;
- struct texture_ref *prev, *next; /**< linked list w/ u_simple_list.h */
-};
+#define RESOURCE_REF_SZ 32
+/** List of resource references */
+struct resource_ref {
+ struct pipe_resource *resource[RESOURCE_REF_SZ];
+ int count;
+ struct resource_ref *next;
+};
/**
@@ -48,28 +51,16 @@ struct texture_ref {
* \param queue the queue to put newly rendered/emptied scenes into
*/
struct lp_scene *
-lp_scene_create( struct pipe_context *pipe,
- struct lp_scene_queue *queue )
+lp_scene_create( struct pipe_context *pipe )
{
- unsigned i, j;
struct lp_scene *scene = CALLOC_STRUCT(lp_scene);
if (!scene)
return NULL;
scene->pipe = pipe;
- scene->empty_queue = queue;
-
- for (i = 0; i < TILES_X; i++) {
- for (j = 0; j < TILES_Y; j++) {
- struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
- bin->commands.head = bin->commands.tail = CALLOC_STRUCT(cmd_block);
- }
- }
scene->data.head =
- scene->data.tail = CALLOC_STRUCT(data_block);
-
- make_empty_list(&scene->resources);
+ CALLOC_STRUCT(data_block);
pipe_mutex_init(scene->mutex);
@@ -83,24 +74,9 @@ lp_scene_create( struct pipe_context *pipe,
void
lp_scene_destroy(struct lp_scene *scene)
{
- unsigned i, j;
-
- lp_scene_reset(scene);
-
- for (i = 0; i < TILES_X; i++)
- for (j = 0; j < TILES_Y; j++) {
- struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
- assert(bin->commands.head == bin->commands.tail);
- FREE(bin->commands.head);
- bin->commands.head = NULL;
- bin->commands.tail = NULL;
- }
-
- FREE(scene->data.head);
- scene->data.head = NULL;
-
pipe_mutex_destroy(scene->mutex);
-
+ assert(scene->data.head->next == NULL);
+ FREE(scene->data.head);
FREE(scene);
}
@@ -117,8 +93,7 @@ lp_scene_is_empty(struct lp_scene *scene )
for (y = 0; y < TILES_Y; y++) {
for (x = 0; x < TILES_X; x++) {
const struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
- const struct cmd_block_list *list = &bin->commands;
- if (list->head != list->tail || list->head->count > 0) {
+ if (bin->head) {
return FALSE;
}
}
@@ -127,45 +102,108 @@ lp_scene_is_empty(struct lp_scene *scene )
}
-/* Free data for one particular bin. May be called from the
- * rasterizer thread(s).
+/* Returns true if there has ever been a failed allocation attempt in
+ * this scene. Used in triangle emit to avoid having to check success
+ * at each bin.
+ */
+boolean
+lp_scene_is_oom(struct lp_scene *scene)
+{
+ return scene->alloc_failed;
+}
+
+
+/* Remove all commands from a bin. Tries to reuse some of the memory
+ * allocated to the bin, however.
*/
void
lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y)
{
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
- struct cmd_block_list *list = &bin->commands;
- struct cmd_block *block;
- struct cmd_block *tmp;
- assert(x < TILES_X);
- assert(y < TILES_Y);
+ bin->head = bin->tail;
+ if (bin->tail) {
+ bin->tail->next = NULL;
+ bin->tail->count = 0;
+ }
+}
+
- for (block = list->head; block != list->tail; block = tmp) {
- tmp = block->next;
- FREE(block);
+void
+lp_scene_begin_rasterization(struct lp_scene *scene)
+{
+ const struct pipe_framebuffer_state *fb = &scene->fb;
+ int i;
+
+ //LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__);
+
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
+ struct pipe_surface *cbuf = scene->fb.cbufs[i];
+ scene->cbufs[i].stride = llvmpipe_resource_stride(cbuf->texture,
+ cbuf->level);
+
+ scene->cbufs[i].map = llvmpipe_resource_map(cbuf->texture,
+ cbuf->face,
+ cbuf->level,
+ cbuf->zslice,
+ LP_TEX_USAGE_READ_WRITE,
+ LP_TEX_LAYOUT_LINEAR);
}
- assert(list->tail->next == NULL);
- list->head = list->tail;
- list->head->count = 0;
+ if (fb->zsbuf) {
+ struct pipe_surface *zsbuf = scene->fb.zsbuf;
+ scene->zsbuf.stride = llvmpipe_resource_stride(zsbuf->texture, zsbuf->level);
+ scene->zsbuf.blocksize =
+ util_format_get_blocksize(zsbuf->texture->format);
+
+ scene->zsbuf.map = llvmpipe_resource_map(zsbuf->texture,
+ zsbuf->face,
+ zsbuf->level,
+ zsbuf->zslice,
+ LP_TEX_USAGE_READ_WRITE,
+ LP_TEX_LAYOUT_NONE);
+ }
}
+
+
/**
- * Free all the temporary data in a scene. May be called from the
- * rasterizer thread(s).
+ * Free all the temporary data in a scene.
*/
void
-lp_scene_reset(struct lp_scene *scene )
+lp_scene_end_rasterization(struct lp_scene *scene )
{
- unsigned i, j;
+ int i, j;
+
+ /* Unmap color buffers */
+ for (i = 0; i < scene->fb.nr_cbufs; i++) {
+ if (scene->cbufs[i].map) {
+ struct pipe_surface *cbuf = scene->fb.cbufs[i];
+ llvmpipe_resource_unmap(cbuf->texture,
+ cbuf->face,
+ cbuf->level,
+ cbuf->zslice);
+ scene->cbufs[i].map = NULL;
+ }
+ }
- /* Free all but last binner command lists:
+ /* Unmap z/stencil buffer */
+ if (scene->zsbuf.map) {
+ struct pipe_surface *zsbuf = scene->fb.zsbuf;
+ llvmpipe_resource_unmap(zsbuf->texture,
+ zsbuf->face,
+ zsbuf->level,
+ zsbuf->zslice);
+ scene->zsbuf.map = NULL;
+ }
+
+ /* Reset all command lists:
*/
for (i = 0; i < scene->tiles_x; i++) {
for (j = 0; j < scene->tiles_y; j++) {
- lp_scene_bin_reset(scene, i, j);
+ struct cmd_bin *bin = lp_scene_get_bin(scene, i, j);
+ bin->head = bin->tail = NULL;
}
}
@@ -174,40 +212,56 @@ lp_scene_reset(struct lp_scene *scene )
*/
assert(lp_scene_is_empty(scene));
- /* Free all but last binned data block:
+ /* Decrement texture ref counts
*/
{
- struct data_block_list *list = &scene->data;
- struct data_block *block, *tmp;
-
- for (block = list->head; block != list->tail; block = tmp) {
- tmp = block->next;
- FREE(block);
+ struct resource_ref *ref;
+ int i, j = 0;
+
+ for (ref = scene->resources; ref; ref = ref->next) {
+ for (i = 0; i < ref->count; i++) {
+ if (LP_DEBUG & DEBUG_SETUP)
+ debug_printf("resource %d: %p %dx%d sz %d\n",
+ j,
+ ref->resource[i],
+ ref->resource[i]->width0,
+ ref->resource[i]->height0,
+ llvmpipe_resource_size(ref->resource[i]));
+ j++;
+ pipe_resource_reference(&ref->resource[i], NULL);
+ }
}
-
- assert(list->tail->next == NULL);
- list->head = list->tail;
- list->head->used = 0;
+
+ if (LP_DEBUG & DEBUG_SETUP)
+ debug_printf("scene %d resources, sz %d\n",
+ j, scene->resource_reference_size);
}
- /* Release texture refs
+ /* Free all scene data blocks:
*/
{
- struct resource_ref *ref, *next, *ref_list = &scene->resources;
- for (ref = ref_list->next; ref != ref_list; ref = next) {
- next = next_elem(ref);
- pipe_resource_reference(&ref->resource, NULL);
- FREE(ref);
+ struct data_block_list *list = &scene->data;
+ struct data_block *block, *tmp;
+
+ for (block = list->head->next; block; block = tmp) {
+ tmp = block->next;
+ FREE(block);
}
- make_empty_list(ref_list);
+
+ list->head->next = NULL;
+ list->head->used = 0;
}
lp_fence_reference(&scene->fence, NULL);
+ scene->resources = NULL;
scene->scene_size = 0;
+ scene->resource_reference_size = 0;
- scene->has_color_clear = FALSE;
scene->has_depthstencil_clear = FALSE;
+ scene->alloc_failed = FALSE;
+
+ util_unreference_framebuffer_state( &scene->fb );
}
@@ -216,12 +270,20 @@ lp_scene_reset(struct lp_scene *scene )
struct cmd_block *
-lp_bin_new_cmd_block( struct cmd_block_list *list )
+lp_scene_new_cmd_block( struct lp_scene *scene,
+ struct cmd_bin *bin )
{
- struct cmd_block *block = MALLOC_STRUCT(cmd_block);
+ struct cmd_block *block = lp_scene_alloc(scene, sizeof(struct cmd_block));
if (block) {
- list->tail->next = block;
- list->tail = block;
+ if (bin->tail) {
+ bin->tail->next = block;
+ bin->tail = block;
+ }
+ else {
+ bin->head = block;
+ bin->tail = block;
+ }
+ //memset(block, 0, sizeof *block);
block->next = NULL;
block->count = 0;
}
@@ -230,16 +292,26 @@ lp_bin_new_cmd_block( struct cmd_block_list *list )
struct data_block *
-lp_bin_new_data_block( struct data_block_list *list )
+lp_scene_new_data_block( struct lp_scene *scene )
{
- struct data_block *block = MALLOC_STRUCT(data_block);
- if (block) {
- list->tail->next = block;
- list->tail = block;
- block->next = NULL;
+ if (scene->scene_size + DATA_BLOCK_SIZE > LP_SCENE_MAX_SIZE) {
+ if (0) debug_printf("%s: failed\n", __FUNCTION__);
+ scene->alloc_failed = TRUE;
+ return NULL;
+ }
+ else {
+ struct data_block *block = MALLOC_STRUCT(data_block);
+ if (block == NULL)
+ return NULL;
+
+ scene->scene_size += sizeof *block;
+
block->used = 0;
+ block->next = scene->data.head;
+ scene->data.head = block;
+
+ return block;
}
- return block;
}
@@ -247,7 +319,7 @@ lp_bin_new_data_block( struct data_block_list *list )
* Return number of bytes used for all bin data within a scene.
* This does not include resources (textures) referenced by the scene.
*/
-unsigned
+static unsigned
lp_scene_data_size( const struct lp_scene *scene )
{
unsigned size = 0;
@@ -259,36 +331,63 @@ lp_scene_data_size( const struct lp_scene *scene )
}
-/** Return number of bytes used for a single bin */
-unsigned
-lp_scene_bin_size( const struct lp_scene *scene, unsigned x, unsigned y )
-{
- struct cmd_bin *bin = lp_scene_get_bin((struct lp_scene *) scene, x, y);
- const struct cmd_block *cmd;
- unsigned size = 0;
- for (cmd = bin->commands.head; cmd; cmd = cmd->next) {
- size += (cmd->count *
- (sizeof(lp_rast_cmd) + sizeof(union lp_rast_cmd_arg)));
- }
- return size;
-}
-
/**
* Add a reference to a resource by the scene.
*/
-void
+boolean
lp_scene_add_resource_reference(struct lp_scene *scene,
- struct pipe_resource *resource)
+ struct pipe_resource *resource,
+ boolean initializing_scene)
{
- struct resource_ref *ref = CALLOC_STRUCT(resource_ref);
- if (ref) {
- struct resource_ref *ref_list = &scene->resources;
- pipe_resource_reference(&ref->resource, resource);
- insert_at_tail(ref_list, ref);
+ struct resource_ref *ref, **last = &scene->resources;
+ int i;
+
+ /* Look at existing resource blocks:
+ */
+ for (ref = scene->resources; ref; ref = ref->next) {
+ last = &ref->next;
+
+ /* Search for this resource:
+ */
+ for (i = 0; i < ref->count; i++)
+ if (ref->resource[i] == resource)
+ return TRUE;
+
+ if (ref->count < RESOURCE_REF_SZ) {
+ /* If the block is half-empty, then append the reference here.
+ */
+ break;
+ }
+ }
+
+ /* Create a new block if no half-empty block was found.
+ */
+ if (!ref) {
+ assert(*last == NULL);
+ *last = lp_scene_alloc(scene, sizeof *ref);
+ if (*last == NULL)
+ return FALSE;
+
+ ref = *last;
+ memset(ref, 0, sizeof *ref);
}
- scene->scene_size += llvmpipe_resource_size(resource);
+ /* Append the reference to the reference block.
+ */
+ pipe_resource_reference(&ref->resource[ref->count++], resource);
+ scene->resource_reference_size += llvmpipe_resource_size(resource);
+
+ /* Heuristic to advise scene flushes. This isn't helpful in the
+ * initial setup of the scene, but after that point flush on the
+ * next resource added which exceeds 64MB in referenced texture
+ * data.
+ */
+ if (!initializing_scene &&
+ scene->resource_reference_size >= LP_SCENE_MAX_RESOURCE_SIZE)
+ return FALSE;
+
+ return TRUE;
}
@@ -299,12 +398,15 @@ boolean
lp_scene_is_resource_referenced(const struct lp_scene *scene,
const struct pipe_resource *resource)
{
- const struct resource_ref *ref_list = &scene->resources;
const struct resource_ref *ref;
- foreach (ref, ref_list) {
- if (ref->resource == resource)
- return TRUE;
+ int i;
+
+ for (ref = scene->resources; ref; ref = ref->next) {
+ for (i = 0; i < ref->count; i++)
+ if (ref->resource[i] == resource)
+ return TRUE;
}
+
return FALSE;
}
@@ -342,7 +444,7 @@ lp_scene_bin_iter_begin( struct lp_scene *scene )
* of work (a bin) to work on.
*/
struct cmd_bin *
-lp_scene_bin_iter_next( struct lp_scene *scene, int *bin_x, int *bin_y )
+lp_scene_bin_iter_next( struct lp_scene *scene )
{
struct cmd_bin *bin = NULL;
@@ -359,8 +461,6 @@ lp_scene_bin_iter_next( struct lp_scene *scene, int *bin_x, int *bin_y )
}
bin = lp_scene_get_bin(scene, scene->curr_x, scene->curr_y);
- *bin_x = scene->curr_x;
- *bin_y = scene->curr_y;
end:
/*printf("return bin %p at %d, %d\n", (void *) bin, *bin_x, *bin_y);*/
@@ -384,34 +484,16 @@ void lp_scene_begin_binning( struct lp_scene *scene,
}
-void lp_scene_rasterize( struct lp_scene *scene,
- struct lp_rasterizer *rast )
+void lp_scene_end_binning( struct lp_scene *scene )
{
- if (0) {
- unsigned x, y;
+ if (LP_DEBUG & DEBUG_SCENE) {
debug_printf("rasterize scene:\n");
- debug_printf(" data size: %u\n", lp_scene_data_size(scene));
- for (y = 0; y < scene->tiles_y; y++) {
- for (x = 0; x < scene->tiles_x; x++) {
- debug_printf(" bin %u, %u size: %u\n", x, y,
- lp_scene_bin_size(scene, x, y));
- }
- }
- }
-
- /* Enqueue the scene for rasterization, then immediately wait for
- * it to finish.
- */
- lp_rast_queue_scene( rast, scene );
+ debug_printf(" scene_size: %u\n",
+ scene->scene_size);
+ debug_printf(" data size: %u\n",
+ lp_scene_data_size(scene));
- /* Currently just wait for the rasterizer to finish. Some
- * threading interactions need to be worked out, particularly once
- * transfers become per-context:
- */
- lp_rast_finish( rast );
-
- util_unreference_framebuffer_state( &scene->fb );
-
- /* put scene into the empty list */
- lp_scene_enqueue( scene->empty_queue, scene );
+ if (0)
+ lp_debug_bins( scene );
+ }
}
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.h b/src/gallium/drivers/llvmpipe/lp_scene.h
index fa1b311fa1..dbef7692e4 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.h
+++ b/src/gallium/drivers/llvmpipe/lp_scene.h
@@ -38,6 +38,7 @@
#include "os/os_thread.h"
#include "lp_tile_soa.h"
#include "lp_rast.h"
+#include "lp_debug.h"
struct lp_scene_queue;
@@ -49,58 +50,71 @@ struct lp_scene_queue;
#define CMD_BLOCK_MAX 128
-#define DATA_BLOCK_SIZE (16 * 1024 - sizeof(unsigned) - sizeof(void *))
-
+#define DATA_BLOCK_SIZE (64 * 1024)
+
+/* Scene temporary storage is clamped to this size:
+ */
+#define LP_SCENE_MAX_SIZE (4*1024*1024)
+
+/* The maximum amount of texture storage referenced by a scene is
+ * clamped ot this size:
+ */
+#define LP_SCENE_MAX_RESOURCE_SIZE (64*1024*1024)
/* switch to a non-pointer value for this:
*/
-typedef void (*lp_rast_cmd)( struct lp_rasterizer_task *,
- const union lp_rast_cmd_arg );
+typedef void (*lp_rast_cmd_func)( struct lp_rasterizer_task *,
+ const union lp_rast_cmd_arg );
+
struct cmd_block {
- lp_rast_cmd cmd[CMD_BLOCK_MAX];
+ uint8_t cmd[CMD_BLOCK_MAX];
union lp_rast_cmd_arg arg[CMD_BLOCK_MAX];
unsigned count;
struct cmd_block *next;
};
+struct cmd_block_list {
+ struct cmd_block *head;
+ struct cmd_block *tail;
+};
+
struct data_block {
ubyte data[DATA_BLOCK_SIZE];
unsigned used;
struct data_block *next;
};
-struct cmd_block_list {
- struct cmd_block *head;
- struct cmd_block *tail;
-};
+
/**
* For each screen tile we have one of these bins.
*/
struct cmd_bin {
- struct cmd_block_list commands;
+ ushort x;
+ ushort y;
+ struct cmd_block *head;
+ struct cmd_block *tail;
};
/**
- * This stores bulk data which is shared by all bins within a scene.
+ * This stores bulk data which is used for all memory allocations
+ * within a scene.
+ *
* Examples include triangle data and state data. The commands in
* the per-tile bins will point to chunks of data in this structure.
+ *
+ * Include the first block of data statically to ensure we can always
+ * initiate a scene without relying on malloc succeeding.
*/
struct data_block_list {
+ struct data_block first;
struct data_block *head;
- struct data_block *tail;
-};
-
-
-/** List of resource references */
-struct resource_ref {
- struct pipe_resource *resource;
- struct resource_ref *prev, *next; /**< linked list w/ u_simple_list.h */
};
+struct resource_ref;
/**
* All bins and bin data are contained here.
@@ -114,18 +128,33 @@ struct lp_scene {
struct pipe_context *pipe;
struct lp_fence *fence;
+ /* Framebuffer mappings - valid only between begin_rasterization()
+ * and end_rasterization().
+ */
+ struct {
+ uint8_t *map;
+ unsigned stride;
+ unsigned blocksize;
+ } zsbuf, cbufs[PIPE_MAX_COLOR_BUFS];
+
/** the framebuffer to render the scene into */
struct pipe_framebuffer_state fb;
/** list of resources referenced by the scene commands */
- struct resource_ref resources;
+ struct resource_ref *resources;
- /** Approx memory used by the scene (in bytes). This includes the
- * shared and per-tile bins plus any referenced resources/textures.
+ /** Total memory used by the scene (in bytes). This sums all the
+ * data blocks and counts all bins, state, resource references and
+ * other random allocations within the scene.
*/
unsigned scene_size;
- boolean has_color_clear;
+ /** Sum of sizes of all resources referenced by the scene. Sums
+ * all the textures read by the scene:
+ */
+ unsigned resource_reference_size;
+
+ boolean alloc_failed;
boolean has_depthstencil_clear;
/**
@@ -137,38 +166,28 @@ struct lp_scene {
int curr_x, curr_y; /**< for iterating over bins */
pipe_mutex mutex;
- /* Where to place this scene once it has been rasterized:
- */
- struct lp_scene_queue *empty_queue;
-
struct cmd_bin tile[TILES_X][TILES_Y];
struct data_block_list data;
};
-struct lp_scene *lp_scene_create(struct pipe_context *pipe,
- struct lp_scene_queue *empty_queue);
+struct lp_scene *lp_scene_create(struct pipe_context *pipe);
void lp_scene_destroy(struct lp_scene *scene);
-
-
boolean lp_scene_is_empty(struct lp_scene *scene );
-
-void lp_scene_reset(struct lp_scene *scene );
+boolean lp_scene_is_oom(struct lp_scene *scene );
-struct data_block *lp_bin_new_data_block( struct data_block_list *list );
+struct data_block *lp_scene_new_data_block( struct lp_scene *scene );
-struct cmd_block *lp_bin_new_cmd_block( struct cmd_block_list *list );
+struct cmd_block *lp_scene_new_cmd_block( struct lp_scene *scene,
+ struct cmd_bin *bin );
-unsigned lp_scene_data_size( const struct lp_scene *scene );
-
-unsigned lp_scene_bin_size( const struct lp_scene *scene, unsigned x, unsigned y );
-
-void lp_scene_add_resource_reference(struct lp_scene *scene,
- struct pipe_resource *resource);
+boolean lp_scene_add_resource_reference(struct lp_scene *scene,
+ struct pipe_resource *resource,
+ boolean initializing_scene);
boolean lp_scene_is_resource_referenced(const struct lp_scene *scene,
const struct pipe_resource *resource );
@@ -182,21 +201,27 @@ static INLINE void *
lp_scene_alloc( struct lp_scene *scene, unsigned size)
{
struct data_block_list *list = &scene->data;
- struct data_block *tail = list->tail;
+ struct data_block *block = list->head;
- if (tail->used + size > DATA_BLOCK_SIZE) {
- tail = lp_bin_new_data_block( list );
- if (!tail) {
+ assert(size <= DATA_BLOCK_SIZE);
+ assert(block != NULL);
+
+ if (LP_DEBUG & DEBUG_MEM)
+ debug_printf("alloc %u block %u/%u tot %u/%u\n",
+ size, block->used, DATA_BLOCK_SIZE,
+ scene->scene_size, LP_SCENE_MAX_SIZE);
+
+ if (block->used + size > DATA_BLOCK_SIZE) {
+ block = lp_scene_new_data_block( scene );
+ if (!block) {
/* out of memory */
return NULL;
}
}
- scene->scene_size += size;
-
{
- ubyte *data = tail->data + tail->used;
- tail->used += size;
+ ubyte *data = block->data + block->used;
+ block->used += size;
return data;
}
}
@@ -210,20 +235,26 @@ lp_scene_alloc_aligned( struct lp_scene *scene, unsigned size,
unsigned alignment )
{
struct data_block_list *list = &scene->data;
- struct data_block *tail = list->tail;
-
- if (tail->used + size + alignment - 1 > DATA_BLOCK_SIZE) {
- tail = lp_bin_new_data_block( list );
- if (!tail)
+ struct data_block *block = list->head;
+
+ assert(block != NULL);
+
+ if (LP_DEBUG & DEBUG_MEM)
+ debug_printf("alloc %u block %u/%u tot %u/%u\n",
+ size + alignment - 1,
+ block->used, DATA_BLOCK_SIZE,
+ scene->scene_size, LP_SCENE_MAX_SIZE);
+
+ if (block->used + size + alignment - 1 > DATA_BLOCK_SIZE) {
+ block = lp_scene_new_data_block( scene );
+ if (!block)
return NULL;
}
- scene->scene_size += size;
-
{
- ubyte *data = tail->data + tail->used;
+ ubyte *data = block->data + block->used;
unsigned offset = (((uintptr_t)data + alignment - 1) & ~(alignment - 1)) - (uintptr_t)data;
- tail->used += offset + size;
+ block->used += offset + size;
return data + offset;
}
}
@@ -235,9 +266,8 @@ static INLINE void
lp_scene_putback_data( struct lp_scene *scene, unsigned size)
{
struct data_block_list *list = &scene->data;
- scene->scene_size -= size;
- assert(list->tail->used >= size);
- list->tail->used -= size;
+ assert(list->head && list->head->used >= size);
+ list->head->used -= size;
}
@@ -256,55 +286,55 @@ lp_scene_bin_reset(struct lp_scene *scene, unsigned x, unsigned y);
/* Add a command to bin[x][y].
*/
-static INLINE void
+static INLINE boolean
lp_scene_bin_command( struct lp_scene *scene,
- unsigned x, unsigned y,
- lp_rast_cmd cmd,
- union lp_rast_cmd_arg arg )
+ unsigned x, unsigned y,
+ unsigned cmd,
+ union lp_rast_cmd_arg arg )
{
struct cmd_bin *bin = lp_scene_get_bin(scene, x, y);
- struct cmd_block_list *list = &bin->commands;
- struct cmd_block *tail = list->tail;
+ struct cmd_block *tail = bin->tail;
assert(x < scene->tiles_x);
assert(y < scene->tiles_y);
+ assert(cmd <= LP_RAST_OP_END_QUERY);
- if (tail->count == CMD_BLOCK_MAX) {
- tail = lp_bin_new_cmd_block( list );
+ if (tail == NULL || tail->count == CMD_BLOCK_MAX) {
+ tail = lp_scene_new_cmd_block( scene, bin );
if (!tail) {
- /* out of memory - simply ignore this command (for now) */
- return;
+ return FALSE;
}
assert(tail->count == 0);
}
{
unsigned i = tail->count;
- tail->cmd[i] = cmd;
+ tail->cmd[i] = cmd & LP_RAST_OP_MASK;
tail->arg[i] = arg;
tail->count++;
}
+
+ return TRUE;
}
/* Add a command to all active bins.
*/
-static INLINE void
+static INLINE boolean
lp_scene_bin_everywhere( struct lp_scene *scene,
- lp_rast_cmd cmd,
+ unsigned cmd,
const union lp_rast_cmd_arg arg )
{
unsigned i, j;
- for (i = 0; i < scene->tiles_x; i++)
- for (j = 0; j < scene->tiles_y; j++)
- lp_scene_bin_command( scene, i, j, cmd, arg );
-}
-
+ for (i = 0; i < scene->tiles_x; i++) {
+ for (j = 0; j < scene->tiles_y; j++) {
+ if (!lp_scene_bin_command( scene, i, j, cmd, arg ))
+ return FALSE;
+ }
+ }
-void
-lp_scene_bin_state_command( struct lp_scene *scene,
- lp_rast_cmd cmd,
- const union lp_rast_cmd_arg arg );
+ return TRUE;
+}
static INLINE unsigned
@@ -318,23 +348,30 @@ void
lp_scene_bin_iter_begin( struct lp_scene *scene );
struct cmd_bin *
-lp_scene_bin_iter_next( struct lp_scene *scene, int *bin_x, int *bin_y );
+lp_scene_bin_iter_next( struct lp_scene *scene );
-void
-lp_scene_rasterize( struct lp_scene *scene,
- struct lp_rasterizer *rast );
+/* Begin/end binning of a scene
+ */
void
lp_scene_begin_binning( struct lp_scene *scene,
struct pipe_framebuffer_state *fb );
+void
+lp_scene_end_binning( struct lp_scene *scene );
+
+
+/* Begin/end rasterization of a scene
+ */
+void
+lp_scene_begin_rasterization(struct lp_scene *scene);
+
+void
+lp_scene_end_rasterization(struct lp_scene *scene );
+
+
-static INLINE unsigned
-lp_scene_get_size(const struct lp_scene *scene)
-{
- return scene->scene_size;
-}
#endif /* LP_BIN_H */
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 1e65a91fc6..0d40dc5020 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -33,8 +33,8 @@
#include "util/u_format_s3tc.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "draw/draw_context.h"
-#include "gallivm/lp_bld_limits.h"
#include "lp_texture.h"
#include "lp_fence.h"
#include "lp_jit.h"
@@ -63,6 +63,7 @@ static const struct debug_named_value lp_debug_flags[] = {
{ "counters", DEBUG_COUNTERS, NULL },
{ "scene", DEBUG_SCENE, NULL },
{ "fence", DEBUG_FENCE, NULL },
+ { "mem", DEBUG_MEM, NULL },
DEBUG_NAMED_VALUE_END
};
#endif
@@ -131,8 +132,6 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return LP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return LP_MAX_TEXTURE_2D_LEVELS;
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
@@ -145,47 +144,29 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
return 0;
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- /* There is no limit in number of instructions beyond available memory */
- return 32768;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- return LP_MAX_TGSI_NESTING;
- case PIPE_CAP_MAX_VS_INPUTS:
- case PIPE_CAP_MAX_FS_INPUTS:
- return PIPE_MAX_ATTRIBS;
- case PIPE_CAP_MAX_FS_CONSTS:
- case PIPE_CAP_MAX_VS_CONSTS:
- /* There is no limit in number of constants beyond available memory */
- return 32768;
- case PIPE_CAP_MAX_VS_TEMPS:
- case PIPE_CAP_MAX_FS_TEMPS:
- return LP_MAX_TGSI_TEMPS;
- case PIPE_CAP_MAX_VS_ADDRS:
- case PIPE_CAP_MAX_FS_ADDRS:
- return LP_MAX_TGSI_ADDRS;
- case PIPE_CAP_MAX_VS_PREDS:
- case PIPE_CAP_MAX_FS_PREDS:
- return LP_MAX_TGSI_PREDS;
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
- case PIPE_CAP_GEOMETRY_SHADER4:
- return 1;
case PIPE_CAP_DEPTH_CLAMP:
return 0;
default:
- assert(0);
return 0;
}
}
+static int
+llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ return tgsi_exec_get_shader_param(param);
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_GEOMETRY:
+ return draw_get_shader_param(shader, param);
+ default:
+ return 0;
+ }
+}
static float
llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
@@ -401,6 +382,7 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
screen->base.get_name = llvmpipe_get_name;
screen->base.get_vendor = llvmpipe_get_vendor;
screen->base.get_param = llvmpipe_get_param;
+ screen->base.get_shader_param = llvmpipe_get_shader_param;
screen->base.get_paramf = llvmpipe_get_paramf;
screen->base.is_format_supported = llvmpipe_is_format_supported;
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index 3da9097154..e6a8196761 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -42,7 +42,6 @@
#include "lp_context.h"
#include "lp_memory.h"
#include "lp_scene.h"
-#include "lp_scene_queue.h"
#include "lp_texture.h"
#include "lp_debug.h"
#include "lp_fence.h"
@@ -57,36 +56,31 @@
#include "draw/draw_vbuf.h"
-static void set_scene_state( struct lp_setup_context *, enum setup_state );
+static void set_scene_state( struct lp_setup_context *, enum setup_state,
+ const char *reason);
+static boolean try_update_scene_state( struct lp_setup_context *setup );
-struct lp_scene *
-lp_setup_get_current_scene(struct lp_setup_context *setup)
+static void
+lp_setup_get_empty_scene(struct lp_setup_context *setup)
{
- if (!setup->scene) {
- set_scene_state( setup, SETUP_EMPTY );
- }
- return setup->scene;
-}
+ assert(setup->scene == NULL);
+ setup->scene_idx++;
+ setup->scene_idx %= Elements(setup->scenes);
-/**
- * Check if the size of the current scene has exceeded the limit.
- * If so, flush/render it.
- */
-static void
-setup_check_scene_size_and_flush(struct lp_setup_context *setup)
-{
- if (setup->scene) {
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
- unsigned size = lp_scene_get_size(scene);
+ setup->scene = setup->scenes[setup->scene_idx];
- if (size > LP_MAX_SCENE_SIZE) {
- /*printf("LLVMPIPE: scene size = %u, flushing.\n", size);*/
- set_scene_state( setup, SETUP_FLUSHED );
- /*assert(lp_scene_get_size(scene) == 0);*/
- }
+ if (setup->scene->fence) {
+ if (LP_DEBUG & DEBUG_SETUP)
+ debug_printf("%s: wait for scene %d\n",
+ __FUNCTION__, setup->scene->fence->id);
+
+ lp_fence_wait(setup->scene->fence);
}
+
+ lp_scene_begin_binning(setup->scene, &setup->fb);
+
}
@@ -96,7 +90,7 @@ first_triangle( struct lp_setup_context *setup,
const float (*v1)[4],
const float (*v2)[4])
{
- set_scene_state( setup, SETUP_ACTIVE );
+ assert(setup->state == SETUP_ACTIVE);
lp_setup_choose_triangle( setup );
setup->triangle( setup, v0, v1, v2 );
}
@@ -106,7 +100,7 @@ first_line( struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4])
{
- set_scene_state( setup, SETUP_ACTIVE );
+ assert(setup->state == SETUP_ACTIVE);
lp_setup_choose_line( setup );
setup->line( setup, v0, v1 );
}
@@ -115,12 +109,12 @@ static void
first_point( struct lp_setup_context *setup,
const float (*v0)[4])
{
- set_scene_state( setup, SETUP_ACTIVE );
+ assert(setup->state == SETUP_ACTIVE);
lp_setup_choose_point( setup );
setup->point( setup, v0 );
}
-static void reset_context( struct lp_setup_context *setup )
+static void lp_setup_reset( struct lp_setup_context *setup )
{
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
@@ -135,8 +129,7 @@ static void reset_context( struct lp_setup_context *setup )
/* Reset some state:
*/
- setup->clear.flags = 0;
- setup->clear.clearzs.clearzs_mask = 0;
+ memset(&setup->clear, 0, sizeof setup->clear);
/* Have an explicit "start-binning" call and get rid of this
* pointer twiddling?
@@ -151,14 +144,23 @@ static void reset_context( struct lp_setup_context *setup )
static void
lp_setup_rasterize_scene( struct lp_setup_context *setup )
{
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ struct lp_scene *scene = setup->scene;
struct llvmpipe_screen *screen = llvmpipe_screen(scene->pipe->screen);
+ lp_scene_end_binning(scene);
+
+ lp_fence_reference(&setup->last_fence, scene->fence);
+
+ if (setup->last_fence)
+ setup->last_fence->issued = TRUE;
+
pipe_mutex_lock(screen->rast_mutex);
- lp_scene_rasterize(scene, screen->rast);
+ lp_rast_queue_scene(screen->rast, scene);
+ lp_rast_finish(screen->rast);
pipe_mutex_unlock(screen->rast_mutex);
- reset_context( setup );
+ lp_scene_end_rasterization(setup->scene);
+ lp_setup_reset( setup );
LP_DBG(DEBUG_SETUP, "%s done \n", __FUNCTION__);
}
@@ -168,8 +170,30 @@ lp_setup_rasterize_scene( struct lp_setup_context *setup )
static void
begin_binning( struct lp_setup_context *setup )
{
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ struct lp_scene *scene = setup->scene;
boolean need_zsload = FALSE;
+ boolean ok;
+ unsigned i, j;
+
+ assert(scene);
+ assert(scene->fence == NULL);
+
+ /* Always create a fence:
+ */
+ scene->fence = lp_fence_create(MAX2(1, setup->num_threads));
+
+ /* Initialize the bin flags and x/y coords:
+ */
+ for (i = 0; i < scene->tiles_x; i++) {
+ for (j = 0; j < scene->tiles_y; j++) {
+ scene->tile[i][j].x = i;
+ scene->tile[i][j].y = j;
+ }
+ }
+
+ ok = try_update_scene_state(setup);
+ assert(ok);
+
if (setup->fb.zsbuf &&
((setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) &&
util_format_is_depth_and_stencil(setup->fb.zsbuf->format))
@@ -181,10 +205,10 @@ begin_binning( struct lp_setup_context *setup )
if (setup->fb.nr_cbufs) {
if (setup->clear.flags & PIPE_CLEAR_COLOR) {
- lp_scene_bin_everywhere( scene,
- lp_rast_clear_color,
- setup->clear.color );
- scene->has_color_clear = TRUE;
+ ok = lp_scene_bin_everywhere( scene,
+ LP_RAST_OP_CLEAR_COLOR,
+ setup->clear.color );
+ assert(ok);
}
}
@@ -192,12 +216,27 @@ begin_binning( struct lp_setup_context *setup )
if (setup->clear.flags & PIPE_CLEAR_DEPTHSTENCIL) {
if (!need_zsload)
scene->has_depthstencil_clear = TRUE;
- lp_scene_bin_everywhere( scene,
- lp_rast_clear_zstencil,
- lp_rast_arg_clearzs(&setup->clear.clearzs) );
+ ok = lp_scene_bin_everywhere( scene,
+ LP_RAST_OP_CLEAR_ZSTENCIL,
+ lp_rast_arg_clearzs(
+ setup->clear.zsvalue,
+ setup->clear.zsmask));
+ assert(ok);
}
}
+ if (setup->active_query) {
+ ok = lp_scene_bin_everywhere( scene,
+ LP_RAST_OP_BEGIN_QUERY,
+ lp_rast_arg_query(setup->active_query) );
+ assert(ok);
+ }
+
+
+ setup->clear.flags = 0;
+ setup->clear.zsmask = 0;
+ setup->clear.zsvalue = 0;
+
LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__);
}
@@ -213,51 +252,56 @@ execute_clears( struct lp_setup_context *setup )
LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
begin_binning( setup );
- lp_setup_rasterize_scene( setup );
}
+const char *states[] = {
+ "FLUSHED",
+ "EMPTY ",
+ "CLEARED",
+ "ACTIVE "
+};
+
static void
set_scene_state( struct lp_setup_context *setup,
- enum setup_state new_state )
+ enum setup_state new_state,
+ const char *reason)
{
unsigned old_state = setup->state;
if (old_state == new_state)
return;
-
- LP_DBG(DEBUG_SETUP, "%s old %d new %d\n", __FUNCTION__, old_state, new_state);
-
- switch (new_state) {
- case SETUP_EMPTY:
- assert(old_state == SETUP_FLUSHED);
- assert(setup->scene == NULL);
+
+ if (LP_DEBUG & DEBUG_SCENE) {
+ debug_printf("%s old %s new %s%s%s\n",
+ __FUNCTION__,
+ states[old_state],
+ states[new_state],
+ (new_state == SETUP_FLUSHED) ? ": " : "",
+ (new_state == SETUP_FLUSHED) ? reason : "");
+
+ if (new_state == SETUP_FLUSHED && setup->scene)
+ lp_debug_draw_bins_by_cmd_length(setup->scene);
+ }
- /* wait for a free/empty scene
- */
- setup->scene = lp_scene_dequeue(setup->empty_scenes, TRUE);
- assert(lp_scene_is_empty(setup->scene));
- lp_scene_begin_binning(setup->scene,
- &setup->fb );
- break;
+ /* wait for a free/empty scene
+ */
+ if (old_state == SETUP_FLUSHED)
+ lp_setup_get_empty_scene(setup);
+ switch (new_state) {
case SETUP_CLEARED:
- assert(old_state == SETUP_EMPTY);
- assert(setup->scene != NULL);
break;
case SETUP_ACTIVE:
- assert(old_state == SETUP_EMPTY ||
- old_state == SETUP_CLEARED);
- assert(setup->scene != NULL);
begin_binning( setup );
break;
case SETUP_FLUSHED:
if (old_state == SETUP_CLEARED)
execute_clears( setup );
- else
- lp_setup_rasterize_scene( setup );
+
+ lp_setup_rasterize_scene( setup );
assert(setup->scene == NULL);
break;
@@ -278,21 +322,11 @@ lp_setup_flush( struct lp_setup_context *setup,
struct pipe_fence_handle **fence,
const char *reason)
{
- LP_DBG(DEBUG_SETUP, "%s %s\n", __FUNCTION__, reason);
-
- if (setup->scene) {
- if (fence) {
- /* if we're going to flush the setup/rasterization modules, emit
- * a fence.
- */
- *fence = lp_setup_fence( setup );
- }
+ set_scene_state( setup, SETUP_FLUSHED, reason );
- if (setup->scene->fence)
- setup->scene->fence->issued = TRUE;
+ if (fence) {
+ lp_fence_reference((struct lp_fence **)fence, setup->last_fence);
}
-
- set_scene_state( setup, SETUP_FLUSHED );
}
@@ -304,7 +338,7 @@ lp_setup_bind_framebuffer( struct lp_setup_context *setup,
/* Flush any old scene.
*/
- set_scene_state( setup, SETUP_FLUSHED );
+ set_scene_state( setup, SETUP_FLUSHED, __FUNCTION__ );
/*
* Ensure the old scene is not reused.
@@ -323,78 +357,41 @@ lp_setup_bind_framebuffer( struct lp_setup_context *setup,
}
-void
-lp_setup_clear( struct lp_setup_context *setup,
- const float *color,
- double depth,
- unsigned stencil,
- unsigned flags )
+static boolean
+lp_setup_try_clear( struct lp_setup_context *setup,
+ const float *color,
+ double depth,
+ unsigned stencil,
+ unsigned flags )
{
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ uint32_t zsmask = 0;
+ uint32_t zsvalue = 0;
+ union lp_rast_cmd_arg color_arg;
unsigned i;
- boolean full_zs_clear = TRUE;
- uint32_t mask = 0;
LP_DBG(DEBUG_SETUP, "%s state %d\n", __FUNCTION__, setup->state);
-
if (flags & PIPE_CLEAR_COLOR) {
- for (i = 0; i < 4; ++i)
- setup->clear.color.clear_color[i] = float_to_ubyte(color[i]);
+ for (i = 0; i < 4; i++)
+ color_arg.clear_color[i] = float_to_ubyte(color[i]);
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- if (setup->fb.zsbuf &&
- ((flags & PIPE_CLEAR_DEPTHSTENCIL) != PIPE_CLEAR_DEPTHSTENCIL) &&
- util_format_is_depth_and_stencil(setup->fb.zsbuf->format))
- full_zs_clear = FALSE;
-
- if (full_zs_clear) {
- setup->clear.clearzs.clearzs_value =
- util_pack_z_stencil(setup->fb.zsbuf->format,
- depth,
- stencil);
- setup->clear.clearzs.clearzs_mask = 0xffffffff;
- }
- else {
- /* hmm */
- uint32_t tmpval;
- if (flags & PIPE_CLEAR_DEPTH) {
- tmpval = util_pack_z(setup->fb.zsbuf->format,
- depth);
- switch (setup->fb.zsbuf->format) {
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- mask = 0xffffff;
- break;
- case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- mask = 0xffffff00;
- break;
- default:
- assert(0);
- }
- }
- else {
- switch (setup->fb.zsbuf->format) {
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- mask = 0xff000000;
- tmpval = stencil << 24;
- break;
- case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
- mask = 0xff;
- tmpval = stencil;
- break;
- default:
- assert(0);
- tmpval = 0;
- }
- }
- setup->clear.clearzs.clearzs_mask |= mask;
- setup->clear.clearzs.clearzs_value =
- (setup->clear.clearzs.clearzs_value & ~mask) | (tmpval & mask);
- }
+ unsigned zmask = (flags & PIPE_CLEAR_DEPTH) ? ~0 : 0;
+ unsigned smask = (flags & PIPE_CLEAR_STENCIL) ? ~0 : 0;
+
+ zsvalue = util_pack_z_stencil(setup->fb.zsbuf->format,
+ depth,
+ stencil);
+
+ zsmask = util_pack_uint_z_stencil(setup->fb.zsbuf->format,
+ zmask,
+ smask);
}
if (setup->state == SETUP_ACTIVE) {
+ struct lp_scene *scene = setup->scene;
+
/* Add the clear to existing scene. In the unusual case where
* both color and depth-stencil are being cleared when there's
* already been some rendering, we could discard the currently
@@ -402,24 +399,18 @@ lp_setup_clear( struct lp_setup_context *setup,
* a common usage.
*/
if (flags & PIPE_CLEAR_COLOR) {
- lp_scene_bin_everywhere( scene,
- lp_rast_clear_color,
- setup->clear.color );
- scene->has_color_clear = TRUE;
+ if (!lp_scene_bin_everywhere( scene,
+ LP_RAST_OP_CLEAR_COLOR,
+ color_arg ))
+ return FALSE;
}
if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
- if (full_zs_clear)
- scene->has_depthstencil_clear = TRUE;
- else
- setup->clear.clearzs.clearzs_mask = mask;
- lp_scene_bin_everywhere( scene,
- lp_rast_clear_zstencil,
- lp_rast_arg_clearzs(&setup->clear.clearzs) );
-
-
+ if (!lp_scene_bin_everywhere( scene,
+ LP_RAST_OP_CLEAR_ZSTENCIL,
+ lp_rast_arg_clearzs(zsvalue, zsmask) ))
+ return FALSE;
}
-
}
else {
/* Put ourselves into the 'pre-clear' state, specifically to try
@@ -427,42 +418,43 @@ lp_setup_clear( struct lp_setup_context *setup,
* buffers which the app or state-tracker might issue
* separately.
*/
- set_scene_state( setup, SETUP_CLEARED );
+ set_scene_state( setup, SETUP_CLEARED, __FUNCTION__ );
setup->clear.flags |= flags;
+
+ if (flags & PIPE_CLEAR_DEPTHSTENCIL) {
+ setup->clear.zsmask |= zsmask;
+ setup->clear.zsvalue =
+ (setup->clear.zsvalue & ~zsmask) | (zsvalue & zsmask);
+ }
+
+ if (flags & PIPE_CLEAR_COLOR) {
+ memcpy(setup->clear.color.clear_color,
+ &color_arg,
+ sizeof color_arg);
+ }
}
+
+ return TRUE;
}
-
-/**
- * Emit a fence.
- */
-struct pipe_fence_handle *
-lp_setup_fence( struct lp_setup_context *setup )
+void
+lp_setup_clear( struct lp_setup_context *setup,
+ const float *color,
+ double depth,
+ unsigned stencil,
+ unsigned flags )
{
- if (setup->scene == NULL)
- return NULL;
- else if (setup->num_threads == 0)
- return NULL;
- else
- {
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
- const unsigned rank = setup->num_threads;
+ if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) {
+ lp_setup_flush(setup, 0, NULL, __FUNCTION__);
- set_scene_state( setup, SETUP_ACTIVE );
-
- assert(scene->fence == NULL);
+ if (!lp_setup_try_clear( setup, color, depth, stencil, flags ))
+ assert(0);
+ }
+}
- /* The caller gets a reference, we keep a copy too, so need to
- * bump the refcount:
- */
- lp_fence_reference(&scene->fence, lp_fence_create(rank));
- LP_DBG(DEBUG_SETUP, "%s rank %u\n", __FUNCTION__, rank);
- return (struct pipe_fence_handle *) scene->fence;
- }
-}
void
@@ -725,58 +717,33 @@ lp_setup_is_resource_referenced( const struct lp_setup_context *setup,
/**
* Called by vbuf code when we're about to draw something.
*/
-void
-lp_setup_update_state( struct lp_setup_context *setup )
+static boolean
+try_update_scene_state( struct lp_setup_context *setup )
{
- struct lp_scene *scene;
+ boolean new_scene = (setup->fs.stored == NULL);
+ struct lp_scene *scene = setup->scene;
- LP_DBG(DEBUG_SETUP, "%s\n", __FUNCTION__);
-
- setup_check_scene_size_and_flush(setup);
-
- scene = lp_setup_get_current_scene(setup);
-
- assert(setup->fs.current.variant);
-
- /* Some of the 'draw' pipeline stages may have changed some driver state.
- * Make sure we've processed those state changes before anything else.
- *
- * XXX this is the only place where llvmpipe_context is used in the
- * setup code. This may get refactored/changed...
- */
- {
- struct llvmpipe_context *lp = llvmpipe_context(scene->pipe);
-
- /* Will probably need to move this somewhere else, just need
- * to know about vertex shader point size attribute.
- */
- setup->psize = lp->psize_slot;
-
- if (lp->dirty) {
- llvmpipe_update_derived(lp);
- }
- assert(lp->dirty == 0);
- }
+ assert(scene);
if(setup->dirty & LP_SETUP_NEW_BLEND_COLOR) {
uint8_t *stored;
unsigned i, j;
stored = lp_scene_alloc_aligned(scene, 4 * 16, 16);
+ if (!stored) {
+ assert(!new_scene);
+ return FALSE;
+ }
- if (stored) {
- /* smear each blend color component across 16 ubyte elements */
- for (i = 0; i < 4; ++i) {
- uint8_t c = float_to_ubyte(setup->blend_color.current.color[i]);
- for (j = 0; j < 16; ++j)
- stored[i*16 + j] = c;
- }
-
- setup->blend_color.stored = stored;
-
- setup->fs.current.jit_context.blend_color = setup->blend_color.stored;
+ /* smear each blend color component across 16 ubyte elements */
+ for (i = 0; i < 4; ++i) {
+ uint8_t c = float_to_ubyte(setup->blend_color.current.color[i]);
+ for (j = 0; j < 16; ++j)
+ stored[i*16 + j] = c;
}
+ setup->blend_color.stored = stored;
+ setup->fs.current.jit_context.blend_color = setup->blend_color.stored;
setup->dirty |= LP_SETUP_NEW_FS;
}
@@ -797,13 +764,16 @@ lp_setup_update_state( struct lp_setup_context *setup )
void *stored;
stored = lp_scene_alloc(scene, current_size);
- if(stored) {
- memcpy(stored,
- current_data,
- current_size);
- setup->constants.stored_size = current_size;
- setup->constants.stored_data = stored;
+ if (!stored) {
+ assert(!new_scene);
+ return FALSE;
}
+
+ memcpy(stored,
+ current_data,
+ current_size);
+ setup->constants.stored_size = current_size;
+ setup->constants.stored_data = stored;
}
}
else {
@@ -816,31 +786,42 @@ lp_setup_update_state( struct lp_setup_context *setup )
}
- if(setup->dirty & LP_SETUP_NEW_FS) {
- if(!setup->fs.stored ||
- memcmp(setup->fs.stored,
- &setup->fs.current,
- sizeof setup->fs.current) != 0) {
+ if (setup->dirty & LP_SETUP_NEW_FS) {
+ if (!setup->fs.stored ||
+ memcmp(setup->fs.stored,
+ &setup->fs.current,
+ sizeof setup->fs.current) != 0)
+ {
+ struct lp_rast_state *stored;
+ uint i;
+
/* The fs state that's been stored in the scene is different from
* the new, current state. So allocate a new lp_rast_state object
* and append it to the bin's setup data buffer.
*/
- uint i;
- struct lp_rast_state *stored =
- (struct lp_rast_state *) lp_scene_alloc(scene, sizeof *stored);
- if(stored) {
- memcpy(stored,
- &setup->fs.current,
- sizeof setup->fs.current);
- setup->fs.stored = stored;
+ stored = (struct lp_rast_state *) lp_scene_alloc(scene, sizeof *stored);
+ if (!stored) {
+ assert(!new_scene);
+ return FALSE;
}
+ memcpy(stored,
+ &setup->fs.current,
+ sizeof setup->fs.current);
+ setup->fs.stored = stored;
+
/* The scene now references the textures in the rasterization
* state record. Note that now.
*/
for (i = 0; i < Elements(setup->fs.current_tex); i++) {
- if (setup->fs.current_tex[i])
- lp_scene_add_resource_reference(scene, setup->fs.current_tex[i]);
+ if (setup->fs.current_tex[i]) {
+ if (!lp_scene_add_resource_reference(scene,
+ setup->fs.current_tex[i],
+ new_scene)) {
+ assert(!new_scene);
+ return FALSE;
+ }
+ }
}
}
}
@@ -856,6 +837,47 @@ lp_setup_update_state( struct lp_setup_context *setup )
setup->dirty = 0;
assert(setup->fs.stored);
+ return TRUE;
+}
+
+void
+lp_setup_update_state( struct lp_setup_context *setup,
+ boolean update_scene )
+{
+ /* Some of the 'draw' pipeline stages may have changed some driver state.
+ * Make sure we've processed those state changes before anything else.
+ *
+ * XXX this is the only place where llvmpipe_context is used in the
+ * setup code. This may get refactored/changed...
+ */
+ {
+ struct llvmpipe_context *lp = llvmpipe_context(setup->pipe);
+ if (lp->dirty) {
+ llvmpipe_update_derived(lp);
+ }
+
+ /* Will probably need to move this somewhere else, just need
+ * to know about vertex shader point size attribute.
+ */
+ setup->psize = lp->psize_slot;
+
+ assert(lp->dirty == 0);
+ }
+
+ if (update_scene)
+ set_scene_state( setup, SETUP_ACTIVE, __FUNCTION__ );
+
+ /* Only call into update_scene_state() if we already have a
+ * scene:
+ */
+ if (update_scene && setup->scene) {
+ assert(setup->state == SETUP_ACTIVE);
+ if (!try_update_scene_state(setup)) {
+ lp_setup_flush_and_restart(setup);
+ if (!try_update_scene_state(setup))
+ assert(0);
+ }
+ }
}
@@ -867,7 +889,7 @@ lp_setup_destroy( struct lp_setup_context *setup )
{
uint i;
- reset_context( setup );
+ lp_setup_reset( setup );
util_unreference_framebuffer_state(&setup->fb);
@@ -878,15 +900,15 @@ lp_setup_destroy( struct lp_setup_context *setup )
pipe_resource_reference(&setup->constants.current, NULL);
/* free the scenes in the 'empty' queue */
- while (1) {
- struct lp_scene *scene = lp_scene_dequeue(setup->empty_scenes, FALSE);
- if (!scene)
- break;
+ for (i = 0; i < Elements(setup->scenes); i++) {
+ struct lp_scene *scene = setup->scenes[i];
+
+ if (scene->fence)
+ lp_fence_wait(scene->fence);
+
lp_scene_destroy(scene);
}
- lp_scene_queue_destroy(setup->empty_scenes);
-
FREE( setup );
}
@@ -908,10 +930,11 @@ lp_setup_create( struct pipe_context *pipe,
return NULL;
lp_setup_init_vbuf(setup);
+
+ /* Used only in update_state():
+ */
+ setup->pipe = pipe;
- setup->empty_scenes = lp_scene_queue_create();
- if (!setup->empty_scenes)
- goto fail;
setup->num_threads = screen->num_threads;
setup->vbuf = draw_vbuf_stage(draw, &setup->base);
@@ -923,9 +946,7 @@ lp_setup_create( struct pipe_context *pipe,
/* create some empty scenes */
for (i = 0; i < MAX_SCENES; i++) {
- setup->scenes[i] = lp_scene_create( pipe, setup->empty_scenes );
-
- lp_scene_enqueue(setup->empty_scenes, setup->scenes[i]);
+ setup->scenes[i] = lp_scene_create( pipe );
}
setup->triangle = first_triangle;
@@ -940,9 +961,6 @@ fail:
if (setup->vbuf)
;
- if (setup->empty_scenes)
- lp_scene_queue_destroy(setup->empty_scenes);
-
FREE(setup);
return NULL;
}
@@ -955,22 +973,26 @@ void
lp_setup_begin_query(struct lp_setup_context *setup,
struct llvmpipe_query *pq)
{
- struct lp_scene * scene = lp_setup_get_current_scene(setup);
- union lp_rast_cmd_arg cmd_arg;
-
/* init the query to its beginning state */
- pq->done = FALSE;
- pq->tile_count = 0;
- pq->num_tiles = scene->tiles_x * scene->tiles_y;
- assert(pq->num_tiles > 0);
+ assert(setup->active_query == NULL);
+
+ if (setup->scene) {
+ if (!lp_scene_bin_everywhere(setup->scene,
+ LP_RAST_OP_BEGIN_QUERY,
+ lp_rast_arg_query(pq))) {
- memset(pq->count, 0, sizeof(pq->count)); /* reset all counters */
+ lp_setup_flush_and_restart(setup);
- set_scene_state( setup, SETUP_ACTIVE );
+ if (!lp_scene_bin_everywhere(setup->scene,
+ LP_RAST_OP_BEGIN_QUERY,
+ lp_rast_arg_query(pq))) {
+ assert(0);
+ return;
+ }
+ }
+ }
- cmd_arg.query_obj = pq;
- lp_scene_bin_everywhere(scene, lp_rast_begin_query, cmd_arg);
- pq->binned = TRUE;
+ setup->active_query = pq;
}
@@ -980,11 +1002,42 @@ lp_setup_begin_query(struct lp_setup_context *setup,
void
lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
{
- struct lp_scene * scene = lp_setup_get_current_scene(setup);
- union lp_rast_cmd_arg cmd_arg;
+ union lp_rast_cmd_arg dummy = { 0 };
+
+ assert(setup->active_query == pq);
+ setup->active_query = NULL;
- set_scene_state( setup, SETUP_ACTIVE );
+ /* Setup will automatically re-issue any query which carried over a
+ * scene boundary, and the rasterizer automatically "ends" queries
+ * which are active at the end of a scene, so there is no need to
+ * retry this commands on failure.
+ */
+ if (setup->scene) {
+ /* pq->fence should be the fence of the *last* scene which
+ * contributed to the query result.
+ */
+ lp_fence_reference(&pq->fence, setup->scene->fence);
- cmd_arg.query_obj = pq;
- lp_scene_bin_everywhere(scene, lp_rast_end_query, cmd_arg);
+ if (!lp_scene_bin_everywhere(setup->scene,
+ LP_RAST_OP_END_QUERY,
+ dummy)) {
+ lp_setup_flush(setup, 0, NULL, __FUNCTION__);
+ }
+ }
+ else {
+ lp_fence_reference(&pq->fence, setup->last_fence);
+ }
}
+
+
+void
+lp_setup_flush_and_restart(struct lp_setup_context *setup)
+{
+ if (0) debug_printf("%s\n", __FUNCTION__);
+
+ assert(setup->state == SETUP_ACTIVE);
+ set_scene_state(setup, SETUP_FLUSHED, __FUNCTION__);
+ lp_setup_update_state(setup, TRUE);
+}
+
+
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 821ebb1087..b94061b7d4 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -65,6 +65,7 @@ struct pipe_framebuffer_state;
struct lp_fragment_shader_variant;
struct lp_jit_context;
struct llvmpipe_query;
+struct pipe_fence_handle;
struct lp_setup_context *
@@ -78,8 +79,6 @@ lp_setup_clear(struct lp_setup_context *setup,
unsigned clear_stencil,
unsigned flags);
-struct pipe_fence_handle *
-lp_setup_fence( struct lp_setup_context *setup );
void
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.c b/src/gallium/drivers/llvmpipe/lp_setup_coef.c
index 95e3e8fffe..8dc2688ddb 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_coef.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.c
@@ -187,11 +187,32 @@ static void setup_facing_coef( struct lp_rast_shader_inputs *inputs,
*/
void lp_setup_tri_coef( struct lp_setup_context *setup,
struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info)
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean frontfacing)
{
unsigned fragcoord_usage_mask = TGSI_WRITEMASK_XYZ;
unsigned slot;
unsigned i;
+ struct lp_tri_info info;
+ float dx01 = v0[0][0] - v1[0][0];
+ float dy01 = v0[0][1] - v1[0][1];
+ float dx20 = v2[0][0] - v0[0][0];
+ float dy20 = v2[0][1] - v0[0][1];
+ float oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01);
+
+ info.v0 = v0;
+ info.v1 = v1;
+ info.v2 = v2;
+ info.frontfacing = frontfacing;
+ info.x0_center = v0[0][0] - setup->pixel_offset;
+ info.y0_center = v0[0][1] - setup->pixel_offset;
+ info.dx01_ooa = dx01 * oneoverarea;
+ info.dx20_ooa = dx20 * oneoverarea;
+ info.dy01_ooa = dy01 * oneoverarea;
+ info.dy20_ooa = dy20 * oneoverarea;
+
/* setup interpolation for all the remaining attributes:
*/
@@ -204,25 +225,25 @@ void lp_setup_tri_coef( struct lp_setup_context *setup,
if (setup->flatshade_first) {
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(inputs, slot+1, info->v0[vert_attr][i], i);
+ constant_coef(inputs, slot+1, info.v0[vert_attr][i], i);
}
else {
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- constant_coef(inputs, slot+1, info->v2[vert_attr][i], i);
+ constant_coef(inputs, slot+1, info.v2[vert_attr][i], i);
}
break;
case LP_INTERP_LINEAR:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- linear_coef(inputs, info, slot+1, vert_attr, i);
+ linear_coef(inputs, &info, slot+1, vert_attr, i);
break;
case LP_INTERP_PERSPECTIVE:
for (i = 0; i < NUM_CHANNELS; i++)
if (usage_mask & (1 << i))
- perspective_coef(inputs, info, slot+1, vert_attr, i);
+ perspective_coef(inputs, &info, slot+1, vert_attr, i);
fragcoord_usage_mask |= TGSI_WRITEMASK_W;
break;
@@ -236,7 +257,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup,
break;
case LP_INTERP_FACING:
- setup_facing_coef(inputs, slot+1, info->frontfacing, usage_mask);
+ setup_facing_coef(inputs, slot+1, info.frontfacing, usage_mask);
break;
default:
@@ -246,7 +267,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup,
/* The internal position input is in slot zero:
*/
- setup_fragcoord_coef(inputs, info, 0, fragcoord_usage_mask);
+ setup_fragcoord_coef(inputs, &info, 0, fragcoord_usage_mask);
}
#else
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef.h b/src/gallium/drivers/llvmpipe/lp_setup_coef.h
index d68b39c603..87a3255ccc 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_coef.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_coef.h
@@ -56,6 +56,9 @@ struct lp_tri_info {
void lp_setup_tri_coef( struct lp_setup_context *setup,
struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info);
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean frontfacing);
#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c
index 73fb70599c..3742fd672b 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_coef_intrin.c
@@ -151,13 +151,34 @@ static void perspective_coef( struct lp_rast_shader_inputs *inputs,
*/
void lp_setup_tri_coef( struct lp_setup_context *setup,
struct lp_rast_shader_inputs *inputs,
- const struct lp_tri_info *info)
+ const float (*v0)[4],
+ const float (*v1)[4],
+ const float (*v2)[4],
+ boolean frontfacing)
{
unsigned slot;
+ struct lp_tri_info info;
+ float dx01 = v0[0][0] - v1[0][0];
+ float dy01 = v0[0][1] - v1[0][1];
+ float dx20 = v2[0][0] - v0[0][0];
+ float dy20 = v2[0][1] - v0[0][1];
+ float oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01);
+
+ info.v0 = v0;
+ info.v1 = v1;
+ info.v2 = v2;
+ info.frontfacing = frontfacing;
+ info.x0_center = v0[0][0] - setup->pixel_offset;
+ info.y0_center = v0[0][1] - setup->pixel_offset;
+ info.dx01_ooa = dx01 * oneoverarea;
+ info.dx20_ooa = dx20 * oneoverarea;
+ info.dy01_ooa = dy01 * oneoverarea;
+ info.dy20_ooa = dy20 * oneoverarea;
+
/* The internal position input is in slot zero:
*/
- linear_coef(inputs, info, 0, 0);
+ linear_coef(inputs, &info, 0, 0);
/* setup interpolation for all the remaining attributes:
*/
@@ -167,19 +188,19 @@ void lp_setup_tri_coef( struct lp_setup_context *setup,
switch (setup->fs.input[slot].interp) {
case LP_INTERP_CONSTANT:
if (setup->flatshade_first) {
- constant_coef4(inputs, info, slot+1, info->v0[vert_attr]);
+ constant_coef4(inputs, &info, slot+1, info.v0[vert_attr]);
}
else {
- constant_coef4(inputs, info, slot+1, info->v2[vert_attr]);
+ constant_coef4(inputs, &info, slot+1, info.v2[vert_attr]);
}
break;
case LP_INTERP_LINEAR:
- linear_coef(inputs, info, slot+1, vert_attr);
+ linear_coef(inputs, &info, slot+1, vert_attr);
break;
case LP_INTERP_PERSPECTIVE:
- perspective_coef(inputs, info, slot+1, vert_attr);
+ perspective_coef(inputs, &info, slot+1, vert_attr);
break;
case LP_INTERP_POSITION:
@@ -190,7 +211,7 @@ void lp_setup_tri_coef( struct lp_setup_context *setup,
break;
case LP_INTERP_FACING:
- setup_facing_coef(inputs, info, slot+1);
+ setup_facing_coef(inputs, &info, slot+1);
break;
default:
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_context.h b/src/gallium/drivers/llvmpipe/lp_setup_context.h
index 877a492c6d..80b356476a 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_context.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup_context.h
@@ -49,8 +49,6 @@
#define LP_SETUP_NEW_SCISSOR 0x08
-struct lp_scene_queue;
-
/** Max number of scenes */
#define MAX_SCENES 2
@@ -70,6 +68,7 @@ struct lp_setup_context
{
struct vbuf_render base;
+ struct pipe_context *pipe;
struct vertex_info *vertex_info;
uint prim;
uint vertex_size;
@@ -83,9 +82,12 @@ struct lp_setup_context
*/
struct draw_stage *vbuf;
unsigned num_threads;
+ unsigned scene_idx;
struct lp_scene *scenes[MAX_SCENES]; /**< all the scenes */
struct lp_scene *scene; /**< current scene being built */
- struct lp_scene_queue *empty_scenes; /**< queue of empty scenes */
+
+ struct lp_fence *last_fence;
+ struct llvmpipe_query *active_query;
boolean flatshade_first;
boolean ccw_is_frontface;
@@ -105,12 +107,12 @@ struct lp_setup_context
struct {
unsigned flags;
union lp_rast_cmd_arg color; /**< lp_rast_clear_color() cmd */
- struct lp_rast_clearzs clearzs; /**< lp_rast_clear_zstencil() cmd */
+ unsigned zsmask;
+ unsigned zsvalue; /**< lp_rast_clear_zstencil() cmd */
} clear;
enum setup_state {
SETUP_FLUSHED, /**< scene is null */
- SETUP_EMPTY, /**< scene exists but has only state changes */
SETUP_CLEARED, /**< scene exists but has only clears */
SETUP_ACTIVE /**< scene exists and has at least one draw/query */
} state;
@@ -156,14 +158,15 @@ void lp_setup_choose_triangle( struct lp_setup_context *setup );
void lp_setup_choose_line( struct lp_setup_context *setup );
void lp_setup_choose_point( struct lp_setup_context *setup );
-struct lp_scene *lp_setup_get_current_scene(struct lp_setup_context *setup);
-
void lp_setup_init_vbuf(struct lp_setup_context *setup);
-void lp_setup_update_state( struct lp_setup_context *setup );
+void lp_setup_update_state( struct lp_setup_context *setup,
+ boolean update_scene);
void lp_setup_destroy( struct lp_setup_context *setup );
+void lp_setup_flush_and_restart(struct lp_setup_context *setup);
+
void
lp_setup_print_triangle(struct lp_setup_context *setup,
const float (*v0)[4],
@@ -182,11 +185,12 @@ lp_setup_alloc_triangle(struct lp_scene *scene,
unsigned nr_planes,
unsigned *tri_size);
-void
+boolean
lp_setup_bin_triangle( struct lp_setup_context *setup,
struct lp_rast_triangle *tri,
const struct u_rect *bbox,
int nr_planes );
-#endif
+void lp_setup_flush_and_restart(struct lp_setup_context *setup);
+#endif
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_line.c b/src/gallium/drivers/llvmpipe/lp_setup_line.c
index ce2da55cf4..9f090d1992 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_line.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_line.c
@@ -263,12 +263,12 @@ static INLINE float fracf(float f)
-static void
-lp_setup_line( struct lp_setup_context *setup,
+static boolean
+try_setup_line( struct lp_setup_context *setup,
const float (*v1)[4],
const float (*v2)[4])
{
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ struct lp_scene *scene = setup->scene;
struct lp_rast_triangle *line;
struct lp_line_info info;
float width = MAX2(1.0, setup->line_width);
@@ -536,13 +536,13 @@ lp_setup_line( struct lp_setup_context *setup,
bbox.y1 < bbox.y0) {
if (0) debug_printf("empty bounding box\n");
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
if (!u_rect_test_intersection(&setup->draw_region, &bbox)) {
if (0) debug_printf("offscreen\n");
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
u_rect_find_intersection(&setup->draw_region, &bbox);
@@ -552,7 +552,7 @@ lp_setup_line( struct lp_setup_context *setup,
nr_planes,
&tri_bytes);
if (!line)
- return;
+ return FALSE;
#ifdef DEBUG
line->v[0][0] = v1[0][0];
@@ -585,6 +585,8 @@ lp_setup_line( struct lp_setup_context *setup,
line->inputs.facing = 1.0F;
line->inputs.state = setup->fs.stored;
+ line->inputs.disable = FALSE;
+ line->inputs.opaque = FALSE;
for (i = 0; i < 4; i++) {
struct lp_rast_plane *plane = &line->plane[i];
@@ -687,9 +689,23 @@ lp_setup_line( struct lp_setup_context *setup,
line->plane[7].eo = 0;
}
- lp_setup_bin_triangle(setup, line, &bbox, nr_planes);
+ return lp_setup_bin_triangle(setup, line, &bbox, nr_planes);
}
-
+
+
+static void lp_setup_line( struct lp_setup_context *setup,
+ const float (*v0)[4],
+ const float (*v1)[4] )
+{
+ if (!try_setup_line( setup, v0, v1 ))
+ {
+ lp_setup_flush_and_restart(setup);
+
+ if (!try_setup_line( setup, v0, v1 ))
+ assert(0);
+ }
+}
+
void lp_setup_choose_line( struct lp_setup_context *setup )
{
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_point.c b/src/gallium/drivers/llvmpipe/lp_setup_point.c
index 6ae318d328..5538987151 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_point.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_point.c
@@ -210,8 +210,9 @@ subpixel_snap(float a)
}
-static void lp_setup_point( struct lp_setup_context *setup,
- const float (*v0)[4] )
+static boolean
+try_setup_point( struct lp_setup_context *setup,
+ const float (*v0)[4] )
{
/* x/y positions in fixed point */
const int sizeAttr = setup->psize;
@@ -228,7 +229,7 @@ static void lp_setup_point( struct lp_setup_context *setup,
const int x0 = subpixel_snap(v0[0][0] - setup->pixel_offset) - fixed_width/2;
const int y0 = subpixel_snap(v0[0][1] - setup->pixel_offset) - fixed_width/2;
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ struct lp_scene *scene = setup->scene;
struct lp_rast_triangle *point;
unsigned bytes;
struct u_rect bbox;
@@ -259,7 +260,7 @@ static void lp_setup_point( struct lp_setup_context *setup,
if (!u_rect_test_intersection(&setup->draw_region, &bbox)) {
if (0) debug_printf("offscreen\n");
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
u_rect_find_intersection(&setup->draw_region, &bbox);
@@ -269,7 +270,7 @@ static void lp_setup_point( struct lp_setup_context *setup,
nr_planes,
&bytes);
if (!point)
- return;
+ return FALSE;
#ifdef DEBUG
point->v[0][0] = v0[0][0];
@@ -288,6 +289,8 @@ static void lp_setup_point( struct lp_setup_context *setup,
point->inputs.facing = 1.0F;
point->inputs.state = setup->fs.stored;
+ point->inputs.disable = FALSE;
+ point->inputs.opaque = FALSE;
{
point->plane[0].dcdx = -1;
@@ -315,7 +318,20 @@ static void lp_setup_point( struct lp_setup_context *setup,
point->plane[3].eo = 0;
}
- lp_setup_bin_triangle(setup, point, &bbox, nr_planes);
+ return lp_setup_bin_triangle(setup, point, &bbox, nr_planes);
+}
+
+
+static void lp_setup_point( struct lp_setup_context *setup,
+ const float (*v0)[4] )
+{
+ if (!try_setup_point( setup, v0 ))
+ {
+ lp_setup_flush_and_restart(setup);
+
+ if (!try_setup_point( setup, v0 ))
+ assert(0);
+ }
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 0180d95090..5090f82ab5 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -160,44 +160,79 @@ lp_setup_print_triangle(struct lp_setup_context *setup,
}
-lp_rast_cmd lp_rast_tri_tab[9] = {
- NULL, /* should be impossible */
- lp_rast_triangle_1,
- lp_rast_triangle_2,
- lp_rast_triangle_3,
- lp_rast_triangle_4,
- lp_rast_triangle_5,
- lp_rast_triangle_6,
- lp_rast_triangle_7,
- lp_rast_triangle_8
+static unsigned
+lp_rast_tri_tab[9] = {
+ 0, /* should be impossible */
+ LP_RAST_OP_TRIANGLE_1,
+ LP_RAST_OP_TRIANGLE_2,
+ LP_RAST_OP_TRIANGLE_3,
+ LP_RAST_OP_TRIANGLE_4,
+ LP_RAST_OP_TRIANGLE_5,
+ LP_RAST_OP_TRIANGLE_6,
+ LP_RAST_OP_TRIANGLE_7,
+ LP_RAST_OP_TRIANGLE_8
};
+
+
+/**
+ * The primitive covers the whole tile- shade whole tile.
+ *
+ * \param tx, ty the tile position in tiles, not pixels
+ */
+static boolean
+lp_setup_whole_tile(struct lp_setup_context *setup,
+ const struct lp_rast_shader_inputs *inputs,
+ int tx, int ty)
+{
+ struct lp_scene *scene = setup->scene;
+
+ LP_COUNT(nr_fully_covered_64);
+
+ /* if variant is opaque and scissor doesn't effect the tile */
+ if (inputs->opaque) {
+ if (!scene->fb.zsbuf) {
+ /*
+ * All previous rendering will be overwritten so reset the bin.
+ */
+ lp_scene_bin_reset( scene, tx, ty );
+ }
+
+ LP_COUNT(nr_shade_opaque_64);
+ return lp_scene_bin_command( scene, tx, ty,
+ LP_RAST_OP_SHADE_TILE_OPAQUE,
+ lp_rast_arg_inputs(inputs) );
+ } else {
+ LP_COUNT(nr_shade_64);
+ return lp_scene_bin_command( scene, tx, ty,
+ LP_RAST_OP_SHADE_TILE,
+ lp_rast_arg_inputs(inputs) );
+ }
+}
+
+
/**
* Do basic setup for triangle rasterization and determine which
* framebuffer tiles are touched. Put the triangle in the scene's
* bins for the tiles which we overlap.
*/
-static void
+static boolean
do_triangle_ccw(struct lp_setup_context *setup,
const float (*v0)[4],
const float (*v1)[4],
const float (*v2)[4],
boolean frontfacing )
{
- struct lp_scene *scene = lp_setup_get_current_scene(setup);
+ struct lp_scene *scene = setup->scene;
struct lp_rast_triangle *tri;
int x[3];
int y[3];
- float dy01, dy20;
- float dx01, dx20;
- float oneoverarea;
- struct lp_tri_info info;
int area;
struct u_rect bbox;
unsigned tri_bytes;
int i;
int nr_planes = 3;
-
+
if (0)
lp_setup_print_triangle(setup, v0, v1, v2);
@@ -241,13 +276,13 @@ do_triangle_ccw(struct lp_setup_context *setup,
bbox.y1 < bbox.y0) {
if (0) debug_printf("empty bounding box\n");
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
if (!u_rect_test_intersection(&setup->draw_region, &bbox)) {
if (0) debug_printf("offscreen\n");
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
u_rect_find_intersection(&setup->draw_region, &bbox);
@@ -257,7 +292,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
nr_planes,
&tri_bytes);
if (!tri)
- return;
+ return FALSE;
#ifdef DEBUG
tri->v[0][0] = v0[0][0];
@@ -288,37 +323,18 @@ do_triangle_ccw(struct lp_setup_context *setup,
if (area <= 0) {
lp_scene_putback_data( scene, tri_bytes );
LP_COUNT(nr_culled_tris);
- return;
+ return TRUE;
}
-
- /*
- */
- dx01 = v0[0][0] - v1[0][0];
- dy01 = v0[0][1] - v1[0][1];
- dx20 = v2[0][0] - v0[0][0];
- dy20 = v2[0][1] - v0[0][1];
- oneoverarea = 1.0f / (dx01 * dy20 - dx20 * dy01);
-
- info.v0 = v0;
- info.v1 = v1;
- info.v2 = v2;
- info.frontfacing = frontfacing;
- info.x0_center = v0[0][0] - setup->pixel_offset;
- info.y0_center = v0[0][1] - setup->pixel_offset;
- info.dx01_ooa = dx01 * oneoverarea;
- info.dx20_ooa = dx20 * oneoverarea;
- info.dy01_ooa = dy01 * oneoverarea;
- info.dy20_ooa = dy20 * oneoverarea;
-
/* Setup parameter interpolants:
*/
- lp_setup_tri_coef( setup, &tri->inputs, &info );
+ lp_setup_tri_coef( setup, &tri->inputs, v0, v1, v2, frontfacing );
tri->inputs.facing = frontfacing ? 1.0F : -1.0F;
+ tri->inputs.disable = FALSE;
+ tri->inputs.opaque = setup->fs.current.variant->opaque;
tri->inputs.state = setup->fs.stored;
-
for (i = 0; i < 3; i++) {
struct lp_rast_plane *plane = &tri->plane[i];
@@ -420,70 +436,98 @@ do_triangle_ccw(struct lp_setup_context *setup,
tri->plane[6].eo = 0;
}
- lp_setup_bin_triangle( setup, tri, &bbox, nr_planes );
+ return lp_setup_bin_triangle( setup, tri, &bbox, nr_planes );
+}
+
+/*
+ * Round to nearest less or equal power of two of the input.
+ *
+ * Undefined if no bit set exists, so code should check against 0 first.
+ */
+static INLINE uint32_t
+floor_pot(uint32_t n)
+{
+#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
+ if (n == 0)
+ return 0;
+
+ __asm__("bsr %1,%0"
+ : "=r" (n)
+ : "rm" (n));
+ return 1 << n;
+#else
+ n |= (n >> 1);
+ n |= (n >> 2);
+ n |= (n >> 4);
+ n |= (n >> 8);
+ n |= (n >> 16);
+ return n - (n >> 1);
+#endif
}
-void
+boolean
lp_setup_bin_triangle( struct lp_setup_context *setup,
struct lp_rast_triangle *tri,
const struct u_rect *bbox,
int nr_planes )
{
struct lp_scene *scene = setup->scene;
- struct lp_fragment_shader_variant *variant = setup->fs.current.variant;
- int ix0, ix1, iy0, iy1;
int i;
- /*
- * All fields of 'tri' are now set. The remaining code here is
- * concerned with binning.
+ /* What is the largest power-of-two boundary this triangle crosses:
*/
+ int dx = floor_pot((bbox->x0 ^ bbox->x1) |
+ (bbox->y0 ^ bbox->y1));
- /* Convert to tile coordinates, and inclusive ranges:
+ /* The largest dimension of the rasterized area of the triangle
+ * (aligned to a 4x4 grid), rounded down to the nearest power of two:
*/
+ int sz = floor_pot((bbox->x1 - (bbox->x0 & ~3)) |
+ (bbox->y1 - (bbox->y0 & ~3)));
+
if (nr_planes == 3) {
- int ix0 = bbox->x0 / 16;
- int iy0 = bbox->y0 / 16;
- int ix1 = bbox->x1 / 16;
- int iy1 = bbox->y1 / 16;
-
- if (iy0 == iy1 && ix0 == ix1)
+ if (sz < 4 && dx < 64)
{
+ /* Triangle is contained in a single 4x4 stamp:
+ */
+ int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8);
+
+ return lp_scene_bin_command( scene,
+ bbox->x0/64, bbox->y0/64,
+ LP_RAST_OP_TRIANGLE_3_4,
+ lp_rast_arg_triangle(tri, mask) );
+ }
+
+ if (sz < 16 && dx < 64)
+ {
+ int mask = (bbox->x0 & 63 & ~3) | ((bbox->y0 & 63 & ~3) << 8);
/* Triangle is contained in a single 16x16 block:
*/
- int mask = (ix0 & 3) | ((iy0 & 3) << 4);
-
- lp_scene_bin_command( scene, ix0/4, iy0/4,
- lp_rast_triangle_3_16,
- lp_rast_arg_triangle(tri, mask) );
- return;
+ return lp_scene_bin_command( scene,
+ bbox->x0/64, bbox->y0/64,
+ LP_RAST_OP_TRIANGLE_3_16,
+ lp_rast_arg_triangle(tri, mask) );
}
}
- ix0 = bbox->x0 / TILE_SIZE;
- iy0 = bbox->y0 / TILE_SIZE;
- ix1 = bbox->x1 / TILE_SIZE;
- iy1 = bbox->y1 / TILE_SIZE;
-
- /*
- * Clamp to framebuffer size
- */
- assert(ix0 == MAX2(ix0, 0));
- assert(iy0 == MAX2(iy0, 0));
- assert(ix1 == MIN2(ix1, scene->tiles_x - 1));
- assert(iy1 == MIN2(iy1, scene->tiles_y - 1));
/* Determine which tile(s) intersect the triangle's bounding box
*/
- if (iy0 == iy1 && ix0 == ix1)
+ if (dx < TILE_SIZE)
{
+ int ix0 = bbox->x0 / TILE_SIZE;
+ int iy0 = bbox->y0 / TILE_SIZE;
+
+ assert(iy0 == bbox->y1 / TILE_SIZE &&
+ ix0 == bbox->x1 / TILE_SIZE);
+
/* Triangle is contained in a single tile:
*/
- lp_scene_bin_command( scene, ix0, iy0,
- lp_rast_tri_tab[nr_planes],
- lp_rast_arg_triangle(tri, (1<<nr_planes)-1) );
+ return lp_scene_bin_command( scene, ix0, iy0,
+ lp_rast_tri_tab[nr_planes],
+ lp_rast_arg_triangle(tri, (1<<nr_planes)-1) );
}
else
{
@@ -493,6 +537,11 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
int xstep[7];
int ystep[7];
int x, y;
+
+ int ix0 = bbox->x0 / TILE_SIZE;
+ int iy0 = bbox->y0 / TILE_SIZE;
+ int ix1 = bbox->x1 / TILE_SIZE;
+ int iy1 = bbox->y1 / TILE_SIZE;
for (i = 0; i < nr_planes; i++) {
c[i] = (tri->plane[i].c +
@@ -544,9 +593,10 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
*/
int count = util_bitcount(partial);
in = TRUE;
- lp_scene_bin_command( scene, x, y,
- lp_rast_tri_tab[count],
- lp_rast_arg_triangle(tri, partial) );
+ if (!lp_scene_bin_command( scene, x, y,
+ lp_rast_tri_tab[count],
+ lp_rast_arg_triangle(tri, partial) ))
+ goto fail;
LP_COUNT(nr_partially_covered_64);
}
@@ -554,13 +604,8 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
/* triangle covers the whole tile- shade whole tile */
LP_COUNT(nr_fully_covered_64);
in = TRUE;
- if (variant->opaque &&
- !setup->fb.zsbuf) {
- lp_scene_bin_reset( scene, x, y );
- }
- lp_scene_bin_command( scene, x, y,
- lp_rast_shade_tile,
- lp_rast_arg_inputs(&tri->inputs) );
+ if (!lp_setup_whole_tile(setup, &tri->inputs, x, y))
+ goto fail;
}
/* Iterate cx values across the region:
@@ -575,6 +620,16 @@ lp_setup_bin_triangle( struct lp_setup_context *setup,
c[i] += ystep[i];
}
}
+
+ return TRUE;
+
+fail:
+ /* Need to disable any partially binned triangle. This is easier
+ * than trying to locate all the triangle, shade-tile, etc,
+ * commands which may have been binned.
+ */
+ tri->inputs.disable = TRUE;
+ return FALSE;
}
@@ -586,7 +641,13 @@ static void triangle_cw( struct lp_setup_context *setup,
const float (*v1)[4],
const float (*v2)[4] )
{
- do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface );
+ if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface ))
+ {
+ lp_setup_flush_and_restart(setup);
+
+ if (!do_triangle_ccw( setup, v1, v0, v2, !setup->ccw_is_frontface ))
+ assert(0);
+ }
}
@@ -598,7 +659,12 @@ static void triangle_ccw( struct lp_setup_context *setup,
const float (*v1)[4],
const float (*v2)[4] )
{
- do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface );
+ if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface ))
+ {
+ lp_setup_flush_and_restart(setup);
+ if (!do_triangle_ccw( setup, v0, v1, v2, setup->ccw_is_frontface ))
+ assert(0);
+ }
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
index 51948f5bf2..6308561f24 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_vbuf.c
@@ -64,7 +64,7 @@ lp_setup_get_vertex_info(struct vbuf_render *vbr)
/* Vertex size/info depends on the latest state.
* The draw module may have issued additional state-change commands.
*/
- lp_setup_update_state(setup);
+ lp_setup_update_state(setup, FALSE);
return setup->vertex_info;
}
@@ -141,7 +141,7 @@ lp_setup_draw_elements(struct vbuf_render *vbr, const ushort *indices, uint nr)
const boolean flatshade_first = setup->flatshade_first;
unsigned i;
- lp_setup_update_state(setup);
+ lp_setup_update_state(setup, TRUE);
switch (setup->prim) {
case PIPE_PRIM_POINTS:
@@ -338,7 +338,7 @@ lp_setup_draw_arrays(struct vbuf_render *vbr, uint start, uint nr)
const boolean flatshade_first = setup->flatshade_first;
unsigned i;
- lp_setup_update_state(setup);
+ lp_setup_update_state(setup, TRUE);
switch (setup->prim) {
case PIPE_PRIM_POINTS:
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 33c1a49efe..8101e2d843 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -186,6 +186,7 @@ generate_quad_mask(LLVMBuilderRef builder,
LLVMTypeRef i32t = LLVMInt32Type();
LLVMValueRef bits[4];
LLVMValueRef mask;
+ int shift;
/*
* XXX: We'll need a different path for 16 x u8
@@ -197,10 +198,28 @@ generate_quad_mask(LLVMBuilderRef builder,
/*
* mask_input >>= (quad * 4)
*/
+
+ switch (quad) {
+ case 0:
+ shift = 0;
+ break;
+ case 1:
+ shift = 2;
+ break;
+ case 2:
+ shift = 8;
+ break;
+ case 3:
+ shift = 10;
+ break;
+ default:
+ assert(0);
+ shift = 0;
+ }
mask_input = LLVMBuildLShr(builder,
mask_input,
- LLVMConstInt(i32t, quad * 4, 0),
+ LLVMConstInt(i32t, shift, 0),
"");
/*
@@ -211,9 +230,9 @@ generate_quad_mask(LLVMBuilderRef builder,
bits[0] = LLVMConstInt(i32t, 1 << 0, 0);
bits[1] = LLVMConstInt(i32t, 1 << 1, 0);
- bits[2] = LLVMConstInt(i32t, 1 << 2, 0);
- bits[3] = LLVMConstInt(i32t, 1 << 3, 0);
-
+ bits[2] = LLVMConstInt(i32t, 1 << 4, 0);
+ bits[3] = LLVMConstInt(i32t, 1 << 5, 0);
+
mask = LLVMBuildAnd(builder, mask, LLVMConstVector(bits, 4), "");
/*
@@ -332,14 +351,13 @@ generate_fs(struct llvmpipe_context *lp,
lp_build_name(out, "color%u.%u.%c", i, attrib, "rgba"[chan]);
/* Alpha test */
- /* XXX: should the alpha reference value be passed separately? */
/* XXX: should only test the final assignment to alpha */
- if(cbuf == 0 && chan == 3) {
+ if (cbuf == 0 && chan == 3 && key->alpha.enabled) {
LLVMValueRef alpha = out;
LLVMValueRef alpha_ref_value;
alpha_ref_value = lp_jit_context_alpha_ref_value(builder, context_ptr);
alpha_ref_value = lp_build_broadcast(builder, vec_type, alpha_ref_value);
- lp_build_alpha_test(builder, &key->alpha, type,
+ lp_build_alpha_test(builder, key->alpha.func, type,
&mask, alpha, alpha_ref_value);
}
@@ -728,6 +746,9 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key)
debug_printf("fs variant %p:\n", (void *) key);
+ for (i = 0; i < key->nr_cbufs; ++i) {
+ debug_printf("cbuf_format[%u] = %s\n", i, util_format_name(key->cbuf_format[i]));
+ }
if (key->depth.enabled) {
debug_printf("depth.format = %s\n", util_format_name(key->zsbuf_format));
debug_printf("depth.func = %s\n", util_dump_func(key->depth.func, TRUE));
@@ -747,7 +768,6 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key)
if (key->alpha.enabled) {
debug_printf("alpha.func = %s\n", util_dump_func(key->alpha.func, TRUE));
- debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value);
}
if (key->blend.logicop_enable) {
@@ -791,6 +811,16 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key)
}
+void
+lp_debug_fs_variant(const struct lp_fragment_shader_variant *variant)
+{
+ debug_printf("llvmpipe: Fragment shader #%u variant #%u:\n",
+ variant->shader->no, variant->no);
+ tgsi_dump(variant->shader->base.tokens, 0);
+ dump_fs_variant_key(&variant->key);
+ debug_printf("variant->opaque = %u\n", variant->opaque);
+ debug_printf("\n");
+}
static struct lp_fragment_shader_variant *
generate_variant(struct llvmpipe_context *lp,
@@ -798,6 +828,7 @@ generate_variant(struct llvmpipe_context *lp,
const struct lp_fragment_shader_variant_key *key)
{
struct lp_fragment_shader_variant *variant;
+ boolean fullcolormask;
variant = CALLOC_STRUCT(lp_fragment_shader_variant);
if(!variant)
@@ -810,27 +841,43 @@ generate_variant(struct llvmpipe_context *lp,
memcpy(&variant->key, key, shader->variant_key_size);
- if (gallivm_debug & GALLIVM_DEBUG_IR) {
- debug_printf("llvmpipe: Creating fragment shader #%u variant #%u:\n",
- shader->no, variant->no);
- tgsi_dump(shader->base.tokens, 0);
- dump_fs_variant_key(key);
+ /*
+ * Determine whether we are touching all channels in the color buffer.
+ */
+ fullcolormask = FALSE;
+ if (key->nr_cbufs == 1) {
+ const struct util_format_description *format_desc;
+ format_desc = util_format_description(key->cbuf_format[0]);
+ if ((~key->blend.rt[0].colormask &
+ util_format_colormask(format_desc)) == 0) {
+ fullcolormask = TRUE;
+ }
}
- generate_fragment(lp, shader, variant, RAST_WHOLE);
- generate_fragment(lp, shader, variant, RAST_EDGE_TEST);
-
- /* TODO: most of these can be relaxed, in particular the colormask */
variant->opaque =
!key->blend.logicop_enable &&
!key->blend.rt[0].blend_enable &&
- key->blend.rt[0].colormask == 0xf &&
+ fullcolormask &&
!key->stencil[0].enabled &&
!key->alpha.enabled &&
!key->depth.enabled &&
!shader->info.uses_kill
? TRUE : FALSE;
+
+ if (gallivm_debug & GALLIVM_DEBUG_IR) {
+ lp_debug_fs_variant(variant);
+ }
+
+ generate_fragment(lp, shader, variant, RAST_EDGE_TEST);
+
+ if (variant->opaque) {
+ /* Specialized shader, which doesn't need to read the color buffer. */
+ generate_fragment(lp, shader, variant, RAST_WHOLE);
+ } else {
+ variant->jit_function[RAST_WHOLE] = variant->jit_function[RAST_EDGE_TEST];
+ }
+
return variant;
}
@@ -1056,25 +1103,22 @@ make_variant_key(struct llvmpipe_context *lp,
key->nr_cbufs = lp->framebuffer.nr_cbufs;
for (i = 0; i < lp->framebuffer.nr_cbufs; i++) {
+ enum pipe_format format = lp->framebuffer.cbufs[i]->format;
struct pipe_rt_blend_state *blend_rt = &key->blend.rt[i];
const struct util_format_description *format_desc;
- unsigned chan;
- format_desc = util_format_description(lp->framebuffer.cbufs[i]->format);
+ key->cbuf_format[i] = format;
+
+ format_desc = util_format_description(format);
assert(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_RGB ||
format_desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB);
blend_rt->colormask = lp->blend->rt[i].colormask;
- /* mask out color channels not present in the color buffer.
- * Should be simple to incorporate per-cbuf writemasks:
+ /*
+ * Mask out color channels not present in the color buffer.
*/
- for(chan = 0; chan < 4; ++chan) {
- enum util_format_swizzle swizzle = format_desc->swizzle[chan];
-
- if(swizzle > UTIL_FORMAT_SWIZZLE_W)
- blend_rt->colormask &= ~(1 << chan);
- }
+ blend_rt->colormask &= util_format_colormask(format_desc);
/*
* Our swizzled render tiles always have an alpha channel, but the linear
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.h b/src/gallium/drivers/llvmpipe/lp_state_fs.h
index 33c480010d..2914e7d7ef 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.h
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.h
@@ -49,14 +49,21 @@ struct lp_fragment_shader_variant_key
{
struct pipe_depth_state depth;
struct pipe_stencil_state stencil[2];
- struct pipe_alpha_state alpha;
struct pipe_blend_state blend;
- enum pipe_format zsbuf_format;
+
+ struct {
+ unsigned enabled:1;
+ unsigned func:3;
+ } alpha;
+
unsigned nr_cbufs:8;
unsigned nr_samplers:8; /* actually derivable from just the shader */
unsigned flatshade:1;
unsigned occlusion_count:1;
+ enum pipe_format zsbuf_format;
+ enum pipe_format cbuf_format[PIPE_MAX_COLOR_BUFS];
+
struct lp_sampler_static_state sampler[PIPE_MAX_SAMPLERS];
};
@@ -101,4 +108,8 @@ struct lp_fragment_shader
};
+void
+lp_debug_fs_variant(const struct lp_fragment_shader_variant *variant);
+
+
#endif /* LP_STATE_FS_H_ */
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index 63ddc669c2..164242eda6 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -68,16 +68,16 @@ lp_resource_copy(struct pipe_context *pipe,
0, /* flush_flags */
FALSE, /* read_only */
TRUE, /* cpu_access */
- FALSE,
- "blit dst"); /* do_not_block */
+ FALSE, /* do_not_block */
+ "blit dest");
llvmpipe_flush_resource(pipe,
src, subsrc.face, subsrc.level,
0, /* flush_flags */
TRUE, /* read_only */
TRUE, /* cpu_access */
- FALSE,
- "blit src"); /* do_not_block */
+ FALSE, /* do_not_block */
+ "blit src");
/*
printf("surface copy from %u to %u: %u,%u to %u,%u %u x %u\n",
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 5832ea2744..a4b9f2590a 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -585,7 +585,7 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
read_only,
TRUE, /* cpu_access */
do_not_block,
- "transfer dest")) {
+ __FUNCTION__)) {
/*
* It would have blocked, but state tracker requested no to.
*/
diff --git a/src/gallium/drivers/llvmpipe/sse_mathfun.h b/src/gallium/drivers/llvmpipe/sse_mathfun.h
index 8ac2064b7b..0077f34b5c 100644
--- a/src/gallium/drivers/llvmpipe/sse_mathfun.h
+++ b/src/gallium/drivers/llvmpipe/sse_mathfun.h
@@ -94,55 +94,6 @@ v4sf sin_ps(v4sf x);
v4sf cos_ps(v4sf x);
void sincos_ps(v4sf x, v4sf *s, v4sf *c);
-#if defined (__MINGW32__)
-
-/* the ugly part below: many versions of gcc used to be completely buggy with respect to some intrinsics
- The movehl_ps is fixed in mingw 3.4.5, but I found out that all the _mm_cmp* intrinsics were completely
- broken on my mingw gcc 3.4.5 ...
-
- Note that the bug on _mm_cmp* does occur only at -O0 optimization level
-*/
-
-inline __m128 my_movehl_ps(__m128 a, const __m128 b) {
- asm (
- "movhlps %2,%0\n\t"
- : "=x" (a)
- : "0" (a), "x"(b)
- );
- return a; }
-#warning "redefined _mm_movehl_ps (see gcc bug 21179)"
-#define _mm_movehl_ps my_movehl_ps
-
-inline __m128 my_cmplt_ps(__m128 a, const __m128 b) {
- asm (
- "cmpltps %2,%0\n\t"
- : "=x" (a)
- : "0" (a), "x"(b)
- );
- return a;
- }
-inline __m128 my_cmpgt_ps(__m128 a, const __m128 b) {
- asm (
- "cmpnleps %2,%0\n\t"
- : "=x" (a)
- : "0" (a), "x"(b)
- );
- return a;
-}
-inline __m128 my_cmpeq_ps(__m128 a, const __m128 b) {
- asm (
- "cmpeqps %2,%0\n\t"
- : "=x" (a)
- : "0" (a), "x"(b)
- );
- return a;
-}
-#warning "redefined _mm_cmpxx_ps functions..."
-#define _mm_cmplt_ps my_cmplt_ps
-#define _mm_cmpgt_ps my_cmpgt_ps
-#define _mm_cmpeq_ps my_cmpeq_ps
-#endif
-
#ifndef USE_SSE2
typedef union xmm_mm_union {
__m128 xmm;
diff --git a/src/gallium/drivers/nouveau/nouveau_class.h b/src/gallium/drivers/nouveau/nouveau_class.h
deleted file mode 100644
index d9f35b4c4b..0000000000
--- a/src/gallium/drivers/nouveau/nouveau_class.h
+++ /dev/null
@@ -1,10059 +0,0 @@
-/*************************************************************************
-
- Autogenerated file, do not edit !
-
- This file was generated by renouveau-gen from renouveau.xml, the
- XML database of nvidia objects and methods. renouveau-gen and
- renouveau.xml can be found in CVS module renouveau of sourceforge.net
- project nouveau:
-
-cvs -z3 -d:pserver:anonymous@nouveau.cvs.sourceforge.net:/cvsroot/nouveau co -P renouveau
-
-**************************************************************************
-
- Copyright (C) 2006-2008 :
- Dmitry Baryshkov,
- Laurent Carlier,
- Matthieu Castet,
- Dawid Gajownik,
- Jeremy Kolb,
- Stephane Loeuillet,
- Patrice Mandin,
- Stephane Marchesin,
- Serge Martin,
- Sylvain Munaut,
- Simon Raffeiner,
- Ben Skeggs,
- Erik Waling,
- koala_br,
-
-All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice (including the
-next paragraph) shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-*************************************************************************/
-
-
-#ifndef NOUVEAU_REG_H
-#define NOUVEAU_REG_H 1
-
-
-#define NV01_ROOT 0x00000001
-
-
-
-#define NV01_CONTEXT_DMA 0x00000002
-
-
-
-#define NV01_DEVICE 0x00000003
-
-
-
-#define NV01_TIMER 0x00000004
-
-#define NV01_TIMER_SYNCHRONIZE 0x00000100
-#define NV01_TIMER_STOP_ALARM 0x00000104
-#define NV01_TIMER_DMA_NOTIFY 0x00000180
-#define NV01_TIMER_TIME(x) (0x00000300+((x)*4))
-#define NV01_TIMER_TIME__SIZE 0x00000002
-#define NV01_TIMER_ALARM_NOTIFY 0x00000308
-
-
-#define NV01_CONTEXT_BETA1 0x00000012
-
-#define NV01_CONTEXT_BETA1_NOP 0x00000100
-#define NV01_CONTEXT_BETA1_NOTIFY 0x00000104
-#define NV01_CONTEXT_BETA1_DMA_NOTIFY 0x00000180
-#define NV01_CONTEXT_BETA1_BETA_1D31 0x00000300
-
-
-#define NV01_CONTEXT_COLOR_KEY 0x00000017
-
-#define NV01_CONTEXT_COLOR_KEY_NOP 0x00000100
-#define NV01_CONTEXT_COLOR_KEY_NOTIFY 0x00000104
-#define NV01_CONTEXT_COLOR_KEY_DMA_NOTIFY 0x00000180
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT 0x00000300
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16A8Y8 0x00000001
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X24Y8 0x00000002
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16A1R5G5B5 0x00000003
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X17R5G5B5 0x00000004
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A8R8G8B8 0x00000005
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X8R8G8B8 0x00000006
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A16Y16 0x00000007
-#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16Y16 0x00000008
-#define NV01_CONTEXT_COLOR_KEY_COLOR 0x00000304
-
-
-#define NV04_CONTEXT_COLOR_KEY 0x00000057
-
-
-
-#define NV01_CONTEXT_PATTERN 0x00000018
-
-#define NV01_CONTEXT_PATTERN_NOP 0x00000100
-#define NV01_CONTEXT_PATTERN_NOTIFY 0x00000104
-#define NV01_CONTEXT_PATTERN_DMA_NOTIFY 0x00000180
-#define NV01_CONTEXT_PATTERN_COLOR_FORMAT 0x00000300
-#define NV01_CONTEXT_PATTERN_MONOCHROME_FORMAT 0x00000304
-#define NV01_CONTEXT_PATTERN_SHAPE 0x00000308
-#define NV01_CONTEXT_PATTERN_COLOR(x) (0x00000310+((x)*4))
-#define NV01_CONTEXT_PATTERN_COLOR__SIZE 0x00000002
-#define NV01_CONTEXT_PATTERN_PATTERN(x) (0x00000318+((x)*4))
-#define NV01_CONTEXT_PATTERN_PATTERN__SIZE 0x00000002
-
-
-#define NV01_CONTEXT_CLIP_RECTANGLE 0x00000019
-
-#define NV01_CONTEXT_CLIP_RECTANGLE_NOP 0x00000100
-#define NV01_CONTEXT_CLIP_RECTANGLE_NOTIFY 0x00000104
-#define NV01_CONTEXT_CLIP_RECTANGLE_DMA_NOTIFY 0x00000180
-#define NV01_CONTEXT_CLIP_RECTANGLE_POINT 0x00000300
-#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X_SHIFT 0
-#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X_MASK 0x0000ffff
-#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y_SHIFT 16
-#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y_MASK 0xffff0000
-#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE 0x00000304
-#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W_SHIFT 0
-#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W_MASK 0x0000ffff
-#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H_SHIFT 16
-#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H_MASK 0xffff0000
-
-
-#define NV01_RENDER_SOLID_LINE 0x0000001c
-
-#define NV01_RENDER_SOLID_LINE_NOP 0x00000100
-#define NV01_RENDER_SOLID_LINE_NOTIFY 0x00000104
-#define NV01_RENDER_SOLID_LINE_PATCH 0x0000010c
-#define NV01_RENDER_SOLID_LINE_DMA_NOTIFY 0x00000180
-#define NV01_RENDER_SOLID_LINE_CLIP_RECTANGLE 0x00000184
-#define NV01_RENDER_SOLID_LINE_PATTERN 0x00000188
-#define NV01_RENDER_SOLID_LINE_ROP 0x0000018c
-#define NV01_RENDER_SOLID_LINE_BETA1 0x00000190
-#define NV01_RENDER_SOLID_LINE_SURFACE 0x00000194
-#define NV01_RENDER_SOLID_LINE_OPERATION 0x000002fc
-#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_AND 0x00000000
-#define NV01_RENDER_SOLID_LINE_OPERATION_ROP_AND 0x00000001
-#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_AND 0x00000002
-#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY 0x00000003
-#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_PREMULT 0x00000005
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT 0x00000300
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16A8Y8 0x00000001
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X24Y8 0x00000002
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16A1R5G5B5 0x00000003
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X17R5G5B5 0x00000004
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A8R8G8B8 0x00000005
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X8R8G8B8 0x00000006
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A16Y16 0x00000007
-#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16Y16 0x00000008
-#define NV01_RENDER_SOLID_LINE_COLOR 0x00000304
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0(x) (0x00000400+((x)*8))
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X_SHIFT 0
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y_SHIFT 16
-#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1(x) (0x00000404+((x)*8))
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X_SHIFT 0
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y_SHIFT 16
-#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X(x) (0x00000480+((x)*16))
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y(x) (0x00000484+((x)*16))
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X(x) (0x00000488+((x)*16))
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y(x) (0x0000048c+((x)*16))
-#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_POLYLINE(x) (0x00000500+((x)*4))
-#define NV01_RENDER_SOLID_LINE_POLYLINE__SIZE 0x00000020
-#define NV01_RENDER_SOLID_LINE_POLYLINE_X_SHIFT 0
-#define NV01_RENDER_SOLID_LINE_POLYLINE_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_LINE_POLYLINE_Y_SHIFT 16
-#define NV01_RENDER_SOLID_LINE_POLYLINE_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X(x) (0x00000580+((x)*8))
-#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y(x) (0x00000584+((x)*8))
-#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR(x) (0x00000600+((x)*8))
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT(x) (0x00000604+((x)*8))
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT__SIZE 0x00000010
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X_SHIFT 0
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y_SHIFT 16
-#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y_MASK 0xffff0000
-
-
-#define NV04_RENDER_SOLID_LINE 0x0000005c
-
-#define NV04_RENDER_SOLID_LINE_BETA4 0x00000194
-#define NV04_RENDER_SOLID_LINE_SURFACE 0x00000198
-
-
-#define NV01_RENDER_SOLID_TRIANGLE 0x0000001d
-
-#define NV01_RENDER_SOLID_TRIANGLE_NOP 0x00000100
-#define NV01_RENDER_SOLID_TRIANGLE_NOTIFY 0x00000104
-#define NV01_RENDER_SOLID_TRIANGLE_PATCH 0x0000010c
-#define NV01_RENDER_SOLID_TRIANGLE_DMA_NOTIFY 0x00000180
-#define NV01_RENDER_SOLID_TRIANGLE_CLIP_RECTANGLE 0x00000184
-#define NV01_RENDER_SOLID_TRIANGLE_PATTERN 0x00000188
-#define NV01_RENDER_SOLID_TRIANGLE_ROP 0x0000018c
-#define NV01_RENDER_SOLID_TRIANGLE_BETA1 0x00000190
-#define NV01_RENDER_SOLID_TRIANGLE_SURFACE 0x00000194
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION 0x000002fc
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_AND 0x00000000
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_ROP_AND 0x00000001
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_AND 0x00000002
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY 0x00000003
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_PREMULT 0x00000005
-#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT 0x00000300
-#define NV01_RENDER_SOLID_TRIANGLE_COLOR 0x00000304
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0 0x00000310
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1 0x00000314
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2 0x00000318
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_X 0x00000320
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_Y 0x00000324
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_X 0x00000328
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_Y 0x0000032c
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_X 0x00000330
-#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_Y 0x00000334
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH(x) (0x00000400+((x)*4))
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH__SIZE 0x00000020
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X(x) (0x00000480+((x)*8))
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X__SIZE 0x00000010
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y(x) (0x00000484+((x)*8))
-#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y__SIZE 0x00000010
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR(x) (0x00000500+((x)*16))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR__SIZE 0x00000008
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0(x) (0x00000504+((x)*16))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0__SIZE 0x00000008
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1(x) (0x00000508+((x)*16))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1__SIZE 0x00000008
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2(x) (0x0000050c+((x)*16))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2__SIZE 0x00000008
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR(x) (0x00000580+((x)*8))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR__SIZE 0x00000010
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT(x) (0x00000584+((x)*8))
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT__SIZE 0x00000010
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X_SHIFT 0
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y_SHIFT 16
-#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y_MASK 0xffff0000
-
-
-#define NV04_RENDER_SOLID_TRIANGLE 0x0000005d
-
-#define NV04_RENDER_SOLID_TRIANGLE_BETA4 0x00000194
-#define NV04_RENDER_SOLID_TRIANGLE_SURFACE 0x00000198
-
-
-#define NV01_RENDER_SOLID_RECTANGLE 0x0000001e
-
-#define NV01_RENDER_SOLID_RECTANGLE_NOP 0x00000100
-#define NV01_RENDER_SOLID_RECTANGLE_NOTIFY 0x00000104
-#define NV01_RENDER_SOLID_RECTANGLE_PATCH 0x0000010c
-#define NV01_RENDER_SOLID_RECTANGLE_DMA_NOTIFY 0x00000180
-#define NV01_RENDER_SOLID_RECTANGLE_CLIP_RECTANGLE 0x00000184
-#define NV01_RENDER_SOLID_RECTANGLE_PATTERN 0x00000188
-#define NV01_RENDER_SOLID_RECTANGLE_ROP 0x0000018c
-#define NV01_RENDER_SOLID_RECTANGLE_BETA1 0x00000190
-#define NV01_RENDER_SOLID_RECTANGLE_SURFACE 0x00000194
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION 0x000002fc
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_AND 0x00000000
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_ROP_AND 0x00000001
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_AND 0x00000002
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY 0x00000003
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_PREMULT 0x00000005
-#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT 0x00000300
-#define NV01_RENDER_SOLID_RECTANGLE_COLOR 0x00000304
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT(x) (0x00000400+((x)*8))
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT__SIZE 0x00000010
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X_SHIFT 0
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y_SHIFT 16
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y_MASK 0xffff0000
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE(x) (0x00000404+((x)*8))
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE__SIZE 0x00000010
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W_SHIFT 0
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W_MASK 0x0000ffff
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H_SHIFT 16
-#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H_MASK 0xffff0000
-
-
-#define NV04_RENDER_SOLID_RECTANGLE 0x0000005e
-
-#define NV04_RENDER_SOLID_RECTANGLE_BETA4 0x00000194
-#define NV04_RENDER_SOLID_RECTANGLE_SURFACE 0x00000198
-
-
-#define NV01_IMAGE_BLIT 0x0000001f
-
-#define NV01_IMAGE_BLIT_NOP 0x00000100
-#define NV01_IMAGE_BLIT_NOTIFY 0x00000104
-#define NV01_IMAGE_BLIT_PATCH 0x0000010c
-#define NV01_IMAGE_BLIT_DMA_NOTIFY 0x00000180
-#define NV01_IMAGE_BLIT_COLOR_KEY 0x00000184
-#define NV01_IMAGE_BLIT_CLIP_RECTANGLE 0x00000188
-#define NV01_IMAGE_BLIT_PATTERN 0x0000018c
-#define NV01_IMAGE_BLIT_ROP 0x00000190
-#define NV01_IMAGE_BLIT_BETA1 0x00000194
-#define NV01_IMAGE_BLIT_SURFACE 0x0000019c
-#define NV01_IMAGE_BLIT_OPERATION 0x000002fc
-#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_AND 0x00000000
-#define NV01_IMAGE_BLIT_OPERATION_ROP_AND 0x00000001
-#define NV01_IMAGE_BLIT_OPERATION_BLEND_AND 0x00000002
-#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY 0x00000003
-#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV01_IMAGE_BLIT_OPERATION_BLEND_PREMULT 0x00000005
-#define NV01_IMAGE_BLIT_IMAGE_INPUT 0x00000204
-#define NV01_IMAGE_BLIT_POINT_IN 0x00000300
-#define NV01_IMAGE_BLIT_POINT_IN_X_SHIFT 0
-#define NV01_IMAGE_BLIT_POINT_IN_X_MASK 0x0000ffff
-#define NV01_IMAGE_BLIT_POINT_IN_Y_SHIFT 16
-#define NV01_IMAGE_BLIT_POINT_IN_Y_MASK 0xffff0000
-#define NV01_IMAGE_BLIT_POINT_OUT 0x00000304
-#define NV01_IMAGE_BLIT_POINT_OUT_X_SHIFT 0
-#define NV01_IMAGE_BLIT_POINT_OUT_X_MASK 0x0000ffff
-#define NV01_IMAGE_BLIT_POINT_OUT_Y_SHIFT 16
-#define NV01_IMAGE_BLIT_POINT_OUT_Y_MASK 0xffff0000
-#define NV01_IMAGE_BLIT_SIZE 0x00000308
-#define NV01_IMAGE_BLIT_SIZE_W_SHIFT 0
-#define NV01_IMAGE_BLIT_SIZE_W_MASK 0x0000ffff
-#define NV01_IMAGE_BLIT_SIZE_H_SHIFT 16
-#define NV01_IMAGE_BLIT_SIZE_H_MASK 0xffff0000
-
-
-#define NV04_IMAGE_BLIT 0x0000005f
-
-#define NV04_IMAGE_BLIT_ROP 0x00000190
-#define NV04_IMAGE_BLIT_BETA4 0x00000198
-#define NV04_IMAGE_BLIT_SURFACE 0x0000019c
-
-
-#define NV12_IMAGE_BLIT 0x0000009f
-
-#define NV12_IMAGE_BLIT_WAIT_FOR_IDLE 0x00000108
-
-
-#define NV01_IMAGE_FROM_CPU 0x00000021
-
-#define NV01_IMAGE_FROM_CPU_NOP 0x00000100
-#define NV01_IMAGE_FROM_CPU_NOTIFY 0x00000104
-#define NV01_IMAGE_FROM_CPU_PATCH 0x0000010c
-#define NV01_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
-#define NV01_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
-#define NV01_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x00000188
-#define NV01_IMAGE_FROM_CPU_PATTERN 0x0000018c
-#define NV01_IMAGE_FROM_CPU_ROP 0x00000190
-#define NV01_IMAGE_FROM_CPU_BETA1 0x00000194
-#define NV01_IMAGE_FROM_CPU_SURFACE 0x00000198
-#define NV01_IMAGE_FROM_CPU_OPERATION 0x000002fc
-#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_AND 0x00000000
-#define NV01_IMAGE_FROM_CPU_OPERATION_ROP_AND 0x00000001
-#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_AND 0x00000002
-#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY 0x00000003
-#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_PREMULT 0x00000005
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_Y8 0x00000001
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A1R5G5B5 0x00000002
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X1R5G5B5 0x00000003
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A8R8G8B8 0x00000004
-#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X8R8G8B8 0x00000005
-#define NV01_IMAGE_FROM_CPU_POINT 0x00000304
-#define NV01_IMAGE_FROM_CPU_POINT_X_SHIFT 0
-#define NV01_IMAGE_FROM_CPU_POINT_X_MASK 0x0000ffff
-#define NV01_IMAGE_FROM_CPU_POINT_Y_SHIFT 16
-#define NV01_IMAGE_FROM_CPU_POINT_Y_MASK 0xffff0000
-#define NV01_IMAGE_FROM_CPU_SIZE_OUT 0x00000308
-#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W_SHIFT 0
-#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W_MASK 0x0000ffff
-#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H_SHIFT 16
-#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H_MASK 0xffff0000
-#define NV01_IMAGE_FROM_CPU_SIZE_IN 0x0000030c
-#define NV01_IMAGE_FROM_CPU_SIZE_IN_W_SHIFT 0
-#define NV01_IMAGE_FROM_CPU_SIZE_IN_W_MASK 0x0000ffff
-#define NV01_IMAGE_FROM_CPU_SIZE_IN_H_SHIFT 16
-#define NV01_IMAGE_FROM_CPU_SIZE_IN_H_MASK 0xffff0000
-#define NV01_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
-#define NV01_IMAGE_FROM_CPU_COLOR__SIZE 0x00000020
-
-
-#define NV04_IMAGE_FROM_CPU 0x00000061
-
-#define NV04_IMAGE_FROM_CPU_BETA4 0x00000198
-#define NV04_IMAGE_FROM_CPU_SURFACE 0x0000019c
-
-
-#define NV05_IMAGE_FROM_CPU 0x00000065
-
-#define NV05_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
-
-
-#define NV10_IMAGE_FROM_CPU 0x0000008a
-
-#define NV10_IMAGE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
-
-
-#define NV30_IMAGE_FROM_CPU 0x0000038a
-
-
-
-#define NV40_IMAGE_FROM_CPU 0x0000308a
-
-
-
-#define NV01_NULL 0x00000030
-
-
-
-#define NV03_STRETCHED_IMAGE_FROM_CPU 0x00000036
-
-#define NV03_STRETCHED_IMAGE_FROM_CPU_NOP 0x00000100
-#define NV03_STRETCHED_IMAGE_FROM_CPU_NOTIFY 0x00000104
-#define NV03_STRETCHED_IMAGE_FROM_CPU_PATCH 0x0000010c
-#define NV03_STRETCHED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
-#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
-#define NV03_STRETCHED_IMAGE_FROM_CPU_PATTERN 0x00000188
-#define NV03_STRETCHED_IMAGE_FROM_CPU_ROP 0x0000018c
-#define NV03_STRETCHED_IMAGE_FROM_CPU_BETA1 0x00000190
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SURFACE 0x00000194
-#define NV03_STRETCHED_IMAGE_FROM_CPU_OPERATION 0x000002fc
-#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN 0x00000304
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W_SHIFT 0
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W_MASK 0x0000ffff
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H_SHIFT 16
-#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H_MASK 0xffff0000
-#define NV03_STRETCHED_IMAGE_FROM_CPU_DX_DU 0x00000308
-#define NV03_STRETCHED_IMAGE_FROM_CPU_DY_DV 0x0000030c
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT 0x00000310
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X_SHIFT 0
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X_MASK 0x0000ffff
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y_SHIFT 16
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y_MASK 0xffff0000
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE 0x00000314
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W_SHIFT 0
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W_MASK 0x0000ffff
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H_SHIFT 16
-#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H_MASK 0xffff0000
-#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4 0x00000318
-#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X_SHIFT 0
-#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X_MASK 0x0000ffff
-#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y_SHIFT 16
-#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y_MASK 0xffff0000
-#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
-#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR__SIZE 0x00000020
-
-
-#define NV04_STRETCHED_IMAGE_FROM_CPU 0x00000076
-
-#define NV04_STRETCHED_IMAGE_FROM_CPU_BETA4 0x00000194
-#define NV04_STRETCHED_IMAGE_FROM_CPU_SURFACE 0x00000198
-
-
-#define NV05_STRETCHED_IMAGE_FROM_CPU 0x00000066
-
-#define NV05_STRETCHED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
-
-
-#define NV30_STRETCHED_IMAGE_FROM_CPU 0x00000366
-
-
-
-#define NV40_STRETCHED_IMAGE_FROM_CPU 0x00003066
-
-
-
-#define NV03_SCALED_IMAGE_FROM_MEMORY 0x00000037
-
-#define NV03_SCALED_IMAGE_FROM_MEMORY_NOP 0x00000100
-#define NV03_SCALED_IMAGE_FROM_MEMORY_NOTIFY 0x00000104
-#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_NOTIFY 0x00000180
-#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE 0x00000184
-#define NV03_SCALED_IMAGE_FROM_MEMORY_PATTERN 0x00000188
-#define NV03_SCALED_IMAGE_FROM_MEMORY_ROP 0x0000018c
-#define NV03_SCALED_IMAGE_FROM_MEMORY_BETA1 0x00000190
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000194
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT 0x00000300
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5 0x00000001
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X1R5G5B5 0x00000002
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8 0x00000003
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8 0x00000004
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_V8YB8U8YA8 0x00000005
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_YB8V8YA8U8 0x00000006
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5 0x00000007
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8 0x00000008
-#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_AY8 0x00000009
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION 0x00000304
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_AND 0x00000000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_ROP_AND 0x00000001
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_AND 0x00000002
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY 0x00000003
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_PREMULT 0x00000005
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT 0x00000308
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_MASK 0xffff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE 0x0000030c
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_MASK 0xffff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT 0x00000310
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_MASK 0xffff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE 0x00000314
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_MASK 0xffff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_DU_DX 0x00000318
-#define NV03_SCALED_IMAGE_FROM_MEMORY_DV_DY 0x0000031c
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE 0x00000400
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_MASK 0xffff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT 0x00000404
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_MASK 0x00ff0000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER 0x00010000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CORNER 0x00020000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_SHIFT 24
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_MASK 0xff000000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE 0x00000000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_BILINEAR 0x01000000
-#define NV03_SCALED_IMAGE_FROM_MEMORY_OFFSET 0x00000408
-#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT 0x0000040c
-#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U_SHIFT 0
-#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U_MASK 0x0000ffff
-#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V_SHIFT 16
-#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V_MASK 0xffff0000
-
-
-#define NV04_SCALED_IMAGE_FROM_MEMORY 0x00000077
-
-#define NV04_SCALED_IMAGE_FROM_MEMORY_BETA4 0x00000194
-#define NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000198
-
-
-#define NV05_SCALED_IMAGE_FROM_MEMORY 0x00000063
-
-#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION 0x000002fc
-#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_DITHER 0x00000000
-#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE 0x00000001
-#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_SUBTR_TRUNCATE 0x00000002
-
-
-#define NV10_SCALED_IMAGE_FROM_MEMORY 0x00000089
-
-#define NV10_SCALED_IMAGE_FROM_MEMORY_WAIT_FOR_IDLE 0x00000108
-
-
-#define NV30_SCALED_IMAGE_FROM_MEMORY 0x00000389
-
-
-
-#define NV40_SCALED_IMAGE_FROM_MEMORY 0x00003089
-
-
-
-#define NV04_DVD_SUBPICTURE 0x00000038
-
-#define NV04_DVD_SUBPICTURE_NOP 0x00000100
-#define NV04_DVD_SUBPICTURE_NOTIFY 0x00000104
-#define NV04_DVD_SUBPICTURE_DMA_NOTIFY 0x00000180
-#define NV04_DVD_SUBPICTURE_DMA_OVERLAY 0x00000184
-#define NV04_DVD_SUBPICTURE_DMA_IMAGEIN 0x00000188
-#define NV04_DVD_SUBPICTURE_DMA_IMAGEOUT 0x0000018c
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT 0x00000300
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_X_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_X_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_Y_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_Y_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE 0x00000304
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_W_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_W_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_H_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_H_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT 0x00000308
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_PITCH_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_PITCH_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_COLOR_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_COLOR_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_IMAGEOUT_OFFSET 0x0000030c
-#define NV04_DVD_SUBPICTURE_IMAGEIN_DELTA_DU_DX 0x00000310
-#define NV04_DVD_SUBPICTURE_IMAGEIN_DELTA_DV_DY 0x00000314
-#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE 0x00000318
-#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_W_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_W_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_H_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_H_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT 0x0000031c
-#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_PITCH_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_PITCH_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_COLOR_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_COLOR_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_IMAGEIN_OFFSET 0x00000320
-#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT 0x00000324
-#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_U_SHIFT 0
-#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_U_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_V_SHIFT 16
-#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_V_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_OVERLAY_DELTA_DU_DX 0x00000328
-#define NV04_DVD_SUBPICTURE_OVERLAY_DELTA_DV_DY 0x0000032c
-#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE 0x00000330
-#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_W_SHIFT 0
-#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_W_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_H_SHIFT 16
-#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_H_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT 0x00000334
-#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_PITCH_SHIFT 0
-#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_PITCH_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_COLOR_SHIFT 16
-#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_COLOR_MASK 0xffff0000
-#define NV04_DVD_SUBPICTURE_OVERLAY_OFFSET 0x00000338
-#define NV04_DVD_SUBPICTURE_OVERLAY_POINT 0x0000033c
-#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_U_SHIFT 0
-#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_U_MASK 0x0000ffff
-#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_V_SHIFT 16
-#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_V_MASK 0xffff0000
-
-
-#define NV10_DVD_SUBPICTURE 0x00000088
-
-#define NV10_DVD_SUBPICTURE_WAIT_FOR_IDLE 0x00000108
-
-
-#define NV04_MEMORY_TO_MEMORY_FORMAT 0x00000039
-
-#define NV04_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
-#define NV04_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104
-#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY 0x00000180
-#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN 0x00000184
-#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_OUT 0x00000188
-#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c
-#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT 0x00000310
-#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_IN 0x00000314
-#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT 0x00000318
-#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN 0x0000031c
-#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_COUNT 0x00000320
-#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT 0x00000324
-#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_SHIFT 0
-#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_MASK 0x000000ff
-#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_SHIFT 8
-#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_MASK 0x0000ff00
-#define NV04_MEMORY_TO_MEMORY_FORMAT_BUF_NOTIFY 0x00000328
-
-
-#define NV50_MEMORY_TO_MEMORY_FORMAT 0x00005039
-
-#define NV50_MEMORY_TO_MEMORY_FORMAT_SERIALIZE 0x00000110
-#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN 0x00000200
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_IN 0x00000204
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_IN 0x00000208
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_IN 0x0000020c
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_IN 0x00000210
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Z 0x00000214
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN 0x00000218
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_SHIFT 0
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_MASK 0x0000ffff
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_SHIFT 16
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_MASK 0xffff0000
-#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT 0x0000021c
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_OUT 0x00000220
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_OUT 0x00000224
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_OUT 0x00000228
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_OUT 0x0000022c
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Z 0x00000230
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT 0x00000234
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_SHIFT 0
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_MASK 0x0000ffff
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_SHIFT 16
-#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_MASK 0xffff0000
-#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x00000238
-#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x0000023c
-
-
-#define NVC0_MEMORY_TO_MEMORY_FORMAT 0x00009039
-
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_SERIALIZE 0x00000110
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_IN 0x00000204
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_IN 0x00000208
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_IN 0x0000020c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_IN 0x00000210
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Z 0x00000214
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_OUT 0x00000220
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_OUT 0x00000224
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_OUT 0x00000228
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_OUT 0x0000022c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Z 0x00000230
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x00000238
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_LOW 0x0000023c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC 0x00000300
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_PUSH (1 << 0)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_LINEAR_IN (1 << 4)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_LINEAR_OUT (1 << 8)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_NOTIFY (1 << 13)
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_INC_SHIFT 20
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_EXEC_INC_MASK 0x00f00000
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_DATA 0x00000304
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x0000030c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_LOW 0x00000310
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_PITCH_IN 0x00000314
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT 0x00000318
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN 0x0000031c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_LINE_COUNT 0x00000320
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY_ADDRESS_HIGH 0x0000032c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY_ADDRESS_LOW 0x00000330
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000334
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X 0x00000344
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y 0x00000348
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X 0x0000034c
-#define NVC0_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y 0x00000350
-
-
-#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
-
-
-
-#define NV01_MAPPING_SYSTEM 0x0000003e
-
-
-
-#define NV03_MEMORY_LOCAL_CURSOR 0x0000003f
-
-
-
-#define NV01_MEMORY_LOCAL_LINEAR 0x00000040
-
-
-
-#define NV01_MAPPING_LOCAL 0x00000041
-
-
-
-#define NV04_CONTEXT_SURFACES_2D 0x00000042
-
-#define NV04_CONTEXT_SURFACES_2D_NOP 0x00000100
-#define NV04_CONTEXT_SURFACES_2D_NOTIFY 0x00000104
-#define NV04_CONTEXT_SURFACES_2D_PM_TRIGGER 0x00000140
-#define NV04_CONTEXT_SURFACES_2D_DMA_NOTIFY 0x00000180
-#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE 0x00000184
-#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_DESTIN 0x00000188
-#define NV04_CONTEXT_SURFACES_2D_FORMAT 0x00000300
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y8 0x00000001
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_Z1R5G5B5 0x00000002
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_X1R5G5B5 0x00000003
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5 0x00000004
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y16 0x00000005
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_Z8R8G8B8 0x00000006
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_X8R8G8B8 0x00000007
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_X1A7R8G8B8 0x00000009
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8 0x0000000a
-#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y32 0x0000000b
-#define NV04_CONTEXT_SURFACES_2D_PITCH 0x00000304
-#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE_SHIFT 0
-#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE_MASK 0x0000ffff
-#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN_SHIFT 16
-#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN_MASK 0xffff0000
-#define NV04_CONTEXT_SURFACES_2D_OFFSET_SOURCE 0x00000308
-#define NV04_CONTEXT_SURFACES_2D_OFFSET_DESTIN 0x0000030c
-
-
-#define NV10_CONTEXT_SURFACES_2D 0x00000062
-
-
-
-#define NV30_CONTEXT_SURFACES_2D 0x00000362
-
-
-
-#define NV40_CONTEXT_SURFACES_2D 0x00003062
-
-
-
-#define NV03_CONTEXT_ROP 0x00000043
-
-#define NV03_CONTEXT_ROP_NOP 0x00000100
-#define NV03_CONTEXT_ROP_NOTIFY 0x00000104
-#define NV03_CONTEXT_ROP_DMA_NOTIFY 0x00000180
-#define NV03_CONTEXT_ROP_ROP 0x00000300
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_SHIFT 0
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_MASK 0x0000000f
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_CLEAR 0x00000000
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NOR 0x00000001
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND_INVERTED 0x00000002
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_COPY_INVERTED 0x00000003
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND_REVERSE 0x00000004
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_INVERT 0x00000005
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_XOR 0x00000006
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NAND 0x00000007
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND 0x00000008
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_EQUI 0x00000009
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NOOP 0x0000000a
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR_INVERTED 0x0000000b
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_COPY 0x0000000c
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR_REVERSE 0x0000000d
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR 0x0000000e
-#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_SET 0x0000000f
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_SHIFT 4
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_MASK 0x000000f0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_CLEAR 0x00000000
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NOR 0x00000010
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND_INVERTED 0x00000020
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_COPY_INVERTED 0x00000030
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND_REVERSE 0x00000040
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_INVERT 0x00000050
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_XOR 0x00000060
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NAND 0x00000070
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND 0x00000080
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_EQUI 0x00000090
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NOOP 0x000000a0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR_INVERTED 0x000000b0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_COPY 0x000000c0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR_REVERSE 0x000000d0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR 0x000000e0
-#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_SET 0x000000f0
-
-
-#define NV04_IMAGE_PATTERN 0x00000044
-
-#define NV04_IMAGE_PATTERN_NOP 0x00000100
-#define NV04_IMAGE_PATTERN_NOTIFY 0x00000104
-#define NV04_IMAGE_PATTERN_DMA_NOTIFY 0x00000180
-#define NV04_IMAGE_PATTERN_COLOR_FORMAT 0x00000300
-#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A16R5G6B5 0x00000001
-#define NV04_IMAGE_PATTERN_COLOR_FORMAT_X16A1R5G5B5 0x00000002
-#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A8R8G8B8 0x00000003
-#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT 0x00000304
-#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_CGA6 0x00000001
-#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_LE 0x00000002
-#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE 0x00000308
-#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_8X8 0x00000000
-#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_64X1 0x00000001
-#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_1X64 0x00000002
-#define NV04_IMAGE_PATTERN_PATTERN_SELECT 0x0000030c
-#define NV04_IMAGE_PATTERN_PATTERN_SELECT_MONO 0x00000001
-#define NV04_IMAGE_PATTERN_PATTERN_SELECT_COLOR 0x00000002
-#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR0 0x00000310
-#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR1 0x00000314
-#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN0 0x00000318
-#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN1 0x0000031c
-#define NV04_IMAGE_PATTERN_PATTERN_Y8(x) (0x00000400+((x)*4))
-#define NV04_IMAGE_PATTERN_PATTERN_Y8__SIZE 0x00000010
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0_SHIFT 0
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0_MASK 0x000000ff
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1_SHIFT 8
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1_MASK 0x0000ff00
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2_SHIFT 16
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2_MASK 0x00ff0000
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3_SHIFT 24
-#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3_MASK 0xff000000
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5(x) (0x00000500+((x)*4))
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5__SIZE 0x00000020
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0_SHIFT 0
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0_MASK 0x0000001f
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0_SHIFT 5
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0_MASK 0x000007e0
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0_SHIFT 11
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0_MASK 0x0000f800
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1_SHIFT 16
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1_MASK 0x001f0000
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1_SHIFT 21
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1_MASK 0x07e00000
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1_SHIFT 27
-#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1_MASK 0xf8000000
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5(x) (0x00000600+((x)*4))
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5__SIZE 0x00000020
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0_SHIFT 0
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0_MASK 0x0000001f
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0_SHIFT 5
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0_MASK 0x000003e0
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0_SHIFT 10
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0_MASK 0x00007c00
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1_SHIFT 16
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1_MASK 0x001f0000
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1_SHIFT 21
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1_MASK 0x03e00000
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1_SHIFT 26
-#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1_MASK 0x7c000000
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8(x) (0x00000700+((x)*4))
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8__SIZE 0x00000040
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B_SHIFT 0
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B_MASK 0x000000ff
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G_SHIFT 8
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G_MASK 0x0000ff00
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R_SHIFT 16
-#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R_MASK 0x00ff0000
-
-
-#define NV03_VIDEO_LUT_CURSOR_DAC 0x00000046
-
-#define NV03_VIDEO_LUT_CURSOR_DAC_SYNCHRONIZE 0x00000100
-#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_IMAGE 0x00000104
-#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_CURSOR 0x00000108
-#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_DAC 0x0000010c
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_NOTIFY 0x00000180
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_IMAGE(x) (0x00000184+((x)*4))
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_IMAGE__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_LUT(x) (0x0000018c+((x)*4))
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_LUT__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_CURSOR(x) (0x00000194+((x)*4))
-#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_CURSOR__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_GET 0x000002fc
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_OFFSET(x) (0x00000300+((x)*8))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_OFFSET__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT(x) (0x00000304+((x)*8))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_PITCH_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_PITCH_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_COLOR_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_COLOR_MASK 0x0fff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_NOTIFY_SHIFT 28
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_NOTIFY_MASK 0xf0000000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_OFFSET(x) (0x00000340+((x)*12))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_OFFSET__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT(x) (0x00000344+((x)*12))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_X_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_X_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_Y_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_Y_MASK 0xffff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_FORMAT(x) (0x00000348+((x)*12))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_FORMAT__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A 0x00000358
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_X_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_X_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_Y_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_Y_MASK 0xffff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE(x) (0x00000380+((x)*16))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_W_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_W_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_H_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_H_MASK 0xffff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC(x) (0x00000384+((x)*16))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_START_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_START_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_WIDTH_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_WIDTH_MASK 0x0fff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_POLARITY_SHIFT 28
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_POLARITY_MASK 0xf0000000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC(x) (0x00000388+((x)*16))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_START_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_START_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_WIDTH_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_WIDTH_MASK 0x0fff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_POLARITY_SHIFT 28
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_POLARITY_MASK 0xf0000000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE(x) (0x0000038c+((x)*16))
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE__SIZE 0x00000002
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_WIDTH_SHIFT 0
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_WIDTH_MASK 0x0000ffff
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_HEIGHT_SHIFT 16
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_HEIGHT_MASK 0x0fff0000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_NOTIFY_SHIFT 28
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_NOTIFY_MASK 0xf0000000
-#define NV03_VIDEO_LUT_CURSOR_DAC_SET_PIXEL_CLOCK 0x000003a0
-
-
-#define NV03_TEXTURED_TRIANGLE 0x00000048
-
-#define NV03_TEXTURED_TRIANGLE_NOP 0x00000100
-#define NV03_TEXTURED_TRIANGLE_NOTIFY 0x00000104
-#define NV03_TEXTURED_TRIANGLE_PATCH 0x0000010c
-#define NV03_TEXTURED_TRIANGLE_DMA_NOTIFY 0x00000180
-#define NV03_TEXTURED_TRIANGLE_DMA_TEXTURE 0x00000184
-#define NV03_TEXTURED_TRIANGLE_CLIP_RECTANGLE 0x00000188
-#define NV03_TEXTURED_TRIANGLE_SURFACE 0x0000018c
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_OFFSET 0x00000304
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT 0x00000308
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_MASK_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_MASK_MASK 0x0000ffff
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_ENABLE_SHIFT 16
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_ENABLE_MASK 0x000f0000
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_SHIFT 20
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_MASK 0x00f00000
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MIN_SHIFT 24
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MIN_MASK 0x0f000000
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MAX_SHIFT 28
-#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MAX_MASK 0xf0000000
-#define NV03_TEXTURED_TRIANGLE_FILTER 0x0000030c
-#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_X_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_X_MASK 0x0000001f
-#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_Y_SHIFT 8
-#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_Y_MASK 0x00001f00
-#define NV03_TEXTURED_TRIANGLE_FILTER_SIZE_ADJUST_SHIFT 16
-#define NV03_TEXTURED_TRIANGLE_FILTER_SIZE_ADJUST_MASK 0x00ff0000
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR 0x00000310
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_B_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_B_MASK 0x000000ff
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_G_SHIFT 8
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_G_MASK 0x0000ff00
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_R_SHIFT 16
-#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_R_MASK 0x00ff0000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT 0x00000314
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_INTERPOLATOR_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_INTERPOLATOR_MASK 0x0000000f
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_U_SHIFT 4
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_U_MASK 0x00000030
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_V_SHIFT 6
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_V_MASK 0x000000c0
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SOURCE_COLOR_SHIFT 8
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SOURCE_COLOR_MASK 0x00000f00
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_CULLING_SHIFT 12
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_CULLING_MASK 0x00007000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_PERSPECTIVE_ENABLE (1 << 15)
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_FUNC_SHIFT 16
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_FUNC_MASK 0x000f0000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_WRITE_ENABLE_SHIFT 20
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_WRITE_ENABLE_MASK 0x00f00000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_COLOR_WRITE_ENABLE_SHIFT 24
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_COLOR_WRITE_ENABLE_MASK 0x07000000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_ROP_SHIFT 27
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_ROP_MASK 0x18000000
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_BETA (1 << 29)
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_DST_BLEND (1 << 30)
-#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SRC_BLEND (1 << 31)
-#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL 0x00000318
-#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_REF_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_REF_MASK 0x000000ff
-#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_FUNC_SHIFT 8
-#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_FUNC_MASK 0xffffff00
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR(x) (0x00001000+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I0_SHIFT 0
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I0_MASK 0x0000000f
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I1_SHIFT 4
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I1_MASK 0x000000f0
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I2_SHIFT 8
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I2_MASK 0x00000f00
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I3_SHIFT 12
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I3_MASK 0x0000f000
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I4_SHIFT 16
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I4_MASK 0x000f0000
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I5_SHIFT 20
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I5_MASK 0x00f00000
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_SHIFT 24
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_MASK 0xff000000
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_COLOR(x) (0x00001004+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_COLOR__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SX(x) (0x00001008+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SX__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SY(x) (0x0000100c+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SY__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SZ(x) (0x00001010+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SZ__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_RHW(x) (0x00001014+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_RHW__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TU(x) (0x00001018+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TU__SIZE 0x00000080
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TV(x) (0x0000101c+((x)*32))
-#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TV__SIZE 0x00000080
-
-
-#define NV04_GDI_RECTANGLE_TEXT 0x0000004a
-
-#define NV04_GDI_RECTANGLE_TEXT_NOP 0x00000100
-#define NV04_GDI_RECTANGLE_TEXT_NOTIFY 0x00000104
-#define NV04_GDI_RECTANGLE_TEXT_PATCH 0x0000010c
-#define NV04_GDI_RECTANGLE_TEXT_PM_TRIGGER 0x00000140
-#define NV04_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
-#define NV04_GDI_RECTANGLE_TEXT_DMA_FONTS 0x00000184
-#define NV04_GDI_RECTANGLE_TEXT_PATTERN 0x00000188
-#define NV04_GDI_RECTANGLE_TEXT_ROP 0x0000018c
-#define NV04_GDI_RECTANGLE_TEXT_BETA1 0x00000190
-#define NV04_GDI_RECTANGLE_TEXT_BETA4 0x00000194
-#define NV04_GDI_RECTANGLE_TEXT_SURFACE 0x00000198
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_AND 0x00000000
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_ROP_AND 0x00000001
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_AND 0x00000002
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY 0x00000003
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_PREMULT 0x00000005
-#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
-#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5 0x00000001
-#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_X16A1R5G5B5 0x00000002
-#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8 0x00000003
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_CGA6 0x00000001
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE 0x00000002
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT(x) (0x00000400+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT__SIZE 0x00000020
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE(x) (0x00000404+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE__SIZE 0x00000020
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0 0x000005f4
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1 0x000005f8
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_B 0x000005fc
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0(x) (0x00000600+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0__SIZE 0x00000020
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1(x) (0x00000604+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1__SIZE 0x00000020
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x000007ec
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x000007f0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_C 0x000007f4
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_C 0x000007f8
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_POINT_C 0x000007fc
-#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(x) (0x00000800+((x)*4))
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__SIZE 0x00000080
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x00000be4
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x00000be8
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_COLOR0_E 0x00000bec
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_E 0x00000bf0
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x00000bf4
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x00000bf8
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_POINT_E 0x00000bfc
-#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(x) (0x00000c00+((x)*4))
-#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__SIZE 0x00000080
-#define NV04_GDI_RECTANGLE_TEXT_FONT_F 0x00000ff0
-#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET_MASK 0x0fffffff
-#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH_SHIFT 28
-#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH_MASK 0xf0000000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0 0x00000ff4
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1 0x00000ff8
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_F 0x00000ffc
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F(x) (0x00001000+((x)*4))
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F__SIZE 0x00000100
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX_MASK 0x000000ff
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X_SHIFT 8
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X_MASK 0x000fff00
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y_SHIFT 20
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y_MASK 0xfff00000
-#define NV04_GDI_RECTANGLE_TEXT_FONT_G 0x000017f0
-#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET_MASK 0x0fffffff
-#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH_SHIFT 28
-#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH_MASK 0xf0000000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0 0x000017f4
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1 0x000017f8
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_COLOR1_G 0x000017fc
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT(x) (0x00001800+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT__SIZE 0x00000100
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X_SHIFT 0
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X_MASK 0x0000ffff
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y_SHIFT 16
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y_MASK 0xffff0000
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX(x) (0x00001804+((x)*8))
-#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX__SIZE 0x00000100
-
-
-#define NV03_GDI_RECTANGLE_TEXT 0x0000004b
-
-#define NV03_GDI_RECTANGLE_TEXT_NOP 0x00000100
-#define NV03_GDI_RECTANGLE_TEXT_NOTIFY 0x00000104
-#define NV03_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
-#define NV03_GDI_RECTANGLE_TEXT_PATTERN 0x00000184
-#define NV03_GDI_RECTANGLE_TEXT_ROP 0x00000188
-#define NV03_GDI_RECTANGLE_TEXT_BETA1 0x0000018c
-#define NV03_GDI_RECTANGLE_TEXT_SURFACE 0x00000190
-#define NV03_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
-#define NV03_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
-#define NV03_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT 0x00000400
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE 0x00000404
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B 0x000007f4
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B 0x000007f8
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_COLOR1_B 0x000007fc
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0 0x00000800
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1 0x00000804
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x00000bec
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x00000bf0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_COLOR1_C 0x00000bf4
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_C 0x00000bf8
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_POINT_C 0x00000bfc
-#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(x) (0x00000c00+((x)*4))
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__SIZE 0x00000020
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0 0x00000fe8
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1 0x00000fec
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_COLOR1_D 0x00000ff0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D 0x00000ff4
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D 0x00000ff8
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_POINT_D 0x00000ffc
-#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D(x) (0x00001000+((x)*4))
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D__SIZE 0x00000020
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x000013e4
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x000013e8
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_COLOR0_E 0x000013ec
-#define NV03_GDI_RECTANGLE_TEXT_COLOR1_E 0x000013f0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x000013f4
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x000013f8
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_POINT_E 0x000013fc
-#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X_SHIFT 0
-#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X_MASK 0x0000ffff
-#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y_SHIFT 16
-#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y_MASK 0xffff0000
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(x) (0x00001400+((x)*4))
-#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__SIZE 0x00000020
-
-
-#define NV04_SWIZZLED_SURFACE 0x00000052
-
-#define NV04_SWIZZLED_SURFACE_NOP 0x00000100
-#define NV04_SWIZZLED_SURFACE_NOTIFY 0x00000104
-#define NV04_SWIZZLED_SURFACE_DMA_NOTIFY 0x00000180
-#define NV04_SWIZZLED_SURFACE_DMA_IMAGE 0x00000184
-#define NV04_SWIZZLED_SURFACE_FORMAT 0x00000300
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_SHIFT 0
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_MASK 0x000000ff
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y8 0x00000001
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_Z1R5G5B5 0x00000002
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_X1R5G5B5 0x00000003
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_R5G6B5 0x00000004
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y16 0x00000005
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_Z8R8G8B8 0x00000006
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_X8R8G8B8 0x00000007
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_X1A7R8G8B8 0x00000009
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_A8R8G8B8 0x0000000a
-#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y32 0x0000000b
-#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT 16
-#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_MASK 0x00ff0000
-#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT 24
-#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_MASK 0xff000000
-#define NV04_SWIZZLED_SURFACE_OFFSET 0x00000304
-
-
-#define NV20_SWIZZLED_SURFACE 0x0000009e
-
-
-
-#define NV30_SWIZZLED_SURFACE 0x0000039e
-
-
-
-#define NV40_SWIZZLED_SURFACE 0x0000309e
-
-
-
-#define NV04_CONTEXT_SURFACES_3D 0x00000053
-
-#define NV04_CONTEXT_SURFACES_3D_NOP 0x00000100
-#define NV04_CONTEXT_SURFACES_3D_NOTIFY 0x00000104
-#define NV04_CONTEXT_SURFACES_3D_DMA_NOTIFY 0x00000180
-#define NV04_CONTEXT_SURFACES_3D_DMA_COLOR 0x00000184
-#define NV04_CONTEXT_SURFACES_3D_DMA_ZETA 0x00000188
-#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL 0x000002f8
-#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_X_SHIFT 0
-#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_X_MASK 0x0000ffff
-#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_W_SHIFT 16
-#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_W_MASK 0xffff0000
-#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL 0x000002fc
-#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_Y_SHIFT 0
-#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_Y_MASK 0x0000ffff
-#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_H_SHIFT 16
-#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_H_MASK 0xffff0000
-#define NV04_CONTEXT_SURFACES_3D_FORMAT 0x00000300
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_SHIFT 0
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_MASK 0x000000ff
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1R5G5B5_Z1R5G5B5 0x00000001
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1R5G5B5_X1R5G5B5 0x00000002
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_R5G6B5 0x00000003
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X8R8G8B8_Z8R8G8B8 0x00000004
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X8R8G8B8_X8R8G8B8 0x00000005
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1A7R8G8B8_Z1A7R8G8B8 0x00000006
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1A7R8G8B8_X1A7R8G8B8 0x00000007
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_A8R8G8B8 0x00000008
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_SHIFT 8
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_MASK 0x0000ff00
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_PITCH 0x00000100
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_SWIZZLE 0x00000200
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_U_SHIFT 16
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_U_MASK 0x00ff0000
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_V_SHIFT 24
-#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_V_MASK 0xff000000
-#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE 0x00000304
-#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_W_SHIFT 0
-#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_W_MASK 0x0000ffff
-#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_H_SHIFT 16
-#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_H_MASK 0xffff0000
-#define NV04_CONTEXT_SURFACES_3D_PITCH 0x00000308
-#define NV04_CONTEXT_SURFACES_3D_PITCH_COLOR_SHIFT 0
-#define NV04_CONTEXT_SURFACES_3D_PITCH_COLOR_MASK 0x0000ffff
-#define NV04_CONTEXT_SURFACES_3D_PITCH_ZETA_SHIFT 16
-#define NV04_CONTEXT_SURFACES_3D_PITCH_ZETA_MASK 0xffff0000
-#define NV04_CONTEXT_SURFACES_3D_OFFSET_COLOR 0x0000030c
-#define NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA 0x00000310
-
-
-#define NV10_CONTEXT_SURFACES_3D 0x00000093
-
-
-
-#define NV04_TEXTURED_TRIANGLE 0x00000054
-
-#define NV04_TEXTURED_TRIANGLE_NOP 0x00000100
-#define NV04_TEXTURED_TRIANGLE_NOTIFY 0x00000104
-#define NV04_TEXTURED_TRIANGLE_DMA_NOTIFY 0x00000180
-#define NV04_TEXTURED_TRIANGLE_DMA_A 0x00000184
-#define NV04_TEXTURED_TRIANGLE_DMA_B 0x00000188
-#define NV04_TEXTURED_TRIANGLE_SURFACE 0x0000018c
-#define NV04_TEXTURED_TRIANGLE_COLORKEY 0x00000300
-#define NV04_TEXTURED_TRIANGLE_OFFSET 0x00000304
-#define NV04_TEXTURED_TRIANGLE_FORMAT 0x00000308
-#define NV04_TEXTURED_TRIANGLE_FORMAT_DMA_A (1 << 0)
-#define NV04_TEXTURED_TRIANGLE_FORMAT_DMA_B (1 << 1)
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_KEY_MATCH_SHIFT 2
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_KEY_MATCH_MASK 0x0000000c
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_SHIFT 4
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_MASK 0x00000030
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CENTER 0x00000010
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CORNER 0x00000020
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_SHIFT 6
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_MASK 0x000000c0
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CENTER 0x00000040
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER 0x00000080
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_MASK 0x00000f00
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8 0x00000100
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5 0x00000200
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X1R5G5B5 0x00000300
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A4R4G4B4 0x00000400
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_R5G6B5 0x00000500
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8 0x00000600
-#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X8R8G8B8 0x00000700
-#define NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT 12
-#define NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_MASK 0x0000f000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_MASK 0x000f0000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT 20
-#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_MASK 0x00f00000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_MASK 0x07000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_REPEAT 0x01000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_MIRRORED_REPEAT 0x02000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE 0x03000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_BORDER 0x04000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP 0x05000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_WRAPU (1 << 27)
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_SHIFT 28
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_MASK 0x70000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_REPEAT 0x10000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_MIRRORED_REPEAT 0x20000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE 0x30000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_BORDER 0x40000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP 0x50000000
-#define NV04_TEXTURED_TRIANGLE_FORMAT_WRAPV (1 << 31)
-#define NV04_TEXTURED_TRIANGLE_FILTER 0x0000030c
-#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_X_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_X_MASK 0x000000ff
-#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_Y_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_Y_MASK 0x00007f00
-#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_DITHER_ENABLE (1 << 15)
-#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_LODBIAS_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_LODBIAS_MASK 0x00ff0000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_MASK 0x07000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST 0x01000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR 0x02000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x03000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x04000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x05000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x06000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_ANISOTROPIC_MINIFY_ENABLE (1 << 27)
-#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_SHIFT 28
-#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_MASK 0x70000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_NEAREST 0x10000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_LINEAR 0x20000000
-#define NV04_TEXTURED_TRIANGLE_FILTER_ANISOTROPIC_MAGNIFY_ENABLE (1 << 31)
-#define NV04_TEXTURED_TRIANGLE_BLEND 0x00000310
-#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP_MASK 0x0000000f
-#define NV04_TEXTURED_TRIANGLE_BLEND_MASK_BIT_SHIFT 4
-#define NV04_TEXTURED_TRIANGLE_BLEND_MASK_BIT_MASK 0x00000030
-#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_SHIFT 6
-#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_MASK 0x000000c0
-#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT 0x00000040
-#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_GOURAUD 0x00000080
-#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_PHONG 0x000000c0
-#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE (1 << 8)
-#define NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE (1 << 12)
-#define NV04_TEXTURED_TRIANGLE_BLEND_FOG_ENABLE (1 << 16)
-#define NV04_TEXTURED_TRIANGLE_BLEND_BLEND_ENABLE (1 << 20)
-#define NV04_TEXTURED_TRIANGLE_BLEND_SRC_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_BLEND_SRC_MASK 0x0f000000
-#define NV04_TEXTURED_TRIANGLE_BLEND_DST_SHIFT 28
-#define NV04_TEXTURED_TRIANGLE_BLEND_DST_MASK 0xf0000000
-#define NV04_TEXTURED_TRIANGLE_CONTROL 0x00000314
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_REF_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_REF_MASK 0x000000ff
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_MASK 0x00000f00
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_ENABLE (1 << 12)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN (1 << 13)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_ENABLE (1 << 14)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FUNC_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FUNC_MASK 0x000f0000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_SHIFT 20
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_MASK 0x00300000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_BOTH 0x00000000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_NONE 0x00100000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CW 0x00200000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CCW 0x00300000
-#define NV04_TEXTURED_TRIANGLE_CONTROL_DITHER_ENABLE (1 << 22)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_PERSPECTIVE_ENABLE (1 << 23)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_WRITE (1 << 24)
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FORMAT_SHIFT 30
-#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FORMAT_MASK 0xc0000000
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR 0x00000318
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_B_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_B_MASK 0x000000ff
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_G_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_G_MASK 0x0000ff00
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_R_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_R_MASK 0x00ff0000
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_A_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_A_MASK 0xff000000
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SX(x) (0x00000400+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SX__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SY(x) (0x00000404+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SY__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SZ(x) (0x00000408+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SZ__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_RHW(x) (0x0000040c+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_RHW__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR(x) (0x00000410+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_B_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_B_MASK 0x000000ff
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_G_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_G_MASK 0x0000ff00
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_R_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_R_MASK 0x00ff0000
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_A_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_A_MASK 0xff000000
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR(x) (0x00000414+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_B_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_B_MASK 0x000000ff
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_G_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_G_MASK 0x0000ff00
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_R_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_R_MASK 0x00ff0000
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_SHIFT 24
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_MASK 0xff000000
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TU(x) (0x00000418+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TU__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TV(x) (0x0000041c+((x)*32))
-#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TV__SIZE 0x00000010
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE(x) (0x00000600+((x)*4))
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE__SIZE 0x00000040
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I0_SHIFT 0
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I0_MASK 0x0000000f
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I1_SHIFT 4
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I1_MASK 0x000000f0
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I2_SHIFT 8
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I2_MASK 0x00000f00
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I3_SHIFT 12
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I3_MASK 0x0000f000
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I4_SHIFT 16
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I4_MASK 0x000f0000
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I5_SHIFT 20
-#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I5_MASK 0x00f00000
-
-
-#define NV10_TEXTURED_TRIANGLE 0x00000094
-
-
-
-#define NV04_MULTITEX_TRIANGLE 0x00000055
-
-#define NV04_MULTITEX_TRIANGLE_NOP 0x00000100
-#define NV04_MULTITEX_TRIANGLE_NOTIFY 0x00000104
-#define NV04_MULTITEX_TRIANGLE_DMA_NOTIFY 0x00000180
-#define NV04_MULTITEX_TRIANGLE_DMA_A 0x00000184
-#define NV04_MULTITEX_TRIANGLE_DMA_B 0x00000188
-#define NV04_MULTITEX_TRIANGLE_SURFACE 0x0000018c
-#define NV04_MULTITEX_TRIANGLE_OFFSET(x) (0x00000308+((x)*4))
-#define NV04_MULTITEX_TRIANGLE_OFFSET__SIZE 0x00000002
-#define NV04_MULTITEX_TRIANGLE_FORMAT(x) (0x00000310+((x)*4))
-#define NV04_MULTITEX_TRIANGLE_FORMAT__SIZE 0x00000002
-#define NV04_MULTITEX_TRIANGLE_FORMAT_DMA_A (1 << 0)
-#define NV04_MULTITEX_TRIANGLE_FORMAT_DMA_B (1 << 1)
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_ZOH_SHIFT 4
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_ZOH_MASK 0x00000030
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_FOH_SHIFT 6
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_FOH_MASK 0x000000c0
-#define NV04_MULTITEX_TRIANGLE_FORMAT_COLOR_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_FORMAT_COLOR_MASK 0x00000f00
-#define NV04_MULTITEX_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT 12
-#define NV04_MULTITEX_TRIANGLE_FORMAT_MIPMAP_LEVELS_MASK 0x0000f000
-#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_U_MASK 0x000f0000
-#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT 20
-#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_V_MASK 0x00f00000
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSU_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSU_MASK 0x07000000
-#define NV04_MULTITEX_TRIANGLE_FORMAT_WRAPU (1 << 27)
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSV_SHIFT 28
-#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSV_MASK 0x70000000
-#define NV04_MULTITEX_TRIANGLE_FORMAT_WRAPV (1 << 31)
-#define NV04_MULTITEX_TRIANGLE_FILTER(x) (0x00000318+((x)*4))
-#define NV04_MULTITEX_TRIANGLE_FILTER__SIZE 0x00000002
-#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_X_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_X_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_Y_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_Y_MASK 0x00007f00
-#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_DITHER_ENABLE (1 << 15)
-#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_LODBIAS_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_LODBIAS_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_FILTER_MINIFY_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_FILTER_MINIFY_MASK 0x07000000
-#define NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MINIFY_ENABLE (1 << 27)
-#define NV04_MULTITEX_TRIANGLE_FILTER_MAGNIFY_SHIFT 28
-#define NV04_MULTITEX_TRIANGLE_FILTER_MAGNIFY_MASK 0x70000000
-#define NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MAGNIFY_ENABLE (1 << 31)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA(x) (0x00000320+((x)*12))
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA__SIZE 0x00000002
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE0 (1 << 0)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_SHIFT 2
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_MASK 0x000000fc
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_ZERO 0x00000004
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_CONSTANT 0x00000008
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_PRIMARY_COLOR 0x0000000c
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_PREVIOUS 0x00000010
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_TEXTURE0 0x00000014
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_TEXTURE1 0x00000018
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE1 (1 << 8)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_SHIFT 10
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_MASK 0x0000fc00
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_ZERO 0x00000400
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_CONSTANT 0x00000800
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_PRIMARY_COLOR 0x00000c00
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_PREVIOUS 0x00001000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_TEXTURE0 0x00001400
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_TEXTURE1 0x00001800
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE2 (1 << 16)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_SHIFT 18
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_MASK 0x00fc0000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_ZERO 0x00040000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_CONSTANT 0x00080000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_PRIMARY_COLOR 0x000c0000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_PREVIOUS 0x00100000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_TEXTURE0 0x00140000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_TEXTURE1 0x00180000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE3 (1 << 24)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_SHIFT 26
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_MASK 0x1c000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_ZERO 0x04000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_CONSTANT 0x08000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_PRIMARY_COLOR 0x0c000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_PREVIOUS 0x10000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_TEXTURE0 0x14000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_TEXTURE1 0x18000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SHIFT 29
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_MASK 0xe0000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_IDENTITY 0x20000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SCALE2 0x40000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SCALE4 0x60000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_BIAS 0x80000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_BIAS_SCALE2 0xe0000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR(x) (0x00000324+((x)*12))
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR__SIZE 0x00000002
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE0 (1 << 0)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0 (1 << 1)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_SHIFT 2
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_MASK 0x000000fc
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_ZERO 0x00000004
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_CONSTANT 0x00000008
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_PRIMARY_COLOR 0x0000000c
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_PREVIOUS 0x00000010
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_TEXTURE0 0x00000014
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_TEXTURE1 0x00000018
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE1 (1 << 8)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA1 (1 << 9)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_SHIFT 10
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_MASK 0x0000fc00
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_ZERO 0x00000400
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_CONSTANT 0x00000800
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_PRIMARY_COLOR 0x00000c00
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_PREVIOUS 0x00001000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_TEXTURE0 0x00001400
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_TEXTURE1 0x00001800
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE2 (1 << 16)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA2 (1 << 17)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_SHIFT 18
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_MASK 0x00fc0000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_ZERO 0x00040000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_CONSTANT 0x00080000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_PRIMARY_COLOR 0x000c0000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_PREVIOUS 0x00100000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_TEXTURE0 0x00140000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_TEXTURE1 0x00180000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE3 (1 << 24)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA3 (1 << 25)
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_SHIFT 26
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_MASK 0x1c000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_ZERO 0x04000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_CONSTANT 0x08000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_PRIMARY_COLOR 0x0c000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_PREVIOUS 0x10000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_TEXTURE0 0x14000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_TEXTURE1 0x18000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SHIFT 29
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_MASK 0xe0000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_IDENTITY 0x20000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SCALE2 0x40000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SCALE4 0x60000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_BIAS 0x80000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_BIAS_SCALE2 0xe0000000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR 0x00000334
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_B_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_B_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_G_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_G_MASK 0x0000ff00
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_R_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_R_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_A_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_A_MASK 0xff000000
-#define NV04_MULTITEX_TRIANGLE_BLEND 0x00000338
-#define NV04_MULTITEX_TRIANGLE_BLEND_MASK_BIT_SHIFT 4
-#define NV04_MULTITEX_TRIANGLE_BLEND_MASK_BIT_MASK 0x00000030
-#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_SHIFT 6
-#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_MASK 0x000000c0
-#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT 0x00000040
-#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_GOURAUD 0x00000080
-#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_PHONG 0x000000c0
-#define NV04_MULTITEX_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE (1 << 8)
-#define NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE (1 << 12)
-#define NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE (1 << 16)
-#define NV04_MULTITEX_TRIANGLE_BLEND_BLEND_ENABLE (1 << 20)
-#define NV04_MULTITEX_TRIANGLE_BLEND_SRC_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_BLEND_SRC_MASK 0x0f000000
-#define NV04_MULTITEX_TRIANGLE_BLEND_DST_SHIFT 28
-#define NV04_MULTITEX_TRIANGLE_BLEND_DST_MASK 0xf0000000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0 0x0000033c
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_REF_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_REF_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_FUNC_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_FUNC_MASK 0x00000f00
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_ENABLE (1 << 12)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ORIGIN (1 << 13)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_ENABLE (1 << 14)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FUNC_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FUNC_MASK 0x000f0000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_SHIFT 20
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_MASK 0x00300000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_BOTH 0x00000000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_NONE 0x00100000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_CW 0x00200000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_CCW 0x00300000
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_DITHER_ENABLE (1 << 22)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_PERSPECTIVE_ENABLE (1 << 23)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_WRITE (1 << 24)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_STENCIL_WRITE (1 << 25)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_WRITE (1 << 26)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_RED_WRITE (1 << 27)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_GREEN_WRITE (1 << 28)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_BLUE_WRITE (1 << 29)
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FORMAT_SHIFT 30
-#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FORMAT_MASK 0xc0000000
-#define NV04_MULTITEX_TRIANGLE_CONTROL1 0x00000340
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_ENABLE (1 << 0)
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_FUNC_SHIFT 4
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_FUNC_MASK 0x000000f0
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_REF_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_REF_MASK 0x0000ff00
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_READ_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_READ_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_WRITE_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_WRITE_MASK 0xff000000
-#define NV04_MULTITEX_TRIANGLE_CONTROL2 0x00000344
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_FAIL_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_FAIL_MASK 0x0000000f
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZFAIL_SHIFT 4
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZFAIL_MASK 0x000000f0
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZPASS_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZPASS_MASK 0x00000f00
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR 0x00000348
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_B_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_B_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_G_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_G_MASK 0x0000ff00
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_R_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_R_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_A_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_A_MASK 0xff000000
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SX(x) (0x00000400+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SX__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SY(x) (0x00000404+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SY__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SZ(x) (0x00000408+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SZ__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_RHW(x) (0x0000040c+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_RHW__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR(x) (0x00000410+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_B_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_B_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_G_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_G_MASK 0x0000ff00
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_R_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_R_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_A_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_A_MASK 0xff000000
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR(x) (0x00000414+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_B_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_B_MASK 0x000000ff
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_G_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_G_MASK 0x0000ff00
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_R_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_R_MASK 0x00ff0000
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_FOG_SHIFT 24
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_FOG_MASK 0xff000000
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU0(x) (0x00000418+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU0__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV0(x) (0x0000041c+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV0__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU1(x) (0x00000420+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU1__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV1(x) (0x00000424+((x)*40))
-#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV1__SIZE 0x00000008
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE(x) (0x00000540+((x)*4))
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE__SIZE 0x00000030
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I0_SHIFT 0
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I0_MASK 0x0000000f
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I1_SHIFT 4
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I1_MASK 0x000000f0
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I2_SHIFT 8
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I2_MASK 0x00000f00
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I3_SHIFT 12
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I3_MASK 0x0000f000
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I4_SHIFT 16
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I4_MASK 0x000f0000
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I5_SHIFT 20
-#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I5_MASK 0x00f00000
-
-
-#define NV10_MULTITEX_TRIANGLE 0x00000095
-
-
-
-#define NV10TCL 0x00000056
-
-#define NV10TCL_NOP 0x00000100
-#define NV10TCL_NOTIFY 0x00000104
-#define NV10TCL_DMA_NOTIFY 0x00000180
-#define NV10TCL_DMA_IN_MEMORY0 0x00000184
-#define NV10TCL_DMA_IN_MEMORY1 0x00000188
-#define NV10TCL_DMA_VTXBUF0 0x0000018c
-#define NV10TCL_DMA_IN_MEMORY2 0x00000194
-#define NV10TCL_DMA_IN_MEMORY3 0x00000198
-#define NV10TCL_RT_HORIZ 0x00000200
-#define NV10TCL_RT_HORIZ_X_SHIFT 0
-#define NV10TCL_RT_HORIZ_X_MASK 0x0000ffff
-#define NV10TCL_RT_HORIZ_W_SHIFT 16
-#define NV10TCL_RT_HORIZ_W_MASK 0xffff0000
-#define NV10TCL_RT_VERT 0x00000204
-#define NV10TCL_RT_VERT_Y_SHIFT 0
-#define NV10TCL_RT_VERT_Y_MASK 0x0000ffff
-#define NV10TCL_RT_VERT_H_SHIFT 16
-#define NV10TCL_RT_VERT_H_MASK 0xffff0000
-#define NV10TCL_RT_FORMAT 0x00000208
-#define NV10TCL_RT_FORMAT_TYPE_SHIFT 8
-#define NV10TCL_RT_FORMAT_TYPE_MASK 0x00000f00
-#define NV10TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
-#define NV10TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
-#define NV10TCL_RT_FORMAT_COLOR_SHIFT 0
-#define NV10TCL_RT_FORMAT_COLOR_MASK 0x0000001f
-#define NV10TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
-#define NV10TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
-#define NV10TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
-#define NV10TCL_RT_FORMAT_COLOR_B8 0x00000009
-#define NV10TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
-#define NV10TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
-#define NV10TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
-#define NV10TCL_RT_PITCH 0x0000020c
-#define NV10TCL_RT_PITCH_COLOR_PITCH_SHIFT 0
-#define NV10TCL_RT_PITCH_COLOR_PITCH_MASK 0x0000ffff
-#define NV10TCL_RT_PITCH_ZETA_PITCH_SHIFT 16
-#define NV10TCL_RT_PITCH_ZETA_PITCH_MASK 0xffff0000
-#define NV10TCL_COLOR_OFFSET 0x00000210
-#define NV10TCL_ZETA_OFFSET 0x00000214
-#define NV10TCL_TX_OFFSET(x) (0x00000218+((x)*4))
-#define NV10TCL_TX_OFFSET__SIZE 0x00000002
-#define NV10TCL_TX_FORMAT(x) (0x00000220+((x)*4))
-#define NV10TCL_TX_FORMAT__SIZE 0x00000002
-#define NV10TCL_TX_FORMAT_DMA0 (1 << 0)
-#define NV10TCL_TX_FORMAT_DMA1 (1 << 1)
-#define NV10TCL_TX_FORMAT_CUBE_MAP (1 << 2)
-#define NV10TCL_TX_FORMAT_FORMAT_SHIFT 7
-#define NV10TCL_TX_FORMAT_FORMAT_MASK 0x00000f80
-#define NV10TCL_TX_FORMAT_FORMAT_L8 0x00000000
-#define NV10TCL_TX_FORMAT_FORMAT_A8 0x00000080
-#define NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5 0x00000100
-#define NV10TCL_TX_FORMAT_FORMAT_A4R4G4B4 0x00000200
-#define NV10TCL_TX_FORMAT_FORMAT_R5G6B5 0x00000280
-#define NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8 0x00000300
-#define NV10TCL_TX_FORMAT_FORMAT_X8R8G8B8 0x00000380
-#define NV10TCL_TX_FORMAT_FORMAT_INDEX8 0x00000580
-#define NV10TCL_TX_FORMAT_FORMAT_DXT1 0x00000600
-#define NV10TCL_TX_FORMAT_FORMAT_DXT3 0x00000700
-#define NV10TCL_TX_FORMAT_FORMAT_DXT5 0x00000780
-#define NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00000800
-#define NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT 0x00000880
-#define NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00000900
-#define NV10TCL_TX_FORMAT_FORMAT_A8_RECT 0x00000980
-#define NV10TCL_TX_FORMAT_MIPMAP (1 << 15)
-#define NV10TCL_TX_FORMAT_BASE_SIZE_U_SHIFT 16
-#define NV10TCL_TX_FORMAT_BASE_SIZE_U_MASK 0x000f0000
-#define NV10TCL_TX_FORMAT_BASE_SIZE_V_SHIFT 20
-#define NV10TCL_TX_FORMAT_BASE_SIZE_V_MASK 0x00f00000
-#define NV10TCL_TX_FORMAT_WRAP_S_SHIFT 24
-#define NV10TCL_TX_FORMAT_WRAP_S_MASK 0x0f000000
-#define NV10TCL_TX_FORMAT_WRAP_S_REPEAT 0x01000000
-#define NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT 0x02000000
-#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE 0x03000000
-#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER 0x04000000
-#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP 0x05000000
-#define NV10TCL_TX_FORMAT_WRAP_T_SHIFT 28
-#define NV10TCL_TX_FORMAT_WRAP_T_MASK 0xf0000000
-#define NV10TCL_TX_FORMAT_WRAP_T_REPEAT 0x10000000
-#define NV10TCL_TX_FORMAT_WRAP_T_MIRRORED_REPEAT 0x20000000
-#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_EDGE 0x30000000
-#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_BORDER 0x40000000
-#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP 0x50000000
-#define NV10TCL_TX_ENABLE(x) (0x00000228+((x)*4))
-#define NV10TCL_TX_ENABLE__SIZE 0x00000002
-#define NV10TCL_TX_ENABLE_CULL_SHIFT 0
-#define NV10TCL_TX_ENABLE_CULL_MASK 0x0000000f
-#define NV10TCL_TX_ENABLE_CULL_DISABLED 0x00000000
-#define NV10TCL_TX_ENABLE_CULL_TEST_ALL 0x00000003
-#define NV10TCL_TX_ENABLE_CULL_TEST_ALPHA 0x00000004
-#define NV10TCL_TX_ENABLE_ANISOTROPY_SHIFT 4
-#define NV10TCL_TX_ENABLE_ANISOTROPY_MASK 0x00000030
-#define NV10TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT 14
-#define NV10TCL_TX_ENABLE_MIPMAP_MAX_LOD_MASK 0x0003c000
-#define NV10TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT 26
-#define NV10TCL_TX_ENABLE_MIPMAP_MIN_LOD_MASK 0x3c000000
-#define NV10TCL_TX_ENABLE_ENABLE (1 << 30)
-#define NV10TCL_TX_NPOT_PITCH(x) (0x00000230+((x)*4))
-#define NV10TCL_TX_NPOT_PITCH__SIZE 0x00000002
-#define NV10TCL_TX_NPOT_PITCH_PITCH_SHIFT 16
-#define NV10TCL_TX_NPOT_PITCH_PITCH_MASK 0xffff0000
-#define NV10TCL_TX_NPOT_SIZE(x) (0x00000240+((x)*4))
-#define NV10TCL_TX_NPOT_SIZE__SIZE 0x00000002
-#define NV10TCL_TX_NPOT_SIZE_H_SHIFT 0
-#define NV10TCL_TX_NPOT_SIZE_H_MASK 0x0000ffff
-#define NV10TCL_TX_NPOT_SIZE_W_SHIFT 16
-#define NV10TCL_TX_NPOT_SIZE_W_MASK 0xffff0000
-#define NV10TCL_TX_FILTER(x) (0x00000248+((x)*4))
-#define NV10TCL_TX_FILTER__SIZE 0x00000002
-#define NV10TCL_TX_FILTER_LOD_BIAS_SHIFT 8
-#define NV10TCL_TX_FILTER_LOD_BIAS_MASK 0x00000f00
-#define NV10TCL_TX_FILTER_MINIFY_SHIFT 24
-#define NV10TCL_TX_FILTER_MINIFY_MASK 0x0f000000
-#define NV10TCL_TX_FILTER_MINIFY_NEAREST 0x01000000
-#define NV10TCL_TX_FILTER_MINIFY_LINEAR 0x02000000
-#define NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x03000000
-#define NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x04000000
-#define NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x05000000
-#define NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x06000000
-#define NV10TCL_TX_FILTER_MAGNIFY_SHIFT 28
-#define NV10TCL_TX_FILTER_MAGNIFY_MASK 0xf0000000
-#define NV10TCL_TX_FILTER_MAGNIFY_NEAREST 0x10000000
-#define NV10TCL_TX_FILTER_MAGNIFY_LINEAR 0x20000000
-#define NV10TCL_TX_PALETTE_OFFSET(x) (0x00000250+((x)*4))
-#define NV10TCL_TX_PALETTE_OFFSET__SIZE 0x00000002
-#define NV10TCL_RC_IN_ALPHA(x) (0x00000260+((x)*4))
-#define NV10TCL_RC_IN_ALPHA__SIZE 0x00000002
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_SHIFT 0
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_MASK 0x0000000f
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
-#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
-#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE (1 << 4)
-#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
-#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SHIFT 5
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_MASK 0x000000e0
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_SHIFT 8
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_MASK 0x00000f00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE (1 << 12)
-#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
-#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SHIFT 13
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_MASK 0x0000e000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_SHIFT 16
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_MASK 0x000f0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
-#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
-#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE (1 << 20)
-#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
-#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SHIFT 21
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_MASK 0x00e00000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_SHIFT 24
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_MASK 0x0f000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
-#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
-#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE (1 << 28)
-#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
-#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SHIFT 29
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_MASK 0xe0000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV10TCL_RC_IN_RGB(x) (0x00000268+((x)*4))
-#define NV10TCL_RC_IN_RGB__SIZE 0x00000002
-#define NV10TCL_RC_IN_RGB_D_INPUT_SHIFT 0
-#define NV10TCL_RC_IN_RGB_D_INPUT_MASK 0x0000000f
-#define NV10TCL_RC_IN_RGB_D_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV10TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV10TCL_RC_IN_RGB_D_INPUT_FOG 0x00000003
-#define NV10TCL_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV10TCL_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
-#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
-#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
-#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
-#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV10TCL_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
-#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
-#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
-#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE (1 << 4)
-#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV10TCL_RC_IN_RGB_D_MAPPING_SHIFT 5
-#define NV10TCL_RC_IN_RGB_D_MAPPING_MASK 0x000000e0
-#define NV10TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV10TCL_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV10TCL_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV10TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV10TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV10TCL_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV10TCL_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV10TCL_RC_IN_RGB_C_INPUT_SHIFT 8
-#define NV10TCL_RC_IN_RGB_C_INPUT_MASK 0x00000f00
-#define NV10TCL_RC_IN_RGB_C_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_IN_RGB_C_INPUT_FOG 0x00000300
-#define NV10TCL_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE (1 << 12)
-#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_SHIFT 13
-#define NV10TCL_RC_IN_RGB_C_MAPPING_MASK 0x0000e000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV10TCL_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV10TCL_RC_IN_RGB_B_INPUT_SHIFT 16
-#define NV10TCL_RC_IN_RGB_B_INPUT_MASK 0x000f0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV10TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV10TCL_RC_IN_RGB_B_INPUT_FOG 0x00030000
-#define NV10TCL_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV10TCL_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
-#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
-#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
-#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
-#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE (1 << 20)
-#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_SHIFT 21
-#define NV10TCL_RC_IN_RGB_B_MAPPING_MASK 0x00e00000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV10TCL_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV10TCL_RC_IN_RGB_A_INPUT_SHIFT 24
-#define NV10TCL_RC_IN_RGB_A_INPUT_MASK 0x0f000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_FOG 0x03000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
-#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
-#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE (1 << 28)
-#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_SHIFT 29
-#define NV10TCL_RC_IN_RGB_A_MAPPING_MASK 0xe0000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV10TCL_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV10TCL_RC_COLOR(x) (0x00000270+((x)*4))
-#define NV10TCL_RC_COLOR__SIZE 0x00000002
-#define NV10TCL_RC_COLOR_B_SHIFT 0
-#define NV10TCL_RC_COLOR_B_MASK 0x000000ff
-#define NV10TCL_RC_COLOR_G_SHIFT 8
-#define NV10TCL_RC_COLOR_G_MASK 0x0000ff00
-#define NV10TCL_RC_COLOR_R_SHIFT 16
-#define NV10TCL_RC_COLOR_R_MASK 0x00ff0000
-#define NV10TCL_RC_COLOR_A_SHIFT 24
-#define NV10TCL_RC_COLOR_A_MASK 0xff000000
-#define NV10TCL_RC_OUT_ALPHA(x) (0x00000278+((x)*4))
-#define NV10TCL_RC_OUT_ALPHA__SIZE 0x00000002
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SHIFT 0
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_MASK 0x0000000f
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SHIFT 4
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_MASK 0x000000f0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SHIFT 8
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_MASK 0x00000f00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_OUT_ALPHA_CD_DOT_PRODUCT (1 << 12)
-#define NV10TCL_RC_OUT_ALPHA_AB_DOT_PRODUCT (1 << 13)
-#define NV10TCL_RC_OUT_ALPHA_MUX_SUM (1 << 14)
-#define NV10TCL_RC_OUT_ALPHA_BIAS (1 << 15)
-#define NV10TCL_RC_OUT_ALPHA_BIAS_NONE 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 17
-#define NV10TCL_RC_OUT_ALPHA_SCALE_MASK 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_SCALE_NONE 0x00000000
-#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00020000
-#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV10TCL_RC_OUT_RGB(x) (0x00000280+((x)*4))
-#define NV10TCL_RC_OUT_RGB__SIZE 0x00000002
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT 0
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_MASK 0x0000000f
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SHIFT 4
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_MASK 0x000000f0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SHIFT 8
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_MASK 0x00000f00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_OUT_RGB_CD_DOT_PRODUCT (1 << 12)
-#define NV10TCL_RC_OUT_RGB_AB_DOT_PRODUCT (1 << 13)
-#define NV10TCL_RC_OUT_RGB_MUX_SUM (1 << 14)
-#define NV10TCL_RC_OUT_RGB_BIAS (1 << 15)
-#define NV10TCL_RC_OUT_RGB_BIAS_NONE 0x00000000
-#define NV10TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV10TCL_RC_OUT_RGB_SCALE_SHIFT 17
-#define NV10TCL_RC_OUT_RGB_SCALE_MASK 0x00000000
-#define NV10TCL_RC_OUT_RGB_SCALE_NONE 0x00000000
-#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00020000
-#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV10TCL_RC_OUT_RGB_OPERATION_SHIFT 27
-#define NV10TCL_RC_OUT_RGB_OPERATION_MASK 0x38000000
-#define NV10TCL_RC_FINAL0 0x00000288
-#define NV10TCL_RC_FINAL0_D_INPUT_SHIFT 0
-#define NV10TCL_RC_FINAL0_D_INPUT_MASK 0x0000000f
-#define NV10TCL_RC_FINAL0_D_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV10TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV10TCL_RC_FINAL0_D_INPUT_FOG 0x00000003
-#define NV10TCL_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV10TCL_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
-#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
-#define NV10TCL_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
-#define NV10TCL_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
-#define NV10TCL_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV10TCL_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
-#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
-#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
-#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE (1 << 4)
-#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV10TCL_RC_FINAL0_D_MAPPING_SHIFT 5
-#define NV10TCL_RC_FINAL0_D_MAPPING_MASK 0x000000e0
-#define NV10TCL_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV10TCL_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV10TCL_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV10TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV10TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV10TCL_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV10TCL_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV10TCL_RC_FINAL0_C_INPUT_SHIFT 8
-#define NV10TCL_RC_FINAL0_C_INPUT_MASK 0x00000f00
-#define NV10TCL_RC_FINAL0_C_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_FINAL0_C_INPUT_FOG 0x00000300
-#define NV10TCL_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE (1 << 12)
-#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV10TCL_RC_FINAL0_C_MAPPING_SHIFT 13
-#define NV10TCL_RC_FINAL0_C_MAPPING_MASK 0x0000e000
-#define NV10TCL_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV10TCL_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV10TCL_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV10TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV10TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV10TCL_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV10TCL_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV10TCL_RC_FINAL0_B_INPUT_SHIFT 16
-#define NV10TCL_RC_FINAL0_B_INPUT_MASK 0x000f0000
-#define NV10TCL_RC_FINAL0_B_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV10TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV10TCL_RC_FINAL0_B_INPUT_FOG 0x00030000
-#define NV10TCL_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV10TCL_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
-#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
-#define NV10TCL_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
-#define NV10TCL_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
-#define NV10TCL_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV10TCL_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
-#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
-#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
-#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE (1 << 20)
-#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV10TCL_RC_FINAL0_B_MAPPING_SHIFT 21
-#define NV10TCL_RC_FINAL0_B_MAPPING_MASK 0x00e00000
-#define NV10TCL_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV10TCL_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV10TCL_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV10TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV10TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV10TCL_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV10TCL_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV10TCL_RC_FINAL0_A_INPUT_SHIFT 24
-#define NV10TCL_RC_FINAL0_A_INPUT_MASK 0x0f000000
-#define NV10TCL_RC_FINAL0_A_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV10TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV10TCL_RC_FINAL0_A_INPUT_FOG 0x03000000
-#define NV10TCL_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV10TCL_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
-#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
-#define NV10TCL_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
-#define NV10TCL_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
-#define NV10TCL_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV10TCL_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
-#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
-#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
-#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE (1 << 28)
-#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_SHIFT 29
-#define NV10TCL_RC_FINAL0_A_MAPPING_MASK 0xe0000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV10TCL_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV10TCL_RC_FINAL1 0x0000028c
-#define NV10TCL_RC_FINAL1_COLOR_SUM_CLAMP (1 << 7)
-#define NV10TCL_RC_FINAL1_G_INPUT_SHIFT 8
-#define NV10TCL_RC_FINAL1_G_INPUT_MASK 0x00000f00
-#define NV10TCL_RC_FINAL1_G_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV10TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV10TCL_RC_FINAL1_G_INPUT_FOG 0x00000300
-#define NV10TCL_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
-#define NV10TCL_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
-#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
-#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
-#define NV10TCL_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
-#define NV10TCL_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
-#define NV10TCL_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV10TCL_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
-#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
-#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
-#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE (1 << 12)
-#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV10TCL_RC_FINAL1_G_MAPPING_SHIFT 13
-#define NV10TCL_RC_FINAL1_G_MAPPING_MASK 0x0000e000
-#define NV10TCL_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV10TCL_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV10TCL_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV10TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV10TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV10TCL_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV10TCL_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV10TCL_RC_FINAL1_F_INPUT_SHIFT 16
-#define NV10TCL_RC_FINAL1_F_INPUT_MASK 0x000f0000
-#define NV10TCL_RC_FINAL1_F_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV10TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV10TCL_RC_FINAL1_F_INPUT_FOG 0x00030000
-#define NV10TCL_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
-#define NV10TCL_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
-#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
-#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
-#define NV10TCL_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
-#define NV10TCL_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
-#define NV10TCL_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV10TCL_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
-#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
-#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
-#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE (1 << 20)
-#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV10TCL_RC_FINAL1_F_MAPPING_SHIFT 21
-#define NV10TCL_RC_FINAL1_F_MAPPING_MASK 0x00e00000
-#define NV10TCL_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV10TCL_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV10TCL_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV10TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV10TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV10TCL_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV10TCL_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV10TCL_RC_FINAL1_E_INPUT_SHIFT 24
-#define NV10TCL_RC_FINAL1_E_INPUT_MASK 0x0f000000
-#define NV10TCL_RC_FINAL1_E_INPUT_ZERO 0x00000000
-#define NV10TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV10TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV10TCL_RC_FINAL1_E_INPUT_FOG 0x03000000
-#define NV10TCL_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
-#define NV10TCL_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
-#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
-#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
-#define NV10TCL_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
-#define NV10TCL_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
-#define NV10TCL_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV10TCL_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
-#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
-#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
-#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE (1 << 28)
-#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
-#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_SHIFT 29
-#define NV10TCL_RC_FINAL1_E_MAPPING_MASK 0xe0000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV10TCL_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV10TCL_LIGHT_MODEL 0x00000294
-#define NV10TCL_LIGHT_MODEL_VERTEX_SPECULAR (1 << 0)
-#define NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR (1 << 1)
-#define NV10TCL_LIGHT_MODEL_LOCAL_VIEWER (1 << 16)
-#define NV10TCL_COLOR_MATERIAL 0x00000298
-#define NV10TCL_COLOR_MATERIAL_EMISSION (1 << 0)
-#define NV10TCL_COLOR_MATERIAL_AMBIENT (1 << 1)
-#define NV10TCL_COLOR_MATERIAL_DIFFUSE (1 << 2)
-#define NV10TCL_COLOR_MATERIAL_SPECULAR (1 << 3)
-#define NV10TCL_FOG_MODE 0x0000029c
-#define NV10TCL_FOG_MODE_LINEAR 0x00002601
-#define NV10TCL_FOG_MODE_EXP 0x00000800
-#define NV10TCL_FOG_MODE_EXP_ABS 0x00000802
-#define NV10TCL_FOG_MODE_EXP2 0x00000803
-#define NV10TCL_FOG_COORD 0x000002a0
-#define NV10TCL_FOG_COORD_FOG 0x00000000
-#define NV10TCL_FOG_COORD_DIST_RADIAL 0x00000001
-#define NV10TCL_FOG_COORD_DIST_ORTHOGONAL 0x00000002
-#define NV10TCL_FOG_COORD_DIST_ORTHOGONAL_ABS 0x00000003
-#define NV10TCL_FOG_ENABLE 0x000002a4
-#define NV10TCL_FOG_COLOR 0x000002a8
-#define NV10TCL_FOG_COLOR_R_SHIFT 0
-#define NV10TCL_FOG_COLOR_R_MASK 0x000000ff
-#define NV10TCL_FOG_COLOR_G_SHIFT 8
-#define NV10TCL_FOG_COLOR_G_MASK 0x0000ff00
-#define NV10TCL_FOG_COLOR_B_SHIFT 16
-#define NV10TCL_FOG_COLOR_B_MASK 0x00ff0000
-#define NV10TCL_FOG_COLOR_A_SHIFT 24
-#define NV10TCL_FOG_COLOR_A_MASK 0xff000000
-#define NV10TCL_VIEWPORT_CLIP_MODE 0x000002b4
-#define NV10TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*4))
-#define NV10TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_L_SHIFT 0
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_L_MASK 0x000007ff
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_LEFT_ENABLE (1 << 11)
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_R_SHIFT 16
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_R_MASK 0x07ff0000
-#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_RIGHT_ENABLE (1 << 27)
-#define NV10TCL_VIEWPORT_CLIP_VERT(x) (0x000002e0+((x)*4))
-#define NV10TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_T_SHIFT 0
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_T_MASK 0x000007ff
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_TOP_ENABLE (1 << 11)
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_B_SHIFT 16
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_B_MASK 0x07ff0000
-#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_BOTTOM_ENABLE (1 << 27)
-#define NV10TCL_ALPHA_FUNC_ENABLE 0x00000300
-#define NV10TCL_BLEND_FUNC_ENABLE 0x00000304
-#define NV10TCL_CULL_FACE_ENABLE 0x00000308
-#define NV10TCL_DEPTH_TEST_ENABLE 0x0000030c
-#define NV10TCL_DITHER_ENABLE 0x00000310
-#define NV10TCL_LIGHTING_ENABLE 0x00000314
-#define NV10TCL_POINT_PARAMETERS_ENABLE 0x00000318
-#define NV10TCL_POINT_SMOOTH_ENABLE 0x0000031c
-#define NV10TCL_LINE_SMOOTH_ENABLE 0x00000320
-#define NV10TCL_POLYGON_SMOOTH_ENABLE 0x00000324
-#define NV10TCL_VERTEX_WEIGHT_ENABLE 0x00000328
-#define NV10TCL_STENCIL_ENABLE 0x0000032c
-#define NV10TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000330
-#define NV10TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000334
-#define NV10TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000338
-#define NV10TCL_ALPHA_FUNC_FUNC 0x0000033c
-#define NV10TCL_ALPHA_FUNC_FUNC_NEVER 0x00000200
-#define NV10TCL_ALPHA_FUNC_FUNC_LESS 0x00000201
-#define NV10TCL_ALPHA_FUNC_FUNC_EQUAL 0x00000202
-#define NV10TCL_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
-#define NV10TCL_ALPHA_FUNC_FUNC_GREATER 0x00000204
-#define NV10TCL_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV10TCL_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
-#define NV10TCL_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
-#define NV10TCL_ALPHA_FUNC_REF 0x00000340
-#define NV10TCL_BLEND_FUNC_SRC 0x00000344
-#define NV10TCL_BLEND_FUNC_SRC_ZERO 0x00000000
-#define NV10TCL_BLEND_FUNC_SRC_ONE 0x00000001
-#define NV10TCL_BLEND_FUNC_SRC_SRC_COLOR 0x00000300
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV10TCL_BLEND_FUNC_SRC_SRC_ALPHA 0x00000302
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV10TCL_BLEND_FUNC_SRC_DST_ALPHA 0x00000304
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV10TCL_BLEND_FUNC_SRC_DST_COLOR 0x00000306
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_COLOR 0x00000307
-#define NV10TCL_BLEND_FUNC_SRC_SRC_ALPHA_SATURATE 0x00000308
-#define NV10TCL_BLEND_FUNC_SRC_CONSTANT_COLOR 0x00008001
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV10TCL_BLEND_FUNC_SRC_CONSTANT_ALPHA 0x00008003
-#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV10TCL_BLEND_FUNC_DST 0x00000348
-#define NV10TCL_BLEND_FUNC_DST_ZERO 0x00000000
-#define NV10TCL_BLEND_FUNC_DST_ONE 0x00000001
-#define NV10TCL_BLEND_FUNC_DST_SRC_COLOR 0x00000300
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV10TCL_BLEND_FUNC_DST_SRC_ALPHA 0x00000302
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV10TCL_BLEND_FUNC_DST_DST_ALPHA 0x00000304
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV10TCL_BLEND_FUNC_DST_DST_COLOR 0x00000306
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_DST_COLOR 0x00000307
-#define NV10TCL_BLEND_FUNC_DST_SRC_ALPHA_SATURATE 0x00000308
-#define NV10TCL_BLEND_FUNC_DST_CONSTANT_COLOR 0x00008001
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV10TCL_BLEND_FUNC_DST_CONSTANT_ALPHA 0x00008003
-#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV10TCL_BLEND_COLOR 0x0000034c
-#define NV10TCL_BLEND_COLOR_B_SHIFT 0
-#define NV10TCL_BLEND_COLOR_B_MASK 0x000000ff
-#define NV10TCL_BLEND_COLOR_G_SHIFT 8
-#define NV10TCL_BLEND_COLOR_G_MASK 0x0000ff00
-#define NV10TCL_BLEND_COLOR_R_SHIFT 16
-#define NV10TCL_BLEND_COLOR_R_MASK 0x00ff0000
-#define NV10TCL_BLEND_COLOR_A_SHIFT 24
-#define NV10TCL_BLEND_COLOR_A_MASK 0xff000000
-#define NV10TCL_BLEND_EQUATION 0x00000350
-#define NV10TCL_BLEND_EQUATION_FUNC_ADD 0x00008006
-#define NV10TCL_BLEND_EQUATION_MIN 0x00008007
-#define NV10TCL_BLEND_EQUATION_MAX 0x00008008
-#define NV10TCL_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
-#define NV10TCL_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV10TCL_DEPTH_FUNC 0x00000354
-#define NV10TCL_DEPTH_FUNC_NEVER 0x00000200
-#define NV10TCL_DEPTH_FUNC_LESS 0x00000201
-#define NV10TCL_DEPTH_FUNC_EQUAL 0x00000202
-#define NV10TCL_DEPTH_FUNC_LEQUAL 0x00000203
-#define NV10TCL_DEPTH_FUNC_GREATER 0x00000204
-#define NV10TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
-#define NV10TCL_DEPTH_FUNC_GEQUAL 0x00000206
-#define NV10TCL_DEPTH_FUNC_ALWAYS 0x00000207
-#define NV10TCL_COLOR_MASK 0x00000358
-#define NV10TCL_COLOR_MASK_B (1 << 0)
-#define NV10TCL_COLOR_MASK_G (1 << 8)
-#define NV10TCL_COLOR_MASK_R (1 << 16)
-#define NV10TCL_COLOR_MASK_A (1 << 24)
-#define NV10TCL_DEPTH_WRITE_ENABLE 0x0000035c
-#define NV10TCL_STENCIL_MASK 0x00000360
-#define NV10TCL_STENCIL_FUNC_FUNC 0x00000364
-#define NV10TCL_STENCIL_FUNC_FUNC_NEVER 0x00000200
-#define NV10TCL_STENCIL_FUNC_FUNC_LESS 0x00000201
-#define NV10TCL_STENCIL_FUNC_FUNC_EQUAL 0x00000202
-#define NV10TCL_STENCIL_FUNC_FUNC_LEQUAL 0x00000203
-#define NV10TCL_STENCIL_FUNC_FUNC_GREATER 0x00000204
-#define NV10TCL_STENCIL_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV10TCL_STENCIL_FUNC_FUNC_GEQUAL 0x00000206
-#define NV10TCL_STENCIL_FUNC_FUNC_ALWAYS 0x00000207
-#define NV10TCL_STENCIL_FUNC_REF 0x00000368
-#define NV10TCL_STENCIL_FUNC_MASK 0x0000036c
-#define NV10TCL_STENCIL_OP_FAIL 0x00000370
-#define NV10TCL_STENCIL_OP_FAIL_ZERO 0x00000000
-#define NV10TCL_STENCIL_OP_FAIL_INVERT 0x0000150a
-#define NV10TCL_STENCIL_OP_FAIL_KEEP 0x00001e00
-#define NV10TCL_STENCIL_OP_FAIL_REPLACE 0x00001e01
-#define NV10TCL_STENCIL_OP_FAIL_INCR 0x00001e02
-#define NV10TCL_STENCIL_OP_FAIL_DECR 0x00001e03
-#define NV10TCL_STENCIL_OP_FAIL_INCR_WRAP 0x00008507
-#define NV10TCL_STENCIL_OP_FAIL_DECR_WRAP 0x00008508
-#define NV10TCL_STENCIL_OP_ZFAIL 0x00000374
-#define NV10TCL_STENCIL_OP_ZFAIL_ZERO 0x00000000
-#define NV10TCL_STENCIL_OP_ZFAIL_INVERT 0x0000150a
-#define NV10TCL_STENCIL_OP_ZFAIL_KEEP 0x00001e00
-#define NV10TCL_STENCIL_OP_ZFAIL_REPLACE 0x00001e01
-#define NV10TCL_STENCIL_OP_ZFAIL_INCR 0x00001e02
-#define NV10TCL_STENCIL_OP_ZFAIL_DECR 0x00001e03
-#define NV10TCL_STENCIL_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV10TCL_STENCIL_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV10TCL_STENCIL_OP_ZPASS 0x00000378
-#define NV10TCL_STENCIL_OP_ZPASS_ZERO 0x00000000
-#define NV10TCL_STENCIL_OP_ZPASS_INVERT 0x0000150a
-#define NV10TCL_STENCIL_OP_ZPASS_KEEP 0x00001e00
-#define NV10TCL_STENCIL_OP_ZPASS_REPLACE 0x00001e01
-#define NV10TCL_STENCIL_OP_ZPASS_INCR 0x00001e02
-#define NV10TCL_STENCIL_OP_ZPASS_DECR 0x00001e03
-#define NV10TCL_STENCIL_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV10TCL_STENCIL_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV10TCL_SHADE_MODEL 0x0000037c
-#define NV10TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NV10TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NV10TCL_LINE_WIDTH 0x00000380
-#define NV10TCL_POLYGON_OFFSET_FACTOR 0x00000384
-#define NV10TCL_POLYGON_OFFSET_UNITS 0x00000388
-#define NV10TCL_POLYGON_MODE_FRONT 0x0000038c
-#define NV10TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NV10TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NV10TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NV10TCL_POLYGON_MODE_BACK 0x00000390
-#define NV10TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NV10TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NV10TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NV10TCL_DEPTH_RANGE_NEAR 0x00000394
-#define NV10TCL_DEPTH_RANGE_FAR 0x00000398
-#define NV10TCL_CULL_FACE 0x0000039c
-#define NV10TCL_CULL_FACE_FRONT 0x00000404
-#define NV10TCL_CULL_FACE_BACK 0x00000405
-#define NV10TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NV10TCL_FRONT_FACE 0x000003a0
-#define NV10TCL_FRONT_FACE_CW 0x00000900
-#define NV10TCL_FRONT_FACE_CCW 0x00000901
-#define NV10TCL_NORMALIZE_ENABLE 0x000003a4
-#define NV10TCL_MATERIAL_FACTOR_R 0x000003a8
-#define NV10TCL_MATERIAL_FACTOR_G 0x000003ac
-#define NV10TCL_MATERIAL_FACTOR_B 0x000003b0
-#define NV10TCL_MATERIAL_FACTOR_A 0x000003b4
-#define NV10TCL_SEPARATE_SPECULAR_ENABLE 0x000003b8
-#define NV10TCL_ENABLED_LIGHTS 0x000003bc
-#define NV10TCL_ENABLED_LIGHTS_0_SHIFT 0
-#define NV10TCL_ENABLED_LIGHTS_0_MASK 0x00000003
-#define NV10TCL_ENABLED_LIGHTS_0_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_0_NONPOSITIONAL 0x00000001
-#define NV10TCL_ENABLED_LIGHTS_0_POSITIONAL 0x00000002
-#define NV10TCL_ENABLED_LIGHTS_0_DIRECTIONAL 0x00000003
-#define NV10TCL_ENABLED_LIGHTS_1_SHIFT 2
-#define NV10TCL_ENABLED_LIGHTS_1_MASK 0x0000000c
-#define NV10TCL_ENABLED_LIGHTS_1_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_1_NONPOSITIONAL 0x00000004
-#define NV10TCL_ENABLED_LIGHTS_1_POSITIONAL 0x00000008
-#define NV10TCL_ENABLED_LIGHTS_1_DIRECTIONAL 0x0000000c
-#define NV10TCL_ENABLED_LIGHTS_2_SHIFT 4
-#define NV10TCL_ENABLED_LIGHTS_2_MASK 0x00000030
-#define NV10TCL_ENABLED_LIGHTS_2_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_2_NONPOSITIONAL 0x00000010
-#define NV10TCL_ENABLED_LIGHTS_2_POSITIONAL 0x00000020
-#define NV10TCL_ENABLED_LIGHTS_2_DIRECTIONAL 0x00000030
-#define NV10TCL_ENABLED_LIGHTS_3_SHIFT 6
-#define NV10TCL_ENABLED_LIGHTS_3_MASK 0x000000c0
-#define NV10TCL_ENABLED_LIGHTS_3_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_3_NONPOSITIONAL 0x00000040
-#define NV10TCL_ENABLED_LIGHTS_3_POSITIONAL 0x00000080
-#define NV10TCL_ENABLED_LIGHTS_3_DIRECTIONAL 0x000000c0
-#define NV10TCL_ENABLED_LIGHTS_4_SHIFT 8
-#define NV10TCL_ENABLED_LIGHTS_4_MASK 0x00000300
-#define NV10TCL_ENABLED_LIGHTS_4_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_4_NONPOSITIONAL 0x00000100
-#define NV10TCL_ENABLED_LIGHTS_4_POSITIONAL 0x00000200
-#define NV10TCL_ENABLED_LIGHTS_4_DIRECTIONAL 0x00000300
-#define NV10TCL_ENABLED_LIGHTS_5_SHIFT 10
-#define NV10TCL_ENABLED_LIGHTS_5_MASK 0x00000c00
-#define NV10TCL_ENABLED_LIGHTS_5_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_5_NONPOSITIONAL 0x00000400
-#define NV10TCL_ENABLED_LIGHTS_5_POSITIONAL 0x00000800
-#define NV10TCL_ENABLED_LIGHTS_5_DIRECTIONAL 0x00000c00
-#define NV10TCL_ENABLED_LIGHTS_6_SHIFT 12
-#define NV10TCL_ENABLED_LIGHTS_6_MASK 0x00003000
-#define NV10TCL_ENABLED_LIGHTS_6_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_6_NONPOSITIONAL 0x00001000
-#define NV10TCL_ENABLED_LIGHTS_6_POSITIONAL 0x00002000
-#define NV10TCL_ENABLED_LIGHTS_6_DIRECTIONAL 0x00003000
-#define NV10TCL_ENABLED_LIGHTS_7_SHIFT 14
-#define NV10TCL_ENABLED_LIGHTS_7_MASK 0x0000c000
-#define NV10TCL_ENABLED_LIGHTS_7_DISABLED 0x00000000
-#define NV10TCL_ENABLED_LIGHTS_7_NONPOSITIONAL 0x00004000
-#define NV10TCL_ENABLED_LIGHTS_7_POSITIONAL 0x00008000
-#define NV10TCL_ENABLED_LIGHTS_7_DIRECTIONAL 0x0000c000
-#define NV10TCL_TX_GEN_MODE_S(x) (0x000003c0+((x)*16))
-#define NV10TCL_TX_GEN_MODE_S__SIZE 0x00000002
-#define NV10TCL_TX_GEN_MODE_S_FALSE 0x00000000
-#define NV10TCL_TX_GEN_MODE_S_EYE_LINEAR 0x00002400
-#define NV10TCL_TX_GEN_MODE_S_OBJECT_LINEAR 0x00002401
-#define NV10TCL_TX_GEN_MODE_S_SPHERE_MAP 0x00002402
-#define NV10TCL_TX_GEN_MODE_S_NORMAL_MAP 0x00008511
-#define NV10TCL_TX_GEN_MODE_S_REFLECTION_MAP 0x00008512
-#define NV10TCL_TX_GEN_MODE_T(x) (0x000003c4+((x)*16))
-#define NV10TCL_TX_GEN_MODE_T__SIZE 0x00000002
-#define NV10TCL_TX_GEN_MODE_T_FALSE 0x00000000
-#define NV10TCL_TX_GEN_MODE_T_EYE_LINEAR 0x00002400
-#define NV10TCL_TX_GEN_MODE_T_OBJECT_LINEAR 0x00002401
-#define NV10TCL_TX_GEN_MODE_T_SPHERE_MAP 0x00002402
-#define NV10TCL_TX_GEN_MODE_T_NORMAL_MAP 0x00008511
-#define NV10TCL_TX_GEN_MODE_T_REFLECTION_MAP 0x00008512
-#define NV10TCL_TX_GEN_MODE_R(x) (0x000003c8+((x)*16))
-#define NV10TCL_TX_GEN_MODE_R__SIZE 0x00000002
-#define NV10TCL_TX_GEN_MODE_R_FALSE 0x00000000
-#define NV10TCL_TX_GEN_MODE_R_EYE_LINEAR 0x00002400
-#define NV10TCL_TX_GEN_MODE_R_OBJECT_LINEAR 0x00002401
-#define NV10TCL_TX_GEN_MODE_R_SPHERE_MAP 0x00002402
-#define NV10TCL_TX_GEN_MODE_R_NORMAL_MAP 0x00008511
-#define NV10TCL_TX_GEN_MODE_R_REFLECTION_MAP 0x00008512
-#define NV10TCL_TX_GEN_MODE_Q(x) (0x000003cc+((x)*16))
-#define NV10TCL_TX_GEN_MODE_Q__SIZE 0x00000002
-#define NV10TCL_TX_GEN_MODE_Q_FALSE 0x00000000
-#define NV10TCL_TX_GEN_MODE_Q_EYE_LINEAR 0x00002400
-#define NV10TCL_TX_GEN_MODE_Q_OBJECT_LINEAR 0x00002401
-#define NV10TCL_TX_GEN_MODE_Q_SPHERE_MAP 0x00002402
-#define NV10TCL_TX_GEN_MODE_Q_NORMAL_MAP 0x00008511
-#define NV10TCL_TX_GEN_MODE_Q_REFLECTION_MAP 0x00008512
-#define NV10TCL_TX_MATRIX_ENABLE(x) (0x000003e0+((x)*4))
-#define NV10TCL_TX_MATRIX_ENABLE__SIZE 0x00000002
-#define NV10TCL_VIEW_MATRIX_ENABLE 0x000003e8
-#define NV10TCL_VIEW_MATRIX_ENABLE_MODELVIEW1 (1 << 0)
-#define NV10TCL_VIEW_MATRIX_ENABLE_MODELVIEW0 (1 << 1)
-#define NV10TCL_VIEW_MATRIX_ENABLE_PROJECTION (1 << 2)
-#define NV10TCL_POINT_SIZE 0x000003ec
-#define NV10TCL_MODELVIEW0_MATRIX(x) (0x00000400+((x)*4))
-#define NV10TCL_MODELVIEW0_MATRIX__SIZE 0x00000010
-#define NV10TCL_MODELVIEW1_MATRIX(x) (0x00000440+((x)*4))
-#define NV10TCL_MODELVIEW1_MATRIX__SIZE 0x00000010
-#define NV10TCL_INVERSE_MODELVIEW0_MATRIX(x) (0x00000480+((x)*4))
-#define NV10TCL_INVERSE_MODELVIEW0_MATRIX__SIZE 0x00000010
-#define NV10TCL_INVERSE_MODELVIEW1_MATRIX(x) (0x000004c0+((x)*4))
-#define NV10TCL_INVERSE_MODELVIEW1_MATRIX__SIZE 0x00000010
-#define NV10TCL_PROJECTION_MATRIX(x) (0x00000500+((x)*4))
-#define NV10TCL_PROJECTION_MATRIX__SIZE 0x00000010
-#define NV10TCL_TX0_MATRIX(x) (0x00000540+((x)*4))
-#define NV10TCL_TX0_MATRIX__SIZE 0x00000010
-#define NV10TCL_TX1_MATRIX(x) (0x00000580+((x)*4))
-#define NV10TCL_TX1_MATRIX__SIZE 0x00000010
-#define NV10TCL_TX_GEN_COEFF_S_A(x) (0x00000600+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_S_A__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_S_B(x) (0x00000604+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_S_B__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_S_C(x) (0x00000608+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_S_C__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_S_D(x) (0x0000060c+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_S_D__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_T_A(x) (0x00000610+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_T_A__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_T_B(x) (0x00000614+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_T_B__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_T_C(x) (0x00000618+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_T_C__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_T_D(x) (0x0000061c+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_T_D__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_R_A(x) (0x00000620+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_R_A__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_R_B(x) (0x00000624+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_R_B__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_R_C(x) (0x00000628+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_R_C__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_R_D(x) (0x0000062c+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_R_D__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_Q_A(x) (0x00000630+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_Q_A__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_Q_B(x) (0x00000634+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_Q_B__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_Q_C(x) (0x00000638+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_Q_C__SIZE 0x00000002
-#define NV10TCL_TX_GEN_COEFF_Q_D(x) (0x0000063c+((x)*64))
-#define NV10TCL_TX_GEN_COEFF_Q_D__SIZE 0x00000002
-#define NV10TCL_FOG_EQUATION_CONSTANT 0x00000680
-#define NV10TCL_FOG_EQUATION_LINEAR 0x00000684
-#define NV10TCL_FOG_EQUATION_QUADRATIC 0x00000688
-#define NV10TCL_MATERIAL_SHININESS(x) (0x000006a0+((x)*4))
-#define NV10TCL_MATERIAL_SHININESS__SIZE 0x00000006
-#define NV10TCL_LIGHT_MODEL_AMBIENT_R 0x000006c4
-#define NV10TCL_LIGHT_MODEL_AMBIENT_G 0x000006c8
-#define NV10TCL_LIGHT_MODEL_AMBIENT_B 0x000006cc
-#define NV10TCL_VIEWPORT_TRANSLATE_X 0x000006e8
-#define NV10TCL_VIEWPORT_TRANSLATE_Y 0x000006ec
-#define NV10TCL_VIEWPORT_TRANSLATE_Z 0x000006f0
-#define NV10TCL_VIEWPORT_TRANSLATE_W 0x000006f4
-#define NV10TCL_POINT_PARAMETER(x) (0x000006f8+((x)*4))
-#define NV10TCL_POINT_PARAMETER__SIZE 0x00000008
-#define NV10TCL_LIGHT_AMBIENT_R(x) (0x00000800+((x)*128))
-#define NV10TCL_LIGHT_AMBIENT_R__SIZE 0x00000008
-#define NV10TCL_LIGHT_AMBIENT_G(x) (0x00000804+((x)*128))
-#define NV10TCL_LIGHT_AMBIENT_G__SIZE 0x00000008
-#define NV10TCL_LIGHT_AMBIENT_B(x) (0x00000808+((x)*128))
-#define NV10TCL_LIGHT_AMBIENT_B__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIFFUSE_R(x) (0x0000080c+((x)*128))
-#define NV10TCL_LIGHT_DIFFUSE_R__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIFFUSE_G(x) (0x00000810+((x)*128))
-#define NV10TCL_LIGHT_DIFFUSE_G__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIFFUSE_B(x) (0x00000814+((x)*128))
-#define NV10TCL_LIGHT_DIFFUSE_B__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPECULAR_R(x) (0x00000818+((x)*128))
-#define NV10TCL_LIGHT_SPECULAR_R__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPECULAR_G(x) (0x0000081c+((x)*128))
-#define NV10TCL_LIGHT_SPECULAR_G__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPECULAR_B(x) (0x00000820+((x)*128))
-#define NV10TCL_LIGHT_SPECULAR_B__SIZE 0x00000008
-#define NV10TCL_LIGHT_HALF_VECTOR_X(x) (0x00000828+((x)*128))
-#define NV10TCL_LIGHT_HALF_VECTOR_X__SIZE 0x00000008
-#define NV10TCL_LIGHT_HALF_VECTOR_Y(x) (0x0000082c+((x)*128))
-#define NV10TCL_LIGHT_HALF_VECTOR_Y__SIZE 0x00000008
-#define NV10TCL_LIGHT_HALF_VECTOR_Z(x) (0x00000830+((x)*128))
-#define NV10TCL_LIGHT_HALF_VECTOR_Z__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIRECTION_X(x) (0x00000834+((x)*128))
-#define NV10TCL_LIGHT_DIRECTION_X__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIRECTION_Y(x) (0x00000838+((x)*128))
-#define NV10TCL_LIGHT_DIRECTION_Y__SIZE 0x00000008
-#define NV10TCL_LIGHT_DIRECTION_Z(x) (0x0000083c+((x)*128))
-#define NV10TCL_LIGHT_DIRECTION_Z__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_CUTOFF_A(x) (0x00000840+((x)*128))
-#define NV10TCL_LIGHT_SPOT_CUTOFF_A__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_CUTOFF_B(x) (0x00000844+((x)*128))
-#define NV10TCL_LIGHT_SPOT_CUTOFF_B__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_CUTOFF_C(x) (0x00000848+((x)*128))
-#define NV10TCL_LIGHT_SPOT_CUTOFF_C__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_DIR_X(x) (0x0000084c+((x)*128))
-#define NV10TCL_LIGHT_SPOT_DIR_X__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_DIR_Y(x) (0x00000850+((x)*128))
-#define NV10TCL_LIGHT_SPOT_DIR_Y__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_DIR_Z(x) (0x00000854+((x)*128))
-#define NV10TCL_LIGHT_SPOT_DIR_Z__SIZE 0x00000008
-#define NV10TCL_LIGHT_SPOT_CUTOFF_D(x) (0x00000858+((x)*128))
-#define NV10TCL_LIGHT_SPOT_CUTOFF_D__SIZE 0x00000008
-#define NV10TCL_LIGHT_POSITION_X(x) (0x0000085c+((x)*128))
-#define NV10TCL_LIGHT_POSITION_X__SIZE 0x00000008
-#define NV10TCL_LIGHT_POSITION_Y(x) (0x00000860+((x)*128))
-#define NV10TCL_LIGHT_POSITION_Y__SIZE 0x00000008
-#define NV10TCL_LIGHT_POSITION_Z(x) (0x00000864+((x)*128))
-#define NV10TCL_LIGHT_POSITION_Z__SIZE 0x00000008
-#define NV10TCL_LIGHT_ATTENUATION_CONSTANT(x) (0x00000868+((x)*128))
-#define NV10TCL_LIGHT_ATTENUATION_CONSTANT__SIZE 0x00000008
-#define NV10TCL_LIGHT_ATTENUATION_LINEAR(x) (0x0000086c+((x)*128))
-#define NV10TCL_LIGHT_ATTENUATION_LINEAR__SIZE 0x00000008
-#define NV10TCL_LIGHT_ATTENUATION_QUADRATIC(x) (0x00000870+((x)*128))
-#define NV10TCL_LIGHT_ATTENUATION_QUADRATIC__SIZE 0x00000008
-#define NV10TCL_VERTEX_POS_3F_X 0x00000c00
-#define NV10TCL_VERTEX_POS_3F_Y 0x00000c04
-#define NV10TCL_VERTEX_POS_3F_Z 0x00000c08
-#define NV10TCL_VERTEX_POS_4F_X 0x00000c18
-#define NV10TCL_VERTEX_POS_4F_Y 0x00000c1c
-#define NV10TCL_VERTEX_POS_4F_Z 0x00000c20
-#define NV10TCL_VERTEX_POS_4F_W 0x00000c24
-#define NV10TCL_VERTEX_NOR_3F_X 0x00000c30
-#define NV10TCL_VERTEX_NOR_3F_Y 0x00000c34
-#define NV10TCL_VERTEX_NOR_3F_Z 0x00000c38
-#define NV10TCL_VERTEX_NOR_3I_XY 0x00000c40
-#define NV10TCL_VERTEX_NOR_3I_XY_X_SHIFT 0
-#define NV10TCL_VERTEX_NOR_3I_XY_X_MASK 0x0000ffff
-#define NV10TCL_VERTEX_NOR_3I_XY_Y_SHIFT 16
-#define NV10TCL_VERTEX_NOR_3I_XY_Y_MASK 0xffff0000
-#define NV10TCL_VERTEX_NOR_3I_Z 0x00000c44
-#define NV10TCL_VERTEX_NOR_3I_Z_Z_SHIFT 0
-#define NV10TCL_VERTEX_NOR_3I_Z_Z_MASK 0x0000ffff
-#define NV10TCL_VERTEX_COL_4F_R 0x00000c50
-#define NV10TCL_VERTEX_COL_4F_G 0x00000c54
-#define NV10TCL_VERTEX_COL_4F_B 0x00000c58
-#define NV10TCL_VERTEX_COL_4F_A 0x00000c5c
-#define NV10TCL_VERTEX_COL_3F_R 0x00000c60
-#define NV10TCL_VERTEX_COL_3F_G 0x00000c64
-#define NV10TCL_VERTEX_COL_3F_B 0x00000c68
-#define NV10TCL_VERTEX_COL_4I 0x00000c6c
-#define NV10TCL_VERTEX_COL_4I_R_SHIFT 0
-#define NV10TCL_VERTEX_COL_4I_R_MASK 0x000000ff
-#define NV10TCL_VERTEX_COL_4I_G_SHIFT 8
-#define NV10TCL_VERTEX_COL_4I_G_MASK 0x0000ff00
-#define NV10TCL_VERTEX_COL_4I_B_SHIFT 16
-#define NV10TCL_VERTEX_COL_4I_B_MASK 0x00ff0000
-#define NV10TCL_VERTEX_COL_4I_A_SHIFT 24
-#define NV10TCL_VERTEX_COL_4I_A_MASK 0xff000000
-#define NV10TCL_VERTEX_COL2_3F_R 0x00000c80
-#define NV10TCL_VERTEX_COL2_3F_G 0x00000c84
-#define NV10TCL_VERTEX_COL2_3F_B 0x00000c88
-#define NV10TCL_VERTEX_COL2_3I 0x00000c8c
-#define NV10TCL_VERTEX_COL2_3I_R_SHIFT 0
-#define NV10TCL_VERTEX_COL2_3I_R_MASK 0x000000ff
-#define NV10TCL_VERTEX_COL2_3I_G_SHIFT 8
-#define NV10TCL_VERTEX_COL2_3I_G_MASK 0x0000ff00
-#define NV10TCL_VERTEX_COL2_3I_B_SHIFT 16
-#define NV10TCL_VERTEX_COL2_3I_B_MASK 0x00ff0000
-#define NV10TCL_VERTEX_TX0_2F_S 0x00000c90
-#define NV10TCL_VERTEX_TX0_2F_T 0x00000c94
-#define NV10TCL_VERTEX_TX0_2I 0x00000c98
-#define NV10TCL_VERTEX_TX0_2I_S_SHIFT 0
-#define NV10TCL_VERTEX_TX0_2I_S_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX0_2I_T_SHIFT 16
-#define NV10TCL_VERTEX_TX0_2I_T_MASK 0xffff0000
-#define NV10TCL_VERTEX_TX0_4F_S 0x00000ca0
-#define NV10TCL_VERTEX_TX0_4F_T 0x00000ca4
-#define NV10TCL_VERTEX_TX0_4F_R 0x00000ca8
-#define NV10TCL_VERTEX_TX0_4F_Q 0x00000cac
-#define NV10TCL_VERTEX_TX0_4I_ST 0x00000cb0
-#define NV10TCL_VERTEX_TX0_4I_ST_S_SHIFT 0
-#define NV10TCL_VERTEX_TX0_4I_ST_S_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX0_4I_ST_T_SHIFT 16
-#define NV10TCL_VERTEX_TX0_4I_ST_T_MASK 0xffff0000
-#define NV10TCL_VERTEX_TX0_4I_RQ 0x00000cb4
-#define NV10TCL_VERTEX_TX0_4I_RQ_R_SHIFT 0
-#define NV10TCL_VERTEX_TX0_4I_RQ_R_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX0_4I_RQ_Q_SHIFT 16
-#define NV10TCL_VERTEX_TX0_4I_RQ_Q_MASK 0xffff0000
-#define NV10TCL_VERTEX_TX1_2F_S 0x00000cb8
-#define NV10TCL_VERTEX_TX1_2F_T 0x00000cbc
-#define NV10TCL_VERTEX_TX1_2I 0x00000cc0
-#define NV10TCL_VERTEX_TX1_2I_S_SHIFT 0
-#define NV10TCL_VERTEX_TX1_2I_S_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX1_2I_T_SHIFT 16
-#define NV10TCL_VERTEX_TX1_2I_T_MASK 0xffff0000
-#define NV10TCL_VERTEX_TX1_4F_S 0x00000cc8
-#define NV10TCL_VERTEX_TX1_4F_T 0x00000ccc
-#define NV10TCL_VERTEX_TX1_4F_R 0x00000cd0
-#define NV10TCL_VERTEX_TX1_4F_Q 0x00000cd4
-#define NV10TCL_VERTEX_TX1_4I_ST 0x00000cd8
-#define NV10TCL_VERTEX_TX1_4I_ST_S_SHIFT 0
-#define NV10TCL_VERTEX_TX1_4I_ST_S_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX1_4I_ST_T_SHIFT 16
-#define NV10TCL_VERTEX_TX1_4I_ST_T_MASK 0xffff0000
-#define NV10TCL_VERTEX_TX1_4I_RQ 0x00000cdc
-#define NV10TCL_VERTEX_TX1_4I_RQ_R_SHIFT 0
-#define NV10TCL_VERTEX_TX1_4I_RQ_R_MASK 0x0000ffff
-#define NV10TCL_VERTEX_TX1_4I_RQ_Q_SHIFT 16
-#define NV10TCL_VERTEX_TX1_4I_RQ_Q_MASK 0xffff0000
-#define NV10TCL_VERTEX_FOG_1F 0x00000ce0
-#define NV10TCL_VERTEX_WGH_1F 0x00000ce4
-#define NV10TCL_EDGEFLAG_ENABLE 0x00000cec
-#define NV10TCL_VERTEX_ARRAY_VALIDATE 0x00000cf0
-#define NV10TCL_VTXBUF_ADDRESS(x) (0x00000d00+((x)*8))
-#define NV10TCL_VTXBUF_ADDRESS__SIZE 0x00000008
-#define NV10TCL_VTXFMT(x) (0x00000d04+((x)*8))
-#define NV10TCL_VTXFMT__SIZE 0x00000008
-#define NV10TCL_VTXFMT_TYPE_SHIFT 0
-#define NV10TCL_VTXFMT_TYPE_MASK 0x0000000f
-#define NV10TCL_VTXFMT_TYPE_BYTE_BGRA 0x00000000
-#define NV10TCL_VTXFMT_TYPE_SHORT 0x00000001
-#define NV10TCL_VTXFMT_TYPE_FLOAT 0x00000002
-#define NV10TCL_VTXFMT_TYPE_BYTE_RGBA 0x00000004
-#define NV10TCL_VTXFMT_FIELDS_SHIFT 4
-#define NV10TCL_VTXFMT_FIELDS_MASK 0x000000f0
-#define NV10TCL_VTXFMT_STRIDE_SHIFT 8
-#define NV10TCL_VTXFMT_STRIDE_MASK 0x0000ff00
-#define NV10TCL_VTXFMT_POS_HOMOGENEOUS (1 << 24)
-#define NV10TCL_VERTEX_BEGIN_END 0x00000dfc
-#define NV10TCL_VERTEX_BEGIN_END_STOP 0x00000000
-#define NV10TCL_VERTEX_BEGIN_END_POINTS 0x00000001
-#define NV10TCL_VERTEX_BEGIN_END_LINES 0x00000002
-#define NV10TCL_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
-#define NV10TCL_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
-#define NV10TCL_VERTEX_BEGIN_END_TRIANGLES 0x00000005
-#define NV10TCL_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
-#define NV10TCL_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
-#define NV10TCL_VERTEX_BEGIN_END_QUADS 0x00000008
-#define NV10TCL_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
-#define NV10TCL_VERTEX_BEGIN_END_POLYGON 0x0000000a
-#define NV10TCL_VB_ELEMENT_U16 0x00000e00
-#define NV10TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NV10TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NV10TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NV10TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NV10TCL_VB_ELEMENT_U32 0x00001100
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END 0x000013fc
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_STOP 0x00000000
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_POINTS 0x00000001
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINES 0x00000002
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINE_LOOP 0x00000003
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINE_STRIP 0x00000004
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLES 0x00000005
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLE_STRIP 0x00000006
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLE_FAN 0x00000007
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_QUADS 0x00000008
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_QUAD_STRIP 0x00000009
-#define NV10TCL_VERTEX_BUFFER_BEGIN_END_POLYGON 0x0000000a
-#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS 0x00001400
-#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_FIRST_SHIFT 0
-#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_FIRST_MASK 0x0000ffff
-#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_LAST_SHIFT 24
-#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_LAST_MASK 0xff000000
-#define NV10TCL_VERTEX_ARRAY_DATA 0x00001800
-
-
-#define NV11TCL 0x00000096
-
-#define NV11TCL_COLOR_LOGIC_OP_ENABLE 0x00000d40
-#define NV11TCL_COLOR_LOGIC_OP_OP 0x00000d44
-#define NV11TCL_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
-#define NV11TCL_COLOR_LOGIC_OP_OP_AND 0x00001501
-#define NV11TCL_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
-#define NV11TCL_COLOR_LOGIC_OP_OP_COPY 0x00001503
-#define NV11TCL_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
-#define NV11TCL_COLOR_LOGIC_OP_OP_NOOP 0x00001505
-#define NV11TCL_COLOR_LOGIC_OP_OP_XOR 0x00001506
-#define NV11TCL_COLOR_LOGIC_OP_OP_OR 0x00001507
-#define NV11TCL_COLOR_LOGIC_OP_OP_NOR 0x00001508
-#define NV11TCL_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
-#define NV11TCL_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
-#define NV11TCL_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
-#define NV11TCL_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
-#define NV11TCL_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
-#define NV11TCL_COLOR_LOGIC_OP_OP_NAND 0x0000150e
-#define NV11TCL_COLOR_LOGIC_OP_OP_SET 0x0000150f
-
-
-#define NV17TCL 0x00000099
-
-#define NV17TCL_DMA_IN_MEMORY4 0x000001ac
-#define NV17TCL_DMA_IN_MEMORY5 0x000001b0
-#define NV17TCL_COLOR_MASK_ENABLE 0x000002bc
-#define NV17TCL_LMA_DEPTH_BUFFER_PITCH 0x00000d5c
-#define NV17TCL_LMA_DEPTH_BUFFER_OFFSET 0x00000d60
-#define NV17TCL_LMA_DEPTH_FILL_VALUE 0x00000d68
-#define NV17TCL_LMA_DEPTH_BUFFER_CLEAR 0x00000d6c
-#define NV17TCL_LMA_DEPTH_WINDOW_X 0x00001638
-#define NV17TCL_LMA_DEPTH_WINDOW_Y 0x0000163c
-#define NV17TCL_LMA_DEPTH_WINDOW_Z 0x00001640
-#define NV17TCL_LMA_DEPTH_WINDOW_W 0x00001644
-#define NV17TCL_LMA_DEPTH_ENABLE 0x00001658
-
-
-#define NV03_CONTEXT_SURFACES_2D 0x00000058
-
-#define NV03_CONTEXT_SURFACES_2D_SYNCHRONIZE 0x00000100
-#define NV03_CONTEXT_SURFACES_2D_DMA_NOTIFY 0x00000180
-#define NV03_CONTEXT_SURFACES_2D_DMA_SOURCE 0x00000184
-#define NV03_CONTEXT_SURFACES_2D_DMA_DESTIN 0x00000188
-#define NV03_CONTEXT_SURFACES_2D_COLOR_FORMAT 0x00000300
-#define NV03_CONTEXT_SURFACES_2D_PITCH 0x00000304
-#define NV03_CONTEXT_SURFACES_2D_PITCH_SOURCE_SHIFT 0
-#define NV03_CONTEXT_SURFACES_2D_PITCH_SOURCE_MASK 0x0000ffff
-#define NV03_CONTEXT_SURFACES_2D_PITCH_DESTIN_SHIFT 16
-#define NV03_CONTEXT_SURFACES_2D_PITCH_DESTIN_MASK 0xffff0000
-#define NV03_CONTEXT_SURFACES_2D_OFFSET_SOURCE 0x00000308
-#define NV03_CONTEXT_SURFACES_2D_OFFSET_DESTIN 0x0000030c
-
-
-#define NV03_CONTEXT_SURFACES_3D 0x0000005a
-
-#define NV03_CONTEXT_SURFACES_3D_SYNCHRONIZE 0x00000100
-#define NV03_CONTEXT_SURFACES_3D_DMA_NOTIFY 0x00000180
-#define NV03_CONTEXT_SURFACES_3D_DMA_SURFACE 0x00000184
-#define NV03_CONTEXT_SURFACES_3D_PITCH 0x00000300
-#define NV03_CONTEXT_SURFACES_3D_OFFSET_COLOR 0x00000304
-#define NV03_CONTEXT_SURFACES_3D_OFFSET_ZETA 0x00000308
-
-
-#define NV04_INDEXED_IMAGE_FROM_CPU 0x00000060
-
-#define NV04_INDEXED_IMAGE_FROM_CPU_NOP 0x00000100
-#define NV04_INDEXED_IMAGE_FROM_CPU_NOTIFY 0x00000104
-#define NV04_INDEXED_IMAGE_FROM_CPU_PATCH 0x0000010c
-#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
-#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_LUT 0x00000184
-#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_KEY 0x00000188
-#define NV04_INDEXED_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x0000018c
-#define NV04_INDEXED_IMAGE_FROM_CPU_PATTERN 0x00000190
-#define NV04_INDEXED_IMAGE_FROM_CPU_ROP 0x00000194
-#define NV04_INDEXED_IMAGE_FROM_CPU_BETA1 0x00000198
-#define NV04_INDEXED_IMAGE_FROM_CPU_BETA4 0x0000019c
-#define NV04_INDEXED_IMAGE_FROM_CPU_SURFACE 0x000001a0
-#define NV04_INDEXED_IMAGE_FROM_CPU_OPERATION 0x000003e4
-#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_FORMAT 0x000003e8
-#define NV04_INDEXED_IMAGE_FROM_CPU_INDEX_FORMAT 0x000003ec
-#define NV04_INDEXED_IMAGE_FROM_CPU_LUT_OFFSET 0x000003f0
-#define NV04_INDEXED_IMAGE_FROM_CPU_POINT 0x000003f4
-#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_OUT 0x000003f8
-#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_IN 0x000003fc
-#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
-#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR__SIZE 0x00000700
-
-
-#define NV05_INDEXED_IMAGE_FROM_CPU 0x00000064
-
-#define NV05_INDEXED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000003e0
-
-
-#define NV03_CHANNEL_PIO 0x0000006a
-
-
-
-#define NV03_CHANNEL_DMA 0x0000006b
-
-
-
-#define NV04_BETA_SOLID 0x00000072
-
-#define NV04_BETA_SOLID_NOP 0x00000100
-#define NV04_BETA_SOLID_NOTIFY 0x00000104
-#define NV04_BETA_SOLID_DMA_NOTIFY 0x00000180
-#define NV04_BETA_SOLID_BETA_OUTPUT 0x00000200
-#define NV04_BETA_SOLID_BETA_FACTOR 0x00000300
-
-
-#define NV10_TEXTURE_FROM_CPU 0x0000007b
-
-#define NV10_TEXTURE_FROM_CPU_NOP 0x00000100
-#define NV10_TEXTURE_FROM_CPU_NOTIFY 0x00000104
-#define NV10_TEXTURE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
-#define NV10_TEXTURE_FROM_CPU_PM_TRIGGER 0x00000140
-#define NV10_TEXTURE_FROM_CPU_DMA_NOTIFY 0x00000180
-#define NV10_TEXTURE_FROM_CPU_SURFACE 0x00000184
-#define NV10_TEXTURE_FROM_CPU_COLOR_FORMAT 0x00000300
-#define NV10_TEXTURE_FROM_CPU_POINT 0x00000304
-#define NV10_TEXTURE_FROM_CPU_POINT_X_SHIFT 0
-#define NV10_TEXTURE_FROM_CPU_POINT_X_MASK 0x0000ffff
-#define NV10_TEXTURE_FROM_CPU_POINT_Y_SHIFT 16
-#define NV10_TEXTURE_FROM_CPU_POINT_Y_MASK 0xffff0000
-#define NV10_TEXTURE_FROM_CPU_SIZE 0x00000308
-#define NV10_TEXTURE_FROM_CPU_SIZE_W_SHIFT 0
-#define NV10_TEXTURE_FROM_CPU_SIZE_W_MASK 0x0000ffff
-#define NV10_TEXTURE_FROM_CPU_SIZE_H_SHIFT 16
-#define NV10_TEXTURE_FROM_CPU_SIZE_H_MASK 0xffff0000
-#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL 0x0000030c
-#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X_SHIFT 0
-#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X_MASK 0x0000ffff
-#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W_SHIFT 16
-#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W_MASK 0xffff0000
-#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL 0x00000310
-#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y_SHIFT 0
-#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y_MASK 0x0000ffff
-#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H_SHIFT 16
-#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H_MASK 0xffff0000
-#define NV10_TEXTURE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
-#define NV10_TEXTURE_FROM_CPU_COLOR__SIZE 0x00000700
-
-
-#define NV30_TEXTURE_FROM_CPU 0x0000037b
-
-
-
-#define NV40_TEXTURE_FROM_CPU 0x0000307b
-
-
-
-#define NV10_VIDEO_DISPLAY 0x0000007c
-
-
-
-#define NV20TCL 0x00000097
-
-#define NV20TCL_NOP 0x00000100
-#define NV20TCL_NOTIFY 0x00000104
-#define NV20TCL_DMA_NOTIFY 0x00000180
-#define NV20TCL_DMA_TEXTURE0 0x00000184
-#define NV20TCL_DMA_TEXTURE1 0x00000188
-#define NV20TCL_DMA_COLOR 0x00000194
-#define NV20TCL_DMA_ZETA 0x00000198
-#define NV20TCL_DMA_VTXBUF0 0x0000019c
-#define NV20TCL_DMA_VTXBUF1 0x000001a0
-#define NV20TCL_DMA_FENCE 0x000001a4
-#define NV20TCL_DMA_QUERY 0x000001a8
-#define NV20TCL_RT_HORIZ 0x00000200
-#define NV20TCL_RT_HORIZ_X_SHIFT 0
-#define NV20TCL_RT_HORIZ_X_MASK 0x0000ffff
-#define NV20TCL_RT_HORIZ_W_SHIFT 16
-#define NV20TCL_RT_HORIZ_W_MASK 0xffff0000
-#define NV20TCL_RT_VERT 0x00000204
-#define NV20TCL_RT_VERT_Y_SHIFT 0
-#define NV20TCL_RT_VERT_Y_MASK 0x0000ffff
-#define NV20TCL_RT_VERT_H_SHIFT 16
-#define NV20TCL_RT_VERT_H_MASK 0xffff0000
-#define NV20TCL_RT_FORMAT 0x00000208
-#define NV20TCL_RT_FORMAT_TYPE_SHIFT 8
-#define NV20TCL_RT_FORMAT_TYPE_MASK 0x00000f00
-#define NV20TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
-#define NV20TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
-#define NV20TCL_RT_FORMAT_COLOR_SHIFT 0
-#define NV20TCL_RT_FORMAT_COLOR_MASK 0x0000001f
-#define NV20TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
-#define NV20TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
-#define NV20TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
-#define NV20TCL_RT_FORMAT_COLOR_B8 0x00000009
-#define NV20TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
-#define NV20TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
-#define NV20TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
-#define NV20TCL_RT_PITCH 0x0000020c
-#define NV20TCL_RT_PITCH_COLOR_PITCH_SHIFT 0
-#define NV20TCL_RT_PITCH_COLOR_PITCH_MASK 0x0000ffff
-#define NV20TCL_RT_PITCH_ZETA_PITCH_SHIFT 16
-#define NV20TCL_RT_PITCH_ZETA_PITCH_MASK 0xffff0000
-#define NV20TCL_COLOR_OFFSET 0x00000210
-#define NV20TCL_ZETA_OFFSET 0x00000214
-#define NV20TCL_RC_IN_ALPHA(x) (0x00000260+((x)*4))
-#define NV20TCL_RC_IN_ALPHA__SIZE 0x00000008
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_SHIFT 0
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_MASK 0x0000000f
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
-#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
-#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE (1 << 4)
-#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
-#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SHIFT 5
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_MASK 0x000000e0
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_SHIFT 8
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_MASK 0x00000f00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE (1 << 12)
-#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
-#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SHIFT 13
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_MASK 0x0000e000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_SHIFT 16
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_MASK 0x000f0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
-#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
-#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE (1 << 20)
-#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
-#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SHIFT 21
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_MASK 0x00e00000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_SHIFT 24
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_MASK 0x0f000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
-#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
-#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE (1 << 28)
-#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
-#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SHIFT 29
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_MASK 0xe0000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV20TCL_RC_FINAL0 0x00000288
-#define NV20TCL_RC_FINAL0_D_INPUT_SHIFT 0
-#define NV20TCL_RC_FINAL0_D_INPUT_MASK 0x0000000f
-#define NV20TCL_RC_FINAL0_D_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV20TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV20TCL_RC_FINAL0_D_INPUT_FOG 0x00000003
-#define NV20TCL_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV20TCL_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
-#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
-#define NV20TCL_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
-#define NV20TCL_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
-#define NV20TCL_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV20TCL_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
-#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
-#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
-#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE (1 << 4)
-#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV20TCL_RC_FINAL0_D_MAPPING_SHIFT 5
-#define NV20TCL_RC_FINAL0_D_MAPPING_MASK 0x000000e0
-#define NV20TCL_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV20TCL_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV20TCL_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV20TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV20TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV20TCL_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV20TCL_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV20TCL_RC_FINAL0_C_INPUT_SHIFT 8
-#define NV20TCL_RC_FINAL0_C_INPUT_MASK 0x00000f00
-#define NV20TCL_RC_FINAL0_C_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_FINAL0_C_INPUT_FOG 0x00000300
-#define NV20TCL_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE (1 << 12)
-#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV20TCL_RC_FINAL0_C_MAPPING_SHIFT 13
-#define NV20TCL_RC_FINAL0_C_MAPPING_MASK 0x0000e000
-#define NV20TCL_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV20TCL_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV20TCL_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV20TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV20TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV20TCL_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV20TCL_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV20TCL_RC_FINAL0_B_INPUT_SHIFT 16
-#define NV20TCL_RC_FINAL0_B_INPUT_MASK 0x000f0000
-#define NV20TCL_RC_FINAL0_B_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV20TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV20TCL_RC_FINAL0_B_INPUT_FOG 0x00030000
-#define NV20TCL_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV20TCL_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
-#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
-#define NV20TCL_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
-#define NV20TCL_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
-#define NV20TCL_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV20TCL_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
-#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
-#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
-#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE (1 << 20)
-#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV20TCL_RC_FINAL0_B_MAPPING_SHIFT 21
-#define NV20TCL_RC_FINAL0_B_MAPPING_MASK 0x00e00000
-#define NV20TCL_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV20TCL_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV20TCL_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV20TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV20TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV20TCL_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV20TCL_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV20TCL_RC_FINAL0_A_INPUT_SHIFT 24
-#define NV20TCL_RC_FINAL0_A_INPUT_MASK 0x0f000000
-#define NV20TCL_RC_FINAL0_A_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV20TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV20TCL_RC_FINAL0_A_INPUT_FOG 0x03000000
-#define NV20TCL_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV20TCL_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
-#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
-#define NV20TCL_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
-#define NV20TCL_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
-#define NV20TCL_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV20TCL_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
-#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
-#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
-#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE (1 << 28)
-#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_SHIFT 29
-#define NV20TCL_RC_FINAL0_A_MAPPING_MASK 0xe0000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV20TCL_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV20TCL_RC_FINAL1 0x0000028c
-#define NV20TCL_RC_FINAL1_COLOR_SUM_CLAMP (1 << 7)
-#define NV20TCL_RC_FINAL1_G_INPUT_SHIFT 8
-#define NV20TCL_RC_FINAL1_G_INPUT_MASK 0x00000f00
-#define NV20TCL_RC_FINAL1_G_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_FINAL1_G_INPUT_FOG 0x00000300
-#define NV20TCL_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE (1 << 12)
-#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV20TCL_RC_FINAL1_G_MAPPING_SHIFT 13
-#define NV20TCL_RC_FINAL1_G_MAPPING_MASK 0x0000e000
-#define NV20TCL_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV20TCL_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV20TCL_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV20TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV20TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV20TCL_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV20TCL_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV20TCL_RC_FINAL1_F_INPUT_SHIFT 16
-#define NV20TCL_RC_FINAL1_F_INPUT_MASK 0x000f0000
-#define NV20TCL_RC_FINAL1_F_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV20TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV20TCL_RC_FINAL1_F_INPUT_FOG 0x00030000
-#define NV20TCL_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
-#define NV20TCL_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
-#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
-#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
-#define NV20TCL_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
-#define NV20TCL_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
-#define NV20TCL_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV20TCL_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
-#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
-#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
-#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE (1 << 20)
-#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV20TCL_RC_FINAL1_F_MAPPING_SHIFT 21
-#define NV20TCL_RC_FINAL1_F_MAPPING_MASK 0x00e00000
-#define NV20TCL_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV20TCL_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV20TCL_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV20TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV20TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV20TCL_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV20TCL_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV20TCL_RC_FINAL1_E_INPUT_SHIFT 24
-#define NV20TCL_RC_FINAL1_E_INPUT_MASK 0x0f000000
-#define NV20TCL_RC_FINAL1_E_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV20TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV20TCL_RC_FINAL1_E_INPUT_FOG 0x03000000
-#define NV20TCL_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
-#define NV20TCL_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
-#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
-#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
-#define NV20TCL_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
-#define NV20TCL_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
-#define NV20TCL_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV20TCL_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
-#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
-#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
-#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE (1 << 28)
-#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_SHIFT 29
-#define NV20TCL_RC_FINAL1_E_MAPPING_MASK 0xe0000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV20TCL_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV20TCL_LIGHT_MODEL 0x00000294
-#define NV20TCL_LIGHT_MODEL_VIEWER_SHIFT 16
-#define NV20TCL_LIGHT_MODEL_VIEWER_MASK 0x00030000
-#define NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL 0x00020000
-#define NV20TCL_LIGHT_MODEL_VIEWER_LOCAL 0x00030000
-#define NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR (1 << 0)
-#define NV20TCL_COLOR_MATERIAL 0x00000298
-#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_SHIFT 0
-#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_MASK 0x00000003
-#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_COL1 0x00000001
-#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_COL2 0x00000002
-#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_SHIFT 2
-#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_MASK 0x0000000c
-#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_COL1 0x00000004
-#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_COL2 0x00000008
-#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_SHIFT 4
-#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_MASK 0x00000030
-#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_COL1 0x00000010
-#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_COL2 0x00000020
-#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_SHIFT 6
-#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_MASK 0x000000c0
-#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_COL1 0x00000040
-#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_COL2 0x00000080
-#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_SHIFT 8
-#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_MASK 0x00000300
-#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_COL1 0x00000100
-#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_COL2 0x00000200
-#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_SHIFT 10
-#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_MASK 0x00000c00
-#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_COL1 0x00000400
-#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_COL2 0x00000800
-#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_SHIFT 12
-#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_MASK 0x00003000
-#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_COL1 0x00001000
-#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_COL2 0x00002000
-#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_SHIFT 14
-#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_MASK 0x0000c000
-#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_OFF 0x00000000
-#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_COL1 0x00004000
-#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_COL2 0x00008000
-#define NV20TCL_FOG_MODE 0x0000029c
-#define NV20TCL_FOG_MODE_LINEAR_UNSIGNED 0x00000804
-#define NV20TCL_FOG_MODE_LINEAR_SIGNED 0x00002601
-#define NV20TCL_FOG_MODE_EXP_UNSIGNED 0x00000802
-#define NV20TCL_FOG_MODE_EXP_SIGNED 0x00000800
-#define NV20TCL_FOG_MODE_EXP2_UNSIGNED 0x00000803
-#define NV20TCL_FOG_MODE_EXP2_SIGNED 0x00000801
-#define NV20TCL_FOG_COORD 0x000002a0
-#define NV20TCL_FOG_COORD_DIST_RADIAL 0x00000001
-#define NV20TCL_FOG_COORD_DIST_ORTHOGONAL 0x00000002
-#define NV20TCL_FOG_COORD_DIST_ORTHOGONAL_ABS 0x00000003
-#define NV20TCL_FOG_COORD_FOG 0x00000006
-#define NV20TCL_FOG_ENABLE 0x000002a4
-#define NV20TCL_FOG_COLOR 0x000002a8
-#define NV20TCL_FOG_COLOR_R_SHIFT 0
-#define NV20TCL_FOG_COLOR_R_MASK 0x000000ff
-#define NV20TCL_FOG_COLOR_G_SHIFT 8
-#define NV20TCL_FOG_COLOR_G_MASK 0x0000ff00
-#define NV20TCL_FOG_COLOR_B_SHIFT 16
-#define NV20TCL_FOG_COLOR_B_MASK 0x00ff0000
-#define NV20TCL_FOG_COLOR_A_SHIFT 24
-#define NV20TCL_FOG_COLOR_A_MASK 0xff000000
-#define NV20TCL_VIEWPORT_CLIP_MODE 0x000002b4
-#define NV20TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*4))
-#define NV20TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NV20TCL_VIEWPORT_CLIP_VERT(x) (0x000002e0+((x)*4))
-#define NV20TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NV20TCL_ALPHA_FUNC_ENABLE 0x00000300
-#define NV20TCL_BLEND_FUNC_ENABLE 0x00000304
-#define NV20TCL_CULL_FACE_ENABLE 0x00000308
-#define NV20TCL_DEPTH_TEST_ENABLE 0x0000030c
-#define NV20TCL_DITHER_ENABLE 0x00000310
-#define NV20TCL_LIGHTING_ENABLE 0x00000314
-#define NV20TCL_POINT_PARAMETERS_ENABLE 0x00000318
-#define NV20TCL_POINT_SMOOTH_ENABLE 0x0000031c
-#define NV20TCL_LINE_SMOOTH_ENABLE 0x00000320
-#define NV20TCL_POLYGON_SMOOTH_ENABLE 0x00000324
-#define NV20TCL_STENCIL_ENABLE 0x0000032c
-#define NV20TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000330
-#define NV20TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000334
-#define NV20TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000338
-#define NV20TCL_ALPHA_FUNC_FUNC 0x0000033c
-#define NV20TCL_ALPHA_FUNC_FUNC_NEVER 0x00000200
-#define NV20TCL_ALPHA_FUNC_FUNC_LESS 0x00000201
-#define NV20TCL_ALPHA_FUNC_FUNC_EQUAL 0x00000202
-#define NV20TCL_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
-#define NV20TCL_ALPHA_FUNC_FUNC_GREATER 0x00000204
-#define NV20TCL_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV20TCL_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
-#define NV20TCL_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
-#define NV20TCL_ALPHA_FUNC_REF 0x00000340
-#define NV20TCL_BLEND_FUNC_SRC 0x00000344
-#define NV20TCL_BLEND_FUNC_SRC_ZERO 0x00000000
-#define NV20TCL_BLEND_FUNC_SRC_ONE 0x00000001
-#define NV20TCL_BLEND_FUNC_SRC_SRC_COLOR 0x00000300
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV20TCL_BLEND_FUNC_SRC_SRC_ALPHA 0x00000302
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV20TCL_BLEND_FUNC_SRC_DST_ALPHA 0x00000304
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV20TCL_BLEND_FUNC_SRC_DST_COLOR 0x00000306
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_COLOR 0x00000307
-#define NV20TCL_BLEND_FUNC_SRC_SRC_ALPHA_SATURATE 0x00000308
-#define NV20TCL_BLEND_FUNC_SRC_CONSTANT_COLOR 0x00008001
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV20TCL_BLEND_FUNC_SRC_CONSTANT_ALPHA 0x00008003
-#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV20TCL_BLEND_FUNC_DST 0x00000348
-#define NV20TCL_BLEND_FUNC_DST_ZERO 0x00000000
-#define NV20TCL_BLEND_FUNC_DST_ONE 0x00000001
-#define NV20TCL_BLEND_FUNC_DST_SRC_COLOR 0x00000300
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV20TCL_BLEND_FUNC_DST_SRC_ALPHA 0x00000302
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV20TCL_BLEND_FUNC_DST_DST_ALPHA 0x00000304
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV20TCL_BLEND_FUNC_DST_DST_COLOR 0x00000306
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_DST_COLOR 0x00000307
-#define NV20TCL_BLEND_FUNC_DST_SRC_ALPHA_SATURATE 0x00000308
-#define NV20TCL_BLEND_FUNC_DST_CONSTANT_COLOR 0x00008001
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV20TCL_BLEND_FUNC_DST_CONSTANT_ALPHA 0x00008003
-#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV20TCL_BLEND_COLOR 0x0000034c
-#define NV20TCL_BLEND_COLOR_B_SHIFT 0
-#define NV20TCL_BLEND_COLOR_B_MASK 0x000000ff
-#define NV20TCL_BLEND_COLOR_G_SHIFT 8
-#define NV20TCL_BLEND_COLOR_G_MASK 0x0000ff00
-#define NV20TCL_BLEND_COLOR_R_SHIFT 16
-#define NV20TCL_BLEND_COLOR_R_MASK 0x00ff0000
-#define NV20TCL_BLEND_COLOR_A_SHIFT 24
-#define NV20TCL_BLEND_COLOR_A_MASK 0xff000000
-#define NV20TCL_BLEND_EQUATION 0x00000350
-#define NV20TCL_BLEND_EQUATION_FUNC_ADD 0x00008006
-#define NV20TCL_BLEND_EQUATION_MIN 0x00008007
-#define NV20TCL_BLEND_EQUATION_MAX 0x00008008
-#define NV20TCL_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
-#define NV20TCL_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV20TCL_DEPTH_FUNC 0x00000354
-#define NV20TCL_DEPTH_FUNC_NEVER 0x00000200
-#define NV20TCL_DEPTH_FUNC_LESS 0x00000201
-#define NV20TCL_DEPTH_FUNC_EQUAL 0x00000202
-#define NV20TCL_DEPTH_FUNC_LEQUAL 0x00000203
-#define NV20TCL_DEPTH_FUNC_GREATER 0x00000204
-#define NV20TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
-#define NV20TCL_DEPTH_FUNC_GEQUAL 0x00000206
-#define NV20TCL_DEPTH_FUNC_ALWAYS 0x00000207
-#define NV20TCL_COLOR_MASK 0x00000358
-#define NV20TCL_COLOR_MASK_B (1 << 0)
-#define NV20TCL_COLOR_MASK_G (1 << 8)
-#define NV20TCL_COLOR_MASK_R (1 << 16)
-#define NV20TCL_COLOR_MASK_A (1 << 24)
-#define NV20TCL_DEPTH_WRITE_ENABLE 0x0000035c
-#define NV20TCL_STENCIL_MASK 0x00000360
-#define NV20TCL_STENCIL_FUNC_FUNC 0x00000364
-#define NV20TCL_STENCIL_FUNC_FUNC_NEVER 0x00000200
-#define NV20TCL_STENCIL_FUNC_FUNC_LESS 0x00000201
-#define NV20TCL_STENCIL_FUNC_FUNC_EQUAL 0x00000202
-#define NV20TCL_STENCIL_FUNC_FUNC_LEQUAL 0x00000203
-#define NV20TCL_STENCIL_FUNC_FUNC_GREATER 0x00000204
-#define NV20TCL_STENCIL_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV20TCL_STENCIL_FUNC_FUNC_GEQUAL 0x00000206
-#define NV20TCL_STENCIL_FUNC_FUNC_ALWAYS 0x00000207
-#define NV20TCL_STENCIL_FUNC_REF 0x00000368
-#define NV20TCL_STENCIL_FUNC_MASK 0x0000036c
-#define NV20TCL_STENCIL_OP_FAIL 0x00000370
-#define NV20TCL_STENCIL_OP_FAIL_ZERO 0x00000000
-#define NV20TCL_STENCIL_OP_FAIL_INVERT 0x0000150a
-#define NV20TCL_STENCIL_OP_FAIL_KEEP 0x00001e00
-#define NV20TCL_STENCIL_OP_FAIL_REPLACE 0x00001e01
-#define NV20TCL_STENCIL_OP_FAIL_INCR 0x00001e02
-#define NV20TCL_STENCIL_OP_FAIL_DECR 0x00001e03
-#define NV20TCL_STENCIL_OP_FAIL_INCR_WRAP 0x00008507
-#define NV20TCL_STENCIL_OP_FAIL_DECR_WRAP 0x00008508
-#define NV20TCL_STENCIL_OP_ZFAIL 0x00000374
-#define NV20TCL_STENCIL_OP_ZFAIL_ZERO 0x00000000
-#define NV20TCL_STENCIL_OP_ZFAIL_INVERT 0x0000150a
-#define NV20TCL_STENCIL_OP_ZFAIL_KEEP 0x00001e00
-#define NV20TCL_STENCIL_OP_ZFAIL_REPLACE 0x00001e01
-#define NV20TCL_STENCIL_OP_ZFAIL_INCR 0x00001e02
-#define NV20TCL_STENCIL_OP_ZFAIL_DECR 0x00001e03
-#define NV20TCL_STENCIL_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV20TCL_STENCIL_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV20TCL_STENCIL_OP_ZPASS 0x00000378
-#define NV20TCL_STENCIL_OP_ZPASS_ZERO 0x00000000
-#define NV20TCL_STENCIL_OP_ZPASS_INVERT 0x0000150a
-#define NV20TCL_STENCIL_OP_ZPASS_KEEP 0x00001e00
-#define NV20TCL_STENCIL_OP_ZPASS_REPLACE 0x00001e01
-#define NV20TCL_STENCIL_OP_ZPASS_INCR 0x00001e02
-#define NV20TCL_STENCIL_OP_ZPASS_DECR 0x00001e03
-#define NV20TCL_STENCIL_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV20TCL_STENCIL_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV20TCL_SHADE_MODEL 0x0000037c
-#define NV20TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NV20TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NV20TCL_LINE_WIDTH 0x00000380
-#define NV20TCL_POLYGON_OFFSET_FACTOR 0x00000384
-#define NV20TCL_POLYGON_OFFSET_UNITS 0x00000388
-#define NV20TCL_POLYGON_MODE_FRONT 0x0000038c
-#define NV20TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NV20TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NV20TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NV20TCL_POLYGON_MODE_BACK 0x00000390
-#define NV20TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NV20TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NV20TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NV20TCL_DEPTH_RANGE_NEAR 0x00000394
-#define NV20TCL_DEPTH_RANGE_FAR 0x00000398
-#define NV20TCL_CULL_FACE 0x0000039c
-#define NV20TCL_CULL_FACE_FRONT 0x00000404
-#define NV20TCL_CULL_FACE_BACK 0x00000405
-#define NV20TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NV20TCL_FRONT_FACE 0x000003a0
-#define NV20TCL_FRONT_FACE_CW 0x00000900
-#define NV20TCL_FRONT_FACE_CCW 0x00000901
-#define NV20TCL_NORMALIZE_ENABLE 0x000003a4
-#define NV20TCL_MATERIAL_FACTOR_FRONT_R 0x000003a8
-#define NV20TCL_MATERIAL_FACTOR_FRONT_G 0x000003ac
-#define NV20TCL_MATERIAL_FACTOR_FRONT_B 0x000003b0
-#define NV20TCL_MATERIAL_FACTOR_FRONT_A 0x000003b4
-#define NV20TCL_SEPARATE_SPECULAR_ENABLE 0x000003b8
-#define NV20TCL_ENABLED_LIGHTS 0x000003bc
-#define NV20TCL_ENABLED_LIGHTS_0_SHIFT 0
-#define NV20TCL_ENABLED_LIGHTS_0_MASK 0x00000003
-#define NV20TCL_ENABLED_LIGHTS_0_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_0_NONPOSITIONAL 0x00000001
-#define NV20TCL_ENABLED_LIGHTS_0_POSITIONAL 0x00000002
-#define NV20TCL_ENABLED_LIGHTS_0_DIRECTIONAL 0x00000003
-#define NV20TCL_ENABLED_LIGHTS_1_SHIFT 2
-#define NV20TCL_ENABLED_LIGHTS_1_MASK 0x0000000c
-#define NV20TCL_ENABLED_LIGHTS_1_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_1_NONPOSITIONAL 0x00000004
-#define NV20TCL_ENABLED_LIGHTS_1_POSITIONAL 0x00000008
-#define NV20TCL_ENABLED_LIGHTS_1_DIRECTIONAL 0x0000000c
-#define NV20TCL_ENABLED_LIGHTS_2_SHIFT 4
-#define NV20TCL_ENABLED_LIGHTS_2_MASK 0x00000030
-#define NV20TCL_ENABLED_LIGHTS_2_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_2_NONPOSITIONAL 0x00000010
-#define NV20TCL_ENABLED_LIGHTS_2_POSITIONAL 0x00000020
-#define NV20TCL_ENABLED_LIGHTS_2_DIRECTIONAL 0x00000030
-#define NV20TCL_ENABLED_LIGHTS_3_SHIFT 6
-#define NV20TCL_ENABLED_LIGHTS_3_MASK 0x000000c0
-#define NV20TCL_ENABLED_LIGHTS_3_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_3_NONPOSITIONAL 0x00000040
-#define NV20TCL_ENABLED_LIGHTS_3_POSITIONAL 0x00000080
-#define NV20TCL_ENABLED_LIGHTS_3_DIRECTIONAL 0x000000c0
-#define NV20TCL_ENABLED_LIGHTS_4_SHIFT 8
-#define NV20TCL_ENABLED_LIGHTS_4_MASK 0x00000300
-#define NV20TCL_ENABLED_LIGHTS_4_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_4_NONPOSITIONAL 0x00000100
-#define NV20TCL_ENABLED_LIGHTS_4_POSITIONAL 0x00000200
-#define NV20TCL_ENABLED_LIGHTS_4_DIRECTIONAL 0x00000300
-#define NV20TCL_ENABLED_LIGHTS_5_SHIFT 10
-#define NV20TCL_ENABLED_LIGHTS_5_MASK 0x00000c00
-#define NV20TCL_ENABLED_LIGHTS_5_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_5_NONPOSITIONAL 0x00000400
-#define NV20TCL_ENABLED_LIGHTS_5_POSITIONAL 0x00000800
-#define NV20TCL_ENABLED_LIGHTS_5_DIRECTIONAL 0x00000c00
-#define NV20TCL_ENABLED_LIGHTS_6_SHIFT 12
-#define NV20TCL_ENABLED_LIGHTS_6_MASK 0x00003000
-#define NV20TCL_ENABLED_LIGHTS_6_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_6_NONPOSITIONAL 0x00001000
-#define NV20TCL_ENABLED_LIGHTS_6_POSITIONAL 0x00002000
-#define NV20TCL_ENABLED_LIGHTS_6_DIRECTIONAL 0x00003000
-#define NV20TCL_ENABLED_LIGHTS_7_SHIFT 14
-#define NV20TCL_ENABLED_LIGHTS_7_MASK 0x0000c000
-#define NV20TCL_ENABLED_LIGHTS_7_DISABLED 0x00000000
-#define NV20TCL_ENABLED_LIGHTS_7_NONPOSITIONAL 0x00004000
-#define NV20TCL_ENABLED_LIGHTS_7_POSITIONAL 0x00008000
-#define NV20TCL_ENABLED_LIGHTS_7_DIRECTIONAL 0x0000c000
-#define NV20TCL_TX_GEN_MODE_S(x) (0x000003c0+((x)*16))
-#define NV20TCL_TX_GEN_MODE_S__SIZE 0x00000004
-#define NV20TCL_TX_GEN_MODE_S_FALSE 0x00000000
-#define NV20TCL_TX_GEN_MODE_S_EYE_LINEAR 0x00002400
-#define NV20TCL_TX_GEN_MODE_S_OBJECT_LINEAR 0x00002401
-#define NV20TCL_TX_GEN_MODE_S_SPHERE_MAP 0x00002402
-#define NV20TCL_TX_GEN_MODE_S_NORMAL_MAP 0x00008511
-#define NV20TCL_TX_GEN_MODE_S_REFLECTION_MAP 0x00008512
-#define NV20TCL_TX_GEN_MODE_T(x) (0x000003c4+((x)*16))
-#define NV20TCL_TX_GEN_MODE_T__SIZE 0x00000004
-#define NV20TCL_TX_GEN_MODE_T_FALSE 0x00000000
-#define NV20TCL_TX_GEN_MODE_T_EYE_LINEAR 0x00002400
-#define NV20TCL_TX_GEN_MODE_T_OBJECT_LINEAR 0x00002401
-#define NV20TCL_TX_GEN_MODE_T_SPHERE_MAP 0x00002402
-#define NV20TCL_TX_GEN_MODE_T_NORMAL_MAP 0x00008511
-#define NV20TCL_TX_GEN_MODE_T_REFLECTION_MAP 0x00008512
-#define NV20TCL_TX_GEN_MODE_R(x) (0x000003c8+((x)*16))
-#define NV20TCL_TX_GEN_MODE_R__SIZE 0x00000004
-#define NV20TCL_TX_GEN_MODE_R_FALSE 0x00000000
-#define NV20TCL_TX_GEN_MODE_R_EYE_LINEAR 0x00002400
-#define NV20TCL_TX_GEN_MODE_R_OBJECT_LINEAR 0x00002401
-#define NV20TCL_TX_GEN_MODE_R_SPHERE_MAP 0x00002402
-#define NV20TCL_TX_GEN_MODE_R_NORMAL_MAP 0x00008511
-#define NV20TCL_TX_GEN_MODE_R_REFLECTION_MAP 0x00008512
-#define NV20TCL_TX_GEN_MODE_Q(x) (0x000003cc+((x)*16))
-#define NV20TCL_TX_GEN_MODE_Q__SIZE 0x00000004
-#define NV20TCL_TX_GEN_MODE_Q_FALSE 0x00000000
-#define NV20TCL_TX_GEN_MODE_Q_EYE_LINEAR 0x00002400
-#define NV20TCL_TX_GEN_MODE_Q_OBJECT_LINEAR 0x00002401
-#define NV20TCL_TX_GEN_MODE_Q_SPHERE_MAP 0x00002402
-#define NV20TCL_TX_GEN_MODE_Q_NORMAL_MAP 0x00008511
-#define NV20TCL_TX_GEN_MODE_Q_REFLECTION_MAP 0x00008512
-#define NV20TCL_TX_MATRIX_ENABLE(x) (0x00000420+((x)*4))
-#define NV20TCL_TX_MATRIX_ENABLE__SIZE 0x00000004
-#define NV20TCL_POINT_SIZE 0x0000043c
-#define NV20TCL_MODELVIEW0_MATRIX(x) (0x00000480+((x)*4))
-#define NV20TCL_MODELVIEW0_MATRIX__SIZE 0x00000010
-#define NV20TCL_MODELVIEW1_MATRIX(x) (0x000004c0+((x)*4))
-#define NV20TCL_MODELVIEW1_MATRIX__SIZE 0x00000010
-#define NV20TCL_MODELVIEW2_MATRIX(x) (0x00000500+((x)*4))
-#define NV20TCL_MODELVIEW2_MATRIX__SIZE 0x00000010
-#define NV20TCL_MODELVIEW3_MATRIX(x) (0x00000540+((x)*4))
-#define NV20TCL_MODELVIEW3_MATRIX__SIZE 0x00000010
-#define NV20TCL_INVERSE_MODELVIEW0_MATRIX(x) (0x00000580+((x)*4))
-#define NV20TCL_INVERSE_MODELVIEW0_MATRIX__SIZE 0x00000010
-#define NV20TCL_INVERSE_MODELVIEW1_MATRIX(x) (0x000005c0+((x)*4))
-#define NV20TCL_INVERSE_MODELVIEW1_MATRIX__SIZE 0x00000010
-#define NV20TCL_INVERSE_MODELVIEW2_MATRIX(x) (0x00000600+((x)*4))
-#define NV20TCL_INVERSE_MODELVIEW2_MATRIX__SIZE 0x00000010
-#define NV20TCL_INVERSE_MODELVIEW3_MATRIX(x) (0x00000640+((x)*4))
-#define NV20TCL_INVERSE_MODELVIEW3_MATRIX__SIZE 0x00000010
-#define NV20TCL_PROJECTION_MATRIX(x) (0x00000680+((x)*4))
-#define NV20TCL_PROJECTION_MATRIX__SIZE 0x00000010
-#define NV20TCL_TX0_MATRIX(x) (0x000006c0+((x)*4))
-#define NV20TCL_TX0_MATRIX__SIZE 0x00000010
-#define NV20TCL_TX1_MATRIX(x) (0x00000700+((x)*4))
-#define NV20TCL_TX1_MATRIX__SIZE 0x00000010
-#define NV20TCL_TX2_MATRIX(x) (0x00000740+((x)*4))
-#define NV20TCL_TX2_MATRIX__SIZE 0x00000010
-#define NV20TCL_TX3_MATRIX(x) (0x00000780+((x)*4))
-#define NV20TCL_TX3_MATRIX__SIZE 0x00000010
-#define NV20TCL_TX_GEN_COEFF_S_A(x) (0x00000840+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_S_A__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_S_B(x) (0x00000844+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_S_B__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_S_C(x) (0x00000848+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_S_C__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_S_D(x) (0x0000084c+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_S_D__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_T_A(x) (0x00000850+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_T_A__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_T_B(x) (0x00000854+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_T_B__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_T_C(x) (0x00000858+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_T_C__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_T_D(x) (0x0000085c+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_T_D__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_R_A(x) (0x00000860+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_R_A__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_R_B(x) (0x00000864+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_R_B__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_R_C(x) (0x00000868+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_R_C__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_R_D(x) (0x0000086c+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_R_D__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_Q_A(x) (0x00000870+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_Q_A__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_Q_B(x) (0x00000874+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_Q_B__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_Q_C(x) (0x00000878+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_Q_C__SIZE 0x00000004
-#define NV20TCL_TX_GEN_COEFF_Q_D(x) (0x0000087c+((x)*64))
-#define NV20TCL_TX_GEN_COEFF_Q_D__SIZE 0x00000004
-#define NV20TCL_FOG_EQUATION_CONSTANT 0x000009c0
-#define NV20TCL_FOG_EQUATION_LINEAR 0x000009c4
-#define NV20TCL_FOG_EQUATION_QUADRATIC 0x000009c8
-#define NV20TCL_FRONT_MATERIAL_SHININESS(x) (0x000009e0+((x)*4))
-#define NV20TCL_FRONT_MATERIAL_SHININESS__SIZE 0x00000006
-#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R 0x00000a10
-#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_G 0x00000a14
-#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_B 0x00000a18
-#define NV20TCL_VIEWPORT_TRANSLATE_X 0x00000a20
-#define NV20TCL_VIEWPORT_TRANSLATE_Y 0x00000a24
-#define NV20TCL_VIEWPORT_TRANSLATE_Z 0x00000a28
-#define NV20TCL_VIEWPORT_TRANSLATE_W 0x00000a2c
-#define NV20TCL_POINT_PARAMETER(x) (0x00000a30+((x)*4))
-#define NV20TCL_POINT_PARAMETER__SIZE 0x00000008
-#define NV20TCL_RC_CONSTANT_COLOR0(x) (0x00000a60+((x)*4))
-#define NV20TCL_RC_CONSTANT_COLOR0__SIZE 0x00000008
-#define NV20TCL_RC_CONSTANT_COLOR0_B_SHIFT 0
-#define NV20TCL_RC_CONSTANT_COLOR0_B_MASK 0x000000ff
-#define NV20TCL_RC_CONSTANT_COLOR0_G_SHIFT 8
-#define NV20TCL_RC_CONSTANT_COLOR0_G_MASK 0x0000ff00
-#define NV20TCL_RC_CONSTANT_COLOR0_R_SHIFT 16
-#define NV20TCL_RC_CONSTANT_COLOR0_R_MASK 0x00ff0000
-#define NV20TCL_RC_CONSTANT_COLOR0_A_SHIFT 24
-#define NV20TCL_RC_CONSTANT_COLOR0_A_MASK 0xff000000
-#define NV20TCL_RC_CONSTANT_COLOR1(x) (0x00000a80+((x)*4))
-#define NV20TCL_RC_CONSTANT_COLOR1__SIZE 0x00000008
-#define NV20TCL_RC_CONSTANT_COLOR1_B_SHIFT 0
-#define NV20TCL_RC_CONSTANT_COLOR1_B_MASK 0x000000ff
-#define NV20TCL_RC_CONSTANT_COLOR1_G_SHIFT 8
-#define NV20TCL_RC_CONSTANT_COLOR1_G_MASK 0x0000ff00
-#define NV20TCL_RC_CONSTANT_COLOR1_R_SHIFT 16
-#define NV20TCL_RC_CONSTANT_COLOR1_R_MASK 0x00ff0000
-#define NV20TCL_RC_CONSTANT_COLOR1_A_SHIFT 24
-#define NV20TCL_RC_CONSTANT_COLOR1_A_MASK 0xff000000
-#define NV20TCL_RC_OUT_ALPHA(x) (0x00000aa0+((x)*4))
-#define NV20TCL_RC_OUT_ALPHA__SIZE 0x00000008
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SHIFT 0
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_MASK 0x0000000f
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SHIFT 4
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_MASK 0x000000f0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SHIFT 8
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_MASK 0x00000f00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_OUT_ALPHA_CD_DOT_PRODUCT (1 << 12)
-#define NV20TCL_RC_OUT_ALPHA_AB_DOT_PRODUCT (1 << 13)
-#define NV20TCL_RC_OUT_ALPHA_MUX_SUM (1 << 14)
-#define NV20TCL_RC_OUT_ALPHA_BIAS (1 << 15)
-#define NV20TCL_RC_OUT_ALPHA_BIAS_NONE 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 17
-#define NV20TCL_RC_OUT_ALPHA_SCALE_MASK 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_SCALE_NONE 0x00000000
-#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00020000
-#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV20TCL_RC_IN_RGB(x) (0x00000ac0+((x)*4))
-#define NV20TCL_RC_IN_RGB__SIZE 0x00000008
-#define NV20TCL_RC_IN_RGB_D_INPUT_SHIFT 0
-#define NV20TCL_RC_IN_RGB_D_INPUT_MASK 0x0000000f
-#define NV20TCL_RC_IN_RGB_D_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV20TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV20TCL_RC_IN_RGB_D_INPUT_FOG 0x00000003
-#define NV20TCL_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV20TCL_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
-#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
-#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
-#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
-#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV20TCL_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
-#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
-#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
-#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE (1 << 4)
-#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV20TCL_RC_IN_RGB_D_MAPPING_SHIFT 5
-#define NV20TCL_RC_IN_RGB_D_MAPPING_MASK 0x000000e0
-#define NV20TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV20TCL_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV20TCL_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV20TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV20TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV20TCL_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV20TCL_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV20TCL_RC_IN_RGB_C_INPUT_SHIFT 8
-#define NV20TCL_RC_IN_RGB_C_INPUT_MASK 0x00000f00
-#define NV20TCL_RC_IN_RGB_C_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_IN_RGB_C_INPUT_FOG 0x00000300
-#define NV20TCL_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE (1 << 12)
-#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_SHIFT 13
-#define NV20TCL_RC_IN_RGB_C_MAPPING_MASK 0x0000e000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV20TCL_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV20TCL_RC_IN_RGB_B_INPUT_SHIFT 16
-#define NV20TCL_RC_IN_RGB_B_INPUT_MASK 0x000f0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV20TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV20TCL_RC_IN_RGB_B_INPUT_FOG 0x00030000
-#define NV20TCL_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV20TCL_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
-#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
-#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
-#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
-#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE (1 << 20)
-#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_SHIFT 21
-#define NV20TCL_RC_IN_RGB_B_MAPPING_MASK 0x00e00000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV20TCL_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV20TCL_RC_IN_RGB_A_INPUT_SHIFT 24
-#define NV20TCL_RC_IN_RGB_A_INPUT_MASK 0x0f000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_ZERO 0x00000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_FOG 0x03000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
-#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
-#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE (1 << 28)
-#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_SHIFT 29
-#define NV20TCL_RC_IN_RGB_A_MAPPING_MASK 0xe0000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV20TCL_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV20TCL_VIEWPORT_SCALE_X 0x00000af0
-#define NV20TCL_VIEWPORT_SCALE_Y 0x00000af4
-#define NV20TCL_VIEWPORT_SCALE_Z 0x00000af8
-#define NV20TCL_VIEWPORT_SCALE_W 0x00000afc
-#define NV20TCL_VP_UPLOAD_INST(x) (0x00000b00+((x)*4))
-#define NV20TCL_VP_UPLOAD_INST__SIZE 0x00000004
-#define NV20TCL_VP_UPLOAD_CONST(x) (0x00000b80+((x)*4))
-#define NV20TCL_VP_UPLOAD_CONST__SIZE 0x00000004
-#define NV20TCL_LIGHT_BACK_AMBIENT_R(x) (0x00000c00+((x)*64))
-#define NV20TCL_LIGHT_BACK_AMBIENT_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_AMBIENT_G(x) (0x00000c04+((x)*64))
-#define NV20TCL_LIGHT_BACK_AMBIENT_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_AMBIENT_B(x) (0x00000c08+((x)*64))
-#define NV20TCL_LIGHT_BACK_AMBIENT_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_DIFFUSE_R(x) (0x00000c0c+((x)*64))
-#define NV20TCL_LIGHT_BACK_DIFFUSE_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_DIFFUSE_G(x) (0x00000c10+((x)*64))
-#define NV20TCL_LIGHT_BACK_DIFFUSE_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_DIFFUSE_B(x) (0x00000c14+((x)*64))
-#define NV20TCL_LIGHT_BACK_DIFFUSE_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_SPECULAR_R(x) (0x00000c18+((x)*64))
-#define NV20TCL_LIGHT_BACK_SPECULAR_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_SPECULAR_G(x) (0x00000c1c+((x)*64))
-#define NV20TCL_LIGHT_BACK_SPECULAR_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_BACK_SPECULAR_B(x) (0x00000c20+((x)*64))
-#define NV20TCL_LIGHT_BACK_SPECULAR_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_AMBIENT_R(x) (0x00001000+((x)*128))
-#define NV20TCL_LIGHT_FRONT_AMBIENT_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_AMBIENT_G(x) (0x00001004+((x)*128))
-#define NV20TCL_LIGHT_FRONT_AMBIENT_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_AMBIENT_B(x) (0x00001008+((x)*128))
-#define NV20TCL_LIGHT_FRONT_AMBIENT_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_R(x) (0x0000100c+((x)*128))
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_G(x) (0x00001010+((x)*128))
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_B(x) (0x00001014+((x)*128))
-#define NV20TCL_LIGHT_FRONT_DIFFUSE_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_SPECULAR_R(x) (0x00001018+((x)*128))
-#define NV20TCL_LIGHT_FRONT_SPECULAR_R__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_SPECULAR_G(x) (0x0000101c+((x)*128))
-#define NV20TCL_LIGHT_FRONT_SPECULAR_G__SIZE 0x00000008
-#define NV20TCL_LIGHT_FRONT_SPECULAR_B(x) (0x00001020+((x)*128))
-#define NV20TCL_LIGHT_FRONT_SPECULAR_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_HALF_VECTOR_X(x) (0x00001028+((x)*128))
-#define NV20TCL_LIGHT_HALF_VECTOR_X__SIZE 0x00000008
-#define NV20TCL_LIGHT_HALF_VECTOR_Y(x) (0x0000102c+((x)*128))
-#define NV20TCL_LIGHT_HALF_VECTOR_Y__SIZE 0x00000008
-#define NV20TCL_LIGHT_HALF_VECTOR_Z(x) (0x00001030+((x)*128))
-#define NV20TCL_LIGHT_HALF_VECTOR_Z__SIZE 0x00000008
-#define NV20TCL_LIGHT_DIRECTION_X(x) (0x00001034+((x)*128))
-#define NV20TCL_LIGHT_DIRECTION_X__SIZE 0x00000008
-#define NV20TCL_LIGHT_DIRECTION_Y(x) (0x00001038+((x)*128))
-#define NV20TCL_LIGHT_DIRECTION_Y__SIZE 0x00000008
-#define NV20TCL_LIGHT_DIRECTION_Z(x) (0x0000103c+((x)*128))
-#define NV20TCL_LIGHT_DIRECTION_Z__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_CUTOFF_A(x) (0x00001040+((x)*128))
-#define NV20TCL_LIGHT_SPOT_CUTOFF_A__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_CUTOFF_B(x) (0x00001044+((x)*128))
-#define NV20TCL_LIGHT_SPOT_CUTOFF_B__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_CUTOFF_C(x) (0x00001048+((x)*128))
-#define NV20TCL_LIGHT_SPOT_CUTOFF_C__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_DIR_X(x) (0x0000104c+((x)*128))
-#define NV20TCL_LIGHT_SPOT_DIR_X__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_DIR_Y(x) (0x00001050+((x)*128))
-#define NV20TCL_LIGHT_SPOT_DIR_Y__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_DIR_Z(x) (0x00001054+((x)*128))
-#define NV20TCL_LIGHT_SPOT_DIR_Z__SIZE 0x00000008
-#define NV20TCL_LIGHT_SPOT_CUTOFF_D(x) (0x00001058+((x)*128))
-#define NV20TCL_LIGHT_SPOT_CUTOFF_D__SIZE 0x00000008
-#define NV20TCL_LIGHT_POSITION_X(x) (0x0000105c+((x)*128))
-#define NV20TCL_LIGHT_POSITION_X__SIZE 0x00000008
-#define NV20TCL_LIGHT_POSITION_Y(x) (0x00001060+((x)*128))
-#define NV20TCL_LIGHT_POSITION_Y__SIZE 0x00000008
-#define NV20TCL_LIGHT_POSITION_Z(x) (0x00001064+((x)*128))
-#define NV20TCL_LIGHT_POSITION_Z__SIZE 0x00000008
-#define NV20TCL_LIGHT_ATTENUATION_CONSTANT(x) (0x00001068+((x)*128))
-#define NV20TCL_LIGHT_ATTENUATION_CONSTANT__SIZE 0x00000008
-#define NV20TCL_LIGHT_ATTENUATION_LINEAR(x) (0x0000106c+((x)*128))
-#define NV20TCL_LIGHT_ATTENUATION_LINEAR__SIZE 0x00000008
-#define NV20TCL_LIGHT_ATTENUATION_QUADRATIC(x) (0x00001070+((x)*128))
-#define NV20TCL_LIGHT_ATTENUATION_QUADRATIC__SIZE 0x00000008
-#define NV20TCL_POLYGON_STIPPLE_ENABLE 0x0000147c
-#define NV20TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001480+((x)*4))
-#define NV20TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NV20TCL_VERTEX_POS_3F_X 0x00001500
-#define NV20TCL_VERTEX_POS_3F_Y 0x00001504
-#define NV20TCL_VERTEX_POS_3F_Z 0x00001508
-#define NV20TCL_VERTEX_POS_4F_X 0x00001518
-#define NV20TCL_VERTEX_POS_4F_Y 0x0000151c
-#define NV20TCL_VERTEX_POS_4F_Z 0x00001520
-#define NV20TCL_VERTEX_POS_3I_XY 0x00001528
-#define NV20TCL_VERTEX_POS_3I_XY_X_SHIFT 0
-#define NV20TCL_VERTEX_POS_3I_XY_X_MASK 0x0000ffff
-#define NV20TCL_VERTEX_POS_3I_XY_Y_SHIFT 16
-#define NV20TCL_VERTEX_POS_3I_XY_Y_MASK 0xffff0000
-#define NV20TCL_VERTEX_POS_3I_Z 0x0000152c
-#define NV20TCL_VERTEX_POS_3I_Z_Z_SHIFT 0
-#define NV20TCL_VERTEX_POS_3I_Z_Z_MASK 0x0000ffff
-#define NV20TCL_VERTEX_NOR_3F_X 0x00001530
-#define NV20TCL_VERTEX_NOR_3F_Y 0x00001534
-#define NV20TCL_VERTEX_NOR_3F_Z 0x00001538
-#define NV20TCL_VERTEX_NOR_3I_XY 0x00001540
-#define NV20TCL_VERTEX_NOR_3I_XY_X_SHIFT 0
-#define NV20TCL_VERTEX_NOR_3I_XY_X_MASK 0x0000ffff
-#define NV20TCL_VERTEX_NOR_3I_XY_Y_SHIFT 16
-#define NV20TCL_VERTEX_NOR_3I_XY_Y_MASK 0xffff0000
-#define NV20TCL_VERTEX_NOR_3I_Z 0x00001544
-#define NV20TCL_VERTEX_NOR_3I_Z_Z_SHIFT 0
-#define NV20TCL_VERTEX_NOR_3I_Z_Z_MASK 0x0000ffff
-#define NV20TCL_VERTEX_COL_4F_X 0x00001550
-#define NV20TCL_VERTEX_COL_4F_Y 0x00001554
-#define NV20TCL_VERTEX_COL_4F_Z 0x00001558
-#define NV20TCL_VERTEX_COL_4F_W 0x0000155c
-#define NV20TCL_VERTEX_COL_3F_X 0x00001560
-#define NV20TCL_VERTEX_COL_3F_Y 0x00001564
-#define NV20TCL_VERTEX_COL_3F_Z 0x00001568
-#define NV20TCL_VERTEX_COL_4I 0x0000156c
-#define NV20TCL_VERTEX_COL_4I_R_SHIFT 0
-#define NV20TCL_VERTEX_COL_4I_R_MASK 0x000000ff
-#define NV20TCL_VERTEX_COL_4I_G_SHIFT 8
-#define NV20TCL_VERTEX_COL_4I_G_MASK 0x0000ff00
-#define NV20TCL_VERTEX_COL_4I_B_SHIFT 16
-#define NV20TCL_VERTEX_COL_4I_B_MASK 0x00ff0000
-#define NV20TCL_VERTEX_COL_4I_A_SHIFT 24
-#define NV20TCL_VERTEX_COL_4I_A_MASK 0xff000000
-#define NV20TCL_VERTEX_COL2_3F_X 0x00001580
-#define NV20TCL_VERTEX_COL2_3F_Y 0x00001584
-#define NV20TCL_VERTEX_COL2_3F_Z 0x00001588
-#define NV20TCL_VERTEX_COL2_4I 0x0000158c
-#define NV20TCL_VERTEX_COL2_4I_R_SHIFT 0
-#define NV20TCL_VERTEX_COL2_4I_R_MASK 0x000000ff
-#define NV20TCL_VERTEX_COL2_4I_G_SHIFT 8
-#define NV20TCL_VERTEX_COL2_4I_G_MASK 0x0000ff00
-#define NV20TCL_VERTEX_COL2_4I_B_SHIFT 16
-#define NV20TCL_VERTEX_COL2_4I_B_MASK 0x00ff0000
-#define NV20TCL_VERTEX_COL2_4I_A_SHIFT 24
-#define NV20TCL_VERTEX_COL2_4I_A_MASK 0xff000000
-#define NV20TCL_VERTEX_TX0_2F_S 0x00001590
-#define NV20TCL_VERTEX_TX0_2F_T 0x00001594
-#define NV20TCL_VERTEX_TX0_2I 0x00001598
-#define NV20TCL_VERTEX_TX0_2I_S_SHIFT 0
-#define NV20TCL_VERTEX_TX0_2I_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX0_2I_T_SHIFT 16
-#define NV20TCL_VERTEX_TX0_2I_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX0_4F_S 0x000015a0
-#define NV20TCL_VERTEX_TX0_4F_T 0x000015a4
-#define NV20TCL_VERTEX_TX0_4F_R 0x000015a8
-#define NV20TCL_VERTEX_TX0_4F_Q 0x000015ac
-#define NV20TCL_VERTEX_TX0_4I_ST 0x000015b0
-#define NV20TCL_VERTEX_TX0_4I_ST_S_SHIFT 0
-#define NV20TCL_VERTEX_TX0_4I_ST_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX0_4I_ST_T_SHIFT 16
-#define NV20TCL_VERTEX_TX0_4I_ST_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX0_4I_RQ 0x000015b4
-#define NV20TCL_VERTEX_TX0_4I_RQ_R_SHIFT 0
-#define NV20TCL_VERTEX_TX0_4I_RQ_R_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX0_4I_RQ_Q_SHIFT 16
-#define NV20TCL_VERTEX_TX0_4I_RQ_Q_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX1_2F_S 0x000015b8
-#define NV20TCL_VERTEX_TX1_2F_T 0x000015bc
-#define NV20TCL_VERTEX_TX1_2I 0x000015c0
-#define NV20TCL_VERTEX_TX1_2I_S_SHIFT 0
-#define NV20TCL_VERTEX_TX1_2I_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX1_2I_T_SHIFT 16
-#define NV20TCL_VERTEX_TX1_2I_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX1_4F_S 0x000015c8
-#define NV20TCL_VERTEX_TX1_4F_T 0x000015cc
-#define NV20TCL_VERTEX_TX1_4F_R 0x000015d0
-#define NV20TCL_VERTEX_TX1_4F_Q 0x000015d4
-#define NV20TCL_VERTEX_TX1_4I_ST 0x000015d8
-#define NV20TCL_VERTEX_TX1_4I_ST_S_SHIFT 0
-#define NV20TCL_VERTEX_TX1_4I_ST_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX1_4I_ST_T_SHIFT 16
-#define NV20TCL_VERTEX_TX1_4I_ST_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX1_4I_RQ 0x000015dc
-#define NV20TCL_VERTEX_TX1_4I_RQ_R_SHIFT 0
-#define NV20TCL_VERTEX_TX1_4I_RQ_R_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX1_4I_RQ_Q_SHIFT 16
-#define NV20TCL_VERTEX_TX1_4I_RQ_Q_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX2_2F_S 0x000015e0
-#define NV20TCL_VERTEX_TX2_2F_T 0x000015e4
-#define NV20TCL_VERTEX_TX2_2I 0x000015e8
-#define NV20TCL_VERTEX_TX2_2I_S_SHIFT 0
-#define NV20TCL_VERTEX_TX2_2I_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX2_2I_T_SHIFT 16
-#define NV20TCL_VERTEX_TX2_2I_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX2_4F_S 0x000015f0
-#define NV20TCL_VERTEX_TX2_4F_T 0x000015f4
-#define NV20TCL_VERTEX_TX2_4F_R 0x000015f8
-#define NV20TCL_VERTEX_TX2_4F_Q 0x000015fc
-#define NV20TCL_VERTEX_TX2_4I_ST 0x00001600
-#define NV20TCL_VERTEX_TX2_4I_ST_S_SHIFT 0
-#define NV20TCL_VERTEX_TX2_4I_ST_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX2_4I_ST_T_SHIFT 16
-#define NV20TCL_VERTEX_TX2_4I_ST_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX2_4I_RQ 0x00001604
-#define NV20TCL_VERTEX_TX2_4I_RQ_R_SHIFT 0
-#define NV20TCL_VERTEX_TX2_4I_RQ_R_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX2_4I_RQ_Q_SHIFT 16
-#define NV20TCL_VERTEX_TX2_4I_RQ_Q_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX3_2F_S 0x00001608
-#define NV20TCL_VERTEX_TX3_2F_T 0x0000160c
-#define NV20TCL_VERTEX_TX3_2I 0x00001610
-#define NV20TCL_VERTEX_TX3_2I_S_SHIFT 0
-#define NV20TCL_VERTEX_TX3_2I_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX3_2I_T_SHIFT 16
-#define NV20TCL_VERTEX_TX3_2I_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX3_4F_S 0x00001620
-#define NV20TCL_VERTEX_TX3_4F_T 0x00001624
-#define NV20TCL_VERTEX_TX3_4F_R 0x00001628
-#define NV20TCL_VERTEX_TX3_4F_Q 0x0000162c
-#define NV20TCL_VERTEX_TX3_4I_ST 0x00001630
-#define NV20TCL_VERTEX_TX3_4I_ST_S_SHIFT 0
-#define NV20TCL_VERTEX_TX3_4I_ST_S_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX3_4I_ST_T_SHIFT 16
-#define NV20TCL_VERTEX_TX3_4I_ST_T_MASK 0xffff0000
-#define NV20TCL_VERTEX_TX3_4I_RQ 0x00001634
-#define NV20TCL_VERTEX_TX3_4I_RQ_R_SHIFT 0
-#define NV20TCL_VERTEX_TX3_4I_RQ_R_MASK 0x0000ffff
-#define NV20TCL_VERTEX_TX3_4I_RQ_Q_SHIFT 16
-#define NV20TCL_VERTEX_TX3_4I_RQ_Q_MASK 0xffff0000
-#define NV20TCL_VERTEX_FOG_1F 0x00001698
-#define NV20TCL_EDGEFLAG_ENABLE 0x000016bc
-#define NV20TCL_VTX_CACHE_INVALIDATE 0x00001710
-#define NV20TCL_VTXBUF_ADDRESS(x) (0x00001720+((x)*4))
-#define NV20TCL_VTXBUF_ADDRESS__SIZE 0x00000010
-#define NV20TCL_VTXBUF_ADDRESS_DMA1 (1 << 31)
-#define NV20TCL_VTXBUF_ADDRESS_OFFSET_SHIFT 0
-#define NV20TCL_VTXBUF_ADDRESS_OFFSET_MASK 0x0fffffff
-#define NV20TCL_VTXFMT(x) (0x00001760+((x)*4))
-#define NV20TCL_VTXFMT__SIZE 0x00000010
-#define NV20TCL_VTXFMT_TYPE_SHIFT 0
-#define NV20TCL_VTXFMT_TYPE_MASK 0x0000000f
-#define NV20TCL_VTXFMT_TYPE_FLOAT 0x00000002
-#define NV20TCL_VTXFMT_TYPE_HALF 0x00000003
-#define NV20TCL_VTXFMT_TYPE_UBYTE 0x00000004
-#define NV20TCL_VTXFMT_TYPE_USHORT 0x00000005
-#define NV20TCL_VTXFMT_SIZE_SHIFT 4
-#define NV20TCL_VTXFMT_SIZE_MASK 0x000000f0
-#define NV20TCL_VTXFMT_STRIDE_SHIFT 8
-#define NV20TCL_VTXFMT_STRIDE_MASK 0x0000ff00
-#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R 0x000017a0
-#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_G 0x000017a4
-#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_B 0x000017a8
-#define NV20TCL_MATERIAL_FACTOR_BACK_A 0x000017ac
-#define NV20TCL_MATERIAL_FACTOR_BACK_R 0x000017b0
-#define NV20TCL_MATERIAL_FACTOR_BACK_G 0x000017b4
-#define NV20TCL_MATERIAL_FACTOR_BACK_B 0x000017b8
-#define NV20TCL_COLOR_LOGIC_OP_ENABLE 0x000017bc
-#define NV20TCL_COLOR_LOGIC_OP_OP 0x000017c0
-#define NV20TCL_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
-#define NV20TCL_COLOR_LOGIC_OP_OP_AND 0x00001501
-#define NV20TCL_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
-#define NV20TCL_COLOR_LOGIC_OP_OP_COPY 0x00001503
-#define NV20TCL_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
-#define NV20TCL_COLOR_LOGIC_OP_OP_NOOP 0x00001505
-#define NV20TCL_COLOR_LOGIC_OP_OP_XOR 0x00001506
-#define NV20TCL_COLOR_LOGIC_OP_OP_OR 0x00001507
-#define NV20TCL_COLOR_LOGIC_OP_OP_NOR 0x00001508
-#define NV20TCL_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
-#define NV20TCL_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
-#define NV20TCL_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
-#define NV20TCL_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
-#define NV20TCL_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
-#define NV20TCL_COLOR_LOGIC_OP_OP_NAND 0x0000150e
-#define NV20TCL_COLOR_LOGIC_OP_OP_SET 0x0000150f
-#define NV20TCL_LIGHT_MODEL_TWO_SIDE_ENABLE 0x000017c4
-#define NV20TCL_TX_SHADER_CULL_MODE 0x000017f8
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S (1 << 0)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S_LESS 0x00000001
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T (1 << 1)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T_LESS 0x00000002
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R (1 << 2)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R_LESS 0x00000004
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q (1 << 3)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q_LESS 0x00000008
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S (1 << 4)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S_LESS 0x00000010
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T (1 << 5)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T_LESS 0x00000020
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R (1 << 6)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R_LESS 0x00000040
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q (1 << 7)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q_LESS 0x00000080
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S (1 << 8)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S_LESS 0x00000100
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T (1 << 9)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T_LESS 0x00000200
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R (1 << 10)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R_LESS 0x00000400
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q (1 << 11)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q_LESS 0x00000800
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S (1 << 12)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S_LESS 0x00001000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T (1 << 13)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T_LESS 0x00002000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R (1 << 14)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R_LESS 0x00004000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q (1 << 15)
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q_GEQUAL 0x00000000
-#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q_LESS 0x00008000
-#define NV20TCL_VERTEX_BEGIN_END 0x000017fc
-#define NV20TCL_VERTEX_BEGIN_END_STOP 0x00000000
-#define NV20TCL_VERTEX_BEGIN_END_POINTS 0x00000001
-#define NV20TCL_VERTEX_BEGIN_END_LINES 0x00000002
-#define NV20TCL_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
-#define NV20TCL_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
-#define NV20TCL_VERTEX_BEGIN_END_TRIANGLES 0x00000005
-#define NV20TCL_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
-#define NV20TCL_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
-#define NV20TCL_VERTEX_BEGIN_END_QUADS 0x00000008
-#define NV20TCL_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
-#define NV20TCL_VERTEX_BEGIN_END_POLYGON 0x0000000a
-#define NV20TCL_VB_ELEMENT_U16 0x00001800
-#define NV20TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NV20TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NV20TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NV20TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NV20TCL_VB_ELEMENT_U32 0x00001808
-#define NV20TCL_VB_VERTEX_BATCH 0x00001810
-#define NV20TCL_VB_VERTEX_BATCH_OFFSET_SHIFT 0
-#define NV20TCL_VB_VERTEX_BATCH_OFFSET_MASK 0x00ffffff
-#define NV20TCL_VB_VERTEX_BATCH_COUNT_SHIFT 24
-#define NV20TCL_VB_VERTEX_BATCH_COUNT_MASK 0xff000000
-#define NV20TCL_VERTEX_DATA 0x00001818
-#define NV20TCL_TX_SHADER_CONST_EYE_X 0x0000181c
-#define NV20TCL_TX_SHADER_CONST_EYE_Y 0x00001820
-#define NV20TCL_TX_SHADER_CONST_EYE_Z 0x00001824
-#define NV20TCL_VTX_ATTR_4F_X(x) (0x00001a00+((x)*16))
-#define NV20TCL_VTX_ATTR_4F_X__SIZE 0x00000010
-#define NV20TCL_VTX_ATTR_4F_Y(x) (0x00001a04+((x)*16))
-#define NV20TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
-#define NV20TCL_VTX_ATTR_4F_Z(x) (0x00001a08+((x)*16))
-#define NV20TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
-#define NV20TCL_VTX_ATTR_4F_W(x) (0x00001a0c+((x)*16))
-#define NV20TCL_VTX_ATTR_4F_W__SIZE 0x00000010
-#define NV20TCL_TX_OFFSET(x) (0x00001b00+((x)*64))
-#define NV20TCL_TX_OFFSET__SIZE 0x00000004
-#define NV20TCL_TX_FORMAT(x) (0x00001b04+((x)*64))
-#define NV20TCL_TX_FORMAT__SIZE 0x00000004
-#define NV20TCL_TX_FORMAT_DMA0 (1 << 0)
-#define NV20TCL_TX_FORMAT_DMA1 (1 << 1)
-#define NV20TCL_TX_FORMAT_CUBIC (1 << 2)
-#define NV20TCL_TX_FORMAT_NO_BORDER (1 << 3)
-#define NV20TCL_TX_FORMAT_DIMS_SHIFT 4
-#define NV20TCL_TX_FORMAT_DIMS_MASK 0x000000f0
-#define NV20TCL_TX_FORMAT_DIMS_1D 0x00000010
-#define NV20TCL_TX_FORMAT_DIMS_2D 0x00000020
-#define NV20TCL_TX_FORMAT_DIMS_3D 0x00000030
-#define NV20TCL_TX_FORMAT_FORMAT_SHIFT 8
-#define NV20TCL_TX_FORMAT_FORMAT_MASK 0x0000ff00
-#define NV20TCL_TX_FORMAT_FORMAT_L8 0x00000000
-#define NV20TCL_TX_FORMAT_FORMAT_A8 0x00000100
-#define NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5 0x00000200
-#define NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4 0x00000400
-#define NV20TCL_TX_FORMAT_FORMAT_R5G6B5 0x00000500
-#define NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8 0x00000600
-#define NV20TCL_TX_FORMAT_FORMAT_X8R8G8B8 0x00000700
-#define NV20TCL_TX_FORMAT_FORMAT_INDEX8 0x00000b00
-#define NV20TCL_TX_FORMAT_FORMAT_DXT1 0x00000c00
-#define NV20TCL_TX_FORMAT_FORMAT_DXT3 0x00000e00
-#define NV20TCL_TX_FORMAT_FORMAT_DXT5 0x00000f00
-#define NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00001000
-#define NV20TCL_TX_FORMAT_FORMAT_R5G6B5_RECT 0x00001100
-#define NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00001200
-#define NV20TCL_TX_FORMAT_FORMAT_L8_RECT 0x00001300
-#define NV20TCL_TX_FORMAT_FORMAT_DSDT8_RECT 0x00001700
-#define NV20TCL_TX_FORMAT_FORMAT_A8L8 0x00001a00
-#define NV20TCL_TX_FORMAT_FORMAT_A8_RECT 0x00001b00
-#define NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT 0x00001d00
-#define NV20TCL_TX_FORMAT_FORMAT_R8G8B8_RECT 0x00001e00
-#define NV20TCL_TX_FORMAT_FORMAT_A8L8_RECT 0x00002000
-#define NV20TCL_TX_FORMAT_FORMAT_DSDT8 0x00002800
-#define NV20TCL_TX_FORMAT_FORMAT_HILO16 0x00003300
-#define NV20TCL_TX_FORMAT_FORMAT_HILO16_RECT 0x00003600
-#define NV20TCL_TX_FORMAT_FORMAT_HILO8 0x00004400
-#define NV20TCL_TX_FORMAT_FORMAT_SIGNED_HILO8 0x00004500
-#define NV20TCL_TX_FORMAT_FORMAT_HILO8_RECT 0x00004600
-#define NV20TCL_TX_FORMAT_FORMAT_SIGNED_HILO8_RECT 0x00004700
-#define NV20TCL_TX_FORMAT_FORMAT_A16 0x00003200
-#define NV20TCL_TX_FORMAT_FORMAT_A16_RECT 0x00003500
-#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_RGBA16_NV 0x00004a00
-#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_RGBA32_NV 0x00004b00
-#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_R32_NV 0x00004c00
-#define NV20TCL_TX_FORMAT_MIPMAP (1 << 19)
-#define NV20TCL_TX_FORMAT_BASE_SIZE_U_SHIFT 20
-#define NV20TCL_TX_FORMAT_BASE_SIZE_U_MASK 0x00f00000
-#define NV20TCL_TX_FORMAT_BASE_SIZE_V_SHIFT 24
-#define NV20TCL_TX_FORMAT_BASE_SIZE_V_MASK 0x0f000000
-#define NV20TCL_TX_FORMAT_BASE_SIZE_W_SHIFT 28
-#define NV20TCL_TX_FORMAT_BASE_SIZE_W_MASK 0xf0000000
-#define NV20TCL_TX_WRAP(x) (0x00001b08+((x)*64))
-#define NV20TCL_TX_WRAP__SIZE 0x00000004
-#define NV20TCL_TX_WRAP_S_SHIFT 0
-#define NV20TCL_TX_WRAP_S_MASK 0x000000ff
-#define NV20TCL_TX_WRAP_S_REPEAT 0x00000001
-#define NV20TCL_TX_WRAP_S_MIRRORED_REPEAT 0x00000002
-#define NV20TCL_TX_WRAP_S_CLAMP_TO_EDGE 0x00000003
-#define NV20TCL_TX_WRAP_S_CLAMP_TO_BORDER 0x00000004
-#define NV20TCL_TX_WRAP_S_CLAMP 0x00000005
-#define NV20TCL_TX_WRAP_T_SHIFT 8
-#define NV20TCL_TX_WRAP_T_MASK 0x00000f00
-#define NV20TCL_TX_WRAP_T_REPEAT 0x00000100
-#define NV20TCL_TX_WRAP_T_MIRRORED_REPEAT 0x00000200
-#define NV20TCL_TX_WRAP_T_CLAMP_TO_EDGE 0x00000300
-#define NV20TCL_TX_WRAP_T_CLAMP_TO_BORDER 0x00000400
-#define NV20TCL_TX_WRAP_T_CLAMP 0x00000500
-#define NV20TCL_TX_WRAP_R_SHIFT 16
-#define NV20TCL_TX_WRAP_R_MASK 0x000f0000
-#define NV20TCL_TX_WRAP_R_REPEAT 0x00010000
-#define NV20TCL_TX_WRAP_R_MIRRORED_REPEAT 0x00020000
-#define NV20TCL_TX_WRAP_R_CLAMP_TO_EDGE 0x00030000
-#define NV20TCL_TX_WRAP_R_CLAMP_TO_BORDER 0x00040000
-#define NV20TCL_TX_WRAP_R_CLAMP 0x00050000
-#define NV20TCL_TX_ENABLE(x) (0x00001b0c+((x)*64))
-#define NV20TCL_TX_ENABLE__SIZE 0x00000004
-#define NV20TCL_TX_ENABLE_ANISO_SHIFT 4
-#define NV20TCL_TX_ENABLE_ANISO_MASK 0x00000030
-#define NV20TCL_TX_ENABLE_ANISO_NONE 0x00000000
-#define NV20TCL_TX_ENABLE_ANISO_2X 0x00000010
-#define NV20TCL_TX_ENABLE_ANISO_4X 0x00000020
-#define NV20TCL_TX_ENABLE_ANISO_8X 0x00000030
-#define NV20TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT 14
-#define NV20TCL_TX_ENABLE_MIPMAP_MAX_LOD_MASK 0x0003c000
-#define NV20TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT 26
-#define NV20TCL_TX_ENABLE_MIPMAP_MIN_LOD_MASK 0x3c000000
-#define NV20TCL_TX_ENABLE_ENABLE (1 << 30)
-#define NV20TCL_TX_NPOT_PITCH(x) (0x00001b10+((x)*64))
-#define NV20TCL_TX_NPOT_PITCH__SIZE 0x00000004
-#define NV20TCL_TX_NPOT_PITCH_PITCH_SHIFT 16
-#define NV20TCL_TX_NPOT_PITCH_PITCH_MASK 0xffff0000
-#define NV20TCL_TX_FILTER(x) (0x00001b14+((x)*64))
-#define NV20TCL_TX_FILTER__SIZE 0x00000004
-#define NV20TCL_TX_FILTER_LOD_BIAS_SHIFT 8
-#define NV20TCL_TX_FILTER_LOD_BIAS_MASK 0x00000f00
-#define NV20TCL_TX_FILTER_MINIFY_SHIFT 16
-#define NV20TCL_TX_FILTER_MINIFY_MASK 0x000f0000
-#define NV20TCL_TX_FILTER_MINIFY_NEAREST 0x00010000
-#define NV20TCL_TX_FILTER_MINIFY_LINEAR 0x00020000
-#define NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x00030000
-#define NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x00040000
-#define NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x00050000
-#define NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x00060000
-#define NV20TCL_TX_FILTER_MAGNIFY_SHIFT 24
-#define NV20TCL_TX_FILTER_MAGNIFY_MASK 0x0f000000
-#define NV20TCL_TX_FILTER_MAGNIFY_NEAREST 0x01000000
-#define NV20TCL_TX_FILTER_MAGNIFY_LINEAR 0x02000000
-#define NV20TCL_TX_NPOT_SIZE(x) (0x00001b1c+((x)*64))
-#define NV20TCL_TX_NPOT_SIZE__SIZE 0x00000004
-#define NV20TCL_TX_NPOT_SIZE_H_SHIFT 0
-#define NV20TCL_TX_NPOT_SIZE_H_MASK 0x0000ffff
-#define NV20TCL_TX_NPOT_SIZE_W_SHIFT 16
-#define NV20TCL_TX_NPOT_SIZE_W_MASK 0xffff0000
-#define NV20TCL_TX_PALETTE_OFFSET(x) (0x00001b20+((x)*64))
-#define NV20TCL_TX_PALETTE_OFFSET__SIZE 0x00000004
-#define NV20TCL_TX_BORDER_COLOR(x) (0x00001b24+((x)*64))
-#define NV20TCL_TX_BORDER_COLOR__SIZE 0x00000004
-#define NV20TCL_TX_BORDER_COLOR_B_SHIFT 0
-#define NV20TCL_TX_BORDER_COLOR_B_MASK 0x000000ff
-#define NV20TCL_TX_BORDER_COLOR_G_SHIFT 8
-#define NV20TCL_TX_BORDER_COLOR_G_MASK 0x0000ff00
-#define NV20TCL_TX_BORDER_COLOR_R_SHIFT 16
-#define NV20TCL_TX_BORDER_COLOR_R_MASK 0x00ff0000
-#define NV20TCL_TX_BORDER_COLOR_A_SHIFT 24
-#define NV20TCL_TX_BORDER_COLOR_A_MASK 0xff000000
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX00(x) (0x00001b28+((x)*64))
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX00__SIZE 0x00000004
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX01(x) (0x00001b2c+((x)*64))
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX01__SIZE 0x00000004
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX11(x) (0x00001b30+((x)*64))
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX11__SIZE 0x00000004
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX10(x) (0x00001b34+((x)*64))
-#define NV20TCL_TX_SHADER_OFFSET_MATRIX10__SIZE 0x00000004
-#define NV20TCL_DEPTH_UNK17D8 0x00001d78
-#define NV20TCL_DEPTH_UNK17D8_CLAMP_SHIFT 4
-#define NV20TCL_DEPTH_UNK17D8_CLAMP_MASK 0x000000f0
-#define NV20TCL_MULTISAMPLE_CONTROL 0x00001d7c
-#define NV20TCL_CLEAR_DEPTH_VALUE 0x00001d8c
-#define NV20TCL_CLEAR_VALUE 0x00001d90
-#define NV20TCL_CLEAR_BUFFERS 0x00001d94
-#define NV20TCL_CLEAR_BUFFERS_COLOR_A (1 << 7)
-#define NV20TCL_CLEAR_BUFFERS_COLOR_B (1 << 6)
-#define NV20TCL_CLEAR_BUFFERS_COLOR_G (1 << 5)
-#define NV20TCL_CLEAR_BUFFERS_COLOR_R (1 << 4)
-#define NV20TCL_CLEAR_BUFFERS_STENCIL (1 << 1)
-#define NV20TCL_CLEAR_BUFFERS_DEPTH (1 << 0)
-#define NV20TCL_RC_COLOR0 0x00001e20
-#define NV20TCL_RC_COLOR0_B_SHIFT 0
-#define NV20TCL_RC_COLOR0_B_MASK 0x000000ff
-#define NV20TCL_RC_COLOR0_G_SHIFT 8
-#define NV20TCL_RC_COLOR0_G_MASK 0x0000ff00
-#define NV20TCL_RC_COLOR0_R_SHIFT 16
-#define NV20TCL_RC_COLOR0_R_MASK 0x00ff0000
-#define NV20TCL_RC_COLOR0_A_SHIFT 24
-#define NV20TCL_RC_COLOR0_A_MASK 0xff000000
-#define NV20TCL_RC_COLOR1 0x00001e24
-#define NV20TCL_RC_COLOR1_B_SHIFT 0
-#define NV20TCL_RC_COLOR1_B_MASK 0x000000ff
-#define NV20TCL_RC_COLOR1_G_SHIFT 8
-#define NV20TCL_RC_COLOR1_G_MASK 0x0000ff00
-#define NV20TCL_RC_COLOR1_R_SHIFT 16
-#define NV20TCL_RC_COLOR1_R_MASK 0x00ff0000
-#define NV20TCL_RC_COLOR1_A_SHIFT 24
-#define NV20TCL_RC_COLOR1_A_MASK 0xff000000
-#define NV20TCL_BACK_MATERIAL_SHININESS(x) (0x00001e28+((x)*4))
-#define NV20TCL_BACK_MATERIAL_SHININESS__SIZE 0x00000006
-#define NV20TCL_RC_OUT_RGB(x) (0x00001e40+((x)*4))
-#define NV20TCL_RC_OUT_RGB__SIZE 0x00000008
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT 0
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_MASK 0x0000000f
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SHIFT 4
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_MASK 0x000000f0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SHIFT 8
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_MASK 0x00000f00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV20TCL_RC_OUT_RGB_CD_DOT_PRODUCT (1 << 12)
-#define NV20TCL_RC_OUT_RGB_AB_DOT_PRODUCT (1 << 13)
-#define NV20TCL_RC_OUT_RGB_MUX_SUM (1 << 14)
-#define NV20TCL_RC_OUT_RGB_BIAS (1 << 15)
-#define NV20TCL_RC_OUT_RGB_BIAS_NONE 0x00000000
-#define NV20TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV20TCL_RC_OUT_RGB_SCALE_SHIFT 17
-#define NV20TCL_RC_OUT_RGB_SCALE_MASK 0x00000000
-#define NV20TCL_RC_OUT_RGB_SCALE_NONE 0x00000000
-#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00020000
-#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV20TCL_RC_ENABLE 0x00001e60
-#define NV20TCL_RC_ENABLE_NUM_COMBINERS_SHIFT 0
-#define NV20TCL_RC_ENABLE_NUM_COMBINERS_MASK 0x0000000f
-#define NV20TCL_TX_RCOMP 0x00001e6c
-#define NV20TCL_TX_RCOMP_NEVER 0x00000000
-#define NV20TCL_TX_RCOMP_GREATER 0x00000001
-#define NV20TCL_TX_RCOMP_EQUAL 0x00000002
-#define NV20TCL_TX_RCOMP_GEQUAL 0x00000003
-#define NV20TCL_TX_RCOMP_LESS 0x00000004
-#define NV20TCL_TX_RCOMP_NOTEQUAL 0x00000005
-#define NV20TCL_TX_RCOMP_LEQUAL 0x00000006
-#define NV20TCL_TX_RCOMP_ALWAYS 0x00000007
-#define NV20TCL_TX_SHADER_OP 0x00001e70
-#define NV20TCL_TX_SHADER_OP_TX0_SHIFT 0
-#define NV20TCL_TX_SHADER_OP_TX0_MASK 0x0000001f
-#define NV20TCL_TX_SHADER_OP_TX0_NONE 0x00000000
-#define NV20TCL_TX_SHADER_OP_TX0_TEXTURE_2D 0x00000001
-#define NV20TCL_TX_SHADER_OP_TX0_PASS_THROUGH 0x00000004
-#define NV20TCL_TX_SHADER_OP_TX0_CULL_FRAGMENT 0x00000005
-#define NV20TCL_TX_SHADER_OP_TX0_OFFSET_TEXTURE_2D 0x00000006
-#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT_TEXTURE_2D 0x00000009
-#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT_DEPTH_REPLACE 0x0000000a
-#define NV20TCL_TX_SHADER_OP_TX0_DEPENDANT_AR_TEXTURE_2D 0x0000000f
-#define NV20TCL_TX_SHADER_OP_TX0_DEPENDANT_GB_TEXTURE_2D 0x00000010
-#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT 0x00000011
-#define NV20TCL_TX_SHADER_OP_TX1_SHIFT 5
-#define NV20TCL_TX_SHADER_OP_TX1_MASK 0x000003e0
-#define NV20TCL_TX_SHADER_OP_TX1_NONE 0x00000000
-#define NV20TCL_TX_SHADER_OP_TX1_TEXTURE_2D 0x00000020
-#define NV20TCL_TX_SHADER_OP_TX1_PASS_THROUGH 0x00000080
-#define NV20TCL_TX_SHADER_OP_TX1_CULL_FRAGMENT 0x000000a0
-#define NV20TCL_TX_SHADER_OP_TX1_OFFSET_TEXTURE_2D 0x000000c0
-#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT_TEXTURE_2D 0x00000120
-#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT_DEPTH_REPLACE 0x00000140
-#define NV20TCL_TX_SHADER_OP_TX1_DEPENDANT_AR_TEXTURE_2D 0x000001e0
-#define NV20TCL_TX_SHADER_OP_TX1_DEPENDANT_GB_TEXTURE_2D 0x00000200
-#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT 0x00000220
-#define NV20TCL_TX_SHADER_OP_TX2_SHIFT 10
-#define NV20TCL_TX_SHADER_OP_TX2_MASK 0x00007c00
-#define NV20TCL_TX_SHADER_OP_TX2_NONE 0x00000000
-#define NV20TCL_TX_SHADER_OP_TX2_TEXTURE_2D 0x00000400
-#define NV20TCL_TX_SHADER_OP_TX2_PASS_THROUGH 0x00001000
-#define NV20TCL_TX_SHADER_OP_TX2_CULL_FRAGMENT 0x00001400
-#define NV20TCL_TX_SHADER_OP_TX2_OFFSET_TEXTURE_2D 0x00001800
-#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT_TEXTURE_2D 0x00002400
-#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT_DEPTH_REPLACE 0x00002800
-#define NV20TCL_TX_SHADER_OP_TX2_DEPENDANT_AR_TEXTURE_2D 0x00003c00
-#define NV20TCL_TX_SHADER_OP_TX2_DEPENDANT_GB_TEXTURE_2D 0x00004000
-#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT 0x00004400
-#define NV20TCL_TX_SHADER_OP_TX3_SHIFT 15
-#define NV20TCL_TX_SHADER_OP_TX3_MASK 0x000f8000
-#define NV20TCL_TX_SHADER_OP_TX3_NONE 0x00000000
-#define NV20TCL_TX_SHADER_OP_TX3_TEXTURE_2D 0x00008000
-#define NV20TCL_TX_SHADER_OP_TX3_PASS_THROUGH 0x00020000
-#define NV20TCL_TX_SHADER_OP_TX3_CULL_FRAGMENT 0x00028000
-#define NV20TCL_TX_SHADER_OP_TX3_OFFSET_TEXTURE_2D 0x00030000
-#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT_TEXTURE_2D 0x00048000
-#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT_DEPTH_REPLACE 0x00050000
-#define NV20TCL_TX_SHADER_OP_TX3_DEPENDANT_AR_TEXTURE_2D 0x00078000
-#define NV20TCL_TX_SHADER_OP_TX3_DEPENDANT_GB_TEXTURE_2D 0x00080000
-#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT 0x00088000
-#define NV20TCL_TX_SHADER_DOTMAPPING 0x00001e74
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX0_SHIFT 0
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX0_MASK 0x0000000f
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX1_SHIFT 4
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX1_MASK 0x000000f0
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX2_SHIFT 8
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX2_MASK 0x00000f00
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX3_SHIFT 12
-#define NV20TCL_TX_SHADER_DOTMAPPING_TX3_MASK 0x0000f000
-#define NV20TCL_TX_SHADER_PREVIOUS 0x00001e78
-#define NV20TCL_TX_SHADER_PREVIOUS_TX0_SHIFT 8
-#define NV20TCL_TX_SHADER_PREVIOUS_TX0_MASK 0x00000f00
-#define NV20TCL_TX_SHADER_PREVIOUS_TX1_SHIFT 12
-#define NV20TCL_TX_SHADER_PREVIOUS_TX1_MASK 0x0000f000
-#define NV20TCL_TX_SHADER_PREVIOUS_TX2_SHIFT 16
-#define NV20TCL_TX_SHADER_PREVIOUS_TX2_MASK 0x00030000
-#define NV20TCL_TX_SHADER_PREVIOUS_TX3_SHIFT 20
-#define NV20TCL_TX_SHADER_PREVIOUS_TX3_MASK 0x00300000
-#define NV20TCL_ENGINE 0x00001e94
-#define NV20TCL_ENGINE_VP (1 << 1)
-#define NV20TCL_ENGINE_FIXED (1 << 2)
-#define NV20TCL_VP_UPLOAD_FROM_ID 0x00001e9c
-#define NV20TCL_VP_START_FROM_ID 0x00001ea0
-#define NV20TCL_VP_UPLOAD_CONST_ID 0x00001ea4
-
-
-#define NV25TCL 0x00000597
-
-#define NV25TCL_DMA_IN_MEMORY4 0x0000019c
-#define NV25TCL_DMA_IN_MEMORY5 0x000001a0
-#define NV25TCL_DMA_IN_MEMORY8 0x000001ac
-#define NV25TCL_DMA_IN_MEMORY9 0x000001b0
-
-
-#define NV30TCL 0x00000397
-
-
-
-#define NV35TCL 0x00000497
-
-
-
-#define NV34TCL 0x00000697
-
-#define NV34TCL_NOP 0x00000100
-#define NV34TCL_NOTIFY 0x00000104
-#define NV34TCL_DMA_NOTIFY 0x00000180
-#define NV34TCL_DMA_TEXTURE0 0x00000184
-#define NV34TCL_DMA_TEXTURE1 0x00000188
-#define NV34TCL_DMA_COLOR1 0x0000018c
-#define NV34TCL_DMA_COLOR0 0x00000194
-#define NV34TCL_DMA_ZETA 0x00000198
-#define NV34TCL_DMA_VTXBUF0 0x0000019c
-#define NV34TCL_DMA_VTXBUF1 0x000001a0
-#define NV34TCL_DMA_FENCE 0x000001a4
-#define NV34TCL_DMA_QUERY 0x000001a8
-#define NV34TCL_DMA_IN_MEMORY7 0x000001ac
-#define NV34TCL_DMA_IN_MEMORY8 0x000001b0
-#define NV34TCL_RT_HORIZ 0x00000200
-#define NV34TCL_RT_HORIZ_X_SHIFT 0
-#define NV34TCL_RT_HORIZ_X_MASK 0x0000ffff
-#define NV34TCL_RT_HORIZ_W_SHIFT 16
-#define NV34TCL_RT_HORIZ_W_MASK 0xffff0000
-#define NV34TCL_RT_VERT 0x00000204
-#define NV34TCL_RT_VERT_Y_SHIFT 0
-#define NV34TCL_RT_VERT_Y_MASK 0x0000ffff
-#define NV34TCL_RT_VERT_H_SHIFT 16
-#define NV34TCL_RT_VERT_H_MASK 0xffff0000
-#define NV34TCL_RT_FORMAT 0x00000208
-#define NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT 24
-#define NV34TCL_RT_FORMAT_LOG2_HEIGHT_MASK 0xff000000
-#define NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT 16
-#define NV34TCL_RT_FORMAT_LOG2_WIDTH_MASK 0x00ff0000
-#define NV34TCL_RT_FORMAT_TYPE_SHIFT 8
-#define NV34TCL_RT_FORMAT_TYPE_MASK 0x00000f00
-#define NV34TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
-#define NV34TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
-#define NV34TCL_RT_FORMAT_ZETA_SHIFT 5
-#define NV34TCL_RT_FORMAT_ZETA_MASK 0x000000e0
-#define NV34TCL_RT_FORMAT_ZETA_Z16 0x00000020
-#define NV34TCL_RT_FORMAT_ZETA_Z24S8 0x00000040
-#define NV34TCL_RT_FORMAT_COLOR_SHIFT 0
-#define NV34TCL_RT_FORMAT_COLOR_MASK 0x0000001f
-#define NV34TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
-#define NV34TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
-#define NV34TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
-#define NV34TCL_RT_FORMAT_COLOR_B8 0x00000009
-#define NV34TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
-#define NV34TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
-#define NV34TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
-#define NV34TCL_COLOR0_PITCH 0x0000020c
-#define NV34TCL_COLOR0_PITCH_COLOR0_SHIFT 0
-#define NV34TCL_COLOR0_PITCH_COLOR0_MASK 0x0000ffff
-#define NV34TCL_COLOR0_PITCH_ZETA_SHIFT 16
-#define NV34TCL_COLOR0_PITCH_ZETA_MASK 0xffff0000
-#define NV34TCL_COLOR0_OFFSET 0x00000210
-#define NV34TCL_ZETA_OFFSET 0x00000214
-#define NV34TCL_COLOR1_OFFSET 0x00000218
-#define NV34TCL_COLOR1_PITCH 0x0000021c
-#define NV34TCL_RT_ENABLE 0x00000220
-#define NV34TCL_RT_ENABLE_MRT (1 << 4)
-#define NV34TCL_RT_ENABLE_COLOR1 (1 << 1)
-#define NV34TCL_RT_ENABLE_COLOR0 (1 << 0)
-#define NV34TCL_LMA_DEPTH_PITCH 0x0000022c
-#define NV34TCL_LMA_DEPTH_OFFSET 0x00000230
-#define NV34TCL_TX_UNITS_ENABLE 0x0000023c
-#define NV34TCL_TX_UNITS_ENABLE_TX0 (1 << 0)
-#define NV34TCL_TX_UNITS_ENABLE_TX1 (1 << 1)
-#define NV34TCL_TX_UNITS_ENABLE_TX2 (1 << 2)
-#define NV34TCL_TX_UNITS_ENABLE_TX3 (1 << 3)
-#define NV34TCL_TX_UNITS_ENABLE_TX4 (1 << 4)
-#define NV34TCL_TX_UNITS_ENABLE_TX5 (1 << 5)
-#define NV34TCL_TX_UNITS_ENABLE_TX6 (1 << 6)
-#define NV34TCL_TX_UNITS_ENABLE_TX7 (1 << 7)
-#define NV34TCL_TX_MATRIX_ENABLE(x) (0x00000240+((x)*4))
-#define NV34TCL_TX_MATRIX_ENABLE__SIZE 0x00000008
-#define NV34TCL_VIEWPORT_TX_ORIGIN 0x000002b8
-#define NV34TCL_VIEWPORT_TX_ORIGIN_X_SHIFT 0
-#define NV34TCL_VIEWPORT_TX_ORIGIN_X_MASK 0x0000ffff
-#define NV34TCL_VIEWPORT_TX_ORIGIN_Y_SHIFT 16
-#define NV34TCL_VIEWPORT_TX_ORIGIN_Y_MASK 0xffff0000
-#define NV34TCL_VIEWPORT_CLIP_MODE 0x000002bc
-#define NV34TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*8))
-#define NV34TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NV34TCL_VIEWPORT_CLIP_HORIZ_L_SHIFT 0
-#define NV34TCL_VIEWPORT_CLIP_HORIZ_L_MASK 0x0000ffff
-#define NV34TCL_VIEWPORT_CLIP_HORIZ_R_SHIFT 16
-#define NV34TCL_VIEWPORT_CLIP_HORIZ_R_MASK 0xffff0000
-#define NV34TCL_VIEWPORT_CLIP_VERT(x) (0x000002c4+((x)*8))
-#define NV34TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NV34TCL_VIEWPORT_CLIP_VERT_T_SHIFT 0
-#define NV34TCL_VIEWPORT_CLIP_VERT_T_MASK 0x0000ffff
-#define NV34TCL_VIEWPORT_CLIP_VERT_D_SHIFT 16
-#define NV34TCL_VIEWPORT_CLIP_VERT_D_MASK 0xffff0000
-#define NV34TCL_DITHER_ENABLE 0x00000300
-#define NV34TCL_ALPHA_FUNC_ENABLE 0x00000304
-#define NV34TCL_ALPHA_FUNC_FUNC 0x00000308
-#define NV34TCL_ALPHA_FUNC_FUNC_NEVER 0x00000200
-#define NV34TCL_ALPHA_FUNC_FUNC_LESS 0x00000201
-#define NV34TCL_ALPHA_FUNC_FUNC_EQUAL 0x00000202
-#define NV34TCL_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
-#define NV34TCL_ALPHA_FUNC_FUNC_GREATER 0x00000204
-#define NV34TCL_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV34TCL_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
-#define NV34TCL_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
-#define NV34TCL_ALPHA_FUNC_REF 0x0000030c
-#define NV34TCL_BLEND_FUNC_ENABLE 0x00000310
-#define NV34TCL_BLEND_FUNC_SRC 0x00000314
-#define NV34TCL_BLEND_FUNC_SRC_RGB_SHIFT 0
-#define NV34TCL_BLEND_FUNC_SRC_RGB_MASK 0x0000ffff
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00000000
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE 0x00000001
-#define NV34TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00000300
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV34TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00000302
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV34TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00000304
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV34TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00000306
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00000307
-#define NV34TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00000308
-#define NV34TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x00008001
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV34TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x00008003
-#define NV34TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_SHIFT 16
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_MASK 0xffff0000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00000000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00010000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x03000000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x03020000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x03040000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x03060000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x03080000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x80010000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x80030000
-#define NV34TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
-#define NV34TCL_BLEND_FUNC_DST 0x00000318
-#define NV34TCL_BLEND_FUNC_DST_RGB_SHIFT 0
-#define NV34TCL_BLEND_FUNC_DST_RGB_MASK 0x0000ffff
-#define NV34TCL_BLEND_FUNC_DST_RGB_ZERO 0x00000000
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE 0x00000001
-#define NV34TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00000300
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV34TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00000302
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV34TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00000304
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV34TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00000306
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00000307
-#define NV34TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00000308
-#define NV34TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x00008001
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV34TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x00008003
-#define NV34TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_SHIFT 16
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_MASK 0xffff0000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00000000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00010000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x03000000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x03020000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x03040000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x03060000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x03080000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x80010000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x80030000
-#define NV34TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
-#define NV34TCL_BLEND_COLOR 0x0000031c
-#define NV34TCL_BLEND_COLOR_B_SHIFT 0
-#define NV34TCL_BLEND_COLOR_B_MASK 0x000000ff
-#define NV34TCL_BLEND_COLOR_G_SHIFT 8
-#define NV34TCL_BLEND_COLOR_G_MASK 0x0000ff00
-#define NV34TCL_BLEND_COLOR_R_SHIFT 16
-#define NV34TCL_BLEND_COLOR_R_MASK 0x00ff0000
-#define NV34TCL_BLEND_COLOR_A_SHIFT 24
-#define NV34TCL_BLEND_COLOR_A_MASK 0xff000000
-#define NV34TCL_BLEND_EQUATION 0x00000320
-#define NV34TCL_BLEND_EQUATION_FUNC_ADD 0x00008006
-#define NV34TCL_BLEND_EQUATION_MIN 0x00008007
-#define NV34TCL_BLEND_EQUATION_MAX 0x00008008
-#define NV34TCL_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
-#define NV34TCL_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV34TCL_COLOR_MASK 0x00000324
-#define NV34TCL_COLOR_MASK_B_SHIFT 0
-#define NV34TCL_COLOR_MASK_B_MASK 0x000000ff
-#define NV34TCL_COLOR_MASK_G_SHIFT 8
-#define NV34TCL_COLOR_MASK_G_MASK 0x0000ff00
-#define NV34TCL_COLOR_MASK_R_SHIFT 16
-#define NV34TCL_COLOR_MASK_R_MASK 0x00ff0000
-#define NV34TCL_COLOR_MASK_A_SHIFT 24
-#define NV34TCL_COLOR_MASK_A_MASK 0xff000000
-#define NV34TCL_STENCIL_FRONT_ENABLE 0x00000328
-#define NV34TCL_STENCIL_FRONT_MASK 0x0000032c
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC 0x00000330
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
-#define NV34TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
-#define NV34TCL_STENCIL_FRONT_FUNC_REF 0x00000334
-#define NV34TCL_STENCIL_FRONT_FUNC_MASK 0x00000338
-#define NV34TCL_STENCIL_FRONT_OP_FAIL 0x0000033c
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL 0x00000340
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS 0x00000344
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV34TCL_STENCIL_BACK_ENABLE 0x00000348
-#define NV34TCL_STENCIL_BACK_MASK 0x0000034c
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC 0x00000350
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
-#define NV34TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
-#define NV34TCL_STENCIL_BACK_FUNC_REF 0x00000354
-#define NV34TCL_STENCIL_BACK_FUNC_MASK 0x00000358
-#define NV34TCL_STENCIL_BACK_OP_FAIL 0x0000035c
-#define NV34TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
-#define NV34TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
-#define NV34TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
-#define NV34TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
-#define NV34TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
-#define NV34TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL 0x00000360
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV34TCL_STENCIL_BACK_OP_ZPASS 0x00000364
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV34TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV34TCL_SHADE_MODEL 0x00000368
-#define NV34TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NV34TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NV34TCL_FOG_ENABLE 0x0000036c
-#define NV34TCL_FOG_COLOR 0x00000370
-#define NV34TCL_FOG_COLOR_R_SHIFT 0
-#define NV34TCL_FOG_COLOR_R_MASK 0x000000ff
-#define NV34TCL_FOG_COLOR_G_SHIFT 8
-#define NV34TCL_FOG_COLOR_G_MASK 0x0000ff00
-#define NV34TCL_FOG_COLOR_B_SHIFT 16
-#define NV34TCL_FOG_COLOR_B_MASK 0x00ff0000
-#define NV34TCL_FOG_COLOR_A_SHIFT 24
-#define NV34TCL_FOG_COLOR_A_MASK 0xff000000
-#define NV34TCL_COLOR_LOGIC_OP_ENABLE 0x00000374
-#define NV34TCL_COLOR_LOGIC_OP_OP 0x00000378
-#define NV34TCL_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
-#define NV34TCL_COLOR_LOGIC_OP_OP_AND 0x00001501
-#define NV34TCL_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
-#define NV34TCL_COLOR_LOGIC_OP_OP_COPY 0x00001503
-#define NV34TCL_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
-#define NV34TCL_COLOR_LOGIC_OP_OP_NOOP 0x00001505
-#define NV34TCL_COLOR_LOGIC_OP_OP_XOR 0x00001506
-#define NV34TCL_COLOR_LOGIC_OP_OP_OR 0x00001507
-#define NV34TCL_COLOR_LOGIC_OP_OP_NOR 0x00001508
-#define NV34TCL_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
-#define NV34TCL_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
-#define NV34TCL_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
-#define NV34TCL_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
-#define NV34TCL_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
-#define NV34TCL_COLOR_LOGIC_OP_OP_NAND 0x0000150e
-#define NV34TCL_COLOR_LOGIC_OP_OP_SET 0x0000150f
-#define NV34TCL_NORMALIZE_ENABLE 0x0000037c
-#define NV34TCL_COLOR_MATERIAL 0x00000390
-#define NV34TCL_COLOR_MATERIAL_FRONT_EMISSION_ENABLE (1 << 0)
-#define NV34TCL_COLOR_MATERIAL_FRONT_AMBIENT_ENABLE (1 << 2)
-#define NV34TCL_COLOR_MATERIAL_FRONT_DIFFUSE_ENABLE (1 << 4)
-#define NV34TCL_COLOR_MATERIAL_FRONT_SPECULAR_ENABLE (1 << 6)
-#define NV34TCL_COLOR_MATERIAL_BACK_EMISSION_ENABLE (1 << 8)
-#define NV34TCL_COLOR_MATERIAL_BACK_AMBIENT_ENABLE (1 << 10)
-#define NV34TCL_COLOR_MATERIAL_BACK_DIFFUSE_ENABLE (1 << 12)
-#define NV34TCL_COLOR_MATERIAL_BACK_SPECULAR_ENABLE (1 << 14)
-#define NV34TCL_DEPTH_RANGE_NEAR 0x00000394
-#define NV34TCL_DEPTH_RANGE_FAR 0x00000398
-#define NV34TCL_COLOR_MATERIAL_FRONT_R 0x000003a0
-#define NV34TCL_COLOR_MATERIAL_FRONT_G 0x000003a4
-#define NV34TCL_COLOR_MATERIAL_FRONT_B 0x000003a8
-#define NV34TCL_COLOR_MATERIAL_FRONT_A 0x000003b4
-#define NV34TCL_LINE_WIDTH 0x000003b8
-#define NV34TCL_LINE_SMOOTH_ENABLE 0x000003bc
-#define NV34TCL_TX_GEN_S(x) (0x00000400+((x)*16))
-#define NV34TCL_TX_GEN_S__SIZE 0x00000008
-#define NV34TCL_TX_GEN_S_FALSE 0x00000000
-#define NV34TCL_TX_GEN_S_EYE_LINEAR 0x00002400
-#define NV34TCL_TX_GEN_S_OBJECT_LINEAR 0x00002401
-#define NV34TCL_TX_GEN_S_SPHERE_MAP 0x00002402
-#define NV34TCL_TX_GEN_S_NORMAL_MAP 0x00008511
-#define NV34TCL_TX_GEN_S_REFLECTION_MAP 0x00008512
-#define NV34TCL_TX_GEN_T(x) (0x00000404+((x)*16))
-#define NV34TCL_TX_GEN_T__SIZE 0x00000008
-#define NV34TCL_TX_GEN_T_FALSE 0x00000000
-#define NV34TCL_TX_GEN_T_EYE_LINEAR 0x00002400
-#define NV34TCL_TX_GEN_T_OBJECT_LINEAR 0x00002401
-#define NV34TCL_TX_GEN_T_SPHERE_MAP 0x00002402
-#define NV34TCL_TX_GEN_T_NORMAL_MAP 0x00008511
-#define NV34TCL_TX_GEN_T_REFLECTION_MAP 0x00008512
-#define NV34TCL_TX_GEN_R(x) (0x00000408+((x)*16))
-#define NV34TCL_TX_GEN_R__SIZE 0x00000008
-#define NV34TCL_TX_GEN_R_FALSE 0x00000000
-#define NV34TCL_TX_GEN_R_EYE_LINEAR 0x00002400
-#define NV34TCL_TX_GEN_R_OBJECT_LINEAR 0x00002401
-#define NV34TCL_TX_GEN_R_SPHERE_MAP 0x00002402
-#define NV34TCL_TX_GEN_R_NORMAL_MAP 0x00008511
-#define NV34TCL_TX_GEN_R_REFLECTION_MAP 0x00008512
-#define NV34TCL_TX_GEN_Q(x) (0x0000040c+((x)*16))
-#define NV34TCL_TX_GEN_Q__SIZE 0x00000008
-#define NV34TCL_TX_GEN_Q_FALSE 0x00000000
-#define NV34TCL_TX_GEN_Q_EYE_LINEAR 0x00002400
-#define NV34TCL_TX_GEN_Q_OBJECT_LINEAR 0x00002401
-#define NV34TCL_TX_GEN_Q_SPHERE_MAP 0x00002402
-#define NV34TCL_TX_GEN_Q_NORMAL_MAP 0x00008511
-#define NV34TCL_TX_GEN_Q_REFLECTION_MAP 0x00008512
-#define NV34TCL_MODELVIEW_MATRIX(x) (0x00000480+((x)*4))
-#define NV34TCL_MODELVIEW_MATRIX__SIZE 0x00000010
-#define NV34TCL_INVERSE_MODELVIEW_MATRIX(x) (0x00000580+((x)*4))
-#define NV34TCL_INVERSE_MODELVIEW_MATRIX__SIZE 0x0000000c
-#define NV34TCL_PROJECTION_MATRIX(x) (0x00000680+((x)*4))
-#define NV34TCL_PROJECTION_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX0_MATRIX(x) (0x000006c0+((x)*4))
-#define NV34TCL_TX0_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX1_MATRIX(x) (0x00000700+((x)*4))
-#define NV34TCL_TX1_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX2_MATRIX(x) (0x00000740+((x)*4))
-#define NV34TCL_TX2_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX3_MATRIX(x) (0x00000780+((x)*4))
-#define NV34TCL_TX3_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX4_MATRIX(x) (0x000007c0+((x)*4))
-#define NV34TCL_TX4_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX5_MATRIX(x) (0x00000800+((x)*4))
-#define NV34TCL_TX5_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX6_MATRIX(x) (0x00000840+((x)*4))
-#define NV34TCL_TX6_MATRIX__SIZE 0x00000010
-#define NV34TCL_TX7_MATRIX(x) (0x00000880+((x)*4))
-#define NV34TCL_TX7_MATRIX__SIZE 0x00000010
-#define NV34TCL_SCISSOR_HORIZ 0x000008c0
-#define NV34TCL_SCISSOR_HORIZ_X_SHIFT 0
-#define NV34TCL_SCISSOR_HORIZ_X_MASK 0x0000ffff
-#define NV34TCL_SCISSOR_HORIZ_W_SHIFT 16
-#define NV34TCL_SCISSOR_HORIZ_W_MASK 0xffff0000
-#define NV34TCL_SCISSOR_VERT 0x000008c4
-#define NV34TCL_SCISSOR_VERT_Y_SHIFT 0
-#define NV34TCL_SCISSOR_VERT_Y_MASK 0x0000ffff
-#define NV34TCL_SCISSOR_VERT_H_SHIFT 16
-#define NV34TCL_SCISSOR_VERT_H_MASK 0xffff0000
-#define NV34TCL_FOG_COORD_DIST 0x000008c8
-#define NV34TCL_FOG_MODE 0x000008cc
-#define NV34TCL_FOG_EQUATION_CONSTANT 0x000008d0
-#define NV34TCL_FOG_EQUATION_LINEAR 0x000008d4
-#define NV34TCL_FOG_EQUATION_QUADRATIC 0x000008d8
-#define NV34TCL_FP_ACTIVE_PROGRAM 0x000008e4
-#define NV34TCL_FP_ACTIVE_PROGRAM_DMA0 (1 << 0)
-#define NV34TCL_FP_ACTIVE_PROGRAM_DMA1 (1 << 1)
-#define NV34TCL_FP_ACTIVE_PROGRAM_OFFSET_SHIFT 2
-#define NV34TCL_FP_ACTIVE_PROGRAM_OFFSET_MASK 0xfffffffc
-#define NV34TCL_RC_COLOR0 0x000008ec
-#define NV34TCL_RC_COLOR0_B_SHIFT 0
-#define NV34TCL_RC_COLOR0_B_MASK 0x000000ff
-#define NV34TCL_RC_COLOR0_G_SHIFT 8
-#define NV34TCL_RC_COLOR0_G_MASK 0x0000ff00
-#define NV34TCL_RC_COLOR0_R_SHIFT 16
-#define NV34TCL_RC_COLOR0_R_MASK 0x00ff0000
-#define NV34TCL_RC_COLOR0_A_SHIFT 24
-#define NV34TCL_RC_COLOR0_A_MASK 0xff000000
-#define NV34TCL_RC_COLOR1 0x000008f0
-#define NV34TCL_RC_COLOR1_B_SHIFT 0
-#define NV34TCL_RC_COLOR1_B_MASK 0x000000ff
-#define NV34TCL_RC_COLOR1_G_SHIFT 8
-#define NV34TCL_RC_COLOR1_G_MASK 0x0000ff00
-#define NV34TCL_RC_COLOR1_R_SHIFT 16
-#define NV34TCL_RC_COLOR1_R_MASK 0x00ff0000
-#define NV34TCL_RC_COLOR1_A_SHIFT 24
-#define NV34TCL_RC_COLOR1_A_MASK 0xff000000
-#define NV34TCL_RC_FINAL0 0x000008f4
-#define NV34TCL_RC_FINAL0_D_INPUT_SHIFT 0
-#define NV34TCL_RC_FINAL0_D_INPUT_MASK 0x0000000f
-#define NV34TCL_RC_FINAL0_D_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV34TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV34TCL_RC_FINAL0_D_INPUT_FOG 0x00000003
-#define NV34TCL_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV34TCL_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV34TCL_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
-#define NV34TCL_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
-#define NV34TCL_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
-#define NV34TCL_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
-#define NV34TCL_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV34TCL_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
-#define NV34TCL_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
-#define NV34TCL_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
-#define NV34TCL_RC_FINAL0_D_COMPONENT_USAGE (1 << 4)
-#define NV34TCL_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV34TCL_RC_FINAL0_D_MAPPING_SHIFT 5
-#define NV34TCL_RC_FINAL0_D_MAPPING_MASK 0x000000e0
-#define NV34TCL_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV34TCL_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV34TCL_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV34TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV34TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV34TCL_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV34TCL_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV34TCL_RC_FINAL0_C_INPUT_SHIFT 8
-#define NV34TCL_RC_FINAL0_C_INPUT_MASK 0x00000f00
-#define NV34TCL_RC_FINAL0_C_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_FINAL0_C_INPUT_FOG 0x00000300
-#define NV34TCL_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_FINAL0_C_COMPONENT_USAGE (1 << 12)
-#define NV34TCL_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV34TCL_RC_FINAL0_C_MAPPING_SHIFT 13
-#define NV34TCL_RC_FINAL0_C_MAPPING_MASK 0x0000e000
-#define NV34TCL_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV34TCL_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV34TCL_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV34TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV34TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV34TCL_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV34TCL_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV34TCL_RC_FINAL0_B_INPUT_SHIFT 16
-#define NV34TCL_RC_FINAL0_B_INPUT_MASK 0x000f0000
-#define NV34TCL_RC_FINAL0_B_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV34TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV34TCL_RC_FINAL0_B_INPUT_FOG 0x00030000
-#define NV34TCL_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV34TCL_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV34TCL_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
-#define NV34TCL_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
-#define NV34TCL_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
-#define NV34TCL_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
-#define NV34TCL_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV34TCL_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
-#define NV34TCL_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
-#define NV34TCL_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
-#define NV34TCL_RC_FINAL0_B_COMPONENT_USAGE (1 << 20)
-#define NV34TCL_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV34TCL_RC_FINAL0_B_MAPPING_SHIFT 21
-#define NV34TCL_RC_FINAL0_B_MAPPING_MASK 0x00e00000
-#define NV34TCL_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV34TCL_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV34TCL_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV34TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV34TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV34TCL_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV34TCL_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV34TCL_RC_FINAL0_A_INPUT_SHIFT 24
-#define NV34TCL_RC_FINAL0_A_INPUT_MASK 0x0f000000
-#define NV34TCL_RC_FINAL0_A_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV34TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV34TCL_RC_FINAL0_A_INPUT_FOG 0x03000000
-#define NV34TCL_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV34TCL_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV34TCL_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
-#define NV34TCL_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
-#define NV34TCL_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
-#define NV34TCL_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
-#define NV34TCL_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV34TCL_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
-#define NV34TCL_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
-#define NV34TCL_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
-#define NV34TCL_RC_FINAL0_A_COMPONENT_USAGE (1 << 28)
-#define NV34TCL_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_SHIFT 29
-#define NV34TCL_RC_FINAL0_A_MAPPING_MASK 0xe0000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV34TCL_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV34TCL_RC_FINAL1 0x000008f8
-#define NV34TCL_RC_FINAL1_COLOR_SUM_CLAMP (1 << 7)
-#define NV34TCL_RC_FINAL1_G_INPUT_SHIFT 8
-#define NV34TCL_RC_FINAL1_G_INPUT_MASK 0x00000f00
-#define NV34TCL_RC_FINAL1_G_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_FINAL1_G_INPUT_FOG 0x00000300
-#define NV34TCL_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_FINAL1_G_COMPONENT_USAGE (1 << 12)
-#define NV34TCL_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV34TCL_RC_FINAL1_G_MAPPING_SHIFT 13
-#define NV34TCL_RC_FINAL1_G_MAPPING_MASK 0x0000e000
-#define NV34TCL_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV34TCL_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV34TCL_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV34TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV34TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV34TCL_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV34TCL_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV34TCL_RC_FINAL1_F_INPUT_SHIFT 16
-#define NV34TCL_RC_FINAL1_F_INPUT_MASK 0x000f0000
-#define NV34TCL_RC_FINAL1_F_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV34TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV34TCL_RC_FINAL1_F_INPUT_FOG 0x00030000
-#define NV34TCL_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
-#define NV34TCL_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
-#define NV34TCL_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
-#define NV34TCL_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
-#define NV34TCL_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
-#define NV34TCL_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
-#define NV34TCL_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV34TCL_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
-#define NV34TCL_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
-#define NV34TCL_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
-#define NV34TCL_RC_FINAL1_F_COMPONENT_USAGE (1 << 20)
-#define NV34TCL_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV34TCL_RC_FINAL1_F_MAPPING_SHIFT 21
-#define NV34TCL_RC_FINAL1_F_MAPPING_MASK 0x00e00000
-#define NV34TCL_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV34TCL_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV34TCL_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV34TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV34TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV34TCL_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV34TCL_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV34TCL_RC_FINAL1_E_INPUT_SHIFT 24
-#define NV34TCL_RC_FINAL1_E_INPUT_MASK 0x0f000000
-#define NV34TCL_RC_FINAL1_E_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV34TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV34TCL_RC_FINAL1_E_INPUT_FOG 0x03000000
-#define NV34TCL_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
-#define NV34TCL_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
-#define NV34TCL_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
-#define NV34TCL_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
-#define NV34TCL_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
-#define NV34TCL_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
-#define NV34TCL_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV34TCL_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
-#define NV34TCL_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
-#define NV34TCL_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
-#define NV34TCL_RC_FINAL1_E_COMPONENT_USAGE (1 << 28)
-#define NV34TCL_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_SHIFT 29
-#define NV34TCL_RC_FINAL1_E_MAPPING_MASK 0xe0000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV34TCL_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV34TCL_RC_ENABLE 0x000008fc
-#define NV34TCL_RC_ENABLE_NUM_COMBINERS_SHIFT 0
-#define NV34TCL_RC_ENABLE_NUM_COMBINERS_MASK 0x0000000f
-#define NV34TCL_RC_ENABLE_STAGE_CONSTANT_COLOR0_SHIFT 12
-#define NV34TCL_RC_ENABLE_STAGE_CONSTANT_COLOR0_MASK 0x0000f000
-#define NV34TCL_RC_ENABLE_STAGE_CONSTANT_COLOR1_SHIFT 16
-#define NV34TCL_RC_ENABLE_STAGE_CONSTANT_COLOR1_MASK 0x000f0000
-#define NV34TCL_RC_IN_ALPHA(x) (0x00000900+((x)*32))
-#define NV34TCL_RC_IN_ALPHA__SIZE 0x00000008
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_SHIFT 0
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_MASK 0x0000000f
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
-#define NV34TCL_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
-#define NV34TCL_RC_IN_ALPHA_D_COMPONENT_USAGE (1 << 4)
-#define NV34TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
-#define NV34TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_SHIFT 5
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_MASK 0x000000e0
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV34TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_SHIFT 8
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_MASK 0x00000f00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_IN_ALPHA_C_COMPONENT_USAGE (1 << 12)
-#define NV34TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
-#define NV34TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_SHIFT 13
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_MASK 0x0000e000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV34TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_SHIFT 16
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_MASK 0x000f0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
-#define NV34TCL_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
-#define NV34TCL_RC_IN_ALPHA_B_COMPONENT_USAGE (1 << 20)
-#define NV34TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
-#define NV34TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_SHIFT 21
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_MASK 0x00e00000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV34TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_SHIFT 24
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_MASK 0x0f000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
-#define NV34TCL_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
-#define NV34TCL_RC_IN_ALPHA_A_COMPONENT_USAGE (1 << 28)
-#define NV34TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
-#define NV34TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_SHIFT 29
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_MASK 0xe0000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV34TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV34TCL_RC_IN_RGB(x) (0x00000904+((x)*32))
-#define NV34TCL_RC_IN_RGB__SIZE 0x00000008
-#define NV34TCL_RC_IN_RGB_D_INPUT_SHIFT 0
-#define NV34TCL_RC_IN_RGB_D_INPUT_MASK 0x0000000f
-#define NV34TCL_RC_IN_RGB_D_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
-#define NV34TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
-#define NV34TCL_RC_IN_RGB_D_INPUT_FOG 0x00000003
-#define NV34TCL_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
-#define NV34TCL_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
-#define NV34TCL_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
-#define NV34TCL_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
-#define NV34TCL_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
-#define NV34TCL_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
-#define NV34TCL_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV34TCL_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
-#define NV34TCL_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
-#define NV34TCL_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
-#define NV34TCL_RC_IN_RGB_D_COMPONENT_USAGE (1 << 4)
-#define NV34TCL_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
-#define NV34TCL_RC_IN_RGB_D_MAPPING_SHIFT 5
-#define NV34TCL_RC_IN_RGB_D_MAPPING_MASK 0x000000e0
-#define NV34TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
-#define NV34TCL_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
-#define NV34TCL_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
-#define NV34TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
-#define NV34TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
-#define NV34TCL_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
-#define NV34TCL_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
-#define NV34TCL_RC_IN_RGB_C_INPUT_SHIFT 8
-#define NV34TCL_RC_IN_RGB_C_INPUT_MASK 0x00000f00
-#define NV34TCL_RC_IN_RGB_C_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_IN_RGB_C_INPUT_FOG 0x00000300
-#define NV34TCL_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_IN_RGB_C_COMPONENT_USAGE (1 << 12)
-#define NV34TCL_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_SHIFT 13
-#define NV34TCL_RC_IN_RGB_C_MAPPING_MASK 0x0000e000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
-#define NV34TCL_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
-#define NV34TCL_RC_IN_RGB_B_INPUT_SHIFT 16
-#define NV34TCL_RC_IN_RGB_B_INPUT_MASK 0x000f0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
-#define NV34TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
-#define NV34TCL_RC_IN_RGB_B_INPUT_FOG 0x00030000
-#define NV34TCL_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
-#define NV34TCL_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
-#define NV34TCL_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
-#define NV34TCL_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
-#define NV34TCL_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
-#define NV34TCL_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
-#define NV34TCL_RC_IN_RGB_B_COMPONENT_USAGE (1 << 20)
-#define NV34TCL_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_SHIFT 21
-#define NV34TCL_RC_IN_RGB_B_MAPPING_MASK 0x00e00000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
-#define NV34TCL_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
-#define NV34TCL_RC_IN_RGB_A_INPUT_SHIFT 24
-#define NV34TCL_RC_IN_RGB_A_INPUT_MASK 0x0f000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_ZERO 0x00000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_FOG 0x03000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
-#define NV34TCL_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
-#define NV34TCL_RC_IN_RGB_A_COMPONENT_USAGE (1 << 28)
-#define NV34TCL_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
-#define NV34TCL_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_SHIFT 29
-#define NV34TCL_RC_IN_RGB_A_MAPPING_MASK 0xe0000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
-#define NV34TCL_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
-#define NV34TCL_RC_CONSTANT_COLOR0(x) (0x00000908+((x)*32))
-#define NV34TCL_RC_CONSTANT_COLOR0__SIZE 0x00000008
-#define NV34TCL_RC_CONSTANT_COLOR0_B_SHIFT 0
-#define NV34TCL_RC_CONSTANT_COLOR0_B_MASK 0x000000ff
-#define NV34TCL_RC_CONSTANT_COLOR0_G_SHIFT 8
-#define NV34TCL_RC_CONSTANT_COLOR0_G_MASK 0x0000ff00
-#define NV34TCL_RC_CONSTANT_COLOR0_R_SHIFT 16
-#define NV34TCL_RC_CONSTANT_COLOR0_R_MASK 0x00ff0000
-#define NV34TCL_RC_CONSTANT_COLOR0_A_SHIFT 24
-#define NV34TCL_RC_CONSTANT_COLOR0_A_MASK 0xff000000
-#define NV34TCL_RC_CONSTANT_COLOR1(x) (0x0000090c+((x)*32))
-#define NV34TCL_RC_CONSTANT_COLOR1__SIZE 0x00000008
-#define NV34TCL_RC_CONSTANT_COLOR1_B_SHIFT 0
-#define NV34TCL_RC_CONSTANT_COLOR1_B_MASK 0x000000ff
-#define NV34TCL_RC_CONSTANT_COLOR1_G_SHIFT 8
-#define NV34TCL_RC_CONSTANT_COLOR1_G_MASK 0x0000ff00
-#define NV34TCL_RC_CONSTANT_COLOR1_R_SHIFT 16
-#define NV34TCL_RC_CONSTANT_COLOR1_R_MASK 0x00ff0000
-#define NV34TCL_RC_CONSTANT_COLOR1_A_SHIFT 24
-#define NV34TCL_RC_CONSTANT_COLOR1_A_MASK 0xff000000
-#define NV34TCL_RC_OUT_ALPHA(x) (0x00000910+((x)*32))
-#define NV34TCL_RC_OUT_ALPHA__SIZE 0x00000008
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_SHIFT 0
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_MASK 0x0000000f
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV34TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_SHIFT 4
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_MASK 0x000000f0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV34TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_SHIFT 8
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_MASK 0x00000f00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_OUT_ALPHA_CD_DOT_PRODUCT (1 << 12)
-#define NV34TCL_RC_OUT_ALPHA_AB_DOT_PRODUCT (1 << 13)
-#define NV34TCL_RC_OUT_ALPHA_MUX_SUM (1 << 14)
-#define NV34TCL_RC_OUT_ALPHA_BIAS (1 << 15)
-#define NV34TCL_RC_OUT_ALPHA_BIAS_NONE 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV34TCL_RC_OUT_ALPHA_SCALE_SHIFT 17
-#define NV34TCL_RC_OUT_ALPHA_SCALE_MASK 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_SCALE_NONE 0x00000000
-#define NV34TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00020000
-#define NV34TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV34TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV34TCL_RC_OUT_RGB(x) (0x00000914+((x)*32))
-#define NV34TCL_RC_OUT_RGB__SIZE 0x00000008
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT 0
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_MASK 0x0000000f
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
-#define NV34TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_SHIFT 4
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_MASK 0x000000f0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
-#define NV34TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_SHIFT 8
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_MASK 0x00000f00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
-#define NV34TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
-#define NV34TCL_RC_OUT_RGB_CD_DOT_PRODUCT (1 << 12)
-#define NV34TCL_RC_OUT_RGB_AB_DOT_PRODUCT (1 << 13)
-#define NV34TCL_RC_OUT_RGB_MUX_SUM (1 << 14)
-#define NV34TCL_RC_OUT_RGB_BIAS (1 << 15)
-#define NV34TCL_RC_OUT_RGB_BIAS_NONE 0x00000000
-#define NV34TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
-#define NV34TCL_RC_OUT_RGB_SCALE_SHIFT 17
-#define NV34TCL_RC_OUT_RGB_SCALE_MASK 0x00000000
-#define NV34TCL_RC_OUT_RGB_SCALE_NONE 0x00000000
-#define NV34TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00020000
-#define NV34TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00040000
-#define NV34TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00060000
-#define NV34TCL_VIEWPORT_HORIZ 0x00000a00
-#define NV34TCL_VIEWPORT_HORIZ_X_SHIFT 0
-#define NV34TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
-#define NV34TCL_VIEWPORT_HORIZ_W_SHIFT 16
-#define NV34TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
-#define NV34TCL_VIEWPORT_VERT 0x00000a04
-#define NV34TCL_VIEWPORT_VERT_Y_SHIFT 0
-#define NV34TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
-#define NV34TCL_VIEWPORT_VERT_H_SHIFT 16
-#define NV34TCL_VIEWPORT_VERT_H_MASK 0xffff0000
-#define NV34TCL_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R 0x00000a10
-#define NV34TCL_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G 0x00000a14
-#define NV34TCL_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B 0x00000a18
-#define NV34TCL_VIEWPORT_TRANSLATE_X 0x00000a20
-#define NV34TCL_VIEWPORT_TRANSLATE_Y 0x00000a24
-#define NV34TCL_VIEWPORT_TRANSLATE_Z 0x00000a28
-#define NV34TCL_VIEWPORT_TRANSLATE_W 0x00000a2c
-#define NV34TCL_VIEWPORT_SCALE_X 0x00000a30
-#define NV34TCL_VIEWPORT_SCALE_Y 0x00000a34
-#define NV34TCL_VIEWPORT_SCALE_Z 0x00000a38
-#define NV34TCL_VIEWPORT_SCALE_W 0x00000a3c
-#define NV34TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000a60
-#define NV34TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000a64
-#define NV34TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000a68
-#define NV34TCL_DEPTH_FUNC 0x00000a6c
-#define NV34TCL_DEPTH_FUNC_NEVER 0x00000200
-#define NV34TCL_DEPTH_FUNC_LESS 0x00000201
-#define NV34TCL_DEPTH_FUNC_EQUAL 0x00000202
-#define NV34TCL_DEPTH_FUNC_LEQUAL 0x00000203
-#define NV34TCL_DEPTH_FUNC_GREATER 0x00000204
-#define NV34TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
-#define NV34TCL_DEPTH_FUNC_GEQUAL 0x00000206
-#define NV34TCL_DEPTH_FUNC_ALWAYS 0x00000207
-#define NV34TCL_DEPTH_WRITE_ENABLE 0x00000a70
-#define NV34TCL_DEPTH_TEST_ENABLE 0x00000a74
-#define NV34TCL_POLYGON_OFFSET_FACTOR 0x00000a78
-#define NV34TCL_POLYGON_OFFSET_UNITS 0x00000a7c
-#define NV34TCL_VTX_ATTR_3I_XY(x) (0x00000a80+((x)*8))
-#define NV34TCL_VTX_ATTR_3I_XY__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_3I_XY_X_SHIFT 0
-#define NV34TCL_VTX_ATTR_3I_XY_X_MASK 0x0000ffff
-#define NV34TCL_VTX_ATTR_3I_XY_Y_SHIFT 16
-#define NV34TCL_VTX_ATTR_3I_XY_Y_MASK 0xffff0000
-#define NV34TCL_VTX_ATTR_3I_Z(x) (0x00000a84+((x)*8))
-#define NV34TCL_VTX_ATTR_3I_Z__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_3I_Z_Z_SHIFT 0
-#define NV34TCL_VTX_ATTR_3I_Z_Z_MASK 0x0000ffff
-#define NV34TCL_VP_UPLOAD_INST(x) (0x00000b80+((x)*4))
-#define NV34TCL_VP_UPLOAD_INST__SIZE 0x00000004
-#define NV34TCL_TX0_CLIP_PLANE_A(x) (0x00000e00+((x)*16))
-#define NV34TCL_TX0_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX0_CLIP_PLANE_B(x) (0x00000e04+((x)*16))
-#define NV34TCL_TX0_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX0_CLIP_PLANE_C(x) (0x00000e08+((x)*16))
-#define NV34TCL_TX0_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX0_CLIP_PLANE_D(x) (0x00000e0c+((x)*16))
-#define NV34TCL_TX0_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX1_CLIP_PLANE_A(x) (0x00000e40+((x)*16))
-#define NV34TCL_TX1_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX1_CLIP_PLANE_B(x) (0x00000e44+((x)*16))
-#define NV34TCL_TX1_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX1_CLIP_PLANE_C(x) (0x00000e48+((x)*16))
-#define NV34TCL_TX1_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX1_CLIP_PLANE_D(x) (0x00000e4c+((x)*16))
-#define NV34TCL_TX1_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX2_CLIP_PLANE_A(x) (0x00000e80+((x)*16))
-#define NV34TCL_TX2_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX2_CLIP_PLANE_B(x) (0x00000e84+((x)*16))
-#define NV34TCL_TX2_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX2_CLIP_PLANE_C(x) (0x00000e88+((x)*16))
-#define NV34TCL_TX2_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX2_CLIP_PLANE_D(x) (0x00000e8c+((x)*16))
-#define NV34TCL_TX2_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX3_CLIP_PLANE_A(x) (0x00000ec0+((x)*16))
-#define NV34TCL_TX3_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX3_CLIP_PLANE_B(x) (0x00000ec4+((x)*16))
-#define NV34TCL_TX3_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX3_CLIP_PLANE_C(x) (0x00000ec8+((x)*16))
-#define NV34TCL_TX3_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX3_CLIP_PLANE_D(x) (0x00000ecc+((x)*16))
-#define NV34TCL_TX3_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX4_CLIP_PLANE_A(x) (0x00000f00+((x)*16))
-#define NV34TCL_TX4_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX4_CLIP_PLANE_B(x) (0x00000f04+((x)*16))
-#define NV34TCL_TX4_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX4_CLIP_PLANE_C(x) (0x00000f08+((x)*16))
-#define NV34TCL_TX4_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX4_CLIP_PLANE_D(x) (0x00000f0c+((x)*16))
-#define NV34TCL_TX4_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX5_CLIP_PLANE_A(x) (0x00000f40+((x)*16))
-#define NV34TCL_TX5_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX5_CLIP_PLANE_B(x) (0x00000f44+((x)*16))
-#define NV34TCL_TX5_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX5_CLIP_PLANE_C(x) (0x00000f48+((x)*16))
-#define NV34TCL_TX5_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX5_CLIP_PLANE_D(x) (0x00000f4c+((x)*16))
-#define NV34TCL_TX5_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX6_CLIP_PLANE_A(x) (0x00000f80+((x)*16))
-#define NV34TCL_TX6_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX6_CLIP_PLANE_B(x) (0x00000f84+((x)*16))
-#define NV34TCL_TX6_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX6_CLIP_PLANE_C(x) (0x00000f88+((x)*16))
-#define NV34TCL_TX6_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX6_CLIP_PLANE_D(x) (0x00000f8c+((x)*16))
-#define NV34TCL_TX6_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_TX7_CLIP_PLANE_A(x) (0x00000fc0+((x)*16))
-#define NV34TCL_TX7_CLIP_PLANE_A__SIZE 0x00000004
-#define NV34TCL_TX7_CLIP_PLANE_B(x) (0x00000fc4+((x)*16))
-#define NV34TCL_TX7_CLIP_PLANE_B__SIZE 0x00000004
-#define NV34TCL_TX7_CLIP_PLANE_C(x) (0x00000fc8+((x)*16))
-#define NV34TCL_TX7_CLIP_PLANE_C__SIZE 0x00000004
-#define NV34TCL_TX7_CLIP_PLANE_D(x) (0x00000fcc+((x)*16))
-#define NV34TCL_TX7_CLIP_PLANE_D__SIZE 0x00000004
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_R(x) (0x00001000+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_R__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_G(x) (0x00001004+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_G__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_B(x) (0x00001008+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_B__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_R(x) (0x0000100c+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_R__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_G(x) (0x00001010+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_G__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_B(x) (0x00001014+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_B__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_R(x) (0x00001018+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_R__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_G(x) (0x0000101c+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_G__SIZE 0x00000008
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_B(x) (0x00001020+((x)*64))
-#define NV34TCL_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_B__SIZE 0x00000008
-#define NV34TCL_LIGHT_HALF_VECTOR_X(x) (0x00001028+((x)*64))
-#define NV34TCL_LIGHT_HALF_VECTOR_X__SIZE 0x00000008
-#define NV34TCL_LIGHT_HALF_VECTOR_Y(x) (0x0000102c+((x)*64))
-#define NV34TCL_LIGHT_HALF_VECTOR_Y__SIZE 0x00000008
-#define NV34TCL_LIGHT_HALF_VECTOR_Z(x) (0x00001030+((x)*64))
-#define NV34TCL_LIGHT_HALF_VECTOR_Z__SIZE 0x00000008
-#define NV34TCL_LIGHT_DIRECTION_X(x) (0x00001034+((x)*64))
-#define NV34TCL_LIGHT_DIRECTION_X__SIZE 0x00000008
-#define NV34TCL_LIGHT_DIRECTION_Y(x) (0x00001038+((x)*64))
-#define NV34TCL_LIGHT_DIRECTION_Y__SIZE 0x00000008
-#define NV34TCL_LIGHT_DIRECTION_Z(x) (0x0000103c+((x)*64))
-#define NV34TCL_LIGHT_DIRECTION_Z__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_CUTOFF_A(x) (0x00001200+((x)*64))
-#define NV34TCL_LIGHT_SPOT_CUTOFF_A__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_CUTOFF_B(x) (0x00001204+((x)*64))
-#define NV34TCL_LIGHT_SPOT_CUTOFF_B__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_CUTOFF_C(x) (0x00001208+((x)*64))
-#define NV34TCL_LIGHT_SPOT_CUTOFF_C__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_DIR_X(x) (0x0000120c+((x)*64))
-#define NV34TCL_LIGHT_SPOT_DIR_X__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_DIR_Y(x) (0x00001210+((x)*64))
-#define NV34TCL_LIGHT_SPOT_DIR_Y__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_DIR_Z(x) (0x00001214+((x)*64))
-#define NV34TCL_LIGHT_SPOT_DIR_Z__SIZE 0x00000008
-#define NV34TCL_LIGHT_SPOT_CUTOFF_D(x) (0x00001218+((x)*64))
-#define NV34TCL_LIGHT_SPOT_CUTOFF_D__SIZE 0x00000008
-#define NV34TCL_LIGHT_POSITION_X(x) (0x0000121c+((x)*64))
-#define NV34TCL_LIGHT_POSITION_X__SIZE 0x00000008
-#define NV34TCL_LIGHT_POSITION_Y(x) (0x00001220+((x)*64))
-#define NV34TCL_LIGHT_POSITION_Y__SIZE 0x00000008
-#define NV34TCL_LIGHT_POSITION_Z(x) (0x00001224+((x)*64))
-#define NV34TCL_LIGHT_POSITION_Z__SIZE 0x00000008
-#define NV34TCL_LIGHT_ATTENUATION_CONSTANT(x) (0x00001228+((x)*64))
-#define NV34TCL_LIGHT_ATTENUATION_CONSTANT__SIZE 0x00000008
-#define NV34TCL_LIGHT_ATTENUATION_LINEAR(x) (0x0000122c+((x)*64))
-#define NV34TCL_LIGHT_ATTENUATION_LINEAR__SIZE 0x00000008
-#define NV34TCL_LIGHT_ATTENUATION_QUADRATIC(x) (0x00001230+((x)*64))
-#define NV34TCL_LIGHT_ATTENUATION_QUADRATIC__SIZE 0x00000008
-#define NV34TCL_FRONT_MATERIAL_SHININESS(x) (0x00001400+((x)*4))
-#define NV34TCL_FRONT_MATERIAL_SHININESS__SIZE 0x00000006
-#define NV34TCL_ENABLED_LIGHTS 0x00001420
-#define NV34TCL_VERTEX_TWO_SIDE_ENABLE 0x0000142c
-#define NV34TCL_FP_REG_CONTROL 0x00001450
-#define NV34TCL_FP_REG_CONTROL_UNK1_SHIFT 16
-#define NV34TCL_FP_REG_CONTROL_UNK1_MASK 0xffff0000
-#define NV34TCL_FP_REG_CONTROL_UNK0_SHIFT 0
-#define NV34TCL_FP_REG_CONTROL_UNK0_MASK 0x0000ffff
-#define NV34TCL_FLATSHADE_FIRST 0x00001454
-#define NV34TCL_EDGEFLAG_ENABLE 0x0000145c
-#define NV34TCL_VP_CLIP_PLANES_ENABLE 0x00001478
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 (1 << 1)
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 (1 << 5)
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 (1 << 9)
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3 (1 << 13)
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4 (1 << 17)
-#define NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE5 (1 << 21)
-#define NV34TCL_POLYGON_STIPPLE_ENABLE 0x0000147c
-#define NV34TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001480+((x)*4))
-#define NV34TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NV34TCL_VTX_ATTR_3F_X(x) (0x00001500+((x)*16))
-#define NV34TCL_VTX_ATTR_3F_X__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_3F_Y(x) (0x00001504+((x)*16))
-#define NV34TCL_VTX_ATTR_3F_Y__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_3F_Z(x) (0x00001508+((x)*16))
-#define NV34TCL_VTX_ATTR_3F_Z__SIZE 0x00000010
-#define NV34TCL_VP_CLIP_PLANE_A(x) (0x00001600+((x)*16))
-#define NV34TCL_VP_CLIP_PLANE_A__SIZE 0x00000006
-#define NV34TCL_VP_CLIP_PLANE_B(x) (0x00001604+((x)*16))
-#define NV34TCL_VP_CLIP_PLANE_B__SIZE 0x00000006
-#define NV34TCL_VP_CLIP_PLANE_C(x) (0x00001608+((x)*16))
-#define NV34TCL_VP_CLIP_PLANE_C__SIZE 0x00000006
-#define NV34TCL_VP_CLIP_PLANE_D(x) (0x0000160c+((x)*16))
-#define NV34TCL_VP_CLIP_PLANE_D__SIZE 0x00000006
-#define NV34TCL_VTXBUF_ADDRESS(x) (0x00001680+((x)*4))
-#define NV34TCL_VTXBUF_ADDRESS__SIZE 0x00000010
-#define NV34TCL_VTXBUF_ADDRESS_DMA1 (1 << 31)
-#define NV34TCL_VTXBUF_ADDRESS_OFFSET_SHIFT 0
-#define NV34TCL_VTXBUF_ADDRESS_OFFSET_MASK 0x0fffffff
-#define NV34TCL_VTXFMT(x) (0x00001740+((x)*4))
-#define NV34TCL_VTXFMT__SIZE 0x00000010
-#define NV34TCL_VTXFMT_TYPE_SHIFT 0
-#define NV34TCL_VTXFMT_TYPE_MASK 0x0000000f
-#define NV34TCL_VTXFMT_TYPE_16_SNORM 0x00000001
-#define NV34TCL_VTXFMT_TYPE_32_FLOAT 0x00000002
-#define NV34TCL_VTXFMT_TYPE_16_FLOAT 0x00000003
-#define NV34TCL_VTXFMT_TYPE_8_UNORM 0x00000004
-#define NV34TCL_VTXFMT_TYPE_16_SSCALED 0x00000005
-#define NV34TCL_VTXFMT_TYPE_11_11_10_SNORM 0x00000006
-#define NV34TCL_VTXFMT_TYPE_8_USCALED 0x00000007
-#define NV34TCL_VTXFMT_SIZE_SHIFT 4
-#define NV34TCL_VTXFMT_SIZE_MASK 0x000000f0
-#define NV34TCL_VTXFMT_STRIDE_SHIFT 8
-#define NV34TCL_VTXFMT_STRIDE_MASK 0x0000ff00
-#define NV34TCL_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R 0x000017a0
-#define NV34TCL_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G 0x000017a4
-#define NV34TCL_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B 0x000017a8
-#define NV34TCL_COLOR_MATERIAL_BACK_R 0x000017b0
-#define NV34TCL_COLOR_MATERIAL_BACK_G 0x000017b4
-#define NV34TCL_COLOR_MATERIAL_BACK_B 0x000017b8
-#define NV34TCL_COLOR_MATERIAL_BACK_A 0x000017c0
-#define NV34TCL_QUERY_RESET 0x000017c8
-#define NV34TCL_QUERY_UNK17CC 0x000017cc
-#define NV34TCL_QUERY_GET 0x00001800
-#define NV34TCL_QUERY_GET_UNK24_SHIFT 24
-#define NV34TCL_QUERY_GET_UNK24_MASK 0xff000000
-#define NV34TCL_QUERY_GET_OFFSET_SHIFT 0
-#define NV34TCL_QUERY_GET_OFFSET_MASK 0x00ffffff
-#define NV34TCL_VERTEX_BEGIN_END 0x00001808
-#define NV34TCL_VERTEX_BEGIN_END_STOP 0x00000000
-#define NV34TCL_VERTEX_BEGIN_END_POINTS 0x00000001
-#define NV34TCL_VERTEX_BEGIN_END_LINES 0x00000002
-#define NV34TCL_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
-#define NV34TCL_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
-#define NV34TCL_VERTEX_BEGIN_END_TRIANGLES 0x00000005
-#define NV34TCL_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
-#define NV34TCL_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
-#define NV34TCL_VERTEX_BEGIN_END_QUADS 0x00000008
-#define NV34TCL_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
-#define NV34TCL_VERTEX_BEGIN_END_POLYGON 0x0000000a
-#define NV34TCL_VB_ELEMENT_U16 0x0000180c
-#define NV34TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NV34TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NV34TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NV34TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NV34TCL_VB_ELEMENT_U32 0x00001810
-#define NV34TCL_VB_VERTEX_BATCH 0x00001814
-#define NV34TCL_VB_VERTEX_BATCH_OFFSET_SHIFT 0
-#define NV34TCL_VB_VERTEX_BATCH_OFFSET_MASK 0x00ffffff
-#define NV34TCL_VB_VERTEX_BATCH_COUNT_SHIFT 24
-#define NV34TCL_VB_VERTEX_BATCH_COUNT_MASK 0xff000000
-#define NV34TCL_VERTEX_DATA 0x00001818
-#define NV34TCL_IDXBUF_ADDRESS 0x0000181c
-#define NV34TCL_IDXBUF_FORMAT 0x00001820
-#define NV34TCL_IDXBUF_FORMAT_TYPE_SHIFT 4
-#define NV34TCL_IDXBUF_FORMAT_TYPE_MASK 0x000000f0
-#define NV34TCL_IDXBUF_FORMAT_TYPE_U32 0x00000000
-#define NV34TCL_IDXBUF_FORMAT_TYPE_U16 0x00000010
-#define NV34TCL_IDXBUF_FORMAT_DMA1 (1 << 0)
-#define NV34TCL_VB_INDEX_BATCH 0x00001824
-#define NV34TCL_VB_INDEX_BATCH_COUNT_SHIFT 24
-#define NV34TCL_VB_INDEX_BATCH_COUNT_MASK 0xff000000
-#define NV34TCL_VB_INDEX_BATCH_START_SHIFT 0
-#define NV34TCL_VB_INDEX_BATCH_START_MASK 0x00ffffff
-#define NV34TCL_POLYGON_MODE_FRONT 0x00001828
-#define NV34TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NV34TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NV34TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NV34TCL_POLYGON_MODE_BACK 0x0000182c
-#define NV34TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NV34TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NV34TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NV34TCL_CULL_FACE 0x00001830
-#define NV34TCL_CULL_FACE_FRONT 0x00000404
-#define NV34TCL_CULL_FACE_BACK 0x00000405
-#define NV34TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NV34TCL_FRONT_FACE 0x00001834
-#define NV34TCL_FRONT_FACE_CW 0x00000900
-#define NV34TCL_FRONT_FACE_CCW 0x00000901
-#define NV34TCL_POLYGON_SMOOTH_ENABLE 0x00001838
-#define NV34TCL_CULL_FACE_ENABLE 0x0000183c
-#define NV34TCL_TX_PALETTE_OFFSET(x) (0x00001840+((x)*4))
-#define NV34TCL_TX_PALETTE_OFFSET__SIZE 0x00000008
-#define NV34TCL_VTX_ATTR_2F_X(x) (0x00001880+((x)*8))
-#define NV34TCL_VTX_ATTR_2F_X__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_2F_Y(x) (0x00001884+((x)*8))
-#define NV34TCL_VTX_ATTR_2F_Y__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_2I(x) (0x00001900+((x)*4))
-#define NV34TCL_VTX_ATTR_2I__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_2I_X_SHIFT 0
-#define NV34TCL_VTX_ATTR_2I_X_MASK 0x0000ffff
-#define NV34TCL_VTX_ATTR_2I_Y_SHIFT 16
-#define NV34TCL_VTX_ATTR_2I_Y_MASK 0xffff0000
-#define NV34TCL_VTX_ATTR_4UB(x) (0x00001940+((x)*4))
-#define NV34TCL_VTX_ATTR_4UB__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4UB_X_SHIFT 0
-#define NV34TCL_VTX_ATTR_4UB_X_MASK 0x000000ff
-#define NV34TCL_VTX_ATTR_4UB_Y_SHIFT 8
-#define NV34TCL_VTX_ATTR_4UB_Y_MASK 0x0000ff00
-#define NV34TCL_VTX_ATTR_4UB_Z_SHIFT 16
-#define NV34TCL_VTX_ATTR_4UB_Z_MASK 0x00ff0000
-#define NV34TCL_VTX_ATTR_4UB_W_SHIFT 24
-#define NV34TCL_VTX_ATTR_4UB_W_MASK 0xff000000
-#define NV34TCL_VTX_ATTR_4I_XY(x) (0x00001980+((x)*8))
-#define NV34TCL_VTX_ATTR_4I_XY__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4I_XY_X_SHIFT 0
-#define NV34TCL_VTX_ATTR_4I_XY_X_MASK 0x0000ffff
-#define NV34TCL_VTX_ATTR_4I_XY_Y_SHIFT 16
-#define NV34TCL_VTX_ATTR_4I_XY_Y_MASK 0xffff0000
-#define NV34TCL_VTX_ATTR_4I_ZW(x) (0x00001984+((x)*8))
-#define NV34TCL_VTX_ATTR_4I_ZW__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4I_ZW_Z_SHIFT 0
-#define NV34TCL_VTX_ATTR_4I_ZW_Z_MASK 0x0000ffff
-#define NV34TCL_VTX_ATTR_4I_ZW_W_SHIFT 16
-#define NV34TCL_VTX_ATTR_4I_ZW_W_MASK 0xffff0000
-#define NV34TCL_TX_OFFSET(x) (0x00001a00+((x)*32))
-#define NV34TCL_TX_OFFSET__SIZE 0x00000008
-#define NV34TCL_TX_FORMAT(x) (0x00001a04+((x)*32))
-#define NV34TCL_TX_FORMAT__SIZE 0x00000008
-#define NV34TCL_TX_FORMAT_DMA0 (1 << 0)
-#define NV34TCL_TX_FORMAT_DMA1 (1 << 1)
-#define NV34TCL_TX_FORMAT_CUBIC (1 << 2)
-#define NV34TCL_TX_FORMAT_NO_BORDER (1 << 3)
-#define NV34TCL_TX_FORMAT_DIMS_SHIFT 4
-#define NV34TCL_TX_FORMAT_DIMS_MASK 0x000000f0
-#define NV34TCL_TX_FORMAT_DIMS_1D 0x00000010
-#define NV34TCL_TX_FORMAT_DIMS_2D 0x00000020
-#define NV34TCL_TX_FORMAT_DIMS_3D 0x00000030
-#define NV34TCL_TX_FORMAT_FORMAT_SHIFT 8
-#define NV34TCL_TX_FORMAT_FORMAT_MASK 0x0000ff00
-#define NV34TCL_TX_FORMAT_FORMAT_L8 0x00000000
-#define NV34TCL_TX_FORMAT_FORMAT_A8 0x00000100
-#define NV34TCL_TX_FORMAT_FORMAT_A1R5G5B5 0x00000200
-#define NV34TCL_TX_FORMAT_FORMAT_A4R4G4B4 0x00000400
-#define NV34TCL_TX_FORMAT_FORMAT_R5G6B5 0x00000500
-#define NV34TCL_TX_FORMAT_FORMAT_A8R8G8B8 0x00000600
-#define NV34TCL_TX_FORMAT_FORMAT_X8R8G8B8 0x00000700
-#define NV34TCL_TX_FORMAT_FORMAT_INDEX8 0x00000b00
-#define NV34TCL_TX_FORMAT_FORMAT_DXT1 0x00000c00
-#define NV34TCL_TX_FORMAT_FORMAT_DXT3 0x00000e00
-#define NV34TCL_TX_FORMAT_FORMAT_DXT5 0x00000f00
-#define NV34TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00001000
-#define NV34TCL_TX_FORMAT_FORMAT_R5G6B5_RECT 0x00001100
-#define NV34TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00001200
-#define NV34TCL_TX_FORMAT_FORMAT_L8_RECT 0x00001300
-#define NV34TCL_TX_FORMAT_FORMAT_DSDT8_RECT 0x00001700
-#define NV34TCL_TX_FORMAT_FORMAT_A8L8 0x00001a00
-#define NV34TCL_TX_FORMAT_FORMAT_A8_RECT 0x00001b00
-#define NV34TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT 0x00001d00
-#define NV34TCL_TX_FORMAT_FORMAT_R8G8B8_RECT 0x00001e00
-#define NV34TCL_TX_FORMAT_FORMAT_A8L8_RECT 0x00002000
-#define NV34TCL_TX_FORMAT_FORMAT_DSDT8 0x00002800
-#define NV34TCL_TX_FORMAT_FORMAT_Z24 0x2a00
-#define NV34TCL_TX_FORMAT_FORMAT_Z24_RECT 0x2b00 /* XXX: guess! */
-#define NV34TCL_TX_FORMAT_FORMAT_Z16 0x2c00
-#define NV34TCL_TX_FORMAT_FORMAT_Z16_RECT 0x2d00 /* XXX: guess! */
-#define NV34TCL_TX_FORMAT_FORMAT_HILO16 0x00003300
-#define NV34TCL_TX_FORMAT_FORMAT_HILO16_RECT 0x00003600
-#define NV34TCL_TX_FORMAT_FORMAT_HILO8 0x00004400
-#define NV34TCL_TX_FORMAT_FORMAT_SIGNED_HILO8 0x00004500
-#define NV34TCL_TX_FORMAT_FORMAT_HILO8_RECT 0x00004600
-#define NV34TCL_TX_FORMAT_FORMAT_SIGNED_HILO8_RECT 0x00004700
-#define NV34TCL_TX_FORMAT_FORMAT_A16 0x00003200
-#define NV34TCL_TX_FORMAT_FORMAT_A16_RECT 0x00003500
-#define NV34TCL_TX_FORMAT_FORMAT_FLOAT_RGBA16_NV 0x00004a00
-#define NV34TCL_TX_FORMAT_FORMAT_FLOAT_RGBA32_NV 0x00004b00
-#define NV34TCL_TX_FORMAT_FORMAT_FLOAT_R32_NV 0x00004c00
-#define NV34TCL_TX_FORMAT_MIPMAP (1 << 19)
-#define NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT 20
-#define NV34TCL_TX_FORMAT_BASE_SIZE_U_MASK 0x00f00000
-#define NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT 24
-#define NV34TCL_TX_FORMAT_BASE_SIZE_V_MASK 0x0f000000
-#define NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT 28
-#define NV34TCL_TX_FORMAT_BASE_SIZE_W_MASK 0xf0000000
-#define NV34TCL_TX_WRAP(x) (0x00001a08+((x)*32))
-#define NV34TCL_TX_WRAP__SIZE 0x00000008
-#define NV34TCL_TX_WRAP_S_SHIFT 0
-#define NV34TCL_TX_WRAP_S_MASK 0x000000ff
-#define NV34TCL_TX_WRAP_S_REPEAT 0x00000001
-#define NV34TCL_TX_WRAP_S_MIRRORED_REPEAT 0x00000002
-#define NV34TCL_TX_WRAP_S_CLAMP_TO_EDGE 0x00000003
-#define NV34TCL_TX_WRAP_S_CLAMP_TO_BORDER 0x00000004
-#define NV34TCL_TX_WRAP_S_CLAMP 0x00000005
-#define NV34TCL_TX_WRAP_T_SHIFT 8
-#define NV34TCL_TX_WRAP_T_MASK 0x00000f00
-#define NV34TCL_TX_WRAP_T_REPEAT 0x00000100
-#define NV34TCL_TX_WRAP_T_MIRRORED_REPEAT 0x00000200
-#define NV34TCL_TX_WRAP_T_CLAMP_TO_EDGE 0x00000300
-#define NV34TCL_TX_WRAP_T_CLAMP_TO_BORDER 0x00000400
-#define NV34TCL_TX_WRAP_T_CLAMP 0x00000500
-#define NV34TCL_TX_WRAP_EXPAND_NORMAL_SHIFT 12
-#define NV34TCL_TX_WRAP_EXPAND_NORMAL_MASK 0x0000f000
-#define NV34TCL_TX_WRAP_R_SHIFT 16
-#define NV34TCL_TX_WRAP_R_MASK 0x000f0000
-#define NV34TCL_TX_WRAP_R_REPEAT 0x00010000
-#define NV34TCL_TX_WRAP_R_MIRRORED_REPEAT 0x00020000
-#define NV34TCL_TX_WRAP_R_CLAMP_TO_EDGE 0x00030000
-#define NV34TCL_TX_WRAP_R_CLAMP_TO_BORDER 0x00040000
-#define NV34TCL_TX_WRAP_R_CLAMP 0x00050000
-#define NV34TCL_TX_WRAP_RCOMP_SHIFT 28
-#define NV34TCL_TX_WRAP_RCOMP_MASK 0xf0000000
-#define NV34TCL_TX_WRAP_RCOMP_NEVER 0x00000000
-#define NV34TCL_TX_WRAP_RCOMP_GREATER 0x10000000
-#define NV34TCL_TX_WRAP_RCOMP_EQUAL 0x20000000
-#define NV34TCL_TX_WRAP_RCOMP_GEQUAL 0x30000000
-#define NV34TCL_TX_WRAP_RCOMP_LESS 0x40000000
-#define NV34TCL_TX_WRAP_RCOMP_NOTEQUAL 0x50000000
-#define NV34TCL_TX_WRAP_RCOMP_LEQUAL 0x60000000
-#define NV34TCL_TX_WRAP_RCOMP_ALWAYS 0x70000000
-#define NV34TCL_TX_ENABLE(x) (0x00001a0c+((x)*32))
-#define NV34TCL_TX_ENABLE__SIZE 0x00000008
-#define NV34TCL_TX_ENABLE_ANISO_SHIFT 4
-#define NV34TCL_TX_ENABLE_ANISO_MASK 0x00000030
-#define NV34TCL_TX_ENABLE_ANISO_NONE 0x00000000
-#define NV34TCL_TX_ENABLE_ANISO_2X 0x00000010
-#define NV34TCL_TX_ENABLE_ANISO_4X 0x00000020
-#define NV34TCL_TX_ENABLE_ANISO_8X 0x00000030
-#define NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT 14
-#define NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_MASK 0x0003c000
-#define NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT 26
-#define NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_MASK 0x3c000000
-#define NV34TCL_TX_ENABLE_ENABLE (1 << 30)
-#define NV34TCL_TX_SWIZZLE(x) (0x00001a10+((x)*32))
-#define NV34TCL_TX_SWIZZLE__SIZE 0x00000008
-#define NV34TCL_TX_SWIZZLE_S0_X_SHIFT 14
-#define NV34TCL_TX_SWIZZLE_S0_X_MASK 0x0000c000
-#define NV34TCL_TX_SWIZZLE_S0_X_ZERO 0x00000000
-#define NV34TCL_TX_SWIZZLE_S0_X_ONE 0x00004000
-#define NV34TCL_TX_SWIZZLE_S0_X_S1 0x00008000
-#define NV34TCL_TX_SWIZZLE_S0_Y_SHIFT 12
-#define NV34TCL_TX_SWIZZLE_S0_Y_MASK 0x00003000
-#define NV34TCL_TX_SWIZZLE_S0_Y_ZERO 0x00000000
-#define NV34TCL_TX_SWIZZLE_S0_Y_ONE 0x00001000
-#define NV34TCL_TX_SWIZZLE_S0_Y_S1 0x00002000
-#define NV34TCL_TX_SWIZZLE_S0_Z_SHIFT 10
-#define NV34TCL_TX_SWIZZLE_S0_Z_MASK 0x00000c00
-#define NV34TCL_TX_SWIZZLE_S0_Z_ZERO 0x00000000
-#define NV34TCL_TX_SWIZZLE_S0_Z_ONE 0x00000400
-#define NV34TCL_TX_SWIZZLE_S0_Z_S1 0x00000800
-#define NV34TCL_TX_SWIZZLE_S0_W_SHIFT 8
-#define NV34TCL_TX_SWIZZLE_S0_W_MASK 0x00000300
-#define NV34TCL_TX_SWIZZLE_S0_W_ZERO 0x00000000
-#define NV34TCL_TX_SWIZZLE_S0_W_ONE 0x00000100
-#define NV34TCL_TX_SWIZZLE_S0_W_S1 0x00000200
-#define NV34TCL_TX_SWIZZLE_S1_X_SHIFT 6
-#define NV34TCL_TX_SWIZZLE_S1_X_MASK 0x000000c0
-#define NV34TCL_TX_SWIZZLE_S1_X_W 0x00000000
-#define NV34TCL_TX_SWIZZLE_S1_X_Z 0x00000040
-#define NV34TCL_TX_SWIZZLE_S1_X_Y 0x00000080
-#define NV34TCL_TX_SWIZZLE_S1_X_X 0x000000c0
-#define NV34TCL_TX_SWIZZLE_S1_Y_SHIFT 4
-#define NV34TCL_TX_SWIZZLE_S1_Y_MASK 0x00000030
-#define NV34TCL_TX_SWIZZLE_S1_Y_W 0x00000000
-#define NV34TCL_TX_SWIZZLE_S1_Y_Z 0x00000010
-#define NV34TCL_TX_SWIZZLE_S1_Y_Y 0x00000020
-#define NV34TCL_TX_SWIZZLE_S1_Y_X 0x00000030
-#define NV34TCL_TX_SWIZZLE_S1_Z_SHIFT 2
-#define NV34TCL_TX_SWIZZLE_S1_Z_MASK 0x0000000c
-#define NV34TCL_TX_SWIZZLE_S1_Z_W 0x00000000
-#define NV34TCL_TX_SWIZZLE_S1_Z_Z 0x00000004
-#define NV34TCL_TX_SWIZZLE_S1_Z_Y 0x00000008
-#define NV34TCL_TX_SWIZZLE_S1_Z_X 0x0000000c
-#define NV34TCL_TX_SWIZZLE_S1_W_SHIFT 0
-#define NV34TCL_TX_SWIZZLE_S1_W_MASK 0x00000003
-#define NV34TCL_TX_SWIZZLE_S1_W_W 0x00000000
-#define NV34TCL_TX_SWIZZLE_S1_W_Z 0x00000001
-#define NV34TCL_TX_SWIZZLE_S1_W_Y 0x00000002
-#define NV34TCL_TX_SWIZZLE_S1_W_X 0x00000003
-#define NV34TCL_TX_SWIZZLE_RECT_PITCH_SHIFT 16
-#define NV34TCL_TX_SWIZZLE_RECT_PITCH_MASK 0xffff0000
-#define NV34TCL_TX_FILTER(x) (0x00001a14+((x)*32))
-#define NV34TCL_TX_FILTER__SIZE 0x00000008
-#define NV34TCL_TX_FILTER_LOD_BIAS_SHIFT 8
-#define NV34TCL_TX_FILTER_LOD_BIAS_MASK 0x00000f00
-#define NV34TCL_TX_FILTER_MINIFY_SHIFT 16
-#define NV34TCL_TX_FILTER_MINIFY_MASK 0x000f0000
-#define NV34TCL_TX_FILTER_MINIFY_NEAREST 0x00010000
-#define NV34TCL_TX_FILTER_MINIFY_LINEAR 0x00020000
-#define NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x00030000
-#define NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x00040000
-#define NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x00050000
-#define NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x00060000
-#define NV34TCL_TX_FILTER_MAGNIFY_SHIFT 24
-#define NV34TCL_TX_FILTER_MAGNIFY_MASK 0x0f000000
-#define NV34TCL_TX_FILTER_MAGNIFY_NEAREST 0x01000000
-#define NV34TCL_TX_FILTER_MAGNIFY_LINEAR 0x02000000
-#define NV34TCL_TX_FILTER_SIGNED_BLUE (1 << 28)
-#define NV34TCL_TX_FILTER_SIGNED_GREEN (1 << 29)
-#define NV34TCL_TX_FILTER_SIGNED_RED (1 << 30)
-#define NV34TCL_TX_FILTER_SIGNED_ALPHA (1 << 31)
-#define NV34TCL_TX_NPOT_SIZE(x) (0x00001a18+((x)*32))
-#define NV34TCL_TX_NPOT_SIZE__SIZE 0x00000008
-#define NV34TCL_TX_NPOT_SIZE_H_SHIFT 0
-#define NV34TCL_TX_NPOT_SIZE_H_MASK 0x0000ffff
-#define NV34TCL_TX_NPOT_SIZE_W_SHIFT 16
-#define NV34TCL_TX_NPOT_SIZE_W_MASK 0xffff0000
-#define NV34TCL_TX_BORDER_COLOR(x) (0x00001a1c+((x)*32))
-#define NV34TCL_TX_BORDER_COLOR__SIZE 0x00000008
-#define NV34TCL_TX_BORDER_COLOR_B_SHIFT 0
-#define NV34TCL_TX_BORDER_COLOR_B_MASK 0x000000ff
-#define NV34TCL_TX_BORDER_COLOR_G_SHIFT 8
-#define NV34TCL_TX_BORDER_COLOR_G_MASK 0x0000ff00
-#define NV34TCL_TX_BORDER_COLOR_R_SHIFT 16
-#define NV34TCL_TX_BORDER_COLOR_R_MASK 0x00ff0000
-#define NV34TCL_TX_BORDER_COLOR_A_SHIFT 24
-#define NV34TCL_TX_BORDER_COLOR_A_MASK 0xff000000
-#define NV34TCL_VTX_ATTR_4F_X(x) (0x00001c00+((x)*16))
-#define NV34TCL_VTX_ATTR_4F_X__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4F_Y(x) (0x00001c04+((x)*16))
-#define NV34TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4F_Z(x) (0x00001c08+((x)*16))
-#define NV34TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
-#define NV34TCL_VTX_ATTR_4F_W(x) (0x00001c0c+((x)*16))
-#define NV34TCL_VTX_ATTR_4F_W__SIZE 0x00000010
-#define NV34TCL_FP_CONTROL 0x00001d60
-#define NV34TCL_FP_CONTROL_USES_KIL (1 << 7)
-#define NV34TCL_FP_CONTROL_USED_REGS_MINUS1_DIV2_SHIFT 0
-#define NV34TCL_FP_CONTROL_USED_REGS_MINUS1_DIV2_MASK 0x0000000f
-#define NV34TCL_DEPTH_UNK17D8 0x00001d78
-#define NV34TCL_DEPTH_UNK17D8_CLAMP_SHIFT 4
-#define NV34TCL_DEPTH_UNK17D8_CLAMP_MASK 0x000000f0
-#define NV34TCL_MULTISAMPLE_CONTROL 0x00001d7c
-#define NV34TCL_MULTISAMPLE_CONTROL_ENABLE (1 << 0)
-#define NV34TCL_MULTISAMPLE_CONTROL_SAMPLE_ALPHA_TO_COVERAGE (1 << 4)
-#define NV34TCL_MULTISAMPLE_CONTROL_SAMPLE_ALPHA_TO_ONE (1 << 8)
-#define NV34TCL_MULTISAMPLE_CONTROL_SAMPLE_COVERAGE_SHIFT 16
-#define NV34TCL_MULTISAMPLE_CONTROL_SAMPLE_COVERAGE_MASK 0xffff0000
-#define NV34TCL_CLEAR_DEPTH_VALUE 0x00001d8c
-#define NV34TCL_CLEAR_COLOR_VALUE 0x00001d90
-#define NV34TCL_CLEAR_COLOR_VALUE_B_SHIFT 0
-#define NV34TCL_CLEAR_COLOR_VALUE_B_MASK 0x000000ff
-#define NV34TCL_CLEAR_COLOR_VALUE_G_SHIFT 8
-#define NV34TCL_CLEAR_COLOR_VALUE_G_MASK 0x0000ff00
-#define NV34TCL_CLEAR_COLOR_VALUE_R_SHIFT 16
-#define NV34TCL_CLEAR_COLOR_VALUE_R_MASK 0x00ff0000
-#define NV34TCL_CLEAR_COLOR_VALUE_A_SHIFT 24
-#define NV34TCL_CLEAR_COLOR_VALUE_A_MASK 0xff000000
-#define NV34TCL_CLEAR_BUFFERS 0x00001d94
-#define NV34TCL_CLEAR_BUFFERS_COLOR_A (1 << 7)
-#define NV34TCL_CLEAR_BUFFERS_COLOR_B (1 << 6)
-#define NV34TCL_CLEAR_BUFFERS_COLOR_G (1 << 5)
-#define NV34TCL_CLEAR_BUFFERS_COLOR_R (1 << 4)
-#define NV34TCL_CLEAR_BUFFERS_STENCIL (1 << 1)
-#define NV34TCL_CLEAR_BUFFERS_DEPTH (1 << 0)
-#define NV34TCL_DO_VERTICES 0x00001dac
-#define NV34TCL_LINE_STIPPLE_ENABLE 0x00001db4
-#define NV34TCL_LINE_STIPPLE_PATTERN 0x00001db8
-#define NV34TCL_LINE_STIPPLE_PATTERN_FACTOR_SHIFT 0
-#define NV34TCL_LINE_STIPPLE_PATTERN_FACTOR_MASK 0x0000ffff
-#define NV34TCL_LINE_STIPPLE_PATTERN_PATTERN_SHIFT 16
-#define NV34TCL_LINE_STIPPLE_PATTERN_PATTERN_MASK 0xffff0000
-#define NV34TCL_BACK_MATERIAL_SHININESS(x) (0x00001e20+((x)*4))
-#define NV34TCL_BACK_MATERIAL_SHININESS__SIZE 0x00000006
-#define NV34TCL_VTX_ATTR_1F(x) (0x00001e40+((x)*4))
-#define NV34TCL_VTX_ATTR_1F__SIZE 0x00000010
-#define NV34TCL_ENGINE 0x00001e94
-#define NV34TCL_ENGINE_FP (1 << 0)
-#define NV34TCL_ENGINE_VP (1 << 1)
-#define NV34TCL_ENGINE_FIXED (1 << 2)
-#define NV34TCL_VP_UPLOAD_FROM_ID 0x00001e9c
-#define NV34TCL_VP_START_FROM_ID 0x00001ea0
-#define NV34TCL_POINT_PARAMETERS(x) (0x00001ec0+((x)*4))
-#define NV34TCL_POINT_PARAMETERS__SIZE 0x00000008
-#define NV34TCL_POINT_SIZE 0x00001ee0
-#define NV34TCL_POINT_PARAMETERS_ENABLE 0x00001ee4
-#define NV34TCL_POINT_SPRITE 0x00001ee8
-#define NV34TCL_POINT_SPRITE_ENABLE (1 << 0)
-#define NV34TCL_POINT_SPRITE_R_MODE_SHIFT 1
-#define NV34TCL_POINT_SPRITE_R_MODE_MASK 0x00000006
-#define NV34TCL_POINT_SPRITE_R_MODE_ZERO 0x00000000
-#define NV34TCL_POINT_SPRITE_R_MODE_R 0x00000002
-#define NV34TCL_POINT_SPRITE_R_MODE_S 0x00000004
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_0 (1 << 8)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_1 (1 << 9)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_2 (1 << 10)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_3 (1 << 11)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_4 (1 << 12)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_5 (1 << 13)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_6 (1 << 14)
-#define NV34TCL_POINT_SPRITE_COORD_REPLACE_7 (1 << 15)
-#define NV34TCL_VP_UPLOAD_CONST_ID 0x00001efc
-#define NV34TCL_VP_UPLOAD_CONST_X(x) (0x00001f00+((x)*16))
-#define NV34TCL_VP_UPLOAD_CONST_X__SIZE 0x00000004
-#define NV34TCL_VP_UPLOAD_CONST_Y(x) (0x00001f04+((x)*16))
-#define NV34TCL_VP_UPLOAD_CONST_Y__SIZE 0x00000004
-#define NV34TCL_VP_UPLOAD_CONST_Z(x) (0x00001f08+((x)*16))
-#define NV34TCL_VP_UPLOAD_CONST_Z__SIZE 0x00000004
-#define NV34TCL_VP_UPLOAD_CONST_W(x) (0x00001f0c+((x)*16))
-#define NV34TCL_VP_UPLOAD_CONST_W__SIZE 0x00000004
-#define NV34TCL_UNK1f80(x) (0x00001f80+((x)*4))
-#define NV34TCL_UNK1f80__SIZE 0x00000010
-
-
-#define NV40TCL 0x00004097
-
-#define NV40TCL_REF_CNT 0x00000050
-#define NV40TCL_NOP 0x00000100
-#define NV40TCL_NOTIFY 0x00000104
-#define NV40TCL_DMA_NOTIFY 0x00000180
-#define NV40TCL_DMA_TEXTURE0 0x00000184
-#define NV40TCL_DMA_TEXTURE1 0x00000188
-#define NV40TCL_DMA_COLOR1 0x0000018c
-#define NV40TCL_DMA_COLOR0 0x00000194
-#define NV40TCL_DMA_ZETA 0x00000198
-#define NV40TCL_DMA_VTXBUF0 0x0000019c
-#define NV40TCL_DMA_VTXBUF1 0x000001a0
-#define NV40TCL_DMA_FENCE 0x000001a4
-#define NV40TCL_DMA_QUERY 0x000001a8
-#define NV40TCL_DMA_UNK01AC 0x000001ac
-#define NV40TCL_DMA_UNK01B0 0x000001b0
-#define NV40TCL_DMA_COLOR2 0x000001b4
-#define NV40TCL_DMA_COLOR3 0x000001b8
-#define NV40TCL_RT_HORIZ 0x00000200
-#define NV40TCL_RT_HORIZ_W_SHIFT 16
-#define NV40TCL_RT_HORIZ_W_MASK 0xffff0000
-#define NV40TCL_RT_HORIZ_X_SHIFT 0
-#define NV40TCL_RT_HORIZ_X_MASK 0x0000ffff
-#define NV40TCL_RT_VERT 0x00000204
-#define NV40TCL_RT_VERT_H_SHIFT 16
-#define NV40TCL_RT_VERT_H_MASK 0xffff0000
-#define NV40TCL_RT_VERT_Y_SHIFT 0
-#define NV40TCL_RT_VERT_Y_MASK 0x0000ffff
-#define NV40TCL_RT_FORMAT 0x00000208
-#define NV40TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT 24
-#define NV40TCL_RT_FORMAT_LOG2_HEIGHT_MASK 0xff000000
-#define NV40TCL_RT_FORMAT_LOG2_WIDTH_SHIFT 16
-#define NV40TCL_RT_FORMAT_LOG2_WIDTH_MASK 0x00ff0000
-#define NV40TCL_RT_FORMAT_TYPE_SHIFT 8
-#define NV40TCL_RT_FORMAT_TYPE_MASK 0x00000f00
-#define NV40TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
-#define NV40TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
-#define NV40TCL_RT_FORMAT_ZETA_SHIFT 5
-#define NV40TCL_RT_FORMAT_ZETA_MASK 0x000000e0
-#define NV40TCL_RT_FORMAT_ZETA_Z16 0x00000020
-#define NV40TCL_RT_FORMAT_ZETA_Z24S8 0x00000040
-#define NV40TCL_RT_FORMAT_COLOR_SHIFT 0
-#define NV40TCL_RT_FORMAT_COLOR_MASK 0x0000001f
-#define NV40TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
-#define NV40TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
-#define NV40TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
-#define NV40TCL_RT_FORMAT_COLOR_B8 0x00000009
-#define NV40TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
-#define NV40TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
-#define NV40TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
-#define NV40TCL_COLOR0_PITCH 0x0000020c
-#define NV40TCL_COLOR0_OFFSET 0x00000210
-#define NV40TCL_ZETA_OFFSET 0x00000214
-#define NV40TCL_COLOR1_OFFSET 0x00000218
-#define NV40TCL_COLOR1_PITCH 0x0000021c
-#define NV40TCL_RT_ENABLE 0x00000220
-#define NV40TCL_RT_ENABLE_MRT (1 << 4)
-#define NV40TCL_RT_ENABLE_COLOR3 (1 << 3)
-#define NV40TCL_RT_ENABLE_COLOR2 (1 << 2)
-#define NV40TCL_RT_ENABLE_COLOR1 (1 << 1)
-#define NV40TCL_RT_ENABLE_COLOR0 (1 << 0)
-#define NV40TCL_ZETA_PITCH 0x0000022c
-#define NV40TCL_COLOR2_PITCH 0x00000280
-#define NV40TCL_COLOR3_PITCH 0x00000284
-#define NV40TCL_COLOR2_OFFSET 0x00000288
-#define NV40TCL_COLOR3_OFFSET 0x0000028c
-#define NV40TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*8))
-#define NV40TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NV40TCL_VIEWPORT_CLIP_VERT(x) (0x000002c4+((x)*8))
-#define NV40TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NV40TCL_DITHER_ENABLE 0x00000300
-#define NV40TCL_ALPHA_TEST_ENABLE 0x00000304
-#define NV40TCL_ALPHA_TEST_FUNC 0x00000308
-#define NV40TCL_ALPHA_TEST_FUNC_NEVER 0x00000200
-#define NV40TCL_ALPHA_TEST_FUNC_LESS 0x00000201
-#define NV40TCL_ALPHA_TEST_FUNC_EQUAL 0x00000202
-#define NV40TCL_ALPHA_TEST_FUNC_LEQUAL 0x00000203
-#define NV40TCL_ALPHA_TEST_FUNC_GREATER 0x00000204
-#define NV40TCL_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
-#define NV40TCL_ALPHA_TEST_FUNC_GEQUAL 0x00000206
-#define NV40TCL_ALPHA_TEST_FUNC_ALWAYS 0x00000207
-#define NV40TCL_ALPHA_TEST_REF 0x0000030c
-#define NV40TCL_BLEND_ENABLE 0x00000310
-#define NV40TCL_BLEND_FUNC_SRC 0x00000314
-#define NV40TCL_BLEND_FUNC_SRC_RGB_SHIFT 0
-#define NV40TCL_BLEND_FUNC_SRC_RGB_MASK 0x0000ffff
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00000000
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE 0x00000001
-#define NV40TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00000300
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV40TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00000302
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV40TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00000304
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV40TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00000306
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00000307
-#define NV40TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00000308
-#define NV40TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x00008001
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV40TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x00008003
-#define NV40TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_SHIFT 16
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_MASK 0xffff0000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00000000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00010000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x03000000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x03020000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x03040000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x03060000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x03080000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x80010000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x80030000
-#define NV40TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
-#define NV40TCL_BLEND_FUNC_DST 0x00000318
-#define NV40TCL_BLEND_FUNC_DST_RGB_SHIFT 0
-#define NV40TCL_BLEND_FUNC_DST_RGB_MASK 0x0000ffff
-#define NV40TCL_BLEND_FUNC_DST_RGB_ZERO 0x00000000
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE 0x00000001
-#define NV40TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00000300
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00000301
-#define NV40TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00000302
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
-#define NV40TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00000304
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00000305
-#define NV40TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00000306
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00000307
-#define NV40TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00000308
-#define NV40TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x00008001
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
-#define NV40TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x00008003
-#define NV40TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_SHIFT 16
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_MASK 0xffff0000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00000000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00010000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x03000000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x03020000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x03040000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x03060000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x03080000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x80010000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x80030000
-#define NV40TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
-#define NV40TCL_BLEND_COLOR 0x0000031c
-#define NV40TCL_BLEND_COLOR_B_SHIFT 0
-#define NV40TCL_BLEND_COLOR_B_MASK 0x000000ff
-#define NV40TCL_BLEND_COLOR_G_SHIFT 8
-#define NV40TCL_BLEND_COLOR_G_MASK 0x0000ff00
-#define NV40TCL_BLEND_COLOR_R_SHIFT 16
-#define NV40TCL_BLEND_COLOR_R_MASK 0x00ff0000
-#define NV40TCL_BLEND_COLOR_A_SHIFT 24
-#define NV40TCL_BLEND_COLOR_A_MASK 0xff000000
-#define NV40TCL_BLEND_EQUATION 0x00000320
-#define NV40TCL_BLEND_EQUATION_RGB_SHIFT 0
-#define NV40TCL_BLEND_EQUATION_RGB_MASK 0x0000ffff
-#define NV40TCL_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
-#define NV40TCL_BLEND_EQUATION_RGB_MIN 0x00008007
-#define NV40TCL_BLEND_EQUATION_RGB_MAX 0x00008008
-#define NV40TCL_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
-#define NV40TCL_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV40TCL_BLEND_EQUATION_ALPHA_SHIFT 16
-#define NV40TCL_BLEND_EQUATION_ALPHA_MASK 0xffff0000
-#define NV40TCL_BLEND_EQUATION_ALPHA_FUNC_ADD 0x80060000
-#define NV40TCL_BLEND_EQUATION_ALPHA_MIN 0x80070000
-#define NV40TCL_BLEND_EQUATION_ALPHA_MAX 0x80080000
-#define NV40TCL_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x800a0000
-#define NV40TCL_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x800b0000
-#define NV40TCL_COLOR_MASK 0x00000324
-#define NV40TCL_COLOR_MASK_BUFFER0_B_SHIFT 0
-#define NV40TCL_COLOR_MASK_BUFFER0_B_MASK 0x000000ff
-#define NV40TCL_COLOR_MASK_BUFFER0_G_SHIFT 8
-#define NV40TCL_COLOR_MASK_BUFFER0_G_MASK 0x0000ff00
-#define NV40TCL_COLOR_MASK_BUFFER0_R_SHIFT 16
-#define NV40TCL_COLOR_MASK_BUFFER0_R_MASK 0x00ff0000
-#define NV40TCL_COLOR_MASK_BUFFER0_A_SHIFT 24
-#define NV40TCL_COLOR_MASK_BUFFER0_A_MASK 0xff000000
-#define NV40TCL_STENCIL_FRONT_ENABLE 0x00000328
-#define NV40TCL_STENCIL_FRONT_MASK 0x0000032c
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC 0x00000330
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
-#define NV40TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
-#define NV40TCL_STENCIL_FRONT_FUNC_REF 0x00000334
-#define NV40TCL_STENCIL_FRONT_FUNC_MASK 0x00000338
-#define NV40TCL_STENCIL_FRONT_OP_FAIL 0x0000033c
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL 0x00000340
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS 0x00000344
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV40TCL_STENCIL_BACK_ENABLE 0x00000348
-#define NV40TCL_STENCIL_BACK_MASK 0x0000034c
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC 0x00000350
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
-#define NV40TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
-#define NV40TCL_STENCIL_BACK_FUNC_REF 0x00000354
-#define NV40TCL_STENCIL_BACK_FUNC_MASK 0x00000358
-#define NV40TCL_STENCIL_BACK_OP_FAIL 0x0000035c
-#define NV40TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
-#define NV40TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
-#define NV40TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
-#define NV40TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
-#define NV40TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
-#define NV40TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL 0x00000360
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV40TCL_STENCIL_BACK_OP_ZPASS 0x00000364
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV40TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV40TCL_SHADE_MODEL 0x00000368
-#define NV40TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NV40TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NV40TCL_MRT_COLOR_MASK 0x00000370
-#define NV40TCL_MRT_COLOR_MASK_BUFFER1_A (1 << 4)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER1_R (1 << 5)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER1_G (1 << 6)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER1_B (1 << 7)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER2_A (1 << 8)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER2_R (1 << 9)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER2_G (1 << 10)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER2_B (1 << 11)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER3_A (1 << 12)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER3_R (1 << 13)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER3_G (1 << 14)
-#define NV40TCL_MRT_COLOR_MASK_BUFFER3_B (1 << 15)
-#define NV40TCL_COLOR_LOGIC_OP_ENABLE 0x00000374
-#define NV40TCL_COLOR_LOGIC_OP 0x00000378
-#define NV40TCL_COLOR_LOGIC_OP_CLEAR 0x00001500
-#define NV40TCL_COLOR_LOGIC_OP_AND 0x00001501
-#define NV40TCL_COLOR_LOGIC_OP_AND_REVERSE 0x00001502
-#define NV40TCL_COLOR_LOGIC_OP_COPY 0x00001503
-#define NV40TCL_COLOR_LOGIC_OP_AND_INVERTED 0x00001504
-#define NV40TCL_COLOR_LOGIC_OP_NOOP 0x00001505
-#define NV40TCL_COLOR_LOGIC_OP_XOR 0x00001506
-#define NV40TCL_COLOR_LOGIC_OP_OR 0x00001507
-#define NV40TCL_COLOR_LOGIC_OP_NOR 0x00001508
-#define NV40TCL_COLOR_LOGIC_OP_EQUIV 0x00001509
-#define NV40TCL_COLOR_LOGIC_OP_INVERT 0x0000150a
-#define NV40TCL_COLOR_LOGIC_OP_OR_REVERSE 0x0000150b
-#define NV40TCL_COLOR_LOGIC_OP_COPY_INVERTED 0x0000150c
-#define NV40TCL_COLOR_LOGIC_OP_OR_INVERTED 0x0000150d
-#define NV40TCL_COLOR_LOGIC_OP_NAND 0x0000150e
-#define NV40TCL_COLOR_LOGIC_OP_SET 0x0000150f
-#define NV40TCL_DEPTH_RANGE_NEAR 0x00000394
-#define NV40TCL_DEPTH_RANGE_FAR 0x00000398
-#define NV40TCL_LINE_WIDTH 0x000003b8
-#define NV40TCL_LINE_SMOOTH_ENABLE 0x000003bc
-#define NV40TCL_UNK03C0(x) (0x000003c0+((x)*4))
-#define NV40TCL_UNK03C0__SIZE 0x00000010
-#define NV40TCL_UNK0400(x) (0x00000400+((x)*4))
-#define NV40TCL_UNK0400__SIZE 0x00000010
-#define NV40TCL_UNK0440(x) (0x00000440+((x)*4))
-#define NV40TCL_UNK0440__SIZE 0x00000020
-#define NV40TCL_SCISSOR_HORIZ 0x000008c0
-#define NV40TCL_SCISSOR_HORIZ_X_SHIFT 0
-#define NV40TCL_SCISSOR_HORIZ_X_MASK 0x0000ffff
-#define NV40TCL_SCISSOR_HORIZ_W_SHIFT 16
-#define NV40TCL_SCISSOR_HORIZ_W_MASK 0xffff0000
-#define NV40TCL_SCISSOR_VERT 0x000008c4
-#define NV40TCL_SCISSOR_VERT_Y_SHIFT 0
-#define NV40TCL_SCISSOR_VERT_Y_MASK 0x0000ffff
-#define NV40TCL_SCISSOR_VERT_H_SHIFT 16
-#define NV40TCL_SCISSOR_VERT_H_MASK 0xffff0000
-#define NV40TCL_FOG_MODE 0x000008cc
-#define NV40TCL_FOG_EQUATION_CONSTANT 0x000008d0
-#define NV40TCL_FOG_EQUATION_LINEAR 0x000008d4
-#define NV40TCL_FOG_EQUATION_QUADRATIC 0x000008d8
-#define NV40TCL_FP_ADDRESS 0x000008e4
-#define NV40TCL_FP_ADDRESS_OFFSET_SHIFT 8
-#define NV40TCL_FP_ADDRESS_OFFSET_MASK 0xffffff00
-#define NV40TCL_FP_ADDRESS_DMA1 (1 << 1)
-#define NV40TCL_FP_ADDRESS_DMA0 (1 << 0)
-#define NV40TCL_VIEWPORT_HORIZ 0x00000a00
-#define NV40TCL_VIEWPORT_HORIZ_W_SHIFT 16
-#define NV40TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
-#define NV40TCL_VIEWPORT_HORIZ_X_SHIFT 0
-#define NV40TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
-#define NV40TCL_VIEWPORT_VERT 0x00000a04
-#define NV40TCL_VIEWPORT_VERT_H_SHIFT 16
-#define NV40TCL_VIEWPORT_VERT_H_MASK 0xffff0000
-#define NV40TCL_VIEWPORT_VERT_Y_SHIFT 0
-#define NV40TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
-#define NV40TCL_VIEWPORT_TRANSLATE_X 0x00000a20
-#define NV40TCL_VIEWPORT_TRANSLATE_Y 0x00000a24
-#define NV40TCL_VIEWPORT_TRANSLATE_Z 0x00000a28
-#define NV40TCL_VIEWPORT_TRANSLATE_W 0x00000a2c
-#define NV40TCL_VIEWPORT_SCALE_X 0x00000a30
-#define NV40TCL_VIEWPORT_SCALE_Y 0x00000a34
-#define NV40TCL_VIEWPORT_SCALE_Z 0x00000a38
-#define NV40TCL_VIEWPORT_SCALE_W 0x00000a3c
-#define NV40TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000a60
-#define NV40TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000a64
-#define NV40TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000a68
-#define NV40TCL_DEPTH_FUNC 0x00000a6c
-#define NV40TCL_DEPTH_FUNC_NEVER 0x00000200
-#define NV40TCL_DEPTH_FUNC_LESS 0x00000201
-#define NV40TCL_DEPTH_FUNC_EQUAL 0x00000202
-#define NV40TCL_DEPTH_FUNC_LEQUAL 0x00000203
-#define NV40TCL_DEPTH_FUNC_GREATER 0x00000204
-#define NV40TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
-#define NV40TCL_DEPTH_FUNC_GEQUAL 0x00000206
-#define NV40TCL_DEPTH_FUNC_ALWAYS 0x00000207
-#define NV40TCL_DEPTH_WRITE_ENABLE 0x00000a70
-#define NV40TCL_DEPTH_TEST_ENABLE 0x00000a74
-#define NV40TCL_POLYGON_OFFSET_FACTOR 0x00000a78
-#define NV40TCL_POLYGON_OFFSET_UNITS 0x00000a7c
-#define NV40TCL_VTX_ATTR_3I_XY(x) (0x00000a80+((x)*8))
-#define NV40TCL_VTX_ATTR_3I_XY__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_3I_XY_X_SHIFT 0
-#define NV40TCL_VTX_ATTR_3I_XY_X_MASK 0x0000ffff
-#define NV40TCL_VTX_ATTR_3I_XY_Y_SHIFT 16
-#define NV40TCL_VTX_ATTR_3I_XY_Y_MASK 0xffff0000
-#define NV40TCL_VTX_ATTR_3I_Z(x) (0x00000a84+((x)*8))
-#define NV40TCL_VTX_ATTR_3I_Z__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_3I_Z_Z_SHIFT 0
-#define NV40TCL_VTX_ATTR_3I_Z_Z_MASK 0x0000ffff
-#define NV40TCL_TEX_FILTER_OPTIMIZATION 0x00000b00
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_SHIFT 0
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_MASK 0x0000001f
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_OFF 0x00000000
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_HIGH_QUALITY 0x00000004
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_QUALITY 0x00000006
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_PERFORMANCE 0x00000008
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_TRILINEAR_HIGH_PERFORMANCE 0x00000018
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_SHIFT 6
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_MASK 0x000001c0
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_OFF 0x00000000
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_HIGH_QUALITY 0x000000c0
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_QUALITY 0x000001c0
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_PERFORMANCE 0x00000140
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_UNKNOWN_SHIFT 10
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_UNKNOWN_MASK 0x00007c00
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_UNKNOWN_OFF 0x00000000
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_UNKNOWN_PARTIAL 0x00002c00
-#define NV40TCL_TEX_FILTER_OPTIMIZATION_UNKNOWN_FULL 0x00007c00
-#define NV40TCL_UNK0B40(x) (0x00000b40+((x)*4))
-#define NV40TCL_UNK0B40__SIZE 0x00000008
-#define NV40TCL_VP_UPLOAD_INST(x) (0x00000b80+((x)*4))
-#define NV40TCL_VP_UPLOAD_INST__SIZE 0x00000004
-#define NV40TCL_VERTEX_TWO_SIDE_ENABLE 0x0000142c
-#define NV40TCL_CLIP_PLANE_ENABLE 0x00001478
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE0 (1 << 1)
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE1 (1 << 5)
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE2 (1 << 9)
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE3 (1 << 13)
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE4 (1 << 17)
-#define NV40TCL_CLIP_PLANE_ENABLE_PLANE5 (1 << 21)
-#define NV40TCL_POLYGON_STIPPLE_ENABLE 0x0000147c
-#define NV40TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001480+((x)*4))
-#define NV40TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NV40TCL_VTX_ATTR_3F_X(x) (0x00001500+((x)*16))
-#define NV40TCL_VTX_ATTR_3F_X__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_3F_Y(x) (0x00001504+((x)*16))
-#define NV40TCL_VTX_ATTR_3F_Y__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_3F_Z(x) (0x00001508+((x)*16))
-#define NV40TCL_VTX_ATTR_3F_Z__SIZE 0x00000010
-#define NV40TCL_VTXBUF_ADDRESS(x) (0x00001680+((x)*4))
-#define NV40TCL_VTXBUF_ADDRESS__SIZE 0x00000010
-#define NV40TCL_VTXBUF_ADDRESS_DMA1 (1 << 31)
-#define NV40TCL_VTXBUF_ADDRESS_OFFSET_SHIFT 0
-#define NV40TCL_VTXBUF_ADDRESS_OFFSET_MASK 0x0fffffff
-#define NV40TCL_VTX_CACHE_INVALIDATE 0x00001714
-#define NV40TCL_VTXFMT(x) (0x00001740+((x)*4))
-#define NV40TCL_VTXFMT__SIZE 0x00000010
-#define NV40TCL_VTXFMT_TYPE_SHIFT 0
-#define NV40TCL_VTXFMT_TYPE_MASK 0x0000000f
-#define NV40TCL_VTXFMT_TYPE_FLOAT 0x00000002
-#define NV40TCL_VTXFMT_TYPE_HALF 0x00000003
-#define NV40TCL_VTXFMT_TYPE_UBYTE 0x00000004
-#define NV40TCL_VTXFMT_TYPE_USHORT 0x00000005
-#define NV40TCL_VTXFMT_SIZE_SHIFT 4
-#define NV40TCL_VTXFMT_SIZE_MASK 0x000000f0
-#define NV40TCL_VTXFMT_STRIDE_SHIFT 8
-#define NV40TCL_VTXFMT_STRIDE_MASK 0x0000ff00
-#define NV40TCL_QUERY_RESET 0x000017c8
-#define NV40TCL_QUERY_UNK17CC 0x000017cc
-#define NV40TCL_QUERY_GET 0x00001800
-#define NV40TCL_QUERY_GET_UNK24_SHIFT 24
-#define NV40TCL_QUERY_GET_UNK24_MASK 0xff000000
-#define NV40TCL_QUERY_GET_OFFSET_SHIFT 0
-#define NV40TCL_QUERY_GET_OFFSET_MASK 0x00ffffff
-#define NV40TCL_BEGIN_END 0x00001808
-#define NV40TCL_BEGIN_END_STOP 0x00000000
-#define NV40TCL_BEGIN_END_POINTS 0x00000001
-#define NV40TCL_BEGIN_END_LINES 0x00000002
-#define NV40TCL_BEGIN_END_LINE_LOOP 0x00000003
-#define NV40TCL_BEGIN_END_LINE_STRIP 0x00000004
-#define NV40TCL_BEGIN_END_TRIANGLES 0x00000005
-#define NV40TCL_BEGIN_END_TRIANGLE_STRIP 0x00000006
-#define NV40TCL_BEGIN_END_TRIANGLE_FAN 0x00000007
-#define NV40TCL_BEGIN_END_QUADS 0x00000008
-#define NV40TCL_BEGIN_END_QUAD_STRIP 0x00000009
-#define NV40TCL_BEGIN_END_POLYGON 0x0000000a
-#define NV40TCL_VB_ELEMENT_U16 0x0000180c
-#define NV40TCL_VB_ELEMENT_U16_1_SHIFT 16
-#define NV40TCL_VB_ELEMENT_U16_1_MASK 0xffff0000
-#define NV40TCL_VB_ELEMENT_U16_0_SHIFT 0
-#define NV40TCL_VB_ELEMENT_U16_0_MASK 0x0000ffff
-#define NV40TCL_VB_ELEMENT_U32 0x00001810
-#define NV40TCL_VB_VERTEX_BATCH 0x00001814
-#define NV40TCL_VB_VERTEX_BATCH_COUNT_SHIFT 24
-#define NV40TCL_VB_VERTEX_BATCH_COUNT_MASK 0xff000000
-#define NV40TCL_VB_VERTEX_BATCH_START_SHIFT 0
-#define NV40TCL_VB_VERTEX_BATCH_START_MASK 0x00ffffff
-#define NV40TCL_VERTEX_DATA 0x00001818
-#define NV40TCL_IDXBUF_ADDRESS 0x0000181c
-#define NV40TCL_IDXBUF_FORMAT 0x00001820
-#define NV40TCL_IDXBUF_FORMAT_TYPE_SHIFT 4
-#define NV40TCL_IDXBUF_FORMAT_TYPE_MASK 0x000000f0
-#define NV40TCL_IDXBUF_FORMAT_TYPE_U32 0x00000000
-#define NV40TCL_IDXBUF_FORMAT_TYPE_U16 0x00000010
-#define NV40TCL_IDXBUF_FORMAT_DMA1 (1 << 0)
-#define NV40TCL_VB_INDEX_BATCH 0x00001824
-#define NV40TCL_VB_INDEX_BATCH_COUNT_SHIFT 24
-#define NV40TCL_VB_INDEX_BATCH_COUNT_MASK 0xff000000
-#define NV40TCL_VB_INDEX_BATCH_START_SHIFT 0
-#define NV40TCL_VB_INDEX_BATCH_START_MASK 0x00ffffff
-#define NV40TCL_POLYGON_MODE_FRONT 0x00001828
-#define NV40TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NV40TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NV40TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NV40TCL_POLYGON_MODE_BACK 0x0000182c
-#define NV40TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NV40TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NV40TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NV40TCL_CULL_FACE 0x00001830
-#define NV40TCL_CULL_FACE_FRONT 0x00000404
-#define NV40TCL_CULL_FACE_BACK 0x00000405
-#define NV40TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NV40TCL_FRONT_FACE 0x00001834
-#define NV40TCL_FRONT_FACE_CW 0x00000900
-#define NV40TCL_FRONT_FACE_CCW 0x00000901
-#define NV40TCL_POLYGON_SMOOTH_ENABLE 0x00001838
-#define NV40TCL_CULL_FACE_ENABLE 0x0000183c
-#define NV40TCL_TEX_SIZE1(x) (0x00001840+((x)*4))
-#define NV40TCL_TEX_SIZE1__SIZE 0x00000008
-#define NV40TCL_TEX_SIZE1_DEPTH_SHIFT 20
-#define NV40TCL_TEX_SIZE1_DEPTH_MASK 0xfff00000
-#define NV40TCL_TEX_SIZE1_PITCH_SHIFT 0
-#define NV40TCL_TEX_SIZE1_PITCH_MASK 0x0000ffff
-#define NV40TCL_VTX_ATTR_2F_X(x) (0x00001880+((x)*8))
-#define NV40TCL_VTX_ATTR_2F_X__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_2F_Y(x) (0x00001884+((x)*8))
-#define NV40TCL_VTX_ATTR_2F_Y__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_2I(x) (0x00001900+((x)*4))
-#define NV40TCL_VTX_ATTR_2I__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_2I_X_SHIFT 0
-#define NV40TCL_VTX_ATTR_2I_X_MASK 0x0000ffff
-#define NV40TCL_VTX_ATTR_2I_Y_SHIFT 16
-#define NV40TCL_VTX_ATTR_2I_Y_MASK 0xffff0000
-#define NV40TCL_VTX_ATTR_4UB(x) (0x00001940+((x)*4))
-#define NV40TCL_VTX_ATTR_4UB__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4UB_X_SHIFT 0
-#define NV40TCL_VTX_ATTR_4UB_X_MASK 0x000000ff
-#define NV40TCL_VTX_ATTR_4UB_Y_SHIFT 8
-#define NV40TCL_VTX_ATTR_4UB_Y_MASK 0x0000ff00
-#define NV40TCL_VTX_ATTR_4UB_Z_SHIFT 16
-#define NV40TCL_VTX_ATTR_4UB_Z_MASK 0x00ff0000
-#define NV40TCL_VTX_ATTR_4UB_W_SHIFT 24
-#define NV40TCL_VTX_ATTR_4UB_W_MASK 0xff000000
-#define NV40TCL_VTX_ATTR_4I_XY(x) (0x00001980+((x)*8))
-#define NV40TCL_VTX_ATTR_4I_XY__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4I_XY_X_SHIFT 0
-#define NV40TCL_VTX_ATTR_4I_XY_X_MASK 0x0000ffff
-#define NV40TCL_VTX_ATTR_4I_XY_Y_SHIFT 16
-#define NV40TCL_VTX_ATTR_4I_XY_Y_MASK 0xffff0000
-#define NV40TCL_VTX_ATTR_4I_ZW(x) (0x00001984+((x)*8))
-#define NV40TCL_VTX_ATTR_4I_ZW__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4I_ZW_Z_SHIFT 0
-#define NV40TCL_VTX_ATTR_4I_ZW_Z_MASK 0x0000ffff
-#define NV40TCL_VTX_ATTR_4I_ZW_W_SHIFT 16
-#define NV40TCL_VTX_ATTR_4I_ZW_W_MASK 0xffff0000
-#define NV40TCL_TEX_OFFSET(x) (0x00001a00+((x)*32))
-#define NV40TCL_TEX_OFFSET__SIZE 0x00000010
-#define NV40TCL_TEX_FORMAT(x) (0x00001a04+((x)*32))
-#define NV40TCL_TEX_FORMAT__SIZE 0x00000010
-#define NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT 16
-#define NV40TCL_TEX_FORMAT_MIPMAP_COUNT_MASK 0x000f0000
-#define NV40TCL_TEX_FORMAT_RECT (1 << 14)
-#define NV40TCL_TEX_FORMAT_LINEAR (1 << 13)
-#define NV40TCL_TEX_FORMAT_FORMAT_SHIFT 8
-#define NV40TCL_TEX_FORMAT_FORMAT_MASK 0x00001f00
-#define NV40TCL_TEX_FORMAT_FORMAT_L8 0x00000100
-#define NV40TCL_TEX_FORMAT_FORMAT_A1R5G5B5 0x00000200
-#define NV40TCL_TEX_FORMAT_FORMAT_A4R4G4B4 0x00000300
-#define NV40TCL_TEX_FORMAT_FORMAT_R5G6B5 0x00000400
-#define NV40TCL_TEX_FORMAT_FORMAT_A8R8G8B8 0x00000500
-#define NV40TCL_TEX_FORMAT_FORMAT_DXT1 0x00000600
-#define NV40TCL_TEX_FORMAT_FORMAT_DXT3 0x00000700
-#define NV40TCL_TEX_FORMAT_FORMAT_DXT5 0x00000800
-#define NV40TCL_TEX_FORMAT_FORMAT_A8L8 0x00000b00
-#define NV40TCL_TEX_FORMAT_FORMAT_Z24 0x00001000
-#define NV40TCL_TEX_FORMAT_FORMAT_Z16 0x00001200
-#define NV40TCL_TEX_FORMAT_FORMAT_A16 0x00001400
-#define NV40TCL_TEX_FORMAT_FORMAT_A16L16 0x00001500
-#define NV40TCL_TEX_FORMAT_FORMAT_HILO8 0x00001800
-#define NV40TCL_TEX_FORMAT_FORMAT_RGBA16F 0x00001a00
-#define NV40TCL_TEX_FORMAT_FORMAT_RGBA32F 0x00001b00
-#define NV40TCL_TEX_FORMAT_DIMS_SHIFT 4
-#define NV40TCL_TEX_FORMAT_DIMS_MASK 0x000000f0
-#define NV40TCL_TEX_FORMAT_DIMS_1D 0x00000010
-#define NV40TCL_TEX_FORMAT_DIMS_2D 0x00000020
-#define NV40TCL_TEX_FORMAT_DIMS_3D 0x00000030
-#define NV40TCL_TEX_FORMAT_NO_BORDER (1 << 3)
-#define NV40TCL_TEX_FORMAT_CUBIC (1 << 2)
-#define NV40TCL_TEX_FORMAT_DMA1 (1 << 1)
-#define NV40TCL_TEX_FORMAT_DMA0 (1 << 0)
-#define NV40TCL_TEX_WRAP(x) (0x00001a08+((x)*32))
-#define NV40TCL_TEX_WRAP__SIZE 0x00000010
-#define NV40TCL_TEX_WRAP_S_SHIFT 0
-#define NV40TCL_TEX_WRAP_S_MASK 0x0000000f
-#define NV40TCL_TEX_WRAP_S_REPEAT 0x00000001
-#define NV40TCL_TEX_WRAP_S_MIRRORED_REPEAT 0x00000002
-#define NV40TCL_TEX_WRAP_S_CLAMP_TO_EDGE 0x00000003
-#define NV40TCL_TEX_WRAP_S_CLAMP_TO_BORDER 0x00000004
-#define NV40TCL_TEX_WRAP_S_CLAMP 0x00000005
-#define NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE 0x00000006
-#define NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER 0x00000007
-#define NV40TCL_TEX_WRAP_S_MIRROR_CLAMP 0x00000008
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_SHIFT 4
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_MASK 0x00000070
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_OFF 0x00000000
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_QUALITY 0x00000020
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_PERFORMANCE 0x00000030
-#define NV40TCL_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_HIGH_PERFORMANCE 0x00000070
-#define NV40TCL_TEX_WRAP_T_SHIFT 8
-#define NV40TCL_TEX_WRAP_T_MASK 0x00000f00
-#define NV40TCL_TEX_WRAP_T_REPEAT 0x00000100
-#define NV40TCL_TEX_WRAP_T_MIRRORED_REPEAT 0x00000200
-#define NV40TCL_TEX_WRAP_T_CLAMP_TO_EDGE 0x00000300
-#define NV40TCL_TEX_WRAP_T_CLAMP_TO_BORDER 0x00000400
-#define NV40TCL_TEX_WRAP_T_CLAMP 0x00000500
-#define NV40TCL_TEX_WRAP_T_MIRROR_CLAMP_TO_EDGE 0x00000600
-#define NV40TCL_TEX_WRAP_T_MIRROR_CLAMP_TO_BORDER 0x00000700
-#define NV40TCL_TEX_WRAP_T_MIRROR_CLAMP 0x00000800
-#define NV40TCL_TEX_WRAP_EXPAND_NORMAL_SHIFT 12
-#define NV40TCL_TEX_WRAP_EXPAND_NORMAL_MASK 0x0000f000
-#define NV40TCL_TEX_WRAP_R_SHIFT 16
-#define NV40TCL_TEX_WRAP_R_MASK 0x000f0000
-#define NV40TCL_TEX_WRAP_R_REPEAT 0x00010000
-#define NV40TCL_TEX_WRAP_R_MIRRORED_REPEAT 0x00020000
-#define NV40TCL_TEX_WRAP_R_CLAMP_TO_EDGE 0x00030000
-#define NV40TCL_TEX_WRAP_R_CLAMP_TO_BORDER 0x00040000
-#define NV40TCL_TEX_WRAP_R_CLAMP 0x00050000
-#define NV40TCL_TEX_WRAP_R_MIRROR_CLAMP_TO_EDGE 0x00060000
-#define NV40TCL_TEX_WRAP_R_MIRROR_CLAMP_TO_BORDER 0x00070000
-#define NV40TCL_TEX_WRAP_R_MIRROR_CLAMP 0x00080000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_SHIFT 20
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_MASK 0x00f00000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_NONE 0x00000000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_RED 0x00100000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_GREEN 0x00200000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_BLUE 0x00400000
-#define NV40TCL_TEX_WRAP_GAMMA_DECREASE_FILTER_ALL 0x00f00000
-#define NV40TCL_TEX_WRAP_RCOMP_SHIFT 28
-#define NV40TCL_TEX_WRAP_RCOMP_MASK 0xf0000000
-#define NV40TCL_TEX_WRAP_RCOMP_NEVER 0x00000000
-#define NV40TCL_TEX_WRAP_RCOMP_GREATER 0x10000000
-#define NV40TCL_TEX_WRAP_RCOMP_EQUAL 0x20000000
-#define NV40TCL_TEX_WRAP_RCOMP_GEQUAL 0x30000000
-#define NV40TCL_TEX_WRAP_RCOMP_LESS 0x40000000
-#define NV40TCL_TEX_WRAP_RCOMP_NOTEQUAL 0x50000000
-#define NV40TCL_TEX_WRAP_RCOMP_LEQUAL 0x60000000
-#define NV40TCL_TEX_WRAP_RCOMP_ALWAYS 0x70000000
-#define NV40TCL_TEX_ENABLE(x) (0x00001a0c+((x)*32))
-#define NV40TCL_TEX_ENABLE__SIZE 0x00000010
-#define NV40TCL_TEX_ENABLE_ENABLE (1 << 31)
-#define NV40TCL_TEX_ENABLE_MIPMAP_MIN_LOD_SHIFT 27
-#define NV40TCL_TEX_ENABLE_MIPMAP_MIN_LOD_MASK 0x38000000
-#define NV40TCL_TEX_ENABLE_MIPMAP_MAX_LOD_SHIFT 15
-#define NV40TCL_TEX_ENABLE_MIPMAP_MAX_LOD_MASK 0x00038000
-#define NV40TCL_TEX_ENABLE_ANISO_SHIFT 4
-#define NV40TCL_TEX_ENABLE_ANISO_MASK 0x000000f0
-#define NV40TCL_TEX_ENABLE_ANISO_NONE 0x00000000
-#define NV40TCL_TEX_ENABLE_ANISO_2X 0x00000010
-#define NV40TCL_TEX_ENABLE_ANISO_4X 0x00000020
-#define NV40TCL_TEX_ENABLE_ANISO_6X 0x00000030
-#define NV40TCL_TEX_ENABLE_ANISO_8X 0x00000040
-#define NV40TCL_TEX_ENABLE_ANISO_10X 0x00000050
-#define NV40TCL_TEX_ENABLE_ANISO_12X 0x00000060
-#define NV40TCL_TEX_ENABLE_ANISO_16X 0x00000070
-#define NV40TCL_TEX_SWIZZLE(x) (0x00001a10+((x)*32))
-#define NV40TCL_TEX_SWIZZLE__SIZE 0x00000010
-#define NV40TCL_TEX_SWIZZLE_S0_X_SHIFT 14
-#define NV40TCL_TEX_SWIZZLE_S0_X_MASK 0x0000c000
-#define NV40TCL_TEX_SWIZZLE_S0_X_ZERO 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S0_X_ONE 0x00004000
-#define NV40TCL_TEX_SWIZZLE_S0_X_S1 0x00008000
-#define NV40TCL_TEX_SWIZZLE_S0_Y_SHIFT 12
-#define NV40TCL_TEX_SWIZZLE_S0_Y_MASK 0x00003000
-#define NV40TCL_TEX_SWIZZLE_S0_Y_ZERO 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S0_Y_ONE 0x00001000
-#define NV40TCL_TEX_SWIZZLE_S0_Y_S1 0x00002000
-#define NV40TCL_TEX_SWIZZLE_S0_Z_SHIFT 10
-#define NV40TCL_TEX_SWIZZLE_S0_Z_MASK 0x00000c00
-#define NV40TCL_TEX_SWIZZLE_S0_Z_ZERO 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S0_Z_ONE 0x00000400
-#define NV40TCL_TEX_SWIZZLE_S0_Z_S1 0x00000800
-#define NV40TCL_TEX_SWIZZLE_S0_W_SHIFT 8
-#define NV40TCL_TEX_SWIZZLE_S0_W_MASK 0x00000300
-#define NV40TCL_TEX_SWIZZLE_S0_W_ZERO 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S0_W_ONE 0x00000100
-#define NV40TCL_TEX_SWIZZLE_S0_W_S1 0x00000200
-#define NV40TCL_TEX_SWIZZLE_S1_X_SHIFT 6
-#define NV40TCL_TEX_SWIZZLE_S1_X_MASK 0x000000c0
-#define NV40TCL_TEX_SWIZZLE_S1_X_W 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S1_X_Z 0x00000040
-#define NV40TCL_TEX_SWIZZLE_S1_X_Y 0x00000080
-#define NV40TCL_TEX_SWIZZLE_S1_X_X 0x000000c0
-#define NV40TCL_TEX_SWIZZLE_S1_Y_SHIFT 4
-#define NV40TCL_TEX_SWIZZLE_S1_Y_MASK 0x00000030
-#define NV40TCL_TEX_SWIZZLE_S1_Y_W 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S1_Y_Z 0x00000010
-#define NV40TCL_TEX_SWIZZLE_S1_Y_Y 0x00000020
-#define NV40TCL_TEX_SWIZZLE_S1_Y_X 0x00000030
-#define NV40TCL_TEX_SWIZZLE_S1_Z_SHIFT 2
-#define NV40TCL_TEX_SWIZZLE_S1_Z_MASK 0x0000000c
-#define NV40TCL_TEX_SWIZZLE_S1_Z_W 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S1_Z_Z 0x00000004
-#define NV40TCL_TEX_SWIZZLE_S1_Z_Y 0x00000008
-#define NV40TCL_TEX_SWIZZLE_S1_Z_X 0x0000000c
-#define NV40TCL_TEX_SWIZZLE_S1_W_SHIFT 0
-#define NV40TCL_TEX_SWIZZLE_S1_W_MASK 0x00000003
-#define NV40TCL_TEX_SWIZZLE_S1_W_W 0x00000000
-#define NV40TCL_TEX_SWIZZLE_S1_W_Z 0x00000001
-#define NV40TCL_TEX_SWIZZLE_S1_W_Y 0x00000002
-#define NV40TCL_TEX_SWIZZLE_S1_W_X 0x00000003
-#define NV40TCL_TEX_FILTER(x) (0x00001a14+((x)*32))
-#define NV40TCL_TEX_FILTER__SIZE 0x00000010
-#define NV40TCL_TEX_FILTER_SIGNED_ALPHA (1 << 31)
-#define NV40TCL_TEX_FILTER_SIGNED_RED (1 << 30)
-#define NV40TCL_TEX_FILTER_SIGNED_GREEN (1 << 29)
-#define NV40TCL_TEX_FILTER_SIGNED_BLUE (1 << 28)
-#define NV40TCL_TEX_FILTER_MIN_SHIFT 16
-#define NV40TCL_TEX_FILTER_MIN_MASK 0x000f0000
-#define NV40TCL_TEX_FILTER_MIN_NEAREST 0x00010000
-#define NV40TCL_TEX_FILTER_MIN_LINEAR 0x00020000
-#define NV40TCL_TEX_FILTER_MIN_NEAREST_MIPMAP_NEAREST 0x00030000
-#define NV40TCL_TEX_FILTER_MIN_LINEAR_MIPMAP_NEAREST 0x00040000
-#define NV40TCL_TEX_FILTER_MIN_NEAREST_MIPMAP_LINEAR 0x00050000
-#define NV40TCL_TEX_FILTER_MIN_LINEAR_MIPMAP_LINEAR 0x00060000
-#define NV40TCL_TEX_FILTER_MAG_SHIFT 24
-#define NV40TCL_TEX_FILTER_MAG_MASK 0x0f000000
-#define NV40TCL_TEX_FILTER_MAG_NEAREST 0x01000000
-#define NV40TCL_TEX_FILTER_MAG_LINEAR 0x02000000
-#define NV40TCL_TEX_SIZE0(x) (0x00001a18+((x)*32))
-#define NV40TCL_TEX_SIZE0__SIZE 0x00000010
-#define NV40TCL_TEX_SIZE0_H_SHIFT 0
-#define NV40TCL_TEX_SIZE0_H_MASK 0x0000ffff
-#define NV40TCL_TEX_SIZE0_W_SHIFT 16
-#define NV40TCL_TEX_SIZE0_W_MASK 0xffff0000
-#define NV40TCL_TEX_BORDER_COLOR(x) (0x00001a1c+((x)*32))
-#define NV40TCL_TEX_BORDER_COLOR__SIZE 0x00000010
-#define NV40TCL_TEX_BORDER_COLOR_B_SHIFT 0
-#define NV40TCL_TEX_BORDER_COLOR_B_MASK 0x000000ff
-#define NV40TCL_TEX_BORDER_COLOR_G_SHIFT 8
-#define NV40TCL_TEX_BORDER_COLOR_G_MASK 0x0000ff00
-#define NV40TCL_TEX_BORDER_COLOR_R_SHIFT 16
-#define NV40TCL_TEX_BORDER_COLOR_R_MASK 0x00ff0000
-#define NV40TCL_TEX_BORDER_COLOR_A_SHIFT 24
-#define NV40TCL_TEX_BORDER_COLOR_A_MASK 0xff000000
-#define NV40TCL_VTX_ATTR_4F_X(x) (0x00001c00+((x)*16))
-#define NV40TCL_VTX_ATTR_4F_X__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4F_Y(x) (0x00001c04+((x)*16))
-#define NV40TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4F_Z(x) (0x00001c08+((x)*16))
-#define NV40TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
-#define NV40TCL_VTX_ATTR_4F_W(x) (0x00001c0c+((x)*16))
-#define NV40TCL_VTX_ATTR_4F_W__SIZE 0x00000010
-#define NV40TCL_FP_CONTROL 0x00001d60
-#define NV40TCL_FP_CONTROL_TEMP_COUNT_SHIFT 24
-#define NV40TCL_FP_CONTROL_TEMP_COUNT_MASK 0xff000000
-#define NV40TCL_FP_CONTROL_KIL (1 << 7)
-#define NV40TCL_MULTISAMPLE_CONTROL 0x00001d7c
-#define NV40TCL_CLEAR_VALUE_DEPTH 0x00001d8c
-#define NV40TCL_CLEAR_VALUE_COLOR 0x00001d90
-#define NV40TCL_CLEAR_VALUE_COLOR_B_SHIFT 0
-#define NV40TCL_CLEAR_VALUE_COLOR_B_MASK 0x000000ff
-#define NV40TCL_CLEAR_VALUE_COLOR_G_SHIFT 8
-#define NV40TCL_CLEAR_VALUE_COLOR_G_MASK 0x0000ff00
-#define NV40TCL_CLEAR_VALUE_COLOR_R_SHIFT 16
-#define NV40TCL_CLEAR_VALUE_COLOR_R_MASK 0x00ff0000
-#define NV40TCL_CLEAR_VALUE_COLOR_A_SHIFT 24
-#define NV40TCL_CLEAR_VALUE_COLOR_A_MASK 0xff000000
-#define NV40TCL_CLEAR_BUFFERS 0x00001d94
-#define NV40TCL_CLEAR_BUFFERS_COLOR_A (1 << 7)
-#define NV40TCL_CLEAR_BUFFERS_COLOR_B (1 << 6)
-#define NV40TCL_CLEAR_BUFFERS_COLOR_G (1 << 5)
-#define NV40TCL_CLEAR_BUFFERS_COLOR_R (1 << 4)
-#define NV40TCL_CLEAR_BUFFERS_STENCIL (1 << 1)
-#define NV40TCL_CLEAR_BUFFERS_DEPTH (1 << 0)
-#define NV40TCL_LINE_STIPPLE_ENABLE 0x00001db4
-#define NV40TCL_LINE_STIPPLE_PATTERN 0x00001db8
-#define NV40TCL_LINE_STIPPLE_PATTERN_FACTOR_SHIFT 0
-#define NV40TCL_LINE_STIPPLE_PATTERN_FACTOR_MASK 0x0000ffff
-#define NV40TCL_LINE_STIPPLE_PATTERN_PATTERN_SHIFT 16
-#define NV40TCL_LINE_STIPPLE_PATTERN_PATTERN_MASK 0xffff0000
-#define NV40TCL_VTX_ATTR_1F(x) (0x00001e40+((x)*4))
-#define NV40TCL_VTX_ATTR_1F__SIZE 0x00000010
-#define NV40TCL_VP_UPLOAD_FROM_ID 0x00001e9c
-#define NV40TCL_VP_START_FROM_ID 0x00001ea0
-#define NV40TCL_POINT_SIZE 0x00001ee0
-#define NV40TCL_POINT_SPRITE 0x00001ee8
-#define NV40TCL_POINT_SPRITE_ENABLE (1 << 0)
-#define NV40TCL_POINT_SPRITE_R_MODE_SHIFT 1
-#define NV40TCL_POINT_SPRITE_R_MODE_MASK 0x00000006
-#define NV40TCL_POINT_SPRITE_R_MODE_ZERO 0x00000000
-#define NV40TCL_POINT_SPRITE_R_MODE_R 0x00000002
-#define NV40TCL_POINT_SPRITE_R_MODE_S 0x00000004
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_0 (1 << 8)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_1 (1 << 9)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_2 (1 << 10)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_3 (1 << 11)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_4 (1 << 12)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_5 (1 << 13)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_6 (1 << 14)
-#define NV40TCL_POINT_SPRITE_COORD_REPLACE_7 (1 << 15)
-#define NV40TCL_VP_UPLOAD_CONST_ID 0x00001efc
-#define NV40TCL_VP_UPLOAD_CONST_X(x) (0x00001f00+((x)*16))
-#define NV40TCL_VP_UPLOAD_CONST_X__SIZE 0x00000004
-#define NV40TCL_VP_UPLOAD_CONST_Y(x) (0x00001f04+((x)*16))
-#define NV40TCL_VP_UPLOAD_CONST_Y__SIZE 0x00000004
-#define NV40TCL_VP_UPLOAD_CONST_Z(x) (0x00001f08+((x)*16))
-#define NV40TCL_VP_UPLOAD_CONST_Z__SIZE 0x00000004
-#define NV40TCL_VP_UPLOAD_CONST_W(x) (0x00001f0c+((x)*16))
-#define NV40TCL_VP_UPLOAD_CONST_W__SIZE 0x00000004
-#define NV40TCL_TEX_CACHE_CTL 0x00001fd8
-#define NV40TCL_VP_ATTRIB_EN 0x00001ff0
-#define NV40TCL_VP_RESULT_EN 0x00001ff4
-
-
-#define NV44TCL 0x00004497
-
-
-
-#define NV50_2D 0x0000502d
-
-#define NV50_2D_NOP 0x00000100
-#define NV50_2D_NOTIFY 0x00000104
-#define NV50_2D_SERIALIZE 0x00000110
-#define NV50_2D_DMA_NOTIFY 0x00000180
-#define NV50_2D_DMA_DST 0x00000184
-#define NV50_2D_DMA_SRC 0x00000188
-#define NV50_2D_DMA_COND 0x0000018c
-#define NV50_2D_DST_FORMAT 0x00000200
-#define NV50_2D_DST_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NV50_2D_DST_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NV50_2D_DST_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NV50_2D_DST_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NV50_2D_DST_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NV50_2D_DST_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NV50_2D_DST_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NV50_2D_DST_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NV50_2D_DST_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NV50_2D_DST_FORMAT_R32G32_FLOAT 0x000000cb
-#define NV50_2D_DST_FORMAT_R32G32_SINT 0x000000cc
-#define NV50_2D_DST_FORMAT_R32G32_UINT 0x000000cd
-#define NV50_2D_DST_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NV50_2D_DST_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NV50_2D_DST_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NV50_2D_DST_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NV50_2D_DST_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NV50_2D_DST_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NV50_2D_DST_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NV50_2D_DST_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NV50_2D_DST_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NV50_2D_DST_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NV50_2D_DST_FORMAT_R16G16_UNORM 0x000000da
-#define NV50_2D_DST_FORMAT_R16G16_SNORM 0x000000db
-#define NV50_2D_DST_FORMAT_R16G16_SINT 0x000000dc
-#define NV50_2D_DST_FORMAT_R16G16_UINT 0x000000dd
-#define NV50_2D_DST_FORMAT_R16G16_FLOAT 0x000000de
-#define NV50_2D_DST_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NV50_2D_DST_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NV50_2D_DST_FORMAT_R32_FLOAT 0x000000e5
-#define NV50_2D_DST_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NV50_2D_DST_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NV50_2D_DST_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NV50_2D_DST_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NV50_2D_DST_FORMAT_R8G8_UNORM 0x000000ea
-#define NV50_2D_DST_FORMAT_R8G8_SNORM 0x000000eb
-#define NV50_2D_DST_FORMAT_R8G8_SINT 0x000000ec
-#define NV50_2D_DST_FORMAT_R8G8_UINT 0x000000ed
-#define NV50_2D_DST_FORMAT_R16_UNORM 0x000000ee
-#define NV50_2D_DST_FORMAT_R16_SNORM 0x000000ef
-#define NV50_2D_DST_FORMAT_R16_SINT 0x000000f0
-#define NV50_2D_DST_FORMAT_R16_UINT 0x000000f1
-#define NV50_2D_DST_FORMAT_R16_FLOAT 0x000000f2
-#define NV50_2D_DST_FORMAT_R8_UNORM 0x000000f3
-#define NV50_2D_DST_FORMAT_R8_SNORM 0x000000f4
-#define NV50_2D_DST_FORMAT_R8_SINT 0x000000f5
-#define NV50_2D_DST_FORMAT_R8_UINT 0x000000f6
-#define NV50_2D_DST_FORMAT_A8_UNORM 0x000000f7
-#define NV50_2D_DST_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NV50_2D_DST_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NV50_2D_DST_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NV50_2D_DST_LINEAR 0x00000204
-#define NV50_2D_DST_TILE_MODE 0x00000208
-#define NV50_2D_DST_DEPTH 0x0000020c
-#define NV50_2D_DST_LAYER 0x00000210
-#define NV50_2D_DST_PITCH 0x00000214
-#define NV50_2D_DST_WIDTH 0x00000218
-#define NV50_2D_DST_HEIGHT 0x0000021c
-#define NV50_2D_DST_ADDRESS_HIGH 0x00000220
-#define NV50_2D_DST_ADDRESS_LOW 0x00000224
-#define NV50_2D_SRC_FORMAT 0x00000230
-#define NV50_2D_SRC_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NV50_2D_SRC_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NV50_2D_SRC_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NV50_2D_SRC_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NV50_2D_SRC_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NV50_2D_SRC_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NV50_2D_SRC_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NV50_2D_SRC_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NV50_2D_SRC_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NV50_2D_SRC_FORMAT_R32G32_FLOAT 0x000000cb
-#define NV50_2D_SRC_FORMAT_R32G32_SINT 0x000000cc
-#define NV50_2D_SRC_FORMAT_R32G32_UINT 0x000000cd
-#define NV50_2D_SRC_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NV50_2D_SRC_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NV50_2D_SRC_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NV50_2D_SRC_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NV50_2D_SRC_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NV50_2D_SRC_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NV50_2D_SRC_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NV50_2D_SRC_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NV50_2D_SRC_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NV50_2D_SRC_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NV50_2D_SRC_FORMAT_R16G16_UNORM 0x000000da
-#define NV50_2D_SRC_FORMAT_R16G16_SNORM 0x000000db
-#define NV50_2D_SRC_FORMAT_R16G16_SINT 0x000000dc
-#define NV50_2D_SRC_FORMAT_R16G16_UINT 0x000000dd
-#define NV50_2D_SRC_FORMAT_R16G16_FLOAT 0x000000de
-#define NV50_2D_SRC_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NV50_2D_SRC_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NV50_2D_SRC_FORMAT_R32_FLOAT 0x000000e5
-#define NV50_2D_SRC_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NV50_2D_SRC_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NV50_2D_SRC_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NV50_2D_SRC_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NV50_2D_SRC_FORMAT_R8G8_UNORM 0x000000ea
-#define NV50_2D_SRC_FORMAT_R8G8_SNORM 0x000000eb
-#define NV50_2D_SRC_FORMAT_R8G8_SINT 0x000000ec
-#define NV50_2D_SRC_FORMAT_R8G8_UINT 0x000000ed
-#define NV50_2D_SRC_FORMAT_R16_UNORM 0x000000ee
-#define NV50_2D_SRC_FORMAT_R16_SNORM 0x000000ef
-#define NV50_2D_SRC_FORMAT_R16_SINT 0x000000f0
-#define NV50_2D_SRC_FORMAT_R16_UINT 0x000000f1
-#define NV50_2D_SRC_FORMAT_R16_FLOAT 0x000000f2
-#define NV50_2D_SRC_FORMAT_R8_UNORM 0x000000f3
-#define NV50_2D_SRC_FORMAT_R8_SNORM 0x000000f4
-#define NV50_2D_SRC_FORMAT_R8_SINT 0x000000f5
-#define NV50_2D_SRC_FORMAT_R8_UINT 0x000000f6
-#define NV50_2D_SRC_FORMAT_A8_UNORM 0x000000f7
-#define NV50_2D_SRC_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NV50_2D_SRC_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NV50_2D_SRC_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NV50_2D_SRC_LINEAR 0x00000234
-#define NV50_2D_SRC_TILE_MODE 0x00000238
-#define NV50_2D_SRC_DEPTH 0x0000023c
-#define NV50_2D_SRC_LAYER 0x00000240
-#define NV50_2D_SRC_PITCH 0x00000244
-#define NV50_2D_SRC_WIDTH 0x00000248
-#define NV50_2D_SRC_HEIGHT 0x0000024c
-#define NV50_2D_SRC_ADDRESS_HIGH 0x00000250
-#define NV50_2D_SRC_ADDRESS_LOW 0x00000254
-#define NV50_2D_COND_ADDRESS_HIGH 0x00000264
-#define NV50_2D_COND_ADDRESS_LOW 0x00000268
-#define NV50_2D_COND_MODE 0x0000026c
-#define NV50_2D_COND_MODE_NEVER 0x00000000
-#define NV50_2D_COND_MODE_ALWAYS 0x00000001
-#define NV50_2D_COND_MODE_RES 0x00000002
-#define NV50_2D_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
-#define NV50_2D_COND_MODE_RES_OR_ID 0x00000004
-#define NV50_2D_CLIP_X 0x00000280
-#define NV50_2D_CLIP_Y 0x00000284
-#define NV50_2D_CLIP_W 0x00000288
-#define NV50_2D_CLIP_H 0x0000028c
-#define NV50_2D_CLIP_ENABLE 0x00000290
-#define NV50_2D_COLOR_KEY_FORMAT 0x00000294
-#define NV50_2D_COLOR_KEY_FORMAT_16BPP 0x00000000
-#define NV50_2D_COLOR_KEY_FORMAT_15BPP 0x00000001
-#define NV50_2D_COLOR_KEY_FORMAT_24BPP 0x00000002
-#define NV50_2D_COLOR_KEY_FORMAT_30BPP 0x00000003
-#define NV50_2D_COLOR_KEY_FORMAT_8BPP 0x00000004
-#define NV50_2D_COLOR_KEY_FORMAT_16BPP2 0x00000005
-#define NV50_2D_COLOR_KEY_FORMAT_32BPP 0x00000006
-#define NV50_2D_COLOR_KEY 0x00000298
-#define NV50_2D_COLOR_KEY_ENABLE 0x0000029c
-#define NV50_2D_ROP 0x000002a0
-#define NV50_2D_OPERATION 0x000002ac
-#define NV50_2D_OPERATION_SRCCOPY_AND 0x00000000
-#define NV50_2D_OPERATION_ROP_AND 0x00000001
-#define NV50_2D_OPERATION_BLEND_AND 0x00000002
-#define NV50_2D_OPERATION_SRCCOPY 0x00000003
-#define NV50_2D_OPERATION_SRCCOPY_PREMULT 0x00000004
-#define NV50_2D_OPERATION_BLEND_PREMULT 0x00000005
-#define NV50_2D_PATTERN_FORMAT 0x000002e8
-#define NV50_2D_PATTERN_FORMAT_16BPP 0x00000000
-#define NV50_2D_PATTERN_FORMAT_15BPP 0x00000001
-#define NV50_2D_PATTERN_FORMAT_32BPP 0x00000002
-#define NV50_2D_PATTERN_FORMAT_8BPP 0x00000003
-#define NV50_2D_PATTERN_COLOR(x) (0x000002f0+((x)*4))
-#define NV50_2D_PATTERN_COLOR__SIZE 0x00000002
-#define NV50_2D_PATTERN_BITMAP(x) (0x000002f8+((x)*4))
-#define NV50_2D_PATTERN_BITMAP__SIZE 0x00000002
-#define NV50_2D_DRAW_SHAPE 0x00000580
-#define NV50_2D_DRAW_SHAPE_POINTS 0x00000000
-#define NV50_2D_DRAW_SHAPE_LINES 0x00000001
-#define NV50_2D_DRAW_SHAPE_LINE_STRIP 0x00000002
-#define NV50_2D_DRAW_SHAPE_TRIANGLES 0x00000003
-#define NV50_2D_DRAW_SHAPE_RECTANGLES 0x00000004
-#define NV50_2D_DRAW_COLOR_FORMAT 0x00000584
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_FLOAT 0x000000cb
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_SINT 0x000000cc
-#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_UINT 0x000000cd
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NV50_2D_DRAW_COLOR_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NV50_2D_DRAW_COLOR_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NV50_2D_DRAW_COLOR_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NV50_2D_DRAW_COLOR_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_UNORM 0x000000da
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_SNORM 0x000000db
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_SINT 0x000000dc
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_UINT 0x000000dd
-#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_FLOAT 0x000000de
-#define NV50_2D_DRAW_COLOR_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NV50_2D_DRAW_COLOR_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NV50_2D_DRAW_COLOR_FORMAT_R32_FLOAT 0x000000e5
-#define NV50_2D_DRAW_COLOR_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NV50_2D_DRAW_COLOR_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NV50_2D_DRAW_COLOR_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NV50_2D_DRAW_COLOR_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_UNORM 0x000000ea
-#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_SNORM 0x000000eb
-#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_SINT 0x000000ec
-#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_UINT 0x000000ed
-#define NV50_2D_DRAW_COLOR_FORMAT_R16_UNORM 0x000000ee
-#define NV50_2D_DRAW_COLOR_FORMAT_R16_SNORM 0x000000ef
-#define NV50_2D_DRAW_COLOR_FORMAT_R16_SINT 0x000000f0
-#define NV50_2D_DRAW_COLOR_FORMAT_R16_UINT 0x000000f1
-#define NV50_2D_DRAW_COLOR_FORMAT_R16_FLOAT 0x000000f2
-#define NV50_2D_DRAW_COLOR_FORMAT_R8_UNORM 0x000000f3
-#define NV50_2D_DRAW_COLOR_FORMAT_R8_SNORM 0x000000f4
-#define NV50_2D_DRAW_COLOR_FORMAT_R8_SINT 0x000000f5
-#define NV50_2D_DRAW_COLOR_FORMAT_R8_UINT 0x000000f6
-#define NV50_2D_DRAW_COLOR_FORMAT_A8_UNORM 0x000000f7
-#define NV50_2D_DRAW_COLOR_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NV50_2D_DRAW_COLOR_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NV50_2D_DRAW_COLOR_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NV50_2D_DRAW_COLOR 0x00000588
-#define NV50_2D_DRAW_POINT16 0x000005e0
-#define NV50_2D_DRAW_POINT16_X_SHIFT 0
-#define NV50_2D_DRAW_POINT16_X_MASK 0x0000ffff
-#define NV50_2D_DRAW_POINT16_Y_SHIFT 16
-#define NV50_2D_DRAW_POINT16_Y_MASK 0xffff0000
-#define NV50_2D_DRAW_POINT32_X(x) (0x00000600+((x)*8))
-#define NV50_2D_DRAW_POINT32_X__SIZE 0x00000040
-#define NV50_2D_DRAW_POINT32_Y(x) (0x00000604+((x)*8))
-#define NV50_2D_DRAW_POINT32_Y__SIZE 0x00000040
-#define NV50_2D_SIFC_BITMAP_ENABLE 0x00000800
-#define NV50_2D_SIFC_FORMAT 0x00000804
-#define NV50_2D_SIFC_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NV50_2D_SIFC_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NV50_2D_SIFC_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NV50_2D_SIFC_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NV50_2D_SIFC_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NV50_2D_SIFC_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NV50_2D_SIFC_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NV50_2D_SIFC_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NV50_2D_SIFC_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NV50_2D_SIFC_FORMAT_R32G32_FLOAT 0x000000cb
-#define NV50_2D_SIFC_FORMAT_R32G32_SINT 0x000000cc
-#define NV50_2D_SIFC_FORMAT_R32G32_UINT 0x000000cd
-#define NV50_2D_SIFC_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NV50_2D_SIFC_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NV50_2D_SIFC_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NV50_2D_SIFC_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NV50_2D_SIFC_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NV50_2D_SIFC_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NV50_2D_SIFC_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NV50_2D_SIFC_FORMAT_R16G16_UNORM 0x000000da
-#define NV50_2D_SIFC_FORMAT_R16G16_SNORM 0x000000db
-#define NV50_2D_SIFC_FORMAT_R16G16_SINT 0x000000dc
-#define NV50_2D_SIFC_FORMAT_R16G16_UINT 0x000000dd
-#define NV50_2D_SIFC_FORMAT_R16G16_FLOAT 0x000000de
-#define NV50_2D_SIFC_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NV50_2D_SIFC_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NV50_2D_SIFC_FORMAT_R32_FLOAT 0x000000e5
-#define NV50_2D_SIFC_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NV50_2D_SIFC_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NV50_2D_SIFC_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NV50_2D_SIFC_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NV50_2D_SIFC_FORMAT_R8G8_UNORM 0x000000ea
-#define NV50_2D_SIFC_FORMAT_R8G8_SNORM 0x000000eb
-#define NV50_2D_SIFC_FORMAT_R8G8_SINT 0x000000ec
-#define NV50_2D_SIFC_FORMAT_R8G8_UINT 0x000000ed
-#define NV50_2D_SIFC_FORMAT_R16_UNORM 0x000000ee
-#define NV50_2D_SIFC_FORMAT_R16_SNORM 0x000000ef
-#define NV50_2D_SIFC_FORMAT_R16_SINT 0x000000f0
-#define NV50_2D_SIFC_FORMAT_R16_UINT 0x000000f1
-#define NV50_2D_SIFC_FORMAT_R16_FLOAT 0x000000f2
-#define NV50_2D_SIFC_FORMAT_R8_UNORM 0x000000f3
-#define NV50_2D_SIFC_FORMAT_R8_SNORM 0x000000f4
-#define NV50_2D_SIFC_FORMAT_R8_SINT 0x000000f5
-#define NV50_2D_SIFC_FORMAT_R8_UINT 0x000000f6
-#define NV50_2D_SIFC_FORMAT_A8_UNORM 0x000000f7
-#define NV50_2D_SIFC_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NV50_2D_SIFC_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NV50_2D_SIFC_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NV50_2D_SIFC_BITMAP_UNK808 0x00000808
-#define NV50_2D_SIFC_BITMAP_LSB_FIRST 0x0000080c
-#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE 0x00000810
-#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_PACKED 0x00000000
-#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_BYTE 0x00000001
-#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_WORD 0x00000002
-#define NV50_2D_SIFC_BITMAP_COLOR_BIT0 0x00000814
-#define NV50_2D_SIFC_BITMAP_COLOR_BIT1 0x00000818
-#define NV50_2D_SIFC_BITMAP_WRITE_BIT0_ENABLE 0x0000081c
-#define NV50_2D_SIFC_WIDTH 0x00000838
-#define NV50_2D_SIFC_HEIGHT 0x0000083c
-#define NV50_2D_SIFC_DX_DU_FRACT 0x00000840
-#define NV50_2D_SIFC_DX_DU_INT 0x00000844
-#define NV50_2D_SIFC_DY_DV_FRACT 0x00000848
-#define NV50_2D_SIFC_DY_DV_INT 0x0000084c
-#define NV50_2D_SIFC_DST_X_FRACT 0x00000850
-#define NV50_2D_SIFC_DST_X_INT 0x00000854
-#define NV50_2D_SIFC_DST_Y_FRACT 0x00000858
-#define NV50_2D_SIFC_DST_Y_INT 0x0000085c
-#define NV50_2D_SIFC_DATA 0x00000860
-#define NV50_2D_BLIT_DST_X 0x000008b0
-#define NV50_2D_BLIT_DST_Y 0x000008b4
-#define NV50_2D_BLIT_DST_W 0x000008b8
-#define NV50_2D_BLIT_DST_H 0x000008bc
-#define NV50_2D_BLIT_DU_DX_FRACT 0x000008c0
-#define NV50_2D_BLIT_DU_DX_INT 0x000008c4
-#define NV50_2D_BLIT_DV_DY_FRACT 0x000008c8
-#define NV50_2D_BLIT_DV_DY_INT 0x000008cc
-#define NV50_2D_BLIT_SRC_X_FRACT 0x000008d0
-#define NV50_2D_BLIT_SRC_X_INT 0x000008d4
-#define NV50_2D_BLIT_SRC_Y_FRACT 0x000008d8
-#define NV50_2D_BLIT_SRC_Y_INT 0x000008dc
-
-
-#define NV50TCL 0x00005097
-
-#define NV50TCL_NOP 0x00000100
-#define NV50TCL_NOTIFY 0x00000104
-#define NV50TCL_SERIALIZE 0x00000110
-#define NV50TCL_DMA_NOTIFY 0x00000180
-#define NV50TCL_DMA_ZETA 0x00000184
-#define NV50TCL_DMA_QUERY 0x00000188
-#define NV50TCL_DMA_VTXBUF0 0x0000018c
-#define NV50TCL_DMA_LOCAL 0x00000190
-#define NV50TCL_DMA_STACK 0x00000194
-#define NV50TCL_DMA_CODE_CB 0x00000198
-#define NV50TCL_DMA_TSC 0x0000019c
-#define NV50TCL_DMA_TIC 0x000001a0
-#define NV50TCL_DMA_TEXTURE 0x000001a4
-#define NV50TCL_DMA_STRMOUT 0x000001a8
-#define NV50TCL_DMA_CLIPID 0x000001ac
-#define NV50TCL_DMA_COLOR(x) (0x000001c0+((x)*4))
-#define NV50TCL_DMA_COLOR__SIZE 0x00000008
-#define NV50TCL_RT_ADDRESS_HIGH(x) (0x00000200+((x)*32))
-#define NV50TCL_RT_ADDRESS_HIGH__SIZE 0x00000008
-#define NV50TCL_RT_ADDRESS_LOW(x) (0x00000204+((x)*32))
-#define NV50TCL_RT_ADDRESS_LOW__SIZE 0x00000008
-#define NV50TCL_RT_FORMAT(x) (0x00000208+((x)*32))
-#define NV50TCL_RT_FORMAT__SIZE 0x00000008
-#define NV50TCL_RT_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NV50TCL_RT_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NV50TCL_RT_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NV50TCL_RT_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NV50TCL_RT_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NV50TCL_RT_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NV50TCL_RT_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NV50TCL_RT_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NV50TCL_RT_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NV50TCL_RT_FORMAT_R32G32_FLOAT 0x000000cb
-#define NV50TCL_RT_FORMAT_R32G32_SINT 0x000000cc
-#define NV50TCL_RT_FORMAT_R32G32_UINT 0x000000cd
-#define NV50TCL_RT_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NV50TCL_RT_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NV50TCL_RT_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NV50TCL_RT_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NV50TCL_RT_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NV50TCL_RT_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NV50TCL_RT_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NV50TCL_RT_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NV50TCL_RT_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NV50TCL_RT_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NV50TCL_RT_FORMAT_R16G16_UNORM 0x000000da
-#define NV50TCL_RT_FORMAT_R16G16_SNORM 0x000000db
-#define NV50TCL_RT_FORMAT_R16G16_SINT 0x000000dc
-#define NV50TCL_RT_FORMAT_R16G16_UINT 0x000000dd
-#define NV50TCL_RT_FORMAT_R16G16_FLOAT 0x000000de
-#define NV50TCL_RT_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NV50TCL_RT_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NV50TCL_RT_FORMAT_R32_FLOAT 0x000000e5
-#define NV50TCL_RT_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NV50TCL_RT_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NV50TCL_RT_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NV50TCL_RT_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NV50TCL_RT_FORMAT_R8G8_UNORM 0x000000ea
-#define NV50TCL_RT_FORMAT_R8G8_SNORM 0x000000eb
-#define NV50TCL_RT_FORMAT_R8G8_SINT 0x000000ec
-#define NV50TCL_RT_FORMAT_R8G8_UINT 0x000000ed
-#define NV50TCL_RT_FORMAT_R16_UNORM 0x000000ee
-#define NV50TCL_RT_FORMAT_R16_SNORM 0x000000ef
-#define NV50TCL_RT_FORMAT_R16_SINT 0x000000f0
-#define NV50TCL_RT_FORMAT_R16_UINT 0x000000f1
-#define NV50TCL_RT_FORMAT_R16_FLOAT 0x000000f2
-#define NV50TCL_RT_FORMAT_R8_UNORM 0x000000f3
-#define NV50TCL_RT_FORMAT_R8_SNORM 0x000000f4
-#define NV50TCL_RT_FORMAT_R8_SINT 0x000000f5
-#define NV50TCL_RT_FORMAT_R8_UINT 0x000000f6
-#define NV50TCL_RT_FORMAT_A8_UNORM 0x000000f7
-#define NV50TCL_RT_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NV50TCL_RT_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NV50TCL_RT_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NV50TCL_RT_TILE_MODE(x) (0x0000020c+((x)*32))
-#define NV50TCL_RT_TILE_MODE__SIZE 0x00000008
-#define NV50TCL_RT_LAYER_STRIDE(x) (0x00000210+((x)*32))
-#define NV50TCL_RT_LAYER_STRIDE__SIZE 0x00000008
-#define NV50TCL_VTX_ATTR_1F(x) (0x00000300+((x)*4))
-#define NV50TCL_VTX_ATTR_1F__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_2H(x) (0x00000340+((x)*4))
-#define NV50TCL_VTX_ATTR_2H__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_2H_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_2H_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_2H_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_2H_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_2F_X(x) (0x00000380+((x)*8))
-#define NV50TCL_VTX_ATTR_2F_X__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_2F_Y(x) (0x00000384+((x)*8))
-#define NV50TCL_VTX_ATTR_2F_Y__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_3F_X(x) (0x00000400+((x)*16))
-#define NV50TCL_VTX_ATTR_3F_X__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_3F_Y(x) (0x00000404+((x)*16))
-#define NV50TCL_VTX_ATTR_3F_Y__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_3F_Z(x) (0x00000408+((x)*16))
-#define NV50TCL_VTX_ATTR_3F_Z__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4F_X(x) (0x00000500+((x)*16))
-#define NV50TCL_VTX_ATTR_4F_X__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4F_Y(x) (0x00000504+((x)*16))
-#define NV50TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4F_Z(x) (0x00000508+((x)*16))
-#define NV50TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4F_W(x) (0x0000050c+((x)*16))
-#define NV50TCL_VTX_ATTR_4F_W__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4H_0(x) (0x00000600+((x)*8))
-#define NV50TCL_VTX_ATTR_4H_0__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4H_0_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4H_0_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4H_0_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_4H_0_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4H_1(x) (0x00000604+((x)*8))
-#define NV50TCL_VTX_ATTR_4H_1__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4H_1_Z_SHIFT 0
-#define NV50TCL_VTX_ATTR_4H_1_Z_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4H_1_W_SHIFT 16
-#define NV50TCL_VTX_ATTR_4H_1_W_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_2I(x) (0x00000680+((x)*4))
-#define NV50TCL_VTX_ATTR_2I__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_2I_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_2I_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_2I_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_2I_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_2NI(x) (0x000006c0+((x)*4))
-#define NV50TCL_VTX_ATTR_2NI__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_2NI_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_2NI_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_2NI_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_2NI_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4I_0(x) (0x00000700+((x)*8))
-#define NV50TCL_VTX_ATTR_4I_0__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4I_0_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4I_0_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4I_0_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_4I_0_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4I_1(x) (0x00000704+((x)*8))
-#define NV50TCL_VTX_ATTR_4I_1__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4I_1_Z_SHIFT 0
-#define NV50TCL_VTX_ATTR_4I_1_Z_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4I_1_W_SHIFT 16
-#define NV50TCL_VTX_ATTR_4I_1_W_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4NI_0(x) (0x00000780+((x)*8))
-#define NV50TCL_VTX_ATTR_4NI_0__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4NI_0_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4NI_0_X_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4NI_0_Y_SHIFT 16
-#define NV50TCL_VTX_ATTR_4NI_0_Y_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4NI_1(x) (0x00000784+((x)*8))
-#define NV50TCL_VTX_ATTR_4NI_1__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4NI_1_Z_SHIFT 0
-#define NV50TCL_VTX_ATTR_4NI_1_Z_MASK 0x0000ffff
-#define NV50TCL_VTX_ATTR_4NI_1_W_SHIFT 16
-#define NV50TCL_VTX_ATTR_4NI_1_W_MASK 0xffff0000
-#define NV50TCL_VTX_ATTR_4UB(x) (0x00000800+((x)*4))
-#define NV50TCL_VTX_ATTR_4UB__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4UB_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4UB_X_MASK 0x000000ff
-#define NV50TCL_VTX_ATTR_4UB_Y_SHIFT 8
-#define NV50TCL_VTX_ATTR_4UB_Y_MASK 0x0000ff00
-#define NV50TCL_VTX_ATTR_4UB_Z_SHIFT 16
-#define NV50TCL_VTX_ATTR_4UB_Z_MASK 0x00ff0000
-#define NV50TCL_VTX_ATTR_4UB_W_SHIFT 24
-#define NV50TCL_VTX_ATTR_4UB_W_MASK 0xff000000
-#define NV50TCL_VTX_ATTR_4B(x) (0x00000840+((x)*4))
-#define NV50TCL_VTX_ATTR_4B__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4B_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4B_X_MASK 0x000000ff
-#define NV50TCL_VTX_ATTR_4B_Y_SHIFT 8
-#define NV50TCL_VTX_ATTR_4B_Y_MASK 0x0000ff00
-#define NV50TCL_VTX_ATTR_4B_Z_SHIFT 16
-#define NV50TCL_VTX_ATTR_4B_Z_MASK 0x00ff0000
-#define NV50TCL_VTX_ATTR_4B_W_SHIFT 24
-#define NV50TCL_VTX_ATTR_4B_W_MASK 0xff000000
-#define NV50TCL_VTX_ATTR_4NUB(x) (0x00000880+((x)*4))
-#define NV50TCL_VTX_ATTR_4NUB__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4NUB_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4NUB_X_MASK 0x000000ff
-#define NV50TCL_VTX_ATTR_4NUB_Y_SHIFT 8
-#define NV50TCL_VTX_ATTR_4NUB_Y_MASK 0x0000ff00
-#define NV50TCL_VTX_ATTR_4NUB_Z_SHIFT 16
-#define NV50TCL_VTX_ATTR_4NUB_Z_MASK 0x00ff0000
-#define NV50TCL_VTX_ATTR_4NUB_W_SHIFT 24
-#define NV50TCL_VTX_ATTR_4NUB_W_MASK 0xff000000
-#define NV50TCL_VTX_ATTR_4NB(x) (0x000008c0+((x)*4))
-#define NV50TCL_VTX_ATTR_4NB__SIZE 0x00000010
-#define NV50TCL_VTX_ATTR_4NB_X_SHIFT 0
-#define NV50TCL_VTX_ATTR_4NB_X_MASK 0x000000ff
-#define NV50TCL_VTX_ATTR_4NB_Y_SHIFT 8
-#define NV50TCL_VTX_ATTR_4NB_Y_MASK 0x0000ff00
-#define NV50TCL_VTX_ATTR_4NB_Z_SHIFT 16
-#define NV50TCL_VTX_ATTR_4NB_Z_MASK 0x00ff0000
-#define NV50TCL_VTX_ATTR_4NB_W_SHIFT 24
-#define NV50TCL_VTX_ATTR_4NB_W_MASK 0xff000000
-#define NV50TCL_VERTEX_ARRAY_FORMAT(x) (0x00000900+((x)*16))
-#define NV50TCL_VERTEX_ARRAY_FORMAT__SIZE 0x00000010
-#define NV50TCL_VERTEX_ARRAY_FORMAT_STRIDE_SHIFT 0
-#define NV50TCL_VERTEX_ARRAY_FORMAT_STRIDE_MASK 0x00000fff
-#define NV50TCL_VERTEX_ARRAY_FORMAT_ENABLE (1 << 29)
-#define NV50TCL_VERTEX_ARRAY_START_HIGH(x) (0x00000904+((x)*16))
-#define NV50TCL_VERTEX_ARRAY_START_HIGH__SIZE 0x00000010
-#define NV50TCL_VERTEX_ARRAY_START_LOW(x) (0x00000908+((x)*16))
-#define NV50TCL_VERTEX_ARRAY_START_LOW__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_SCALE_X(x) (0x00000a00+((x)*32))
-#define NV50TCL_VIEWPORT_SCALE_X__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_SCALE_Y(x) (0x00000a04+((x)*32))
-#define NV50TCL_VIEWPORT_SCALE_Y__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_SCALE_Z(x) (0x00000a08+((x)*32))
-#define NV50TCL_VIEWPORT_SCALE_Z__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_TRANSLATE_X(x) (0x00000a0c+((x)*32))
-#define NV50TCL_VIEWPORT_TRANSLATE_X__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_TRANSLATE_Y(x) (0x00000a10+((x)*32))
-#define NV50TCL_VIEWPORT_TRANSLATE_Y__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_TRANSLATE_Z(x) (0x00000a14+((x)*32))
-#define NV50TCL_VIEWPORT_TRANSLATE_Z__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_HORIZ(x) (0x00000c00+((x)*16))
-#define NV50TCL_VIEWPORT_HORIZ__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_HORIZ_X_SHIFT 0
-#define NV50TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
-#define NV50TCL_VIEWPORT_HORIZ_W_SHIFT 16
-#define NV50TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
-#define NV50TCL_VIEWPORT_VERT(x) (0x00000c04+((x)*16))
-#define NV50TCL_VIEWPORT_VERT__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_VERT_Y_SHIFT 0
-#define NV50TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
-#define NV50TCL_VIEWPORT_VERT_H_SHIFT 16
-#define NV50TCL_VIEWPORT_VERT_H_MASK 0xffff0000
-#define NV50TCL_DEPTH_RANGE_NEAR(x) (0x00000c08+((x)*16))
-#define NV50TCL_DEPTH_RANGE_NEAR__SIZE 0x00000010
-#define NV50TCL_DEPTH_RANGE_FAR(x) (0x00000c0c+((x)*16))
-#define NV50TCL_DEPTH_RANGE_FAR__SIZE 0x00000010
-#define NV50TCL_VIEWPORT_CLIP_HORIZ(x) (0x00000d00+((x)*8))
-#define NV50TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NV50TCL_VIEWPORT_CLIP_HORIZ_MIN_SHIFT 0
-#define NV50TCL_VIEWPORT_CLIP_HORIZ_MIN_MASK 0x0000ffff
-#define NV50TCL_VIEWPORT_CLIP_HORIZ_MAX_SHIFT 16
-#define NV50TCL_VIEWPORT_CLIP_HORIZ_MAX_MASK 0xffff0000
-#define NV50TCL_VIEWPORT_CLIP_VERT(x) (0x00000d04+((x)*8))
-#define NV50TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NV50TCL_VIEWPORT_CLIP_VERT_MIN_SHIFT 0
-#define NV50TCL_VIEWPORT_CLIP_VERT_MIN_MASK 0x0000ffff
-#define NV50TCL_VIEWPORT_CLIP_VERT_MAX_SHIFT 16
-#define NV50TCL_VIEWPORT_CLIP_VERT_MAX_MASK 0xffff0000
-#define NV50TCL_CLIPID_REGION_HORIZ(x) (0x00000d40+((x)*8))
-#define NV50TCL_CLIPID_REGION_HORIZ__SIZE 0x00000004
-#define NV50TCL_CLIPID_REGION_VERT(x) (0x00000d44+((x)*8))
-#define NV50TCL_CLIPID_REGION_VERT__SIZE 0x00000004
-#define NV50TCL_VERTEX_BUFFER_FIRST 0x00000d74
-#define NV50TCL_VERTEX_BUFFER_COUNT 0x00000d78
-#define NV50TCL_CLEAR_COLOR(x) (0x00000d80+((x)*4))
-#define NV50TCL_CLEAR_COLOR__SIZE 0x00000004
-#define NV50TCL_CLEAR_DEPTH 0x00000d90
-#define NV50TCL_STACK_ADDRESS_HIGH 0x00000d94
-#define NV50TCL_STACK_ADDRESS_LOW 0x00000d98
-#define NV50TCL_STACK_SIZE_LOG 0x00000d9c
-#define NV50TCL_CLEAR_STENCIL 0x00000da0
-#define NV50TCL_STRMOUT_PRIMITIVE_COUNT 0x00000da8
-#define NV50TCL_POLYGON_MODE_FRONT 0x00000dac
-#define NV50TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NV50TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NV50TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NV50TCL_POLYGON_MODE_BACK 0x00000db0
-#define NV50TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NV50TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NV50TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NV50TCL_POLYGON_SMOOTH_ENABLE 0x00000db4
-#define NV50TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000dc0
-#define NV50TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000dc4
-#define NV50TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000dc8
-#define NV50TCL_WATCHDOG_TIMER 0x00000de4
-#define NV50TCL_WINDOW_OFFSET_X 0x00000df8
-#define NV50TCL_WINDOW_OFFSET_Y 0x00000dfc
-#define NV50TCL_SCISSOR_ENABLE(x) (0x00000e00+((x)*16))
-#define NV50TCL_SCISSOR_ENABLE__SIZE 0x00000010
-#define NV50TCL_SCISSOR_HORIZ(x) (0x00000e04+((x)*16))
-#define NV50TCL_SCISSOR_HORIZ__SIZE 0x00000010
-#define NV50TCL_SCISSOR_HORIZ_MIN_SHIFT 0
-#define NV50TCL_SCISSOR_HORIZ_MIN_MASK 0x0000ffff
-#define NV50TCL_SCISSOR_HORIZ_MAX_SHIFT 16
-#define NV50TCL_SCISSOR_HORIZ_MAX_MASK 0xffff0000
-#define NV50TCL_SCISSOR_VERT(x) (0x00000e08+((x)*16))
-#define NV50TCL_SCISSOR_VERT__SIZE 0x00000010
-#define NV50TCL_SCISSOR_VERT_MIN_SHIFT 0
-#define NV50TCL_SCISSOR_VERT_MIN_MASK 0x0000ffff
-#define NV50TCL_SCISSOR_VERT_MAX_SHIFT 16
-#define NV50TCL_SCISSOR_VERT_MAX_MASK 0xffff0000
-#define NV50TCL_CB_ADDR 0x00000f00
-#define NV50TCL_CB_ADDR_ID_SHIFT 8
-#define NV50TCL_CB_ADDR_ID_MASK 0x003fff00
-#define NV50TCL_CB_ADDR_BUFFER_SHIFT 0
-#define NV50TCL_CB_ADDR_BUFFER_MASK 0x0000007f
-#define NV50TCL_CB_DATA(x) (0x00000f04+((x)*4))
-#define NV50TCL_CB_DATA__SIZE 0x00000010
-#define NV50TCL_LOCAL_WARPS_LOG_ALLOC 0x00000f44
-#define NV50TCL_LOCAL_WARPS_NO_CLAMP 0x00000f48
-#define NV50TCL_STACK_WARPS_LOG_ALLOC 0x00000f4c
-#define NV50TCL_STACK_WARPS_NO_CLAMP 0x00000f50
-#define NV50TCL_STENCIL_BACK_FUNC_REF 0x00000f54
-#define NV50TCL_STENCIL_BACK_MASK 0x00000f58
-#define NV50TCL_STENCIL_BACK_FUNC_MASK 0x00000f5c
-#define NV50TCL_GP_ADDRESS_HIGH 0x00000f70
-#define NV50TCL_GP_ADDRESS_LOW 0x00000f74
-#define NV50TCL_VP_ADDRESS_HIGH 0x00000f7c
-#define NV50TCL_VP_ADDRESS_LOW 0x00000f80
-#define NV50TCL_VERTEX_RUNOUT_HIGH 0x00000f84
-#define NV50TCL_VERTEX_RUNOUT_LOW 0x00000f88
-#define NV50TCL_DEPTH_BOUNDS(x) (0x00000f9c+((x)*4))
-#define NV50TCL_DEPTH_BOUNDS__SIZE 0x00000002
-#define NV50TCL_FP_ADDRESS_HIGH 0x00000fa4
-#define NV50TCL_FP_ADDRESS_LOW 0x00000fa8
-#define NV50TCL_MSAA_MASK(x) (0x00000fbc+((x)*4))
-#define NV50TCL_MSAA_MASK__SIZE 0x00000004
-#define NV50TCL_CLIPID_ADDRESS_HIGH 0x00000fcc
-#define NV50TCL_CLIPID_ADDRESS_LOW 0x00000fd0
-#define NV50TCL_ZETA_ADDRESS_HIGH 0x00000fe0
-#define NV50TCL_ZETA_ADDRESS_LOW 0x00000fe4
-#define NV50TCL_ZETA_FORMAT 0x00000fe8
-#define NV50TCL_ZETA_FORMAT_Z32_FLOAT 0x0000000a
-#define NV50TCL_ZETA_FORMAT_Z16_UNORM 0x00000013
-#define NV50TCL_ZETA_FORMAT_Z24S8_UNORM 0x00000014
-#define NV50TCL_ZETA_FORMAT_X8Z24_UNORM 0x00000015
-#define NV50TCL_ZETA_FORMAT_S8Z24_UNORM 0x00000016
-#define NV50TCL_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM 0x00000019
-#define NV50TCL_ZETA_TILE_MODE 0x00000fec
-#define NV50TCL_ZETA_LAYER_STRIDE 0x00000ff0
-#define NV50TCL_SCREEN_SCISSOR_HORIZ 0x00000ff4
-#define NV50TCL_SCREEN_SCISSOR_HORIZ_W_SHIFT 16
-#define NV50TCL_SCREEN_SCISSOR_HORIZ_W_MASK 0xffff0000
-#define NV50TCL_SCREEN_SCISSOR_HORIZ_X_SHIFT 0
-#define NV50TCL_SCREEN_SCISSOR_HORIZ_X_MASK 0x0000ffff
-#define NV50TCL_SCREEN_SCISSOR_VERT 0x00000ff8
-#define NV50TCL_SCREEN_SCISSOR_VERT_H_SHIFT 16
-#define NV50TCL_SCREEN_SCISSOR_VERT_H_MASK 0xffff0000
-#define NV50TCL_SCREEN_SCISSOR_VERT_Y_SHIFT 0
-#define NV50TCL_SCREEN_SCISSOR_VERT_Y_MASK 0x0000ffff
-#define NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(x) (0x00001080+((x)*8))
-#define NV50TCL_VERTEX_ARRAY_LIMIT_HIGH__SIZE 0x00000010
-#define NV50TCL_VERTEX_ARRAY_LIMIT_LOW(x) (0x00001084+((x)*8))
-#define NV50TCL_VERTEX_ARRAY_LIMIT_LOW__SIZE 0x00000010
-#define NV50TCL_RT_CONTROL 0x0000121c
-#define NV50TCL_RT_CONTROL_COUNT_SHIFT 0
-#define NV50TCL_RT_CONTROL_COUNT_MASK 0x0000000f
-#define NV50TCL_RT_CONTROL_MAP0_SHIFT 4
-#define NV50TCL_RT_CONTROL_MAP0_MASK 0x00000070
-#define NV50TCL_RT_CONTROL_MAP1_SHIFT 7
-#define NV50TCL_RT_CONTROL_MAP1_MASK 0x00000380
-#define NV50TCL_RT_CONTROL_MAP2_SHIFT 10
-#define NV50TCL_RT_CONTROL_MAP2_MASK 0x00001c00
-#define NV50TCL_RT_CONTROL_MAP3_SHIFT 13
-#define NV50TCL_RT_CONTROL_MAP3_MASK 0x0000e000
-#define NV50TCL_RT_CONTROL_MAP4_SHIFT 16
-#define NV50TCL_RT_CONTROL_MAP4_MASK 0x00070000
-#define NV50TCL_RT_CONTROL_MAP5_SHIFT 19
-#define NV50TCL_RT_CONTROL_MAP5_MASK 0x00380000
-#define NV50TCL_RT_CONTROL_MAP6_SHIFT 22
-#define NV50TCL_RT_CONTROL_MAP6_MASK 0x01c00000
-#define NV50TCL_RT_CONTROL_MAP7_SHIFT 25
-#define NV50TCL_RT_CONTROL_MAP7_MASK 0x0e000000
-#define NV50TCL_RT_ARRAY_MODE 0x00001224
-#define NV50TCL_RT_ARRAY_MODE_LAYERS_SHIFT 0
-#define NV50TCL_RT_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NV50TCL_RT_ARRAY_MODE_VOLUME (1 << 16)
-#define NV50TCL_ZETA_HORIZ 0x00001228
-#define NV50TCL_ZETA_VERT 0x0000122c
-#define NV50TCL_ZETA_ARRAY_MODE 0x00001230
-#define NV50TCL_ZETA_ARRAY_MODE_LAYERS_SHIFT 0
-#define NV50TCL_ZETA_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NV50TCL_ZETA_ARRAY_MODE_UNK (1 << 16)
-#define NV50TCL_LINKED_TSC 0x00001234
-#define NV50TCL_RT_HORIZ(x) (0x00001240+((x)*8))
-#define NV50TCL_RT_HORIZ__SIZE 0x00000008
-#define NV50TCL_RT_VERT(x) (0x00001244+((x)*8))
-#define NV50TCL_RT_VERT__SIZE 0x00000008
-#define NV50TCL_CB_DEF_ADDRESS_HIGH 0x00001280
-#define NV50TCL_CB_DEF_ADDRESS_LOW 0x00001284
-#define NV50TCL_CB_DEF_SET 0x00001288
-#define NV50TCL_CB_DEF_SET_SIZE_SHIFT 0
-#define NV50TCL_CB_DEF_SET_SIZE_MASK 0x0000ffff
-#define NV50TCL_CB_DEF_SET_BUFFER_SHIFT 16
-#define NV50TCL_CB_DEF_SET_BUFFER_MASK 0x007f0000
-#define NV50TCL_STRMOUT_BUFFERS_CTRL 0x00001294
-#define NV50TCL_STRMOUT_BUFFERS_CTRL_INTERLEAVED (1 << 0)
-#define NV50TCL_STRMOUT_BUFFERS_CTRL_SEPARATE_SHIFT 4
-#define NV50TCL_STRMOUT_BUFFERS_CTRL_SEPARATE_MASK 0x000000f0
-#define NV50TCL_STRMOUT_BUFFERS_CTRL_STRIDE_SHIFT 8
-#define NV50TCL_STRMOUT_BUFFERS_CTRL_STRIDE_MASK 0x0000ff00
-#define NV50TCL_FP_RESULT_COUNT 0x00001298
-#define NV50TCL_DEPTH_TEST_ENABLE 0x000012cc
-#define NV50TCL_SHADE_MODEL 0x000012d4
-#define NV50TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NV50TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NV50TCL_LOCAL_ADDRESS_HIGH 0x000012d8
-#define NV50TCL_LOCAL_ADDRESS_LOW 0x000012dc
-#define NV50TCL_LOCAL_SIZE_LOG 0x000012e0
-#define NV50TCL_DEPTH_WRITE_ENABLE 0x000012e8
-#define NV50TCL_ALPHA_TEST_ENABLE 0x000012ec
-#define NV50TCL_PM_SET(x) (0x000012f0+((x)*4))
-#define NV50TCL_PM_SET__SIZE 0x00000004
-#define NV50TCL_VB_ELEMENT_U8_SETUP 0x00001300
-#define NV50TCL_VB_ELEMENT_U8_SETUP_OFFSET_SHIFT 30
-#define NV50TCL_VB_ELEMENT_U8_SETUP_OFFSET_MASK 0xc0000000
-#define NV50TCL_VB_ELEMENT_U8_SETUP_COUNT_SHIFT 0
-#define NV50TCL_VB_ELEMENT_U8_SETUP_COUNT_MASK 0x3fffffff
-#define NV50TCL_VB_ELEMENT_U8 0x00001304
-#define NV50TCL_VB_ELEMENT_U8_I0_SHIFT 0
-#define NV50TCL_VB_ELEMENT_U8_I0_MASK 0x000000ff
-#define NV50TCL_VB_ELEMENT_U8_I1_SHIFT 8
-#define NV50TCL_VB_ELEMENT_U8_I1_MASK 0x0000ff00
-#define NV50TCL_VB_ELEMENT_U8_I2_SHIFT 16
-#define NV50TCL_VB_ELEMENT_U8_I2_MASK 0x00ff0000
-#define NV50TCL_VB_ELEMENT_U8_I3_SHIFT 24
-#define NV50TCL_VB_ELEMENT_U8_I3_MASK 0xff000000
-#define NV50TCL_DEPTH_TEST_FUNC 0x0000130c
-#define NV50TCL_DEPTH_TEST_FUNC_NEVER 0x00000200
-#define NV50TCL_DEPTH_TEST_FUNC_LESS 0x00000201
-#define NV50TCL_DEPTH_TEST_FUNC_EQUAL 0x00000202
-#define NV50TCL_DEPTH_TEST_FUNC_LEQUAL 0x00000203
-#define NV50TCL_DEPTH_TEST_FUNC_GREATER 0x00000204
-#define NV50TCL_DEPTH_TEST_FUNC_NOTEQUAL 0x00000205
-#define NV50TCL_DEPTH_TEST_FUNC_GEQUAL 0x00000206
-#define NV50TCL_DEPTH_TEST_FUNC_ALWAYS 0x00000207
-#define NV50TCL_ALPHA_TEST_REF 0x00001310
-#define NV50TCL_ALPHA_TEST_FUNC 0x00001314
-#define NV50TCL_ALPHA_TEST_FUNC_NEVER 0x00000200
-#define NV50TCL_ALPHA_TEST_FUNC_LESS 0x00000201
-#define NV50TCL_ALPHA_TEST_FUNC_EQUAL 0x00000202
-#define NV50TCL_ALPHA_TEST_FUNC_LEQUAL 0x00000203
-#define NV50TCL_ALPHA_TEST_FUNC_GREATER 0x00000204
-#define NV50TCL_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
-#define NV50TCL_ALPHA_TEST_FUNC_GEQUAL 0x00000206
-#define NV50TCL_ALPHA_TEST_FUNC_ALWAYS 0x00000207
-#define NV50TCL_BLEND_COLOR(x) (0x0000131c+((x)*4))
-#define NV50TCL_BLEND_COLOR__SIZE 0x00000004
-#define NV50TCL_TIC_FLUSH 0x00001330
-#define NV50TCL_TSC_FLUSH 0x00001334
-#define NV50TCL_TEX_CACHE_CTL 0x00001338
-#define NV50TCL_BLEND_EQUATION_RGB 0x00001340
-#define NV50TCL_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
-#define NV50TCL_BLEND_EQUATION_RGB_MIN 0x00008007
-#define NV50TCL_BLEND_EQUATION_RGB_MAX 0x00008008
-#define NV50TCL_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
-#define NV50TCL_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV50TCL_BLEND_FUNC_SRC_RGB 0x00001344
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00004000
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE 0x00004001
-#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00004300
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00004302
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NV50TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00004304
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NV50TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00004306
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NV50TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x0000c001
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NV50TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x0000c003
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC1_COLOR 0x0000c900
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC1_ALPHA 0x0000c902
-#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NV50TCL_BLEND_FUNC_DST_RGB 0x00001348
-#define NV50TCL_BLEND_FUNC_DST_RGB_ZERO 0x00004000
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE 0x00004001
-#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00004300
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00004302
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NV50TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00004304
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NV50TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00004306
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NV50TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x0000c001
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NV50TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x0000c003
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NV50TCL_BLEND_FUNC_DST_RGB_SRC1_COLOR 0x0000c900
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NV50TCL_BLEND_FUNC_DST_RGB_SRC1_ALPHA 0x0000c902
-#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NV50TCL_BLEND_EQUATION_ALPHA 0x0000134c
-#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
-#define NV50TCL_BLEND_EQUATION_ALPHA_MIN 0x00008007
-#define NV50TCL_BLEND_EQUATION_ALPHA_MAX 0x00008008
-#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
-#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA 0x00001350
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00004000
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00004001
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x00004300
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x00004302
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x00004304
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x00004306
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC1_COLOR 0x0000c900
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC1_ALPHA 0x0000c902
-#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NV50TCL_BLEND_FUNC_DST_ALPHA 0x00001358
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00004000
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00004001
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x00004300
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x00004302
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x00004304
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x00004306
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC1_COLOR 0x0000c900
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC1_ALPHA 0x0000c902
-#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NV50TCL_BLEND_ENABLE(x) (0x00001360+((x)*4))
-#define NV50TCL_BLEND_ENABLE__SIZE 0x00000008
-#define NV50TCL_STENCIL_FRONT_ENABLE 0x00001380
-#define NV50TCL_STENCIL_FRONT_OP_FAIL 0x00001384
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL 0x00001388
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS 0x0000138c
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC 0x00001390
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
-#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
-#define NV50TCL_STENCIL_FRONT_FUNC_REF 0x00001394
-#define NV50TCL_STENCIL_FRONT_MASK 0x00001398
-#define NV50TCL_STENCIL_FRONT_FUNC_MASK 0x0000139c
-#define NV50TCL_FRAG_COLOR_CLAMP_EN 0x000013a8
-#define NV50TCL_Y_ORIGIN_BOTTOM 0x000013ac
-#define NV50TCL_LINE_WIDTH 0x000013b0
-#define NV50TCL_TEX_LIMITS(x) (0x000013b4+((x)*4))
-#define NV50TCL_TEX_LIMITS__SIZE 0x00000003
-#define NV50TCL_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
-#define NV50TCL_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
-#define NV50TCL_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
-#define NV50TCL_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
-#define NV50TCL_POINT_COORD_REPLACE_MAP(x) (0x000013c0+((x)*4))
-#define NV50TCL_POINT_COORD_REPLACE_MAP__SIZE 0x00000008
-#define NV50TCL_VP_START_ID 0x0000140c
-#define NV50TCL_GP_START_ID 0x00001410
-#define NV50TCL_FP_START_ID 0x00001414
-#define NV50TCL_GP_VERTEX_OUTPUT_COUNT 0x00001420
-#define NV50TCL_VB_ELEMENT_BASE 0x00001434
-#define NV50TCL_INSTANCE_BASE 0x00001438
-#define NV50TCL_CODE_CB_FLUSH 0x00001440
-#define NV50TCL_BIND_TSC(x) (0x00001444+((x)*8))
-#define NV50TCL_BIND_TSC__SIZE 0x00000003
-#define NV50TCL_BIND_TSC_VALID (1 << 0)
-#define NV50TCL_BIND_TSC_SAMPLER_SHIFT 4
-#define NV50TCL_BIND_TSC_SAMPLER_MASK 0x000000f0
-#define NV50TCL_BIND_TSC_TSC_SHIFT 12
-#define NV50TCL_BIND_TSC_TSC_MASK 0x001ff000
-#define NV50TCL_BIND_TIC(x) (0x00001448+((x)*8))
-#define NV50TCL_BIND_TIC__SIZE 0x00000003
-#define NV50TCL_BIND_TIC_VALID (1 << 0)
-#define NV50TCL_BIND_TIC_TEXTURE_SHIFT 1
-#define NV50TCL_BIND_TIC_TEXTURE_MASK 0x000001fe
-#define NV50TCL_BIND_TIC_TIC_SHIFT 9
-#define NV50TCL_BIND_TIC_TIC_MASK 0x7ffffe00
-#define NV50TCL_STRMOUT_MAP(x) (0x00001480+((x)*4))
-#define NV50TCL_STRMOUT_MAP__SIZE 0x00000020
-#define NV50TCL_CLIPID_HEIGHT 0x00001504
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE 0x00001510
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_0 (1 << 0)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_1 (1 << 1)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_2 (1 << 2)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_3 (1 << 3)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_4 (1 << 4)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_5 (1 << 5)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_6 (1 << 6)
-#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_7 (1 << 7)
-#define NV50TCL_SAMPLECNT_ENABLE 0x00001514
-#define NV50TCL_POINT_SIZE 0x00001518
-#define NV50TCL_POINT_SPRITE_ENABLE 0x00001520
-#define NV50TCL_SAMPLECNT_RESET 0x00001530
-#define NV50TCL_ZETA_ENABLE 0x00001538
-#define NV50TCL_MULTISAMPLE_CTRL 0x0000153c
-#define NV50TCL_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE (1 << 0)
-#define NV50TCL_MULTISAMPLE_CTRL_ALPHA_TO_ONE (1 << 4)
-#define NV50TCL_NOPERSPECTIVE_BITMAP(x) (0x00001540+((x)*4))
-#define NV50TCL_NOPERSPECTIVE_BITMAP__SIZE 0x00000004
-#define NV50TCL_COND_ADDRESS_HIGH 0x00001550
-#define NV50TCL_COND_ADDRESS_LOW 0x00001554
-#define NV50TCL_COND_MODE 0x00001558
-#define NV50TCL_COND_MODE_NEVER 0x00000000
-#define NV50TCL_COND_MODE_ALWAYS 0x00000001
-#define NV50TCL_COND_MODE_RES 0x00000002
-#define NV50TCL_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
-#define NV50TCL_COND_MODE_RES_OR_ID 0x00000004
-#define NV50TCL_TSC_ADDRESS_HIGH 0x0000155c
-#define NV50TCL_TSC_ADDRESS_LOW 0x00001560
-#define NV50TCL_TSC_LIMIT 0x00001564
-#define NV50TCL_POLYGON_OFFSET_FACTOR 0x0000156c
-#define NV50TCL_LINE_SMOOTH_ENABLE 0x00001570
-#define NV50TCL_TIC_ADDRESS_HIGH 0x00001574
-#define NV50TCL_TIC_ADDRESS_LOW 0x00001578
-#define NV50TCL_TIC_LIMIT 0x0000157c
-#define NV50TCL_PM_CONTROL(x) (0x00001580+((x)*4))
-#define NV50TCL_PM_CONTROL__SIZE 0x00000004
-#define NV50TCL_PM_CONTROL_UNK0 (1 << 0)
-#define NV50TCL_PM_CONTROL_UNK1_SHIFT 4
-#define NV50TCL_PM_CONTROL_UNK1_MASK 0x00000070
-#define NV50TCL_PM_CONTROL_UNK2_SHIFT 8
-#define NV50TCL_PM_CONTROL_UNK2_MASK 0xffffff00
-#define NV50TCL_STENCIL_BACK_ENABLE 0x00001594
-#define NV50TCL_STENCIL_BACK_OP_FAIL 0x00001598
-#define NV50TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
-#define NV50TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
-#define NV50TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
-#define NV50TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
-#define NV50TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
-#define NV50TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL 0x0000159c
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_BACK_OP_ZPASS 0x000015a0
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
-#define NV50TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC 0x000015a4
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
-#define NV50TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
-#define NV50TCL_FRAMEBUFFER_SRGB 0x000015b8
-#define NV50TCL_POLYGON_OFFSET_UNITS 0x000015bc
-#define NV50TCL_GP_BUILTIN_RESULT_EN 0x000015cc
-#define NV50TCL_GP_BUILTIN_RESULT_EN_VPORT_IDX (1 << 0)
-#define NV50TCL_GP_BUILTIN_RESULT_EN_LAYER_IDX (1 << 16)
-#define NV50TCL_MULTISAMPLE_MODE 0x000015d0
-#define NV50TCL_MULTISAMPLE_MODE_1X 0x00000000
-#define NV50TCL_MULTISAMPLE_MODE_2XMS 0x00000001
-#define NV50TCL_MULTISAMPLE_MODE_4XMS 0x00000002
-#define NV50TCL_MULTISAMPLE_MODE_8XMS 0x00000004
-#define NV50TCL_MULTISAMPLE_MODE_4XMS_4XCS 0x00000008
-#define NV50TCL_MULTISAMPLE_MODE_4XMS_12XCS 0x00000009
-#define NV50TCL_MULTISAMPLE_MODE_8XMS_8XCS 0x0000000a
-#define NV50TCL_VERTEX_BEGIN 0x000015dc
-#define NV50TCL_VERTEX_BEGIN_POINTS 0x00000000
-#define NV50TCL_VERTEX_BEGIN_LINES 0x00000001
-#define NV50TCL_VERTEX_BEGIN_LINE_LOOP 0x00000002
-#define NV50TCL_VERTEX_BEGIN_LINE_STRIP 0x00000003
-#define NV50TCL_VERTEX_BEGIN_TRIANGLES 0x00000004
-#define NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP 0x00000005
-#define NV50TCL_VERTEX_BEGIN_TRIANGLE_FAN 0x00000006
-#define NV50TCL_VERTEX_BEGIN_QUADS 0x00000007
-#define NV50TCL_VERTEX_BEGIN_QUAD_STRIP 0x00000008
-#define NV50TCL_VERTEX_BEGIN_POLYGON 0x00000009
-#define NV50TCL_VERTEX_BEGIN_LINES_ADJACENCY 0x0000000a
-#define NV50TCL_VERTEX_BEGIN_LINE_STRIP_ADJACENCY 0x0000000b
-#define NV50TCL_VERTEX_BEGIN_TRIANGLES_ADJACENCY 0x0000000c
-#define NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP_ADJACENCY 0x0000000d
-#define NV50TCL_VERTEX_BEGIN_PATCHES 0x0000000e
-#define NV50TCL_VERTEX_END 0x000015e0
-#define NV50TCL_EDGEFLAG_ENABLE 0x000015e4
-#define NV50TCL_VB_ELEMENT_U32 0x000015e8
-#define NV50TCL_VB_ELEMENT_U16_SETUP 0x000015ec
-#define NV50TCL_VB_ELEMENT_U16_SETUP_OFFSET_SHIFT 30
-#define NV50TCL_VB_ELEMENT_U16_SETUP_OFFSET_MASK 0xc0000000
-#define NV50TCL_VB_ELEMENT_U16_SETUP_COUNT_SHIFT 0
-#define NV50TCL_VB_ELEMENT_U16_SETUP_COUNT_MASK 0x3fffffff
-#define NV50TCL_VB_ELEMENT_U16 0x000015f0
-#define NV50TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NV50TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NV50TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NV50TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NV50TCL_VERTEX_BASE_HIGH 0x000015f4
-#define NV50TCL_VERTEX_BASE_LOW 0x000015f8
-#define NV50TCL_VERTEX_DATA 0x00001640
-#define NV50TCL_PRIM_RESTART_ENABLE 0x00001644
-#define NV50TCL_PRIM_RESTART_INDEX 0x00001648
-#define NV50TCL_VP_GP_BUILTIN_ATTR_EN 0x0000164c
-#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID (1 << 0)
-#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_INSTANCE_ID (1 << 4)
-#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID (1 << 8)
-#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_UNK12 (1 << 12)
-#define NV50TCL_VP_ATTR_EN_0 0x00001650
-#define NV50TCL_VP_ATTR_EN_0_7_SHIFT 28
-#define NV50TCL_VP_ATTR_EN_0_7_MASK 0xf0000000
-#define NV50TCL_VP_ATTR_EN_0_7_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_7_XNNN 0x10000000
-#define NV50TCL_VP_ATTR_EN_0_7_NYNN 0x20000000
-#define NV50TCL_VP_ATTR_EN_0_7_XYNN 0x30000000
-#define NV50TCL_VP_ATTR_EN_0_7_NNZN 0x40000000
-#define NV50TCL_VP_ATTR_EN_0_7_XNZN 0x50000000
-#define NV50TCL_VP_ATTR_EN_0_7_NYZN 0x60000000
-#define NV50TCL_VP_ATTR_EN_0_7_XYZN 0x70000000
-#define NV50TCL_VP_ATTR_EN_0_7_NNNW 0x80000000
-#define NV50TCL_VP_ATTR_EN_0_7_XNNW 0x90000000
-#define NV50TCL_VP_ATTR_EN_0_7_NYNW 0xa0000000
-#define NV50TCL_VP_ATTR_EN_0_7_XYNW 0xb0000000
-#define NV50TCL_VP_ATTR_EN_0_7_NNZW 0xc0000000
-#define NV50TCL_VP_ATTR_EN_0_7_XNZW 0xd0000000
-#define NV50TCL_VP_ATTR_EN_0_7_NYZW 0xe0000000
-#define NV50TCL_VP_ATTR_EN_0_7_XYZW 0xf0000000
-#define NV50TCL_VP_ATTR_EN_0_6_SHIFT 24
-#define NV50TCL_VP_ATTR_EN_0_6_MASK 0x0f000000
-#define NV50TCL_VP_ATTR_EN_0_6_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_6_XNNN 0x01000000
-#define NV50TCL_VP_ATTR_EN_0_6_NYNN 0x02000000
-#define NV50TCL_VP_ATTR_EN_0_6_XYNN 0x03000000
-#define NV50TCL_VP_ATTR_EN_0_6_NNZN 0x04000000
-#define NV50TCL_VP_ATTR_EN_0_6_XNZN 0x05000000
-#define NV50TCL_VP_ATTR_EN_0_6_NYZN 0x06000000
-#define NV50TCL_VP_ATTR_EN_0_6_XYZN 0x07000000
-#define NV50TCL_VP_ATTR_EN_0_6_NNNW 0x08000000
-#define NV50TCL_VP_ATTR_EN_0_6_XNNW 0x09000000
-#define NV50TCL_VP_ATTR_EN_0_6_NYNW 0x0a000000
-#define NV50TCL_VP_ATTR_EN_0_6_XYNW 0x0b000000
-#define NV50TCL_VP_ATTR_EN_0_6_NNZW 0x0c000000
-#define NV50TCL_VP_ATTR_EN_0_6_XNZW 0x0d000000
-#define NV50TCL_VP_ATTR_EN_0_6_NYZW 0x0e000000
-#define NV50TCL_VP_ATTR_EN_0_6_XYZW 0x0f000000
-#define NV50TCL_VP_ATTR_EN_0_5_SHIFT 20
-#define NV50TCL_VP_ATTR_EN_0_5_MASK 0x00f00000
-#define NV50TCL_VP_ATTR_EN_0_5_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_5_XNNN 0x00100000
-#define NV50TCL_VP_ATTR_EN_0_5_NYNN 0x00200000
-#define NV50TCL_VP_ATTR_EN_0_5_XYNN 0x00300000
-#define NV50TCL_VP_ATTR_EN_0_5_NNZN 0x00400000
-#define NV50TCL_VP_ATTR_EN_0_5_XNZN 0x00500000
-#define NV50TCL_VP_ATTR_EN_0_5_NYZN 0x00600000
-#define NV50TCL_VP_ATTR_EN_0_5_XYZN 0x00700000
-#define NV50TCL_VP_ATTR_EN_0_5_NNNW 0x00800000
-#define NV50TCL_VP_ATTR_EN_0_5_XNNW 0x00900000
-#define NV50TCL_VP_ATTR_EN_0_5_NYNW 0x00a00000
-#define NV50TCL_VP_ATTR_EN_0_5_XYNW 0x00b00000
-#define NV50TCL_VP_ATTR_EN_0_5_NNZW 0x00c00000
-#define NV50TCL_VP_ATTR_EN_0_5_XNZW 0x00d00000
-#define NV50TCL_VP_ATTR_EN_0_5_NYZW 0x00e00000
-#define NV50TCL_VP_ATTR_EN_0_5_XYZW 0x00f00000
-#define NV50TCL_VP_ATTR_EN_0_4_SHIFT 16
-#define NV50TCL_VP_ATTR_EN_0_4_MASK 0x000f0000
-#define NV50TCL_VP_ATTR_EN_0_4_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_4_XNNN 0x00010000
-#define NV50TCL_VP_ATTR_EN_0_4_NYNN 0x00020000
-#define NV50TCL_VP_ATTR_EN_0_4_XYNN 0x00030000
-#define NV50TCL_VP_ATTR_EN_0_4_NNZN 0x00040000
-#define NV50TCL_VP_ATTR_EN_0_4_XNZN 0x00050000
-#define NV50TCL_VP_ATTR_EN_0_4_NYZN 0x00060000
-#define NV50TCL_VP_ATTR_EN_0_4_XYZN 0x00070000
-#define NV50TCL_VP_ATTR_EN_0_4_NNNW 0x00080000
-#define NV50TCL_VP_ATTR_EN_0_4_XNNW 0x00090000
-#define NV50TCL_VP_ATTR_EN_0_4_NYNW 0x000a0000
-#define NV50TCL_VP_ATTR_EN_0_4_XYNW 0x000b0000
-#define NV50TCL_VP_ATTR_EN_0_4_NNZW 0x000c0000
-#define NV50TCL_VP_ATTR_EN_0_4_XNZW 0x000d0000
-#define NV50TCL_VP_ATTR_EN_0_4_NYZW 0x000e0000
-#define NV50TCL_VP_ATTR_EN_0_4_XYZW 0x000f0000
-#define NV50TCL_VP_ATTR_EN_0_3_SHIFT 12
-#define NV50TCL_VP_ATTR_EN_0_3_MASK 0x0000f000
-#define NV50TCL_VP_ATTR_EN_0_3_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_3_XNNN 0x00001000
-#define NV50TCL_VP_ATTR_EN_0_3_NYNN 0x00002000
-#define NV50TCL_VP_ATTR_EN_0_3_XYNN 0x00003000
-#define NV50TCL_VP_ATTR_EN_0_3_NNZN 0x00004000
-#define NV50TCL_VP_ATTR_EN_0_3_XNZN 0x00005000
-#define NV50TCL_VP_ATTR_EN_0_3_NYZN 0x00006000
-#define NV50TCL_VP_ATTR_EN_0_3_XYZN 0x00007000
-#define NV50TCL_VP_ATTR_EN_0_3_NNNW 0x00008000
-#define NV50TCL_VP_ATTR_EN_0_3_XNNW 0x00009000
-#define NV50TCL_VP_ATTR_EN_0_3_NYNW 0x0000a000
-#define NV50TCL_VP_ATTR_EN_0_3_XYNW 0x0000b000
-#define NV50TCL_VP_ATTR_EN_0_3_NNZW 0x0000c000
-#define NV50TCL_VP_ATTR_EN_0_3_XNZW 0x0000d000
-#define NV50TCL_VP_ATTR_EN_0_3_NYZW 0x0000e000
-#define NV50TCL_VP_ATTR_EN_0_3_XYZW 0x0000f000
-#define NV50TCL_VP_ATTR_EN_0_2_SHIFT 8
-#define NV50TCL_VP_ATTR_EN_0_2_MASK 0x00000f00
-#define NV50TCL_VP_ATTR_EN_0_2_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_2_XNNN 0x00000100
-#define NV50TCL_VP_ATTR_EN_0_2_NYNN 0x00000200
-#define NV50TCL_VP_ATTR_EN_0_2_XYNN 0x00000300
-#define NV50TCL_VP_ATTR_EN_0_2_NNZN 0x00000400
-#define NV50TCL_VP_ATTR_EN_0_2_XNZN 0x00000500
-#define NV50TCL_VP_ATTR_EN_0_2_NYZN 0x00000600
-#define NV50TCL_VP_ATTR_EN_0_2_XYZN 0x00000700
-#define NV50TCL_VP_ATTR_EN_0_2_NNNW 0x00000800
-#define NV50TCL_VP_ATTR_EN_0_2_XNNW 0x00000900
-#define NV50TCL_VP_ATTR_EN_0_2_NYNW 0x00000a00
-#define NV50TCL_VP_ATTR_EN_0_2_XYNW 0x00000b00
-#define NV50TCL_VP_ATTR_EN_0_2_NNZW 0x00000c00
-#define NV50TCL_VP_ATTR_EN_0_2_XNZW 0x00000d00
-#define NV50TCL_VP_ATTR_EN_0_2_NYZW 0x00000e00
-#define NV50TCL_VP_ATTR_EN_0_2_XYZW 0x00000f00
-#define NV50TCL_VP_ATTR_EN_0_1_SHIFT 4
-#define NV50TCL_VP_ATTR_EN_0_1_MASK 0x000000f0
-#define NV50TCL_VP_ATTR_EN_0_1_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_1_XNNN 0x00000010
-#define NV50TCL_VP_ATTR_EN_0_1_NYNN 0x00000020
-#define NV50TCL_VP_ATTR_EN_0_1_XYNN 0x00000030
-#define NV50TCL_VP_ATTR_EN_0_1_NNZN 0x00000040
-#define NV50TCL_VP_ATTR_EN_0_1_XNZN 0x00000050
-#define NV50TCL_VP_ATTR_EN_0_1_NYZN 0x00000060
-#define NV50TCL_VP_ATTR_EN_0_1_XYZN 0x00000070
-#define NV50TCL_VP_ATTR_EN_0_1_NNNW 0x00000080
-#define NV50TCL_VP_ATTR_EN_0_1_XNNW 0x00000090
-#define NV50TCL_VP_ATTR_EN_0_1_NYNW 0x000000a0
-#define NV50TCL_VP_ATTR_EN_0_1_XYNW 0x000000b0
-#define NV50TCL_VP_ATTR_EN_0_1_NNZW 0x000000c0
-#define NV50TCL_VP_ATTR_EN_0_1_XNZW 0x000000d0
-#define NV50TCL_VP_ATTR_EN_0_1_NYZW 0x000000e0
-#define NV50TCL_VP_ATTR_EN_0_1_XYZW 0x000000f0
-#define NV50TCL_VP_ATTR_EN_0_0_SHIFT 0
-#define NV50TCL_VP_ATTR_EN_0_0_MASK 0x0000000f
-#define NV50TCL_VP_ATTR_EN_0_0_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_0_0_XNNN 0x00000001
-#define NV50TCL_VP_ATTR_EN_0_0_NYNN 0x00000002
-#define NV50TCL_VP_ATTR_EN_0_0_XYNN 0x00000003
-#define NV50TCL_VP_ATTR_EN_0_0_NNZN 0x00000004
-#define NV50TCL_VP_ATTR_EN_0_0_XNZN 0x00000005
-#define NV50TCL_VP_ATTR_EN_0_0_NYZN 0x00000006
-#define NV50TCL_VP_ATTR_EN_0_0_XYZN 0x00000007
-#define NV50TCL_VP_ATTR_EN_0_0_NNNW 0x00000008
-#define NV50TCL_VP_ATTR_EN_0_0_XNNW 0x00000009
-#define NV50TCL_VP_ATTR_EN_0_0_NYNW 0x0000000a
-#define NV50TCL_VP_ATTR_EN_0_0_XYNW 0x0000000b
-#define NV50TCL_VP_ATTR_EN_0_0_NNZW 0x0000000c
-#define NV50TCL_VP_ATTR_EN_0_0_XNZW 0x0000000d
-#define NV50TCL_VP_ATTR_EN_0_0_NYZW 0x0000000e
-#define NV50TCL_VP_ATTR_EN_0_0_XYZW 0x0000000f
-#define NV50TCL_VP_ATTR_EN_1 0x00001654
-#define NV50TCL_VP_ATTR_EN_1_15_SHIFT 28
-#define NV50TCL_VP_ATTR_EN_1_15_MASK 0xf0000000
-#define NV50TCL_VP_ATTR_EN_1_15_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_15_XNNN 0x10000000
-#define NV50TCL_VP_ATTR_EN_1_15_NYNN 0x20000000
-#define NV50TCL_VP_ATTR_EN_1_15_XYNN 0x30000000
-#define NV50TCL_VP_ATTR_EN_1_15_NNZN 0x40000000
-#define NV50TCL_VP_ATTR_EN_1_15_XNZN 0x50000000
-#define NV50TCL_VP_ATTR_EN_1_15_NYZN 0x60000000
-#define NV50TCL_VP_ATTR_EN_1_15_XYZN 0x70000000
-#define NV50TCL_VP_ATTR_EN_1_15_NNNW 0x80000000
-#define NV50TCL_VP_ATTR_EN_1_15_XNNW 0x90000000
-#define NV50TCL_VP_ATTR_EN_1_15_NYNW 0xa0000000
-#define NV50TCL_VP_ATTR_EN_1_15_XYNW 0xb0000000
-#define NV50TCL_VP_ATTR_EN_1_15_NNZW 0xc0000000
-#define NV50TCL_VP_ATTR_EN_1_15_XNZW 0xd0000000
-#define NV50TCL_VP_ATTR_EN_1_15_NYZW 0xe0000000
-#define NV50TCL_VP_ATTR_EN_1_15_XYZW 0xf0000000
-#define NV50TCL_VP_ATTR_EN_1_14_SHIFT 24
-#define NV50TCL_VP_ATTR_EN_1_14_MASK 0x0f000000
-#define NV50TCL_VP_ATTR_EN_1_14_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_14_XNNN 0x01000000
-#define NV50TCL_VP_ATTR_EN_1_14_NYNN 0x02000000
-#define NV50TCL_VP_ATTR_EN_1_14_XYNN 0x03000000
-#define NV50TCL_VP_ATTR_EN_1_14_NNZN 0x04000000
-#define NV50TCL_VP_ATTR_EN_1_14_XNZN 0x05000000
-#define NV50TCL_VP_ATTR_EN_1_14_NYZN 0x06000000
-#define NV50TCL_VP_ATTR_EN_1_14_XYZN 0x07000000
-#define NV50TCL_VP_ATTR_EN_1_14_NNNW 0x08000000
-#define NV50TCL_VP_ATTR_EN_1_14_XNNW 0x09000000
-#define NV50TCL_VP_ATTR_EN_1_14_NYNW 0x0a000000
-#define NV50TCL_VP_ATTR_EN_1_14_XYNW 0x0b000000
-#define NV50TCL_VP_ATTR_EN_1_14_NNZW 0x0c000000
-#define NV50TCL_VP_ATTR_EN_1_14_XNZW 0x0d000000
-#define NV50TCL_VP_ATTR_EN_1_14_NYZW 0x0e000000
-#define NV50TCL_VP_ATTR_EN_1_14_XYZW 0x0f000000
-#define NV50TCL_VP_ATTR_EN_1_13_SHIFT 20
-#define NV50TCL_VP_ATTR_EN_1_13_MASK 0x00f00000
-#define NV50TCL_VP_ATTR_EN_1_13_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_13_XNNN 0x00100000
-#define NV50TCL_VP_ATTR_EN_1_13_NYNN 0x00200000
-#define NV50TCL_VP_ATTR_EN_1_13_XYNN 0x00300000
-#define NV50TCL_VP_ATTR_EN_1_13_NNZN 0x00400000
-#define NV50TCL_VP_ATTR_EN_1_13_XNZN 0x00500000
-#define NV50TCL_VP_ATTR_EN_1_13_NYZN 0x00600000
-#define NV50TCL_VP_ATTR_EN_1_13_XYZN 0x00700000
-#define NV50TCL_VP_ATTR_EN_1_13_NNNW 0x00800000
-#define NV50TCL_VP_ATTR_EN_1_13_XNNW 0x00900000
-#define NV50TCL_VP_ATTR_EN_1_13_NYNW 0x00a00000
-#define NV50TCL_VP_ATTR_EN_1_13_XYNW 0x00b00000
-#define NV50TCL_VP_ATTR_EN_1_13_NNZW 0x00c00000
-#define NV50TCL_VP_ATTR_EN_1_13_XNZW 0x00d00000
-#define NV50TCL_VP_ATTR_EN_1_13_NYZW 0x00e00000
-#define NV50TCL_VP_ATTR_EN_1_13_XYZW 0x00f00000
-#define NV50TCL_VP_ATTR_EN_1_12_SHIFT 16
-#define NV50TCL_VP_ATTR_EN_1_12_MASK 0x000f0000
-#define NV50TCL_VP_ATTR_EN_1_12_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_12_XNNN 0x00010000
-#define NV50TCL_VP_ATTR_EN_1_12_NYNN 0x00020000
-#define NV50TCL_VP_ATTR_EN_1_12_XYNN 0x00030000
-#define NV50TCL_VP_ATTR_EN_1_12_NNZN 0x00040000
-#define NV50TCL_VP_ATTR_EN_1_12_XNZN 0x00050000
-#define NV50TCL_VP_ATTR_EN_1_12_NYZN 0x00060000
-#define NV50TCL_VP_ATTR_EN_1_12_XYZN 0x00070000
-#define NV50TCL_VP_ATTR_EN_1_12_NNNW 0x00080000
-#define NV50TCL_VP_ATTR_EN_1_12_XNNW 0x00090000
-#define NV50TCL_VP_ATTR_EN_1_12_NYNW 0x000a0000
-#define NV50TCL_VP_ATTR_EN_1_12_XYNW 0x000b0000
-#define NV50TCL_VP_ATTR_EN_1_12_NNZW 0x000c0000
-#define NV50TCL_VP_ATTR_EN_1_12_XNZW 0x000d0000
-#define NV50TCL_VP_ATTR_EN_1_12_NYZW 0x000e0000
-#define NV50TCL_VP_ATTR_EN_1_12_XYZW 0x000f0000
-#define NV50TCL_VP_ATTR_EN_1_11_SHIFT 12
-#define NV50TCL_VP_ATTR_EN_1_11_MASK 0x0000f000
-#define NV50TCL_VP_ATTR_EN_1_11_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_11_XNNN 0x00001000
-#define NV50TCL_VP_ATTR_EN_1_11_NYNN 0x00002000
-#define NV50TCL_VP_ATTR_EN_1_11_XYNN 0x00003000
-#define NV50TCL_VP_ATTR_EN_1_11_NNZN 0x00004000
-#define NV50TCL_VP_ATTR_EN_1_11_XNZN 0x00005000
-#define NV50TCL_VP_ATTR_EN_1_11_NYZN 0x00006000
-#define NV50TCL_VP_ATTR_EN_1_11_XYZN 0x00007000
-#define NV50TCL_VP_ATTR_EN_1_11_NNNW 0x00008000
-#define NV50TCL_VP_ATTR_EN_1_11_XNNW 0x00009000
-#define NV50TCL_VP_ATTR_EN_1_11_NYNW 0x0000a000
-#define NV50TCL_VP_ATTR_EN_1_11_XYNW 0x0000b000
-#define NV50TCL_VP_ATTR_EN_1_11_NNZW 0x0000c000
-#define NV50TCL_VP_ATTR_EN_1_11_XNZW 0x0000d000
-#define NV50TCL_VP_ATTR_EN_1_11_NYZW 0x0000e000
-#define NV50TCL_VP_ATTR_EN_1_11_XYZW 0x0000f000
-#define NV50TCL_VP_ATTR_EN_1_10_SHIFT 8
-#define NV50TCL_VP_ATTR_EN_1_10_MASK 0x00000f00
-#define NV50TCL_VP_ATTR_EN_1_10_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_10_XNNN 0x00000100
-#define NV50TCL_VP_ATTR_EN_1_10_NYNN 0x00000200
-#define NV50TCL_VP_ATTR_EN_1_10_XYNN 0x00000300
-#define NV50TCL_VP_ATTR_EN_1_10_NNZN 0x00000400
-#define NV50TCL_VP_ATTR_EN_1_10_XNZN 0x00000500
-#define NV50TCL_VP_ATTR_EN_1_10_NYZN 0x00000600
-#define NV50TCL_VP_ATTR_EN_1_10_XYZN 0x00000700
-#define NV50TCL_VP_ATTR_EN_1_10_NNNW 0x00000800
-#define NV50TCL_VP_ATTR_EN_1_10_XNNW 0x00000900
-#define NV50TCL_VP_ATTR_EN_1_10_NYNW 0x00000a00
-#define NV50TCL_VP_ATTR_EN_1_10_XYNW 0x00000b00
-#define NV50TCL_VP_ATTR_EN_1_10_NNZW 0x00000c00
-#define NV50TCL_VP_ATTR_EN_1_10_XNZW 0x00000d00
-#define NV50TCL_VP_ATTR_EN_1_10_NYZW 0x00000e00
-#define NV50TCL_VP_ATTR_EN_1_10_XYZW 0x00000f00
-#define NV50TCL_VP_ATTR_EN_1_9_SHIFT 4
-#define NV50TCL_VP_ATTR_EN_1_9_MASK 0x000000f0
-#define NV50TCL_VP_ATTR_EN_1_9_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_9_XNNN 0x00000010
-#define NV50TCL_VP_ATTR_EN_1_9_NYNN 0x00000020
-#define NV50TCL_VP_ATTR_EN_1_9_XYNN 0x00000030
-#define NV50TCL_VP_ATTR_EN_1_9_NNZN 0x00000040
-#define NV50TCL_VP_ATTR_EN_1_9_XNZN 0x00000050
-#define NV50TCL_VP_ATTR_EN_1_9_NYZN 0x00000060
-#define NV50TCL_VP_ATTR_EN_1_9_XYZN 0x00000070
-#define NV50TCL_VP_ATTR_EN_1_9_NNNW 0x00000080
-#define NV50TCL_VP_ATTR_EN_1_9_XNNW 0x00000090
-#define NV50TCL_VP_ATTR_EN_1_9_NYNW 0x000000a0
-#define NV50TCL_VP_ATTR_EN_1_9_XYNW 0x000000b0
-#define NV50TCL_VP_ATTR_EN_1_9_NNZW 0x000000c0
-#define NV50TCL_VP_ATTR_EN_1_9_XNZW 0x000000d0
-#define NV50TCL_VP_ATTR_EN_1_9_NYZW 0x000000e0
-#define NV50TCL_VP_ATTR_EN_1_9_XYZW 0x000000f0
-#define NV50TCL_VP_ATTR_EN_1_8_SHIFT 0
-#define NV50TCL_VP_ATTR_EN_1_8_MASK 0x0000000f
-#define NV50TCL_VP_ATTR_EN_1_8_NONE 0x00000000
-#define NV50TCL_VP_ATTR_EN_1_8_XNNN 0x00000001
-#define NV50TCL_VP_ATTR_EN_1_8_NYNN 0x00000002
-#define NV50TCL_VP_ATTR_EN_1_8_XYNN 0x00000003
-#define NV50TCL_VP_ATTR_EN_1_8_NNZN 0x00000004
-#define NV50TCL_VP_ATTR_EN_1_8_XNZN 0x00000005
-#define NV50TCL_VP_ATTR_EN_1_8_NYZN 0x00000006
-#define NV50TCL_VP_ATTR_EN_1_8_XYZN 0x00000007
-#define NV50TCL_VP_ATTR_EN_1_8_NNNW 0x00000008
-#define NV50TCL_VP_ATTR_EN_1_8_XNNW 0x00000009
-#define NV50TCL_VP_ATTR_EN_1_8_NYNW 0x0000000a
-#define NV50TCL_VP_ATTR_EN_1_8_XYNW 0x0000000b
-#define NV50TCL_VP_ATTR_EN_1_8_NNZW 0x0000000c
-#define NV50TCL_VP_ATTR_EN_1_8_XNZW 0x0000000d
-#define NV50TCL_VP_ATTR_EN_1_8_NYZW 0x0000000e
-#define NV50TCL_VP_ATTR_EN_1_8_XYZW 0x0000000f
-#define NV50TCL_POINT_SPRITE_CTRL 0x00001660
-#define NV50TCL_LINE_STIPPLE_ENABLE 0x0000166c
-#define NV50TCL_LINE_STIPPLE_PATTERN 0x00001680
-#define NV50TCL_PROVOKING_VERTEX_LAST 0x00001684
-#define NV50TCL_VERTEX_TWO_SIDE_ENABLE 0x00001688
-#define NV50TCL_POLYGON_STIPPLE_ENABLE 0x0000168c
-#define NV50TCL_SET_PROGRAM_CB 0x00001694
-#define NV50TCL_SET_PROGRAM_CB_PROGRAM_SHIFT 4
-#define NV50TCL_SET_PROGRAM_CB_PROGRAM_MASK 0x000000f0
-#define NV50TCL_SET_PROGRAM_CB_PROGRAM_VERTEX 0x00000000
-#define NV50TCL_SET_PROGRAM_CB_PROGRAM_GEOMETRY 0x00000020
-#define NV50TCL_SET_PROGRAM_CB_PROGRAM_FRAGMENT 0x00000030
-#define NV50TCL_SET_PROGRAM_CB_INDEX_SHIFT 8
-#define NV50TCL_SET_PROGRAM_CB_INDEX_MASK 0x00000f00
-#define NV50TCL_SET_PROGRAM_CB_BUFFER_SHIFT 12
-#define NV50TCL_SET_PROGRAM_CB_BUFFER_MASK 0x0007f000
-#define NV50TCL_SET_PROGRAM_CB_VALID (1 << 0)
-#define NV50TCL_VP_RESULT_MAP_SIZE 0x000016ac
-#define NV50TCL_VP_REG_ALLOC_TEMP 0x000016b0
-#define NV50TCL_VP_REG_ALLOC_RESULT 0x000016b8
-#define NV50TCL_VP_RESULT_MAP(x) (0x000016bc+((x)*4))
-#define NV50TCL_VP_RESULT_MAP__SIZE 0x00000010
-#define NV50TCL_VP_RESULT_MAP_0_SHIFT 0
-#define NV50TCL_VP_RESULT_MAP_0_MASK 0x000000ff
-#define NV50TCL_VP_RESULT_MAP_1_SHIFT 8
-#define NV50TCL_VP_RESULT_MAP_1_MASK 0x0000ff00
-#define NV50TCL_VP_RESULT_MAP_2_SHIFT 16
-#define NV50TCL_VP_RESULT_MAP_2_MASK 0x00ff0000
-#define NV50TCL_VP_RESULT_MAP_3_SHIFT 24
-#define NV50TCL_VP_RESULT_MAP_3_MASK 0xff000000
-#define NV50TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001700+((x)*4))
-#define NV50TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NV50TCL_GP_ENABLE 0x00001798
-#define NV50TCL_GP_REG_ALLOC_TEMP 0x000017a0
-#define NV50TCL_GP_REG_ALLOC_RESULT 0x000017a8
-#define NV50TCL_GP_RESULT_MAP_SIZE 0x000017ac
-#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE 0x000017b0
-#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_POINTS 0x00000001
-#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_LINE_STRIP 0x00000002
-#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_TRIANGLE_STRIP 0x00000003
-#define NV50TCL_RASTERIZE_ENABLE 0x000017b4
-#define NV50TCL_STRMOUT_ENABLE 0x000017b8
-#define NV50TCL_GP_RESULT_MAP(x) (0x000017fc+((x)*4))
-#define NV50TCL_GP_RESULT_MAP__SIZE 0x00000020
-#define NV50TCL_GP_RESULT_MAP_0_SHIFT 0
-#define NV50TCL_GP_RESULT_MAP_0_MASK 0x000000ff
-#define NV50TCL_GP_RESULT_MAP_1_SHIFT 8
-#define NV50TCL_GP_RESULT_MAP_1_MASK 0x0000ff00
-#define NV50TCL_GP_RESULT_MAP_2_SHIFT 16
-#define NV50TCL_GP_RESULT_MAP_2_MASK 0x00ff0000
-#define NV50TCL_GP_RESULT_MAP_3_SHIFT 24
-#define NV50TCL_GP_RESULT_MAP_3_MASK 0xff000000
-#define NV50TCL_MAP_SEMANTIC_0 0x00001904
-#define NV50TCL_MAP_SEMANTIC_0_FFC0_ID_SHIFT 0
-#define NV50TCL_MAP_SEMANTIC_0_FFC0_ID_MASK 0x000000ff
-#define NV50TCL_MAP_SEMANTIC_0_BFC0_ID_SHIFT 8
-#define NV50TCL_MAP_SEMANTIC_0_BFC0_ID_MASK 0x0000ff00
-#define NV50TCL_MAP_SEMANTIC_0_COLR_NR_SHIFT 16
-#define NV50TCL_MAP_SEMANTIC_0_COLR_NR_MASK 0x00ff0000
-#define NV50TCL_MAP_SEMANTIC_0_CLMP_EN_SHIFT 24
-#define NV50TCL_MAP_SEMANTIC_0_CLMP_EN_MASK 0xff000000
-#define NV50TCL_MAP_SEMANTIC_1 0x00001908
-#define NV50TCL_MAP_SEMANTIC_1_CLIP_LO_SHIFT 0
-#define NV50TCL_MAP_SEMANTIC_1_CLIP_LO_MASK 0x000000ff
-#define NV50TCL_MAP_SEMANTIC_1_CLIP_HI_SHIFT 8
-#define NV50TCL_MAP_SEMANTIC_1_CLIP_HI_MASK 0x0000ff00
-#define NV50TCL_MAP_SEMANTIC_2 0x0000190c
-#define NV50TCL_MAP_SEMANTIC_2_LAYER_ID_SHIFT 0
-#define NV50TCL_MAP_SEMANTIC_2_LAYER_ID_MASK 0x000000ff
-#define NV50TCL_MAP_SEMANTIC_3 0x00001910
-#define NV50TCL_MAP_SEMANTIC_3_PTSZ_EN (1 << 0)
-#define NV50TCL_MAP_SEMANTIC_3_PTSZ_ID_SHIFT 4
-#define NV50TCL_MAP_SEMANTIC_3_PTSZ_ID_MASK 0x00000ff0
-#define NV50TCL_MAP_SEMANTIC_4 0x00001914
-#define NV50TCL_MAP_SEMANTIC_4_PRIM_ID_SHIFT 0
-#define NV50TCL_MAP_SEMANTIC_4_PRIM_ID_MASK 0x000000ff
-#define NV50TCL_CULL_FACE_ENABLE 0x00001918
-#define NV50TCL_FRONT_FACE 0x0000191c
-#define NV50TCL_FRONT_FACE_CW 0x00000900
-#define NV50TCL_FRONT_FACE_CCW 0x00000901
-#define NV50TCL_CULL_FACE 0x00001920
-#define NV50TCL_CULL_FACE_FRONT 0x00000404
-#define NV50TCL_CULL_FACE_BACK 0x00000405
-#define NV50TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NV50TCL_VIEWPORT_TRANSFORM_EN 0x0000192c
-#define NV50TCL_VIEW_VOLUME_CLIP_CTRL 0x0000193c
-#define NV50TCL_VIEWPORT_CLIP_RECTS_EN 0x0000194c
-#define NV50TCL_VIEWPORT_CLIP_MODE 0x00001950
-#define NV50TCL_VIEWPORT_CLIP_MODE_INCLUDE 0x00000000
-#define NV50TCL_VIEWPORT_CLIP_MODE_EXCLUDE 0x00000001
-#define NV50TCL_VIEWPORT_CLIP_MODE_UNKNOWN 0x00000002
-#define NV50TCL_FP_CTRL_UNK196C 0x0000196c
-#define NV50TCL_CLIPID_ENABLE 0x0000197c
-#define NV50TCL_CLIPID_WIDTH 0x00001980
-#define NV50TCL_CLIPID_ID 0x00001984
-#define NV50TCL_FP_INTERPOLANT_CTRL 0x00001988
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_SHIFT 24
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_MASK 0xff000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NONE 0x00000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNNN 0x01000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYNN 0x02000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYNN 0x03000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNZN 0x04000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNZN 0x05000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYZN 0x06000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYZN 0x07000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNNW 0x08000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNNW 0x09000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYNW 0x0a000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYNW 0x0b000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNZW 0x0c000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNZW 0x0d000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYZW 0x0e000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYZW 0x0f000000
-#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_NONFLAT_SHIFT 16
-#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_NONFLAT_MASK 0x00ff0000
-#define NV50TCL_FP_INTERPOLANT_CTRL_OFFSET_SHIFT 8
-#define NV50TCL_FP_INTERPOLANT_CTRL_OFFSET_MASK 0x0000ff00
-#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_SHIFT 0
-#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_MASK 0x000000ff
-#define NV50TCL_FP_REG_ALLOC_TEMP 0x0000198c
-#define NV50TCL_REG_MODE 0x000019a0
-#define NV50TCL_REG_MODE_PACKED 0x00000001
-#define NV50TCL_REG_MODE_STRIPED 0x00000002
-#define NV50TCL_FP_CONTROL 0x000019a8
-#define NV50TCL_FP_CONTROL_MULTIPLE_RESULTS (1 << 0)
-#define NV50TCL_FP_CONTROL_EXPORTS_Z (1 << 8)
-#define NV50TCL_FP_CONTROL_USES_KIL (1 << 20)
-#define NV50TCL_DEPTH_BOUNDS_EN 0x000019bc
-#define NV50TCL_LOGIC_OP_ENABLE 0x000019c4
-#define NV50TCL_LOGIC_OP 0x000019c8
-#define NV50TCL_LOGIC_OP_CLEAR 0x00001500
-#define NV50TCL_LOGIC_OP_AND 0x00001501
-#define NV50TCL_LOGIC_OP_AND_REVERSE 0x00001502
-#define NV50TCL_LOGIC_OP_COPY 0x00001503
-#define NV50TCL_LOGIC_OP_AND_INVERTED 0x00001504
-#define NV50TCL_LOGIC_OP_NOOP 0x00001505
-#define NV50TCL_LOGIC_OP_XOR 0x00001506
-#define NV50TCL_LOGIC_OP_OR 0x00001507
-#define NV50TCL_LOGIC_OP_NOR 0x00001508
-#define NV50TCL_LOGIC_OP_EQUIV 0x00001509
-#define NV50TCL_LOGIC_OP_INVERT 0x0000150a
-#define NV50TCL_LOGIC_OP_OR_REVERSE 0x0000150b
-#define NV50TCL_LOGIC_OP_COPY_INVERTED 0x0000150c
-#define NV50TCL_LOGIC_OP_OR_INVERTED 0x0000150d
-#define NV50TCL_LOGIC_OP_NAND 0x0000150e
-#define NV50TCL_LOGIC_OP_SET 0x0000150f
-#define NV50TCL_CLEAR_BUFFERS 0x000019d0
-#define NV50TCL_CLEAR_BUFFERS_Z (1 << 0)
-#define NV50TCL_CLEAR_BUFFERS_S (1 << 1)
-#define NV50TCL_CLEAR_BUFFERS_R (1 << 2)
-#define NV50TCL_CLEAR_BUFFERS_G (1 << 3)
-#define NV50TCL_CLEAR_BUFFERS_B (1 << 4)
-#define NV50TCL_CLEAR_BUFFERS_A (1 << 5)
-#define NV50TCL_CLEAR_BUFFERS_RT_SHIFT 6
-#define NV50TCL_CLEAR_BUFFERS_RT_MASK 0x000003c0
-#define NV50TCL_CLEAR_BUFFERS_LAYER_SHIFT 10
-#define NV50TCL_CLEAR_BUFFERS_LAYER_MASK 0x0007fc00
-#define NV50TCL_COLOR_MASK(x) (0x00001a00+((x)*4))
-#define NV50TCL_COLOR_MASK__SIZE 0x00000008
-#define NV50TCL_COLOR_MASK_R_SHIFT 0
-#define NV50TCL_COLOR_MASK_R_MASK 0x0000000f
-#define NV50TCL_COLOR_MASK_G_SHIFT 4
-#define NV50TCL_COLOR_MASK_G_MASK 0x000000f0
-#define NV50TCL_COLOR_MASK_B_SHIFT 8
-#define NV50TCL_COLOR_MASK_B_MASK 0x00000f00
-#define NV50TCL_COLOR_MASK_A_SHIFT 12
-#define NV50TCL_COLOR_MASK_A_MASK 0x0000f000
-#define NV50TCL_STRMOUT_ADDRESS_HIGH(x) (0x00001a80+((x)*16))
-#define NV50TCL_STRMOUT_ADDRESS_HIGH__SIZE 0x00000004
-#define NV50TCL_STRMOUT_ADDRESS_LOW(x) (0x00001a84+((x)*16))
-#define NV50TCL_STRMOUT_ADDRESS_LOW__SIZE 0x00000004
-#define NV50TCL_STRMOUT_NUM_ATTRIBS(x) (0x00001a88+((x)*16))
-#define NV50TCL_STRMOUT_NUM_ATTRIBS__SIZE 0x00000004
-#define NV50TCL_VERTEX_ARRAY_ATTRIB(x) (0x00001ac0+((x)*4))
-#define NV50TCL_VERTEX_ARRAY_ATTRIB__SIZE 0x00000010
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_BUFFER_SHIFT 0
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_BUFFER_MASK 0x0000000f
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_CONST (1 << 4)
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_OFFSET_SHIFT 5
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_OFFSET_MASK 0x0007ffe0
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_SHIFT 19
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_MASK 0x01f80000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32_32_32 0x00080000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32_32 0x00100000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16_16_16 0x00180000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32 0x00200000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16_16 0x00280000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8_8_8 0x00500000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16 0x00780000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32 0x00900000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8_8 0x00980000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8 0x00c00000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16 0x00d80000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8 0x00e80000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_2_10_10_10 0x01800000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SHIFT 25
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_MASK 0x0e000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_FLOAT 0x0e000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SNORM 0x02000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UNORM 0x04000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED 0x0a000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED 0x0c000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UINT 0x08000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SINT 0x06000000
-#define NV50TCL_VERTEX_ARRAY_ATTRIB_BGRA (1 << 31)
-#define NV50TCL_QUERY_ADDRESS_HIGH 0x00001b00
-#define NV50TCL_QUERY_ADDRESS_LOW 0x00001b04
-#define NV50TCL_QUERY_SEQUENCE 0x00001b08
-#define NV50TCL_QUERY_GET 0x00001b0c
-
-
-#define NV84TCL 0x00008297
-
-
-
-#define NVA0TCL 0x00008397
-
-
-
-#define NVA8TCL 0x00008597
-
-
-
-#define NV50_COMPUTE 0x000050c0
-
-#define NV50_COMPUTE_NOP 0x00000100
-#define NV50_COMPUTE_NOTIFY 0x00000104
-#define NV50_COMPUTE_SERIALIZE 0x00000110
-#define NV50_COMPUTE_DMA_NOTIFY 0x00000180
-#define NV50_COMPUTE_DMA_GLOBAL 0x000001a0
-#define NV50_COMPUTE_DMA_QUERY 0x000001a4
-#define NV50_COMPUTE_DMA_LOCAL 0x000001b8
-#define NV50_COMPUTE_DMA_STACK 0x000001bc
-#define NV50_COMPUTE_DMA_CODE_CB 0x000001c0
-#define NV50_COMPUTE_DMA_TSC 0x000001c4
-#define NV50_COMPUTE_DMA_TIC 0x000001c8
-#define NV50_COMPUTE_DMA_TEXTURE 0x000001cc
-#define NV50_COMPUTE_CP_ADDRESS_HIGH 0x00000210
-#define NV50_COMPUTE_CP_ADDRESS_LOW 0x00000214
-#define NV50_COMPUTE_STACK_ADDRESS_HIGH 0x00000218
-#define NV50_COMPUTE_STACK_ADDRESS_LOW 0x0000021c
-#define NV50_COMPUTE_STACK_SIZE_LOG 0x00000220
-#define NV50_COMPUTE_TSC_ADDRESS_HIGH 0x0000022c
-#define NV50_COMPUTE_TSC_ADDRESS_LOW 0x00000230
-#define NV50_COMPUTE_TSC_LIMIT 0x00000234
-#define NV50_COMPUTE_CB_ADDR 0x00000238
-#define NV50_COMPUTE_CB_ADDR_ID_SHIFT 8
-#define NV50_COMPUTE_CB_ADDR_ID_MASK 0x003fff00
-#define NV50_COMPUTE_CB_ADDR_BUFFER_SHIFT 0
-#define NV50_COMPUTE_CB_ADDR_BUFFER_MASK 0x0000007f
-#define NV50_COMPUTE_CB_DATA(x) (0x0000023c+((x)*4))
-#define NV50_COMPUTE_CB_DATA__SIZE 0x00000010
-#define NV50_COMPUTE_DELAY1 0x00000284
-#define NV50_COMPUTE_WATCHDOG_TIMER 0x00000288
-#define NV50_COMPUTE_DELAY2 0x0000028c
-#define NV50_COMPUTE_LOCAL_ADDRESS_HIGH 0x00000294
-#define NV50_COMPUTE_LOCAL_ADDRESS_LOW 0x00000298
-#define NV50_COMPUTE_LOCAL_SIZE_LOG 0x0000029c
-#define NV50_COMPUTE_CB_DEF_ADDRESS_HIGH 0x000002a4
-#define NV50_COMPUTE_CB_DEF_ADDRESS_LOW 0x000002a8
-#define NV50_COMPUTE_CB_DEF_SET 0x000002ac
-#define NV50_COMPUTE_CB_DEF_SET_SIZE_SHIFT 0
-#define NV50_COMPUTE_CB_DEF_SET_SIZE_MASK 0x0000ffff
-#define NV50_COMPUTE_CB_DEF_SET_BUFFER_SHIFT 16
-#define NV50_COMPUTE_CB_DEF_SET_BUFFER_MASK 0x007f0000
-#define NV50_COMPUTE_BLOCK_ALLOC 0x000002b4
-#define NV50_COMPUTE_BLOCK_ALLOC_THREADS_SHIFT 0
-#define NV50_COMPUTE_BLOCK_ALLOC_THREADS_MASK 0x0000ffff
-#define NV50_COMPUTE_BLOCK_ALLOC_BARRIERS_SHIFT 16
-#define NV50_COMPUTE_BLOCK_ALLOC_BARRIERS_MASK 0xffff0000
-#define NV50_COMPUTE_LANES32_ENABLE 0x000002b8
-#define NV50_COMPUTE_CP_REG_ALLOC_TEMP 0x000002c0
-#define NV50_COMPUTE_TIC_ADDRESS_HIGH 0x000002c4
-#define NV50_COMPUTE_TIC_ADDRESS_LOW 0x000002c8
-#define NV50_COMPUTE_TIC_LIMIT 0x000002cc
-#define NV50_COMPUTE_PM_SET(x) (0x000002d0+((x)*4))
-#define NV50_COMPUTE_PM_SET__SIZE 0x00000004
-#define NV50_COMPUTE_PM_CONTROL(x) (0x000002e0+((x)*4))
-#define NV50_COMPUTE_PM_CONTROL__SIZE 0x00000004
-#define NV50_COMPUTE_PM_CONTROL_UNK0 (1 << 0)
-#define NV50_COMPUTE_PM_CONTROL_UNK1_SHIFT 4
-#define NV50_COMPUTE_PM_CONTROL_UNK1_MASK 0x00000070
-#define NV50_COMPUTE_PM_CONTROL_UNK2_SHIFT 8
-#define NV50_COMPUTE_PM_CONTROL_UNK2_MASK 0xffffff00
-#define NV50_COMPUTE_LOCAL_WARPS_LOG_ALLOC 0x000002fc
-#define NV50_COMPUTE_LOCAL_WARPS_NO_CLAMP 0x00000300
-#define NV50_COMPUTE_STACK_WARPS_LOG_ALLOC 0x00000304
-#define NV50_COMPUTE_STACK_WARPS_NO_CLAMP 0x00000308
-#define NV50_COMPUTE_QUERY_ADDRESS_HIGH 0x00000310
-#define NV50_COMPUTE_QUERY_ADDRESS_LOW 0x00000314
-#define NV50_COMPUTE_QUERY_COUNTER 0x00000318
-#define NV50_COMPUTE_QUERY_GET 0x0000031c
-#define NV50_COMPUTE_COND_ADDRESS_HIGH 0x00000320
-#define NV50_COMPUTE_COND_ADDRESS_LOW 0x00000324
-#define NV50_COMPUTE_COND_MODE 0x00000328
-#define NV50_COMPUTE_COND_MODE_NEVER 0x00000000
-#define NV50_COMPUTE_COND_MODE_ALWAYS 0x00000001
-#define NV50_COMPUTE_COND_MODE_RES 0x00000002
-#define NV50_COMPUTE_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
-#define NV50_COMPUTE_COND_MODE_RES_OR_ID 0x00000004
-#define NV50_COMPUTE_LAUNCH 0x00000368
-#define NV50_COMPUTE_USER_PARAM_COUNT 0x00000374
-#define NV50_COMPUTE_USER_PARAM_COUNT_COUNT_SHIFT 8
-#define NV50_COMPUTE_USER_PARAM_COUNT_COUNT_MASK 0x0000ff00
-#define NV50_COMPUTE_LINKED_TSC 0x00000378
-#define NV50_COMPUTE_CODE_CB_FLUSH 0x00000380
-#define NV50_COMPUTE_GRIDDIM 0x000003a4
-#define NV50_COMPUTE_GRIDDIM_X_SHIFT 0
-#define NV50_COMPUTE_GRIDDIM_X_MASK 0x0000ffff
-#define NV50_COMPUTE_GRIDDIM_Y_SHIFT 16
-#define NV50_COMPUTE_GRIDDIM_Y_MASK 0xffff0000
-#define NV50_COMPUTE_SHARED_SIZE 0x000003a8
-#define NV50_COMPUTE_BLOCKDIM_YX 0x000003ac
-#define NV50_COMPUTE_BLOCKDIM_YX_X_SHIFT 0
-#define NV50_COMPUTE_BLOCKDIM_YX_X_MASK 0x0000ffff
-#define NV50_COMPUTE_BLOCKDIM_YX_Y_SHIFT 16
-#define NV50_COMPUTE_BLOCKDIM_YX_Y_MASK 0xffff0000
-#define NV50_COMPUTE_BLOCKDIM_Z 0x000003b0
-#define NV50_COMPUTE_CP_START_ID 0x000003b4
-#define NV50_COMPUTE_REG_MODE 0x000003b8
-#define NV50_COMPUTE_REG_MODE_PACKED 0x00000001
-#define NV50_COMPUTE_REG_MODE_STRIPED 0x00000002
-#define NV50_COMPUTE_TEX_LIMITS 0x000003bc
-#define NV50_COMPUTE_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
-#define NV50_COMPUTE_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
-#define NV50_COMPUTE_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
-#define NV50_COMPUTE_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
-#define NV50_COMPUTE_BIND_TSC 0x000003c0
-#define NV50_COMPUTE_BIND_TSC_VALID (1 << 0)
-#define NV50_COMPUTE_BIND_TSC_SAMPLER_SHIFT 4
-#define NV50_COMPUTE_BIND_TSC_SAMPLER_MASK 0x000000f0
-#define NV50_COMPUTE_BIND_TSC_TSC_SHIFT 12
-#define NV50_COMPUTE_BIND_TSC_TSC_MASK 0x001ff000
-#define NV50_COMPUTE_BIND_TIC 0x000003c4
-#define NV50_COMPUTE_BIND_TIC_VALID (1 << 0)
-#define NV50_COMPUTE_BIND_TIC_TEXTURE_SHIFT 1
-#define NV50_COMPUTE_BIND_TIC_TEXTURE_MASK 0x000001fe
-#define NV50_COMPUTE_BIND_TIC_TIC_SHIFT 9
-#define NV50_COMPUTE_BIND_TIC_TIC_MASK 0x7ffffe00
-#define NV50_COMPUTE_SET_PROGRAM_CB 0x000003c8
-#define NV50_COMPUTE_SET_PROGRAM_CB_INDEX_SHIFT 8
-#define NV50_COMPUTE_SET_PROGRAM_CB_INDEX_MASK 0x00000f00
-#define NV50_COMPUTE_SET_PROGRAM_CB_BUFFER_SHIFT 12
-#define NV50_COMPUTE_SET_PROGRAM_CB_BUFFER_MASK 0x0007f000
-#define NV50_COMPUTE_SET_PROGRAM_CB_VALID (1 << 0)
-#define NV50_COMPUTE_GLOBAL_ADDRESS_HIGH(x) (0x00000400+((x)*32))
-#define NV50_COMPUTE_GLOBAL_ADDRESS_HIGH__SIZE 0x00000010
-#define NV50_COMPUTE_GLOBAL_ADDRESS_LOW(x) (0x00000404+((x)*32))
-#define NV50_COMPUTE_GLOBAL_ADDRESS_LOW__SIZE 0x00000010
-#define NV50_COMPUTE_GLOBAL_PITCH(x) (0x00000408+((x)*32))
-#define NV50_COMPUTE_GLOBAL_PITCH__SIZE 0x00000010
-#define NV50_COMPUTE_GLOBAL_LIMIT(x) (0x0000040c+((x)*32))
-#define NV50_COMPUTE_GLOBAL_LIMIT__SIZE 0x00000010
-#define NV50_COMPUTE_GLOBAL_MODE(x) (0x00000410+((x)*32))
-#define NV50_COMPUTE_GLOBAL_MODE__SIZE 0x00000010
-#define NV50_COMPUTE_GLOBAL_MODE_LINEAR (1 << 0)
-#define NV50_COMPUTE_GLOBAL_MODE_TILE_MODE_SHIFT 8
-#define NV50_COMPUTE_GLOBAL_MODE_TILE_MODE_MASK 0x00000f00
-#define NV50_COMPUTE_USER_PARAM(x) (0x00000600+((x)*4))
-#define NV50_COMPUTE_USER_PARAM__SIZE 0x00000040
-
-
-#define NVC0TCL 0x00009097
-
-#define NVC0TCL_SEMAPHORE_ADDRESS_HIGH 0x00000010
-#define NVC0TCL_SEMAPHORE_ADDRESS_LOW 0x00000014
-#define NVC0TCL_NOP 0x00000100
-#define NVC0TCL_NOTIFY_ADDRESS_HIGH 0x00000104
-#define NVC0TCL_NOTIFY_ADDRESS_LOW 0x00000108
-#define NVC0TCL_NOTIFY 0x0000010c
-#define NVC0TCL_SERIALIZE 0x00000110
-#define NVC0TCL_EARLY_FRAGMENT_TESTS 0x00000210
-#define NVC0TCL_TESS_MODE 0x00000320
-#define NVC0TCL_TESS_MODE_PRIM_SHIFT 0
-#define NVC0TCL_TESS_MODE_PRIM_MASK 0x0000000f
-#define NVC0TCL_TESS_MODE_PRIM_ISOLINES 0x00000000
-#define NVC0TCL_TESS_MODE_PRIM_TRIANGLES 0x00000001
-#define NVC0TCL_TESS_MODE_PRIM_QUADS 0x00000002
-#define NVC0TCL_TESS_MODE_SPACING_SHIFT 4
-#define NVC0TCL_TESS_MODE_SPACING_MASK 0x000000f0
-#define NVC0TCL_TESS_MODE_SPACING_EQUAL 0x00000000
-#define NVC0TCL_TESS_MODE_SPACING_FRACTIONAL_ODD 0x00000010
-#define NVC0TCL_TESS_MODE_SPACING_FRACTIONAL_EVEN 0x00000020
-#define NVC0TCL_TESS_MODE_CW (1 << 8)
-#define NVC0TCL_TESS_MODE_CONNECTED (1 << 9)
-#define NVC0TCL_TESS_LEVEL_OUTER(x) (0x00000324+((x)*4))
-#define NVC0TCL_TESS_LEVEL_OUTER__SIZE 0x00000004
-#define NVC0TCL_TESS_LEVEL_INNER(x) (0x00000334+((x)*4))
-#define NVC0TCL_TESS_LEVEL_INNER__SIZE 0x00000002
-#define NVC0TCL_RASTERIZE_ENABLE 0x0000037c
-#define NVC0TCL_TFB_BUFFER_ENABLE(x) (0x00000380+((x)*32))
-#define NVC0TCL_TFB_BUFFER_ENABLE__SIZE 0x00000004
-#define NVC0TCL_TFB_ADDRESS_HIGH(x) (0x00000384+((x)*32))
-#define NVC0TCL_TFB_ADDRESS_HIGH__SIZE 0x00000004
-#define NVC0TCL_TFB_ADDRESS_LOW(x) (0x00000388+((x)*32))
-#define NVC0TCL_TFB_ADDRESS_LOW__SIZE 0x00000004
-#define NVC0TCL_TFB_BUFFER_SIZE(x) (0x0000038c+((x)*32))
-#define NVC0TCL_TFB_BUFFER_SIZE__SIZE 0x00000004
-#define NVC0TCL_TFB_PRIMITIVE_ID(x) (0x00000390+((x)*32))
-#define NVC0TCL_TFB_PRIMITIVE_ID__SIZE 0x00000004
-#define NVC0TCL_TFB_UNK0700(x) (0x00000700+((x)*16))
-#define NVC0TCL_TFB_UNK0700__SIZE 0x00000004
-#define NVC0TCL_TFB_VARYING_COUNT(x) (0x00000704+((x)*16))
-#define NVC0TCL_TFB_VARYING_COUNT__SIZE 0x00000004
-#define NVC0TCL_TFB_BUFFER_STRIDE(x) (0x00000708+((x)*16))
-#define NVC0TCL_TFB_BUFFER_STRIDE__SIZE 0x00000004
-#define NVC0TCL_TFB_ENABLE 0x00000744
-#define NVC0TCL_LOCAL_BASE 0x0000077c
-#define NVC0TCL_UNK0790_ADDRESS_HIGH 0x00000790
-#define NVC0TCL_UNK0790_ADDRESS_LOW 0x00000794
-#define NVC0TCL_RT_ADDRESS_HIGH(x) (0x00000800+((x)*32))
-#define NVC0TCL_RT_ADDRESS_HIGH__SIZE 0x00000008
-#define NVC0TCL_RT_ADDRESS_LOW(x) (0x00000804+((x)*32))
-#define NVC0TCL_RT_ADDRESS_LOW__SIZE 0x00000008
-#define NVC0TCL_RT_HORIZ(x) (0x00000808+((x)*32))
-#define NVC0TCL_RT_HORIZ__SIZE 0x00000008
-#define NVC0TCL_RT_VERT(x) (0x0000080c+((x)*32))
-#define NVC0TCL_RT_VERT__SIZE 0x00000008
-#define NVC0TCL_RT_FORMAT(x) (0x00000810+((x)*32))
-#define NVC0TCL_RT_FORMAT__SIZE 0x00000008
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_FLOAT 0x000000c0
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_SINT 0x000000c1
-#define NVC0TCL_RT_FORMAT_R32G32B32A32_UINT 0x000000c2
-#define NVC0TCL_RT_FORMAT_R32G32B32X32_FLOAT 0x000000c3
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_UNORM 0x000000c6
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_SNORM 0x000000c7
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_SINT 0x000000c8
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_UINT 0x000000c9
-#define NVC0TCL_RT_FORMAT_R16G16B16A16_FLOAT 0x000000ca
-#define NVC0TCL_RT_FORMAT_R32G32_FLOAT 0x000000cb
-#define NVC0TCL_RT_FORMAT_R32G32_SINT 0x000000cc
-#define NVC0TCL_RT_FORMAT_R32G32_UINT 0x000000cd
-#define NVC0TCL_RT_FORMAT_R16G16B16X16_FLOAT 0x000000ce
-#define NVC0TCL_RT_FORMAT_A8R8G8B8_UNORM 0x000000cf
-#define NVC0TCL_RT_FORMAT_A8R8G8B8_SRGB 0x000000d0
-#define NVC0TCL_RT_FORMAT_A2B10G10R10_UNORM 0x000000d1
-#define NVC0TCL_RT_FORMAT_A2B10G10R10_UINT 0x000000d2
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_UNORM 0x000000d5
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SRGB 0x000000d6
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SNORM 0x000000d7
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_SINT 0x000000d8
-#define NVC0TCL_RT_FORMAT_A8B8G8R8_UINT 0x000000d9
-#define NVC0TCL_RT_FORMAT_R16G16_UNORM 0x000000da
-#define NVC0TCL_RT_FORMAT_R16G16_SNORM 0x000000db
-#define NVC0TCL_RT_FORMAT_R16G16_SINT 0x000000dc
-#define NVC0TCL_RT_FORMAT_R16G16_UINT 0x000000dd
-#define NVC0TCL_RT_FORMAT_R16G16_FLOAT 0x000000de
-#define NVC0TCL_RT_FORMAT_A2R10G10B10_UNORM 0x000000df
-#define NVC0TCL_RT_FORMAT_B10G11R11_FLOAT 0x000000e0
-#define NVC0TCL_RT_FORMAT_R32_FLOAT 0x000000e5
-#define NVC0TCL_RT_FORMAT_X8R8G8B8_UNORM 0x000000e6
-#define NVC0TCL_RT_FORMAT_X8R8G8B8_SRGB 0x000000e7
-#define NVC0TCL_RT_FORMAT_R5G6B5_UNORM 0x000000e8
-#define NVC0TCL_RT_FORMAT_A1R5G5B5_UNORM 0x000000e9
-#define NVC0TCL_RT_FORMAT_R8G8_UNORM 0x000000ea
-#define NVC0TCL_RT_FORMAT_R8G8_SNORM 0x000000eb
-#define NVC0TCL_RT_FORMAT_R8G8_SINT 0x000000ec
-#define NVC0TCL_RT_FORMAT_R8G8_UINT 0x000000ed
-#define NVC0TCL_RT_FORMAT_R16_UNORM 0x000000ee
-#define NVC0TCL_RT_FORMAT_R16_SNORM 0x000000ef
-#define NVC0TCL_RT_FORMAT_R16_SINT 0x000000f0
-#define NVC0TCL_RT_FORMAT_R16_UINT 0x000000f1
-#define NVC0TCL_RT_FORMAT_R16_FLOAT 0x000000f2
-#define NVC0TCL_RT_FORMAT_R8_UNORM 0x000000f3
-#define NVC0TCL_RT_FORMAT_R8_SNORM 0x000000f4
-#define NVC0TCL_RT_FORMAT_R8_SINT 0x000000f5
-#define NVC0TCL_RT_FORMAT_R8_UINT 0x000000f6
-#define NVC0TCL_RT_FORMAT_A8_UNORM 0x000000f7
-#define NVC0TCL_RT_FORMAT_X1R5G5B5_UNORM 0x000000f8
-#define NVC0TCL_RT_FORMAT_X8B8G8R8_UNORM 0x000000f9
-#define NVC0TCL_RT_FORMAT_X8B8G8R8_SRGB 0x000000fa
-#define NVC0TCL_RT_TILE_MODE(x) (0x00000814+((x)*32))
-#define NVC0TCL_RT_TILE_MODE__SIZE 0x00000008
-#define NVC0TCL_RT_ARRAY_MODE(x) (0x00000818+((x)*32))
-#define NVC0TCL_RT_ARRAY_MODE__SIZE 0x00000008
-#define NVC0TCL_RT_ARRAY_MODE_LAYERS_SHIFT 0
-#define NVC0TCL_RT_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NVC0TCL_RT_ARRAY_MODE_VOLUME (1 << 16)
-#define NVC0TCL_RT_LAYER_STRIDE(x) (0x0000081c+((x)*32))
-#define NVC0TCL_RT_LAYER_STRIDE__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_SCALE_X(x) (0x00000a00+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_X__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_SCALE_Y(x) (0x00000a04+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_Y__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_SCALE_Z(x) (0x00000a08+((x)*32))
-#define NVC0TCL_VIEWPORT_SCALE_Z__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_X(x) (0x00000a0c+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_X__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_Y(x) (0x00000a10+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_Y__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_TRANSLATE_Z(x) (0x00000a14+((x)*32))
-#define NVC0TCL_VIEWPORT_TRANSLATE_Z__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_HORIZ(x) (0x00000c00+((x)*16))
-#define NVC0TCL_VIEWPORT_HORIZ__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_HORIZ_X_SHIFT 0
-#define NVC0TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_HORIZ_W_SHIFT 16
-#define NVC0TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
-#define NVC0TCL_VIEWPORT_VERT(x) (0x00000c04+((x)*16))
-#define NVC0TCL_VIEWPORT_VERT__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_VERT_Y_SHIFT 0
-#define NVC0TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_VERT_H_SHIFT 16
-#define NVC0TCL_VIEWPORT_VERT_H_MASK 0xffff0000
-#define NVC0TCL_DEPTH_RANGE_NEAR(x) (0x00000c08+((x)*16))
-#define NVC0TCL_DEPTH_RANGE_NEAR__SIZE 0x00000010
-#define NVC0TCL_DEPTH_RANGE_FAR(x) (0x00000c0c+((x)*16))
-#define NVC0TCL_DEPTH_RANGE_FAR__SIZE 0x00000010
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ(x) (0x00000d00+((x)*8))
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MIN_SHIFT 0
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MIN_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MAX_SHIFT 16
-#define NVC0TCL_VIEWPORT_CLIP_HORIZ_MAX_MASK 0xffff0000
-#define NVC0TCL_VIEWPORT_CLIP_VERT(x) (0x00000d04+((x)*8))
-#define NVC0TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MIN_SHIFT 0
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MIN_MASK 0x0000ffff
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MAX_SHIFT 16
-#define NVC0TCL_VIEWPORT_CLIP_VERT_MAX_MASK 0xffff0000
-#define NVC0TCL_CLIPID_REGION_HORIZ(x) (0x00000d40+((x)*8))
-#define NVC0TCL_CLIPID_REGION_HORIZ__SIZE 0x00000004
-#define NVC0TCL_CLIPID_REGION_VERT(x) (0x00000d44+((x)*8))
-#define NVC0TCL_CLIPID_REGION_VERT__SIZE 0x00000004
-#define NVC0TCL_VERTEX_BUFFER_FIRST 0x00000d74
-#define NVC0TCL_VERTEX_BUFFER_COUNT 0x00000d78
-#define NVC0TCL_CLEAR_COLOR(x) (0x00000d80+((x)*4))
-#define NVC0TCL_CLEAR_COLOR__SIZE 0x00000004
-#define NVC0TCL_CLEAR_DEPTH 0x00000d90
-#define NVC0TCL_STACK_ADDRESS_HIGH 0x00000d94
-#define NVC0TCL_STACK_ADDRESS_LOW 0x00000d98
-#define NVC0TCL_STACK_SIZE_LOG 0x00000d9c
-#define NVC0TCL_CLEAR_STENCIL 0x00000da0
-#define NVC0TCL_POLYGON_SMOOTH_ENABLE 0x00000db4
-#define NVC0TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000dc0
-#define NVC0TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000dc4
-#define NVC0TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000dc8
-#define NVC0TCL_PATCH_VERTICES 0x00000dcc
-#define NVC0TCL_WATCHDOG_TIMER 0x00000de4
-#define NVC0TCL_WINDOW_OFFSET_X 0x00000df8
-#define NVC0TCL_WINDOW_OFFSET_Y 0x00000dfc
-#define NVC0TCL_SCISSOR_ENABLE(x) (0x00000e00+((x)*16))
-#define NVC0TCL_SCISSOR_ENABLE__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_HORIZ(x) (0x00000e04+((x)*16))
-#define NVC0TCL_SCISSOR_HORIZ__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_HORIZ_MIN_SHIFT 0
-#define NVC0TCL_SCISSOR_HORIZ_MIN_MASK 0x0000ffff
-#define NVC0TCL_SCISSOR_HORIZ_MAX_SHIFT 16
-#define NVC0TCL_SCISSOR_HORIZ_MAX_MASK 0xffff0000
-#define NVC0TCL_SCISSOR_VERT(x) (0x00000e08+((x)*16))
-#define NVC0TCL_SCISSOR_VERT__SIZE 0x00000010
-#define NVC0TCL_SCISSOR_VERT_MIN_SHIFT 0
-#define NVC0TCL_SCISSOR_VERT_MIN_MASK 0x0000ffff
-#define NVC0TCL_SCISSOR_VERT_MAX_SHIFT 16
-#define NVC0TCL_SCISSOR_VERT_MAX_MASK 0xffff0000
-#define NVC0TCL_LOCAL_WARPS_LOG_ALLOC 0x00000f44
-#define NVC0TCL_LOCAL_WARPS_NO_CLAMP 0x00000f48
-#define NVC0TCL_STACK_WARPS_LOG_ALLOC 0x00000f4c
-#define NVC0TCL_STACK_WARPS_NO_CLAMP 0x00000f50
-#define NVC0TCL_STENCIL_BACK_FUNC_REF 0x00000f54
-#define NVC0TCL_STENCIL_BACK_MASK 0x00000f58
-#define NVC0TCL_STENCIL_BACK_FUNC_MASK 0x00000f5c
-#define NVC0TCL_VERTEX_RUNOUT_HIGH 0x00000f84
-#define NVC0TCL_VERTEX_RUNOUT_LOW 0x00000f88
-#define NVC0TCL_DEPTH_BOUNDS(x) (0x00000f9c+((x)*4))
-#define NVC0TCL_DEPTH_BOUNDS__SIZE 0x00000002
-#define NVC0TCL_MSAA_MASK(x) (0x00000fbc+((x)*4))
-#define NVC0TCL_MSAA_MASK__SIZE 0x00000004
-#define NVC0TCL_CLIPID_ADDRESS_HIGH 0x00000fcc
-#define NVC0TCL_CLIPID_ADDRESS_LOW 0x00000fd0
-#define NVC0TCL_ZETA_ADDRESS_HIGH 0x00000fe0
-#define NVC0TCL_ZETA_ADDRESS_LOW 0x00000fe4
-#define NVC0TCL_ZETA_FORMAT 0x00000fe8
-#define NVC0TCL_ZETA_FORMAT_Z32_FLOAT 0x0000000a
-#define NVC0TCL_ZETA_FORMAT_Z16_UNORM 0x00000013
-#define NVC0TCL_ZETA_FORMAT_Z24S8_UNORM 0x00000014
-#define NVC0TCL_ZETA_FORMAT_X8Z24_UNORM 0x00000015
-#define NVC0TCL_ZETA_FORMAT_S8Z24_UNORM 0x00000016
-#define NVC0TCL_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM 0x00000019
-#define NVC0TCL_ZETA_TILE_MODE 0x00000fec
-#define NVC0TCL_ZETA_LAYER_STRIDE 0x00000ff0
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ 0x00000ff4
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_W_SHIFT 16
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_W_MASK 0xffff0000
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_X_SHIFT 0
-#define NVC0TCL_SCREEN_SCISSOR_HORIZ_X_MASK 0x0000ffff
-#define NVC0TCL_SCREEN_SCISSOR_VERT 0x00000ff8
-#define NVC0TCL_SCREEN_SCISSOR_VERT_H_SHIFT 16
-#define NVC0TCL_SCREEN_SCISSOR_VERT_H_MASK 0xffff0000
-#define NVC0TCL_SCREEN_SCISSOR_VERT_Y_SHIFT 0
-#define NVC0TCL_SCREEN_SCISSOR_VERT_Y_MASK 0x0000ffff
-#define NVC0TCL_VTX_ATTR_DEFINE 0x0000114c
-#define NVC0TCL_VTX_ATTR_DEFINE_ATTR_SHIFT 0
-#define NVC0TCL_VTX_ATTR_DEFINE_ATTR_MASK 0x0000003f
-#define NVC0TCL_VTX_ATTR_DEFINE_COMP_SHIFT 8
-#define NVC0TCL_VTX_ATTR_DEFINE_COMP_MASK 0x00000f00
-#define NVC0TCL_VTX_ATTR_DEFINE_SIZE_SHIFT 12
-#define NVC0TCL_VTX_ATTR_DEFINE_SIZE_MASK 0x0000f000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SHIFT 16
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_MASK 0x000f0000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_FLOAT 0x00070000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SNORM 0x00010000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_UNORM 0x00020000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_USCALED 0x00050000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SSCALED 0x00060000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_UINT 0x00040000
-#define NVC0TCL_VTX_ATTR_DEFINE_TYPE_SINT 0x00030000
-#define NVC0TCL_VTX_ATTR_DATA(x) (0x00001150+((x)*4))
-#define NVC0TCL_VTX_ATTR_DATA__SIZE 0x00000004
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT(x) (0x00001160+((x)*4))
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT__SIZE 0x00000020
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_BUFFER_SHIFT 0
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_BUFFER_MASK 0x0000003f
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_CONST (1 << 6)
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_OFFSET_SHIFT 7
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_OFFSET_MASK 0x001fff80
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_SHIFT 21
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_MASK 0x07e00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32_32_32 0x00200000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32_32 0x00400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16_16_16 0x00600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32_32 0x00800000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16_16 0x00a00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8_8_8 0x01400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16_16 0x01e00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_32 0x02400000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8_8 0x02600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8_8 0x03000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_16 0x03600000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_8 0x03a00000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_FORMAT_2_10_10_10 0x06000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SHIFT 27
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_MASK 0x78000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_FLOAT 0x38000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SNORM 0x08000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_UNORM 0x10000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_USCALED 0x28000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SSCALED 0x30000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_UINT 0x20000000
-#define NVC0TCL_VERTEX_ATTRIB_FORMAT_TYPE_SINT 0x18000000
-#define NVC0TCL_RT_CONTROL 0x0000121c
-#define NVC0TCL_RT_CONTROL_COUNT_SHIFT 0
-#define NVC0TCL_RT_CONTROL_COUNT_MASK 0x0000000f
-#define NVC0TCL_RT_CONTROL_MAP0_SHIFT 4
-#define NVC0TCL_RT_CONTROL_MAP0_MASK 0x00000070
-#define NVC0TCL_RT_CONTROL_MAP1_SHIFT 7
-#define NVC0TCL_RT_CONTROL_MAP1_MASK 0x00000380
-#define NVC0TCL_RT_CONTROL_MAP2_SHIFT 10
-#define NVC0TCL_RT_CONTROL_MAP2_MASK 0x00001c00
-#define NVC0TCL_RT_CONTROL_MAP3_SHIFT 13
-#define NVC0TCL_RT_CONTROL_MAP3_MASK 0x0000e000
-#define NVC0TCL_RT_CONTROL_MAP4_SHIFT 16
-#define NVC0TCL_RT_CONTROL_MAP4_MASK 0x00070000
-#define NVC0TCL_RT_CONTROL_MAP5_SHIFT 19
-#define NVC0TCL_RT_CONTROL_MAP5_MASK 0x00380000
-#define NVC0TCL_RT_CONTROL_MAP6_SHIFT 22
-#define NVC0TCL_RT_CONTROL_MAP6_MASK 0x01c00000
-#define NVC0TCL_RT_CONTROL_MAP7_SHIFT 25
-#define NVC0TCL_RT_CONTROL_MAP7_MASK 0x0e000000
-#define NVC0TCL_ZETA_HORIZ 0x00001228
-#define NVC0TCL_ZETA_VERT 0x0000122c
-#define NVC0TCL_ZETA_ARRAY_MODE 0x00001230
-#define NVC0TCL_ZETA_ARRAY_MODE_LAYERS_SHIFT 0
-#define NVC0TCL_ZETA_ARRAY_MODE_LAYERS_MASK 0x0000ffff
-#define NVC0TCL_ZETA_ARRAY_MODE_UNK (1 << 16)
-#define NVC0TCL_LINKED_TSC 0x00001234
-#define NVC0TCL_FP_RESULT_COUNT 0x00001298
-#define NVC0TCL_DEPTH_TEST_ENABLE 0x000012cc
-#define NVC0TCL_SHADE_MODEL 0x000012d4
-#define NVC0TCL_SHADE_MODEL_FLAT 0x00001d00
-#define NVC0TCL_SHADE_MODEL_SMOOTH 0x00001d01
-#define NVC0TCL_BLEND_INDEPENDENT 0x000012e4
-#define NVC0TCL_DEPTH_WRITE_ENABLE 0x000012e8
-#define NVC0TCL_ALPHA_TEST_ENABLE 0x000012ec
-#define NVC0TCL_PM_SET(x) (0x000012f0+((x)*4))
-#define NVC0TCL_PM_SET__SIZE 0x00000004
-#define NVC0TCL_VB_ELEMENT_U8_SETUP 0x00001300
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_OFFSET_SHIFT 30
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_OFFSET_MASK 0xc0000000
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_COUNT_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U8_SETUP_COUNT_MASK 0x3fffffff
-#define NVC0TCL_VB_ELEMENT_U8 0x00001304
-#define NVC0TCL_VB_ELEMENT_U8_I0_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U8_I0_MASK 0x000000ff
-#define NVC0TCL_VB_ELEMENT_U8_I1_SHIFT 8
-#define NVC0TCL_VB_ELEMENT_U8_I1_MASK 0x0000ff00
-#define NVC0TCL_VB_ELEMENT_U8_I2_SHIFT 16
-#define NVC0TCL_VB_ELEMENT_U8_I2_MASK 0x00ff0000
-#define NVC0TCL_VB_ELEMENT_U8_I3_SHIFT 24
-#define NVC0TCL_VB_ELEMENT_U8_I3_MASK 0xff000000
-#define NVC0TCL_DEPTH_TEST_FUNC 0x0000130c
-#define NVC0TCL_DEPTH_TEST_FUNC_NEVER 0x00000200
-#define NVC0TCL_DEPTH_TEST_FUNC_LESS 0x00000201
-#define NVC0TCL_DEPTH_TEST_FUNC_EQUAL 0x00000202
-#define NVC0TCL_DEPTH_TEST_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_DEPTH_TEST_FUNC_GREATER 0x00000204
-#define NVC0TCL_DEPTH_TEST_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_DEPTH_TEST_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_DEPTH_TEST_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_ALPHA_TEST_REF 0x00001310
-#define NVC0TCL_ALPHA_TEST_FUNC 0x00001314
-#define NVC0TCL_ALPHA_TEST_FUNC_NEVER 0x00000200
-#define NVC0TCL_ALPHA_TEST_FUNC_LESS 0x00000201
-#define NVC0TCL_ALPHA_TEST_FUNC_EQUAL 0x00000202
-#define NVC0TCL_ALPHA_TEST_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_ALPHA_TEST_FUNC_GREATER 0x00000204
-#define NVC0TCL_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_ALPHA_TEST_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_ALPHA_TEST_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_BLEND_COLOR(x) (0x0000131c+((x)*4))
-#define NVC0TCL_BLEND_COLOR__SIZE 0x00000004
-#define NVC0TCL_TIC_FLUSH 0x00001330
-#define NVC0TCL_TSC_FLUSH 0x00001334
-#define NVC0TCL_TEX_CACHE_CTL 0x00001338
-#define NVC0TCL_BLEND_EQUATION_RGB 0x00001340
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATION_RGB_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATION_RGB_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNC_SRC_RGB 0x00001344
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNC_DST_RGB 0x00001348
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_DST_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_EQUATION_ALPHA 0x0000134c
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATION_ALPHA_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATION_ALPHA_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA 0x00001350
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA 0x00001358
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_STENCIL_ENABLE 0x00001380
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL 0x00001384
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL 0x00001388
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS 0x0000138c
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC 0x00001390
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_STENCIL_FRONT_FUNC_REF 0x00001394
-#define NVC0TCL_STENCIL_FRONT_MASK 0x00001398
-#define NVC0TCL_STENCIL_FRONT_FUNC_MASK 0x0000139c
-#define NVC0TCL_FRAG_COLOR_CLAMP_EN 0x000013a8
-#define NVC0TCL_Y_ORIGIN_BOTTOM 0x000013ac
-#define NVC0TCL_LINE_WIDTH(x) (0x000013b0+((x)*4))
-#define NVC0TCL_LINE_WIDTH__SIZE 0x00000002
-#define NVC0TCL_POINT_COORD_REPLACE_MAP(x) (0x000013c0+((x)*4))
-#define NVC0TCL_POINT_COORD_REPLACE_MAP__SIZE 0x00000008
-#define NVC0TCL_GP_VERTEX_OUTPUT_COUNT 0x00001420
-#define NVC0TCL_FENCE 0x0000142c
-#define NVC0TCL_VB_ELEMENT_BASE 0x00001434
-#define NVC0TCL_INSTANCE_BASE 0x00001438
-#define NVC0TCL_CODE_CB_FLUSH 0x00001440
-#define NVC0TCL_CLIPID_HEIGHT 0x00001504
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE 0x00001510
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_0 (1 << 0)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_1 (1 << 1)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_2 (1 << 2)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_3 (1 << 3)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_4 (1 << 4)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_5 (1 << 5)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_6 (1 << 6)
-#define NVC0TCL_VP_CLIP_DISTANCE_ENABLE_7 (1 << 7)
-#define NVC0TCL_SAMPLECNT_ENABLE 0x00001514
-#define NVC0TCL_POINT_SIZE 0x00001518
-#define NVC0TCL_POINT_SPRITE_ENABLE 0x00001520
-#define NVC0TCL_SAMPLECNT_RESET 0x00001530
-#define NVC0TCL_MULTISAMPLE_ZETA_ENABLE 0x00001534
-#define NVC0TCL_ZETA_ENABLE 0x00001538
-#define NVC0TCL_MULTISAMPLE_CTRL 0x0000153c
-#define NVC0TCL_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE (1 << 0)
-#define NVC0TCL_MULTISAMPLE_CTRL_ALPHA_TO_ONE (1 << 4)
-#define NVC0TCL_NOPERSPECTIVE_BITMAP(x) (0x00001540+((x)*4))
-#define NVC0TCL_NOPERSPECTIVE_BITMAP__SIZE 0x00000004
-#define NVC0TCL_COND_ADDRESS_HIGH 0x00001550
-#define NVC0TCL_COND_ADDRESS_LOW 0x00001554
-#define NVC0TCL_COND_MODE 0x00001558
-#define NVC0TCL_COND_MODE_NEVER 0x00000000
-#define NVC0TCL_COND_MODE_ALWAYS 0x00000001
-#define NVC0TCL_COND_MODE_RES 0x00000002
-#define NVC0TCL_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
-#define NVC0TCL_COND_MODE_RES_OR_ID 0x00000004
-#define NVC0TCL_TSC_ADDRESS_HIGH 0x0000155c
-#define NVC0TCL_TSC_ADDRESS_LOW 0x00001560
-#define NVC0TCL_TSC_LIMIT 0x00001564
-#define NVC0TCL_POLYGON_OFFSET_FACTOR 0x0000156c
-#define NVC0TCL_LINE_SMOOTH_ENABLE 0x00001570
-#define NVC0TCL_TIC_ADDRESS_HIGH 0x00001574
-#define NVC0TCL_TIC_ADDRESS_LOW 0x00001578
-#define NVC0TCL_TIC_LIMIT 0x0000157c
-#define NVC0TCL_PM_CONTROL(x) (0x00001580+((x)*4))
-#define NVC0TCL_PM_CONTROL__SIZE 0x00000004
-#define NVC0TCL_PM_CONTROL_UNK0 (1 << 0)
-#define NVC0TCL_PM_CONTROL_UNK1_SHIFT 4
-#define NVC0TCL_PM_CONTROL_UNK1_MASK 0x00000070
-#define NVC0TCL_PM_CONTROL_UNK2_SHIFT 8
-#define NVC0TCL_PM_CONTROL_UNK2_MASK 0xffffff00
-#define NVC0TCL_STENCIL_TWO_SIDE_ENABLE 0x00001594
-#define NVC0TCL_STENCIL_BACK_OP_FAIL 0x00001598
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL 0x0000159c
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS 0x000015a0
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
-#define NVC0TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC 0x000015a4
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
-#define NVC0TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
-#define NVC0TCL_MULTISAMPLE_COLOR_ENABLE 0x000015b4
-#define NVC0TCL_FRAMEBUFFER_SRGB 0x000015b8
-#define NVC0TCL_POLYGON_OFFSET_UNITS 0x000015bc
-#define NVC0TCL_GP_BUILTIN_RESULT_EN 0x000015cc
-#define NVC0TCL_GP_BUILTIN_RESULT_EN_VPORT (1 << 0)
-#define NVC0TCL_GP_BUILTIN_RESULT_EN_LAYER (1 << 16)
-#define NVC0TCL_MULTISAMPLE_MODE 0x000015d0
-#define NVC0TCL_MULTISAMPLE_MODE_1X 0x00000000
-#define NVC0TCL_MULTISAMPLE_MODE_2XMS 0x00000001
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS 0x00000002
-#define NVC0TCL_MULTISAMPLE_MODE_8XMS 0x00000004
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS_4XCS 0x00000008
-#define NVC0TCL_MULTISAMPLE_MODE_4XMS_12XCS 0x00000009
-#define NVC0TCL_MULTISAMPLE_MODE_8XMS_8XCS 0x0000000a
-#define NVC0TCL_EDGEFLAG_ENABLE 0x000015e4
-#define NVC0TCL_VB_ELEMENT_U32 0x000015e8
-#define NVC0TCL_VB_ELEMENT_U16_SETUP 0x000015ec
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_OFFSET_SHIFT 30
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_OFFSET_MASK 0xc0000000
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_COUNT_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U16_SETUP_COUNT_MASK 0x3fffffff
-#define NVC0TCL_VB_ELEMENT_U16 0x000015f0
-#define NVC0TCL_VB_ELEMENT_U16_I0_SHIFT 0
-#define NVC0TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
-#define NVC0TCL_VB_ELEMENT_U16_I1_SHIFT 16
-#define NVC0TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
-#define NVC0TCL_VERTEX_BASE_HIGH 0x000015f4
-#define NVC0TCL_VERTEX_BASE_LOW 0x000015f8
-#define NVC0TCL_CODE_ADDRESS_HIGH 0x00001608
-#define NVC0TCL_CODE_ADDRESS_LOW 0x0000160c
-#define NVC0TCL_VERTEX_BEGIN 0x00001618
-#define NVC0TCL_VERTEX_BEGIN_MODE_SHIFT 0
-#define NVC0TCL_VERTEX_BEGIN_MODE_MASK 0x0000000f
-#define NVC0TCL_VERTEX_BEGIN_MODE_POINTS 0x00000000
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINES 0x00000001
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_LOOP 0x00000002
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_STRIP 0x00000003
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLES 0x00000004
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_STRIP 0x00000005
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_FAN 0x00000006
-#define NVC0TCL_VERTEX_BEGIN_MODE_QUADS 0x00000007
-#define NVC0TCL_VERTEX_BEGIN_MODE_QUAD_STRIP 0x00000008
-#define NVC0TCL_VERTEX_BEGIN_MODE_POLYGON 0x00000009
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINES_ADJACENCY 0x0000000a
-#define NVC0TCL_VERTEX_BEGIN_MODE_LINE_STRIP_ADJACENCY 0x0000000b
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLES_ADJACENCY 0x0000000c
-#define NVC0TCL_VERTEX_BEGIN_MODE_TRIANGLE_STRIP_ADJACENCY 0x0000000d
-#define NVC0TCL_VERTEX_BEGIN_MODE_PATCHES 0x0000000e
-#define NVC0TCL_VERTEX_BEGIN_INSTANCE (1 << 26)
-#define NVC0TCL_VERTEX_END 0x00001614
-#define NVC0TCL_VERTEX_DATA 0x00001640
-#define NVC0TCL_PRIM_RESTART_ENABLE 0x00001644
-#define NVC0TCL_PRIM_RESTART_INDEX 0x00001648
-#define NVC0TCL_POINT_SMOOTH_ENABLE 0x00001658
-#define NVC0TCL_POINT_SPRITE_CTRL 0x00001660
-#define NVC0TCL_LINE_STIPPLE_ENABLE 0x0000166c
-#define NVC0TCL_LINE_STIPPLE_PATTERN 0x00001680
-#define NVC0TCL_PROVOKING_VERTEX_LAST 0x00001684
-#define NVC0TCL_VERTEX_TWO_SIDE_ENABLE 0x00001688
-#define NVC0TCL_POLYGON_STIPPLE_ENABLE 0x0000168c
-#define NVC0TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001700+((x)*4))
-#define NVC0TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
-#define NVC0TCL_UNK17BC_ADDRESS_HIGH 0x000017bc
-#define NVC0TCL_UNK17BC_ADDRESS_LOW 0x000017c0
-#define NVC0TCL_UNK17BC_LIMIT 0x000017c4
-#define NVC0TCL_VP_POINT_SIZE_EN 0x00001910
-#define NVC0TCL_CULL_FACE_ENABLE 0x00001918
-#define NVC0TCL_FRONT_FACE 0x0000191c
-#define NVC0TCL_FRONT_FACE_CW 0x00000900
-#define NVC0TCL_FRONT_FACE_CCW 0x00000901
-#define NVC0TCL_CULL_FACE 0x00001920
-#define NVC0TCL_CULL_FACE_FRONT 0x00000404
-#define NVC0TCL_CULL_FACE_BACK 0x00000405
-#define NVC0TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
-#define NVC0TCL_VIEWPORT_TRANSFORM_EN 0x0000192c
-#define NVC0TCL_VIEW_VOLUME_CLIP_CTRL 0x0000193c
-#define NVC0TCL_VIEWPORT_CLIP_RECTS_EN 0x0000194c
-#define NVC0TCL_VIEWPORT_CLIP_MODE 0x00001950
-#define NVC0TCL_VIEWPORT_CLIP_MODE_INCLUDE 0x00000000
-#define NVC0TCL_VIEWPORT_CLIP_MODE_EXCLUDE 0x00000001
-#define NVC0TCL_VIEWPORT_CLIP_MODE_UNKNOWN 0x00000002
-#define NVC0TCL_FP_ZORDER_CTRL 0x0000196c
-#define NVC0TCL_CLIPID_ENABLE 0x0000197c
-#define NVC0TCL_CLIPID_WIDTH 0x00001980
-#define NVC0TCL_CLIPID_ID 0x00001984
-#define NVC0TCL_REG_MODE 0x000019a0
-#define NVC0TCL_REG_MODE_PACKED 0x00000001
-#define NVC0TCL_REG_MODE_STRIPED 0x00000002
-#define NVC0TCL_FP_CONTROL 0x000019a8
-#define NVC0TCL_FP_CONTROL_MULTIPLE_RESULTS (1 << 0)
-#define NVC0TCL_FP_CONTROL_EXPORTS_Z (1 << 8)
-#define NVC0TCL_FP_CONTROL_USES_KIL (1 << 20)
-#define NVC0TCL_DEPTH_BOUNDS_EN 0x000019bc
-#define NVC0TCL_LOGIC_OP_ENABLE 0x000019c4
-#define NVC0TCL_LOGIC_OP 0x000019c8
-#define NVC0TCL_LOGIC_OP_CLEAR 0x00001500
-#define NVC0TCL_LOGIC_OP_AND 0x00001501
-#define NVC0TCL_LOGIC_OP_AND_REVERSE 0x00001502
-#define NVC0TCL_LOGIC_OP_COPY 0x00001503
-#define NVC0TCL_LOGIC_OP_AND_INVERTED 0x00001504
-#define NVC0TCL_LOGIC_OP_NOOP 0x00001505
-#define NVC0TCL_LOGIC_OP_XOR 0x00001506
-#define NVC0TCL_LOGIC_OP_OR 0x00001507
-#define NVC0TCL_LOGIC_OP_NOR 0x00001508
-#define NVC0TCL_LOGIC_OP_EQUIV 0x00001509
-#define NVC0TCL_LOGIC_OP_INVERT 0x0000150a
-#define NVC0TCL_LOGIC_OP_OR_REVERSE 0x0000150b
-#define NVC0TCL_LOGIC_OP_COPY_INVERTED 0x0000150c
-#define NVC0TCL_LOGIC_OP_OR_INVERTED 0x0000150d
-#define NVC0TCL_LOGIC_OP_NAND 0x0000150e
-#define NVC0TCL_LOGIC_OP_SET 0x0000150f
-#define NVC0TCL_CLEAR_BUFFERS 0x000019d0
-#define NVC0TCL_CLEAR_BUFFERS_Z (1 << 0)
-#define NVC0TCL_CLEAR_BUFFERS_S (1 << 1)
-#define NVC0TCL_CLEAR_BUFFERS_R (1 << 2)
-#define NVC0TCL_CLEAR_BUFFERS_G (1 << 3)
-#define NVC0TCL_CLEAR_BUFFERS_B (1 << 4)
-#define NVC0TCL_CLEAR_BUFFERS_A (1 << 5)
-#define NVC0TCL_CLEAR_BUFFERS_RT_SHIFT 6
-#define NVC0TCL_CLEAR_BUFFERS_RT_MASK 0x000003c0
-#define NVC0TCL_CLEAR_BUFFERS_LAYER_SHIFT 10
-#define NVC0TCL_CLEAR_BUFFERS_LAYER_MASK 0x0007fc00
-#define NVC0TCL_COLOR_MASK(x) (0x00001a00+((x)*4))
-#define NVC0TCL_COLOR_MASK__SIZE 0x00000008
-#define NVC0TCL_COLOR_MASK_R_SHIFT 0
-#define NVC0TCL_COLOR_MASK_R_MASK 0x0000000f
-#define NVC0TCL_COLOR_MASK_G_SHIFT 4
-#define NVC0TCL_COLOR_MASK_G_MASK 0x000000f0
-#define NVC0TCL_COLOR_MASK_B_SHIFT 8
-#define NVC0TCL_COLOR_MASK_B_MASK 0x00000f00
-#define NVC0TCL_COLOR_MASK_A_SHIFT 12
-#define NVC0TCL_COLOR_MASK_A_MASK 0x0000f000
-#define NVC0TCL_QUERY_ADDRESS_HIGH 0x00001b00
-#define NVC0TCL_QUERY_ADDRESS_LOW 0x00001b04
-#define NVC0TCL_QUERY_SEQUENCE 0x00001b08
-#define NVC0TCL_QUERY_GET 0x00001b0c
-#define NVC0TCL_VERTEX_ARRAY_FETCH(x) (0x00001c00+((x)*16))
-#define NVC0TCL_VERTEX_ARRAY_FETCH__SIZE 0x00000020
-#define NVC0TCL_VERTEX_ARRAY_FETCH_STRIDE_SHIFT 0
-#define NVC0TCL_VERTEX_ARRAY_FETCH_STRIDE_MASK 0x00000fff
-#define NVC0TCL_VERTEX_ARRAY_FETCH_ENABLE (1 << 12)
-#define NVC0TCL_BLEND_EQUATIONI_RGB(x) (0x00001e04+((x)*32))
-#define NVC0TCL_BLEND_EQUATIONI_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATIONI_RGB_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATIONI_RGB_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATIONI_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB(x) (0x00001e08+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNCI_DST_RGB(x) (0x00001e0c+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_DST_RGB__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA(x) (0x00001e10+((x)*32))
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_ADD 0x00008006
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_MIN 0x00008007
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_MAX 0x00008008
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_SUBTRACT 0x0000800a
-#define NVC0TCL_BLEND_EQUATIONI_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA(x) (0x00001e14+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA(x) (0x00001e18+((x)*32))
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA__SIZE 0x00000008
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ZERO 0x00004000
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE 0x00004001
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_COLOR 0x00004300
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_ALPHA 0x00004302
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_DST_ALPHA 0x00004304
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_DST_COLOR 0x00004306
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_CONSTANT_COLOR 0x0000c001
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC1_COLOR 0x0000c900
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_SRC1_ALPHA 0x0000c902
-#define NVC0TCL_BLEND_FUNCI_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
-#define NVC0TCL_SP_SELECT(x) (0x00002000+((x)*64))
-#define NVC0TCL_SP_SELECT__SIZE 0x00000006
-#define NVC0TCL_SP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_SP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_SP_SELECT_PROGRAM_MASK 0x000000f0
-#define NVC0TCL_SP_START_ID(x) (0x00002004+((x)*64))
-#define NVC0TCL_SP_START_ID__SIZE 0x00000006
-#define NVC0TCL_SP_GPR_ALLOC(x) (0x0000200c+((x)*64))
-#define NVC0TCL_SP_GPR_ALLOC__SIZE 0x00000006
-#define NVC0TCL_CB_SIZE 0x00002380
-#define NVC0TCL_CB_BIND(x) (0x00002410+((x)*32))
-#define NVC0TCL_CB_BIND__SIZE 0x00000005
-#define NVC0TCL_CB_BIND_VALID (1 << 0)
-#define NVC0TCL_CB_BIND_INDEX_SHIFT 4
-#define NVC0TCL_CB_BIND_INDEX_MASK 0x000000f0
-#define NVC0TCL_BIND_TIC(x) (0x00002404+((x)*32))
-#define NVC0TCL_BIND_TIC__SIZE 0x00000005
-#define NVC0TCL_BIND_TIC_ACTIVE (1 << 0)
-#define NVC0TCL_BIND_TIC_TEXTURE_SHIFT 1
-#define NVC0TCL_BIND_TIC_TEXTURE_MASK 0x000001fe
-#define NVC0TCL_BIND_TIC_TIC_SHIFT 9
-#define NVC0TCL_BIND_TIC_TIC_MASK 0x7ffffe00
-#define NVC0TCL_TEX_LIMITS(x) (0x00002200+((x)*16))
-#define NVC0TCL_TEX_LIMITS__SIZE 0x00000005
-#define NVC0TCL_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
-#define NVC0TCL_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
-#define NVC0TCL_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
-#define NVC0TCL_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
-#define NVC0TCL_CB_ADDR_HIGH 0x00002384
-#define NVC0TCL_CB_ADDR_LOW 0x00002388
-#define NVC0TCL_CB_POS 0x0000238c
-#define NVC0TCL_CB_DATA(x) (0x00002390+((x)*4))
-#define NVC0TCL_CB_DATA__SIZE 0x00000010
-#define NVC0TCL_TFB_VARYING_LOCS(x) (0x00002800+((x)*4))
-#define NVC0TCL_TFB_VARYING_LOCS__SIZE 0x00000080
-#define NVC0TCL_UNK_UPLOAD_POS 0x00003800
-#define NVC0TCL_UNK_UPLOAD_DATA 0x00003804
-#define NVC0TCL_VERTEX_ARRAY_SELECT 0x00003820
-#define NVC0TCL_VERTEX_ARRAY_ADDRESS 0x00003824
-#define NVC0TCL_BLEND_ENABLEI 0x00003858
-#define NVC0TCL_POLYGON_MODE_FRONT 0x00003868
-#define NVC0TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
-#define NVC0TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
-#define NVC0TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
-#define NVC0TCL_POLYGON_MODE_BACK 0x00003870
-#define NVC0TCL_POLYGON_MODE_BACK_POINT 0x00001b00
-#define NVC0TCL_POLYGON_MODE_BACK_LINE 0x00001b01
-#define NVC0TCL_POLYGON_MODE_BACK_FILL 0x00001b02
-#define NVC0TCL_GP_SELECT 0x00003878
-#define NVC0TCL_GP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_GP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_GP_SELECT_PROGRAM_MASK 0x000000f0
-#define NVC0TCL_TEP_SELECT 0x00003880
-#define NVC0TCL_TEP_SELECT_ENABLE (1 << 0)
-#define NVC0TCL_TEP_SELECT_PROGRAM_SHIFT 4
-#define NVC0TCL_TEP_SELECT_PROGRAM_MASK 0x000000f0
-
-
-#define NVC0_COMPUTE 0x000090c0
-
-#define NVC0_COMPUTE_NOP 0x00000100
-#define NVC0_COMPUTE_NOTIFY 0x00000104
-#define NVC0_COMPUTE_SERIALIZE 0x00000110
-#define NVC0_COMPUTE_LOCAL_SIZE 0x00000204
-#define NVC0_COMPUTE_SHARED_BASE 0x00000214
-#define NVC0_COMPUTE_GRIDDIM_YX 0x00000238
-#define NVC0_COMPUTE_GRIDDIM_YX_X_SHIFT 0
-#define NVC0_COMPUTE_GRIDDIM_YX_X_MASK 0x0000ffff
-#define NVC0_COMPUTE_GRIDDIM_YX_Y_SHIFT 16
-#define NVC0_COMPUTE_GRIDDIM_YX_Y_MASK 0xffff0000
-#define NVC0_COMPUTE_GRIDDIM_Z 0x0000023c
-#define NVC0_COMPUTE_SHARED_SIZE 0x0000024c
-#define NVC0_COMPUTE_BLOCK_ALLOC 0x00000250
-#define NVC0_COMPUTE_BLOCK_ALLOC_THREADS_SHIFT 0
-#define NVC0_COMPUTE_BLOCK_ALLOC_THREADS_MASK 0x0000ffff
-#define NVC0_COMPUTE_BLOCK_ALLOC_BARRIERS_SHIFT 16
-#define NVC0_COMPUTE_BLOCK_ALLOC_BARRIERS_MASK 0xffff0000
-#define NVC0_COMPUTE_CP_GPR_ALLOC 0x000002c0
-#define NVC0_COMPUTE_GLOBAL_BASE 0x000002c8
-#define NVC0_COMPUTE_GLOBAL_BASE_HIGH_SHIFT 0
-#define NVC0_COMPUTE_GLOBAL_BASE_HIGH_MASK 0x000000ff
-#define NVC0_COMPUTE_GLOBAL_BASE_INDEX_SHIFT 16
-#define NVC0_COMPUTE_GLOBAL_BASE_INDEX_MASK 0x00ff0000
-#define NVC0_COMPUTE_GLOBAL_BASE_FLAGS_SHIFT 28
-#define NVC0_COMPUTE_GLOBAL_BASE_FLAGS_MASK 0xf0000000
-#define NVC0_COMPUTE_LAUNCH 0x00000368
-#define NVC0_COMPUTE_BLOCKDIM_YX 0x000003ac
-#define NVC0_COMPUTE_BLOCKDIM_YX_X_SHIFT 0
-#define NVC0_COMPUTE_BLOCKDIM_YX_X_MASK 0x0000ffff
-#define NVC0_COMPUTE_BLOCKDIM_YX_Y_SHIFT 16
-#define NVC0_COMPUTE_BLOCKDIM_YX_Y_MASK 0xffff0000
-#define NVC0_COMPUTE_BLOCKDIM_Z 0x000003b0
-#define NVC0_COMPUTE_CP_START_ID 0x000003b4
-#define NVC0_COMPUTE_LOCAL_BASE 0x0000077c
-#define NVC0_COMPUTE_UNK0790_ADDRESS_HIGH 0x00000790
-#define NVC0_COMPUTE_UNK0790_ADDRESS_LOW 0x00000794
-#define NVC0_COMPUTE_LINKED_TSC 0x00001234
-#define NVC0_COMPUTE_TSC_ADDRESS_HIGH 0x0000155c
-#define NVC0_COMPUTE_TSC_ADDRESS_LOW 0x00001560
-#define NVC0_COMPUTE_TSC_LIMIT 0x00001564
-#define NVC0_COMPUTE_TIC_ADDRESS_HIGH 0x00001574
-#define NVC0_COMPUTE_TIC_ADDRESS_LOW 0x00001578
-#define NVC0_COMPUTE_TIC_LIMIT 0x0000157c
-#define NVC0_COMPUTE_CODE_ADDRESS_HIGH 0x00001608
-#define NVC0_COMPUTE_CODE_ADDRESS_LOW 0x0000160c
-#define NVC0_COMPUTE_CB_BIND 0x00001694
-#define NVC0_COMPUTE_CB_BIND_INDEX_SHIFT 1
-#define NVC0_COMPUTE_CB_BIND_INDEX_MASK 0xfffffffe
-#define NVC0_COMPUTE_CB_BIND_VALID (1 << 0)
-#define NVC0_COMPUTE_QUERY_ADDRESS_HIGH 0x00001b00
-#define NVC0_COMPUTE_QUERY_ADDRESS_LOW 0x00001b04
-#define NVC0_COMPUTE_QUERY_SEQUENCE 0x00001b08
-#define NVC0_COMPUTE_QUERY_GET 0x00001b0c
-#define NVC0_COMPUTE_CB_ADDRESS_HIGH 0x00002384
-#define NVC0_COMPUTE_CB_ADDRESS_LOW 0x00002388
-#define NVC0_COMPUTE_CB_POS 0x0000238c
-#define NVC0_COMPUTE_CB_DATA 0x00002390
-
-
-#endif /* NOUVEAU_REG_H */
diff --git a/src/gallium/drivers/nouveau/nouveau_winsys.h b/src/gallium/drivers/nouveau/nouveau_winsys.h
index c6c93d40b8..c9003c97f5 100644
--- a/src/gallium/drivers/nouveau/nouveau_winsys.h
+++ b/src/gallium/drivers/nouveau/nouveau_winsys.h
@@ -6,7 +6,6 @@
#include "nouveau/nouveau_bo.h"
#include "nouveau/nouveau_channel.h"
-#include "nouveau/nouveau_class.h"
#include "nouveau/nouveau_device.h"
#include "nouveau/nouveau_grobj.h"
#include "nouveau/nouveau_notifier.h"
diff --git a/src/gallium/drivers/nouveau/nv_m2mf.xml.h b/src/gallium/drivers/nouveau/nv_m2mf.xml.h
new file mode 100644
index 0000000000..ffdaf95de6
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nv_m2mf.xml.h
@@ -0,0 +1,155 @@
+#ifndef NV_M2MF_XML
+#define NV_M2MF_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv_m2mf.xml ( 2710 bytes, from 2010-08-05 19:38:53)
+- copyright.xml ( 6503 bytes, from 2010-04-10 23:15:50)
+- nv_object.xml ( 10424 bytes, from 2010-08-05 19:38:53)
+- nvchipsets.xml ( 2824 bytes, from 2010-08-05 19:38:53)
+- nv_defs.xml ( 4437 bytes, from 2010-08-05 19:38:53)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <mandin.patrice@orange.fr> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NV04_M2MF_DMA_NOTIFY 0x00000180
+
+#define NV04_M2MF_DMA_BUFFER_IN 0x00000184
+
+#define NV04_M2MF_DMA_BUFFER_OUT 0x00000188
+
+
+#define NV50_M2MF_LINEAR_IN 0x00000200
+
+#define NV50_M2MF_TILING_MODE_IN 0x00000204
+
+#define NV50_M2MF_TILING_PITCH_IN 0x00000208
+
+#define NV50_M2MF_TILING_HEIGHT_IN 0x0000020c
+
+#define NV50_M2MF_TILING_DEPTH_IN 0x00000210
+
+#define NV50_M2MF_TILING_POSITION_IN_Z 0x00000214
+
+#define NV50_M2MF_TILING_POSITION_IN 0x00000218
+#define NV50_M2MF_TILING_POSITION_IN_X__MASK 0x0000ffff
+#define NV50_M2MF_TILING_POSITION_IN_X__SHIFT 0
+#define NV50_M2MF_TILING_POSITION_IN_Y__MASK 0xffff0000
+#define NV50_M2MF_TILING_POSITION_IN_Y__SHIFT 16
+
+#define NV50_M2MF_LINEAR_OUT 0x0000021c
+
+#define NV50_M2MF_TILING_MODE_OUT 0x00000220
+
+#define NV50_M2MF_TILING_PITCH_OUT 0x00000224
+
+#define NV50_M2MF_TILING_HEIGHT_OUT 0x00000228
+
+#define NV50_M2MF_TILING_DEPTH_OUT 0x0000022c
+
+#define NV50_M2MF_TILING_POSITION_OUT_Z 0x00000230
+
+#define NV50_M2MF_TILING_POSITION_OUT 0x00000234
+#define NV50_M2MF_TILING_POSITION_OUT_X__MASK 0x0000ffff
+#define NV50_M2MF_TILING_POSITION_OUT_X__SHIFT 0
+#define NV50_M2MF_TILING_POSITION_OUT_Y__MASK 0xffff0000
+#define NV50_M2MF_TILING_POSITION_OUT_Y__SHIFT 16
+
+#define NV50_M2MF_OFFSET_IN_HIGH 0x00000238
+
+#define NV50_M2MF_OFFSET_OUT_HIGH 0x0000023c
+
+#define NV04_M2MF_OFFSET_IN 0x0000030c
+
+#define NV04_M2MF_OFFSET_OUT 0x00000310
+
+#define NV04_M2MF_PITCH_IN 0x00000314
+
+#define NV04_M2MF_PITCH_OUT 0x00000318
+
+#define NV04_M2MF_LINE_LENGTH_IN 0x0000031c
+
+#define NV04_M2MF_LINE_COUNT 0x00000320
+
+#define NV04_M2MF_FORMAT 0x00000324
+#define NV04_M2MF_FORMAT_INPUT_INC__MASK 0x000000ff
+#define NV04_M2MF_FORMAT_INPUT_INC__SHIFT 0
+#define NV04_M2MF_FORMAT_INPUT_INC_1 0x00000001
+#define NV04_M2MF_FORMAT_INPUT_INC_2 0x00000002
+#define NV04_M2MF_FORMAT_INPUT_INC_4 0x00000004
+#define NV50_M2MF_FORMAT_INPUT_INC_8 0x00000008
+#define NV50_M2MF_FORMAT_INPUT_INC_16 0x00000010
+#define NV04_M2MF_FORMAT_OUTPUT_INC__MASK 0x0000ff00
+#define NV04_M2MF_FORMAT_OUTPUT_INC__SHIFT 8
+#define NV04_M2MF_FORMAT_OUTPUT_INC_1 0x00000100
+#define NV04_M2MF_FORMAT_OUTPUT_INC_2 0x00000200
+#define NV04_M2MF_FORMAT_OUTPUT_INC_4 0x00000400
+#define NV50_M2MF_FORMAT_OUTPUT_INC_8 0x00000800
+#define NV50_M2MF_FORMAT_OUTPUT_INC_16 0x00001000
+
+#define NV04_M2MF_BUF_NOTIFY 0x00000328
+
+
+#endif /* NV_M2MF_XML */
diff --git a/src/gallium/drivers/nouveau/nv_object.xml.h b/src/gallium/drivers/nouveau/nv_object.xml.h
new file mode 100644
index 0000000000..cb7653c3fe
--- /dev/null
+++ b/src/gallium/drivers/nouveau/nv_object.xml.h
@@ -0,0 +1,231 @@
+#ifndef NV_OBJECT_XML
+#define NV_OBJECT_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv30-40_3d.xml ( 31709 bytes, from 2010-09-05 07:53:14)
+- copyright.xml ( 6503 bytes, from 2010-04-10 23:15:50)
+- nv_3ddefs.xml ( 15193 bytes, from 2010-09-05 07:50:15)
+- nv_defs.xml ( 4437 bytes, from 2010-08-05 19:38:53)
+- nv_object.xml ( 10424 bytes, from 2010-08-05 19:38:53)
+- nvchipsets.xml ( 2824 bytes, from 2010-08-05 19:38:53)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <mandin.patrice@orange.fr> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+#define NV01_ROOT 0x00000001
+#define NV01_CONTEXT_DMA 0x00000002
+#define NV01_DEVICE 0x00000003
+#define NV01_TIMER 0x00000004
+#define NV01_NULL 0x00000030
+#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
+#define NV01_MAPPING_SYSTEM 0x0000003e
+#define NV03_MEMORY_LOCAL_CURSOR 0x0000003f
+#define NV01_MEMORY_LOCAL_LINEAR 0x00000040
+#define NV01_MAPPING_LOCAL 0x00000041
+#define NV03_VIDEO_LUT_CURSOR_DAC 0x00000046
+#define NV03_CHANNEL_PIO 0x0000006a
+#define NV03_CHANNEL_DMA 0x0000006b
+#define NV10_VIDEO_DISPLAY 0x0000007c
+#define NV01_CONTEXT_BETA1 0x00000012
+#define NV04_BETA_SOLID 0x00000072
+#define NV01_CONTEXT_COLOR_KEY 0x00000017
+#define NV04_CONTEXT_COLOR_KEY 0x00000057
+#define NV01_CONTEXT_PATTERN 0x00000018
+#define NV01_CONTEXT_CLIP_RECTANGLE 0x00000019
+#define NV03_CONTEXT_ROP 0x00000043
+#define NV04_IMAGE_PATTERN 0x00000044
+#define NV01_RENDER_SOLID_LINE 0x0000001c
+#define NV04_RENDER_SOLID_LINE 0x0000005c
+#define NV30_RENDER_SOLID_LINE 0x0000035c
+#define NV40_RENDER_SOLID_LINE 0x0000305c
+#define NV01_RENDER_SOLID_TRIANGLE 0x0000001d
+#define NV04_RENDER_SOLID_TRIANGLE 0x0000005d
+#define NV01_RENDER_SOLID_RECTANGLE 0x0000001e
+#define NV04_RENDER_SOLID_RECTANGLE 0x0000005e
+#define NV01_IMAGE_BLIT 0x0000001f
+#define NV04_IMAGE_BLIT 0x0000005f
+#define NV11_IMAGE_BLIT 0x0000009f
+#define NV01_IMAGE_FROM_CPU 0x00000021
+#define NV04_IMAGE_FROM_CPU 0x00000061
+#define NV05_IMAGE_FROM_CPU 0x00000065
+#define NV10_IMAGE_FROM_CPU 0x0000008a
+#define NV30_IMAGE_FROM_CPU 0x0000038a
+#define NV40_IMAGE_FROM_CPU 0x0000308a
+#define NV03_STRETCHED_IMAGE_FROM_CPU 0x00000036
+#define NV04_STRETCHED_IMAGE_FROM_CPU 0x00000076
+#define NV05_STRETCHED_IMAGE_FROM_CPU 0x00000066
+#define NV30_STRETCHED_IMAGE_FROM_CPU 0x00000366
+#define NV40_STRETCHED_IMAGE_FROM_CPU 0x00003066
+#define NV03_SCALED_IMAGE_FROM_MEMORY 0x00000037
+#define NV04_SCALED_IMAGE_FROM_MEMORY 0x00000077
+#define NV05_SCALED_IMAGE_FROM_MEMORY 0x00000063
+#define NV10_SCALED_IMAGE_FROM_MEMORY 0x00000089
+#define NV30_SCALED_IMAGE_FROM_MEMORY 0x00000389
+#define NV40_SCALED_IMAGE_FROM_MEMORY 0x00003089
+#define NV50_SCALED_IMAGE_FROM_MEMORY 0x00005089
+#define NV04_DVD_SUBPICTURE 0x00000038
+#define NV10_DVD_SUBPICTURE 0x00000088
+#define NV03_GDI_RECTANGLE_TEXT 0x0000004b
+#define NV04_GDI_RECTANGLE_TEXT 0x0000004a
+#define NV04_SWIZZLED_SURFACE 0x00000052
+#define NV11_SWIZZLED_SURFACE 0x0000009e
+#define NV30_SWIZZLED_SURFACE 0x0000039e
+#define NV40_SWIZZLED_SURFACE 0x0000309e
+#define NV03_CONTEXT_SURFACE_DST 0x00000058
+#define NV03_CONTEXT_SURFACE_SRC 0x00000059
+#define NV04_CONTEXT_SURFACES_2D 0x00000042
+#define NV10_CONTEXT_SURFACES_2D 0x00000062
+#define NV30_CONTEXT_SURFACES_2D 0x00000362
+#define NV40_CONTEXT_SURFACES_2D 0x00003062
+#define NV50_CONTEXT_SURFACES_2D 0x00005062
+#define NV04_INDEXED_IMAGE_FROM_CPU 0x00000060
+#define NV05_INDEXED_IMAGE_FROM_CPU 0x00000064
+#define NV30_INDEXED_IMAGE_FROM_CPU 0x00000364
+#define NV40_INDEXED_IMAGE_FROM_CPU 0x00003064
+#define NV10_TEXTURE_FROM_CPU 0x0000007b
+#define NV30_TEXTURE_FROM_CPU 0x0000037b
+#define NV40_TEXTURE_FROM_CPU 0x0000307b
+#define NV04_M2MF 0x00000039
+#define NV50_M2MF 0x00005039
+#define NVC0_M2MF 0x00009039
+#define NV03_TEXTURED_TRIANGLE 0x00000048
+#define NV04_TEXTURED_TRIANGLE 0x00000054
+#define NV10_TEXTURED_TRIANGLE 0x00000094
+#define NV04_MULTITEX_TRIANGLE 0x00000055
+#define NV10_MULTITEX_TRIANGLE 0x00000095
+#define NV03_CONTEXT_SURFACE_COLOR 0x0000005a
+#define NV03_CONTEXT_SURFACE_ZETA 0x0000005b
+#define NV04_CONTEXT_SURFACES_3D 0x00000053
+#define NV10_CONTEXT_SURFACES_3D 0x00000093
+#define NV10_3D 0x00000056
+#define NV11_3D 0x00000096
+#define NV17_3D 0x00000099
+#define NV20_3D 0x00000097
+#define NV25_3D 0x00000597
+#define NV30_3D 0x00000397
+#define NV35_3D 0x00000497
+#define NV34_3D 0x00000697
+#define NV40_3D 0x00004097
+#define NV44_3D 0x00004497
+#define NV50_3D 0x00005097
+#define NV84_3D 0x00008297
+#define NVA0_3D 0x00008397
+#define NVA3_3D 0x00008597
+#define NVAF_3D 0x00008697
+#define NVC0_3D 0x00009097
+#define NV50_2D 0x0000502d
+#define NVC0_2D 0x0000902d
+#define NV50_COMPUTE 0x000050c0
+#define NVA3_COMPUTE 0x000085c0
+#define NVC0_COMPUTE 0x000090c0
+#define NV01_SUBCHAN__SIZE 0x00002000
+#define NV01_SUBCHAN 0x00000000
+
+#define NV01_SUBCHAN_OBJECT 0x00000000
+
+
+#define NV84_SUBCHAN_QUERY_ADDRESS_HIGH 0x00000010
+
+#define NV84_SUBCHAN_QUERY_ADDRESS_LOW 0x00000014
+
+#define NV84_SUBCHAN_QUERY_COUNTER 0x00000018
+
+#define NV84_SUBCHAN_QUERY_GET 0x0000001c
+
+#define NV84_SUBCHAN_UNK20 0x00000020
+
+#define NV84_SUBCHAN_UNK24 0x00000024
+
+#define NV10_SUBCHAN_REF_CNT 0x00000050
+
+
+#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
+
+#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
+
+#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
+
+#define NV11_SUBCHAN_SEMAPHORE_RELEASE 0x0000006c
+
+#define NV50_SUBCHAN_UNK80 0x00000080
+
+#define NV01_GRAPH 0x00000000
+
+#define NV04_GRAPH_NOP 0x00000100
+
+#define NV01_GRAPH_NOTIFY 0x00000104
+#define NV01_GRAPH_NOTIFY_WRITE 0x00000000
+#define NV01_GRAPH_NOTIFY_WRITE_AND_AWAKEN 0x00000001
+
+#define NV50_GRAPH_WAIT_FOR_IDLE 0x00000110
+
+#define NVA3_GRAPH_UNK0120 0x00000120
+
+#define NVA3_GRAPH_UNK0124 0x00000124
+
+#define NV40_GRAPH_PM_TRIGGER 0x00000140
+
+
+#endif /* NV_OBJECT_XML */
diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h
index d24d6c50ea..6ec9095a74 100644
--- a/src/gallium/drivers/nv50/nv50_context.h
+++ b/src/gallium/drivers/nv50/nv50_context.h
@@ -16,6 +16,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
#include "nouveau/nouveau_stateobj.h"
+#include "nv50_reg.h"
#include "nv50_screen.h"
#include "nv50_program.h"
diff --git a/src/gallium/drivers/nv50/nv50_formats.c b/src/gallium/drivers/nv50/nv50_formats.c
index e1c7dae306..3be39d5337 100644
--- a/src/gallium/drivers/nv50/nv50_formats.c
+++ b/src/gallium/drivers/nv50/nv50_formats.c
@@ -22,7 +22,7 @@
#include "nv50_screen.h"
#include "nv50_texture.h"
-#include "nouveau/nouveau_class.h"
+#include "nv50_reg.h"
#include "pipe/p_defines.h"
#define A_(cr, cg, cb, ca, t0, t1, t2, t3, sz, r) \
diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h
index d8b6e8d6d1..97d2933c3e 100644
--- a/src/gallium/drivers/nv50/nv50_program.h
+++ b/src/gallium/drivers/nv50/nv50_program.h
@@ -25,7 +25,6 @@
#include "pipe/p_state.h"
#include "tgsi/tgsi_scan.h"
-#include "nouveau/nouveau_class.h"
#define NV50_CAP_MAX_PROGRAM_TEMPS 64
diff --git a/src/gallium/drivers/nv50/nv50_reg.h b/src/gallium/drivers/nv50/nv50_reg.h
new file mode 100644
index 0000000000..365576fdd0
--- /dev/null
+++ b/src/gallium/drivers/nv50/nv50_reg.h
@@ -0,0 +1,1824 @@
+/*************************************************************************
+
+ Autogenerated file, do not edit !
+
+ This file was generated by renouveau-gen from renouveau.xml, the
+ XML database of nvidia objects and methods. renouveau-gen and
+ renouveau.xml can be found in CVS module renouveau of sourceforge.net
+ project nouveau:
+
+cvs -z3 -d:pserver:anonymous@nouveau.cvs.sourceforge.net:/cvsroot/nouveau co -P renouveau
+
+**************************************************************************
+
+ Copyright (C) 2006-2008 :
+ Dmitry Baryshkov,
+ Laurent Carlier,
+ Matthieu Castet,
+ Dawid Gajownik,
+ Jeremy Kolb,
+ Stephane Loeuillet,
+ Patrice Mandin,
+ Stephane Marchesin,
+ Serge Martin,
+ Sylvain Munaut,
+ Simon Raffeiner,
+ Ben Skeggs,
+ Erik Waling,
+ koala_br,
+
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*************************************************************************/
+
+
+#ifndef NOUVEAU_REG_H
+#define NOUVEAU_REG_H 1
+
+
+#define NV04_MEMORY_TO_MEMORY_FORMAT 0x00000039
+
+#define NV04_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
+#define NV04_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY 0x00000180
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN 0x00000184
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_OUT 0x00000188
+#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c
+#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT 0x00000310
+#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_IN 0x00000314
+#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT 0x00000318
+#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN 0x0000031c
+#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_COUNT 0x00000320
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT 0x00000324
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_SHIFT 0
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_MASK 0x000000ff
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_SHIFT 8
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_MASK 0x0000ff00
+#define NV04_MEMORY_TO_MEMORY_FORMAT_BUF_NOTIFY 0x00000328
+
+
+#define NV50_MEMORY_TO_MEMORY_FORMAT 0x00005039
+
+#define NV50_MEMORY_TO_MEMORY_FORMAT_SERIALIZE 0x00000110
+#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN 0x00000200
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_IN 0x00000204
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_IN 0x00000208
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_IN 0x0000020c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_IN 0x00000210
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Z 0x00000214
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN 0x00000218
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_SHIFT 0
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_MASK 0x0000ffff
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_SHIFT 16
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_MASK 0xffff0000
+#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT 0x0000021c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_OUT 0x00000220
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_OUT 0x00000224
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_OUT 0x00000228
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_OUT 0x0000022c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Z 0x00000230
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT 0x00000234
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_SHIFT 0
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_MASK 0x0000ffff
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_SHIFT 16
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_MASK 0xffff0000
+#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x00000238
+#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x0000023c
+
+
+#define NV50_2D 0x0000502d
+
+#define NV50_2D_NOP 0x00000100
+#define NV50_2D_NOTIFY 0x00000104
+#define NV50_2D_SERIALIZE 0x00000110
+#define NV50_2D_DMA_NOTIFY 0x00000180
+#define NV50_2D_DMA_DST 0x00000184
+#define NV50_2D_DMA_SRC 0x00000188
+#define NV50_2D_DMA_COND 0x0000018c
+#define NV50_2D_DST_FORMAT 0x00000200
+#define NV50_2D_DST_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50_2D_DST_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50_2D_DST_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50_2D_DST_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50_2D_DST_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50_2D_DST_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50_2D_DST_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50_2D_DST_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50_2D_DST_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50_2D_DST_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50_2D_DST_FORMAT_R32G32_SINT 0x000000cc
+#define NV50_2D_DST_FORMAT_R32G32_UINT 0x000000cd
+#define NV50_2D_DST_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50_2D_DST_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50_2D_DST_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50_2D_DST_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50_2D_DST_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50_2D_DST_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50_2D_DST_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50_2D_DST_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50_2D_DST_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50_2D_DST_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50_2D_DST_FORMAT_R16G16_UNORM 0x000000da
+#define NV50_2D_DST_FORMAT_R16G16_SNORM 0x000000db
+#define NV50_2D_DST_FORMAT_R16G16_SINT 0x000000dc
+#define NV50_2D_DST_FORMAT_R16G16_UINT 0x000000dd
+#define NV50_2D_DST_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50_2D_DST_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50_2D_DST_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50_2D_DST_FORMAT_R32_FLOAT 0x000000e5
+#define NV50_2D_DST_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50_2D_DST_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50_2D_DST_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50_2D_DST_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50_2D_DST_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50_2D_DST_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50_2D_DST_FORMAT_R8G8_SINT 0x000000ec
+#define NV50_2D_DST_FORMAT_R8G8_UINT 0x000000ed
+#define NV50_2D_DST_FORMAT_R16_UNORM 0x000000ee
+#define NV50_2D_DST_FORMAT_R16_SNORM 0x000000ef
+#define NV50_2D_DST_FORMAT_R16_SINT 0x000000f0
+#define NV50_2D_DST_FORMAT_R16_UINT 0x000000f1
+#define NV50_2D_DST_FORMAT_R16_FLOAT 0x000000f2
+#define NV50_2D_DST_FORMAT_R8_UNORM 0x000000f3
+#define NV50_2D_DST_FORMAT_R8_SNORM 0x000000f4
+#define NV50_2D_DST_FORMAT_R8_SINT 0x000000f5
+#define NV50_2D_DST_FORMAT_R8_UINT 0x000000f6
+#define NV50_2D_DST_FORMAT_A8_UNORM 0x000000f7
+#define NV50_2D_DST_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50_2D_DST_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50_2D_DST_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50_2D_DST_LINEAR 0x00000204
+#define NV50_2D_DST_TILE_MODE 0x00000208
+#define NV50_2D_DST_DEPTH 0x0000020c
+#define NV50_2D_DST_LAYER 0x00000210
+#define NV50_2D_DST_PITCH 0x00000214
+#define NV50_2D_DST_WIDTH 0x00000218
+#define NV50_2D_DST_HEIGHT 0x0000021c
+#define NV50_2D_DST_ADDRESS_HIGH 0x00000220
+#define NV50_2D_DST_ADDRESS_LOW 0x00000224
+#define NV50_2D_SRC_FORMAT 0x00000230
+#define NV50_2D_SRC_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50_2D_SRC_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50_2D_SRC_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50_2D_SRC_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50_2D_SRC_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50_2D_SRC_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50_2D_SRC_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50_2D_SRC_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50_2D_SRC_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50_2D_SRC_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50_2D_SRC_FORMAT_R32G32_SINT 0x000000cc
+#define NV50_2D_SRC_FORMAT_R32G32_UINT 0x000000cd
+#define NV50_2D_SRC_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50_2D_SRC_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50_2D_SRC_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50_2D_SRC_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50_2D_SRC_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50_2D_SRC_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50_2D_SRC_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50_2D_SRC_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50_2D_SRC_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50_2D_SRC_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50_2D_SRC_FORMAT_R16G16_UNORM 0x000000da
+#define NV50_2D_SRC_FORMAT_R16G16_SNORM 0x000000db
+#define NV50_2D_SRC_FORMAT_R16G16_SINT 0x000000dc
+#define NV50_2D_SRC_FORMAT_R16G16_UINT 0x000000dd
+#define NV50_2D_SRC_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50_2D_SRC_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50_2D_SRC_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50_2D_SRC_FORMAT_R32_FLOAT 0x000000e5
+#define NV50_2D_SRC_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50_2D_SRC_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50_2D_SRC_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50_2D_SRC_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50_2D_SRC_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50_2D_SRC_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50_2D_SRC_FORMAT_R8G8_SINT 0x000000ec
+#define NV50_2D_SRC_FORMAT_R8G8_UINT 0x000000ed
+#define NV50_2D_SRC_FORMAT_R16_UNORM 0x000000ee
+#define NV50_2D_SRC_FORMAT_R16_SNORM 0x000000ef
+#define NV50_2D_SRC_FORMAT_R16_SINT 0x000000f0
+#define NV50_2D_SRC_FORMAT_R16_UINT 0x000000f1
+#define NV50_2D_SRC_FORMAT_R16_FLOAT 0x000000f2
+#define NV50_2D_SRC_FORMAT_R8_UNORM 0x000000f3
+#define NV50_2D_SRC_FORMAT_R8_SNORM 0x000000f4
+#define NV50_2D_SRC_FORMAT_R8_SINT 0x000000f5
+#define NV50_2D_SRC_FORMAT_R8_UINT 0x000000f6
+#define NV50_2D_SRC_FORMAT_A8_UNORM 0x000000f7
+#define NV50_2D_SRC_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50_2D_SRC_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50_2D_SRC_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50_2D_SRC_LINEAR 0x00000234
+#define NV50_2D_SRC_TILE_MODE 0x00000238
+#define NV50_2D_SRC_DEPTH 0x0000023c
+#define NV50_2D_SRC_LAYER 0x00000240
+#define NV50_2D_SRC_PITCH 0x00000244
+#define NV50_2D_SRC_WIDTH 0x00000248
+#define NV50_2D_SRC_HEIGHT 0x0000024c
+#define NV50_2D_SRC_ADDRESS_HIGH 0x00000250
+#define NV50_2D_SRC_ADDRESS_LOW 0x00000254
+#define NV50_2D_COND_ADDRESS_HIGH 0x00000264
+#define NV50_2D_COND_ADDRESS_LOW 0x00000268
+#define NV50_2D_COND_MODE 0x0000026c
+#define NV50_2D_COND_MODE_NEVER 0x00000000
+#define NV50_2D_COND_MODE_ALWAYS 0x00000001
+#define NV50_2D_COND_MODE_RES 0x00000002
+#define NV50_2D_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
+#define NV50_2D_COND_MODE_RES_OR_ID 0x00000004
+#define NV50_2D_CLIP_X 0x00000280
+#define NV50_2D_CLIP_Y 0x00000284
+#define NV50_2D_CLIP_W 0x00000288
+#define NV50_2D_CLIP_H 0x0000028c
+#define NV50_2D_CLIP_ENABLE 0x00000290
+#define NV50_2D_COLOR_KEY_FORMAT 0x00000294
+#define NV50_2D_COLOR_KEY_FORMAT_16BPP 0x00000000
+#define NV50_2D_COLOR_KEY_FORMAT_15BPP 0x00000001
+#define NV50_2D_COLOR_KEY_FORMAT_24BPP 0x00000002
+#define NV50_2D_COLOR_KEY_FORMAT_30BPP 0x00000003
+#define NV50_2D_COLOR_KEY_FORMAT_8BPP 0x00000004
+#define NV50_2D_COLOR_KEY_FORMAT_16BPP2 0x00000005
+#define NV50_2D_COLOR_KEY_FORMAT_32BPP 0x00000006
+#define NV50_2D_COLOR_KEY 0x00000298
+#define NV50_2D_COLOR_KEY_ENABLE 0x0000029c
+#define NV50_2D_ROP 0x000002a0
+#define NV50_2D_OPERATION 0x000002ac
+#define NV50_2D_OPERATION_SRCCOPY_AND 0x00000000
+#define NV50_2D_OPERATION_ROP_AND 0x00000001
+#define NV50_2D_OPERATION_BLEND_AND 0x00000002
+#define NV50_2D_OPERATION_SRCCOPY 0x00000003
+#define NV50_2D_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV50_2D_OPERATION_BLEND_PREMULT 0x00000005
+#define NV50_2D_PATTERN_FORMAT 0x000002e8
+#define NV50_2D_PATTERN_FORMAT_16BPP 0x00000000
+#define NV50_2D_PATTERN_FORMAT_15BPP 0x00000001
+#define NV50_2D_PATTERN_FORMAT_32BPP 0x00000002
+#define NV50_2D_PATTERN_FORMAT_8BPP 0x00000003
+#define NV50_2D_PATTERN_COLOR(x) (0x000002f0+((x)*4))
+#define NV50_2D_PATTERN_COLOR__SIZE 0x00000002
+#define NV50_2D_PATTERN_BITMAP(x) (0x000002f8+((x)*4))
+#define NV50_2D_PATTERN_BITMAP__SIZE 0x00000002
+#define NV50_2D_DRAW_SHAPE 0x00000580
+#define NV50_2D_DRAW_SHAPE_POINTS 0x00000000
+#define NV50_2D_DRAW_SHAPE_LINES 0x00000001
+#define NV50_2D_DRAW_SHAPE_LINE_STRIP 0x00000002
+#define NV50_2D_DRAW_SHAPE_TRIANGLES 0x00000003
+#define NV50_2D_DRAW_SHAPE_RECTANGLES 0x00000004
+#define NV50_2D_DRAW_COLOR_FORMAT 0x00000584
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_SINT 0x000000cc
+#define NV50_2D_DRAW_COLOR_FORMAT_R32G32_UINT 0x000000cd
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50_2D_DRAW_COLOR_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50_2D_DRAW_COLOR_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50_2D_DRAW_COLOR_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50_2D_DRAW_COLOR_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50_2D_DRAW_COLOR_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_UNORM 0x000000da
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_SNORM 0x000000db
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_SINT 0x000000dc
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_UINT 0x000000dd
+#define NV50_2D_DRAW_COLOR_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50_2D_DRAW_COLOR_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50_2D_DRAW_COLOR_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50_2D_DRAW_COLOR_FORMAT_R32_FLOAT 0x000000e5
+#define NV50_2D_DRAW_COLOR_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50_2D_DRAW_COLOR_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50_2D_DRAW_COLOR_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50_2D_DRAW_COLOR_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_SINT 0x000000ec
+#define NV50_2D_DRAW_COLOR_FORMAT_R8G8_UINT 0x000000ed
+#define NV50_2D_DRAW_COLOR_FORMAT_R16_UNORM 0x000000ee
+#define NV50_2D_DRAW_COLOR_FORMAT_R16_SNORM 0x000000ef
+#define NV50_2D_DRAW_COLOR_FORMAT_R16_SINT 0x000000f0
+#define NV50_2D_DRAW_COLOR_FORMAT_R16_UINT 0x000000f1
+#define NV50_2D_DRAW_COLOR_FORMAT_R16_FLOAT 0x000000f2
+#define NV50_2D_DRAW_COLOR_FORMAT_R8_UNORM 0x000000f3
+#define NV50_2D_DRAW_COLOR_FORMAT_R8_SNORM 0x000000f4
+#define NV50_2D_DRAW_COLOR_FORMAT_R8_SINT 0x000000f5
+#define NV50_2D_DRAW_COLOR_FORMAT_R8_UINT 0x000000f6
+#define NV50_2D_DRAW_COLOR_FORMAT_A8_UNORM 0x000000f7
+#define NV50_2D_DRAW_COLOR_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50_2D_DRAW_COLOR_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50_2D_DRAW_COLOR_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50_2D_DRAW_COLOR 0x00000588
+#define NV50_2D_DRAW_POINT16 0x000005e0
+#define NV50_2D_DRAW_POINT16_X_SHIFT 0
+#define NV50_2D_DRAW_POINT16_X_MASK 0x0000ffff
+#define NV50_2D_DRAW_POINT16_Y_SHIFT 16
+#define NV50_2D_DRAW_POINT16_Y_MASK 0xffff0000
+#define NV50_2D_DRAW_POINT32_X(x) (0x00000600+((x)*8))
+#define NV50_2D_DRAW_POINT32_X__SIZE 0x00000040
+#define NV50_2D_DRAW_POINT32_Y(x) (0x00000604+((x)*8))
+#define NV50_2D_DRAW_POINT32_Y__SIZE 0x00000040
+#define NV50_2D_SIFC_BITMAP_ENABLE 0x00000800
+#define NV50_2D_SIFC_FORMAT 0x00000804
+#define NV50_2D_SIFC_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50_2D_SIFC_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50_2D_SIFC_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50_2D_SIFC_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50_2D_SIFC_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50_2D_SIFC_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50_2D_SIFC_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50_2D_SIFC_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50_2D_SIFC_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50_2D_SIFC_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50_2D_SIFC_FORMAT_R32G32_SINT 0x000000cc
+#define NV50_2D_SIFC_FORMAT_R32G32_UINT 0x000000cd
+#define NV50_2D_SIFC_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50_2D_SIFC_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50_2D_SIFC_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50_2D_SIFC_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50_2D_SIFC_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50_2D_SIFC_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50_2D_SIFC_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50_2D_SIFC_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50_2D_SIFC_FORMAT_R16G16_UNORM 0x000000da
+#define NV50_2D_SIFC_FORMAT_R16G16_SNORM 0x000000db
+#define NV50_2D_SIFC_FORMAT_R16G16_SINT 0x000000dc
+#define NV50_2D_SIFC_FORMAT_R16G16_UINT 0x000000dd
+#define NV50_2D_SIFC_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50_2D_SIFC_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50_2D_SIFC_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50_2D_SIFC_FORMAT_R32_FLOAT 0x000000e5
+#define NV50_2D_SIFC_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50_2D_SIFC_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50_2D_SIFC_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50_2D_SIFC_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50_2D_SIFC_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50_2D_SIFC_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50_2D_SIFC_FORMAT_R8G8_SINT 0x000000ec
+#define NV50_2D_SIFC_FORMAT_R8G8_UINT 0x000000ed
+#define NV50_2D_SIFC_FORMAT_R16_UNORM 0x000000ee
+#define NV50_2D_SIFC_FORMAT_R16_SNORM 0x000000ef
+#define NV50_2D_SIFC_FORMAT_R16_SINT 0x000000f0
+#define NV50_2D_SIFC_FORMAT_R16_UINT 0x000000f1
+#define NV50_2D_SIFC_FORMAT_R16_FLOAT 0x000000f2
+#define NV50_2D_SIFC_FORMAT_R8_UNORM 0x000000f3
+#define NV50_2D_SIFC_FORMAT_R8_SNORM 0x000000f4
+#define NV50_2D_SIFC_FORMAT_R8_SINT 0x000000f5
+#define NV50_2D_SIFC_FORMAT_R8_UINT 0x000000f6
+#define NV50_2D_SIFC_FORMAT_A8_UNORM 0x000000f7
+#define NV50_2D_SIFC_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50_2D_SIFC_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50_2D_SIFC_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50_2D_SIFC_BITMAP_UNK808 0x00000808
+#define NV50_2D_SIFC_BITMAP_LSB_FIRST 0x0000080c
+#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE 0x00000810
+#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_PACKED 0x00000000
+#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_BYTE 0x00000001
+#define NV50_2D_SIFC_BITMAP_LINE_PACK_MODE_ALIGN_WORD 0x00000002
+#define NV50_2D_SIFC_BITMAP_COLOR_BIT0 0x00000814
+#define NV50_2D_SIFC_BITMAP_COLOR_BIT1 0x00000818
+#define NV50_2D_SIFC_BITMAP_WRITE_BIT0_ENABLE 0x0000081c
+#define NV50_2D_SIFC_WIDTH 0x00000838
+#define NV50_2D_SIFC_HEIGHT 0x0000083c
+#define NV50_2D_SIFC_DX_DU_FRACT 0x00000840
+#define NV50_2D_SIFC_DX_DU_INT 0x00000844
+#define NV50_2D_SIFC_DY_DV_FRACT 0x00000848
+#define NV50_2D_SIFC_DY_DV_INT 0x0000084c
+#define NV50_2D_SIFC_DST_X_FRACT 0x00000850
+#define NV50_2D_SIFC_DST_X_INT 0x00000854
+#define NV50_2D_SIFC_DST_Y_FRACT 0x00000858
+#define NV50_2D_SIFC_DST_Y_INT 0x0000085c
+#define NV50_2D_SIFC_DATA 0x00000860
+#define NV50_2D_BLIT_DST_X 0x000008b0
+#define NV50_2D_BLIT_DST_Y 0x000008b4
+#define NV50_2D_BLIT_DST_W 0x000008b8
+#define NV50_2D_BLIT_DST_H 0x000008bc
+#define NV50_2D_BLIT_DU_DX_FRACT 0x000008c0
+#define NV50_2D_BLIT_DU_DX_INT 0x000008c4
+#define NV50_2D_BLIT_DV_DY_FRACT 0x000008c8
+#define NV50_2D_BLIT_DV_DY_INT 0x000008cc
+#define NV50_2D_BLIT_SRC_X_FRACT 0x000008d0
+#define NV50_2D_BLIT_SRC_X_INT 0x000008d4
+#define NV50_2D_BLIT_SRC_Y_FRACT 0x000008d8
+#define NV50_2D_BLIT_SRC_Y_INT 0x000008dc
+
+
+#define NV50TCL 0x00005097
+
+#define NV50TCL_NOP 0x00000100
+#define NV50TCL_NOTIFY 0x00000104
+#define NV50TCL_SERIALIZE 0x00000110
+#define NV50TCL_DMA_NOTIFY 0x00000180
+#define NV50TCL_DMA_ZETA 0x00000184
+#define NV50TCL_DMA_QUERY 0x00000188
+#define NV50TCL_DMA_VTXBUF0 0x0000018c
+#define NV50TCL_DMA_LOCAL 0x00000190
+#define NV50TCL_DMA_STACK 0x00000194
+#define NV50TCL_DMA_CODE_CB 0x00000198
+#define NV50TCL_DMA_TSC 0x0000019c
+#define NV50TCL_DMA_TIC 0x000001a0
+#define NV50TCL_DMA_TEXTURE 0x000001a4
+#define NV50TCL_DMA_STRMOUT 0x000001a8
+#define NV50TCL_DMA_CLIPID 0x000001ac
+#define NV50TCL_DMA_COLOR(x) (0x000001c0+((x)*4))
+#define NV50TCL_DMA_COLOR__SIZE 0x00000008
+#define NV50TCL_RT_ADDRESS_HIGH(x) (0x00000200+((x)*32))
+#define NV50TCL_RT_ADDRESS_HIGH__SIZE 0x00000008
+#define NV50TCL_RT_ADDRESS_LOW(x) (0x00000204+((x)*32))
+#define NV50TCL_RT_ADDRESS_LOW__SIZE 0x00000008
+#define NV50TCL_RT_FORMAT(x) (0x00000208+((x)*32))
+#define NV50TCL_RT_FORMAT__SIZE 0x00000008
+#define NV50TCL_RT_FORMAT_R32G32B32A32_FLOAT 0x000000c0
+#define NV50TCL_RT_FORMAT_R32G32B32A32_SINT 0x000000c1
+#define NV50TCL_RT_FORMAT_R32G32B32A32_UINT 0x000000c2
+#define NV50TCL_RT_FORMAT_R32G32B32X32_FLOAT 0x000000c3
+#define NV50TCL_RT_FORMAT_R16G16B16A16_UNORM 0x000000c6
+#define NV50TCL_RT_FORMAT_R16G16B16A16_SNORM 0x000000c7
+#define NV50TCL_RT_FORMAT_R16G16B16A16_SINT 0x000000c8
+#define NV50TCL_RT_FORMAT_R16G16B16A16_UINT 0x000000c9
+#define NV50TCL_RT_FORMAT_R16G16B16A16_FLOAT 0x000000ca
+#define NV50TCL_RT_FORMAT_R32G32_FLOAT 0x000000cb
+#define NV50TCL_RT_FORMAT_R32G32_SINT 0x000000cc
+#define NV50TCL_RT_FORMAT_R32G32_UINT 0x000000cd
+#define NV50TCL_RT_FORMAT_R16G16B16X16_FLOAT 0x000000ce
+#define NV50TCL_RT_FORMAT_A8R8G8B8_UNORM 0x000000cf
+#define NV50TCL_RT_FORMAT_A8R8G8B8_SRGB 0x000000d0
+#define NV50TCL_RT_FORMAT_A2B10G10R10_UNORM 0x000000d1
+#define NV50TCL_RT_FORMAT_A2B10G10R10_UINT 0x000000d2
+#define NV50TCL_RT_FORMAT_A8B8G8R8_UNORM 0x000000d5
+#define NV50TCL_RT_FORMAT_A8B8G8R8_SRGB 0x000000d6
+#define NV50TCL_RT_FORMAT_A8B8G8R8_SNORM 0x000000d7
+#define NV50TCL_RT_FORMAT_A8B8G8R8_SINT 0x000000d8
+#define NV50TCL_RT_FORMAT_A8B8G8R8_UINT 0x000000d9
+#define NV50TCL_RT_FORMAT_R16G16_UNORM 0x000000da
+#define NV50TCL_RT_FORMAT_R16G16_SNORM 0x000000db
+#define NV50TCL_RT_FORMAT_R16G16_SINT 0x000000dc
+#define NV50TCL_RT_FORMAT_R16G16_UINT 0x000000dd
+#define NV50TCL_RT_FORMAT_R16G16_FLOAT 0x000000de
+#define NV50TCL_RT_FORMAT_A2R10G10B10_UNORM 0x000000df
+#define NV50TCL_RT_FORMAT_B10G11R11_FLOAT 0x000000e0
+#define NV50TCL_RT_FORMAT_R32_FLOAT 0x000000e5
+#define NV50TCL_RT_FORMAT_X8R8G8B8_UNORM 0x000000e6
+#define NV50TCL_RT_FORMAT_X8R8G8B8_SRGB 0x000000e7
+#define NV50TCL_RT_FORMAT_R5G6B5_UNORM 0x000000e8
+#define NV50TCL_RT_FORMAT_A1R5G5B5_UNORM 0x000000e9
+#define NV50TCL_RT_FORMAT_R8G8_UNORM 0x000000ea
+#define NV50TCL_RT_FORMAT_R8G8_SNORM 0x000000eb
+#define NV50TCL_RT_FORMAT_R8G8_SINT 0x000000ec
+#define NV50TCL_RT_FORMAT_R8G8_UINT 0x000000ed
+#define NV50TCL_RT_FORMAT_R16_UNORM 0x000000ee
+#define NV50TCL_RT_FORMAT_R16_SNORM 0x000000ef
+#define NV50TCL_RT_FORMAT_R16_SINT 0x000000f0
+#define NV50TCL_RT_FORMAT_R16_UINT 0x000000f1
+#define NV50TCL_RT_FORMAT_R16_FLOAT 0x000000f2
+#define NV50TCL_RT_FORMAT_R8_UNORM 0x000000f3
+#define NV50TCL_RT_FORMAT_R8_SNORM 0x000000f4
+#define NV50TCL_RT_FORMAT_R8_SINT 0x000000f5
+#define NV50TCL_RT_FORMAT_R8_UINT 0x000000f6
+#define NV50TCL_RT_FORMAT_A8_UNORM 0x000000f7
+#define NV50TCL_RT_FORMAT_X1R5G5B5_UNORM 0x000000f8
+#define NV50TCL_RT_FORMAT_X8B8G8R8_UNORM 0x000000f9
+#define NV50TCL_RT_FORMAT_X8B8G8R8_SRGB 0x000000fa
+#define NV50TCL_RT_TILE_MODE(x) (0x0000020c+((x)*32))
+#define NV50TCL_RT_TILE_MODE__SIZE 0x00000008
+#define NV50TCL_RT_LAYER_STRIDE(x) (0x00000210+((x)*32))
+#define NV50TCL_RT_LAYER_STRIDE__SIZE 0x00000008
+#define NV50TCL_VTX_ATTR_1F(x) (0x00000300+((x)*4))
+#define NV50TCL_VTX_ATTR_1F__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_2H(x) (0x00000340+((x)*4))
+#define NV50TCL_VTX_ATTR_2H__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_2H_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_2H_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_2H_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_2H_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_2F_X(x) (0x00000380+((x)*8))
+#define NV50TCL_VTX_ATTR_2F_X__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_2F_Y(x) (0x00000384+((x)*8))
+#define NV50TCL_VTX_ATTR_2F_Y__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_3F_X(x) (0x00000400+((x)*16))
+#define NV50TCL_VTX_ATTR_3F_X__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_3F_Y(x) (0x00000404+((x)*16))
+#define NV50TCL_VTX_ATTR_3F_Y__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_3F_Z(x) (0x00000408+((x)*16))
+#define NV50TCL_VTX_ATTR_3F_Z__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4F_X(x) (0x00000500+((x)*16))
+#define NV50TCL_VTX_ATTR_4F_X__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4F_Y(x) (0x00000504+((x)*16))
+#define NV50TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4F_Z(x) (0x00000508+((x)*16))
+#define NV50TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4F_W(x) (0x0000050c+((x)*16))
+#define NV50TCL_VTX_ATTR_4F_W__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4H_0(x) (0x00000600+((x)*8))
+#define NV50TCL_VTX_ATTR_4H_0__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4H_0_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4H_0_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4H_0_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_4H_0_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4H_1(x) (0x00000604+((x)*8))
+#define NV50TCL_VTX_ATTR_4H_1__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4H_1_Z_SHIFT 0
+#define NV50TCL_VTX_ATTR_4H_1_Z_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4H_1_W_SHIFT 16
+#define NV50TCL_VTX_ATTR_4H_1_W_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_2I(x) (0x00000680+((x)*4))
+#define NV50TCL_VTX_ATTR_2I__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_2I_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_2I_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_2I_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_2I_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_2NI(x) (0x000006c0+((x)*4))
+#define NV50TCL_VTX_ATTR_2NI__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_2NI_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_2NI_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_2NI_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_2NI_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4I_0(x) (0x00000700+((x)*8))
+#define NV50TCL_VTX_ATTR_4I_0__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4I_0_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4I_0_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4I_0_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_4I_0_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4I_1(x) (0x00000704+((x)*8))
+#define NV50TCL_VTX_ATTR_4I_1__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4I_1_Z_SHIFT 0
+#define NV50TCL_VTX_ATTR_4I_1_Z_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4I_1_W_SHIFT 16
+#define NV50TCL_VTX_ATTR_4I_1_W_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4NI_0(x) (0x00000780+((x)*8))
+#define NV50TCL_VTX_ATTR_4NI_0__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4NI_0_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4NI_0_X_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4NI_0_Y_SHIFT 16
+#define NV50TCL_VTX_ATTR_4NI_0_Y_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4NI_1(x) (0x00000784+((x)*8))
+#define NV50TCL_VTX_ATTR_4NI_1__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4NI_1_Z_SHIFT 0
+#define NV50TCL_VTX_ATTR_4NI_1_Z_MASK 0x0000ffff
+#define NV50TCL_VTX_ATTR_4NI_1_W_SHIFT 16
+#define NV50TCL_VTX_ATTR_4NI_1_W_MASK 0xffff0000
+#define NV50TCL_VTX_ATTR_4UB(x) (0x00000800+((x)*4))
+#define NV50TCL_VTX_ATTR_4UB__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4UB_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4UB_X_MASK 0x000000ff
+#define NV50TCL_VTX_ATTR_4UB_Y_SHIFT 8
+#define NV50TCL_VTX_ATTR_4UB_Y_MASK 0x0000ff00
+#define NV50TCL_VTX_ATTR_4UB_Z_SHIFT 16
+#define NV50TCL_VTX_ATTR_4UB_Z_MASK 0x00ff0000
+#define NV50TCL_VTX_ATTR_4UB_W_SHIFT 24
+#define NV50TCL_VTX_ATTR_4UB_W_MASK 0xff000000
+#define NV50TCL_VTX_ATTR_4B(x) (0x00000840+((x)*4))
+#define NV50TCL_VTX_ATTR_4B__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4B_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4B_X_MASK 0x000000ff
+#define NV50TCL_VTX_ATTR_4B_Y_SHIFT 8
+#define NV50TCL_VTX_ATTR_4B_Y_MASK 0x0000ff00
+#define NV50TCL_VTX_ATTR_4B_Z_SHIFT 16
+#define NV50TCL_VTX_ATTR_4B_Z_MASK 0x00ff0000
+#define NV50TCL_VTX_ATTR_4B_W_SHIFT 24
+#define NV50TCL_VTX_ATTR_4B_W_MASK 0xff000000
+#define NV50TCL_VTX_ATTR_4NUB(x) (0x00000880+((x)*4))
+#define NV50TCL_VTX_ATTR_4NUB__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4NUB_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4NUB_X_MASK 0x000000ff
+#define NV50TCL_VTX_ATTR_4NUB_Y_SHIFT 8
+#define NV50TCL_VTX_ATTR_4NUB_Y_MASK 0x0000ff00
+#define NV50TCL_VTX_ATTR_4NUB_Z_SHIFT 16
+#define NV50TCL_VTX_ATTR_4NUB_Z_MASK 0x00ff0000
+#define NV50TCL_VTX_ATTR_4NUB_W_SHIFT 24
+#define NV50TCL_VTX_ATTR_4NUB_W_MASK 0xff000000
+#define NV50TCL_VTX_ATTR_4NB(x) (0x000008c0+((x)*4))
+#define NV50TCL_VTX_ATTR_4NB__SIZE 0x00000010
+#define NV50TCL_VTX_ATTR_4NB_X_SHIFT 0
+#define NV50TCL_VTX_ATTR_4NB_X_MASK 0x000000ff
+#define NV50TCL_VTX_ATTR_4NB_Y_SHIFT 8
+#define NV50TCL_VTX_ATTR_4NB_Y_MASK 0x0000ff00
+#define NV50TCL_VTX_ATTR_4NB_Z_SHIFT 16
+#define NV50TCL_VTX_ATTR_4NB_Z_MASK 0x00ff0000
+#define NV50TCL_VTX_ATTR_4NB_W_SHIFT 24
+#define NV50TCL_VTX_ATTR_4NB_W_MASK 0xff000000
+#define NV50TCL_VERTEX_ARRAY_FORMAT(x) (0x00000900+((x)*16))
+#define NV50TCL_VERTEX_ARRAY_FORMAT__SIZE 0x00000010
+#define NV50TCL_VERTEX_ARRAY_FORMAT_STRIDE_SHIFT 0
+#define NV50TCL_VERTEX_ARRAY_FORMAT_STRIDE_MASK 0x00000fff
+#define NV50TCL_VERTEX_ARRAY_FORMAT_ENABLE (1 << 29)
+#define NV50TCL_VERTEX_ARRAY_START_HIGH(x) (0x00000904+((x)*16))
+#define NV50TCL_VERTEX_ARRAY_START_HIGH__SIZE 0x00000010
+#define NV50TCL_VERTEX_ARRAY_START_LOW(x) (0x00000908+((x)*16))
+#define NV50TCL_VERTEX_ARRAY_START_LOW__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_SCALE_X(x) (0x00000a00+((x)*32))
+#define NV50TCL_VIEWPORT_SCALE_X__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_SCALE_Y(x) (0x00000a04+((x)*32))
+#define NV50TCL_VIEWPORT_SCALE_Y__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_SCALE_Z(x) (0x00000a08+((x)*32))
+#define NV50TCL_VIEWPORT_SCALE_Z__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_TRANSLATE_X(x) (0x00000a0c+((x)*32))
+#define NV50TCL_VIEWPORT_TRANSLATE_X__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_TRANSLATE_Y(x) (0x00000a10+((x)*32))
+#define NV50TCL_VIEWPORT_TRANSLATE_Y__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_TRANSLATE_Z(x) (0x00000a14+((x)*32))
+#define NV50TCL_VIEWPORT_TRANSLATE_Z__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_HORIZ(x) (0x00000c00+((x)*16))
+#define NV50TCL_VIEWPORT_HORIZ__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_HORIZ_X_SHIFT 0
+#define NV50TCL_VIEWPORT_HORIZ_X_MASK 0x0000ffff
+#define NV50TCL_VIEWPORT_HORIZ_W_SHIFT 16
+#define NV50TCL_VIEWPORT_HORIZ_W_MASK 0xffff0000
+#define NV50TCL_VIEWPORT_VERT(x) (0x00000c04+((x)*16))
+#define NV50TCL_VIEWPORT_VERT__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_VERT_Y_SHIFT 0
+#define NV50TCL_VIEWPORT_VERT_Y_MASK 0x0000ffff
+#define NV50TCL_VIEWPORT_VERT_H_SHIFT 16
+#define NV50TCL_VIEWPORT_VERT_H_MASK 0xffff0000
+#define NV50TCL_DEPTH_RANGE_NEAR(x) (0x00000c08+((x)*16))
+#define NV50TCL_DEPTH_RANGE_NEAR__SIZE 0x00000010
+#define NV50TCL_DEPTH_RANGE_FAR(x) (0x00000c0c+((x)*16))
+#define NV50TCL_DEPTH_RANGE_FAR__SIZE 0x00000010
+#define NV50TCL_VIEWPORT_CLIP_HORIZ(x) (0x00000d00+((x)*8))
+#define NV50TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
+#define NV50TCL_VIEWPORT_CLIP_HORIZ_MIN_SHIFT 0
+#define NV50TCL_VIEWPORT_CLIP_HORIZ_MIN_MASK 0x0000ffff
+#define NV50TCL_VIEWPORT_CLIP_HORIZ_MAX_SHIFT 16
+#define NV50TCL_VIEWPORT_CLIP_HORIZ_MAX_MASK 0xffff0000
+#define NV50TCL_VIEWPORT_CLIP_VERT(x) (0x00000d04+((x)*8))
+#define NV50TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
+#define NV50TCL_VIEWPORT_CLIP_VERT_MIN_SHIFT 0
+#define NV50TCL_VIEWPORT_CLIP_VERT_MIN_MASK 0x0000ffff
+#define NV50TCL_VIEWPORT_CLIP_VERT_MAX_SHIFT 16
+#define NV50TCL_VIEWPORT_CLIP_VERT_MAX_MASK 0xffff0000
+#define NV50TCL_CLIPID_REGION_HORIZ(x) (0x00000d40+((x)*8))
+#define NV50TCL_CLIPID_REGION_HORIZ__SIZE 0x00000004
+#define NV50TCL_CLIPID_REGION_VERT(x) (0x00000d44+((x)*8))
+#define NV50TCL_CLIPID_REGION_VERT__SIZE 0x00000004
+#define NV50TCL_VERTEX_BUFFER_FIRST 0x00000d74
+#define NV50TCL_VERTEX_BUFFER_COUNT 0x00000d78
+#define NV50TCL_CLEAR_COLOR(x) (0x00000d80+((x)*4))
+#define NV50TCL_CLEAR_COLOR__SIZE 0x00000004
+#define NV50TCL_CLEAR_DEPTH 0x00000d90
+#define NV50TCL_STACK_ADDRESS_HIGH 0x00000d94
+#define NV50TCL_STACK_ADDRESS_LOW 0x00000d98
+#define NV50TCL_STACK_SIZE_LOG 0x00000d9c
+#define NV50TCL_CLEAR_STENCIL 0x00000da0
+#define NV50TCL_STRMOUT_PRIMITIVE_COUNT 0x00000da8
+#define NV50TCL_POLYGON_MODE_FRONT 0x00000dac
+#define NV50TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
+#define NV50TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
+#define NV50TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
+#define NV50TCL_POLYGON_MODE_BACK 0x00000db0
+#define NV50TCL_POLYGON_MODE_BACK_POINT 0x00001b00
+#define NV50TCL_POLYGON_MODE_BACK_LINE 0x00001b01
+#define NV50TCL_POLYGON_MODE_BACK_FILL 0x00001b02
+#define NV50TCL_POLYGON_SMOOTH_ENABLE 0x00000db4
+#define NV50TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000dc0
+#define NV50TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000dc4
+#define NV50TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000dc8
+#define NV50TCL_WATCHDOG_TIMER 0x00000de4
+#define NV50TCL_WINDOW_OFFSET_X 0x00000df8
+#define NV50TCL_WINDOW_OFFSET_Y 0x00000dfc
+#define NV50TCL_SCISSOR_ENABLE(x) (0x00000e00+((x)*16))
+#define NV50TCL_SCISSOR_ENABLE__SIZE 0x00000010
+#define NV50TCL_SCISSOR_HORIZ(x) (0x00000e04+((x)*16))
+#define NV50TCL_SCISSOR_HORIZ__SIZE 0x00000010
+#define NV50TCL_SCISSOR_HORIZ_MIN_SHIFT 0
+#define NV50TCL_SCISSOR_HORIZ_MIN_MASK 0x0000ffff
+#define NV50TCL_SCISSOR_HORIZ_MAX_SHIFT 16
+#define NV50TCL_SCISSOR_HORIZ_MAX_MASK 0xffff0000
+#define NV50TCL_SCISSOR_VERT(x) (0x00000e08+((x)*16))
+#define NV50TCL_SCISSOR_VERT__SIZE 0x00000010
+#define NV50TCL_SCISSOR_VERT_MIN_SHIFT 0
+#define NV50TCL_SCISSOR_VERT_MIN_MASK 0x0000ffff
+#define NV50TCL_SCISSOR_VERT_MAX_SHIFT 16
+#define NV50TCL_SCISSOR_VERT_MAX_MASK 0xffff0000
+#define NV50TCL_CB_ADDR 0x00000f00
+#define NV50TCL_CB_ADDR_ID_SHIFT 8
+#define NV50TCL_CB_ADDR_ID_MASK 0x003fff00
+#define NV50TCL_CB_ADDR_BUFFER_SHIFT 0
+#define NV50TCL_CB_ADDR_BUFFER_MASK 0x0000007f
+#define NV50TCL_CB_DATA(x) (0x00000f04+((x)*4))
+#define NV50TCL_CB_DATA__SIZE 0x00000010
+#define NV50TCL_LOCAL_WARPS_LOG_ALLOC 0x00000f44
+#define NV50TCL_LOCAL_WARPS_NO_CLAMP 0x00000f48
+#define NV50TCL_STACK_WARPS_LOG_ALLOC 0x00000f4c
+#define NV50TCL_STACK_WARPS_NO_CLAMP 0x00000f50
+#define NV50TCL_STENCIL_BACK_FUNC_REF 0x00000f54
+#define NV50TCL_STENCIL_BACK_MASK 0x00000f58
+#define NV50TCL_STENCIL_BACK_FUNC_MASK 0x00000f5c
+#define NV50TCL_GP_ADDRESS_HIGH 0x00000f70
+#define NV50TCL_GP_ADDRESS_LOW 0x00000f74
+#define NV50TCL_VP_ADDRESS_HIGH 0x00000f7c
+#define NV50TCL_VP_ADDRESS_LOW 0x00000f80
+#define NV50TCL_VERTEX_RUNOUT_HIGH 0x00000f84
+#define NV50TCL_VERTEX_RUNOUT_LOW 0x00000f88
+#define NV50TCL_DEPTH_BOUNDS(x) (0x00000f9c+((x)*4))
+#define NV50TCL_DEPTH_BOUNDS__SIZE 0x00000002
+#define NV50TCL_FP_ADDRESS_HIGH 0x00000fa4
+#define NV50TCL_FP_ADDRESS_LOW 0x00000fa8
+#define NV50TCL_MSAA_MASK(x) (0x00000fbc+((x)*4))
+#define NV50TCL_MSAA_MASK__SIZE 0x00000004
+#define NV50TCL_CLIPID_ADDRESS_HIGH 0x00000fcc
+#define NV50TCL_CLIPID_ADDRESS_LOW 0x00000fd0
+#define NV50TCL_ZETA_ADDRESS_HIGH 0x00000fe0
+#define NV50TCL_ZETA_ADDRESS_LOW 0x00000fe4
+#define NV50TCL_ZETA_FORMAT 0x00000fe8
+#define NV50TCL_ZETA_FORMAT_Z32_FLOAT 0x0000000a
+#define NV50TCL_ZETA_FORMAT_Z16_UNORM 0x00000013
+#define NV50TCL_ZETA_FORMAT_Z24S8_UNORM 0x00000014
+#define NV50TCL_ZETA_FORMAT_X8Z24_UNORM 0x00000015
+#define NV50TCL_ZETA_FORMAT_S8Z24_UNORM 0x00000016
+#define NV50TCL_ZETA_FORMAT_Z32_FLOAT_X24S8_UNORM 0x00000019
+#define NV50TCL_ZETA_TILE_MODE 0x00000fec
+#define NV50TCL_ZETA_LAYER_STRIDE 0x00000ff0
+#define NV50TCL_SCREEN_SCISSOR_HORIZ 0x00000ff4
+#define NV50TCL_SCREEN_SCISSOR_HORIZ_W_SHIFT 16
+#define NV50TCL_SCREEN_SCISSOR_HORIZ_W_MASK 0xffff0000
+#define NV50TCL_SCREEN_SCISSOR_HORIZ_X_SHIFT 0
+#define NV50TCL_SCREEN_SCISSOR_HORIZ_X_MASK 0x0000ffff
+#define NV50TCL_SCREEN_SCISSOR_VERT 0x00000ff8
+#define NV50TCL_SCREEN_SCISSOR_VERT_H_SHIFT 16
+#define NV50TCL_SCREEN_SCISSOR_VERT_H_MASK 0xffff0000
+#define NV50TCL_SCREEN_SCISSOR_VERT_Y_SHIFT 0
+#define NV50TCL_SCREEN_SCISSOR_VERT_Y_MASK 0x0000ffff
+#define NV50TCL_VERTEX_ARRAY_LIMIT_HIGH(x) (0x00001080+((x)*8))
+#define NV50TCL_VERTEX_ARRAY_LIMIT_HIGH__SIZE 0x00000010
+#define NV50TCL_VERTEX_ARRAY_LIMIT_LOW(x) (0x00001084+((x)*8))
+#define NV50TCL_VERTEX_ARRAY_LIMIT_LOW__SIZE 0x00000010
+#define NV50TCL_RT_CONTROL 0x0000121c
+#define NV50TCL_RT_CONTROL_COUNT_SHIFT 0
+#define NV50TCL_RT_CONTROL_COUNT_MASK 0x0000000f
+#define NV50TCL_RT_CONTROL_MAP0_SHIFT 4
+#define NV50TCL_RT_CONTROL_MAP0_MASK 0x00000070
+#define NV50TCL_RT_CONTROL_MAP1_SHIFT 7
+#define NV50TCL_RT_CONTROL_MAP1_MASK 0x00000380
+#define NV50TCL_RT_CONTROL_MAP2_SHIFT 10
+#define NV50TCL_RT_CONTROL_MAP2_MASK 0x00001c00
+#define NV50TCL_RT_CONTROL_MAP3_SHIFT 13
+#define NV50TCL_RT_CONTROL_MAP3_MASK 0x0000e000
+#define NV50TCL_RT_CONTROL_MAP4_SHIFT 16
+#define NV50TCL_RT_CONTROL_MAP4_MASK 0x00070000
+#define NV50TCL_RT_CONTROL_MAP5_SHIFT 19
+#define NV50TCL_RT_CONTROL_MAP5_MASK 0x00380000
+#define NV50TCL_RT_CONTROL_MAP6_SHIFT 22
+#define NV50TCL_RT_CONTROL_MAP6_MASK 0x01c00000
+#define NV50TCL_RT_CONTROL_MAP7_SHIFT 25
+#define NV50TCL_RT_CONTROL_MAP7_MASK 0x0e000000
+#define NV50TCL_RT_ARRAY_MODE 0x00001224
+#define NV50TCL_RT_ARRAY_MODE_LAYERS_SHIFT 0
+#define NV50TCL_RT_ARRAY_MODE_LAYERS_MASK 0x0000ffff
+#define NV50TCL_RT_ARRAY_MODE_VOLUME (1 << 16)
+#define NV50TCL_ZETA_HORIZ 0x00001228
+#define NV50TCL_ZETA_VERT 0x0000122c
+#define NV50TCL_ZETA_ARRAY_MODE 0x00001230
+#define NV50TCL_ZETA_ARRAY_MODE_LAYERS_SHIFT 0
+#define NV50TCL_ZETA_ARRAY_MODE_LAYERS_MASK 0x0000ffff
+#define NV50TCL_ZETA_ARRAY_MODE_UNK (1 << 16)
+#define NV50TCL_LINKED_TSC 0x00001234
+#define NV50TCL_RT_HORIZ(x) (0x00001240+((x)*8))
+#define NV50TCL_RT_HORIZ__SIZE 0x00000008
+#define NV50TCL_RT_VERT(x) (0x00001244+((x)*8))
+#define NV50TCL_RT_VERT__SIZE 0x00000008
+#define NV50TCL_CB_DEF_ADDRESS_HIGH 0x00001280
+#define NV50TCL_CB_DEF_ADDRESS_LOW 0x00001284
+#define NV50TCL_CB_DEF_SET 0x00001288
+#define NV50TCL_CB_DEF_SET_SIZE_SHIFT 0
+#define NV50TCL_CB_DEF_SET_SIZE_MASK 0x0000ffff
+#define NV50TCL_CB_DEF_SET_BUFFER_SHIFT 16
+#define NV50TCL_CB_DEF_SET_BUFFER_MASK 0x007f0000
+#define NV50TCL_STRMOUT_BUFFERS_CTRL 0x00001294
+#define NV50TCL_STRMOUT_BUFFERS_CTRL_INTERLEAVED (1 << 0)
+#define NV50TCL_STRMOUT_BUFFERS_CTRL_SEPARATE_SHIFT 4
+#define NV50TCL_STRMOUT_BUFFERS_CTRL_SEPARATE_MASK 0x000000f0
+#define NV50TCL_STRMOUT_BUFFERS_CTRL_STRIDE_SHIFT 8
+#define NV50TCL_STRMOUT_BUFFERS_CTRL_STRIDE_MASK 0x0000ff00
+#define NV50TCL_FP_RESULT_COUNT 0x00001298
+#define NV50TCL_DEPTH_TEST_ENABLE 0x000012cc
+#define NV50TCL_SHADE_MODEL 0x000012d4
+#define NV50TCL_SHADE_MODEL_FLAT 0x00001d00
+#define NV50TCL_SHADE_MODEL_SMOOTH 0x00001d01
+#define NV50TCL_LOCAL_ADDRESS_HIGH 0x000012d8
+#define NV50TCL_LOCAL_ADDRESS_LOW 0x000012dc
+#define NV50TCL_LOCAL_SIZE_LOG 0x000012e0
+#define NV50TCL_DEPTH_WRITE_ENABLE 0x000012e8
+#define NV50TCL_ALPHA_TEST_ENABLE 0x000012ec
+#define NV50TCL_PM_SET(x) (0x000012f0+((x)*4))
+#define NV50TCL_PM_SET__SIZE 0x00000004
+#define NV50TCL_VB_ELEMENT_U8_SETUP 0x00001300
+#define NV50TCL_VB_ELEMENT_U8_SETUP_OFFSET_SHIFT 30
+#define NV50TCL_VB_ELEMENT_U8_SETUP_OFFSET_MASK 0xc0000000
+#define NV50TCL_VB_ELEMENT_U8_SETUP_COUNT_SHIFT 0
+#define NV50TCL_VB_ELEMENT_U8_SETUP_COUNT_MASK 0x3fffffff
+#define NV50TCL_VB_ELEMENT_U8 0x00001304
+#define NV50TCL_VB_ELEMENT_U8_I0_SHIFT 0
+#define NV50TCL_VB_ELEMENT_U8_I0_MASK 0x000000ff
+#define NV50TCL_VB_ELEMENT_U8_I1_SHIFT 8
+#define NV50TCL_VB_ELEMENT_U8_I1_MASK 0x0000ff00
+#define NV50TCL_VB_ELEMENT_U8_I2_SHIFT 16
+#define NV50TCL_VB_ELEMENT_U8_I2_MASK 0x00ff0000
+#define NV50TCL_VB_ELEMENT_U8_I3_SHIFT 24
+#define NV50TCL_VB_ELEMENT_U8_I3_MASK 0xff000000
+#define NV50TCL_DEPTH_TEST_FUNC 0x0000130c
+#define NV50TCL_DEPTH_TEST_FUNC_NEVER 0x00000200
+#define NV50TCL_DEPTH_TEST_FUNC_LESS 0x00000201
+#define NV50TCL_DEPTH_TEST_FUNC_EQUAL 0x00000202
+#define NV50TCL_DEPTH_TEST_FUNC_LEQUAL 0x00000203
+#define NV50TCL_DEPTH_TEST_FUNC_GREATER 0x00000204
+#define NV50TCL_DEPTH_TEST_FUNC_NOTEQUAL 0x00000205
+#define NV50TCL_DEPTH_TEST_FUNC_GEQUAL 0x00000206
+#define NV50TCL_DEPTH_TEST_FUNC_ALWAYS 0x00000207
+#define NV50TCL_ALPHA_TEST_REF 0x00001310
+#define NV50TCL_ALPHA_TEST_FUNC 0x00001314
+#define NV50TCL_ALPHA_TEST_FUNC_NEVER 0x00000200
+#define NV50TCL_ALPHA_TEST_FUNC_LESS 0x00000201
+#define NV50TCL_ALPHA_TEST_FUNC_EQUAL 0x00000202
+#define NV50TCL_ALPHA_TEST_FUNC_LEQUAL 0x00000203
+#define NV50TCL_ALPHA_TEST_FUNC_GREATER 0x00000204
+#define NV50TCL_ALPHA_TEST_FUNC_NOTEQUAL 0x00000205
+#define NV50TCL_ALPHA_TEST_FUNC_GEQUAL 0x00000206
+#define NV50TCL_ALPHA_TEST_FUNC_ALWAYS 0x00000207
+#define NV50TCL_BLEND_COLOR(x) (0x0000131c+((x)*4))
+#define NV50TCL_BLEND_COLOR__SIZE 0x00000004
+#define NV50TCL_TIC_FLUSH 0x00001330
+#define NV50TCL_TSC_FLUSH 0x00001334
+#define NV50TCL_TEX_CACHE_CTL 0x00001338
+#define NV50TCL_BLEND_EQUATION_RGB 0x00001340
+#define NV50TCL_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
+#define NV50TCL_BLEND_EQUATION_RGB_MIN 0x00008007
+#define NV50TCL_BLEND_EQUATION_RGB_MAX 0x00008008
+#define NV50TCL_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
+#define NV50TCL_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
+#define NV50TCL_BLEND_FUNC_SRC_RGB 0x00001344
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ZERO 0x00004000
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE 0x00004001
+#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00004300
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00004301
+#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00004302
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
+#define NV50TCL_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00004304
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00004305
+#define NV50TCL_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00004306
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00004307
+#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00004308
+#define NV50TCL_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x0000c001
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
+#define NV50TCL_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x0000c003
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
+#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC1_COLOR 0x0000c900
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
+#define NV50TCL_BLEND_FUNC_SRC_RGB_SRC1_ALPHA 0x0000c902
+#define NV50TCL_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
+#define NV50TCL_BLEND_FUNC_DST_RGB 0x00001348
+#define NV50TCL_BLEND_FUNC_DST_RGB_ZERO 0x00004000
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE 0x00004001
+#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00004300
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00004301
+#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00004302
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00004303
+#define NV50TCL_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00004304
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00004305
+#define NV50TCL_BLEND_FUNC_DST_RGB_DST_COLOR 0x00004306
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00004307
+#define NV50TCL_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00004308
+#define NV50TCL_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x0000c001
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x0000c002
+#define NV50TCL_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x0000c003
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
+#define NV50TCL_BLEND_FUNC_DST_RGB_SRC1_COLOR 0x0000c900
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_COLOR 0x0000c901
+#define NV50TCL_BLEND_FUNC_DST_RGB_SRC1_ALPHA 0x0000c902
+#define NV50TCL_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC1_ALPHA 0x0000c903
+#define NV50TCL_BLEND_EQUATION_ALPHA 0x0000134c
+#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_ADD 0x00008006
+#define NV50TCL_BLEND_EQUATION_ALPHA_MIN 0x00008007
+#define NV50TCL_BLEND_EQUATION_ALPHA_MAX 0x00008008
+#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x0000800a
+#define NV50TCL_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x0000800b
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA 0x00001350
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ZERO 0x00004000
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE 0x00004001
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x00004300
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x00004302
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x00004304
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x00004306
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x00004308
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x0000c001
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x0000c003
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC1_COLOR 0x0000c900
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_SRC1_ALPHA 0x0000c902
+#define NV50TCL_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
+#define NV50TCL_BLEND_FUNC_DST_ALPHA 0x00001358
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ZERO 0x00004000
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE 0x00004001
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x00004300
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x00004301
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x00004302
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x00004303
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x00004304
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x00004305
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x00004306
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x00004307
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x00004308
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x0000c001
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x0000c002
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x0000c003
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x0000c004
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC1_COLOR 0x0000c900
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_COLOR 0x0000c901
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_SRC1_ALPHA 0x0000c902
+#define NV50TCL_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC1_ALPHA 0x0000c903
+#define NV50TCL_BLEND_ENABLE(x) (0x00001360+((x)*4))
+#define NV50TCL_BLEND_ENABLE__SIZE 0x00000008
+#define NV50TCL_STENCIL_FRONT_ENABLE 0x00001380
+#define NV50TCL_STENCIL_FRONT_OP_FAIL 0x00001384
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_ZERO 0x00000000
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_INVERT 0x0000150a
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_KEEP 0x00001e00
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_INCR 0x00001e02
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_DECR 0x00001e03
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_FRONT_OP_FAIL_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL 0x00001388
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_ZERO 0x00000000
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INVERT 0x0000150a
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_KEEP 0x00001e00
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INCR 0x00001e02
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_DECR 0x00001e03
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_FRONT_OP_ZFAIL_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS 0x0000138c
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_ZERO 0x00000000
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INVERT 0x0000150a
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_KEEP 0x00001e00
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INCR 0x00001e02
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_DECR 0x00001e03
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_FRONT_OP_ZPASS_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC 0x00001390
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_NEVER 0x00000200
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_LESS 0x00000201
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_EQUAL 0x00000202
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_LEQUAL 0x00000203
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_GREATER 0x00000204
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_GEQUAL 0x00000206
+#define NV50TCL_STENCIL_FRONT_FUNC_FUNC_ALWAYS 0x00000207
+#define NV50TCL_STENCIL_FRONT_FUNC_REF 0x00001394
+#define NV50TCL_STENCIL_FRONT_MASK 0x00001398
+#define NV50TCL_STENCIL_FRONT_FUNC_MASK 0x0000139c
+#define NV50TCL_FRAG_COLOR_CLAMP_EN 0x000013a8
+#define NV50TCL_Y_ORIGIN_BOTTOM 0x000013ac
+#define NV50TCL_LINE_WIDTH 0x000013b0
+#define NV50TCL_TEX_LIMITS(x) (0x000013b4+((x)*4))
+#define NV50TCL_TEX_LIMITS__SIZE 0x00000003
+#define NV50TCL_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
+#define NV50TCL_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
+#define NV50TCL_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
+#define NV50TCL_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
+#define NV50TCL_POINT_COORD_REPLACE_MAP(x) (0x000013c0+((x)*4))
+#define NV50TCL_POINT_COORD_REPLACE_MAP__SIZE 0x00000008
+#define NV50TCL_VP_START_ID 0x0000140c
+#define NV50TCL_GP_START_ID 0x00001410
+#define NV50TCL_FP_START_ID 0x00001414
+#define NV50TCL_GP_VERTEX_OUTPUT_COUNT 0x00001420
+#define NV50TCL_VB_ELEMENT_BASE 0x00001434
+#define NV50TCL_INSTANCE_BASE 0x00001438
+#define NV50TCL_CODE_CB_FLUSH 0x00001440
+#define NV50TCL_BIND_TSC(x) (0x00001444+((x)*8))
+#define NV50TCL_BIND_TSC__SIZE 0x00000003
+#define NV50TCL_BIND_TSC_VALID (1 << 0)
+#define NV50TCL_BIND_TSC_SAMPLER_SHIFT 4
+#define NV50TCL_BIND_TSC_SAMPLER_MASK 0x000000f0
+#define NV50TCL_BIND_TSC_TSC_SHIFT 12
+#define NV50TCL_BIND_TSC_TSC_MASK 0x001ff000
+#define NV50TCL_BIND_TIC(x) (0x00001448+((x)*8))
+#define NV50TCL_BIND_TIC__SIZE 0x00000003
+#define NV50TCL_BIND_TIC_VALID (1 << 0)
+#define NV50TCL_BIND_TIC_TEXTURE_SHIFT 1
+#define NV50TCL_BIND_TIC_TEXTURE_MASK 0x000001fe
+#define NV50TCL_BIND_TIC_TIC_SHIFT 9
+#define NV50TCL_BIND_TIC_TIC_MASK 0x7ffffe00
+#define NV50TCL_STRMOUT_MAP(x) (0x00001480+((x)*4))
+#define NV50TCL_STRMOUT_MAP__SIZE 0x00000020
+#define NV50TCL_CLIPID_HEIGHT 0x00001504
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE 0x00001510
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_0 (1 << 0)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_1 (1 << 1)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_2 (1 << 2)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_3 (1 << 3)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_4 (1 << 4)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_5 (1 << 5)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_6 (1 << 6)
+#define NV50TCL_VP_CLIP_DISTANCE_ENABLE_7 (1 << 7)
+#define NV50TCL_SAMPLECNT_ENABLE 0x00001514
+#define NV50TCL_POINT_SIZE 0x00001518
+#define NV50TCL_POINT_SPRITE_ENABLE 0x00001520
+#define NV50TCL_SAMPLECNT_RESET 0x00001530
+#define NV50TCL_ZETA_ENABLE 0x00001538
+#define NV50TCL_MULTISAMPLE_CTRL 0x0000153c
+#define NV50TCL_MULTISAMPLE_CTRL_ALPHA_TO_COVERAGE (1 << 0)
+#define NV50TCL_MULTISAMPLE_CTRL_ALPHA_TO_ONE (1 << 4)
+#define NV50TCL_NOPERSPECTIVE_BITMAP(x) (0x00001540+((x)*4))
+#define NV50TCL_NOPERSPECTIVE_BITMAP__SIZE 0x00000004
+#define NV50TCL_COND_ADDRESS_HIGH 0x00001550
+#define NV50TCL_COND_ADDRESS_LOW 0x00001554
+#define NV50TCL_COND_MODE 0x00001558
+#define NV50TCL_COND_MODE_NEVER 0x00000000
+#define NV50TCL_COND_MODE_ALWAYS 0x00000001
+#define NV50TCL_COND_MODE_RES 0x00000002
+#define NV50TCL_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
+#define NV50TCL_COND_MODE_RES_OR_ID 0x00000004
+#define NV50TCL_TSC_ADDRESS_HIGH 0x0000155c
+#define NV50TCL_TSC_ADDRESS_LOW 0x00001560
+#define NV50TCL_TSC_LIMIT 0x00001564
+#define NV50TCL_POLYGON_OFFSET_FACTOR 0x0000156c
+#define NV50TCL_LINE_SMOOTH_ENABLE 0x00001570
+#define NV50TCL_TIC_ADDRESS_HIGH 0x00001574
+#define NV50TCL_TIC_ADDRESS_LOW 0x00001578
+#define NV50TCL_TIC_LIMIT 0x0000157c
+#define NV50TCL_PM_CONTROL(x) (0x00001580+((x)*4))
+#define NV50TCL_PM_CONTROL__SIZE 0x00000004
+#define NV50TCL_PM_CONTROL_UNK0 (1 << 0)
+#define NV50TCL_PM_CONTROL_UNK1_SHIFT 4
+#define NV50TCL_PM_CONTROL_UNK1_MASK 0x00000070
+#define NV50TCL_PM_CONTROL_UNK2_SHIFT 8
+#define NV50TCL_PM_CONTROL_UNK2_MASK 0xffffff00
+#define NV50TCL_STENCIL_BACK_ENABLE 0x00001594
+#define NV50TCL_STENCIL_BACK_OP_FAIL 0x00001598
+#define NV50TCL_STENCIL_BACK_OP_FAIL_ZERO 0x00000000
+#define NV50TCL_STENCIL_BACK_OP_FAIL_INVERT 0x0000150a
+#define NV50TCL_STENCIL_BACK_OP_FAIL_KEEP 0x00001e00
+#define NV50TCL_STENCIL_BACK_OP_FAIL_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_BACK_OP_FAIL_INCR 0x00001e02
+#define NV50TCL_STENCIL_BACK_OP_FAIL_DECR 0x00001e03
+#define NV50TCL_STENCIL_BACK_OP_FAIL_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_BACK_OP_FAIL_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL 0x0000159c
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_ZERO 0x00000000
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INVERT 0x0000150a
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_KEEP 0x00001e00
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INCR 0x00001e02
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_DECR 0x00001e03
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_BACK_OP_ZFAIL_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_BACK_OP_ZPASS 0x000015a0
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_ZERO 0x00000000
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_INVERT 0x0000150a
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_KEEP 0x00001e00
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_REPLACE 0x00001e01
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_INCR 0x00001e02
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_DECR 0x00001e03
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_INCR_WRAP 0x00008507
+#define NV50TCL_STENCIL_BACK_OP_ZPASS_DECR_WRAP 0x00008508
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC 0x000015a4
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_NEVER 0x00000200
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_LESS 0x00000201
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_EQUAL 0x00000202
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_LEQUAL 0x00000203
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_GREATER 0x00000204
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_GEQUAL 0x00000206
+#define NV50TCL_STENCIL_BACK_FUNC_FUNC_ALWAYS 0x00000207
+#define NV50TCL_FRAMEBUFFER_SRGB 0x000015b8
+#define NV50TCL_POLYGON_OFFSET_UNITS 0x000015bc
+#define NV50TCL_GP_BUILTIN_RESULT_EN 0x000015cc
+#define NV50TCL_GP_BUILTIN_RESULT_EN_VPORT_IDX (1 << 0)
+#define NV50TCL_GP_BUILTIN_RESULT_EN_LAYER_IDX (1 << 16)
+#define NV50TCL_MULTISAMPLE_MODE 0x000015d0
+#define NV50TCL_MULTISAMPLE_MODE_1X 0x00000000
+#define NV50TCL_MULTISAMPLE_MODE_2XMS 0x00000001
+#define NV50TCL_MULTISAMPLE_MODE_4XMS 0x00000002
+#define NV50TCL_MULTISAMPLE_MODE_8XMS 0x00000004
+#define NV50TCL_MULTISAMPLE_MODE_4XMS_4XCS 0x00000008
+#define NV50TCL_MULTISAMPLE_MODE_4XMS_12XCS 0x00000009
+#define NV50TCL_MULTISAMPLE_MODE_8XMS_8XCS 0x0000000a
+#define NV50TCL_VERTEX_BEGIN 0x000015dc
+#define NV50TCL_VERTEX_BEGIN_POINTS 0x00000000
+#define NV50TCL_VERTEX_BEGIN_LINES 0x00000001
+#define NV50TCL_VERTEX_BEGIN_LINE_LOOP 0x00000002
+#define NV50TCL_VERTEX_BEGIN_LINE_STRIP 0x00000003
+#define NV50TCL_VERTEX_BEGIN_TRIANGLES 0x00000004
+#define NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP 0x00000005
+#define NV50TCL_VERTEX_BEGIN_TRIANGLE_FAN 0x00000006
+#define NV50TCL_VERTEX_BEGIN_QUADS 0x00000007
+#define NV50TCL_VERTEX_BEGIN_QUAD_STRIP 0x00000008
+#define NV50TCL_VERTEX_BEGIN_POLYGON 0x00000009
+#define NV50TCL_VERTEX_BEGIN_LINES_ADJACENCY 0x0000000a
+#define NV50TCL_VERTEX_BEGIN_LINE_STRIP_ADJACENCY 0x0000000b
+#define NV50TCL_VERTEX_BEGIN_TRIANGLES_ADJACENCY 0x0000000c
+#define NV50TCL_VERTEX_BEGIN_TRIANGLE_STRIP_ADJACENCY 0x0000000d
+#define NV50TCL_VERTEX_BEGIN_PATCHES 0x0000000e
+#define NV50TCL_VERTEX_END 0x000015e0
+#define NV50TCL_EDGEFLAG_ENABLE 0x000015e4
+#define NV50TCL_VB_ELEMENT_U32 0x000015e8
+#define NV50TCL_VB_ELEMENT_U16_SETUP 0x000015ec
+#define NV50TCL_VB_ELEMENT_U16_SETUP_OFFSET_SHIFT 30
+#define NV50TCL_VB_ELEMENT_U16_SETUP_OFFSET_MASK 0xc0000000
+#define NV50TCL_VB_ELEMENT_U16_SETUP_COUNT_SHIFT 0
+#define NV50TCL_VB_ELEMENT_U16_SETUP_COUNT_MASK 0x3fffffff
+#define NV50TCL_VB_ELEMENT_U16 0x000015f0
+#define NV50TCL_VB_ELEMENT_U16_I0_SHIFT 0
+#define NV50TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
+#define NV50TCL_VB_ELEMENT_U16_I1_SHIFT 16
+#define NV50TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
+#define NV50TCL_VERTEX_BASE_HIGH 0x000015f4
+#define NV50TCL_VERTEX_BASE_LOW 0x000015f8
+#define NV50TCL_VERTEX_DATA 0x00001640
+#define NV50TCL_PRIM_RESTART_ENABLE 0x00001644
+#define NV50TCL_PRIM_RESTART_INDEX 0x00001648
+#define NV50TCL_VP_GP_BUILTIN_ATTR_EN 0x0000164c
+#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_VERTEX_ID (1 << 0)
+#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_INSTANCE_ID (1 << 4)
+#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_PRIMITIVE_ID (1 << 8)
+#define NV50TCL_VP_GP_BUILTIN_ATTR_EN_UNK12 (1 << 12)
+#define NV50TCL_VP_ATTR_EN_0 0x00001650
+#define NV50TCL_VP_ATTR_EN_0_7_SHIFT 28
+#define NV50TCL_VP_ATTR_EN_0_7_MASK 0xf0000000
+#define NV50TCL_VP_ATTR_EN_0_7_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_7_XNNN 0x10000000
+#define NV50TCL_VP_ATTR_EN_0_7_NYNN 0x20000000
+#define NV50TCL_VP_ATTR_EN_0_7_XYNN 0x30000000
+#define NV50TCL_VP_ATTR_EN_0_7_NNZN 0x40000000
+#define NV50TCL_VP_ATTR_EN_0_7_XNZN 0x50000000
+#define NV50TCL_VP_ATTR_EN_0_7_NYZN 0x60000000
+#define NV50TCL_VP_ATTR_EN_0_7_XYZN 0x70000000
+#define NV50TCL_VP_ATTR_EN_0_7_NNNW 0x80000000
+#define NV50TCL_VP_ATTR_EN_0_7_XNNW 0x90000000
+#define NV50TCL_VP_ATTR_EN_0_7_NYNW 0xa0000000
+#define NV50TCL_VP_ATTR_EN_0_7_XYNW 0xb0000000
+#define NV50TCL_VP_ATTR_EN_0_7_NNZW 0xc0000000
+#define NV50TCL_VP_ATTR_EN_0_7_XNZW 0xd0000000
+#define NV50TCL_VP_ATTR_EN_0_7_NYZW 0xe0000000
+#define NV50TCL_VP_ATTR_EN_0_7_XYZW 0xf0000000
+#define NV50TCL_VP_ATTR_EN_0_6_SHIFT 24
+#define NV50TCL_VP_ATTR_EN_0_6_MASK 0x0f000000
+#define NV50TCL_VP_ATTR_EN_0_6_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_6_XNNN 0x01000000
+#define NV50TCL_VP_ATTR_EN_0_6_NYNN 0x02000000
+#define NV50TCL_VP_ATTR_EN_0_6_XYNN 0x03000000
+#define NV50TCL_VP_ATTR_EN_0_6_NNZN 0x04000000
+#define NV50TCL_VP_ATTR_EN_0_6_XNZN 0x05000000
+#define NV50TCL_VP_ATTR_EN_0_6_NYZN 0x06000000
+#define NV50TCL_VP_ATTR_EN_0_6_XYZN 0x07000000
+#define NV50TCL_VP_ATTR_EN_0_6_NNNW 0x08000000
+#define NV50TCL_VP_ATTR_EN_0_6_XNNW 0x09000000
+#define NV50TCL_VP_ATTR_EN_0_6_NYNW 0x0a000000
+#define NV50TCL_VP_ATTR_EN_0_6_XYNW 0x0b000000
+#define NV50TCL_VP_ATTR_EN_0_6_NNZW 0x0c000000
+#define NV50TCL_VP_ATTR_EN_0_6_XNZW 0x0d000000
+#define NV50TCL_VP_ATTR_EN_0_6_NYZW 0x0e000000
+#define NV50TCL_VP_ATTR_EN_0_6_XYZW 0x0f000000
+#define NV50TCL_VP_ATTR_EN_0_5_SHIFT 20
+#define NV50TCL_VP_ATTR_EN_0_5_MASK 0x00f00000
+#define NV50TCL_VP_ATTR_EN_0_5_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_5_XNNN 0x00100000
+#define NV50TCL_VP_ATTR_EN_0_5_NYNN 0x00200000
+#define NV50TCL_VP_ATTR_EN_0_5_XYNN 0x00300000
+#define NV50TCL_VP_ATTR_EN_0_5_NNZN 0x00400000
+#define NV50TCL_VP_ATTR_EN_0_5_XNZN 0x00500000
+#define NV50TCL_VP_ATTR_EN_0_5_NYZN 0x00600000
+#define NV50TCL_VP_ATTR_EN_0_5_XYZN 0x00700000
+#define NV50TCL_VP_ATTR_EN_0_5_NNNW 0x00800000
+#define NV50TCL_VP_ATTR_EN_0_5_XNNW 0x00900000
+#define NV50TCL_VP_ATTR_EN_0_5_NYNW 0x00a00000
+#define NV50TCL_VP_ATTR_EN_0_5_XYNW 0x00b00000
+#define NV50TCL_VP_ATTR_EN_0_5_NNZW 0x00c00000
+#define NV50TCL_VP_ATTR_EN_0_5_XNZW 0x00d00000
+#define NV50TCL_VP_ATTR_EN_0_5_NYZW 0x00e00000
+#define NV50TCL_VP_ATTR_EN_0_5_XYZW 0x00f00000
+#define NV50TCL_VP_ATTR_EN_0_4_SHIFT 16
+#define NV50TCL_VP_ATTR_EN_0_4_MASK 0x000f0000
+#define NV50TCL_VP_ATTR_EN_0_4_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_4_XNNN 0x00010000
+#define NV50TCL_VP_ATTR_EN_0_4_NYNN 0x00020000
+#define NV50TCL_VP_ATTR_EN_0_4_XYNN 0x00030000
+#define NV50TCL_VP_ATTR_EN_0_4_NNZN 0x00040000
+#define NV50TCL_VP_ATTR_EN_0_4_XNZN 0x00050000
+#define NV50TCL_VP_ATTR_EN_0_4_NYZN 0x00060000
+#define NV50TCL_VP_ATTR_EN_0_4_XYZN 0x00070000
+#define NV50TCL_VP_ATTR_EN_0_4_NNNW 0x00080000
+#define NV50TCL_VP_ATTR_EN_0_4_XNNW 0x00090000
+#define NV50TCL_VP_ATTR_EN_0_4_NYNW 0x000a0000
+#define NV50TCL_VP_ATTR_EN_0_4_XYNW 0x000b0000
+#define NV50TCL_VP_ATTR_EN_0_4_NNZW 0x000c0000
+#define NV50TCL_VP_ATTR_EN_0_4_XNZW 0x000d0000
+#define NV50TCL_VP_ATTR_EN_0_4_NYZW 0x000e0000
+#define NV50TCL_VP_ATTR_EN_0_4_XYZW 0x000f0000
+#define NV50TCL_VP_ATTR_EN_0_3_SHIFT 12
+#define NV50TCL_VP_ATTR_EN_0_3_MASK 0x0000f000
+#define NV50TCL_VP_ATTR_EN_0_3_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_3_XNNN 0x00001000
+#define NV50TCL_VP_ATTR_EN_0_3_NYNN 0x00002000
+#define NV50TCL_VP_ATTR_EN_0_3_XYNN 0x00003000
+#define NV50TCL_VP_ATTR_EN_0_3_NNZN 0x00004000
+#define NV50TCL_VP_ATTR_EN_0_3_XNZN 0x00005000
+#define NV50TCL_VP_ATTR_EN_0_3_NYZN 0x00006000
+#define NV50TCL_VP_ATTR_EN_0_3_XYZN 0x00007000
+#define NV50TCL_VP_ATTR_EN_0_3_NNNW 0x00008000
+#define NV50TCL_VP_ATTR_EN_0_3_XNNW 0x00009000
+#define NV50TCL_VP_ATTR_EN_0_3_NYNW 0x0000a000
+#define NV50TCL_VP_ATTR_EN_0_3_XYNW 0x0000b000
+#define NV50TCL_VP_ATTR_EN_0_3_NNZW 0x0000c000
+#define NV50TCL_VP_ATTR_EN_0_3_XNZW 0x0000d000
+#define NV50TCL_VP_ATTR_EN_0_3_NYZW 0x0000e000
+#define NV50TCL_VP_ATTR_EN_0_3_XYZW 0x0000f000
+#define NV50TCL_VP_ATTR_EN_0_2_SHIFT 8
+#define NV50TCL_VP_ATTR_EN_0_2_MASK 0x00000f00
+#define NV50TCL_VP_ATTR_EN_0_2_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_2_XNNN 0x00000100
+#define NV50TCL_VP_ATTR_EN_0_2_NYNN 0x00000200
+#define NV50TCL_VP_ATTR_EN_0_2_XYNN 0x00000300
+#define NV50TCL_VP_ATTR_EN_0_2_NNZN 0x00000400
+#define NV50TCL_VP_ATTR_EN_0_2_XNZN 0x00000500
+#define NV50TCL_VP_ATTR_EN_0_2_NYZN 0x00000600
+#define NV50TCL_VP_ATTR_EN_0_2_XYZN 0x00000700
+#define NV50TCL_VP_ATTR_EN_0_2_NNNW 0x00000800
+#define NV50TCL_VP_ATTR_EN_0_2_XNNW 0x00000900
+#define NV50TCL_VP_ATTR_EN_0_2_NYNW 0x00000a00
+#define NV50TCL_VP_ATTR_EN_0_2_XYNW 0x00000b00
+#define NV50TCL_VP_ATTR_EN_0_2_NNZW 0x00000c00
+#define NV50TCL_VP_ATTR_EN_0_2_XNZW 0x00000d00
+#define NV50TCL_VP_ATTR_EN_0_2_NYZW 0x00000e00
+#define NV50TCL_VP_ATTR_EN_0_2_XYZW 0x00000f00
+#define NV50TCL_VP_ATTR_EN_0_1_SHIFT 4
+#define NV50TCL_VP_ATTR_EN_0_1_MASK 0x000000f0
+#define NV50TCL_VP_ATTR_EN_0_1_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_1_XNNN 0x00000010
+#define NV50TCL_VP_ATTR_EN_0_1_NYNN 0x00000020
+#define NV50TCL_VP_ATTR_EN_0_1_XYNN 0x00000030
+#define NV50TCL_VP_ATTR_EN_0_1_NNZN 0x00000040
+#define NV50TCL_VP_ATTR_EN_0_1_XNZN 0x00000050
+#define NV50TCL_VP_ATTR_EN_0_1_NYZN 0x00000060
+#define NV50TCL_VP_ATTR_EN_0_1_XYZN 0x00000070
+#define NV50TCL_VP_ATTR_EN_0_1_NNNW 0x00000080
+#define NV50TCL_VP_ATTR_EN_0_1_XNNW 0x00000090
+#define NV50TCL_VP_ATTR_EN_0_1_NYNW 0x000000a0
+#define NV50TCL_VP_ATTR_EN_0_1_XYNW 0x000000b0
+#define NV50TCL_VP_ATTR_EN_0_1_NNZW 0x000000c0
+#define NV50TCL_VP_ATTR_EN_0_1_XNZW 0x000000d0
+#define NV50TCL_VP_ATTR_EN_0_1_NYZW 0x000000e0
+#define NV50TCL_VP_ATTR_EN_0_1_XYZW 0x000000f0
+#define NV50TCL_VP_ATTR_EN_0_0_SHIFT 0
+#define NV50TCL_VP_ATTR_EN_0_0_MASK 0x0000000f
+#define NV50TCL_VP_ATTR_EN_0_0_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_0_0_XNNN 0x00000001
+#define NV50TCL_VP_ATTR_EN_0_0_NYNN 0x00000002
+#define NV50TCL_VP_ATTR_EN_0_0_XYNN 0x00000003
+#define NV50TCL_VP_ATTR_EN_0_0_NNZN 0x00000004
+#define NV50TCL_VP_ATTR_EN_0_0_XNZN 0x00000005
+#define NV50TCL_VP_ATTR_EN_0_0_NYZN 0x00000006
+#define NV50TCL_VP_ATTR_EN_0_0_XYZN 0x00000007
+#define NV50TCL_VP_ATTR_EN_0_0_NNNW 0x00000008
+#define NV50TCL_VP_ATTR_EN_0_0_XNNW 0x00000009
+#define NV50TCL_VP_ATTR_EN_0_0_NYNW 0x0000000a
+#define NV50TCL_VP_ATTR_EN_0_0_XYNW 0x0000000b
+#define NV50TCL_VP_ATTR_EN_0_0_NNZW 0x0000000c
+#define NV50TCL_VP_ATTR_EN_0_0_XNZW 0x0000000d
+#define NV50TCL_VP_ATTR_EN_0_0_NYZW 0x0000000e
+#define NV50TCL_VP_ATTR_EN_0_0_XYZW 0x0000000f
+#define NV50TCL_VP_ATTR_EN_1 0x00001654
+#define NV50TCL_VP_ATTR_EN_1_15_SHIFT 28
+#define NV50TCL_VP_ATTR_EN_1_15_MASK 0xf0000000
+#define NV50TCL_VP_ATTR_EN_1_15_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_15_XNNN 0x10000000
+#define NV50TCL_VP_ATTR_EN_1_15_NYNN 0x20000000
+#define NV50TCL_VP_ATTR_EN_1_15_XYNN 0x30000000
+#define NV50TCL_VP_ATTR_EN_1_15_NNZN 0x40000000
+#define NV50TCL_VP_ATTR_EN_1_15_XNZN 0x50000000
+#define NV50TCL_VP_ATTR_EN_1_15_NYZN 0x60000000
+#define NV50TCL_VP_ATTR_EN_1_15_XYZN 0x70000000
+#define NV50TCL_VP_ATTR_EN_1_15_NNNW 0x80000000
+#define NV50TCL_VP_ATTR_EN_1_15_XNNW 0x90000000
+#define NV50TCL_VP_ATTR_EN_1_15_NYNW 0xa0000000
+#define NV50TCL_VP_ATTR_EN_1_15_XYNW 0xb0000000
+#define NV50TCL_VP_ATTR_EN_1_15_NNZW 0xc0000000
+#define NV50TCL_VP_ATTR_EN_1_15_XNZW 0xd0000000
+#define NV50TCL_VP_ATTR_EN_1_15_NYZW 0xe0000000
+#define NV50TCL_VP_ATTR_EN_1_15_XYZW 0xf0000000
+#define NV50TCL_VP_ATTR_EN_1_14_SHIFT 24
+#define NV50TCL_VP_ATTR_EN_1_14_MASK 0x0f000000
+#define NV50TCL_VP_ATTR_EN_1_14_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_14_XNNN 0x01000000
+#define NV50TCL_VP_ATTR_EN_1_14_NYNN 0x02000000
+#define NV50TCL_VP_ATTR_EN_1_14_XYNN 0x03000000
+#define NV50TCL_VP_ATTR_EN_1_14_NNZN 0x04000000
+#define NV50TCL_VP_ATTR_EN_1_14_XNZN 0x05000000
+#define NV50TCL_VP_ATTR_EN_1_14_NYZN 0x06000000
+#define NV50TCL_VP_ATTR_EN_1_14_XYZN 0x07000000
+#define NV50TCL_VP_ATTR_EN_1_14_NNNW 0x08000000
+#define NV50TCL_VP_ATTR_EN_1_14_XNNW 0x09000000
+#define NV50TCL_VP_ATTR_EN_1_14_NYNW 0x0a000000
+#define NV50TCL_VP_ATTR_EN_1_14_XYNW 0x0b000000
+#define NV50TCL_VP_ATTR_EN_1_14_NNZW 0x0c000000
+#define NV50TCL_VP_ATTR_EN_1_14_XNZW 0x0d000000
+#define NV50TCL_VP_ATTR_EN_1_14_NYZW 0x0e000000
+#define NV50TCL_VP_ATTR_EN_1_14_XYZW 0x0f000000
+#define NV50TCL_VP_ATTR_EN_1_13_SHIFT 20
+#define NV50TCL_VP_ATTR_EN_1_13_MASK 0x00f00000
+#define NV50TCL_VP_ATTR_EN_1_13_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_13_XNNN 0x00100000
+#define NV50TCL_VP_ATTR_EN_1_13_NYNN 0x00200000
+#define NV50TCL_VP_ATTR_EN_1_13_XYNN 0x00300000
+#define NV50TCL_VP_ATTR_EN_1_13_NNZN 0x00400000
+#define NV50TCL_VP_ATTR_EN_1_13_XNZN 0x00500000
+#define NV50TCL_VP_ATTR_EN_1_13_NYZN 0x00600000
+#define NV50TCL_VP_ATTR_EN_1_13_XYZN 0x00700000
+#define NV50TCL_VP_ATTR_EN_1_13_NNNW 0x00800000
+#define NV50TCL_VP_ATTR_EN_1_13_XNNW 0x00900000
+#define NV50TCL_VP_ATTR_EN_1_13_NYNW 0x00a00000
+#define NV50TCL_VP_ATTR_EN_1_13_XYNW 0x00b00000
+#define NV50TCL_VP_ATTR_EN_1_13_NNZW 0x00c00000
+#define NV50TCL_VP_ATTR_EN_1_13_XNZW 0x00d00000
+#define NV50TCL_VP_ATTR_EN_1_13_NYZW 0x00e00000
+#define NV50TCL_VP_ATTR_EN_1_13_XYZW 0x00f00000
+#define NV50TCL_VP_ATTR_EN_1_12_SHIFT 16
+#define NV50TCL_VP_ATTR_EN_1_12_MASK 0x000f0000
+#define NV50TCL_VP_ATTR_EN_1_12_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_12_XNNN 0x00010000
+#define NV50TCL_VP_ATTR_EN_1_12_NYNN 0x00020000
+#define NV50TCL_VP_ATTR_EN_1_12_XYNN 0x00030000
+#define NV50TCL_VP_ATTR_EN_1_12_NNZN 0x00040000
+#define NV50TCL_VP_ATTR_EN_1_12_XNZN 0x00050000
+#define NV50TCL_VP_ATTR_EN_1_12_NYZN 0x00060000
+#define NV50TCL_VP_ATTR_EN_1_12_XYZN 0x00070000
+#define NV50TCL_VP_ATTR_EN_1_12_NNNW 0x00080000
+#define NV50TCL_VP_ATTR_EN_1_12_XNNW 0x00090000
+#define NV50TCL_VP_ATTR_EN_1_12_NYNW 0x000a0000
+#define NV50TCL_VP_ATTR_EN_1_12_XYNW 0x000b0000
+#define NV50TCL_VP_ATTR_EN_1_12_NNZW 0x000c0000
+#define NV50TCL_VP_ATTR_EN_1_12_XNZW 0x000d0000
+#define NV50TCL_VP_ATTR_EN_1_12_NYZW 0x000e0000
+#define NV50TCL_VP_ATTR_EN_1_12_XYZW 0x000f0000
+#define NV50TCL_VP_ATTR_EN_1_11_SHIFT 12
+#define NV50TCL_VP_ATTR_EN_1_11_MASK 0x0000f000
+#define NV50TCL_VP_ATTR_EN_1_11_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_11_XNNN 0x00001000
+#define NV50TCL_VP_ATTR_EN_1_11_NYNN 0x00002000
+#define NV50TCL_VP_ATTR_EN_1_11_XYNN 0x00003000
+#define NV50TCL_VP_ATTR_EN_1_11_NNZN 0x00004000
+#define NV50TCL_VP_ATTR_EN_1_11_XNZN 0x00005000
+#define NV50TCL_VP_ATTR_EN_1_11_NYZN 0x00006000
+#define NV50TCL_VP_ATTR_EN_1_11_XYZN 0x00007000
+#define NV50TCL_VP_ATTR_EN_1_11_NNNW 0x00008000
+#define NV50TCL_VP_ATTR_EN_1_11_XNNW 0x00009000
+#define NV50TCL_VP_ATTR_EN_1_11_NYNW 0x0000a000
+#define NV50TCL_VP_ATTR_EN_1_11_XYNW 0x0000b000
+#define NV50TCL_VP_ATTR_EN_1_11_NNZW 0x0000c000
+#define NV50TCL_VP_ATTR_EN_1_11_XNZW 0x0000d000
+#define NV50TCL_VP_ATTR_EN_1_11_NYZW 0x0000e000
+#define NV50TCL_VP_ATTR_EN_1_11_XYZW 0x0000f000
+#define NV50TCL_VP_ATTR_EN_1_10_SHIFT 8
+#define NV50TCL_VP_ATTR_EN_1_10_MASK 0x00000f00
+#define NV50TCL_VP_ATTR_EN_1_10_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_10_XNNN 0x00000100
+#define NV50TCL_VP_ATTR_EN_1_10_NYNN 0x00000200
+#define NV50TCL_VP_ATTR_EN_1_10_XYNN 0x00000300
+#define NV50TCL_VP_ATTR_EN_1_10_NNZN 0x00000400
+#define NV50TCL_VP_ATTR_EN_1_10_XNZN 0x00000500
+#define NV50TCL_VP_ATTR_EN_1_10_NYZN 0x00000600
+#define NV50TCL_VP_ATTR_EN_1_10_XYZN 0x00000700
+#define NV50TCL_VP_ATTR_EN_1_10_NNNW 0x00000800
+#define NV50TCL_VP_ATTR_EN_1_10_XNNW 0x00000900
+#define NV50TCL_VP_ATTR_EN_1_10_NYNW 0x00000a00
+#define NV50TCL_VP_ATTR_EN_1_10_XYNW 0x00000b00
+#define NV50TCL_VP_ATTR_EN_1_10_NNZW 0x00000c00
+#define NV50TCL_VP_ATTR_EN_1_10_XNZW 0x00000d00
+#define NV50TCL_VP_ATTR_EN_1_10_NYZW 0x00000e00
+#define NV50TCL_VP_ATTR_EN_1_10_XYZW 0x00000f00
+#define NV50TCL_VP_ATTR_EN_1_9_SHIFT 4
+#define NV50TCL_VP_ATTR_EN_1_9_MASK 0x000000f0
+#define NV50TCL_VP_ATTR_EN_1_9_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_9_XNNN 0x00000010
+#define NV50TCL_VP_ATTR_EN_1_9_NYNN 0x00000020
+#define NV50TCL_VP_ATTR_EN_1_9_XYNN 0x00000030
+#define NV50TCL_VP_ATTR_EN_1_9_NNZN 0x00000040
+#define NV50TCL_VP_ATTR_EN_1_9_XNZN 0x00000050
+#define NV50TCL_VP_ATTR_EN_1_9_NYZN 0x00000060
+#define NV50TCL_VP_ATTR_EN_1_9_XYZN 0x00000070
+#define NV50TCL_VP_ATTR_EN_1_9_NNNW 0x00000080
+#define NV50TCL_VP_ATTR_EN_1_9_XNNW 0x00000090
+#define NV50TCL_VP_ATTR_EN_1_9_NYNW 0x000000a0
+#define NV50TCL_VP_ATTR_EN_1_9_XYNW 0x000000b0
+#define NV50TCL_VP_ATTR_EN_1_9_NNZW 0x000000c0
+#define NV50TCL_VP_ATTR_EN_1_9_XNZW 0x000000d0
+#define NV50TCL_VP_ATTR_EN_1_9_NYZW 0x000000e0
+#define NV50TCL_VP_ATTR_EN_1_9_XYZW 0x000000f0
+#define NV50TCL_VP_ATTR_EN_1_8_SHIFT 0
+#define NV50TCL_VP_ATTR_EN_1_8_MASK 0x0000000f
+#define NV50TCL_VP_ATTR_EN_1_8_NONE 0x00000000
+#define NV50TCL_VP_ATTR_EN_1_8_XNNN 0x00000001
+#define NV50TCL_VP_ATTR_EN_1_8_NYNN 0x00000002
+#define NV50TCL_VP_ATTR_EN_1_8_XYNN 0x00000003
+#define NV50TCL_VP_ATTR_EN_1_8_NNZN 0x00000004
+#define NV50TCL_VP_ATTR_EN_1_8_XNZN 0x00000005
+#define NV50TCL_VP_ATTR_EN_1_8_NYZN 0x00000006
+#define NV50TCL_VP_ATTR_EN_1_8_XYZN 0x00000007
+#define NV50TCL_VP_ATTR_EN_1_8_NNNW 0x00000008
+#define NV50TCL_VP_ATTR_EN_1_8_XNNW 0x00000009
+#define NV50TCL_VP_ATTR_EN_1_8_NYNW 0x0000000a
+#define NV50TCL_VP_ATTR_EN_1_8_XYNW 0x0000000b
+#define NV50TCL_VP_ATTR_EN_1_8_NNZW 0x0000000c
+#define NV50TCL_VP_ATTR_EN_1_8_XNZW 0x0000000d
+#define NV50TCL_VP_ATTR_EN_1_8_NYZW 0x0000000e
+#define NV50TCL_VP_ATTR_EN_1_8_XYZW 0x0000000f
+#define NV50TCL_POINT_SPRITE_CTRL 0x00001660
+#define NV50TCL_LINE_STIPPLE_ENABLE 0x0000166c
+#define NV50TCL_LINE_STIPPLE_PATTERN 0x00001680
+#define NV50TCL_PROVOKING_VERTEX_LAST 0x00001684
+#define NV50TCL_VERTEX_TWO_SIDE_ENABLE 0x00001688
+#define NV50TCL_POLYGON_STIPPLE_ENABLE 0x0000168c
+#define NV50TCL_SET_PROGRAM_CB 0x00001694
+#define NV50TCL_SET_PROGRAM_CB_PROGRAM_SHIFT 4
+#define NV50TCL_SET_PROGRAM_CB_PROGRAM_MASK 0x000000f0
+#define NV50TCL_SET_PROGRAM_CB_PROGRAM_VERTEX 0x00000000
+#define NV50TCL_SET_PROGRAM_CB_PROGRAM_GEOMETRY 0x00000020
+#define NV50TCL_SET_PROGRAM_CB_PROGRAM_FRAGMENT 0x00000030
+#define NV50TCL_SET_PROGRAM_CB_INDEX_SHIFT 8
+#define NV50TCL_SET_PROGRAM_CB_INDEX_MASK 0x00000f00
+#define NV50TCL_SET_PROGRAM_CB_BUFFER_SHIFT 12
+#define NV50TCL_SET_PROGRAM_CB_BUFFER_MASK 0x0007f000
+#define NV50TCL_SET_PROGRAM_CB_VALID (1 << 0)
+#define NV50TCL_VP_RESULT_MAP_SIZE 0x000016ac
+#define NV50TCL_VP_REG_ALLOC_TEMP 0x000016b0
+#define NV50TCL_VP_REG_ALLOC_RESULT 0x000016b8
+#define NV50TCL_VP_RESULT_MAP(x) (0x000016bc+((x)*4))
+#define NV50TCL_VP_RESULT_MAP__SIZE 0x00000010
+#define NV50TCL_VP_RESULT_MAP_0_SHIFT 0
+#define NV50TCL_VP_RESULT_MAP_0_MASK 0x000000ff
+#define NV50TCL_VP_RESULT_MAP_1_SHIFT 8
+#define NV50TCL_VP_RESULT_MAP_1_MASK 0x0000ff00
+#define NV50TCL_VP_RESULT_MAP_2_SHIFT 16
+#define NV50TCL_VP_RESULT_MAP_2_MASK 0x00ff0000
+#define NV50TCL_VP_RESULT_MAP_3_SHIFT 24
+#define NV50TCL_VP_RESULT_MAP_3_MASK 0xff000000
+#define NV50TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001700+((x)*4))
+#define NV50TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
+#define NV50TCL_GP_ENABLE 0x00001798
+#define NV50TCL_GP_REG_ALLOC_TEMP 0x000017a0
+#define NV50TCL_GP_REG_ALLOC_RESULT 0x000017a8
+#define NV50TCL_GP_RESULT_MAP_SIZE 0x000017ac
+#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE 0x000017b0
+#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_POINTS 0x00000001
+#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_LINE_STRIP 0x00000002
+#define NV50TCL_GP_OUTPUT_PRIMITIVE_TYPE_TRIANGLE_STRIP 0x00000003
+#define NV50TCL_RASTERIZE_ENABLE 0x000017b4
+#define NV50TCL_STRMOUT_ENABLE 0x000017b8
+#define NV50TCL_GP_RESULT_MAP(x) (0x000017fc+((x)*4))
+#define NV50TCL_GP_RESULT_MAP__SIZE 0x00000020
+#define NV50TCL_GP_RESULT_MAP_0_SHIFT 0
+#define NV50TCL_GP_RESULT_MAP_0_MASK 0x000000ff
+#define NV50TCL_GP_RESULT_MAP_1_SHIFT 8
+#define NV50TCL_GP_RESULT_MAP_1_MASK 0x0000ff00
+#define NV50TCL_GP_RESULT_MAP_2_SHIFT 16
+#define NV50TCL_GP_RESULT_MAP_2_MASK 0x00ff0000
+#define NV50TCL_GP_RESULT_MAP_3_SHIFT 24
+#define NV50TCL_GP_RESULT_MAP_3_MASK 0xff000000
+#define NV50TCL_MAP_SEMANTIC_0 0x00001904
+#define NV50TCL_MAP_SEMANTIC_0_FFC0_ID_SHIFT 0
+#define NV50TCL_MAP_SEMANTIC_0_FFC0_ID_MASK 0x000000ff
+#define NV50TCL_MAP_SEMANTIC_0_BFC0_ID_SHIFT 8
+#define NV50TCL_MAP_SEMANTIC_0_BFC0_ID_MASK 0x0000ff00
+#define NV50TCL_MAP_SEMANTIC_0_COLR_NR_SHIFT 16
+#define NV50TCL_MAP_SEMANTIC_0_COLR_NR_MASK 0x00ff0000
+#define NV50TCL_MAP_SEMANTIC_0_CLMP_EN_SHIFT 24
+#define NV50TCL_MAP_SEMANTIC_0_CLMP_EN_MASK 0xff000000
+#define NV50TCL_MAP_SEMANTIC_1 0x00001908
+#define NV50TCL_MAP_SEMANTIC_1_CLIP_LO_SHIFT 0
+#define NV50TCL_MAP_SEMANTIC_1_CLIP_LO_MASK 0x000000ff
+#define NV50TCL_MAP_SEMANTIC_1_CLIP_HI_SHIFT 8
+#define NV50TCL_MAP_SEMANTIC_1_CLIP_HI_MASK 0x0000ff00
+#define NV50TCL_MAP_SEMANTIC_2 0x0000190c
+#define NV50TCL_MAP_SEMANTIC_2_LAYER_ID_SHIFT 0
+#define NV50TCL_MAP_SEMANTIC_2_LAYER_ID_MASK 0x000000ff
+#define NV50TCL_MAP_SEMANTIC_3 0x00001910
+#define NV50TCL_MAP_SEMANTIC_3_PTSZ_EN (1 << 0)
+#define NV50TCL_MAP_SEMANTIC_3_PTSZ_ID_SHIFT 4
+#define NV50TCL_MAP_SEMANTIC_3_PTSZ_ID_MASK 0x00000ff0
+#define NV50TCL_MAP_SEMANTIC_4 0x00001914
+#define NV50TCL_MAP_SEMANTIC_4_PRIM_ID_SHIFT 0
+#define NV50TCL_MAP_SEMANTIC_4_PRIM_ID_MASK 0x000000ff
+#define NV50TCL_CULL_FACE_ENABLE 0x00001918
+#define NV50TCL_FRONT_FACE 0x0000191c
+#define NV50TCL_FRONT_FACE_CW 0x00000900
+#define NV50TCL_FRONT_FACE_CCW 0x00000901
+#define NV50TCL_CULL_FACE 0x00001920
+#define NV50TCL_CULL_FACE_FRONT 0x00000404
+#define NV50TCL_CULL_FACE_BACK 0x00000405
+#define NV50TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
+#define NV50TCL_VIEWPORT_TRANSFORM_EN 0x0000192c
+#define NV50TCL_VIEW_VOLUME_CLIP_CTRL 0x0000193c
+#define NV50TCL_VIEWPORT_CLIP_RECTS_EN 0x0000194c
+#define NV50TCL_VIEWPORT_CLIP_MODE 0x00001950
+#define NV50TCL_VIEWPORT_CLIP_MODE_INCLUDE 0x00000000
+#define NV50TCL_VIEWPORT_CLIP_MODE_EXCLUDE 0x00000001
+#define NV50TCL_VIEWPORT_CLIP_MODE_UNKNOWN 0x00000002
+#define NV50TCL_FP_CTRL_UNK196C 0x0000196c
+#define NV50TCL_CLIPID_ENABLE 0x0000197c
+#define NV50TCL_CLIPID_WIDTH 0x00001980
+#define NV50TCL_CLIPID_ID 0x00001984
+#define NV50TCL_FP_INTERPOLANT_CTRL 0x00001988
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_SHIFT 24
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_MASK 0xff000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NONE 0x00000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNNN 0x01000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYNN 0x02000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYNN 0x03000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNZN 0x04000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNZN 0x05000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYZN 0x06000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYZN 0x07000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNNW 0x08000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNNW 0x09000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYNW 0x0a000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYNW 0x0b000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NNZW 0x0c000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XNZW 0x0d000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_NYZW 0x0e000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_UMASK_XYZW 0x0f000000
+#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_NONFLAT_SHIFT 16
+#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_NONFLAT_MASK 0x00ff0000
+#define NV50TCL_FP_INTERPOLANT_CTRL_OFFSET_SHIFT 8
+#define NV50TCL_FP_INTERPOLANT_CTRL_OFFSET_MASK 0x0000ff00
+#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_SHIFT 0
+#define NV50TCL_FP_INTERPOLANT_CTRL_COUNT_MASK 0x000000ff
+#define NV50TCL_FP_REG_ALLOC_TEMP 0x0000198c
+#define NV50TCL_REG_MODE 0x000019a0
+#define NV50TCL_REG_MODE_PACKED 0x00000001
+#define NV50TCL_REG_MODE_STRIPED 0x00000002
+#define NV50TCL_FP_CONTROL 0x000019a8
+#define NV50TCL_FP_CONTROL_MULTIPLE_RESULTS (1 << 0)
+#define NV50TCL_FP_CONTROL_EXPORTS_Z (1 << 8)
+#define NV50TCL_FP_CONTROL_USES_KIL (1 << 20)
+#define NV50TCL_DEPTH_BOUNDS_EN 0x000019bc
+#define NV50TCL_LOGIC_OP_ENABLE 0x000019c4
+#define NV50TCL_LOGIC_OP 0x000019c8
+#define NV50TCL_LOGIC_OP_CLEAR 0x00001500
+#define NV50TCL_LOGIC_OP_AND 0x00001501
+#define NV50TCL_LOGIC_OP_AND_REVERSE 0x00001502
+#define NV50TCL_LOGIC_OP_COPY 0x00001503
+#define NV50TCL_LOGIC_OP_AND_INVERTED 0x00001504
+#define NV50TCL_LOGIC_OP_NOOP 0x00001505
+#define NV50TCL_LOGIC_OP_XOR 0x00001506
+#define NV50TCL_LOGIC_OP_OR 0x00001507
+#define NV50TCL_LOGIC_OP_NOR 0x00001508
+#define NV50TCL_LOGIC_OP_EQUIV 0x00001509
+#define NV50TCL_LOGIC_OP_INVERT 0x0000150a
+#define NV50TCL_LOGIC_OP_OR_REVERSE 0x0000150b
+#define NV50TCL_LOGIC_OP_COPY_INVERTED 0x0000150c
+#define NV50TCL_LOGIC_OP_OR_INVERTED 0x0000150d
+#define NV50TCL_LOGIC_OP_NAND 0x0000150e
+#define NV50TCL_LOGIC_OP_SET 0x0000150f
+#define NV50TCL_CLEAR_BUFFERS 0x000019d0
+#define NV50TCL_CLEAR_BUFFERS_Z (1 << 0)
+#define NV50TCL_CLEAR_BUFFERS_S (1 << 1)
+#define NV50TCL_CLEAR_BUFFERS_R (1 << 2)
+#define NV50TCL_CLEAR_BUFFERS_G (1 << 3)
+#define NV50TCL_CLEAR_BUFFERS_B (1 << 4)
+#define NV50TCL_CLEAR_BUFFERS_A (1 << 5)
+#define NV50TCL_CLEAR_BUFFERS_RT_SHIFT 6
+#define NV50TCL_CLEAR_BUFFERS_RT_MASK 0x000003c0
+#define NV50TCL_CLEAR_BUFFERS_LAYER_SHIFT 10
+#define NV50TCL_CLEAR_BUFFERS_LAYER_MASK 0x0007fc00
+#define NV50TCL_COLOR_MASK(x) (0x00001a00+((x)*4))
+#define NV50TCL_COLOR_MASK__SIZE 0x00000008
+#define NV50TCL_COLOR_MASK_R_SHIFT 0
+#define NV50TCL_COLOR_MASK_R_MASK 0x0000000f
+#define NV50TCL_COLOR_MASK_G_SHIFT 4
+#define NV50TCL_COLOR_MASK_G_MASK 0x000000f0
+#define NV50TCL_COLOR_MASK_B_SHIFT 8
+#define NV50TCL_COLOR_MASK_B_MASK 0x00000f00
+#define NV50TCL_COLOR_MASK_A_SHIFT 12
+#define NV50TCL_COLOR_MASK_A_MASK 0x0000f000
+#define NV50TCL_STRMOUT_ADDRESS_HIGH(x) (0x00001a80+((x)*16))
+#define NV50TCL_STRMOUT_ADDRESS_HIGH__SIZE 0x00000004
+#define NV50TCL_STRMOUT_ADDRESS_LOW(x) (0x00001a84+((x)*16))
+#define NV50TCL_STRMOUT_ADDRESS_LOW__SIZE 0x00000004
+#define NV50TCL_STRMOUT_NUM_ATTRIBS(x) (0x00001a88+((x)*16))
+#define NV50TCL_STRMOUT_NUM_ATTRIBS__SIZE 0x00000004
+#define NV50TCL_VERTEX_ARRAY_ATTRIB(x) (0x00001ac0+((x)*4))
+#define NV50TCL_VERTEX_ARRAY_ATTRIB__SIZE 0x00000010
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_BUFFER_SHIFT 0
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_BUFFER_MASK 0x0000000f
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_CONST (1 << 4)
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_OFFSET_SHIFT 5
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_OFFSET_MASK 0x0007ffe0
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_SHIFT 19
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_MASK 0x01f80000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32_32_32 0x00080000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32_32 0x00100000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16_16_16 0x00180000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32_32 0x00200000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16_16 0x00280000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8_8_8 0x00500000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16_16 0x00780000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_32 0x00900000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8_8 0x00980000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8_8 0x00c00000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_16 0x00d80000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_8 0x00e80000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_FORMAT_2_10_10_10 0x01800000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SHIFT 25
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_MASK 0x0e000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_FLOAT 0x0e000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SNORM 0x02000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UNORM 0x04000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_USCALED 0x0a000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SSCALED 0x0c000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_UINT 0x08000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_TYPE_SINT 0x06000000
+#define NV50TCL_VERTEX_ARRAY_ATTRIB_BGRA (1 << 31)
+#define NV50TCL_QUERY_ADDRESS_HIGH 0x00001b00
+#define NV50TCL_QUERY_ADDRESS_LOW 0x00001b04
+#define NV50TCL_QUERY_SEQUENCE 0x00001b08
+#define NV50TCL_QUERY_GET 0x00001b0c
+
+
+#define NV84TCL 0x00008297
+
+
+
+#define NVA0TCL 0x00008397
+
+
+
+#define NVA8TCL 0x00008597
+
+
+
+#define NV50_COMPUTE 0x000050c0
+
+#define NV50_COMPUTE_NOP 0x00000100
+#define NV50_COMPUTE_NOTIFY 0x00000104
+#define NV50_COMPUTE_SERIALIZE 0x00000110
+#define NV50_COMPUTE_DMA_NOTIFY 0x00000180
+#define NV50_COMPUTE_DMA_GLOBAL 0x000001a0
+#define NV50_COMPUTE_DMA_QUERY 0x000001a4
+#define NV50_COMPUTE_DMA_LOCAL 0x000001b8
+#define NV50_COMPUTE_DMA_STACK 0x000001bc
+#define NV50_COMPUTE_DMA_CODE_CB 0x000001c0
+#define NV50_COMPUTE_DMA_TSC 0x000001c4
+#define NV50_COMPUTE_DMA_TIC 0x000001c8
+#define NV50_COMPUTE_DMA_TEXTURE 0x000001cc
+#define NV50_COMPUTE_CP_ADDRESS_HIGH 0x00000210
+#define NV50_COMPUTE_CP_ADDRESS_LOW 0x00000214
+#define NV50_COMPUTE_STACK_ADDRESS_HIGH 0x00000218
+#define NV50_COMPUTE_STACK_ADDRESS_LOW 0x0000021c
+#define NV50_COMPUTE_STACK_SIZE_LOG 0x00000220
+#define NV50_COMPUTE_TSC_ADDRESS_HIGH 0x0000022c
+#define NV50_COMPUTE_TSC_ADDRESS_LOW 0x00000230
+#define NV50_COMPUTE_TSC_LIMIT 0x00000234
+#define NV50_COMPUTE_CB_ADDR 0x00000238
+#define NV50_COMPUTE_CB_ADDR_ID_SHIFT 8
+#define NV50_COMPUTE_CB_ADDR_ID_MASK 0x003fff00
+#define NV50_COMPUTE_CB_ADDR_BUFFER_SHIFT 0
+#define NV50_COMPUTE_CB_ADDR_BUFFER_MASK 0x0000007f
+#define NV50_COMPUTE_CB_DATA(x) (0x0000023c+((x)*4))
+#define NV50_COMPUTE_CB_DATA__SIZE 0x00000010
+#define NV50_COMPUTE_DELAY1 0x00000284
+#define NV50_COMPUTE_WATCHDOG_TIMER 0x00000288
+#define NV50_COMPUTE_DELAY2 0x0000028c
+#define NV50_COMPUTE_LOCAL_ADDRESS_HIGH 0x00000294
+#define NV50_COMPUTE_LOCAL_ADDRESS_LOW 0x00000298
+#define NV50_COMPUTE_LOCAL_SIZE_LOG 0x0000029c
+#define NV50_COMPUTE_CB_DEF_ADDRESS_HIGH 0x000002a4
+#define NV50_COMPUTE_CB_DEF_ADDRESS_LOW 0x000002a8
+#define NV50_COMPUTE_CB_DEF_SET 0x000002ac
+#define NV50_COMPUTE_CB_DEF_SET_SIZE_SHIFT 0
+#define NV50_COMPUTE_CB_DEF_SET_SIZE_MASK 0x0000ffff
+#define NV50_COMPUTE_CB_DEF_SET_BUFFER_SHIFT 16
+#define NV50_COMPUTE_CB_DEF_SET_BUFFER_MASK 0x007f0000
+#define NV50_COMPUTE_BLOCK_ALLOC 0x000002b4
+#define NV50_COMPUTE_BLOCK_ALLOC_THREADS_SHIFT 0
+#define NV50_COMPUTE_BLOCK_ALLOC_THREADS_MASK 0x0000ffff
+#define NV50_COMPUTE_BLOCK_ALLOC_BARRIERS_SHIFT 16
+#define NV50_COMPUTE_BLOCK_ALLOC_BARRIERS_MASK 0xffff0000
+#define NV50_COMPUTE_LANES32_ENABLE 0x000002b8
+#define NV50_COMPUTE_CP_REG_ALLOC_TEMP 0x000002c0
+#define NV50_COMPUTE_TIC_ADDRESS_HIGH 0x000002c4
+#define NV50_COMPUTE_TIC_ADDRESS_LOW 0x000002c8
+#define NV50_COMPUTE_TIC_LIMIT 0x000002cc
+#define NV50_COMPUTE_PM_SET(x) (0x000002d0+((x)*4))
+#define NV50_COMPUTE_PM_SET__SIZE 0x00000004
+#define NV50_COMPUTE_PM_CONTROL(x) (0x000002e0+((x)*4))
+#define NV50_COMPUTE_PM_CONTROL__SIZE 0x00000004
+#define NV50_COMPUTE_PM_CONTROL_UNK0 (1 << 0)
+#define NV50_COMPUTE_PM_CONTROL_UNK1_SHIFT 4
+#define NV50_COMPUTE_PM_CONTROL_UNK1_MASK 0x00000070
+#define NV50_COMPUTE_PM_CONTROL_UNK2_SHIFT 8
+#define NV50_COMPUTE_PM_CONTROL_UNK2_MASK 0xffffff00
+#define NV50_COMPUTE_LOCAL_WARPS_LOG_ALLOC 0x000002fc
+#define NV50_COMPUTE_LOCAL_WARPS_NO_CLAMP 0x00000300
+#define NV50_COMPUTE_STACK_WARPS_LOG_ALLOC 0x00000304
+#define NV50_COMPUTE_STACK_WARPS_NO_CLAMP 0x00000308
+#define NV50_COMPUTE_QUERY_ADDRESS_HIGH 0x00000310
+#define NV50_COMPUTE_QUERY_ADDRESS_LOW 0x00000314
+#define NV50_COMPUTE_QUERY_COUNTER 0x00000318
+#define NV50_COMPUTE_QUERY_GET 0x0000031c
+#define NV50_COMPUTE_COND_ADDRESS_HIGH 0x00000320
+#define NV50_COMPUTE_COND_ADDRESS_LOW 0x00000324
+#define NV50_COMPUTE_COND_MODE 0x00000328
+#define NV50_COMPUTE_COND_MODE_NEVER 0x00000000
+#define NV50_COMPUTE_COND_MODE_ALWAYS 0x00000001
+#define NV50_COMPUTE_COND_MODE_RES 0x00000002
+#define NV50_COMPUTE_COND_MODE_NOT_RES_AND_NOT_ID 0x00000003
+#define NV50_COMPUTE_COND_MODE_RES_OR_ID 0x00000004
+#define NV50_COMPUTE_LAUNCH 0x00000368
+#define NV50_COMPUTE_USER_PARAM_COUNT 0x00000374
+#define NV50_COMPUTE_USER_PARAM_COUNT_COUNT_SHIFT 8
+#define NV50_COMPUTE_USER_PARAM_COUNT_COUNT_MASK 0x0000ff00
+#define NV50_COMPUTE_LINKED_TSC 0x00000378
+#define NV50_COMPUTE_CODE_CB_FLUSH 0x00000380
+#define NV50_COMPUTE_GRIDDIM 0x000003a4
+#define NV50_COMPUTE_GRIDDIM_X_SHIFT 0
+#define NV50_COMPUTE_GRIDDIM_X_MASK 0x0000ffff
+#define NV50_COMPUTE_GRIDDIM_Y_SHIFT 16
+#define NV50_COMPUTE_GRIDDIM_Y_MASK 0xffff0000
+#define NV50_COMPUTE_SHARED_SIZE 0x000003a8
+#define NV50_COMPUTE_BLOCKDIM_YX 0x000003ac
+#define NV50_COMPUTE_BLOCKDIM_YX_X_SHIFT 0
+#define NV50_COMPUTE_BLOCKDIM_YX_X_MASK 0x0000ffff
+#define NV50_COMPUTE_BLOCKDIM_YX_Y_SHIFT 16
+#define NV50_COMPUTE_BLOCKDIM_YX_Y_MASK 0xffff0000
+#define NV50_COMPUTE_BLOCKDIM_Z 0x000003b0
+#define NV50_COMPUTE_CP_START_ID 0x000003b4
+#define NV50_COMPUTE_REG_MODE 0x000003b8
+#define NV50_COMPUTE_REG_MODE_PACKED 0x00000001
+#define NV50_COMPUTE_REG_MODE_STRIPED 0x00000002
+#define NV50_COMPUTE_TEX_LIMITS 0x000003bc
+#define NV50_COMPUTE_TEX_LIMITS_SAMPLERS_LOG2_SHIFT 0
+#define NV50_COMPUTE_TEX_LIMITS_SAMPLERS_LOG2_MASK 0x0000000f
+#define NV50_COMPUTE_TEX_LIMITS_TEXTURES_LOG2_SHIFT 4
+#define NV50_COMPUTE_TEX_LIMITS_TEXTURES_LOG2_MASK 0x000000f0
+#define NV50_COMPUTE_BIND_TSC 0x000003c0
+#define NV50_COMPUTE_BIND_TSC_VALID (1 << 0)
+#define NV50_COMPUTE_BIND_TSC_SAMPLER_SHIFT 4
+#define NV50_COMPUTE_BIND_TSC_SAMPLER_MASK 0x000000f0
+#define NV50_COMPUTE_BIND_TSC_TSC_SHIFT 12
+#define NV50_COMPUTE_BIND_TSC_TSC_MASK 0x001ff000
+#define NV50_COMPUTE_BIND_TIC 0x000003c4
+#define NV50_COMPUTE_BIND_TIC_VALID (1 << 0)
+#define NV50_COMPUTE_BIND_TIC_TEXTURE_SHIFT 1
+#define NV50_COMPUTE_BIND_TIC_TEXTURE_MASK 0x000001fe
+#define NV50_COMPUTE_BIND_TIC_TIC_SHIFT 9
+#define NV50_COMPUTE_BIND_TIC_TIC_MASK 0x7ffffe00
+#define NV50_COMPUTE_SET_PROGRAM_CB 0x000003c8
+#define NV50_COMPUTE_SET_PROGRAM_CB_INDEX_SHIFT 8
+#define NV50_COMPUTE_SET_PROGRAM_CB_INDEX_MASK 0x00000f00
+#define NV50_COMPUTE_SET_PROGRAM_CB_BUFFER_SHIFT 12
+#define NV50_COMPUTE_SET_PROGRAM_CB_BUFFER_MASK 0x0007f000
+#define NV50_COMPUTE_SET_PROGRAM_CB_VALID (1 << 0)
+#define NV50_COMPUTE_GLOBAL_ADDRESS_HIGH(x) (0x00000400+((x)*32))
+#define NV50_COMPUTE_GLOBAL_ADDRESS_HIGH__SIZE 0x00000010
+#define NV50_COMPUTE_GLOBAL_ADDRESS_LOW(x) (0x00000404+((x)*32))
+#define NV50_COMPUTE_GLOBAL_ADDRESS_LOW__SIZE 0x00000010
+#define NV50_COMPUTE_GLOBAL_PITCH(x) (0x00000408+((x)*32))
+#define NV50_COMPUTE_GLOBAL_PITCH__SIZE 0x00000010
+#define NV50_COMPUTE_GLOBAL_LIMIT(x) (0x0000040c+((x)*32))
+#define NV50_COMPUTE_GLOBAL_LIMIT__SIZE 0x00000010
+#define NV50_COMPUTE_GLOBAL_MODE(x) (0x00000410+((x)*32))
+#define NV50_COMPUTE_GLOBAL_MODE__SIZE 0x00000010
+#define NV50_COMPUTE_GLOBAL_MODE_LINEAR (1 << 0)
+#define NV50_COMPUTE_GLOBAL_MODE_TILE_MODE_SHIFT 8
+#define NV50_COMPUTE_GLOBAL_MODE_TILE_MODE_MASK 0x00000f00
+#define NV50_COMPUTE_USER_PARAM(x) (0x00000600+((x)*4))
+#define NV50_COMPUTE_USER_PARAM__SIZE 0x00000040
+
+
+#endif /* NOUVEAU_REG_H */
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 24a6d8055c..49af9b59be 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -85,8 +85,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_GLSL:
return 1;
- case PIPE_CAP_GEOMETRY_SHADER4:
- return 0;
case PIPE_CAP_ANISOTROPIC_FILTER:
return 1;
case PIPE_CAP_POINT_SPRITE:
@@ -110,8 +108,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_TEXTURE_SWIZZLE:
return 1;
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
case PIPE_CAP_INDEP_BLEND_ENABLE:
@@ -126,38 +122,51 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS: /* arbitrary limit */
+ case PIPE_CAP_DEPTH_CLAMP:
+ return 1;
+ default:
+ NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
+ return 0;
+ }
+}
+
+static int
+nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+ enum pipe_shader_cap param)
+{
+ switch(shader) {
+ case PIPE_SHADER_FRAGMENT:
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_GEOMETRY:
+ break;
+ default:
+ return 0;
+ }
+
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS: /* arbitrary limit */
return 16384;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH: /* need stack bo */
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH: /* need stack bo */
return 4;
- case PIPE_CAP_MAX_VS_INPUTS:
- return 16;
- case PIPE_CAP_MAX_FS_INPUTS: /* 128 / 4 with GP */
- return 64 / 4;
- case PIPE_CAP_MAX_VS_CONSTS:
- case PIPE_CAP_MAX_FS_CONSTS:
+ case PIPE_SHADER_CAP_MAX_INPUTS: /* 128 / 4 with GP */
+ if (shader == PIPE_SHADER_GEOMETRY)
+ return 128 / 4;
+ else
+ return 64 / 4;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
return 65536 / 16;
- case PIPE_CAP_MAX_VS_ADDRS:
- case PIPE_CAP_MAX_FS_ADDRS: /* no spilling atm */
+ case PIPE_SHADER_CAP_MAX_ADDRS: /* no spilling atm */
return 1;
- case PIPE_CAP_MAX_VS_PREDS:
- case PIPE_CAP_MAX_FS_PREDS: /* not yet handled */
+ case PIPE_SHADER_CAP_MAX_PREDS: /* not yet handled */
return 0;
- case PIPE_CAP_MAX_VS_TEMPS:
- case PIPE_CAP_MAX_FS_TEMPS: /* no spilling atm */
+ case PIPE_SHADER_CAP_MAX_TEMPS: /* no spilling atm */
return NV50_CAP_MAX_PROGRAM_TEMPS;
- case PIPE_CAP_DEPTH_CLAMP:
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
return 1;
default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0;
}
}
@@ -292,6 +301,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->winsys = ws;
pscreen->destroy = nv50_screen_destroy;
pscreen->get_param = nv50_screen_get_param;
+ pscreen->get_shader_param = nv50_screen_get_shader_param;
pscreen->get_paramf = nv50_screen_get_paramf;
pscreen->is_format_supported = nv50_screen_is_format_supported;
pscreen->context_create = nv50_create;
diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile
index 6cbbad699e..46bb082388 100644
--- a/src/gallium/drivers/nvfx/Makefile
+++ b/src/gallium/drivers/nvfx/Makefile
@@ -19,14 +19,8 @@ C_SOURCES = \
nvfx_resource.c \
nvfx_screen.c \
nvfx_state.c \
- nvfx_state_blend.c \
- nvfx_state_emit.c \
+ nvfx_state_emit.c \
nvfx_state_fb.c \
- nvfx_state_rasterizer.c \
- nvfx_state_scissor.c \
- nvfx_state_stipple.c \
- nvfx_state_viewport.c \
- nvfx_state_zsa.c \
nvfx_surface.c \
nvfx_transfer.c \
nvfx_vbo.c \
diff --git a/src/gallium/drivers/nvfx/SConscript b/src/gallium/drivers/nvfx/SConscript
index 80e3ef2257..f1041e7763 100644
--- a/src/gallium/drivers/nvfx/SConscript
+++ b/src/gallium/drivers/nvfx/SConscript
@@ -24,14 +24,8 @@ nvfx = env.ConvenienceLibrary(
'nvfx_resource.c',
'nvfx_screen.c',
'nvfx_state.c',
- 'nvfx_state_blend.c',
'nvfx_state_emit.c',
'nvfx_state_fb.c',
- 'nvfx_state_rasterizer.c',
- 'nvfx_state_scissor.c',
- 'nvfx_state_stipple.c',
- 'nvfx_state_viewport.c',
- 'nvfx_state_zsa.c',
'nvfx_surface.c',
'nvfx_transfer.c',
'nvfx_vbo.c',
diff --git a/src/gallium/drivers/nvfx/nv01_2d.xml.h b/src/gallium/drivers/nvfx/nv01_2d.xml.h
new file mode 100644
index 0000000000..b963eb7edc
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nv01_2d.xml.h
@@ -0,0 +1,1343 @@
+#ifndef NV01_2D_XML
+#define NV01_2D_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv01_2d.xml ( 33462 bytes, from 2010-08-05 19:38:53)
+- copyright.xml ( 6503 bytes, from 2010-04-10 23:15:50)
+- nv_defs.xml ( 4437 bytes, from 2010-08-05 19:38:53)
+- nv_object.xml ( 10424 bytes, from 2010-08-05 19:38:53)
+- nvchipsets.xml ( 2824 bytes, from 2010-08-05 19:38:53)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <mandin.patrice@orange.fr> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NV01_CONTEXT_BETA1_DMA_NOTIFY 0x00000180
+
+#define NV01_CONTEXT_BETA1_BETA_1D31 0x00000300
+
+
+#define NV04_BETA_SOLID_DMA_NOTIFY 0x00000180
+
+#define NV04_BETA_SOLID_BETA_FACTOR 0x00000300
+
+
+#define NV01_CONTEXT_COLOR_KEY_DMA_NOTIFY 0x00000180
+
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT 0x00000300
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV01_CONTEXT_COLOR_KEY_COLOR 0x00000304
+
+
+#define NV01_CONTEXT_PATTERN_DMA_NOTIFY 0x00000180
+
+#define NV01_CONTEXT_PATTERN_COLOR_FORMAT 0x00000300
+
+#define NV01_CONTEXT_PATTERN_MONOCHROME_FORMAT 0x00000304
+
+#define NV01_CONTEXT_PATTERN_SHAPE 0x00000308
+
+#define NV01_CONTEXT_PATTERN_COLOR(i0) (0x00000310 + 0x4*(i0))
+#define NV01_CONTEXT_PATTERN_COLOR__ESIZE 0x00000004
+#define NV01_CONTEXT_PATTERN_COLOR__LEN 0x00000002
+
+#define NV01_CONTEXT_PATTERN_PATTERN(i0) (0x00000318 + 0x4*(i0))
+#define NV01_CONTEXT_PATTERN_PATTERN__ESIZE 0x00000004
+#define NV01_CONTEXT_PATTERN_PATTERN__LEN 0x00000002
+
+
+#define NV01_CONTEXT_CLIP_RECTANGLE_DMA_NOTIFY 0x00000180
+
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT 0x00000300
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X__MASK 0x0000ffff
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X__SHIFT 0
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y__MASK 0xffff0000
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y__SHIFT 16
+
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE 0x00000304
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W__MASK 0x0000ffff
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W__SHIFT 0
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H__MASK 0xffff0000
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H__SHIFT 16
+
+
+#define NV04_CONTEXT_SURFACES_2D_DMA_NOTIFY 0x00000180
+
+#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE 0x00000184
+
+#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_DESTIN 0x00000188
+
+
+#define NV50_CONTEXT_SURFACES_2D_SRC_LINEAR 0x00000200
+
+#define NV50_CONTEXT_SURFACES_2D_SRC_TILE_MODE 0x00000204
+
+#define NV50_CONTEXT_SURFACES_2D_SRC_WIDTH 0x00000208
+
+#define NV50_CONTEXT_SURFACES_2D_SRC_HEIGHT 0x0000020c
+
+#define NV50_CONTEXT_SURFACES_2D_UNK0210 0x00000210
+
+#define NV50_CONTEXT_SURFACES_2D_UNK0214 0x00000214
+
+#define NV50_CONTEXT_SURFACES_2D_DST_LINEAR 0x00000218
+
+#define NV50_CONTEXT_SURFACES_2D_DST_TILE_MODE 0x0000021c
+
+#define NV50_CONTEXT_SURFACES_2D_DST_WIDTH 0x00000220
+
+#define NV50_CONTEXT_SURFACES_2D_DST_HEIGHT 0x00000224
+
+#define NV50_CONTEXT_SURFACES_2D_UNK0228 0x00000228
+
+#define NV50_CONTEXT_SURFACES_2D_UNK022C 0x0000022c
+
+#define NV50_CONTEXT_SURFACES_2D_OFFSET_SOURCE_HIGH 0x00000230
+
+#define NV50_CONTEXT_SURFACES_2D_OFFSET_DESTIN_HIGH 0x00000234
+
+#define NV04_CONTEXT_SURFACES_2D_FORMAT 0x00000300
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y8 0x00000001
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_Z1R5G5B5 0x00000002
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_X1R5G5B5 0x00000003
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5 0x00000004
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y16 0x00000005
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_Z8R8G8B8 0x00000006
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_X8R8G8B8 0x00000007
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_X1A7R8G8B8 0x00000009
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8 0x0000000a
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y32 0x0000000b
+
+#define NV04_CONTEXT_SURFACES_2D_PITCH 0x00000304
+#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE__MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE__SHIFT 0
+#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN__MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN__SHIFT 16
+
+#define NV04_CONTEXT_SURFACES_2D_OFFSET_SOURCE 0x00000308
+
+#define NV04_CONTEXT_SURFACES_2D_OFFSET_DESTIN 0x0000030c
+
+
+#define NV04_SWIZZLED_SURFACE_DMA_NOTIFY 0x00000180
+
+#define NV04_SWIZZLED_SURFACE_DMA_IMAGE 0x00000184
+
+#define NV04_SWIZZLED_SURFACE_FORMAT 0x00000300
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR__MASK 0x000000ff
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR__SHIFT 0
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y8 0x00000001
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_Z1R5G5B5 0x00000002
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_X1R5G5B5 0x00000003
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_R5G6B5 0x00000004
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y16 0x00000005
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_Z8R8G8B8 0x00000006
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_X8R8G8B8 0x00000007
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_X1A7R8G8B8 0x00000009
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_A8R8G8B8 0x0000000a
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y32 0x0000000b
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U__MASK 0x00ff0000
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U__SHIFT 16
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V__MASK 0xff000000
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V__SHIFT 24
+
+#define NV04_SWIZZLED_SURFACE_OFFSET 0x00000304
+
+
+#define NV03_CONTEXT_ROP_DMA_NOTIFY 0x00000180
+
+#define NV03_CONTEXT_ROP_ROP 0x00000300
+
+
+#define NV04_IMAGE_PATTERN_DMA_NOTIFY 0x00000180
+
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT 0x00000300
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT 0x00000304
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_CGA6 0x00000001
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_LE 0x00000002
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE 0x00000308
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_8X8 0x00000000
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_64X1 0x00000001
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_1X64 0x00000002
+
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT 0x0000030c
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT_MONO 0x00000001
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT_COLOR 0x00000002
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR0 0x00000310
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR1 0x00000314
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN0 0x00000318
+
+#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN1 0x0000031c
+
+#define NV04_IMAGE_PATTERN_PATTERN_Y8(i0) (0x00000400 + 0x4*(i0))
+#define NV04_IMAGE_PATTERN_PATTERN_Y8__ESIZE 0x00000004
+#define NV04_IMAGE_PATTERN_PATTERN_Y8__LEN 0x00000010
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0__MASK 0x000000ff
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0__SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1__MASK 0x0000ff00
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1__SHIFT 8
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2__MASK 0x00ff0000
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2__SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3__MASK 0xff000000
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3__SHIFT 24
+
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5(i0) (0x00000500 + 0x4*(i0))
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5__ESIZE 0x00000004
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5__LEN 0x00000020
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0__MASK 0x0000001f
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0__SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0__MASK 0x000007e0
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0__SHIFT 5
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0__MASK 0x0000f800
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0__SHIFT 11
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1__MASK 0x001f0000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1__SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1__MASK 0x07e00000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1__SHIFT 21
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1__MASK 0xf8000000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1__SHIFT 27
+
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5(i0) (0x00000600 + 0x4*(i0))
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5__ESIZE 0x00000004
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5__LEN 0x00000020
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0__MASK 0x0000001f
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0__SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0__MASK 0x000003e0
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0__SHIFT 5
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0__MASK 0x00007c00
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0__SHIFT 10
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1__MASK 0x001f0000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1__SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1__MASK 0x03e00000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1__SHIFT 21
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1__MASK 0x7c000000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1__SHIFT 26
+
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8(i0) (0x00000700 + 0x4*(i0))
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8__ESIZE 0x00000004
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8__LEN 0x00000040
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B__MASK 0x000000ff
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B__SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G__MASK 0x0000ff00
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G__SHIFT 8
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R__MASK 0x00ff0000
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R__SHIFT 16
+
+
+#define NV01_RENDER_SOLID_LINE_PATCH 0x0000010c
+
+#define NV01_RENDER_SOLID_LINE_DMA_NOTIFY 0x00000180
+
+#define NV01_RENDER_SOLID_LINE_CLIP_RECTANGLE 0x00000184
+
+#define NV01_RENDER_SOLID_LINE_PATTERN 0x00000188
+
+#define NV04_RENDER_SOLID_LINE_PATTERN 0x00000188
+
+#define NV01_RENDER_SOLID_LINE_ROP 0x0000018c
+
+#define NV01_RENDER_SOLID_LINE_BETA1 0x00000190
+
+#define NV01_RENDER_SOLID_LINE_SURFACE_DST 0x00000194
+
+
+#define NV04_RENDER_SOLID_LINE_BETA4 0x00000194
+
+#define NV04_RENDER_SOLID_LINE_SURFACE 0x00000198
+
+#define NV01_RENDER_SOLID_LINE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_LINE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV01_RENDER_SOLID_LINE_COLOR 0x00000304
+
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0(i0) (0x00000400 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0__LEN 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X__SHIFT 0
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1(i0) (0x00000404 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1__LEN 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X__SHIFT 0
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X(i0) (0x00000480 + 0x10*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y(i0) (0x00000484 + 0x10*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X(i0) (0x00000488 + 0x10*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y(i0) (0x0000048c + 0x10*(i0))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_POLYLINE(i0) (0x00000500 + 0x4*(i0))
+#define NV01_RENDER_SOLID_LINE_POLYLINE__ESIZE 0x00000004
+#define NV01_RENDER_SOLID_LINE_POLYLINE__LEN 0x00000020
+#define NV01_RENDER_SOLID_LINE_POLYLINE_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_POLYLINE_X__SHIFT 0
+#define NV01_RENDER_SOLID_LINE_POLYLINE_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_POLYLINE_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X(i0) (0x00000580 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y(i0) (0x00000584 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR(i0) (0x00000600 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT(i0) (0x00000604 + 0x8*(i0))
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT__LEN 0x00000010
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X__SHIFT 0
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y__SHIFT 16
+
+
+#define NV01_RENDER_SOLID_TRIANGLE_PATCH 0x0000010c
+
+#define NV01_RENDER_SOLID_TRIANGLE_DMA_NOTIFY 0x00000180
+
+#define NV01_RENDER_SOLID_TRIANGLE_CLIP_RECTANGLE 0x00000184
+
+#define NV01_RENDER_SOLID_TRIANGLE_PATTERN 0x00000188
+
+#define NV04_RENDER_SOLID_TRIANGLE_PATTERN 0x00000188
+
+#define NV01_RENDER_SOLID_TRIANGLE_ROP 0x0000018c
+
+#define NV01_RENDER_SOLID_TRIANGLE_BETA1 0x00000190
+
+#define NV01_RENDER_SOLID_TRIANGLE_SURFACE_DST 0x00000194
+
+
+#define NV04_RENDER_SOLID_TRIANGLE_BETA4 0x00000194
+
+#define NV04_RENDER_SOLID_TRIANGLE_SURFACE 0x00000198
+
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR 0x00000304
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0 0x00000310
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1 0x00000314
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2 0x00000318
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_X 0x00000320
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_Y 0x00000324
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_X 0x00000328
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_Y 0x0000032c
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_X 0x00000330
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_Y 0x00000334
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH(i0) (0x00000400 + 0x4*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH__ESIZE 0x00000004
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH__LEN 0x00000020
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X(i0) (0x00000480 + 0x8*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y(i0) (0x00000484 + 0x8*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR(i0) (0x00000500 + 0x10*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR__LEN 0x00000008
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0(i0) (0x00000504 + 0x10*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0__LEN 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1(i0) (0x00000508 + 0x10*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1__LEN 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2(i0) (0x0000050c + 0x10*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2__ESIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2__LEN 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR(i0) (0x00000580 + 0x8*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR__LEN 0x00000010
+
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT(i0) (0x00000584 + 0x8*(i0))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT__LEN 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X__SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y__SHIFT 16
+
+
+#define NV01_RENDER_SOLID_RECTANGLE_PATCH 0x0000010c
+
+#define NV01_RENDER_SOLID_RECTANGLE_DMA_NOTIFY 0x00000180
+
+#define NV01_RENDER_SOLID_RECTANGLE_CLIP_RECTANGLE 0x00000184
+
+#define NV01_RENDER_SOLID_RECTANGLE_PATTERN 0x00000188
+
+#define NV04_RENDER_SOLID_RECTANGLE_PATTERN 0x00000188
+
+#define NV01_RENDER_SOLID_RECTANGLE_ROP 0x0000018c
+
+#define NV01_RENDER_SOLID_RECTANGLE_BETA1 0x00000190
+
+#define NV01_RENDER_SOLID_RECTANGLE_SURFACE_DST 0x00000194
+
+
+#define NV04_RENDER_SOLID_RECTANGLE_BETA4 0x00000194
+
+#define NV04_RENDER_SOLID_RECTANGLE_SURFACE 0x00000198
+
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR 0x00000304
+
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT(i0) (0x00000400 + 0x8*(i0))
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT__LEN 0x00000010
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X__SHIFT 0
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y__MASK 0xffff0000
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y__SHIFT 16
+
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE(i0) (0x00000404 + 0x8*(i0))
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE__ESIZE 0x00000008
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE__LEN 0x00000010
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W__MASK 0x0000ffff
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W__SHIFT 0
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H__MASK 0xffff0000
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H__SHIFT 16
+
+
+#define NV01_IMAGE_BLIT_PATCH 0x0000010c
+
+
+#define NV11_IMAGE_BLIT_WAIT_FOR_IDLE 0x00000108
+
+#define NV11_IMAGE_BLIT_UNK120 0x00000120
+
+#define NV11_IMAGE_BLIT_UNK124 0x00000124
+
+#define NV11_IMAGE_BLIT_UNK128 0x00000128
+
+#define NV11_IMAGE_BLIT_UNK12C 0x0000012c
+
+#define NV11_IMAGE_BLIT_UNK130 0x00000130
+
+#define NV11_IMAGE_BLIT_UNK134 0x00000134
+
+#define NV01_IMAGE_BLIT_DMA_NOTIFY 0x00000180
+
+#define NV01_IMAGE_BLIT_COLOR_KEY 0x00000184
+
+#define NV04_IMAGE_BLIT_COLOR_KEY 0x00000184
+
+#define NV01_IMAGE_BLIT_CLIP_RECTANGLE 0x00000188
+
+#define NV01_IMAGE_BLIT_PATTERN 0x0000018c
+
+#define NV04_IMAGE_BLIT_PATTERN 0x0000018c
+
+#define NV01_IMAGE_BLIT_ROP 0x00000190
+
+#define NV01_IMAGE_BLIT_BETA1 0x00000194
+
+
+#define NV01_IMAGE_BLIT_SURFACE_SRC 0x00000198
+
+#define NV01_IMAGE_BLIT_SURFACE_DST 0x0000019c
+
+
+#define NV04_IMAGE_BLIT_BETA4 0x00000198
+
+#define NV04_IMAGE_BLIT_SURFACES 0x0000019c
+
+#define NV01_IMAGE_BLIT_OPERATION 0x000002fc
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_IMAGE_BLIT_OPERATION_ROP_AND 0x00000001
+#define NV01_IMAGE_BLIT_OPERATION_BLEND_AND 0x00000002
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY 0x00000003
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_IMAGE_BLIT_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV01_IMAGE_BLIT_POINT_IN 0x00000300
+#define NV01_IMAGE_BLIT_POINT_IN_X__MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_POINT_IN_X__SHIFT 0
+#define NV01_IMAGE_BLIT_POINT_IN_Y__MASK 0xffff0000
+#define NV01_IMAGE_BLIT_POINT_IN_Y__SHIFT 16
+
+#define NV01_IMAGE_BLIT_POINT_OUT 0x00000304
+#define NV01_IMAGE_BLIT_POINT_OUT_X__MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_POINT_OUT_X__SHIFT 0
+#define NV01_IMAGE_BLIT_POINT_OUT_Y__MASK 0xffff0000
+#define NV01_IMAGE_BLIT_POINT_OUT_Y__SHIFT 16
+
+#define NV01_IMAGE_BLIT_SIZE 0x00000308
+#define NV01_IMAGE_BLIT_SIZE_W__MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_SIZE_W__SHIFT 0
+#define NV01_IMAGE_BLIT_SIZE_H__MASK 0xffff0000
+#define NV01_IMAGE_BLIT_SIZE_H__SHIFT 16
+
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_PATCH 0x0000010c
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_LUT 0x00000184
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_KEY 0x00000188
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x0000018c
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_PATTERN 0x00000190
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_ROP 0x00000194
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_BETA1 0x00000198
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_BETA4 0x0000019c
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_SURFACE 0x000001a0
+
+#define NV05_INDEXED_IMAGE_FROM_CPU_SURFACE 0x000001a0
+
+#define NV05_INDEXED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000003e0
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_OPERATION 0x000003e4
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_FORMAT 0x000003e8
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_INDEX_FORMAT 0x000003ec
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_LUT_OFFSET 0x000003f0
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_POINT 0x000003f4
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_OUT 0x000003f8
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_IN 0x000003fc
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR(i0) (0x00000400 + 0x4*(i0))
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR__ESIZE 0x00000004
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR__LEN 0x00000700
+
+
+#define NV10_IMAGE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
+
+#define NV01_IMAGE_FROM_CPU_PATCH 0x0000010c
+
+#define NV01_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+
+#define NV01_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+
+#define NV04_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+
+#define NV01_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x00000188
+
+#define NV01_IMAGE_FROM_CPU_PATTERN 0x0000018c
+
+#define NV04_IMAGE_FROM_CPU_PATTERN 0x0000018c
+
+#define NV01_IMAGE_FROM_CPU_ROP 0x00000190
+
+#define NV01_IMAGE_FROM_CPU_BETA1 0x00000194
+
+
+#define NV01_IMAGE_FROM_CPU_SURFACE_DST 0x00000198
+
+
+#define NV04_IMAGE_FROM_CPU_BETA4 0x00000198
+
+#define NV04_IMAGE_FROM_CPU_SURFACE 0x0000019c
+
+#define NV05_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
+
+#define NV01_IMAGE_FROM_CPU_OPERATION 0x000002fc
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_IMAGE_FROM_CPU_OPERATION_ROP_AND 0x00000001
+#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_AND 0x00000002
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY 0x00000003
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_R5G6G5 0x00000001
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A1R5G5B5 0x00000002
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X1R5G5B5 0x00000003
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A8R8G8B8 0x00000004
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X8R8G8B8 0x00000005
+
+#define NV01_IMAGE_FROM_CPU_POINT 0x00000304
+#define NV01_IMAGE_FROM_CPU_POINT_X__MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_POINT_X__SHIFT 0
+#define NV01_IMAGE_FROM_CPU_POINT_Y__MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_POINT_Y__SHIFT 16
+
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT 0x00000308
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W__MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W__SHIFT 0
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H__MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H__SHIFT 16
+
+#define NV01_IMAGE_FROM_CPU_SIZE_IN 0x0000030c
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_W__MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_W__SHIFT 0
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_H__MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_H__SHIFT 16
+
+#define NV01_IMAGE_FROM_CPU_COLOR(i0) (0x00000400 + 0x4*(i0))
+#define NV01_IMAGE_FROM_CPU_COLOR__ESIZE 0x00000004
+#define NV01_IMAGE_FROM_CPU_COLOR__LEN 0x00000020
+
+#define NV04_IMAGE_FROM_CPU_COLOR(i0) (0x00000400 + 0x4*(i0))
+#define NV04_IMAGE_FROM_CPU_COLOR__ESIZE 0x00000004
+#define NV04_IMAGE_FROM_CPU_COLOR__LEN 0x00000700
+
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_PATCH 0x0000010c
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_PATTERN 0x00000188
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU_PATTERN 0x00000188
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_ROP 0x0000018c
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_BETA1 0x00000190
+
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SURFACE_DST 0x00000194
+
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU_BETA4 0x00000194
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU_SURFACE 0x00000198
+
+#define NV05_STRETCHED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_OPERATION 0x000002fc
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN 0x00000304
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W__MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W__SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H__MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H__SHIFT 16
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DX_DU 0x00000308
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DY_DV 0x0000030c
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT 0x00000310
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X__MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X__SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y__MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y__SHIFT 16
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE 0x00000314
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W__MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W__SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H__MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H__SHIFT 16
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4 0x00000318
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X__MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X__SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y__MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y__SHIFT 16
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR(i0) (0x00000400 + 0x4*(i0))
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR__ESIZE 0x00000004
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR__LEN 0x00000700
+
+
+#define NV10_SCALED_IMAGE_FROM_MEMORY_WAIT_FOR_IDLE 0x00000108
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_NOTIFY 0x00000180
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE 0x00000184
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_PATTERN 0x00000188
+
+#define NV04_SCALED_IMAGE_FROM_MEMORY_PATTERN 0x00000188
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_ROP 0x0000018c
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_BETA1 0x00000190
+
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SURFACE_DST 0x00000194
+
+
+#define NV04_SCALED_IMAGE_FROM_MEMORY_BETA4 0x00000194
+
+#define NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000198
+
+#define NV05_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000198
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION 0x000002fc
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_DITHER 0x00000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE 0x00000001
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_SUBTR_TRUNCATE 0x00000002
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT 0x00000300
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5 0x00000001
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X1R5G5B5 0x00000002
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8 0x00000003
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8 0x00000004
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_V8YB8U8YA8 0x00000005
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_YB8V8YA8U8 0x00000006
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5 0x00000007
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8 0x00000008
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_AY8 0x00000009
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION 0x00000304
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_AND 0x00000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_ROP_AND 0x00000001
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_AND 0x00000002
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY 0x00000003
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT 0x00000308
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y__SHIFT 16
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE 0x0000030c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H__SHIFT 16
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT 0x00000310
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y__SHIFT 16
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE 0x00000314
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H__SHIFT 16
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DU_DX 0x00000318
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DV_DY 0x0000031c
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE 0x00000400
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H__SHIFT 16
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT 0x00000404
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN__MASK 0x00ff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN__SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER 0x00010000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CORNER 0x00020000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER__MASK 0xff000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER__SHIFT 24
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE 0x00000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_BILINEAR 0x01000000
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OFFSET 0x00000408
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT 0x0000040c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U__MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U__SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V__MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V__SHIFT 16
+
+
+#define NV50_SCALED_IMAGE_FROM_MEMORY_OFFSET_HIGH 0x00000410
+
+#define NV50_SCALED_IMAGE_FROM_MEMORY_SRC_LINEAR 0x00000414
+
+#define NV50_SCALED_IMAGE_FROM_MEMORY_SRC_TILE_MODE 0x00000418
+
+
+#define NV03_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
+
+#define NV03_GDI_RECTANGLE_TEXT_PATTERN 0x00000184
+
+#define NV03_GDI_RECTANGLE_TEXT_ROP 0x00000188
+
+#define NV03_GDI_RECTANGLE_TEXT_BETA1 0x0000019c
+
+#define NV03_GDI_RECTANGLE_TEXT_SURFACE_DST 0x00000190
+
+#define NV03_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
+
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
+
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT 0x00000400
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE 0x00000404
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B 0x000007f4
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B 0x000007f8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_B 0x000007fc
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0 0x00000800
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1 0x00000804
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x00000bec
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x00000bf0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_C 0x00000bf4
+
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C 0x00000bf8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C 0x00000bfc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(i0) (0x00000c00 + 0x4*(i0))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__ESIZE 0x00000004
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__LEN 0x00000020
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0 0x00000fe8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1 0x00000fec
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_D 0x00000ff0
+
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D 0x00000ff4
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D 0x00000ff8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D 0x00000ffc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D(i0) (0x00001000 + 0x4*(i0))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D__ESIZE 0x00000004
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D__LEN 0x00000020
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x000013e4
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x000013e8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR0_E 0x000013ec
+
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_E 0x000013f0
+
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x000013f4
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x000013f8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E 0x000013fc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X__MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X__SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y__MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y__SHIFT 16
+
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(i0) (0x00001400 + 0x4*(i0))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__ESIZE 0x00000004
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__LEN 0x00000020
+
+
+#define NV04_GDI_RECTANGLE_TEXT_PATCH 0x0000010c
+
+#define NV04_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
+
+#define NV04_GDI_RECTANGLE_TEXT_DMA_FONTS 0x00000184
+
+#define NV04_GDI_RECTANGLE_TEXT_PATTERN 0x00000188
+
+#define NV04_GDI_RECTANGLE_TEXT_ROP 0x0000018c
+
+#define NV04_GDI_RECTANGLE_TEXT_BETA1 0x00000190
+
+#define NV04_GDI_RECTANGLE_TEXT_BETA4 0x00000194
+
+#define NV04_GDI_RECTANGLE_TEXT_SURFACE 0x00000198
+
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_AND 0x00000000
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_ROP_AND 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_AND 0x00000002
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY 0x00000003
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_PREMULT 0x00000005
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8 0x00000003
+
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_CGA6 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE 0x00000002
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
+
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT(i0) (0x00000400 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT__LEN 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE(i0) (0x00000404 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE__LEN 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0 0x000005f4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1 0x000005f8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_B 0x000005fc
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0(i0) (0x00000600 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0__LEN 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1(i0) (0x00000604 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1__LEN 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x000007ec
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x000007f0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_C 0x000007f4
+
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C 0x000007f8
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C 0x000007fc
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(i0) (0x00000800 + 0x4*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__ESIZE 0x00000004
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__LEN 0x00000080
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x00000be4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x00000be8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR0_E 0x00000bec
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_E 0x00000bf0
+
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x00000bf4
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x00000bf8
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E 0x00000bfc
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(i0) (0x00000c00 + 0x4*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__ESIZE 0x00000004
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__LEN 0x00000080
+
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F 0x00000ff0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET__MASK 0x0fffffff
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH__MASK 0xf0000000
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH__SHIFT 28
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0 0x00000ff4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1 0x00000ff8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_F 0x00000ffc
+
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F(i0) (0x00001000 + 0x4*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F__ESIZE 0x00000004
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F__LEN 0x00000100
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX__MASK 0x000000ff
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X__MASK 0x000fff00
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X__SHIFT 8
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y__MASK 0xfff00000
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y__SHIFT 20
+
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G 0x000017f0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET__MASK 0x0fffffff
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH__MASK 0xf0000000
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH__SHIFT 28
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0 0x000017f4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1 0x000017f8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_G 0x000017fc
+
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT(i0) (0x00001800 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT__LEN 0x00000100
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X__MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X__SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y__MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y__SHIFT 16
+
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX(i0) (0x00001804 + 0x8*(i0))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX__ESIZE 0x00000008
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX__LEN 0x00000100
+
+
+#define NV10_TEXTURE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
+
+#define NV10_TEXTURE_FROM_CPU_DMA_NOTIFY 0x00000180
+
+#define NV10_TEXTURE_FROM_CPU_SURFACE 0x00000184
+
+#define NV10_TEXTURE_FROM_CPU_COLOR_FORMAT 0x00000300
+
+#define NV10_TEXTURE_FROM_CPU_POINT 0x00000304
+#define NV10_TEXTURE_FROM_CPU_POINT_X__MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_POINT_X__SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_POINT_Y__MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_POINT_Y__SHIFT 16
+
+#define NV10_TEXTURE_FROM_CPU_SIZE 0x00000308
+#define NV10_TEXTURE_FROM_CPU_SIZE_W__MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_SIZE_W__SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_SIZE_H__MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_SIZE_H__SHIFT 16
+
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL 0x0000030c
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X__MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X__SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W__MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W__SHIFT 16
+
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL 0x00000310
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y__MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y__SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H__MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H__SHIFT 16
+
+#define NV10_TEXTURE_FROM_CPU_COLOR(i0) (0x00000400 + 0x4*(i0))
+#define NV10_TEXTURE_FROM_CPU_COLOR__ESIZE 0x00000004
+#define NV10_TEXTURE_FROM_CPU_COLOR__LEN 0x00000700
+
+
+#endif /* NV01_2D_XML */
diff --git a/src/gallium/drivers/nvfx/nv04_2d.c b/src/gallium/drivers/nvfx/nv04_2d.c
index c05312219b..e0e65e7a87 100644
--- a/src/gallium/drivers/nvfx/nv04_2d.c
+++ b/src/gallium/drivers/nvfx/nv04_2d.c
@@ -33,7 +33,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
-#include <nouveau/nouveau_class.h>
#include <nouveau/nouveau_device.h>
#include <nouveau/nouveau_pushbuf.h>
#include <nouveau/nouveau_channel.h>
@@ -42,6 +41,10 @@
#include <nouveau/nouveau_grobj.h>
#include "nv04_2d.h"
+#include "nouveau/nv_object.xml.h"
+#include "nouveau/nv_m2mf.xml.h"
+#include "nv01_2d.xml.h"
+
/* avoid depending on Mesa/Gallium */
#ifdef __GNUC__
#define likely(x) __builtin_expect(!!(x), 1)
@@ -107,7 +110,7 @@ static inline unsigned log2i(unsigned i)
//#define NV04_REGION_DEBUG
// Yes, we really want to inline everything, since all the functions are used only once
-#if defined(__GNUC__) && defined(DEBUG)
+#if defined(__GNUC__) && !defined(DEBUG)
#define inline __attribute__((always_inline)) inline
#endif
@@ -365,19 +368,21 @@ nv04_region_do_align_offset(struct nv04_region* rgn, unsigned w, unsigned h, int
{
if(rgn->pitch > 0)
{
- int delta;
-
assert(!(rgn->offset & ((1 << rgn->bpps) - 1))); // fatal!
- delta = rgn->offset & ((1 << shift) - 1);
if(h <= 1)
{
- rgn->x += delta >> rgn->bpps;
+ int delta;
+ rgn->offset += rgn->y * rgn->pitch + (rgn->x << rgn->bpps);
+ delta = rgn->offset & ((1 << shift) - 1);
+ rgn->y = 0;
+ rgn->x = delta >> rgn->bpps;
rgn->offset -= delta;
rgn->pitch = align((rgn->x + w) << rgn->bpps, 1 << shift);
}
else
{
+ int delta = rgn->offset & ((1 << shift) - 1);
int newxo = (rgn->x << rgn->bpps) + delta;
int dy = newxo / rgn->pitch;
newxo -= dy * rgn->pitch;
@@ -723,15 +728,58 @@ ms:
nouveau_bo_unmap(dst->bo);
}
+static inline int
+nv04_region_cs2d_format(struct nv04_region* rgn)
+{
+ switch(rgn->bpps) {
+ case 0:
+ return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8;
+ case 1:
+ if(rgn->one_bits >= 1)
+ return NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_X1R5G5B5;
+ else
+ return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5;
+ case 2:
+ if(rgn->one_bits >= 8)
+ return NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_X8R8G8B8;
+ else
+ return NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8;
+ default:
+ return -1;
+ }
+}
+
+static inline int
+nv04_region_sifm_format(struct nv04_region* rgn)
+{
+ switch(rgn->bpps) {
+ case 0:
+ return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8;
+ case 1:
+ if(rgn->one_bits >= 1)
+ return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X1R5G5B5;
+ else
+ return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5;
+ case 2:
+ if(rgn->one_bits >= 8)
+ return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8;
+ else
+ return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8;
+ default:
+ return -1;
+ }
+}
static void
nv04_region_copy_swizzle(struct nv04_2d_context *ctx,
struct nv04_region* dst,
struct nv04_region* src,
- int w, int h, int cs2d_format, int sifm_format)
+ int w, int h)
{
struct nouveau_channel *chan = ctx->swzsurf->channel;
struct nouveau_grobj *swzsurf = ctx->swzsurf;
struct nouveau_grobj *sifm = ctx->sifm;
+ int cs2d_format = nv04_region_cs2d_format(dst);
+ int sifm_format = nv04_region_sifm_format(src);
/* Max width & height may not be the same on all HW, but must be POT */
unsigned max_shift = 10;
unsigned cw = 1 << max_shift;
@@ -768,8 +816,8 @@ nv04_region_copy_swizzle(struct nv04_2d_context *ctx,
BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_FORMAT, 1);
OUT_RING (chan, cs2d_format |
- log2i(cw) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT |
- log2i(ch) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT);
+ log2i(cw) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U__SHIFT |
+ log2i(ch) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V__SHIFT);
BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1);
OUT_RELOCo(chan, src->bo,
@@ -796,19 +844,19 @@ nv04_region_copy_swizzle(struct nv04_2d_context *ctx,
OUT_RELOCl(chan, dst->bo, dst_offset,
NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
- BEGIN_RING(chan, sifm, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
- OUT_RING (chan, NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE);
+ BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9);
+ OUT_RING (chan, NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE);
OUT_RING (chan, sifm_format);
OUT_RING (chan, NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY);
- OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT));
- OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | rw);
- OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT));
- OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | rw);
+ OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y__SHIFT));
+ OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H__SHIFT | rw);
+ OUT_RING (chan, rx | (ry << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y__SHIFT));
+ OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H__SHIFT | rw);
OUT_RING (chan, 1 << 20);
OUT_RING (chan, 1 << 20);
BEGIN_RING(chan, sifm, NV03_SCALED_IMAGE_FROM_MEMORY_SIZE, 4);
- OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | align(rw, 8));
+ OUT_RING (chan, rh << NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H__SHIFT | align(rw, 8));
OUT_RING (chan, src->pitch |
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER |
NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE);
@@ -828,7 +876,7 @@ nv04_copy_m2mf_begin(struct nv04_2d_context *ctx, struct nouveau_bo* dstbo, stru
struct nouveau_channel *chan = ctx->m2mf->channel;
struct nouveau_grobj *m2mf = ctx->m2mf;
MARK_RING (chan, 3 + commands * 9, 2 + commands * 2);
- BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2);
+ BEGIN_RING(chan, m2mf, NV04_M2MF_DMA_BUFFER_IN, 2);
OUT_RELOCo(chan, srcbo,
NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RELOCo(chan, dstbo,
@@ -845,7 +893,7 @@ nv04_copy_m2mf_body(struct nv04_2d_context *ctx, struct nouveau_bo* dstbo, int*
fprintf(stderr, "\t\t\tCOPY_M2MF_BODY [%i, %i] <%i[%u]> lin %u <- <%i[%u]> lin %u\n", size, lines, dstbo->handle, *pdstoff, dstpitch, srcbo->handle, *psrcoff, srcpitch);
#endif
- BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8);
+ BEGIN_RING(chan, m2mf, NV04_M2MF_OFFSET_IN, 8);
OUT_RELOCl(chan, srcbo, *psrcoff,
NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD);
OUT_RELOCl(chan, dstbo, *pdstoff,
@@ -949,11 +997,12 @@ nv04_region_copy_m2mf(struct nv04_2d_context *ctx, struct nv04_region *dst, stru
}
static inline void
-nv04_region_copy_blit(struct nv04_2d_context *ctx, struct nv04_region* dst, struct nv04_region* src, int w, int h, int format)
+nv04_region_copy_blit(struct nv04_2d_context *ctx, struct nv04_region* dst, struct nv04_region* src, int w, int h)
{
struct nouveau_channel *chan = ctx->surf2d->channel;
struct nouveau_grobj *surf2d = ctx->surf2d;
struct nouveau_grobj *blit = ctx->blit;
+ int cs2d_format = nv04_region_cs2d_format(dst);
#ifdef NV04_REGION_DEBUG
fprintf(stderr, "\tRGN_COPY_BLIT [%i, %i: %i] ", w, h, dst->bpps);
@@ -974,7 +1023,7 @@ nv04_region_copy_blit(struct nv04_2d_context *ctx, struct nv04_region* dst, stru
OUT_RELOCo(chan, src->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RELOCo(chan, dst->bo, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
BEGIN_RING(chan, surf2d, NV04_CONTEXT_SURFACES_2D_FORMAT, 4);
- OUT_RING (chan, format);
+ OUT_RING (chan, cs2d_format);
OUT_RING (chan, (dst->pitch << 16) | src->pitch);
OUT_RELOCl(chan, src->bo, src->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD);
OUT_RELOCl(chan, dst->bo, dst->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_WR);
@@ -1001,12 +1050,12 @@ nv04_region_copy_blit(struct nv04_2d_context *ctx, struct nv04_region* dst, stru
// dst and src may be modified, and the possibly modified version should be passed to nv04_region_cpu if necessary
int
nv04_region_copy_2d(struct nv04_2d_context *ctx, struct nv04_region* dst, struct nv04_region* src,
- int w, int h, int cs2d_format, int sifm_format, int dst_to_gpu, int src_on_gpu)
+ int w, int h, int dst_to_gpu, int src_on_gpu)
{
assert(src->bpps == dst->bpps);
#ifdef NV04_REGION_DEBUG
- fprintf(stderr, "RGN_COPY%s [%i, %i: %i] ", (cs2d_format >= 0) ? "_2D" : "_NO2D", w, h, dst->bpps);
+ fprintf(stderr, "RGN_COPY [%i, %i: %i] ", w, h, dst->bpps);
for(int i = 0; i < 2; ++i)
{
int gpu = i ? src_on_gpu : dst_to_gpu;
@@ -1059,7 +1108,7 @@ nv04_region_copy_2d(struct nv04_2d_context *ctx, struct nv04_region* dst, struct
{
if (!dst->pitch)
{
- if(cs2d_format < 0 || sifm_format < 0 || !dst_to_gpu)
+ if(!dst_to_gpu)
{
#ifdef NV04_REGION_DEBUG
fprintf(stderr, "\tCOPY_ENG3D\n");
@@ -1070,25 +1119,29 @@ nv04_region_copy_2d(struct nv04_2d_context *ctx, struct nv04_region* dst, struct
{
assert(!nv04_region_align(dst, w, h, 6));
- nv04_region_copy_swizzle(ctx, dst, src, w, h, cs2d_format, sifm_format);
+ nv04_region_copy_swizzle(ctx, dst, src, w, h);
return 0;
}
}
else
{
/* NV_CONTEXT_SURFACES_2D has buffer alignment restrictions, fallback
- * to NV_MEMORY_TO_MEMORY_FORMAT in this case.
+ * to NV_M2MF in this case.
* TODO: is this also true for the source? possibly not
+ * TODO: should we just always use m2mf?
+ * TODO: if not, add support for multiple operations to copy_blit
*/
- if ((cs2d_format < 0)
- || !dst_to_gpu
+ if (!dst_to_gpu
+ || w > 2047
+ || h > 2047
+ || (w & 1)
|| nv04_region_align(src, w, h, 6)
|| nv04_region_align(dst, w, h, 6)
)
nv04_region_copy_m2mf(ctx, dst, src, w, h);
else
- nv04_region_copy_blit(ctx, dst, src, w, h, cs2d_format);
+ nv04_region_copy_blit(ctx, dst, src, w, h);
return 0;
}
@@ -1110,26 +1163,25 @@ nv04_region_fill_gdirect(struct nv04_2d_context *ctx, struct nv04_region* dst, i
assert(!(dst->pitch & 63) && dst->pitch);
nv04_region_assert(dst, w, h);
- if(dst->bpps == 0)
+ switch(dst->bpps)
{
+ case 0:
gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8;
cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y8;
- }
- else if(dst->bpps == 1)
- {
+ break;
+ case 1:
gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5;
cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y16;
- }
- else if(dst->bpps == 2)
- {
+ break;
+ case 2:
gdirect_format = NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8;
cs2d_format = NV04_CONTEXT_SURFACES_2D_FORMAT_Y32;
- }
- else
- {
+ break;
+ default:
assert(0);
gdirect_format = 0;
cs2d_format = 0;
+ break;
}
MARK_RING (chan, 15, 4);
@@ -1225,7 +1277,7 @@ nv04_2d_context_init(struct nouveau_channel* chan)
return NULL;
}
- BEGIN_RING(chan, ctx->m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY, 1);
+ BEGIN_RING(chan, ctx->m2mf, NV04_M2MF_DMA_NOTIFY, 1);
OUT_RING (chan, ctx->ntfy->handle);
if (chan->device->chipset < 0x10)
@@ -1247,7 +1299,7 @@ nv04_2d_context_init(struct nouveau_channel* chan)
if (chan->device->chipset < 0x10)
class = NV04_IMAGE_BLIT;
else
- class = NV12_IMAGE_BLIT;
+ class = NV11_IMAGE_BLIT;
ret = nouveau_grobj_alloc(chan, handle++, class, &ctx->blit);
if (ret) {
@@ -1257,7 +1309,7 @@ nv04_2d_context_init(struct nouveau_channel* chan)
BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_DMA_NOTIFY, 1);
OUT_RING (chan, ctx->ntfy->handle);
- BEGIN_RING(chan, ctx->blit, NV04_IMAGE_BLIT_SURFACE, 1);
+ BEGIN_RING(chan, ctx->blit, NV04_IMAGE_BLIT_SURFACES, 1);
OUT_RING (chan, ctx->surf2d->handle);
BEGIN_RING(chan, ctx->blit, NV01_IMAGE_BLIT_OPERATION, 1);
OUT_RING (chan, NV01_IMAGE_BLIT_OPERATION_SRCCOPY);
@@ -1285,7 +1337,7 @@ nv04_2d_context_init(struct nouveau_channel* chan)
class = NV04_SWIZZLED_SURFACE;
break;
case 0x20:
- class = NV20_SWIZZLED_SURFACE;
+ class = NV11_SWIZZLED_SURFACE;
break;
case 0x30:
class = NV30_SWIZZLED_SURFACE;
diff --git a/src/gallium/drivers/nvfx/nv04_2d.h b/src/gallium/drivers/nvfx/nv04_2d.h
index e638b8c874..00ee5bc0b2 100644
--- a/src/gallium/drivers/nvfx/nv04_2d.h
+++ b/src/gallium/drivers/nvfx/nv04_2d.h
@@ -43,10 +43,31 @@ struct nv04_region {
int offset;
unsigned pitch; // 0 -> swizzled
unsigned bpps; // bpp shift (0, 1, 2; 3, 4 for fp/compressed)
+ unsigned one_bits; // number of high bits read and written as ones (for "no-alpha" optimization)
unsigned x, y, z;
unsigned w, h, d;
};
+static inline void
+nv04_region_try_to_linearize(struct nv04_region* rgn)
+{
+ assert(!rgn->pitch);
+
+ if(rgn->d <= 1)
+ {
+ if(rgn->h <= 1 || rgn->w <= 2)
+ rgn->pitch = rgn->w << rgn->bpps;
+ }
+ else
+ {
+ if(rgn->h <= 2 && rgn->w <= 2)
+ {
+ rgn->pitch = rgn->w << rgn->bpps;
+ rgn->offset += rgn->z * rgn->h * rgn->pitch;
+ }
+ }
+}
+
void
nv04_memcpy(struct nv04_2d_context *ctx,
struct nouveau_bo* dstbo, int dstoff,
@@ -75,7 +96,6 @@ int
nv04_region_copy_2d(struct nv04_2d_context *ctx,
struct nv04_region* dst, struct nv04_region* src,
int w, int h,
- int cs2d_format, int sifm_format,
int dst_to_gpu, int src_on_gpu);
int
diff --git a/src/gallium/drivers/nvfx/nv30-40_3d.xml.h b/src/gallium/drivers/nvfx/nv30-40_3d.xml.h
new file mode 100644
index 0000000000..a705a6bd3f
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nv30-40_3d.xml.h
@@ -0,0 +1,2022 @@
+#ifndef NV30_40_3D_XML
+#define NV30_40_3D_XML
+
+/* Autogenerated file, DO NOT EDIT manually!
+
+This file was generated by the rules-ng-ng headergen tool in this git repository:
+http://0x04.net/cgit/index.cgi/rules-ng-ng
+git clone git://0x04.net/rules-ng-ng
+
+The rules-ng-ng source files this header was generated from are:
+- nv30-40_3d.xml ( 31709 bytes, from 2010-09-05 08:00:50)
+- copyright.xml ( 6503 bytes, from 2010-04-10 23:15:50)
+- nv_3ddefs.xml ( 15391 bytes, from 2010-09-05 08:00:46)
+- nv_defs.xml ( 4437 bytes, from 2010-08-05 19:38:53)
+- nv_object.xml ( 10424 bytes, from 2010-08-05 19:38:53)
+- nvchipsets.xml ( 2824 bytes, from 2010-08-05 19:38:53)
+
+Copyright (C) 2006-2010 by the following authors:
+- Artur Huillet <arthur.huillet@free.fr> (ahuillet)
+- Ben Skeggs (darktama, darktama_)
+- B. R. <koala_br@users.sourceforge.net> (koala_br)
+- Carlos Martin <carlosmn@users.sf.net> (carlosmn)
+- Christoph Bumiller <e0425955@student.tuwien.ac.at> (calim, chrisbmr)
+- Dawid Gajownik <gajownik@users.sf.net> (gajownik)
+- Dmitry Baryshkov
+- Dmitry Eremin-Solenikov <lumag@users.sf.net> (lumag)
+- EdB <edb_@users.sf.net> (edb_)
+- Erik Waling <erikwailing@users.sf.net> (erikwaling)
+- Francisco Jerez <currojerez@riseup.net> (curro, curro_, currojerez)
+- imirkin <imirkin@users.sf.net> (imirkin)
+- jb17bsome <jb17bsome@bellsouth.net> (jb17bsome)
+- Jeremy Kolb <kjeremy@users.sf.net> (kjeremy)
+- Laurent Carlier <lordheavym@gmail.com> (lordheavy)
+- Luca Barbieri <luca@luca-barbieri.com> (lb, lb1)
+- Maarten Maathuis <madman2003@gmail.com> (stillunknown)
+- Marcin Kościelnicki <koriakin@0x04.net> (mwk, koriakin)
+- Mark Carey <mark.carey@gmail.com> (careym)
+- Matthieu Castet <matthieu.castet@parrot.com> (mat-c)
+- nvidiaman <nvidiaman@users.sf.net> (nvidiaman)
+- Patrice Mandin <mandin.patrice@orange.fr> (pmandin, pmdata)
+- Pekka Paalanen <pq@iki.fi> (pq, ppaalanen)
+- Peter Popov <ironpeter@users.sf.net> (ironpeter)
+- Richard Hughes <hughsient@users.sf.net> (hughsient)
+- Rudi Cilibrasi <cilibrar@users.sf.net> (cilibrar)
+- Serge Martin
+- Simon Raffeiner
+- Stephane Loeuillet <leroutier@users.sf.net> (leroutier)
+- Stephane Marchesin <stephane.marchesin@gmail.com> (marcheu)
+- sturmflut <sturmflut@users.sf.net> (sturmflut)
+- Sylvain Munaut <tnt@246tNt.com>
+- Victor Stinner <victor.stinner@haypocalc.com> (haypo)
+- Wladmir van der Laan <laanwj@gmail.com> (miathan6)
+- Younes Manton <younes.m@gmail.com> (ymanton)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+
+
+#define NV30_3D_DMA_NOTIFY 0x00000180
+
+#define NV30_3D_DMA_TEXTURE0 0x00000184
+
+#define NV30_3D_DMA_TEXTURE1 0x00000188
+
+#define NV30_3D_DMA_COLOR1 0x0000018c
+
+#define NV30_3D_DMA_UNK190 0x00000190
+
+#define NV30_3D_DMA_COLOR0 0x00000194
+
+#define NV30_3D_DMA_ZETA 0x00000198
+
+#define NV30_3D_DMA_VTXBUF0 0x0000019c
+
+#define NV30_3D_DMA_VTXBUF1 0x000001a0
+
+#define NV30_3D_DMA_FENCE 0x000001a4
+
+#define NV30_3D_DMA_QUERY 0x000001a8
+
+#define NV30_3D_DMA_UNK1AC 0x000001ac
+
+#define NV30_3D_DMA_UNK1B0 0x000001b0
+
+#define NV40_3D_DMA_COLOR2 0x000001b4
+
+#define NV40_3D_DMA_COLOR3 0x000001b8
+
+#define NV30_3D_RT_HORIZ 0x00000200
+#define NV30_3D_RT_HORIZ_X__MASK 0x0000ffff
+#define NV30_3D_RT_HORIZ_X__SHIFT 0
+#define NV30_3D_RT_HORIZ_W__MASK 0xffff0000
+#define NV30_3D_RT_HORIZ_W__SHIFT 16
+
+#define NV30_3D_RT_VERT 0x00000204
+#define NV30_3D_RT_VERT_Y__MASK 0x0000ffff
+#define NV30_3D_RT_VERT_Y__SHIFT 0
+#define NV30_3D_RT_VERT_H__MASK 0xffff0000
+#define NV30_3D_RT_VERT_H__SHIFT 16
+
+#define NV30_3D_RT_FORMAT 0x00000208
+#define NV30_3D_RT_FORMAT_COLOR__MASK 0x0000001f
+#define NV30_3D_RT_FORMAT_COLOR__SHIFT 0
+#define NV30_3D_RT_FORMAT_COLOR_R5G6B5 0x00000003
+#define NV30_3D_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
+#define NV30_3D_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
+#define NV30_3D_RT_FORMAT_COLOR_B8 0x00000009
+#define NV30_3D_RT_FORMAT_COLOR_A16B16G16R16_FLOAT 0x0000000b
+#define NV30_3D_RT_FORMAT_COLOR_A32B32G32R32_FLOAT 0x0000000c
+#define NV30_3D_RT_FORMAT_COLOR_R32_FLOAT 0x0000000d
+#define NV30_3D_RT_FORMAT_COLOR_UNK0D 0x0000000d
+#define NV30_3D_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
+#define NV30_3D_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
+#define NV30_3D_RT_FORMAT_ZETA__MASK 0x000000e0
+#define NV30_3D_RT_FORMAT_ZETA__SHIFT 5
+#define NV30_3D_RT_FORMAT_ZETA_Z16 0x00000020
+#define NV30_3D_RT_FORMAT_ZETA_Z24S8 0x00000040
+#define NV30_3D_RT_FORMAT_TYPE__MASK 0x00000f00
+#define NV30_3D_RT_FORMAT_TYPE__SHIFT 8
+#define NV30_3D_RT_FORMAT_TYPE_LINEAR 0x00000100
+#define NV30_3D_RT_FORMAT_TYPE_SWIZZLED 0x00000200
+#define NV30_3D_RT_FORMAT_LOG2_WIDTH__MASK 0x00ff0000
+#define NV30_3D_RT_FORMAT_LOG2_WIDTH__SHIFT 16
+#define NV30_3D_RT_FORMAT_LOG2_HEIGHT__MASK 0xff000000
+#define NV30_3D_RT_FORMAT_LOG2_HEIGHT__SHIFT 24
+
+#define NV30_3D_COLOR0_PITCH 0x0000020c
+#define NV30_3D_COLOR0_PITCH_COLOR0__MASK 0x0000ffff
+#define NV30_3D_COLOR0_PITCH_COLOR0__SHIFT 0
+#define NV30_3D_COLOR0_PITCH_ZETA__MASK 0xffff0000
+#define NV30_3D_COLOR0_PITCH_ZETA__SHIFT 16
+
+#define NV40_3D_COLOR0_PITCH 0x0000020c
+
+#define NV30_3D_COLOR0_OFFSET 0x00000210
+
+#define NV30_3D_ZETA_OFFSET 0x00000214
+
+#define NV30_3D_COLOR1_OFFSET 0x00000218
+
+#define NV30_3D_COLOR1_PITCH 0x0000021c
+
+#define NV30_3D_RT_ENABLE 0x00000220
+#define NV30_3D_RT_ENABLE_COLOR0 0x00000001
+#define NV30_3D_RT_ENABLE_COLOR1 0x00000002
+#define NV40_3D_RT_ENABLE_COLOR2 0x00000004
+#define NV40_3D_RT_ENABLE_COLOR3 0x00000008
+#define NV30_3D_RT_ENABLE_MRT 0x00000010
+
+#define NV40_3D_ZETA_PITCH 0x0000022c
+
+#define NV30_3D_LMA_DEPTH_PITCH 0x0000022c
+
+#define NV30_3D_LMA_DEPTH_OFFSET 0x00000230
+
+#define NV30_3D_TEX_UNITS_ENABLE 0x0000023c
+#define NV30_3D_TEX_UNITS_ENABLE_TX0 0x00000001
+#define NV30_3D_TEX_UNITS_ENABLE_TX1 0x00000002
+#define NV30_3D_TEX_UNITS_ENABLE_TX2 0x00000004
+#define NV30_3D_TEX_UNITS_ENABLE_TX3 0x00000008
+#define NV30_3D_TEX_UNITS_ENABLE_TX4 0x00000010
+#define NV30_3D_TEX_UNITS_ENABLE_TX5 0x00000020
+#define NV30_3D_TEX_UNITS_ENABLE_TX6 0x00000040
+#define NV30_3D_TEX_UNITS_ENABLE_TX7 0x00000080
+
+#define NV30_3D_TEX_MATRIX_ENABLE(i0) (0x00000240 + 0x4*(i0))
+#define NV30_3D_TEX_MATRIX_ENABLE__ESIZE 0x00000004
+#define NV30_3D_TEX_MATRIX_ENABLE__LEN 0x00000008
+
+#define NV40_3D_COLOR2_PITCH 0x00000280
+
+#define NV40_3D_COLOR3_PITCH 0x00000284
+
+#define NV40_3D_COLOR2_OFFSET 0x00000288
+
+#define NV40_3D_COLOR3_OFFSET 0x0000028c
+
+#define NV30_3D_VIEWPORT_TX_ORIGIN 0x000002b8
+#define NV30_3D_VIEWPORT_TX_ORIGIN_X__MASK 0x0000ffff
+#define NV30_3D_VIEWPORT_TX_ORIGIN_X__SHIFT 0
+#define NV30_3D_VIEWPORT_TX_ORIGIN_Y__MASK 0xffff0000
+#define NV30_3D_VIEWPORT_TX_ORIGIN_Y__SHIFT 16
+
+#define NV30_3D_VIEWPORT_CLIP_MODE 0x000002bc
+
+#define NV30_3D_VIEWPORT_CLIP_HORIZ(i0) (0x000002c0 + 0x8*(i0))
+#define NV30_3D_VIEWPORT_CLIP_HORIZ__ESIZE 0x00000008
+#define NV30_3D_VIEWPORT_CLIP_HORIZ__LEN 0x00000008
+#define NV30_3D_VIEWPORT_CLIP_HORIZ_L__MASK 0x0000ffff
+#define NV30_3D_VIEWPORT_CLIP_HORIZ_L__SHIFT 0
+#define NV30_3D_VIEWPORT_CLIP_HORIZ_R__MASK 0xffff0000
+#define NV30_3D_VIEWPORT_CLIP_HORIZ_R__SHIFT 16
+
+#define NV30_3D_VIEWPORT_CLIP_VERT(i0) (0x000002c4 + 0x8*(i0))
+#define NV30_3D_VIEWPORT_CLIP_VERT__ESIZE 0x00000008
+#define NV30_3D_VIEWPORT_CLIP_VERT__LEN 0x00000008
+#define NV30_3D_VIEWPORT_CLIP_VERT_T__MASK 0x0000ffff
+#define NV30_3D_VIEWPORT_CLIP_VERT_T__SHIFT 0
+#define NV30_3D_VIEWPORT_CLIP_VERT_D__MASK 0xffff0000
+#define NV30_3D_VIEWPORT_CLIP_VERT_D__SHIFT 16
+
+#define NV30_3D_DITHER_ENABLE 0x00000300
+
+#define NV30_3D_ALPHA_FUNC_ENABLE 0x00000304
+
+#define NV30_3D_ALPHA_FUNC_FUNC 0x00000308
+#define NV30_3D_ALPHA_FUNC_FUNC_NEVER 0x00000200
+#define NV30_3D_ALPHA_FUNC_FUNC_LESS 0x00000201
+#define NV30_3D_ALPHA_FUNC_FUNC_EQUAL 0x00000202
+#define NV30_3D_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
+#define NV30_3D_ALPHA_FUNC_FUNC_GREATER 0x00000204
+#define NV30_3D_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV30_3D_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
+#define NV30_3D_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
+
+#define NV30_3D_ALPHA_FUNC_REF 0x0000030c
+
+#define NV30_3D_BLEND_FUNC_ENABLE 0x00000310
+
+#define NV30_3D_BLEND_FUNC_SRC 0x00000314
+#define NV30_3D_BLEND_FUNC_SRC_RGB__MASK 0x0000ffff
+#define NV30_3D_BLEND_FUNC_SRC_RGB__SHIFT 0
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ZERO 0x00000000
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE 0x00000001
+#define NV30_3D_BLEND_FUNC_SRC_RGB_SRC_COLOR 0x00000300
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV30_3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA 0x00000302
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV30_3D_BLEND_FUNC_SRC_RGB_DST_ALPHA 0x00000304
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV30_3D_BLEND_FUNC_SRC_RGB_DST_COLOR 0x00000306
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_DST_COLOR 0x00000307
+#define NV30_3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA_SATURATE 0x00000308
+#define NV30_3D_BLEND_FUNC_SRC_RGB_CONSTANT_COLOR 0x00008001
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV30_3D_BLEND_FUNC_SRC_RGB_CONSTANT_ALPHA 0x00008003
+#define NV30_3D_BLEND_FUNC_SRC_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA__MASK 0xffff0000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA__SHIFT 16
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ZERO 0x00000000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE 0x00010000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_SRC_COLOR 0x03000000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA 0x03020000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_DST_ALPHA 0x03040000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_DST_COLOR 0x03060000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA_SATURATE 0x03080000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_CONSTANT_COLOR 0x80010000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_CONSTANT_ALPHA 0x80030000
+#define NV30_3D_BLEND_FUNC_SRC_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
+
+#define NV30_3D_BLEND_FUNC_DST 0x00000318
+#define NV30_3D_BLEND_FUNC_DST_RGB__MASK 0x0000ffff
+#define NV30_3D_BLEND_FUNC_DST_RGB__SHIFT 0
+#define NV30_3D_BLEND_FUNC_DST_RGB_ZERO 0x00000000
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE 0x00000001
+#define NV30_3D_BLEND_FUNC_DST_RGB_SRC_COLOR 0x00000300
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV30_3D_BLEND_FUNC_DST_RGB_SRC_ALPHA 0x00000302
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV30_3D_BLEND_FUNC_DST_RGB_DST_ALPHA 0x00000304
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV30_3D_BLEND_FUNC_DST_RGB_DST_COLOR 0x00000306
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_DST_COLOR 0x00000307
+#define NV30_3D_BLEND_FUNC_DST_RGB_SRC_ALPHA_SATURATE 0x00000308
+#define NV30_3D_BLEND_FUNC_DST_RGB_CONSTANT_COLOR 0x00008001
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV30_3D_BLEND_FUNC_DST_RGB_CONSTANT_ALPHA 0x00008003
+#define NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV30_3D_BLEND_FUNC_DST_ALPHA__MASK 0xffff0000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA__SHIFT 16
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ZERO 0x00000000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE 0x00010000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_SRC_COLOR 0x03000000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_COLOR 0x03010000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_SRC_ALPHA 0x03020000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_SRC_ALPHA 0x03030000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_DST_ALPHA 0x03040000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_ALPHA 0x03050000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_DST_COLOR 0x03060000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_DST_COLOR 0x03070000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_SRC_ALPHA_SATURATE 0x03080000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_CONSTANT_COLOR 0x80010000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_COLOR 0x80020000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_CONSTANT_ALPHA 0x80030000
+#define NV30_3D_BLEND_FUNC_DST_ALPHA_ONE_MINUS_CONSTANT_ALPHA 0x80040000
+
+#define NV30_3D_BLEND_COLOR 0x0000031c
+#define NV30_3D_BLEND_COLOR_B__MASK 0x000000ff
+#define NV30_3D_BLEND_COLOR_B__SHIFT 0
+#define NV30_3D_BLEND_COLOR_G__MASK 0x0000ff00
+#define NV30_3D_BLEND_COLOR_G__SHIFT 8
+#define NV30_3D_BLEND_COLOR_R__MASK 0x00ff0000
+#define NV30_3D_BLEND_COLOR_R__SHIFT 16
+#define NV30_3D_BLEND_COLOR_A__MASK 0xff000000
+#define NV30_3D_BLEND_COLOR_A__SHIFT 24
+
+#define NV30_3D_BLEND_EQUATION 0x00000320
+#define NV30_3D_BLEND_EQUATION_FUNC_ADD 0x00008006
+#define NV30_3D_BLEND_EQUATION_MIN 0x00008007
+#define NV30_3D_BLEND_EQUATION_MAX 0x00008008
+#define NV30_3D_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
+#define NV30_3D_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
+
+#define NV40_3D_BLEND_EQUATION 0x00000320
+#define NV40_3D_BLEND_EQUATION_RGB__MASK 0x0000ffff
+#define NV40_3D_BLEND_EQUATION_RGB__SHIFT 0
+#define NV40_3D_BLEND_EQUATION_RGB_FUNC_ADD 0x00008006
+#define NV40_3D_BLEND_EQUATION_RGB_MIN 0x00008007
+#define NV40_3D_BLEND_EQUATION_RGB_MAX 0x00008008
+#define NV40_3D_BLEND_EQUATION_RGB_FUNC_SUBTRACT 0x0000800a
+#define NV40_3D_BLEND_EQUATION_RGB_FUNC_REVERSE_SUBTRACT 0x0000800b
+#define NV40_3D_BLEND_EQUATION_ALPHA__MASK 0xffff0000
+#define NV40_3D_BLEND_EQUATION_ALPHA__SHIFT 16
+#define NV40_3D_BLEND_EQUATION_ALPHA_FUNC_ADD 0x80060000
+#define NV40_3D_BLEND_EQUATION_ALPHA_MIN 0x80070000
+#define NV40_3D_BLEND_EQUATION_ALPHA_MAX 0x80080000
+#define NV40_3D_BLEND_EQUATION_ALPHA_FUNC_SUBTRACT 0x800a0000
+#define NV40_3D_BLEND_EQUATION_ALPHA_FUNC_REVERSE_SUBTRACT 0x800b0000
+
+#define NV30_3D_COLOR_MASK 0x00000324
+#define NV30_3D_COLOR_MASK_B 0x000000ff
+#define NV30_3D_COLOR_MASK_G 0x0000ff00
+#define NV30_3D_COLOR_MASK_R 0x00ff0000
+#define NV30_3D_COLOR_MASK_A 0xff000000
+
+#define NV30_3D_STENCIL(i0) (0x00000328 + 0x20*(i0))
+#define NV30_3D_STENCIL__ESIZE 0x00000020
+#define NV30_3D_STENCIL__LEN 0x00000002
+
+#define NV30_3D_STENCIL_ENABLE(i0) (0x00000328 + 0x20*(i0))
+
+#define NV30_3D_STENCIL_MASK(i0) (0x0000032c + 0x20*(i0))
+
+#define NV30_3D_STENCIL_FUNC_FUNC(i0) (0x00000330 + 0x20*(i0))
+#define NV30_3D_STENCIL_FUNC_FUNC_NEVER 0x00000200
+#define NV30_3D_STENCIL_FUNC_FUNC_LESS 0x00000201
+#define NV30_3D_STENCIL_FUNC_FUNC_EQUAL 0x00000202
+#define NV30_3D_STENCIL_FUNC_FUNC_LEQUAL 0x00000203
+#define NV30_3D_STENCIL_FUNC_FUNC_GREATER 0x00000204
+#define NV30_3D_STENCIL_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV30_3D_STENCIL_FUNC_FUNC_GEQUAL 0x00000206
+#define NV30_3D_STENCIL_FUNC_FUNC_ALWAYS 0x00000207
+
+#define NV30_3D_STENCIL_FUNC_REF(i0) (0x00000334 + 0x20*(i0))
+
+#define NV30_3D_STENCIL_FUNC_MASK(i0) (0x00000338 + 0x20*(i0))
+
+#define NV30_3D_STENCIL_OP_FAIL(i0) (0x0000033c + 0x20*(i0))
+#define NV30_3D_STENCIL_OP_FAIL_ZERO 0x00000000
+#define NV30_3D_STENCIL_OP_FAIL_INVERT 0x0000150a
+#define NV30_3D_STENCIL_OP_FAIL_KEEP 0x00001e00
+#define NV30_3D_STENCIL_OP_FAIL_REPLACE 0x00001e01
+#define NV30_3D_STENCIL_OP_FAIL_INCR 0x00001e02
+#define NV30_3D_STENCIL_OP_FAIL_DECR 0x00001e03
+#define NV30_3D_STENCIL_OP_FAIL_INCR_WRAP 0x00008507
+#define NV30_3D_STENCIL_OP_FAIL_DECR_WRAP 0x00008508
+
+#define NV30_3D_STENCIL_OP_ZFAIL(i0) (0x00000340 + 0x20*(i0))
+#define NV30_3D_STENCIL_OP_ZFAIL_ZERO 0x00000000
+#define NV30_3D_STENCIL_OP_ZFAIL_INVERT 0x0000150a
+#define NV30_3D_STENCIL_OP_ZFAIL_KEEP 0x00001e00
+#define NV30_3D_STENCIL_OP_ZFAIL_REPLACE 0x00001e01
+#define NV30_3D_STENCIL_OP_ZFAIL_INCR 0x00001e02
+#define NV30_3D_STENCIL_OP_ZFAIL_DECR 0x00001e03
+#define NV30_3D_STENCIL_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NV30_3D_STENCIL_OP_ZFAIL_DECR_WRAP 0x00008508
+
+#define NV30_3D_STENCIL_OP_ZPASS(i0) (0x00000344 + 0x20*(i0))
+#define NV30_3D_STENCIL_OP_ZPASS_ZERO 0x00000000
+#define NV30_3D_STENCIL_OP_ZPASS_INVERT 0x0000150a
+#define NV30_3D_STENCIL_OP_ZPASS_KEEP 0x00001e00
+#define NV30_3D_STENCIL_OP_ZPASS_REPLACE 0x00001e01
+#define NV30_3D_STENCIL_OP_ZPASS_INCR 0x00001e02
+#define NV30_3D_STENCIL_OP_ZPASS_DECR 0x00001e03
+#define NV30_3D_STENCIL_OP_ZPASS_INCR_WRAP 0x00008507
+#define NV30_3D_STENCIL_OP_ZPASS_DECR_WRAP 0x00008508
+
+#define NV30_3D_SHADE_MODEL 0x00000368
+#define NV30_3D_SHADE_MODEL_FLAT 0x00001d00
+#define NV30_3D_SHADE_MODEL_SMOOTH 0x00001d01
+
+#define NV30_3D_FOG_ENABLE 0x0000036c
+
+#define NV30_3D_FOG_COLOR 0x00000370
+#define NV30_3D_FOG_COLOR_R__MASK 0x000000ff
+#define NV30_3D_FOG_COLOR_R__SHIFT 0
+#define NV30_3D_FOG_COLOR_G__MASK 0x0000ff00
+#define NV30_3D_FOG_COLOR_G__SHIFT 8
+#define NV30_3D_FOG_COLOR_B__MASK 0x00ff0000
+#define NV30_3D_FOG_COLOR_B__SHIFT 16
+#define NV30_3D_FOG_COLOR_A__MASK 0xff000000
+#define NV30_3D_FOG_COLOR_A__SHIFT 24
+
+#define NV40_3D_MRT_COLOR_MASK 0x00000370
+#define NV40_3D_MRT_COLOR_MASK_BUFFER1_A 0x00000010
+#define NV40_3D_MRT_COLOR_MASK_BUFFER1_R 0x00000020
+#define NV40_3D_MRT_COLOR_MASK_BUFFER1_G 0x00000040
+#define NV40_3D_MRT_COLOR_MASK_BUFFER1_B 0x00000080
+#define NV40_3D_MRT_COLOR_MASK_BUFFER2_A 0x00000100
+#define NV40_3D_MRT_COLOR_MASK_BUFFER2_R 0x00000200
+#define NV40_3D_MRT_COLOR_MASK_BUFFER2_G 0x00000400
+#define NV40_3D_MRT_COLOR_MASK_BUFFER2_B 0x00000800
+#define NV40_3D_MRT_COLOR_MASK_BUFFER3_A 0x00001000
+#define NV40_3D_MRT_COLOR_MASK_BUFFER3_R 0x00002000
+#define NV40_3D_MRT_COLOR_MASK_BUFFER3_G 0x00004000
+#define NV40_3D_MRT_COLOR_MASK_BUFFER3_B 0x00008000
+
+#define NV30_3D_COLOR_LOGIC_OP_ENABLE 0x00000374
+
+#define NV30_3D_COLOR_LOGIC_OP_OP 0x00000378
+#define NV30_3D_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
+#define NV30_3D_COLOR_LOGIC_OP_OP_AND 0x00001501
+#define NV30_3D_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
+#define NV30_3D_COLOR_LOGIC_OP_OP_COPY 0x00001503
+#define NV30_3D_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
+#define NV30_3D_COLOR_LOGIC_OP_OP_NOOP 0x00001505
+#define NV30_3D_COLOR_LOGIC_OP_OP_XOR 0x00001506
+#define NV30_3D_COLOR_LOGIC_OP_OP_OR 0x00001507
+#define NV30_3D_COLOR_LOGIC_OP_OP_NOR 0x00001508
+#define NV30_3D_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
+#define NV30_3D_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
+#define NV30_3D_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
+#define NV30_3D_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
+#define NV30_3D_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
+#define NV30_3D_COLOR_LOGIC_OP_OP_NAND 0x0000150e
+#define NV30_3D_COLOR_LOGIC_OP_OP_SET 0x0000150f
+
+#define NV30_3D_NORMALIZE_ENABLE 0x0000037c
+
+#define NV30_3D_COLOR_MATERIAL 0x00000390
+#define NV30_3D_COLOR_MATERIAL_FRONT_EMISSION_ENABLE 0x00000001
+#define NV30_3D_COLOR_MATERIAL_FRONT_AMBIENT_ENABLE 0x00000004
+#define NV30_3D_COLOR_MATERIAL_FRONT_DIFFUSE_ENABLE 0x00000010
+#define NV30_3D_COLOR_MATERIAL_FRONT_SPECULAR_ENABLE 0x00000040
+#define NV30_3D_COLOR_MATERIAL_BACK_EMISSION_ENABLE 0x00000100
+#define NV30_3D_COLOR_MATERIAL_BACK_AMBIENT_ENABLE 0x00000400
+#define NV30_3D_COLOR_MATERIAL_BACK_DIFFUSE_ENABLE 0x00001000
+#define NV30_3D_COLOR_MATERIAL_BACK_SPECULAR_ENABLE 0x00004000
+
+#define NV30_3D_DEPTH_RANGE_NEAR 0x00000394
+
+#define NV30_3D_DEPTH_RANGE_FAR 0x00000398
+
+#define NV30_3D_COLOR_MATERIAL_FRONT 0x000003a0
+
+
+#define NV30_3D_COLOR_MATERIAL_FRONT_R 0x000003a0
+
+#define NV30_3D_COLOR_MATERIAL_FRONT_G 0x000003a4
+
+#define NV30_3D_COLOR_MATERIAL_FRONT_B 0x000003a8
+
+#define NV30_3D_COLOR_MATERIAL_FRONT_A 0x000003ac
+
+#define NV40_3D_MIPMAP_ROUNDING 0x000003b0
+#define NV40_3D_MIPMAP_ROUNDING_MODE__MASK 0x00100000
+#define NV40_3D_MIPMAP_ROUNDING_MODE__SHIFT 20
+#define NV40_3D_MIPMAP_ROUNDING_MODE_UP 0x00000000
+#define NV40_3D_MIPMAP_ROUNDING_MODE_DOWN 0x00100000
+
+#define NV30_3D_LINE_WIDTH 0x000003b8
+
+#define NV30_3D_LINE_SMOOTH_ENABLE 0x000003bc
+
+
+
+#define NV30_3D_TEX_GEN_MODE(i0, i1) (0x00000400 + 0x10*(i0) + 0x4*(i1))
+#define NV30_3D_TEX_GEN_MODE__ESIZE 0x00000004
+#define NV30_3D_TEX_GEN_MODE__LEN 0x00000004
+#define NV30_3D_TEX_GEN_MODE_FALSE 0x00000000
+#define NV30_3D_TEX_GEN_MODE_EYE_LINEAR 0x00002400
+#define NV30_3D_TEX_GEN_MODE_OBJECT_LINEAR 0x00002401
+#define NV30_3D_TEX_GEN_MODE_SPHERE_MAP 0x00002402
+#define NV30_3D_TEX_GEN_MODE_NORMAL_MAP 0x00008511
+#define NV30_3D_TEX_GEN_MODE_REFLECTION_MAP 0x00008512
+
+#define NV30_3D_MODELVIEW_MATRIX(i0) (0x00000480 + 0x4*(i0))
+#define NV30_3D_MODELVIEW_MATRIX__ESIZE 0x00000004
+#define NV30_3D_MODELVIEW_MATRIX__LEN 0x00000010
+
+#define NV30_3D_INVERSE_MODELVIEW_MATRIX(i0) (0x00000580 + 0x4*(i0))
+#define NV30_3D_INVERSE_MODELVIEW_MATRIX__ESIZE 0x00000004
+#define NV30_3D_INVERSE_MODELVIEW_MATRIX__LEN 0x0000000c
+
+#define NV30_3D_PROJECTION_MATRIX(i0) (0x00000680 + 0x4*(i0))
+#define NV30_3D_PROJECTION_MATRIX__ESIZE 0x00000004
+#define NV30_3D_PROJECTION_MATRIX__LEN 0x00000010
+
+
+#define NV30_3D_TEX_MATRIX(i0, i1) (0x000006c0 + 0x40*(i0) + 0x4*(i1))
+#define NV30_3D_TEX_MATRIX__ESIZE 0x00000004
+#define NV30_3D_TEX_MATRIX__LEN 0x00000010
+
+#define NV30_3D_SCISSOR_HORIZ 0x000008c0
+#define NV30_3D_SCISSOR_HORIZ_X__MASK 0x0000ffff
+#define NV30_3D_SCISSOR_HORIZ_X__SHIFT 0
+#define NV30_3D_SCISSOR_HORIZ_W__MASK 0xffff0000
+#define NV30_3D_SCISSOR_HORIZ_W__SHIFT 16
+
+#define NV30_3D_SCISSOR_VERT 0x000008c4
+#define NV30_3D_SCISSOR_VERT_Y__MASK 0x0000ffff
+#define NV30_3D_SCISSOR_VERT_Y__SHIFT 0
+#define NV30_3D_SCISSOR_VERT_H__MASK 0xffff0000
+#define NV30_3D_SCISSOR_VERT_H__SHIFT 16
+
+#define NV30_3D_FOG_COORD_DIST 0x000008c8
+
+#define NV30_3D_FOG_MODE 0x000008cc
+
+#define NV30_3D_FOG_EQUATION_CONSTANT 0x000008d0
+
+#define NV30_3D_FOG_EQUATION_LINEAR 0x000008d4
+
+#define NV30_3D_FOG_EQUATION_QUADRATIC 0x000008d8
+
+#define NV30_3D_FP_ACTIVE_PROGRAM 0x000008e4
+#define NV30_3D_FP_ACTIVE_PROGRAM_DMA0 0x00000001
+#define NV30_3D_FP_ACTIVE_PROGRAM_DMA1 0x00000002
+#define NV30_3D_FP_ACTIVE_PROGRAM_OFFSET__MASK 0xfffffffc
+#define NV30_3D_FP_ACTIVE_PROGRAM_OFFSET__SHIFT 2
+
+
+#define NV30_3D_RC_COLOR0 0x000008ec
+#define NV30_3D_RC_COLOR0_B__MASK 0x000000ff
+#define NV30_3D_RC_COLOR0_B__SHIFT 0
+#define NV30_3D_RC_COLOR0_G__MASK 0x0000ff00
+#define NV30_3D_RC_COLOR0_G__SHIFT 8
+#define NV30_3D_RC_COLOR0_R__MASK 0x00ff0000
+#define NV30_3D_RC_COLOR0_R__SHIFT 16
+#define NV30_3D_RC_COLOR0_A__MASK 0xff000000
+#define NV30_3D_RC_COLOR0_A__SHIFT 24
+
+#define NV30_3D_RC_COLOR1 0x000008f0
+#define NV30_3D_RC_COLOR1_B__MASK 0x000000ff
+#define NV30_3D_RC_COLOR1_B__SHIFT 0
+#define NV30_3D_RC_COLOR1_G__MASK 0x0000ff00
+#define NV30_3D_RC_COLOR1_G__SHIFT 8
+#define NV30_3D_RC_COLOR1_R__MASK 0x00ff0000
+#define NV30_3D_RC_COLOR1_R__SHIFT 16
+#define NV30_3D_RC_COLOR1_A__MASK 0xff000000
+#define NV30_3D_RC_COLOR1_A__SHIFT 24
+
+#define NV30_3D_RC_FINAL0 0x000008f4
+#define NV30_3D_RC_FINAL0_D_INPUT__MASK 0x0000000f
+#define NV30_3D_RC_FINAL0_D_INPUT__SHIFT 0
+#define NV30_3D_RC_FINAL0_D_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV30_3D_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV30_3D_RC_FINAL0_D_INPUT_FOG 0x00000003
+#define NV30_3D_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV30_3D_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV30_3D_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
+#define NV30_3D_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
+#define NV30_3D_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
+#define NV30_3D_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
+#define NV30_3D_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
+#define NV30_3D_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
+#define NV30_3D_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV30_3D_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
+#define NV30_3D_RC_FINAL0_D_COMPONENT_USAGE__MASK 0x00000010
+#define NV30_3D_RC_FINAL0_D_COMPONENT_USAGE__SHIFT 4
+#define NV30_3D_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV30_3D_RC_FINAL0_D_MAPPING__MASK 0x000000e0
+#define NV30_3D_RC_FINAL0_D_MAPPING__SHIFT 5
+#define NV30_3D_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV30_3D_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV30_3D_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV30_3D_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV30_3D_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV30_3D_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV30_3D_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV30_3D_RC_FINAL0_C_INPUT__MASK 0x00000f00
+#define NV30_3D_RC_FINAL0_C_INPUT__SHIFT 8
+#define NV30_3D_RC_FINAL0_C_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_FINAL0_C_INPUT_FOG 0x00000300
+#define NV30_3D_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_FINAL0_C_COMPONENT_USAGE__MASK 0x00001000
+#define NV30_3D_RC_FINAL0_C_COMPONENT_USAGE__SHIFT 12
+#define NV30_3D_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV30_3D_RC_FINAL0_C_MAPPING__MASK 0x0000e000
+#define NV30_3D_RC_FINAL0_C_MAPPING__SHIFT 13
+#define NV30_3D_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV30_3D_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV30_3D_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV30_3D_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV30_3D_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV30_3D_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV30_3D_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV30_3D_RC_FINAL0_B_INPUT__MASK 0x000f0000
+#define NV30_3D_RC_FINAL0_B_INPUT__SHIFT 16
+#define NV30_3D_RC_FINAL0_B_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV30_3D_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV30_3D_RC_FINAL0_B_INPUT_FOG 0x00030000
+#define NV30_3D_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV30_3D_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV30_3D_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
+#define NV30_3D_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
+#define NV30_3D_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
+#define NV30_3D_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
+#define NV30_3D_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
+#define NV30_3D_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
+#define NV30_3D_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV30_3D_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
+#define NV30_3D_RC_FINAL0_B_COMPONENT_USAGE__MASK 0x00100000
+#define NV30_3D_RC_FINAL0_B_COMPONENT_USAGE__SHIFT 20
+#define NV30_3D_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV30_3D_RC_FINAL0_B_MAPPING__MASK 0x00e00000
+#define NV30_3D_RC_FINAL0_B_MAPPING__SHIFT 21
+#define NV30_3D_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV30_3D_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV30_3D_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV30_3D_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV30_3D_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV30_3D_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV30_3D_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV30_3D_RC_FINAL0_A_INPUT__MASK 0x0f000000
+#define NV30_3D_RC_FINAL0_A_INPUT__SHIFT 24
+#define NV30_3D_RC_FINAL0_A_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV30_3D_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV30_3D_RC_FINAL0_A_INPUT_FOG 0x03000000
+#define NV30_3D_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV30_3D_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV30_3D_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
+#define NV30_3D_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
+#define NV30_3D_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
+#define NV30_3D_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
+#define NV30_3D_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
+#define NV30_3D_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
+#define NV30_3D_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV30_3D_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
+#define NV30_3D_RC_FINAL0_A_COMPONENT_USAGE__MASK 0x10000000
+#define NV30_3D_RC_FINAL0_A_COMPONENT_USAGE__SHIFT 28
+#define NV30_3D_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV30_3D_RC_FINAL0_A_MAPPING__MASK 0xe0000000
+#define NV30_3D_RC_FINAL0_A_MAPPING__SHIFT 29
+#define NV30_3D_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV30_3D_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
+
+#define NV30_3D_RC_FINAL1 0x000008f8
+#define NV30_3D_RC_FINAL1_COLOR_SUM_CLAMP 0x00000080
+#define NV30_3D_RC_FINAL1_G_INPUT__MASK 0x00000f00
+#define NV30_3D_RC_FINAL1_G_INPUT__SHIFT 8
+#define NV30_3D_RC_FINAL1_G_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_FINAL1_G_INPUT_FOG 0x00000300
+#define NV30_3D_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_FINAL1_G_COMPONENT_USAGE__MASK 0x00001000
+#define NV30_3D_RC_FINAL1_G_COMPONENT_USAGE__SHIFT 12
+#define NV30_3D_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV30_3D_RC_FINAL1_G_MAPPING__MASK 0x0000e000
+#define NV30_3D_RC_FINAL1_G_MAPPING__SHIFT 13
+#define NV30_3D_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV30_3D_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV30_3D_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV30_3D_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV30_3D_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV30_3D_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV30_3D_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV30_3D_RC_FINAL1_F_INPUT__MASK 0x000f0000
+#define NV30_3D_RC_FINAL1_F_INPUT__SHIFT 16
+#define NV30_3D_RC_FINAL1_F_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV30_3D_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV30_3D_RC_FINAL1_F_INPUT_FOG 0x00030000
+#define NV30_3D_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
+#define NV30_3D_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
+#define NV30_3D_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
+#define NV30_3D_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
+#define NV30_3D_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
+#define NV30_3D_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
+#define NV30_3D_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
+#define NV30_3D_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
+#define NV30_3D_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV30_3D_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
+#define NV30_3D_RC_FINAL1_F_COMPONENT_USAGE__MASK 0x00100000
+#define NV30_3D_RC_FINAL1_F_COMPONENT_USAGE__SHIFT 20
+#define NV30_3D_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV30_3D_RC_FINAL1_F_MAPPING__MASK 0x00e00000
+#define NV30_3D_RC_FINAL1_F_MAPPING__SHIFT 21
+#define NV30_3D_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV30_3D_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV30_3D_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV30_3D_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV30_3D_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV30_3D_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV30_3D_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV30_3D_RC_FINAL1_E_INPUT__MASK 0x0f000000
+#define NV30_3D_RC_FINAL1_E_INPUT__SHIFT 24
+#define NV30_3D_RC_FINAL1_E_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV30_3D_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV30_3D_RC_FINAL1_E_INPUT_FOG 0x03000000
+#define NV30_3D_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
+#define NV30_3D_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
+#define NV30_3D_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
+#define NV30_3D_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
+#define NV30_3D_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
+#define NV30_3D_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
+#define NV30_3D_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
+#define NV30_3D_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
+#define NV30_3D_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV30_3D_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
+#define NV30_3D_RC_FINAL1_E_COMPONENT_USAGE__MASK 0x10000000
+#define NV30_3D_RC_FINAL1_E_COMPONENT_USAGE__SHIFT 28
+#define NV30_3D_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV30_3D_RC_FINAL1_E_MAPPING__MASK 0xe0000000
+#define NV30_3D_RC_FINAL1_E_MAPPING__SHIFT 29
+#define NV30_3D_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV30_3D_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
+
+#define NV30_3D_RC_ENABLE 0x000008fc
+#define NV30_3D_RC_ENABLE_NUM_COMBINERS__MASK 0x0000000f
+#define NV30_3D_RC_ENABLE_NUM_COMBINERS__SHIFT 0
+#define NV30_3D_RC_ENABLE_STAGE_CONSTANT_COLOR0 0x0000f000
+#define NV30_3D_RC_ENABLE_STAGE_CONSTANT_COLOR1 0x000f0000
+
+
+#define NV30_3D_RC_IN_ALPHA(i0) (0x00000900 + 0x20*(i0))
+#define NV30_3D_RC_IN_ALPHA_D_INPUT__MASK 0x0000000f
+#define NV30_3D_RC_IN_ALPHA_D_INPUT__SHIFT 0
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV30_3D_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
+#define NV30_3D_RC_IN_ALPHA_D_COMPONENT_USAGE__MASK 0x00000010
+#define NV30_3D_RC_IN_ALPHA_D_COMPONENT_USAGE__SHIFT 4
+#define NV30_3D_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
+#define NV30_3D_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING__MASK 0x000000e0
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING__SHIFT 5
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV30_3D_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV30_3D_RC_IN_ALPHA_C_INPUT__MASK 0x00000f00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT__SHIFT 8
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_IN_ALPHA_C_COMPONENT_USAGE__MASK 0x00001000
+#define NV30_3D_RC_IN_ALPHA_C_COMPONENT_USAGE__SHIFT 12
+#define NV30_3D_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
+#define NV30_3D_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING__MASK 0x0000e000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING__SHIFT 13
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV30_3D_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT__MASK 0x000f0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT__SHIFT 16
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV30_3D_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
+#define NV30_3D_RC_IN_ALPHA_B_COMPONENT_USAGE__MASK 0x00100000
+#define NV30_3D_RC_IN_ALPHA_B_COMPONENT_USAGE__SHIFT 20
+#define NV30_3D_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
+#define NV30_3D_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING__MASK 0x00e00000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING__SHIFT 21
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV30_3D_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT__MASK 0x0f000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT__SHIFT 24
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV30_3D_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
+#define NV30_3D_RC_IN_ALPHA_A_COMPONENT_USAGE__MASK 0x10000000
+#define NV30_3D_RC_IN_ALPHA_A_COMPONENT_USAGE__SHIFT 28
+#define NV30_3D_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
+#define NV30_3D_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING__MASK 0xe0000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING__SHIFT 29
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV30_3D_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
+
+#define NV30_3D_RC_IN_RGB(i0) (0x00000904 + 0x20*(i0))
+#define NV30_3D_RC_IN_RGB_D_INPUT__MASK 0x0000000f
+#define NV30_3D_RC_IN_RGB_D_INPUT__SHIFT 0
+#define NV30_3D_RC_IN_RGB_D_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV30_3D_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV30_3D_RC_IN_RGB_D_INPUT_FOG 0x00000003
+#define NV30_3D_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV30_3D_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV30_3D_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
+#define NV30_3D_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
+#define NV30_3D_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
+#define NV30_3D_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
+#define NV30_3D_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
+#define NV30_3D_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
+#define NV30_3D_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV30_3D_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
+#define NV30_3D_RC_IN_RGB_D_COMPONENT_USAGE__MASK 0x00000010
+#define NV30_3D_RC_IN_RGB_D_COMPONENT_USAGE__SHIFT 4
+#define NV30_3D_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV30_3D_RC_IN_RGB_D_MAPPING__MASK 0x000000e0
+#define NV30_3D_RC_IN_RGB_D_MAPPING__SHIFT 5
+#define NV30_3D_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV30_3D_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV30_3D_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV30_3D_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV30_3D_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV30_3D_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV30_3D_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV30_3D_RC_IN_RGB_C_INPUT__MASK 0x00000f00
+#define NV30_3D_RC_IN_RGB_C_INPUT__SHIFT 8
+#define NV30_3D_RC_IN_RGB_C_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_IN_RGB_C_INPUT_FOG 0x00000300
+#define NV30_3D_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_IN_RGB_C_COMPONENT_USAGE__MASK 0x00001000
+#define NV30_3D_RC_IN_RGB_C_COMPONENT_USAGE__SHIFT 12
+#define NV30_3D_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV30_3D_RC_IN_RGB_C_MAPPING__MASK 0x0000e000
+#define NV30_3D_RC_IN_RGB_C_MAPPING__SHIFT 13
+#define NV30_3D_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV30_3D_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV30_3D_RC_IN_RGB_B_INPUT__MASK 0x000f0000
+#define NV30_3D_RC_IN_RGB_B_INPUT__SHIFT 16
+#define NV30_3D_RC_IN_RGB_B_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV30_3D_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV30_3D_RC_IN_RGB_B_INPUT_FOG 0x00030000
+#define NV30_3D_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV30_3D_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV30_3D_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
+#define NV30_3D_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
+#define NV30_3D_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
+#define NV30_3D_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
+#define NV30_3D_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
+#define NV30_3D_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
+#define NV30_3D_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV30_3D_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
+#define NV30_3D_RC_IN_RGB_B_COMPONENT_USAGE__MASK 0x00100000
+#define NV30_3D_RC_IN_RGB_B_COMPONENT_USAGE__SHIFT 20
+#define NV30_3D_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV30_3D_RC_IN_RGB_B_MAPPING__MASK 0x00e00000
+#define NV30_3D_RC_IN_RGB_B_MAPPING__SHIFT 21
+#define NV30_3D_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV30_3D_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV30_3D_RC_IN_RGB_A_INPUT__MASK 0x0f000000
+#define NV30_3D_RC_IN_RGB_A_INPUT__SHIFT 24
+#define NV30_3D_RC_IN_RGB_A_INPUT_ZERO 0x00000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_FOG 0x03000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV30_3D_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
+#define NV30_3D_RC_IN_RGB_A_COMPONENT_USAGE__MASK 0x10000000
+#define NV30_3D_RC_IN_RGB_A_COMPONENT_USAGE__SHIFT 28
+#define NV30_3D_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV30_3D_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING__MASK 0xe0000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING__SHIFT 29
+#define NV30_3D_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV30_3D_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
+
+#define NV30_3D_RC_CONSTANT_COLOR0(i0) (0x00000908 + 0x20*(i0))
+#define NV30_3D_RC_CONSTANT_COLOR0_B__MASK 0x000000ff
+#define NV30_3D_RC_CONSTANT_COLOR0_B__SHIFT 0
+#define NV30_3D_RC_CONSTANT_COLOR0_G__MASK 0x0000ff00
+#define NV30_3D_RC_CONSTANT_COLOR0_G__SHIFT 8
+#define NV30_3D_RC_CONSTANT_COLOR0_R__MASK 0x00ff0000
+#define NV30_3D_RC_CONSTANT_COLOR0_R__SHIFT 16
+#define NV30_3D_RC_CONSTANT_COLOR0_A__MASK 0xff000000
+#define NV30_3D_RC_CONSTANT_COLOR0_A__SHIFT 24
+
+#define NV30_3D_RC_CONSTANT_COLOR1(i0) (0x0000090c + 0x20*(i0))
+#define NV30_3D_RC_CONSTANT_COLOR1_B__MASK 0x000000ff
+#define NV30_3D_RC_CONSTANT_COLOR1_B__SHIFT 0
+#define NV30_3D_RC_CONSTANT_COLOR1_G__MASK 0x0000ff00
+#define NV30_3D_RC_CONSTANT_COLOR1_G__SHIFT 8
+#define NV30_3D_RC_CONSTANT_COLOR1_R__MASK 0x00ff0000
+#define NV30_3D_RC_CONSTANT_COLOR1_R__SHIFT 16
+#define NV30_3D_RC_CONSTANT_COLOR1_A__MASK 0xff000000
+#define NV30_3D_RC_CONSTANT_COLOR1_A__SHIFT 24
+
+#define NV30_3D_RC_OUT_ALPHA(i0) (0x00000910 + 0x20*(i0))
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT__MASK 0x0000000f
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT__SHIFT 0
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV30_3D_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT__MASK 0x000000f0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT__SHIFT 4
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV30_3D_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT__MASK 0x00000f00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT__SHIFT 8
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_OUT_ALPHA_CD_DOT_PRODUCT 0x00001000
+#define NV30_3D_RC_OUT_ALPHA_AB_DOT_PRODUCT 0x00002000
+#define NV30_3D_RC_OUT_ALPHA_MUX_SUM 0x00004000
+#define NV30_3D_RC_OUT_ALPHA_BIAS__MASK 0x00008000
+#define NV30_3D_RC_OUT_ALPHA_BIAS__SHIFT 15
+#define NV30_3D_RC_OUT_ALPHA_BIAS_NONE 0x00000000
+#define NV30_3D_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV30_3D_RC_OUT_ALPHA_SCALE__MASK 0x00030000
+#define NV30_3D_RC_OUT_ALPHA_SCALE__SHIFT 16
+#define NV30_3D_RC_OUT_ALPHA_SCALE_NONE 0x00000000
+#define NV30_3D_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00010000
+#define NV30_3D_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00020000
+#define NV30_3D_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00030000
+
+#define NV30_3D_RC_OUT_RGB(i0) (0x00000914 + 0x20*(i0))
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT__MASK 0x0000000f
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT__SHIFT 0
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV30_3D_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT__MASK 0x000000f0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT__SHIFT 4
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV30_3D_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT__MASK 0x00000f00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT__SHIFT 8
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV30_3D_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV30_3D_RC_OUT_RGB_CD_DOT_PRODUCT 0x00001000
+#define NV30_3D_RC_OUT_RGB_AB_DOT_PRODUCT 0x00002000
+#define NV30_3D_RC_OUT_RGB_MUX_SUM 0x00004000
+#define NV30_3D_RC_OUT_RGB_BIAS__MASK 0x00008000
+#define NV30_3D_RC_OUT_RGB_BIAS__SHIFT 15
+#define NV30_3D_RC_OUT_RGB_BIAS_NONE 0x00000000
+#define NV30_3D_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV30_3D_RC_OUT_RGB_SCALE__MASK 0x00030000
+#define NV30_3D_RC_OUT_RGB_SCALE__SHIFT 16
+#define NV30_3D_RC_OUT_RGB_SCALE_NONE 0x00000000
+#define NV30_3D_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00010000
+#define NV30_3D_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00020000
+#define NV30_3D_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00030000
+
+#define NV30_3D_VIEWPORT_HORIZ 0x00000a00
+#define NV30_3D_VIEWPORT_HORIZ_X__MASK 0x0000ffff
+#define NV30_3D_VIEWPORT_HORIZ_X__SHIFT 0
+#define NV30_3D_VIEWPORT_HORIZ_W__MASK 0xffff0000
+#define NV30_3D_VIEWPORT_HORIZ_W__SHIFT 16
+
+#define NV30_3D_VIEWPORT_VERT 0x00000a04
+#define NV30_3D_VIEWPORT_VERT_Y__MASK 0x0000ffff
+#define NV30_3D_VIEWPORT_VERT_Y__SHIFT 0
+#define NV30_3D_VIEWPORT_VERT_H__MASK 0xffff0000
+#define NV30_3D_VIEWPORT_VERT_H__SHIFT 16
+
+#define NV30_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION 0x00000a10
+
+
+#define NV30_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R 0x00000a10
+
+#define NV30_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G 0x00000a14
+
+#define NV30_3D_LIGHT_MODEL_FRONT_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B 0x00000a18
+
+#define NV30_3D_VIEWPORT_TRANSLATE 0x00000a20
+
+
+#define NV30_3D_VIEWPORT_TRANSLATE_X 0x00000a20
+
+#define NV30_3D_VIEWPORT_TRANSLATE_Y 0x00000a24
+
+#define NV30_3D_VIEWPORT_TRANSLATE_Z 0x00000a28
+
+#define NV30_3D_VIEWPORT_TRANSLATE_W 0x00000a2c
+
+#define NV30_3D_VIEWPORT_SCALE 0x00000a30
+
+
+#define NV30_3D_VIEWPORT_SCALE_X 0x00000a30
+
+#define NV30_3D_VIEWPORT_SCALE_Y 0x00000a34
+
+#define NV30_3D_VIEWPORT_SCALE_Z 0x00000a38
+
+#define NV30_3D_VIEWPORT_SCALE_W 0x00000a3c
+
+#define NV30_3D_POLYGON_OFFSET_POINT_ENABLE 0x00000a60
+
+#define NV30_3D_POLYGON_OFFSET_LINE_ENABLE 0x00000a64
+
+#define NV30_3D_POLYGON_OFFSET_FILL_ENABLE 0x00000a68
+
+#define NV30_3D_DEPTH_FUNC 0x00000a6c
+#define NV30_3D_DEPTH_FUNC_NEVER 0x00000200
+#define NV30_3D_DEPTH_FUNC_LESS 0x00000201
+#define NV30_3D_DEPTH_FUNC_EQUAL 0x00000202
+#define NV30_3D_DEPTH_FUNC_LEQUAL 0x00000203
+#define NV30_3D_DEPTH_FUNC_GREATER 0x00000204
+#define NV30_3D_DEPTH_FUNC_NOTEQUAL 0x00000205
+#define NV30_3D_DEPTH_FUNC_GEQUAL 0x00000206
+#define NV30_3D_DEPTH_FUNC_ALWAYS 0x00000207
+
+#define NV30_3D_DEPTH_WRITE_ENABLE 0x00000a70
+
+#define NV30_3D_DEPTH_TEST_ENABLE 0x00000a74
+
+#define NV30_3D_POLYGON_OFFSET_FACTOR 0x00000a78
+
+#define NV30_3D_POLYGON_OFFSET_UNITS 0x00000a7c
+
+#define NV30_3D_VTX_ATTR_3I_XY(i0) (0x00000a80 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_3I_XY__ESIZE 0x00000008
+#define NV30_3D_VTX_ATTR_3I_XY__LEN 0x00000010
+#define NV30_3D_VTX_ATTR_3I_XY_X__MASK 0x0000ffff
+#define NV30_3D_VTX_ATTR_3I_XY_X__SHIFT 0
+#define NV30_3D_VTX_ATTR_3I_XY_Y__MASK 0xffff0000
+#define NV30_3D_VTX_ATTR_3I_XY_Y__SHIFT 16
+
+#define NV30_3D_VTX_ATTR_3I_Z(i0) (0x00000a84 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_3I_Z__ESIZE 0x00000008
+#define NV30_3D_VTX_ATTR_3I_Z__LEN 0x00000010
+#define NV30_3D_VTX_ATTR_3I_Z_Z__MASK 0x0000ffff
+#define NV30_3D_VTX_ATTR_3I_Z_Z__SHIFT 0
+
+#define NV30_3D_TEX_FILTER_OPTIMIZATION(i0) (0x00000b00 + 0x4*(i0))
+#define NV30_3D_TEX_FILTER_OPTIMIZATION__ESIZE 0x00000004
+#define NV30_3D_TEX_FILTER_OPTIMIZATION__LEN 0x00000004
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR__MASK 0x0000001f
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR__SHIFT 0
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR_OFF 0x00000000
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR_HIGH_QUALITY 0x00000004
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR_QUALITY 0x00000006
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR_PERFORMANCE 0x00000008
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_TRILINEAR_HIGH_PERFORMANCE 0x00000018
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE__MASK 0x000001c0
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE__SHIFT 6
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_OFF 0x00000000
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_HIGH_QUALITY 0x000000c0
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_QUALITY 0x000001c0
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_ANISO_SAMPLE_PERFORMANCE 0x00000140
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_UNKNOWN__MASK 0x00007c00
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_UNKNOWN__SHIFT 10
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_UNKNOWN_OFF 0x00000000
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_UNKNOWN_PARTIAL 0x00002c00
+#define NV40_3D_TEX_FILTER_OPTIMIZATION_UNKNOWN_FULL 0x00007c00
+
+#define NV40_3D_UNK0B40(i0) (0x00000b40 + 0x4*(i0))
+#define NV40_3D_UNK0B40__ESIZE 0x00000004
+#define NV40_3D_UNK0B40__LEN 0x00000008
+
+#define NV30_3D_VP_UPLOAD_INST(i0) (0x00000b80 + 0x4*(i0))
+#define NV30_3D_VP_UPLOAD_INST__ESIZE 0x00000004
+#define NV30_3D_VP_UPLOAD_INST__LEN 0x00000004
+
+
+#define NV30_3D_TEX_CLIP_PLANE(i0) (0x00000e00 + 0x10*(i0))
+
+
+#define NV30_3D_TEX_CLIP_PLANE_X(i0) (0x00000e00 + 0x10*(i0))
+
+#define NV30_3D_TEX_CLIP_PLANE_Y(i0) (0x00000e04 + 0x10*(i0))
+
+#define NV30_3D_TEX_CLIP_PLANE_Z(i0) (0x00000e08 + 0x10*(i0))
+
+#define NV30_3D_TEX_CLIP_PLANE_W(i0) (0x00000e0c + 0x10*(i0))
+
+#define NV30_3D_LIGHT 0x00001000
+
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT(i0) (0x00001000 + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_R(i0) (0x00001000 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_G(i0) (0x00001004 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_AMBIENT_B(i0) (0x00001008 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE(i0) (0x0000100c + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_R(i0) (0x0000100c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_G(i0) (0x00001010 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_DIFFUSE_B(i0) (0x00001014 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR(i0) (0x00001018 + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_R(i0) (0x00001018 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_G(i0) (0x0000101c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_FRONT_SIDE_PRODUCT_SPECULAR_B(i0) (0x00001020 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_UNK24(i0) (0x00001024 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_HALF_VECTOR(i0) (0x00001028 + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_HALF_VECTOR_X(i0) (0x00001028 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_HALF_VECTOR_Y(i0) (0x0000102c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_HALF_VECTOR_Z(i0) (0x00001030 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_DIRECTION(i0) (0x00001034 + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_DIRECTION_X(i0) (0x00001034 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_DIRECTION_Y(i0) (0x00001038 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_DIRECTION_Z(i0) (0x0000103c + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_SPOT_CUTOFF_A(i0) (0x00001200 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_CUTOFF_B(i0) (0x00001204 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_CUTOFF_C(i0) (0x00001208 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_DIR(i0) (0x0000120c + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_SPOT_DIR_X(i0) (0x0000120c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_DIR_Y(i0) (0x00001210 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_DIR_Z(i0) (0x00001214 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_SPOT_CUTOFF_D(i0) (0x00001218 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_POSITION(i0) (0x0000121c + 0x40*(i0))
+
+
+#define NV30_3D_LIGHT_POSITION_X(i0) (0x0000121c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_POSITION_Y(i0) (0x00001220 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_POSITION_Z(i0) (0x00001224 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_ATTENUATION(i0) (0x00001228 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_ATTENUATION_CONSTANT(i0) (0x00001228 + 0x40*(i0))
+
+#define NV30_3D_LIGHT_ATTENUATION_LINEAR(i0) (0x0000122c + 0x40*(i0))
+
+#define NV30_3D_LIGHT_ATTENUATION_QUADRATIC(i0) (0x00001230 + 0x40*(i0))
+
+#define NV30_3D_FRONT_MATERIAL_SHININESS(i0) (0x00001400 + 0x4*(i0))
+#define NV30_3D_FRONT_MATERIAL_SHININESS__ESIZE 0x00000004
+#define NV30_3D_FRONT_MATERIAL_SHININESS__LEN 0x00000006
+
+#define NV30_3D_ENABLED_LIGHTS 0x00001420
+
+#define NV30_3D_VERTEX_TWO_SIDE_ENABLE 0x0000142c
+
+#define NV30_3D_FP_REG_CONTROL 0x00001450
+#define NV30_3D_FP_REG_CONTROL_UNK0__MASK 0x0000ffff
+#define NV30_3D_FP_REG_CONTROL_UNK0__SHIFT 0
+#define NV30_3D_FP_REG_CONTROL_UNK1__MASK 0xffff0000
+#define NV30_3D_FP_REG_CONTROL_UNK1__SHIFT 16
+
+#define NV30_3D_FLATSHADE_FIRST 0x00001454
+
+#define NV30_3D_EDGEFLAG 0x0000145c
+#define NV30_3D_EDGEFLAG_ENABLE 0x00000001
+
+#define NV30_3D_VP_CLIP_PLANES_ENABLE 0x00001478
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 0x00000002
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 0x00000020
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE2 0x00000200
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE3 0x00002000
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE4 0x00020000
+#define NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE5 0x00200000
+
+#define NV30_3D_POLYGON_STIPPLE_ENABLE 0x0000147c
+
+#define NV30_3D_POLYGON_STIPPLE_PATTERN(i0) (0x00001480 + 0x4*(i0))
+#define NV30_3D_POLYGON_STIPPLE_PATTERN__ESIZE 0x00000004
+#define NV30_3D_POLYGON_STIPPLE_PATTERN__LEN 0x00000020
+
+#define NV30_3D_VTX_ATTR_3F(i0) (0x00001500 + 0x10*(i0))
+#define NV30_3D_VTX_ATTR_3F__ESIZE 0x00000010
+#define NV30_3D_VTX_ATTR_3F__LEN 0x00000010
+
+
+#define NV30_3D_VTX_ATTR_3F_X(i0) (0x00001500 + 0x10*(i0))
+
+#define NV30_3D_VTX_ATTR_3F_Y(i0) (0x00001504 + 0x10*(i0))
+
+#define NV30_3D_VTX_ATTR_3F_Z(i0) (0x00001508 + 0x10*(i0))
+
+
+#define NV30_3D_VP_CLIP_PLANE(i0, i1) (0x00001600 + 0x10*(i0) + 0x4*(i1))
+#define NV30_3D_VP_CLIP_PLANE__ESIZE 0x00000004
+#define NV30_3D_VP_CLIP_PLANE__LEN 0x00000004
+
+#define NV30_3D_VTXBUF(i0) (0x00001680 + 0x4*(i0))
+#define NV30_3D_VTXBUF__ESIZE 0x00000004
+#define NV30_3D_VTXBUF__LEN 0x00000010
+#define NV30_3D_VTXBUF_OFFSET__MASK 0x0fffffff
+#define NV30_3D_VTXBUF_OFFSET__SHIFT 0
+#define NV30_3D_VTXBUF_DMA1 0x80000000
+
+#define NV40_3D_VTX_CACHE_INVALIDATE 0x00001714
+
+#define NV30_3D_VTXFMT(i0) (0x00001740 + 0x4*(i0))
+#define NV30_3D_VTXFMT__ESIZE 0x00000004
+#define NV30_3D_VTXFMT__LEN 0x00000010
+#define NV30_3D_VTXFMT_TYPE__MASK 0x0000000f
+#define NV30_3D_VTXFMT_TYPE__SHIFT 0
+#define NV30_3D_VTXFMT_TYPE_B8G8R8A8_UNORM 0x00000000
+#define NV30_3D_VTXFMT_TYPE_V16_SNORM 0x00000001
+#define NV30_3D_VTXFMT_TYPE_V32_FLOAT 0x00000002
+#define NV30_3D_VTXFMT_TYPE_V16_FLOAT 0x00000003
+#define NV30_3D_VTXFMT_TYPE_U8_UNORM 0x00000004
+#define NV30_3D_VTXFMT_TYPE_V16_SSCALED 0x00000005
+#define NV30_3D_VTXFMT_TYPE_U8_USCALED 0x00000007
+#define NV30_3D_VTXFMT_SIZE__MASK 0x000000f0
+#define NV30_3D_VTXFMT_SIZE__SHIFT 4
+#define NV30_3D_VTXFMT_STRIDE__MASK 0x0000ff00
+#define NV30_3D_VTXFMT_STRIDE__SHIFT 8
+
+#define NV30_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION 0x000017a0
+
+
+#define NV30_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_R 0x000017a0
+
+#define NV30_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_G 0x000017a4
+
+#define NV30_3D_LIGHT_MODEL_BACK_SIDE_PRODUCT_AMBIENT_PLUS_EMISSION_B 0x000017a8
+
+#define NV30_3D_COLOR_MATERIAL_BACK 0x000017b0
+
+
+#define NV30_3D_COLOR_MATERIAL_BACK_R 0x000017b0
+
+#define NV30_3D_COLOR_MATERIAL_BACK_G 0x000017b4
+
+#define NV30_3D_COLOR_MATERIAL_BACK_B 0x000017b8
+
+#define NV30_3D_COLOR_MATERIAL_BACK_A 0x000017bc
+
+#define NV30_3D_QUERY_RESET 0x000017c8
+
+#define NV30_3D_QUERY_ENABLE 0x000017cc
+
+#define NV30_3D_QUERY_GET 0x00001800
+#define NV30_3D_QUERY_GET_OFFSET__MASK 0x00ffffff
+#define NV30_3D_QUERY_GET_OFFSET__SHIFT 0
+#define NV30_3D_QUERY_GET_UNK24__MASK 0xff000000
+#define NV30_3D_QUERY_GET_UNK24__SHIFT 24
+
+#define NV30_3D_VERTEX_BEGIN_END 0x00001808
+#define NV30_3D_VERTEX_BEGIN_END_STOP 0x00000000
+#define NV30_3D_VERTEX_BEGIN_END_POINTS 0x00000001
+#define NV30_3D_VERTEX_BEGIN_END_LINES 0x00000002
+#define NV30_3D_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
+#define NV30_3D_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
+#define NV30_3D_VERTEX_BEGIN_END_TRIANGLES 0x00000005
+#define NV30_3D_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
+#define NV30_3D_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
+#define NV30_3D_VERTEX_BEGIN_END_QUADS 0x00000008
+#define NV30_3D_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
+#define NV30_3D_VERTEX_BEGIN_END_POLYGON 0x0000000a
+
+#define NV30_3D_VB_ELEMENT_U16 0x0000180c
+#define NV30_3D_VB_ELEMENT_U16_0__MASK 0x0000ffff
+#define NV30_3D_VB_ELEMENT_U16_0__SHIFT 0
+#define NV30_3D_VB_ELEMENT_U16_1__MASK 0xffff0000
+#define NV30_3D_VB_ELEMENT_U16_1__SHIFT 16
+
+#define NV30_3D_VB_ELEMENT_U32 0x00001810
+
+#define NV30_3D_VB_VERTEX_BATCH 0x00001814
+#define NV30_3D_VB_VERTEX_BATCH_OFFSET__MASK 0x00ffffff
+#define NV30_3D_VB_VERTEX_BATCH_OFFSET__SHIFT 0
+#define NV30_3D_VB_VERTEX_BATCH_COUNT__MASK 0xff000000
+#define NV30_3D_VB_VERTEX_BATCH_COUNT__SHIFT 24
+
+#define NV30_3D_VERTEX_DATA 0x00001818
+
+#define NV30_3D_IDXBUF_OFFSET 0x0000181c
+
+#define NV30_3D_IDXBUF_FORMAT 0x00001820
+#define NV30_3D_IDXBUF_FORMAT_DMA1 0x00000001
+#define NV30_3D_IDXBUF_FORMAT_TYPE__MASK 0x000000f0
+#define NV30_3D_IDXBUF_FORMAT_TYPE__SHIFT 4
+#define NV30_3D_IDXBUF_FORMAT_TYPE_U32 0x00000000
+#define NV30_3D_IDXBUF_FORMAT_TYPE_U16 0x00000010
+
+#define NV30_3D_VB_INDEX_BATCH 0x00001824
+#define NV30_3D_VB_INDEX_BATCH_START__MASK 0x00ffffff
+#define NV30_3D_VB_INDEX_BATCH_START__SHIFT 0
+#define NV30_3D_VB_INDEX_BATCH_COUNT__MASK 0xff000000
+#define NV30_3D_VB_INDEX_BATCH_COUNT__SHIFT 24
+
+#define NV30_3D_POLYGON_MODE_FRONT 0x00001828
+#define NV30_3D_POLYGON_MODE_FRONT_POINT 0x00001b00
+#define NV30_3D_POLYGON_MODE_FRONT_LINE 0x00001b01
+#define NV30_3D_POLYGON_MODE_FRONT_FILL 0x00001b02
+
+#define NV30_3D_POLYGON_MODE_BACK 0x0000182c
+#define NV30_3D_POLYGON_MODE_BACK_POINT 0x00001b00
+#define NV30_3D_POLYGON_MODE_BACK_LINE 0x00001b01
+#define NV30_3D_POLYGON_MODE_BACK_FILL 0x00001b02
+
+#define NV30_3D_CULL_FACE 0x00001830
+#define NV30_3D_CULL_FACE_FRONT 0x00000404
+#define NV30_3D_CULL_FACE_BACK 0x00000405
+#define NV30_3D_CULL_FACE_FRONT_AND_BACK 0x00000408
+
+#define NV30_3D_FRONT_FACE 0x00001834
+#define NV30_3D_FRONT_FACE_CW 0x00000900
+#define NV30_3D_FRONT_FACE_CCW 0x00000901
+
+#define NV30_3D_POLYGON_SMOOTH_ENABLE 0x00001838
+
+#define NV30_3D_CULL_FACE_ENABLE 0x0000183c
+
+#define NV30_3D_TEX_PALETTE_OFFSET(i0) (0x00001840 + 0x4*(i0))
+#define NV30_3D_TEX_PALETTE_OFFSET__ESIZE 0x00000004
+#define NV30_3D_TEX_PALETTE_OFFSET__LEN 0x00000008
+
+#define NV40_3D_TEX_SIZE1(i0) (0x00001840 + 0x4*(i0))
+#define NV40_3D_TEX_SIZE1__ESIZE 0x00000004
+#define NV40_3D_TEX_SIZE1__LEN 0x00000008
+#define NV40_3D_TEX_SIZE1_DEPTH__MASK 0xfff00000
+#define NV40_3D_TEX_SIZE1_DEPTH__SHIFT 20
+#define NV40_3D_TEX_SIZE1_PITCH__MASK 0x0000ffff
+#define NV40_3D_TEX_SIZE1_PITCH__SHIFT 0
+
+#define NV30_3D_VTX_ATTR_2F(i0) (0x00001880 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_2F__ESIZE 0x00000008
+#define NV30_3D_VTX_ATTR_2F__LEN 0x00000010
+
+
+#define NV30_3D_VTX_ATTR_2F_X(i0) (0x00001880 + 0x8*(i0))
+
+#define NV30_3D_VTX_ATTR_2F_Y(i0) (0x00001884 + 0x8*(i0))
+
+#define NV30_3D_VTX_ATTR_2I(i0) (0x00001900 + 0x4*(i0))
+#define NV30_3D_VTX_ATTR_2I__ESIZE 0x00000004
+#define NV30_3D_VTX_ATTR_2I__LEN 0x00000010
+#define NV30_3D_VTX_ATTR_2I_X__MASK 0x0000ffff
+#define NV30_3D_VTX_ATTR_2I_X__SHIFT 0
+#define NV30_3D_VTX_ATTR_2I_Y__MASK 0xffff0000
+#define NV30_3D_VTX_ATTR_2I_Y__SHIFT 16
+
+#define NV30_3D_VTX_ATTR_4UB(i0) (0x00001940 + 0x4*(i0))
+#define NV30_3D_VTX_ATTR_4UB__ESIZE 0x00000004
+#define NV30_3D_VTX_ATTR_4UB__LEN 0x00000010
+#define NV30_3D_VTX_ATTR_4UB_X__MASK 0x000000ff
+#define NV30_3D_VTX_ATTR_4UB_X__SHIFT 0
+#define NV30_3D_VTX_ATTR_4UB_Y__MASK 0x0000ff00
+#define NV30_3D_VTX_ATTR_4UB_Y__SHIFT 8
+#define NV30_3D_VTX_ATTR_4UB_Z__MASK 0x00ff0000
+#define NV30_3D_VTX_ATTR_4UB_Z__SHIFT 16
+#define NV30_3D_VTX_ATTR_4UB_W__MASK 0xff000000
+#define NV30_3D_VTX_ATTR_4UB_W__SHIFT 24
+
+#define NV30_3D_VTX_ATTR_4I(i0) (0x00001980 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_4I__ESIZE 0x00000008
+#define NV30_3D_VTX_ATTR_4I__LEN 0x00000010
+
+#define NV30_3D_VTX_ATTR_4I_XY(i0) (0x00001980 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_4I_XY_X__MASK 0x0000ffff
+#define NV30_3D_VTX_ATTR_4I_XY_X__SHIFT 0
+#define NV30_3D_VTX_ATTR_4I_XY_Y__MASK 0xffff0000
+#define NV30_3D_VTX_ATTR_4I_XY_Y__SHIFT 16
+
+#define NV30_3D_VTX_ATTR_4I_ZW(i0) (0x00001984 + 0x8*(i0))
+#define NV30_3D_VTX_ATTR_4I_ZW_Z__MASK 0x0000ffff
+#define NV30_3D_VTX_ATTR_4I_ZW_Z__SHIFT 0
+#define NV30_3D_VTX_ATTR_4I_ZW_W__MASK 0xffff0000
+#define NV30_3D_VTX_ATTR_4I_ZW_W__SHIFT 16
+
+#define NV30_3D_TEX_OFFSET(i0) (0x00001a00 + 0x20*(i0))
+#define NV30_3D_TEX_OFFSET__ESIZE 0x00000020
+#define NV30_3D_TEX_OFFSET__LEN 0x00000008
+
+#define NV30_3D_TEX_FORMAT(i0) (0x00001a04 + 0x20*(i0))
+#define NV30_3D_TEX_FORMAT__ESIZE 0x00000020
+#define NV30_3D_TEX_FORMAT__LEN 0x00000008
+#define NV30_3D_TEX_FORMAT_DMA0 0x00000001
+#define NV30_3D_TEX_FORMAT_DMA1 0x00000002
+#define NV30_3D_TEX_FORMAT_CUBIC 0x00000004
+#define NV30_3D_TEX_FORMAT_NO_BORDER 0x00000008
+#define NV30_3D_TEX_FORMAT_DIMS__MASK 0x000000f0
+#define NV30_3D_TEX_FORMAT_DIMS__SHIFT 4
+#define NV30_3D_TEX_FORMAT_DIMS_1D 0x00000010
+#define NV30_3D_TEX_FORMAT_DIMS_2D 0x00000020
+#define NV30_3D_TEX_FORMAT_DIMS_3D 0x00000030
+#define NV30_3D_TEX_FORMAT_FORMAT__MASK 0x0000ff00
+#define NV30_3D_TEX_FORMAT_FORMAT__SHIFT 8
+#define NV30_3D_TEX_FORMAT_FORMAT_L8 0x00000000
+#define NV30_3D_TEX_FORMAT_FORMAT_I8 0x00000100
+#define NV30_3D_TEX_FORMAT_FORMAT_A1R5G5B5 0x00000200
+#define NV30_3D_TEX_FORMAT_FORMAT_A4R4G4B4 0x00000400
+#define NV30_3D_TEX_FORMAT_FORMAT_R5G6B5 0x00000500
+#define NV30_3D_TEX_FORMAT_FORMAT_A8R8G8B8 0x00000600
+#define NV30_3D_TEX_FORMAT_FORMAT_X8R8G8B8 0x00000700
+#define NV30_3D_TEX_FORMAT_FORMAT_INDEX8 0x00000b00
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT1 0x00000c00
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT3 0x00000e00
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT5 0x00000f00
+#define NV30_3D_TEX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00001000
+#define NV30_3D_TEX_FORMAT_FORMAT_R5G6B5_RECT 0x00001100
+#define NV30_3D_TEX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00001200
+#define NV30_3D_TEX_FORMAT_FORMAT_L8_RECT 0x00001300
+#define NV30_3D_TEX_FORMAT_FORMAT_DSDT8_RECT 0x00001700
+#define NV30_3D_TEX_FORMAT_FORMAT_A8L8 0x00001a00
+#define NV30_3D_TEX_FORMAT_FORMAT_I8_RECT 0x00001b00
+#define NV30_3D_TEX_FORMAT_FORMAT_A4R4G4B4_RECT 0x00001d00
+#define NV30_3D_TEX_FORMAT_FORMAT_R8G8B8_RECT 0x00001e00
+#define NV30_3D_TEX_FORMAT_FORMAT_A8L8_RECT 0x00002000
+#define NV30_3D_TEX_FORMAT_FORMAT_Z24 0x00002a00
+#define NV30_3D_TEX_FORMAT_FORMAT_Z24_RECT 0x00002b00
+#define NV30_3D_TEX_FORMAT_FORMAT_Z16 0x00002c00
+#define NV30_3D_TEX_FORMAT_FORMAT_Z16_RECT 0x00002d00
+#define NV30_3D_TEX_FORMAT_FORMAT_DSDT8 0x00002800
+#define NV30_3D_TEX_FORMAT_FORMAT_HILO16 0x00003300
+#define NV30_3D_TEX_FORMAT_FORMAT_HILO16_RECT 0x00003600
+#define NV30_3D_TEX_FORMAT_FORMAT_HILO8 0x00004400
+#define NV30_3D_TEX_FORMAT_FORMAT_SIGNED_HILO8 0x00004500
+#define NV30_3D_TEX_FORMAT_FORMAT_HILO8_RECT 0x00004600
+#define NV30_3D_TEX_FORMAT_FORMAT_SIGNED_HILO8_RECT 0x00004700
+#define NV30_3D_TEX_FORMAT_FORMAT_A16 0x00003200
+#define NV30_3D_TEX_FORMAT_FORMAT_A16_RECT 0x00003500
+#define NV30_3D_TEX_FORMAT_FORMAT_UNK3F 0x00003f00
+#define NV30_3D_TEX_FORMAT_FORMAT_FLOAT_RGBA16_NV 0x00004a00
+#define NV30_3D_TEX_FORMAT_FORMAT_FLOAT_RGBA32_NV 0x00004b00
+#define NV30_3D_TEX_FORMAT_FORMAT_FLOAT_R32_NV 0x00004c00
+#define NV40_3D_TEX_FORMAT_FORMAT__MASK 0x00001f00
+#define NV40_3D_TEX_FORMAT_FORMAT__SHIFT 8
+#define NV40_3D_TEX_FORMAT_FORMAT_L8 0x00000100
+#define NV40_3D_TEX_FORMAT_FORMAT_A1R5G5B5 0x00000200
+#define NV40_3D_TEX_FORMAT_FORMAT_A4R4G4B4 0x00000300
+#define NV40_3D_TEX_FORMAT_FORMAT_R5G6B5 0x00000400
+#define NV40_3D_TEX_FORMAT_FORMAT_A8R8G8B8 0x00000500
+#define NV40_3D_TEX_FORMAT_FORMAT_DXT1 0x00000600
+#define NV40_3D_TEX_FORMAT_FORMAT_DXT3 0x00000700
+#define NV40_3D_TEX_FORMAT_FORMAT_DXT5 0x00000800
+#define NV40_3D_TEX_FORMAT_FORMAT_A8L8 0x00000b00
+#define NV40_3D_TEX_FORMAT_FORMAT_Z24 0x00001000
+#define NV40_3D_TEX_FORMAT_FORMAT_Z16 0x00001200
+#define NV40_3D_TEX_FORMAT_FORMAT_A16 0x00001400
+#define NV40_3D_TEX_FORMAT_FORMAT_A16L16 0x00001500
+#define NV40_3D_TEX_FORMAT_FORMAT_HILO8 0x00001800
+#define NV40_3D_TEX_FORMAT_FORMAT_RGBA16F 0x00001a00
+#define NV40_3D_TEX_FORMAT_FORMAT_RGBA32F 0x00001b00
+#define NV40_3D_TEX_FORMAT_LINEAR 0x00002000
+#define NV40_3D_TEX_FORMAT_RECT 0x00004000
+#define NV40_3D_TEX_FORMAT_MIPMAP_COUNT__MASK 0x000f0000
+#define NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT 16
+#define NV30_3D_TEX_FORMAT_MIPMAP 0x00080000
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_U__MASK 0x00f00000
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_U__SHIFT 20
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_V__MASK 0x0f000000
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_V__SHIFT 24
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_W__MASK 0xf0000000
+#define NV30_3D_TEX_FORMAT_BASE_SIZE_W__SHIFT 28
+
+#define NV30_3D_TEX_WRAP(i0) (0x00001a08 + 0x20*(i0))
+#define NV30_3D_TEX_WRAP__ESIZE 0x00000020
+#define NV30_3D_TEX_WRAP__LEN 0x00000008
+#define NV30_3D_TEX_WRAP_S__MASK 0x000000ff
+#define NV30_3D_TEX_WRAP_S__SHIFT 0
+#define NV30_3D_TEX_WRAP_S_REPEAT 0x00000001
+#define NV30_3D_TEX_WRAP_S_MIRRORED_REPEAT 0x00000002
+#define NV30_3D_TEX_WRAP_S_CLAMP_TO_EDGE 0x00000003
+#define NV30_3D_TEX_WRAP_S_CLAMP_TO_BORDER 0x00000004
+#define NV30_3D_TEX_WRAP_S_CLAMP 0x00000005
+#define NV40_3D_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE 0x00000006
+#define NV40_3D_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER 0x00000007
+#define NV40_3D_TEX_WRAP_S_MIRROR_CLAMP 0x00000008
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION__MASK 0x00000070
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION__SHIFT 4
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_OFF 0x00000000
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_QUALITY 0x00000020
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_PERFORMANCE 0x00000030
+#define NV40_3D_TEX_WRAP_ANISO_MIP_FILTER_OPTIMIZATION_HIGH_PERFORMANCE 0x00000070
+#define NV30_3D_TEX_WRAP_T__MASK 0x00000f00
+#define NV30_3D_TEX_WRAP_T__SHIFT 8
+#define NV30_3D_TEX_WRAP_T_REPEAT 0x00000100
+#define NV30_3D_TEX_WRAP_T_MIRRORED_REPEAT 0x00000200
+#define NV30_3D_TEX_WRAP_T_CLAMP_TO_EDGE 0x00000300
+#define NV30_3D_TEX_WRAP_T_CLAMP_TO_BORDER 0x00000400
+#define NV30_3D_TEX_WRAP_T_CLAMP 0x00000500
+#define NV40_3D_TEX_WRAP_T_MIRROR_CLAMP_TO_EDGE 0x00000600
+#define NV40_3D_TEX_WRAP_T_MIRROR_CLAMP_TO_BORDER 0x00000700
+#define NV40_3D_TEX_WRAP_T_MIRROR_CLAMP 0x00000800
+#define NV30_3D_TEX_WRAP_EXPAND_NORMAL 0x0000f000
+#define NV30_3D_TEX_WRAP_R__MASK 0x000f0000
+#define NV30_3D_TEX_WRAP_R__SHIFT 16
+#define NV30_3D_TEX_WRAP_R_REPEAT 0x00010000
+#define NV30_3D_TEX_WRAP_R_MIRRORED_REPEAT 0x00020000
+#define NV30_3D_TEX_WRAP_R_CLAMP_TO_EDGE 0x00030000
+#define NV30_3D_TEX_WRAP_R_CLAMP_TO_BORDER 0x00040000
+#define NV30_3D_TEX_WRAP_R_CLAMP 0x00050000
+#define NV40_3D_TEX_WRAP_R_MIRROR_CLAMP_TO_EDGE 0x00060000
+#define NV40_3D_TEX_WRAP_R_MIRROR_CLAMP_TO_BORDER 0x00070000
+#define NV40_3D_TEX_WRAP_R_MIRROR_CLAMP 0x00080000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER__MASK 0x00f00000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER__SHIFT 20
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER_NONE 0x00000000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER_RED 0x00100000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER_GREEN 0x00200000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER_BLUE 0x00400000
+#define NV40_3D_TEX_WRAP_GAMMA_DECREASE_FILTER_ALL 0x00f00000
+#define NV30_3D_TEX_WRAP_RCOMP__MASK 0xf0000000
+#define NV30_3D_TEX_WRAP_RCOMP__SHIFT 28
+#define NV30_3D_TEX_WRAP_RCOMP_NEVER 0x00000000
+#define NV30_3D_TEX_WRAP_RCOMP_GREATER 0x10000000
+#define NV30_3D_TEX_WRAP_RCOMP_EQUAL 0x20000000
+#define NV30_3D_TEX_WRAP_RCOMP_GEQUAL 0x30000000
+#define NV30_3D_TEX_WRAP_RCOMP_LESS 0x40000000
+#define NV30_3D_TEX_WRAP_RCOMP_NOTEQUAL 0x50000000
+#define NV30_3D_TEX_WRAP_RCOMP_LEQUAL 0x60000000
+#define NV30_3D_TEX_WRAP_RCOMP_ALWAYS 0x70000000
+
+#define NV30_3D_TEX_ENABLE(i0) (0x00001a0c + 0x20*(i0))
+#define NV30_3D_TEX_ENABLE__ESIZE 0x00000020
+#define NV30_3D_TEX_ENABLE__LEN 0x00000008
+#define NV30_3D_TEX_ENABLE_ANISO__MASK 0x00000030
+#define NV30_3D_TEX_ENABLE_ANISO__SHIFT 4
+#define NV30_3D_TEX_ENABLE_ANISO_NONE 0x00000000
+#define NV30_3D_TEX_ENABLE_ANISO_2X 0x00000010
+#define NV30_3D_TEX_ENABLE_ANISO_4X 0x00000020
+#define NV30_3D_TEX_ENABLE_ANISO_8X 0x00000030
+#define NV40_3D_TEX_ENABLE_ANISO__MASK 0x000000f0
+#define NV40_3D_TEX_ENABLE_ANISO__SHIFT 4
+#define NV40_3D_TEX_ENABLE_ANISO_NONE 0x00000000
+#define NV40_3D_TEX_ENABLE_ANISO_2X 0x00000010
+#define NV40_3D_TEX_ENABLE_ANISO_4X 0x00000020
+#define NV40_3D_TEX_ENABLE_ANISO_6X 0x00000030
+#define NV40_3D_TEX_ENABLE_ANISO_8X 0x00000040
+#define NV40_3D_TEX_ENABLE_ANISO_10X 0x00000050
+#define NV40_3D_TEX_ENABLE_ANISO_12X 0x00000060
+#define NV40_3D_TEX_ENABLE_ANISO_16X 0x00000070
+#define NV30_3D_TEX_ENABLE_MIPMAP_MAX_LOD__MASK 0x0003c000
+#define NV30_3D_TEX_ENABLE_MIPMAP_MAX_LOD__SHIFT 14
+#define NV40_3D_TEX_ENABLE_MIPMAP_MAX_LOD__MASK 0x00038000
+#define NV40_3D_TEX_ENABLE_MIPMAP_MAX_LOD__SHIFT 15
+#define NV30_3D_TEX_ENABLE_MIPMAP_MIN_LOD__MASK 0x3c000000
+#define NV30_3D_TEX_ENABLE_MIPMAP_MIN_LOD__SHIFT 26
+#define NV40_3D_TEX_ENABLE_MIPMAP_MIN_LOD__MASK 0x38000000
+#define NV40_3D_TEX_ENABLE_MIPMAP_MIN_LOD__SHIFT 27
+#define NV30_3D_TEX_ENABLE_ENABLE 0x40000000
+#define NV40_3D_TEX_ENABLE_ENABLE 0x80000000
+
+#define NV30_3D_TEX_SWIZZLE(i0) (0x00001a10 + 0x20*(i0))
+#define NV30_3D_TEX_SWIZZLE__ESIZE 0x00000020
+#define NV30_3D_TEX_SWIZZLE__LEN 0x00000008
+#define NV30_3D_TEX_SWIZZLE_S1_W__MASK 0x00000003
+#define NV30_3D_TEX_SWIZZLE_S1_W__SHIFT 0
+#define NV30_3D_TEX_SWIZZLE_S1_W_W 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S1_W_Z 0x00000001
+#define NV30_3D_TEX_SWIZZLE_S1_W_Y 0x00000002
+#define NV30_3D_TEX_SWIZZLE_S1_W_X 0x00000003
+#define NV30_3D_TEX_SWIZZLE_S1_Z__MASK 0x0000000c
+#define NV30_3D_TEX_SWIZZLE_S1_Z__SHIFT 2
+#define NV30_3D_TEX_SWIZZLE_S1_Z_W 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S1_Z_Z 0x00000004
+#define NV30_3D_TEX_SWIZZLE_S1_Z_Y 0x00000008
+#define NV30_3D_TEX_SWIZZLE_S1_Z_X 0x0000000c
+#define NV30_3D_TEX_SWIZZLE_S1_Y__MASK 0x00000030
+#define NV30_3D_TEX_SWIZZLE_S1_Y__SHIFT 4
+#define NV30_3D_TEX_SWIZZLE_S1_Y_W 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S1_Y_Z 0x00000010
+#define NV30_3D_TEX_SWIZZLE_S1_Y_Y 0x00000020
+#define NV30_3D_TEX_SWIZZLE_S1_Y_X 0x00000030
+#define NV30_3D_TEX_SWIZZLE_S1_X__MASK 0x000000c0
+#define NV30_3D_TEX_SWIZZLE_S1_X__SHIFT 6
+#define NV30_3D_TEX_SWIZZLE_S1_X_W 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S1_X_Z 0x00000040
+#define NV30_3D_TEX_SWIZZLE_S1_X_Y 0x00000080
+#define NV30_3D_TEX_SWIZZLE_S1_X_X 0x000000c0
+#define NV30_3D_TEX_SWIZZLE_S0_W__MASK 0x00000300
+#define NV30_3D_TEX_SWIZZLE_S0_W__SHIFT 8
+#define NV30_3D_TEX_SWIZZLE_S0_W_ZERO 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S0_W_ONE 0x00000100
+#define NV30_3D_TEX_SWIZZLE_S0_W_S1 0x00000200
+#define NV30_3D_TEX_SWIZZLE_S0_Z__MASK 0x00000c00
+#define NV30_3D_TEX_SWIZZLE_S0_Z__SHIFT 10
+#define NV30_3D_TEX_SWIZZLE_S0_Z_ZERO 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S0_Z_ONE 0x00000400
+#define NV30_3D_TEX_SWIZZLE_S0_Z_S1 0x00000800
+#define NV30_3D_TEX_SWIZZLE_S0_Y__MASK 0x00003000
+#define NV30_3D_TEX_SWIZZLE_S0_Y__SHIFT 12
+#define NV30_3D_TEX_SWIZZLE_S0_Y_ZERO 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S0_Y_ONE 0x00001000
+#define NV30_3D_TEX_SWIZZLE_S0_Y_S1 0x00002000
+#define NV30_3D_TEX_SWIZZLE_S0_X__MASK 0x0000c000
+#define NV30_3D_TEX_SWIZZLE_S0_X__SHIFT 14
+#define NV30_3D_TEX_SWIZZLE_S0_X_ZERO 0x00000000
+#define NV30_3D_TEX_SWIZZLE_S0_X_ONE 0x00004000
+#define NV30_3D_TEX_SWIZZLE_S0_X_S1 0x00008000
+#define NV30_3D_TEX_SWIZZLE_RECT_PITCH__MASK 0xffff0000
+#define NV30_3D_TEX_SWIZZLE_RECT_PITCH__SHIFT 16
+
+#define NV30_3D_TEX_FILTER(i0) (0x00001a14 + 0x20*(i0))
+#define NV30_3D_TEX_FILTER__ESIZE 0x00000020
+#define NV30_3D_TEX_FILTER__LEN 0x00000008
+#define NV30_3D_TEX_FILTER_LOD_BIAS__MASK 0x00000f00
+#define NV30_3D_TEX_FILTER_LOD_BIAS__SHIFT 8
+#define NV30_3D_TEX_FILTER_MIN__MASK 0x000f0000
+#define NV30_3D_TEX_FILTER_MIN__SHIFT 16
+#define NV30_3D_TEX_FILTER_MIN_NEAREST 0x00010000
+#define NV30_3D_TEX_FILTER_MIN_LINEAR 0x00020000
+#define NV30_3D_TEX_FILTER_MIN_NEAREST_MIPMAP_NEAREST 0x00030000
+#define NV30_3D_TEX_FILTER_MIN_LINEAR_MIPMAP_NEAREST 0x00040000
+#define NV30_3D_TEX_FILTER_MIN_NEAREST_MIPMAP_LINEAR 0x00050000
+#define NV30_3D_TEX_FILTER_MIN_LINEAR_MIPMAP_LINEAR 0x00060000
+#define NV30_3D_TEX_FILTER_MAG__MASK 0x0f000000
+#define NV30_3D_TEX_FILTER_MAG__SHIFT 24
+#define NV30_3D_TEX_FILTER_MAG_NEAREST 0x01000000
+#define NV30_3D_TEX_FILTER_MAG_LINEAR 0x02000000
+#define NV30_3D_TEX_FILTER_SIGNED_BLUE 0x10000000
+#define NV30_3D_TEX_FILTER_SIGNED_GREEN 0x20000000
+#define NV30_3D_TEX_FILTER_SIGNED_RED 0x40000000
+#define NV30_3D_TEX_FILTER_SIGNED_ALPHA 0x80000000
+
+#define NV30_3D_TEX_NPOT_SIZE(i0) (0x00001a18 + 0x20*(i0))
+#define NV30_3D_TEX_NPOT_SIZE__ESIZE 0x00000020
+#define NV30_3D_TEX_NPOT_SIZE__LEN 0x00000008
+#define NV30_3D_TEX_NPOT_SIZE_H__MASK 0x0000ffff
+#define NV30_3D_TEX_NPOT_SIZE_H__SHIFT 0
+#define NV30_3D_TEX_NPOT_SIZE_W__MASK 0xffff0000
+#define NV30_3D_TEX_NPOT_SIZE_W__SHIFT 16
+
+#define NV30_3D_TEX_BORDER_COLOR(i0) (0x00001a1c + 0x20*(i0))
+#define NV30_3D_TEX_BORDER_COLOR__ESIZE 0x00000020
+#define NV30_3D_TEX_BORDER_COLOR__LEN 0x00000008
+#define NV30_3D_TEX_BORDER_COLOR_B__MASK 0x000000ff
+#define NV30_3D_TEX_BORDER_COLOR_B__SHIFT 0
+#define NV30_3D_TEX_BORDER_COLOR_G__MASK 0x0000ff00
+#define NV30_3D_TEX_BORDER_COLOR_G__SHIFT 8
+#define NV30_3D_TEX_BORDER_COLOR_R__MASK 0x00ff0000
+#define NV30_3D_TEX_BORDER_COLOR_R__SHIFT 16
+#define NV30_3D_TEX_BORDER_COLOR_A__MASK 0xff000000
+#define NV30_3D_TEX_BORDER_COLOR_A__SHIFT 24
+
+#define NV30_3D_VTX_ATTR_4F(i0) (0x00001c00 + 0x10*(i0))
+#define NV30_3D_VTX_ATTR_4F__ESIZE 0x00000010
+#define NV30_3D_VTX_ATTR_4F__LEN 0x00000010
+
+
+#define NV30_3D_VTX_ATTR_4F_X(i0) (0x00001c00 + 0x10*(i0))
+
+#define NV30_3D_VTX_ATTR_4F_Y(i0) (0x00001c04 + 0x10*(i0))
+
+#define NV30_3D_VTX_ATTR_4F_Z(i0) (0x00001c08 + 0x10*(i0))
+
+#define NV30_3D_VTX_ATTR_4F_W(i0) (0x00001c0c + 0x10*(i0))
+
+#define NV30_3D_FP_CONTROL 0x00001d60
+#define NV30_3D_FP_CONTROL_USED_REGS_MINUS1_DIV2__MASK 0x0000000f
+#define NV30_3D_FP_CONTROL_USED_REGS_MINUS1_DIV2__SHIFT 0
+#define NV30_3D_FP_CONTROL_USES_KIL 0x00000080
+#define NV40_3D_FP_CONTROL_KIL 0x00000080
+#define NV40_3D_FP_CONTROL_TEMP_COUNT__MASK 0xff000000
+#define NV40_3D_FP_CONTROL_TEMP_COUNT__SHIFT 24
+
+#define NV30_3D_DEPTH_CONTROL 0x00001d78
+#define NV30_3D_DEPTH_CONTROL_CLAMP 0x000000f0
+
+#define NV30_3D_MULTISAMPLE_CONTROL 0x00001d7c
+#define NV30_3D_MULTISAMPLE_CONTROL_ENABLE 0x00000001
+#define NV30_3D_MULTISAMPLE_CONTROL_SAMPLE_ALPHA_TO_COVERAGE 0x00000010
+#define NV30_3D_MULTISAMPLE_CONTROL_SAMPLE_ALPHA_TO_ONE 0x00000100
+#define NV30_3D_MULTISAMPLE_CONTROL_SAMPLE_COVERAGE__MASK 0xffff0000
+#define NV30_3D_MULTISAMPLE_CONTROL_SAMPLE_COVERAGE__SHIFT 16
+
+#define NV30_3D_COORD_CONVENTIONS 0x00001d88
+#define NV30_3D_COORD_CONVENTIONS_HEIGHT__MASK 0x00000fff
+#define NV30_3D_COORD_CONVENTIONS_HEIGHT__SHIFT 0
+#define NV30_3D_COORD_CONVENTIONS_ORIGIN__MASK 0x00001000
+#define NV30_3D_COORD_CONVENTIONS_ORIGIN__SHIFT 12
+#define NV30_3D_COORD_CONVENTIONS_ORIGIN_NORMAL 0x00000000
+#define NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED 0x00001000
+#define NV30_3D_COORD_CONVENTIONS_CENTER__MASK 0x00010000
+#define NV30_3D_COORD_CONVENTIONS_CENTER__SHIFT 16
+#define NV30_3D_COORD_CONVENTIONS_CENTER_HALF_INTEGER 0x00000000
+#define NV30_3D_COORD_CONVENTIONS_CENTER_INTEGER 0x00010000
+
+#define NV30_3D_CLEAR_DEPTH_VALUE 0x00001d8c
+
+#define NV30_3D_CLEAR_COLOR_VALUE 0x00001d90
+#define NV30_3D_CLEAR_COLOR_VALUE_B__MASK 0x000000ff
+#define NV30_3D_CLEAR_COLOR_VALUE_B__SHIFT 0
+#define NV30_3D_CLEAR_COLOR_VALUE_G__MASK 0x0000ff00
+#define NV30_3D_CLEAR_COLOR_VALUE_G__SHIFT 8
+#define NV30_3D_CLEAR_COLOR_VALUE_R__MASK 0x00ff0000
+#define NV30_3D_CLEAR_COLOR_VALUE_R__SHIFT 16
+#define NV30_3D_CLEAR_COLOR_VALUE_A__MASK 0xff000000
+#define NV30_3D_CLEAR_COLOR_VALUE_A__SHIFT 24
+
+#define NV30_3D_CLEAR_BUFFERS 0x00001d94
+#define NV30_3D_CLEAR_BUFFERS_DEPTH 0x00000001
+#define NV30_3D_CLEAR_BUFFERS_STENCIL 0x00000002
+#define NV30_3D_CLEAR_BUFFERS_COLOR_R 0x00000010
+#define NV30_3D_CLEAR_BUFFERS_COLOR_G 0x00000020
+#define NV30_3D_CLEAR_BUFFERS_COLOR_B 0x00000040
+#define NV30_3D_CLEAR_BUFFERS_COLOR_A 0x00000080
+
+#define NV30_3D_DO_VERTICES 0x00001dac
+
+#define NV30_3D_LINE_STIPPLE_ENABLE 0x00001db4
+
+#define NV30_3D_LINE_STIPPLE_PATTERN 0x00001db8
+#define NV30_3D_LINE_STIPPLE_PATTERN_FACTOR__MASK 0x0000ffff
+#define NV30_3D_LINE_STIPPLE_PATTERN_FACTOR__SHIFT 0
+#define NV30_3D_LINE_STIPPLE_PATTERN_PATTERN__MASK 0xffff0000
+#define NV30_3D_LINE_STIPPLE_PATTERN_PATTERN__SHIFT 16
+
+#define NV30_3D_BACK_MATERIAL_SHININESS(i0) (0x00001e20 + 0x4*(i0))
+#define NV30_3D_BACK_MATERIAL_SHININESS__ESIZE 0x00000004
+#define NV30_3D_BACK_MATERIAL_SHININESS__LEN 0x00000006
+
+#define NV30_3D_VTX_ATTR_1F(i0) (0x00001e40 + 0x4*(i0))
+#define NV30_3D_VTX_ATTR_1F__ESIZE 0x00000004
+#define NV30_3D_VTX_ATTR_1F__LEN 0x00000010
+
+#define NV30_3D_ENGINE 0x00001e94
+#define NV30_3D_ENGINE_FP 0x00000001
+#define NV30_3D_ENGINE_VP 0x00000002
+#define NV30_3D_ENGINE_FIXED 0x00000004
+
+#define NV30_3D_VP_UPLOAD_FROM_ID 0x00001e9c
+
+#define NV30_3D_VP_START_FROM_ID 0x00001ea0
+
+#define NV30_3D_POINT_PARAMETERS(i0) (0x00001ec0 + 0x4*(i0))
+#define NV30_3D_POINT_PARAMETERS__ESIZE 0x00000004
+#define NV30_3D_POINT_PARAMETERS__LEN 0x00000008
+
+#define NV30_3D_POINT_SIZE 0x00001ee0
+
+#define NV30_3D_POINT_PARAMETERS_ENABLE 0x00001ee4
+
+#define NV30_3D_POINT_SPRITE 0x00001ee8
+#define NV30_3D_POINT_SPRITE_ENABLE 0x00000001
+#define NV30_3D_POINT_SPRITE_R_MODE__MASK 0x00000006
+#define NV30_3D_POINT_SPRITE_R_MODE__SHIFT 1
+#define NV30_3D_POINT_SPRITE_R_MODE_ZERO 0x00000000
+#define NV30_3D_POINT_SPRITE_R_MODE_R 0x00000002
+#define NV30_3D_POINT_SPRITE_R_MODE_S 0x00000004
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_0 0x00000100
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_1 0x00000200
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_2 0x00000400
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_3 0x00000800
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_4 0x00001000
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_5 0x00002000
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_6 0x00004000
+#define NV30_3D_POINT_SPRITE_COORD_REPLACE_7 0x00008000
+
+#define NV30_3D_VP_UPLOAD_CONST_ID 0x00001efc
+
+#define NV30_3D_VP_UPLOAD_CONST(i0) (0x00001f00 + 0x10*(i0))
+#define NV30_3D_VP_UPLOAD_CONST__ESIZE 0x00000010
+#define NV30_3D_VP_UPLOAD_CONST__LEN 0x00000004
+
+
+#define NV30_3D_VP_UPLOAD_CONST_X(i0) (0x00001f00 + 0x10*(i0))
+
+#define NV30_3D_VP_UPLOAD_CONST_Y(i0) (0x00001f04 + 0x10*(i0))
+
+#define NV30_3D_VP_UPLOAD_CONST_Z(i0) (0x00001f08 + 0x10*(i0))
+
+#define NV30_3D_VP_UPLOAD_CONST_W(i0) (0x00001f0c + 0x10*(i0))
+
+#define NV30_3D_UNK1F80(i0) (0x00001f80 + 0x4*(i0))
+#define NV30_3D_UNK1F80__ESIZE 0x00000004
+#define NV30_3D_UNK1F80__LEN 0x00000010
+
+#define NV40_3D_TEX_CACHE_CTL 0x00001fd8
+
+#define NV40_3D_VP_ATTRIB_EN 0x00001ff0
+
+#define NV40_3D_VP_RESULT_EN 0x00001ff4
+
+
+#endif /* NV30_40_3D_XML */
diff --git a/src/gallium/drivers/nvfx/nv30_fragtex.c b/src/gallium/drivers/nvfx/nv30_fragtex.c
index 0c3d43fd57..d6ede5b40a 100644
--- a/src/gallium/drivers/nvfx/nv30_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv30_fragtex.c
@@ -14,11 +14,11 @@ nv30_sampler_state_init(struct pipe_context *pipe,
if (cso->max_anisotropy >= 2)
{
if (cso->max_anisotropy >= 8)
- ps->en |= NV34TCL_TX_ENABLE_ANISO_8X;
+ ps->en |= NV30_3D_TEX_ENABLE_ANISO_8X;
else if (cso->max_anisotropy >= 4)
- ps->en |= NV34TCL_TX_ENABLE_ANISO_4X;
+ ps->en |= NV30_3D_TEX_ENABLE_ANISO_4X;
else if (cso->max_anisotropy >= 2)
- ps->en |= NV34TCL_TX_ENABLE_ANISO_2X;
+ ps->en |= NV30_3D_TEX_ENABLE_ANISO_2X;
}
limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0));
@@ -27,7 +27,7 @@ nv30_sampler_state_init(struct pipe_context *pipe,
ps->max_lod = (int)CLAMP(cso->max_lod, 0.0, 15.0);
ps->min_lod = (int)CLAMP(cso->min_lod, 0.0, 15.0);
- ps->en |= NV34TCL_TX_ENABLE_ENABLE;
+ ps->en |= NV30_3D_TEX_ENABLE_ENABLE;
}
void
@@ -42,10 +42,10 @@ nv30_sampler_view_init(struct pipe_context *pipe,
assert(tf->fmt[0] >= 0);
txf = sv->u.init_fmt;
- txf |= (level != sv->base.last_level ? NV34TCL_TX_FORMAT_MIPMAP : 0);
- txf |= util_logbase2(u_minify(pt->width0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT;
- txf |= util_logbase2(u_minify(pt->height0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT;
- txf |= util_logbase2(u_minify(pt->depth0, level)) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT;
+ txf |= (level != sv->base.last_level ? NV30_3D_TEX_FORMAT_MIPMAP : 0);
+ txf |= util_logbase2(u_minify(pt->width0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_U__SHIFT;
+ txf |= util_logbase2(u_minify(pt->height0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_V__SHIFT;
+ txf |= util_logbase2(u_minify(pt->depth0, level)) << NV30_3D_TEX_FORMAT_BASE_SIZE_W__SHIFT;
txf |= 0x10000;
sv->u.nv30.fmt[0] = tf->fmt[0] | txf;
@@ -53,7 +53,7 @@ nv30_sampler_view_init(struct pipe_context *pipe,
sv->u.nv30.fmt[2] = tf->fmt[2] | txf;
sv->u.nv30.fmt[3] = tf->fmt[3] | txf;
- sv->swizzle |= (nvfx_subresource_pitch(pt, 0) << NV34TCL_TX_SWIZZLE_RECT_PITCH_SHIFT);
+ sv->swizzle |= (nvfx_subresource_pitch(pt, 0) << NV30_3D_TEX_SWIZZLE_RECT_PITCH__SHIFT);
if(pt->height0 <= 1 || util_format_is_compressed(sv->base.format))
sv->u.nv30.rect = -1;
@@ -102,13 +102,13 @@ nv30_fragtex_set(struct nvfx_context *nvfx, int unit)
txf = sv->u.nv30.fmt[ps->compare + (use_rect ? 2 : 0)];
MARK_RING(chan, 9, 2);
- OUT_RING(chan, RING_3D(NV34TCL_TX_OFFSET(unit), 8));
+ OUT_RING(chan, RING_3D(NV30_3D_TEX_OFFSET(unit), 8));
OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0);
OUT_RELOC(chan, bo, txf,
tex_flags | NOUVEAU_BO_OR,
- NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
+ NV30_3D_TEX_FORMAT_DMA0, NV30_3D_TEX_FORMAT_DMA1);
OUT_RING(chan, (ps->wrap & sv->wrap_mask) | sv->wrap);
- OUT_RING(chan, ps->en | (min_lod << NV34TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT) | (max_lod << NV34TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT));
+ OUT_RING(chan, ps->en | (min_lod << NV30_3D_TEX_ENABLE_MIPMAP_MIN_LOD__SHIFT) | (max_lod << NV30_3D_TEX_ENABLE_MIPMAP_MAX_LOD__SHIFT));
OUT_RING(chan, sv->swizzle);
OUT_RING(chan, ps->filt | sv->filt);
OUT_RING(chan, sv->npot_size);
diff --git a/src/gallium/drivers/nvfx/nv30_vertprog.h b/src/gallium/drivers/nvfx/nv30_vertprog.h
index 9a68f5c1fb..e8c16b0341 100644
--- a/src/gallium/drivers/nvfx/nv30_vertprog.h
+++ b/src/gallium/drivers/nvfx/nv30_vertprog.h
@@ -60,6 +60,9 @@
/* DWORD 0 */
+/* guess that this is the same as nv40 */
+#define NV30_VP_INST_INDEX_INPUT (1 << 27)
+
#define NV30_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
#define NV30_VP_INST_SRC2_ABS (1 << 23) /* guess */
#define NV30_VP_INST_SRC1_ABS (1 << 22) /* guess */
@@ -136,6 +139,9 @@
# define NV30_VP_INST_DEST_TC(n) (8+(n))
# define NV30_VP_INST_DEST_CLP(n) (17 + (n))
+/* guess that this is the same as nv40 */
+#define NV30_VP_INST_INDEX_CONST (1 << 1)
+
/* Useful to split the source selection regs into their pieces */
#define NV30_VP_SRC0_HIGH_SHIFT 6
#define NV30_VP_SRC0_HIGH_MASK 0x00007FC0
diff --git a/src/gallium/drivers/nvfx/nv40_fragtex.c b/src/gallium/drivers/nvfx/nv40_fragtex.c
index 106ce71a07..d4fb73702d 100644
--- a/src/gallium/drivers/nvfx/nv40_fragtex.c
+++ b/src/gallium/drivers/nvfx/nv40_fragtex.c
@@ -14,19 +14,19 @@ nv40_sampler_state_init(struct pipe_context *pipe,
ps->wrap |= (1 << 5);
if (cso->max_anisotropy >= 16)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_16X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_16X;
else if (cso->max_anisotropy >= 12)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_12X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_12X;
else if (cso->max_anisotropy >= 10)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_10X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_10X;
else if (cso->max_anisotropy >= 8)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_8X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_8X;
else if (cso->max_anisotropy >= 6)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_6X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_6X;
else if (cso->max_anisotropy >= 4)
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_4X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_4X;
else
- ps->en |= NV40TCL_TEX_ENABLE_ANISO_2X;
+ ps->en |= NV40_3D_TEX_ENABLE_ANISO_2X;
}
limit = CLAMP(cso->lod_bias, -16.0, 15.0 + (255.0 / 256.0));
@@ -35,7 +35,7 @@ nv40_sampler_state_init(struct pipe_context *pipe,
ps->max_lod = (int)(CLAMP(cso->max_lod, 0.0, 15.0 + (255.0 / 256.0)) * 256.0);
ps->min_lod = (int)(CLAMP(cso->min_lod, 0.0, 15.0 + (255.0 / 256.0)) * 256.0);
- ps->en |= NV40TCL_TEX_ENABLE_ENABLE;
+ ps->en |= NV40_3D_TEX_ENABLE_ENABLE;
}
void
@@ -52,21 +52,21 @@ nv40_sampler_view_init(struct pipe_context *pipe,
txf = sv->u.init_fmt;
txf |= 0x8000;
if(pt->target == PIPE_TEXTURE_CUBE)
- txf |= ((pt->last_level + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT);
+ txf |= ((pt->last_level + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
else
- txf |= (((sv->base.last_level - sv->base.first_level) + 1) << NV40TCL_TEX_FORMAT_MIPMAP_COUNT_SHIFT);
+ txf |= (((sv->base.last_level - sv->base.first_level) + 1) << NV40_3D_TEX_FORMAT_MIPMAP_COUNT__SHIFT);
if (!mt->linear_pitch)
sv->u.nv40.npot_size2 = 0;
else {
sv->u.nv40.npot_size2 = mt->linear_pitch;
- txf |= NV40TCL_TEX_FORMAT_LINEAR;
+ txf |= NV40_3D_TEX_FORMAT_LINEAR;
}
sv->u.nv40.fmt[0] = tf->fmt[4] | txf;
sv->u.nv40.fmt[1] = tf->fmt[5] | txf;
- sv->u.nv40.npot_size2 |= (u_minify(pt->depth0, level) << NV40TCL_TEX_SIZE1_DEPTH_SHIFT);
+ sv->u.nv40.npot_size2 |= (u_minify(pt->depth0, level) << NV40_3D_TEX_SIZE1_DEPTH__SHIFT);
sv->lod_offset = (sv->base.first_level - level) * 256;
sv->max_lod_limit = (sv->base.last_level - level) * 256;
@@ -87,17 +87,17 @@ nv40_fragtex_set(struct nvfx_context *nvfx, int unit)
txf = sv->u.nv40.fmt[ps->compare] | ps->fmt;
MARK_RING(chan, 11, 2);
- OUT_RING(chan, RING_3D(NV34TCL_TX_OFFSET(unit), 8));
+ OUT_RING(chan, RING_3D(NV30_3D_TEX_OFFSET(unit), 8));
OUT_RELOC(chan, bo, sv->offset, tex_flags | NOUVEAU_BO_LOW, 0, 0);
OUT_RELOC(chan, bo, txf, tex_flags | NOUVEAU_BO_OR,
- NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
+ NV30_3D_TEX_FORMAT_DMA0, NV30_3D_TEX_FORMAT_DMA1);
OUT_RING(chan, (ps->wrap & sv->wrap_mask) | sv->wrap);
OUT_RING(chan, ps->en | (min_lod << 19) | (max_lod << 7));
OUT_RING(chan, sv->swizzle);
OUT_RING(chan, ps->filt | sv->filt);
OUT_RING(chan, sv->npot_size);
OUT_RING(chan, ps->bcol);
- OUT_RING(chan, RING_3D(NV40TCL_TEX_SIZE1(unit), 1));
+ OUT_RING(chan, RING_3D(NV40_3D_TEX_SIZE1(unit), 1));
OUT_RING(chan, sv->u.nv40.npot_size2);
nvfx->hw_txf[unit] = txf;
diff --git a/src/gallium/drivers/nvfx/nv40_vertprog.h b/src/gallium/drivers/nvfx/nv40_vertprog.h
index 3d0a1fe3d1..c1f2208f51 100644
--- a/src/gallium/drivers/nvfx/nv40_vertprog.h
+++ b/src/gallium/drivers/nvfx/nv40_vertprog.h
@@ -38,6 +38,7 @@
#define NV40_VP_INST_COND_UPDATE_ENABLE ((1 << 14)|1<<29)
/* use address reg as index into attribs */
#define NV40_VP_INST_INDEX_INPUT (1 << 27)
+#define NV40_VP_INST_SATURATE (1 << 26)
#define NV40_VP_INST_COND_REG_SELECT_1 (1 << 25)
#define NV40_VP_INST_ADDR_REG_SELECT_1 (1 << 24)
#define NV40_VP_INST_SRC2_ABS (1 << 23)
diff --git a/src/gallium/drivers/nvfx/nvfx_context.c b/src/gallium/drivers/nvfx/nvfx_context.c
index 5a2fa14c88..95834d2327 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.c
+++ b/src/gallium/drivers/nvfx/nvfx_context.c
@@ -13,14 +13,14 @@ nvfx_flush(struct pipe_context *pipe, unsigned flags,
struct nvfx_context *nvfx = nvfx_context(pipe);
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
/* XXX: we need to actually be intelligent here */
if (flags & PIPE_FLUSH_TEXTURE_CACHE) {
- BEGIN_RING(chan, eng3d, 0x1fd8, 1);
- OUT_RING (chan, 2);
- BEGIN_RING(chan, eng3d, 0x1fd8, 1);
- OUT_RING (chan, 1);
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(0x1fd8, 1));
+ OUT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(0x1fd8, 1));
+ OUT_RING(chan, 1);
}
FIRE_RING(chan);
@@ -76,6 +76,7 @@ nvfx_create(struct pipe_screen *pscreen, void *priv)
nvfx->pipe.flush = nvfx_flush;
nvfx->is_nv4x = screen->is_nv4x;
+ nvfx->use_nv4x = screen->use_nv4x;
/* TODO: it seems that nv30 might have fixed function clipping usable with vertex programs
* However, my code for that doesn't work, so use vp clipping for all cards, which works.
*/
diff --git a/src/gallium/drivers/nvfx/nvfx_context.h b/src/gallium/drivers/nvfx/nvfx_context.h
index 4c654bfa8b..6ef2a6945d 100644
--- a/src/gallium/drivers/nvfx/nvfx_context.h
+++ b/src/gallium/drivers/nvfx/nvfx_context.h
@@ -18,7 +18,7 @@
#include "nouveau/nouveau_winsys.h"
#include "nouveau/nouveau_gldefs.h"
-
+#include "nv30-40_3d.xml.h"
#include "nvfx_state.h"
#define NOUVEAU_ERR(fmt, args...) \
@@ -141,22 +141,17 @@ struct nvfx_context {
struct nvfx_screen *screen;
unsigned is_nv4x; /* either 0 or ~0 */
+ unsigned use_nv4x; /* either 0 or ~0 */
boolean use_vp_clipping;
struct draw_context *draw;
- struct blitter_context* blitter;
+ /* one is for user-requested operations, the other is for temporary copying inside them */
+ struct blitter_context* blitter[2];
+ unsigned blitters_in_use;
struct list_head render_cache;
/* HW state derived from pipe states */
struct nvfx_state state;
- struct {
- struct nvfx_vertex_program *vertprog;
-
- unsigned nr_attribs;
- unsigned hw[PIPE_MAX_SHADER_INPUTS];
- unsigned draw[PIPE_MAX_SHADER_INPUTS];
- unsigned emit[PIPE_MAX_SHADER_INPUTS];
- } swtnl;
enum {
HW, SWTNL, SWRAST
@@ -168,7 +163,7 @@ struct nvfx_context {
struct pipe_scissor_state scissor;
unsigned stipple[32];
struct pipe_clip_state clip;
- struct nvfx_vertex_program *vertprog;
+ struct nvfx_pipe_vertex_program *vertprog;
struct nvfx_pipe_fragment_program *fragprog;
struct pipe_resource *constbuf[PIPE_SHADER_TYPES];
unsigned constbuf_nr[PIPE_SHADER_TYPES];
@@ -183,6 +178,7 @@ struct nvfx_context {
struct nvfx_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
struct nvfx_pipe_fragment_program* dummy_fs;
+ struct pipe_query* query;
unsigned nr_samplers;
unsigned nr_textures;
@@ -199,13 +195,14 @@ struct nvfx_context {
int use_vertex_buffers;
unsigned hw_vtxelt_nr;
- uint8_t hw_samplers;
- uint32_t hw_txf[8];
+ unsigned hw_samplers;
+ uint32_t hw_txf[16];
struct nvfx_render_target hw_rt[4];
struct nvfx_render_target hw_zeta;
int hw_pointsprite_control;
int hw_vp_output;
struct nvfx_fragment_program* hw_fragprog;
+ struct nvfx_vertex_program* hw_vertprog;
unsigned relocs_needed;
};
@@ -324,6 +321,7 @@ extern void nvfx_init_transfer_functions(struct pipe_context *pipe);
/* nvfx_vbo.c */
extern boolean nvfx_vbo_validate(struct nvfx_context *nvfx);
+extern void nvfx_vbo_swtnl_validate(struct nvfx_context *nvfx);
extern void nvfx_vbo_relocate(struct nvfx_context *nvfx);
extern void nvfx_idxbuf_validate(struct nvfx_context* nvfx);
extern void nvfx_idxbuf_relocate(struct nvfx_context* nvfx);
@@ -346,25 +344,25 @@ static inline void nvfx_emit_vtx_attr(struct nouveau_channel* chan, unsigned att
{
switch (ncomp) {
case 4:
- OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_4F_X(attrib), 4));
+ OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_4F_X(attrib), 4));
OUT_RING(chan, fui(v[0]));
OUT_RING(chan, fui(v[1]));
OUT_RING(chan, fui(v[2]));
OUT_RING(chan, fui(v[3]));
break;
case 3:
- OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_3F_X(attrib), 3));
+ OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_3F_X(attrib), 3));
OUT_RING(chan, fui(v[0]));
OUT_RING(chan, fui(v[1]));
OUT_RING(chan, fui(v[2]));
break;
case 2:
- OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_2F_X(attrib), 2));
+ OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_2F_X(attrib), 2));
OUT_RING(chan, fui(v[0]));
OUT_RING(chan, fui(v[1]));
break;
case 1:
- OUT_RING(chan, RING_3D(NV34TCL_VTX_ATTR_1F(attrib), 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VTX_ATTR_1F(attrib), 1));
OUT_RING(chan, fui(v[0]));
break;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_draw.c b/src/gallium/drivers/nvfx/nvfx_draw.c
index 2601d5b8e2..61f888a8ea 100644
--- a/src/gallium/drivers/nvfx/nvfx_draw.c
+++ b/src/gallium/drivers/nvfx/nvfx_draw.c
@@ -1,6 +1,5 @@
#include "pipe/p_shader_tokens.h"
#include "util/u_inlines.h"
-#include "tgsi/tgsi_ureg.h"
#include "util/u_pack_color.h"
@@ -11,11 +10,6 @@
#include "nvfx_context.h"
#include "nvfx_resource.h"
-/* Simple, but crappy, swtnl path, hopefully we wont need to hit this very
- * often at all. Uses "quadro style" vertex submission + a fixed vertex
- * layout to avoid the need to generate a vertex program or vtxfmt.
- */
-
struct nvfx_render_stage {
struct draw_stage stage;
struct nvfx_context *nvfx;
@@ -28,58 +22,18 @@ nvfx_render_stage(struct draw_stage *stage)
return (struct nvfx_render_stage *)stage;
}
-static INLINE void
-nvfx_render_vertex(struct nvfx_context *nvfx, const struct vertex_header *v)
+static void
+nvfx_render_flush(struct draw_stage *stage, unsigned flags)
{
- struct nvfx_screen *screen = nvfx->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
- unsigned i;
+ struct nvfx_render_stage *rs = nvfx_render_stage(stage);
+ struct nvfx_context *nvfx = rs->nvfx;
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
- for (i = 0; i < nvfx->swtnl.nr_attribs; i++) {
- unsigned idx = nvfx->swtnl.draw[i];
- unsigned hw = nvfx->swtnl.hw[i];
-
- WAIT_RING(chan, 5);
- switch (nvfx->swtnl.emit[i]) {
- case EMIT_OMIT:
- break;
- case EMIT_1F:
- nvfx_emit_vtx_attr(chan, hw, v->data[idx], 1);
- break;
- case EMIT_2F:
- nvfx_emit_vtx_attr(chan, hw, v->data[idx], 2);
- break;
- case EMIT_3F:
- nvfx_emit_vtx_attr(chan, hw, v->data[idx], 3);
- break;
- case EMIT_4F:
- nvfx_emit_vtx_attr(chan, hw, v->data[idx], 4);
- break;
- case 0xff:
- BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4F_X(hw), 4);
- OUT_RING (chan, fui(v->data[idx][0] / v->data[idx][3]));
- OUT_RING (chan, fui(v->data[idx][1] / v->data[idx][3]));
- OUT_RING (chan, fui(v->data[idx][2] / v->data[idx][3]));
- OUT_RING (chan, fui(1.0f / v->data[idx][3]));
- break;
- case EMIT_4UB:
- BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4UB(hw), 1);
- OUT_RING (chan, pack_ub4(float_to_ubyte(v->data[idx][0]),
- float_to_ubyte(v->data[idx][1]),
- float_to_ubyte(v->data[idx][2]),
- float_to_ubyte(v->data[idx][3])));
- case EMIT_4UB_BGRA:
- BEGIN_RING(chan, eng3d, NV34TCL_VTX_ATTR_4UB(hw), 1);
- OUT_RING (chan, pack_ub4(float_to_ubyte(v->data[idx][2]),
- float_to_ubyte(v->data[idx][1]),
- float_to_ubyte(v->data[idx][0]),
- float_to_ubyte(v->data[idx][3])));
- break;
- default:
- assert(0);
- break;
- }
+ if (rs->prim != NV30_3D_VERTEX_BEGIN_END_STOP) {
+ assert(AVAIL_RING(chan) >= 2);
+ OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+ OUT_RING(chan, NV30_3D_VERTEX_BEGIN_END_STOP);
+ rs->prim = NV30_3D_VERTEX_BEGIN_END_STOP;
}
}
@@ -92,82 +46,87 @@ nvfx_render_prim(struct draw_stage *stage, struct prim_header *prim,
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
- unsigned i;
+ boolean no_elements = nvfx->vertprog->draw_no_elements;
+ unsigned num_attribs = nvfx->vertprog->draw_elements;
- /* Ensure there's room for 4xfloat32 + potentially 3 begin/end */
- if (AVAIL_RING(chan) < ((count * 20) + 6)) {
- if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
- NOUVEAU_ERR("AIII, missed flush\n");
- assert(0);
- }
+ /* we need to account the flush as well here even if it is done afterthis
+ * function
+ */
+ if (AVAIL_RING(chan) < ((1 + count * num_attribs * 4) + 6 + 64)) {
+ nvfx_render_flush(stage, 0);
FIRE_RING(chan);
nvfx_state_emit(nvfx);
+
+ assert(AVAIL_RING(chan) >= ((1 + count * num_attribs * 4) + 6 + 64));
}
/* Switch primitive modes if necessary */
if (rs->prim != mode) {
- if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
- BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
- OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
+ if (rs->prim != NV30_3D_VERTEX_BEGIN_END_STOP) {
+ OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
+ OUT_RING(chan, NV30_3D_VERTEX_BEGIN_END_STOP);
}
- BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
+ /* XXX: any command a lot of times seems to (mostly) fix corruption that would otherwise happen */
+ /* this seems to cause issues on nv3x, and also be unneeded there */
+ if(nvfx->is_nv4x)
+ {
+ int i;
+ for(i = 0; i < 32; ++i)
+ {
+ OUT_RING(chan, RING_3D(0x1dac, 1));
+ OUT_RING(chan, 0);
+ }
+ }
+
+ OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
OUT_RING (chan, mode);
rs->prim = mode;
}
- /* Emit vertex data */
- for (i = 0; i < count; i++)
- nvfx_render_vertex(nvfx, prim->v[i]);
-
- /* If it's likely we'll need to empty the push buffer soon, finish
- * off the primitive now.
- */
- if (AVAIL_RING(chan) < ((count * 20) + 6)) {
- BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
- OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
- rs->prim = NV34TCL_VERTEX_BEGIN_END_STOP;
+ OUT_RING(chan, RING_3D_NI(NV30_3D_VERTEX_DATA, num_attribs * 4 * count));
+ if(no_elements) {
+ OUT_RING(chan, 0);
+ OUT_RING(chan, 0);
+ OUT_RING(chan, 0);
+ OUT_RING(chan, 0);
+ } else {
+ for (unsigned i = 0; i < count; ++i)
+ {
+ struct vertex_header* v = prim->v[i];
+ /* TODO: disable divide where it's causing the problem, and remove this hack */
+ OUT_RING(chan, fui(v->data[0][0] / v->data[0][3]));
+ OUT_RING(chan, fui(v->data[0][1] / v->data[0][3]));
+ OUT_RING(chan, fui(v->data[0][2] / v->data[0][3]));
+ OUT_RING(chan, fui(1.0f / v->data[0][3]));
+ OUT_RINGp(chan, &v->data[1][0], 4 * (num_attribs - 1));
+ }
}
}
static void
nvfx_render_point(struct draw_stage *draw, struct prim_header *prim)
{
- nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_POINTS, 1);
+ nvfx_render_prim(draw, prim, NV30_3D_VERTEX_BEGIN_END_POINTS, 1);
}
static void
nvfx_render_line(struct draw_stage *draw, struct prim_header *prim)
{
- nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_LINES, 2);
+ nvfx_render_prim(draw, prim, NV30_3D_VERTEX_BEGIN_END_LINES, 2);
}
static void
nvfx_render_tri(struct draw_stage *draw, struct prim_header *prim)
{
- nvfx_render_prim(draw, prim, NV34TCL_VERTEX_BEGIN_END_TRIANGLES, 3);
-}
-
-static void
-nvfx_render_flush(struct draw_stage *draw, unsigned flags)
-{
- struct nvfx_render_stage *rs = nvfx_render_stage(draw);
- struct nvfx_context *nvfx = rs->nvfx;
- struct nvfx_screen *screen = nvfx->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
-
- if (rs->prim != NV34TCL_VERTEX_BEGIN_END_STOP) {
- BEGIN_RING(chan, eng3d, NV34TCL_VERTEX_BEGIN_END, 1);
- OUT_RING (chan, NV34TCL_VERTEX_BEGIN_END_STOP);
- rs->prim = NV34TCL_VERTEX_BEGIN_END_STOP;
- }
+ nvfx_render_prim(draw, prim, NV30_3D_VERTEX_BEGIN_END_TRIANGLES, 3);
}
static void
nvfx_render_reset_stipple_counter(struct draw_stage *draw)
{
+ /* this doesn't really seem to work, but it matters rather little */
+ nvfx_render_flush(draw, 0);
}
static void
@@ -176,40 +135,11 @@ nvfx_render_destroy(struct draw_stage *draw)
FREE(draw);
}
-static struct nvfx_vertex_program *
-nvfx_create_drawvp(struct nvfx_context *nvfx)
-{
- struct ureg_program *ureg;
- uint i;
-
- ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
- if (ureg == NULL)
- return NULL;
-
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0), ureg_DECL_vs_input(ureg, 0));
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0), ureg_DECL_vs_input(ureg, 3));
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 1), ureg_DECL_vs_input(ureg, 4));
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_BCOLOR, 0), ureg_DECL_vs_input(ureg, 3));
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_BCOLOR, 1), ureg_DECL_vs_input(ureg, 4));
- ureg_MOV(ureg,
- ureg_writemask(ureg_DECL_output(ureg, TGSI_SEMANTIC_FOG, 1), TGSI_WRITEMASK_X),
- ureg_DECL_vs_input(ureg, 5));
- for (i = 0; i < 8; ++i)
- ureg_MOV(ureg, ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, i), ureg_DECL_vs_input(ureg, 8 + i));
-
- ureg_END( ureg );
-
- return ureg_create_shader_and_destroy( ureg, &nvfx->pipe );
-}
-
struct draw_stage *
nvfx_draw_render_stage(struct nvfx_context *nvfx)
{
struct nvfx_render_stage *render = CALLOC_STRUCT(nvfx_render_stage);
- if (!nvfx->swtnl.vertprog)
- nvfx->swtnl.vertprog = nvfx_create_drawvp(nvfx);
-
render->nvfx = nvfx;
render->stage.draw = nvfx->draw;
render->stage.point = nvfx_render_point;
@@ -231,6 +161,7 @@ nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info
if (!nvfx_state_validate_swtnl(nvfx))
return;
+
nvfx_state_emit(nvfx);
/* these must be passed without adding the offsets */
@@ -256,62 +187,3 @@ nvfx_draw_vbo_swtnl(struct pipe_context *pipe, const struct pipe_draw_info* info
draw_flush(nvfx->draw);
}
-
-static INLINE void
-emit_attrib(struct nvfx_context *nvfx, unsigned hw, unsigned emit,
- unsigned semantic, unsigned index)
-{
- unsigned draw_out = draw_find_shader_output(nvfx->draw, semantic, index);
- unsigned a = nvfx->swtnl.nr_attribs++;
-
- nvfx->swtnl.hw[a] = hw;
- nvfx->swtnl.emit[a] = emit;
- nvfx->swtnl.draw[a] = draw_out;
-}
-
-void
-nvfx_vtxfmt_validate(struct nvfx_context *nvfx)
-{
- struct nvfx_pipe_fragment_program *pfp = nvfx->fragprog;
- unsigned colour = 0, texcoords = 0, fog = 0, i;
-
- /* Determine needed fragprog inputs */
- for (i = 0; i < pfp->info.num_inputs; i++) {
- switch (pfp->info.input_semantic_name[i]) {
- case TGSI_SEMANTIC_POSITION:
- break;
- case TGSI_SEMANTIC_COLOR:
- colour |= (1 << pfp->info.input_semantic_index[i]);
- break;
- case TGSI_SEMANTIC_GENERIC:
- texcoords |= (1 << pfp->info.input_semantic_index[i]);
- break;
- case TGSI_SEMANTIC_FOG:
- fog = 1;
- break;
- default:
- assert(0);
- }
- }
-
- nvfx->swtnl.nr_attribs = 0;
-
- /* Map draw vtxprog output to hw attribute IDs */
- for (i = 0; i < 2; i++) {
- if (!(colour & (1 << i)))
- continue;
- emit_attrib(nvfx, 3 + i, EMIT_4F, TGSI_SEMANTIC_COLOR, i);
- }
-
- for (i = 0; i < 8; i++) {
- if (!(texcoords & (1 << i)))
- continue;
- emit_attrib(nvfx, 8 + i, EMIT_4F, TGSI_SEMANTIC_GENERIC, i);
- }
-
- if (fog) {
- emit_attrib(nvfx, 5, EMIT_1F, TGSI_SEMANTIC_FOG, 0);
- }
-
- emit_attrib(nvfx, 0, 0xff, TGSI_SEMANTIC_POSITION, 0);
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_fragprog.c b/src/gallium/drivers/nvfx/nvfx_fragprog.c
index 275672a31f..d97cab8db1 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragprog.c
@@ -1,3 +1,4 @@
+#include <float.h>
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
@@ -14,9 +15,6 @@
#include "nvfx_shader.h"
#include "nvfx_resource.h"
-#define MAX_CONSTS 128
-#define MAX_IMM 32
-
struct nvfx_fpc {
struct nvfx_pipe_fragment_program* pfp;
struct nvfx_fragment_program *fp;
@@ -33,13 +31,9 @@ struct nvfx_fpc {
unsigned inst_offset;
unsigned have_const;
- struct {
- int pipe;
- float vals[4];
- } consts[MAX_CONSTS];
- int nr_consts;
+ struct util_dynarray imm_data;
- struct nvfx_reg imm[MAX_IMM];
+ struct nvfx_reg* r_imm;
unsigned nr_imm;
unsigned char generic_to_slot[256]; /* semantic idx for each input semantic */
@@ -72,19 +66,14 @@ release_temps(struct nvfx_fpc *fpc)
fpc->r_temps_discard = 0ULL;
}
-static INLINE struct nvfx_reg
-constant(struct nvfx_fpc *fpc, int pipe, float vals[4])
+static inline struct nvfx_reg
+nvfx_fp_imm(struct nvfx_fpc *fpc, float a, float b, float c, float d)
{
- int idx;
-
- if (fpc->nr_consts == MAX_CONSTS)
- assert(0);
- idx = fpc->nr_consts++;
+ float v[4] = {a, b, c, d};
+ int idx = fpc->imm_data.size >> 4;
- fpc->consts[idx].pipe = pipe;
- if (pipe == -1)
- memcpy(fpc->consts[idx].vals, vals, 4 * sizeof(float));
- return nvfx_reg(NVFXSR_CONST, idx);
+ memcpy(util_dynarray_grow(&fpc->imm_data, sizeof(float) * 4), v, 4 * sizeof(float));
+ return nvfx_reg(NVFXSR_IMM, idx);
}
static void
@@ -121,26 +110,35 @@ emit_src(struct nvfx_fpc *fpc, int pos, struct nvfx_src src)
//printf("adding relocation at %x for %x\n", fpc->inst_offset, src.index);
util_dynarray_append(&fpc->fp->slot_relocations[src.reg.index], unsigned, fpc->inst_offset + pos + 1);
break;
+ case NVFXSR_IMM:
+ if (!fpc->have_const) {
+ grow_insns(fpc, 4);
+ hw = &fp->insn[fpc->inst_offset];
+ fpc->have_const = 1;
+ }
+
+ memcpy(&fp->insn[fpc->inst_offset + 4],
+ (float*)fpc->imm_data.data + src.reg.index * 4,
+ sizeof(uint32_t) * 4);
+
+ sr |= (NVFX_FP_REG_TYPE_CONST << NVFX_FP_REG_TYPE_SHIFT);
+ break;
case NVFXSR_CONST:
if (!fpc->have_const) {
grow_insns(fpc, 4);
+ hw = &fp->insn[fpc->inst_offset];
fpc->have_const = 1;
}
- hw = &fp->insn[fpc->inst_offset];
- if (fpc->consts[src.reg.index].pipe >= 0) {
+ {
struct nvfx_fragment_program_data *fpd;
fp->consts = realloc(fp->consts, ++fp->nr_consts *
sizeof(*fpd));
fpd = &fp->consts[fp->nr_consts - 1];
fpd->offset = fpc->inst_offset + 4;
- fpd->index = fpc->consts[src.reg.index].pipe;
+ fpd->index = src.reg.index;
memset(&fp->insn[fpd->offset], 0, sizeof(uint32_t) * 4);
- } else {
- memcpy(&fp->insn[fpc->inst_offset + 4],
- fpc->consts[src.reg.index].vals,
- sizeof(uint32_t) * 4);
}
sr |= (NVFX_FP_REG_TYPE_CONST << NVFX_FP_REG_TYPE_SHIFT);
@@ -207,7 +205,7 @@ nvfx_fp_emit(struct nvfx_fpc *fpc, struct nvfx_insn insn)
memset(hw, 0, sizeof(uint32_t) * 4);
if (insn.op == NVFX_FP_OP_OPCODE_KIL)
- fp->fp_control |= NV34TCL_FP_CONTROL_USES_KIL;
+ fp->fp_control |= NV30_3D_FP_CONTROL_USES_KIL;
hw[0] |= (insn.op << NVFX_FP_OP_OPCODE_SHIFT);
hw[0] |= (insn.mask << NVFX_FP_OP_OUTMASK_SHIFT);
hw[2] |= (insn.scale << NVFX_FP_OP_DST_SCALE_SHIFT);
@@ -408,11 +406,11 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc)
}
break;
case TGSI_FILE_CONSTANT:
- src.reg = constant(fpc, fsrc->Register.Index, NULL);
+ src.reg = nvfx_reg(NVFXSR_CONST, fsrc->Register.Index);
break;
case TGSI_FILE_IMMEDIATE:
assert(fsrc->Register.Index < fpc->nr_imm);
- src.reg = fpc->imm[fsrc->Register.Index];
+ src.reg = fpc->r_imm[fsrc->Register.Index];
break;
case TGSI_FILE_TEMPORARY:
src.reg = fpc->r_temp[fsrc->Register.Index];
@@ -434,6 +432,9 @@ tgsi_src(struct nvfx_fpc *fpc, const struct tgsi_full_src_register *fsrc)
src.swz[1] = fsrc->Register.SwizzleY;
src.swz[2] = fsrc->Register.SwizzleZ;
src.swz[3] = fsrc->Register.SwizzleW;
+ src.indirect = 0;
+ src.indirect_reg = 0;
+ src.indirect_swz = 0;
return src;
}
@@ -470,7 +471,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
{
const struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0));
struct nvfx_insn insn;
- struct nvfx_src src[3], tmp, tmp2;
+ struct nvfx_src src[3], tmp;
struct nvfx_reg dst;
int mask, sat, unit = 0;
int ai = -1, ci = -1, ii = -1;
@@ -495,7 +496,21 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
switch (fsrc->Register.File) {
case TGSI_FILE_INPUT:
- if (ai == -1 || ai == fsrc->Register.Index) {
+ if(fpc->pfp->info.input_semantic_name[fsrc->Register.Index] == TGSI_SEMANTIC_FOG && (0
+ || fsrc->Register.SwizzleX == PIPE_SWIZZLE_ALPHA
+ || fsrc->Register.SwizzleY == PIPE_SWIZZLE_ALPHA
+ || fsrc->Register.SwizzleZ == PIPE_SWIZZLE_ALPHA
+ || fsrc->Register.SwizzleW == PIPE_SWIZZLE_ALPHA
+ )) {
+ /* hardware puts 0 in fogcoord.w, but GL/Gallium want 1 there */
+ struct nvfx_src addend = nvfx_src(nvfx_fp_imm(fpc, 0, 0, 0, 1));
+ addend.swz[0] = fsrc->Register.SwizzleX;
+ addend.swz[1] = fsrc->Register.SwizzleY;
+ addend.swz[2] = fsrc->Register.SwizzleZ;
+ addend.swz[3] = fsrc->Register.SwizzleW;
+ src[i] = nvfx_src(temp(fpc));
+ nvfx_fp_emit(fpc, arith(0, ADD, src[i].reg, NVFX_FP_MASK_ALL, tgsi_src(fpc, fsrc), addend, none));
+ } else if (ai == -1 || ai == fsrc->Register.Index) {
ai = fsrc->Register.Index;
src[i] = tgsi_src(fpc, fsrc);
} else {
@@ -629,7 +644,27 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
case TGSI_OPCODE_LG2:
nvfx_fp_emit(fpc, arith(sat, LG2, dst, mask, src[0], none, none));
break;
-// case TGSI_OPCODE_LIT:
+ case TGSI_OPCODE_LIT:
+ if(!nvfx->is_nv4x)
+ nvfx_fp_emit(fpc, arith(sat, LIT_NV30, dst, mask, src[0], src[1], src[2]));
+ else {
+ /* we use FLT_MIN, so that log2 never gives -infinity, and thus multiplication by
+ * specular 0 always gives 0, so that ex2 gives 1, to satisfy the 0^0 = 1 requirement
+ *
+ * NOTE: if we start using half precision, we might need an fp16 FLT_MIN here instead
+ */
+ struct nvfx_src maxs = nvfx_src(nvfx_fp_imm(fpc, 0, FLT_MIN, 0, 0));
+ tmp = nvfx_src(temp(fpc));
+ if (ci>= 0 || ii >= 0) {
+ nvfx_fp_emit(fpc, arith(0, MOV, tmp.reg, NVFX_FP_MASK_X | NVFX_FP_MASK_Y, maxs, none, none));
+ maxs = tmp;
+ }
+ nvfx_fp_emit(fpc, arith(0, MAX, tmp.reg, NVFX_FP_MASK_Y | NVFX_FP_MASK_W, swz(src[0], X, X, X, Y), swz(maxs, X, X, Y, Y), none));
+ nvfx_fp_emit(fpc, arith(0, LG2, tmp.reg, NVFX_FP_MASK_W, swz(tmp, W, W, W, W), none, none));
+ nvfx_fp_emit(fpc, arith(0, MUL, tmp.reg, NVFX_FP_MASK_W, swz(tmp, W, W, W, W), swz(src[0], W, W, W, W), none));
+ nvfx_fp_emit(fpc, arith(sat, LITEX2_NV40, dst, mask, swz(tmp, Y, Y, W, W), none, none));
+ }
+ break;
case TGSI_OPCODE_LRP:
if(!nvfx->is_nv4x)
nvfx_fp_emit(fpc, arith(sat, LRP_NV30, dst, mask, src[0], src[1], src[2]));
@@ -735,12 +770,24 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
nvfx_fp_emit(fpc, arith(sat, SNE, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SSG:
- tmp = nvfx_src(temp(fpc));
- tmp2 = nvfx_src(temp(fpc));
- nvfx_fp_emit(fpc, arith(0, SGT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none));
- nvfx_fp_emit(fpc, arith(0, SLT, tmp.reg, mask, src[0], nvfx_src(nvfx_reg(NVFXSR_CONST, 0)), none));
- nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, tmp, neg(tmp2), none));
+ {
+ struct nvfx_src minones = swz(nvfx_src(nvfx_fp_imm(fpc, -1, -1, -1, -1)), X, X, X, X);
+
+ insn = arith(sat, MOV, dst, mask, src[0], none, none);
+ insn.cc_update = 1;
+ nvfx_fp_emit(fpc, insn);
+
+ insn = arith(0, STR, dst, mask, none, none, none);
+ insn.cc_test = NVFX_COND_GT;
+ nvfx_fp_emit(fpc, insn);
+
+ if(!sat) {
+ insn = arith(0, MOV, dst, mask, minones, none, none);
+ insn.cc_test = NVFX_COND_LT;
+ nvfx_fp_emit(fpc, insn);
+ }
break;
+ }
case TGSI_OPCODE_STR:
nvfx_fp_emit(fpc, arith(sat, STR, dst, mask, src[0], src[1], none));
break;
@@ -784,7 +831,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
case TGSI_OPCODE_IF:
// MOVRC0 R31 (TR0.xyzw), R<src>:
// IF (NE.xxxx) ELSE <else> END <end>
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
nv40_fp_if(fpc, src[0]);
break;
@@ -792,7 +839,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
case TGSI_OPCODE_ELSE:
{
uint32_t *hw;
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
assert(util_dynarray_contains(&fpc->if_stack, unsigned));
hw = &fpc->fp->insn[util_dynarray_top(&fpc->if_stack, unsigned)];
@@ -803,7 +850,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
case TGSI_OPCODE_ENDIF:
{
uint32_t *hw;
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
assert(util_dynarray_contains(&fpc->if_stack, unsigned));
hw = &fpc->fp->insn[util_dynarray_pop(&fpc->if_stack, unsigned)];
@@ -826,19 +873,19 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
break;
case TGSI_OPCODE_CAL:
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
nv40_fp_cal(fpc, finst->Label.Label);
break;
case TGSI_OPCODE_RET:
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
nv40_fp_ret(fpc);
break;
case TGSI_OPCODE_BGNLOOP:
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
/* TODO: we should support using two nested REPs to allow a > 255 iteration count */
nv40_fp_rep(fpc, 255, finst->Label.Label);
@@ -848,7 +895,7 @@ nvfx_fragprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
break;
case TGSI_OPCODE_BRK:
- if(!nvfx->is_nv4x)
+ if(!nvfx->use_nv4x)
goto nv3x_cflow;
nv40_fp_brk(fpc);
break;
@@ -903,7 +950,7 @@ nvfx_fragprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_fpc *fpc,
case 2: hw = 3; break;
case 3: hw = 4; break;
}
- if(hw > ((nvfx->is_nv4x) ? 4 : 2)) {
+ if(hw > ((nvfx->use_nv4x) ? 4 : 2)) {
NOUVEAU_ERR("bad rcol index\n");
return FALSE;
}
@@ -924,19 +971,17 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc)
struct tgsi_parse_context p;
int high_temp = -1, i;
struct util_semantic_set set;
- float const0v[4] = {0, 0, 0, 0};
- struct nvfx_reg const0;
+ unsigned num_texcoords = nvfx->use_nv4x ? 10 : 8;
fpc->fp->num_slots = util_semantic_set_from_program_file(&set, fpc->pfp->pipe.tokens, TGSI_FILE_INPUT);
- if(fpc->fp->num_slots > 8)
+ if(fpc->fp->num_slots > num_texcoords)
return FALSE;
- util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, 8);
- util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, 8);
+ util_semantic_layout_from_set(fpc->fp->slot_to_generic, &set, 0, num_texcoords);
+ util_semantic_table_from_layout(fpc->generic_to_slot, fpc->fp->slot_to_generic, 0, num_texcoords);
memset(fpc->fp->slot_to_fp_input, 0xff, sizeof(fpc->fp->slot_to_fp_input));
- const0 = constant(fpc, -1, const0v);
- assert(const0.index == 0);
+ fpc->r_imm = CALLOC(fpc->pfp->info.immediate_count, sizeof(struct nvfx_reg));
tgsi_parse_init(&p, fpc->pfp->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&p)) {
@@ -967,19 +1012,14 @@ nvfx_fragprog_prepare(struct nvfx_context* nvfx, struct nvfx_fpc *fpc)
case TGSI_TOKEN_TYPE_IMMEDIATE:
{
struct tgsi_full_immediate *imm;
- float vals[4];
imm = &p.FullToken.FullImmediate;
assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32);
- assert(fpc->nr_imm < MAX_IMM);
+ assert(fpc->nr_imm < fpc->pfp->info.immediate_count);
- vals[0] = imm->u[0].Float;
- vals[1] = imm->u[1].Float;
- vals[2] = imm->u[2].Float;
- vals[3] = imm->u[3].Float;
- fpc->imm[fpc->nr_imm++] = constant(fpc, -1, vals);
- }
+ fpc->r_imm[fpc->nr_imm++] = nvfx_fp_imm(fpc, imm->u[0].Float, imm->u[1].Float, imm->u[2].Float, imm->u[3].Float);
break;
+ }
default:
break;
}
@@ -1025,11 +1065,21 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx,
if (!fpc)
goto out_err;
- fpc->max_temps = nvfx->is_nv4x ? 48 : 32;
+ fpc->max_temps = nvfx->use_nv4x ? 48 : 32;
fpc->pfp = pfp;
fpc->fp = fp;
fpc->num_regs = 2;
+ for (unsigned i = 0; i < pfp->info.num_properties; ++i) {
+ if (pfp->info.properties[i].name == TGSI_PROPERTY_FS_COORD_ORIGIN) {
+ if(pfp->info.properties[i].data[0])
+ fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED;
+ } else if (pfp->info.properties[i].name == TGSI_PROPERTY_FS_COORD_PIXEL_CENTER) {
+ if(pfp->info.properties[i].data[0])
+ fp->coord_conventions |= NV30_3D_COORD_CONVENTIONS_CENTER_INTEGER;
+ }
+ }
+
if (!nvfx_fragprog_prepare(nvfx, fpc))
goto out_err;
@@ -1040,8 +1090,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx,
{
struct nvfx_reg reg = temp(fpc);
struct nvfx_src sprite_input = nvfx_src(nvfx_reg(NVFXSR_RELOCATED, fp->num_slots));
- float v[4] = {1, -1, 0, 0};
- struct nvfx_src imm = nvfx_src(constant(fpc, -1, v));
+ struct nvfx_src imm = nvfx_src(nvfx_fp_imm(fpc, 1, -1, 0, 0));
fpc->sprite_coord_temp = reg.index;
fpc->r_temps_discard = 0ULL;
@@ -1078,7 +1127,7 @@ nvfx_fragprog_translate(struct nvfx_context *nvfx,
if(!nvfx->is_nv4x)
fp->fp_control |= (fpc->num_regs-1)/2;
else
- fp->fp_control |= fpc->num_regs << NV40TCL_FP_CONTROL_TEMP_COUNT_SHIFT;
+ fp->fp_control |= fpc->num_regs << NV40_3D_FP_CONTROL_TEMP_COUNT__SHIFT;
/* Terminate final instruction */
if(fp->insn)
@@ -1119,6 +1168,7 @@ out:
FREE(fpc->r_temp);
util_dynarray_fini(&fpc->if_stack);
util_dynarray_fini(&fpc->label_relocs);
+ util_dynarray_fini(&fpc->imm_data);
//util_dynarray_fini(&fpc->loop_stack);
FREE(fpc);
}
@@ -1230,7 +1280,7 @@ nvfx_fragprog_validate(struct nvfx_context *nvfx)
pfp->fps[key] = fp;
}
- vp = nvfx->render_mode == HW ? nvfx->vertprog : nvfx->swtnl.vertprog;
+ vp = nvfx->hw_vertprog;
if (fp->last_vp_id != vp->id || fp->last_sprite_coord_enable != sprite_coord_enable) {
int sprite_real_input = -1;
@@ -1450,17 +1500,17 @@ update:
nvfx->hw_fragprog = fp;
MARK_RING(chan, 8, 1);
- OUT_RING(chan, RING_3D(NV34TCL_FP_ACTIVE_PROGRAM, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_FP_ACTIVE_PROGRAM, 1));
OUT_RELOC(chan, fp->fpbo->bo, offset, NOUVEAU_BO_VRAM |
NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
- NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0,
- NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
- OUT_RING(chan, RING_3D(NV34TCL_FP_CONTROL, 1));
+ NOUVEAU_BO_OR, NV30_3D_FP_ACTIVE_PROGRAM_DMA0,
+ NV30_3D_FP_ACTIVE_PROGRAM_DMA1);
+ OUT_RING(chan, RING_3D(NV30_3D_FP_CONTROL, 1));
OUT_RING(chan, fp->fp_control);
if(!nvfx->is_nv4x) {
- OUT_RING(chan, RING_3D(NV34TCL_FP_REG_CONTROL, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_FP_REG_CONTROL, 1));
OUT_RING(chan, (1<<16)|0x4);
- OUT_RING(chan, RING_3D(NV34TCL_TX_UNITS_ENABLE, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_TEX_UNITS_ENABLE, 1));
OUT_RING(chan, fp->samplers);
}
}
@@ -1470,7 +1520,7 @@ update:
if(pointsprite_control != nvfx->hw_pointsprite_control)
{
WAIT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV34TCL_POINT_SPRITE, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_POINT_SPRITE, 1));
OUT_RING(chan, pointsprite_control);
nvfx->hw_pointsprite_control = pointsprite_control;
}
@@ -1489,10 +1539,10 @@ nvfx_fragprog_relocate(struct nvfx_context *nvfx)
unsigned fp_flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_RD; // TODO: GART?
fp_flags |= NOUVEAU_BO_DUMMY;
MARK_RING(chan, 2, 2);
- OUT_RELOC(chan, bo, RING_3D(NV34TCL_FP_ACTIVE_PROGRAM, 1), fp_flags, 0, 0);
+ OUT_RELOC(chan, bo, RING_3D(NV30_3D_FP_ACTIVE_PROGRAM, 1), fp_flags, 0, 0);
OUT_RELOC(chan, bo, offset, fp_flags | NOUVEAU_BO_LOW |
- NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0,
- NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
+ NOUVEAU_BO_OR, NV30_3D_FP_ACTIVE_PROGRAM_DMA0,
+ NV30_3D_FP_ACTIVE_PROGRAM_DMA1);
nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGPROG;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c
index 6503c7afcb..1d6b4e24cb 100644
--- a/src/gallium/drivers/nvfx/nvfx_fragtex.c
+++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c
@@ -12,12 +12,12 @@ nvfx_sampler_state_create(struct pipe_context *pipe,
ps = MALLOC(sizeof(struct nvfx_sampler_state));
/* on nv30, we use this as an internal flag */
- ps->fmt = cso->normalized_coords ? 0 : NV40TCL_TEX_FORMAT_RECT;
+ ps->fmt = cso->normalized_coords ? 0 : NV40_3D_TEX_FORMAT_RECT;
ps->en = 0;
ps->filt = nvfx_tex_filter(cso) | 0x2000; /*voodoo*/
- ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV34TCL_TX_WRAP_S_SHIFT) |
- (nvfx_tex_wrap_mode(cso->wrap_t) << NV34TCL_TX_WRAP_T_SHIFT) |
- (nvfx_tex_wrap_mode(cso->wrap_r) << NV34TCL_TX_WRAP_R_SHIFT);
+ ps->wrap = (nvfx_tex_wrap_mode(cso->wrap_s) << NV30_3D_TEX_WRAP_S__SHIFT) |
+ (nvfx_tex_wrap_mode(cso->wrap_t) << NV30_3D_TEX_WRAP_T__SHIFT) |
+ (nvfx_tex_wrap_mode(cso->wrap_r) << NV30_3D_TEX_WRAP_R__SHIFT);
ps->compare = FALSE;
if(cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
@@ -80,21 +80,21 @@ nvfx_create_sampler_view(struct pipe_context *pipe,
pipe_resource_reference(&sv->base.texture, pt);
sv->base.context = pipe;
- txf = NV34TCL_TX_FORMAT_NO_BORDER;
+ txf = NV30_3D_TEX_FORMAT_NO_BORDER;
switch (pt->target) {
case PIPE_TEXTURE_CUBE:
- txf |= NV34TCL_TX_FORMAT_CUBIC;
+ txf |= NV30_3D_TEX_FORMAT_CUBIC;
/* fall-through */
case PIPE_TEXTURE_2D:
case PIPE_TEXTURE_RECT:
- txf |= NV34TCL_TX_FORMAT_DIMS_2D;
+ txf |= NV30_3D_TEX_FORMAT_DIMS_2D;
break;
case PIPE_TEXTURE_3D:
- txf |= NV34TCL_TX_FORMAT_DIMS_3D;
+ txf |= NV30_3D_TEX_FORMAT_DIMS_3D;
break;
case PIPE_TEXTURE_1D:
- txf |= NV34TCL_TX_FORMAT_DIMS_1D;
+ txf |= NV30_3D_TEX_FORMAT_DIMS_1D;
break;
default:
assert(0);
@@ -102,14 +102,14 @@ nvfx_create_sampler_view(struct pipe_context *pipe,
sv->u.init_fmt = txf;
sv->swizzle = 0
- | (tf->src[sv->base.swizzle_r] << NV34TCL_TX_SWIZZLE_S0_Z_SHIFT)
- | (tf->src[sv->base.swizzle_g] << NV34TCL_TX_SWIZZLE_S0_Y_SHIFT)
- | (tf->src[sv->base.swizzle_b] << NV34TCL_TX_SWIZZLE_S0_X_SHIFT)
- | (tf->src[sv->base.swizzle_a] << NV34TCL_TX_SWIZZLE_S0_W_SHIFT)
- | (tf->comp[sv->base.swizzle_r] << NV34TCL_TX_SWIZZLE_S1_Z_SHIFT)
- | (tf->comp[sv->base.swizzle_g] << NV34TCL_TX_SWIZZLE_S1_Y_SHIFT)
- | (tf->comp[sv->base.swizzle_b] << NV34TCL_TX_SWIZZLE_S1_X_SHIFT)
- | (tf->comp[sv->base.swizzle_a] << NV34TCL_TX_SWIZZLE_S1_W_SHIFT);
+ | (tf->src[sv->base.swizzle_r] << NV30_3D_TEX_SWIZZLE_S0_Z__SHIFT)
+ | (tf->src[sv->base.swizzle_g] << NV30_3D_TEX_SWIZZLE_S0_Y__SHIFT)
+ | (tf->src[sv->base.swizzle_b] << NV30_3D_TEX_SWIZZLE_S0_X__SHIFT)
+ | (tf->src[sv->base.swizzle_a] << NV30_3D_TEX_SWIZZLE_S0_W__SHIFT)
+ | (tf->comp[sv->base.swizzle_r] << NV30_3D_TEX_SWIZZLE_S1_Z__SHIFT)
+ | (tf->comp[sv->base.swizzle_g] << NV30_3D_TEX_SWIZZLE_S1_Y__SHIFT)
+ | (tf->comp[sv->base.swizzle_b] << NV30_3D_TEX_SWIZZLE_S1_X__SHIFT)
+ | (tf->comp[sv->base.swizzle_a] << NV30_3D_TEX_SWIZZLE_S1_W__SHIFT);
sv->filt = tf->sign;
sv->wrap = tf->wrap;
@@ -118,18 +118,18 @@ nvfx_create_sampler_view(struct pipe_context *pipe,
if (pt->target == PIPE_TEXTURE_CUBE)
{
sv->offset = 0;
- sv->npot_size = (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | pt->height0;
+ sv->npot_size = (pt->width0 << NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | pt->height0;
}
else
{
sv->offset = nvfx_subresource_offset(pt, 0, sv->base.first_level, 0);
- sv->npot_size = (u_minify(pt->width0, sv->base.first_level) << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | u_minify(pt->height0, sv->base.first_level);
+ sv->npot_size = (u_minify(pt->width0, sv->base.first_level) << NV30_3D_TEX_NPOT_SIZE_W__SHIFT) | u_minify(pt->height0, sv->base.first_level);
/* apparently, we need to ignore the t coordinate for 1D textures to fix piglit tex1d-2dborder */
if(pt->target == PIPE_TEXTURE_1D)
{
- sv->wrap_mask &=~ NV34TCL_TX_WRAP_T_MASK;
- sv->wrap |= NV34TCL_TX_WRAP_T_REPEAT;
+ sv->wrap_mask &=~ NV30_3D_TEX_WRAP_T__MASK;
+ sv->wrap |= NV30_3D_TEX_WRAP_T_REPEAT;
}
}
@@ -199,7 +199,7 @@ nvfx_fragtex_validate(struct nvfx_context *nvfx)
} else {
WAIT_RING(chan, 2);
/* this is OK for nv40 too */
- OUT_RING(chan, RING_3D(NV34TCL_TX_ENABLE(unit), 1));
+ OUT_RING(chan, RING_3D(NV30_3D_TEX_ENABLE(unit), 1));
OUT_RING(chan, 0);
nvfx->hw_samplers &= ~(1 << unit);
}
@@ -227,10 +227,10 @@ nvfx_fragtex_relocate(struct nvfx_context *nvfx)
bo = mt->base.bo;
MARK_RING(chan, 3, 3);
- OUT_RELOC(chan, bo, RING_3D(NV34TCL_TX_OFFSET(unit), 2), tex_flags | NOUVEAU_BO_DUMMY, 0, 0);
+ OUT_RELOC(chan, bo, RING_3D(NV30_3D_TEX_OFFSET(unit), 2), tex_flags | NOUVEAU_BO_DUMMY, 0, 0);
OUT_RELOC(chan, bo, 0, tex_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_DUMMY, 0, 0);
OUT_RELOC(chan, bo, nvfx->hw_txf[unit], tex_flags | NOUVEAU_BO_OR | NOUVEAU_BO_DUMMY,
- NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
+ NV30_3D_TEX_FORMAT_DMA0, NV30_3D_TEX_FORMAT_DMA1);
}
nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAGTEX;
}
@@ -246,32 +246,32 @@ nvfx_init_sampling_functions(struct nvfx_context *nvfx)
nvfx->pipe.sampler_view_destroy = nvfx_sampler_view_destroy;
}
-#define NV34TCL_TX_FORMAT_FORMAT_DXT1_RECT NV34TCL_TX_FORMAT_FORMAT_DXT1
-#define NV34TCL_TX_FORMAT_FORMAT_DXT3_RECT NV34TCL_TX_FORMAT_FORMAT_DXT3
-#define NV34TCL_TX_FORMAT_FORMAT_DXT5_RECT NV34TCL_TX_FORMAT_FORMAT_DXT5
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT1_RECT NV30_3D_TEX_FORMAT_FORMAT_DXT1
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT3_RECT NV30_3D_TEX_FORMAT_FORMAT_DXT3
+#define NV30_3D_TEX_FORMAT_FORMAT_DXT5_RECT NV30_3D_TEX_FORMAT_FORMAT_DXT5
-#define NV40TCL_TEX_FORMAT_FORMAT_HILO16 NV40TCL_TEX_FORMAT_FORMAT_A16L16
+#define NV40_3D_TEX_FORMAT_FORMAT_HILO16 NV40_3D_TEX_FORMAT_FORMAT_A16L16
-#define NV34TCL_TX_FORMAT_FORMAT_RGBA16F 0x00004a00
-#define NV34TCL_TX_FORMAT_FORMAT_RGBA16F_RECT NV34TCL_TX_FORMAT_FORMAT_RGBA16F
-#define NV34TCL_TX_FORMAT_FORMAT_RGBA32F 0x00004b00
-#define NV34TCL_TX_FORMAT_FORMAT_RGBA32F_RECT NV34TCL_TX_FORMAT_FORMAT_RGBA32F
-#define NV34TCL_TX_FORMAT_FORMAT_R32F 0x00004c00
-#define NV34TCL_TX_FORMAT_FORMAT_R32F_RECT NV34TCL_TX_FORMAT_FORMAT_R32F
+#define NV30_3D_TEX_FORMAT_FORMAT_RGBA16F 0x00004a00
+#define NV30_3D_TEX_FORMAT_FORMAT_RGBA16F_RECT NV30_3D_TEX_FORMAT_FORMAT_RGBA16F
+#define NV30_3D_TEX_FORMAT_FORMAT_RGBA32F 0x00004b00
+#define NV30_3D_TEX_FORMAT_FORMAT_RGBA32F_RECT NV30_3D_TEX_FORMAT_FORMAT_RGBA32F
+#define NV30_3D_TEX_FORMAT_FORMAT_R32F 0x00004c00
+#define NV30_3D_TEX_FORMAT_FORMAT_R32F_RECT NV30_3D_TEX_FORMAT_FORMAT_R32F
// TODO: guess!
-#define NV40TCL_TEX_FORMAT_FORMAT_R32F 0x00001c00
+#define NV40_3D_TEX_FORMAT_FORMAT_R32F 0x00001c00
#define SRGB 0x00700000
#define __(m,tf,tfc,ts0x,ts0y,ts0z,ts0w,ts1x,ts1y,ts1z,ts1w,sign,wrap) \
[PIPE_FORMAT_##m] = { \
- {NV34TCL_TX_FORMAT_FORMAT_##tf, \
- NV34TCL_TX_FORMAT_FORMAT_##tfc, \
- NV34TCL_TX_FORMAT_FORMAT_##tf##_RECT, \
- NV34TCL_TX_FORMAT_FORMAT_##tfc##_RECT, \
- NV40TCL_TEX_FORMAT_FORMAT_##tf, \
- NV40TCL_TEX_FORMAT_FORMAT_##tfc}, \
+ {NV30_3D_TEX_FORMAT_FORMAT_##tf, \
+ NV30_3D_TEX_FORMAT_FORMAT_##tfc, \
+ NV30_3D_TEX_FORMAT_FORMAT_##tf##_RECT, \
+ NV30_3D_TEX_FORMAT_FORMAT_##tfc##_RECT, \
+ NV40_3D_TEX_FORMAT_FORMAT_##tf, \
+ NV40_3D_TEX_FORMAT_FORMAT_##tfc}, \
sign, wrap, \
{ts0z, ts0y, ts0x, ts0w, 0, 1}, {ts1z, ts1y, ts1x, ts1w, 0, 0} \
}
@@ -293,7 +293,7 @@ nvfx_init_sampling_functions(struct nvfx_context *nvfx)
#define Z 1
#define W 0
-#define SNORM ((NV34TCL_TX_FILTER_SIGNED_RED) | (NV34TCL_TX_FILTER_SIGNED_GREEN) | (NV34TCL_TX_FILTER_SIGNED_BLUE) | (NV34TCL_TX_FILTER_SIGNED_ALPHA))
+#define SNORM ((NV30_3D_TEX_FILTER_SIGNED_RED) | (NV30_3D_TEX_FILTER_SIGNED_GREEN) | (NV30_3D_TEX_FILTER_SIGNED_BLUE) | (NV30_3D_TEX_FILTER_SIGNED_ALPHA))
#define UNORM 0
struct nvfx_texture_format
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 0916aaa828..7677fde40c 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -214,6 +214,7 @@ nvfx_miptree_surface_del(struct pipe_surface *ps)
if(!ns->temp)
{
+ assert(!util_dirty_surface_is_dirty(&ns->base));
util_surfaces_detach(&((struct nvfx_miptree*)ps->texture)->surfaces, ps);
pipe_resource_reference(&ps->texture, 0);
FREE(ps);
diff --git a/src/gallium/drivers/nvfx/nvfx_push.c b/src/gallium/drivers/nvfx/nvfx_push.c
index ffe7e98357..ebf47e6ed3 100644
--- a/src/gallium/drivers/nvfx/nvfx_push.c
+++ b/src/gallium/drivers/nvfx/nvfx_push.c
@@ -29,7 +29,7 @@ emit_edgeflag(void *priv, boolean enabled)
struct push_context* ctx = priv;
struct nouveau_channel *chan = ctx->chan;
- OUT_RING(chan, RING_3D(NV34TCL_EDGEFLAG_ENABLE, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_EDGEFLAG, 1));
OUT_RING(chan, enabled ? 1 : 0);
}
@@ -44,7 +44,7 @@ emit_vertices_lookup8(void *priv, unsigned start, unsigned count)
unsigned push = MIN2(count, ctx->max_vertices_per_packet);
unsigned length = push * ctx->vertex_length;
- OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length));
+ OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
ctx->translate->run_elts8(ctx->translate, elts, push, 0, ctx->chan->cur);
ctx->chan->cur += length;
@@ -64,7 +64,7 @@ emit_vertices_lookup16(void *priv, unsigned start, unsigned count)
unsigned push = MIN2(count, ctx->max_vertices_per_packet);
unsigned length = push * ctx->vertex_length;
- OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length));
+ OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
ctx->translate->run_elts16(ctx->translate, elts, push, 0, ctx->chan->cur);
ctx->chan->cur += length;
@@ -84,7 +84,7 @@ emit_vertices_lookup32(void *priv, unsigned start, unsigned count)
unsigned push = MIN2(count, ctx->max_vertices_per_packet);
unsigned length = push * ctx->vertex_length;
- OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length));
+ OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
ctx->translate->run_elts(ctx->translate, elts, push, 0, ctx->chan->cur);
ctx->chan->cur += length;
@@ -103,7 +103,7 @@ emit_vertices(void *priv, unsigned start, unsigned count)
unsigned push = MIN2(count, ctx->max_vertices_per_packet);
unsigned length = push * ctx->vertex_length;
- OUT_RING(ctx->chan, RING_3D_NI(NV34TCL_VERTEX_DATA, length));
+ OUT_RING(ctx->chan, RING_3D_NI(NV30_3D_VERTEX_DATA, length));
ctx->translate->run(ctx->translate, start, push, 0, ctx->chan->cur);
ctx->chan->cur += length;
@@ -141,13 +141,13 @@ emit_ranges(void* priv, unsigned start, unsigned vc, unsigned reg)
static void
emit_ib_ranges(void* priv, unsigned start, unsigned vc)
{
- emit_ranges(priv, start, vc, NV34TCL_VB_INDEX_BATCH);
+ emit_ranges(priv, start, vc, NV30_3D_VB_INDEX_BATCH);
}
static void
emit_vb_ranges(void* priv, unsigned start, unsigned vc)
{
- emit_ranges(priv, start, vc, NV34TCL_VB_VERTEX_BATCH);
+ emit_ranges(priv, start, vc, NV30_3D_VB_VERTEX_BATCH);
}
static INLINE void
@@ -159,7 +159,7 @@ emit_elt8(void* priv, unsigned start, unsigned vc)
int idxbias = ctx->idxbias;
if (vc & 1) {
- OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VB_ELEMENT_U32, 1));
OUT_RING (chan, elts[0]);
elts++; vc--;
}
@@ -168,7 +168,7 @@ emit_elt8(void* priv, unsigned start, unsigned vc)
unsigned i;
unsigned push = MIN2(vc, 2047 * 2);
- OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1));
+ OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U16, push >> 1));
for (i = 0; i < push; i+=2)
OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias));
@@ -186,7 +186,7 @@ emit_elt16(void* priv, unsigned start, unsigned vc)
int idxbias = ctx->idxbias;
if (vc & 1) {
- OUT_RING(chan, RING_3D(NV34TCL_VB_ELEMENT_U32, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VB_ELEMENT_U32, 1));
OUT_RING (chan, elts[0]);
elts++; vc--;
}
@@ -195,7 +195,7 @@ emit_elt16(void* priv, unsigned start, unsigned vc)
unsigned i;
unsigned push = MIN2(vc, 2047 * 2);
- OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U16, push >> 1));
+ OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U16, push >> 1));
for (i = 0; i < push; i+=2)
OUT_RING(chan, ((elts[i+1] + idxbias) << 16) | (elts[i] + idxbias));
@@ -215,7 +215,7 @@ emit_elt32(void* priv, unsigned start, unsigned vc)
while (vc) {
unsigned push = MIN2(vc, 2047);
- OUT_RING(chan, RING_3D_NI(NV34TCL_VB_ELEMENT_U32, push));
+ OUT_RING(chan, RING_3D_NI(NV30_3D_VB_ELEMENT_U32, push));
assert(AVAIL_RING(chan) >= push);
if(idxbias)
{
@@ -379,10 +379,10 @@ nvfx_push_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
}
}
- OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
OUT_RING(chan, hw_mode);
done = util_split_prim_next(&s, max_verts);
- OUT_RING(chan, RING_3D(NV34TCL_VERTEX_BEGIN_END, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VERTEX_BEGIN_END, 1));
OUT_RING(chan, 0);
if(done)
diff --git a/src/gallium/drivers/nvfx/nvfx_query.c b/src/gallium/drivers/nvfx/nvfx_query.c
index 1dab20c41a..3935ffd7f9 100644
--- a/src/gallium/drivers/nvfx/nvfx_query.c
+++ b/src/gallium/drivers/nvfx/nvfx_query.c
@@ -49,9 +49,10 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
struct nvfx_query *q = nvfx_query(pq);
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
uint64_t tmp;
+ assert(!nvfx->query);
+
/* Happens when end_query() is called, then another begin_query()
* without querying the result in-between. For now we'll wait for
* the existing query to notify completion, but it could be better.
@@ -71,27 +72,35 @@ nvfx_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
nouveau_notifier_reset(nvfx->screen->query, q->object->start);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_RESET, 1);
- OUT_RING (chan, 1);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_UNK17CC, 1);
- OUT_RING (chan, 1);
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_RESET, 1));
+ OUT_RING(chan, 1);
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+ OUT_RING(chan, 1);
q->ready = FALSE;
+
+ nvfx->query = pq;
}
static void
nvfx_query_end(struct pipe_context *pipe, struct pipe_query *pq)
{
struct nvfx_context *nvfx = nvfx_context(pipe);
- struct nvfx_screen *screen = nvfx->screen;
- struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
struct nvfx_query *q = nvfx_query(pq);
- BEGIN_RING(chan, eng3d, NV34TCL_QUERY_GET, 1);
- OUT_RING (chan, (0x01 << NV34TCL_QUERY_GET_UNK24_SHIFT) |
- ((q->object->start * 32) << NV34TCL_QUERY_GET_OFFSET_SHIFT));
+ assert(nvfx->query == pq);
+
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_GET, 1));
+ OUT_RING (chan, (0x01 << NV30_3D_QUERY_GET_UNK24__SHIFT) |
+ ((q->object->start * 32) << NV30_3D_QUERY_GET_OFFSET__SHIFT));
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+ OUT_RING(chan, 0);
FIRE_RING(chan);
+
+ nvfx->query = 0;
}
static boolean
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 65ca265d45..3f177b7ed0 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -4,15 +4,15 @@
#include "util/u_simple_screen.h"
#include "nouveau/nouveau_screen.h"
-
+#include "nouveau/nv_object.xml.h"
#include "nvfx_context.h"
#include "nvfx_screen.h"
#include "nvfx_resource.h"
#include "nvfx_tex.h"
-#define NV30TCL_CHIPSET_3X_MASK 0x00000003
-#define NV34TCL_CHIPSET_3X_MASK 0x00000010
-#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
+#define NV30_3D_CHIPSET_3X_MASK 0x00000003
+#define NV34_3D_CHIPSET_3X_MASK 0x00000010
+#define NV35_3D_CHIPSET_3X_MASK 0x000001e0
#define NV4X_GRCLASS4097_CHIPSETS 0x00000baf
#define NV4X_GRCLASS4497_CHIPSETS 0x00005450
@@ -25,10 +25,9 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
switch (param) {
case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS:
- /* TODO: check this */
- return screen->is_nv4x ? 16 : 8;
+ return 16;
case PIPE_CAP_NPOT_TEXTURES:
- return !!screen->is_nv4x;
+ return screen->advertise_npot;
case PIPE_CAP_TWO_SIDED_STENCIL:
return 1;
case PIPE_CAP_GLSL:
@@ -38,7 +37,7 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_POINT_SPRITE:
return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
- return screen->is_nv4x ? 4 : 2;
+ return screen->use_nv4x ? 4 : 2;
case PIPE_CAP_OCCLUSION_QUERY:
return 1;
case PIPE_CAP_TIMER_QUERY:
@@ -54,15 +53,13 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 13;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
- return !!screen->is_nv4x;
+ return !!screen->use_nv4x;
case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
return 1;
case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS:
return 0; /* We have 4 on nv40 - but unsupported currently */
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 0;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
- return !!screen->is_nv4x;
+ return screen->advertise_blend_equation_separate;
case PIPE_CAP_MAX_COMBINED_SAMPLERS:
return 16;
case PIPE_CAP_INDEP_BLEND_ENABLE:
@@ -75,59 +72,90 @@ nvfx_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 0;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
- return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
- return 0;
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- return 4096;
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- /* FIXME: is it the dynamic (nv30:0/nv40:24) or the static
- value (nv30:0/nv40:4) ? */
- return screen->is_nv4x ? 4 : 0;
- case PIPE_CAP_MAX_FS_INPUTS:
- return 10;
- case PIPE_CAP_MAX_FS_CONSTS:
- return screen->is_nv4x ? 224 : 32;
- case PIPE_CAP_MAX_FS_TEMPS:
- return 32;
- case PIPE_CAP_MAX_FS_ADDRS:
- return screen->is_nv4x ? 1 : 0;
- case PIPE_CAP_MAX_FS_PREDS:
- return screen->is_nv4x ? 1 : 0;
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- return screen->is_nv4x ? 512 : 256;
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- return screen->is_nv4x ? 512 : 0;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- /* FIXME: is it the dynamic (nv30:24/nv40:24) or the static
- value (nv30:1/nv40:4) ? */
- return screen->is_nv4x ? 4 : 1;
- case PIPE_CAP_MAX_VS_INPUTS:
- return 16;
- case PIPE_CAP_MAX_VS_CONSTS:
- return 256;
- case PIPE_CAP_MAX_VS_TEMPS:
- return screen->is_nv4x ? 32 : 13;
- case PIPE_CAP_MAX_VS_ADDRS:
- return 2;
- case PIPE_CAP_MAX_VS_PREDS:
- return screen->is_nv4x ? 1 : 0;
- case PIPE_CAP_GEOMETRY_SHADER4:
- return 0;
+ return 1;
case PIPE_CAP_DEPTH_CLAMP:
return 0; // TODO: implement depth clamp
default:
- NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
+ NOUVEAU_ERR("Warning: unknown PIPE_CAP %d\n", param);
return 0;
}
}
+static int
+nvfx_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
+{
+ struct nvfx_screen *screen = nvfx_screen(pscreen);
+
+ switch(shader) {
+ case PIPE_SHADER_FRAGMENT:
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 4096;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ /* FIXME: is it the dynamic (nv30:0/nv40:24) or the static
+ value (nv30:0/nv40:4) ? */
+ return screen->use_nv4x ? 4 : 0;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return screen->use_nv4x ? 12 : 10;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return screen->use_nv4x ? 224 : 32;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 32;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return screen->use_nv4x ? 1 : 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0; /* we could expose these, but nothing uses them */
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 0;
+ default:
+ break;
+ }
+ break;
+ case PIPE_SHADER_VERTEX:
+ switch(param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ return screen->use_nv4x ? 512 : 256;
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return screen->use_nv4x ? 512 : 0;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ /* FIXME: is it the dynamic (nv30:24/nv40:24) or the static
+ value (nv30:1/nv40:4) ? */
+ return screen->use_nv4x ? 4 : 1;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 16;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ /* - 6 is for clip planes; Gallium should be fixed to put
+ * them in the vertex shader itself, so we don't need to reserve these */
+ return (screen->use_nv4x ? 468 : 256) - 6;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return screen->use_nv4x ? 32 : 13;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 2;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0; /* we could expose these, but nothing uses them */
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
static float
nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
{
@@ -141,9 +169,9 @@ nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_MAX_POINT_WIDTH_AA:
return 64.0;
case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
- return screen->is_nv4x ? 16.0 : 8.0;
+ return screen->use_nv4x ? 16.0 : 8.0;
case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
- return screen->is_nv4x ? 16.0 : 4.0;
+ return 15.0;
default:
NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
return 0.0;
@@ -168,6 +196,14 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen,
case PIPE_FORMAT_B8G8R8X8_UNORM:
case PIPE_FORMAT_B5G6R5_UNORM:
break;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ if(!screen->advertise_fp16)
+ return FALSE;
+ break;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ if(!screen->advertise_fp32)
+ return FALSE;
+ break;
default:
return FALSE;
}
@@ -188,8 +224,11 @@ nvfx_screen_is_format_supported(struct pipe_screen *pscreen,
struct nvfx_texture_format* tf = &nvfx_texture_formats[format];
if(util_format_is_s3tc(format) && !util_format_s3tc_enabled)
return FALSE;
-
- if(screen->is_nv4x)
+ if(format == PIPE_FORMAT_R16G16B16A16_FLOAT && !screen->advertise_fp16)
+ return FALSE;
+ if(format == PIPE_FORMAT_R32G32B32A32_FLOAT && !screen->advertise_fp32)
+ return FALSE;
+ if(screen->use_nv4x)
{
if(tf->fmt[4] < 0)
return FALSE;
@@ -245,9 +284,9 @@ static void nv30_screen_init(struct nvfx_screen *screen)
/* TODO: perhaps we should do some of this on nv40 too? */
for (i=1; i<8; i++) {
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_HORIZ(i), 1));
OUT_RING(chan, 0);
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_CLIP_VERT(i), 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_VERT(i), 1));
OUT_RING(chan, 0);
}
@@ -283,14 +322,14 @@ static void nv30_screen_init(struct nvfx_screen *screen)
OUT_RING(chan, RING_3D(0x1d88, 1));
OUT_RING(chan, 0x00001200);
- OUT_RING(chan, RING_3D(NV34TCL_RC_ENABLE, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_RC_ENABLE, 1));
OUT_RING(chan, 0);
- OUT_RING(chan, RING_3D(NV34TCL_DEPTH_RANGE_NEAR, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DEPTH_RANGE_NEAR, 2));
OUT_RING(chan, fui(0.0));
OUT_RING(chan, fui(1.0));
- OUT_RING(chan, RING_3D(NV34TCL_MULTISAMPLE_CONTROL, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_MULTISAMPLE_CONTROL, 1));
OUT_RING(chan, 0xffff0000);
/* enables use of vp rather than fixed-function somehow */
@@ -302,10 +341,13 @@ static void nv40_screen_init(struct nvfx_screen *screen)
{
struct nouveau_channel *chan = screen->base.channel;
- OUT_RING(chan, RING_3D(NV40TCL_DMA_COLOR2, 2));
+ OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR2, 2));
OUT_RING(chan, screen->base.channel->vram->handle);
OUT_RING(chan, screen->base.channel->vram->handle);
+ OUT_RING(chan, RING_3D(0x1450, 1));
+ OUT_RING(chan, 0x00000004);
+
OUT_RING(chan, RING_3D(0x1ea4, 3));
OUT_RING(chan, 0x00000010);
OUT_RING(chan, 0x01000100);
@@ -316,7 +358,7 @@ static void nv40_screen_init(struct nvfx_screen *screen)
OUT_RING(chan, 0x06144321);
OUT_RING(chan, RING_3D(0x1fc8, 2));
OUT_RING(chan, 0xedcba987);
- OUT_RING(chan, 0x00000021);
+ OUT_RING(chan, 0x0000006f);
OUT_RING(chan, RING_3D(0x1fd0, 1));
OUT_RING(chan, 0x00171615);
OUT_RING(chan, RING_3D(0x1fd4, 1));
@@ -325,9 +367,12 @@ static void nv40_screen_init(struct nvfx_screen *screen)
OUT_RING(chan, RING_3D(0x1ef8, 1));
OUT_RING(chan, 0x0020ffff);
OUT_RING(chan, RING_3D(0x1d64, 1));
- OUT_RING(chan, 0x00d30000);
+ OUT_RING(chan, 0x01d300d4);
OUT_RING(chan, RING_3D(0x1e94, 1));
OUT_RING(chan, 0x00000001);
+
+ OUT_RING(chan, RING_3D(NV40_3D_MIPMAP_ROUNDING, 1));
+ OUT_RING(chan, NV40_3D_MIPMAP_ROUNDING_MODE_DOWN);
}
static unsigned
@@ -344,19 +389,6 @@ nvfx_screen_get_vertex_buffer_flags(struct nvfx_screen* screen)
vram_hack_default = 1;
vram_hack = debug_get_bool_option("NOUVEAU_VTXIDX_IN_VRAM", vram_hack_default);
-#ifdef DEBUG
- if(!vram_hack)
- {
- fprintf(stderr, "Some systems may experience graphics corruption due to randomly misplaced vertices.\n"
- "If this is happening, export NOUVEAU_VTXIDX_IN_VRAM=1 may reduce or eliminate the problem\n");
- }
- else
- {
- fprintf(stderr, "A performance reducing hack is being used to help avoid graphics corruption.\n"
- "You can try export NOUVEAU_VTXIDX_IN_VRAM=0 to disable it.\n");
- }
-#endif
-
return vram_hack ? NOUVEAU_BO_VRAM : NOUVEAU_BO_GART;
}
@@ -396,29 +428,30 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->winsys = ws;
pscreen->destroy = nvfx_screen_destroy;
pscreen->get_param = nvfx_screen_get_param;
+ pscreen->get_shader_param = nvfx_screen_get_shader_param;
pscreen->get_paramf = nvfx_screen_get_paramf;
pscreen->is_format_supported = nvfx_screen_is_format_supported;
pscreen->context_create = nvfx_create;
switch (dev->chipset & 0xf0) {
case 0x30:
- if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- eng3d_class = 0x0397;
- else if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- eng3d_class = 0x0697;
- else if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
- eng3d_class = 0x0497;
+ if (NV30_3D_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV30_3D;
+ else if (NV34_3D_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV34_3D;
+ else if (NV35_3D_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
+ eng3d_class = NV35_3D;
break;
case 0x40:
if (NV4X_GRCLASS4097_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- eng3d_class = NV40TCL;
+ eng3d_class = NV40_3D;
else if (NV4X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- eng3d_class = NV44TCL;
+ eng3d_class = NV44_3D;
screen->is_nv4x = ~0;
break;
case 0x60:
if (NV6X_GRCLASS4497_CHIPSETS & (1 << (dev->chipset & 0x0f)))
- eng3d_class = NV44TCL;
+ eng3d_class = NV44_3D;
screen->is_nv4x = ~0;
break;
}
@@ -428,17 +461,37 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
return NULL;
}
- screen->force_swtnl = debug_get_bool_option("NOUVEAU_SWTNL", FALSE);
+ screen->advertise_npot = !!screen->is_nv4x;
+ screen->advertise_blend_equation_separate = !!screen->is_nv4x;
+ screen->use_nv4x = screen->is_nv4x;
+
+ if(screen->is_nv4x) {
+ if(debug_get_bool_option("NVFX_SIMULATE_NV30", FALSE))
+ screen->use_nv4x = 0;
+ if(!debug_get_bool_option("NVFX_NPOT", TRUE))
+ screen->advertise_npot = 0;
+ if(!debug_get_bool_option("NVFX_BLEND_EQ_SEP", TRUE))
+ screen->advertise_blend_equation_separate = 0;
+ }
+
+ screen->force_swtnl = debug_get_bool_option("NVFX_SWTNL", FALSE);
screen->trace_draw = debug_get_bool_option("NVFX_TRACE_DRAW", FALSE);
screen->buffer_allocation_cost = debug_get_num_option("NVFX_BUFFER_ALLOCATION_COST", 16384);
screen->inline_cost_per_hardware_cost = atof(debug_get_option("NVFX_INLINE_COST_PER_HARDWARE_COST", "1.0"));
screen->static_reuse_threshold = atof(debug_get_option("NVFX_STATIC_REUSE_THRESHOLD", "2.0"));
+ /* We don't advertise these by default because filtering and blending doesn't work as
+ * it should, due to several restrictions.
+ * The only exception is fp16 on nv40.
+ */
+ screen->advertise_fp16 = debug_get_bool_option("NVFX_FP16", !!screen->use_nv4x);
+ screen->advertise_fp32 = debug_get_bool_option("NVFX_FP32", 0);
+
screen->vertex_buffer_reloc_flags = nvfx_screen_get_vertex_buffer_flags(screen);
/* surely both nv3x and nv44 support index buffers too: find out how and test that */
- if(eng3d_class == NV40TCL)
+ if(eng3d_class == NV40_3D)
screen->index_buffer_reloc_flags = screen->vertex_buffer_reloc_flags;
if(!screen->force_swtnl && screen->vertex_buffer_reloc_flags == screen->index_buffer_reloc_flags)
@@ -487,8 +540,8 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
LIST_INITHEAD(&screen->query_list);
/* Vtxprog resources */
- if (nouveau_resource_init(&screen->vp_exec_heap, 0, screen->is_nv4x ? 512 : 256) ||
- nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
+ if (nouveau_resource_init(&screen->vp_exec_heap, 0, screen->use_nv4x ? 512 : 256) ||
+ nouveau_resource_init(&screen->vp_data_heap, 0, screen->use_nv4x ? 468 : 256)) {
nvfx_screen_destroy(pscreen);
return NULL;
}
@@ -497,25 +550,25 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
/* Static eng3d initialisation */
/* note that we just started using the channel, so we must have space in the pushbuffer */
- OUT_RING(chan, RING_3D(NV34TCL_DMA_NOTIFY, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_NOTIFY, 1));
OUT_RING(chan, screen->sync->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_TEXTURE0, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_TEXTURE0, 2));
OUT_RING(chan, chan->vram->handle);
OUT_RING(chan, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_COLOR1, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR1, 1));
OUT_RING(chan, chan->vram->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_COLOR0, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR0, 2));
OUT_RING(chan, chan->vram->handle);
OUT_RING(chan, chan->vram->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_VTXBUF0, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_VTXBUF0, 2));
OUT_RING(chan, chan->vram->handle);
OUT_RING(chan, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_FENCE, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_FENCE, 2));
OUT_RING(chan, 0);
OUT_RING(chan, screen->query->handle);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_IN_MEMORY7, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_UNK1AC, 2));
OUT_RING(chan, chan->vram->handle);
OUT_RING(chan, chan->vram->handle);
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.h b/src/gallium/drivers/nvfx/nvfx_screen.h
index 1b79235ae0..b1f07187c7 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.h
+++ b/src/gallium/drivers/nvfx/nvfx_screen.h
@@ -15,10 +15,15 @@ struct nvfx_screen {
struct nvfx_context *cur_ctx;
unsigned is_nv4x; /* either 0 or ~0 */
+ unsigned use_nv4x; /* either 0 or ~0 */
boolean force_swtnl;
boolean trace_draw;
unsigned vertex_buffer_reloc_flags;
unsigned index_buffer_reloc_flags;
+ unsigned advertise_fp16;
+ unsigned advertise_fp32;
+ unsigned advertise_npot;
+ unsigned advertise_blend_equation_separate;
/* HW graphics objects */
struct nouveau_grobj *eng3d;
diff --git a/src/gallium/drivers/nvfx/nvfx_shader.h b/src/gallium/drivers/nvfx/nvfx_shader.h
index 35006eec3d..46406b2794 100644
--- a/src/gallium/drivers/nvfx/nvfx_shader.h
+++ b/src/gallium/drivers/nvfx/nvfx_shader.h
@@ -263,6 +263,7 @@
/* NV40 only fragment program opcodes */
#define NVFX_FP_OP_OPCODE_TXL_NV40 0x2F
+#define NVFX_FP_OP_OPCODE_LITEX2_NV40 0x3C
/* The use of these instructions appears to be indicated by bit 31 of DWORD 2.*/
#define NV40_FP_OP_BRA_OPCODE_BRK 0x0
@@ -378,8 +379,9 @@
#define NVFXSR_OUTPUT 1
#define NVFXSR_INPUT 2
#define NVFXSR_TEMP 3
-#define NVFXSR_CONST 4
-#define NVFXSR_RELOCATED 5
+#define NVFXSR_CONST 5
+#define NVFXSR_IMM 6
+#define NVFXSR_RELOCATED 7
#define NVFX_COND_FL 0
#define NVFX_COND_LT 1
@@ -414,14 +416,16 @@
#define abs(s) nvfx_src_abs((s))
struct nvfx_reg {
- uint8_t type;
+ int8_t type;
uint32_t index;
};
struct nvfx_src {
struct nvfx_reg reg;
- /* src only */
+ uint8_t indirect : 1;
+ uint8_t indirect_reg : 1;
+ uint8_t indirect_swz : 2;
uint8_t negate : 1;
uint8_t abs : 1;
uint8_t swz[4];
@@ -483,6 +487,7 @@ nvfx_src(struct nvfx_reg reg)
.abs = 0,
.negate = 0,
.swz = { 0, 1, 2, 3 },
+ .indirect = 0,
};
return temp;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_state.c b/src/gallium/drivers/nvfx/nvfx_state.c
index 5bd7dc07f0..b767846a99 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.c
+++ b/src/gallium/drivers/nvfx/nvfx_state.c
@@ -20,26 +20,26 @@ nvfx_blend_state_create(struct pipe_context *pipe,
struct nouveau_statebuf_builder sb = sb_init(bso->sb);
if (cso->rt[0].blend_enable) {
- sb_method(sb, NV34TCL_BLEND_FUNC_ENABLE, 3);
+ sb_method(sb, NV30_3D_BLEND_FUNC_ENABLE, 3);
sb_data(sb, 1);
sb_data(sb, (nvgl_blend_func(cso->rt[0].alpha_src_factor) << 16) |
nvgl_blend_func(cso->rt[0].rgb_src_factor));
sb_data(sb, nvgl_blend_func(cso->rt[0].alpha_dst_factor) << 16 |
nvgl_blend_func(cso->rt[0].rgb_dst_factor));
if(nvfx->screen->base.device->chipset < 0x40) {
- sb_method(sb, NV34TCL_BLEND_EQUATION, 1);
+ sb_method(sb, NV30_3D_BLEND_EQUATION, 1);
sb_data(sb, nvgl_blend_eqn(cso->rt[0].rgb_func));
} else {
- sb_method(sb, NV40TCL_BLEND_EQUATION, 1);
+ sb_method(sb, NV40_3D_BLEND_EQUATION, 1);
sb_data(sb, nvgl_blend_eqn(cso->rt[0].alpha_func) << 16 |
nvgl_blend_eqn(cso->rt[0].rgb_func));
}
} else {
- sb_method(sb, NV34TCL_BLEND_FUNC_ENABLE, 1);
+ sb_method(sb, NV30_3D_BLEND_FUNC_ENABLE, 1);
sb_data(sb, 0);
}
- sb_method(sb, NV34TCL_COLOR_MASK, 1);
+ sb_method(sb, NV30_3D_COLOR_MASK, 1);
sb_data(sb, (((cso->rt[0].colormask & PIPE_MASK_A) ? (0x01 << 24) : 0) |
((cso->rt[0].colormask & PIPE_MASK_R) ? (0x01 << 16) : 0) |
((cso->rt[0].colormask & PIPE_MASK_G) ? (0x01 << 8) : 0) |
@@ -48,15 +48,15 @@ nvfx_blend_state_create(struct pipe_context *pipe,
/* TODO: add NV40 MRT color mask */
if (cso->logicop_enable) {
- sb_method(sb, NV34TCL_COLOR_LOGIC_OP_ENABLE, 2);
+ sb_method(sb, NV30_3D_COLOR_LOGIC_OP_ENABLE, 2);
sb_data(sb, 1);
sb_data(sb, nvgl_logicop_func(cso->logicop_func));
} else {
- sb_method(sb, NV34TCL_COLOR_LOGIC_OP_ENABLE, 1);
+ sb_method(sb, NV30_3D_COLOR_LOGIC_OP_ENABLE, 1);
sb_data(sb, 0);
}
- sb_method(sb, NV34TCL_DITHER_ENABLE, 1);
+ sb_method(sb, NV30_3D_DITHER_ENABLE, 1);
sb_data(sb, cso->dither ? 1 : 0);
bso->sb_len = sb_len(sb, bso->sb);
@@ -94,64 +94,64 @@ nvfx_rasterizer_state_create(struct pipe_context *pipe,
* sprite_coord_origin
*/
- sb_method(sb, NV34TCL_SHADE_MODEL, 1);
- sb_data(sb, cso->flatshade ? NV34TCL_SHADE_MODEL_FLAT :
- NV34TCL_SHADE_MODEL_SMOOTH);
+ sb_method(sb, NV30_3D_SHADE_MODEL, 1);
+ sb_data(sb, cso->flatshade ? NV30_3D_SHADE_MODEL_FLAT :
+ NV30_3D_SHADE_MODEL_SMOOTH);
- sb_method(sb, NV34TCL_VERTEX_TWO_SIDE_ENABLE, 1);
+ sb_method(sb, NV30_3D_VERTEX_TWO_SIDE_ENABLE, 1);
sb_data(sb, cso->light_twoside);
- sb_method(sb, NV34TCL_LINE_WIDTH, 2);
+ sb_method(sb, NV30_3D_LINE_WIDTH, 2);
sb_data(sb, (unsigned char)(cso->line_width * 8.0) & 0xff);
sb_data(sb, cso->line_smooth ? 1 : 0);
- sb_method(sb, NV34TCL_LINE_STIPPLE_ENABLE, 2);
+ sb_method(sb, NV30_3D_LINE_STIPPLE_ENABLE, 2);
sb_data(sb, cso->line_stipple_enable ? 1 : 0);
sb_data(sb, (cso->line_stipple_pattern << 16) |
cso->line_stipple_factor);
- sb_method(sb, NV34TCL_POINT_SIZE, 1);
+ sb_method(sb, NV30_3D_POINT_SIZE, 1);
sb_data(sb, fui(cso->point_size));
- sb_method(sb, NV34TCL_POLYGON_MODE_FRONT, 6);
+ sb_method(sb, NV30_3D_POLYGON_MODE_FRONT, 6);
sb_data(sb, nvgl_polygon_mode(cso->fill_front));
sb_data(sb, nvgl_polygon_mode(cso->fill_back));
switch (cso->cull_face) {
case PIPE_FACE_FRONT:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT);
+ sb_data(sb, NV30_3D_CULL_FACE_FRONT);
break;
case PIPE_FACE_BACK:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ sb_data(sb, NV30_3D_CULL_FACE_BACK);
break;
case PIPE_FACE_FRONT_AND_BACK:
- sb_data(sb, NV34TCL_CULL_FACE_FRONT_AND_BACK);
+ sb_data(sb, NV30_3D_CULL_FACE_FRONT_AND_BACK);
break;
default:
- sb_data(sb, NV34TCL_CULL_FACE_BACK);
+ sb_data(sb, NV30_3D_CULL_FACE_BACK);
break;
}
if (cso->front_ccw) {
- sb_data(sb, NV34TCL_FRONT_FACE_CCW);
+ sb_data(sb, NV30_3D_FRONT_FACE_CCW);
} else {
- sb_data(sb, NV34TCL_FRONT_FACE_CW);
+ sb_data(sb, NV30_3D_FRONT_FACE_CW);
}
sb_data(sb, cso->poly_smooth ? 1 : 0);
sb_data(sb, (cso->cull_face != PIPE_FACE_NONE) ? 1 : 0);
- sb_method(sb, NV34TCL_POLYGON_STIPPLE_ENABLE, 1);
+ sb_method(sb, NV30_3D_POLYGON_STIPPLE_ENABLE, 1);
sb_data(sb, cso->poly_stipple_enable ? 1 : 0);
- sb_method(sb, NV34TCL_POLYGON_OFFSET_POINT_ENABLE, 3);
+ sb_method(sb, NV30_3D_POLYGON_OFFSET_POINT_ENABLE, 3);
sb_data(sb, cso->offset_point);
sb_data(sb, cso->offset_line);
sb_data(sb, cso->offset_tri);
if (cso->offset_point || cso->offset_line || cso->offset_tri) {
- sb_method(sb, NV34TCL_POLYGON_OFFSET_FACTOR, 2);
+ sb_method(sb, NV30_3D_POLYGON_OFFSET_FACTOR, 2);
sb_data(sb, fui(cso->offset_scale));
sb_data(sb, fui(cso->offset_units * 2));
}
- sb_method(sb, NV34TCL_FLATSHADE_FIRST, 1);
+ sb_method(sb, NV30_3D_FLATSHADE_FIRST, 1);
sb_data(sb, cso->flatshade_first);
rsso->pipe = *cso;
@@ -201,41 +201,41 @@ nvfx_depth_stencil_alpha_state_create(struct pipe_context *pipe,
struct nvfx_zsa_state *zsaso = CALLOC(1, sizeof(*zsaso));
struct nouveau_statebuf_builder sb = sb_init(zsaso->sb);
- sb_method(sb, NV34TCL_DEPTH_FUNC, 1);
+ sb_method(sb, NV30_3D_DEPTH_FUNC, 1);
sb_data (sb, nvgl_comparison_op(cso->depth.func));
- sb_method(sb, NV34TCL_ALPHA_FUNC_ENABLE, 3);
+ sb_method(sb, NV30_3D_ALPHA_FUNC_ENABLE, 3);
sb_data (sb, cso->alpha.enabled ? 1 : 0);
sb_data (sb, nvgl_comparison_op(cso->alpha.func));
sb_data (sb, float_to_ubyte(cso->alpha.ref_value));
if (cso->stencil[0].enabled) {
- sb_method(sb, NV34TCL_STENCIL_FRONT_ENABLE, 3);
+ sb_method(sb, NV30_3D_STENCIL_ENABLE(0), 3);
sb_data (sb, cso->stencil[0].enabled ? 1 : 0);
sb_data (sb, cso->stencil[0].writemask);
sb_data (sb, nvgl_comparison_op(cso->stencil[0].func));
- sb_method(sb, NV34TCL_STENCIL_FRONT_FUNC_MASK, 4);
+ sb_method(sb, NV30_3D_STENCIL_FUNC_MASK(0), 4);
sb_data (sb, cso->stencil[0].valuemask);
sb_data (sb, nvgl_stencil_op(cso->stencil[0].fail_op));
sb_data (sb, nvgl_stencil_op(cso->stencil[0].zfail_op));
sb_data (sb, nvgl_stencil_op(cso->stencil[0].zpass_op));
} else {
- sb_method(sb, NV34TCL_STENCIL_FRONT_ENABLE, 1);
+ sb_method(sb, NV30_3D_STENCIL_ENABLE(0), 1);
sb_data (sb, 0);
}
if (cso->stencil[1].enabled) {
- sb_method(sb, NV34TCL_STENCIL_BACK_ENABLE, 3);
+ sb_method(sb, NV30_3D_STENCIL_ENABLE(1), 3);
sb_data (sb, cso->stencil[1].enabled ? 1 : 0);
sb_data (sb, cso->stencil[1].writemask);
sb_data (sb, nvgl_comparison_op(cso->stencil[1].func));
- sb_method(sb, NV34TCL_STENCIL_BACK_FUNC_MASK, 4);
+ sb_method(sb, NV30_3D_STENCIL_FUNC_MASK(1), 4);
sb_data (sb, cso->stencil[1].valuemask);
sb_data (sb, nvgl_stencil_op(cso->stencil[1].fail_op));
sb_data (sb, nvgl_stencil_op(cso->stencil[1].zfail_op));
sb_data (sb, nvgl_stencil_op(cso->stencil[1].zpass_op));
} else {
- sb_method(sb, NV34TCL_STENCIL_BACK_ENABLE, 1);
+ sb_method(sb, NV30_3D_STENCIL_ENABLE(1), 1);
sb_data (sb, 0);
}
diff --git a/src/gallium/drivers/nvfx/nvfx_state.h b/src/gallium/drivers/nvfx/nvfx_state.h
index e9c1f2c26d..8fafca1950 100644
--- a/src/gallium/drivers/nvfx/nvfx_state.h
+++ b/src/gallium/drivers/nvfx/nvfx_state.h
@@ -17,13 +17,8 @@ struct nvfx_vertex_program_data {
};
struct nvfx_vertex_program {
- struct pipe_shader_state pipe;
unsigned long long id;
- struct draw_vertex_shader *draw;
-
- boolean translated;
-
struct nvfx_vertex_program_exec *insns;
unsigned nr_insns;
struct nvfx_vertex_program_data *consts;
@@ -46,6 +41,20 @@ struct nvfx_vertex_program {
struct util_dynarray const_relocs;
};
+#define NVFX_VP_FAILED ((struct nvfx_vertex_program*)-1)
+
+struct nvfx_pipe_vertex_program {
+ struct pipe_shader_state pipe;
+ struct tgsi_shader_info info;
+
+ unsigned draw_elements;
+ boolean draw_no_elements;
+ struct draw_vertex_shader *draw_vs;
+ struct nvfx_vertex_program* draw_vp;
+
+ struct nvfx_vertex_program* vp;
+};
+
struct nvfx_fragment_program_data {
unsigned offset;
unsigned index;
@@ -62,6 +71,7 @@ struct nvfx_fragment_program {
unsigned samplers;
unsigned point_sprite_control;
unsigned or;
+ unsigned coord_conventions;
uint32_t *insn;
int insn_len;
diff --git a/src/gallium/drivers/nvfx/nvfx_state_blend.c b/src/gallium/drivers/nvfx/nvfx_state_blend.c
deleted file mode 100644
index fe34e98364..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_blend.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_blend_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel* chan = nvfx->screen->base.channel;
- sb_emit(chan, nvfx->blend->sb, nvfx->blend->sb_len);
-}
-
-void
-nvfx_state_blend_colour_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel* chan = nvfx->screen->base.channel;
- struct pipe_blend_color *bcol = &nvfx->blend_colour;
-
- WAIT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV34TCL_BLEND_COLOR, 1));
- OUT_RING(chan, ((float_to_ubyte(bcol->color[3]) << 24) |
- (float_to_ubyte(bcol->color[0]) << 16) |
- (float_to_ubyte(bcol->color[1]) << 8) |
- (float_to_ubyte(bcol->color[2]) << 0)));
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_emit.c b/src/gallium/drivers/nvfx/nvfx_state_emit.c
index 390bca8cdb..501fdd4430 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_emit.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_emit.c
@@ -3,13 +3,191 @@
#include "nvfx_resource.h"
#include "draw/draw_context.h"
+void
+nvfx_state_viewport_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
+ struct pipe_viewport_state *vpt = &nvfx->viewport;
+
+ WAIT_RING(chan, 11);
+ if(nvfx->render_mode == HW) {
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TRANSLATE_X, 8));
+ OUT_RINGf(chan, vpt->translate[0]);
+ OUT_RINGf(chan, vpt->translate[1]);
+ OUT_RINGf(chan, vpt->translate[2]);
+ OUT_RINGf(chan, vpt->translate[3]);
+ OUT_RINGf(chan, vpt->scale[0]);
+ OUT_RINGf(chan, vpt->scale[1]);
+ OUT_RINGf(chan, vpt->scale[2]);
+ OUT_RINGf(chan, vpt->scale[3]);
+ OUT_RING(chan, RING_3D(0x1d78, 1));
+ OUT_RING(chan, 1);
+ } else {
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TRANSLATE_X, 8));
+ OUT_RINGf(chan, 0.0f);
+ OUT_RINGf(chan, 0.0f);
+ OUT_RINGf(chan, 0.0f);
+ OUT_RINGf(chan, 0.0f);
+ OUT_RINGf(chan, 1.0f);
+ OUT_RINGf(chan, 1.0f);
+ OUT_RINGf(chan, 1.0f);
+ OUT_RINGf(chan, 1.0f);
+ OUT_RING(chan, RING_3D(0x1d78, 1));
+ OUT_RING(chan, nvfx->is_nv4x ? 0x110 : 1);
+ }
+}
+
+void
+nvfx_state_scissor_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
+ struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe;
+ struct pipe_scissor_state *s = &nvfx->scissor;
+
+ if ((rast->scissor == 0 && nvfx->state.scissor_enabled == 0))
+ return;
+ nvfx->state.scissor_enabled = rast->scissor;
+
+ WAIT_RING(chan, 3);
+ OUT_RING(chan, RING_3D(NV30_3D_SCISSOR_HORIZ, 2));
+ if (nvfx->state.scissor_enabled) {
+ OUT_RING(chan, ((s->maxx - s->minx) << 16) | s->minx);
+ OUT_RING(chan, ((s->maxy - s->miny) << 16) | s->miny);
+ } else {
+ OUT_RING(chan, 4096 << 16);
+ OUT_RING(chan, 4096 << 16);
+ }
+}
+
+void
+nvfx_state_sr_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ struct pipe_stencil_ref *sr = &nvfx->stencil_ref;
+
+ WAIT_RING(chan, 4);
+ OUT_RING(chan, RING_3D(NV30_3D_STENCIL_FUNC_REF(0), 1));
+ OUT_RING(chan, sr->ref_value[0]);
+ OUT_RING(chan, RING_3D(NV30_3D_STENCIL_FUNC_REF(1), 1));
+ OUT_RING(chan, sr->ref_value[1]);
+}
+
+void
+nvfx_state_blend_colour_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ struct pipe_blend_color *bcol = &nvfx->blend_colour;
+
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_BLEND_COLOR, 1));
+ OUT_RING(chan, ((float_to_ubyte(bcol->color[3]) << 24) |
+ (float_to_ubyte(bcol->color[0]) << 16) |
+ (float_to_ubyte(bcol->color[1]) << 8) |
+ (float_to_ubyte(bcol->color[2]) << 0)));
+}
+
+void
+nvfx_state_stipple_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel *chan = nvfx->screen->base.channel;
+
+ WAIT_RING(chan, 33);
+ OUT_RING(chan, RING_3D(NV30_3D_POLYGON_STIPPLE_PATTERN(0), 32));
+ OUT_RINGp(chan, nvfx->stipple, 32);
+}
+
+static void
+nvfx_coord_conventions_validate(struct nvfx_context* nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ unsigned value = nvfx->hw_fragprog->coord_conventions;
+ if(value & NV30_3D_COORD_CONVENTIONS_ORIGIN_INVERTED)
+ value |= nvfx->framebuffer.height << NV30_3D_COORD_CONVENTIONS_HEIGHT__SHIFT;
+
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_COORD_CONVENTIONS, 1));
+ OUT_RING(chan, value);
+}
+
+static void
+nvfx_ucp_validate(struct nvfx_context* nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ unsigned enables[7] =
+ {
+ 0,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE2,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE2 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE3,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE2 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE3 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE4,
+ NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE0 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE1 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE2 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE3 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE4 | NV30_3D_VP_CLIP_PLANES_ENABLE_PLANE5,
+ };
+
+ if(!nvfx->use_vp_clipping)
+ {
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANES_ENABLE, 1));
+ OUT_RING(chan, 0);
+
+ WAIT_RING(chan, 6 * 4 + 1);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANE(0, 0), nvfx->clip.nr * 4));
+ OUT_RINGp(chan, &nvfx->clip.ucp[0][0], nvfx->clip.nr * 4);
+ }
+
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_CLIP_PLANES_ENABLE, 1));
+ OUT_RING(chan, enables[nvfx->clip.nr]);
+}
+
+static void
+nvfx_vertprog_ucp_validate(struct nvfx_context* nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ unsigned i;
+ struct nvfx_vertex_program* vp = nvfx->hw_vertprog;
+ if(nvfx->clip.nr != vp->clip_nr)
+ {
+ unsigned idx;
+ WAIT_RING(chan, 14);
+
+ /* remove last instruction bit */
+ if(vp->clip_nr >= 0)
+ {
+ idx = vp->nr_insns - 7 + vp->clip_nr;
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+ OUT_RING(chan, vp->exec->start + idx);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+ OUT_RINGp (chan, vp->insns[idx].data, 4);
+ }
+
+ /* set last instruction bit */
+ idx = vp->nr_insns - 7 + nvfx->clip.nr;
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+ OUT_RING(chan, vp->exec->start + idx);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+ OUT_RINGp(chan, vp->insns[idx].data, 3);
+ OUT_RING(chan, vp->insns[idx].data[3] | 1);
+ vp->clip_nr = nvfx->clip.nr;
+ }
+
+ // TODO: only do this for the ones changed
+ WAIT_RING(chan, 6 * 6);
+ for(i = 0; i < nvfx->clip.nr; ++i)
+ {
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+ OUT_RING(chan, vp->data->start + i);
+ OUT_RINGp (chan, nvfx->clip.ucp[i], 4);
+ }
+}
+
static boolean
nvfx_state_validate_common(struct nvfx_context *nvfx)
{
struct nouveau_channel* chan = nvfx->screen->base.channel;
unsigned dirty;
unsigned still_dirty = 0;
- int all_swizzled = -1;
+ int new_fb_mode = -1; /* 1 = all swizzled, 0 = make all linear */
boolean flush_tex_cache = FALSE;
unsigned render_temps;
@@ -41,10 +219,10 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
if(nvfx->dirty & NVFX_NEW_FB)
{
nvfx->dirty &=~ NVFX_NEW_FB;
- all_swizzled = nvfx_framebuffer_prepare(nvfx);
+ new_fb_mode = nvfx_framebuffer_prepare(nvfx);
// TODO: make sure this doesn't happen, i.e. fbs have matching formats
- assert(all_swizzled >= 0);
+ assert(new_fb_mode >= 0);
}
}
@@ -52,7 +230,7 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
if(nvfx->render_mode == HW)
{
- if(dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_VERTCONST | NVFX_NEW_UCP))
+ if(dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_VERTCONST))
{
if(!nvfx_vertprog_validate(nvfx))
return FALSE;
@@ -74,12 +252,10 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
}
else
{
- /* TODO: this looks a bit misdesigned */
- if(dirty & (NVFX_NEW_VERTPROG | NVFX_NEW_UCP))
- nvfx_vertprog_validate(nvfx);
-
- if(dirty & (NVFX_NEW_ARRAYS | NVFX_NEW_INDEX | NVFX_NEW_FRAGPROG))
- nvfx_vtxfmt_validate(nvfx);
+ if(dirty & NVFX_NEW_VERTPROG) {
+ assert(nvfx_vertprog_validate(nvfx));
+ nvfx_vbo_swtnl_validate(nvfx);
+ }
}
if(dirty & NVFX_NEW_RAST)
@@ -92,72 +268,10 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
nvfx_state_stipple_validate(nvfx);
if(nvfx->dirty & NVFX_NEW_UCP)
- {
- unsigned enables[7] =
- {
- 0,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4,
- NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE0 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE1 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE2 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE3 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE4 | NV34TCL_VP_CLIP_PLANES_ENABLE_PLANE5,
- };
-
- if(!nvfx->use_vp_clipping)
- {
- WAIT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1));
- OUT_RING(chan, 0);
-
- WAIT_RING(chan, 6 * 4 + 1);
- OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANE_A(0), nvfx->clip.nr * 4));
- OUT_RINGp(chan, &nvfx->clip.ucp[0][0], nvfx->clip.nr * 4);
- }
-
- WAIT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV34TCL_VP_CLIP_PLANES_ENABLE, 1));
- OUT_RING(chan, enables[nvfx->clip.nr]);
- }
+ nvfx_ucp_validate(nvfx);
if(nvfx->use_vp_clipping && (nvfx->dirty & (NVFX_NEW_UCP | NVFX_NEW_VERTPROG)))
- {
- unsigned i;
- struct nvfx_vertex_program* vp = nvfx->vertprog;
- if(nvfx->clip.nr != vp->clip_nr)
- {
- unsigned idx;
- WAIT_RING(chan, 14);
-
- /* remove last instruction bit */
- if(vp->clip_nr >= 0)
- {
- idx = vp->nr_insns - 7 + vp->clip_nr;
- OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_FROM_ID, 1));
- OUT_RING(chan, vp->exec->start + idx);
- OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_INST(0), 4));
- OUT_RINGp (chan, vp->insns[idx].data, 4);
- }
-
- /* set last instruction bit */
- idx = vp->nr_insns - 7 + nvfx->clip.nr;
- OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_FROM_ID, 1));
- OUT_RING(chan, vp->exec->start + idx);
- OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_INST(0), 4));
- OUT_RINGp(chan, vp->insns[idx].data, 3);
- OUT_RING(chan, vp->insns[idx].data[3] | 1);
- vp->clip_nr = nvfx->clip.nr;
- }
-
- // TODO: only do this for the ones changed
- WAIT_RING(chan, 6 * 6);
- for(i = 0; i < nvfx->clip.nr; ++i)
- {
- OUT_RING(chan, RING_3D(NV34TCL_VP_UPLOAD_CONST_ID, 5));
- OUT_RING(chan, vp->data->start + i);
- OUT_RINGp (chan, nvfx->clip.ucp[i], 4);
- }
- }
+ nvfx_vertprog_ucp_validate(nvfx);
if(dirty & (NVFX_NEW_FRAGPROG | NVFX_NEW_FRAGCONST | NVFX_NEW_VERTPROG | NVFX_NEW_SPRITE))
{
@@ -168,20 +282,20 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
if(nvfx->is_nv4x)
{
- unsigned vp_output = nvfx->vertprog->or | nvfx->hw_fragprog->or;
+ unsigned vp_output = nvfx->hw_vertprog->or | nvfx->hw_fragprog->or;
vp_output |= (1 << (nvfx->clip.nr + 6)) - (1 << 6);
if(vp_output != nvfx->hw_vp_output)
{
WAIT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV40TCL_VP_RESULT_EN, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_VP_RESULT_EN, 1));
OUT_RING(chan, vp_output);
nvfx->hw_vp_output = vp_output;
}
}
- if(all_swizzled >= 0)
- nvfx_framebuffer_validate(nvfx, all_swizzled);
+ if(new_fb_mode >= 0)
+ nvfx_framebuffer_validate(nvfx, new_fb_mode);
if(dirty & NVFX_NEW_BLEND)
sb_emit(chan, nvfx->blend->sb, nvfx->blend->sb_len);
@@ -199,28 +313,31 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
etracer, neverball, foobillard, glest totally misrender
TODO: find the right fix
*/
- if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_RAST | NVFX_NEW_ZSA) || (all_swizzled >= 0))
+ if(dirty & (NVFX_NEW_VIEWPORT | NVFX_NEW_RAST | NVFX_NEW_ZSA) || (new_fb_mode >= 0))
{
nvfx_state_viewport_validate(nvfx);
}
- if(dirty & NVFX_NEW_ZSA || (all_swizzled >= 0))
+ if(dirty & NVFX_NEW_ZSA || (new_fb_mode >= 0))
{
WAIT_RING(chan, 3);
- OUT_RING(chan, RING_3D(NV34TCL_DEPTH_WRITE_ENABLE, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_DEPTH_WRITE_ENABLE, 2));
OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.writemask);
OUT_RING(chan, nvfx->framebuffer.zsbuf && nvfx->zsa->pipe.depth.enabled);
}
+ if((new_fb_mode >= 0) || (dirty & NVFX_NEW_FRAGPROG))
+ nvfx_coord_conventions_validate(nvfx);
+
if(flush_tex_cache)
{
// TODO: what about nv30?
if(nvfx->is_nv4x)
{
WAIT_RING(chan, 4);
- OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_TEX_CACHE_CTL, 1));
OUT_RING(chan, 2);
- OUT_RING(chan, RING_3D(NV40TCL_TEX_CACHE_CTL, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_TEX_CACHE_CTL, 1));
OUT_RING(chan, 1);
}
}
@@ -232,14 +349,18 @@ nvfx_state_validate_common(struct nvfx_context *nvfx)
{
for(int i = 0; i < nvfx->framebuffer.nr_cbufs; ++i)
{
- if(render_temps & (1 << i))
+ if(render_temps & (1 << i)) {
+ assert(((struct nvfx_surface*)nvfx->framebuffer.cbufs[i])->temp);
util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.cbufs[i]),
(struct util_dirty_surface*)nvfx->framebuffer.cbufs[i]);
+ }
}
- if(render_temps & 0x80)
+ if(render_temps & 0x80) {
+ assert(((struct nvfx_surface*)nvfx->framebuffer.zsbuf)->temp);
util_dirty_surface_set_dirty(nvfx_surface_get_dirty_surfaces(nvfx->framebuffer.zsbuf),
(struct util_dirty_surface*)nvfx->framebuffer.zsbuf);
+ }
}
return TRUE;
@@ -276,8 +397,6 @@ nvfx_state_relocate(struct nvfx_context *nvfx, unsigned relocs)
boolean
nvfx_state_validate(struct nvfx_context *nvfx)
{
- boolean was_sw = nvfx->fallback_swtnl ? TRUE : FALSE;
-
if (nvfx->render_mode != HW) {
/* Don't even bother trying to go back to hw if none
* of the states that caused swtnl previously have changed.
@@ -296,9 +415,6 @@ nvfx_state_validate(struct nvfx_context *nvfx)
if(!nvfx_state_validate_common(nvfx))
return FALSE;
- if (was_sw)
- NOUVEAU_ERR("swtnl->hw\n");
-
return TRUE;
}
@@ -309,7 +425,11 @@ nvfx_state_validate_swtnl(struct nvfx_context *nvfx)
/* Setup for swtnl */
if (nvfx->render_mode == HW) {
- NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl);
+ static boolean warned = FALSE;
+ if(!warned) {
+ NOUVEAU_ERR("hw->swtnl 0x%08x\n", nvfx->fallback_swtnl);
+ warned = TRUE;
+ }
nvfx->pipe.flush(&nvfx->pipe, 0, NULL);
nvfx->dirty |= (NVFX_NEW_VIEWPORT |
NVFX_NEW_VERTPROG |
@@ -317,8 +437,11 @@ nvfx_state_validate_swtnl(struct nvfx_context *nvfx)
nvfx->render_mode = SWTNL;
}
- if (nvfx->draw_dirty & NVFX_NEW_VERTPROG)
- draw_bind_vertex_shader(draw, nvfx->vertprog->draw);
+ if (nvfx->draw_dirty & NVFX_NEW_VERTPROG) {
+ if(!nvfx->vertprog->draw_vs)
+ nvfx->vertprog->draw_vs = draw_create_vertex_shader(draw, &nvfx->vertprog->pipe);
+ draw_bind_vertex_shader(draw, nvfx->vertprog->draw_vs);
+ }
if (nvfx->draw_dirty & NVFX_NEW_RAST)
draw_set_rasterizer_state(draw, &nvfx->rasterizer->pipe,
diff --git a/src/gallium/drivers/nvfx/nvfx_state_fb.c b/src/gallium/drivers/nvfx/nvfx_state_fb.c
index 3b869d43a1..4ffc4de452 100644
--- a/src/gallium/drivers/nvfx/nvfx_state_fb.c
+++ b/src/gallium/drivers/nvfx/nvfx_state_fb.c
@@ -5,6 +5,7 @@
static inline boolean
nvfx_surface_linear_renderable(struct pipe_surface* surf)
{
+ /* TODO: precompute this in nvfx_surface creation */
return (surf->texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
&& !(surf->offset & 63)
&& !(((struct nvfx_surface*)surf)->pitch & 63);
@@ -13,13 +14,14 @@ nvfx_surface_linear_renderable(struct pipe_surface* surf)
static inline boolean
nvfx_surface_swizzled_renderable(struct pipe_framebuffer_state* fb, struct pipe_surface* surf)
{
- /* TODO: return FALSE if we have a format not supporting swizzled rendering (e.g. r8); currently those are not supported at all */
+ /* TODO: precompute this in nvfx_surface creation */
return !((struct nvfx_miptree*)surf->texture)->linear_pitch
&& (surf->texture->target != PIPE_TEXTURE_3D || u_minify(surf->texture->depth0, surf->level) <= 1)
&& !(surf->offset & 127)
&& (surf->width == fb->width)
&& (surf->height == fb->height)
- && !((struct nvfx_surface*)surf)->temp;
+ && !((struct nvfx_surface*)surf)->temp
+ && (surf->format == PIPE_FORMAT_B8G8R8A8_UNORM || surf->format == PIPE_FORMAT_B8G8R8X8_UNORM || surf->format == PIPE_FORMAT_B5G6R5_UNORM);
}
static boolean
@@ -100,10 +102,10 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
unsigned w = fb->width;
unsigned h = fb->height;
- rt_enable = (NV34TCL_RT_ENABLE_COLOR0 << fb->nr_cbufs) - 1;
- if (rt_enable & (NV34TCL_RT_ENABLE_COLOR1 |
- NV40TCL_RT_ENABLE_COLOR2 | NV40TCL_RT_ENABLE_COLOR3))
- rt_enable |= NV34TCL_RT_ENABLE_MRT;
+ rt_enable = (NV30_3D_RT_ENABLE_COLOR0 << fb->nr_cbufs) - 1;
+ if (rt_enable & (NV30_3D_RT_ENABLE_COLOR1 |
+ NV40_3D_RT_ENABLE_COLOR2 | NV40_3D_RT_ENABLE_COLOR3))
+ rt_enable |= NV30_3D_RT_ENABLE_MRT;
nvfx->state.render_temps = 0;
@@ -123,55 +125,63 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
if (prepare_result) {
assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1)));
- rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED |
- (util_logbase2(fb->width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) |
- (util_logbase2(fb->height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT);
+ rt_format = NV30_3D_RT_FORMAT_TYPE_SWIZZLED |
+ (util_logbase2(fb->width) << NV30_3D_RT_FORMAT_LOG2_WIDTH__SHIFT) |
+ (util_logbase2(fb->height) << NV30_3D_RT_FORMAT_LOG2_HEIGHT__SHIFT);
} else
- rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR;
+ rt_format = NV30_3D_RT_FORMAT_TYPE_LINEAR;
if(fb->nr_cbufs > 0) {
switch (fb->cbufs[0]->format) {
case PIPE_FORMAT_B8G8R8X8_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8;
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_X8R8G8B8;
break;
case PIPE_FORMAT_B8G8R8A8_UNORM:
case 0:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8;
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_A8R8G8B8;
break;
case PIPE_FORMAT_B5G6R5_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_R5G6B5;
+ break;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_A32B32G32R32_FLOAT;
+ break;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_A16B16G16R16_FLOAT;
break;
default:
assert(0);
}
} else if(fb->zsbuf && util_format_get_blocksize(fb->zsbuf->format) == 2)
- rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5;
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_R5G6B5;
else
- rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8;
+ rt_format |= NV30_3D_RT_FORMAT_COLOR_A8R8G8B8;
if(fb->zsbuf) {
switch (fb->zsbuf->format) {
case PIPE_FORMAT_Z16_UNORM:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
+ rt_format |= NV30_3D_RT_FORMAT_ZETA_Z16;
break;
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
case PIPE_FORMAT_X8Z24_UNORM:
case 0:
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8;
+ rt_format |= NV30_3D_RT_FORMAT_ZETA_Z24S8;
break;
default:
assert(0);
}
} else if(fb->nr_cbufs && util_format_get_blocksize(fb->cbufs[0]->format) == 2)
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16;
+ rt_format |= NV30_3D_RT_FORMAT_ZETA_Z16;
else
- rt_format |= NV34TCL_RT_FORMAT_ZETA_Z24S8;
+ rt_format |= NV30_3D_RT_FORMAT_ZETA_Z24S8;
+
+ MARK_RING(chan, 42, 10);
- if ((rt_enable & NV34TCL_RT_ENABLE_COLOR0) || fb->zsbuf) {
+ if ((rt_enable & NV30_3D_RT_ENABLE_COLOR0) || fb->zsbuf) {
struct nvfx_render_target *rt0 = &nvfx->hw_rt[0];
uint32_t pitch;
- if(!(rt_enable & NV34TCL_RT_ENABLE_COLOR0))
+ if(!(rt_enable & NV30_3D_RT_ENABLE_COLOR0))
rt0 = &nvfx->hw_zeta;
pitch = rt0->pitch;
@@ -186,23 +196,23 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
//printf("rendering to bo %p [%i] at offset %i with pitch %i\n", rt0->bo, rt0->bo->handle, rt0->offset, pitch);
- OUT_RING(chan, RING_3D(NV34TCL_DMA_COLOR0, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR0, 1));
OUT_RELOC(chan, rt0->bo, 0,
rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV34TCL_COLOR0_PITCH, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_COLOR0_PITCH, 2));
OUT_RING(chan, pitch);
OUT_RELOC(chan, rt0->bo,
rt0->offset, rt_flags | NOUVEAU_BO_LOW,
0, 0);
}
- if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
- OUT_RING(chan, RING_3D(NV34TCL_DMA_COLOR1, 1));
+ if (rt_enable & NV30_3D_RT_ENABLE_COLOR1) {
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_COLOR1, 1));
OUT_RELOC(chan, nvfx->hw_rt[1].bo, 0,
rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV34TCL_COLOR1_OFFSET, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_COLOR1_OFFSET, 2));
OUT_RELOC(chan, nvfx->hw_rt[1].bo,
nvfx->hw_rt[1].offset, rt_flags | NOUVEAU_BO_LOW,
0, 0);
@@ -211,71 +221,69 @@ nvfx_framebuffer_validate(struct nvfx_context *nvfx, unsigned prepare_result)
if(nvfx->is_nv4x)
{
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR2) {
- OUT_RING(chan, RING_3D(NV40TCL_DMA_COLOR2, 1));
+ if (rt_enable & NV40_3D_RT_ENABLE_COLOR2) {
+ OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR2, 1));
OUT_RELOC(chan, nvfx->hw_rt[2].bo, 0,
rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV40TCL_COLOR2_OFFSET, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_COLOR2_OFFSET, 1));
OUT_RELOC(chan, nvfx->hw_rt[2].bo,
nvfx->hw_rt[2].offset, rt_flags | NOUVEAU_BO_LOW,
0, 0);
- OUT_RING(chan, RING_3D(NV40TCL_COLOR2_PITCH, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_COLOR2_PITCH, 1));
OUT_RING(chan, nvfx->hw_rt[2].pitch);
}
- if (rt_enable & NV40TCL_RT_ENABLE_COLOR3) {
- OUT_RING(chan, RING_3D(NV40TCL_DMA_COLOR3, 1));
+ if (rt_enable & NV40_3D_RT_ENABLE_COLOR3) {
+ OUT_RING(chan, RING_3D(NV40_3D_DMA_COLOR3, 1));
OUT_RELOC(chan, nvfx->hw_rt[3].bo, 0,
rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV40TCL_COLOR3_OFFSET, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_COLOR3_OFFSET, 1));
OUT_RELOC(chan, nvfx->hw_rt[3].bo,
nvfx->hw_rt[3].offset, rt_flags | NOUVEAU_BO_LOW,
0, 0);
- OUT_RING(chan, RING_3D(NV40TCL_COLOR3_PITCH, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_COLOR3_PITCH, 1));
OUT_RING(chan, nvfx->hw_rt[3].pitch);
}
}
if (fb->zsbuf) {
- OUT_RING(chan, RING_3D(NV34TCL_DMA_ZETA, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_DMA_ZETA, 1));
OUT_RELOC(chan, nvfx->hw_zeta.bo, 0,
rt_flags | NOUVEAU_BO_OR,
chan->vram->handle, chan->gart->handle);
- OUT_RING(chan, RING_3D(NV34TCL_ZETA_OFFSET, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_ZETA_OFFSET, 1));
/* TODO: reverse engineer LMA */
OUT_RELOC(chan, nvfx->hw_zeta.bo,
nvfx->hw_zeta.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0);
if(nvfx->is_nv4x) {
- OUT_RING(chan, RING_3D(NV40TCL_ZETA_PITCH, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_ZETA_PITCH, 1));
OUT_RING(chan, nvfx->hw_zeta.pitch);
}
}
else if(nvfx->is_nv4x) {
- OUT_RING(chan, RING_3D(NV40TCL_ZETA_PITCH, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_ZETA_PITCH, 1));
OUT_RING(chan, 64);
}
- OUT_RING(chan, RING_3D(NV34TCL_RT_ENABLE, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_RT_ENABLE, 1));
OUT_RING(chan, rt_enable);
- OUT_RING(chan, RING_3D(NV34TCL_RT_HORIZ, 3));
+ OUT_RING(chan, RING_3D(NV30_3D_RT_HORIZ, 3));
OUT_RING(chan, (w << 16) | 0);
OUT_RING(chan, (h << 16) | 0);
OUT_RING(chan, rt_format);
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_HORIZ, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_HORIZ, 2));
OUT_RING(chan, (w << 16) | 0);
OUT_RING(chan, (h << 16) | 0);
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2));
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_CLIP_HORIZ(0), 2));
OUT_RING(chan, ((w - 1) << 16) | 0);
OUT_RING(chan, ((h - 1) << 16) | 0);
- OUT_RING(chan, RING_3D(0x1d88, 1));
- OUT_RING(chan, (1 << 12) | h);
if(!nvfx->is_nv4x) {
/* Wonder why this is needed, context should all be set to zero on init */
/* TODO: we can most likely remove this, after putting it in context init */
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_TX_ORIGIN, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VIEWPORT_TX_ORIGIN, 1));
OUT_RING(chan, 0);
}
nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAMEBUFFER;
@@ -291,22 +299,22 @@ nvfx_framebuffer_relocate(struct nvfx_context *nvfx)
#define DO_(var, pfx, name) \
if(var.bo) { \
- OUT_RELOC(chan, var.bo, RING_3D(pfx##TCL_DMA_##name, 1), rt_flags, 0, 0); \
+ OUT_RELOC(chan, var.bo, RING_3D(pfx##_3D_DMA_##name, 1), rt_flags, 0, 0); \
OUT_RELOC(chan, var.bo, 0, \
rt_flags | NOUVEAU_BO_OR, \
chan->vram->handle, chan->gart->handle); \
- OUT_RELOC(chan, var.bo, RING_3D(pfx##TCL_##name##_OFFSET, 1), rt_flags, 0, 0); \
+ OUT_RELOC(chan, var.bo, RING_3D(pfx##_3D_##name##_OFFSET, 1), rt_flags, 0, 0); \
OUT_RELOC(chan, var.bo, \
var.offset, rt_flags | NOUVEAU_BO_LOW, \
0, 0); \
}
#define DO(pfx, num) DO_(nvfx->hw_rt[num], pfx, COLOR##num)
- DO(NV34, 0);
- DO(NV34, 1);
+ DO(NV30, 0);
+ DO(NV30, 1);
DO(NV40, 2);
DO(NV40, 3);
- DO_(nvfx->hw_zeta, NV34, ZETA);
+ DO_(nvfx->hw_zeta, NV30, ZETA);
nvfx->relocs_needed &=~ NVFX_RELOCATE_FRAMEBUFFER;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c b/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c
deleted file mode 100644
index 7f14ae85d5..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_rasterizer.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_rasterizer_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel* chan = nvfx->screen->base.channel;
- sb_emit(chan, nvfx->rasterizer->sb, nvfx->rasterizer->sb_len);
-}
-
diff --git a/src/gallium/drivers/nvfx/nvfx_state_scissor.c b/src/gallium/drivers/nvfx/nvfx_state_scissor.c
deleted file mode 100644
index 9077266120..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_scissor.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_scissor_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel *chan = nvfx->screen->base.channel;
- struct pipe_rasterizer_state *rast = &nvfx->rasterizer->pipe;
- struct pipe_scissor_state *s = &nvfx->scissor;
-
- if ((rast->scissor == 0 && nvfx->state.scissor_enabled == 0))
- return;
- nvfx->state.scissor_enabled = rast->scissor;
-
- WAIT_RING(chan, 3);
- OUT_RING(chan, RING_3D(NV34TCL_SCISSOR_HORIZ, 2));
- if (nvfx->state.scissor_enabled) {
- OUT_RING(chan, ((s->maxx - s->minx) << 16) | s->minx);
- OUT_RING(chan, ((s->maxy - s->miny) << 16) | s->miny);
- } else {
- OUT_RING(chan, 4096 << 16);
- OUT_RING(chan, 4096 << 16);
- }
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_stipple.c b/src/gallium/drivers/nvfx/nvfx_state_stipple.c
deleted file mode 100644
index b76e9dd382..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_stipple.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_stipple_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel *chan = nvfx->screen->base.channel;
-
- WAIT_RING(chan, 33);
- OUT_RING(chan, RING_3D(NV34TCL_POLYGON_STIPPLE_PATTERN(0), 32));
- OUT_RINGp(chan, nvfx->stipple, 32);
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_viewport.c b/src/gallium/drivers/nvfx/nvfx_state_viewport.c
deleted file mode 100644
index e983b16f32..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_viewport.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_viewport_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel *chan = nvfx->screen->base.channel;
- struct pipe_viewport_state *vpt = &nvfx->viewport;
-
- WAIT_RING(chan, 11);
- if(nvfx->render_mode == HW) {
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_TRANSLATE_X, 8));
- OUT_RINGf(chan, vpt->translate[0]);
- OUT_RINGf(chan, vpt->translate[1]);
- OUT_RINGf(chan, vpt->translate[2]);
- OUT_RINGf(chan, vpt->translate[3]);
- OUT_RINGf(chan, vpt->scale[0]);
- OUT_RINGf(chan, vpt->scale[1]);
- OUT_RINGf(chan, vpt->scale[2]);
- OUT_RINGf(chan, vpt->scale[3]);
- OUT_RING(chan, RING_3D(0x1d78, 1));
- OUT_RING(chan, 1);
- } else {
- OUT_RING(chan, RING_3D(NV34TCL_VIEWPORT_TRANSLATE_X, 8));
- OUT_RINGf(chan, 0.0f);
- OUT_RINGf(chan, 0.0f);
- OUT_RINGf(chan, 0.0f);
- OUT_RINGf(chan, 0.0f);
- OUT_RINGf(chan, 1.0f);
- OUT_RINGf(chan, 1.0f);
- OUT_RINGf(chan, 1.0f);
- OUT_RINGf(chan, 1.0f);
- OUT_RING(chan, RING_3D(0x1d78, 1));
- OUT_RING(chan, nvfx->is_nv4x ? 0x110 : 1);
- }
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_state_zsa.c b/src/gallium/drivers/nvfx/nvfx_state_zsa.c
deleted file mode 100644
index 608605d32b..0000000000
--- a/src/gallium/drivers/nvfx/nvfx_state_zsa.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "nvfx_context.h"
-
-void
-nvfx_state_zsa_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel* chan = nvfx->screen->base.channel;
- sb_emit(chan, nvfx->zsa->sb, nvfx->zsa->sb_len);
-}
-
-void
-nvfx_state_sr_validate(struct nvfx_context *nvfx)
-{
- struct nouveau_channel* chan = nvfx->screen->base.channel;
- struct pipe_stencil_ref *sr = &nvfx->stencil_ref;
-
- WAIT_RING(chan, 4);
- OUT_RING(chan, RING_3D(NV34TCL_STENCIL_FRONT_FUNC_REF, 1));
- OUT_RING(chan, sr->ref_value[0]);
- OUT_RING(chan, RING_3D(NV34TCL_STENCIL_BACK_FUNC_REF, 1));
- OUT_RING(chan, sr->ref_value[1]);
-}
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c
index a5931b6e15..70adebc1be 100644
--- a/src/gallium/drivers/nvfx/nvfx_surface.c
+++ b/src/gallium/drivers/nvfx/nvfx_surface.c
@@ -47,6 +47,9 @@ static INLINE void
nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format)
{
unsigned bits = util_format_get_blocksizebits(format);
+ unsigned shift = 0;
+ rgn->one_bits = 0;
+
switch(bits)
{
case 8:
@@ -54,43 +57,28 @@ nvfx_region_set_format(struct nv04_region* rgn, enum pipe_format format)
break;
case 16:
rgn->bpps = 1;
+ if(format == PIPE_FORMAT_B5G5R5X1_UNORM)
+ rgn->one_bits = 1;
break;
case 32:
rgn->bpps = 2;
+ if(format == PIPE_FORMAT_R8G8B8X8_UNORM || format == PIPE_FORMAT_B8G8R8X8_UNORM)
+ rgn->one_bits = 8;
+ break;
+ case 64:
+ rgn->bpps = 2;
+ shift = 1;
+ break;
+ case 128:
+ rgn->bpps = 2;
+ shift = 2;
break;
- default:
- {
- int shift;
- assert(util_is_power_of_two(bits));
- shift = util_logbase2(bits) - 3;
- assert(shift >= 2);
- rgn->bpps = 2;
- shift -= 2;
-
- rgn->x = util_format_get_nblocksx(format, rgn->x) << shift;
- rgn->y = util_format_get_nblocksy(format, rgn->y);
- }
}
-}
-static INLINE void
-nvfx_region_fixup_swizzled(struct nv04_region* rgn, unsigned zslice, unsigned width, unsigned height, unsigned depth)
-{
- // TODO: move this code to surface creation?
- if((depth <= 1) && (height <= 1 || width <= 2))
- rgn->pitch = width << rgn->bpps;
- else if(depth > 1 && height <= 2 && width <= 2)
- {
- rgn->pitch = width << rgn->bpps;
- rgn->offset += (zslice * width * height) << rgn->bpps;
- }
- else
- {
- rgn->pitch = 0;
- rgn->z = zslice;
- rgn->w = width;
- rgn->h = height;
- rgn->d = depth;
+ if(shift) {
+ rgn->x = util_format_get_nblocksx(format, rgn->x) << shift;
+ rgn->y = util_format_get_nblocksy(format, rgn->y);
+ rgn->w <<= shift;
}
}
@@ -100,7 +88,6 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf,
rgn->x = x;
rgn->y = y;
rgn->z = 0;
- nvfx_region_set_format(rgn, surf->base.base.format);
if(surf->temp)
{
@@ -113,11 +100,22 @@ nvfx_region_init_for_surface(struct nv04_region* rgn, struct nvfx_surface* surf,
} else {
rgn->bo = ((struct nvfx_resource*)surf->base.base.texture)->bo;
rgn->offset = surf->base.base.offset;
- rgn->pitch = surf->pitch;
- if(!(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR))
- nvfx_region_fixup_swizzled(rgn, surf->base.base.zslice, surf->base.base.width, surf->base.base.height, u_minify(surf->base.base.texture->depth0, surf->base.base.level));
+ if(surf->base.base.texture->flags & NVFX_RESOURCE_FLAG_LINEAR)
+ rgn->pitch = surf->pitch;
+ else
+ {
+ rgn->pitch = 0;
+ rgn->z = surf->base.base.zslice;
+ rgn->w = surf->base.base.width;
+ rgn->h = surf->base.base.height;
+ rgn->d = u_minify(surf->base.base.texture->depth0, surf->base.base.level);
+ }
}
+
+ nvfx_region_set_format(rgn, surf->base.base.format);
+ if(!rgn->pitch)
+ nv04_region_try_to_linearize(rgn);
}
static INLINE void
@@ -135,67 +133,50 @@ nvfx_region_init_for_subresource(struct nv04_region* rgn, struct pipe_resource*
rgn->bo = ((struct nvfx_resource*)pt)->bo;
rgn->offset = nvfx_subresource_offset(pt, sub.face, sub.level, z);
- rgn->pitch = nvfx_subresource_pitch(pt, sub.level);
rgn->x = x;
rgn->y = y;
- rgn->z = 0;
- nvfx_region_set_format(rgn, pt->format);
- if(!(pt->flags & NVFX_RESOURCE_FLAG_LINEAR))
- nvfx_region_fixup_swizzled(rgn, z, u_minify(pt->width0, sub.level), u_minify(pt->height0, sub.level), u_minify(pt->depth0, sub.level));
-}
-
-// TODO: actually test this for all formats, it's probably wrong for some...
-
-static INLINE int
-nvfx_surface_format(enum pipe_format format)
-{
- switch(util_format_get_blocksize(format)) {
- case 1:
- return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8;
- case 2:
- //return NV04_CONTEXT_SURFACES_2D_FORMAT_Y16;
- return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5;
- case 4:
- //if(format == PIPE_FORMAT_B8G8R8X8_UNORM || format == PIPE_FORMAT_B8G8R8A8_UNORM)
- return NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8;
- //else
- // return NV04_CONTEXT_SURFACES_2D_FORMAT_Y32;
- default:
- return -1;
+ if(pt->flags & NVFX_RESOURCE_FLAG_LINEAR)
+ {
+ rgn->pitch = nvfx_subresource_pitch(pt, sub.level);
+ rgn->z = 0;
}
-}
-
-static INLINE int
-nv04_scaled_image_format(enum pipe_format format)
-{
- switch(util_format_get_blocksize(format)) {
- case 1:
- return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8;
- case 2:
- //if(format == PIPE_FORMAT_B5G5R5A1_UNORM)
- // return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5;
- //else
- return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5;
- case 4:
- if(format == PIPE_FORMAT_B8G8R8X8_UNORM)
- return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8;
- else
- return NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8;
- default:
- return -1;
+ else
+ {
+ rgn->pitch = 0;
+ rgn->z = z;
+ rgn->w = u_minify(pt->width0, sub.level);
+ rgn->h = u_minify(pt->height0, sub.level);
+ rgn->d = u_minify(pt->depth0, sub.level);
}
+
+ nvfx_region_set_format(rgn, pt->format);
+ if(!rgn->pitch)
+ nv04_region_try_to_linearize(rgn);
}
-// XXX: must save index buffer too!
+// don't save index buffer because blitter doesn't setit
static struct blitter_context*
nvfx_get_blitter(struct pipe_context* pipe, int copy)
{
struct nvfx_context* nvfx = nvfx_context(pipe);
+ struct blitter_context** pblitter;
+ struct blitter_context* blitter;
+
+ assert(nvfx->blitters_in_use < Elements(nvfx->blitter));
- struct blitter_context* blitter = nvfx->blitter;
- if(!blitter)
- nvfx->blitter = blitter = util_blitter_create(pipe);
+ if(nvfx->query && !nvfx->blitters_in_use)
+ {
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+ OUT_RING(chan, 0);
+ }
+
+ pblitter = &nvfx->blitter[nvfx->blitters_in_use++];
+ if(!*pblitter)
+ *pblitter = util_blitter_create(pipe);
+ blitter = *pblitter;
util_blitter_save_blend(blitter, nvfx->blend);
util_blitter_save_depth_stencil_alpha(blitter, nvfx->zsa);
@@ -218,6 +199,22 @@ nvfx_get_blitter(struct pipe_context* pipe, int copy)
return blitter;
}
+static inline void
+nvfx_put_blitter(struct pipe_context* pipe, struct blitter_context* blitter)
+{
+ struct nvfx_context* nvfx = nvfx_context(pipe);
+ --nvfx->blitters_in_use;
+ assert(nvfx->blitters_in_use >= 0);
+
+ if(nvfx->query && !nvfx->blitters_in_use)
+ {
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ WAIT_RING(chan, 2);
+ OUT_RING(chan, RING_3D(NV30_3D_QUERY_ENABLE, 1));
+ OUT_RING(chan, 1);
+ }
+}
+
static unsigned
nvfx_region_clone(struct nv04_2d_context* ctx, struct nv04_region* rgn, unsigned w, unsigned h, boolean for_read)
{
@@ -269,16 +266,21 @@ nvfx_resource_copy_region(struct pipe_context *pipe,
if((!dst_to_gpu || !src_on_gpu) && small)
ret = -1; /* use the CPU */
else
- ret = nv04_region_copy_2d(ctx, &dst, &src, w, h,
- dstr->target == PIPE_BUFFER ? -1 : nvfx_surface_format(dstr->format),
- dstr->target == PIPE_BUFFER ? -1 : nv04_scaled_image_format(dstr->format),
- dst_to_gpu, src_on_gpu);
+ ret = nv04_region_copy_2d(ctx, &dst, &src, w, h, dst_to_gpu, src_on_gpu);
if(!ret)
{}
- else if(ret > 0 && dstr->bind & PIPE_BIND_RENDER_TARGET && srcr->bind & PIPE_BIND_SAMPLER_VIEW)
+ else if(ret > 0
+ && dstr->bind & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL)
+ && srcr->bind & PIPE_BIND_SAMPLER_VIEW)
{
+ /* this currently works because we hack the bind flags on resource creation to be
+ * the maximum set that the resource type actually supports
+ *
+ * TODO: perhaps support reinterpreting the formats
+ */
struct blitter_context* blitter = nvfx_get_blitter(pipe, 1);
util_blitter_copy_region(blitter, dstr, subdst, dstx, dsty, dstz, srcr, subsrc, srcx, srcy, srcz, w, h, TRUE);
+ nvfx_put_blitter(pipe, blitter);
}
else
{
@@ -371,11 +373,19 @@ nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int
struct nvfx_surface* ns = (struct nvfx_surface*)surf;
struct pipe_subresource tempsr, surfsr;
struct nvfx_context* nvfx = nvfx_context(pipe);
+ struct nvfx_miptree* temp;
+ unsigned use_vertex_buffers;
+ boolean use_index_buffer;
+ unsigned base_vertex;
+
+ /* temporarily detach the temp, so it isn't used in place of the actual resource */
+ temp = ns->temp;
+ ns->temp = 0;
// TODO: we really should do this validation before setting these variable in draw calls
- unsigned use_vertex_buffers = nvfx->use_vertex_buffers;
- boolean use_index_buffer = nvfx->use_index_buffer;
- unsigned base_vertex = nvfx->base_vertex;
+ use_vertex_buffers = nvfx->use_vertex_buffers;
+ use_index_buffer = nvfx->use_index_buffer;
+ base_vertex = nvfx->base_vertex;
tempsr.face = 0;
tempsr.level = 0;
@@ -383,9 +393,16 @@ nvfx_surface_copy_temp(struct pipe_context* pipe, struct pipe_surface* surf, int
surfsr.level = surf->level;
if(to_temp)
- nvfx_resource_copy_region(pipe, &ns->temp->base.base, tempsr, 0, 0, 0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height);
+ nvfx_resource_copy_region(pipe, &temp->base.base, tempsr, 0, 0, 0, surf->texture, surfsr, 0, 0, surf->zslice, surf->width, surf->height);
else
- nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, surf->zslice, &ns->temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height);
+ nvfx_resource_copy_region(pipe, surf->texture, surfsr, 0, 0, surf->zslice, &temp->base.base, tempsr, 0, 0, 0, surf->width, surf->height);
+
+ /* If this triggers, it probably means we attempted to use the blitter
+ * but failed due to non-renderability of the target.
+ * Obviously, this would lead to infinite recursion if supported. */
+ assert(!ns->temp);
+
+ ns->temp = temp;
nvfx->use_vertex_buffers = use_vertex_buffers;
nvfx->use_index_buffer = use_index_buffer;
@@ -409,6 +426,8 @@ nvfx_surface_create_temp(struct pipe_context* pipe, struct pipe_surface* surf)
template.nr_samples = surf->texture->nr_samples;
template.flags = NVFX_RESOURCE_FLAG_LINEAR;
+ assert(!ns->temp && !util_dirty_surface_is_dirty(&ns->base));
+
ns->temp = (struct nvfx_miptree*)nvfx_miptree_create(pipe->screen, &template);
nvfx_surface_copy_temp(pipe, surf, 1);
}
@@ -420,11 +439,10 @@ nvfx_surface_flush(struct pipe_context* pipe, struct pipe_surface* surf)
struct nvfx_surface* ns = (struct nvfx_surface*)surf;
boolean bound = FALSE;
- /* must be done before the copy, otherwise the copy will use the temp as destination */
- util_dirty_surface_set_clean(nvfx_surface_get_dirty_surfaces(surf), &ns->base);
-
nvfx_surface_copy_temp(pipe, surf, 0);
+ util_dirty_surface_set_clean(nvfx_surface_get_dirty_surfaces(surf), &ns->base);
+
if(nvfx->framebuffer.zsbuf == surf)
bound = TRUE;
else
@@ -459,6 +477,7 @@ nvfx_clear_render_target(struct pipe_context *pipe,
// TODO: probably should use hardware clear here instead if possible
struct blitter_context* blitter = nvfx_get_blitter(pipe, 0);
util_blitter_clear_render_target(blitter, dst, rgba, dstx, dsty, width, height);
+ nvfx_put_blitter(pipe, blitter);
}
}
@@ -477,6 +496,7 @@ nvfx_clear_depth_stencil(struct pipe_context *pipe,
// TODO: probably should use hardware clear here instead if possible
struct blitter_context* blitter = nvfx_get_blitter(pipe, 0);
util_blitter_clear_depth_stencil(blitter, dst, clear_flags, depth, stencil, dstx, dsty, width, height);
+ nvfx_put_blitter(pipe, blitter);
}
}
diff --git a/src/gallium/drivers/nvfx/nvfx_surface.h b/src/gallium/drivers/nvfx/nvfx_surface.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_surface.h
diff --git a/src/gallium/drivers/nvfx/nvfx_tex.h b/src/gallium/drivers/nvfx/nvfx_tex.h
index 34be936a89..2f2d737808 100644
--- a/src/gallium/drivers/nvfx/nvfx_tex.h
+++ b/src/gallium/drivers/nvfx/nvfx_tex.h
@@ -4,7 +4,7 @@
#include "util/u_math.h"
#include "pipe/p_defines.h"
#include "pipe/p_state.h"
-#include <nouveau/nouveau_class.h>
+
static inline unsigned
nvfx_tex_wrap_mode(unsigned wrap) {
@@ -12,36 +12,36 @@ nvfx_tex_wrap_mode(unsigned wrap) {
switch (wrap) {
case PIPE_TEX_WRAP_REPEAT:
- ret = NV34TCL_TX_WRAP_S_REPEAT;
+ ret = NV30_3D_TEX_WRAP_S_REPEAT;
break;
case PIPE_TEX_WRAP_MIRROR_REPEAT:
- ret = NV34TCL_TX_WRAP_S_MIRRORED_REPEAT;
+ ret = NV30_3D_TEX_WRAP_S_MIRRORED_REPEAT;
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- ret = NV34TCL_TX_WRAP_S_CLAMP_TO_EDGE;
+ ret = NV30_3D_TEX_WRAP_S_CLAMP_TO_EDGE;
break;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- ret = NV34TCL_TX_WRAP_S_CLAMP_TO_BORDER;
+ ret = NV30_3D_TEX_WRAP_S_CLAMP_TO_BORDER;
break;
case PIPE_TEX_WRAP_CLAMP:
- ret = NV34TCL_TX_WRAP_S_CLAMP;
+ ret = NV30_3D_TEX_WRAP_S_CLAMP;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
+ ret = NV40_3D_TEX_WRAP_S_MIRROR_CLAMP_TO_EDGE;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
+ ret = NV40_3D_TEX_WRAP_S_MIRROR_CLAMP_TO_BORDER;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP:
- ret = NV40TCL_TEX_WRAP_S_MIRROR_CLAMP;
+ ret = NV40_3D_TEX_WRAP_S_MIRROR_CLAMP;
break;
default:
assert(0);
- ret = NV34TCL_TX_WRAP_S_REPEAT;
+ ret = NV30_3D_TEX_WRAP_S_REPEAT;
break;
}
- return ret >> NV34TCL_TX_WRAP_S_SHIFT;
+ return ret >> NV30_3D_TEX_WRAP_S__SHIFT;
}
static inline unsigned
@@ -49,21 +49,21 @@ nvfx_tex_wrap_compare_mode(unsigned func)
{
switch (func) {
case PIPE_FUNC_NEVER:
- return NV34TCL_TX_WRAP_RCOMP_NEVER;
+ return NV30_3D_TEX_WRAP_RCOMP_NEVER;
case PIPE_FUNC_GREATER:
- return NV34TCL_TX_WRAP_RCOMP_GREATER;
+ return NV30_3D_TEX_WRAP_RCOMP_GREATER;
case PIPE_FUNC_EQUAL:
- return NV34TCL_TX_WRAP_RCOMP_EQUAL;
+ return NV30_3D_TEX_WRAP_RCOMP_EQUAL;
case PIPE_FUNC_GEQUAL:
- return NV34TCL_TX_WRAP_RCOMP_GEQUAL;
+ return NV30_3D_TEX_WRAP_RCOMP_GEQUAL;
case PIPE_FUNC_LESS:
- return NV34TCL_TX_WRAP_RCOMP_LESS;
+ return NV30_3D_TEX_WRAP_RCOMP_LESS;
case PIPE_FUNC_NOTEQUAL:
- return NV34TCL_TX_WRAP_RCOMP_NOTEQUAL;
+ return NV30_3D_TEX_WRAP_RCOMP_NOTEQUAL;
case PIPE_FUNC_LEQUAL:
- return NV34TCL_TX_WRAP_RCOMP_LEQUAL;
+ return NV30_3D_TEX_WRAP_RCOMP_LEQUAL;
case PIPE_FUNC_ALWAYS:
- return NV34TCL_TX_WRAP_RCOMP_ALWAYS;
+ return NV30_3D_TEX_WRAP_RCOMP_ALWAYS;
default:
assert(0);
return 0;
@@ -75,11 +75,11 @@ static inline unsigned nvfx_tex_filter(const struct pipe_sampler_state* cso)
unsigned filter = 0;
switch (cso->mag_img_filter) {
case PIPE_TEX_FILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MAGNIFY_LINEAR;
+ filter |= NV30_3D_TEX_FILTER_MAG_LINEAR;
break;
case PIPE_TEX_FILTER_NEAREST:
default:
- filter |= NV34TCL_TX_FILTER_MAGNIFY_NEAREST;
+ filter |= NV30_3D_TEX_FILTER_MAG_NEAREST;
break;
}
@@ -87,14 +87,14 @@ static inline unsigned nvfx_tex_filter(const struct pipe_sampler_state* cso)
case PIPE_TEX_FILTER_LINEAR:
switch (cso->min_mip_filter) {
case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST;
+ filter |= NV30_3D_TEX_FILTER_MIN_LINEAR_MIPMAP_NEAREST;
break;
case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR;
+ filter |= NV30_3D_TEX_FILTER_MIN_LINEAR_MIPMAP_LINEAR;
break;
case PIPE_TEX_MIPFILTER_NONE:
default:
- filter |= NV34TCL_TX_FILTER_MINIFY_LINEAR;
+ filter |= NV30_3D_TEX_FILTER_MIN_LINEAR;
break;
}
break;
@@ -102,14 +102,14 @@ static inline unsigned nvfx_tex_filter(const struct pipe_sampler_state* cso)
default:
switch (cso->min_mip_filter) {
case PIPE_TEX_MIPFILTER_NEAREST:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST;
+ filter |= NV30_3D_TEX_FILTER_MIN_NEAREST_MIPMAP_NEAREST;
break;
case PIPE_TEX_MIPFILTER_LINEAR:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR;
+ filter |= NV30_3D_TEX_FILTER_MIN_NEAREST_MIPMAP_LINEAR;
break;
case PIPE_TEX_MIPFILTER_NONE:
default:
- filter |= NV34TCL_TX_FILTER_MINIFY_NEAREST;
+ filter |= NV30_3D_TEX_FILTER_MIN_NEAREST;
break;
}
break;
diff --git a/src/gallium/drivers/nvfx/nvfx_vbo.c b/src/gallium/drivers/nvfx/nvfx_vbo.c
index e6e9a8f2e4..597664e771 100644
--- a/src/gallium/drivers/nvfx/nvfx_vbo.c
+++ b/src/gallium/drivers/nvfx/nvfx_vbo.c
@@ -9,7 +9,7 @@
#include "nvfx_resource.h"
#include "nouveau/nouveau_channel.h"
-#include "nouveau/nouveau_class.h"
+
#include "nouveau/nouveau_pushbuf.h"
static inline unsigned
@@ -266,7 +266,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
}
- OUT_RING(chan, RING_3D(NV34TCL_VTXFMT(0), elements));
+ OUT_RING(chan, RING_3D(NV30_3D_VTXFMT(0), elements));
if(nvfx->use_vertex_buffers)
{
unsigned idx = 0;
@@ -281,7 +281,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
idx = ve->idx;
}
- OUT_RING(chan, nvfx->vtxelt->vtxfmt[idx] | (vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT));
+ OUT_RING(chan, nvfx->vtxelt->vtxfmt[idx] | (vb->stride << NV30_3D_VTXFMT_STRIDE__SHIFT));
++idx;
}
if(idx != nvfx->vtxelt->num_elements)
@@ -291,7 +291,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
OUT_RINGp(chan, nvfx->vtxelt->vtxfmt, nvfx->vtxelt->num_elements);
for(i = nvfx->vtxelt->num_elements; i < elements; ++i)
- OUT_RING(chan, NV34TCL_VTXFMT_TYPE_32_FLOAT);
+ OUT_RING(chan, NV30_3D_VTXFMT_TYPE_V32_FLOAT);
if(nvfx->is_nv4x) {
unsigned i;
@@ -302,7 +302,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
}
}
- OUT_RING(chan, RING_3D(NV34TCL_VTXBUF_ADDRESS(0), elements));
+ OUT_RING(chan, RING_3D(NV30_3D_VTXBUF(0), elements));
if(nvfx->use_vertex_buffers)
{
unsigned idx = 0;
@@ -317,7 +317,7 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
OUT_RELOC(chan, bo,
vb->buffer_offset + ve->src_offset + nvfx->base_vertex * vb->stride,
vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
- 0, NV34TCL_VTXBUF_ADDRESS_DMA1);
+ 0, NV30_3D_VTXBUF_DMA1);
++idx;
}
@@ -339,6 +339,44 @@ nvfx_vbo_validate(struct nvfx_context *nvfx)
}
void
+nvfx_vbo_swtnl_validate(struct nvfx_context *nvfx)
+{
+ struct nouveau_channel* chan = nvfx->screen->base.channel;
+ unsigned num_outputs = nvfx->vertprog->draw_elements;
+ int elements = MAX2(num_outputs, nvfx->hw_vtxelt_nr);
+
+ if (!elements)
+ return;
+
+ WAIT_RING(chan, (1 + 6 + 1 + 2) + elements * 2);
+
+ OUT_RING(chan, RING_3D(NV30_3D_VTXFMT(0), elements));
+ for(unsigned i = 0; i < num_outputs; ++i)
+ OUT_RING(chan, (4 << NV30_3D_VTXFMT_SIZE__SHIFT) | NV30_3D_VTXFMT_TYPE_V32_FLOAT);
+ for(unsigned i = num_outputs; i < elements; ++i)
+ OUT_RING(chan, NV30_3D_VTXFMT_TYPE_V32_FLOAT);
+
+ if(nvfx->is_nv4x) {
+ unsigned i;
+ /* seems to be some kind of cache flushing */
+ for(i = 0; i < 3; ++i) {
+ OUT_RING(chan, RING_3D(0x1718, 1));
+ OUT_RING(chan, 0);
+ }
+ }
+
+ OUT_RING(chan, RING_3D(NV30_3D_VTXBUF(0), elements));
+ for (unsigned i = 0; i < elements; i++)
+ OUT_RING(chan, 0);
+
+ OUT_RING(chan, RING_3D(0x1710, 1));
+ OUT_RING(chan, 0);
+
+ nvfx->hw_vtxelt_nr = num_outputs;
+ nvfx->relocs_needed &=~ NVFX_RELOCATE_VTXBUF;
+}
+
+void
nvfx_vbo_relocate(struct nvfx_context *nvfx)
{
struct nouveau_channel* chan;
@@ -357,11 +395,11 @@ nvfx_vbo_relocate(struct nvfx_context *nvfx)
struct pipe_vertex_buffer *vb = &nvfx->vtxbuf[ve->vertex_buffer_index];
struct nouveau_bo* bo = nvfx_resource(vb->buffer)->bo;
- OUT_RELOC(chan, bo, RING_3D(NV34TCL_VTXBUF_ADDRESS(ve->idx), 1),
+ OUT_RELOC(chan, bo, RING_3D(NV30_3D_VTXBUF(ve->idx), 1),
vb_flags, 0, 0);
OUT_RELOC(chan, bo, vb->buffer_offset + ve->src_offset + nvfx->base_vertex * vb->stride,
vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
- 0, NV34TCL_VTXBUF_ADDRESS_DMA1);
+ 0, NV30_3D_VTXBUF_DMA1);
}
nvfx->relocs_needed &=~ NVFX_RELOCATE_VTXBUF;
}
@@ -370,7 +408,7 @@ static void
nvfx_idxbuf_emit(struct nvfx_context* nvfx, unsigned ib_flags)
{
struct nouveau_channel* chan = nvfx->screen->base.channel;
- unsigned ib_format = (nvfx->idxbuf.index_size == 2) ? NV34TCL_IDXBUF_FORMAT_TYPE_U16 : NV34TCL_IDXBUF_FORMAT_TYPE_U32;
+ unsigned ib_format = (nvfx->idxbuf.index_size == 2) ? NV30_3D_IDXBUF_FORMAT_TYPE_U16 : NV30_3D_IDXBUF_FORMAT_TYPE_U32;
struct nouveau_bo* bo = nvfx_resource(nvfx->idxbuf.buffer)->bo;
ib_flags |= nvfx->screen->index_buffer_reloc_flags | NOUVEAU_BO_RD;
@@ -378,12 +416,12 @@ nvfx_idxbuf_emit(struct nvfx_context* nvfx, unsigned ib_flags)
MARK_RING(chan, 3, 3);
if(ib_flags & NOUVEAU_BO_DUMMY)
- OUT_RELOC(chan, bo, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2), ib_flags, 0, 0);
+ OUT_RELOC(chan, bo, RING_3D(NV30_3D_IDXBUF_OFFSET, 2), ib_flags, 0, 0);
else
- OUT_RING(chan, RING_3D(NV34TCL_IDXBUF_ADDRESS, 2));
+ OUT_RING(chan, RING_3D(NV30_3D_IDXBUF_OFFSET, 2));
OUT_RELOC(chan, bo, nvfx->idxbuf.offset + 1, ib_flags | NOUVEAU_BO_LOW, 0, 0);
OUT_RELOC(chan, bo, ib_format, ib_flags | NOUVEAU_BO_OR,
- 0, NV34TCL_IDXBUF_FORMAT_DMA1);
+ 0, NV30_3D_IDXBUF_FORMAT_DMA1);
nvfx->relocs_needed &=~ NVFX_RELOCATE_IDXBUF;
}
@@ -401,27 +439,27 @@ nvfx_idxbuf_relocate(struct nvfx_context* nvfx)
unsigned nvfx_vertex_formats[PIPE_FORMAT_COUNT] =
{
- [PIPE_FORMAT_R32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT,
- [PIPE_FORMAT_R32G32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT,
- [PIPE_FORMAT_R32G32B32A32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT,
- [PIPE_FORMAT_R32G32B32_FLOAT] = NV34TCL_VTXFMT_TYPE_32_FLOAT,
- [PIPE_FORMAT_R16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT,
- [PIPE_FORMAT_R16G16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT,
- [PIPE_FORMAT_R16G16B16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT,
- [PIPE_FORMAT_R16G16B16A16_FLOAT] = NV34TCL_VTXFMT_TYPE_16_FLOAT,
- [PIPE_FORMAT_R8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM,
- [PIPE_FORMAT_R8G8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM,
- [PIPE_FORMAT_R8G8B8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM,
- [PIPE_FORMAT_R8G8B8A8_UNORM] = NV34TCL_VTXFMT_TYPE_8_UNORM,
- [PIPE_FORMAT_R8G8B8A8_USCALED] = NV34TCL_VTXFMT_TYPE_8_USCALED,
- [PIPE_FORMAT_R16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM,
- [PIPE_FORMAT_R16G16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM,
- [PIPE_FORMAT_R16G16B16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM,
- [PIPE_FORMAT_R16G16B16A16_SNORM] = NV34TCL_VTXFMT_TYPE_16_SNORM,
- [PIPE_FORMAT_R16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED,
- [PIPE_FORMAT_R16G16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED,
- [PIPE_FORMAT_R16G16B16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED,
- [PIPE_FORMAT_R16G16B16A16_SSCALED] = NV34TCL_VTXFMT_TYPE_16_SSCALED,
+ [PIPE_FORMAT_R32_FLOAT] = NV30_3D_VTXFMT_TYPE_V32_FLOAT,
+ [PIPE_FORMAT_R32G32_FLOAT] = NV30_3D_VTXFMT_TYPE_V32_FLOAT,
+ [PIPE_FORMAT_R32G32B32_FLOAT] = NV30_3D_VTXFMT_TYPE_V32_FLOAT,
+ [PIPE_FORMAT_R32G32B32A32_FLOAT] = NV30_3D_VTXFMT_TYPE_V32_FLOAT,
+ [PIPE_FORMAT_R16_FLOAT] = NV30_3D_VTXFMT_TYPE_V16_FLOAT,
+ [PIPE_FORMAT_R16G16_FLOAT] = NV30_3D_VTXFMT_TYPE_V16_FLOAT,
+ [PIPE_FORMAT_R16G16B16_FLOAT] = NV30_3D_VTXFMT_TYPE_V16_FLOAT,
+ [PIPE_FORMAT_R16G16B16A16_FLOAT] = NV30_3D_VTXFMT_TYPE_V16_FLOAT,
+ [PIPE_FORMAT_R8_UNORM] = NV30_3D_VTXFMT_TYPE_U8_UNORM,
+ [PIPE_FORMAT_R8G8_UNORM] = NV30_3D_VTXFMT_TYPE_U8_UNORM,
+ [PIPE_FORMAT_R8G8B8_UNORM] = NV30_3D_VTXFMT_TYPE_U8_UNORM,
+ [PIPE_FORMAT_R8G8B8A8_UNORM] = NV30_3D_VTXFMT_TYPE_U8_UNORM,
+ [PIPE_FORMAT_R8G8B8A8_USCALED] = NV30_3D_VTXFMT_TYPE_U8_USCALED,
+ [PIPE_FORMAT_R16_SNORM] = NV30_3D_VTXFMT_TYPE_V16_SNORM,
+ [PIPE_FORMAT_R16G16_SNORM] = NV30_3D_VTXFMT_TYPE_V16_SNORM,
+ [PIPE_FORMAT_R16G16B16_SNORM] = NV30_3D_VTXFMT_TYPE_V16_SNORM,
+ [PIPE_FORMAT_R16G16B16A16_SNORM] = NV30_3D_VTXFMT_TYPE_V16_SNORM,
+ [PIPE_FORMAT_R16_SSCALED] = NV30_3D_VTXFMT_TYPE_V16_SSCALED,
+ [PIPE_FORMAT_R16G16_SSCALED] = NV30_3D_VTXFMT_TYPE_V16_SSCALED,
+ [PIPE_FORMAT_R16G16B16_SSCALED] = NV30_3D_VTXFMT_TYPE_V16_SSCALED,
+ [PIPE_FORMAT_R16G16B16A16_SSCALED] = NV30_3D_VTXFMT_TYPE_V16_SSCALED,
};
static void *
@@ -476,7 +514,7 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe,
if(ve->instance_divisor)
{
struct nvfx_low_frequency_element* lfve;
- cso->vtxfmt[i] = NV34TCL_VTXFMT_TYPE_32_FLOAT;
+ cso->vtxfmt[i] = NV30_3D_VTXFMT_TYPE_V32_FLOAT;
//if(ve->frequency == PIPE_ELEMENT_FREQUENCY_CONSTANT)
if(0)
@@ -511,14 +549,14 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe,
if(type)
{
transkey.element[idx].output_format = ve->src_format;
- cso->vtxfmt[i] = (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type;
+ cso->vtxfmt[i] = (ncomp << NV30_3D_VTXFMT_SIZE__SHIFT) | type;
}
else
{
unsigned float32[4] = {PIPE_FORMAT_R32_FLOAT, PIPE_FORMAT_R32G32_FLOAT, PIPE_FORMAT_R32G32B32_FLOAT, PIPE_FORMAT_R32G32B32A32_FLOAT};
transkey.element[idx].output_format = float32[ncomp - 1];
cso->needs_translate = TRUE;
- cso->vtxfmt[i] = (ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | NV34TCL_VTXFMT_TYPE_32_FLOAT;
+ cso->vtxfmt[i] = (ncomp << NV30_3D_VTXFMT_SIZE__SHIFT) | NV30_3D_VTXFMT_TYPE_V32_FLOAT;
}
transkey.element[idx].output_offset = transkey.output_stride;
transkey.output_stride += (util_format_get_stride(transkey.element[idx].output_format, 1) + 3) & ~3;
@@ -527,7 +565,7 @@ nvfx_vtxelts_state_create(struct pipe_context *pipe,
cso->translate = translate_create(&transkey);
cso->vertex_length = transkey.output_stride >> 2;
- cso->max_vertices_per_packet = 2047 / cso->vertex_length;
+ cso->max_vertices_per_packet = 2047 / MAX2(cso->vertex_length, 1);
return (void *)cso;
}
diff --git a/src/gallium/drivers/nvfx/nvfx_vertprog.c b/src/gallium/drivers/nvfx/nvfx_vertprog.c
index ea7e88c561..23f045ecf6 100644
--- a/src/gallium/drivers/nvfx/nvfx_vertprog.c
+++ b/src/gallium/drivers/nvfx/nvfx_vertprog.c
@@ -8,6 +8,7 @@
#include "tgsi/tgsi_parse.h"
#include "tgsi/tgsi_dump.h"
#include "tgsi/tgsi_util.h"
+#include "tgsi/tgsi_ureg.h"
#include "draw/draw_context.h"
@@ -37,7 +38,9 @@ struct nvfx_loop_entry
struct nvfx_vpc {
struct nvfx_context* nvfx;
+ struct pipe_shader_state pipe;
struct nvfx_vertex_program *vp;
+ struct tgsi_shader_info* info;
struct nvfx_vertex_program_exec *vpi;
@@ -46,6 +49,8 @@ struct nvfx_vpc {
struct nvfx_reg r_result[PIPE_MAX_SHADER_OUTPUTS];
struct nvfx_reg *r_address;
struct nvfx_reg *r_temp;
+ struct nvfx_reg *r_const;
+ struct nvfx_reg r_0_1;
struct nvfx_reg *imm;
unsigned nr_imm;
@@ -105,8 +110,8 @@ constant(struct nvfx_vpc *vpc, int pipe, float x, float y, float z, float w)
return nvfx_reg(NVFXSR_CONST, idx);
}
-#define arith(s,o,d,m,s0,s1,s2) \
- nvfx_insn(0, (NVFX_VP_INST_SLOT_##s << 7) | NVFX_VP_INST_##s##_OP_##o, -1, (d), (m), (s0), (s1), (s2))
+#define arith(s,t,o,d,m,s0,s1,s2) \
+ nvfx_insn((s), (NVFX_VP_INST_SLOT_##t << 7) | NVFX_VP_INST_##t##_OP_##o, -1, (d), (m), (s0), (s1), (s2))
static void
emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos, struct nvfx_src src)
@@ -152,6 +157,18 @@ emit_src(struct nvfx_context* nvfx, struct nvfx_vpc *vpc, uint32_t *hw, int pos,
(src.swz[2] << NVFX_VP(SRC_SWZ_Z_SHIFT)) |
(src.swz[3] << NVFX_VP(SRC_SWZ_W_SHIFT)));
+ if(src.indirect) {
+ if(src.reg.type == NVFXSR_CONST)
+ hw[3] |= NVFX_VP(INST_INDEX_CONST);
+ else if(src.reg.type == NVFXSR_INPUT)
+ hw[0] |= NVFX_VP(INST_INDEX_INPUT);
+ else
+ assert(0);
+ if(src.indirect_reg)
+ hw[0] |= NVFX_VP(INST_ADDR_REG_SELECT_1);
+ hw[0] |= src.indirect_swz << NVFX_VP(INST_ADDR_SWZ_SHIFT);
+ }
+
switch (pos) {
case 0:
hw[1] |= ((sr & NVFX_VP(SRC0_HIGH_MASK)) >>
@@ -279,6 +296,13 @@ nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn)
if(insn.cc_update)
hw[0] |= NVFX_VP(INST_COND_UPDATE_ENABLE);
+ if(insn.sat)
+ {
+ assert(nvfx->use_nv4x);
+ if(nvfx->use_nv4x)
+ hw[0] |= NV40_VP_INST_SATURATE;
+ }
+
if(!nvfx->is_nv4x) {
if(slot == 0)
hw[1] |= (op << NV30_VP_INST_VEC_OPCODE_SHIFT);
@@ -317,6 +341,9 @@ nvfx_vp_emit(struct nvfx_vpc *vpc, struct nvfx_insn insn)
emit_src(nvfx, vpc, hw, 0, insn.src[0]);
emit_src(nvfx, vpc, hw, 1, insn.src[1]);
emit_src(nvfx, vpc, hw, 2, insn.src[2]);
+
+// if(insn.src[0].indirect || op == NVFX_VP_INST_VEC_OP_ARL)
+// hw[3] |= NV40_VP_INST_SCA_RESULT;
}
static inline struct nvfx_src
@@ -328,7 +355,7 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
src.reg = nvfx_reg(NVFXSR_INPUT, fsrc->Register.Index);
break;
case TGSI_FILE_CONSTANT:
- src.reg = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0);
+ src.reg = vpc->r_const[fsrc->Register.Index];
break;
case TGSI_FILE_IMMEDIATE:
src.reg = vpc->imm[fsrc->Register.Index];
@@ -339,7 +366,7 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
default:
NOUVEAU_ERR("bad src file\n");
src.reg.index = 0;
- src.reg.type = 0;
+ src.reg.type = -1;
break;
}
@@ -349,6 +376,22 @@ tgsi_src(struct nvfx_vpc *vpc, const struct tgsi_full_src_register *fsrc) {
src.swz[1] = fsrc->Register.SwizzleY;
src.swz[2] = fsrc->Register.SwizzleZ;
src.swz[3] = fsrc->Register.SwizzleW;
+ src.indirect = 0;
+
+ if(fsrc->Register.Indirect) {
+ if(fsrc->Indirect.File == TGSI_FILE_ADDRESS &&
+ (fsrc->Register.File == TGSI_FILE_CONSTANT || fsrc->Register.File == TGSI_FILE_INPUT))
+ {
+ src.indirect = 1;
+ src.indirect_reg = fsrc->Indirect.Index;
+ src.indirect_swz = fsrc->Indirect.SwizzleX;
+ }
+ else
+ {
+ src.reg.index = 0;
+ src.reg.type = -1;
+ }
+ }
return src;
}
@@ -397,16 +440,16 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
{
struct nvfx_src src[3], tmp;
struct nvfx_reg dst;
+ struct nvfx_reg final_dst;
struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0));
struct nvfx_insn insn;
struct nvfx_relocation reloc;
struct nvfx_loop_entry loop;
+ boolean sat = FALSE;
int mask;
int ai = -1, ci = -1, ii = -1;
int i;
-
- if (finst->Instruction.Opcode == TGSI_OPCODE_END)
- return TRUE;
+ unsigned sub_depth = 0;
for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
const struct tgsi_full_src_register *fsrc;
@@ -429,7 +472,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
}
break;
case TGSI_FILE_CONSTANT:
@@ -439,7 +482,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
}
break;
case TGSI_FILE_IMMEDIATE:
@@ -449,7 +492,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
src[i] = tgsi_src(vpc, fsrc);
} else {
src[i] = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MOV, src[i].reg, NVFX_VP_MASK_ALL, tgsi_src(vpc, fsrc), none, none));
}
break;
case TGSI_FILE_TEMPORARY:
@@ -461,161 +504,178 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
}
}
- dst = tgsi_dst(vpc, &finst->Dst[0]);
+ for (i = 0; i < finst->Instruction.NumSrcRegs; i++) {
+ if(src[i].reg.type < 0)
+ return FALSE;
+ }
+
+ if(finst->Dst[0].Register.File == TGSI_FILE_ADDRESS &&
+ finst->Instruction.Opcode != TGSI_OPCODE_ARL)
+ return FALSE;
+
+ final_dst = dst = tgsi_dst(vpc, &finst->Dst[0]);
mask = tgsi_mask(finst->Dst[0].Register.WriteMask);
+ if(finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE)
+ {
+ assert(finst->Instruction.Opcode != TGSI_OPCODE_ARL);
+ if(nvfx->use_nv4x)
+ sat = TRUE;
+ else if(dst.type != NVFXSR_TEMP)
+ dst = temp(vpc);
+ }
switch (finst->Instruction.Opcode) {
case TGSI_OPCODE_ABS:
- nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, abs(src[0]), none, none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MOV, dst, mask, abs(src[0]), none, none));
break;
case TGSI_OPCODE_ADD:
- nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, src[0], none, src[1]));
+ nvfx_vp_emit(vpc, arith(sat, VEC, ADD, dst, mask, src[0], none, src[1]));
break;
case TGSI_OPCODE_ARL:
- nvfx_vp_emit(vpc, arith(VEC, ARL, dst, mask, src[0], none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, ARL, dst, mask, src[0], none, none));
break;
case TGSI_OPCODE_CMP:
- insn = arith(VEC, MOV, none.reg, mask, src[0], none, none);
+ insn = arith(0, VEC, MOV, none.reg, mask, src[0], none, none);
insn.cc_update = 1;
nvfx_vp_emit(vpc, insn);
- insn = arith(VEC, MOV, dst, mask, src[2], none, none);
+ insn = arith(sat, VEC, MOV, dst, mask, src[2], none, none);
insn.cc_test = NVFX_COND_GE;
nvfx_vp_emit(vpc, insn);
- insn = arith(VEC, MOV, dst, mask, src[1], none, none);
+ insn = arith(sat, VEC, MOV, dst, mask, src[1], none, none);
insn.cc_test = NVFX_COND_LT;
nvfx_vp_emit(vpc, insn);
break;
case TGSI_OPCODE_COS:
- nvfx_vp_emit(vpc, arith(SCA, COS, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, COS, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_DP2:
tmp = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, NVFX_VP_MASK_X | NVFX_VP_MASK_Y, src[0], src[1], none));
- nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, swz(tmp, X, X, X, X), swz(tmp, Y, Y, Y, Y), none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MUL, tmp.reg, NVFX_VP_MASK_X | NVFX_VP_MASK_Y, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, ADD, dst, mask, swz(tmp, X, X, X, X), none, swz(tmp, Y, Y, Y, Y)));
break;
case TGSI_OPCODE_DP3:
- nvfx_vp_emit(vpc, arith(VEC, DP3, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, DP3, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_DP4:
- nvfx_vp_emit(vpc, arith(VEC, DP4, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, DP4, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_DPH:
- nvfx_vp_emit(vpc, arith(VEC, DPH, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, DPH, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_DST:
- nvfx_vp_emit(vpc, arith(VEC, DST, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, DST, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_EX2:
- nvfx_vp_emit(vpc, arith(SCA, EX2, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, EX2, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_EXP:
- nvfx_vp_emit(vpc, arith(SCA, EXP, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, EXP, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_FLR:
- nvfx_vp_emit(vpc, arith(VEC, FLR, dst, mask, src[0], none, none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, FLR, dst, mask, src[0], none, none));
break;
case TGSI_OPCODE_FRC:
- nvfx_vp_emit(vpc, arith(VEC, FRC, dst, mask, src[0], none, none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, FRC, dst, mask, src[0], none, none));
break;
case TGSI_OPCODE_LG2:
- nvfx_vp_emit(vpc, arith(SCA, LG2, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, LG2, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_LIT:
- nvfx_vp_emit(vpc, arith(SCA, LIT, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, LIT, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_LOG:
- nvfx_vp_emit(vpc, arith(SCA, LOG, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, LOG, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_LRP:
tmp = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MAD, tmp.reg, mask, neg(src[0]), src[2], src[2]));
- nvfx_vp_emit(vpc, arith(VEC, MAD, dst, mask, src[0], src[1], tmp));
+ nvfx_vp_emit(vpc, arith(0, VEC, MAD, tmp.reg, mask, neg(src[0]), src[2], src[2]));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MAD, dst, mask, src[0], src[1], tmp));
break;
case TGSI_OPCODE_MAD:
- nvfx_vp_emit(vpc, arith(VEC, MAD, dst, mask, src[0], src[1], src[2]));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MAD, dst, mask, src[0], src[1], src[2]));
break;
case TGSI_OPCODE_MAX:
- nvfx_vp_emit(vpc, arith(VEC, MAX, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MAX, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_MIN:
- nvfx_vp_emit(vpc, arith(VEC, MIN, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MIN, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_MOV:
- nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, src[0], none, none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MOV, dst, mask, src[0], none, none));
break;
case TGSI_OPCODE_MUL:
- nvfx_vp_emit(vpc, arith(VEC, MUL, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MUL, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_NOP:
break;
case TGSI_OPCODE_POW:
tmp = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(SCA, LG2, tmp.reg, NVFX_VP_MASK_X, none, none, swz(src[0], X, X, X, X)));
- nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, NVFX_VP_MASK_X, swz(tmp, X, X, X, X), swz(src[1], X, X, X, X), none));
- nvfx_vp_emit(vpc, arith(SCA, EX2, dst, mask, none, none, swz(tmp, X, X, X, X)));
+ nvfx_vp_emit(vpc, arith(0, SCA, LG2, tmp.reg, NVFX_VP_MASK_X, none, none, swz(src[0], X, X, X, X)));
+ nvfx_vp_emit(vpc, arith(0, VEC, MUL, tmp.reg, NVFX_VP_MASK_X, swz(tmp, X, X, X, X), swz(src[1], X, X, X, X), none));
+ nvfx_vp_emit(vpc, arith(sat, SCA, EX2, dst, mask, none, none, swz(tmp, X, X, X, X)));
break;
case TGSI_OPCODE_RCP:
- nvfx_vp_emit(vpc, arith(SCA, RCP, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, RCP, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_RSQ:
- nvfx_vp_emit(vpc, arith(SCA, RSQ, dst, mask, none, none, abs(src[0])));
+ nvfx_vp_emit(vpc, arith(sat, SCA, RSQ, dst, mask, none, none, abs(src[0])));
break;
case TGSI_OPCODE_SEQ:
- nvfx_vp_emit(vpc, arith(VEC, SEQ, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SEQ, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SFL:
- nvfx_vp_emit(vpc, arith(VEC, SFL, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SFL, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SGE:
- nvfx_vp_emit(vpc, arith(VEC, SGE, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SGE, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SGT:
- nvfx_vp_emit(vpc, arith(VEC, SGT, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SGT, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SIN:
- nvfx_vp_emit(vpc, arith(SCA, SIN, dst, mask, none, none, src[0]));
+ nvfx_vp_emit(vpc, arith(sat, SCA, SIN, dst, mask, none, none, src[0]));
break;
case TGSI_OPCODE_SLE:
- nvfx_vp_emit(vpc, arith(VEC, SLE, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SLE, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SLT:
- nvfx_vp_emit(vpc, arith(VEC, SLT, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SLT, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SNE:
- nvfx_vp_emit(vpc, arith(VEC, SNE, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SNE, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SSG:
- nvfx_vp_emit(vpc, arith(VEC, SSG, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, SSG, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_STR:
- nvfx_vp_emit(vpc, arith(VEC, STR, dst, mask, src[0], src[1], none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, STR, dst, mask, src[0], src[1], none));
break;
case TGSI_OPCODE_SUB:
- nvfx_vp_emit(vpc, arith(VEC, ADD, dst, mask, src[0], none, neg(src[1])));
+ nvfx_vp_emit(vpc, arith(sat, VEC, ADD, dst, mask, src[0], none, neg(src[1])));
break;
case TGSI_OPCODE_TRUNC:
tmp = nvfx_src(temp(vpc));
- insn = arith(VEC, MOV, none.reg, mask, src[0], none, none);
+ insn = arith(0, VEC, MOV, none.reg, mask, src[0], none, none);
insn.cc_update = 1;
nvfx_vp_emit(vpc, insn);
- nvfx_vp_emit(vpc, arith(VEC, FLR, tmp.reg, mask, abs(src[0]), none, none));
- nvfx_vp_emit(vpc, arith(VEC, MOV, dst, mask, tmp, none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, FLR, tmp.reg, mask, abs(src[0]), none, none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MOV, dst, mask, tmp, none, none));
- insn = arith(VEC, MOV, dst, mask, neg(tmp), none, none);
+ insn = arith(sat, VEC, MOV, dst, mask, neg(tmp), none, none);
insn.cc_test = NVFX_COND_LT;
nvfx_vp_emit(vpc, insn);
break;
case TGSI_OPCODE_XPD:
tmp = nvfx_src(temp(vpc));
- nvfx_vp_emit(vpc, arith(VEC, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none));
- nvfx_vp_emit(vpc, arith(VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp)));
+ nvfx_vp_emit(vpc, arith(0, VEC, MUL, tmp.reg, mask, swz(src[0], Z, X, Y, Y), swz(src[1], Y, Z, X, X), none));
+ nvfx_vp_emit(vpc, arith(sat, VEC, MAD, dst, (mask & ~NVFX_VP_MASK_W), swz(src[0], Y, Z, X, X), swz(src[1], Z, X, Y, Y), neg(tmp)));
break;
case TGSI_OPCODE_IF:
- insn = arith(VEC, MOV, none.reg, NVFX_VP_MASK_X, src[0], none, none);
+ insn = arith(0, VEC, MOV, none.reg, NVFX_VP_MASK_X, src[0], none, none);
insn.cc_update = 1;
nvfx_vp_emit(vpc, insn);
@@ -623,7 +683,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
reloc.target = finst->Label.Label + 1;
util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
- insn = arith(SCA, BRA, none.reg, 0, none, none, none);
+ insn = arith(0, SCA, BRA, none.reg, 0, none, none, none);
insn.cc_test = NVFX_COND_EQ;
insn.cc_swz[0] = insn.cc_swz[1] = insn.cc_swz[2] = insn.cc_swz[3] = 0;
nvfx_vp_emit(vpc, insn);
@@ -637,20 +697,31 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
if(finst->Instruction.Opcode == TGSI_OPCODE_CAL)
- insn = arith(SCA, CAL, none.reg, 0, none, none, none);
+ insn = arith(0, SCA, CAL, none.reg, 0, none, none, none);
else
- insn = arith(SCA, BRA, none.reg, 0, none, none, none);
+ insn = arith(0, SCA, BRA, none.reg, 0, none, none, none);
nvfx_vp_emit(vpc, insn);
break;
case TGSI_OPCODE_RET:
- tmp = none;
- tmp.swz[0] = tmp.swz[1] = tmp.swz[2] = tmp.swz[3] = 0;
- nvfx_vp_emit(vpc, arith(SCA, RET, none.reg, 0, none, none, tmp));
+ if(sub_depth || !nvfx->use_vp_clipping) {
+ tmp = none;
+ tmp.swz[0] = tmp.swz[1] = tmp.swz[2] = tmp.swz[3] = 0;
+ nvfx_vp_emit(vpc, arith(0, SCA, RET, none.reg, 0, none, none, tmp));
+ } else {
+ reloc.location = vpc->vp->nr_insns;
+ reloc.target = vpc->info->num_instructions;
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
+ nvfx_vp_emit(vpc, arith(0, SCA, BRA, none.reg, 0, none, none, none));
+ }
break;
case TGSI_OPCODE_BGNSUB:
+ ++sub_depth;
+ break;
case TGSI_OPCODE_ENDSUB:
+ --sub_depth;
+ break;
case TGSI_OPCODE_ENDIF:
/* nothing to do here */
break;
@@ -668,7 +739,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
reloc.target = loop.cont_target;
util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
- nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
+ nvfx_vp_emit(vpc, arith(0, SCA, BRA, none.reg, 0, none, none, none));
break;
case TGSI_OPCODE_CONT:
@@ -678,7 +749,7 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
reloc.target = loop.cont_target;
util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
- nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
+ nvfx_vp_emit(vpc, arith(0, SCA, BRA, none.reg, 0, none, none, none));
break;
case TGSI_OPCODE_BRK:
@@ -688,7 +759,24 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
reloc.target = loop.brk_target;
util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
- nvfx_vp_emit(vpc, arith(SCA, BRA, none.reg, 0, none, none, none));
+ nvfx_vp_emit(vpc, arith(0, SCA, BRA, none.reg, 0, none, none, none));
+ break;
+
+ case TGSI_OPCODE_END:
+ assert(!sub_depth);
+ if(nvfx->use_vp_clipping) {
+ if(idx != (vpc->info->num_instructions - 1)) {
+ reloc.location = vpc->vp->nr_insns;
+ reloc.target = vpc->info->num_instructions;
+ util_dynarray_append(&vpc->label_relocs, struct nvfx_relocation, reloc);
+ nvfx_vp_emit(vpc, arith(0, SCA, BRA, none.reg, 0, none, none, none));
+ }
+ } else {
+ if(vpc->vp->nr_insns)
+ vpc->vp->insns[vpc->vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
+ nvfx_vp_emit(vpc, arith(0, VEC, NOP, none.reg, 0, none, none, none));
+ vpc->vp->insns[vpc->vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
+ }
break;
default:
@@ -696,6 +784,14 @@ nvfx_vertprog_parse_instruction(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
return FALSE;
}
+ if(finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE && !nvfx->use_nv4x)
+ {
+ if(!vpc->r_0_1.type)
+ vpc->r_0_1 = constant(vpc, -1, 0, 1, 0, 0);
+ nvfx_vp_emit(vpc, arith(0, VEC, MAX, dst, mask, nvfx_src(dst), swz(nvfx_src(vpc->r_0_1), X, X, X, X), none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MIN, final_dst, mask, nvfx_src(dst), swz(nvfx_src(vpc->r_0_1), Y, Y, Y, Y), none));
+ }
+
release_temps(vpc);
return TRUE;
}
@@ -741,8 +837,13 @@ nvfx_vertprog_parse_decl_output(struct nvfx_context* nvfx, struct nvfx_vpc *vpc,
hw = NVFX_VP(INST_DEST_PSZ);
break;
case TGSI_SEMANTIC_GENERIC:
- hw = (vpc->vp->generic_to_fp_input[fdec->Semantic.Index] & 0xf)
- + NVFX_VP(INST_DEST_TC(0)) - NVFX_FP_OP_INPUT_SRC_TC(0);
+ hw = (vpc->vp->generic_to_fp_input[fdec->Semantic.Index] & 0xf) - NVFX_FP_OP_INPUT_SRC_TC(0);
+ if(hw <= 8)
+ hw = NVFX_VP(INST_DEST_TC(hw));
+ else if(hw == 9) /* TODO: this is correct, but how does this overlapping work exactly? */
+ hw = NV40_VP_INST_DEST_PSZ;
+ else
+ assert(0);
break;
case TGSI_SEMANTIC_EDGEFLAG:
/* not really an error just a fallback */
@@ -761,22 +862,23 @@ static boolean
nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
{
struct tgsi_parse_context p;
- int high_temp = -1, high_addr = -1, nr_imm = 0, i;
+ int high_const = -1, high_temp = -1, high_addr = -1, nr_imm = 0, i;
struct util_semantic_set set;
- unsigned char sem_layout[8];
+ unsigned char sem_layout[10];
unsigned num_outputs;
+ unsigned num_texcoords = nvfx->is_nv4x ? 10 : 8;
- num_outputs = util_semantic_set_from_program_file(&set, vpc->vp->pipe.tokens, TGSI_FILE_OUTPUT);
+ num_outputs = util_semantic_set_from_program_file(&set, vpc->pipe.tokens, TGSI_FILE_OUTPUT);
- if(num_outputs > 8) {
+ if(num_outputs > num_texcoords) {
NOUVEAU_ERR("too many vertex program outputs: %i\n", num_outputs);
return FALSE;
}
- util_semantic_layout_from_set(sem_layout, &set, 8, 8);
+ util_semantic_layout_from_set(sem_layout, &set, num_texcoords, num_texcoords);
/* hope 0xf is (0, 0, 0, 1) initialized; otherwise, we are _probably_ not required to do this */
memset(vpc->vp->generic_to_fp_input, 0x0f, sizeof(vpc->vp->generic_to_fp_input));
- for(int i = 0; i < 8; ++i) {
+ for(int i = 0; i < num_texcoords; ++i) {
if(sem_layout[i] == 0xff)
continue;
//printf("vp: GENERIC[%i] to fpreg %i\n", sem_layout[i], NVFX_FP_OP_INPUT_SRC_TC(0) + i);
@@ -784,7 +886,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
}
vpc->vp->sprite_fp_input = -1;
- for(int i = 0; i < 8; ++i)
+ for(int i = 0; i < num_texcoords; ++i)
{
if(sem_layout[i] == 0xff)
{
@@ -793,7 +895,7 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
}
}
- tgsi_parse_init(&p, vpc->vp->pipe.tokens);
+ tgsi_parse_init(&p, vpc->pipe.tokens);
while (!tgsi_parse_end_of_tokens(&p)) {
const union tgsi_full_token *tok = &p.FullToken;
@@ -814,14 +916,18 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
fdec->Range.Last;
}
break;
-#if 0 /* this would be nice.. except gallium doesn't track it */
case TGSI_FILE_ADDRESS:
if (fdec->Range.Last > high_addr) {
high_addr =
fdec->Range.Last;
}
break;
-#endif
+ case TGSI_FILE_CONSTANT:
+ if (fdec->Range.Last > high_const) {
+ high_const =
+ fdec->Range.Last;
+ }
+ break;
case TGSI_FILE_OUTPUT:
if (!nvfx_vertprog_parse_decl_output(nvfx, vpc, fdec))
return FALSE;
@@ -831,23 +937,6 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
}
}
break;
-#if 1 /* yay, parse instructions looking for address regs instead */
- case TGSI_TOKEN_TYPE_INSTRUCTION:
- {
- const struct tgsi_full_instruction *finst;
- const struct tgsi_full_dst_register *fdst;
-
- finst = &p.FullToken.FullInstruction;
- fdst = &finst->Dst[0];
-
- if (fdst->Register.File == TGSI_FILE_ADDRESS) {
- if (fdst->Register.Index > high_addr)
- high_addr = fdst->Register.Index;
- }
-
- }
- break;
-#endif
default:
break;
}
@@ -868,7 +957,13 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
if (++high_addr) {
vpc->r_address = CALLOC(high_addr, sizeof(struct nvfx_reg));
for (i = 0; i < high_addr; i++)
- vpc->r_address[i] = temp(vpc);
+ vpc->r_address[i] = nvfx_reg(NVFXSR_TEMP, i);
+ }
+
+ if(++high_const) {
+ vpc->r_const = CALLOC(high_const, sizeof(struct nvfx_reg));
+ for (i = 0; i < high_const; i++)
+ vpc->r_const[i] = constant(vpc, i, 0, 0, 0, 0);
}
vpc->r_temps_discard = 0;
@@ -877,21 +972,36 @@ nvfx_vertprog_prepare(struct nvfx_context* nvfx, struct nvfx_vpc *vpc)
DEBUG_GET_ONCE_BOOL_OPTION(nvfx_dump_vp, "NVFX_DUMP_VP", FALSE)
-static void
-nvfx_vertprog_translate(struct nvfx_context *nvfx,
- struct nvfx_vertex_program *vp)
+static struct nvfx_vertex_program*
+nvfx_vertprog_translate(struct nvfx_context *nvfx, const struct pipe_shader_state* vps, const struct tgsi_shader_info* info)
{
struct tgsi_parse_context parse;
+ struct nvfx_vertex_program* vp = NULL;
struct nvfx_vpc *vpc = NULL;
struct nvfx_src none = nvfx_src(nvfx_reg(NVFXSR_NONE, 0));
struct util_dynarray insns;
int i;
- vpc = CALLOC(1, sizeof(struct nvfx_vpc));
+ tgsi_parse_init(&parse, vps->tokens);
+
+ vp = CALLOC_STRUCT(nvfx_vertex_program);
+ if(!vp)
+ goto out_err;
+
+ vpc = CALLOC_STRUCT(nvfx_vpc);
if (!vpc)
- return;
+ goto out_err;
+
vpc->nvfx = nvfx;
vpc->vp = vp;
+ vpc->pipe = *vps;
+ vpc->info = info;
+
+ {
+ // TODO: use a 64-bit atomic here!
+ static unsigned long long id = 0;
+ vp->id = ++id;
+ }
/* reserve space for ucps */
if(nvfx->use_vp_clipping)
@@ -902,7 +1012,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
if (!nvfx_vertprog_prepare(nvfx, vpc)) {
FREE(vpc);
- return;
+ return NULL;
}
/* Redirect post-transform vertex position to a temp if user clip
@@ -915,8 +1025,6 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
vpc->r_temps_discard = 0;
}
- tgsi_parse_init(&parse, vp->pipe.tokens);
-
util_dynarray_init(&insns);
while (!tgsi_parse_end_of_tokens(&parse)) {
tgsi_parse_token(&parse);
@@ -977,7 +1085,7 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
NVFX_VP(INST_DEST_POS));
struct nvfx_src htmp = nvfx_src(vpc->r_result[vpc->hpos_idx]);
- nvfx_vp_emit(vpc, arith(VEC, MOV, hpos, NVFX_VP_MASK_ALL, htmp, none, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, MOV, hpos, NVFX_VP_MASK_ALL, htmp, none, none));
}
/* Insert code to handle user clip planes */
@@ -1003,22 +1111,14 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
else
mask = NVFX_VP_MASK_X;
- nvfx_vp_emit(vpc, arith(VEC, DP4, cdst, mask, htmp, ceqn, none));
+ nvfx_vp_emit(vpc, arith(0, VEC, DP4, cdst, mask, htmp, ceqn, none));
}
}
- else
- {
- if(vp->nr_insns)
- vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
-
- nvfx_vp_emit(vpc, arith(VEC, NOP, none.reg, 0, none, none, none));
- vp->insns[vp->nr_insns - 1].data[3] |= NVFX_VP_INST_LAST;
- }
if(debug_get_option_nvfx_dump_vp())
{
debug_printf("\n");
- tgsi_dump(vp->pipe.tokens, 0);
+ tgsi_dump(vpc->pipe.tokens, 0);
debug_printf("\n%s vertex program:\n", nvfx->is_nv4x ? "nv4x" : "nv3x");
for (i = 0; i < vp->nr_insns; i++)
@@ -1028,18 +1128,51 @@ nvfx_vertprog_translate(struct nvfx_context *nvfx,
vp->clip_nr = -1;
vp->exec_start = -1;
- vp->translated = TRUE;
-out_err:
+
+out:
tgsi_parse_free(&parse);
- util_dynarray_fini(&vpc->label_relocs);
- util_dynarray_fini(&vpc->loop_stack);
- if (vpc->r_temp)
+ if(vpc) {
+ util_dynarray_fini(&vpc->label_relocs);
+ util_dynarray_fini(&vpc->loop_stack);
FREE(vpc->r_temp);
- if (vpc->r_address)
FREE(vpc->r_address);
- if (vpc->imm)
+ FREE(vpc->r_const);
FREE(vpc->imm);
- FREE(vpc);
+ FREE(vpc);
+ }
+ return vp;
+
+out_err:
+ FREE(vp);
+ vp = NULL;
+ goto out;
+}
+
+static struct nvfx_vertex_program*
+nvfx_vertprog_translate_draw_vp(struct nvfx_context *nvfx, struct nvfx_pipe_vertex_program* pvp)
+{
+ struct nvfx_vertex_program* vp = NULL;
+ struct pipe_shader_state vps;
+ struct tgsi_shader_info info;
+ struct ureg_program *ureg = NULL;
+ unsigned num_outputs = MIN2(pvp->info.num_outputs, 16);
+
+ ureg = ureg_create( TGSI_PROCESSOR_VERTEX );
+ if(ureg == NULL)
+ return 0;
+
+ for (unsigned i = 0; i < num_outputs; i++)
+ ureg_MOV(ureg, ureg_DECL_output(ureg, pvp->info.output_semantic_name[i], pvp->info.output_semantic_index[i]), ureg_DECL_vs_input(ureg, i));
+
+ ureg_END( ureg );
+
+ vps.tokens = ureg_get_tokens(ureg, 0);
+ tgsi_scan_shader(vps.tokens, &info);
+ vp = nvfx_vertprog_translate(nvfx, &vps, &info);
+ ureg_free_tokens(vps.tokens);
+ ureg_destroy(ureg);
+
+ return vp;
}
boolean
@@ -1047,31 +1180,44 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
{
struct nvfx_screen *screen = nvfx->screen;
struct nouveau_channel *chan = screen->base.channel;
- struct nouveau_grobj *eng3d = screen->eng3d;
- struct nvfx_vertex_program *vp;
+ struct nvfx_pipe_vertex_program *pvp = nvfx->vertprog;
+ struct nvfx_vertex_program* vp;
struct pipe_resource *constbuf;
boolean upload_code = FALSE, upload_data = FALSE;
int i;
if (nvfx->render_mode == HW) {
- vp = nvfx->vertprog;
- constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX];
- } else {
- vp = nvfx->swtnl.vertprog;
- constbuf = NULL;
- }
-
- /* Translate TGSI shader into hw bytecode */
- if (!vp->translated)
- {
nvfx->fallback_swtnl &= ~NVFX_NEW_VERTPROG;
- nvfx_vertprog_translate(nvfx, vp);
- if (!vp->translated) {
+ vp = pvp->vp;
+
+ if(!vp) {
+ vp = nvfx_vertprog_translate(nvfx, &pvp->pipe, &pvp->info);
+ if(!vp)
+ vp = NVFX_VP_FAILED;
+ pvp->vp = vp;
+ }
+
+ if(vp == NVFX_VP_FAILED) {
nvfx->fallback_swtnl |= NVFX_NEW_VERTPROG;
return FALSE;
}
+
+ constbuf = nvfx->constbuf[PIPE_SHADER_VERTEX];
+ } else {
+ vp = pvp->draw_vp;
+ if(!vp)
+ {
+ pvp->draw_vp = vp = nvfx_vertprog_translate_draw_vp(nvfx, pvp);
+ if(!vp) {
+ _debug_printf("Error: unable to create a swtnl passthrough vertex shader: aborting.");
+ abort();
+ }
+ }
+ constbuf = NULL;
}
+ nvfx->hw_vertprog = vp;
+
/* Allocate hw vtxprog exec slots */
if (!vp->exec) {
struct nouveau_resource *heap = nvfx->screen->vp_exec_heap;
@@ -1116,6 +1262,8 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
}
}
+ //printf("start at %u nc %u\n", vp->data->start, vp->nr_consts);
+
/*XXX: handle this some day */
assert(vp->data->start >= vp->data_start_min);
@@ -1161,6 +1309,8 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
struct nvfx_relocation* reloc = (struct nvfx_relocation*)((char*)vp->const_relocs.data + i);
struct nvfx_vertex_program_exec *vpi = &vp->insns[reloc->location];
+ //printf("reloc %i to %i + %i\n", reloc->location, vp->data->start, reloc->target);
+
vpi->data[1] &= ~NVFX_VP(INST_CONST_SRC_MASK);
vpi->data[1] |=
(reloc->target + vp->data->start) <<
@@ -1178,6 +1328,18 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
if (constbuf)
map = (float*)nvfx_buffer(constbuf)->data;
+ /*
+ * WAIT_RING(chan, 512 * 6);
+ for (i = 0; i < 512; i++) {
+ float v[4] = {0.1, 0,2, 0.3, 0.4};
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+ OUT_RING(chan, i);
+ OUT_RINGp(chan, (uint32_t *)v, 4);
+ printf("frob %i\n", i);
+ }
+ */
+
+ WAIT_RING(chan, 6 * vp->nr_consts);
for (i = nvfx->use_vp_clipping ? 6 : 0; i < vp->nr_consts; i++) {
struct nvfx_vertex_program_data *vpd = &vp->consts[i];
@@ -1190,19 +1352,23 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
4 * sizeof(float));
}
- BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_CONST_ID, 5);
- OUT_RING (chan, i + vp->data->start);
- OUT_RINGp (chan, (uint32_t *)vpd->value, 4);
+ //printf("upload into %i + %i: %f %f %f %f\n", vp->data->start, i, vpd->value[0], vpd->value[1], vpd->value[2], vpd->value[3]);
+
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_CONST_ID, 5));
+ OUT_RING(chan, i + vp->data->start);
+ OUT_RINGp(chan, (uint32_t *)vpd->value, 4);
}
}
/* Upload vtxprog */
if (upload_code) {
- BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_FROM_ID, 1);
- OUT_RING (chan, vp->exec->start);
+ WAIT_RING(chan, 2 + 5 * vp->nr_insns);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_FROM_ID, 1));
+ OUT_RING(chan, vp->exec->start);
for (i = 0; i < vp->nr_insns; i++) {
- BEGIN_RING(chan, eng3d, NV34TCL_VP_UPLOAD_INST(0), 4);
- OUT_RINGp (chan, vp->insns[i].data, 4);
+ OUT_RING(chan, RING_3D(NV30_3D_VP_UPLOAD_INST(0), 4));
+ //printf("%08x %08x %08x %08x\n", vp->insns[i].data[0], vp->insns[i].data[1], vp->insns[i].data[2], vp->insns[i].data[3]);
+ OUT_RINGp(chan, vp->insns[i].data, 4);
}
vp->clip_nr = -1;
}
@@ -1210,10 +1376,10 @@ nvfx_vertprog_validate(struct nvfx_context *nvfx)
if(nvfx->dirty & (NVFX_NEW_VERTPROG))
{
WAIT_RING(chan, 6);
- OUT_RING(chan, RING_3D(NV34TCL_VP_START_FROM_ID, 1));
+ OUT_RING(chan, RING_3D(NV30_3D_VP_START_FROM_ID, 1));
OUT_RING(chan, vp->exec->start);
if(nvfx->is_nv4x) {
- OUT_RING(chan, RING_3D(NV40TCL_VP_ATTRIB_EN, 1));
+ OUT_RING(chan, RING_3D(NV40_3D_VP_ATTRIB_EN, 1));
OUT_RING(chan, vp->ir);
}
}
@@ -1235,24 +1401,21 @@ nvfx_vertprog_destroy(struct nvfx_context *nvfx, struct nvfx_vertex_program *vp)
util_dynarray_fini(&vp->branch_relocs);
util_dynarray_fini(&vp->const_relocs);
+ FREE(vp);
}
static void *
-nvfx_vp_state_create(struct pipe_context *pipe,
- const struct pipe_shader_state *cso)
+nvfx_vp_state_create(struct pipe_context *pipe, const struct pipe_shader_state *cso)
{
- struct nvfx_context *nvfx = nvfx_context(pipe);
- struct nvfx_vertex_program *vp;
+ struct nvfx_pipe_vertex_program *pvp;
- // TODO: use a 64-bit atomic here!
- static unsigned long long id = 0;
+ pvp = CALLOC(1, sizeof(struct nvfx_pipe_vertex_program));
+ pvp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
+ tgsi_scan_shader(pvp->pipe.tokens, &pvp->info);
+ pvp->draw_elements = MAX2(1, MIN2(pvp->info.num_outputs, 16));
+ pvp->draw_no_elements = pvp->info.num_outputs == 0;
- vp = CALLOC(1, sizeof(struct nvfx_vertex_program));
- vp->pipe.tokens = tgsi_dup_tokens(cso->tokens);
- vp->draw = draw_create_vertex_shader(nvfx->draw, &vp->pipe);
- vp->id = ++id;
-
- return (void *)vp;
+ return (void *)pvp;
}
static void
@@ -1268,13 +1431,17 @@ nvfx_vp_state_bind(struct pipe_context *pipe, void *hwcso)
static void
nvfx_vp_state_delete(struct pipe_context *pipe, void *hwcso)
{
- struct nvfx_context *nvfx = nvfx_context(pipe);
- struct nvfx_vertex_program *vp = hwcso;
-
- draw_delete_vertex_shader(nvfx->draw, vp->draw);
- nvfx_vertprog_destroy(nvfx, vp);
- FREE((void*)vp->pipe.tokens);
- FREE(vp);
+ struct nvfx_context *nvfx = nvfx_context(pipe);
+ struct nvfx_pipe_vertex_program *pvp = hwcso;
+
+ if(pvp->draw_vs)
+ draw_delete_vertex_shader(nvfx->draw, pvp->draw_vs);
+ if(pvp->vp && pvp->vp != NVFX_VP_FAILED)
+ nvfx_vertprog_destroy(nvfx, pvp->vp);
+ if(pvp->draw_vp)
+ nvfx_vertprog_destroy(nvfx, pvp->draw_vp);
+ FREE((void*)pvp->pipe.tokens);
+ FREE(pvp);
}
void
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 47ffc0cb3c..91a374a583 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -263,10 +263,6 @@ static void r300_clear(struct pipe_context* pipe,
zstex->hiz_in_use[fb->zsbuf->level])) {
r300->hyperz_state.dirty = TRUE;
}
-
- /* XXX this flush "fixes" a hardlock in the cubestorm xscreensaver */
- if (r300->flush_counter == 0)
- pipe->flush(pipe, 0, NULL);
}
/* Clear a region of a color surface to a constant value. */
@@ -391,9 +387,6 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
r300_flush_depth_stencil(pipe, src, subsrc, srcz);
}
if (old_format != new_format) {
- dst->format = new_format;
- src->format = new_format;
-
r300_texture_reinterpret_format(pipe->screen,
dst, new_format);
r300_texture_reinterpret_format(pipe->screen,
@@ -404,9 +397,6 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
src, subsrc, srcx, srcy, srcz, width, height);
if (old_format != new_format) {
- dst->format = old_format;
- src->format = old_format;
-
r300_texture_reinterpret_format(pipe->screen,
dst, old_format);
r300_texture_reinterpret_format(pipe->screen,
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 8f0e86fd37..8eddf72b70 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -447,9 +447,17 @@ struct r300_context {
struct r300_winsys_cs *cs;
/* Screen. */
struct r300_screen *screen;
+
/* Draw module. Used mostly for SW TCL. */
struct draw_context* draw;
+ /* Vertex buffer for SW TCL. */
+ struct pipe_resource* vbo;
+ /* Offset and size into the SW TCL VBO. */
+ size_t draw_vbo_offset;
size_t draw_vbo_size;
+ /* Whether the VBO must not be flushed. */
+ boolean draw_vbo_locked;
+
/* Accelerated blit support. */
struct blitter_context* blitter;
/* Stencil two-sided reference value fallback. */
@@ -457,14 +465,10 @@ struct r300_context {
/* For translating vertex buffers having incompatible vertex layout. */
struct r300_translate_context tran;
- /* Vertex buffer for rendering. */
- struct pipe_resource* vbo;
/* The KIL opcode needs the first texture unit to be enabled
* on r3xx-r4xx. In order to calm down the CS checker, we bind this
* dummy texture there. */
struct r300_sampler_view *texkill_sampler;
- /* Offset into the VBO. */
- size_t vbo_offset;
/* The currently active query. */
struct r300_query *query_current;
diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c
index c3e157e99a..145a7985da 100644
--- a/src/gallium/drivers/r300/r300_debug.c
+++ b/src/gallium/drivers/r300/r300_debug.c
@@ -27,24 +27,27 @@
#include <stdio.h>
static const struct debug_named_value debug_options[] = {
- { "fp", DBG_FP, "Fragment program handling (for debugging)" },
- { "vp", DBG_VP, "Vertex program handling (for debugging)" },
- { "draw", DBG_DRAW, "Draw calls (for debugging)" },
- { "swtcl", DBG_SWTCL, "SWTCL-specific info (for debugging)" },
- { "rsblock", DBG_RS_BLOCK, "Rasterizer registers (for debugging)" },
- { "psc", DBG_PSC, "Vertex stream registers (for debugging)" },
- { "tex", DBG_TEX, "Textures (for debugging)" },
- { "texalloc", DBG_TEXALLOC, "Texture allocation (for debugging)" },
- { "fall", DBG_FALL, "Fallbacks (for debugging)" },
- { "rs", DBG_RS, "Rasterizer (for debugging)" },
- { "fb", DBG_FB, "Framebuffer (for debugging)" },
- { "cbzb", DBG_CBZB, "Fast color clear info (for debugging)" },
- { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries (for debugging)" },
- { "anisohq", DBG_ANISOHQ, "High quality anisotropic filtering (for benchmarking)" },
- { "notiling", DBG_NO_TILING, "Disable tiling (for benchmarking)" },
- { "noimmd", DBG_NO_IMMD, "Disable immediate mode (for benchmarking)" },
- { "stats", DBG_STATS, "Gather statistics" },
- { "hyperz", DBG_HYPERZ, "HyperZ (for debugging)" },
+ { "fp", DBG_FP, "Log fragment program compilation" },
+ { "vp", DBG_VP, "Log vertex program compilation" },
+ { "draw", DBG_DRAW, "Log draw calls" },
+ { "swtcl", DBG_SWTCL, "Log SWTCL-specific info" },
+ { "rsblock", DBG_RS_BLOCK, "Log rasterizer registers" },
+ { "psc", DBG_PSC, "Log vertex stream registers" },
+ { "tex", DBG_TEX, "Log basic info about textures" },
+ { "texalloc", DBG_TEXALLOC, "Log texture mipmap tree info" },
+ { "fall", DBG_FALL, "Log fallbacks" },
+ { "rs", DBG_RS, "Log rasterizer" },
+ { "fb", DBG_FB, "Log framebuffer" },
+ { "cbzb", DBG_CBZB, "Log fast color clear info" },
+ { "stats", DBG_STATS, "Log emission statistics" },
+ { "hyperz", DBG_HYPERZ, "Log HyperZ info" },
+ { "scissor", DBG_SCISSOR, "Log scissor info" },
+ { "fakeocc", DBG_FAKE_OCC, "Use fake occlusion queries" },
+ { "anisohq", DBG_ANISOHQ, "Use high quality anisotropic filtering" },
+ { "notiling", DBG_NO_TILING, "Disable tiling" },
+ { "noimmd", DBG_NO_IMMD, "Disable immediate mode" },
+ { "noopt", DBG_NO_OPT, "Disable shader optimizations" },
+ { "nocbzb", DBG_NO_CBZB, "Disable fast color clear" },
/* must be last */
DEBUG_NAMED_VALUE_END
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 232259e21d..b2b34c3efc 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -300,6 +300,10 @@ void r300_emit_gpu_flush(struct r300_context *r300, unsigned size, void *state)
width = surf->cbzb_width;
}
+ DBG(r300, DBG_SCISSOR,
+ "r300: Scissor width: %i, height: %i, CBZB clear: %s\n",
+ width, height, r300->cbzb_clear ? "YES" : "NO");
+
BEGIN_CS(size);
/* Set up scissors.
@@ -843,7 +847,7 @@ void r300_emit_aos_swtcl(struct r300_context *r300, boolean indexed)
OUT_CS(1 | (!indexed ? R300_VC_FORCE_PREFETCH : 0));
OUT_CS(r300->vertex_info.size |
(r300->vertex_info.size << 8));
- OUT_CS(r300->vbo_offset);
+ OUT_CS(r300->draw_vbo_offset);
OUT_CS_BUF_RELOC(r300->vbo, 0, r300_buffer(r300->vbo)->domain, 0);
END_CS;
}
@@ -1137,9 +1141,9 @@ void r300_emit_texture_cache_inval(struct r300_context* r300, unsigned size, voi
END_CS;
}
-void r300_emit_buffer_validate(struct r300_context *r300,
- boolean do_validate_vertex_buffers,
- struct pipe_resource *index_buffer)
+boolean r300_emit_buffer_validate(struct r300_context *r300,
+ boolean do_validate_vertex_buffers,
+ struct pipe_resource *index_buffer)
{
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
@@ -1150,7 +1154,6 @@ void r300_emit_buffer_validate(struct r300_context *r300,
struct pipe_vertex_element *velem = r300->velems->velem;
struct pipe_resource *pbuf;
unsigned i;
- boolean invalid = FALSE;
/* upload buffers first */
if (r300->screen->caps.has_tcl && r300->any_user_vbs) {
@@ -1161,7 +1164,6 @@ void r300_emit_buffer_validate(struct r300_context *r300,
/* Clean out BOs. */
r300->rws->cs_reset_buffers(r300->cs);
-validate:
/* Color buffers... */
for (i = 0; i < fb->nr_cbufs; i++) {
tex = r300_texture(fb->cbufs[i]->texture);
@@ -1208,15 +1210,10 @@ validate:
r300_buffer(index_buffer)->domain, 0);
if (!r300->rws->cs_validate(r300->cs)) {
- r300->context.flush(&r300->context, 0, NULL);
- if (invalid) {
- /* Well, hell. */
- fprintf(stderr, "r300: Stuck in validation loop, gonna quit now.\n");
- abort();
- }
- invalid = TRUE;
- goto validate;
+ return FALSE;
}
+
+ return TRUE;
}
unsigned r300_get_num_dirty_dwords(struct r300_context *r300)
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index bae2525634..278dbcb4c7 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -121,8 +121,8 @@ unsigned r300_get_num_cs_end_dwords(struct r300_context *r300);
/* Emit all dirty state. */
void r300_emit_dirty_state(struct r300_context* r300);
-void r300_emit_buffer_validate(struct r300_context *r300,
- boolean do_validate_vertex_buffers,
- struct pipe_resource *index_buffer);
+boolean r300_emit_buffer_validate(struct r300_context *r300,
+ boolean do_validate_vertex_buffers,
+ struct pipe_resource *index_buffer);
#endif /* R300_EMIT_H */
diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c
index 2b5d2e42ba..1afd27f093 100644
--- a/src/gallium/drivers/r300/r300_flush.c
+++ b/src/gallium/drivers/r300/r300_flush.c
@@ -43,7 +43,7 @@ static void r300_flush(struct pipe_context* pipe,
u_upload_flush(r300->upload_vb);
u_upload_flush(r300->upload_ib);
- if (r300->draw)
+ if (r300->draw && !r300->draw_vbo_locked)
r300_draw_flush_vbuf(r300);
if (r300->dirty_hw) {
diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c
index 9845e54610..b8dab88ef0 100644
--- a/src/gallium/drivers/r300/r300_fs.c
+++ b/src/gallium/drivers/r300/r300_fs.c
@@ -385,7 +385,12 @@ static void r300_translate_fragment_shader(
compiler.code = &shader->code;
compiler.state = shader->compare_state;
compiler.Base.is_r500 = r300->screen->caps.is_r500;
+ compiler.Base.disable_optimizations = DBG_ON(r300, DBG_NO_OPT);
+ compiler.Base.has_half_swizzles = TRUE;
+ compiler.Base.has_presub = TRUE;
compiler.Base.max_temp_regs = compiler.Base.is_r500 ? 128 : 32;
+ compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32;
+ compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64;
compiler.Base.remove_unused_constants = TRUE;
compiler.AllocateHwInputs = &allocate_hardware_inputs;
compiler.UserData = &shader->inputs;
@@ -423,14 +428,6 @@ static void r300_translate_fragment_shader(
/* Invoke the compiler */
r3xx_compile_fragment_program(&compiler);
- /* Shaders with zero instructions are invalid,
- * use the dummy shader instead. */
- if (shader->code.code.r500.inst_end == -1) {
- rc_destroy(&compiler.Base);
- r300_dummy_fragment_shader(r300, shader);
- return;
- }
-
if (compiler.Base.Error) {
fprintf(stderr, "r300 FP: Compiler Error:\n%sUsing a dummy shader"
" instead.\n", compiler.Base.ErrorMsg);
@@ -446,6 +443,14 @@ static void r300_translate_fragment_shader(
return;
}
+ /* Shaders with zero instructions are invalid,
+ * use the dummy shader instead. */
+ if (shader->code.code.r500.inst_end == -1) {
+ rc_destroy(&compiler.Base);
+ r300_dummy_fragment_shader(r300, shader);
+ return;
+ }
+
/* Initialize numbers of constants for each type. */
shader->externals_count = 0;
for (i = 0;
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 20bad2c56f..177850dea2 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -179,26 +179,20 @@ enum r300_prepare_flags {
/**
* Check if the requested number of dwords is available in the CS and
- * if not, flush. Then validate buffers and emit dirty state.
+ * if not, flush.
* \param r300 The context.
* \param flags See r300_prepare_flags.
- * \param index_buffer The index buffer to validate. The parameter may be NULL.
* \param cs_dwords The number of dwords to reserve in CS.
- * \param aos_offset The offset passed to emit_aos.
- * \param index_bias The index bias to emit.
+ * \return TRUE if the CS was flushed
*/
-static void r300_prepare_for_rendering(struct r300_context *r300,
- enum r300_prepare_flags flags,
- struct pipe_resource *index_buffer,
- unsigned cs_dwords,
- int aos_offset,
- int index_bias)
+static boolean r300_reserve_cs_dwords(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ unsigned cs_dwords)
{
boolean flushed = FALSE;
boolean first_draw = flags & PREP_FIRST_DRAW;
boolean emit_aos = flags & PREP_EMIT_AOS;
boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
- boolean indexed = flags & PREP_INDEXED;
boolean hw_index_bias = r500_index_bias_supported(r300);
/* Add dirty state, index offset, and AOS. */
@@ -223,9 +217,39 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
flushed = TRUE;
}
+ return flushed;
+}
+
+/**
+ * Validate buffers and emit dirty state.
+ * \param r300 The context.
+ * \param flags See r300_prepare_flags.
+ * \param index_buffer The index buffer to validate. The parameter may be NULL.
+ * \param aos_offset The offset passed to emit_aos.
+ * \param index_bias The index bias to emit.
+ * \return TRUE if rendering should be skipped
+ */
+static boolean r300_emit_states(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ struct pipe_resource *index_buffer,
+ int aos_offset,
+ int index_bias)
+{
+ boolean first_draw = flags & PREP_FIRST_DRAW;
+ boolean emit_aos = flags & PREP_EMIT_AOS;
+ boolean emit_aos_swtcl = flags & PREP_EMIT_AOS_SWTCL;
+ boolean indexed = flags & PREP_INDEXED;
+ boolean hw_index_bias = r500_index_bias_supported(r300);
+
/* Validate buffers and emit dirty state if needed. */
- if (first_draw || flushed) {
- r300_emit_buffer_validate(r300, flags & PREP_VALIDATE_VBOS, index_buffer);
+ if (first_draw) {
+ if (!r300_emit_buffer_validate(r300, flags & PREP_VALIDATE_VBOS,
+ index_buffer)) {
+ fprintf(stderr, "r300: CS space validation failed. "
+ "(not enough memory?) Skipping rendering.\n");
+ return FALSE;
+ }
+
r300_emit_dirty_state(r300);
if (hw_index_bias) {
if (r300->screen->caps.has_tcl)
@@ -240,6 +264,32 @@ static void r300_prepare_for_rendering(struct r300_context *r300,
if (emit_aos_swtcl)
r300_emit_aos_swtcl(r300, indexed);
}
+
+ return TRUE;
+}
+
+/**
+ * Check if the requested number of dwords is available in the CS and
+ * if not, flush. Then validate buffers and emit dirty state.
+ * \param r300 The context.
+ * \param flags See r300_prepare_flags.
+ * \param index_buffer The index buffer to validate. The parameter may be NULL.
+ * \param cs_dwords The number of dwords to reserve in CS.
+ * \param aos_offset The offset passed to emit_aos.
+ * \param index_bias The index bias to emit.
+ * \return TRUE if rendering should be skipped
+ */
+static boolean r300_prepare_for_rendering(struct r300_context *r300,
+ enum r300_prepare_flags flags,
+ struct pipe_resource *index_buffer,
+ unsigned cs_dwords,
+ int aos_offset,
+ int index_bias)
+{
+ if (r300_reserve_cs_dwords(r300, flags, cs_dwords))
+ flags |= PREP_FIRST_DRAW;
+
+ return r300_emit_states(r300, flags, index_buffer, aos_offset, index_bias);
}
static boolean immd_is_good_idea(struct r300_context *r300,
@@ -300,11 +350,14 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
struct pipe_vertex_element* velem;
struct pipe_vertex_buffer* vbuf;
unsigned vertex_element_count = r300->velems->count;
- unsigned i, v, vbi, dwords;
+ unsigned i, v, vbi;
/* Size of the vertex, in dwords. */
unsigned vertex_size = r300->velems->vertex_size_dwords;
+ /* The number of dwords for this draw operation. */
+ unsigned dwords = 9 + count * vertex_size;
+
/* Size of the vertex element, in dwords. */
unsigned size[PIPE_MAX_ATTRIBS];
@@ -319,6 +372,9 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
CS_LOCALS(r300);
+ if (!r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0))
+ return;
+
/* Calculate the vertex size, offsets, strides etc. and map the buffers. */
for (i = 0; i < vertex_element_count; i++) {
velem = &r300->velems->velem[i];
@@ -338,10 +394,6 @@ static void r300_emit_draw_arrays_immediate(struct r300_context *r300,
mapelem[i] = map[vbi] + (velem->src_offset / 4);
}
- dwords = 9 + count * vertex_size;
-
- r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0);
-
BEGIN_CS(dwords);
OUT_CS_REG(R300_GA_COLOR_CONTROL,
r300_provoking_vertex_fixes(r300, mode));
@@ -517,10 +569,12 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &new_offset);
start = new_offset;
- /* 15 dwords for emit_draw_elements */
- r300_prepare_for_rendering(r300,
- PREP_FIRST_DRAW | PREP_VALIDATE_VBOS | PREP_EMIT_AOS | PREP_INDEXED,
- indexBuffer, 15, buffer_offset, indexBias);
+
+ /* 15 dwords for emit_draw_elements. Give up if the function fails. */
+ if (!r300_prepare_for_rendering(r300,
+ PREP_FIRST_DRAW | PREP_VALIDATE_VBOS | PREP_EMIT_AOS |
+ PREP_INDEXED, indexBuffer, 15, buffer_offset, indexBias))
+ goto done;
if (alt_num_verts || count <= 65535) {
r300_emit_draw_elements(r300, indexBuffer, indexSize,
@@ -537,13 +591,15 @@ static void r300_draw_range_elements(struct pipe_context* pipe,
/* 15 dwords for emit_draw_elements */
if (count) {
- r300_prepare_for_rendering(r300,
- PREP_VALIDATE_VBOS | PREP_EMIT_AOS | PREP_INDEXED,
- indexBuffer, 15, buffer_offset, indexBias);
+ if (!r300_prepare_for_rendering(r300,
+ PREP_VALIDATE_VBOS | PREP_EMIT_AOS | PREP_INDEXED,
+ indexBuffer, 15, buffer_offset, indexBias))
+ goto done;
}
} while (count);
}
+done:
if (indexBuffer != orgIndexBuffer) {
pipe_resource_reference( &indexBuffer, NULL );
}
@@ -582,9 +638,11 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
if (immd_is_good_idea(r300, count)) {
r300_emit_draw_arrays_immediate(r300, mode, start, count);
} else {
- /* 9 spare dwords for emit_draw_arrays. */
- r300_prepare_for_rendering(r300, PREP_FIRST_DRAW | PREP_VALIDATE_VBOS | PREP_EMIT_AOS,
- NULL, 9, start, 0);
+ /* 9 spare dwords for emit_draw_arrays. Give up if the function fails. */
+ if (!r300_prepare_for_rendering(r300,
+ PREP_FIRST_DRAW | PREP_VALIDATE_VBOS | PREP_EMIT_AOS,
+ NULL, 9, start, 0))
+ goto done;
if (alt_num_verts || count <= 65535) {
r300_emit_draw_arrays(r300, mode, count);
@@ -596,17 +654,18 @@ static void r300_draw_arrays(struct pipe_context* pipe, unsigned mode,
start += short_count;
count -= short_count;
- /* 9 spare dwords for emit_draw_arrays. */
+ /* 9 spare dwords for emit_draw_arrays. Give up if the function fails. */
if (count) {
- r300_prepare_for_rendering(r300,
- PREP_VALIDATE_VBOS | PREP_EMIT_AOS, NULL, 9,
- start, 0);
+ if (!r300_prepare_for_rendering(r300,
+ PREP_VALIDATE_VBOS | PREP_EMIT_AOS, NULL, 9,
+ start, 0))
+ goto done;
}
} while (count);
}
- u_upload_flush(r300->upload_vb);
}
+done:
if (translate) {
r300_end_vertex_translate(r300);
}
@@ -617,6 +676,9 @@ static void r300_draw_vbo(struct pipe_context* pipe,
{
struct r300_context* r300 = r300_context(pipe);
+ if (!r300->velems->count || !r300->vertex_buffer_count)
+ return;
+
if (info->indexed && r300->index_buffer.buffer) {
unsigned offset;
@@ -655,7 +717,8 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
struct pipe_transfer *ib_transfer = NULL;
unsigned count = info->count;
int i;
- void* indices = NULL;
+ void *indices = NULL;
+ boolean indexed = info->indexed && r300->index_buffer.buffer;
if (r300->skip_rendering) {
return;
@@ -667,6 +730,11 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
r300_update_derived_state(r300);
+ r300_reserve_cs_dwords(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL |
+ (indexed ? PREP_INDEXED : 0),
+ indexed ? 256 : 6);
+
for (i = 0; i < r300->vertex_buffer_count; i++) {
if (r300->vertex_buffer[i].buffer) {
void *buf = pipe_buffer_map(pipe,
@@ -677,18 +745,17 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
}
}
- if (info->indexed && r300->index_buffer.buffer) {
+ if (indexed) {
indices = pipe_buffer_map(pipe, r300->index_buffer.buffer,
PIPE_TRANSFER_READ, &ib_transfer);
}
draw_set_mapped_index_buffer(r300->draw, indices);
+ r300->draw_vbo_locked = TRUE;
draw_vbo(r300->draw, info);
-
- /* XXX Not sure whether this is the best fix.
- * It prevents CS from being rejected and weird assertion failures. */
draw_flush(r300->draw);
+ r300->draw_vbo_locked = FALSE;
for (i = 0; i < r300->vertex_buffer_count; i++) {
if (r300->vertex_buffer[i].buffer) {
@@ -698,7 +765,7 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
}
}
- if (ib_transfer) {
+ if (indexed) {
pipe_buffer_unmap(pipe, r300->index_buffer.buffer, ib_transfer);
draw_set_mapped_index_buffer(r300->draw, NULL);
}
@@ -718,7 +785,6 @@ struct r300_render {
unsigned hwprim;
/* VBO */
- size_t vbo_offset;
size_t vbo_max_used;
void * vbo_ptr;
@@ -749,18 +815,19 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render,
struct pipe_screen* screen = r300->context.screen;
size_t size = (size_t)vertex_size * (size_t)count;
- if (size + r300render->vbo_offset > r300->draw_vbo_size)
+ DBG(r300, DBG_DRAW, "r300: render_allocate_vertices (size: %d)\n", size);
+
+ if (size + r300->draw_vbo_offset > r300->draw_vbo_size)
{
pipe_resource_reference(&r300->vbo, NULL);
r300->vbo = pipe_buffer_create(screen,
PIPE_BIND_VERTEX_BUFFER,
R300_MAX_DRAW_VBO_SIZE);
- r300render->vbo_offset = 0;
+ r300->draw_vbo_offset = 0;
r300->draw_vbo_size = R300_MAX_DRAW_VBO_SIZE;
}
r300render->vertex_size = vertex_size;
- r300->vbo_offset = r300render->vbo_offset;
return (r300->vbo) ? TRUE : FALSE;
}
@@ -772,6 +839,8 @@ static void* r300_render_map_vertices(struct vbuf_render* render)
assert(!r300render->vbo_transfer);
+ DBG(r300, DBG_DRAW, "r300: render_map_vertices\n");
+
r300render->vbo_ptr = pipe_buffer_map(&r300render->r300->context,
r300->vbo,
PIPE_TRANSFER_WRITE,
@@ -779,7 +848,7 @@ static void* r300_render_map_vertices(struct vbuf_render* render)
assert(r300render->vbo_ptr);
- return ((uint8_t*)r300render->vbo_ptr + r300render->vbo_offset);
+ return ((uint8_t*)r300render->vbo_ptr + r300->draw_vbo_offset);
}
static void r300_render_unmap_vertices(struct vbuf_render* render,
@@ -792,6 +861,8 @@ static void r300_render_unmap_vertices(struct vbuf_render* render,
assert(r300render->vbo_transfer);
+ DBG(r300, DBG_DRAW, "r300: render_unmap_vertices\n");
+
r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
r300render->vertex_size * (max + 1));
pipe_buffer_unmap(context, r300->vbo, r300render->vbo_transfer);
@@ -802,8 +873,11 @@ static void r300_render_unmap_vertices(struct vbuf_render* render,
static void r300_render_release_vertices(struct vbuf_render* render)
{
struct r300_render* r300render = r300_render(render);
+ struct r300_context* r300 = r300render->r300;
+
+ DBG(r300, DBG_DRAW, "r300: render_release_vertices\n");
- r300render->vbo_offset += r300render->vbo_max_used;
+ r300->draw_vbo_offset += r300render->vbo_max_used;
r300render->vbo_max_used = 0;
}
@@ -831,11 +905,13 @@ static void r300_render_draw_arrays(struct vbuf_render* render,
CS_LOCALS(r300);
(void) i; (void) ptr;
- r300_prepare_for_rendering(r300, PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
- NULL, dwords, 0, 0);
-
DBG(r300, DBG_DRAW, "r300: render_draw_arrays (count: %d)\n", count);
+ if (!r300_emit_states(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL,
+ NULL, 0, 0))
+ return;
+
/* Uncomment to dump all VBOs rendered through this interface.
* Slow and noisy!
ptr = pipe_buffer_map(&r300render->r300->context,
@@ -871,7 +947,7 @@ static void r300_render_draw_elements(struct vbuf_render* render,
struct r300_context* r300 = r300render->r300;
int i;
unsigned end_cs_dwords;
- unsigned max_index = (r300->draw_vbo_size - r300render->vbo_offset) /
+ unsigned max_index = (r300->draw_vbo_size - r300->draw_vbo_offset) /
(r300render->r300->vertex_info.size * 4) - 1;
unsigned short_count;
unsigned free_dwords;
@@ -879,13 +955,14 @@ static void r300_render_draw_elements(struct vbuf_render* render,
CS_LOCALS(r300);
DBG(r300, DBG_DRAW, "r300: render_draw_elements (count: %d)\n", count);
- /* Reserve at least 256 dwords.
- *
- * Below we manage the CS space manually because there may be more
+ if (!r300_emit_states(r300,
+ PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+ NULL, 0, 0))
+ return;
+
+ /* Below we manage the CS space manually because there may be more
* indices than it can fit in CS. */
- r300_prepare_for_rendering(r300,
- PREP_FIRST_DRAW | PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
- NULL, 256, 0, 0);
+
end_cs_dwords = r300_get_num_cs_end_dwords(r300);
while (count) {
@@ -914,9 +991,11 @@ static void r300_render_draw_elements(struct vbuf_render* render,
count -= short_count;
if (count) {
- r300_prepare_for_rendering(r300,
- PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
- NULL, 256, 0, 0);
+ if (!r300_prepare_for_rendering(r300,
+ PREP_EMIT_AOS_SWTCL | PREP_INDEXED,
+ NULL, 256, 0, 0))
+ return;
+
end_cs_dwords = r300_get_num_cs_end_dwords(r300);
}
}
@@ -947,8 +1026,6 @@ static struct vbuf_render* r300_render_create(struct r300_context* r300)
r300render->base.release_vertices = r300_render_release_vertices;
r300render->base.destroy = r300_render_destroy;
- r300render->vbo_offset = 0;
-
return &r300render->base;
}
@@ -985,7 +1062,9 @@ void r300_draw_flush_vbuf(struct r300_context *r300)
* End of SW TCL functions *
***************************************************************************/
-/* If we used a quad to draw a rectangle, the pixels on the main diagonal
+/* This functions is used to draw a rectangle for the blitter module.
+ *
+ * If we rendered a quad, the pixels on the main diagonal
* would be computed and stored twice, which makes the clear/copy codepaths
* somewhat inefficient. Instead we use a rectangular point sprite. */
static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
@@ -1015,7 +1094,8 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
r300->clip_state.dirty = FALSE;
r300->viewport_state.dirty = FALSE;
- r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0);
+ if (!r300_prepare_for_rendering(r300, PREP_FIRST_DRAW, NULL, dwords, 0, 0))
+ goto done;
DBG(r300, DBG_DRAW, "r300: draw_rectangle\n");
@@ -1059,6 +1139,7 @@ static void r300_blitter_draw_rectangle(struct blitter_context *blitter,
}
END_CS;
+done:
/* Restore the state. */
r300->clip_state.dirty = TRUE;
r300->rs_state.dirty = TRUE;
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 1e4edcdbc3..7f41ff0e2e 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -120,7 +120,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
/* Unsupported features (boolean caps). */
case PIPE_CAP_TIMER_QUERY:
case PIPE_CAP_DUAL_SOURCE_BLEND:
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
case PIPE_CAP_INDEP_BLEND_ENABLE:
case PIPE_CAP_INDEP_BLEND_FUNC:
case PIPE_CAP_DEPTH_CLAMP: /* XXX implemented, but breaks Regnum Online */
@@ -146,11 +145,6 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
/* General shader limits and features. */
case PIPE_CAP_SM3:
return is_r500 ? 1 : 0;
- case PIPE_CAP_MAX_CONST_BUFFERS:
- return 1;
- case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
- return 256;
-
/* Fragment coordinate conventions. */
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
@@ -158,19 +152,39 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
+ default:
+ fprintf(stderr, "r300: Implementation error: Bad param %d\n",
+ param);
+ return 0;
+ }
+}
- /* Fragment shader limits. */
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
+static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
+{
+ struct r300_screen* r300screen = r300_screen(pscreen);
+ boolean is_r400 = r300screen->caps.is_r400;
+ boolean is_r500 = r300screen->caps.is_r500;
+
+ /* XXX extended shader capabilities of r400 unimplemented */
+ is_r400 = FALSE;
+
+ switch (shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
return is_r500 || is_r400 ? 512 : 96;
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
return is_r500 || is_r400 ? 512 : 64;
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
return is_r500 || is_r400 ? 512 : 32;
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return is_r500 ? 511 : 4;
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return is_r500 ? 64 : 0; /* Actually unlimited on r500. */
- case PIPE_CAP_MAX_FS_INPUTS:
+ /* Fragment shader limits. */
+ case PIPE_SHADER_CAP_MAX_INPUTS:
/* 2 colors + 8 texcoords are always supported
* (minus fog and wpos).
*
@@ -178,42 +192,53 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
* additional texcoords but there is no two-sided color
* selection then. However the facing bit can be used instead. */
return 10;
- case PIPE_CAP_MAX_FS_CONSTS:
+ case PIPE_SHADER_CAP_MAX_CONSTS:
return is_r500 ? 256 : 32;
- case PIPE_CAP_MAX_FS_TEMPS:
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
return is_r500 ? 128 : is_r400 ? 64 : 32;
- case PIPE_CAP_MAX_FS_ADDRS:
+ case PIPE_SHADER_CAP_MAX_ADDRS:
return 0;
- case PIPE_CAP_MAX_FS_PREDS:
+ case PIPE_SHADER_CAP_MAX_PREDS:
return is_r500 ? 1 : 0;
-
- /* Vertex shader limits. */
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ }
+ break;
+ case PIPE_SHADER_VERTEX:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
return is_r500 ? 1024 : 256;
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
return 0;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
return is_r500 ? 4 : 0; /* For loops; not sure about conditionals. */
- case PIPE_CAP_MAX_VS_INPUTS:
+ case PIPE_SHADER_CAP_MAX_INPUTS:
return 16;
- case PIPE_CAP_MAX_VS_CONSTS:
+ case PIPE_SHADER_CAP_MAX_CONSTS:
return 256;
- case PIPE_CAP_MAX_VS_TEMPS:
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
return 32;
- case PIPE_CAP_MAX_VS_ADDRS:
+ case PIPE_SHADER_CAP_MAX_ADDRS:
return 1; /* XXX guessed */
- case PIPE_CAP_MAX_VS_PREDS:
+ case PIPE_SHADER_CAP_MAX_PREDS:
return is_r500 ? 4 : 0; /* XXX guessed. */
- case PIPE_CAP_GEOMETRY_SHADER4:
- return 0;
-
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
default:
- fprintf(stderr, "r300: Implementation error: Bad param %d\n",
- param);
- return 0;
+ break;
+ }
+ break;
+ default:
+ break;
}
+ return 0;
}
static float r300_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
@@ -410,6 +435,7 @@ struct pipe_screen* r300_screen_create(struct r300_winsys_screen *rws)
r300screen->screen.get_name = r300_get_name;
r300screen->screen.get_vendor = r300_get_vendor;
r300screen->screen.get_param = r300_get_param;
+ r300screen->screen.get_shader_param = r300_get_shader_param;
r300screen->screen.get_paramf = r300_get_paramf;
r300screen->screen.is_format_supported = r300_is_format_supported;
r300screen->screen.context_create = r300_create_context;
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index 13a3320b99..dc2bc7e827 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -92,11 +92,14 @@ r300_winsys_screen(struct pipe_screen *screen) {
#define DBG_RS_BLOCK (1 << 10)
#define DBG_CBZB (1 << 11)
#define DBG_HYPERZ (1 << 12)
+#define DBG_SCISSOR (1 << 13)
/* Features. */
#define DBG_ANISOHQ (1 << 16)
#define DBG_NO_TILING (1 << 17)
#define DBG_NO_IMMD (1 << 18)
#define DBG_FAKE_OCC (1 << 19)
+#define DBG_NO_OPT (1 << 20)
+#define DBG_NO_CBZB (1 << 21)
/* Statistics. */
#define DBG_STATS (1 << 24)
/*@}*/
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index 960dfdbaf0..f9a516825d 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -477,6 +477,15 @@ static void r300_update_rs_block(struct r300_context *r300)
}
}
+ if (DBG_ON(r300, DBG_RS)) {
+ for (; i < ATTR_GENERIC_COUNT; i++) {
+ if (fs_inputs->generic[i] != ATTR_UNUSED) {
+ DBG(r300, DBG_RS,
+ "r300: FS input generic %i unassigned.\n", i);
+ }
+ }
+ }
+
/* Rasterize fog coordinates. */
if (vs_outputs->fog != ATTR_UNUSED && tex_count < 8) {
/* Set up the fog coordinates in VAP. */
diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c
index 66f6d80bd0..34105aa4bc 100644
--- a/src/gallium/drivers/r300/r300_texture.c
+++ b/src/gallium/drivers/r300/r300_texture.c
@@ -758,18 +758,6 @@ struct pipe_resource *r300_texture_create(struct pipe_screen *screen,
struct r300_screen *rscreen = r300_screen(screen);
enum r300_buffer_tiling microtile, macrotile;
- /* Refuse to create a texture with size 0. */
- if (!base->width0 ||
- (!base->height0 && (base->target == PIPE_TEXTURE_2D ||
- base->target == PIPE_TEXTURE_CUBE ||
- base->target == PIPE_TEXTURE_RECT)) ||
- (!base->depth0 && base->target == PIPE_TEXTURE_3D)) {
- fprintf(stderr, "r300: texture_create: "
- "Got invalid texture dimensions: %ix%ix%i\n",
- base->width0, base->height0, base->depth0);
- return NULL;
- }
-
if ((base->flags & R300_RESOURCE_FLAG_TRANSFER) ||
(base->bind & PIPE_BIND_SCANOUT)) {
microtile = R300_BUFFER_LINEAR;
@@ -893,9 +881,11 @@ struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
surface->cbzb_format = R300_DEPTHFORMAT_16BIT_INT_Z;
SCREEN_DBG(r300_screen(screen), DBG_CBZB,
- "CBZB Dim: %ix%i, Misalignment: %i, Macro: %s\n",
+ "CBZB Allowed: %s, Dim: %ix%i, Misalignment: %i, Micro: %s, Macro: %s\n",
+ surface->cbzb_allowed ? "YES" : " NO",
surface->cbzb_width, surface->cbzb_height,
offset & 2047,
+ tex->desc.microtile ? "YES" : " NO",
tex->desc.macrotile[level] ? "YES" : " NO");
}
diff --git a/src/gallium/drivers/r300/r300_texture_desc.c b/src/gallium/drivers/r300/r300_texture_desc.c
index 2fe5d72188..112282a0a6 100644
--- a/src/gallium/drivers/r300/r300_texture_desc.c
+++ b/src/gallium/drivers/r300/r300_texture_desc.c
@@ -339,6 +339,9 @@ static void r300_setup_cbzb_flags(struct r300_screen *rscreen,
(bpp == 16 || bpp == 32) &&
desc->macrotile[0];
+ if (SCREEN_DBG_ON(rscreen, DBG_NO_CBZB))
+ first_level_valid = FALSE;
+
for (i = 0; i <= desc->b.b.last_level; i++)
desc->cbzb_allowed[i] = first_level_valid && desc->macrotile[i];
}
diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c
index 5f8dbb28d0..e2b9af9d01 100644
--- a/src/gallium/drivers/r300/r300_vs.c
+++ b/src/gallium/drivers/r300/r300_vs.c
@@ -199,13 +199,19 @@ void r300_translate_vertex_shader(struct r300_context *r300,
unsigned i;
/* Setup the compiler */
+ memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
compiler.Base.Debug = DBG_ON(r300, DBG_VP);
compiler.code = &vs->code;
compiler.UserData = vs;
compiler.Base.is_r500 = r300->screen->caps.is_r500;
+ compiler.Base.disable_optimizations = DBG_ON(r300, DBG_NO_OPT);
+ compiler.Base.has_half_swizzles = FALSE;
+ compiler.Base.has_presub = FALSE;
compiler.Base.max_temp_regs = 32;
+ compiler.Base.max_constants = 256;
+ compiler.Base.max_alu_insts = r300->screen->caps.is_r500 ? 1024 : 256;
compiler.Base.remove_unused_constants = TRUE;
if (compiler.Base.Debug) {
diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile
index fc94ae71f4..a5249e09aa 100644
--- a/src/gallium/drivers/r600/Makefile
+++ b/src/gallium/drivers/r600/Makefile
@@ -19,6 +19,9 @@ C_SOURCES = \
r600_state.c \
r600_texture.c \
r600_asm.c \
- r700_asm.c
+ r700_asm.c \
+ r600_hw_states.c \
+ eg_asm.c \
+ eg_hw_states.c
include ../../Makefile.template
diff --git a/src/gallium/drivers/r600/eg_asm.c b/src/gallium/drivers/r600/eg_asm.c
new file mode 100644
index 0000000000..bc5dda43ed
--- /dev/null
+++ b/src/gallium/drivers/r600/eg_asm.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#include "r600_asm.h"
+#include "r600_context.h"
+#include "util/u_memory.h"
+#include "eg_sq.h"
+#include "r600_opcodes.h"
+#include <stdio.h>
+#include <errno.h>
+
+int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
+{
+ unsigned id = cf->id;
+
+ switch (cf->inst) {
+ case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
+ case (EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
+ bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
+ S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache0_mode);
+ bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) |
+ S_SQ_CF_ALU_WORD1_BARRIER(1) |
+ S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1);
+ break;
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_TEX:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_VTX:
+ bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->addr >> 1);
+ bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) |
+ S_SQ_CF_WORD1_BARRIER(1) |
+ S_SQ_CF_WORD1_COUNT((cf->ndw / 4) - 1);
+ break;
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
+ bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
+ S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(cf->output.elem_size) |
+ S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(cf->output.array_base) |
+ S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(cf->output.type);
+ bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(cf->output.swizzle_x) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(cf->output.swizzle_y) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(cf->output.swizzle_z) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(cf->output.swizzle_w) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(cf->output.barrier) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(cf->output.inst) |
+ S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(cf->output.end_of_program);
+ break;
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_JUMP:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_ELSE:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_POP:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE:
+ case EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK:
+ bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1);
+ bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(cf->inst) |
+ S_SQ_CF_WORD1_BARRIER(1) |
+ S_SQ_CF_WORD1_COND(cf->cond) |
+ S_SQ_CF_WORD1_POP_COUNT(cf->pop_count);
+
+ break;
+ default:
+ R600_ERR("unsupported CF instruction (0x%X)\n", cf->inst);
+ return -EINVAL;
+ }
+ return 0;
+}
diff --git a/src/gallium/drivers/r600/eg_hw_states.c b/src/gallium/drivers/r600/eg_hw_states.c
new file mode 100644
index 0000000000..621e36e1bb
--- /dev/null
+++ b/src/gallium/drivers/r600/eg_hw_states.c
@@ -0,0 +1,1070 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ * 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jerome Glisse
+ * Dave Airlie
+ */
+#include <util/u_inlines.h>
+#include <util/u_format.h>
+#include <util/u_memory.h>
+#include <util/u_blitter.h>
+#include "util/u_pack_color.h"
+#include "r600_screen.h"
+#include "r600_context.h"
+#include "r600_resource.h"
+#include "eg_state_inlines.h"
+#include "evergreend.h"
+
+#include "eg_states_inc.h"
+
+static void eg_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ int i;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0);
+ rstate->states[EG_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]);
+ rstate->states[EG_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]);
+ rstate->states[EG_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]);
+ rstate->states[EG_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]);
+ rstate->states[EG_BLEND__CB_BLEND0_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND1_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND2_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND3_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND4_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND5_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND6_CONTROL] = 0x00000000;
+ rstate->states[EG_BLEND__CB_BLEND7_CONTROL] = 0x00000000;
+
+ for (i = 0; i < 8; i++) {
+ unsigned eqRGB = state->rt[i].rgb_func;
+ unsigned srcRGB = state->rt[i].rgb_src_factor;
+ unsigned dstRGB = state->rt[i].rgb_dst_factor;
+
+ unsigned eqA = state->rt[i].alpha_func;
+ unsigned srcA = state->rt[i].alpha_src_factor;
+ unsigned dstA = state->rt[i].alpha_dst_factor;
+ uint32_t bc = 0;
+
+ if (!state->rt[i].blend_enable)
+ continue;
+
+ bc |= S_028780_BLEND_CONTROL_ENABLE(1);
+
+ bc |= S_028780_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
+ bc |= S_028780_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
+ bc |= S_028780_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
+
+ if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
+ bc |= S_028780_SEPARATE_ALPHA_BLEND(1);
+ bc |= S_028780_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
+ bc |= S_028780_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
+ bc |= S_028780_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
+ }
+
+ rstate->states[EG_BLEND__CB_BLEND0_CONTROL + i] = bc;
+ }
+
+ radeon_state_pm4(rstate);
+}
+
+static void eg_ucp(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_clip_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0);
+
+ for (int i = 0; i < state->nr; i++) {
+ rstate->states[i * 4 + 0] = fui(state->ucp[i][0]);
+ rstate->states[i * 4 + 1] = fui(state->ucp[i][1]);
+ rstate->states[i * 4 + 2] = fui(state->ucp[i][2]);
+ rstate->states[i * 4 + 3] = fui(state->ucp[i][3]);
+ }
+ radeon_state_pm4(rstate);
+}
+
+static void eg_cb(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state, int cb)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level = state->cbufs[cb]->level;
+ unsigned pitch, slice;
+ unsigned color_info;
+ unsigned format, swap, ntype;
+ const struct util_format_description *desc;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0, cb, 0);
+ rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
+ rbuffer = &rtex->resource;
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
+ rstate->nbo = 1;
+ pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
+ slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
+
+ ntype = 0;
+ desc = util_format_description(rtex->resource.base.b.format);
+ if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+ ntype = V_028C70_NUMBER_SRGB;
+
+ format = r600_translate_colorformat(rtex->resource.base.b.format);
+ swap = r600_translate_colorswap(rtex->resource.base.b.format);
+
+ color_info = S_028C70_FORMAT(format) |
+ S_028C70_COMP_SWAP(swap) |
+ S_028C70_BLEND_CLAMP(1) |
+ S_028C70_SOURCE_FORMAT(1) |
+ S_028C70_NUMBER_TYPE(ntype);
+
+ rstate->states[EG_CB__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8;
+ rstate->states[EG_CB__CB_COLOR0_INFO] = color_info;
+ rstate->states[EG_CB__CB_COLOR0_PITCH] = S_028C64_PITCH_TILE_MAX(pitch);
+ rstate->states[EG_CB__CB_COLOR0_SLICE] = S_028C68_SLICE_TILE_MAX(slice);
+ rstate->states[EG_CB__CB_COLOR0_VIEW] = 0x00000000;
+ rstate->states[EG_CB__CB_COLOR0_ATTRIB] = S_028C74_NON_DISP_TILING_ORDER(1);
+
+ radeon_state_pm4(rstate);
+}
+
+static void eg_db(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level;
+ unsigned pitch, slice, format;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0);
+ if (state->zsbuf == NULL)
+ return;
+
+ rtex = (struct r600_resource_texture*)state->zsbuf->texture;
+ rtex->tilled = 1;
+ rtex->array_mode = 2;
+ rtex->tile_type = 1;
+ rtex->depth = 1;
+ rbuffer = &rtex->resource;
+
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->nbo = 1;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
+ level = state->zsbuf->level;
+ pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
+ slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
+ format = r600_translate_dbformat(state->zsbuf->texture->format);
+ rstate->states[EG_DB__DB_HTILE_DATA_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[EG_DB__DB_Z_READ_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[EG_DB__DB_Z_WRITE_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[EG_DB__DB_STENCIL_READ_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[EG_DB__DB_STENCIL_WRITE_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[EG_DB__DB_Z_INFO] = S_028040_ARRAY_MODE(rtex->array_mode) | S_028040_FORMAT(format);
+ rstate->states[EG_DB__DB_DEPTH_VIEW] = 0x00000000;
+ rstate->states[EG_DB__DB_DEPTH_SIZE] = S_028058_PITCH_TILE_MAX(pitch);
+ rstate->states[EG_DB__DB_DEPTH_SLICE] = S_02805C_SLICE_TILE_MAX(slice);
+ radeon_state_pm4(rstate);
+}
+
+static void eg_rasterizer(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer;
+ const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+ const struct pipe_clip_state *clip = NULL;
+ struct r600_screen *rscreen = rctx->screen;
+ float offset_units = 0, offset_scale = 0;
+ char depth = 0;
+ unsigned offset_db_fmt_cntl = 0;
+ unsigned tmp;
+ unsigned prov_vtx = 1;
+
+ if (rctx->clip)
+ clip = &rctx->clip->state.clip;
+ if (fb->zsbuf) {
+ offset_units = state->offset_units;
+ offset_scale = state->offset_scale * 12.0f;
+ switch (fb->zsbuf->texture->format) {
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ depth = -24;
+ offset_units *= 2.0f;
+ break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ depth = -23;
+ offset_units *= 1.0f;
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
+ break;
+ case PIPE_FORMAT_Z16_UNORM:
+ depth = -16;
+ offset_units *= 4.0f;
+ break;
+ default:
+ R600_ERR("unsupported %d\n", fb->zsbuf->texture->format);
+ return;
+ }
+ }
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
+
+ if (state->flatshade_first)
+ prov_vtx = 0;
+
+ rctx->flat_shade = state->flatshade;
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0);
+ rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000000;
+ if (rctx->flat_shade)
+ rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |= S_0286D4_FLAT_SHADE_ENA(1);
+ if (state->sprite_coord_enable) {
+ rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |=
+ S_0286D4_PNT_SPRITE_ENA(1) |
+ S_0286D4_PNT_SPRITE_OVRD_X(2) |
+ S_0286D4_PNT_SPRITE_OVRD_Y(3) |
+ S_0286D4_PNT_SPRITE_OVRD_Z(0) |
+ S_0286D4_PNT_SPRITE_OVRD_W(1);
+ if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
+ rstate->states[EG_RASTERIZER__SPI_INTERP_CONTROL_0] |=
+ S_0286D4_PNT_SPRITE_TOP_1(1);
+ }
+ }
+ rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = 0;
+ if (clip) {
+ rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1);
+ rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp);
+ rstate->states[EG_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
+ }
+ rstate->states[EG_RASTERIZER__PA_SU_SC_MODE_CNTL] =
+ S_028814_PROVOKING_VTX_LAST(prov_vtx) |
+ S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
+ S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
+ S_028814_FACE(!state->front_ccw) |
+ S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri);
+ rstate->states[EG_RASTERIZER__PA_CL_VS_OUT_CNTL] =
+ S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
+ S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
+ rstate->states[EG_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000;
+ /* point size 12.4 fixed point */
+ tmp = (unsigned)(state->point_size * 8.0);
+ rstate->states[EG_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp);
+ rstate->states[EG_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000;
+ rstate->states[EG_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008;
+ rstate->states[EG_RASTERIZER__PA_SU_VTX_CNTL] = 0x00000005;
+
+ rstate->states[EG_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000;
+ rstate->states[EG_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400;
+ rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000;
+ rstate->states[EG_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000;
+ rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000;
+ rstate->states[EG_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000;
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl;
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000;
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale);
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units);
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale);
+ rstate->states[EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units);
+ radeon_state_pm4(rstate);
+}
+
+static void eg_scissor(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_scissor_state *state = &rctx->scissor->state.scissor;
+ const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+ struct r600_screen *rscreen = rctx->screen;
+ unsigned minx, maxx, miny, maxy;
+ u32 tl, br;
+
+ if (state == NULL) {
+ minx = 0;
+ miny = 0;
+ maxx = fb->cbufs[0]->width;
+ maxy = fb->cbufs[0]->height;
+ } else {
+ minx = state->minx;
+ miny = state->miny;
+ maxx = state->maxx;
+ maxy = state->maxy;
+ }
+ tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny);
+ br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy);
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0);
+ /* screen scissor has no WINDOW OFFSET */
+ rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl;
+ rstate->states[EG_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000;
+ rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl | S_028204_WINDOW_OFFSET_DISABLE(1);
+ rstate->states[EG_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_0_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_1_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_2_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl;
+ rstate->states[EG_SCISSOR__PA_SC_CLIPRECT_3_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA;
+ rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1);
+ rstate->states[EG_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br;
+ rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl | S_028240_WINDOW_OFFSET_DISABLE(1);
+ rstate->states[EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br;
+ radeon_state_pm4(rstate);
+}
+
+static void eg_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0);
+ rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000;
+ rstate->states[EG_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000;
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]);
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]);
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]);
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]);
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]);
+ rstate->states[EG_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]);
+ rstate->states[EG_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F;
+ radeon_state_pm4(rstate);
+}
+
+static void eg_dsa(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa;
+ const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref;
+ struct r600_screen *rscreen = rctx->screen;
+ unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
+ unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
+ struct r600_shader *rshader;
+ struct r600_query *rquery = NULL;
+ boolean query_running;
+ int i;
+
+ if (rctx->ps_shader == NULL) {
+ return;
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0);
+
+ db_shader_control = 0x210;
+ rshader = &rctx->ps_shader->shader;
+ if (rshader->uses_kill)
+ db_shader_control |= (1 << 6);
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ db_shader_control |= 1;
+ }
+ stencil_ref_mask = 0;
+ stencil_ref_mask_bf = 0;
+ db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
+ S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
+ S_028800_ZFUNC(state->depth.func);
+ /* set stencil enable */
+
+ if (state->stencil[0].enabled) {
+ db_depth_control |= S_028800_STENCIL_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
+ db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
+
+ stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
+ S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
+ stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]);
+ if (state->stencil[1].enabled) {
+ db_depth_control |= S_028800_BACKFACE_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
+ db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
+ stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
+ S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
+ stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]);
+ }
+ }
+
+ alpha_test_control = 0;
+ alpha_ref = 0;
+ if (state->alpha.enabled) {
+ alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
+ alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
+ alpha_ref = fui(state->alpha.ref_value);
+ }
+
+ db_render_control = 0;
+/// db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) |
+/// S_028D0C_DEPTH_COMPRESS_DISABLE(1);
+ db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
+
+ query_running = false;
+
+ LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
+ if (rquery->state & R600_QUERY_STATE_STARTED) {
+ query_running = true;
+ }
+ }
+
+ if (query_running) {
+ db_render_override |= S_028D10_NOOP_CULL_DISABLE(1);
+ db_render_control |= S_028D0C_PERFECT_ZPASS_COUNTS(1);
+ }
+
+ rstate->states[EG_DSA__DB_STENCIL_CLEAR] = 0x00000000;
+ rstate->states[EG_DSA__DB_DEPTH_CLEAR] = 0x3F800000;
+ rstate->states[EG_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control;
+ rstate->states[EG_DSA__DB_STENCILREFMASK] = stencil_ref_mask;
+ rstate->states[EG_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf;
+ rstate->states[EG_DSA__SX_ALPHA_REF] = alpha_ref;
+ // rstate->states[EG_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000;
+ // rstate->states[EG_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000;
+ rstate->states[EG_DSA__SPI_FOG_CNTL] = 0x00000000;
+ rstate->states[EG_DSA__DB_DEPTH_CONTROL] = db_depth_control;
+ rstate->states[EG_DSA__DB_SHADER_CONTROL] = db_shader_control;
+ rstate->states[EG_DSA__DB_RENDER_CONTROL] = db_render_control;
+ rstate->states[EG_DSA__DB_RENDER_OVERRIDE] = db_render_override;
+
+ rstate->states[EG_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000;
+ rstate->states[EG_DSA__DB_PRELOAD_CONTROL] = 0x00000000;
+ rstate->states[EG_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00;
+ radeon_state_pm4(rstate);
+}
+
+
+static INLINE u32 S_FIXED(float value, u32 frac_bits)
+{
+ return value * (1 << frac_bits);
+}
+
+static void eg_sampler_border(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ union util_color uc;
+
+ util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS);
+ if (uc.ui) {
+ rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]);
+ rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]);
+ rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]);
+ rstate->states[EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]);
+ }
+ radeon_state_pm4(rstate);
+}
+
+static void eg_sampler(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ union util_color uc;
+
+ util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS);
+ rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] =
+ S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
+ S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
+ S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
+ S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
+ S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
+ S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
+ S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
+ S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0);
+ /* FIXME LOD it depends on texture base level ... */
+ rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] =
+ S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
+ S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6));
+
+ rstate->states[EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] =
+ S_03C008_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)) |
+S_03C008_TYPE(1);
+ radeon_state_pm4(rstate);
+
+}
+
+
+static void eg_resource(struct pipe_context *ctx, struct radeon_state *rstate,
+ const struct pipe_sampler_view *view, unsigned id)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_screen *rscreen = rctx->screen;
+ const struct util_format_description *desc;
+ struct r600_resource_texture *tmp;
+ struct r600_resource *rbuffer;
+ unsigned format;
+ uint32_t word4 = 0, yuv_format = 0, pitch = 0;
+ unsigned char swizzle[4];
+ int r;
+
+ rstate->cpm4 = 0;
+ swizzle[0] = view->swizzle_r;
+ swizzle[1] = view->swizzle_g;
+ swizzle[2] = view->swizzle_b;
+ swizzle[3] = view->swizzle_a;
+ format = r600_translate_texformat(view->texture->format,
+ swizzle,
+ &word4, &yuv_format);
+ if (format == ~0) {
+ return;
+ }
+ desc = util_format_description(view->texture->format);
+ if (desc == NULL) {
+ R600_ERR("unknow format %d\n", view->texture->format);
+ return;
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS);
+ tmp = (struct r600_resource_texture*)view->texture;
+ rbuffer = &tmp->resource;
+ if (tmp->depth) {
+ r = r600_texture_from_depth(ctx, tmp, view->first_level);
+ if (r) {
+ return;
+ }
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
+ rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
+ } else {
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ }
+ rstate->nbo = 2;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
+
+ pitch = (tmp->pitch[0] / tmp->bpt);
+ pitch = (pitch + 0x7) & ~0x7;
+
+ /* FIXME properly handle first level != 0 */
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD0] =
+ S_030000_DIM(r600_tex_dim(view->texture->target)) |
+ S_030000_PITCH((pitch / 8) - 1) |
+ S_030000_TEX_WIDTH(view->texture->width0 - 1);
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD1] =
+ S_030004_TEX_HEIGHT(view->texture->height0 - 1) |
+ S_030004_TEX_DEPTH(view->texture->depth0 - 1);
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8;
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8;
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD4] =
+ word4 |
+ S_030010_NUM_FORMAT_ALL(V_030010_SQ_NUM_FORMAT_NORM) |
+ S_030010_SRF_MODE_ALL(V_030010_SFR_MODE_NO_ZERO) |
+ S_030010_REQUEST_SIZE(1) |
+ S_030010_BASE_LEVEL(view->first_level);
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD5] =
+ S_030014_LAST_LEVEL(view->last_level) |
+ S_030014_BASE_ARRAY(0) |
+ S_030014_LAST_ARRAY(0);
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0;
+ rstate->states[EG_PS_RESOURCE__RESOURCE0_WORD7] =
+ S_03001C_DATA_FORMAT(format) |
+ S_03001C_TYPE(V_03001C_SQ_TEX_VTX_VALID_TEXTURE);
+ radeon_state_pm4(rstate);
+}
+
+static void eg_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ const struct pipe_blend_state *pbs = &rctx->blend->state.blend;
+ int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs;
+ uint32_t color_control, target_mask, shader_mask;
+ int i;
+
+ target_mask = 0;
+ shader_mask = 0;
+ color_control = S_028808_MODE(1);
+
+ for (i = 0; i < nr_cbufs; i++) {
+ shader_mask |= 0xf << (i * 4);
+ }
+
+ if (pbs->logicop_enable) {
+ color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20);
+ } else {
+ color_control |= (0xcc << 16);
+ }
+
+ if (pbs->independent_blend_enable) {
+ for (i = 0; i < nr_cbufs; i++) {
+ target_mask |= (pbs->rt[i].colormask << (4 * i));
+ }
+ } else {
+ for (i = 0; i < nr_cbufs; i++) {
+ target_mask |= (pbs->rt[0].colormask << (4 * i));
+ }
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0);
+ rstate->states[EG_CB_CNTL__CB_SHADER_MASK] = shader_mask;
+ rstate->states[EG_CB_CNTL__CB_TARGET_MASK] = target_mask;
+ rstate->states[EG_CB_CNTL__CB_COLOR_CONTROL] = color_control;
+ rstate->states[EG_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
+ rstate->states[EG_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
+ rstate->states[EG_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF;
+ radeon_state_pm4(rstate);
+}
+
+
+static void eg_init_config(struct r600_context *rctx)
+{
+ int ps_prio;
+ int vs_prio;
+ int gs_prio;
+ int es_prio;
+ int hs_prio, cs_prio, ls_prio;
+ int num_ps_gprs;
+ int num_vs_gprs;
+ int num_gs_gprs;
+ int num_es_gprs;
+ int num_hs_gprs;
+ int num_ls_gprs;
+ int num_temp_gprs;
+ int num_ps_threads;
+ int num_vs_threads;
+ int num_gs_threads;
+ int num_es_threads;
+ int num_hs_threads;
+ int num_ls_threads;
+ int num_ps_stack_entries;
+ int num_vs_stack_entries;
+ int num_gs_stack_entries;
+ int num_es_stack_entries;
+ int num_hs_stack_entries;
+ int num_ls_stack_entries;
+ enum radeon_family family;
+
+ family = radeon_get_family(rctx->rw);
+ ps_prio = 0;
+ vs_prio = 1;
+ gs_prio = 2;
+ es_prio = 3;
+ hs_prio = 0;
+ ls_prio = 0;
+ cs_prio = 0;
+
+ switch (family) {
+ case CHIP_CEDAR:
+ default:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 96;
+ num_vs_threads = 16;
+ num_gs_threads = 16;
+ num_es_threads = 16;
+ num_hs_threads = 16;
+ num_ls_threads = 16;
+ num_ps_stack_entries = 42;
+ num_vs_stack_entries = 42;
+ num_gs_stack_entries = 42;
+ num_es_stack_entries = 42;
+ num_hs_stack_entries = 42;
+ num_ls_stack_entries = 42;
+ break;
+ case CHIP_REDWOOD:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 42;
+ num_vs_stack_entries = 42;
+ num_gs_stack_entries = 42;
+ num_es_stack_entries = 42;
+ num_hs_stack_entries = 42;
+ num_ls_stack_entries = 42;
+ break;
+ case CHIP_JUNIPER:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 85;
+ num_vs_stack_entries = 85;
+ num_gs_stack_entries = 85;
+ num_es_stack_entries = 85;
+ num_hs_stack_entries = 85;
+ num_ls_stack_entries = 85;
+ break;
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 85;
+ num_vs_stack_entries = 85;
+ num_gs_stack_entries = 85;
+ num_es_stack_entries = 85;
+ num_hs_stack_entries = 85;
+ num_ls_stack_entries = 85;
+ break;
+ }
+
+ radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0);
+
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] = 0x00000000;
+ switch (family) {
+ case CHIP_CEDAR:
+ break;
+ default:
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1);
+ break;
+ }
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_EXPORT_SRC_C(1);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_CS_PRIO(cs_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_LS_PRIO(ls_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_HS_PRIO(hs_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio);
+ rctx->config.states[EG_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio);
+
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0;
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
+
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0;
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_ES_GPRS(num_es_gprs);
+
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] = 0;
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_HS_GPRS(num_hs_gprs);
+ rctx->config.states[EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3] |= S_008C0C_NUM_LS_GPRS(num_ls_gprs);
+
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] = 0;
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_PS_THREADS(num_ps_threads);
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_VS_THREADS(num_vs_threads);
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_GS_THREADS(num_gs_threads);
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1] |= S_008C18_NUM_ES_THREADS(num_es_threads);
+
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] = 0;
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_HS_THREADS(num_hs_threads);
+ rctx->config.states[EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2] |= S_008C1C_NUM_LS_THREADS(num_ls_threads);
+
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0;
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C20_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
+
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0;
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C24_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
+
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] = 0;
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_HS_STACK_ENTRIES(num_hs_stack_entries);
+ rctx->config.states[EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3] |= S_008C28_NUM_LS_STACK_ENTRIES(num_ls_stack_entries);
+
+ rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SPI_CONFIG_CNTL_1] = S_00913C_VTX_DONE_DELAY(4);
+
+ rctx->config.states[EG_CONFIG__SX_MISC] = 0x00000000;
+
+ rctx->config.states[EG_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000;
+ rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_0] = 0x0;
+ rctx->config.states[EG_CONFIG__PA_SC_MODE_CNTL_1] = 0x0;
+
+ rctx->config.states[EG_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000;
+
+ rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_1] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_2] = 0x00000000;
+ rctx->config.states[EG_CONFIG__SQ_GS_VERT_ITEMSIZE_3] = 0x00000000;
+
+ rctx->config.states[EG_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_HOS_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_DECR] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_GS_MODE] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_STRMOUT_CONFIG] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_STRMOUT_BUFFER_CONFIG] = 0x00000000;
+ rctx->config.states[EG_CONFIG__VGT_REUSE_OFF] = 0x00000001;
+ rctx->config.states[EG_CONFIG__VGT_VTX_CNT_EN] = 0x00000000;
+// rctx->config.states[EG_CONFIG__VGT_CACHE_INVALIDATION] = 0x2;
+// rctx->config.states[EG_CONFIG__VGT_GS_VERTEX_REUSE] = 0x16;
+ rctx->config.states[EG_CONFIG__PA_CL_ENHANCE] = (3 << 1) | 1;
+
+ radeon_state_pm4(&rctx->config);
+}
+
+static int eg_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
+ uint32_t stride, uint32_t format)
+{
+ struct radeon_state *vs_resource = &rctx->vs_resource[id];
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS);
+ vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ vs_resource->nbo = 1;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD0] = offset;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset - 1;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD2] = S_030008_STRIDE(stride) |
+ S_030008_DATA_FORMAT(format);
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD3] = S_03000C_DST_SEL_X(V_03000C_SQ_SEL_X) |
+ S_03000C_DST_SEL_Y(V_03000C_SQ_SEL_Y) |
+ S_03000C_DST_SEL_Z(V_03000C_SQ_SEL_Z) |
+ S_03000C_DST_SEL_W(V_03000C_SQ_SEL_W);
+
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD6] = 0x00000000;
+ vs_resource->states[EG_PS_RESOURCE__RESOURCE0_WORD7] = 0xC0000000;
+ vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(vs_resource);
+}
+
+static int eg_draw_vgt_init(struct r600_context *rctx, struct radeon_state *draw,
+ struct r600_resource *rbuffer,
+ uint32_t count, int vgt_draw_initiator)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(draw, rscreen->rw, R600_STATE_DRAW, 0, 0);
+ draw->states[EG_DRAW__VGT_NUM_INDICES] = count;
+ draw->states[EG_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator;
+ if (rbuffer) {
+ draw->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ draw->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ draw->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ draw->nbo = 1;
+ }
+ return radeon_state_pm4(draw);
+}
+
+static int eg_draw_vgt_prim(struct r600_context *rctx, struct radeon_state *vgt,
+ uint32_t prim, uint32_t start, uint32_t vgt_dma_index_type)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ radeon_state_init(vgt, rscreen->rw, R600_STATE_VGT, 0, 0);
+ vgt->states[EG_VGT__VGT_PRIMITIVE_TYPE] = prim;
+ vgt->states[EG_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF;
+ vgt->states[EG_VGT__VGT_MIN_VTX_INDX] = 0x00000000;
+ vgt->states[EG_VGT__VGT_INDX_OFFSET] = start;
+ vgt->states[EG_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
+ vgt->states[EG_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;
+ vgt->states[EG_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001;
+ vgt->states[EG_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000;
+ vgt->states[EG_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000;
+ vgt->states[EG_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000;
+ return radeon_state_pm4(vgt);
+}
+
+
+static int eg_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
+ struct radeon_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ const struct pipe_rasterizer_state *rasterizer;
+ struct r600_shader *rshader = &rpshader->shader;
+ unsigned i, tmp, exports_ps, num_cout;
+ boolean have_pos = FALSE;
+
+ rasterizer = &rctx->rasterizer->state.rasterizer;
+
+ radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
+ for (i = 0; i < rshader->ninput; i++) {
+ tmp = S_028644_SEMANTIC(i);
+ tmp |= S_028644_SEL_CENTROID(1);
+ if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
+ have_pos = TRUE;
+ if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+ tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
+ }
+ if (rasterizer->sprite_coord_enable & (1 << i)) {
+ tmp |= S_028644_PT_SPRITE_TEX(1);
+ }
+ state->states[EG_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp;
+ }
+
+ exports_ps = 0;
+ num_cout = 0;
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ exports_ps |= 1;
+ else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
+ exports_ps |= (1 << (num_cout+1));
+ num_cout++;
+ }
+ }
+ if (!exports_ps) {
+ /* always at least export 1 component per pixel */
+ exports_ps = 2;
+ }
+ state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) |
+ S_0286CC_PERSP_GRADIENT_ENA(1);
+ if (have_pos) {
+ state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1);
+ state->states[EG_PS_SHADER__SPI_INPUT_Z] |= 1;
+ }
+ state->states[EG_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
+ state->states[EG_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028844_NUM_GPRS(rshader->bc.ngpr) | S_028844_PRIME_CACHE_ON_DRAW(1) |
+ S_028844_STACK_SIZE(rshader->bc.nstack);
+ state->states[EG_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
+ state->states[EG_PS_SHADER__SPI_BARYC_CNTL] = S_0286E0_PERSP_CENTROID_ENA(1) |
+ S_0286E0_LINEAR_CENTROID_ENA(1);
+ state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->nbo = 1;
+ state->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(state);
+}
+
+static int eg_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
+ struct radeon_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_shader *rshader = &rpshader->shader;
+ unsigned i, tmp;
+
+ radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
+ for (i = 0; i < 10; i++) {
+ state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0;
+ }
+ /* so far never got proper semantic id from tgsi */
+ for (i = 0; i < 32; i++) {
+ tmp = i << ((i & 3) * 8);
+ state->states[EG_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp;
+ }
+ state->states[EG_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2);
+ state->states[EG_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028860_NUM_GPRS(rshader->bc.ngpr) |
+ S_028860_STACK_SIZE(rshader->bc.nstack);
+ state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->nbo = 2;
+ state->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ state->placement[2] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(state);
+}
+
+struct r600_context_hw_state_vtbl eg_hw_state_vtbl = {
+ .blend = eg_blend,
+ .ucp = eg_ucp,
+ .cb = eg_cb,
+ .db = eg_db,
+ .rasterizer = eg_rasterizer,
+ .scissor = eg_scissor,
+ .viewport = eg_viewport,
+ .dsa = eg_dsa,
+ .sampler_border = eg_sampler_border,
+ .sampler = eg_sampler,
+ .resource = eg_resource,
+ .cb_cntl = eg_cb_cntl,
+ .vs_resource = eg_vs_resource,
+ .vgt_init = eg_draw_vgt_init,
+ .vgt_prim = eg_draw_vgt_prim,
+ .vs_shader = eg_vs_shader,
+ .ps_shader = eg_ps_shader,
+ .init_config = eg_init_config,
+};
+
+void eg_set_constant_buffer(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer)
+{
+ struct r600_screen *rscreen = r600_screen(ctx->screen);
+ struct r600_context *rctx = r600_context(ctx);
+ unsigned nconstant = 0, type, shader_class, size;
+ struct radeon_state *rstate, *rstates;
+ struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+
+ type = R600_STATE_CBUF;
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ shader_class = R600_SHADER_VS;
+ rstates = rctx->vs_constant;
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ shader_class = R600_SHADER_PS;
+ rstates = rctx->ps_constant;
+ break;
+ default:
+ R600_ERR("unsupported %d\n", shader);
+ return;
+ }
+
+ rstate = &rstates[0];
+
+#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
+ nconstant = buffer->width0 / 16;
+ size = ALIGN_DIVUP(nconstant, 16);
+
+ radeon_state_init(rstate, rscreen->rw, type, 0, shader_class);
+ rstate->states[EG_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size;
+ rstate->states[EG_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0;
+
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->nbo = 1;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
+ if (radeon_state_pm4(rstate))
+ return;
+ radeon_draw_bind(&rctx->draw, rstate);
+}
diff --git a/src/gallium/drivers/r600/eg_sq.h b/src/gallium/drivers/r600/eg_sq.h
new file mode 100644
index 0000000000..f80e8bd3aa
--- /dev/null
+++ b/src/gallium/drivers/r600/eg_sq.h
@@ -0,0 +1,485 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jerome Glisse
+ */
+#ifndef EG_SQ_H
+#define EG_SQ_H
+
+#define P_SQ_CF_WORD0
+#define S_SQ_CF_WORD0_ADDR(x) (((x) & 0xFFFFFF) << 0)
+#define G_SQ_CF_WORD0_ADDR(x) (((x) >> 0) & 0xFFFFFF)
+#define C_SQ_CF_WORD0_ADDR 0x00000000
+#define S_SQ_CF_WORD0_JUMPTABLE_SEL(x) (((x) & 0x7) << 24)
+#define G_SQ_CF_WORD0_JUMPTABLE_SEL(x) (((x) >> 24) & 0x7)
+#define C_SQ_CF_WORD0_JUMPTABLE_SEL 0xF8FFFFFF
+#define P_SQ_CF_WORD1
+#define S_SQ_CF_WORD1_POP_COUNT(x) (((x) & 0x7) << 0)
+#define G_SQ_CF_WORD1_POP_COUNT(x) (((x) >> 0) & 0x7)
+#define C_SQ_CF_WORD1_POP_COUNT 0xFFFFFFF8
+#define S_SQ_CF_WORD1_CF_CONST(x) (((x) & 0x1F) << 3)
+#define G_SQ_CF_WORD1_CF_CONST(x) (((x) >> 3) & 0x1F)
+#define C_SQ_CF_WORD1_CF_CONST 0xFFFFFF07
+#define S_SQ_CF_WORD1_COND(x) (((x) & 0x3) << 8)
+#define G_SQ_CF_WORD1_COND(x) (((x) >> 8) & 0x3)
+#define C_SQ_CF_WORD1_COND 0xFFFFFCFF
+#define S_SQ_CF_WORD1_COUNT(x) (((x) & 0x3f) << 10)
+#define G_SQ_CF_WORD1_COUNT(x) (((x) >> 10) & 0x3f)
+#define C_SQ_CF_WORD1_COUNT 0xFFFF03FF
+#define S_SQ_CF_WORD1_VALID_PIXEL_MODE(x) (((x) & 0x1) << 20)
+#define G_SQ_CF_WORD1_VALID_PIXEL_MODE(x) (((x) >> 20) & 0x1)
+#define C_SQ_CF_WORD1_VALID_PIXEL_MODE 0xFFEFFFFF
+#define S_SQ_CF_WORD1_END_OF_PROGRAM(x) (((x) & 0x1) << 21)
+#define G_SQ_CF_WORD1_END_OF_PROGRAM(x) (((x) >> 21) & 0x1)
+#define C_SQ_CF_WORD1_END_OF_PROGRAM 0xFFDFFFFF
+
+#define S_SQ_CF_WORD1_CF_INST(x) (((x) & 0xFF) << 22)
+#define G_SQ_CF_WORD1_CF_INST(x) (((x) >> 22) & 0xFF)
+#define C_SQ_CF_WORD1_CF_INST 0xC03FFFFF
+
+#define S_SQ_CF_WORD1_WHOLE_QUAD_MODE(x) (((x) & 0x1) << 30)
+#define G_SQ_CF_WORD1_WHOLE_QUAD_MODE(x) (((x) >> 30) & 0x1)
+#define C_SQ_CF_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
+#define S_SQ_CF_WORD1_BARRIER(x) (((x) & 0x1) << 31)
+#define G_SQ_CF_WORD1_BARRIER(x) (((x) >> 31) & 0x1)
+#define C_SQ_CF_WORD1_BARRIER 0x7FFFFFFF
+
+/* done */
+#define P_SQ_CF_ALU_WORD0
+#define S_SQ_CF_ALU_WORD0_ADDR(x) (((x) & 0x3FFFFF) << 0)
+#define G_SQ_CF_ALU_WORD0_ADDR(x) (((x) >> 0) & 0x3FFFFF)
+#define C_SQ_CF_ALU_WORD0_ADDR 0xFFC00000
+#define S_SQ_CF_ALU_WORD0_KCACHE_BANK0(x) (((x) & 0xF) << 22)
+#define G_SQ_CF_ALU_WORD0_KCACHE_BANK0(x) (((x) >> 22) & 0xF)
+#define C_SQ_CF_ALU_WORD0_KCACHE_BANK0 0xFC3FFFFF
+#define S_SQ_CF_ALU_WORD0_KCACHE_BANK1(x) (((x) & 0xF) << 26)
+#define G_SQ_CF_ALU_WORD0_KCACHE_BANK1(x) (((x) >> 26) & 0xF)
+#define C_SQ_CF_ALU_WORD0_KCACHE_BANK1 0xC3FFFFFF
+#define S_SQ_CF_ALU_WORD0_KCACHE_MODE0(x) (((x) & 0x3) << 30)
+#define G_SQ_CF_ALU_WORD0_KCACHE_MODE0(x) (((x) >> 30) & 0x3)
+#define C_SQ_CF_ALU_WORD0_KCACHE_MODE0 0x3FFFFFFF
+#define P_SQ_CF_ALU_WORD1
+#define S_SQ_CF_ALU_WORD1_KCACHE_MODE1(x) (((x) & 0x3) << 0)
+#define G_SQ_CF_ALU_WORD1_KCACHE_MODE1(x) (((x) >> 0) & 0x3)
+#define C_SQ_CF_ALU_WORD1_KCACHE_MODE1 0xFFFFFFFC
+#define S_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x) (((x) & 0xFF) << 2)
+#define G_SQ_CF_ALU_WORD1_KCACHE_ADDR0(x) (((x) >> 2) & 0xFF)
+#define C_SQ_CF_ALU_WORD1_KCACHE_ADDR0 0xFFFFFC03
+#define S_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x) (((x) & 0xFF) << 10)
+#define G_SQ_CF_ALU_WORD1_KCACHE_ADDR1(x) (((x) >> 10) & 0xFF)
+#define C_SQ_CF_ALU_WORD1_KCACHE_ADDR1 0xFFFC03FF
+#define S_SQ_CF_ALU_WORD1_COUNT(x) (((x) & 0x7F) << 18)
+#define G_SQ_CF_ALU_WORD1_COUNT(x) (((x) >> 18) & 0x7F)
+#define C_SQ_CF_ALU_WORD1_COUNT 0xFE03FFFF
+#define S_SQ_CF_ALU_WORD1_ALT_CONST(x) (((x) & 0x1) << 25)
+#define G_SQ_CF_ALU_WORD1_ALT_CONST(x) (((x) >> 25) & 0x1)
+#define C_SQ_CF_ALU_WORD1_ALT_CONST 0xFDFFFFFF
+#define S_SQ_CF_ALU_WORD1_CF_INST(x) (((x) & 0xF) << 26)
+#define G_SQ_CF_ALU_WORD1_CF_INST(x) (((x) >> 26) & 0xF)
+#define C_SQ_CF_ALU_WORD1_CF_INST 0xC3FFFFFF
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU 0x00000008
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE 0x00000009
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER 0x0000000A
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER 0x0000000B
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_EXTENDED 0x0000000C
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_CONTINUE 0x0000000D
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_BREAK 0x0000000E
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_ELSE_AFTER 0x0000000F
+#define S_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x) (((x) & 0x1) << 30)
+#define G_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x) (((x) >> 30) & 0x1)
+#define C_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
+#define S_SQ_CF_ALU_WORD1_BARRIER(x) (((x) & 0x1) << 31)
+#define G_SQ_CF_ALU_WORD1_BARRIER(x) (((x) >> 31) & 0x1)
+#define C_SQ_CF_ALU_WORD1_BARRIER 0x7FFFFFFF
+/* extended TODO */
+/* done */
+#define P_SQ_CF_ALLOC_EXPORT_WORD0
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x) (((x) & 0x1FFF) << 0)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE(x) (((x) >> 0) & 0x1FFF)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_ARRAY_BASE 0xFFFFE000
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x) (((x) & 0x3) << 13)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_TYPE(x) (((x) >> 13) & 0x3)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_TYPE 0xFFFF9FFF
+#define V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL 0x00000000
+#define V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_POS 0x00000001
+#define V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM 0x00000002
+#define V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE_IND_ACK 0x00000003
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x) (((x) & 0x7F) << 15)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(x) (((x) >> 15) & 0x7F)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR 0xFFC07FFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x) (((x) & 0x1) << 22)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL(x) (((x) >> 22) & 0x1)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_RW_REL 0xFFBFFFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x) (((x) & 0x7F) << 23)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR(x) (((x) >> 23) & 0x7F)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_INDEX_GPR 0xC07FFFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x) (((x) & 0x3) << 30)
+#define G_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE(x) (((x) >> 30) & 0x3)
+#define C_SQ_CF_ALLOC_EXPORT_WORD0_ELEM_SIZE 0x3FFFFFFF
+/* done */
+#define P_SQ_CF_ALLOC_EXPORT_WORD1
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x) (((x) & 0xF) << 16)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(x) (((x) >> 16) & 0xF)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT 0xFFF0FFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x) (((x) & 0x1) << 20)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE(x) (((x) >> 20) & 0x1)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_VALID_PIXEL_MODE 0xFFEFFFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x) (((x) & 0x1) << 21)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM(x) (((x) >> 21) & 0x1)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_END_OF_PROGRAM 0xFFDFFFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x) (((x) & 0xFF) << 22)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x) (((x) >> 22) & 0xFF)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST 0xC03FFFFF
+
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x) (((x) & 0x1) << 30)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_MARK(x) (((x) >> 30) & 0x1)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x) (((x) & 0x1) << 31)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER(x) (((x) >> 31) & 0x1)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_BARRIER 0x7FFFFFFF
+
+/* done */
+#define P_SQ_CF_ALLOC_EXPORT_WORD1_BUF
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x) (((x) & 0xFFF) << 0)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE(x) (((x) >> 0) & 0xFFF)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_ARRAY_SIZE 0xFFFFF000
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x) (((x) & 0xF) << 12)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK(x) (((x) >> 12) & 0xF)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_BUF_COMP_MASK 0xFFFF0FFF
+#define P_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x) (((x) & 0x7) << 0)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X(x) (((x) >> 0) & 0x7)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_X 0xFFFFFFF8
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x) (((x) & 0x7) << 3)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y(x) (((x) >> 3) & 0x7)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Y 0xFFFFFFC7
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x) (((x) & 0x7) << 6)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z(x) (((x) >> 6) & 0x7)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_Z 0xFFFFFE3F
+#define S_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x) (((x) & 0x7) << 9)
+#define G_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W(x) (((x) >> 9) & 0x7)
+#define C_SQ_CF_ALLOC_EXPORT_WORD1_SWIZ_SEL_W 0xFFFFF1FF
+
+/* done */
+#define P_SQ_ALU_WORD0
+#define S_SQ_ALU_WORD0_SRC0_SEL(x) (((x) & 0x1FF) << 0)
+#define G_SQ_ALU_WORD0_SRC0_SEL(x) (((x) >> 0) & 0x1FF)
+#define C_SQ_ALU_WORD0_SRC0_SEL 0xFFFFFE00
+
+/*
+ * 244 ALU_SRC_1_DBL_L: special constant 1.0 double-float, LSW. (RV670+)
+ * 245 ALU_SRC_1_DBL_M: special constant 1.0 double-float, MSW. (RV670+)
+ * 246 ALU_SRC_0_5_DBL_L: special constant 0.5 double-float, LSW. (RV670+)
+ * 247 ALU_SRC_0_5_DBL_M: special constant 0.5 double-float, MSW. (RV670+)
+ * 248 SQ_ALU_SRC_0: special constant 0.0.
+ * 249 SQ_ALU_SRC_1: special constant 1.0 float.
+ * 250 SQ_ALU_SRC_1_INT: special constant 1 integer.
+ * 251 SQ_ALU_SRC_M_1_INT: special constant -1 integer.
+ * 252 SQ_ALU_SRC_0_5: special constant 0.5 float.
+ * 253 SQ_ALU_SRC_LITERAL: literal constant.
+ * 254 SQ_ALU_SRC_PV: previous vector result.
+ * 255 SQ_ALU_SRC_PS: previous scalar result.
+ */
+#define V_SQ_ALU_SRC_0 0x000000F8
+#define V_SQ_ALU_SRC_1 0x000000F9
+#define V_SQ_ALU_SRC_1_INT 0x000000FA
+#define V_SQ_ALU_SRC_M_1_INT 0x000000FB
+#define V_SQ_ALU_SRC_0_5 0x000000FC
+#define V_SQ_ALU_SRC_LITERAL 0x000000FD
+#define S_SQ_ALU_WORD0_SRC0_REL(x) (((x) & 0x1) << 9)
+#define G_SQ_ALU_WORD0_SRC0_REL(x) (((x) >> 9) & 0x1)
+#define C_SQ_ALU_WORD0_SRC0_REL 0xFFFFFDFF
+#define S_SQ_ALU_WORD0_SRC0_CHAN(x) (((x) & 0x3) << 10)
+#define G_SQ_ALU_WORD0_SRC0_CHAN(x) (((x) >> 10) & 0x3)
+#define C_SQ_ALU_WORD0_SRC0_CHAN 0xFFFFF3FF
+#define S_SQ_ALU_WORD0_SRC0_NEG(x) (((x) & 0x1) << 12)
+#define G_SQ_ALU_WORD0_SRC0_NEG(x) (((x) >> 12) & 0x1)
+#define C_SQ_ALU_WORD0_SRC0_NEG 0xFFFFEFFF
+#define S_SQ_ALU_WORD0_SRC1_SEL(x) (((x) & 0x1FF) << 13)
+#define G_SQ_ALU_WORD0_SRC1_SEL(x) (((x) >> 13) & 0x1FF)
+#define C_SQ_ALU_WORD0_SRC1_SEL 0xFFC01FFF
+#define S_SQ_ALU_WORD0_SRC1_REL(x) (((x) & 0x1) << 22)
+#define G_SQ_ALU_WORD0_SRC1_REL(x) (((x) >> 22) & 0x1)
+#define C_SQ_ALU_WORD0_SRC1_REL 0xFFBFFFFF
+#define S_SQ_ALU_WORD0_SRC1_CHAN(x) (((x) & 0x3) << 23)
+#define G_SQ_ALU_WORD0_SRC1_CHAN(x) (((x) >> 23) & 0x3)
+#define C_SQ_ALU_WORD0_SRC1_CHAN 0xFE7FFFFF
+#define S_SQ_ALU_WORD0_SRC1_NEG(x) (((x) & 0x1) << 25)
+#define G_SQ_ALU_WORD0_SRC1_NEG(x) (((x) >> 25) & 0x1)
+#define C_SQ_ALU_WORD0_SRC1_NEG 0xFDFFFFFF
+#define S_SQ_ALU_WORD0_INDEX_MODE(x) (((x) & 0x7) << 26)
+#define G_SQ_ALU_WORD0_INDEX_MODE(x) (((x) >> 26) & 0x7)
+#define C_SQ_ALU_WORD0_INDEX_MODE 0xE3FFFFFF
+#define S_SQ_ALU_WORD0_PRED_SEL(x) (((x) & 0x3) << 29)
+#define G_SQ_ALU_WORD0_PRED_SEL(x) (((x) >> 29) & 0x3)
+#define C_SQ_ALU_WORD0_PRED_SEL 0x9FFFFFFF
+#define S_SQ_ALU_WORD0_LAST(x) (((x) & 0x1) << 31)
+#define G_SQ_ALU_WORD0_LAST(x) (((x) >> 31) & 0x1)
+#define C_SQ_ALU_WORD0_LAST 0x7FFFFFFF
+/* same */
+#define P_SQ_ALU_WORD1
+#define S_SQ_ALU_WORD1_ENCODING(x) (((x) & 0x7) << 15)
+#define G_SQ_ALU_WORD1_ENCODING(x) (((x) >> 15) & 0x7)
+#define C_SQ_ALU_WORD1_ENCODING 0xFFFC7FFF
+#define S_SQ_ALU_WORD1_BANK_SWIZZLE(x) (((x) & 0x7) << 18)
+#define G_SQ_ALU_WORD1_BANK_SWIZZLE(x) (((x) >> 18) & 0x7)
+#define C_SQ_ALU_WORD1_BANK_SWIZZLE 0xFFE3FFFF
+#define S_SQ_ALU_WORD1_DST_GPR(x) (((x) & 0x7F) << 21)
+#define G_SQ_ALU_WORD1_DST_GPR(x) (((x) >> 21) & 0x7F)
+#define C_SQ_ALU_WORD1_DST_GPR 0xF01FFFFF
+#define S_SQ_ALU_WORD1_DST_REL(x) (((x) & 0x1) << 28)
+#define G_SQ_ALU_WORD1_DST_REL(x) (((x) >> 28) & 0x1)
+#define C_SQ_ALU_WORD1_DST_REL 0xEFFFFFFF
+#define S_SQ_ALU_WORD1_DST_CHAN(x) (((x) & 0x3) << 29)
+#define G_SQ_ALU_WORD1_DST_CHAN(x) (((x) >> 29) & 0x3)
+#define C_SQ_ALU_WORD1_DST_CHAN 0x9FFFFFFF
+#define S_SQ_ALU_WORD1_CLAMP(x) (((x) & 0x1) << 31)
+#define G_SQ_ALU_WORD1_CLAMP(x) (((x) >> 31) & 0x1)
+#define C_SQ_ALU_WORD1_CLAMP 0x7FFFFFFF
+/* same except maybe encoding */
+#define P_SQ_ALU_WORD1_OP2
+#define S_SQ_ALU_WORD1_OP2_SRC0_ABS(x) (((x) & 0x1) << 0)
+#define G_SQ_ALU_WORD1_OP2_SRC0_ABS(x) (((x) >> 0) & 0x1)
+#define C_SQ_ALU_WORD1_OP2_SRC0_ABS 0xFFFFFFFE
+#define S_SQ_ALU_WORD1_OP2_SRC1_ABS(x) (((x) & 0x1) << 1)
+#define G_SQ_ALU_WORD1_OP2_SRC1_ABS(x) (((x) >> 1) & 0x1)
+#define C_SQ_ALU_WORD1_OP2_SRC1_ABS 0xFFFFFFFD
+#define S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x) (((x) & 0x1) << 2)
+#define G_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(x) (((x) >> 2) & 0x1)
+#define C_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK 0xFFFFFFFB
+#define S_SQ_ALU_WORD1_OP2_UPDATE_PRED(x) (((x) & 0x1) << 3)
+#define G_SQ_ALU_WORD1_OP2_UPDATE_PRED(x) (((x) >> 3) & 0x1)
+#define C_SQ_ALU_WORD1_OP2_UPDATE_PRED 0xFFFFFFF7
+#define S_SQ_ALU_WORD1_OP2_WRITE_MASK(x) (((x) & 0x1) << 4)
+#define G_SQ_ALU_WORD1_OP2_WRITE_MASK(x) (((x) >> 4) & 0x1)
+#define C_SQ_ALU_WORD1_OP2_WRITE_MASK 0xFFFFFFEF
+#define S_SQ_ALU_WORD1_OP2_OMOD(x) (((x) & 0x3) << 5)
+#define G_SQ_ALU_WORD1_OP2_OMOD(x) (((x) >> 5) & 0x3)
+#define C_SQ_ALU_WORD1_OP2_OMOD 0xFFFFFF9F
+#define S_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) & 0x7FF) << 7)
+#define G_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) >> 7) & 0x7FF)
+#define C_SQ_ALU_WORD1_OP2_ALU_INST 0xFFFC007F
+
+#define P_SQ_ALU_WORD1_OP3
+#define S_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) & 0x1FF) << 0)
+#define G_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) >> 0) & 0x1FF)
+#define C_SQ_ALU_WORD1_OP3_SRC2_SEL 0xFFFFFE00
+#define S_SQ_ALU_WORD1_OP3_SRC2_REL(x) (((x) & 0x1) << 9)
+#define G_SQ_ALU_WORD1_OP3_SRC2_REL(x) (((x) >> 9) & 0x1)
+#define C_SQ_ALU_WORD1_OP3_SRC2_REL 0xFFFFFDFF
+#define S_SQ_ALU_WORD1_OP3_SRC2_CHAN(x) (((x) & 0x3) << 10)
+#define G_SQ_ALU_WORD1_OP3_SRC2_CHAN(x) (((x) >> 10) & 0x3)
+#define C_SQ_ALU_WORD1_OP3_SRC2_CHAN 0xFFFFF3FF
+#define S_SQ_ALU_WORD1_OP3_SRC2_NEG(x) (((x) & 0x1) << 12)
+#define G_SQ_ALU_WORD1_OP3_SRC2_NEG(x) (((x) >> 12) & 0x1)
+#define C_SQ_ALU_WORD1_OP3_SRC2_NEG 0xFFFFEFFF
+#define S_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) & 0x1F) << 13)
+#define G_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) >> 13) & 0x1F)
+#define C_SQ_ALU_WORD1_OP3_ALU_INST 0xFFFC1FFF
+/* TODO ADD OTHER OP3 */
+/* done */
+#define P_SQ_VTX_WORD0
+#define S_SQ_VTX_WORD0_VTX_INST(x) (((x) & 0x1F) << 0)
+#define G_SQ_VTX_WORD0_VTX_INST(x) (((x) >> 0) & 0x1F)
+#define C_SQ_VTX_WORD0_VTX_INST 0xFFFFFFE0
+#define S_SQ_VTX_WORD0_FETCH_TYPE(x) (((x) & 0x3) << 5)
+#define G_SQ_VTX_WORD0_FETCH_TYPE(x) (((x) >> 5) & 0x3)
+#define C_SQ_VTX_WORD0_FETCH_TYPE 0xFFFFFF9F
+#define S_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x) (((x) & 0x1) << 7)
+#define G_SQ_VTX_WORD0_FETCH_WHOLE_QUAD(x) (((x) >> 7) & 0x1)
+#define C_SQ_VTX_WORD0_FETCH_WHOLE_QUAD 0xFFFFFF7F
+#define S_SQ_VTX_WORD0_BUFFER_ID(x) (((x) & 0xFF) << 8)
+#define G_SQ_VTX_WORD0_BUFFER_ID(x) (((x) >> 8) & 0xFF)
+#define C_SQ_VTX_WORD0_BUFFER_ID 0xFFFF00FF
+#define S_SQ_VTX_WORD0_SRC_GPR(x) (((x) & 0x7F) << 16)
+#define G_SQ_VTX_WORD0_SRC_GPR(x) (((x) >> 16) & 0x7F)
+#define C_SQ_VTX_WORD0_SRC_GPR 0xFF80FFFF
+#define S_SQ_VTX_WORD0_SRC_REL(x) (((x) & 0x1) << 23)
+#define G_SQ_VTX_WORD0_SRC_REL(x) (((x) >> 23) & 0x1)
+#define C_SQ_VTX_WORD0_SRC_REL 0xFF7FFFFF
+#define S_SQ_VTX_WORD0_SRC_SEL_X(x) (((x) & 0x3) << 24)
+#define G_SQ_VTX_WORD0_SRC_SEL_X(x) (((x) >> 24) & 0x3)
+#define C_SQ_VTX_WORD0_SRC_SEL_X 0xFCFFFFFF
+#define S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x) (((x) & 0x3F) << 26)
+#define G_SQ_VTX_WORD0_MEGA_FETCH_COUNT(x) (((x) >> 26) & 0x3F)
+#define C_SQ_VTX_WORD0_MEGA_FETCH_COUNT 0x03FFFFFF
+/* same WORD 0 */
+#define P_SQ_VTX_WORD1
+#define S_SQ_VTX_WORD1_DST_SEL_X(x) (((x) & 0x7) << 9)
+#define G_SQ_VTX_WORD1_DST_SEL_X(x) (((x) >> 9) & 0x7)
+#define C_SQ_VTX_WORD1_DST_SEL_X 0xFFFFF1FF
+#define S_SQ_VTX_WORD1_DST_SEL_Y(x) (((x) & 0x7) << 12)
+#define G_SQ_VTX_WORD1_DST_SEL_Y(x) (((x) >> 12) & 0x7)
+#define C_SQ_VTX_WORD1_DST_SEL_Y 0xFFFF8FFF
+#define S_SQ_VTX_WORD1_DST_SEL_Z(x) (((x) & 0x7) << 15)
+#define G_SQ_VTX_WORD1_DST_SEL_Z(x) (((x) >> 15) & 0x7)
+#define C_SQ_VTX_WORD1_DST_SEL_Z 0xFFFC7FFF
+#define S_SQ_VTX_WORD1_DST_SEL_W(x) (((x) & 0x7) << 18)
+#define G_SQ_VTX_WORD1_DST_SEL_W(x) (((x) >> 18) & 0x7)
+#define C_SQ_VTX_WORD1_DST_SEL_W 0xFFE3FFFF
+#define S_SQ_VTX_WORD1_USE_CONST_FIELDS(x) (((x) & 0x1) << 21)
+#define G_SQ_VTX_WORD1_USE_CONST_FIELDS(x) (((x) >> 21) & 0x1)
+#define C_SQ_VTX_WORD1_USE_CONST_FIELDS 0xFFDFFFFF
+#define S_SQ_VTX_WORD1_DATA_FORMAT(x) (((x) & 0x3F) << 22)
+#define G_SQ_VTX_WORD1_DATA_FORMAT(x) (((x) >> 22) & 0x3F)
+#define C_SQ_VTX_WORD1_DATA_FORMAT 0xF03FFFFF
+#define S_SQ_VTX_WORD1_NUM_FORMAT_ALL(x) (((x) & 0x3) << 28)
+#define G_SQ_VTX_WORD1_NUM_FORMAT_ALL(x) (((x) >> 28) & 0x3)
+#define C_SQ_VTX_WORD1_NUM_FORMAT_ALL 0xCFFFFFFF
+#define S_SQ_VTX_WORD1_FORMAT_COMP_ALL(x) (((x) & 0x1) << 30)
+#define G_SQ_VTX_WORD1_FORMAT_COMP_ALL(x) (((x) >> 30) & 0x1)
+#define C_SQ_VTX_WORD1_FORMAT_COMP_ALL 0xBFFFFFFF
+#define S_SQ_VTX_WORD1_SRF_MODE_ALL(x) (((x) & 0x1) << 31)
+#define G_SQ_VTX_WORD1_SRF_MODE_ALL(x) (((x) >> 31) & 0x1)
+#define C_SQ_VTX_WORD1_SRF_MODE_ALL 0x7FFFFFFF
+/* same WORD1 generic */
+#define P_SQ_VTX_WORD1_GPR
+#define S_SQ_VTX_WORD1_GPR_DST_GPR(x) (((x) & 0x7F) << 0)
+#define G_SQ_VTX_WORD1_GPR_DST_GPR(x) (((x) >> 0) & 0x7F)
+#define C_SQ_VTX_WORD1_GPR_DST_GPR 0xFFFFFF80
+#define S_SQ_VTX_WORD1_GPR_DST_REL(x) (((x) & 0x1) << 7)
+#define G_SQ_VTX_WORD1_GPR_DST_REL(x) (((x) >> 7) & 0x1)
+#define C_SQ_VTX_WORD1_GPR_DST_REL 0xFFFFFF7F
+#define P_SQ_VTX_WORD1_SEM
+#define S_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x) (((x) & 0xFF) << 0)
+#define G_SQ_VTX_WORD1_SEM_SEMANTIC_ID(x) (((x) >> 0) & 0xFF)
+#define C_SQ_VTX_WORD1_SEM_SEMANTIC_ID 0xFFFFFF00
+#define P_SQ_VTX_WORD2
+#define S_SQ_VTX_WORD2_OFFSET(x) (((x) & 0xFFFF) << 0)
+#define G_SQ_VTX_WORD2_OFFSET(x) (((x) >> 0) & 0xFFFF)
+#define C_SQ_VTX_WORD2_OFFSET 0xFFFF0000
+#define S_SQ_VTX_WORD2_ENDIAN_SWAP(x) (((x) & 0x3) << 16)
+#define G_SQ_VTX_WORD2_ENDIAN_SWAP(x) (((x) >> 16) & 0x3)
+#define C_SQ_VTX_WORD2_ENDIAN_SWAP 0xFFFCFFFF
+#define S_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x) (((x) & 0x1) << 18)
+#define G_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE(x) (((x) >> 18) & 0x1)
+#define C_SQ_VTX_WORD2_CONST_BUF_NO_STRIDE 0xFFFBFFFF
+#define S_SQ_VTX_WORD2_MEGA_FETCH(x) (((x) & 0x1) << 19)
+#define G_SQ_VTX_WORD2_MEGA_FETCH(x) (((x) >> 19) & 0x1)
+#define C_SQ_VTX_WORD2_MEGA_FETCH 0xFFF7FFFF
+#define S_SQ_VTX_WORD2_ALT_CONST(x) (((x) & 0x1) << 20)
+#define G_SQ_VTX_WORD2_ALT_CONST(x) (((x) >> 20) & 0x1)
+#define C_SQ_VTX_WORD2_ALT_CONST 0xFFEFFFFF
+#define S_SQ_VTX_WORD2_BIM(x) (((x) & 0x3) << 21)
+#define G_SQ_VTX_WORD2_BIM(x) (((x) >> 21) & 0x3)
+#define C_SQ_VTX_WORD2_BIM 0xFF9FFFFF
+/* done */
+
+#define P_SQ_TEX_WORD0
+#define S_SQ_TEX_WORD0_TEX_INST(x) (((x) & 0x1F) << 0)
+#define G_SQ_TEX_WORD0_TEX_INST(x) (((x) >> 0) & 0x1F)
+#define C_SQ_TEX_WORD0_TEX_INST 0xFFFFFFE0
+#define S_SQ_TEX_WORD0_INST_MOD(x) (((x) & 0x3) << 5)
+#define G_SQ_TEX_WORD0_INST_MOD(x) (((x) >> 5) & 0x3)
+#define C_SQ_TEX_WORD0_INST_MOD 0xFFFFFF9F
+#define S_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x) (((x) & 0x1) << 7)
+#define G_SQ_TEX_WORD0_FETCH_WHOLE_QUAD(x) (((x) >> 7) & 0x1)
+#define C_SQ_TEX_WORD0_FETCH_WHOLE_QUAD 0xFFFFFF7F
+#define S_SQ_TEX_WORD0_RESOURCE_ID(x) (((x) & 0xFF) << 8)
+#define G_SQ_TEX_WORD0_RESOURCE_ID(x) (((x) >> 8) & 0xFF)
+#define C_SQ_TEX_WORD0_RESOURCE_ID 0xFFFF00FF
+#define S_SQ_TEX_WORD0_SRC_GPR(x) (((x) & 0x7F) << 16)
+#define G_SQ_TEX_WORD0_SRC_GPR(x) (((x) >> 16) & 0x7F)
+#define C_SQ_TEX_WORD0_SRC_GPR 0xFF80FFFF
+#define S_SQ_TEX_WORD0_SRC_REL(x) (((x) & 0x1) << 23)
+#define G_SQ_TEX_WORD0_SRC_REL(x) (((x) >> 23) & 0x1)
+#define C_SQ_TEX_WORD0_SRC_REL 0xFF7FFFFF
+#define S_SQ_TEX_WORD0_ALT_CONST(x) (((x) & 0x1) << 24)
+#define G_SQ_TEX_WORD0_ALT_CONST(x) (((x) >> 24) & 0x1)
+#define C_SQ_TEX_WORD0_ALT_CONST 0xFEFFFFFF
+#define S_SQ_TEX_WORD0_RIM(x) (((x) & 0x3) << 25)
+#define G_SQ_TEX_WORD0_RIM(x) (((x) >> 25) & 0x3)
+#define C_SQ_TEX_WORD0_RIM 0xF9FFFFFF
+#define S_SQ_TEX_WORD0_SIM(x) (((x) & 0x3) << 27)
+#define G_SQ_TEX_WORD0_SIM(x) (((x) >> 27) & 0x3)
+#define C_SQ_TEX_WORD0_SIM 0xE7FFFFFF
+#define P_SQ_TEX_WORD1
+#define S_SQ_TEX_WORD1_DST_GPR(x) (((x) & 0x7F) << 0)
+#define G_SQ_TEX_WORD1_DST_GPR(x) (((x) >> 0) & 0x7F)
+#define C_SQ_TEX_WORD1_DST_GPR 0xFFFFFF80
+#define S_SQ_TEX_WORD1_DST_REL(x) (((x) & 0x1) << 7)
+#define G_SQ_TEX_WORD1_DST_REL(x) (((x) >> 7) & 0x1)
+#define C_SQ_TEX_WORD1_DST_REL 0xFFFFFF7F
+#define S_SQ_TEX_WORD1_DST_SEL_X(x) (((x) & 0x7) << 9)
+#define G_SQ_TEX_WORD1_DST_SEL_X(x) (((x) >> 9) & 0x7)
+#define C_SQ_TEX_WORD1_DST_SEL_X 0xFFFFF1FF
+#define S_SQ_TEX_WORD1_DST_SEL_Y(x) (((x) & 0x7) << 12)
+#define G_SQ_TEX_WORD1_DST_SEL_Y(x) (((x) >> 12) & 0x7)
+#define C_SQ_TEX_WORD1_DST_SEL_Y 0xFFFF8FFF
+#define S_SQ_TEX_WORD1_DST_SEL_Z(x) (((x) & 0x7) << 15)
+#define G_SQ_TEX_WORD1_DST_SEL_Z(x) (((x) >> 15) & 0x7)
+#define C_SQ_TEX_WORD1_DST_SEL_Z 0xFFFC7FFF
+#define S_SQ_TEX_WORD1_DST_SEL_W(x) (((x) & 0x7) << 18)
+#define G_SQ_TEX_WORD1_DST_SEL_W(x) (((x) >> 18) & 0x7)
+#define C_SQ_TEX_WORD1_DST_SEL_W 0xFFE3FFFF
+#define S_SQ_TEX_WORD1_LOD_BIAS(x) (((x) & 0x7F) << 21)
+#define G_SQ_TEX_WORD1_LOD_BIAS(x) (((x) >> 21) & 0x7F)
+#define C_SQ_TEX_WORD1_LOD_BIAS 0xF01FFFFF
+#define S_SQ_TEX_WORD1_COORD_TYPE_X(x) (((x) & 0x1) << 28)
+#define G_SQ_TEX_WORD1_COORD_TYPE_X(x) (((x) >> 28) & 0x1)
+#define C_SQ_TEX_WORD1_COORD_TYPE_X 0xEFFFFFFF
+#define V_SQ_TEX_WORD1_COORD_UNNORMALIZED 0x00000000
+#define V_SQ_TEX_WORD1_COORD_NORMALIZED 0x00000001
+#define S_SQ_TEX_WORD1_COORD_TYPE_Y(x) (((x) & 0x1) << 29)
+#define G_SQ_TEX_WORD1_COORD_TYPE_Y(x) (((x) >> 29) & 0x1)
+#define C_SQ_TEX_WORD1_COORD_TYPE_Y 0xDFFFFFFF
+#define S_SQ_TEX_WORD1_COORD_TYPE_Z(x) (((x) & 0x1) << 30)
+#define G_SQ_TEX_WORD1_COORD_TYPE_Z(x) (((x) >> 30) & 0x1)
+#define C_SQ_TEX_WORD1_COORD_TYPE_Z 0xBFFFFFFF
+#define S_SQ_TEX_WORD1_COORD_TYPE_W(x) (((x) & 0x1) << 31)
+#define G_SQ_TEX_WORD1_COORD_TYPE_W(x) (((x) >> 31) & 0x1)
+#define C_SQ_TEX_WORD1_COORD_TYPE_W 0x7FFFFFFF
+#define P_SQ_TEX_WORD2
+#define S_SQ_TEX_WORD2_OFFSET_X(x) (((x) & 0x1F) << 0)
+#define G_SQ_TEX_WORD2_OFFSET_X(x) (((x) >> 0) & 0x1F)
+#define C_SQ_TEX_WORD2_OFFSET_X 0xFFFFFFE0
+#define S_SQ_TEX_WORD2_OFFSET_Y(x) (((x) & 0x1F) << 5)
+#define G_SQ_TEX_WORD2_OFFSET_Y(x) (((x) >> 5) & 0x1F)
+#define C_SQ_TEX_WORD2_OFFSET_Y 0xFFFFFC1F
+#define S_SQ_TEX_WORD2_OFFSET_Z(x) (((x) & 0x1F) << 10)
+#define G_SQ_TEX_WORD2_OFFSET_Z(x) (((x) >> 10) & 0x1F)
+#define C_SQ_TEX_WORD2_OFFSET_Z 0xFFFF83FF
+#define S_SQ_TEX_WORD2_SAMPLER_ID(x) (((x) & 0x1F) << 15)
+#define G_SQ_TEX_WORD2_SAMPLER_ID(x) (((x) >> 15) & 0x1F)
+#define C_SQ_TEX_WORD2_SAMPLER_ID 0xFFF07FFF
+#define S_SQ_TEX_WORD2_SRC_SEL_X(x) (((x) & 0x7) << 20)
+#define G_SQ_TEX_WORD2_SRC_SEL_X(x) (((x) >> 20) & 0x7)
+#define C_SQ_TEX_WORD2_SRC_SEL_X 0xFF8FFFFF
+#define S_SQ_TEX_WORD2_SRC_SEL_Y(x) (((x) & 0x7) << 23)
+#define G_SQ_TEX_WORD2_SRC_SEL_Y(x) (((x) >> 23) & 0x7)
+#define C_SQ_TEX_WORD2_SRC_SEL_Y 0xFC7FFFFF
+#define S_SQ_TEX_WORD2_SRC_SEL_Z(x) (((x) & 0x7) << 26)
+#define G_SQ_TEX_WORD2_SRC_SEL_Z(x) (((x) >> 26) & 0x7)
+#define C_SQ_TEX_WORD2_SRC_SEL_Z 0xE3FFFFFF
+#define S_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) & 0x7) << 29)
+#define G_SQ_TEX_WORD2_SRC_SEL_W(x) (((x) >> 29) & 0x7)
+#define C_SQ_TEX_WORD2_SRC_SEL_W 0x1FFFFFFF
+
+#define V_SQ_CF_COND_ACTIVE 0x00
+#define V_SQ_CF_COND_FALSE 0x01
+#define V_SQ_CF_COND_BOOL 0x02
+#define V_SQ_CF_COND_NOT_BOOL 0x03
+
+#define V_SQ_REL_ABSOLUTE 0
+#define V_SQ_REL_RELATIVE 1
+#endif
diff --git a/src/gallium/drivers/r600/eg_state_inlines.h b/src/gallium/drivers/r600/eg_state_inlines.h
new file mode 100644
index 0000000000..4e3514638b
--- /dev/null
+++ b/src/gallium/drivers/r600/eg_state_inlines.h
@@ -0,0 +1,434 @@
+/*
+ * Copyright 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+#ifndef EG_STATE_INLINES_H
+#define EG_STATE_INLINES_H
+
+#include "util/u_format.h"
+#include "evergreend.h"
+
+static INLINE uint32_t r600_translate_blend_function(int blend_func)
+{
+ switch (blend_func) {
+ case PIPE_BLEND_ADD:
+ return V_028780_COMB_DST_PLUS_SRC;
+ case PIPE_BLEND_SUBTRACT:
+ return V_028780_COMB_SRC_MINUS_DST;
+ case PIPE_BLEND_REVERSE_SUBTRACT:
+ return V_028780_COMB_DST_MINUS_SRC;
+ case PIPE_BLEND_MIN:
+ return V_028780_COMB_MIN_DST_SRC;
+ case PIPE_BLEND_MAX:
+ return V_028780_COMB_MAX_DST_SRC;
+ default:
+ R600_ERR("Unknown blend function %d\n", blend_func);
+ assert(0);
+ break;
+ }
+ return 0;
+}
+
+static INLINE uint32_t r600_translate_blend_factor(int blend_fact)
+{
+ switch (blend_fact) {
+ case PIPE_BLENDFACTOR_ONE:
+ return V_028780_BLEND_ONE;
+ case PIPE_BLENDFACTOR_SRC_COLOR:
+ return V_028780_BLEND_SRC_COLOR;
+ case PIPE_BLENDFACTOR_SRC_ALPHA:
+ return V_028780_BLEND_SRC_ALPHA;
+ case PIPE_BLENDFACTOR_DST_ALPHA:
+ return V_028780_BLEND_DST_ALPHA;
+ case PIPE_BLENDFACTOR_DST_COLOR:
+ return V_028780_BLEND_DST_COLOR;
+ case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE:
+ return V_028780_BLEND_SRC_ALPHA_SATURATE;
+ case PIPE_BLENDFACTOR_CONST_COLOR:
+ return V_028780_BLEND_CONST_COLOR;
+ case PIPE_BLENDFACTOR_CONST_ALPHA:
+ return V_028780_BLEND_CONST_ALPHA;
+ case PIPE_BLENDFACTOR_ZERO:
+ return V_028780_BLEND_ZERO;
+ case PIPE_BLENDFACTOR_INV_SRC_COLOR:
+ return V_028780_BLEND_ONE_MINUS_SRC_COLOR;
+ case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
+ return V_028780_BLEND_ONE_MINUS_SRC_ALPHA;
+ case PIPE_BLENDFACTOR_INV_DST_ALPHA:
+ return V_028780_BLEND_ONE_MINUS_DST_ALPHA;
+ case PIPE_BLENDFACTOR_INV_DST_COLOR:
+ return V_028780_BLEND_ONE_MINUS_DST_COLOR;
+ case PIPE_BLENDFACTOR_INV_CONST_COLOR:
+ return V_028780_BLEND_ONE_MINUS_CONST_COLOR;
+ case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
+ return V_028780_BLEND_ONE_MINUS_CONST_ALPHA;
+ case PIPE_BLENDFACTOR_SRC1_COLOR:
+ return V_028780_BLEND_SRC1_COLOR;
+ case PIPE_BLENDFACTOR_SRC1_ALPHA:
+ return V_028780_BLEND_SRC1_ALPHA;
+ case PIPE_BLENDFACTOR_INV_SRC1_COLOR:
+ return V_028780_BLEND_INV_SRC1_COLOR;
+ case PIPE_BLENDFACTOR_INV_SRC1_ALPHA:
+ return V_028780_BLEND_INV_SRC1_ALPHA;
+ default:
+ R600_ERR("Bad blend factor %d not supported!\n", blend_fact);
+ assert(0);
+ break;
+ }
+ return 0;
+}
+
+static INLINE uint32_t r600_translate_stencil_op(int s_op)
+{
+ switch (s_op) {
+ case PIPE_STENCIL_OP_KEEP:
+ return V_028800_STENCIL_KEEP;
+ case PIPE_STENCIL_OP_ZERO:
+ return V_028800_STENCIL_ZERO;
+ case PIPE_STENCIL_OP_REPLACE:
+ return V_028800_STENCIL_REPLACE;
+ case PIPE_STENCIL_OP_INCR:
+ return V_028800_STENCIL_INCR;
+ case PIPE_STENCIL_OP_DECR:
+ return V_028800_STENCIL_DECR;
+ case PIPE_STENCIL_OP_INCR_WRAP:
+ return V_028800_STENCIL_INCR_WRAP;
+ case PIPE_STENCIL_OP_DECR_WRAP:
+ return V_028800_STENCIL_DECR_WRAP;
+ case PIPE_STENCIL_OP_INVERT:
+ return V_028800_STENCIL_INVERT;
+ default:
+ R600_ERR("Unknown stencil op %d", s_op);
+ assert(0);
+ break;
+ }
+ return 0;
+}
+
+/* translates straight */
+static INLINE uint32_t r600_translate_ds_func(int func)
+{
+ return func;
+}
+
+static inline unsigned r600_tex_wrap(unsigned wrap)
+{
+ switch (wrap) {
+ default:
+ case PIPE_TEX_WRAP_REPEAT:
+ return V_03C000_SQ_TEX_WRAP;
+ case PIPE_TEX_WRAP_CLAMP:
+ return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL;
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ return V_03C000_SQ_TEX_CLAMP_HALF_BORDER;
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ return V_03C000_SQ_TEX_CLAMP_BORDER;
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ return V_03C000_SQ_TEX_MIRROR;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_BORDER;
+ }
+}
+
+static inline unsigned r600_tex_filter(unsigned filter)
+{
+ switch (filter) {
+ default:
+ case PIPE_TEX_FILTER_NEAREST:
+ return V_03C000_SQ_TEX_XY_FILTER_POINT;
+ case PIPE_TEX_FILTER_LINEAR:
+ return V_03C000_SQ_TEX_XY_FILTER_BILINEAR;
+ }
+}
+
+static inline unsigned r600_tex_mipfilter(unsigned filter)
+{
+ switch (filter) {
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ return V_03C000_SQ_TEX_Z_FILTER_POINT;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ return V_03C000_SQ_TEX_Z_FILTER_LINEAR;
+ default:
+ case PIPE_TEX_MIPFILTER_NONE:
+ return V_03C000_SQ_TEX_Z_FILTER_NONE;
+ }
+}
+
+static inline unsigned r600_tex_compare(unsigned compare)
+{
+ switch (compare) {
+ default:
+ case PIPE_FUNC_NEVER:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_NEVER;
+ case PIPE_FUNC_LESS:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_LESS;
+ case PIPE_FUNC_EQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_EQUAL;
+ case PIPE_FUNC_LEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_LESSEQUAL;
+ case PIPE_FUNC_GREATER:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATER;
+ case PIPE_FUNC_NOTEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_NOTEQUAL;
+ case PIPE_FUNC_GEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATEREQUAL;
+ case PIPE_FUNC_ALWAYS:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_ALWAYS;
+ }
+}
+
+static inline unsigned r600_tex_swizzle(unsigned swizzle)
+{
+ switch (swizzle) {
+ case PIPE_SWIZZLE_RED:
+ return V_030010_SQ_SEL_X;
+ case PIPE_SWIZZLE_GREEN:
+ return V_030010_SQ_SEL_Y;
+ case PIPE_SWIZZLE_BLUE:
+ return V_030010_SQ_SEL_Z;
+ case PIPE_SWIZZLE_ALPHA:
+ return V_030010_SQ_SEL_W;
+ case PIPE_SWIZZLE_ZERO:
+ return V_030010_SQ_SEL_0;
+ default:
+ case PIPE_SWIZZLE_ONE:
+ return V_030010_SQ_SEL_1;
+ }
+}
+
+static inline unsigned r600_format_type(unsigned format_type)
+{
+ switch (format_type) {
+ default:
+ case UTIL_FORMAT_TYPE_UNSIGNED:
+ return V_030010_SQ_FORMAT_COMP_UNSIGNED;
+ case UTIL_FORMAT_TYPE_SIGNED:
+ return V_030010_SQ_FORMAT_COMP_SIGNED;
+ case UTIL_FORMAT_TYPE_FIXED:
+ return V_030010_SQ_FORMAT_COMP_UNSIGNED_BIASED;
+ }
+}
+
+static inline unsigned r600_tex_dim(unsigned dim)
+{
+ switch (dim) {
+ default:
+ case PIPE_TEXTURE_1D:
+ return V_030000_SQ_TEX_DIM_1D;
+ case PIPE_TEXTURE_2D:
+ case PIPE_TEXTURE_RECT:
+ return V_030000_SQ_TEX_DIM_2D;
+ case PIPE_TEXTURE_3D:
+ return V_030000_SQ_TEX_DIM_3D;
+ case PIPE_TEXTURE_CUBE:
+ return V_030000_SQ_TEX_DIM_CUBEMAP;
+ }
+}
+
+static inline uint32_t r600_translate_dbformat(enum pipe_format format)
+{
+ switch (format) {
+ case PIPE_FORMAT_Z16_UNORM:
+ return V_028040_Z_16;
+ case PIPE_FORMAT_Z24X8_UNORM:
+ return V_028040_Z_24;
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return V_028040_Z_24;
+ default:
+ return ~0;
+ }
+}
+
+static inline uint32_t r600_translate_colorswap(enum pipe_format format)
+{
+ switch (format) {
+ /* 8-bit buffers. */
+ case PIPE_FORMAT_A8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_R8_UNORM:
+ case PIPE_FORMAT_R8_SNORM:
+ return V_028C70_SWAP_STD;
+
+ /* 16-bit buffers. */
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ return V_028C70_SWAP_STD_REV;
+
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
+ return V_028C70_SWAP_ALT;
+
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ case PIPE_FORMAT_B4G4R4X4_UNORM:
+ return V_028C70_SWAP_ALT;
+ /* 32-bit buffers. */
+
+ case PIPE_FORMAT_A8B8G8R8_SRGB:
+ return V_028C70_SWAP_STD_REV;
+ case PIPE_FORMAT_B8G8R8A8_SRGB:
+ return V_028C70_SWAP_ALT;
+
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ return V_028C70_SWAP_ALT;
+
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ return V_028C70_SWAP_ALT_REV;
+ case PIPE_FORMAT_R8G8B8A8_SNORM:
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ return V_028C70_SWAP_STD;
+
+ case PIPE_FORMAT_A8B8G8R8_UNORM:
+ case PIPE_FORMAT_X8B8G8R8_UNORM:
+ // case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
+ return V_028C70_SWAP_STD_REV;
+
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return V_028C70_SWAP_STD;
+
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ case PIPE_FORMAT_R10G10B10X2_SNORM:
+ case PIPE_FORMAT_B10G10R10A2_UNORM:
+ case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
+ return V_028C70_SWAP_STD_REV;
+
+ /* 64-bit buffers. */
+ case PIPE_FORMAT_R16G16B16A16_UNORM:
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ // return V_028C70_COLOR_16_16_16_16;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ // return V_028C70_COLOR_16_16_16_16_FLOAT;
+
+ /* 128-bit buffers. */
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ // return V_028C70_COLOR_32_32_32_32_FLOAT;
+ return 0;
+ default:
+ R600_ERR("unsupported colorswap format %d\n", format);
+ return ~0;
+ }
+ return ~0;
+}
+
+static INLINE uint32_t r600_translate_colorformat(enum pipe_format format)
+{
+ switch (format) {
+ /* 8-bit buffers. */
+ case PIPE_FORMAT_A8_UNORM:
+ case PIPE_FORMAT_I8_UNORM:
+ case PIPE_FORMAT_L8_UNORM:
+ case PIPE_FORMAT_R8_UNORM:
+ case PIPE_FORMAT_R8_SNORM:
+ return V_028C70_COLOR_8;
+
+ /* 16-bit buffers. */
+ case PIPE_FORMAT_B5G6R5_UNORM:
+ return V_028C70_COLOR_5_6_5;
+
+ case PIPE_FORMAT_B5G5R5A1_UNORM:
+ case PIPE_FORMAT_B5G5R5X1_UNORM:
+ return V_028C70_COLOR_1_5_5_5;
+
+ case PIPE_FORMAT_B4G4R4A4_UNORM:
+ case PIPE_FORMAT_B4G4R4X4_UNORM:
+ return V_028C70_COLOR_4_4_4_4;
+
+ /* 32-bit buffers. */
+ case PIPE_FORMAT_A8B8G8R8_SRGB:
+ case PIPE_FORMAT_A8B8G8R8_UNORM:
+ case PIPE_FORMAT_A8R8G8B8_UNORM:
+ case PIPE_FORMAT_B8G8R8A8_SRGB:
+ case PIPE_FORMAT_B8G8R8A8_UNORM:
+ case PIPE_FORMAT_B8G8R8X8_UNORM:
+ case PIPE_FORMAT_R8G8B8A8_SNORM:
+ case PIPE_FORMAT_R8G8B8A8_UNORM:
+ case PIPE_FORMAT_R8G8B8X8_UNORM:
+ case PIPE_FORMAT_R8SG8SB8UX8U_NORM:
+ case PIPE_FORMAT_X8B8G8R8_UNORM:
+ case PIPE_FORMAT_X8R8G8B8_UNORM:
+ case PIPE_FORMAT_R8G8B8_UNORM:
+ return V_028C70_COLOR_8_8_8_8;
+
+ case PIPE_FORMAT_R10G10B10A2_UNORM:
+ case PIPE_FORMAT_R10G10B10X2_SNORM:
+ case PIPE_FORMAT_B10G10R10A2_UNORM:
+ case PIPE_FORMAT_R10SG10SB10SA2U_NORM:
+ return V_028C70_COLOR_10_10_10_2;
+
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ return V_028C70_COLOR_8_24;
+
+ case PIPE_FORMAT_R32_FLOAT:
+ return V_028C70_COLOR_32_FLOAT;
+
+ /* 64-bit buffers. */
+ case PIPE_FORMAT_R16G16B16A16_UNORM:
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ return V_028C70_COLOR_16_16_16_16;
+ case PIPE_FORMAT_R16G16B16A16_FLOAT:
+ return V_028C70_COLOR_16_16_16_16_FLOAT;
+ case PIPE_FORMAT_R32G32_FLOAT:
+ return V_028C70_COLOR_32_32_FLOAT;
+
+ /* 128-bit buffers. */
+ case PIPE_FORMAT_R32G32B32_FLOAT:
+ return V_028C70_COLOR_32_32_32_FLOAT;
+ case PIPE_FORMAT_R32G32B32A32_FLOAT:
+ return V_028C70_COLOR_32_32_32_32_FLOAT;
+
+ /* YUV buffers. */
+ case PIPE_FORMAT_UYVY:
+ case PIPE_FORMAT_YUYV:
+ default:
+ R600_ERR("unsupported color format %d\n", format);
+ return ~0; /* Unsupported. */
+ }
+}
+
+static INLINE boolean r600_is_sampler_format_supported(enum pipe_format format)
+{
+ return r600_translate_texformat(format, NULL, NULL, NULL) != ~0;
+}
+
+static INLINE boolean r600_is_colorbuffer_format_supported(enum pipe_format format)
+{
+ return r600_translate_colorformat(format) != ~0 &&
+ r600_translate_colorswap(format) != ~0;
+}
+
+static INLINE boolean r600_is_zs_format_supported(enum pipe_format format)
+{
+ return r600_translate_dbformat(format) != ~0;
+}
+
+static INLINE boolean r600_is_vertex_format_supported(enum pipe_format format)
+{
+ return r600_translate_colorformat(format) != ~0;
+}
+
+#endif
diff --git a/src/gallium/drivers/r600/eg_states_inc.h b/src/gallium/drivers/r600/eg_states_inc.h
new file mode 100644
index 0000000000..462f31cc79
--- /dev/null
+++ b/src/gallium/drivers/r600/eg_states_inc.h
@@ -0,0 +1,454 @@
+/* This file is autogenerated from eg_states.h - do not edit directly */
+/* autogenerating script is gen_eg_states.py */
+
+/* EG_CONFIG */
+#define EG_CONFIG__SQ_CONFIG 0
+#define EG_CONFIG__SPI_CONFIG_CNTL 1
+#define EG_CONFIG__SPI_CONFIG_CNTL_1 2
+#define EG_CONFIG__SQ_GPR_RESOURCE_MGMT_1 3
+#define EG_CONFIG__SQ_GPR_RESOURCE_MGMT_2 4
+#define EG_CONFIG__SQ_GPR_RESOURCE_MGMT_3 5
+#define EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_1 6
+#define EG_CONFIG__SQ_THREAD_RESOURCE_MGMT_2 7
+#define EG_CONFIG__SQ_STACK_RESOURCE_MGMT_1 8
+#define EG_CONFIG__SQ_STACK_RESOURCE_MGMT_2 9
+#define EG_CONFIG__SQ_STACK_RESOURCE_MGMT_3 10
+#define EG_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 11
+#define EG_CONFIG__PA_CL_ENHANCE 12
+#define EG_CONFIG__SQ_DYN_GPR_RESOURCE_LIMIT_1 13
+#define EG_CONFIG__SQ_LDS_ALLOC_PS 14
+#define EG_CONFIG__SX_MISC 15
+#define EG_CONFIG__SQ_ESGS_RING_ITEMSIZE 16
+#define EG_CONFIG__SQ_GSVS_RING_ITEMSIZE 17
+#define EG_CONFIG__SQ_ESTMP_RING_ITEMSIZE 18
+#define EG_CONFIG__SQ_GSTMP_RING_ITEMSIZE 19
+#define EG_CONFIG__SQ_VSTMP_RING_ITEMSIZE 20
+#define EG_CONFIG__SQ_PSTMP_RING_ITEMSIZE 21
+#define EG_CONFIG__SQ_GS_VERT_ITEMSIZE 22
+#define EG_CONFIG__SQ_GS_VERT_ITEMSIZE_1 23
+#define EG_CONFIG__SQ_GS_VERT_ITEMSIZE_2 24
+#define EG_CONFIG__SQ_GS_VERT_ITEMSIZE_3 25
+#define EG_CONFIG__VGT_OUTPUT_PATH_CNTL 26
+#define EG_CONFIG__VGT_HOS_CNTL 27
+#define EG_CONFIG__VGT_HOS_MAX_TESS_LEVEL 28
+#define EG_CONFIG__VGT_HOS_MIN_TESS_LEVEL 29
+#define EG_CONFIG__VGT_HOS_REUSE_DEPTH 30
+#define EG_CONFIG__VGT_GROUP_PRIM_TYPE 31
+#define EG_CONFIG__VGT_GROUP_FIRST_DECR 32
+#define EG_CONFIG__VGT_GROUP_DECR 33
+#define EG_CONFIG__VGT_GROUP_VECT_0_CNTL 34
+#define EG_CONFIG__VGT_GROUP_VECT_1_CNTL 35
+#define EG_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 36
+#define EG_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 37
+#define EG_CONFIG__VGT_GS_MODE 38
+#define EG_CONFIG__PA_SC_MODE_CNTL_0 39
+#define EG_CONFIG__PA_SC_MODE_CNTL_1 40
+#define EG_CONFIG__VGT_REUSE_OFF 41
+#define EG_CONFIG__VGT_VTX_CNT_EN 42
+#define EG_CONFIG__VGT_SHADER_STAGES_EN 43
+#define EG_CONFIG__VGT_STRMOUT_CONFIG 44
+#define EG_CONFIG__VGT_STRMOUT_BUFFER_CONFIG 45
+#define EG_CONFIG_SIZE 46
+#define EG_CONFIG_PM4 128
+
+/* EG_CB_CNTL */
+#define EG_CB_CNTL__CB_TARGET_MASK 0
+#define EG_CB_CNTL__CB_SHADER_MASK 1
+#define EG_CB_CNTL__CB_COLOR_CONTROL 2
+#define EG_CB_CNTL__PA_SC_AA_CONFIG 3
+#define EG_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 4
+#define EG_CB_CNTL__PA_SC_AA_MASK 5
+#define EG_CB_CNTL_SIZE 6
+#define EG_CB_CNTL_PM4 128
+
+/* EG_RASTERIZER */
+#define EG_RASTERIZER__SPI_INTERP_CONTROL_0 0
+#define EG_RASTERIZER__PA_CL_CLIP_CNTL 1
+#define EG_RASTERIZER__PA_SU_SC_MODE_CNTL 2
+#define EG_RASTERIZER__PA_CL_VS_OUT_CNTL 3
+#define EG_RASTERIZER__PA_CL_NANINF_CNTL 4
+#define EG_RASTERIZER__PA_SU_POINT_SIZE 5
+#define EG_RASTERIZER__PA_SU_POINT_MINMAX 6
+#define EG_RASTERIZER__PA_SU_LINE_CNTL 7
+#define EG_RASTERIZER__PA_SC_MPASS_PS_CNTL 8
+#define EG_RASTERIZER__PA_SC_LINE_CNTL 9
+#define EG_RASTERIZER__PA_SU_VTX_CNTL 10
+#define EG_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 11
+#define EG_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 12
+#define EG_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 13
+#define EG_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 14
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 15
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 16
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 17
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 18
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 19
+#define EG_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 20
+#define EG_RASTERIZER_SIZE 21
+#define EG_RASTERIZER_PM4 128
+
+/* EG_VIEWPORT */
+#define EG_VIEWPORT__PA_SC_VPORT_ZMIN_0 0
+#define EG_VIEWPORT__PA_SC_VPORT_ZMAX_0 1
+#define EG_VIEWPORT__PA_CL_VPORT_XSCALE_0 2
+#define EG_VIEWPORT__PA_CL_VPORT_YSCALE_0 3
+#define EG_VIEWPORT__PA_CL_VPORT_ZSCALE_0 4
+#define EG_VIEWPORT__PA_CL_VPORT_XOFFSET_0 5
+#define EG_VIEWPORT__PA_CL_VPORT_YOFFSET_0 6
+#define EG_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 7
+#define EG_VIEWPORT__PA_CL_VTE_CNTL 8
+#define EG_VIEWPORT_SIZE 9
+#define EG_VIEWPORT_PM4 128
+
+/* EG_SCISSOR */
+#define EG_SCISSOR__PA_SC_SCREEN_SCISSOR_TL 0
+#define EG_SCISSOR__PA_SC_SCREEN_SCISSOR_BR 1
+#define EG_SCISSOR__PA_SC_WINDOW_OFFSET 2
+#define EG_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 3
+#define EG_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 4
+#define EG_SCISSOR__PA_SC_CLIPRECT_RULE 5
+#define EG_SCISSOR__PA_SC_CLIPRECT_0_TL 6
+#define EG_SCISSOR__PA_SC_CLIPRECT_0_BR 7
+#define EG_SCISSOR__PA_SC_CLIPRECT_1_TL 8
+#define EG_SCISSOR__PA_SC_CLIPRECT_1_BR 9
+#define EG_SCISSOR__PA_SC_CLIPRECT_2_TL 10
+#define EG_SCISSOR__PA_SC_CLIPRECT_2_BR 11
+#define EG_SCISSOR__PA_SC_CLIPRECT_3_TL 12
+#define EG_SCISSOR__PA_SC_CLIPRECT_3_BR 13
+#define EG_SCISSOR__PA_SC_EDGERULE 14
+#define EG_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 15
+#define EG_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 16
+#define EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 17
+#define EG_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 18
+#define EG_SCISSOR__PA_SU_HARDWARE_SCREEN_OFFSET 19
+#define EG_SCISSOR_SIZE 20
+#define EG_SCISSOR_PM4 128
+
+/* EG_BLEND */
+#define EG_BLEND__CB_BLEND_RED 0
+#define EG_BLEND__CB_BLEND_GREEN 1
+#define EG_BLEND__CB_BLEND_BLUE 2
+#define EG_BLEND__CB_BLEND_ALPHA 3
+#define EG_BLEND__CB_BLEND0_CONTROL 4
+#define EG_BLEND__CB_BLEND1_CONTROL 5
+#define EG_BLEND__CB_BLEND2_CONTROL 6
+#define EG_BLEND__CB_BLEND3_CONTROL 7
+#define EG_BLEND__CB_BLEND4_CONTROL 8
+#define EG_BLEND__CB_BLEND5_CONTROL 9
+#define EG_BLEND__CB_BLEND6_CONTROL 10
+#define EG_BLEND__CB_BLEND7_CONTROL 11
+#define EG_BLEND_SIZE 12
+#define EG_BLEND_PM4 128
+
+/* EG_DSA */
+#define EG_DSA__DB_STENCIL_CLEAR 0
+#define EG_DSA__DB_DEPTH_CLEAR 1
+#define EG_DSA__SX_ALPHA_TEST_CONTROL 2
+#define EG_DSA__DB_STENCILREFMASK 3
+#define EG_DSA__DB_STENCILREFMASK_BF 4
+#define EG_DSA__SX_ALPHA_REF 5
+#define EG_DSA__SPI_FOG_CNTL 6
+#define EG_DSA__DB_DEPTH_CONTROL 7
+#define EG_DSA__DB_SHADER_CONTROL 8
+#define EG_DSA__DB_RENDER_CONTROL 9
+#define EG_DSA__DB_RENDER_OVERRIDE 10
+#define EG_DSA__DB_RENDER_OVERRIDE2 11
+#define EG_DSA__DB_SRESULTS_COMPARE_STATE0 12
+#define EG_DSA__DB_SRESULTS_COMPARE_STATE1 13
+#define EG_DSA__DB_PRELOAD_CONTROL 14
+#define EG_DSA__DB_ALPHA_TO_MASK 15
+#define EG_DSA_SIZE 16
+#define EG_DSA_PM4 128
+
+/* EG_VS_SHADER */
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_0 0
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_1 1
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_2 2
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_3 3
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_4 4
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_5 5
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_6 6
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_7 7
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_8 8
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_9 9
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_10 10
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_11 11
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_12 12
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_13 13
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_14 14
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_15 15
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_16 16
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_17 17
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_18 18
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_19 19
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_20 20
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_21 21
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_22 22
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_23 23
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_24 24
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_25 25
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_26 26
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_27 27
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_28 28
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_29 29
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_30 30
+#define EG_VS_SHADER__SQ_VTX_SEMANTIC_31 31
+#define EG_VS_SHADER__SPI_VS_OUT_ID_0 32
+#define EG_VS_SHADER__SPI_VS_OUT_ID_1 33
+#define EG_VS_SHADER__SPI_VS_OUT_ID_2 34
+#define EG_VS_SHADER__SPI_VS_OUT_ID_3 35
+#define EG_VS_SHADER__SPI_VS_OUT_ID_4 36
+#define EG_VS_SHADER__SPI_VS_OUT_ID_5 37
+#define EG_VS_SHADER__SPI_VS_OUT_ID_6 38
+#define EG_VS_SHADER__SPI_VS_OUT_ID_7 39
+#define EG_VS_SHADER__SPI_VS_OUT_ID_8 40
+#define EG_VS_SHADER__SPI_VS_OUT_ID_9 41
+#define EG_VS_SHADER__SPI_VS_OUT_CONFIG 42
+#define EG_VS_SHADER__SQ_PGM_START_VS 43
+#define EG_VS_SHADER__SQ_PGM_RESOURCES_VS 44
+#define EG_VS_SHADER__SQ_PGM_RESOURCES_2_VS 45
+#define EG_VS_SHADER__SQ_PGM_START_FS 46
+#define EG_VS_SHADER__SQ_PGM_RESOURCES_FS 47
+#define EG_VS_SHADER_SIZE 48
+#define EG_VS_SHADER_PM4 128
+
+/* EG_PS_SHADER */
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_0 0
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_1 1
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_2 2
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_3 3
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_4 4
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_5 5
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_6 6
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_7 7
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_8 8
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_9 9
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_10 10
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_11 11
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_12 12
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_13 13
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_14 14
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_15 15
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_16 16
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_17 17
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_18 18
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_19 19
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_20 20
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_21 21
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_22 22
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_23 23
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_24 24
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_25 25
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_26 26
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_27 27
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_28 28
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_29 29
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_30 30
+#define EG_PS_SHADER__SPI_PS_INPUT_CNTL_31 31
+#define EG_PS_SHADER__SPI_THREAD_GROUPING 32
+#define EG_PS_SHADER__SPI_PS_IN_CONTROL_0 33
+#define EG_PS_SHADER__SPI_PS_IN_CONTROL_1 34
+#define EG_PS_SHADER__SPI_INPUT_Z 35
+#define EG_PS_SHADER__SPI_BARYC_CNTL 36
+#define EG_PS_SHADER__SPI_PS_IN_CONTROL_2 37
+#define EG_PS_SHADER__SPI_COMPUTE_INPUT_CNTL 38
+#define EG_PS_SHADER__SQ_PGM_START_PS 39
+#define EG_PS_SHADER__SQ_PGM_RESOURCES_PS 40
+#define EG_PS_SHADER__SQ_PGM_RESOURCES_2_PS 41
+#define EG_PS_SHADER__SQ_PGM_EXPORTS_PS 42
+#define EG_PS_SHADER_SIZE 43
+#define EG_PS_SHADER_PM4 128
+
+/* EG_UCP */
+#define EG_UCP__PA_CL_UCP0_X 0
+#define EG_UCP__PA_CL_UCP0_Y 1
+#define EG_UCP__PA_CL_UCP0_Z 2
+#define EG_UCP__PA_CL_UCP0_W 3
+#define EG_UCP__PA_CL_UCP1_X 4
+#define EG_UCP__PA_CL_UCP1_Y 5
+#define EG_UCP__PA_CL_UCP1_Z 6
+#define EG_UCP__PA_CL_UCP1_W 7
+#define EG_UCP__PA_CL_UCP2_X 8
+#define EG_UCP__PA_CL_UCP2_Y 9
+#define EG_UCP__PA_CL_UCP2_Z 10
+#define EG_UCP__PA_CL_UCP2_W 11
+#define EG_UCP__PA_CL_UCP3_X 12
+#define EG_UCP__PA_CL_UCP3_Y 13
+#define EG_UCP__PA_CL_UCP3_Z 14
+#define EG_UCP__PA_CL_UCP3_W 15
+#define EG_UCP__PA_CL_UCP4_X 16
+#define EG_UCP__PA_CL_UCP4_Y 17
+#define EG_UCP__PA_CL_UCP4_Z 18
+#define EG_UCP__PA_CL_UCP4_W 19
+#define EG_UCP__PA_CL_UCP5_X 20
+#define EG_UCP__PA_CL_UCP5_Y 21
+#define EG_UCP__PA_CL_UCP5_Z 22
+#define EG_UCP__PA_CL_UCP5_W 23
+#define EG_UCP_SIZE 24
+#define EG_UCP_PM4 128
+
+/* EG_VS_CBUF */
+#define EG_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0 0
+#define EG_VS_CBUF__ALU_CONST_CACHE_VS_0 1
+#define EG_VS_CBUF_SIZE 2
+#define EG_VS_CBUF_PM4 128
+
+/* EG_PS_CBUF */
+#define EG_PS_CBUF__ALU_CONST_BUFFER_SIZE_PS_0 0
+#define EG_PS_CBUF__ALU_CONST_CACHE_PS_0 1
+#define EG_PS_CBUF_SIZE 2
+#define EG_PS_CBUF_PM4 128
+
+/* EG_PS_RESOURCE */
+#define EG_PS_RESOURCE__RESOURCE0_WORD0 0
+#define EG_PS_RESOURCE__RESOURCE0_WORD1 1
+#define EG_PS_RESOURCE__RESOURCE0_WORD2 2
+#define EG_PS_RESOURCE__RESOURCE0_WORD3 3
+#define EG_PS_RESOURCE__RESOURCE0_WORD4 4
+#define EG_PS_RESOURCE__RESOURCE0_WORD5 5
+#define EG_PS_RESOURCE__RESOURCE0_WORD6 6
+#define EG_PS_RESOURCE__RESOURCE0_WORD7 7
+#define EG_PS_RESOURCE_SIZE 8
+#define EG_PS_RESOURCE_PM4 128
+
+/* EG_VS_RESOURCE */
+#define EG_VS_RESOURCE__RESOURCE160_WORD0 0
+#define EG_VS_RESOURCE__RESOURCE160_WORD1 1
+#define EG_VS_RESOURCE__RESOURCE160_WORD2 2
+#define EG_VS_RESOURCE__RESOURCE160_WORD3 3
+#define EG_VS_RESOURCE__RESOURCE160_WORD4 4
+#define EG_VS_RESOURCE__RESOURCE160_WORD5 5
+#define EG_VS_RESOURCE__RESOURCE160_WORD6 6
+#define EG_VS_RESOURCE__RESOURCE160_WORD7 7
+#define EG_VS_RESOURCE_SIZE 8
+#define EG_VS_RESOURCE_PM4 128
+
+/* EG_FS_RESOURCE */
+#define EG_FS_RESOURCE__RESOURCE320_WORD0 0
+#define EG_FS_RESOURCE__RESOURCE320_WORD1 1
+#define EG_FS_RESOURCE__RESOURCE320_WORD2 2
+#define EG_FS_RESOURCE__RESOURCE320_WORD3 3
+#define EG_FS_RESOURCE__RESOURCE320_WORD4 4
+#define EG_FS_RESOURCE__RESOURCE320_WORD5 5
+#define EG_FS_RESOURCE__RESOURCE320_WORD6 6
+#define EG_FS_RESOURCE__RESOURCE320_WORD7 7
+#define EG_FS_RESOURCE_SIZE 8
+#define EG_FS_RESOURCE_PM4 128
+
+/* EG_GS_RESOURCE */
+#define EG_GS_RESOURCE__RESOURCE336_WORD0 0
+#define EG_GS_RESOURCE__RESOURCE336_WORD1 1
+#define EG_GS_RESOURCE__RESOURCE336_WORD2 2
+#define EG_GS_RESOURCE__RESOURCE336_WORD3 3
+#define EG_GS_RESOURCE__RESOURCE336_WORD4 4
+#define EG_GS_RESOURCE__RESOURCE336_WORD5 5
+#define EG_GS_RESOURCE__RESOURCE336_WORD6 6
+#define EG_GS_RESOURCE__RESOURCE336_WORD7 7
+#define EG_GS_RESOURCE_SIZE 8
+#define EG_GS_RESOURCE_PM4 128
+
+/* EG_PS_SAMPLER */
+#define EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0 0
+#define EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0 1
+#define EG_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0 2
+#define EG_PS_SAMPLER_SIZE 3
+#define EG_PS_SAMPLER_PM4 128
+
+/* EG_VS_SAMPLER */
+#define EG_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0
+#define EG_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1
+#define EG_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2
+#define EG_VS_SAMPLER_SIZE 3
+#define EG_VS_SAMPLER_PM4 128
+
+/* EG_GS_SAMPLER */
+#define EG_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0
+#define EG_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1
+#define EG_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2
+#define EG_GS_SAMPLER_SIZE 3
+#define EG_GS_SAMPLER_PM4 128
+
+/* EG_PS_SAMPLER_BORDER */
+#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0
+#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1
+#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2
+#define EG_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3
+#define EG_PS_SAMPLER_BORDER_SIZE 4
+#define EG_PS_SAMPLER_BORDER_PM4 128
+
+/* EG_VS_SAMPLER_BORDER */
+#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0
+#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1
+#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2
+#define EG_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3
+#define EG_VS_SAMPLER_BORDER_SIZE 4
+#define EG_VS_SAMPLER_BORDER_PM4 128
+
+/* EG_GS_SAMPLER_BORDER */
+#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0
+#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1
+#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2
+#define EG_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3
+#define EG_GS_SAMPLER_BORDER_SIZE 4
+#define EG_GS_SAMPLER_BORDER_PM4 128
+
+/* EG_CB */
+#define EG_CB__CB_COLOR0_BASE 0
+#define EG_CB__CB_COLOR0_PITCH 1
+#define EG_CB__CB_COLOR0_SLICE 2
+#define EG_CB__CB_COLOR0_VIEW 3
+#define EG_CB__CB_COLOR0_INFO 4
+#define EG_CB__CB_COLOR0_ATTRIB 5
+#define EG_CB__CB_COLOR0_DIM 6
+#define EG_CB_SIZE 7
+#define EG_CB_PM4 128
+
+/* EG_DB */
+#define EG_DB__DB_HTILE_DATA_BASE 0
+#define EG_DB__DB_Z_INFO 1
+#define EG_DB__DB_STENCIL_INFO 2
+#define EG_DB__DB_DEPTH_SIZE 3
+#define EG_DB__DB_DEPTH_SLICE 4
+#define EG_DB__DB_DEPTH_VIEW 5
+#define EG_DB__DB_HTILE_SURFACE 6
+#define EG_DB__DB_Z_READ_BASE 7
+#define EG_DB__DB_STENCIL_READ_BASE 8
+#define EG_DB__DB_Z_WRITE_BASE 9
+#define EG_DB__DB_STENCIL_WRITE_BASE 10
+#define EG_DB_SIZE 11
+#define EG_DB_PM4 128
+
+/* EG_VGT */
+#define EG_VGT__VGT_PRIMITIVE_TYPE 0
+#define EG_VGT__VGT_MAX_VTX_INDX 1
+#define EG_VGT__VGT_MIN_VTX_INDX 2
+#define EG_VGT__VGT_INDX_OFFSET 3
+#define EG_VGT__VGT_DMA_INDEX_TYPE 4
+#define EG_VGT__VGT_PRIMITIVEID_EN 5
+#define EG_VGT__VGT_DMA_NUM_INSTANCES 6
+#define EG_VGT__VGT_MULTI_PRIM_IB_RESET_EN 7
+#define EG_VGT__VGT_INSTANCE_STEP_RATE_0 8
+#define EG_VGT__VGT_INSTANCE_STEP_RATE_1 9
+#define EG_VGT_SIZE 10
+#define EG_VGT_PM4 128
+
+/* EG_DRAW */
+#define EG_DRAW__VGT_NUM_INDICES 0
+#define EG_DRAW__VGT_DMA_BASE_HI 1
+#define EG_DRAW__VGT_DMA_BASE 2
+#define EG_DRAW__VGT_DRAW_INITIATOR 3
+#define EG_DRAW_SIZE 4
+#define EG_DRAW_PM4 128
+
+/* EG_VGT_EVENT */
+#define EG_VGT_EVENT__VGT_EVENT_INITIATOR 0
+#define EG_VGT_EVENT_SIZE 1
+#define EG_VGT_EVENT_PM4 128
+
+/* EG_CB_FLUSH */
+#define EG_CB_FLUSH_SIZE 0
+#define EG_CB_FLUSH_PM4 128
+
+/* EG_DB_FLUSH */
+#define EG_DB_FLUSH_SIZE 0
+#define EG_DB_FLUSH_PM4 128
+
diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h
new file mode 100644
index 0000000000..c8e6710605
--- /dev/null
+++ b/src/gallium/drivers/r600/evergreend.h
@@ -0,0 +1,1442 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jerome Glisse
+ */
+#ifndef EVERGREEND_H
+#define EVERGREEND_H
+
+#define R600_TEXEL_PITCH_ALIGNMENT_MASK 0x7
+
+#define PKT3_NOP 0x10
+#define PKT3_INDIRECT_BUFFER_END 0x17
+#define PKT3_SET_PREDICATION 0x20
+#define PKT3_REG_RMW 0x21
+#define PKT3_COND_EXEC 0x22
+#define PKT3_PRED_EXEC 0x23
+#define PKT3_START_3D_CMDBUF 0x24
+#define PKT3_DRAW_INDEX_2 0x27
+#define PKT3_CONTEXT_CONTROL 0x28
+#define PKT3_DRAW_INDEX_IMMD_BE 0x29
+#define PKT3_INDEX_TYPE 0x2A
+#define PKT3_DRAW_INDEX 0x2B
+#define PKT3_DRAW_INDEX_AUTO 0x2D
+#define PKT3_DRAW_INDEX_IMMD 0x2E
+#define PKT3_NUM_INSTANCES 0x2F
+#define PKT3_STRMOUT_BUFFER_UPDATE 0x34
+#define PKT3_INDIRECT_BUFFER_MP 0x38
+#define PKT3_MEM_SEMAPHORE 0x39
+#define PKT3_MPEG_INDEX 0x3A
+#define PKT3_WAIT_REG_MEM 0x3C
+#define PKT3_MEM_WRITE 0x3D
+#define PKT3_INDIRECT_BUFFER 0x32
+#define PKT3_CP_INTERRUPT 0x40
+#define PKT3_SURFACE_SYNC 0x43
+#define PKT3_ME_INITIALIZE 0x44
+#define PKT3_COND_WRITE 0x45
+#define PKT3_EVENT_WRITE 0x46
+#define PKT3_EVENT_WRITE_EOP 0x47
+#define PKT3_ONE_REG_WRITE 0x57
+#define PKT3_SET_CONFIG_REG 0x68
+#define PKT3_SET_CONTEXT_REG 0x69
+#define PKT3_SET_ALU_CONST 0x6A
+#define PKT3_SET_BOOL_CONST 0x6B
+#define PKT3_SET_LOOP_CONST 0x6C
+#define PKT3_SET_RESOURCE 0x6D
+#define PKT3_SET_SAMPLER 0x6E
+#define PKT3_SET_CTL_CONST 0x6F
+#define PKT3_SURFACE_BASE_UPDATE 0x73
+
+#define PKT_TYPE_S(x) (((x) & 0x3) << 30)
+#define PKT_TYPE_G(x) (((x) >> 30) & 0x3)
+#define PKT_TYPE_C 0x3FFFFFFF
+#define PKT_COUNT_S(x) (((x) & 0x3FFF) << 16)
+#define PKT_COUNT_G(x) (((x) >> 16) & 0x3FFF)
+#define PKT_COUNT_C 0xC000FFFF
+#define PKT0_BASE_INDEX_S(x) (((x) & 0xFFFF) << 0)
+#define PKT0_BASE_INDEX_G(x) (((x) >> 0) & 0xFFFF)
+#define PKT0_BASE_INDEX_C 0xFFFF0000
+#define PKT3_IT_OPCODE_S(x) (((x) & 0xFF) << 8)
+#define PKT3_IT_OPCODE_G(x) (((x) >> 8) & 0xFF)
+#define PKT3_IT_OPCODE_C 0xFFFF00FF
+#define PKT0(index, count) (PKT_TYPE_S(0) | PKT0_BASE_INDEX_S(index) | PKT_COUNT_S(count))
+#define PKT3(op, count) (PKT_TYPE_S(3) | PKT3_IT_OPCODE_S(op) | PKT_COUNT_S(count))
+
+/* Registers */
+#define R_008C00_SQ_CONFIG 0x00008C00
+#define S_008C00_VC_ENABLE(x) (((x) & 0x1) << 0)
+#define G_008C00_VC_ENABLE(x) (((x) >> 0) & 0x1)
+#define C_008C00_VC_ENABLE(x) 0xFFFFFFFE
+#define S_008C00_EXPORT_SRC_C(x) (((x) & 0x1) << 1)
+#define G_008C00_EXPORT_SRC_C(x) (((x) >> 1) & 0x1)
+#define C_008C00_EXPORT_SRC_C(x) 0xFFFFFFFD
+/* different */
+#define S_008C00_CS_PRIO(x) (((x) & 0x3) << 18)
+#define G_008C00_CS_PRIO(x) (((x) >> 18) & 0x3)
+#define C_008C00_CS_PRIO(x) 0xFFF3FFFF
+#define S_008C00_LS_PRIO(x) (((x) & 0x3) << 20)
+#define G_008C00_LS_PRIO(x) (((x) >> 20) & 0x3)
+#define C_008C00_LS_PRIO(x) 0xFFCFFFFF
+#define S_008C00_HS_PRIO(x) (((x) & 0x3) << 22)
+#define G_008C00_HS_PRIO(x) (((x) >> 22) & 0x3)
+#define C_008C00_HS_PRIO(x) 0xFF3FFFFF
+#define S_008C00_PS_PRIO(x) (((x) & 0x3) << 24)
+#define G_008C00_PS_PRIO(x) (((x) >> 24) & 0x3)
+#define C_008C00_PS_PRIO(x) 0xFCFFFFFF
+#define S_008C00_VS_PRIO(x) (((x) & 0x3) << 26)
+#define G_008C00_VS_PRIO(x) (((x) >> 26) & 0x3)
+#define C_008C00_VS_PRIO(x) 0xF3FFFFFF
+#define S_008C00_GS_PRIO(x) (((x) & 0x3) << 28)
+#define G_008C00_GS_PRIO(x) (((x) >> 28) & 0x3)
+#define C_008C00_GS_PRIO(x) 0xCFFFFFFF
+#define S_008C00_ES_PRIO(x) (((x) & 0x3) << 30)
+#define G_008C00_ES_PRIO(x) (((x) >> 30) & 0x3)
+#define C_008C00_ES_PRIO(x) 0x3FFFFFFF
+#define R_008C04_SQ_GPR_RESOURCE_MGMT_1 0x00008C04
+#define S_008C04_NUM_PS_GPRS(x) (((x) & 0xFF) << 0)
+#define G_008C04_NUM_PS_GPRS(x) (((x) >> 0) & 0xFF)
+#define C_008C04_NUM_PS_GPRS(x) 0xFFFFFF00
+#define S_008C04_NUM_VS_GPRS(x) (((x) & 0xFF) << 16)
+#define G_008C04_NUM_VS_GPRS(x) (((x) >> 16) & 0xFF)
+#define C_008C04_NUM_VS_GPRS(x) 0xFF00FFFF
+#define S_008C04_NUM_CLAUSE_TEMP_GPRS(x) (((x) & 0xF) << 28)
+#define G_008C04_NUM_CLAUSE_TEMP_GPRS(x) (((x) >> 28) & 0xF)
+#define C_008C04_NUM_CLAUSE_TEMP_GPRS(x) 0x0FFFFFFF
+#define R_008C08_SQ_GPR_RESOURCE_MGMT_2 0x00008C08
+#define S_008C08_NUM_GS_GPRS(x) (((x) & 0xFF) << 0)
+#define G_008C08_NUM_GS_GPRS(x) (((x) >> 0) & 0xFF)
+#define C_008C08_NUM_GS_GPRS(x) 0xFFFFFF00
+#define S_008C08_NUM_ES_GPRS(x) (((x) & 0xFF) << 16)
+#define G_008C08_NUM_ES_GPRS(x) (((x) >> 16) & 0xFF)
+#define C_008C08_NUM_ES_GPRS(x) 0xFF00FFFF
+#define R_008C0C_SQ_GPR_RESOURCE_MGMT_3 0x00008C0C
+#define S_008C0C_NUM_HS_GPRS(x) (((x) & 0xFF) << 0)
+#define G_008C0C_NUM_HS_GPRS(x) (((x) >> 0) & 0xFF)
+#define C_008C0C_NUM_HS_GPRS(x) 0xFFFFFF00
+#define S_008C0C_NUM_LS_GPRS(x) (((x) & 0xFF) << 16)
+#define G_008C0C_NUM_LS_GPRS(x) (((x) >> 16) & 0xFF)
+#define C_008C0C_NUM_LS_GPRS(x) 0xFF00FFFF
+#define R_008C18_SQ_THREAD_RESOURCE_MGMT_1 0x00008C18
+#define S_008C18_NUM_PS_THREADS(x) (((x) & 0xFF) << 0)
+#define G_008C18_NUM_PS_THREADS(x) (((x) >> 0) & 0xFF)
+#define C_008C18_NUM_PS_THREADS(x) 0xFFFFFF00
+#define S_008C18_NUM_VS_THREADS(x) (((x) & 0xFF) << 8)
+#define G_008C18_NUM_VS_THREADS(x) (((x) >> 8) & 0xFF)
+#define C_008C18_NUM_VS_THREADS(x) 0xFFFF00FF
+#define S_008C18_NUM_GS_THREADS(x) (((x) & 0xFF) << 16)
+#define G_008C18_NUM_GS_THREADS(x) (((x) >> 16) & 0xFF)
+#define C_008C18_NUM_GS_THREADS(x) 0xFF00FFFF
+#define S_008C18_NUM_ES_THREADS(x) (((x) & 0xFF) << 24)
+#define G_008C18_NUM_ES_THREADS(x) (((x) >> 24) & 0xFF)
+#define C_008C18_NUM_ES_THREADS(x) 0x00FFFFFF
+#define R_008C1C_SQ_THREAD_RESOURCE_MGMT_2 0x00008C1C
+#define S_008C1C_NUM_HS_THREADS(x) (((x) & 0xFF) << 0)
+#define G_008C1C_NUM_HS_THREADS(x) (((x) >> 0) & 0xFF)
+#define C_008C1C_NUM_HS_THREADS(x) 0xFFFFFF00
+#define S_008C1C_NUM_LS_THREADS(x) (((x) & 0xFF) << 8)
+#define G_008C1C_NUM_LS_THREADS(x) (((x) >> 8) & 0xFF)
+#define C_008C1C_NUM_LS_THREADS(x) 0xFFFF00FF
+#define R_008C20_SQ_STACK_RESOURCE_MGMT_1 0x00008C20
+#define S_008C20_NUM_PS_STACK_ENTRIES(x) (((x) & 0xFFF) << 0)
+#define G_008C20_NUM_PS_STACK_ENTRIES(x) (((x) >> 0) & 0xFFF)
+#define C_008C20_NUM_PS_STACK_ENTRIES(x) 0xFFFFF000
+#define S_008C20_NUM_VS_STACK_ENTRIES(x) (((x) & 0xFFF) << 16)
+#define G_008C20_NUM_VS_STACK_ENTRIES(x) (((x) >> 16) & 0xFFF)
+#define C_008C20_NUM_VS_STACK_ENTRIES(x) 0xF000FFFF
+#define R_008C24_SQ_STACK_RESOURCE_MGMT_2 0x00008C24
+#define S_008C24_NUM_GS_STACK_ENTRIES(x) (((x) & 0xFFF) << 0)
+#define G_008C24_NUM_GS_STACK_ENTRIES(x) (((x) >> 0) & 0xFFF)
+#define C_008C24_NUM_GS_STACK_ENTRIES(x) 0xFFFFF000
+#define S_008C24_NUM_ES_STACK_ENTRIES(x) (((x) & 0xFFF) << 16)
+#define G_008C24_NUM_ES_STACK_ENTRIES(x) (((x) >> 16) & 0xFFF)
+#define C_008C24_NUM_ES_STACK_ENTRIES(x) 0xF000FFFF
+#define R_008C28_SQ_STACK_RESOURCE_MGMT_3 0x00008C28
+#define S_008C28_NUM_HS_STACK_ENTRIES(x) (((x) & 0xFFF) << 0)
+#define G_008C28_NUM_HS_STACK_ENTRIES(x) (((x) >> 0) & 0xFFF)
+#define C_008C28_NUM_HS_STACK_ENTRIES(x) 0xFFFFF000
+#define S_008C28_NUM_LS_STACK_ENTRIES(x) (((x) & 0xFFF) << 16)
+#define G_008C28_NUM_LS_STACK_ENTRIES(x) (((x) >> 16) & 0xFFF)
+#define C_008C28_NUM_LS_STACK_ENTRIES(x) 0xF000FFFF
+
+#define R_008CF0_SQ_MS_FIFO_SIZES 0x00008CF0
+#define S_008CF0_CACHE_FIFO_SIZE(x) (((x) & 0xFF) << 0)
+#define G_008CF0_CACHE_FIFO_SIZE(x) (((x) >> 0) & 0xFF)
+#define C_008CF0_CACHE_FIFO_SIZE(x) 0xFFFFFF00
+#define S_008CF0_FETCH_FIFO_HIWATER(x) (((x) & 0x1F) << 8)
+#define G_008CF0_FETCH_FIFO_HIWATER(x) (((x) >> 8) & 0x1F)
+#define C_008CF0_FETCH_FIFO_HIWATER(x) 0xFFFFE0FF
+#define S_008CF0_DONE_FIFO_HIWATER(x) (((x) & 0xFF) << 16)
+#define G_008CF0_DONE_FIFO_HIWATER(x) (((x) >> 16) & 0xFF)
+#define C_008CF0_DONE_FIFO_HIWATER(x) 0xFF00FFFF
+#define S_008CF0_ALU_UPDATE_FIFO_HIWATER(x) (((x) & 0x1F) << 24)
+#define G_008CF0_ALU_UPDATE_FIFO_HIWATER(x) (((x) >> 24) & 0x1F)
+#define C_008CF0_ALU_UPDATE_FIFO_HIWATER(x) 0xE0FFFFFF
+
+#define R_009100_SPI_CONFIG_CNTL 0x00009100
+#define R_00913C_SPI_CONFIG_CNTL_1 0x0000913C
+#define S_00913C_VTX_DONE_DELAY(x) (((x) & 0xF) << 0)
+#define G_00913C_VTX_DONE_DELAY(x) (((x) >> 0) & 0xF )
+#define C_00913C_VTX_DONE_DELAY(x) 0xFFFFFFF0
+
+
+#define R_028C64_CB_COLOR0_PITCH 0x028C64
+#define S_028C64_PITCH_TILE_MAX(x) (((x) & 0x7FF) << 0)
+#define G_028C64_PITCH_TILE_MAX(x) (((x) >> 0) & 0x7FF)
+#define C_028C64_PITCH_TILE_MAX 0xFFFFF800
+#define R_028C68_CB_COLOR0_SLICE 0x028C68
+#define S_028C68_SLICE_TILE_MAX(x) (((x) & 0x3FFFFF) << 0)
+#define G_028C68_SLICE_TILE_MAX(x) (((x) >> 0) & 0x3FFFFF)
+#define C_028C68_SLICE_TILE_MAX 0xFFC00000
+#define R_028C70_CB_COLOR0_INFO 0x028C70
+#define S_028C70_ENDIAN(x) (((x) & 0x3) << 0)
+#define G_028C70_ENDIAN(x) (((x) >> 0) & 0x3)
+#define C_028C70_ENDIAN 0xFFFFFFFC
+#define S_028C70_FORMAT(x) (((x) & 0x3F) << 2)
+#define G_028C70_FORMAT(x) (((x) >> 2) & 0x3F)
+#define C_028C70_FORMAT 0xFFFFFF03
+#define V_028C70_COLOR_INVALID 0x00000000
+#define V_028C70_COLOR_8 0x00000001
+#define V_028C70_COLOR_4_4 0x00000002
+#define V_028C70_COLOR_3_3_2 0x00000003
+#define V_028C70_COLOR_16 0x00000005
+#define V_028C70_COLOR_16_FLOAT 0x00000006
+#define V_028C70_COLOR_8_8 0x00000007
+#define V_028C70_COLOR_5_6_5 0x00000008
+#define V_028C70_COLOR_6_5_5 0x00000009
+#define V_028C70_COLOR_1_5_5_5 0x0000000A
+#define V_028C70_COLOR_4_4_4_4 0x0000000B
+#define V_028C70_COLOR_5_5_5_1 0x0000000C
+#define V_028C70_COLOR_32 0x0000000D
+#define V_028C70_COLOR_32_FLOAT 0x0000000E
+#define V_028C70_COLOR_16_16 0x0000000F
+#define V_028C70_COLOR_16_16_FLOAT 0x00000010
+#define V_028C70_COLOR_8_24 0x00000011
+#define V_028C70_COLOR_8_24_FLOAT 0x00000012
+#define V_028C70_COLOR_24_8 0x00000013
+#define V_028C70_COLOR_24_8_FLOAT 0x00000014
+#define V_028C70_COLOR_10_11_11 0x00000015
+#define V_028C70_COLOR_10_11_11_FLOAT 0x00000016
+#define V_028C70_COLOR_11_11_10 0x00000017
+#define V_028C70_COLOR_11_11_10_FLOAT 0x00000018
+#define V_028C70_COLOR_2_10_10_10 0x00000019
+#define V_028C70_COLOR_8_8_8_8 0x0000001A
+#define V_028C70_COLOR_10_10_10_2 0x0000001B
+#define V_028C70_COLOR_X24_8_32_FLOAT 0x0000001C
+#define V_028C70_COLOR_32_32 0x0000001D
+#define V_028C70_COLOR_32_32_FLOAT 0x0000001E
+#define V_028C70_COLOR_16_16_16_16 0x0000001F
+#define V_028C70_COLOR_16_16_16_16_FLOAT 0x00000020
+#define V_028C70_COLOR_32_32_32_32 0x00000022
+#define V_028C70_COLOR_32_32_32_32_FLOAT 0x00000023
+#define V_028C70_COLOR_32_32_32_FLOAT 0x00000030
+#define S_028C70_ARRAY_MODE(x) (((x) & 0xF) << 8)
+#define G_028C70_ARRAY_MODE(x) (((x) >> 8) & 0xF)
+#define C_028C70_ARRAY_MODE 0xFFFFF0FF
+#define V_028C70_ARRAY_LINEAR_GENERAL 0x00000000
+#define V_028C70_ARRAY_LINEAR_ALIGNED 0x00000001
+#define V_028C70_ARRAY_1D_TILED_THIN1 0x00000002
+#define V_028C70_ARRAY_2D_TILED_THIN1 0x00000004
+#define S_028C70_NUMBER_TYPE(x) (((x) & 0x7) << 12)
+#define G_028C70_NUMBER_TYPE(x) (((x) >> 12) & 0x7)
+#define C_028C70_NUMBER_TYPE 0xFFFF8FFF
+#define V_028C70_NUMBER_UNORM 0x00000000
+#define V_028C70_NUMBER_SNORM 0x00000001
+#define V_028C70_NUMBER_USCALED 0x00000002
+#define V_028C70_NUMBER_SSCALED 0x00000003
+#define V_028C70_NUMBER_UINT 0x00000004
+#define V_028C70_NUMBER_SINT 0x00000005
+#define V_028C70_NUMBER_SRGB 0x00000006
+#define V_028C70_NUMBER_FLOAT 0x00000007
+#define S_028C70_COMP_SWAP(x) (((x) & 0x3) << 15)
+#define G_028C70_COMP_SWAP(x) (((x) >> 15) & 0x3)
+#define C_028C70_COMP_SWAP 0xFFFE7FFF
+#define V_028C70_SWAP_STD 0x00000000
+#define V_028C70_SWAP_ALT 0x00000001
+#define V_028C70_SWAP_STD_REV 0x00000002
+#define V_028C70_SWAP_ALT_REV 0x00000003
+#define S_028C70_FAST_CLEAR(x) (((x) & 0x1) << 17)
+#define G_028C70_FAST_CLEAR(x) (((x) >> 17) & 0x1)
+#define C_028C70_FAST_CLEAR 0xFFFDFFFF
+#define S_028C70_COMPRESSION(x) (((x) & 0x3) << 18)
+#define G_028C70_COMPRESSION(x) (((x) >> 18) & 0x3)
+#define C_028C70_COMPRESSION 0xFFF3FFFF
+#define S_028C70_BLEND_CLAMP(x) (((x) & 0x1) << 19)
+#define G_028C70_BLEND_CLAMP(x) (((x) >> 19) & 0x1)
+#define C_028C70_BLEND_CLAMP 0xFFF7FFFF
+#define S_028C70_BLEND_BYPASS(x) (((x) & 0x1) << 20)
+#define G_028C70_BLEND_BYPASS(x) (((x) >> 20) & 0x1)
+#define C_028C70_BLEND_BYPASS 0xFFEFFFFF
+#define S_028C70_SIMPLE_FLOAT(x) (((x) & 0x1) << 21)
+#define G_028C70_SIMPLE_FLOAT(x) (((x) >> 21) & 0x1)
+#define C_028C70_SIMPLE_FLOAT 0xFFDFFFFF
+#define S_028C70_ROUND_MODE(x) (((x) & 0x1) << 22)
+#define G_028C70_ROUND_MODE(x) (((x) >> 22) & 0x1)
+#define C_028C70_ROUND_MODE 0xFFBFFFFF
+#define S_028C70_TILE_COMPACT(x) (((x) & 0x1) << 23)
+#define G_028C70_TILE_COMPACT(x) (((x) >> 23) & 0x1)
+#define C_028C70_TILE_COMPACT 0xFF7FFFFF
+#define S_028C70_SOURCE_FORMAT(x) (((x) & 0x3) << 24)
+#define G_028C70_SOURCE_FORMAT(x) (((x) >> 24) & 0x3)
+#define C_028C70_SOURCE_FORMAT 0xFCFFFFFF
+#define S_028C70_RAT(x) (((x) & 0x1) << 26)
+#define G_028C70_RAT(x) (((x) >> 26) & 0x1)
+#define C_028C70_RAT 0xFBFFFFFF
+#define S_028C70_RESOURCE_TYPE(x) (((x) & 0x7) << 27)
+#define G_028C70_RESOURCE_TYPE(x) (((x) >> 27) & 0x7)
+#define C_028C70_RESOURCE_TYPE 0xC7FFFFFF
+
+#define R_028C74_CB_COLOR0_ATTRIB 0x028C74
+#define S_028C74_NON_DISP_TILING_ORDER(x) (((x) & 0x1) << 4)
+#define G_028C74_NON_DISP_TILING_ORDER(x) (((x) >> 4) & 0x1)
+#define C_028C74_NON_DISP_TILING_ORDER 0xFFFFFFEF
+
+#define R_028C78_CB_COLOR0_DIM 0x028C78
+#define S_028C78_WIDTH_MAX(x) (((x) & 0xFFFF) << 0)
+#define G_028C78_WIDTH_MAX(x) (((x) >> 0) & 0xFFFF)
+#define C_028C78_WIDTH_MAX 0xFFFF0000
+#define S_028C78_HEIGHT_MAX(x) (((x) & 0xFFFF) << 16)
+#define G_028C78_HEIGHT_MAX(x) (((x) >> 16) & 0xFFFF)
+#define C_028C78_HEIGHT_MAX 0x0000FFFF
+
+#define R_028C7C_CB_COLOR0_CMASK 0x028C7C
+#define R_028C80_CB_COLOR0_CMASK_SLICE 0x028C80
+#define R_028C84_CB_COLOR0_FMASK 0x028C84
+#define R_028C88_CB_COLOR0_FMASK_SLICE 0x028C88
+
+#define R_028C8C_CB_COLOR0_CLEAR_WORD0 0x028C8C
+#define R_028C90_CB_COLOR0_CLEAR_WORD1 0x028C90
+#define R_028C94_CB_COLOR0_CLEAR_WORD2 0x028C94
+#define R_028C98_CB_COLOR0_CLEAR_WORD3 0x028C98
+
+/* alpha same */
+#define R_028410_SX_ALPHA_TEST_CONTROL 0x028410
+#define S_028410_ALPHA_FUNC(x) (((x) & 0x7) << 0)
+#define G_028410_ALPHA_FUNC(x) (((x) >> 0) & 0x7)
+#define C_028410_ALPHA_FUNC 0xFFFFFFF8
+#define S_028410_ALPHA_TEST_ENABLE(x) (((x) & 0x1) << 3)
+#define G_028410_ALPHA_TEST_ENABLE(x) (((x) >> 3) & 0x1)
+#define C_028410_ALPHA_TEST_ENABLE 0xFFFFFFF7
+#define S_028410_ALPHA_TEST_BYPASS(x) (((x) & 0x1) << 8)
+#define G_028410_ALPHA_TEST_BYPASS(x) (((x) >> 8) & 0x1)
+#define C_028410_ALPHA_TEST_BYPASS 0xFFFFFEFF
+
+#define R_028800_DB_DEPTH_CONTROL 0x028800
+#define S_028800_STENCIL_ENABLE(x) (((x) & 0x1) << 0)
+#define G_028800_STENCIL_ENABLE(x) (((x) >> 0) & 0x1)
+#define C_028800_STENCIL_ENABLE 0xFFFFFFFE
+#define S_028800_Z_ENABLE(x) (((x) & 0x1) << 1)
+#define G_028800_Z_ENABLE(x) (((x) >> 1) & 0x1)
+#define C_028800_Z_ENABLE 0xFFFFFFFD
+#define S_028800_Z_WRITE_ENABLE(x) (((x) & 0x1) << 2)
+#define G_028800_Z_WRITE_ENABLE(x) (((x) >> 2) & 0x1)
+#define C_028800_Z_WRITE_ENABLE 0xFFFFFFFB
+#define S_028800_ZFUNC(x) (((x) & 0x7) << 4)
+#define G_028800_ZFUNC(x) (((x) >> 4) & 0x7)
+#define C_028800_ZFUNC 0xFFFFFF8F
+#define S_028800_BACKFACE_ENABLE(x) (((x) & 0x1) << 7)
+#define G_028800_BACKFACE_ENABLE(x) (((x) >> 7) & 0x1)
+#define C_028800_BACKFACE_ENABLE 0xFFFFFF7F
+#define S_028800_STENCILFUNC(x) (((x) & 0x7) << 8)
+#define G_028800_STENCILFUNC(x) (((x) >> 8) & 0x7)
+#define C_028800_STENCILFUNC 0xFFFFF8FF
+#define V_028800_STENCILFUNC_NEVER 0x00000000
+#define V_028800_STENCILFUNC_LESS 0x00000001
+#define V_028800_STENCILFUNC_EQUAL 0x00000002
+#define V_028800_STENCILFUNC_LEQUAL 0x00000003
+#define V_028800_STENCILFUNC_GREATER 0x00000004
+#define V_028800_STENCILFUNC_NOTEQUAL 0x00000005
+#define V_028800_STENCILFUNC_GEQUAL 0x00000006
+#define V_028800_STENCILFUNC_ALWAYS 0x00000007
+#define S_028800_STENCILFAIL(x) (((x) & 0x7) << 11)
+#define G_028800_STENCILFAIL(x) (((x) >> 11) & 0x7)
+#define C_028800_STENCILFAIL 0xFFFFC7FF
+#define V_028800_STENCIL_KEEP 0x00000000
+#define V_028800_STENCIL_ZERO 0x00000001
+#define V_028800_STENCIL_REPLACE 0x00000002
+#define V_028800_STENCIL_INCR 0x00000003
+#define V_028800_STENCIL_DECR 0x00000004
+#define V_028800_STENCIL_INVERT 0x00000005
+#define V_028800_STENCIL_INCR_WRAP 0x00000006
+#define V_028800_STENCIL_DECR_WRAP 0x00000007
+#define S_028800_STENCILZPASS(x) (((x) & 0x7) << 14)
+#define G_028800_STENCILZPASS(x) (((x) >> 14) & 0x7)
+#define C_028800_STENCILZPASS 0xFFFE3FFF
+#define S_028800_STENCILZFAIL(x) (((x) & 0x7) << 17)
+#define G_028800_STENCILZFAIL(x) (((x) >> 17) & 0x7)
+#define C_028800_STENCILZFAIL 0xFFF1FFFF
+#define S_028800_STENCILFUNC_BF(x) (((x) & 0x7) << 20)
+#define G_028800_STENCILFUNC_BF(x) (((x) >> 20) & 0x7)
+#define C_028800_STENCILFUNC_BF 0xFF8FFFFF
+#define S_028800_STENCILFAIL_BF(x) (((x) & 0x7) << 23)
+#define G_028800_STENCILFAIL_BF(x) (((x) >> 23) & 0x7)
+#define C_028800_STENCILFAIL_BF 0xFC7FFFFF
+#define S_028800_STENCILZPASS_BF(x) (((x) & 0x7) << 26)
+#define G_028800_STENCILZPASS_BF(x) (((x) >> 26) & 0x7)
+#define C_028800_STENCILZPASS_BF 0xE3FFFFFF
+#define S_028800_STENCILZFAIL_BF(x) (((x) & 0x7) << 29)
+#define G_028800_STENCILZFAIL_BF(x) (((x) >> 29) & 0x7)
+#define C_028800_STENCILZFAIL_BF 0x1FFFFFFF
+
+#define R_028808_CB_COLOR_CONTROL 0x028808
+#define S_028808_FOG_ENABLE(x) (((x) & 0x1) << 0)
+#define G_028808_FOG_ENABLE(x) (((x) >> 0) & 0x1)
+#define C_028808_FOG_ENABLE 0xFFFFFFFE
+#define S_028808_MULTIWRITE_ENABLE(x) (((x) & 0x1) << 1)
+#define G_028808_MULTIWRITE_ENABLE(x) (((x) >> 1) & 0x1)
+#define C_028808_MULTIWRITE_ENABLE 0xFFFFFFFD
+#define S_028808_DITHER_ENABLE(x) (((x) & 0x1) << 2)
+#define G_028808_DITHER_ENABLE(x) (((x) >> 2) & 0x1)
+#define C_028808_DITHER_ENABLE 0xFFFFFFFB
+#define S_028808_DEGAMMA_ENABLE(x) (((x) & 0x1) << 3)
+#define G_028808_DEGAMMA_ENABLE(x) (((x) >> 3) & 0x1)
+#define C_028808_DEGAMMA_ENABLE 0xFFFFFFF7
+#define S_028808_MODE(x) (((x) & 0x7) << 4)
+#define G_028808_MODE(x) (((x) >> 4) & 0x7)
+#define C_028808_MODE 0xFFFFFF8F
+#define S_028808_ROP3(x) (((x) & 0xFF) << 16)
+#define G_028808_ROP3(x) (((x) >> 16) & 0xFF)
+#define C_028808_ROP3 0xFF00FFFF
+#define R_028810_PA_CL_CLIP_CNTL 0x028810
+#define S_028810_UCP_ENA_0(x) (((x) & 0x1) << 0)
+#define G_028810_UCP_ENA_0(x) (((x) >> 0) & 0x1)
+#define C_028810_UCP_ENA_0 0xFFFFFFFE
+#define S_028810_UCP_ENA_1(x) (((x) & 0x1) << 1)
+#define G_028810_UCP_ENA_1(x) (((x) >> 1) & 0x1)
+#define C_028810_UCP_ENA_1 0xFFFFFFFD
+#define S_028810_UCP_ENA_2(x) (((x) & 0x1) << 2)
+#define G_028810_UCP_ENA_2(x) (((x) >> 2) & 0x1)
+#define C_028810_UCP_ENA_2 0xFFFFFFFB
+#define S_028810_UCP_ENA_3(x) (((x) & 0x1) << 3)
+#define G_028810_UCP_ENA_3(x) (((x) >> 3) & 0x1)
+#define C_028810_UCP_ENA_3 0xFFFFFFF7
+#define S_028810_UCP_ENA_4(x) (((x) & 0x1) << 4)
+#define G_028810_UCP_ENA_4(x) (((x) >> 4) & 0x1)
+#define C_028810_UCP_ENA_4 0xFFFFFFEF
+#define S_028810_UCP_ENA_5(x) (((x) & 0x1) << 5)
+#define G_028810_UCP_ENA_5(x) (((x) >> 5) & 0x1)
+#define C_028810_UCP_ENA_5 0xFFFFFFDF
+#define S_028810_PS_UCP_Y_SCALE_NEG(x) (((x) & 0x1) << 13)
+#define G_028810_PS_UCP_Y_SCALE_NEG(x) (((x) >> 13) & 0x1)
+#define C_028810_PS_UCP_Y_SCALE_NEG 0xFFFFDFFF
+#define S_028810_PS_UCP_MODE(x) (((x) & 0x3) << 14)
+#define G_028810_PS_UCP_MODE(x) (((x) >> 14) & 0x3)
+#define C_028810_PS_UCP_MODE 0xFFFF3FFF
+#define S_028810_CLIP_DISABLE(x) (((x) & 0x1) << 16)
+#define G_028810_CLIP_DISABLE(x) (((x) >> 16) & 0x1)
+#define C_028810_CLIP_DISABLE 0xFFFEFFFF
+#define S_028810_UCP_CULL_ONLY_ENA(x) (((x) & 0x1) << 17)
+#define G_028810_UCP_CULL_ONLY_ENA(x) (((x) >> 17) & 0x1)
+#define C_028810_UCP_CULL_ONLY_ENA 0xFFFDFFFF
+#define S_028810_BOUNDARY_EDGE_FLAG_ENA(x) (((x) & 0x1) << 18)
+#define G_028810_BOUNDARY_EDGE_FLAG_ENA(x) (((x) >> 18) & 0x1)
+#define C_028810_BOUNDARY_EDGE_FLAG_ENA 0xFFFBFFFF
+#define S_028810_DX_CLIP_SPACE_DEF(x) (((x) & 0x1) << 19)
+#define G_028810_DX_CLIP_SPACE_DEF(x) (((x) >> 19) & 0x1)
+#define C_028810_DX_CLIP_SPACE_DEF 0xFFF7FFFF
+#define S_028810_DIS_CLIP_ERR_DETECT(x) (((x) & 0x1) << 20)
+#define G_028810_DIS_CLIP_ERR_DETECT(x) (((x) >> 20) & 0x1)
+#define C_028810_DIS_CLIP_ERR_DETECT 0xFFEFFFFF
+#define S_028810_VTX_KILL_OR(x) (((x) & 0x1) << 21)
+#define G_028810_VTX_KILL_OR(x) (((x) >> 21) & 0x1)
+#define C_028810_VTX_KILL_OR 0xFFDFFFFF
+#define S_028810_DX_LINEAR_ATTR_CLIP_ENA(x) (((x) & 0x1) << 24)
+#define G_028810_DX_LINEAR_ATTR_CLIP_ENA(x) (((x) >> 24) & 0x1)
+#define C_028810_DX_LINEAR_ATTR_CLIP_ENA 0xFEFFFFFF
+#define S_028810_VTE_VPORT_PROVOKE_DISABLE(x) (((x) & 0x1) << 25)
+#define G_028810_VTE_VPORT_PROVOKE_DISABLE(x) (((x) >> 25) & 0x1)
+#define C_028810_VTE_VPORT_PROVOKE_DISABLE 0xFDFFFFFF
+#define S_028810_ZCLIP_NEAR_DISABLE(x) (((x) & 0x1) << 26)
+#define G_028810_ZCLIP_NEAR_DISABLE(x) (((x) >> 26) & 0x1)
+#define C_028810_ZCLIP_NEAR_DISABLE 0xFBFFFFFF
+#define S_028810_ZCLIP_FAR_DISABLE(x) (((x) & 0x1) << 27)
+#define G_028810_ZCLIP_FAR_DISABLE(x) (((x) >> 27) & 0x1)
+#define C_028810_ZCLIP_FAR_DISABLE 0xF7FFFFFF
+
+#define R_028040_DB_Z_INFO 0x028040
+#define S_028040_FORMAT(x) (((x) & 0x3) << 0)
+#define G_028040_FORMAT(x) (((x) >> 0) & 0x3)
+#define C_028040_FORMAT 0xFFFFFFFC
+#define V_028040_Z_INVALID 0x00000000
+#define V_028040_Z_16 0x00000001
+#define V_028040_Z_24 0x00000002
+#define V_028040_Z_32_FLOAT 0x00000003
+#define S_028040_ARRAY_MODE(x) (((x) & 0xF) << 4)
+#define G_028040_ARRAY_MODE(x) (((x) >> 4) & 0xF)
+#define C_028040_ARRAY_MODE 0xFFFFFF0F
+#define S_028040_READ_SIZE(x) (((x) & 0x1) << 28)
+#define G_028040_READ_SIZE(x) (((x) >> 28) & 0x1)
+#define C_028040_READ_SIZE 0xEFFFFFFF
+#define S_028040_TILE_SURFACE_ENABLE(x) (((x) & 0x1) << 29)
+#define G_028040_TILE_SURFACE_ENABLE(x) (((x) >> 29) & 0x1)
+#define C_028040_TILE_SURFACE_ENABLE 0xDFFFFFFF
+#define S_028040_ZRANGE_PRECISION(x) (((x) & 0x1) << 31)
+#define G_028040_ZRANGE_PRECISION(x) (((x) >> 31) & 0x1)
+#define C_028040_ZRANGE_PRECISION 0x7FFFFFFF
+
+#define R_028044_DB_STENCIL_INFO 0x028044
+#define S_028044_FORMAT(x) (((x) & 0x1) << 0)
+#define G_028044_FORMAT(x) (((x) >> 0) & 0x1)
+#define C_028044_FORMAT 0xFFFFFFFE
+
+#define R_028058_DB_DEPTH_SIZE 0x028058
+#define S_028058_PITCH_TILE_MAX(x) (((x) & 0x7FF) << 0)
+#define G_028058_PITCH_TILE_MAX(x) (((x) >> 0) & 0x7FF)
+#define C_028058_PITCH_TILE_MAX 0xFFFFF800
+#define S_028058_HEIGHT_TILE_MAX(x) (((x) & 0x7FF) << 11)
+#define G_028058_HEIGHT_TILE_MAX(x) (((x) >> 11) & 0x7FF)
+#define C_028058_HEIGHT_TILE_MAX 0xFFC007FF
+
+#define R_02805C_DB_DEPTH_SLICE 0x02805C
+#define S_02805C_SLICE_TILE_MAX(x) (((x) & 0x3FFFFF) << 0)
+#define G_02805C_SLICE_TILE_MAX(x) (((x) >> 0) & 0x3FFFFF)
+#define C_02805C_SLICE_TILE_MAX 0xFFC00000
+
+#define R_028430_DB_STENCILREFMASK 0x028430
+#define S_028430_STENCILREF(x) (((x) & 0xFF) << 0)
+#define G_028430_STENCILREF(x) (((x) >> 0) & 0xFF)
+#define C_028430_STENCILREF 0xFFFFFF00
+#define S_028430_STENCILMASK(x) (((x) & 0xFF) << 8)
+#define G_028430_STENCILMASK(x) (((x) >> 8) & 0xFF)
+#define C_028430_STENCILMASK 0xFFFF00FF
+#define S_028430_STENCILWRITEMASK(x) (((x) & 0xFF) << 16)
+#define G_028430_STENCILWRITEMASK(x) (((x) >> 16) & 0xFF)
+#define C_028430_STENCILWRITEMASK 0xFF00FFFF
+#define R_028434_DB_STENCILREFMASK_BF 0x028434
+#define S_028434_STENCILREF_BF(x) (((x) & 0xFF) << 0)
+#define G_028434_STENCILREF_BF(x) (((x) >> 0) & 0xFF)
+#define C_028434_STENCILREF_BF 0xFFFFFF00
+#define S_028434_STENCILMASK_BF(x) (((x) & 0xFF) << 8)
+#define G_028434_STENCILMASK_BF(x) (((x) >> 8) & 0xFF)
+#define C_028434_STENCILMASK_BF 0xFFFF00FF
+#define S_028434_STENCILWRITEMASK_BF(x) (((x) & 0xFF) << 16)
+#define G_028434_STENCILWRITEMASK_BF(x) (((x) >> 16) & 0xFF)
+#define C_028434_STENCILWRITEMASK_BF 0xFF00FFFF
+#define R_028780_CB_BLEND_CONTROL 0x028780
+#define S_028780_COLOR_SRCBLEND(x) (((x) & 0x1F) << 0)
+#define G_028780_COLOR_SRCBLEND(x) (((x) >> 0) & 0x1F)
+#define C_028780_COLOR_SRCBLEND 0xFFFFFFE0
+#define V_028780_BLEND_ZERO 0x00000000
+#define V_028780_BLEND_ONE 0x00000001
+#define V_028780_BLEND_SRC_COLOR 0x00000002
+#define V_028780_BLEND_ONE_MINUS_SRC_COLOR 0x00000003
+#define V_028780_BLEND_SRC_ALPHA 0x00000004
+#define V_028780_BLEND_ONE_MINUS_SRC_ALPHA 0x00000005
+#define V_028780_BLEND_DST_ALPHA 0x00000006
+#define V_028780_BLEND_ONE_MINUS_DST_ALPHA 0x00000007
+#define V_028780_BLEND_DST_COLOR 0x00000008
+#define V_028780_BLEND_ONE_MINUS_DST_COLOR 0x00000009
+#define V_028780_BLEND_SRC_ALPHA_SATURATE 0x0000000A
+#define V_028780_BLEND_BOTH_SRC_ALPHA 0x0000000B
+#define V_028780_BLEND_BOTH_INV_SRC_ALPHA 0x0000000C
+#define V_028780_BLEND_CONST_COLOR 0x0000000D
+#define V_028780_BLEND_ONE_MINUS_CONST_COLOR 0x0000000E
+#define V_028780_BLEND_SRC1_COLOR 0x0000000F
+#define V_028780_BLEND_INV_SRC1_COLOR 0x00000010
+#define V_028780_BLEND_SRC1_ALPHA 0x00000011
+#define V_028780_BLEND_INV_SRC1_ALPHA 0x00000012
+#define V_028780_BLEND_CONST_ALPHA 0x00000013
+#define V_028780_BLEND_ONE_MINUS_CONST_ALPHA 0x00000014
+#define S_028780_COLOR_COMB_FCN(x) (((x) & 0x7) << 5)
+#define G_028780_COLOR_COMB_FCN(x) (((x) >> 5) & 0x7)
+#define C_028780_COLOR_COMB_FCN 0xFFFFFF1F
+#define V_028780_COMB_DST_PLUS_SRC 0x00000000
+#define V_028780_COMB_SRC_MINUS_DST 0x00000001
+#define V_028780_COMB_MIN_DST_SRC 0x00000002
+#define V_028780_COMB_MAX_DST_SRC 0x00000003
+#define V_028780_COMB_DST_MINUS_SRC 0x00000004
+#define S_028780_COLOR_DESTBLEND(x) (((x) & 0x1F) << 8)
+#define G_028780_COLOR_DESTBLEND(x) (((x) >> 8) & 0x1F)
+#define C_028780_COLOR_DESTBLEND 0xFFFFE0FF
+#define S_028780_OPACITY_WEIGHT(x) (((x) & 0x1) << 13)
+#define G_028780_OPACITY_WEIGHT(x) (((x) >> 13) & 0x1)
+#define C_028780_OPACITY_WEIGHT 0xFFFFDFFF
+#define S_028780_ALPHA_SRCBLEND(x) (((x) & 0x1F) << 16)
+#define G_028780_ALPHA_SRCBLEND(x) (((x) >> 16) & 0x1F)
+#define C_028780_ALPHA_SRCBLEND 0xFFE0FFFF
+#define S_028780_ALPHA_COMB_FCN(x) (((x) & 0x7) << 21)
+#define G_028780_ALPHA_COMB_FCN(x) (((x) >> 21) & 0x7)
+#define C_028780_ALPHA_COMB_FCN 0xFF1FFFFF
+#define S_028780_ALPHA_DESTBLEND(x) (((x) & 0x1F) << 24)
+#define G_028780_ALPHA_DESTBLEND(x) (((x) >> 24) & 0x1F)
+#define C_028780_ALPHA_DESTBLEND 0xE0FFFFFF
+#define S_028780_SEPARATE_ALPHA_BLEND(x) (((x) & 0x1) << 29)
+#define G_028780_SEPARATE_ALPHA_BLEND(x) (((x) >> 29) & 0x1)
+#define C_028780_SEPARATE_ALPHA_BLEND 0xDFFFFFFF
+#define S_028780_BLEND_CONTROL_ENABLE(x) (((x) & 0x1) << 30)
+#define G_028780_BLEND_CONTROL_ENABLE(x) (((x) >> 30) & 0x1)
+#define C_028780_BLEND_CONTROL_ENABLE 0xEFFFFFFF
+#define R_028814_PA_SU_SC_MODE_CNTL 0x028814
+#define S_028814_CULL_FRONT(x) (((x) & 0x1) << 0)
+#define G_028814_CULL_FRONT(x) (((x) >> 0) & 0x1)
+#define C_028814_CULL_FRONT 0xFFFFFFFE
+#define S_028814_CULL_BACK(x) (((x) & 0x1) << 1)
+#define G_028814_CULL_BACK(x) (((x) >> 1) & 0x1)
+#define C_028814_CULL_BACK 0xFFFFFFFD
+#define S_028814_FACE(x) (((x) & 0x1) << 2)
+#define G_028814_FACE(x) (((x) >> 2) & 0x1)
+#define C_028814_FACE 0xFFFFFFFB
+#define S_028814_POLY_MODE(x) (((x) & 0x3) << 3)
+#define G_028814_POLY_MODE(x) (((x) >> 3) & 0x3)
+#define C_028814_POLY_MODE 0xFFFFFFE7
+#define S_028814_POLYMODE_FRONT_PTYPE(x) (((x) & 0x7) << 5)
+#define G_028814_POLYMODE_FRONT_PTYPE(x) (((x) >> 5) & 0x7)
+#define C_028814_POLYMODE_FRONT_PTYPE 0xFFFFFF1F
+#define S_028814_POLYMODE_BACK_PTYPE(x) (((x) & 0x7) << 8)
+#define G_028814_POLYMODE_BACK_PTYPE(x) (((x) >> 8) & 0x7)
+#define C_028814_POLYMODE_BACK_PTYPE 0xFFFFF8FF
+#define S_028814_POLY_OFFSET_FRONT_ENABLE(x) (((x) & 0x1) << 11)
+#define G_028814_POLY_OFFSET_FRONT_ENABLE(x) (((x) >> 11) & 0x1)
+#define C_028814_POLY_OFFSET_FRONT_ENABLE 0xFFFFF7FF
+#define S_028814_POLY_OFFSET_BACK_ENABLE(x) (((x) & 0x1) << 12)
+#define G_028814_POLY_OFFSET_BACK_ENABLE(x) (((x) >> 12) & 0x1)
+#define C_028814_POLY_OFFSET_BACK_ENABLE 0xFFFFEFFF
+#define S_028814_POLY_OFFSET_PARA_ENABLE(x) (((x) & 0x1) << 13)
+#define G_028814_POLY_OFFSET_PARA_ENABLE(x) (((x) >> 13) & 0x1)
+#define C_028814_POLY_OFFSET_PARA_ENABLE 0xFFFFDFFF
+#define S_028814_VTX_WINDOW_OFFSET_ENABLE(x) (((x) & 0x1) << 16)
+#define G_028814_VTX_WINDOW_OFFSET_ENABLE(x) (((x) >> 16) & 0x1)
+#define C_028814_VTX_WINDOW_OFFSET_ENABLE 0xFFFEFFFF
+#define S_028814_PROVOKING_VTX_LAST(x) (((x) & 0x1) << 19)
+#define G_028814_PROVOKING_VTX_LAST(x) (((x) >> 19) & 0x1)
+#define C_028814_PROVOKING_VTX_LAST 0xFFF7FFFF
+#define S_028814_PERSP_CORR_DIS(x) (((x) & 0x1) << 20)
+#define G_028814_PERSP_CORR_DIS(x) (((x) >> 20) & 0x1)
+#define C_028814_PERSP_CORR_DIS 0xFFEFFFFF
+#define S_028814_MULTI_PRIM_IB_ENA(x) (((x) & 0x1) << 21)
+#define G_028814_MULTI_PRIM_IB_ENA(x) (((x) >> 21) & 0x1)
+#define C_028814_MULTI_PRIM_IB_ENA 0xFFDFFFFF
+
+#define R_028004_DB_DEPTH_VIEW 0x028004
+#define S_028004_SLICE_START(x) (((x) & 0x7FF) << 0)
+#define G_028004_SLICE_START(x) (((x) >> 0) & 0x7FF)
+#define C_028004_SLICE_START 0xFFFFF800
+#define S_028004_SLICE_MAX(x) (((x) & 0x7FF) << 13)
+#define G_028004_SLICE_MAX(x) (((x) >> 13) & 0x7FF)
+#define C_028004_SLICE_MAX 0xFF001FFF
+#define R_028D24_DB_HTILE_SURFACE 0x028D24
+#define S_028D24_HTILE_WIDTH(x) (((x) & 0x1) << 0)
+#define G_028D24_HTILE_WIDTH(x) (((x) >> 0) & 0x1)
+#define C_028D24_HTILE_WIDTH 0xFFFFFFFE
+#define S_028D24_HTILE_HEIGHT(x) (((x) & 0x1) << 1)
+#define G_028D24_HTILE_HEIGHT(x) (((x) >> 1) & 0x1)
+#define C_028D24_HTILE_HEIGHT 0xFFFFFFFD
+#define S_028D24_LINEAR(x) (((x) & 0x1) << 2)
+#define G_028D24_LINEAR(x) (((x) >> 2) & 0x1)
+#define C_028D24_LINEAR 0xFFFFFFFB
+#define S_028D24_FULL_CACHE(x) (((x) & 0x1) << 3)
+#define G_028D24_FULL_CACHE(x) (((x) >> 3) & 0x1)
+#define C_028D24_FULL_CACHE 0xFFFFFFF7
+#define S_028D24_HTILE_USES_PRELOAD_WIN(x) (((x) & 0x1) << 4)
+#define G_028D24_HTILE_USES_PRELOAD_WIN(x) (((x) >> 4) & 0x1)
+#define C_028D24_HTILE_USES_PRELOAD_WIN 0xFFFFFFEF
+#define S_028D24_PRELOAD(x) (((x) & 0x1) << 5)
+#define G_028D24_PRELOAD(x) (((x) >> 5) & 0x1)
+#define C_028D24_PRELOAD 0xFFFFFFDF
+#define S_028D24_PREFETCH_WIDTH(x) (((x) & 0x3F) << 6)
+#define G_028D24_PREFETCH_WIDTH(x) (((x) >> 6) & 0x3F)
+#define C_028D24_PREFETCH_WIDTH 0xFFFFF03F
+#define S_028D24_PREFETCH_HEIGHT(x) (((x) & 0x3F) << 12)
+#define G_028D24_PREFETCH_HEIGHT(x) (((x) >> 12) & 0x3F)
+#define C_028D24_PREFETCH_HEIGHT 0xFFFC0FFF
+#define R_028D34_DB_PREFETCH_LIMIT 0x028D34
+#define S_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) & 0x3FF) << 0)
+#define G_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) >> 0) & 0x3FF)
+#define C_028D34_DEPTH_HEIGHT_TILE_MAX 0xFFFFFC00
+#define R_028D0C_DB_RENDER_CONTROL 0x028D0C
+#define S_028D0C_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5)
+#define S_028D0C_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6)
+#define S_028D0C_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15)
+#define R_028D10_DB_RENDER_OVERRIDE 0x028D10
+#define V_028D10_FORCE_OFF 0
+#define V_028D10_FORCE_ENABLE 1
+#define V_028D10_FORCE_DISABLE 2
+#define S_028D10_FORCE_HIZ_ENABLE(x) (((x) & 0x3) << 0)
+#define G_028D10_FORCE_HIZ_ENABLE(x) (((x) >> 0) & 0x3)
+#define C_028D10_FORCE_HIZ_ENABLE 0xFFFFFFFC
+#define S_028D10_FORCE_HIS_ENABLE0(x) (((x) & 0x3) << 2)
+#define G_028D10_FORCE_HIS_ENABLE0(x) (((x) >> 2) & 0x3)
+#define C_028D10_FORCE_HIS_ENABLE0 0xFFFFFFF3
+#define S_028D10_FORCE_HIS_ENABLE1(x) (((x) & 0x3) << 4)
+#define G_028D10_FORCE_HIS_ENABLE1(x) (((x) >> 4) & 0x3)
+#define C_028D10_FORCE_HIS_ENABLE1 0xFFFFFFCF
+#define S_028D10_FORCE_SHADER_Z_ORDER(x) (((x) & 0x1) << 6)
+#define G_028D10_FORCE_SHADER_Z_ORDER(x) (((x) >> 6) & 0x1)
+#define C_028D10_FORCE_SHADER_Z_ORDER 0xFFFFFFBF
+#define S_028D10_FAST_Z_DISABLE(x) (((x) & 0x1) << 7)
+#define G_028D10_FAST_Z_DISABLE(x) (((x) >> 7) & 0x1)
+#define C_028D10_FAST_Z_DISABLE 0xFFFFFF7F
+#define S_028D10_FAST_STENCIL_DISABLE(x) (((x) & 0x1) << 8)
+#define G_028D10_FAST_STENCIL_DISABLE(x) (((x) >> 8) & 0x1)
+#define C_028D10_FAST_STENCIL_DISABLE 0xFFFFFEFF
+#define S_028D10_NOOP_CULL_DISABLE(x) (((x) & 0x1) << 9)
+#define G_028D10_NOOP_CULL_DISABLE(x) (((x) >> 9) & 0x1)
+#define C_028D10_NOOP_CULL_DISABLE 0xFFFFFDFF
+#define S_028D10_FORCE_COLOR_KILL(x) (((x) & 0x1) << 10)
+#define G_028D10_FORCE_COLOR_KILL(x) (((x) >> 10) & 0x1)
+#define C_028D10_FORCE_COLOR_KILL 0xFFFFFBFF
+#define S_028D10_FORCE_Z_READ(x) (((x) & 0x1) << 11)
+#define G_028D10_FORCE_Z_READ(x) (((x) >> 11) & 0x1)
+#define C_028D10_FORCE_Z_READ 0xFFFFF7FF
+#define S_028D10_FORCE_STENCIL_READ(x) (((x) & 0x1) << 12)
+#define G_028D10_FORCE_STENCIL_READ(x) (((x) >> 12) & 0x1)
+#define C_028D10_FORCE_STENCIL_READ 0xFFFFEFFF
+#define S_028D10_FORCE_FULL_Z_RANGE(x) (((x) & 0x3) << 13)
+#define G_028D10_FORCE_FULL_Z_RANGE(x) (((x) >> 13) & 0x3)
+#define C_028D10_FORCE_FULL_Z_RANGE 0xFFFF9FFF
+#define S_028D10_FORCE_QC_SMASK_CONFLICT(x) (((x) & 0x1) << 15)
+#define G_028D10_FORCE_QC_SMASK_CONFLICT(x) (((x) >> 15) & 0x1)
+#define C_028D10_FORCE_QC_SMASK_CONFLICT 0xFFFF7FFF
+#define S_028D10_DISABLE_VIEWPORT_CLAMP(x) (((x) & 0x1) << 16)
+#define G_028D10_DISABLE_VIEWPORT_CLAMP(x) (((x) >> 16) & 0x1)
+#define C_028D10_DISABLE_VIEWPORT_CLAMP 0xFFFEFFFF
+#define S_028D10_IGNORE_SC_ZRANGE(x) (((x) & 0x1) << 17)
+#define G_028D10_IGNORE_SC_ZRANGE(x) (((x) >> 17) & 0x1)
+#define C_028D10_IGNORE_SC_ZRANGE 0xFFFDFFFF
+#define R_028DF8_PA_SU_POLY_OFFSET_DB_FMT_CNTL 0x028DF8
+#define S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) & 0xFF) << 0)
+#define G_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(x) (((x) >> 0) & 0xFF)
+#define C_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS 0xFFFFFF00
+#define S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) & 0x1) << 8)
+#define G_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(x) (((x) >> 8) & 0x1)
+#define C_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT 0xFFFFFEFF
+#define R_028E00_PA_SU_POLY_OFFSET_FRONT_SCALE 0x028E00
+#define S_028E00_SCALE(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_028E00_SCALE(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_028E00_SCALE 0x00000000
+#define R_028E04_PA_SU_POLY_OFFSET_FRONT_OFFSET 0x028E04
+#define S_028E04_OFFSET(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_028E04_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_028E04_OFFSET 0x00000000
+#define R_028E08_PA_SU_POLY_OFFSET_BACK_SCALE 0x028E08
+#define S_028E08_SCALE(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_028E08_SCALE(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_028E08_SCALE 0x00000000
+#define R_028E0C_PA_SU_POLY_OFFSET_BACK_OFFSET 0x028E0C
+#define S_028E0C_OFFSET(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_028E0C_OFFSET(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_028E0C_OFFSET 0x00000000
+#define R_028A00_PA_SU_POINT_SIZE 0x028A00
+#define S_028A00_HEIGHT(x) (((x) & 0xFFFF) << 0)
+#define G_028A00_HEIGHT(x) (((x) >> 0) & 0xFFFF)
+#define C_028A00_HEIGHT 0xFFFF0000
+#define S_028A00_WIDTH(x) (((x) & 0xFFFF) << 16)
+#define G_028A00_WIDTH(x) (((x) >> 16) & 0xFFFF)
+#define C_028A00_WIDTH 0x0000FFFF
+#define R_028A40_VGT_GS_MODE 0x028A40
+#define S_028A40_MODE(x) (((x) & 0x3) << 0)
+#define G_028A40_MODE(x) (((x) >> 0) & 0x3)
+#define C_028A40_MODE 0xFFFFFFFC
+#define S_028A40_ES_PASSTHRU(x) (((x) & 0x1) << 2)
+#define G_028A40_ES_PASSTHRU(x) (((x) >> 2) & 0x1)
+#define C_028A40_ES_PASSTHRU 0xFFFFFFFB
+#define S_028A40_CUT_MODE(x) (((x) & 0x3) << 3)
+#define G_028A40_CUT_MODE(x) (((x) >> 3) & 0x3)
+#define C_028A40_CUT_MODE 0xFFFFFFE7
+#define R_008040_WAIT_UNTIL 0x008040
+#define S_008040_WAIT_CP_DMA_IDLE(x) (((x) & 0x1) << 8)
+#define G_008040_WAIT_CP_DMA_IDLE(x) (((x) >> 8) & 0x1)
+#define C_008040_WAIT_CP_DMA_IDLE 0xFFFFFEFF
+#define S_008040_WAIT_CMDFIFO(x) (((x) & 0x1) << 10)
+#define G_008040_WAIT_CMDFIFO(x) (((x) >> 10) & 0x1)
+#define C_008040_WAIT_CMDFIFO 0xFFFFFBFF
+#define S_008040_WAIT_2D_IDLE(x) (((x) & 0x1) << 14)
+#define G_008040_WAIT_2D_IDLE(x) (((x) >> 14) & 0x1)
+#define C_008040_WAIT_2D_IDLE 0xFFFFBFFF
+#define S_008040_WAIT_3D_IDLE(x) (((x) & 0x1) << 15)
+#define G_008040_WAIT_3D_IDLE(x) (((x) >> 15) & 0x1)
+#define C_008040_WAIT_3D_IDLE 0xFFFF7FFF
+#define S_008040_WAIT_2D_IDLECLEAN(x) (((x) & 0x1) << 16)
+#define G_008040_WAIT_2D_IDLECLEAN(x) (((x) >> 16) & 0x1)
+#define C_008040_WAIT_2D_IDLECLEAN 0xFFFEFFFF
+#define S_008040_WAIT_3D_IDLECLEAN(x) (((x) & 0x1) << 17)
+#define G_008040_WAIT_3D_IDLECLEAN(x) (((x) >> 17) & 0x1)
+#define C_008040_WAIT_3D_IDLECLEAN 0xFFFDFFFF
+#define S_008040_WAIT_EXTERN_SIG(x) (((x) & 0x1) << 19)
+#define G_008040_WAIT_EXTERN_SIG(x) (((x) >> 19) & 0x1)
+#define C_008040_WAIT_EXTERN_SIG 0xFFF7FFFF
+#define S_008040_CMDFIFO_ENTRIES(x) (((x) & 0x1F) << 20)
+#define G_008040_CMDFIFO_ENTRIES(x) (((x) >> 20) & 0x1F)
+#define C_008040_CMDFIFO_ENTRIES 0xFE0FFFFF
+
+/* diff */
+#define R_0286CC_SPI_PS_IN_CONTROL_0 0x0286CC
+#define S_0286CC_NUM_INTERP(x) (((x) & 0x3F) << 0)
+#define G_0286CC_NUM_INTERP(x) (((x) >> 0) & 0x3F)
+#define C_0286CC_NUM_INTERP 0xFFFFFFC0
+#define S_0286CC_POSITION_ENA(x) (((x) & 0x1) << 8)
+#define G_0286CC_POSITION_ENA(x) (((x) >> 8) & 0x1)
+#define C_0286CC_POSITION_ENA 0xFFFFFEFF
+#define S_0286CC_POSITION_CENTROID(x) (((x) & 0x1) << 9)
+#define G_0286CC_POSITION_CENTROID(x) (((x) >> 9) & 0x1)
+#define C_0286CC_POSITION_CENTROID 0xFFFFFDFF
+#define S_0286CC_POSITION_ADDR(x) (((x) & 0x1F) << 10)
+#define G_0286CC_POSITION_ADDR(x) (((x) >> 10) & 0x1F)
+#define C_0286CC_POSITION_ADDR 0xFFFF83FF
+#define S_0286CC_PARAM_GEN(x) (((x) & 0xF) << 15)
+#define G_0286CC_PARAM_GEN(x) (((x) >> 15) & 0xF)
+#define C_0286CC_PARAM_GEN 0xFFF87FFF
+#define S_0286CC_PERSP_GRADIENT_ENA(x) (((x) & 0x1) << 28)
+#define G_0286CC_PERSP_GRADIENT_ENA(x) (((x) >> 28) & 0x1)
+#define C_0286CC_PERSP_GRADIENT_ENA 0xEFFFFFFF
+#define S_0286CC_LINEAR_GRADIENT_ENA(x) (((x) & 0x1) << 29)
+#define G_0286CC_LINEAR_GRADIENT_ENA(x) (((x) >> 29) & 0x1)
+#define C_0286CC_LINEAR_GRADIENT_ENA 0xDFFFFFFF
+#define S_0286CC_POSITION_SAMPLE(x) (((x) & 0x1) << 30)
+#define G_0286CC_POSITION_SAMPLE(x) (((x) >> 30) & 0x1)
+#define C_0286CC_POSITION_SAMPLE 0xBFFFFFFF
+#define R_0286D0_SPI_PS_IN_CONTROL_1 0x0286D0
+#define S_0286D0_FRONT_FACE_ENA(x) (((x) & 0x1) << 8)
+#define G_0286D0_FRONT_FACE_ENA(x) (((x) >> 8) & 0x1)
+#define C_0286D0_FRONT_FACE_ENA 0xFFFFFEFF
+#define S_0286D0_FRONT_FACE_CHAN(x) (((x) & 0x3) << 9)
+#define G_0286D0_FRONT_FACE_CHAN(x) (((x) >> 9) & 0x3)
+#define C_0286D0_FRONT_FACE_CHAN 0xFFFFF9FF
+#define S_0286D0_FRONT_FACE_ALL_BITS(x) (((x) & 0x1) << 11)
+#define G_0286D0_FRONT_FACE_ALL_BITS(x) (((x) >> 11) & 0x1)
+#define C_0286D0_FRONT_FACE_ALL_BITS 0xFFFFF7FF
+#define S_0286D0_FRONT_FACE_ADDR(x) (((x) & 0x1F) << 12)
+#define G_0286D0_FRONT_FACE_ADDR(x) (((x) >> 12) & 0x1F)
+#define C_0286D0_FRONT_FACE_ADDR 0xFFFE0FFF
+#define S_0286D0_FOG_ADDR(x) (((x) & 0x7F) << 17)
+#define G_0286D0_FOG_ADDR(x) (((x) >> 17) & 0x7F)
+#define C_0286D0_FOG_ADDR 0xFF01FFFF
+#define S_0286D0_FIXED_PT_POSITION_ENA(x) (((x) & 0x1) << 24)
+#define G_0286D0_FIXED_PT_POSITION_ENA(x) (((x) >> 24) & 0x1)
+#define C_0286D0_FIXED_PT_POSITION_ENA 0xFEFFFFFF
+#define S_0286D0_FIXED_PT_POSITION_ADDR(x) (((x) & 0x1F) << 25)
+#define G_0286D0_FIXED_PT_POSITION_ADDR(x) (((x) >> 25) & 0x1F)
+#define C_0286D0_FIXED_PT_POSITION_ADDR 0xC1FFFFFF
+#define R_0286C4_SPI_VS_OUT_CONFIG 0x0286C4
+#define S_0286C4_VS_PER_COMPONENT(x) (((x) & 0x1) << 0)
+#define G_0286C4_VS_PER_COMPONENT(x) (((x) >> 0) & 0x1)
+#define C_0286C4_VS_PER_COMPONENT 0xFFFFFFFE
+#define S_0286C4_VS_EXPORT_COUNT(x) (((x) & 0x1F) << 1)
+#define G_0286C4_VS_EXPORT_COUNT(x) (((x) >> 1) & 0x1F)
+#define C_0286C4_VS_EXPORT_COUNT 0xFFFFFFC1
+#define S_0286C4_VS_EXPORTS_FOG(x) (((x) & 0x1) << 8)
+#define G_0286C4_VS_EXPORTS_FOG(x) (((x) >> 8) & 0x1)
+#define C_0286C4_VS_EXPORTS_FOG 0xFFFFFEFF
+#define S_0286C4_VS_OUT_FOG_VEC_ADDR(x) (((x) & 0x1F) << 9)
+#define G_0286C4_VS_OUT_FOG_VEC_ADDR(x) (((x) >> 9) & 0x1F)
+#define C_0286C4_VS_OUT_FOG_VEC_ADDR 0xFFFFC1FF
+
+#define R_0286E0_SPI_BARYC_CNTL 0x0286E0
+#define S_0286E0_PERSP_CENTER_ENA(x) (((x) & 0x3) << 0)
+#define G_0286E0_PERSP_CENTER_ENA(x) (((x) >> 0) & 0x3)
+#define C_0286E0_PERSP_CENTER_ENA 0xFFFFFFFC
+#define S_0286E0_PERSP_CENTROID_ENA(x) (((x) & 0x3) << 4)
+#define G_0286E0_PERSP_CENTROID_ENA(x) (((x) >> 4) & 0x3)
+#define C_0286E0_PERSP_CENTROID_ENA 0xFFFFFFCF
+#define S_0286E0_PERSP_SAMPLE_ENA(x) (((x) & 0x3) << 8)
+#define G_0286E0_PERSP_SAMPLE_ENA(x) (((x) >> 8) & 0x3)
+#define C_0286E0_PERSP_SAMPLE_ENA 0xFFFFFCFF
+#define S_0286E0_PERSP_PULL_MODEL_ENA(x) (((x) & 0x3) << 12)
+#define G_0286E0_PERSP_PULL_MODEL_ENA(x) (((x) >> 12) & 0x3)
+#define C_0286E0_PERSP_PULL_MODEL_ENA 0xFFFFCFFF
+#define S_0286E0_LINEAR_CENTER_ENA(x) (((x) & 0x3) << 16)
+#define G_0286E0_LINEAR_CENTER_ENA(x) (((x) >> 16) & 0x3)
+#define C_0286E0_LINEAR_CENTER_ENA 0xFFFCFFFF
+#define S_0286E0_LINEAR_CENTROID_ENA(x) (((x) & 0x3) << 20)
+#define G_0286E0_LINEAR_CENTROID_ENA(x) (((x) >> 20) & 0x3)
+#define C_0286E0_LINEAR_CENTROID_ENA 0xFFCFFFFF
+#define S_0286E0_LINEAR_SAMPLE_ENA(x) (((x) & 0x3) << 24)
+#define G_0286E0_LINEAR_SAMPLE_ENA(x) (((x) >> 24) & 0x3)
+#define C_0286E0_LINEAR_SAMPLE_ENA 0xFCFFFFFF
+
+
+/* new - diff */
+#define R_028250_PA_SC_VPORT_SCISSOR_TL 0x028250
+#define S_028250_TL_X(x) (((x) & 0x7FFF) << 0)
+#define G_028250_TL_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028250_TL_X 0xFFFF8000
+#define S_028250_TL_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028250_TL_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028250_TL_Y 0x8000FFFF
+#define S_028250_WINDOW_OFFSET_DISABLE(x) (((x) & 0x1) << 31)
+#define G_028250_WINDOW_OFFSET_DISABLE(x) (((x) >> 31) & 0x1)
+#define C_028250_WINDOW_OFFSET_DISABLE 0x7FFFFFFF
+#define R_028254_PA_SC_VPORT_SCISSOR_BR 0x028254
+#define S_028254_BR_X(x) (((x) & 0x7FFF) << 0)
+#define G_028254_BR_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028254_BR_X 0xFFFF8000
+#define S_028254_BR_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028254_BR_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028254_BR_Y 0x8000FFFF
+/* diff */
+#define R_028240_PA_SC_GENERIC_SCISSOR_TL 0x028240
+#define S_028240_TL_X(x) (((x) & 0x7FFF) << 0)
+#define G_028240_TL_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028240_TL_X 0xFFFF8000
+#define S_028240_TL_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028240_TL_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028240_TL_Y 0x8000FFFF
+#define S_028240_WINDOW_OFFSET_DISABLE(x) (((x) & 0x1) << 31)
+#define G_028240_WINDOW_OFFSET_DISABLE(x) (((x) >> 31) & 0x1)
+#define C_028240_WINDOW_OFFSET_DISABLE 0x7FFFFFFF
+#define R_028244_PA_SC_GENERIC_SCISSOR_BR 0x028244
+#define S_028244_BR_X(x) (((x) & 0x7FFF) << 0)
+#define G_028244_BR_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028244_BR_X 0xFFFF8000
+#define S_028244_BR_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028244_BR_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028244_BR_Y 0x8000FFFF
+/* diff */
+#define R_028030_PA_SC_SCREEN_SCISSOR_TL 0x028030
+#define S_028030_TL_X(x) (((x) & 0xFFFF) << 0)
+#define G_028030_TL_X(x) (((x) >> 0) & 0xFFFF)
+#define C_028030_TL_X 0xFFFF0000
+#define S_028030_TL_Y(x) (((x) & 0xFFFF) << 16)
+#define G_028030_TL_Y(x) (((x) >> 16) & 0xFFFF)
+#define C_028030_TL_Y 0x0000FFFF
+#define R_028034_PA_SC_SCREEN_SCISSOR_BR 0x028034
+#define S_028034_BR_X(x) (((x) & 0xFFFF) << 0)
+#define G_028034_BR_X(x) (((x) >> 0) & 0xFFFF)
+#define C_028034_BR_X 0xFFFF0000
+#define S_028034_BR_Y(x) (((x) & 0xFFFF) << 16)
+#define G_028034_BR_Y(x) (((x) >> 16) & 0xFFFF)
+#define C_028034_BR_Y 0x0000FFFF
+/* diff */
+#define R_028204_PA_SC_WINDOW_SCISSOR_TL 0x028204
+#define S_028204_TL_X(x) (((x) & 0x7FFF) << 0)
+#define G_028204_TL_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028204_TL_X 0xFFFF8000
+#define S_028204_TL_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028204_TL_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028204_TL_Y 0x8000FFFF
+#define S_028204_WINDOW_OFFSET_DISABLE(x) (((x) & 0x1) << 31)
+#define G_028204_WINDOW_OFFSET_DISABLE(x) (((x) >> 31) & 0x1)
+#define C_028204_WINDOW_OFFSET_DISABLE 0x7FFFFFFF
+#define R_028208_PA_SC_WINDOW_SCISSOR_BR 0x028208
+#define S_028208_BR_X(x) (((x) & 0x7FFF) << 0)
+#define G_028208_BR_X(x) (((x) >> 0) & 0x7FFF)
+#define C_028208_BR_X 0xFFFF8000
+#define S_028208_BR_Y(x) (((x) & 0x7FFF) << 16)
+#define G_028208_BR_Y(x) (((x) >> 16) & 0x7FFF)
+#define C_028208_BR_Y 0x8000FFFF
+
+#define R_0287F0_VGT_DRAW_INITIATOR 0x0287F0
+#define S_0287F0_SOURCE_SELECT(x) (((x) & 0x3) << 0)
+#define G_0287F0_SOURCE_SELECT(x) (((x) >> 0) & 0x3)
+#define C_0287F0_SOURCE_SELECT 0xFFFFFFFC
+#define S_0287F0_MAJOR_MODE(x) (((x) & 0x3) << 2)
+#define G_0287F0_MAJOR_MODE(x) (((x) >> 2) & 0x3)
+#define C_0287F0_MAJOR_MODE 0xFFFFFFF3
+#define S_0287F0_SPRITE_EN(x) (((x) & 0x1) << 4)
+#define G_0287F0_SPRITE_EN(x) (((x) >> 4) & 0x1)
+#define C_0287F0_SPRITE_EN 0xFFFFFFEF
+#define S_0287F0_NOT_EOP(x) (((x) & 0x1) << 5)
+#define G_0287F0_NOT_EOP(x) (((x) >> 5) & 0x1)
+#define C_0287F0_NOT_EOP 0xFFFFFFDF
+#define S_0287F0_USE_OPAQUE(x) (((x) & 0x1) << 6)
+#define G_0287F0_USE_OPAQUE(x) (((x) >> 6) & 0x1)
+#define C_0287F0_USE_OPAQUE 0xFFFFFFBF
+
+#define R_030000_SQ_TEX_RESOURCE_WORD0_0 0x030000
+#define S_030000_DIM(x) (((x) & 0x7) << 0)
+#define G_030000_DIM(x) (((x) >> 0) & 0x7)
+#define C_030000_DIM 0xFFFFFFF8
+#define V_030000_SQ_TEX_DIM_1D 0x00000000
+#define V_030000_SQ_TEX_DIM_2D 0x00000001
+#define V_030000_SQ_TEX_DIM_3D 0x00000002
+#define V_030000_SQ_TEX_DIM_CUBEMAP 0x00000003
+#define V_030000_SQ_TEX_DIM_1D_ARRAY 0x00000004
+#define V_030000_SQ_TEX_DIM_2D_ARRAY 0x00000005
+#define V_030000_SQ_TEX_DIM_2D_MSAA 0x00000006
+#define V_030000_SQ_TEX_DIM_2D_ARRAY_MSAA 0x00000007
+#define S_030000_PITCH(x) (((x) & 0xFFF) << 6)
+#define G_030000_PITCH(x) (((x) >> 6) & 0xFFF)
+#define C_030000_PITCH 0xFFFC003F
+#define S_030000_TEX_WIDTH(x) (((x) & 0x3FFF) << 18)
+#define G_030000_TEX_WIDTH(x) (((x) >> 18) & 0x3FFF)
+#define C_030000_TEX_WIDTH 0x0003FFFF
+#define R_030004_SQ_TEX_RESOURCE_WORD1_0 0x030004
+#define S_030004_TEX_HEIGHT(x) (((x) & 0x3FFF) << 0)
+#define G_030004_TEX_HEIGHT(x) (((x) >> 0) & 0x3FFF)
+#define C_030004_TEX_HEIGHT 0xFFFFC000
+#define S_030004_TEX_DEPTH(x) (((x) & 0x1FFF) << 14)
+#define G_030004_TEX_DEPTH(x) (((x) >> 14) & 0x1FFF)
+#define C_030004_TEX_DEPTH 0xF8003FFF
+#define S_030004_ARRAY_MODE(x) (((x) & 0xF) << 28)
+#define G_030004_ARRAY_MODE(x) (((x) >> 28) & 0xF)
+#define C_030004_ARRAY_MODE 0x0FFFFFFF
+#define R_030008_SQ_TEX_RESOURCE_WORD2_0 0x030008
+#define S_030008_BASE_ADDRESS(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_030008_BASE_ADDRESS(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_030008_BASE_ADDRESS 0x00000000
+#define R_03000C_SQ_TEX_RESOURCE_WORD3_0 0x03000C
+#define S_03000C_MIP_ADDRESS(x) (((x) & 0xFFFFFFFF) << 0)
+#define G_03000C_MIP_ADDRESS(x) (((x) >> 0) & 0xFFFFFFFF)
+#define C_03000C_MIP_ADDRESS 0x00000000
+#define R_030010_SQ_TEX_RESOURCE_WORD4_0 0x030010
+#define S_030010_FORMAT_COMP_X(x) (((x) & 0x3) << 0)
+#define G_030010_FORMAT_COMP_X(x) (((x) >> 0) & 0x3)
+#define C_030010_FORMAT_COMP_X 0xFFFFFFFC
+#define V_030010_SQ_FORMAT_COMP_UNSIGNED 0x00000000
+#define V_030010_SQ_FORMAT_COMP_SIGNED 0x00000001
+#define V_030010_SQ_FORMAT_COMP_UNSIGNED_BIASED 0x00000002
+#define S_030010_FORMAT_COMP_Y(x) (((x) & 0x3) << 2)
+#define G_030010_FORMAT_COMP_Y(x) (((x) >> 2) & 0x3)
+#define C_030010_FORMAT_COMP_Y 0xFFFFFFF3
+#define S_030010_FORMAT_COMP_Z(x) (((x) & 0x3) << 4)
+#define G_030010_FORMAT_COMP_Z(x) (((x) >> 4) & 0x3)
+#define C_030010_FORMAT_COMP_Z 0xFFFFFFCF
+#define S_030010_FORMAT_COMP_W(x) (((x) & 0x3) << 6)
+#define G_030010_FORMAT_COMP_W(x) (((x) >> 6) & 0x3)
+#define C_030010_FORMAT_COMP_W 0xFFFFFF3F
+#define S_030010_NUM_FORMAT_ALL(x) (((x) & 0x3) << 8)
+#define G_030010_NUM_FORMAT_ALL(x) (((x) >> 8) & 0x3)
+#define C_030010_NUM_FORMAT_ALL 0xFFFFFCFF
+#define V_030010_SQ_NUM_FORMAT_NORM 0x00000000
+#define V_030010_SQ_NUM_FORMAT_INT 0x00000001
+#define V_030010_SQ_NUM_FORMAT_SCALED 0x00000002
+#define S_030010_SRF_MODE_ALL(x) (((x) & 0x1) << 10)
+#define G_030010_SRF_MODE_ALL(x) (((x) >> 10) & 0x1)
+#define C_030010_SRF_MODE_ALL 0xFFFFFBFF
+#define V_030010_SFR_MODE_ZERO_CLAMP_MINUS_ONE 0x00000000
+#define V_030010_SFR_MODE_NO_ZERO 0x00000001
+#define S_030010_FORCE_DEGAMMA(x) (((x) & 0x1) << 11)
+#define G_030010_FORCE_DEGAMMA(x) (((x) >> 11) & 0x1)
+#define C_030010_FORCE_DEGAMMA 0xFFFFF7FF
+#define S_030010_ENDIAN_SWAP(x) (((x) & 0x3) << 12)
+#define G_030010_ENDIAN_SWAP(x) (((x) >> 12) & 0x3)
+#define C_030010_ENDIAN_SWAP 0xFFFFCFFF
+#define S_030010_REQUEST_SIZE(x) (((x) & 0x3) << 14)
+#define G_030010_REQUEST_SIZE(x) (((x) >> 14) & 0x3)
+#define C_030010_REQUEST_SIZE 0xFFFF3FFF
+#define S_030010_DST_SEL_X(x) (((x) & 0x7) << 16)
+#define G_030010_DST_SEL_X(x) (((x) >> 16) & 0x7)
+#define C_030010_DST_SEL_X 0xFFF8FFFF
+#define V_030010_SQ_SEL_X 0x00000000
+#define V_030010_SQ_SEL_Y 0x00000001
+#define V_030010_SQ_SEL_Z 0x00000002
+#define V_030010_SQ_SEL_W 0x00000003
+#define V_030010_SQ_SEL_0 0x00000004
+#define V_030010_SQ_SEL_1 0x00000005
+#define S_030010_DST_SEL_Y(x) (((x) & 0x7) << 19)
+#define G_030010_DST_SEL_Y(x) (((x) >> 19) & 0x7)
+#define C_030010_DST_SEL_Y 0xFFC7FFFF
+#define S_030010_DST_SEL_Z(x) (((x) & 0x7) << 22)
+#define G_030010_DST_SEL_Z(x) (((x) >> 22) & 0x7)
+#define C_030010_DST_SEL_Z 0xFE3FFFFF
+#define S_030010_DST_SEL_W(x) (((x) & 0x7) << 25)
+#define G_030010_DST_SEL_W(x) (((x) >> 25) & 0x7)
+#define C_030010_DST_SEL_W 0xF1FFFFFF
+#define S_030010_BASE_LEVEL(x) (((x) & 0xF) << 28)
+#define G_030010_BASE_LEVEL(x) (((x) >> 28) & 0xF)
+#define C_030010_BASE_LEVEL 0x0FFFFFFF
+#define R_030014_SQ_TEX_RESOURCE_WORD5_0 0x030014
+#define S_030014_LAST_LEVEL(x) (((x) & 0xF) << 0)
+#define G_030014_LAST_LEVEL(x) (((x) >> 0) & 0xF)
+#define C_030014_LAST_LEVEL 0xFFFFFFF0
+#define S_030014_BASE_ARRAY(x) (((x) & 0x1FFF) << 4)
+#define G_030014_BASE_ARRAY(x) (((x) >> 4) & 0x1FFF)
+#define C_030014_BASE_ARRAY 0xFFFE000F
+#define S_030014_LAST_ARRAY(x) (((x) & 0x1FFF) << 17)
+#define G_030014_LAST_ARRAY(x) (((x) >> 17) & 0x1FFF)
+#define C_030014_LAST_ARRAY 0xC001FFFF
+#define R_030018_SQ_TEX_RESOURCE_WORD6_0 0x030018
+#define S_030018_PERF_MODULATION(x) (((x) & 0x7) << 3)
+#define G_030018_PERF_MODULATION(x) (((x) >> 3) & 0x7)
+#define C_030018_PERF_MODULATION 0xFFFFFFC7
+#define S_030018_INTERLACED(x) (((x) & 0x1) << 6)
+#define G_030018_INTERLACED(x) (((x) >> 6) & 0x1)
+#define C_030018_INTERLACED 0xFFFFFFBF
+#define R_03001C_SQ_TEX_RESOURCE_WORD7_0 0x03001C
+#define S_03001C_TYPE(x) (((x) & 0x3) << 30)
+#define G_03001C_TYPE(x) (((x) >> 30) & 0x3)
+#define C_03001C_TYPE 0x3FFFFFFF
+#define V_03001C_SQ_TEX_VTX_INVALID_TEXTURE 0x00000000
+#define V_03001C_SQ_TEX_VTX_INVALID_BUFFER 0x00000001
+#define V_03001C_SQ_TEX_VTX_VALID_TEXTURE 0x00000002
+#define V_03001C_SQ_TEX_VTX_VALID_BUFFER 0x00000003
+#define S_03001C_DATA_FORMAT(x) (((x) & 0x3F) << 0)
+#define G_03001C_DATA_FORMAT(x) (((x) >> 0) & 0x3F)
+#define C_03001C_DATA_FORMAT 0xFFFFFFC0
+
+#define R_030008_SQ_VTX_CONSTANT_WORD2_0 0x030008
+#define S_030008_BASE_ADDRESS_HI(x) (((x) & 0xFF) << 0)
+#define G_030008_BASE_ADDRESS_HI(x) (((x) >> 0) & 0xFF)
+#define C_030008_BASE_ADDRESS_HI 0xFFFFFF00
+#define S_030008_STRIDE(x) (((x) & 0x7FF) << 8)
+#define G_030008_STRIDE(x) (((x) >> 8) & 0x7FF)
+#define C_030008_STRIDE 0xFFF800FF
+#define S_030008_CLAMP_X(x) (((x) & 0x1) << 19)
+#define G_030008_CLAMP_X(x) (((x) >> 19) & 0x1)
+#define C_030008_CLAMP_X 0xFFF7FFFF
+#define S_030008_DATA_FORMAT(x) (((x) & 0x3F) << 20)
+#define G_030008_DATA_FORMAT(x) (((x) >> 20) & 0x3F)
+#define C_030008_DATA_FORMAT 0xFC0FFFFF
+#define V_030008_COLOR_INVALID 0x00000000
+#define V_030008_COLOR_8 0x00000001
+#define V_030008_COLOR_4_4 0x00000002
+#define V_030008_COLOR_3_3_2 0x00000003
+#define V_030008_COLOR_16 0x00000005
+#define V_030008_COLOR_16_FLOAT 0x00000006
+#define V_030008_COLOR_8_8 0x00000007
+#define V_030008_COLOR_5_6_5 0x00000008
+#define V_030008_COLOR_6_5_5 0x00000009
+#define V_030008_COLOR_1_5_5_5 0x0000000A
+#define V_030008_COLOR_4_4_4_4 0x0000000B
+#define V_030008_COLOR_5_5_5_1 0x0000000C
+#define V_030008_COLOR_32 0x0000000D
+#define V_030008_COLOR_32_FLOAT 0x0000000E
+#define V_030008_COLOR_16_16 0x0000000F
+#define V_030008_COLOR_16_16_FLOAT 0x00000010
+#define V_030008_COLOR_8_24 0x00000011
+#define V_030008_COLOR_8_24_FLOAT 0x00000012
+#define V_030008_COLOR_24_8 0x00000013
+#define V_030008_COLOR_24_8_FLOAT 0x00000014
+#define V_030008_COLOR_10_11_11 0x00000015
+#define V_030008_COLOR_10_11_11_FLOAT 0x00000016
+#define V_030008_COLOR_11_11_10 0x00000017
+#define V_030008_COLOR_11_11_10_FLOAT 0x00000018
+#define V_030008_COLOR_2_10_10_10 0x00000019
+#define V_030008_COLOR_8_8_8_8 0x0000001A
+#define V_030008_COLOR_10_10_10_2 0x0000001B
+#define V_030008_COLOR_X24_8_32_FLOAT 0x0000001C
+#define V_030008_COLOR_32_32 0x0000001D
+#define V_030008_COLOR_32_32_FLOAT 0x0000001E
+#define V_030008_COLOR_16_16_16_16 0x0000001F
+#define V_030008_COLOR_16_16_16_16_FLOAT 0x00000020
+#define V_030008_COLOR_32_32_32_32 0x00000022
+#define V_030008_COLOR_32_32_32_32_FLOAT 0x00000023
+#define S_030008_NUM_FORMAT_ALL(x) (((x) & 0x3) << 26)
+#define G_030008_NUM_FORMAT_ALL(x) (((x) >> 26) & 0x3)
+#define C_030008_NUM_FORMAT_ALL 0xF3FFFFFF
+#define S_030008_FORMAT_COMP_ALL(x) (((x) & 0x1) << 28)
+#define G_030008_FORMAT_COMP_ALL(x) (((x) >> 28) & 0x1)
+#define C_030008_FORMAT_COMP_ALL 0xEFFFFFFF
+#define S_030008_SRF_MODE_ALL(x) (((x) & 0x1) << 29)
+#define G_030008_SRF_MODE_ALL(x) (((x) >> 29) & 0x1)
+#define C_030008_SRF_MODE_ALL 0xDFFFFFFF
+#define S_030008_ENDIAN_SWAP(x) (((x) & 0x3) << 30)
+#define G_030008_ENDIAN_SWAP(x) (((x) >> 30) & 0x3)
+#define C_030008_ENDIAN_SWAP 0x3FFFFFFF
+
+#define R_03000C_SQ_VTX_CONSTANT_WORD3_0 0x03000C
+#define S_03000C_DST_SEL_X(x) (((x) & 0x7) << 3)
+#define G_03000C_DST_SEL_X(x) (((x) >> 3) & 0x7)
+#define V_03000C_SQ_SEL_X 0x00000000
+#define V_03000C_SQ_SEL_Y 0x00000001
+#define V_03000C_SQ_SEL_Z 0x00000002
+#define V_03000C_SQ_SEL_W 0x00000003
+#define V_03000C_SQ_SEL_0 0x00000004
+#define V_03000C_SQ_SEL_1 0x00000005
+#define S_03000C_DST_SEL_Y(x) (((x) & 0x7) << 6)
+#define G_03000C_DST_SEL_Y(x) (((x) >> 6) & 0x7)
+#define S_03000C_DST_SEL_Z(x) (((x) & 0x7) << 9)
+#define G_03000C_DST_SEL_Z(x) (((x) >> 9) & 0x7)
+#define S_03000C_DST_SEL_W(x) (((x) & 0x7) << 12)
+#define G_03000C_DST_SEL_W(x) (((x) >> 12) & 0x7)
+
+#define R_03C000_SQ_TEX_SAMPLER_WORD0_0 0x03C000
+#define S_03C000_CLAMP_X(x) (((x) & 0x7) << 0)
+#define G_03C000_CLAMP_X(x) (((x) >> 0) & 0x7)
+#define C_03C000_CLAMP_X 0xFFFFFFF8
+#define V_03C000_SQ_TEX_WRAP 0x00000000
+#define V_03C000_SQ_TEX_MIRROR 0x00000001
+#define V_03C000_SQ_TEX_CLAMP_LAST_TEXEL 0x00000002
+#define V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL 0x00000003
+#define V_03C000_SQ_TEX_CLAMP_HALF_BORDER 0x00000004
+#define V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER 0x00000005
+#define V_03C000_SQ_TEX_CLAMP_BORDER 0x00000006
+#define V_03C000_SQ_TEX_MIRROR_ONCE_BORDER 0x00000007
+#define S_03C000_CLAMP_Y(x) (((x) & 0x7) << 3)
+#define G_03C000_CLAMP_Y(x) (((x) >> 3) & 0x7)
+#define C_03C000_CLAMP_Y 0xFFFFFFC7
+#define S_03C000_CLAMP_Z(x) (((x) & 0x7) << 6)
+#define G_03C000_CLAMP_Z(x) (((x) >> 6) & 0x7)
+#define C_03C000_CLAMP_Z 0xFFFFFE3F
+#define S_03C000_XY_MAG_FILTER(x) (((x) & 0x3) << 9)
+#define G_03C000_XY_MAG_FILTER(x) (((x) >> 9) & 0x3)
+#define C_03C000_XY_MAG_FILTER 0xFFFFF9FF
+#define V_03C000_SQ_TEX_XY_FILTER_POINT 0x00000000
+#define V_03C000_SQ_TEX_XY_FILTER_BILINEAR 0x00000001
+#define S_03C000_XY_MIN_FILTER(x) (((x) & 0x3) << 11)
+#define G_03C000_XY_MIN_FILTER(x) (((x) >> 11) & 0x3)
+#define C_03C000_XY_MIN_FILTER 0xFFFFE7FF
+#define S_03C000_Z_FILTER(x) (((x) & 0x3) << 13)
+#define G_03C000_Z_FILTER(x) (((x) >> 13) & 0x3)
+#define C_03C000_Z_FILTER 0xFFFF9FFF
+#define V_03C000_SQ_TEX_Z_FILTER_NONE 0x00000000
+#define V_03C000_SQ_TEX_Z_FILTER_POINT 0x00000001
+#define V_03C000_SQ_TEX_Z_FILTER_LINEAR 0x00000002
+#define S_03C000_MIP_FILTER(x) (((x) & 0x3) << 15)
+#define G_03C000_MIP_FILTER(x) (((x) >> 15) & 0x3)
+#define C_03C000_MIP_FILTER 0xFFFE7FFF
+#define S_03C000_BORDER_COLOR_TYPE(x) (((x) & 0x3) << 20)
+#define G_03C000_BORDER_COLOR_TYPE(x) (((x) >> 20) & 0x3)
+#define C_03C000_BORDER_COLOR_TYPE 0xFFCFFFFF
+#define V_03C000_SQ_TEX_BORDER_COLOR_TRANS_BLACK 0x00000000
+#define V_03C000_SQ_TEX_BORDER_COLOR_OPAQUE_BLACK 0x00000001
+#define V_03C000_SQ_TEX_BORDER_COLOR_OPAQUE_WHITE 0x00000002
+#define V_03C000_SQ_TEX_BORDER_COLOR_REGISTER 0x00000003
+#define S_03C000_DEPTH_COMPARE_FUNCTION(x) (((x) & 0x7) << 22)
+#define G_03C000_DEPTH_COMPARE_FUNCTION(x) (((x) >> 22) & 0x7)
+#define C_03C000_DEPTH_COMPARE_FUNCTION 0xFE3FFFFF
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_NEVER 0x00000000
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_LESS 0x00000001
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_EQUAL 0x00000002
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_LESSEQUAL 0x00000003
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_GREATER 0x00000004
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_NOTEQUAL 0x00000005
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_GREATEREQUAL 0x00000006
+#define V_03C000_SQ_TEX_DEPTH_COMPARE_ALWAYS 0x00000007
+#define S_03C000_CHROMA_KEY(x) (((x) & 0x3) << 25)
+#define G_03C000_CHROMA_KEY(x) (((x) >> 25) & 0x3)
+#define C_03C000_CHROMA_KEY 0xF9FFFFFF
+#define V_03C000_SQ_TEX_CHROMA_KEY_DISABLE 0x00000000
+#define V_03C000_SQ_TEX_CHROMA_KEY_KILL 0x00000001
+#define V_03C000_SQ_TEX_CHROMA_KEY_BLEND 0x00000002
+
+#define R_03C004_SQ_TEX_SAMPLER_WORD1_0 0x03C004
+#define S_03C004_MIN_LOD(x) (((x) & 0xFFF) << 0)
+#define G_03C004_MIN_LOD(x) (((x) >> 0) & 0xFFF)
+#define C_03C004_MIN_LOD 0xFFFFF000
+#define S_03C004_MAX_LOD(x) (((x) & 0xFFF) << 12)
+#define G_03C004_MAX_LOD(x) (((x) >> 12) & 0xFFF)
+#define C_03C004_MAX_LOD 0xFF000FFF
+
+#define S_03C004_PERF_MIP(x) (((x) & 0xF) << 24)
+#define G_03C004_PERF_MIP(x) (((x) >> 24) & 0xF)
+#define C_03C004_PERF_MIP 0xF0FFFFFF
+#define S_03C004_PERF_Z(x) (((x) & 0xF) << 28)
+#define G_03C004_PERF_Z(x) (((x) >> 24) & 0xF)
+#define C_03C004_PERF_Z 0x0FFFFFFF
+
+#define R_03C008_SQ_TEX_SAMPLER_WORD2_0 0x03C008
+#define S_03C008_LOD_BIAS(x) (((x) & 0x3FFF) << 0)
+#define G_03C008_LOD_BIAS(x) (((x) >> 0) & 0x3FFF)
+#define C_03C008_LOD_BIAS 0xFFFFC000
+#define S_03C008_LOD_BIAS_SEC(x) (((x) & 0x3F) << 14)
+#define G_03C008_LOD_BIAS_SEC(x) (((x) >> 14) & 0x3F)
+#define C_03C008_LOD_BIAS_SEC 0xFFF03FFF
+#define S_03C008_MC_COORD_TRUNCATE(x) (((x) & 0x1) << 20)
+#define G_03C008_MC_COORD_TRUNCATE(x) (((x) >> 20) & 0x1)
+#define C_03C008_MC_COORD_TRUNCATE 0xFFEFFFFF
+#define S_03C008_FORCE_DEGAMMA(x) (((x) & 0x1) << 21)
+#define G_03C008_FORCE_DEGAMMA(x) (((x) >> 21) & 0x1)
+#define C_03C008_FORCE_DEGAMMA 0xFFDFFFFF
+#define S_03C008_TYPE(x) (((x) & 0x1) << 31)
+#define G_03C008_TYPE(x) (((x) >> 31) & 0x1)
+#define C_03C008_TYPE 0x7FFFFFFF
+
+#define R_008958_VGT_PRIMITIVE_TYPE 0x008958
+#define S_008958_PRIM_TYPE(x) (((x) & 0x3F) << 0)
+#define G_008958_PRIM_TYPE(x) (((x) >> 0) & 0x3F)
+#define C_008958_PRIM_TYPE 0xFFFFFFC0
+#define V_008958_DI_PT_NONE 0x00000000
+#define V_008958_DI_PT_POINTLIST 0x00000001
+#define V_008958_DI_PT_LINELIST 0x00000002
+#define V_008958_DI_PT_LINESTRIP 0x00000003
+#define V_008958_DI_PT_TRILIST 0x00000004
+#define V_008958_DI_PT_TRIFAN 0x00000005
+#define V_008958_DI_PT_TRISTRIP 0x00000006
+#define V_008958_DI_PT_UNUSED_0 0x00000007
+#define V_008958_DI_PT_UNUSED_1 0x00000008
+#define V_008958_DI_PT_UNUSED_2 0x00000009
+#define V_008958_DI_PT_LINELIST_ADJ 0x0000000A
+#define V_008958_DI_PT_LINESTRIP_ADJ 0x0000000B
+#define V_008958_DI_PT_TRILIST_ADJ 0x0000000C
+#define V_008958_DI_PT_TRISTRIP_ADJ 0x0000000D
+#define V_008958_DI_PT_UNUSED_3 0x0000000E
+#define V_008958_DI_PT_UNUSED_4 0x0000000F
+#define V_008958_DI_PT_TRI_WITH_WFLAGS 0x00000010
+#define V_008958_DI_PT_RECTLIST 0x00000011
+#define V_008958_DI_PT_LINELOOP 0x00000012
+#define V_008958_DI_PT_QUADLIST 0x00000013
+#define V_008958_DI_PT_QUADSTRIP 0x00000014
+#define V_008958_DI_PT_POLYGON 0x00000015
+#define V_008958_DI_PT_2D_COPY_RECT_LIST_V0 0x00000016
+#define V_008958_DI_PT_2D_COPY_RECT_LIST_V1 0x00000017
+#define V_008958_DI_PT_2D_COPY_RECT_LIST_V2 0x00000018
+#define V_008958_DI_PT_2D_COPY_RECT_LIST_V3 0x00000019
+#define V_008958_DI_PT_2D_FILL_RECT_LIST 0x0000001A
+#define V_008958_DI_PT_2D_LINE_STRIP 0x0000001B
+#define V_008958_DI_PT_2D_TRI_STRIP 0x0000001C
+#define R_02881C_PA_CL_VS_OUT_CNTL 0x02881C
+#define S_02881C_CLIP_DIST_ENA_0(x) (((x) & 0x1) << 0)
+#define G_02881C_CLIP_DIST_ENA_0(x) (((x) >> 0) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_0 0xFFFFFFFE
+#define S_02881C_CLIP_DIST_ENA_1(x) (((x) & 0x1) << 1)
+#define G_02881C_CLIP_DIST_ENA_1(x) (((x) >> 1) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_1 0xFFFFFFFD
+#define S_02881C_CLIP_DIST_ENA_2(x) (((x) & 0x1) << 2)
+#define G_02881C_CLIP_DIST_ENA_2(x) (((x) >> 2) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_2 0xFFFFFFFB
+#define S_02881C_CLIP_DIST_ENA_3(x) (((x) & 0x1) << 3)
+#define G_02881C_CLIP_DIST_ENA_3(x) (((x) >> 3) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_3 0xFFFFFFF7
+#define S_02881C_CLIP_DIST_ENA_4(x) (((x) & 0x1) << 4)
+#define G_02881C_CLIP_DIST_ENA_4(x) (((x) >> 4) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_4 0xFFFFFFEF
+#define S_02881C_CLIP_DIST_ENA_5(x) (((x) & 0x1) << 5)
+#define G_02881C_CLIP_DIST_ENA_5(x) (((x) >> 5) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_5 0xFFFFFFDF
+#define S_02881C_CLIP_DIST_ENA_6(x) (((x) & 0x1) << 6)
+#define G_02881C_CLIP_DIST_ENA_6(x) (((x) >> 6) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_6 0xFFFFFFBF
+#define S_02881C_CLIP_DIST_ENA_7(x) (((x) & 0x1) << 7)
+#define G_02881C_CLIP_DIST_ENA_7(x) (((x) >> 7) & 0x1)
+#define C_02881C_CLIP_DIST_ENA_7 0xFFFFFF7F
+#define S_02881C_CULL_DIST_ENA_0(x) (((x) & 0x1) << 8)
+#define G_02881C_CULL_DIST_ENA_0(x) (((x) >> 8) & 0x1)
+#define C_02881C_CULL_DIST_ENA_0 0xFFFFFEFF
+#define S_02881C_CULL_DIST_ENA_1(x) (((x) & 0x1) << 9)
+#define G_02881C_CULL_DIST_ENA_1(x) (((x) >> 9) & 0x1)
+#define C_02881C_CULL_DIST_ENA_1 0xFFFFFDFF
+#define S_02881C_CULL_DIST_ENA_2(x) (((x) & 0x1) << 10)
+#define G_02881C_CULL_DIST_ENA_2(x) (((x) >> 10) & 0x1)
+#define C_02881C_CULL_DIST_ENA_2 0xFFFFFBFF
+#define S_02881C_CULL_DIST_ENA_3(x) (((x) & 0x1) << 11)
+#define G_02881C_CULL_DIST_ENA_3(x) (((x) >> 11) & 0x1)
+#define C_02881C_CULL_DIST_ENA_3 0xFFFFF7FF
+#define S_02881C_CULL_DIST_ENA_4(x) (((x) & 0x1) << 12)
+#define G_02881C_CULL_DIST_ENA_4(x) (((x) >> 12) & 0x1)
+#define C_02881C_CULL_DIST_ENA_4 0xFFFFEFFF
+#define S_02881C_CULL_DIST_ENA_5(x) (((x) & 0x1) << 13)
+#define G_02881C_CULL_DIST_ENA_5(x) (((x) >> 13) & 0x1)
+#define C_02881C_CULL_DIST_ENA_5 0xFFFFDFFF
+#define S_02881C_CULL_DIST_ENA_6(x) (((x) & 0x1) << 14)
+#define G_02881C_CULL_DIST_ENA_6(x) (((x) >> 14) & 0x1)
+#define C_02881C_CULL_DIST_ENA_6 0xFFFFBFFF
+#define S_02881C_CULL_DIST_ENA_7(x) (((x) & 0x1) << 15)
+#define G_02881C_CULL_DIST_ENA_7(x) (((x) >> 15) & 0x1)
+#define C_02881C_CULL_DIST_ENA_7 0xFFFF7FFF
+#define S_02881C_USE_VTX_POINT_SIZE(x) (((x) & 0x1) << 16)
+#define G_02881C_USE_VTX_POINT_SIZE(x) (((x) >> 16) & 0x1)
+#define C_02881C_USE_VTX_POINT_SIZE 0xFFFEFFFF
+#define S_02881C_USE_VTX_EDGE_FLAG(x) (((x) & 0x1) << 17)
+#define G_02881C_USE_VTX_EDGE_FLAG(x) (((x) >> 17) & 0x1)
+#define C_02881C_USE_VTX_EDGE_FLAG 0xFFFDFFFF
+#define S_02881C_USE_VTX_RENDER_TARGET_INDX(x) (((x) & 0x1) << 18)
+#define G_02881C_USE_VTX_RENDER_TARGET_INDX(x) (((x) >> 18) & 0x1)
+#define C_02881C_USE_VTX_RENDER_TARGET_INDX 0xFFFBFFFF
+#define S_02881C_USE_VTX_VIEWPORT_INDX(x) (((x) & 0x1) << 19)
+#define G_02881C_USE_VTX_VIEWPORT_INDX(x) (((x) >> 19) & 0x1)
+#define C_02881C_USE_VTX_VIEWPORT_INDX 0xFFF7FFFF
+#define S_02881C_USE_VTX_KILL_FLAG(x) (((x) & 0x1) << 20)
+#define G_02881C_USE_VTX_KILL_FLAG(x) (((x) >> 20) & 0x1)
+#define C_02881C_USE_VTX_KILL_FLAG 0xFFEFFFFF
+#define S_02881C_VS_OUT_MISC_VEC_ENA(x) (((x) & 0x1) << 21)
+#define G_02881C_VS_OUT_MISC_VEC_ENA(x) (((x) >> 21) & 0x1)
+#define C_02881C_VS_OUT_MISC_VEC_ENA 0xFFDFFFFF
+#define S_02881C_VS_OUT_CCDIST0_VEC_ENA(x) (((x) & 0x1) << 22)
+#define G_02881C_VS_OUT_CCDIST0_VEC_ENA(x) (((x) >> 22) & 0x1)
+#define C_02881C_VS_OUT_CCDIST0_VEC_ENA 0xFFBFFFFF
+#define S_02881C_VS_OUT_CCDIST1_VEC_ENA(x) (((x) & 0x1) << 23)
+#define G_02881C_VS_OUT_CCDIST1_VEC_ENA(x) (((x) >> 23) & 0x1)
+#define C_02881C_VS_OUT_CCDIST1_VEC_ENA 0xFF7FFFFF
+/* diff */
+#define R_028860_SQ_PGM_RESOURCES_VS 0x028860
+#define S_028860_NUM_GPRS(x) (((x) & 0xFF) << 0)
+#define G_028860_NUM_GPRS(x) (((x) >> 0) & 0xFF)
+#define C_028860_NUM_GPRS 0xFFFFFF00
+#define S_028860_STACK_SIZE(x) (((x) & 0xFF) << 8)
+#define G_028860_STACK_SIZE(x) (((x) >> 8) & 0xFF)
+#define C_028860_STACK_SIZE 0xFFFF00FF
+#define S_028860_DX10_CLAMP(x) (((x) & 0x1) << 21)
+#define G_028860_DX10_CLAMP(x) (((x) >> 21) & 0x1)
+#define C_028860_DX10_CLAMP 0xFFDFFFFF
+#define S_028860_UNCACHED_FIRST_INST(x) (((x) & 0x1) << 28)
+#define G_028860_UNCACHED_FIRST_INST(x) (((x) >> 28) & 0x1)
+#define C_028860_UNCACHED_FIRST_INST 0xEFFFFFFF
+#define R_028864_SQ_PGM_RESOURCES_2_VS 0x028864
+
+#define R_028844_SQ_PGM_RESOURCES_PS 0x028844
+#define S_028844_NUM_GPRS(x) (((x) & 0xFF) << 0)
+#define G_028844_NUM_GPRS(x) (((x) >> 0) & 0xFF)
+#define C_028844_NUM_GPRS 0xFFFFFF00
+#define S_028844_STACK_SIZE(x) (((x) & 0xFF) << 8)
+#define G_028844_STACK_SIZE(x) (((x) >> 8) & 0xFF)
+#define C_028844_STACK_SIZE 0xFFFF00FF
+#define S_028844_DX10_CLAMP(x) (((x) & 0x1) << 21)
+#define G_028844_DX10_CLAMP(x) (((x) >> 21) & 0x1)
+#define C_028844_DX10_CLAMP 0xFFDFFFFF
+#define S_028844_PRIME_CACHE_ON_DRAW(x) (((x) & 0x1) << 23)
+#define G_028844_PRIME_CACHE_ON_DRAW(x) (((x) >> 23) & 0x1)
+
+#define S_028844_UNCACHED_FIRST_INST(x) (((x) & 0x1) << 28)
+#define G_028844_UNCACHED_FIRST_INST(x) (((x) >> 28) & 0x1)
+#define C_028844_UNCACHED_FIRST_INST 0xEFFFFFFF
+#define S_028844_CLAMP_CONSTS(x) (((x) & 0x1) << 31)
+#define G_028844_CLAMP_CONSTS(x) (((x) >> 31) & 0x1)
+#define C_028844_CLAMP_CONSTS 0x7FFFFFFF
+#define R_028848_SQ_PGM_RESOURCES_2_PS 0x028848
+
+#define R_028644_SPI_PS_INPUT_CNTL_0 0x028644
+#define S_028644_SEMANTIC(x) (((x) & 0xFF) << 0)
+#define G_028644_SEMANTIC(x) (((x) >> 0) & 0xFF)
+#define C_028644_SEMANTIC 0xFFFFFF00
+#define S_028644_DEFAULT_VAL(x) (((x) & 0x3) << 8)
+#define G_028644_DEFAULT_VAL(x) (((x) >> 8) & 0x3)
+#define C_028644_DEFAULT_VAL 0xFFFFFCFF
+#define S_028644_FLAT_SHADE(x) (((x) & 0x1) << 10)
+#define G_028644_FLAT_SHADE(x) (((x) >> 10) & 0x1)
+#define C_028644_FLAT_SHADE 0xFFFFFBFF
+#define S_028644_SEL_CENTROID(x) (((x) & 0x1) << 11)
+#define G_028644_SEL_CENTROID(x) (((x) >> 11) & 0x1)
+#define C_028644_SEL_CENTROID 0xFFFFF7FF
+#define S_028644_SEL_LINEAR(x) (((x) & 0x1) << 12)
+#define G_028644_SEL_LINEAR(x) (((x) >> 12) & 0x1)
+#define C_028644_SEL_LINEAR 0xFFFFEFFF
+#define S_028644_CYL_WRAP(x) (((x) & 0xF) << 13)
+#define G_028644_CYL_WRAP(x) (((x) >> 13) & 0xF)
+#define C_028644_CYL_WRAP 0xFFFE1FFF
+#define S_028644_PT_SPRITE_TEX(x) (((x) & 0x1) << 17)
+#define G_028644_PT_SPRITE_TEX(x) (((x) >> 17) & 0x1)
+#define C_028644_PT_SPRITE_TEX 0xFFFDFFFF
+#define S_028644_SEL_SAMPLE(x) (((x) & 0x1) << 18)
+#define G_028644_SEL_SAMPLE(x) (((x) >> 18) & 0x1)
+#define C_028644_SEL_SAMPLE 0xFFFBFFFF
+#define R_0286D4_SPI_INTERP_CONTROL_0 0x0286D4
+#define S_0286D4_FLAT_SHADE_ENA(x) (((x) & 0x1) << 0)
+#define G_0286D4_FLAT_SHADE_ENA(x) (((x) >> 0) & 0x1)
+#define C_0286D4_FLAT_SHADE_ENA 0xFFFFFFFE
+#define S_0286D4_PNT_SPRITE_ENA(x) (((x) & 0x1) << 1)
+#define G_0286D4_PNT_SPRITE_ENA(x) (((x) >> 1) & 0x1)
+#define C_0286D4_PNT_SPRITE_ENA 0xFFFFFFFD
+#define S_0286D4_PNT_SPRITE_OVRD_X(x) (((x) & 0x7) << 2)
+#define G_0286D4_PNT_SPRITE_OVRD_X(x) (((x) >> 2) & 0x7)
+#define C_0286D4_PNT_SPRITE_OVRD_X 0xFFFFFFE3
+#define S_0286D4_PNT_SPRITE_OVRD_Y(x) (((x) & 0x7) << 5)
+#define G_0286D4_PNT_SPRITE_OVRD_Y(x) (((x) >> 5) & 0x7)
+#define C_0286D4_PNT_SPRITE_OVRD_Y 0xFFFFFF1F
+#define S_0286D4_PNT_SPRITE_OVRD_Z(x) (((x) & 0x7) << 8)
+#define G_0286D4_PNT_SPRITE_OVRD_Z(x) (((x) >> 8) & 0x7)
+#define C_0286D4_PNT_SPRITE_OVRD_Z 0xFFFFF8FF
+#define S_0286D4_PNT_SPRITE_OVRD_W(x) (((x) & 0x7) << 11)
+#define G_0286D4_PNT_SPRITE_OVRD_W(x) (((x) >> 11) & 0x7)
+#define C_0286D4_PNT_SPRITE_OVRD_W 0xFFFFC7FF
+#define S_0286D4_PNT_SPRITE_TOP_1(x) (((x) & 0x1) << 14)
+#define G_0286D4_PNT_SPRITE_TOP_1(x) (((x) >> 14) & 0x1)
+#define C_0286D4_PNT_SPRITE_TOP_1 0xFFFFBFFF
+
+#define SQ_TEX_INST_LD 0x03
+#define SQ_TEX_INST_GET_GRADIENTS_H 0x7
+#define SQ_TEX_INST_GET_GRADIENTS_V 0x8
+
+#define SQ_TEX_INST_SAMPLE 0x10
+#define SQ_TEX_INST_SAMPLE_L 0x11
+#define SQ_TEX_INST_SAMPLE_C 0x18
+#endif
diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index 6483dac703..662b9b9115 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -24,9 +24,61 @@
#include "r600_context.h"
#include "util/u_memory.h"
#include "r600_sq.h"
+#include "r600_opcodes.h"
#include <stdio.h>
#include <errno.h>
+static inline unsigned int r600_bc_get_num_operands(struct r600_bc_alu *alu)
+{
+ if(alu->is_op3)
+ return 3;
+
+ switch (alu->inst) {
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP:
+ return 0;
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE:
+ return 2;
+
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN:
+ case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS:
+ return 1;
+
+ default: R600_ERR(
+ "Need instruction operand number for 0x%x.\n", alu->inst);
+ };
+
+ return 3;
+}
+
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id);
static struct r600_bc_cf *r600_bc_cf(void)
@@ -49,6 +101,7 @@ static struct r600_bc_alu *r600_bc_alu(void)
if (alu == NULL)
return NULL;
LIST_INITHEAD(&alu->list);
+ LIST_INITHEAD(&alu->bs_list);
return alu;
}
@@ -93,6 +146,13 @@ int r600_bc_init(struct r600_bc *bc, enum radeon_family family)
case CHIP_RV740:
bc->chiprev = 1;
break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ bc->chiprev = 2;
+ break;
default:
R600_ERR("unknown family %d\n", bc->family);
return -EINVAL;
@@ -128,6 +188,224 @@ int r600_bc_add_output(struct r600_bc *bc, const struct r600_bc_output *output)
return 0;
}
+const unsigned bank_swizzle_vec[8] = {SQ_ALU_VEC_210, //000
+ SQ_ALU_VEC_120, //001
+ SQ_ALU_VEC_102, //010
+
+ SQ_ALU_VEC_201, //011
+ SQ_ALU_VEC_012, //100
+ SQ_ALU_VEC_021, //101
+
+ SQ_ALU_VEC_012, //110
+ SQ_ALU_VEC_012}; //111
+
+const unsigned bank_swizzle_scl[8] = {SQ_ALU_SCL_210, //000
+ SQ_ALU_SCL_122, //001
+ SQ_ALU_SCL_122, //010
+
+ SQ_ALU_SCL_221, //011
+ SQ_ALU_SCL_212, //100
+ SQ_ALU_SCL_122, //101
+
+ SQ_ALU_SCL_122, //110
+ SQ_ALU_SCL_122}; //111
+
+static int init_gpr(struct r600_bc_alu *alu)
+{
+ int cycle, component;
+ /* set up gpr use */
+ for (cycle = 0; cycle < NUM_OF_CYCLES; cycle++)
+ for (component = 0; component < NUM_OF_COMPONENTS; component++)
+ alu->hw_gpr[cycle][component] = -1;
+ return 0;
+}
+
+#if 0
+static int reserve_gpr(struct r600_bc_alu *alu, unsigned sel, unsigned chan, unsigned cycle)
+{
+ if (alu->hw_gpr[cycle][chan] < 0)
+ alu->hw_gpr[cycle][chan] = sel;
+ else if (alu->hw_gpr[cycle][chan] != (int)sel) {
+ R600_ERR("Another scalar operation has already used GPR read port for channel\n");
+ return -1;
+ }
+ return 0;
+}
+
+static int cycle_for_scalar_bank_swizzle(const int swiz, const int sel, unsigned *p_cycle)
+{
+ int table[3];
+ int ret = 0;
+ switch (swiz) {
+ case SQ_ALU_SCL_210:
+ table[0] = 2; table[1] = 1; table[2] = 0;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_SCL_122:
+ table[0] = 1; table[1] = 2; table[2] = 2;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_SCL_212:
+ table[0] = 2; table[1] = 1; table[2] = 2;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_SCL_221:
+ table[0] = 2; table[1] = 2; table[2] = 1;
+ *p_cycle = table[sel];
+ break;
+ break;
+ default:
+ R600_ERR("bad scalar bank swizzle value\n");
+ ret = -1;
+ break;
+ }
+ return ret;
+}
+
+static int cycle_for_vector_bank_swizzle(const int swiz, const int sel, unsigned *p_cycle)
+{
+ int table[3];
+ int ret;
+
+ switch (swiz) {
+ case SQ_ALU_VEC_012:
+ table[0] = 0; table[1] = 1; table[2] = 2;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_VEC_021:
+ table[0] = 0; table[1] = 2; table[2] = 1;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_VEC_120:
+ table[0] = 1; table[1] = 2; table[2] = 0;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_VEC_102:
+ table[0] = 1; table[1] = 0; table[2] = 2;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_VEC_201:
+ table[0] = 2; table[1] = 0; table[2] = 1;
+ *p_cycle = table[sel];
+ break;
+ case SQ_ALU_VEC_210:
+ table[0] = 2; table[1] = 1; table[2] = 0;
+ *p_cycle = table[sel];
+ break;
+ default:
+ R600_ERR("bad vector bank swizzle value\n");
+ ret = -1;
+ break;
+ }
+ return ret;
+}
+
+
+
+static void update_chan_counter(struct r600_bc_alu *alu, int *chan_counter)
+{
+ int num_src;
+ int i;
+ int channel_swizzle;
+
+ num_src = r600_bc_get_num_operands(alu);
+
+ for (i = 0; i < num_src; i++) {
+ channel_swizzle = alu->src[i].chan;
+ if ((alu->src[i].sel > 0 && alu->src[i].sel < 128) && channel_swizzle <= 3)
+ chan_counter[channel_swizzle]++;
+ }
+}
+
+/* we need something like this I think - but this is bogus */
+int check_read_slots(struct r600_bc *bc, struct r600_bc_alu *alu_first)
+{
+ struct r600_bc_alu *alu;
+ int chan_counter[4] = { 0 };
+
+ update_chan_counter(alu_first, chan_counter);
+
+ LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
+ update_chan_counter(alu, chan_counter);
+ }
+
+ if (chan_counter[0] > 3 ||
+ chan_counter[1] > 3 ||
+ chan_counter[2] > 3 ||
+ chan_counter[3] > 3) {
+ R600_ERR("needed to split instruction for input ran out of banks %x %d %d %d %d\n",
+ alu_first->inst, chan_counter[0], chan_counter[1], chan_counter[2], chan_counter[3]);
+ return -1;
+ }
+ return 0;
+}
+#endif
+
+static int is_const(int sel)
+{
+ if (sel > 255 && sel < 512)
+ return 1;
+ if (sel >= V_SQ_ALU_SRC_0 && sel <= V_SQ_ALU_SRC_LITERAL)
+ return 1;
+ return 0;
+}
+
+static int check_scalar(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+ unsigned swizzle_key;
+
+ if (alu->bank_swizzle_force) {
+ alu->bank_swizzle = alu->bank_swizzle_force;
+ return 0;
+ }
+ swizzle_key = (is_const(alu->src[0].sel) ? 4 : 0 ) +
+ (is_const(alu->src[1].sel) ? 2 : 0 ) +
+ (is_const(alu->src[2].sel) ? 1 : 0 );
+
+ alu->bank_swizzle = bank_swizzle_scl[swizzle_key];
+ return 0;
+}
+
+static int check_vector(struct r600_bc *bc, struct r600_bc_alu *alu)
+{
+ unsigned swizzle_key;
+
+ if (alu->bank_swizzle_force) {
+ alu->bank_swizzle = alu->bank_swizzle_force;
+ return 0;
+ }
+ swizzle_key = (is_const(alu->src[0].sel) ? 4 : 0 ) +
+ (is_const(alu->src[1].sel) ? 2 : 0 ) +
+ (is_const(alu->src[2].sel) ? 1 : 0 );
+
+ alu->bank_swizzle = bank_swizzle_vec[swizzle_key];
+ return 0;
+}
+
+static int check_and_set_bank_swizzle(struct r600_bc *bc, struct r600_bc_alu *alu_first)
+{
+ struct r600_bc_alu *alu = NULL;
+ int num_instr = 1;
+
+ init_gpr(alu_first);
+
+ LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
+ num_instr++;
+ }
+
+ if (num_instr == 1) {
+ check_scalar(bc, alu_first);
+
+ } else {
+/* check_read_slots(bc, bc->cf_last->curr_bs_head);*/
+ check_vector(bc, alu_first);
+ LIST_FOR_EACH_ENTRY(alu, &alu_first->bs_list, bs_list) {
+ check_vector(bc, alu);
+ }
+ }
+ return 0;
+}
+
int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int type)
{
struct r600_bc_alu *nalu = r600_bc_alu();
@@ -150,6 +428,12 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
}
bc->cf_last->inst = (type << 3);
}
+ if (!bc->cf_last->curr_bs_head) {
+ bc->cf_last->curr_bs_head = nalu;
+ LIST_INITHEAD(&nalu->bs_list);
+ } else {
+ LIST_ADDTAIL(&nalu->bs_list, &bc->cf_last->curr_bs_head->bs_list);
+ }
if (alu->last && (bc->cf_last->ndw >> 1) >= 124) {
bc->force_add_cf = 1;
}
@@ -180,12 +464,21 @@ int r600_bc_add_alu_type(struct r600_bc *bc, const struct r600_bc_alu *alu, int
/* each alu use 2 dwords */
bc->cf_last->ndw += 2;
bc->ndw += 2;
+
+ if (bc->use_mem_constant)
+ bc->cf_last->kcache0_mode = 2;
+
+ /* process cur ALU instructions for bank swizzle */
+ if (alu->last) {
+ check_and_set_bank_swizzle(bc, bc->cf_last->curr_bs_head);
+ bc->cf_last->curr_bs_head = NULL;
+ }
return 0;
}
int r600_bc_add_alu(struct r600_bc *bc, const struct r600_bc_alu *alu)
{
- return r600_bc_add_alu_type(bc, alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU);
+ return r600_bc_add_alu_type(bc, alu, BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
}
int r600_bc_add_literal(struct r600_bc *bc, const u32 *value)
@@ -198,6 +491,7 @@ int r600_bc_add_literal(struct r600_bc *bc, const u32 *value)
if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_TEX) {
return 0;
}
+ /* all same on EG */
if (bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_JUMP ||
bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_ELSE ||
bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL ||
@@ -207,6 +501,7 @@ int r600_bc_add_literal(struct r600_bc *bc, const u32 *value)
bc->cf_last->inst == V_SQ_CF_WORD1_SQ_CF_INST_POP) {
return 0;
}
+ /* same on EG */
if (((bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3)) &&
(bc->cf_last->inst != (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3))) ||
LIST_IS_EMPTY(&bc->cf_last->alu)) {
@@ -289,6 +584,7 @@ int r600_bc_add_cfinst(struct r600_bc *bc, int inst)
return 0;
}
+/* common to all 3 families */
static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsigned id)
{
bc->bytecode[id++] = S_SQ_VTX_WORD0_BUFFER_ID(vtx->buffer_id) |
@@ -306,6 +602,7 @@ static int r600_bc_vtx_build(struct r600_bc *bc, struct r600_bc_vtx *vtx, unsign
return 0;
}
+/* common to all 3 families */
static int r600_bc_tex_build(struct r600_bc *bc, struct r600_bc_tex *tex, unsigned id)
{
bc->bytecode[id++] = S_SQ_TEX_WORD0_TEX_INST(tex->inst) |
@@ -335,6 +632,7 @@ static int r600_bc_tex_build(struct r600_bc *bc, struct r600_bc_tex *tex, unsign
return 0;
}
+/* r600 only, r700/eg bits in r700_asm.c */
static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
{
unsigned i;
@@ -360,7 +658,7 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
S_SQ_ALU_WORD1_OP3_SRC2_CHAN(alu->src[2].chan) |
S_SQ_ALU_WORD1_OP3_SRC2_NEG(alu->src[2].neg) |
S_SQ_ALU_WORD1_OP3_ALU_INST(alu->inst) |
- S_SQ_ALU_WORD1_BANK_SWIZZLE(0);
+ S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle);
} else {
bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) |
@@ -370,13 +668,13 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) |
S_SQ_ALU_WORD1_OP2_WRITE_MASK(alu->dst.write) |
S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) |
- S_SQ_ALU_WORD1_BANK_SWIZZLE(0) |
+ S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) |
S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) |
S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate);
}
if (alu->last) {
if (alu->nliteral && !alu->literal_added) {
- R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n");
+ R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n", alu->inst);
}
for (i = 0; i < alu->nliteral; i++) {
bc->bytecode[id++] = alu->value[i];
@@ -385,6 +683,7 @@ static int r600_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsign
return 0;
}
+/* common for r600/r700 - eg in eg_asm.c */
static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
{
unsigned id = cf->id;
@@ -392,7 +691,9 @@ static int r600_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf)
switch (cf->inst) {
case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU << 3):
case (V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE << 3):
- bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1);
+ bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
+ S_SQ_CF_ALU_WORD0_KCACHE_MODE0(cf->kcache0_mode);
+
bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(cf->inst >> 3) |
S_SQ_CF_ALU_WORD1_BARRIER(1) |
S_SQ_CF_ALU_WORD1_COUNT((cf->ndw / 2) - 1);
@@ -469,6 +770,8 @@ int r600_bc_build(struct r600_bc *bc)
break;
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
break;
case V_SQ_CF_WORD1_SQ_CF_INST_JUMP:
case V_SQ_CF_WORD1_SQ_CF_INST_ELSE:
@@ -492,7 +795,10 @@ int r600_bc_build(struct r600_bc *bc)
return -ENOMEM;
LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
addr = cf->addr;
- r = r600_bc_cf_build(bc, cf);
+ if (bc->chiprev == 2)
+ r = eg_bc_cf_build(bc, cf);
+ else
+ r = r600_bc_cf_build(bc, cf);
if (r)
return r;
switch (cf->inst) {
@@ -504,6 +810,7 @@ int r600_bc_build(struct r600_bc *bc)
r = r600_bc_alu_build(bc, alu, addr);
break;
case 1:
+ case 2: /* eg alu is same encoding as r700 */
r = r700_bc_alu_build(bc, alu, addr);
break;
default:
@@ -537,6 +844,8 @@ int r600_bc_build(struct r600_bc *bc)
break;
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
case V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT:
+ case EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE:
case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL:
case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END:
case V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE:
diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h
index 9e65fcdd4f..cc62535e5c 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -26,6 +26,9 @@
#include "radeon.h"
#include "util/u_double_list.h"
+#define NUM_OF_CYCLES 3
+#define NUM_OF_COMPONENTS 4
+
struct r600_bc_alu_src {
unsigned sel;
unsigned chan;
@@ -44,6 +47,7 @@ struct r600_bc_alu_dst {
struct r600_bc_alu {
struct list_head list;
+ struct list_head bs_list; /* bank swizzle list */
struct r600_bc_alu_src src[3];
struct r600_bc_alu_dst dst;
unsigned inst;
@@ -52,7 +56,10 @@ struct r600_bc_alu {
unsigned predicate;
unsigned nliteral;
unsigned literal_added;
+ unsigned bank_swizzle;
+ unsigned bank_swizzle_force;
u32 value[4];
+ int hw_gpr[NUM_OF_CYCLES][NUM_OF_COMPONENTS];
};
struct r600_bc_tex {
@@ -120,10 +127,12 @@ struct r600_bc_cf {
unsigned cond;
unsigned pop_count;
unsigned cf_addr; /* control flow addr */
+ unsigned kcache0_mode;
struct list_head alu;
struct list_head tex;
struct list_head vtx;
struct r600_bc_output output;
+ struct r600_bc_alu *curr_bs_head;
};
#define FC_NONE 0
@@ -151,6 +160,7 @@ struct r600_cf_callstack {
struct r600_bc {
enum radeon_family family;
int chiprev; /* 0 - r600, 1 - r700, 2 - evergreen */
+ unsigned use_mem_constant;
struct list_head cf;
struct r600_bc_cf *cf_last;
unsigned ndw;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 7829a479c2..06197d3d7d 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -56,6 +56,9 @@ u32 r600_domain_from_usage(unsigned usage)
if (usage & PIPE_BIND_INDEX_BUFFER) {
domain |= RADEON_GEM_DOMAIN_GTT;
}
+ if (usage & PIPE_BIND_CONSTANT_BUFFER) {
+ domain |= RADEON_GEM_DOMAIN_VRAM;
+ }
return domain;
}
@@ -79,7 +82,7 @@ struct pipe_resource *r600_buffer_create(struct pipe_screen *screen,
rbuffer->base.b.screen = screen;
rbuffer->base.vtbl = &r600_buffer_vtbl;
- if (rbuffer->base.b.bind & PIPE_BIND_CONSTANT_BUFFER) {
+ if ((rscreen->use_mem_constant == FALSE) && (rbuffer->base.b.bind & PIPE_BIND_CONSTANT_BUFFER)) {
desc.alignment = alignment;
desc.usage = rbuffer->base.b.bind;
rbuffer->pb = pb_malloc_buffer_create(rbuffer->base.b.width0,
@@ -153,7 +156,7 @@ static void *r600_buffer_transfer_map(struct pipe_context *pipe,
int write = 0;
if (rbuffer->pb) {
- return (uint8_t*)pb_map(rbuffer->pb, transfer->usage) + transfer->box.x;
+ return (uint8_t*)pb_map(rbuffer->pb, transfer->usage, NULL) + transfer->box.x;
}
if (transfer->usage & PIPE_TRANSFER_DONTBLOCK) {
/* FIXME */
diff --git a/src/gallium/drivers/r600/r600_context.c b/src/gallium/drivers/r600/r600_context.c
index 7a0e5b4049..00df4dcd42 100644
--- a/src/gallium/drivers/r600/r600_context.c
+++ b/src/gallium/drivers/r600/r600_context.c
@@ -32,8 +32,6 @@
#include "r600_screen.h"
#include "r600_context.h"
#include "r600_resource.h"
-#include "r600d.h"
-
static void r600_destroy_context(struct pipe_context *context)
{
@@ -53,6 +51,11 @@ static void r600_destroy_context(struct pipe_context *context)
rctx->stencil_ref = r600_context_state_decref(rctx->stencil_ref);
rctx->viewport = r600_context_state_decref(rctx->viewport);
rctx->framebuffer = r600_context_state_decref(rctx->framebuffer);
+
+ free(rctx->ps_constant);
+ free(rctx->vs_constant);
+ free(rctx->vs_resource);
+
radeon_ctx_fini(&rctx->ctx);
FREE(rctx);
}
@@ -61,9 +64,11 @@ void r600_flush(struct pipe_context *ctx, unsigned flags,
struct pipe_fence_handle **fence)
{
struct r600_context *rctx = r600_context(ctx);
- struct r600_query *rquery;
+ struct r600_query *rquery = NULL;
static int dc = 0;
+#if 0
char dname[256];
+#endif
/* suspend queries */
r600_queries_suspend(ctx);
@@ -92,237 +97,6 @@ out:
r600_queries_resume(ctx);
}
-static void r600_init_config(struct r600_context *rctx)
-{
- int ps_prio;
- int vs_prio;
- int gs_prio;
- int es_prio;
- int num_ps_gprs;
- int num_vs_gprs;
- int num_gs_gprs;
- int num_es_gprs;
- int num_temp_gprs;
- int num_ps_threads;
- int num_vs_threads;
- int num_gs_threads;
- int num_es_threads;
- int num_ps_stack_entries;
- int num_vs_stack_entries;
- int num_gs_stack_entries;
- int num_es_stack_entries;
- enum radeon_family family;
-
- family = radeon_get_family(rctx->rw);
- ps_prio = 0;
- vs_prio = 1;
- gs_prio = 2;
- es_prio = 3;
- switch (family) {
- case CHIP_R600:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV630:
- case CHIP_RV635:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 40;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- default:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV670:
- num_ps_gprs = 144;
- num_vs_gprs = 40;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 136;
- num_vs_threads = 48;
- num_gs_threads = 4;
- num_es_threads = 4;
- num_ps_stack_entries = 40;
- num_vs_stack_entries = 40;
- num_gs_stack_entries = 32;
- num_es_stack_entries = 16;
- break;
- case CHIP_RV770:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 256;
- num_vs_stack_entries = 256;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV730:
- case CHIP_RV740:
- num_ps_gprs = 84;
- num_vs_gprs = 36;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 188;
- num_vs_threads = 60;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- case CHIP_RV710:
- num_ps_gprs = 192;
- num_vs_gprs = 56;
- num_temp_gprs = 4;
- num_gs_gprs = 0;
- num_es_gprs = 0;
- num_ps_threads = 144;
- num_vs_threads = 48;
- num_gs_threads = 0;
- num_es_threads = 0;
- num_ps_stack_entries = 128;
- num_vs_stack_entries = 128;
- num_gs_stack_entries = 0;
- num_es_stack_entries = 0;
- break;
- }
- radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0);
-
- rctx->config.states[R600_CONFIG__SQ_CONFIG] = 0x00000000;
- switch (family) {
- case CHIP_RV610:
- case CHIP_RV620:
- case CHIP_RS780:
- case CHIP_RS880:
- case CHIP_RV710:
- break;
- default:
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1);
- break;
- }
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio);
- rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio);
-
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0;
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
-
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0;
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
- rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs);
-
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0;
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads);
- rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads);
-
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0;
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
-
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0;
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
- rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
-
- rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000;
-
- if (family >= CHIP_RV770) {
- rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000;
- rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002;
- rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000;
- rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204;
- rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000;
- rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000;
- } else {
- rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000;
- rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000003;
- rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000;
- rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x01020204;
- rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001;
- rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00004010;
- }
- rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003;
- rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001;
- rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000;
- rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000;
- radeon_state_pm4(&rctx->config);
-}
-
struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
{
struct r600_context *rctx = CALLOC_STRUCT(r600_context);
@@ -341,6 +115,11 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
rctx->screen = rscreen;
rctx->rw = rscreen->rw;
+ if (rscreen->chip_class == EVERGREEN)
+ rctx->vtbl = &eg_hw_state_vtbl;
+ else
+ rctx->vtbl = &r600_hw_state_vtbl;
+
r600_init_blit_functions(rctx);
r600_init_query_functions(rctx);
r600_init_state_functions(rctx);
@@ -352,7 +131,25 @@ struct pipe_context *r600_create_context(struct pipe_screen *screen, void *priv)
return NULL;
}
- r600_init_config(rctx);
+ rctx->vtbl->init_config(rctx);
+
+ rctx->vs_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
+ if (!rctx->vs_constant) {
+ FREE(rctx);
+ return NULL;
+ }
+
+ rctx->ps_constant = (struct radeon_state *)calloc(R600_MAX_CONSTANT, sizeof(struct radeon_state));
+ if (!rctx->ps_constant) {
+ FREE(rctx);
+ return NULL;
+ }
+
+ rctx->vs_resource = (struct radeon_state *)calloc(R600_MAX_RESOURCE, sizeof(struct radeon_state));
+ if (!rctx->vs_resource) {
+ FREE(rctx);
+ return NULL;
+ }
radeon_ctx_init(&rctx->ctx, rscreen->rw);
radeon_draw_init(&rctx->draw, rscreen->rw);
diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h
index cea0813054..58f6d0232b 100644
--- a/src/gallium/drivers/r600/r600_context.h
+++ b/src/gallium/drivers/r600/r600_context.h
@@ -119,7 +119,63 @@ struct r600_context_hw_states {
struct radeon_state scissor;
struct radeon_state dsa;
struct radeon_state cb_cntl;
+
+ struct radeon_state db_flush;
+ struct radeon_state cb_flush;
+};
+
+#define R600_MAX_CONSTANT 256 /* magic */
+#define R600_MAX_RESOURCE 160 /* magic */
+
+struct r600_shader_sampler_states {
+ unsigned nsampler;
+ unsigned nview;
+ unsigned nborder;
+ struct radeon_state *sampler[PIPE_MAX_ATTRIBS];
+ struct radeon_state *view[PIPE_MAX_ATTRIBS];
+ struct radeon_state *border[PIPE_MAX_ATTRIBS];
+};
+
+struct r600_context;
+struct r600_resource;
+
+struct r600_context_hw_state_vtbl {
+ void (*blend)(struct r600_context *rctx,
+ struct radeon_state *rstate,
+ const struct pipe_blend_state *state);
+ void (*ucp)(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_clip_state *state);
+ void (*cb)(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state, int cb);
+ void (*db)(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state);
+ void (*rasterizer)(struct r600_context *rctx, struct radeon_state *rstate);
+ void (*scissor)(struct r600_context *rctx, struct radeon_state *rstate);
+ void (*viewport)(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state);
+ void (*dsa)(struct r600_context *rctx, struct radeon_state *rstate);
+ void (*sampler_border)(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id);
+ void (*sampler)(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id);
+ void (*resource)(struct pipe_context *ctx, struct radeon_state *rstate,
+ const struct pipe_sampler_view *view, unsigned id);
+ void (*cb_cntl)(struct r600_context *rctx, struct radeon_state *rstate);
+ int (*vs_resource)(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
+ uint32_t stride, uint32_t format);
+ int (*vgt_init)(struct r600_context *rctx, struct radeon_state *draw,
+ struct r600_resource *rbuffer,
+ uint32_t count, int vgt_draw_initiator);
+ int (*vgt_prim)(struct r600_context *rctx, struct radeon_state *vgt,
+ uint32_t prim, uint32_t start, uint32_t vgt_dma_index_type);
+
+ int (*ps_shader)(struct r600_context *rctx, struct r600_context_state *rshader,
+ struct radeon_state *state);
+ int (*vs_shader)(struct r600_context *rctx, struct r600_context_state *rpshader,
+ struct radeon_state *state);
+ void (*init_config)(struct r600_context *rctx);
};
+extern struct r600_context_hw_state_vtbl r600_hw_state_vtbl;
+extern struct r600_context_hw_state_vtbl eg_hw_state_vtbl;
struct r600_context {
struct pipe_context context;
@@ -128,20 +184,19 @@ struct r600_context {
struct radeon_ctx ctx;
struct blitter_context *blitter;
struct radeon_draw draw;
+ struct r600_context_hw_state_vtbl *vtbl;
struct radeon_state config;
+ boolean use_mem_constant;
/* FIXME get rid of those vs_resource,vs/ps_constant */
- struct radeon_state vs_resource[160];
+ struct radeon_state *vs_resource;
unsigned vs_nresource;
- struct radeon_state vs_constant[256];
- struct radeon_state ps_constant[256];
+ struct radeon_state *vs_constant;
+ struct radeon_state *ps_constant;
/* hw states */
struct r600_context_hw_states hw_states;
/* pipe states */
unsigned flat_shade;
- unsigned ps_nsampler;
- unsigned vs_nsampler;
- unsigned ps_nsampler_view;
- unsigned vs_nsampler_view;
+
unsigned nvertex_buffer;
struct r600_context_state *rasterizer;
struct r600_context_state *poly_stipple;
@@ -157,10 +212,9 @@ struct r600_context {
struct r600_context_state *stencil_ref;
struct r600_context_state *viewport;
struct r600_context_state *framebuffer;
- struct radeon_state *ps_sampler[PIPE_MAX_ATTRIBS];
- struct radeon_state *vs_sampler[PIPE_MAX_ATTRIBS];
- struct radeon_state *ps_sampler_view[PIPE_MAX_ATTRIBS];
- struct radeon_state *vs_sampler_view[PIPE_MAX_ATTRIBS];
+ struct r600_shader_sampler_states vs_sampler;
+ struct r600_shader_sampler_states ps_sampler;
+ /* can add gs later */
struct r600_vertex_element *vertex_elements;
struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS];
struct pipe_index_buffer index_buffer;
@@ -179,7 +233,6 @@ static INLINE struct r600_query* r600_query(struct pipe_query* q)
return (struct r600_query*)q;
}
-struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigned type, const void *state);
struct r600_context_state *r600_context_state_incref(struct r600_context_state *rstate);
struct r600_context_state *r600_context_state_decref(struct r600_context_state *rstate);
void r600_flush(struct pipe_context *ctx, unsigned flags,
@@ -212,5 +265,16 @@ uint32_t r600_translate_texformat(enum pipe_format format,
extern void r600_queries_resume(struct pipe_context *ctx);
extern void r600_queries_suspend(struct pipe_context *ctx);
+int eg_bc_cf_build(struct r600_bc *bc, struct r600_bc_cf *cf);
+
+void r600_set_constant_buffer_file(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer);
+void r600_set_constant_buffer_mem(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer);
+void eg_set_constant_buffer(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer);
#endif
diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c
index fabd337d23..f24f30f6ff 100644
--- a/src/gallium/drivers/r600/r600_draw.c
+++ b/src/gallium/drivers/r600/r600_draw.c
@@ -104,59 +104,17 @@ static int r600_draw_common(struct r600_draw *draw)
rbuffer = (struct r600_resource*)vertex_buffer->buffer;
offset = rctx->vertex_elements->elements[i].src_offset + vertex_buffer->buffer_offset;
format = r600_translate_colorformat(rctx->vertex_elements->elements[i].src_format);
- radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, i, R600_SHADER_VS);
- vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- vs_resource->nbo = 1;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset - 1;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(vertex_buffer->stride) |
- S_038008_DATA_FORMAT(format);
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000;
- vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000;
- vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT;
- vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT;
- r = radeon_state_pm4(vs_resource);
- if (r) {
- return r;
- }
+
+ rctx->vtbl->vs_resource(rctx, i, rbuffer, offset, vertex_buffer->stride, format);
radeon_draw_bind(&rctx->draw, vs_resource);
}
rctx->vs_nresource = rctx->vertex_elements->count;
/* FIXME start need to change winsys */
- radeon_state_init(&draw->draw, rscreen->rw, R600_STATE_DRAW, 0, 0);
- draw->draw.states[R600_DRAW__VGT_NUM_INDICES] = draw->count;
- draw->draw.states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator;
- if (draw->index_buffer) {
- rbuffer = (struct r600_resource*)draw->index_buffer;
- draw->draw.bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- draw->draw.placement[0] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.placement[1] = RADEON_GEM_DOMAIN_GTT;
- draw->draw.nbo = 1;
- }
- r = radeon_state_pm4(&draw->draw);
- if (r) {
- return r;
- }
+ rctx->vtbl->vgt_init(rctx, &draw->draw, (struct r600_resource *)draw->index_buffer,
+ draw->count, vgt_draw_initiator);
radeon_draw_bind(&rctx->draw, &draw->draw);
- radeon_state_init(&draw->vgt, rscreen->rw, R600_STATE_VGT, 0, 0);
- draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim;
- draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF;
- draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->start;
- draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
- draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001;
- draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000;
- draw->vgt.states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000;
- r = radeon_state_pm4(&draw->vgt);
- if (r) {
- return r;
- }
+ rctx->vtbl->vgt_prim(rctx, &draw->vgt, prim, draw->start, vgt_dma_index_type);
radeon_draw_bind(&rctx->draw, &draw->vgt);
r = radeon_ctx_set_draw(&rctx->ctx, &rctx->draw);
@@ -164,6 +122,9 @@ static int r600_draw_common(struct r600_draw *draw)
r600_flush(draw->ctx, 0, NULL);
r = radeon_ctx_set_draw(&rctx->ctx, &rctx->draw);
}
+
+ radeon_state_fini(&draw->draw);
+
return r;
}
@@ -175,6 +136,8 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
assert(info->index_bias == 0);
+ memset(&draw, 0, sizeof(draw));
+
draw.ctx = ctx;
draw.mode = info->mode;
draw.start = info->start;
diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c
new file mode 100644
index 0000000000..de9491d406
--- /dev/null
+++ b/src/gallium/drivers/r600/r600_hw_states.c
@@ -0,0 +1,1125 @@
+/*
+ * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
+ * 2010 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Jerome Glisse
+ * Dave Airlie
+ */
+
+#include <util/u_inlines.h>
+#include <util/u_format.h>
+#include <util/u_memory.h>
+#include <util/u_blitter.h>
+#include "util/u_pack_color.h"
+#include "r600_screen.h"
+#include "r600_context.h"
+#include "r600_resource.h"
+#include "r600_state_inlines.h"
+#include "r600d.h"
+
+static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ int i;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0);
+ rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]);
+ rstate->states[R600_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]);
+ rstate->states[R600_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]);
+ rstate->states[R600_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]);
+ rstate->states[R600_BLEND__CB_BLEND0_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND1_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND2_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND3_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND4_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND5_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND6_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND7_CONTROL] = 0x00000000;
+ rstate->states[R600_BLEND__CB_BLEND_CONTROL] = 0x00000000;
+
+ for (i = 0; i < 8; i++) {
+ unsigned eqRGB = state->rt[i].rgb_func;
+ unsigned srcRGB = state->rt[i].rgb_src_factor;
+ unsigned dstRGB = state->rt[i].rgb_dst_factor;
+
+ unsigned eqA = state->rt[i].alpha_func;
+ unsigned srcA = state->rt[i].alpha_src_factor;
+ unsigned dstA = state->rt[i].alpha_dst_factor;
+ uint32_t bc = 0;
+
+ if (!state->rt[i].blend_enable)
+ continue;
+
+ bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
+ bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
+ bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
+
+ if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
+ bc |= S_028804_SEPARATE_ALPHA_BLEND(1);
+ bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
+ bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
+ bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
+ }
+
+ rstate->states[R600_BLEND__CB_BLEND0_CONTROL + i] = bc;
+ if (i == 0)
+ rstate->states[R600_BLEND__CB_BLEND_CONTROL] = bc;
+ }
+
+ radeon_state_pm4(rstate);
+}
+
+static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_clip_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0);
+
+ for (int i = 0; i < state->nr; i++) {
+ rstate->states[i * 4 + 0] = fui(state->ucp[i][0]);
+ rstate->states[i * 4 + 1] = fui(state->ucp[i][1]);
+ rstate->states[i * 4 + 2] = fui(state->ucp[i][2]);
+ rstate->states[i * 4 + 3] = fui(state->ucp[i][3]);
+ }
+ radeon_state_pm4(rstate);
+}
+
+static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state, int cb)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level = state->cbufs[cb]->level;
+ unsigned pitch, slice;
+ unsigned color_info;
+ unsigned format, swap, ntype;
+ const struct util_format_description *desc;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0);
+ rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
+ rbuffer = &rtex->resource;
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ rstate->nbo = 1;
+ pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
+ slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
+
+ ntype = 0;
+ desc = util_format_description(rtex->resource.base.b.format);
+ if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
+ ntype = V_0280A0_NUMBER_SRGB;
+
+ format = r600_translate_colorformat(rtex->resource.base.b.format);
+ swap = r600_translate_colorswap(rtex->resource.base.b.format);
+
+ color_info = S_0280A0_FORMAT(format) |
+ S_0280A0_COMP_SWAP(swap) |
+ S_0280A0_BLEND_CLAMP(1) |
+ S_0280A0_SOURCE_FORMAT(1) |
+ S_0280A0_NUMBER_TYPE(ntype);
+
+ rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8;
+ rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info;
+ rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) |
+ S_028060_SLICE_TILE_MAX(slice);
+ rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000;
+ rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000;
+ rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000;
+ rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000;
+ radeon_state_pm4(rstate);
+}
+
+static void r600_db(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_framebuffer_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_resource_texture *rtex;
+ struct r600_resource *rbuffer;
+ unsigned level;
+ unsigned pitch, slice, format;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0);
+ if (state->zsbuf == NULL)
+ return;
+
+ rtex = (struct r600_resource_texture*)state->zsbuf->texture;
+ rtex->tilled = 1;
+ rtex->array_mode = 2;
+ rtex->tile_type = 1;
+ rtex->depth = 1;
+ rbuffer = &rtex->resource;
+
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->nbo = 1;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
+ level = state->zsbuf->level;
+ pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
+ slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
+ format = r600_translate_dbformat(state->zsbuf->texture->format);
+ rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8;
+ rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) |
+ S_028010_FORMAT(format);
+ rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000;
+ rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1;
+ rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) |
+ S_028000_SLICE_TILE_MAX(slice);
+ radeon_state_pm4(rstate);
+}
+
+static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer;
+ const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+ const struct pipe_clip_state *clip = NULL;
+ struct r600_screen *rscreen = rctx->screen;
+ float offset_units = 0, offset_scale = 0;
+ char depth = 0;
+ unsigned offset_db_fmt_cntl = 0;
+ unsigned tmp;
+ unsigned prov_vtx = 1;
+
+ if (rctx->clip)
+ clip = &rctx->clip->state.clip;
+ if (fb->zsbuf) {
+ offset_units = state->offset_units;
+ offset_scale = state->offset_scale * 12.0f;
+ switch (fb->zsbuf->texture->format) {
+ case PIPE_FORMAT_Z24X8_UNORM:
+ case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
+ depth = -24;
+ offset_units *= 2.0f;
+ break;
+ case PIPE_FORMAT_Z32_FLOAT:
+ depth = -23;
+ offset_units *= 1.0f;
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
+ break;
+ case PIPE_FORMAT_Z16_UNORM:
+ depth = -16;
+ offset_units *= 4.0f;
+ break;
+ default:
+ R600_ERR("unsupported %d\n", fb->zsbuf->texture->format);
+ return;
+ }
+ }
+ offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
+
+ if (state->flatshade_first)
+ prov_vtx = 0;
+
+ rctx->flat_shade = state->flatshade;
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0);
+ rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001;
+ if (state->sprite_coord_enable) {
+ rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
+ S_0286D4_PNT_SPRITE_ENA(1) |
+ S_0286D4_PNT_SPRITE_OVRD_X(2) |
+ S_0286D4_PNT_SPRITE_OVRD_Y(3) |
+ S_0286D4_PNT_SPRITE_OVRD_Z(0) |
+ S_0286D4_PNT_SPRITE_OVRD_W(1);
+ if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
+ rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
+ S_0286D4_PNT_SPRITE_TOP_1(1);
+ }
+ }
+ rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0;
+ if (clip) {
+ rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1);
+ rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp);
+ rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
+ }
+ rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] =
+ S_028814_PROVOKING_VTX_LAST(prov_vtx) |
+ S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
+ S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
+ S_028814_FACE(!state->front_ccw) |
+ S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
+ S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri);
+ rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] =
+ S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
+ S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
+ rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000;
+ /* point size 12.4 fixed point */
+ tmp = (unsigned)(state->point_size * 8.0);
+ rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp);
+ rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000;
+ rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008;
+ rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005;
+ rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000;
+ rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400;
+ rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000;
+ rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000;
+ rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000;
+ rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000;
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl;
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000;
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale);
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units);
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale);
+ rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units);
+ radeon_state_pm4(rstate);
+}
+
+static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_scissor_state *state = &rctx->scissor->state.scissor;
+ const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
+ struct r600_screen *rscreen = rctx->screen;
+ unsigned minx, maxx, miny, maxy;
+ u32 tl, br;
+
+ if (state == NULL) {
+ minx = 0;
+ miny = 0;
+ maxx = fb->cbufs[0]->width;
+ maxy = fb->cbufs[0]->height;
+ } else {
+ minx = state->minx;
+ miny = state->miny;
+ maxx = state->maxx;
+ maxy = state->maxy;
+ }
+ tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1);
+ br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy);
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0);
+ rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000;
+ rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA;
+ rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br;
+ rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl;
+ rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br;
+ radeon_state_pm4(rstate);
+}
+
+static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0);
+ rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000;
+ rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000;
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]);
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]);
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]);
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]);
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]);
+ rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]);
+ rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F;
+ radeon_state_pm4(rstate);
+}
+
+static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa;
+ const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref;
+ struct r600_screen *rscreen = rctx->screen;
+ unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
+ unsigned stencil_ref_mask, stencil_ref_mask_bf, db_render_override, db_render_control;
+ struct r600_shader *rshader;
+ struct r600_query *rquery = NULL;
+ boolean query_running;
+ int i;
+
+ if (rctx->ps_shader == NULL) {
+ return;
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0);
+
+ db_shader_control = 0x210;
+ rshader = &rctx->ps_shader->shader;
+ if (rshader->uses_kill)
+ db_shader_control |= (1 << 6);
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ db_shader_control |= 1;
+ }
+ stencil_ref_mask = 0;
+ stencil_ref_mask_bf = 0;
+ db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
+ S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
+ S_028800_ZFUNC(state->depth.func);
+ /* set stencil enable */
+
+ if (state->stencil[0].enabled) {
+ db_depth_control |= S_028800_STENCIL_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
+ db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
+
+ stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
+ S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
+ stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]);
+ if (state->stencil[1].enabled) {
+ db_depth_control |= S_028800_BACKFACE_ENABLE(1);
+ db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
+ db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
+ db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
+ db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
+ stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
+ S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
+ stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]);
+ }
+ }
+
+ alpha_test_control = 0;
+ alpha_ref = 0;
+ if (state->alpha.enabled) {
+ alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
+ alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
+ alpha_ref = fui(state->alpha.ref_value);
+ }
+
+ db_render_control = S_028D0C_STENCIL_COMPRESS_DISABLE(1) |
+ S_028D0C_DEPTH_COMPRESS_DISABLE(1);
+ db_render_override = S_028D10_FORCE_HIZ_ENABLE(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE0(V_028D10_FORCE_DISABLE) |
+ S_028D10_FORCE_HIS_ENABLE1(V_028D10_FORCE_DISABLE);
+
+ query_running = false;
+
+ LIST_FOR_EACH_ENTRY(rquery, &rctx->query_list, list) {
+ if (rquery->state & R600_QUERY_STATE_STARTED) {
+ query_running = true;
+ }
+ }
+
+ if (query_running) {
+ db_render_override |= S_028D10_NOOP_CULL_DISABLE(1);
+ if (rscreen->chip_class == R700)
+ db_render_control |= S_028D0C_R700_PERFECT_ZPASS_COUNTS(1);
+ }
+
+ rstate->states[R600_DSA__DB_STENCIL_CLEAR] = 0x00000000;
+ rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000;
+ rstate->states[R600_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control;
+ rstate->states[R600_DSA__DB_STENCILREFMASK] = stencil_ref_mask;
+ rstate->states[R600_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf;
+ rstate->states[R600_DSA__SX_ALPHA_REF] = alpha_ref;
+ rstate->states[R600_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000;
+ rstate->states[R600_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000;
+ rstate->states[R600_DSA__SPI_FOG_CNTL] = 0x00000000;
+ rstate->states[R600_DSA__DB_DEPTH_CONTROL] = db_depth_control;
+ rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control;
+ rstate->states[R600_DSA__DB_RENDER_CONTROL] = db_render_control;
+ rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = db_render_override;
+
+ rstate->states[R600_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000;
+ rstate->states[R600_DSA__DB_PRELOAD_CONTROL] = 0x00000000;
+ rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00;
+ radeon_state_pm4(rstate);
+}
+
+
+static INLINE u32 S_FIXED(float value, u32 frac_bits)
+{
+ return value * (1 << frac_bits);
+}
+
+static void r600_sampler_border(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ union util_color uc;
+
+ util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER_BORDER, id, R600_SHADER_PS);
+ if (uc.ui) {
+ rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED] = fui(state->border_color[0]);
+ rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN] = fui(state->border_color[1]);
+ rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE] = fui(state->border_color[2]);
+ rstate->states[R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA] = fui(state->border_color[3]);
+ }
+ radeon_state_pm4(rstate);
+}
+
+static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate,
+ const struct pipe_sampler_state *state, unsigned id)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ union util_color uc;
+
+ util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS);
+ rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] =
+ S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
+ S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
+ S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
+ S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
+ S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
+ S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
+ S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func)) |
+ S_03C000_BORDER_COLOR_TYPE(uc.ui ? V_03C000_SQ_TEX_BORDER_COLOR_REGISTER : 0);
+ /* FIXME LOD it depends on texture base level ... */
+ rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] =
+ S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
+ S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) |
+ S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6));
+ rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = S_03C008_TYPE(1);
+ radeon_state_pm4(rstate);
+
+}
+
+
+static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate,
+ const struct pipe_sampler_view *view, unsigned id)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_screen *rscreen = rctx->screen;
+ const struct util_format_description *desc;
+ struct r600_resource_texture *tmp;
+ struct r600_resource *rbuffer;
+ unsigned format;
+ uint32_t word4 = 0, yuv_format = 0, pitch = 0;
+ unsigned char swizzle[4], array_mode = 0, tile_type = 0;
+ int r;
+
+ rstate->cpm4 = 0;
+ swizzle[0] = view->swizzle_r;
+ swizzle[1] = view->swizzle_g;
+ swizzle[2] = view->swizzle_b;
+ swizzle[3] = view->swizzle_a;
+ format = r600_translate_texformat(view->texture->format,
+ swizzle,
+ &word4, &yuv_format);
+ if (format == ~0) {
+ return;
+ }
+ desc = util_format_description(view->texture->format);
+ if (desc == NULL) {
+ R600_ERR("unknow format %d\n", view->texture->format);
+ return;
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS);
+ tmp = (struct r600_resource_texture*)view->texture;
+ rbuffer = &tmp->resource;
+ if (tmp->depth) {
+ r = r600_texture_from_depth(ctx, tmp, view->first_level);
+ if (r) {
+ return;
+ }
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
+ rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
+ } else {
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ }
+ rstate->nbo = 2;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
+ rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
+
+ pitch = (tmp->pitch[0] / tmp->bpt);
+ pitch = (pitch + 0x7) & ~0x7;
+
+ /* FIXME properly handle first level != 0 */
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] =
+ S_038000_DIM(r600_tex_dim(view->texture->target)) |
+ S_038000_TILE_MODE(array_mode) |
+ S_038000_TILE_TYPE(tile_type) |
+ S_038000_PITCH((pitch / 8) - 1) |
+ S_038000_TEX_WIDTH(view->texture->width0 - 1);
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] =
+ S_038004_TEX_HEIGHT(view->texture->height0 - 1) |
+ S_038004_TEX_DEPTH(view->texture->depth0 - 1) |
+ S_038004_DATA_FORMAT(format);
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8;
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8;
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] =
+ word4 |
+ S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
+ S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
+ S_038010_REQUEST_SIZE(1) |
+ S_038010_BASE_LEVEL(view->first_level);
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] =
+ S_038014_LAST_LEVEL(view->last_level) |
+ S_038014_BASE_ARRAY(0) |
+ S_038014_LAST_ARRAY(0);
+ rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] =
+ S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE);
+ radeon_state_pm4(rstate);
+}
+
+static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ const struct pipe_blend_state *pbs = &rctx->blend->state.blend;
+ int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs;
+ uint32_t color_control, target_mask, shader_mask;
+ int i;
+
+ target_mask = 0;
+ shader_mask = 0;
+ color_control = S_028808_PER_MRT_BLEND(1);
+
+ for (i = 0; i < nr_cbufs; i++) {
+ shader_mask |= 0xf << (i * 4);
+ }
+
+ if (pbs->logicop_enable) {
+ color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20);
+ } else {
+ color_control |= (0xcc << 16);
+ }
+
+ if (pbs->independent_blend_enable) {
+ for (i = 0; i < nr_cbufs; i++) {
+ if (pbs->rt[i].blend_enable) {
+ color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
+ }
+ target_mask |= (pbs->rt[i].colormask << (4 * i));
+ }
+ } else {
+ for (i = 0; i < nr_cbufs; i++) {
+ if (pbs->rt[0].blend_enable) {
+ color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
+ }
+ target_mask |= (pbs->rt[0].colormask << (4 * i));
+ }
+ }
+ radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0);
+ rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask;
+ rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask;
+ rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control;
+ rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
+ rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
+ rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX] = 0x00000000;
+ rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000;
+ rstate->states[R600_CB_CNTL__CB_CLRCMP_SRC] = 0x00000000;
+ rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF;
+ rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF;
+ rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF;
+ radeon_state_pm4(rstate);
+}
+
+static void r600_init_config(struct r600_context *rctx)
+{
+ int ps_prio;
+ int vs_prio;
+ int gs_prio;
+ int es_prio;
+ int num_ps_gprs;
+ int num_vs_gprs;
+ int num_gs_gprs;
+ int num_es_gprs;
+ int num_temp_gprs;
+ int num_ps_threads;
+ int num_vs_threads;
+ int num_gs_threads;
+ int num_es_threads;
+ int num_ps_stack_entries;
+ int num_vs_stack_entries;
+ int num_gs_stack_entries;
+ int num_es_stack_entries;
+ enum radeon_family family;
+
+ family = radeon_get_family(rctx->rw);
+ ps_prio = 0;
+ vs_prio = 1;
+ gs_prio = 2;
+ es_prio = 3;
+ switch (family) {
+ case CHIP_R600:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ case CHIP_RV630:
+ case CHIP_RV635:
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 144;
+ num_vs_threads = 40;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
+ break;
+ case CHIP_RV610:
+ case CHIP_RV620:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ default:
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
+ break;
+ case CHIP_RV670:
+ num_ps_gprs = 144;
+ num_vs_gprs = 40;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 136;
+ num_vs_threads = 48;
+ num_gs_threads = 4;
+ num_es_threads = 4;
+ num_ps_stack_entries = 40;
+ num_vs_stack_entries = 40;
+ num_gs_stack_entries = 32;
+ num_es_stack_entries = 16;
+ break;
+ case CHIP_RV770:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 188;
+ num_vs_threads = 60;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 256;
+ num_vs_stack_entries = 256;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ case CHIP_RV730:
+ case CHIP_RV740:
+ num_ps_gprs = 84;
+ num_vs_gprs = 36;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 188;
+ num_vs_threads = 60;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ case CHIP_RV710:
+ num_ps_gprs = 192;
+ num_vs_gprs = 56;
+ num_temp_gprs = 4;
+ num_gs_gprs = 0;
+ num_es_gprs = 0;
+ num_ps_threads = 144;
+ num_vs_threads = 48;
+ num_gs_threads = 0;
+ num_es_threads = 0;
+ num_ps_stack_entries = 128;
+ num_vs_stack_entries = 128;
+ num_gs_stack_entries = 0;
+ num_es_stack_entries = 0;
+ break;
+ }
+ radeon_state_init(&rctx->config, rctx->rw, R600_STATE_CONFIG, 0, 0);
+
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] = 0x00000000;
+ switch (family) {
+ case CHIP_RV610:
+ case CHIP_RV620:
+ case CHIP_RS780:
+ case CHIP_RS880:
+ case CHIP_RV710:
+ break;
+ default:
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VC_ENABLE(1);
+ break;
+ }
+
+ if (!rctx->screen->use_mem_constant)
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_DX9_CONSTS(1);
+
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ALU_INST_PREFER_VECTOR(1);
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_PS_PRIO(ps_prio);
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_VS_PRIO(vs_prio);
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_GS_PRIO(gs_prio);
+ rctx->config.states[R600_CONFIG__SQ_CONFIG] |= S_008C00_ES_PRIO(es_prio);
+
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] = 0;
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_PS_GPRS(num_ps_gprs);
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_VS_GPRS(num_vs_gprs);
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1] |= S_008C04_NUM_CLAUSE_TEMP_GPRS(num_temp_gprs);
+
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] = 0;
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_gs_gprs);
+ rctx->config.states[R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2] |= S_008C08_NUM_GS_GPRS(num_es_gprs);
+
+ rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] = 0;
+ rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_PS_THREADS(num_ps_threads);
+ rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_VS_THREADS(num_vs_threads);
+ rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_GS_THREADS(num_gs_threads);
+ rctx->config.states[R600_CONFIG__SQ_THREAD_RESOURCE_MGMT] |= S_008C0C_NUM_ES_THREADS(num_es_threads);
+
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] = 0;
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_PS_STACK_ENTRIES(num_ps_stack_entries);
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1] |= S_008C10_NUM_VS_STACK_ENTRIES(num_vs_stack_entries);
+
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] = 0;
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_GS_STACK_ENTRIES(num_gs_stack_entries);
+ rctx->config.states[R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2] |= S_008C14_NUM_ES_STACK_ENTRIES(num_es_stack_entries);
+
+ rctx->config.states[R600_CONFIG__VC_ENHANCE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SX_MISC] = 0x00000000;
+
+ if (family >= CHIP_RV770) {
+ rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00004000;
+ rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000002;
+ rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x00000000;
+ rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x00420204;
+ rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000000;
+ rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00514000;
+ } else {
+ rctx->config.states[R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ] = 0x00000000;
+ rctx->config.states[R600_CONFIG__TA_CNTL_AUX] = 0x07000003;
+ rctx->config.states[R600_CONFIG__DB_DEBUG] = 0x82000000;
+ rctx->config.states[R600_CONFIG__DB_WATERMARKS] = 0x01020204;
+ rctx->config.states[R600_CONFIG__SPI_THREAD_GROUPING] = 0x00000001;
+ rctx->config.states[R600_CONFIG__PA_SC_MODE_CNTL] = 0x00004010;
+ }
+ rctx->config.states[R600_CONFIG__CB_SHADER_CONTROL] = 0x00000003;
+ rctx->config.states[R600_CONFIG__SQ_ESGS_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_GSVS_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_FBUF_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_REDUC_RING_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__SQ_GS_VERT_ITEMSIZE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_OUTPUT_PATH_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_HOS_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_HOS_REUSE_DEPTH] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_PRIM_TYPE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_FIRST_DECR] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_DECR] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_GS_MODE] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_STRMOUT_EN] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_REUSE_OFF] = 0x00000001;
+ rctx->config.states[R600_CONFIG__VGT_VTX_CNT_EN] = 0x00000000;
+ rctx->config.states[R600_CONFIG__VGT_STRMOUT_BUFFER_EN] = 0x00000000;
+ radeon_state_pm4(&rctx->config);
+}
+
+static int r600_vs_resource(struct r600_context *rctx, int id, struct r600_resource *rbuffer, uint32_t offset,
+ uint32_t stride, uint32_t format)
+{
+ struct radeon_state *vs_resource = &rctx->vs_resource[id];
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(vs_resource, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_VS);
+ vs_resource->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ vs_resource->nbo = 1;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD0] = offset;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD1] = rbuffer->bo->size - offset - 1;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = S_038008_STRIDE(stride) |
+ S_038008_DATA_FORMAT(format);
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = 0x00000000;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD4] = 0x00000000;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD5] = 0x00000000;
+ vs_resource->states[R600_PS_RESOURCE__RESOURCE0_WORD6] = 0xC0000000;
+ vs_resource->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ vs_resource->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(vs_resource);
+}
+
+static int r600_draw_vgt_init(struct r600_context *rctx, struct radeon_state *draw,
+ struct r600_resource *rbuffer,
+ uint32_t count, int vgt_draw_initiator)
+{
+ struct r600_screen *rscreen = rctx->screen;
+
+ radeon_state_init(draw, rscreen->rw, R600_STATE_DRAW, 0, 0);
+ draw->states[R600_DRAW__VGT_NUM_INDICES] = count;
+ draw->states[R600_DRAW__VGT_DRAW_INITIATOR] = vgt_draw_initiator;
+ if (rbuffer) {
+ draw->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ draw->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ draw->placement[1] = RADEON_GEM_DOMAIN_GTT;
+ draw->nbo = 1;
+ }
+ return radeon_state_pm4(draw);
+}
+
+static int r600_draw_vgt_prim(struct r600_context *rctx, struct radeon_state *vgt,
+ uint32_t prim, uint32_t start, uint32_t vgt_dma_index_type)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ radeon_state_init(vgt, rscreen->rw, R600_STATE_VGT, 0, 0);
+ vgt->states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim;
+ vgt->states[R600_VGT__VGT_MAX_VTX_INDX] = 0x00FFFFFF;
+ vgt->states[R600_VGT__VGT_MIN_VTX_INDX] = 0x00000000;
+ vgt->states[R600_VGT__VGT_INDX_OFFSET] = start;
+ vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000;
+ vgt->states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
+ vgt->states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;
+ vgt->states[R600_VGT__VGT_DMA_NUM_INSTANCES] = 0x00000001;
+ vgt->states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN] = 0x00000000;
+ vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_0] = 0x00000000;
+ vgt->states[R600_VGT__VGT_INSTANCE_STEP_RATE_1] = 0x00000000;
+ return radeon_state_pm4(vgt);
+}
+
+static int r600_ps_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
+ struct radeon_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ const struct pipe_rasterizer_state *rasterizer;
+ struct r600_shader *rshader = &rpshader->shader;
+ unsigned i, tmp, exports_ps, num_cout;
+ boolean have_pos = FALSE;
+
+ rasterizer = &rctx->rasterizer->state.rasterizer;
+
+ radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
+ for (i = 0; i < rshader->ninput; i++) {
+ tmp = S_028644_SEMANTIC(i);
+ tmp |= S_028644_SEL_CENTROID(1);
+ if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
+ have_pos = TRUE;
+ if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
+ rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
+ tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
+ }
+ if (rasterizer->sprite_coord_enable & (1 << i)) {
+ tmp |= S_028644_PT_SPRITE_TEX(1);
+ }
+ state->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp;
+ }
+
+ exports_ps = 0;
+ num_cout = 0;
+ for (i = 0; i < rshader->noutput; i++) {
+ if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
+ exports_ps |= 1;
+ else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
+ exports_ps |= (1 << (num_cout+1));
+ num_cout++;
+ }
+ }
+ if (!exports_ps) {
+ /* always at least export 1 component per pixel */
+ exports_ps = 2;
+ }
+ state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) |
+ S_0286CC_PERSP_GRADIENT_ENA(1);
+ if (have_pos) {
+ state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) |
+ S_0286CC_BARYC_SAMPLE_CNTL(1);
+ state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1;
+ }
+ state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
+ state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) |
+ S_028868_STACK_SIZE(rshader->bc.nstack);
+ state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
+ state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->nbo = 1;
+ state->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(state);
+}
+
+static int r600_vs_shader(struct r600_context *rctx, struct r600_context_state *rpshader,
+ struct radeon_state *state)
+{
+ struct r600_screen *rscreen = rctx->screen;
+ struct r600_shader *rshader = &rpshader->shader;
+ unsigned i, tmp;
+
+ radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
+ for (i = 0; i < 10; i++) {
+ state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0;
+ }
+ /* so far never got proper semantic id from tgsi */
+ for (i = 0; i < 32; i++) {
+ tmp = i << ((i & 3) * 8);
+ state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp;
+ }
+ state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2);
+ state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr) |
+ S_028868_STACK_SIZE(rshader->bc.nstack);
+ state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo);
+ state->nbo = 2;
+ state->placement[0] = RADEON_GEM_DOMAIN_GTT;
+ state->placement[2] = RADEON_GEM_DOMAIN_GTT;
+ return radeon_state_pm4(state);
+}
+
+struct r600_context_hw_state_vtbl r600_hw_state_vtbl = {
+ .blend = r600_blend,
+ .ucp = r600_ucp,
+ .cb = r600_cb,
+ .db = r600_db,
+ .rasterizer = r600_rasterizer,
+ .scissor = r600_scissor,
+ .viewport = r600_viewport,
+ .dsa = r600_dsa,
+ .sampler_border = r600_sampler_border,
+ .sampler = r600_sampler,
+ .resource = r600_resource,
+ .cb_cntl = r600_cb_cntl,
+ .vs_resource = r600_vs_resource,
+ .vgt_init = r600_draw_vgt_init,
+ .vgt_prim = r600_draw_vgt_prim,
+ .vs_shader = r600_vs_shader,
+ .ps_shader = r600_ps_shader,
+ .init_config = r600_init_config,
+};
+
+void r600_set_constant_buffer_file(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer)
+{
+ struct r600_screen *rscreen = r600_screen(ctx->screen);
+ struct r600_context *rctx = r600_context(ctx);
+ unsigned nconstant = 0, i, type, shader_class;
+ struct radeon_state *rstate, *rstates;
+ struct pipe_transfer *transfer;
+ u32 *ptr;
+
+ type = R600_STATE_CONSTANT;
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ shader_class = R600_SHADER_VS;
+ rstates = rctx->vs_constant;
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ shader_class = R600_SHADER_PS;
+ rstates = rctx->ps_constant;
+ break;
+ default:
+ R600_ERR("unsupported %d\n", shader);
+ return;
+ }
+ if (buffer && buffer->width0 > 0) {
+ nconstant = buffer->width0 / 16;
+ ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer);
+ if (ptr == NULL)
+ return;
+ for (i = 0; i < nconstant; i++) {
+ rstate = &rstates[i];
+ radeon_state_init(rstate, rscreen->rw, type, i, shader_class);
+ rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0];
+ rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0] = ptr[i * 4 + 1];
+ rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0] = ptr[i * 4 + 2];
+ rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0] = ptr[i * 4 + 3];
+ if (radeon_state_pm4(rstate))
+ return;
+ radeon_draw_bind(&rctx->draw, rstate);
+ }
+ pipe_buffer_unmap(ctx, buffer, transfer);
+ }
+}
+
+void r600_set_constant_buffer_mem(struct pipe_context *ctx,
+ uint shader, uint index,
+ struct pipe_resource *buffer)
+{
+ struct r600_screen *rscreen = r600_screen(ctx->screen);
+ struct r600_context *rctx = r600_context(ctx);
+ unsigned nconstant = 0, type, shader_class, size;
+ struct radeon_state *rstate, *rstates;
+ struct r600_resource *rbuffer = (struct r600_resource*)buffer;
+
+ type = R600_STATE_CBUF;
+
+ switch (shader) {
+ case PIPE_SHADER_VERTEX:
+ shader_class = R600_SHADER_VS;
+ rstates = rctx->vs_constant;
+ break;
+ case PIPE_SHADER_FRAGMENT:
+ shader_class = R600_SHADER_PS;
+ rstates = rctx->ps_constant;
+ break;
+ default:
+ R600_ERR("unsupported %d\n", shader);
+ return;
+ }
+
+ rstate = &rstates[0];
+
+#define ALIGN_DIVUP(x, y) (((x) + (y) - 1) / (y))
+
+ nconstant = buffer->width0 / 16;
+ size = ALIGN_DIVUP(nconstant, 16);
+
+ radeon_state_init(rstate, rscreen->rw, type, 0, shader_class);
+ rstate->states[R600_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0] = size;
+ rstate->states[R600_VS_CBUF__ALU_CONST_CACHE_VS_0] = 0;
+
+ rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ rstate->nbo = 1;
+ rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
+ if (radeon_state_pm4(rstate))
+ return;
+ radeon_draw_bind(&rctx->draw, rstate);
+}
+
diff --git a/src/gallium/drivers/r600/r600_opcodes.h b/src/gallium/drivers/r600/r600_opcodes.h
new file mode 100644
index 0000000000..0cf9c1c401
--- /dev/null
+++ b/src/gallium/drivers/r600/r600_opcodes.h
@@ -0,0 +1,396 @@
+
+#ifndef R600_OPCODES_H
+#define R600_OPCODES_H
+
+#define V_SQ_CF_WORD1_SQ_CF_INST_NOP 0x00000000
+#define V_SQ_CF_WORD1_SQ_CF_INST_TEX 0x00000001
+#define V_SQ_CF_WORD1_SQ_CF_INST_VTX 0x00000002
+#define V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC 0x00000003
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START 0x00000004
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END 0x00000005
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_DX10 0x00000006
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL 0x00000007
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE 0x00000008
+#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK 0x00000009
+#define V_SQ_CF_WORD1_SQ_CF_INST_JUMP 0x0000000A
+#define V_SQ_CF_WORD1_SQ_CF_INST_PUSH 0x0000000B
+#define V_SQ_CF_WORD1_SQ_CF_INST_PUSH_ELSE 0x0000000C
+#define V_SQ_CF_WORD1_SQ_CF_INST_ELSE 0x0000000D
+#define V_SQ_CF_WORD1_SQ_CF_INST_POP 0x0000000E
+#define V_SQ_CF_WORD1_SQ_CF_INST_POP_JUMP 0x0000000F
+#define V_SQ_CF_WORD1_SQ_CF_INST_POP_PUSH 0x00000010
+#define V_SQ_CF_WORD1_SQ_CF_INST_POP_PUSH_ELSE 0x00000011
+#define V_SQ_CF_WORD1_SQ_CF_INST_CALL 0x00000012
+#define V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS 0x00000013
+#define V_SQ_CF_WORD1_SQ_CF_INST_RETURN 0x00000014
+#define V_SQ_CF_WORD1_SQ_CF_INST_EMIT_VERTEX 0x00000015
+#define V_SQ_CF_WORD1_SQ_CF_INST_EMIT_CUT_VERTEX 0x00000016
+#define V_SQ_CF_WORD1_SQ_CF_INST_CUT_VERTEX 0x00000017
+#define V_SQ_CF_WORD1_SQ_CF_INST_KILL 0x00000018
+
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU 0x00000008
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE 0x00000009
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER 0x0000000A
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER 0x0000000B
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_CONTINUE 0x0000000D
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_BREAK 0x0000000E
+#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_ELSE_AFTER 0x0000000F
+
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD 0x00000000
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL 0x00000001
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE 0x00000002
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX 0x00000003
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN 0x00000004
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_DX10 0x00000005
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_DX10 0x00000006
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE 0x00000008
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT 0x00000009
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE 0x0000000A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE 0x0000000B
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_DX10 0x0000000C
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_DX10 0x0000000D
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_DX10 0x0000000E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_DX10 0x0000000F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT 0x00000010
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC 0x00000011
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CEIL 0x00000012
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE 0x00000013
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR 0x00000014
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA 0x00000015
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR 0x00000016
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x00000018
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV 0x00000019
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP 0x0000001A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_UINT 0x0000001E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_UINT 0x0000001F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE 0x00000020
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT 0x00000021
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE 0x00000022
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE 0x00000023
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_INV 0x00000024
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_POP 0x00000025
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_CLR 0x00000026
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_RESTORE 0x00000027
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH 0x00000028
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH 0x00000029
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH 0x0000002A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH 0x0000002B
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE 0x0000002C
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT 0x0000002D
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE 0x0000002E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE 0x0000002F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT 0x00000030
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT 0x00000031
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT 0x00000032
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT 0x00000033
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT 0x00000034
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT 0x00000035
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT 0x00000036
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT 0x00000037
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT 0x00000038
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT 0x00000039
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT 0x0000003A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT 0x0000003B
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT 0x0000003C
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT 0x0000003D
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT 0x0000003E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT 0x0000003F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_UINT 0x00000040
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_UINT 0x00000041
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT 0x00000042
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_INT 0x00000043
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_INT 0x00000044
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT 0x00000045
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE_INT 0x00000046
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_INT 0x00000047
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_INT 0x00000048
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE_INT 0x00000049
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH_INT 0x0000004A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH_INT 0x0000004B
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH_INT 0x0000004C
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH_INT 0x0000004D
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLT_PUSH_INT 0x0000004E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLE_PUSH_INT 0x0000004F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 0x00000050
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE 0x00000051
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE 0x00000052
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX4 0x00000053
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_GPR_INT 0x00000060
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE 0x00000061
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED 0x00000062
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE 0x00000063
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED 0x00000064
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_FF 0x00000065
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE 0x00000066
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED 0x00000067
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_FF 0x00000068
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE 0x00000069
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_IEEE 0x0000006A
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT 0x0000006B
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT 0x0000006C
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT 0x0000006D
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN 0x0000006E
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS 0x0000006F
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT 0x00000070
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT 0x00000071
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT 0x00000072
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT 0x00000073
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT 0x00000074
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT 0x00000075
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT 0x00000076
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_INT 0x00000077
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT 0x00000078
+#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT 0x00000079
+
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT 0x0000000C
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M2 0x0000000D
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M4 0x0000000E
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_D2 0x0000000F
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD 0x00000010
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M2 0x00000011
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M4 0x00000012
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_D2 0x00000013
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE 0x00000014
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_M2 0x00000015
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_M4 0x00000016
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_D2 0x00000017
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE 0x00000018
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT 0x00000019
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE 0x0000001A
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT 0x0000001C
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT_INT 0x0000001D
+#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT 0x0000001E
+
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0 0x00000020
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1 0x00000021
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2 0x00000022
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3 0x00000023
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_SCRATCH 0x00000024
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_REDUCTION 0x00000025
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING 0x00000026
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT 0x00000027
+#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE 0x00000028
+
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_NOP 0x00000000
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_TEX 0x00000001
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_VTX 0x00000002
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_GDS 0x00000003
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START 0x00000004
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END 0x00000005
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_DX10 0x00000006
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL 0x00000007
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE 0x00000008
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK 0x00000009
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_JUMP 0x0000000A
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_PUSH 0x0000000B
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RSVD_12 0x0000000C /* resvd */
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_ELSE 0x0000000D
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_POP 0x0000000E
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RSVD_15 0x0000000F
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RSVD_16 0x00000010
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RSVD_17 0x00000011
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL 0x00000012
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS 0x00000013
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RETURN 0x00000014
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_EMIT_VERTEX 0x00000015
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_EMIT_CUT_VERTEX 0x00000016
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_CUT_VERTEX 0x00000017
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_KILL 0x00000018
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_RSVD_25 0x00000019
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_WAIT_ACK 0x0000001a
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_TC_ACK 0x0000001b
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_VC_ACK 0x0000001c
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_JUMPTABLE 0x0000001d
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_GLOBAL_WAVE_SYNC 0x0000001e
+#define EG_V_SQ_CF_WORD1_SQ_CF_INST_HALT 0x0000001f
+
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU 0x00000008
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE 0x00000009
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER 0x0000000A
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER 0x0000000B
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_EXTENDED 0x0000000C
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_CONTINUE 0x0000000D
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_BREAK 0x0000000E
+#define EG_V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_ELSE_AFTER 0x0000000F
+
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD 0x00000000
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL 0x00000001
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE 0x00000002
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX 0x00000003
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN 0x00000004
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_DX10 0x00000005
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_DX10 0x00000006
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE 0x00000008
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT 0x00000009
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE 0x0000000A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE 0x0000000B
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_DX10 0x0000000C
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_DX10 0x0000000D
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_DX10 0x0000000E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_DX10 0x0000000F
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT 0x00000010
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC 0x00000011
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CEIL 0x00000012
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE 0x00000013
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR 0x00000014
+/* same up to here */
+/*
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA 0x00000015
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR 0x00000016
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x00000018
+*/
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT 0x00000015
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT 0x00000016
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT 0x00000017
+/* same again from here */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV 0x00000019
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP 0x0000001A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_64 0x0000001B /* new EG */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT64_TO_FLT32 0x0000001C /* new EG */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT32_TO_FLT64 0x0000001D /* new EG */
+/* same */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_UINT 0x0000001E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_UINT 0x0000001F
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE 0x00000020
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT 0x00000021
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE 0x00000022
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE 0x00000023
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_INV 0x00000024
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_POP 0x00000025
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_CLR 0x00000026
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_RESTORE 0x00000027
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH 0x00000028
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH 0x00000029
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH 0x0000002A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH 0x0000002B
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE 0x0000002C
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT 0x0000002D
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE 0x0000002E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE 0x0000002F
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT 0x00000030
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT 0x00000031
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT 0x00000032
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT 0x00000033
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT 0x00000034
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT 0x00000035
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT 0x00000036
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT 0x00000037
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT 0x00000038
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT 0x00000039
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT 0x0000003A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT 0x0000003B
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT 0x0000003C
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT 0x0000003D
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT 0x0000003E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT 0x0000003F
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_UINT 0x00000040
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_UINT 0x00000041
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT 0x00000042
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_INT 0x00000043
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_INT 0x00000044
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT 0x00000045
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE_INT 0x00000046
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_INT 0x00000047
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_INT 0x00000048
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE_INT 0x00000049
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH_INT 0x0000004A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH_INT 0x0000004B
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH_INT 0x0000004C
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH_INT 0x0000004D
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLT_PUSH_INT 0x0000004E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLE_PUSH_INT 0x0000004F
+/* same up to here */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT 0x00000050
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_BFREV_INT 0x00000051
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADDC_UINT 0x00000052
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUBB_UINT 0x00000053
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_GROUP_BARRIER 0x00000054
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_GROUP_SEQ_BEGIN 0x00000055
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_GROUP_SEQ_END 0x00000056
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SET_MODE 0x00000057
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SET_CF_IDX0 0x00000058
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SET_CF_IDX1 0x00000059
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SET_LDS_SIZE 0x0000005A
+
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE 0x00000081
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED 0x00000082
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE 0x00000083
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED 0x00000084
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_FF 0x00000085
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE 0x00000086
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED 0x00000087
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_FF 0x00000088
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE 0x00000089
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_IEEE 0x0000008A
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN 0x0000008D
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS 0x0000008E
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT 0x0000008F
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT 0x00000090
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT 0x00000091
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT 0x00000092
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_INT 0x00000093
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT 0x00000094
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_64 0x00000095
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED_64 0x00000096
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_64 0x00000097
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED_64 0x00000098
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_64 0x00000099
+/* TODO Fill in more ALU */
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 0x000000BE
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE 0x000000BF
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE 0x000000C0
+
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY 0x000000D6
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW 0x000000D7
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_X 0x000000D8
+#define EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_Z 0x000000D9
+
+
+/* TODO ADD OTHER OP3 */
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD 0x00000014
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M2 0x00000015
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M4 0x00000016
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_D2 0x00000017
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE 0x00000018
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE 0x00000019
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT 0x0000001A
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE 0x0000001B
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT 0x0000001C
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT_INT 0x0000001D
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT 0x0000001E
+#define EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT 0x0000001F
+
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF0 0x00000040
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF1 0x00000041
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF2 0x00000042
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0_BUF3 0x00000043
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1_BUF0 0x00000044
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1_BUF1 0x00000045
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1_BUF2 0x00000046
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1_BUF3 0x00000047
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2_BUF0 0x00000048
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2_BUF1 0x00000049
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2_BUF2 0x0000004A
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2_BUF3 0x0000004B
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3_BUF0 0x0000004C
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3_BUF1 0x0000004D
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3_BUF2 0x0000004E
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3_BUF3 0x0000004F
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_SCRATCH 0x00000050
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING 0x00000052
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT 0x00000053
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE 0x00000054
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_EXPORT 0x00000055
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RAT 0x00000056
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RAT_CACHELESS 0x00000057
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING1 0x00000058
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING2 0x00000059
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING3 0x0000005A
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_EXPORT_COMBINED 0x0000005B
+#define EG_V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RAT_COMBINED_CACHELESS 0x0000005C
+
+#define BC_INST(bc, x) ((bc)->chiprev == 2 ? EG_##x : x)
+
+#define CTX_INST(x) (ctx->bc->chiprev == 2 ? EG_##x : x)
+
+#endif
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 530940ed84..0073072b4a 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -77,7 +77,6 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
return NULL;
q->type = query_type;
- LIST_ADDTAIL(&q->list, &rctx->query_list);
q->buffer_size = 4096;
q->buffer = radeon_bo(rscreen->rw, 0, q->buffer_size, 1, NULL);
@@ -85,6 +84,9 @@ static struct pipe_query *r600_create_query(struct pipe_context *ctx, unsigned q
FREE(q);
return NULL;
}
+
+ LIST_ADDTAIL(&q->list, &rctx->query_list);
+
return (struct pipe_query *)q;
}
diff --git a/src/gallium/drivers/r600/r600_screen.c b/src/gallium/drivers/r600/r600_screen.c
index a047a49a6c..19d1005e77 100644
--- a/src/gallium/drivers/r600/r600_screen.c
+++ b/src/gallium/drivers/r600/r600_screen.c
@@ -46,8 +46,10 @@ static const char* r600_get_name(struct pipe_screen* pscreen)
if (family >= CHIP_R600 && family < CHIP_RV770)
return "R600 (HD2XXX,HD3XXX)";
- else
+ else if (family < CHIP_CEDAR)
return "R700 (HD4XXX)";
+ else
+ return "EVERGREEN";
}
static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
@@ -74,10 +76,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
/* Unsupported features (boolean caps). */
case PIPE_CAP_TIMER_QUERY:
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
case PIPE_CAP_STREAM_OUTPUT:
case PIPE_CAP_INDEP_BLEND_FUNC: /* FIXME allow this */
- case PIPE_CAP_GEOMETRY_SHADER4:
return 0;
/* Texturing. */
@@ -104,55 +104,59 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
-
- /* Shader limits. */
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- return 16384; //max native instructions, not greater than max instructions
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- return 16384;
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- return 16384; //max program native instructions
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- return 16384; //max program native ALU instructions
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- return 16384; //max program native texture instructions
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- return 2048; //max program native texture indirections
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- return 8; /* FIXME */
- case PIPE_CAP_MAX_VS_INPUTS:
- return 16; //max native attributes
- case PIPE_CAP_MAX_FS_INPUTS:
- return 10; //max native attributes
- case PIPE_CAP_MAX_VS_TEMPS:
- return 256; //max native temporaries
- case PIPE_CAP_MAX_FS_TEMPS:
- return 256; //max native temporaries
- case PIPE_CAP_MAX_VS_ADDRS:
- case PIPE_CAP_MAX_FS_ADDRS:
- return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */
- case PIPE_CAP_MAX_VS_CONSTS:
- return 256; //max native parameters
- case PIPE_CAP_MAX_FS_CONSTS:
- return 256; //max program native parameters
- case PIPE_CAP_MAX_CONST_BUFFERS:
- return 1;
- case PIPE_CAP_MAX_CONST_BUFFER_SIZE: /* in bytes */
- return 4096;
- case PIPE_CAP_MAX_PREDICATE_REGISTERS:
- case PIPE_CAP_MAX_VS_PREDS:
- case PIPE_CAP_MAX_FS_PREDS:
- return 0; /* FIXME */
-
default:
R600_ERR("r600: unknown param %d\n", param);
return 0;
}
}
+static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ case PIPE_SHADER_VERTEX:
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ /* TODO: support and enable geometry programs */
+ return 0;
+ default:
+ /* TODO: support tessellation on Evergreen */
+ return 0;
+ }
+
+ /* TODO: all these should be fixed, since r600 surely supports much more! */
+ switch (param) {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return 16384;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return 8; /* FIXME */
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ if(shader == PIPE_SHADER_FRAGMENT)
+ return 10;
+ else
+ return 16;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ return 256; //max native temporaries
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return 1; //max native address registers/* FIXME Isn't this equal to TEMPS? */
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 256; //max native parameters
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return 0; /* FIXME */
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ /* TODO: support this! */
+ return 0;
+ default:
+ return 0;
+ }
+}
+
static float r600_get_paramf(struct pipe_screen* pscreen, enum pipe_cap param)
{
switch (param) {
@@ -240,6 +244,9 @@ struct pipe_screen *r600_screen_create(struct radeon *rw)
if (rscreen == NULL) {
return NULL;
}
+
+ /* don't enable mem constant for r600 yet */
+ rscreen->use_mem_constant = FALSE;
switch (family) {
case CHIP_R600:
@@ -258,6 +265,14 @@ struct pipe_screen *r600_screen_create(struct radeon *rw)
case CHIP_RV740:
rscreen->chip_class = R700;
break;
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
+ rscreen->chip_class = EVERGREEN;
+ rscreen->use_mem_constant = TRUE;
+ break;
default:
FREE(rscreen);
return NULL;
@@ -268,6 +283,7 @@ struct pipe_screen *r600_screen_create(struct radeon *rw)
rscreen->screen.get_name = r600_get_name;
rscreen->screen.get_vendor = r600_get_vendor;
rscreen->screen.get_param = r600_get_param;
+ rscreen->screen.get_shader_param = r600_get_shader_param;
rscreen->screen.get_paramf = r600_get_paramf;
rscreen->screen.is_format_supported = r600_is_format_supported;
rscreen->screen.context_create = r600_create_context;
diff --git a/src/gallium/drivers/r600/r600_screen.h b/src/gallium/drivers/r600/r600_screen.h
index b9938f117a..4be77865fb 100644
--- a/src/gallium/drivers/r600/r600_screen.h
+++ b/src/gallium/drivers/r600/r600_screen.h
@@ -52,6 +52,7 @@ struct r600_screen {
struct pipe_screen screen;
struct radeon *rw;
enum chip_class chip_class;
+ boolean use_mem_constant;
};
static INLINE struct r600_screen *r600_screen(struct pipe_screen *screen)
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 0ba26a2311..f12dbd37d3 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -30,6 +30,7 @@
#include "r600_shader.h"
#include "r600_asm.h"
#include "r600_sq.h"
+#include "r600_opcodes.h"
#include "r600d.h"
#include <stdio.h>
#include <errno.h>
@@ -60,8 +61,9 @@ struct r600_shader_tgsi_instruction {
int (*process)(struct r600_shader_ctx *ctx);
};
-static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[];
+static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[], eg_shader_tgsi_instruction[];
static int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *shader);
+static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx);
static int r600_shader_update(struct pipe_context *ctx, struct r600_shader *shader)
{
@@ -113,6 +115,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
if (rpshader == NULL)
return -ENOMEM;
rpshader->shader.family = radeon_get_family(rscreen->rw);
+ rpshader->shader.use_mem_constant = rscreen->use_mem_constant;
r = r600_shader_from_tgsi(tokens, &rpshader->shader);
if (r) {
R600_ERR("translation from TGSI failed !\n");
@@ -129,92 +132,24 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
static int r600_pipe_shader_vs(struct pipe_context *ctx, struct r600_context_state *rpshader)
{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_shader *rshader = &rpshader->shader;
+ struct r600_context *rctx = r600_context(ctx);
struct radeon_state *state;
- unsigned i, tmp;
state = &rpshader->rstate[0];
radeon_state_fini(&rpshader->rstate[0]);
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_VS);
- for (i = 0; i < 10; i++) {
- state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i] = 0;
- }
- /* so far never got proper semantic id from tgsi */
- for (i = 0; i < 32; i++) {
- tmp = i << ((i & 3) * 8);
- state->states[R600_VS_SHADER__SPI_VS_OUT_ID_0 + i / 4] |= tmp;
- }
- state->states[R600_VS_SHADER__SPI_VS_OUT_CONFIG] = S_0286C4_VS_EXPORT_COUNT(rshader->noutput - 2);
- state->states[R600_VS_SHADER__SQ_PGM_RESOURCES_VS] = S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack);
- state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
- state->bo[1] = radeon_bo_incref(rscreen->rw, rpshader->bo);
- state->nbo = 2;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- state->placement[2] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
+
+ return rctx->vtbl->vs_shader(rctx, rpshader, state);
}
static int r600_pipe_shader_ps(struct pipe_context *ctx, struct r600_context_state *rpshader)
{
- const struct pipe_rasterizer_state *rasterizer;
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_shader *rshader = &rpshader->shader;
struct r600_context *rctx = r600_context(ctx);
struct radeon_state *state;
- unsigned i, tmp, exports_ps, num_cout;
- boolean have_pos = FALSE;
state = &rpshader->rstate[0];
- rasterizer = &rctx->rasterizer->state.rasterizer;
radeon_state_fini(state);
- radeon_state_init(state, rscreen->rw, R600_STATE_SHADER, 0, R600_SHADER_PS);
- for (i = 0; i < rshader->ninput; i++) {
- tmp = S_028644_SEMANTIC(i);
- tmp |= S_028644_SEL_CENTROID(1);
- if (rshader->input[i].name == TGSI_SEMANTIC_POSITION)
- have_pos = TRUE;
- if (rshader->input[i].name == TGSI_SEMANTIC_COLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_BCOLOR ||
- rshader->input[i].name == TGSI_SEMANTIC_POSITION) {
- tmp |= S_028644_FLAT_SHADE(rshader->flat_shade);
- }
- if (rasterizer->sprite_coord_enable & (1 << i)) {
- tmp |= S_028644_PT_SPRITE_TEX(1);
- }
- state->states[R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 + i] = tmp;
- }
- exports_ps = 0;
- num_cout = 0;
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- exports_ps |= 1;
- else if (rshader->output[i].name == TGSI_SEMANTIC_COLOR) {
- exports_ps |= (1 << (num_cout+1));
- num_cout++;
- }
- }
- if (!exports_ps) {
- /* always at least export 1 component per pixel */
- exports_ps = 2;
- }
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] = S_0286CC_NUM_INTERP(rshader->ninput) |
- S_0286CC_PERSP_GRADIENT_ENA(1);
- if (have_pos) {
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_0] |= S_0286CC_POSITION_ENA(1) |
- S_0286CC_BARYC_SAMPLE_CNTL(1);
- state->states[R600_PS_SHADER__SPI_INPUT_Z] |= 1;
- }
- state->states[R600_PS_SHADER__SPI_PS_IN_CONTROL_1] = 0x00000000;
- state->states[R600_PS_SHADER__SQ_PGM_RESOURCES_PS] = S_028868_NUM_GPRS(rshader->bc.ngpr) |
- S_028868_STACK_SIZE(rshader->bc.nstack);
- state->states[R600_PS_SHADER__SQ_PGM_EXPORTS_PS] = exports_ps;
- state->bo[0] = radeon_bo_incref(rscreen->rw, rpshader->bo);
- state->nbo = 1;
- state->placement[0] = RADEON_GEM_DOMAIN_GTT;
- return radeon_state_pm4(state);
+ return rctx->vtbl->ps_shader(rctx, rpshader, state);
}
static int r600_pipe_shader(struct pipe_context *ctx, struct r600_context_state *rpshader)
@@ -307,6 +242,39 @@ static int tgsi_is_supported(struct r600_shader_ctx *ctx)
return 0;
}
+static int evergreen_interp_alu(struct r600_shader_ctx *ctx, int gpr)
+{
+ int i, r;
+ struct r600_bc_alu alu;
+
+ for (i = 0; i < 8; i++) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ if (i < 4)
+ alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_ZW;
+ else
+ alu.inst = EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INTERP_XY;
+
+ if ((i > 1) && (i < 6)) {
+ alu.dst.sel = ctx->shader->input[gpr].gpr;
+ alu.dst.write = 1;
+ }
+
+ alu.dst.chan = i % 4;
+ alu.src[0].chan = (1 - (i % 2));
+ alu.src[1].sel = V_SQ_ALU_SRC_PARAM_BASE + gpr;
+
+ alu.bank_swizzle_force = SQ_ALU_VEC_210;
+ if ((i % 4) == 3)
+ alu.last = 1;
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+ }
+ return 0;
+}
+
+
static int tgsi_declaration(struct r600_shader_ctx *ctx)
{
struct tgsi_full_declaration *d = &ctx->parse.FullToken.FullDeclaration;
@@ -340,6 +308,10 @@ static int tgsi_declaration(struct r600_shader_ctx *ctx)
if (r)
return r;
}
+ if (ctx->type == TGSI_PROCESSOR_FRAGMENT && ctx->bc->chiprev == 2) {
+ /* turn input into interpolate on EG */
+ evergreen_interp_alu(ctx, i);
+ }
break;
case TGSI_FILE_OUTPUT:
i = ctx->shader->noutput++;
@@ -379,6 +351,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
r = r600_bc_init(ctx.bc, shader->family);
if (r)
return r;
+ ctx.bc->use_mem_constant = shader->use_mem_constant;
ctx.tokens = tokens;
tgsi_scan_shader(tokens, &ctx.info);
tgsi_parse_init(&ctx.parse, tokens);
@@ -414,7 +387,11 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
ctx.info.file_count[TGSI_FILE_INPUT];
ctx.file_offset[TGSI_FILE_TEMPORARY] = ctx.file_offset[TGSI_FILE_OUTPUT] +
ctx.info.file_count[TGSI_FILE_OUTPUT];
- ctx.file_offset[TGSI_FILE_CONSTANT] = 256;
+ if (ctx.shader->use_mem_constant)
+ ctx.file_offset[TGSI_FILE_CONSTANT] = 128;
+ else
+ ctx.file_offset[TGSI_FILE_CONSTANT] = 256;
+
ctx.file_offset[TGSI_FILE_IMMEDIATE] = 253;
ctx.temp_reg = ctx.file_offset[TGSI_FILE_TEMPORARY] +
ctx.info.file_count[TGSI_FILE_TEMPORARY];
@@ -451,7 +428,10 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
/* reserve first tmp for everyone */
r600_get_temp(&ctx);
opcode = ctx.parse.FullToken.FullInstruction.Instruction.Opcode;
- ctx.inst_info = &r600_shader_tgsi_instruction[opcode];
+ if (ctx.bc->chiprev == 2)
+ ctx.inst_info = &eg_shader_tgsi_instruction[opcode];
+ else
+ ctx.inst_info = &r600_shader_tgsi_instruction[opcode];
r = ctx.inst_info->process(&ctx);
if (r)
goto out_err;
@@ -478,7 +458,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
output[i].barrier = 1;
output[i].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PARAM;
output[i].array_base = i - pos0;
- output[i].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT;
+ output[i].inst = BC_INST(ctx.bc, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT);
switch (ctx.type) {
case TGSI_PROCESSOR_VERTEX:
if (shader->output[i].name == TGSI_SEMANTIC_POSITION) {
@@ -550,7 +530,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
output[0].barrier = 1;
output[0].type = V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_PIXEL;
output[0].array_base = 0;
- output[0].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT;
+ output[0].inst = BC_INST(ctx.bc, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT);
noutput++;
}
/* set export done on last export of each type */
@@ -560,7 +540,7 @@ int r600_shader_from_tgsi(const struct tgsi_token *tokens, struct r600_shader *s
}
if (!(output_done & (1 << output[i].type))) {
output_done |= (1 << output[i].type);
- output[i].inst = V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE;
+ output[i].inst = BC_INST(ctx.bc, V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE);
}
}
/* add output to bytecode */
@@ -666,7 +646,7 @@ static int tgsi_split_constant(struct r600_shader_ctx *ctx, struct r600_bc_alu_s
int treg = r600_get_temp(ctx);
for (k = 0; k < 4; k++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = r600_src[j].sel;
alu.src[0].chan = k;
alu.dst.sel = treg;
@@ -702,7 +682,7 @@ static int tgsi_split_literal_constant(struct r600_shader_ctx *ctx, struct r600_
int treg = r600_get_temp(ctx);
for (k = 0; k < 4; k++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = r600_src[j].sel;
alu.src[0].chan = k;
alu.dst.sel = treg;
@@ -820,7 +800,7 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
lit_vals[1] = fui(0.5f);
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.is_op3 = 1;
alu.dst.chan = 0;
@@ -843,7 +823,7 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
return r;
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT);
alu.dst.chan = 0;
alu.dst.sel = ctx->temp_reg;
@@ -865,7 +845,7 @@ static int tgsi_setup_trig(struct r600_shader_ctx *ctx,
}
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.is_op3 = 1;
alu.dst.chan = 0;
@@ -924,7 +904,7 @@ static int tgsi_trig(struct r600_shader_ctx *ctx)
continue;
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = ctx->temp_reg;
r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
@@ -953,7 +933,7 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
/* dst.x = COS */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS);
r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst);
if (r)
return r;
@@ -967,7 +947,7 @@ static int tgsi_scs(struct r600_shader_ctx *ctx)
/* dst.y = SIN */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN);
r = tgsi_dst(ctx, &inst->Dst[0], 1, &alu.dst);
if (r)
return r;
@@ -1037,7 +1017,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
/* dst.x, <- 1.0 */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = V_SQ_ALU_SRC_1; /*1.0*/
alu.src[0].chan = 0;
r = tgsi_dst(ctx, &inst->Dst[0], 0, &alu.dst);
@@ -1050,7 +1030,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
/* dst.y = max(src.x, 0.0) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX);
alu.src[0] = r600_src[0];
alu.src[1].sel = V_SQ_ALU_SRC_0; /*0.0*/
alu.src[1].chan = 0;
@@ -1064,7 +1044,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
/* dst.w, <- 1.0 */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = V_SQ_ALU_SRC_1;
alu.src[0].chan = 0;
r = tgsi_dst(ctx, &inst->Dst[0], 3, &alu.dst);
@@ -1087,7 +1067,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
/* dst.z = log(src.y) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED);
alu.src[0] = r600_src[0];
alu.src[0].chan = tgsi_chan(&inst->Src[0], 1);
r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst);
@@ -1107,7 +1087,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
/* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT);
alu.src[0] = r600_src[0];
alu.src[0].chan = tgsi_chan(&inst->Src[0], 3);
alu.src[1].sel = sel;
@@ -1129,7 +1109,7 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
return r;
/* dst.z = exp(tmp.x) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
alu.src[0].sel = ctx->temp_reg;
alu.src[0].chan = 0;
r = tgsi_dst(ctx, &inst->Dst[0], 2, &alu.dst);
@@ -1143,6 +1123,34 @@ static int tgsi_lit(struct r600_shader_ctx *ctx)
return 0;
}
+static int tgsi_rsq(struct r600_shader_ctx *ctx)
+{
+ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+ struct r600_bc_alu alu;
+ int i, r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE);
+ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) {
+ r = tgsi_src(ctx, &inst->Src[i], &alu.src[i]);
+ if (r)
+ return r;
+ alu.src[i].chan = tgsi_chan(&inst->Src[i], 0);
+ alu.src[i].abs = 1;
+ }
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.write = 1;
+ alu.last = 1;
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+ /* replicate result */
+ return tgsi_helper_tempx_replicate(ctx);
+}
+
static int tgsi_trans(struct r600_shader_ctx *ctx)
{
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
@@ -1180,7 +1188,7 @@ static int tgsi_helper_tempx_replicate(struct r600_shader_ctx *ctx)
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
alu.src[0].sel = ctx->temp_reg;
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.dst.chan = i;
r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
if (r)
@@ -1230,7 +1238,7 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
/* LOG2(a) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE);
r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
if (r)
return r;
@@ -1246,7 +1254,7 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
return r;
/* b * LOG2(a) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE);
r = tgsi_src(ctx, &inst->Src[1], &alu.src[0]);
if (r)
return r;
@@ -1263,7 +1271,7 @@ static int tgsi_pow(struct r600_shader_ctx *ctx)
return r;
/* POW(a,b) = EXP2(b * LOG2(a))*/
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
alu.src[0].sel = ctx->temp_reg;
alu.dst.sel = ctx->temp_reg;
alu.dst.write = 1;
@@ -1291,7 +1299,7 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx)
/* tmp = (src > 0 ? 1 : src) */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT);
alu.is_op3 = 1;
alu.dst.sel = ctx->temp_reg;
@@ -1317,7 +1325,7 @@ static int tgsi_ssg(struct r600_shader_ctx *ctx)
/* dst = (-tmp > 0 ? -1 : tmp) */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT);
alu.is_op3 = 1;
r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
if (r)
@@ -1353,10 +1361,10 @@ static int tgsi_helper_copy(struct r600_shader_ctx *ctx, struct tgsi_full_instru
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
if (!(inst->Dst[0].Register.WriteMask & (1 << i))) {
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP);
alu.dst.chan = i;
} else {
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
if (r)
return r;
@@ -1475,7 +1483,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
if (inst->Instruction.Opcode == TGSI_OPCODE_TXP) {
/* Add perspective divide */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE);
r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
if (r)
return r;
@@ -1491,7 +1499,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
for (i = 0; i < 3; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
alu.src[0].sel = ctx->temp_reg;
alu.src[0].chan = 3;
r = tgsi_src(ctx, &inst->Src[0], &alu.src[1]);
@@ -1506,7 +1514,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
return r;
}
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = V_SQ_ALU_SRC_1;
alu.src[0].chan = 0;
alu.dst.sel = ctx->temp_reg;
@@ -1526,7 +1534,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE);
switch (i) {
case 0:
src_chan = 2;
@@ -1565,7 +1573,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
/* tmp1.z = RCP_e(|tmp1.z|) */
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE);
alu.src[0].sel = ctx->temp_reg;
alu.src[0].chan = 2;
alu.src[0].abs = 1;
@@ -1582,7 +1590,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
* muladd has no writemask, have to use another temp
*/
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.is_op3 = 1;
alu.src[0].sel = ctx->temp_reg;
@@ -1602,7 +1610,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
return r;
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.is_op3 = 1;
alu.src[0].sel = ctx->temp_reg;
@@ -1634,7 +1642,7 @@ static int tgsi_tex(struct r600_shader_ctx *ctx)
if (src_not_temp) {
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = src_gpr;
alu.src[0].chan = i;
alu.dst.sel = ctx->temp_reg;
@@ -1709,7 +1717,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
/* 1 - src0 */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD);
alu.src[0].sel = V_SQ_ALU_SRC_1;
alu.src[0].chan = 0;
alu.src[1] = r600_src[0];
@@ -1732,7 +1740,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
/* (1 - src0) * src2 */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
alu.src[0].sel = ctx->temp_reg;
alu.src[0].chan = i;
alu.src[1] = r600_src[2];
@@ -1754,7 +1762,7 @@ static int tgsi_lrp(struct r600_shader_ctx *ctx)
/* src0 * src1 + (1 - src0) * src2 */
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.is_op3 = 1;
alu.src[0] = r600_src[0];
alu.src[0].chan = tgsi_chan(&inst->Src[0], i);
@@ -1791,7 +1799,7 @@ static int tgsi_cmp(struct r600_shader_ctx *ctx)
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE);
alu.src[0] = r600_src[0];
alu.src[0].chan = tgsi_chan(&inst->Src[0], i);
@@ -1839,7 +1847,7 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx)
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
alu.src[0] = r600_src[0];
switch (i) {
@@ -1882,11 +1890,15 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx)
r = r600_bc_add_alu(ctx->bc, &alu);
if (r)
return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
}
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD);
alu.src[0] = r600_src[0];
switch (i) {
@@ -1939,6 +1951,10 @@ static int tgsi_xpd(struct r600_shader_ctx *ctx)
r = r600_bc_add_alu(ctx->bc, &alu);
if (r)
return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
}
if (use_temp)
return tgsi_helper_copy(ctx, inst);
@@ -1956,7 +1972,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
if (inst->Dst[0].Register.WriteMask & 1) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR);
r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
if (r)
return r;
@@ -1975,7 +1991,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
if (r)
return r;
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
alu.src[0].sel = ctx->temp_reg;
alu.src[0].chan = 0;
@@ -1996,7 +2012,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
if ((inst->Dst[0].Register.WriteMask >> 1) & 1) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT);
alu.src[0] = r600_src[0];
r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
if (r)
@@ -2023,7 +2039,7 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
/* result.z = RoughApprox2ToX(tmp);*/
if ((inst->Dst[0].Register.WriteMask >> 2) & 0x1) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
if (r)
return r;
@@ -2047,7 +2063,209 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
if ((inst->Dst[0].Register.WriteMask >> 3) & 0x1) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+ alu.src[0].sel = V_SQ_ALU_SRC_1;
+ alu.src[0].chan = 0;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 3;
+ alu.dst.write = 1;
+ alu.last = 1;
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+ }
+ return tgsi_helper_copy(ctx, inst);
+}
+
+static int tgsi_log(struct r600_shader_ctx *ctx)
+{
+ struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
+ struct r600_bc_alu alu;
+ int r;
+
+ /* result.x = floor(log2(src)); */
+ if (inst->Dst[0].Register.WriteMask & 1) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE);
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], 0);
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 0;
+ alu.dst.write = 1;
+ alu.last = 1;
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR);
+ alu.src[0].sel = ctx->temp_reg;
+ alu.src[0].chan = 0;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 0;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+ }
+
+ /* result.y = src.x / (2 ^ floor(log2(src.x))); */
+ if ((inst->Dst[0].Register.WriteMask >> 1) & 1) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE);
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], 0);
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 1;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR);
+ alu.src[0].sel = ctx->temp_reg;
+ alu.src[0].chan = 1;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 1;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE);
+ alu.src[0].sel = ctx->temp_reg;
+ alu.src[0].chan = 1;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 1;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE);
+ alu.src[0].sel = ctx->temp_reg;
+ alu.src[0].chan = 1;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 1;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
+
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], 0);
+
+ alu.src[1].sel = ctx->temp_reg;
+ alu.src[1].chan = 1;
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.chan = 1;
+ alu.dst.write = 1;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+ }
+
+ /* result.z = log2(src);*/
+ if ((inst->Dst[0].Register.WriteMask >> 2) & 1) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE);
+ r = tgsi_src(ctx, &inst->Src[0], &alu.src[0]);
+ if (r)
+ return r;
+
+ alu.src[0].chan = tgsi_chan(&inst->Src[0], 0);
+
+ alu.dst.sel = ctx->temp_reg;
+ alu.dst.write = 1;
+ alu.dst.chan = 2;
+ alu.last = 1;
+
+ r = r600_bc_add_alu(ctx->bc, &alu);
+ if (r)
+ return r;
+
+ r = r600_bc_add_literal(ctx->bc, ctx->value);
+ if (r)
+ return r;
+ }
+
+ /* result.w = 1.0; */
+ if ((inst->Dst[0].Register.WriteMask >> 3) & 1) {
+ memset(&alu, 0, sizeof(struct r600_bc_alu));
+
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
alu.src[0].sel = V_SQ_ALU_SRC_1;
alu.src[0].chan = 0;
@@ -2055,16 +2273,20 @@ static int tgsi_exp(struct r600_shader_ctx *ctx)
alu.dst.chan = 3;
alu.dst.write = 1;
alu.last = 1;
+
r = r600_bc_add_alu(ctx->bc, &alu);
if (r)
return r;
+
r = r600_bc_add_literal(ctx->bc, ctx->value);
if (r)
return r;
}
+
return tgsi_helper_copy(ctx, inst);
}
+/* r6/7 only for now */
static int tgsi_arl(struct r600_shader_ctx *ctx)
{
/* TODO from r600c, ar values don't persist between clauses */
@@ -2082,7 +2304,7 @@ static int tgsi_arl(struct r600_shader_ctx *ctx)
alu.last = 1;
- r = r600_bc_add_alu_type(ctx->bc, &alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU);
+ r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU));
if (r)
return r;
return 0;
@@ -2097,7 +2319,7 @@ static int tgsi_opdst(struct r600_shader_ctx *ctx)
for (i = 0; i < 4; i++) {
memset(&alu, 0, sizeof(struct r600_bc_alu));
- alu.inst = V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL;
+ alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
r = tgsi_dst(ctx, &inst->Dst[0], i, &alu.dst);
if (r)
return r;
@@ -2151,7 +2373,7 @@ static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode)
alu.last = 1;
- r = r600_bc_add_alu_type(ctx->bc, &alu, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE);
+ r = r600_bc_add_alu_type(ctx->bc, &alu, CTX_INST(V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE));
if (r)
return r;
return 0;
@@ -2159,7 +2381,7 @@ static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode)
static int pops(struct r600_shader_ctx *ctx, int pops)
{
- r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_POP);
+ r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_POP));
ctx->bc->cf_last->pop_count = pops;
return 0;
}
@@ -2192,6 +2414,9 @@ static inline void callstack_check_depth(struct r600_shader_ctx *ctx, unsigned r
case FC_PUSH_WQM:
diff = 4;
break;
+ default:
+ assert(0);
+ diff = 0;
}
if ((ctx->bc->callstack[ctx->bc->call_sp].current + diff) >
ctx->bc->callstack[ctx->bc->call_sp].max) {
@@ -2300,9 +2525,9 @@ static void break_loop_on_flag(struct r600_shader_ctx *ctx, unsigned fc_sp)
static int tgsi_if(struct r600_shader_ctx *ctx)
{
- emit_logic_pred(ctx, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE);
+ emit_logic_pred(ctx, CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE));
- r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_JUMP);
+ r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_JUMP));
fc_pushlevel(ctx, FC_IF);
@@ -2312,7 +2537,7 @@ static int tgsi_if(struct r600_shader_ctx *ctx)
static int tgsi_else(struct r600_shader_ctx *ctx)
{
- r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_ELSE);
+ r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_ELSE));
ctx->bc->cf_last->pop_count = 1;
fc_set_mid(ctx, ctx->bc->fc_sp);
@@ -2342,7 +2567,7 @@ static int tgsi_endif(struct r600_shader_ctx *ctx)
static int tgsi_bgnloop(struct r600_shader_ctx *ctx)
{
- r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL);
+ r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL));
fc_pushlevel(ctx, FC_LOOP);
@@ -2355,7 +2580,7 @@ static int tgsi_endloop(struct r600_shader_ctx *ctx)
{
int i;
- r600_bc_add_cfinst(ctx->bc, V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END);
+ r600_bc_add_cfinst(ctx->bc, CTX_INST(V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END));
if (ctx->bc->fc_stack[ctx->bc->fc_sp].type != FC_LOOP) {
R600_ERR("loop/endloop in shader code are not paired.\n");
@@ -2410,9 +2635,9 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
{TGSI_OPCODE_MOV, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2},
{TGSI_OPCODE_LIT, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit},
{TGSI_OPCODE_RCP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate},
- {TGSI_OPCODE_RSQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_RSQ, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_rsq},
{TGSI_OPCODE_EXP, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_exp},
- {TGSI_OPCODE_LOG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_LOG, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_log},
{TGSI_OPCODE_MUL, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL, tgsi_op2},
{TGSI_OPCODE_ADD, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2},
{TGSI_OPCODE_DP3, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
@@ -2562,3 +2787,161 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = {
{TGSI_OPCODE_ENDSWITCH, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
{TGSI_OPCODE_LAST, 0, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
};
+
+static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = {
+ {TGSI_OPCODE_ARL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_MOV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2},
+ {TGSI_OPCODE_LIT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lit},
+ {TGSI_OPCODE_RCP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_RSQ, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_EXP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_exp},
+ {TGSI_OPCODE_LOG, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_MUL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL, tgsi_op2},
+ {TGSI_OPCODE_ADD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2},
+ {TGSI_OPCODE_DP3, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
+ {TGSI_OPCODE_DP4, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
+ {TGSI_OPCODE_DST, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_opdst},
+ {TGSI_OPCODE_MIN, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN, tgsi_op2},
+ {TGSI_OPCODE_MAX, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX, tgsi_op2},
+ {TGSI_OPCODE_SLT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2_swap},
+ {TGSI_OPCODE_SGE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_op2},
+ {TGSI_OPCODE_MAD, 1, EG_V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD, tgsi_op3},
+ {TGSI_OPCODE_SUB, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD, tgsi_op2},
+ {TGSI_OPCODE_LRP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_lrp},
+ {TGSI_OPCODE_CND, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ /* gap */
+ {20, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_DP2A, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ /* gap */
+ {22, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {23, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_FRC, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT, tgsi_op2},
+ {TGSI_OPCODE_CLAMP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_FLR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR, tgsi_op2},
+ {TGSI_OPCODE_ROUND, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_EX2, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_LG2, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_POW, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_pow},
+ {TGSI_OPCODE_XPD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_xpd},
+ /* gap */
+ {32, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ABS, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV, tgsi_op2},
+ {TGSI_OPCODE_RCC, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_DPH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
+ {TGSI_OPCODE_COS, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS, tgsi_trig},
+ {TGSI_OPCODE_DDX, 0, SQ_TEX_INST_GET_GRADIENTS_H, tgsi_tex},
+ {TGSI_OPCODE_DDY, 0, SQ_TEX_INST_GET_GRADIENTS_V, tgsi_tex},
+ {TGSI_OPCODE_KILP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT, tgsi_kill}, /* predicated kill */
+ {TGSI_OPCODE_PK2H, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_PK2US, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_PK4B, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_PK4UB, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_RFL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_SEQ, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE, tgsi_op2},
+ {TGSI_OPCODE_SFL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_SGT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT, tgsi_op2},
+ {TGSI_OPCODE_SIN, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN, tgsi_trig},
+ {TGSI_OPCODE_SLE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE, tgsi_op2_swap},
+ {TGSI_OPCODE_SNE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE, tgsi_op2},
+ {TGSI_OPCODE_STR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TEX, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
+ {TGSI_OPCODE_TXD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXP, 0, SQ_TEX_INST_SAMPLE, tgsi_tex},
+ {TGSI_OPCODE_UP2H, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UP2US, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UP4B, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UP4UB, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_X2D, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ARA, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ARR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_BRA, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_CAL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_RET, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_SSG, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_ssg},
+ {TGSI_OPCODE_CMP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_cmp},
+ {TGSI_OPCODE_SCS, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_scs},
+ {TGSI_OPCODE_TXB, 0, SQ_TEX_INST_SAMPLE_L, tgsi_tex},
+ {TGSI_OPCODE_NRM, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_DIV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_DP2, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4, tgsi_dp},
+ {TGSI_OPCODE_TXL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_BRK, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK, tgsi_loop_brk_cont},
+ {TGSI_OPCODE_IF, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_if},
+ /* gap */
+ {75, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {76, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ELSE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_else},
+ {TGSI_OPCODE_ENDIF, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_endif},
+ /* gap */
+ {79, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {80, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_PUSHA, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_POPA, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_CEIL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_I2F, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_NOT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TRUNC, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC, tgsi_trans_srcx_replicate},
+ {TGSI_OPCODE_SHL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ /* gap */
+ {88, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_AND, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_OR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_MOD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_XOR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_SAD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXF, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_TXQ, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_CONT, 0, EG_V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE, tgsi_loop_brk_cont},
+ {TGSI_OPCODE_EMIT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ENDPRIM, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_BGNLOOP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_bgnloop},
+ {TGSI_OPCODE_BGNSUB, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ENDLOOP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_endloop},
+ {TGSI_OPCODE_ENDSUB, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ /* gap */
+ {103, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {104, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {105, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {106, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_NOP, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ /* gap */
+ {108, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {109, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {110, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {111, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_NRM4, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_CALLNZ, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_IFC, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_BREAKC, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_KIL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT, tgsi_kill}, /* conditional kill */
+ {TGSI_OPCODE_END, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_end}, /* aka HALT */
+ /* gap */
+ {118, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_F2I, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_IDIV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_IMAX, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_IMIN, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_INEG, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ISGE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ISHR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ISLT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_F2U, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_U2F, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UADD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UDIV, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UMAD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UMAX, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UMIN, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UMOD, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_UMUL, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_USEQ, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_USGE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_USHR, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_USLT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_USNE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_SWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_CASE, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_DEFAULT, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_ENDSWITCH, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+ {TGSI_OPCODE_LAST, 0, EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP, tgsi_unsupported},
+};
diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h
index 7c722c07cb..fba4a2b3b8 100644
--- a/src/gallium/drivers/r600/r600_shader.h
+++ b/src/gallium/drivers/r600/r600_shader.h
@@ -43,6 +43,7 @@ struct r600_shader {
struct r600_shader_io output[32];
enum radeon_family family;
boolean uses_kill;
+ boolean use_mem_constant;
};
#endif
diff --git a/src/gallium/drivers/r600/r600_sq.h b/src/gallium/drivers/r600/r600_sq.h
index fa7a31742a..0573e63dc8 100644
--- a/src/gallium/drivers/r600/r600_sq.h
+++ b/src/gallium/drivers/r600/r600_sq.h
@@ -55,31 +55,6 @@
#define S_SQ_CF_WORD1_CF_INST(x) (((x) & 0x7F) << 23)
#define G_SQ_CF_WORD1_CF_INST(x) (((x) >> 23) & 0x7F)
#define C_SQ_CF_WORD1_CF_INST 0xC07FFFFF
-#define V_SQ_CF_WORD1_SQ_CF_INST_NOP 0x00000000
-#define V_SQ_CF_WORD1_SQ_CF_INST_TEX 0x00000001
-#define V_SQ_CF_WORD1_SQ_CF_INST_VTX 0x00000002
-#define V_SQ_CF_WORD1_SQ_CF_INST_VTX_TC 0x00000003
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START 0x00000004
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_END 0x00000005
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_DX10 0x00000006
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_START_NO_AL 0x00000007
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_CONTINUE 0x00000008
-#define V_SQ_CF_WORD1_SQ_CF_INST_LOOP_BREAK 0x00000009
-#define V_SQ_CF_WORD1_SQ_CF_INST_JUMP 0x0000000A
-#define V_SQ_CF_WORD1_SQ_CF_INST_PUSH 0x0000000B
-#define V_SQ_CF_WORD1_SQ_CF_INST_PUSH_ELSE 0x0000000C
-#define V_SQ_CF_WORD1_SQ_CF_INST_ELSE 0x0000000D
-#define V_SQ_CF_WORD1_SQ_CF_INST_POP 0x0000000E
-#define V_SQ_CF_WORD1_SQ_CF_INST_POP_JUMP 0x0000000F
-#define V_SQ_CF_WORD1_SQ_CF_INST_POP_PUSH 0x00000010
-#define V_SQ_CF_WORD1_SQ_CF_INST_POP_PUSH_ELSE 0x00000011
-#define V_SQ_CF_WORD1_SQ_CF_INST_CALL 0x00000012
-#define V_SQ_CF_WORD1_SQ_CF_INST_CALL_FS 0x00000013
-#define V_SQ_CF_WORD1_SQ_CF_INST_RETURN 0x00000014
-#define V_SQ_CF_WORD1_SQ_CF_INST_EMIT_VERTEX 0x00000015
-#define V_SQ_CF_WORD1_SQ_CF_INST_EMIT_CUT_VERTEX 0x00000016
-#define V_SQ_CF_WORD1_SQ_CF_INST_CUT_VERTEX 0x00000017
-#define V_SQ_CF_WORD1_SQ_CF_INST_KILL 0x00000018
#define S_SQ_CF_WORD1_WHOLE_QUAD_MODE(x) (((x) & 0x1) << 30)
#define G_SQ_CF_WORD1_WHOLE_QUAD_MODE(x) (((x) >> 30) & 0x1)
#define C_SQ_CF_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
@@ -118,13 +93,6 @@
#define S_SQ_CF_ALU_WORD1_CF_INST(x) (((x) & 0xF) << 26)
#define G_SQ_CF_ALU_WORD1_CF_INST(x) (((x) >> 26) & 0xF)
#define C_SQ_CF_ALU_WORD1_CF_INST 0xC3FFFFFF
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU 0x00000008
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE 0x00000009
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP_AFTER 0x0000000A
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_POP2_AFTER 0x0000000B
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_CONTINUE 0x0000000D
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_BREAK 0x0000000E
-#define V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_ELSE_AFTER 0x0000000F
#define S_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x) (((x) & 0x1) << 30)
#define G_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE(x) (((x) >> 30) & 0x1)
#define C_SQ_CF_ALU_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
@@ -167,15 +135,7 @@
#define S_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x) (((x) & 0x7F) << 23)
#define G_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST(x) (((x) >> 23) & 0x7F)
#define C_SQ_CF_ALLOC_EXPORT_WORD1_CF_INST 0xC07FFFFF
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM0 0x00000020
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM1 0x00000021
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM2 0x00000022
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_STREAM3 0x00000023
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_SCRATCH 0x00000024
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_REDUCTION 0x00000025
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_MEM_RING 0x00000026
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT 0x00000027
-#define V_SQ_CF_ALLOC_EXPORT_WORD1_SQ_CF_INST_EXPORT_DONE 0x00000028
+
#define S_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x) (((x) & 0x1) << 30)
#define G_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE(x) (((x) >> 30) & 0x1)
#define C_SQ_CF_ALLOC_EXPORT_WORD1_WHOLE_QUAD_MODE 0xBFFFFFFF
@@ -219,6 +179,7 @@
* 253 SQ_ALU_SRC_LITERAL: literal constant.
* 254 SQ_ALU_SRC_PV: previous vector result.
* 255 SQ_ALU_SRC_PS: previous scalar result.
+ * 448 EG - INTERP SRC BASE
*/
#define V_SQ_ALU_SRC_0 0x000000F8
#define V_SQ_ALU_SRC_1 0x000000F9
@@ -226,6 +187,7 @@
#define V_SQ_ALU_SRC_M_1_INT 0x000000FB
#define V_SQ_ALU_SRC_0_5 0x000000FC
#define V_SQ_ALU_SRC_LITERAL 0x000000FD
+#define V_SQ_ALU_SRC_PARAM_BASE 0x000001C0
#define S_SQ_ALU_WORD0_SRC0_REL(x) (((x) & 0x1) << 9)
#define G_SQ_ALU_WORD0_SRC0_REL(x) (((x) >> 9) & 0x1)
#define C_SQ_ALU_WORD0_SRC0_REL 0xFFFFFDFF
@@ -300,111 +262,6 @@
#define S_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) & 0x3FF) << 8)
#define G_SQ_ALU_WORD1_OP2_ALU_INST(x) (((x) >> 8) & 0x3FF)
#define C_SQ_ALU_WORD1_OP2_ALU_INST 0xFFFC00FF
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD 0x00000000
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL 0x00000001
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL_IEEE 0x00000002
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX 0x00000003
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN 0x00000004
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_DX10 0x00000005
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_DX10 0x00000006
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE 0x00000008
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT 0x00000009
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE 0x0000000A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE 0x0000000B
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_DX10 0x0000000C
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_DX10 0x0000000D
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_DX10 0x0000000E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_DX10 0x0000000F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FRACT 0x00000010
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC 0x00000011
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CEIL 0x00000012
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RNDNE 0x00000013
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLOOR 0x00000014
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA 0x00000015
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_FLOOR 0x00000016
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_INT 0x00000018
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV 0x00000019
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOP 0x0000001A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_UINT 0x0000001E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_UINT 0x0000001F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE 0x00000020
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT 0x00000021
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE 0x00000022
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE 0x00000023
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_INV 0x00000024
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_POP 0x00000025
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_CLR 0x00000026
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SET_RESTORE 0x00000027
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH 0x00000028
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH 0x00000029
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH 0x0000002A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH 0x0000002B
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE 0x0000002C
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT 0x0000002D
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE 0x0000002E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE 0x0000002F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_AND_INT 0x00000030
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_OR_INT 0x00000031
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_XOR_INT 0x00000032
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_NOT_INT 0x00000033
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ADD_INT 0x00000034
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SUB_INT 0x00000035
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_INT 0x00000036
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_INT 0x00000037
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX_UINT 0x00000038
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN_UINT 0x00000039
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE_INT 0x0000003A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_INT 0x0000003B
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_INT 0x0000003C
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETNE_INT 0x0000003D
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGT_UINT 0x0000003E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETGE_UINT 0x0000003F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_UINT 0x00000040
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_UINT 0x00000041
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_INT 0x00000042
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_INT 0x00000043
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_INT 0x00000044
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_INT 0x00000045
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLE_INT 0x00000046
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGT_INT 0x00000047
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE_INT 0x00000048
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE_INT 0x00000049
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETE_PUSH_INT 0x0000004A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGT_PUSH_INT 0x0000004B
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETGE_PUSH_INT 0x0000004C
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETNE_PUSH_INT 0x0000004D
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLT_PUSH_INT 0x0000004E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_PRED_SETLE_PUSH_INT 0x0000004F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4 0x00000050
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_DOT4_IEEE 0x00000051
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_CUBE 0x00000052
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX4 0x00000053
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOVA_GPR_INT 0x00000060
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_EXP_IEEE 0x00000061
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_CLAMPED 0x00000062
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LOG_IEEE 0x00000063
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_CLAMPED 0x00000064
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_FF 0x00000065
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_IEEE 0x00000066
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_CLAMPED 0x00000067
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_FF 0x00000068
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIPSQRT_IEEE 0x00000069
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SQRT_IEEE 0x0000006A
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT 0x0000006B
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT 0x0000006C
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_UINT_TO_FLT 0x0000006D
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SIN 0x0000006E
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_COS 0x0000006F
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_ASHR_INT 0x00000070
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHR_INT 0x00000071
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_LSHL_INT 0x00000072
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_INT 0x00000073
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_INT 0x00000074
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULLO_UINT 0x00000075
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT 0x00000076
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_INT 0x00000077
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_RECIP_UINT 0x00000078
-#define V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_UINT 0x00000079
#define P_SQ_ALU_WORD1_OP3
#define S_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) & 0x1FF) << 0)
#define G_SQ_ALU_WORD1_OP3_SRC2_SEL(x) (((x) >> 0) & 0x1FF)
@@ -421,24 +278,6 @@
#define S_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) & 0x1F) << 13)
#define G_SQ_ALU_WORD1_OP3_ALU_INST(x) (((x) >> 13) & 0x1F)
#define C_SQ_ALU_WORD1_OP3_ALU_INST 0xFFFC1FFF
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT 0x0000000C
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M2 0x0000000D
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_M4 0x0000000E
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MUL_LIT_D2 0x0000000F
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD 0x00000010
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M2 0x00000011
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_M4 0x00000012
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_D2 0x00000013
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE 0x00000014
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_M2 0x00000015
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_M4 0x00000016
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_MULADD_IEEE_D2 0x00000017
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE 0x00000018
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT 0x00000019
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE 0x0000001A
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDE_INT 0x0000001C
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGT_INT 0x0000001D
-#define V_SQ_ALU_WORD1_OP3_SQ_OP3_INST_CNDGE_INT 0x0000001E
#define P_SQ_VTX_WORD0
#define S_SQ_VTX_WORD0_VTX_INST(x) (((x) & 0x1F) << 0)
#define G_SQ_VTX_WORD0_VTX_INST(x) (((x) >> 0) & 0x1F)
@@ -610,4 +449,16 @@
#define V_SQ_REL_ABSOLUTE 0
#define V_SQ_REL_RELATIVE 1
+
+#define SQ_ALU_VEC_012 0x00
+#define SQ_ALU_VEC_021 0x01
+#define SQ_ALU_VEC_120 0x02
+#define SQ_ALU_VEC_102 0x03
+#define SQ_ALU_VEC_201 0x04
+#define SQ_ALU_VEC_210 0x05
+
+#define SQ_ALU_SCL_210 0x00000000
+#define SQ_ALU_SCL_122 0x00000001
+#define SQ_ALU_SCL_212 0x00000002
+#define SQ_ALU_SCL_221 0x00000003
#endif
diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c
index 66cab7d7a6..5a4a72d64f 100644
--- a/src/gallium/drivers/r600/r600_state.c
+++ b/src/gallium/drivers/r600/r600_state.c
@@ -28,60 +28,88 @@
#include "util/u_inlines.h"
#include "util/u_format.h"
#include "util/u_memory.h"
+#include "util/u_pack_color.h"
#include "r600_screen.h"
#include "r600_context.h"
#include "r600_resource.h"
-#include "r600d.h"
-#include "r600_state_inlines.h"
-
-static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state);
-static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state);
-static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_clip_state *state);
-static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_sampler_state *state, unsigned id);
-static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate, const struct pipe_sampler_view *view, unsigned id);
-static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state, int cb);
-static void r600_db(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state);
+static struct r600_context_state *r600_new_context_state(unsigned type)
+{
+ struct r600_context_state *rstate = CALLOC_STRUCT(r600_context_state);
+ if (rstate == NULL)
+ return NULL;
+ rstate->type = type;
+ rstate->refcount = 1;
+ return rstate;
+}
static void *r600_create_blend_state(struct pipe_context *ctx,
const struct pipe_blend_state *state)
{
struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
- return r600_context_state(rctx, pipe_blend_type, state);
+ rstate = r600_new_context_state(pipe_blend_type);
+ rstate->state.blend = *state;
+ rctx->vtbl->blend(rctx, &rstate->rstate[0], &rstate->state.blend);
+
+ return rstate;
}
static void *r600_create_dsa_state(struct pipe_context *ctx,
- const struct pipe_depth_stencil_alpha_state *state)
+ const struct pipe_depth_stencil_alpha_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
- return r600_context_state(rctx, pipe_dsa_type, state);
+ rstate = r600_new_context_state(pipe_dsa_type);
+ rstate->state.dsa = *state;
+ return rstate;
}
static void *r600_create_rs_state(struct pipe_context *ctx,
const struct pipe_rasterizer_state *state)
{
- struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
- return r600_context_state(rctx, pipe_rasterizer_type, state);
+ rstate = r600_new_context_state(pipe_rasterizer_type);
+ rstate->state.rasterizer = *state;
+ return rstate;
}
static void *r600_create_sampler_state(struct pipe_context *ctx,
const struct pipe_sampler_state *state)
{
struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
- return r600_context_state(rctx, pipe_sampler_type, state);
+ rstate = r600_new_context_state(pipe_sampler_type);
+ rstate->state.sampler = *state;
+ rctx->vtbl->sampler(rctx, &rstate->rstate[0], &rstate->state.sampler, 0);
+ rctx->vtbl->sampler_border(rctx, &rstate->rstate[1], &rstate->state.sampler, 0);
+ return rstate;
}
+static void r600_remove_sampler_view(struct r600_shader_sampler_states *sampler,
+ struct r600_context_state *rstate)
+{
+ int i, j;
+
+ for (i = 0; i < sampler->nview; i++) {
+ for (j = 0; j < rstate->nrstate; j++) {
+ if (sampler->view[i] == &rstate->rstate[j])
+ sampler->view[i] = NULL;
+ }
+ }
+}
static void r600_sampler_view_destroy(struct pipe_context *ctx,
struct pipe_sampler_view *state)
{
struct r600_context_state *rstate = (struct r600_context_state *)state;
+ struct r600_context *rctx = r600_context(ctx);
+ /* need to search list of vs/ps sampler views and remove it from any - uggh */
+ r600_remove_sampler_view(&rctx->ps_sampler, rstate);
+ r600_remove_sampler_view(&rctx->vs_sampler, rstate);
r600_context_state_decref(rstate);
}
@@ -89,24 +117,87 @@ static struct pipe_sampler_view *r600_create_sampler_view(struct pipe_context *c
struct pipe_resource *texture,
const struct pipe_sampler_view *state)
{
- struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
+ struct r600_context *rctx = r600_context(ctx);
- rstate = r600_context_state(rctx, pipe_sampler_view_type, state);
+ rstate = r600_new_context_state(pipe_sampler_view_type);
+ rstate->state.sampler_view = *state;
+ rstate->state.sampler_view.texture = NULL;
pipe_reference(NULL, &texture->reference);
rstate->state.sampler_view.texture = texture;
rstate->state.sampler_view.reference.count = 1;
rstate->state.sampler_view.context = ctx;
- r600_resource(ctx, &rstate->rstate[0], &rstate->state.sampler_view, 0);
+ rctx->vtbl->resource(ctx, &rstate->rstate[0], &rstate->state.sampler_view, 0);
return &rstate->state.sampler_view;
}
+static void r600_set_sampler_view(struct pipe_context *ctx,
+ unsigned count,
+ struct pipe_sampler_view **views,
+ struct r600_shader_sampler_states *sampler,
+ unsigned shader_id)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
+ unsigned i;
+
+ for (i = 0; i < sampler->nview; i++) {
+ radeon_draw_unbind(&rctx->draw, sampler->view[i]);
+ }
+
+ for (i = 0; i < count; i++) {
+ rstate = (struct r600_context_state *)views[i];
+ if (rstate) {
+ rstate->nrstate = 0;
+ }
+ }
+ for (i = 0; i < count; i++) {
+ rstate = (struct r600_context_state *)views[i];
+ if (rstate) {
+ if (rstate->nrstate >= R600_MAX_RSTATE)
+ continue;
+ if (rstate->nrstate) {
+ memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
+ }
+ radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, shader_id);
+ sampler->view[i] = &rstate->rstate[rstate->nrstate];
+ rstate->nrstate++;
+ }
+ }
+ sampler->nview = count;
+}
+
+static void r600_set_ps_sampler_view(struct pipe_context *ctx,
+ unsigned count,
+ struct pipe_sampler_view **views)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ r600_set_sampler_view(ctx, count, views, &rctx->ps_sampler, R600_SHADER_PS);
+}
+
+static void r600_set_vs_sampler_view(struct pipe_context *ctx,
+ unsigned count,
+ struct pipe_sampler_view **views)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ r600_set_sampler_view(ctx, count, views, &rctx->vs_sampler, R600_SHADER_VS);
+}
+
static void *r600_create_shader_state(struct pipe_context *ctx,
const struct pipe_shader_state *state)
{
struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate;
+ int r;
- return r600_context_state(rctx, pipe_shader_type, state);
+ rstate = r600_new_context_state(pipe_shader_type);
+ rstate->state.shader = *state;
+ r = r600_pipe_shader_create(&rctx->context, rstate, rstate->state.shader.tokens);
+ if (r) {
+ r600_context_state_decref(rstate);
+ return NULL;
+ }
+ return rstate;
}
static void *r600_create_vertex_elements(struct pipe_context *ctx,
@@ -122,119 +213,95 @@ static void *r600_create_vertex_elements(struct pipe_context *ctx,
return v;
}
-static void r600_bind_state(struct pipe_context *ctx, void *state)
+static void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate = (struct r600_context_state *)state;
+ struct r600_vertex_element *v = (struct r600_vertex_element*)state;
- if (state == NULL)
+ if (v == NULL)
return;
- switch (rstate->type) {
- case pipe_rasterizer_type:
- rctx->rasterizer = r600_context_state_decref(rctx->rasterizer);
- rctx->rasterizer = r600_context_state_incref(rstate);
- break;
- case pipe_poly_stipple_type:
- rctx->poly_stipple = r600_context_state_decref(rctx->poly_stipple);
- rctx->poly_stipple = r600_context_state_incref(rstate);
- break;
- case pipe_scissor_type:
- rctx->scissor = r600_context_state_decref(rctx->scissor);
- rctx->scissor = r600_context_state_incref(rstate);
- break;
- case pipe_clip_type:
- rctx->clip = r600_context_state_decref(rctx->clip);
- rctx->clip = r600_context_state_incref(rstate);
- break;
- case pipe_depth_type:
- rctx->depth = r600_context_state_decref(rctx->depth);
- rctx->depth = r600_context_state_incref(rstate);
- break;
- case pipe_stencil_type:
- rctx->stencil = r600_context_state_decref(rctx->stencil);
- rctx->stencil = r600_context_state_incref(rstate);
- break;
- case pipe_alpha_type:
- rctx->alpha = r600_context_state_decref(rctx->alpha);
- rctx->alpha = r600_context_state_incref(rstate);
- break;
- case pipe_dsa_type:
- rctx->dsa = r600_context_state_decref(rctx->dsa);
- rctx->dsa = r600_context_state_incref(rstate);
- break;
- case pipe_blend_type:
- rctx->blend = r600_context_state_decref(rctx->blend);
- rctx->blend = r600_context_state_incref(rstate);
- break;
- case pipe_framebuffer_type:
- rctx->framebuffer = r600_context_state_decref(rctx->framebuffer);
- rctx->framebuffer = r600_context_state_incref(rstate);
- break;
- case pipe_stencil_ref_type:
- rctx->stencil_ref = r600_context_state_decref(rctx->stencil_ref);
- rctx->stencil_ref = r600_context_state_incref(rstate);
- break;
- case pipe_viewport_type:
- rctx->viewport = r600_context_state_decref(rctx->viewport);
- rctx->viewport = r600_context_state_incref(rstate);
- break;
- case pipe_shader_type:
- case pipe_sampler_type:
- case pipe_sampler_view_type:
- default:
- R600_ERR("invalid type %d\n", rstate->type);
+ if (--v->refcount)
return;
+ free(v);
+}
+
+static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_vertex_element *v = (struct r600_vertex_element*)state;
+
+ r600_delete_vertex_element(ctx, rctx->vertex_elements);
+ rctx->vertex_elements = v;
+ if (v) {
+ v->refcount++;
}
}
-static void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
+static void r600_bind_rasterizer_state(struct pipe_context *ctx, void *state)
{
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate = (struct r600_context_state *)state;
- rctx->ps_shader = r600_context_state_decref(rctx->ps_shader);
- rctx->ps_shader = r600_context_state_incref(rstate);
+ if (state == NULL)
+ return;
+ rctx->rasterizer = r600_context_state_decref(rctx->rasterizer);
+ rctx->rasterizer = r600_context_state_incref(rstate);
}
-static void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
+static void r600_bind_blend_state(struct pipe_context *ctx, void *state)
{
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate = (struct r600_context_state *)state;
- rctx->vs_shader = r600_context_state_decref(rctx->vs_shader);
- rctx->vs_shader = r600_context_state_incref(rstate);
+ if (state == NULL)
+ return;
+ rctx->blend = r600_context_state_decref(rctx->blend);
+ rctx->blend = r600_context_state_incref(rstate);
+
}
-static void r600_delete_vertex_element(struct pipe_context *ctx, void *state)
+static void r600_bind_dsa_state(struct pipe_context *ctx, void *state)
{
- struct r600_vertex_element *v = (struct r600_vertex_element*)state;
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate = (struct r600_context_state *)state;
- if (v == NULL)
- return;
- if (--v->refcount)
+ if (state == NULL)
return;
- free(v);
+ rctx->dsa = r600_context_state_decref(rctx->dsa);
+ rctx->dsa = r600_context_state_incref(rstate);
}
-static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
+static void r600_bind_ps_shader(struct pipe_context *ctx, void *state)
{
struct r600_context *rctx = r600_context(ctx);
- struct r600_vertex_element *v = (struct r600_vertex_element*)state;
+ struct r600_context_state *rstate = (struct r600_context_state *)state;
- r600_delete_vertex_element(ctx, rctx->vertex_elements);
- rctx->vertex_elements = v;
- if (v) {
- v->refcount++;
- }
+ rctx->ps_shader = r600_context_state_decref(rctx->ps_shader);
+ rctx->ps_shader = r600_context_state_incref(rstate);
}
-static void r600_bind_ps_sampler(struct pipe_context *ctx,
- unsigned count, void **states)
+static void r600_bind_vs_shader(struct pipe_context *ctx, void *state)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ struct r600_context_state *rstate = (struct r600_context_state *)state;
+
+ rctx->vs_shader = r600_context_state_decref(rctx->vs_shader);
+ rctx->vs_shader = r600_context_state_incref(rstate);
+}
+
+static void r600_bind_sampler_shader(struct pipe_context *ctx,
+ unsigned count, void **states,
+ struct r600_shader_sampler_states *sampler, unsigned shader_id)
{
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
unsigned i;
+ for (i = 0; i < sampler->nsampler; i++) {
+ radeon_draw_unbind(&rctx->draw, sampler->sampler[i]);
+ }
+ for (i = 0; i < sampler->nborder; i++) {
+ radeon_draw_unbind(&rctx->draw, sampler->border[i]);
+ }
for (i = 0; i < count; i++) {
rstate = (struct r600_context_state *)states[i];
if (rstate) {
@@ -248,42 +315,31 @@ static void r600_bind_ps_sampler(struct pipe_context *ctx,
continue;
if (rstate->nrstate) {
memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
+ memcpy(&rstate->rstate[rstate->nrstate+1], &rstate->rstate[1], sizeof(struct radeon_state));
}
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, R600_SHADER_PS);
- rctx->ps_sampler[i] = &rstate->rstate[rstate->nrstate];
- rstate->nrstate++;
+ radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, shader_id);
+ radeon_state_convert(&rstate->rstate[rstate->nrstate + 1], R600_STATE_SAMPLER_BORDER, i, shader_id);
+ sampler->sampler[i] = &rstate->rstate[rstate->nrstate];
+ sampler->border[i] = &rstate->rstate[rstate->nrstate + 1];
+ rstate->nrstate += 2;
}
}
- rctx->ps_nsampler = count;
+ sampler->nsampler = count;
+ sampler->nborder = count;
}
-static void r600_bind_vs_sampler(struct pipe_context *ctx,
+static void r600_bind_ps_sampler(struct pipe_context *ctx,
unsigned count, void **states)
{
struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- unsigned i;
+ r600_bind_sampler_shader(ctx, count, states, &rctx->ps_sampler, R600_SHADER_PS);
+}
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)states[i];
- if (rstate) {
- rstate->nrstate = 0;
- }
- }
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)states[i];
- if (rstate) {
- if (rstate->nrstate >= R600_MAX_RSTATE)
- continue;
- if (rstate->nrstate) {
- memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
- }
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_SAMPLER, i, R600_SHADER_VS);
- rctx->vs_sampler[i] = &rstate->rstate[rstate->nrstate];
- rstate->nrstate++;
- }
- }
- rctx->vs_nsampler = count;
+static void r600_bind_vs_sampler(struct pipe_context *ctx,
+ unsigned count, void **states)
+{
+ struct r600_context *rctx = r600_context(ctx);
+ r600_bind_sampler_shader(ctx, count, states, &rctx->vs_sampler, R600_SHADER_VS);
}
static void r600_delete_state(struct pipe_context *ctx, void *state)
@@ -307,116 +363,12 @@ static void r600_set_clip_state(struct pipe_context *ctx,
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
- rstate = r600_context_state(rctx, pipe_clip_type, state);
- r600_bind_state(ctx, rstate);
- /* refcount is taken care of this */
- r600_delete_state(ctx, rstate);
-}
-
-static void r600_set_constant_buffer(struct pipe_context *ctx,
- uint shader, uint index,
- struct pipe_resource *buffer)
-{
- struct r600_screen *rscreen = r600_screen(ctx->screen);
- struct r600_context *rctx = r600_context(ctx);
- unsigned nconstant = 0, i, type, shader_class;
- struct radeon_state *rstate, *rstates;
- struct pipe_transfer *transfer;
- u32 *ptr;
+ r600_context_state_decref(rctx->clip);
- type = R600_STATE_CONSTANT;
-
- switch (shader) {
- case PIPE_SHADER_VERTEX:
- shader_class = R600_SHADER_VS;
- rstates = rctx->vs_constant;
- break;
- case PIPE_SHADER_FRAGMENT:
- shader_class = R600_SHADER_PS;
- rstates = rctx->ps_constant;
- break;
- default:
- R600_ERR("unsupported %d\n", shader);
- return;
- }
- if (buffer && buffer->width0 > 0) {
- nconstant = buffer->width0 / 16;
- ptr = pipe_buffer_map(ctx, buffer, PIPE_TRANSFER_READ, &transfer);
- if (ptr == NULL)
- return;
- for (i = 0; i < nconstant; i++) {
- rstate = &rstates[i];
- radeon_state_init(rstate, rscreen->rw, type, i, shader_class);
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0] = ptr[i * 4 + 0];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0] = ptr[i * 4 + 1];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0] = ptr[i * 4 + 2];
- rstate->states[R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0] = ptr[i * 4 + 3];
- if (radeon_state_pm4(rstate))
- return;
- radeon_draw_bind(&rctx->draw, rstate);
- }
- pipe_buffer_unmap(ctx, buffer, transfer);
- }
-}
-
-static void r600_set_ps_sampler_view(struct pipe_context *ctx,
- unsigned count,
- struct pipe_sampler_view **views)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- unsigned i;
-
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- rstate->nrstate = 0;
- }
- }
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- if (rstate->nrstate >= R600_MAX_RSTATE)
- continue;
- if (rstate->nrstate) {
- memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
- }
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, R600_SHADER_PS);
- rctx->ps_sampler_view[i] = &rstate->rstate[rstate->nrstate];
- rstate->nrstate++;
- }
- }
- rctx->ps_nsampler_view = count;
-}
-
-static void r600_set_vs_sampler_view(struct pipe_context *ctx,
- unsigned count,
- struct pipe_sampler_view **views)
-{
- struct r600_context *rctx = r600_context(ctx);
- struct r600_context_state *rstate;
- unsigned i;
-
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- rstate->nrstate = 0;
- }
- }
- for (i = 0; i < count; i++) {
- rstate = (struct r600_context_state *)views[i];
- if (rstate) {
- if (rstate->nrstate >= R600_MAX_RSTATE)
- continue;
- if (rstate->nrstate) {
- memcpy(&rstate->rstate[rstate->nrstate], &rstate->rstate[0], sizeof(struct radeon_state));
- }
- radeon_state_convert(&rstate->rstate[rstate->nrstate], R600_STATE_RESOURCE, i, R600_SHADER_VS);
- rctx->vs_sampler_view[i] = &rstate->rstate[rstate->nrstate];
- rstate->nrstate++;
- }
- }
- rctx->vs_nsampler_view = count;
+ rstate = r600_new_context_state(pipe_clip_type);
+ rstate->state.clip = *state;
+ rctx->vtbl->ucp(rctx, &rstate->rstate[0], &rstate->state.clip);
+ rctx->clip = rstate;
}
static void r600_set_framebuffer_state(struct pipe_context *ctx,
@@ -424,15 +376,24 @@ static void r600_set_framebuffer_state(struct pipe_context *ctx,
{
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
+ int i;
+
+ r600_context_state_decref(rctx->framebuffer);
- rstate = r600_context_state(rctx, pipe_framebuffer_type, state);
- r600_bind_state(ctx, rstate);
- for (int i = 0; i < state->nr_cbufs; i++) {
- r600_cb(rctx, &rstate->rstate[i+1], state, i);
+ rstate = r600_new_context_state(pipe_framebuffer_type);
+ rstate->state.framebuffer = *state;
+ for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) {
+ pipe_reference(NULL, &state->cbufs[i]->reference);
+ }
+ pipe_reference(NULL, &state->zsbuf->reference);
+ rctx->framebuffer = rstate;
+ for (i = 0; i < state->nr_cbufs; i++) {
+ rctx->vtbl->cb(rctx, &rstate->rstate[i+1], state, i);
}
if (state->zsbuf) {
- r600_db(rctx, &rstate->rstate[0], state);
+ rctx->vtbl->db(rctx, &rstate->rstate[0], state);
}
+ return;
}
static void r600_set_polygon_stipple(struct pipe_context *ctx,
@@ -450,10 +411,11 @@ static void r600_set_scissor_state(struct pipe_context *ctx,
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
- rstate = r600_context_state(rctx, pipe_scissor_type, state);
- r600_bind_state(ctx, rstate);
- /* refcount is taken care of this */
- r600_delete_state(ctx, rstate);
+ r600_context_state_decref(rctx->scissor);
+
+ rstate = r600_new_context_state(pipe_scissor_type);
+ rstate->state.scissor = *state;
+ rctx->scissor = rstate;
}
static void r600_set_stencil_ref(struct pipe_context *ctx,
@@ -462,10 +424,11 @@ static void r600_set_stencil_ref(struct pipe_context *ctx,
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
- rstate = r600_context_state(rctx, pipe_stencil_ref_type, state);
- r600_bind_state(ctx, rstate);
- /* refcount is taken care of this */
- r600_delete_state(ctx, rstate);
+ r600_context_state_decref(rctx->stencil_ref);
+
+ rstate = r600_new_context_state(pipe_stencil_ref_type);
+ rstate->state.stencil_ref = *state;
+ rctx->stencil_ref = rstate;
}
static void r600_set_vertex_buffers(struct pipe_context *ctx,
@@ -508,9 +471,12 @@ static void r600_set_viewport_state(struct pipe_context *ctx,
struct r600_context *rctx = r600_context(ctx);
struct r600_context_state *rstate;
- rstate = r600_context_state(rctx, pipe_viewport_type, state);
- r600_bind_state(ctx, rstate);
- r600_delete_state(ctx, rstate);
+ r600_context_state_decref(rctx->viewport);
+
+ rstate = r600_new_context_state(pipe_viewport_type);
+ rstate->state.viewport = *state;
+ rctx->vtbl->viewport(rctx, &rstate->rstate[0], &rstate->state.viewport);
+ rctx->viewport = rstate;
}
void r600_init_state_functions(struct r600_context *rctx)
@@ -523,11 +489,11 @@ void r600_init_state_functions(struct r600_context *rctx)
rctx->context.create_sampler_view = r600_create_sampler_view;
rctx->context.create_vertex_elements_state = r600_create_vertex_elements;
rctx->context.create_vs_state = r600_create_shader_state;
- rctx->context.bind_blend_state = r600_bind_state;
- rctx->context.bind_depth_stencil_alpha_state = r600_bind_state;
+ rctx->context.bind_blend_state = r600_bind_blend_state;
+ rctx->context.bind_depth_stencil_alpha_state = r600_bind_dsa_state;
rctx->context.bind_fragment_sampler_states = r600_bind_ps_sampler;
rctx->context.bind_fs_state = r600_bind_ps_shader;
- rctx->context.bind_rasterizer_state = r600_bind_state;
+ rctx->context.bind_rasterizer_state = r600_bind_rasterizer_state;
rctx->context.bind_vertex_elements_state = r600_bind_vertex_elements;
rctx->context.bind_vertex_sampler_states = r600_bind_vs_sampler;
rctx->context.bind_vs_state = r600_bind_vs_shader;
@@ -540,7 +506,14 @@ void r600_init_state_functions(struct r600_context *rctx)
rctx->context.delete_vs_state = r600_delete_state;
rctx->context.set_blend_color = r600_set_blend_color;
rctx->context.set_clip_state = r600_set_clip_state;
- rctx->context.set_constant_buffer = r600_set_constant_buffer;
+
+ if (rctx->screen->chip_class == EVERGREEN)
+ rctx->context.set_constant_buffer = eg_set_constant_buffer;
+ else if (rctx->screen->use_mem_constant)
+ rctx->context.set_constant_buffer = r600_set_constant_buffer_mem;
+ else
+ rctx->context.set_constant_buffer = r600_set_constant_buffer_file;
+
rctx->context.set_fragment_sampler_views = r600_set_ps_sampler_view;
rctx->context.set_framebuffer_state = r600_set_framebuffer_state;
rctx->context.set_polygon_stipple = r600_set_polygon_stipple;
@@ -603,775 +576,101 @@ struct r600_context_state *r600_context_state_decref(struct r600_context_state *
return NULL;
}
-struct r600_context_state *r600_context_state(struct r600_context *rctx, unsigned type, const void *state)
+static void r600_bind_shader_sampler(struct r600_context *rctx, struct r600_shader_sampler_states *sampler)
{
- struct r600_context_state *rstate = CALLOC_STRUCT(r600_context_state);
- const union pipe_states *states = state;
- unsigned i;
- int r;
-
- if (rstate == NULL)
- return NULL;
- rstate->type = type;
- rstate->refcount = 1;
-
- switch (rstate->type) {
- case pipe_sampler_view_type:
- rstate->state.sampler_view = (*states).sampler_view;
- rstate->state.sampler_view.texture = NULL;
- break;
- case pipe_framebuffer_type:
- rstate->state.framebuffer = (*states).framebuffer;
- for (i = 0; i < rstate->state.framebuffer.nr_cbufs; i++) {
- pipe_surface_reference(&rstate->state.framebuffer.cbufs[i],
- (*states).framebuffer.cbufs[i]);
- }
- pipe_surface_reference(&rstate->state.framebuffer.zsbuf,
- (*states).framebuffer.zsbuf);
- break;
- case pipe_viewport_type:
- rstate->state.viewport = (*states).viewport;
- r600_viewport(rctx, &rstate->rstate[0], &rstate->state.viewport);
- break;
- case pipe_depth_type:
- rstate->state.depth = (*states).depth;
- break;
- case pipe_rasterizer_type:
- rstate->state.rasterizer = (*states).rasterizer;
- break;
- case pipe_poly_stipple_type:
- rstate->state.poly_stipple = (*states).poly_stipple;
- break;
- case pipe_scissor_type:
- rstate->state.scissor = (*states).scissor;
- break;
- case pipe_clip_type:
- rstate->state.clip = (*states).clip;
- r600_ucp(rctx, &rstate->rstate[0], &rstate->state.clip);
- break;
- case pipe_stencil_type:
- rstate->state.stencil = (*states).stencil;
- break;
- case pipe_alpha_type:
- rstate->state.alpha = (*states).alpha;
- break;
- case pipe_dsa_type:
- rstate->state.dsa = (*states).dsa;
- break;
- case pipe_blend_type:
- rstate->state.blend = (*states).blend;
- r600_blend(rctx, &rstate->rstate[0], &rstate->state.blend);
- break;
- case pipe_stencil_ref_type:
- rstate->state.stencil_ref = (*states).stencil_ref;
- break;
- case pipe_shader_type:
- rstate->state.shader = (*states).shader;
- r = r600_pipe_shader_create(&rctx->context, rstate, rstate->state.shader.tokens);
- if (r) {
- r600_context_state_decref(rstate);
- return NULL;
- }
- break;
- case pipe_sampler_type:
- rstate->state.sampler = (*states).sampler;
- r600_sampler(rctx, &rstate->rstate[0], &rstate->state.sampler, 0);
- break;
- default:
- R600_ERR("invalid type %d\n", rstate->type);
- FREE(rstate);
- return NULL;
- }
- return rstate;
-}
-
-static void r600_blend(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_blend_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
int i;
- radeon_state_init(rstate, rscreen->rw, R600_STATE_BLEND, 0, 0);
- rstate->states[R600_BLEND__CB_BLEND_RED] = fui(rctx->blend_color.color[0]);
- rstate->states[R600_BLEND__CB_BLEND_GREEN] = fui(rctx->blend_color.color[1]);
- rstate->states[R600_BLEND__CB_BLEND_BLUE] = fui(rctx->blend_color.color[2]);
- rstate->states[R600_BLEND__CB_BLEND_ALPHA] = fui(rctx->blend_color.color[3]);
- rstate->states[R600_BLEND__CB_BLEND0_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND1_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND2_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND3_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND4_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND5_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND6_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND7_CONTROL] = 0x00000000;
- rstate->states[R600_BLEND__CB_BLEND_CONTROL] = 0x00000000;
-
- for (i = 0; i < 8; i++) {
- unsigned eqRGB = state->rt[i].rgb_func;
- unsigned srcRGB = state->rt[i].rgb_src_factor;
- unsigned dstRGB = state->rt[i].rgb_dst_factor;
-
- unsigned eqA = state->rt[i].alpha_func;
- unsigned srcA = state->rt[i].alpha_src_factor;
- unsigned dstA = state->rt[i].alpha_dst_factor;
- uint32_t bc = 0;
-
- if (!state->rt[i].blend_enable)
- continue;
-
- bc |= S_028804_COLOR_COMB_FCN(r600_translate_blend_function(eqRGB));
- bc |= S_028804_COLOR_SRCBLEND(r600_translate_blend_factor(srcRGB));
- bc |= S_028804_COLOR_DESTBLEND(r600_translate_blend_factor(dstRGB));
-
- if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) {
- bc |= S_028804_SEPARATE_ALPHA_BLEND(1);
- bc |= S_028804_ALPHA_COMB_FCN(r600_translate_blend_function(eqA));
- bc |= S_028804_ALPHA_SRCBLEND(r600_translate_blend_factor(srcA));
- bc |= S_028804_ALPHA_DESTBLEND(r600_translate_blend_factor(dstA));
- }
-
- rstate->states[R600_BLEND__CB_BLEND0_CONTROL + i] = bc;
- if (i == 0)
- rstate->states[R600_BLEND__CB_BLEND_CONTROL] = bc;
+ for (i = 0; i < sampler->nsampler; i++) {
+ if (sampler->sampler[i])
+ radeon_draw_bind(&rctx->draw, sampler->sampler[i]);
}
- radeon_state_pm4(rstate);
-}
-
-static void r600_ucp(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_clip_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_UCP, 0, 0);
+ for (i = 0; i < sampler->nborder; i++) {
+ if (sampler->border[i])
+ radeon_draw_bind(&rctx->draw, sampler->border[i]);
+ }
- for (int i = 0; i < state->nr; i++) {
- rstate->states[i * 4 + 0] = fui(state->ucp[i][0]);
- rstate->states[i * 4 + 1] = fui(state->ucp[i][1]);
- rstate->states[i * 4 + 2] = fui(state->ucp[i][2]);
- rstate->states[i * 4 + 3] = fui(state->ucp[i][3]);
+ for (i = 0; i < sampler->nview; i++) {
+ if (sampler->view[i])
+ radeon_draw_bind(&rctx->draw, sampler->view[i]);
}
- radeon_state_pm4(rstate);
}
-static void r600_cb(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state, int cb)
-{
- struct r600_screen *rscreen = rctx->screen;
- struct r600_resource_texture *rtex;
- struct r600_resource *rbuffer;
- unsigned level = state->cbufs[cb]->level;
- unsigned pitch, slice;
- unsigned color_info;
- unsigned format, swap, ntype;
- const struct util_format_description *desc;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB0 + cb, 0, 0);
- rtex = (struct r600_resource_texture*)state->cbufs[cb]->texture;
- rbuffer = &rtex->resource;
- rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- rstate->bo[2] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[4] = RADEON_GEM_DOMAIN_GTT;
- rstate->nbo = 3;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->cbufs[cb]->height / 64 - 1;
-
- ntype = 0;
- desc = util_format_description(rtex->resource.base.b.format);
- if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB)
- ntype = V_0280A0_NUMBER_SRGB;
-
- format = r600_translate_colorformat(rtex->resource.base.b.format);
- swap = r600_translate_colorswap(rtex->resource.base.b.format);
-
- color_info = S_0280A0_FORMAT(format) |
- S_0280A0_COMP_SWAP(swap) |
- S_0280A0_BLEND_CLAMP(1) |
- S_0280A0_SOURCE_FORMAT(1) |
- S_0280A0_NUMBER_TYPE(ntype);
-
- rstate->states[R600_CB0__CB_COLOR0_BASE] = state->cbufs[cb]->offset >> 8;
- rstate->states[R600_CB0__CB_COLOR0_INFO] = color_info;
- rstate->states[R600_CB0__CB_COLOR0_SIZE] = S_028060_PITCH_TILE_MAX(pitch) |
- S_028060_SLICE_TILE_MAX(slice);
- rstate->states[R600_CB0__CB_COLOR0_VIEW] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_FRAG] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_TILE] = 0x00000000;
- rstate->states[R600_CB0__CB_COLOR0_MASK] = 0x00000000;
- radeon_state_pm4(rstate);
-}
-static void r600_db(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_framebuffer_state *state)
+static int setup_cb_flush(struct r600_context *rctx, struct radeon_state *flush)
{
struct r600_screen *rscreen = rctx->screen;
struct r600_resource_texture *rtex;
struct r600_resource *rbuffer;
- unsigned level;
- unsigned pitch, slice, format;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DB, 0, 0);
- if (state->zsbuf == NULL)
- return;
-
- rtex = (struct r600_resource_texture*)state->zsbuf->texture;
- rtex->tilled = 1;
- rtex->array_mode = 2;
- rtex->tile_type = 1;
- rtex->depth = 1;
- rbuffer = &rtex->resource;
-
- rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- rstate->nbo = 1;
- rstate->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- level = state->zsbuf->level;
- pitch = (rtex->pitch[level] / rtex->bpt) / 8 - 1;
- slice = (rtex->pitch[level] / rtex->bpt) * state->zsbuf->height / 64 - 1;
- format = r600_translate_dbformat(state->zsbuf->texture->format);
- rstate->states[R600_DB__DB_DEPTH_BASE] = state->zsbuf->offset >> 8;
- rstate->states[R600_DB__DB_DEPTH_INFO] = S_028010_ARRAY_MODE(rtex->array_mode) |
- S_028010_FORMAT(format);
- rstate->states[R600_DB__DB_DEPTH_VIEW] = 0x00000000;
- rstate->states[R600_DB__DB_PREFETCH_LIMIT] = (state->zsbuf->height / 8) -1;
- rstate->states[R600_DB__DB_DEPTH_SIZE] = S_028000_PITCH_TILE_MAX(pitch) |
- S_028000_SLICE_TILE_MAX(slice);
- radeon_state_pm4(rstate);
-}
-
-static void r600_rasterizer(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_rasterizer_state *state = &rctx->rasterizer->state.rasterizer;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- const struct pipe_clip_state *clip = NULL;
- struct r600_screen *rscreen = rctx->screen;
- float offset_units = 0, offset_scale = 0;
- char depth = 0;
- unsigned offset_db_fmt_cntl = 0;
- unsigned tmp;
- unsigned prov_vtx = 1;
-
- if (rctx->clip)
- clip = &rctx->clip->state.clip;
- if (fb->zsbuf) {
- offset_units = state->offset_units;
- offset_scale = state->offset_scale * 12.0f;
- switch (fb->zsbuf->texture->format) {
- case PIPE_FORMAT_Z24X8_UNORM:
- case PIPE_FORMAT_Z24_UNORM_S8_USCALED:
- depth = -24;
- offset_units *= 2.0f;
- break;
- case PIPE_FORMAT_Z32_FLOAT:
- depth = -23;
- offset_units *= 1.0f;
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_DB_IS_FLOAT_FMT(1);
- break;
- case PIPE_FORMAT_Z16_UNORM:
- depth = -16;
- offset_units *= 4.0f;
- break;
- default:
- R600_ERR("unsupported %d\n", fb->zsbuf->texture->format);
- return;
- }
- }
- offset_db_fmt_cntl |= S_028DF8_POLY_OFFSET_NEG_NUM_DB_BITS(depth);
-
- if (state->flatshade_first)
- prov_vtx = 0;
-
- rctx->flat_shade = state->flatshade;
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RASTERIZER, 0, 0);
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] = 0x00000001;
- if (state->sprite_coord_enable) {
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_ENA(1) |
- S_0286D4_PNT_SPRITE_OVRD_X(2) |
- S_0286D4_PNT_SPRITE_OVRD_Y(3) |
- S_0286D4_PNT_SPRITE_OVRD_Z(0) |
- S_0286D4_PNT_SPRITE_OVRD_W(1);
- if (state->sprite_coord_mode != PIPE_SPRITE_COORD_UPPER_LEFT) {
- rstate->states[R600_RASTERIZER__SPI_INTERP_CONTROL_0] |=
- S_0286D4_PNT_SPRITE_TOP_1(1);
- }
- }
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = 0;
- if (clip) {
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] = S_028810_PS_UCP_MODE(3) | ((1 << clip->nr) - 1);
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_NEAR_DISABLE(clip->depth_clamp);
- rstate->states[R600_RASTERIZER__PA_CL_CLIP_CNTL] |= S_028810_ZCLIP_FAR_DISABLE(clip->depth_clamp);
- }
- rstate->states[R600_RASTERIZER__PA_SU_SC_MODE_CNTL] =
- S_028814_PROVOKING_VTX_LAST(prov_vtx) |
- S_028814_CULL_FRONT((state->cull_face & PIPE_FACE_FRONT) ? 1 : 0) |
- S_028814_CULL_BACK((state->cull_face & PIPE_FACE_BACK) ? 1 : 0) |
- S_028814_FACE(!state->front_ccw) |
- S_028814_POLY_OFFSET_FRONT_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_BACK_ENABLE(state->offset_tri) |
- S_028814_POLY_OFFSET_PARA_ENABLE(state->offset_tri);
- rstate->states[R600_RASTERIZER__PA_CL_VS_OUT_CNTL] =
- S_02881C_USE_VTX_POINT_SIZE(state->point_size_per_vertex) |
- S_02881C_VS_OUT_MISC_VEC_ENA(state->point_size_per_vertex);
- rstate->states[R600_RASTERIZER__PA_CL_NANINF_CNTL] = 0x00000000;
- /* point size 12.4 fixed point */
- tmp = (unsigned)(state->point_size * 8.0);
- rstate->states[R600_RASTERIZER__PA_SU_POINT_SIZE] = S_028A00_HEIGHT(tmp) | S_028A00_WIDTH(tmp);
- rstate->states[R600_RASTERIZER__PA_SU_POINT_MINMAX] = 0x80000000;
- rstate->states[R600_RASTERIZER__PA_SU_LINE_CNTL] = 0x00000008;
- rstate->states[R600_RASTERIZER__PA_SC_LINE_STIPPLE] = 0x00000005;
- rstate->states[R600_RASTERIZER__PA_SC_MPASS_PS_CNTL] = 0x00000000;
- rstate->states[R600_RASTERIZER__PA_SC_LINE_CNTL] = 0x00000400;
- rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ] = 0x3F800000;
- rstate->states[R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ] = 0x3F800000;
- rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ] = 0x3F800000;
- rstate->states[R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ] = 0x3F800000;
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL] = offset_db_fmt_cntl;
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP] = 0x00000000;
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE] = fui(offset_scale);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET] = fui(offset_units);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE] = fui(offset_scale);
- rstate->states[R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET] = fui(offset_units);
- radeon_state_pm4(rstate);
-}
-
-static void r600_scissor(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_scissor_state *state = &rctx->scissor->state.scissor;
- const struct pipe_framebuffer_state *fb = &rctx->framebuffer->state.framebuffer;
- struct r600_screen *rscreen = rctx->screen;
- unsigned minx, maxx, miny, maxy;
- u32 tl, br;
-
- if (state == NULL) {
- minx = 0;
- miny = 0;
- maxx = fb->cbufs[0]->width;
- maxy = fb->cbufs[0]->height;
- } else {
- minx = state->minx;
- miny = state->miny;
- maxx = state->maxx;
- maxy = state->maxy;
- }
- tl = S_028240_TL_X(minx) | S_028240_TL_Y(miny) | S_028240_WINDOW_OFFSET_DISABLE(1);
- br = S_028244_BR_X(maxx) | S_028244_BR_Y(maxy);
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SCISSOR, 0, 0);
- rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_OFFSET] = 0x00000000;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_RULE] = 0x0000FFFF;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_0_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_1_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_2_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_CLIPRECT_3_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_EDGERULE] = 0xAAAAAAAA;
- rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR] = br;
- rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL] = tl;
- rstate->states[R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR] = br;
- radeon_state_pm4(rstate);
-}
-
-static void r600_viewport(struct r600_context *rctx, struct radeon_state *rstate, const struct pipe_viewport_state *state)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_VIEWPORT, 0, 0);
- rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMIN_0] = 0x00000000;
- rstate->states[R600_VIEWPORT__PA_SC_VPORT_ZMAX_0] = 0x3F800000;
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_XSCALE_0] = fui(state->scale[0]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_YSCALE_0] = fui(state->scale[1]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0] = fui(state->scale[2]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0] = fui(state->translate[0]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0] = fui(state->translate[1]);
- rstate->states[R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0] = fui(state->translate[2]);
- rstate->states[R600_VIEWPORT__PA_CL_VTE_CNTL] = 0x0000043F;
- radeon_state_pm4(rstate);
-}
-
-static void r600_dsa(struct r600_context *rctx, struct radeon_state *rstate)
-{
- const struct pipe_depth_stencil_alpha_state *state = &rctx->dsa->state.dsa;
- const struct pipe_stencil_ref *stencil_ref = &rctx->stencil_ref->state.stencil_ref;
- struct r600_screen *rscreen = rctx->screen;
- unsigned db_depth_control, alpha_test_control, alpha_ref, db_shader_control;
- unsigned stencil_ref_mask, stencil_ref_mask_bf;
- struct r600_shader *rshader;
+ struct pipe_surface *surf;
int i;
- if (rctx->ps_shader == NULL) {
- return;
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_DSA, 0, 0);
-
- db_shader_control = 0x210;
- rshader = &rctx->ps_shader->shader;
- if (rshader->uses_kill)
- db_shader_control |= (1 << 6);
- for (i = 0; i < rshader->noutput; i++) {
- if (rshader->output[i].name == TGSI_SEMANTIC_POSITION)
- db_shader_control |= 1;
- }
- stencil_ref_mask = 0;
- stencil_ref_mask_bf = 0;
- db_depth_control = S_028800_Z_ENABLE(state->depth.enabled) |
- S_028800_Z_WRITE_ENABLE(state->depth.writemask) |
- S_028800_ZFUNC(state->depth.func);
- /* set stencil enable */
-
- if (state->stencil[0].enabled) {
- db_depth_control |= S_028800_STENCIL_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC(r600_translate_ds_func(state->stencil[0].func));
- db_depth_control |= S_028800_STENCILFAIL(r600_translate_stencil_op(state->stencil[0].fail_op));
- db_depth_control |= S_028800_STENCILZPASS(r600_translate_stencil_op(state->stencil[0].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL(r600_translate_stencil_op(state->stencil[0].zfail_op));
-
- stencil_ref_mask = S_028430_STENCILMASK(state->stencil[0].valuemask) |
- S_028430_STENCILWRITEMASK(state->stencil[0].writemask);
- stencil_ref_mask |= S_028430_STENCILREF(stencil_ref->ref_value[0]);
- if (state->stencil[1].enabled) {
- db_depth_control |= S_028800_BACKFACE_ENABLE(1);
- db_depth_control |= S_028800_STENCILFUNC_BF(r600_translate_ds_func(state->stencil[1].func));
- db_depth_control |= S_028800_STENCILFAIL_BF(r600_translate_stencil_op(state->stencil[1].fail_op));
- db_depth_control |= S_028800_STENCILZPASS_BF(r600_translate_stencil_op(state->stencil[1].zpass_op));
- db_depth_control |= S_028800_STENCILZFAIL_BF(r600_translate_stencil_op(state->stencil[1].zfail_op));
- stencil_ref_mask_bf = S_028434_STENCILMASK_BF(state->stencil[1].valuemask) |
- S_028434_STENCILWRITEMASK_BF(state->stencil[1].writemask);
- stencil_ref_mask_bf |= S_028430_STENCILREF(stencil_ref->ref_value[1]);
- }
- }
-
- alpha_test_control = 0;
- alpha_ref = 0;
- if (state->alpha.enabled) {
- alpha_test_control = S_028410_ALPHA_FUNC(state->alpha.func);
- alpha_test_control |= S_028410_ALPHA_TEST_ENABLE(1);
- alpha_ref = fui(state->alpha.ref_value);
- }
-
- rstate->states[R600_DSA__DB_STENCIL_CLEAR] = 0x00000000;
- rstate->states[R600_DSA__DB_DEPTH_CLEAR] = 0x3F800000;
- rstate->states[R600_DSA__SX_ALPHA_TEST_CONTROL] = alpha_test_control;
- rstate->states[R600_DSA__DB_STENCILREFMASK] = stencil_ref_mask;
- rstate->states[R600_DSA__DB_STENCILREFMASK_BF] = stencil_ref_mask_bf;
- rstate->states[R600_DSA__SX_ALPHA_REF] = alpha_ref;
- rstate->states[R600_DSA__SPI_FOG_FUNC_SCALE] = 0x00000000;
- rstate->states[R600_DSA__SPI_FOG_FUNC_BIAS] = 0x00000000;
- rstate->states[R600_DSA__SPI_FOG_CNTL] = 0x00000000;
- rstate->states[R600_DSA__DB_DEPTH_CONTROL] = db_depth_control;
- rstate->states[R600_DSA__DB_SHADER_CONTROL] = db_shader_control;
- rstate->states[R600_DSA__DB_RENDER_CONTROL] = 0x00000060;
- rstate->states[R600_DSA__DB_RENDER_OVERRIDE] = 0x0000002A;
- rstate->states[R600_DSA__DB_SRESULTS_COMPARE_STATE1] = 0x00000000;
- rstate->states[R600_DSA__DB_PRELOAD_CONTROL] = 0x00000000;
- rstate->states[R600_DSA__DB_ALPHA_TO_MASK] = 0x0000AA00;
- radeon_state_pm4(rstate);
-}
-
-static inline unsigned r600_tex_wrap(unsigned wrap)
-{
- switch (wrap) {
- default:
- case PIPE_TEX_WRAP_REPEAT:
- return V_03C000_SQ_TEX_WRAP;
- case PIPE_TEX_WRAP_CLAMP:
- return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL;
- case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
- return V_03C000_SQ_TEX_CLAMP_HALF_BORDER;
- case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
- return V_03C000_SQ_TEX_CLAMP_BORDER;
- case PIPE_TEX_WRAP_MIRROR_REPEAT:
- return V_03C000_SQ_TEX_MIRROR;
- case PIPE_TEX_WRAP_MIRROR_CLAMP:
- return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
- return V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER;
- case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
- return V_03C000_SQ_TEX_MIRROR_ONCE_BORDER;
- }
-}
-
-static inline unsigned r600_tex_filter(unsigned filter)
-{
- switch (filter) {
- default:
- case PIPE_TEX_FILTER_NEAREST:
- return V_03C000_SQ_TEX_XY_FILTER_POINT;
- case PIPE_TEX_FILTER_LINEAR:
- return V_03C000_SQ_TEX_XY_FILTER_BILINEAR;
- }
-}
-
-static inline unsigned r600_tex_mipfilter(unsigned filter)
-{
- switch (filter) {
- case PIPE_TEX_MIPFILTER_NEAREST:
- return V_03C000_SQ_TEX_Z_FILTER_POINT;
- case PIPE_TEX_MIPFILTER_LINEAR:
- return V_03C000_SQ_TEX_Z_FILTER_LINEAR;
- default:
- case PIPE_TEX_MIPFILTER_NONE:
- return V_03C000_SQ_TEX_Z_FILTER_NONE;
- }
-}
-
-static inline unsigned r600_tex_compare(unsigned compare)
-{
- switch (compare) {
- default:
- case PIPE_FUNC_NEVER:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_NEVER;
- case PIPE_FUNC_LESS:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_LESS;
- case PIPE_FUNC_EQUAL:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_EQUAL;
- case PIPE_FUNC_LEQUAL:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_LESSEQUAL;
- case PIPE_FUNC_GREATER:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATER;
- case PIPE_FUNC_NOTEQUAL:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_NOTEQUAL;
- case PIPE_FUNC_GEQUAL:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATEREQUAL;
- case PIPE_FUNC_ALWAYS:
- return V_03C000_SQ_TEX_DEPTH_COMPARE_ALWAYS;
- }
-}
-
-static INLINE u32 S_FIXED(float value, u32 frac_bits)
-{
- return value * (1 << frac_bits);
-}
-
-static void r600_sampler(struct r600_context *rctx, struct radeon_state *rstate,
- const struct pipe_sampler_state *state, unsigned id)
-{
- struct r600_screen *rscreen = rctx->screen;
-
- radeon_state_init(rstate, rscreen->rw, R600_STATE_SAMPLER, id, R600_SHADER_PS);
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0] =
- S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) |
- S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) |
- S_03C000_CLAMP_Z(r600_tex_wrap(state->wrap_r)) |
- S_03C000_XY_MAG_FILTER(r600_tex_filter(state->mag_img_filter)) |
- S_03C000_XY_MIN_FILTER(r600_tex_filter(state->min_img_filter)) |
- S_03C000_MIP_FILTER(r600_tex_mipfilter(state->min_mip_filter)) |
- S_03C000_DEPTH_COMPARE_FUNCTION(r600_tex_compare(state->compare_func));
- /* FIXME LOD it depends on texture base level ... */
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0] =
- S_03C004_MIN_LOD(S_FIXED(CLAMP(state->min_lod, 0, 15), 6)) |
- S_03C004_MAX_LOD(S_FIXED(CLAMP(state->max_lod, 0, 15), 6)) |
- S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6));
- rstate->states[R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0] = S_03C008_TYPE(1);
- radeon_state_pm4(rstate);
-}
-
-static inline unsigned r600_tex_swizzle(unsigned swizzle)
-{
- switch (swizzle) {
- case PIPE_SWIZZLE_RED:
- return V_038010_SQ_SEL_X;
- case PIPE_SWIZZLE_GREEN:
- return V_038010_SQ_SEL_Y;
- case PIPE_SWIZZLE_BLUE:
- return V_038010_SQ_SEL_Z;
- case PIPE_SWIZZLE_ALPHA:
- return V_038010_SQ_SEL_W;
- case PIPE_SWIZZLE_ZERO:
- return V_038010_SQ_SEL_0;
- default:
- case PIPE_SWIZZLE_ONE:
- return V_038010_SQ_SEL_1;
- }
-}
-
-static inline unsigned r600_format_type(unsigned format_type)
-{
- switch (format_type) {
- default:
- case UTIL_FORMAT_TYPE_UNSIGNED:
- return V_038010_SQ_FORMAT_COMP_UNSIGNED;
- case UTIL_FORMAT_TYPE_SIGNED:
- return V_038010_SQ_FORMAT_COMP_SIGNED;
- case UTIL_FORMAT_TYPE_FIXED:
- return V_038010_SQ_FORMAT_COMP_UNSIGNED_BIASED;
- }
-}
+ radeon_state_init(flush, rscreen->rw, R600_STATE_CB_FLUSH, 0, 0);
-static inline unsigned r600_tex_dim(unsigned dim)
-{
- switch (dim) {
- default:
- case PIPE_TEXTURE_1D:
- return V_038000_SQ_TEX_DIM_1D;
- case PIPE_TEXTURE_2D:
- case PIPE_TEXTURE_RECT:
- return V_038000_SQ_TEX_DIM_2D;
- case PIPE_TEXTURE_3D:
- return V_038000_SQ_TEX_DIM_3D;
- case PIPE_TEXTURE_CUBE:
- return V_038000_SQ_TEX_DIM_CUBEMAP;
+ for (i = 0; i < rctx->framebuffer->state.framebuffer.nr_cbufs; i++) {
+ surf = rctx->framebuffer->state.framebuffer.cbufs[i];
+
+ rtex = (struct r600_resource_texture*)surf->texture;
+ rbuffer = &rtex->resource;
+ /* just need to the bo to the flush list */
+ flush->bo[i] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ flush->placement[i] = RADEON_GEM_DOMAIN_VRAM;
}
+ flush->nbo = rctx->framebuffer->state.framebuffer.nr_cbufs;
+ return radeon_state_pm4(flush);
}
-static void r600_resource(struct pipe_context *ctx, struct radeon_state *rstate,
- const struct pipe_sampler_view *view, unsigned id)
+static int setup_db_flush(struct r600_context *rctx, struct radeon_state *flush)
{
- struct r600_context *rctx = r600_context(ctx);
struct r600_screen *rscreen = rctx->screen;
- const struct util_format_description *desc;
- struct r600_resource_texture *tmp;
+ struct r600_resource_texture *rtex;
struct r600_resource *rbuffer;
- unsigned format;
- uint32_t word4 = 0, yuv_format = 0, pitch = 0;
- unsigned char swizzle[4], array_mode = 0, tile_type = 0;
- int r;
-
- rstate->cpm4 = 0;
- swizzle[0] = view->swizzle_r;
- swizzle[1] = view->swizzle_g;
- swizzle[2] = view->swizzle_b;
- swizzle[3] = view->swizzle_a;
- format = r600_translate_texformat(view->texture->format,
- swizzle,
- &word4, &yuv_format);
- if (format == ~0) {
- return;
- }
- desc = util_format_description(view->texture->format);
- if (desc == NULL) {
- R600_ERR("unknow format %d\n", view->texture->format);
- return;
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_RESOURCE, id, R600_SHADER_PS);
- tmp = (struct r600_resource_texture*)view->texture;
- rbuffer = &tmp->resource;
- if (tmp->depth) {
- r = r600_texture_from_depth(ctx, tmp, view->first_level);
- if (r) {
- return;
- }
- rstate->bo[0] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
- rstate->bo[1] = radeon_bo_incref(rscreen->rw, tmp->uncompressed);
- } else {
- rstate->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- rstate->bo[1] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
- }
- rstate->nbo = 2;
- rstate->placement[0] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[1] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[2] = RADEON_GEM_DOMAIN_GTT;
- rstate->placement[3] = RADEON_GEM_DOMAIN_GTT;
-
- pitch = (tmp->pitch[0] / tmp->bpt);
- pitch = (pitch + 0x7) & ~0x7;
-
- /* FIXME properly handle first level != 0 */
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD0] =
- S_038000_DIM(r600_tex_dim(view->texture->target)) |
- S_038000_TILE_MODE(array_mode) |
- S_038000_TILE_TYPE(tile_type) |
- S_038000_PITCH((pitch / 8) - 1) |
- S_038000_TEX_WIDTH(view->texture->width0 - 1);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD1] =
- S_038004_TEX_HEIGHT(view->texture->height0 - 1) |
- S_038004_TEX_DEPTH(view->texture->depth0 - 1) |
- S_038004_DATA_FORMAT(format);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD2] = tmp->offset[0] >> 8;
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD3] = tmp->offset[1] >> 8;
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD4] =
- word4 |
- S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_NORM) |
- S_038010_SRF_MODE_ALL(V_038010_SFR_MODE_NO_ZERO) |
- S_038010_REQUEST_SIZE(1) |
- S_038010_BASE_LEVEL(view->first_level);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD5] =
- S_038014_LAST_LEVEL(view->last_level) |
- S_038014_BASE_ARRAY(0) |
- S_038014_LAST_ARRAY(0);
- rstate->states[R600_PS_RESOURCE__RESOURCE0_WORD6] =
- S_038018_TYPE(V_038010_SQ_TEX_VTX_VALID_TEXTURE);
- radeon_state_pm4(rstate);
-}
+ struct pipe_surface *surf;
-static void r600_cb_cntl(struct r600_context *rctx, struct radeon_state *rstate)
-{
- struct r600_screen *rscreen = rctx->screen;
- const struct pipe_blend_state *pbs = &rctx->blend->state.blend;
- int nr_cbufs = rctx->framebuffer->state.framebuffer.nr_cbufs;
- uint32_t color_control, target_mask, shader_mask;
- int i;
-
- target_mask = 0;
- shader_mask = 0;
- color_control = S_028808_PER_MRT_BLEND(1);
-
- for (i = 0; i < nr_cbufs; i++) {
- shader_mask |= 0xf << (i * 4);
- }
+ surf = rctx->framebuffer->state.framebuffer.zsbuf;
- if (pbs->logicop_enable) {
- color_control |= (pbs->logicop_func << 16) | (pbs->logicop_func << 20);
- } else {
- color_control |= (0xcc << 16);
- }
+ if (!surf)
+ return 0;
+
+ radeon_state_init(flush, rscreen->rw, R600_STATE_DB_FLUSH, 0, 0);
+ rtex = (struct r600_resource_texture*)surf->texture;
+ rbuffer = &rtex->resource;
+ /* just need to the bo to the flush list */
+ flush->bo[0] = radeon_bo_incref(rscreen->rw, rbuffer->bo);
+ flush->placement[0] = RADEON_GEM_DOMAIN_VRAM;
- if (pbs->independent_blend_enable) {
- for (i = 0; i < nr_cbufs; i++) {
- if (pbs->rt[i].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (pbs->rt[i].colormask << (4 * i));
- }
- } else {
- for (i = 0; i < nr_cbufs; i++) {
- if (pbs->rt[0].blend_enable) {
- color_control |= S_028808_TARGET_BLEND_ENABLE(1 << i);
- }
- target_mask |= (pbs->rt[0].colormask << (4 * i));
- }
- }
- radeon_state_init(rstate, rscreen->rw, R600_STATE_CB_CNTL, 0, 0);
- rstate->states[R600_CB_CNTL__CB_SHADER_MASK] = shader_mask;
- rstate->states[R600_CB_CNTL__CB_TARGET_MASK] = target_mask;
- rstate->states[R600_CB_CNTL__CB_COLOR_CONTROL] = color_control;
- rstate->states[R600_CB_CNTL__PA_SC_AA_CONFIG] = 0x00000000;
- rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX] = 0x00000000;
- rstate->states[R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX] = 0x00000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_CONTROL] = 0x01000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_SRC] = 0x00000000;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_DST] = 0x000000FF;
- rstate->states[R600_CB_CNTL__CB_CLRCMP_MSK] = 0xFFFFFFFF;
- rstate->states[R600_CB_CNTL__PA_SC_AA_MASK] = 0xFFFFFFFF;
- radeon_state_pm4(rstate);
+ flush->nbo = 1;
+ return radeon_state_pm4(flush);
}
int r600_context_hw_states(struct pipe_context *ctx)
{
struct r600_context *rctx = r600_context(ctx);
unsigned i;
-
+
/* build new states */
- r600_rasterizer(rctx, &rctx->hw_states.rasterizer);
- r600_scissor(rctx, &rctx->hw_states.scissor);
- r600_dsa(rctx, &rctx->hw_states.dsa);
- r600_cb_cntl(rctx, &rctx->hw_states.cb_cntl);
+ rctx->vtbl->rasterizer(rctx, &rctx->hw_states.rasterizer);
+ rctx->vtbl->scissor(rctx, &rctx->hw_states.scissor);
+ rctx->vtbl->dsa(rctx, &rctx->hw_states.dsa);
+ rctx->vtbl->cb_cntl(rctx, &rctx->hw_states.cb_cntl);
+
+ /* setup flushes */
+ setup_db_flush(rctx, &rctx->hw_states.db_flush);
+ setup_cb_flush(rctx, &rctx->hw_states.cb_flush);
/* bind states */
+ radeon_draw_bind(&rctx->draw, &rctx->config);
+
radeon_draw_bind(&rctx->draw, &rctx->hw_states.rasterizer);
radeon_draw_bind(&rctx->draw, &rctx->hw_states.scissor);
radeon_draw_bind(&rctx->draw, &rctx->hw_states.dsa);
radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_cntl);
- radeon_draw_bind(&rctx->draw, &rctx->config);
+ radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush);
+ radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush);
+
+ radeon_draw_bind(&rctx->draw, &rctx->hw_states.db_flush);
+ radeon_draw_bind(&rctx->draw, &rctx->hw_states.cb_flush);
if (rctx->viewport) {
radeon_draw_bind(&rctx->draw, &rctx->viewport->rstate[0]);
@@ -1388,15 +687,9 @@ int r600_context_hw_states(struct pipe_context *ctx)
if (rctx->framebuffer->state.framebuffer.zsbuf) {
radeon_draw_bind(&rctx->draw, &rctx->framebuffer->rstate[0]);
}
- for (i = 0; i < rctx->ps_nsampler; i++) {
- if (rctx->ps_sampler[i]) {
- radeon_draw_bind(&rctx->draw, rctx->ps_sampler[i]);
- }
- }
- for (i = 0; i < rctx->ps_nsampler_view; i++) {
- if (rctx->ps_sampler_view[i]) {
- radeon_draw_bind(&rctx->draw, rctx->ps_sampler_view[i]);
- }
- }
+
+ r600_bind_shader_sampler(rctx, &rctx->vs_sampler);
+ r600_bind_shader_sampler(rctx, &rctx->ps_sampler);
+
return 0;
}
diff --git a/src/gallium/drivers/r600/r600_state_inlines.h b/src/gallium/drivers/r600/r600_state_inlines.h
index 84866825aa..b4c21d9e12 100644
--- a/src/gallium/drivers/r600/r600_state_inlines.h
+++ b/src/gallium/drivers/r600/r600_state_inlines.h
@@ -129,7 +129,125 @@ static INLINE uint32_t r600_translate_ds_func(int func)
return func;
}
-static uint32_t r600_translate_dbformat(enum pipe_format format)
+static inline unsigned r600_tex_wrap(unsigned wrap)
+{
+ switch (wrap) {
+ default:
+ case PIPE_TEX_WRAP_REPEAT:
+ return V_03C000_SQ_TEX_WRAP;
+ case PIPE_TEX_WRAP_CLAMP:
+ return V_03C000_SQ_TEX_CLAMP_LAST_TEXEL;
+ case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
+ return V_03C000_SQ_TEX_CLAMP_HALF_BORDER;
+ case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
+ return V_03C000_SQ_TEX_CLAMP_BORDER;
+ case PIPE_TEX_WRAP_MIRROR_REPEAT:
+ return V_03C000_SQ_TEX_MIRROR;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_LAST_TEXEL;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_HALF_BORDER;
+ case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
+ return V_03C000_SQ_TEX_MIRROR_ONCE_BORDER;
+ }
+}
+
+static inline unsigned r600_tex_filter(unsigned filter)
+{
+ switch (filter) {
+ default:
+ case PIPE_TEX_FILTER_NEAREST:
+ return V_03C000_SQ_TEX_XY_FILTER_POINT;
+ case PIPE_TEX_FILTER_LINEAR:
+ return V_03C000_SQ_TEX_XY_FILTER_BILINEAR;
+ }
+}
+
+static inline unsigned r600_tex_mipfilter(unsigned filter)
+{
+ switch (filter) {
+ case PIPE_TEX_MIPFILTER_NEAREST:
+ return V_03C000_SQ_TEX_Z_FILTER_POINT;
+ case PIPE_TEX_MIPFILTER_LINEAR:
+ return V_03C000_SQ_TEX_Z_FILTER_LINEAR;
+ default:
+ case PIPE_TEX_MIPFILTER_NONE:
+ return V_03C000_SQ_TEX_Z_FILTER_NONE;
+ }
+}
+
+static inline unsigned r600_tex_compare(unsigned compare)
+{
+ switch (compare) {
+ default:
+ case PIPE_FUNC_NEVER:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_NEVER;
+ case PIPE_FUNC_LESS:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_LESS;
+ case PIPE_FUNC_EQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_EQUAL;
+ case PIPE_FUNC_LEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_LESSEQUAL;
+ case PIPE_FUNC_GREATER:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATER;
+ case PIPE_FUNC_NOTEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_NOTEQUAL;
+ case PIPE_FUNC_GEQUAL:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_GREATEREQUAL;
+ case PIPE_FUNC_ALWAYS:
+ return V_03C000_SQ_TEX_DEPTH_COMPARE_ALWAYS;
+ }
+}
+
+static inline unsigned r600_tex_swizzle(unsigned swizzle)
+{
+ switch (swizzle) {
+ case PIPE_SWIZZLE_RED:
+ return V_038010_SQ_SEL_X;
+ case PIPE_SWIZZLE_GREEN:
+ return V_038010_SQ_SEL_Y;
+ case PIPE_SWIZZLE_BLUE:
+ return V_038010_SQ_SEL_Z;
+ case PIPE_SWIZZLE_ALPHA:
+ return V_038010_SQ_SEL_W;
+ case PIPE_SWIZZLE_ZERO:
+ return V_038010_SQ_SEL_0;
+ default:
+ case PIPE_SWIZZLE_ONE:
+ return V_038010_SQ_SEL_1;
+ }
+}
+
+static inline unsigned r600_format_type(unsigned format_type)
+{
+ switch (format_type) {
+ default:
+ case UTIL_FORMAT_TYPE_UNSIGNED:
+ return V_038010_SQ_FORMAT_COMP_UNSIGNED;
+ case UTIL_FORMAT_TYPE_SIGNED:
+ return V_038010_SQ_FORMAT_COMP_SIGNED;
+ case UTIL_FORMAT_TYPE_FIXED:
+ return V_038010_SQ_FORMAT_COMP_UNSIGNED_BIASED;
+ }
+}
+
+static inline unsigned r600_tex_dim(unsigned dim)
+{
+ switch (dim) {
+ default:
+ case PIPE_TEXTURE_1D:
+ return V_038000_SQ_TEX_DIM_1D;
+ case PIPE_TEXTURE_2D:
+ case PIPE_TEXTURE_RECT:
+ return V_038000_SQ_TEX_DIM_2D;
+ case PIPE_TEXTURE_3D:
+ return V_038000_SQ_TEX_DIM_3D;
+ case PIPE_TEXTURE_CUBE:
+ return V_038000_SQ_TEX_DIM_CUBEMAP;
+ }
+}
+
+static inline uint32_t r600_translate_dbformat(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_Z16_UNORM:
@@ -143,7 +261,7 @@ static uint32_t r600_translate_dbformat(enum pipe_format format)
}
}
-static uint32_t r600_translate_colorswap(enum pipe_format format)
+static inline uint32_t r600_translate_colorswap(enum pipe_format format)
{
switch (format) {
/* 8-bit buffers. */
diff --git a/src/gallium/drivers/r600/r600_states_inc.h b/src/gallium/drivers/r600/r600_states_inc.h
new file mode 100644
index 0000000000..de717f3536
--- /dev/null
+++ b/src/gallium/drivers/r600/r600_states_inc.h
@@ -0,0 +1,543 @@
+/* This file is autogenerated from r600_states.h - do not edit directly */
+/* autogenerating script is gen_r600_states.py */
+
+/* R600_CONFIG */
+#define R600_CONFIG__SQ_CONFIG 0
+#define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1
+#define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2 2
+#define R600_CONFIG__SQ_THREAD_RESOURCE_MGMT 3
+#define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1 4
+#define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2 5
+#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 6
+#define R600_CONFIG__TA_CNTL_AUX 7
+#define R600_CONFIG__VC_ENHANCE 8
+#define R600_CONFIG__DB_DEBUG 9
+#define R600_CONFIG__DB_WATERMARKS 10
+#define R600_CONFIG__SX_MISC 11
+#define R600_CONFIG__SPI_THREAD_GROUPING 12
+#define R600_CONFIG__CB_SHADER_CONTROL 13
+#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 14
+#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 15
+#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 16
+#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 17
+#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 18
+#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 19
+#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 20
+#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 21
+#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 22
+#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 23
+#define R600_CONFIG__VGT_HOS_CNTL 24
+#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 25
+#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 26
+#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 27
+#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 28
+#define R600_CONFIG__VGT_GROUP_FIRST_DECR 29
+#define R600_CONFIG__VGT_GROUP_DECR 30
+#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 31
+#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 32
+#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 33
+#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 34
+#define R600_CONFIG__VGT_GS_MODE 35
+#define R600_CONFIG__PA_SC_MODE_CNTL 36
+#define R600_CONFIG__VGT_STRMOUT_EN 37
+#define R600_CONFIG__VGT_REUSE_OFF 38
+#define R600_CONFIG__VGT_VTX_CNT_EN 39
+#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 40
+#define R600_CONFIG_SIZE 41
+#define R600_CONFIG_PM4 128
+
+/* R600_CB_CNTL */
+#define R600_CB_CNTL__CB_CLEAR_RED 0
+#define R600_CB_CNTL__CB_CLEAR_GREEN 1
+#define R600_CB_CNTL__CB_CLEAR_BLUE 2
+#define R600_CB_CNTL__CB_CLEAR_ALPHA 3
+#define R600_CB_CNTL__CB_SHADER_MASK 4
+#define R600_CB_CNTL__CB_TARGET_MASK 5
+#define R600_CB_CNTL__CB_FOG_RED 6
+#define R600_CB_CNTL__CB_FOG_GREEN 7
+#define R600_CB_CNTL__CB_FOG_BLUE 8
+#define R600_CB_CNTL__CB_COLOR_CONTROL 9
+#define R600_CB_CNTL__PA_SC_AA_CONFIG 10
+#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 11
+#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 12
+#define R600_CB_CNTL__CB_CLRCMP_CONTROL 13
+#define R600_CB_CNTL__CB_CLRCMP_SRC 14
+#define R600_CB_CNTL__CB_CLRCMP_DST 15
+#define R600_CB_CNTL__CB_CLRCMP_MSK 16
+#define R600_CB_CNTL__PA_SC_AA_MASK 17
+#define R600_CB_CNTL_SIZE 18
+#define R600_CB_CNTL_PM4 128
+
+/* R600_RASTERIZER */
+#define R600_RASTERIZER__SPI_INTERP_CONTROL_0 0
+#define R600_RASTERIZER__PA_CL_CLIP_CNTL 1
+#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 2
+#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 3
+#define R600_RASTERIZER__PA_CL_NANINF_CNTL 4
+#define R600_RASTERIZER__PA_SU_POINT_SIZE 5
+#define R600_RASTERIZER__PA_SU_POINT_MINMAX 6
+#define R600_RASTERIZER__PA_SU_LINE_CNTL 7
+#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 8
+#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 9
+#define R600_RASTERIZER__PA_SC_LINE_CNTL 10
+#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 11
+#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 12
+#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 13
+#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 14
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 15
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 16
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 17
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 18
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 19
+#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 20
+#define R600_RASTERIZER_SIZE 21
+#define R600_RASTERIZER_PM4 128
+
+/* R600_VIEWPORT */
+#define R600_VIEWPORT__PA_SC_VPORT_ZMIN_0 0
+#define R600_VIEWPORT__PA_SC_VPORT_ZMAX_0 1
+#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 2
+#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 3
+#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 4
+#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 5
+#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 6
+#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 7
+#define R600_VIEWPORT__PA_CL_VTE_CNTL 8
+#define R600_VIEWPORT_SIZE 9
+#define R600_VIEWPORT_PM4 128
+
+/* R600_SCISSOR */
+#define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL 0
+#define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR 1
+#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 2
+#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 3
+#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 4
+#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 5
+#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 6
+#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 7
+#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 8
+#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 9
+#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 10
+#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 11
+#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 12
+#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 13
+#define R600_SCISSOR__PA_SC_EDGERULE 14
+#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 15
+#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 16
+#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 17
+#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 18
+#define R600_SCISSOR_SIZE 19
+#define R600_SCISSOR_PM4 128
+
+/* R600_BLEND */
+#define R600_BLEND__CB_BLEND_RED 0
+#define R600_BLEND__CB_BLEND_GREEN 1
+#define R600_BLEND__CB_BLEND_BLUE 2
+#define R600_BLEND__CB_BLEND_ALPHA 3
+#define R600_BLEND__CB_BLEND0_CONTROL 4
+#define R600_BLEND__CB_BLEND1_CONTROL 5
+#define R600_BLEND__CB_BLEND2_CONTROL 6
+#define R600_BLEND__CB_BLEND3_CONTROL 7
+#define R600_BLEND__CB_BLEND4_CONTROL 8
+#define R600_BLEND__CB_BLEND5_CONTROL 9
+#define R600_BLEND__CB_BLEND6_CONTROL 10
+#define R600_BLEND__CB_BLEND7_CONTROL 11
+#define R600_BLEND__CB_BLEND_CONTROL 12
+#define R600_BLEND_SIZE 13
+#define R600_BLEND_PM4 128
+
+/* R600_DSA */
+#define R600_DSA__DB_STENCIL_CLEAR 0
+#define R600_DSA__DB_DEPTH_CLEAR 1
+#define R600_DSA__SX_ALPHA_TEST_CONTROL 2
+#define R600_DSA__DB_STENCILREFMASK 3
+#define R600_DSA__DB_STENCILREFMASK_BF 4
+#define R600_DSA__SX_ALPHA_REF 5
+#define R600_DSA__SPI_FOG_FUNC_SCALE 6
+#define R600_DSA__SPI_FOG_FUNC_BIAS 7
+#define R600_DSA__SPI_FOG_CNTL 8
+#define R600_DSA__DB_DEPTH_CONTROL 9
+#define R600_DSA__DB_SHADER_CONTROL 10
+#define R600_DSA__DB_RENDER_CONTROL 11
+#define R600_DSA__DB_RENDER_OVERRIDE 12
+#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 13
+#define R600_DSA__DB_PRELOAD_CONTROL 14
+#define R600_DSA__DB_ALPHA_TO_MASK 15
+#define R600_DSA_SIZE 16
+#define R600_DSA_PM4 128
+
+/* R600_VS_SHADER */
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_0 0
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_1 1
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_2 2
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_3 3
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_4 4
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_5 5
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_6 6
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_7 7
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_8 8
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_9 9
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_10 10
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_11 11
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_12 12
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_13 13
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_14 14
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_15 15
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_16 16
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_17 17
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_18 18
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_19 19
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_20 20
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_21 21
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_22 22
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_23 23
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_24 24
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_25 25
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_26 26
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_27 27
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_28 28
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_29 29
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_30 30
+#define R600_VS_SHADER__SQ_VTX_SEMANTIC_31 31
+#define R600_VS_SHADER__SPI_VS_OUT_ID_0 32
+#define R600_VS_SHADER__SPI_VS_OUT_ID_1 33
+#define R600_VS_SHADER__SPI_VS_OUT_ID_2 34
+#define R600_VS_SHADER__SPI_VS_OUT_ID_3 35
+#define R600_VS_SHADER__SPI_VS_OUT_ID_4 36
+#define R600_VS_SHADER__SPI_VS_OUT_ID_5 37
+#define R600_VS_SHADER__SPI_VS_OUT_ID_6 38
+#define R600_VS_SHADER__SPI_VS_OUT_ID_7 39
+#define R600_VS_SHADER__SPI_VS_OUT_ID_8 40
+#define R600_VS_SHADER__SPI_VS_OUT_ID_9 41
+#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 42
+#define R600_VS_SHADER__SQ_PGM_START_VS 43
+#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 44
+#define R600_VS_SHADER__SQ_PGM_START_FS 45
+#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 46
+#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 47
+#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 48
+#define R600_VS_SHADER_SIZE 49
+#define R600_VS_SHADER_PM4 128
+
+/* R600_PS_SHADER */
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 0
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_1 1
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_2 2
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_3 3
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_4 4
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_5 5
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_6 6
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_7 7
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_8 8
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_9 9
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_10 10
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_11 11
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_12 12
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_13 13
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_14 14
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_15 15
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_16 16
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_17 17
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_18 18
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_19 19
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_20 20
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_21 21
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_22 22
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_23 23
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_24 24
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_25 25
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_26 26
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_27 27
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_28 28
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_29 29
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_30 30
+#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_31 31
+#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 32
+#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 33
+#define R600_PS_SHADER__SPI_INPUT_Z 34
+#define R600_PS_SHADER__SQ_PGM_START_PS 35
+#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 36
+#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 37
+#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 38
+#define R600_PS_SHADER_SIZE 39
+#define R600_PS_SHADER_PM4 128
+
+/* R600_VS_CBUF */
+#define R600_VS_CBUF__ALU_CONST_BUFFER_SIZE_VS_0 0
+#define R600_VS_CBUF__ALU_CONST_CACHE_VS_0 1
+#define R600_VS_CBUF_SIZE 2
+#define R600_VS_CBUF_PM4 128
+
+/* R600_PS_CBUF */
+#define R600_PS_CBUF__ALU_CONST_BUFFER_SIZE_PS_0 0
+#define R600_PS_CBUF__ALU_CONST_CACHE_PS_0 1
+#define R600_PS_CBUF_SIZE 2
+#define R600_PS_CBUF_PM4 128
+
+/* R600_PS_CONSTANT */
+#define R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0 0
+#define R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0 1
+#define R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0 2
+#define R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0 3
+#define R600_PS_CONSTANT_SIZE 4
+#define R600_PS_CONSTANT_PM4 128
+
+/* R600_VS_CONSTANT */
+#define R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256 0
+#define R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256 1
+#define R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256 2
+#define R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256 3
+#define R600_VS_CONSTANT_SIZE 4
+#define R600_VS_CONSTANT_PM4 128
+
+/* R600_UCP */
+#define R600_UCP__PA_CL_UCP0_X 0
+#define R600_UCP__PA_CL_UCP0_Y 1
+#define R600_UCP__PA_CL_UCP0_Z 2
+#define R600_UCP__PA_CL_UCP0_W 3
+#define R600_UCP__PA_CL_UCP1_X 4
+#define R600_UCP__PA_CL_UCP1_Y 5
+#define R600_UCP__PA_CL_UCP1_Z 6
+#define R600_UCP__PA_CL_UCP1_W 7
+#define R600_UCP__PA_CL_UCP2_X 8
+#define R600_UCP__PA_CL_UCP2_Y 9
+#define R600_UCP__PA_CL_UCP2_Z 10
+#define R600_UCP__PA_CL_UCP2_W 11
+#define R600_UCP__PA_CL_UCP3_X 12
+#define R600_UCP__PA_CL_UCP3_Y 13
+#define R600_UCP__PA_CL_UCP3_Z 14
+#define R600_UCP__PA_CL_UCP3_W 15
+#define R600_UCP__PA_CL_UCP4_X 16
+#define R600_UCP__PA_CL_UCP4_Y 17
+#define R600_UCP__PA_CL_UCP4_Z 18
+#define R600_UCP__PA_CL_UCP4_W 19
+#define R600_UCP__PA_CL_UCP5_X 20
+#define R600_UCP__PA_CL_UCP5_Y 21
+#define R600_UCP__PA_CL_UCP5_Z 22
+#define R600_UCP__PA_CL_UCP5_W 23
+#define R600_UCP_SIZE 24
+#define R600_UCP_PM4 128
+
+/* R600_PS_RESOURCE */
+#define R600_PS_RESOURCE__RESOURCE0_WORD0 0
+#define R600_PS_RESOURCE__RESOURCE0_WORD1 1
+#define R600_PS_RESOURCE__RESOURCE0_WORD2 2
+#define R600_PS_RESOURCE__RESOURCE0_WORD3 3
+#define R600_PS_RESOURCE__RESOURCE0_WORD4 4
+#define R600_PS_RESOURCE__RESOURCE0_WORD5 5
+#define R600_PS_RESOURCE__RESOURCE0_WORD6 6
+#define R600_PS_RESOURCE_SIZE 7
+#define R600_PS_RESOURCE_PM4 128
+
+/* R600_VS_RESOURCE */
+#define R600_VS_RESOURCE__RESOURCE160_WORD0 0
+#define R600_VS_RESOURCE__RESOURCE160_WORD1 1
+#define R600_VS_RESOURCE__RESOURCE160_WORD2 2
+#define R600_VS_RESOURCE__RESOURCE160_WORD3 3
+#define R600_VS_RESOURCE__RESOURCE160_WORD4 4
+#define R600_VS_RESOURCE__RESOURCE160_WORD5 5
+#define R600_VS_RESOURCE__RESOURCE160_WORD6 6
+#define R600_VS_RESOURCE_SIZE 7
+#define R600_VS_RESOURCE_PM4 128
+
+/* R600_FS_RESOURCE */
+#define R600_FS_RESOURCE__RESOURCE320_WORD0 0
+#define R600_FS_RESOURCE__RESOURCE320_WORD1 1
+#define R600_FS_RESOURCE__RESOURCE320_WORD2 2
+#define R600_FS_RESOURCE__RESOURCE320_WORD3 3
+#define R600_FS_RESOURCE__RESOURCE320_WORD4 4
+#define R600_FS_RESOURCE__RESOURCE320_WORD5 5
+#define R600_FS_RESOURCE__RESOURCE320_WORD6 6
+#define R600_FS_RESOURCE_SIZE 7
+#define R600_FS_RESOURCE_PM4 128
+
+/* R600_GS_RESOURCE */
+#define R600_GS_RESOURCE__RESOURCE336_WORD0 0
+#define R600_GS_RESOURCE__RESOURCE336_WORD1 1
+#define R600_GS_RESOURCE__RESOURCE336_WORD2 2
+#define R600_GS_RESOURCE__RESOURCE336_WORD3 3
+#define R600_GS_RESOURCE__RESOURCE336_WORD4 4
+#define R600_GS_RESOURCE__RESOURCE336_WORD5 5
+#define R600_GS_RESOURCE__RESOURCE336_WORD6 6
+#define R600_GS_RESOURCE_SIZE 7
+#define R600_GS_RESOURCE_PM4 128
+
+/* R600_PS_SAMPLER */
+#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0 0
+#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0 1
+#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0 2
+#define R600_PS_SAMPLER_SIZE 3
+#define R600_PS_SAMPLER_PM4 128
+
+/* R600_VS_SAMPLER */
+#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0
+#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1
+#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2
+#define R600_VS_SAMPLER_SIZE 3
+#define R600_VS_SAMPLER_PM4 128
+
+/* R600_GS_SAMPLER */
+#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0
+#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1
+#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2
+#define R600_GS_SAMPLER_SIZE 3
+#define R600_GS_SAMPLER_PM4 128
+
+/* R600_PS_SAMPLER_BORDER */
+#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0
+#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1
+#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2
+#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3
+#define R600_PS_SAMPLER_BORDER_SIZE 4
+#define R600_PS_SAMPLER_BORDER_PM4 128
+
+/* R600_VS_SAMPLER_BORDER */
+#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0
+#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1
+#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2
+#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3
+#define R600_VS_SAMPLER_BORDER_SIZE 4
+#define R600_VS_SAMPLER_BORDER_PM4 128
+
+/* R600_GS_SAMPLER_BORDER */
+#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0
+#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1
+#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2
+#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3
+#define R600_GS_SAMPLER_BORDER_SIZE 4
+#define R600_GS_SAMPLER_BORDER_PM4 128
+
+/* R600_CB0 */
+#define R600_CB0__CB_COLOR0_BASE 0
+#define R600_CB0__CB_COLOR0_INFO 1
+#define R600_CB0__CB_COLOR0_SIZE 2
+#define R600_CB0__CB_COLOR0_VIEW 3
+#define R600_CB0__CB_COLOR0_FRAG 4
+#define R600_CB0__CB_COLOR0_TILE 5
+#define R600_CB0__CB_COLOR0_MASK 6
+#define R600_CB0_SIZE 7
+#define R600_CB0_PM4 128
+
+/* R600_CB1 */
+#define R600_CB1__CB_COLOR1_BASE 0
+#define R600_CB1__CB_COLOR1_INFO 1
+#define R600_CB1__CB_COLOR1_SIZE 2
+#define R600_CB1__CB_COLOR1_VIEW 3
+#define R600_CB1__CB_COLOR1_FRAG 4
+#define R600_CB1__CB_COLOR1_TILE 5
+#define R600_CB1__CB_COLOR1_MASK 6
+#define R600_CB1_SIZE 7
+#define R600_CB1_PM4 128
+
+/* R600_CB2 */
+#define R600_CB2__CB_COLOR2_BASE 0
+#define R600_CB2__CB_COLOR2_INFO 1
+#define R600_CB2__CB_COLOR2_SIZE 2
+#define R600_CB2__CB_COLOR2_VIEW 3
+#define R600_CB2__CB_COLOR2_FRAG 4
+#define R600_CB2__CB_COLOR2_TILE 5
+#define R600_CB2__CB_COLOR2_MASK 6
+#define R600_CB2_SIZE 7
+#define R600_CB2_PM4 128
+
+/* R600_CB3 */
+#define R600_CB3__CB_COLOR3_BASE 0
+#define R600_CB3__CB_COLOR3_INFO 1
+#define R600_CB3__CB_COLOR3_SIZE 2
+#define R600_CB3__CB_COLOR3_VIEW 3
+#define R600_CB3__CB_COLOR3_FRAG 4
+#define R600_CB3__CB_COLOR3_TILE 5
+#define R600_CB3__CB_COLOR3_MASK 6
+#define R600_CB3_SIZE 7
+#define R600_CB3_PM4 128
+
+/* R600_CB4 */
+#define R600_CB4__CB_COLOR4_BASE 0
+#define R600_CB4__CB_COLOR4_INFO 1
+#define R600_CB4__CB_COLOR4_SIZE 2
+#define R600_CB4__CB_COLOR4_VIEW 3
+#define R600_CB4__CB_COLOR4_FRAG 4
+#define R600_CB4__CB_COLOR4_TILE 5
+#define R600_CB4__CB_COLOR4_MASK 6
+#define R600_CB4_SIZE 7
+#define R600_CB4_PM4 128
+
+/* R600_CB5 */
+#define R600_CB5__CB_COLOR5_BASE 0
+#define R600_CB5__CB_COLOR5_INFO 1
+#define R600_CB5__CB_COLOR5_SIZE 2
+#define R600_CB5__CB_COLOR5_VIEW 3
+#define R600_CB5__CB_COLOR5_FRAG 4
+#define R600_CB5__CB_COLOR5_TILE 5
+#define R600_CB5__CB_COLOR5_MASK 6
+#define R600_CB5_SIZE 7
+#define R600_CB5_PM4 128
+
+/* R600_CB6 */
+#define R600_CB6__CB_COLOR6_BASE 0
+#define R600_CB6__CB_COLOR6_INFO 1
+#define R600_CB6__CB_COLOR6_SIZE 2
+#define R600_CB6__CB_COLOR6_VIEW 3
+#define R600_CB6__CB_COLOR6_FRAG 4
+#define R600_CB6__CB_COLOR6_TILE 5
+#define R600_CB6__CB_COLOR6_MASK 6
+#define R600_CB6_SIZE 7
+#define R600_CB6_PM4 128
+
+/* R600_CB7 */
+#define R600_CB7__CB_COLOR7_BASE 0
+#define R600_CB7__CB_COLOR7_INFO 1
+#define R600_CB7__CB_COLOR7_SIZE 2
+#define R600_CB7__CB_COLOR7_VIEW 3
+#define R600_CB7__CB_COLOR7_FRAG 4
+#define R600_CB7__CB_COLOR7_TILE 5
+#define R600_CB7__CB_COLOR7_MASK 6
+#define R600_CB7_SIZE 7
+#define R600_CB7_PM4 128
+
+/* R600_DB */
+#define R600_DB__DB_DEPTH_BASE 0
+#define R600_DB__DB_DEPTH_SIZE 1
+#define R600_DB__DB_DEPTH_VIEW 2
+#define R600_DB__DB_DEPTH_INFO 3
+#define R600_DB__DB_HTILE_SURFACE 4
+#define R600_DB__DB_PREFETCH_LIMIT 5
+#define R600_DB_SIZE 6
+#define R600_DB_PM4 128
+
+/* R600_VGT */
+#define R600_VGT__VGT_PRIMITIVE_TYPE 0
+#define R600_VGT__VGT_MAX_VTX_INDX 1
+#define R600_VGT__VGT_MIN_VTX_INDX 2
+#define R600_VGT__VGT_INDX_OFFSET 3
+#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 4
+#define R600_VGT__VGT_DMA_INDEX_TYPE 5
+#define R600_VGT__VGT_PRIMITIVEID_EN 6
+#define R600_VGT__VGT_DMA_NUM_INSTANCES 7
+#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN 8
+#define R600_VGT__VGT_INSTANCE_STEP_RATE_0 9
+#define R600_VGT__VGT_INSTANCE_STEP_RATE_1 10
+#define R600_VGT_SIZE 11
+#define R600_VGT_PM4 128
+
+/* R600_DRAW */
+#define R600_DRAW__VGT_NUM_INDICES 0
+#define R600_DRAW__VGT_DMA_BASE_HI 1
+#define R600_DRAW__VGT_DMA_BASE 2
+#define R600_DRAW__VGT_DRAW_INITIATOR 3
+#define R600_DRAW_SIZE 4
+#define R600_DRAW_PM4 128
+
+/* R600_VGT_EVENT */
+#define R600_VGT_EVENT__VGT_EVENT_INITIATOR 0
+#define R600_VGT_EVENT_SIZE 1
+#define R600_VGT_EVENT_PM4 128
+
+/* R600_CB_FLUSH */
+#define R600_CB_FLUSH_SIZE 0
+#define R600_CB_FLUSH_PM4 128
+
+/* R600_DB_FLUSH */
+#define R600_DB_FLUSH_SIZE 0
+#define R600_DB_FLUSH_PM4 128
+
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index b6698e3885..37907ef0e9 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -199,11 +199,6 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
struct r600_resource *resource;
struct radeon_bo *bo = NULL;
- bo = radeon_bo(rw, whandle->handle, 0, 0, NULL);
- if (bo == NULL) {
- return NULL;
- }
-
/* Support only 2D textures without mipmaps */
if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) ||
templ->depth0 != 1 || templ->last_level != 0)
@@ -213,6 +208,12 @@ struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen,
if (rtex == NULL)
return NULL;
+ bo = radeon_bo(rw, whandle->handle, 0, 0, NULL);
+ if (bo == NULL) {
+ FREE(rtex);
+ return NULL;
+ }
+
resource = &rtex->resource;
resource->base.b = *templ;
resource->base.vtbl = &r600_texture_vtbl;
@@ -523,7 +524,7 @@ uint32_t r600_translate_texformat(enum pipe_format format,
if (desc->channel[0].size == 5 &&
desc->channel[1].size == 6 &&
desc->channel[2].size == 5) {
- result |= V_0280A0_COLOR_5_6_5;
+ result = V_0280A0_COLOR_5_6_5;
goto out_word4;
}
goto out_unknown;
@@ -532,14 +533,14 @@ uint32_t r600_translate_texformat(enum pipe_format format,
desc->channel[1].size == 5 &&
desc->channel[2].size == 5 &&
desc->channel[3].size == 1) {
- result |= V_0280A0_COLOR_1_5_5_5;
+ result = V_0280A0_COLOR_1_5_5_5;
goto out_word4;
}
if (desc->channel[0].size == 10 &&
desc->channel[1].size == 10 &&
desc->channel[2].size == 10 &&
desc->channel[3].size == 2) {
- result |= V_0280A0_COLOR_10_10_10_2;
+ result = V_0280A0_COLOR_10_10_10_2;
goto out_word4;
}
goto out_unknown;
@@ -560,36 +561,36 @@ uint32_t r600_translate_texformat(enum pipe_format format,
case 4:
switch (desc->nr_channels) {
case 2:
- result |= V_0280A0_COLOR_4_4;
+ result = V_0280A0_COLOR_4_4;
goto out_word4;
case 4:
- result |= V_0280A0_COLOR_4_4_4_4;
+ result = V_0280A0_COLOR_4_4_4_4;
goto out_word4;
}
goto out_unknown;
case 8:
switch (desc->nr_channels) {
case 1:
- result |= V_0280A0_COLOR_8;
+ result = V_0280A0_COLOR_8;
goto out_word4;
case 2:
- result |= V_0280A0_COLOR_8_8;
+ result = V_0280A0_COLOR_8_8;
goto out_word4;
case 4:
- result |= V_0280A0_COLOR_8_8_8_8;
+ result = V_0280A0_COLOR_8_8_8_8;
goto out_word4;
}
goto out_unknown;
case 16:
switch (desc->nr_channels) {
case 1:
- result |= V_0280A0_COLOR_16;
+ result = V_0280A0_COLOR_16;
goto out_word4;
case 2:
- result |= V_0280A0_COLOR_16_16;
+ result = V_0280A0_COLOR_16_16;
goto out_word4;
case 4:
- result |= V_0280A0_COLOR_16_16_16_16;
+ result = V_0280A0_COLOR_16_16_16_16;
goto out_word4;
}
}
@@ -600,26 +601,26 @@ uint32_t r600_translate_texformat(enum pipe_format format,
case 16:
switch (desc->nr_channels) {
case 1:
- result |= V_0280A0_COLOR_16_FLOAT;
+ result = V_0280A0_COLOR_16_FLOAT;
goto out_word4;
case 2:
- result |= V_0280A0_COLOR_16_16_FLOAT;
+ result = V_0280A0_COLOR_16_16_FLOAT;
goto out_word4;
case 4:
- result |= V_0280A0_COLOR_16_16_16_16_FLOAT;
+ result = V_0280A0_COLOR_16_16_16_16_FLOAT;
goto out_word4;
}
goto out_unknown;
case 32:
switch (desc->nr_channels) {
case 1:
- result |= V_0280A0_COLOR_32_FLOAT;
+ result = V_0280A0_COLOR_32_FLOAT;
goto out_word4;
case 2:
- result |= V_0280A0_COLOR_32_32_FLOAT;
+ result = V_0280A0_COLOR_32_32_FLOAT;
goto out_word4;
case 4:
- result |= V_0280A0_COLOR_32_32_32_32_FLOAT;
+ result = V_0280A0_COLOR_32_32_32_32_FLOAT;
goto out_word4;
}
}
diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h
index 7b9a983d53..259927e5fa 100644
--- a/src/gallium/drivers/r600/r600d.h
+++ b/src/gallium/drivers/r600/r600d.h
@@ -589,7 +589,14 @@
#define S_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) & 0x3FF) << 0)
#define G_028D34_DEPTH_HEIGHT_TILE_MAX(x) (((x) >> 0) & 0x3FF)
#define C_028D34_DEPTH_HEIGHT_TILE_MAX 0xFFFFFC00
+#define R_028D0C_DB_RENDER_CONTROL 0x028D0C
+#define S_028D0C_STENCIL_COMPRESS_DISABLE(x) (((x) & 0x1) << 5)
+#define S_028D0C_DEPTH_COMPRESS_DISABLE(x) (((x) & 0x1) << 6)
+#define S_028D0C_R700_PERFECT_ZPASS_COUNTS(x) (((x) & 0x1) << 15)
#define R_028D10_DB_RENDER_OVERRIDE 0x028D10
+#define V_028D10_FORCE_OFF 0
+#define V_028D10_FORCE_ENABLE 1
+#define V_028D10_FORCE_DISABLE 2
#define S_028D10_FORCE_HIZ_ENABLE(x) (((x) & 0x3) << 0)
#define G_028D10_FORCE_HIZ_ENABLE(x) (((x) >> 0) & 0x3)
#define C_028D10_FORCE_HIZ_ENABLE 0xFFFFFFFC
diff --git a/src/gallium/drivers/r600/r700_asm.c b/src/gallium/drivers/r600/r700_asm.c
index 1ebe20d6ab..e754d733af 100644
--- a/src/gallium/drivers/r600/r700_asm.c
+++ b/src/gallium/drivers/r600/r700_asm.c
@@ -26,41 +26,50 @@
#include "r700_sq.h"
#include <stdio.h>
+
int r700_bc_alu_build(struct r600_bc *bc, struct r600_bc_alu *alu, unsigned id)
{
unsigned i;
+ bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
+ S_SQ_ALU_WORD0_SRC0_REL(alu->src[0].rel) |
+ S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) |
+ S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) |
+ S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) |
+ S_SQ_ALU_WORD0_SRC0_REL(alu->src[1].rel) |
+ S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) |
+ S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) |
+ S_SQ_ALU_WORD0_LAST(alu->last);
+
/* don't replace gpr by pv or ps for destination register */
if (alu->is_op3) {
- bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
- S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) |
- S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) |
- S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) |
- S_SQ_ALU_WORD0_LAST(alu->last);
bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) |
+ S_SQ_ALU_WORD1_DST_REL(alu->dst.rel) |
+ S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) |
S_SQ_ALU_WORD1_OP3_SRC2_SEL(alu->src[2].sel) |
+ S_SQ_ALU_WORD1_OP3_SRC2_REL(alu->src[2].rel) |
S_SQ_ALU_WORD1_OP3_SRC2_CHAN(alu->src[2].chan) |
S_SQ_ALU_WORD1_OP3_SRC2_NEG(alu->src[2].neg) |
S_SQ_ALU_WORD1_OP3_ALU_INST(alu->inst) |
- S_SQ_ALU_WORD1_BANK_SWIZZLE(0);
+ S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle);
} else {
- bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
- S_SQ_ALU_WORD0_SRC0_CHAN(alu->src[0].chan) |
- S_SQ_ALU_WORD0_SRC0_NEG(alu->src[0].neg) |
- S_SQ_ALU_WORD0_SRC1_SEL(alu->src[1].sel) |
- S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) |
- S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) |
- S_SQ_ALU_WORD0_LAST(alu->last);
bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
S_SQ_ALU_WORD1_DST_CHAN(alu->dst.chan) |
+ S_SQ_ALU_WORD1_DST_REL(alu->dst.rel) |
+ S_SQ_ALU_WORD1_CLAMP(alu->dst.clamp) |
S_SQ_ALU_WORD1_OP2_SRC0_ABS(alu->src[0].abs) |
S_SQ_ALU_WORD1_OP2_SRC1_ABS(alu->src[1].abs) |
S_SQ_ALU_WORD1_OP2_WRITE_MASK(alu->dst.write) |
S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) |
- S_SQ_ALU_WORD1_BANK_SWIZZLE(0);
+ S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) |
+ S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) |
+ S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate);
}
if (alu->last) {
+ if (alu->nliteral && !alu->literal_added) {
+ R600_ERR("Bug in ALU processing for instruction 0x%08x, literal not added correctly\n", alu->inst);
+ }
for (i = 0; i < alu->nliteral; i++) {
bc->bytecode[id++] = alu->value[i];
}
diff --git a/src/gallium/drivers/r600/radeon.h b/src/gallium/drivers/r600/radeon.h
index aaac8de528..7991821dda 100644
--- a/src/gallium/drivers/r600/radeon.h
+++ b/src/gallium/drivers/r600/radeon.h
@@ -194,6 +194,7 @@ enum r600_stype {
R600_STATE_DSA,
R600_STATE_SHADER, /* has PS,VS,GS,FS variants */
R600_STATE_CONSTANT, /* has PS,VS,GS,FS variants */
+ R600_STATE_CBUF, /* has PS,VS,GS,FS variants */
R600_STATE_RESOURCE, /* has PS,VS,GS,FS variants */
R600_STATE_SAMPLER, /* has PS,VS,GS,FS variants */
R600_STATE_SAMPLER_BORDER, /* has PS,VS,GS,FS variants */
@@ -211,420 +212,14 @@ enum r600_stype {
R600_STATE_UCP,
R600_STATE_VGT,
R600_STATE_DRAW,
+ R600_STATE_CB_FLUSH,
+ R600_STATE_DB_FLUSH,
+ R600_STATE_MAX,
};
-/* R600_CONFIG */
-#define R600_CONFIG__SQ_CONFIG 0
-#define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_1 1
-#define R600_CONFIG__SQ_GPR_RESOURCE_MGMT_2 2
-#define R600_CONFIG__SQ_THREAD_RESOURCE_MGMT 3
-#define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_1 4
-#define R600_CONFIG__SQ_STACK_RESOURCE_MGMT_2 5
-#define R600_CONFIG__SQ_DYN_GPR_CNTL_PS_FLUSH_REQ 6
-#define R600_CONFIG__TA_CNTL_AUX 7
-#define R600_CONFIG__VC_ENHANCE 8
-#define R600_CONFIG__DB_DEBUG 9
-#define R600_CONFIG__DB_WATERMARKS 10
-#define R600_CONFIG__SX_MISC 11
-#define R600_CONFIG__SPI_THREAD_GROUPING 12
-#define R600_CONFIG__CB_SHADER_CONTROL 13
-#define R600_CONFIG__SQ_ESGS_RING_ITEMSIZE 14
-#define R600_CONFIG__SQ_GSVS_RING_ITEMSIZE 15
-#define R600_CONFIG__SQ_ESTMP_RING_ITEMSIZE 16
-#define R600_CONFIG__SQ_GSTMP_RING_ITEMSIZE 17
-#define R600_CONFIG__SQ_VSTMP_RING_ITEMSIZE 18
-#define R600_CONFIG__SQ_PSTMP_RING_ITEMSIZE 19
-#define R600_CONFIG__SQ_FBUF_RING_ITEMSIZE 20
-#define R600_CONFIG__SQ_REDUC_RING_ITEMSIZE 21
-#define R600_CONFIG__SQ_GS_VERT_ITEMSIZE 22
-#define R600_CONFIG__VGT_OUTPUT_PATH_CNTL 23
-#define R600_CONFIG__VGT_HOS_CNTL 24
-#define R600_CONFIG__VGT_HOS_MAX_TESS_LEVEL 25
-#define R600_CONFIG__VGT_HOS_MIN_TESS_LEVEL 26
-#define R600_CONFIG__VGT_HOS_REUSE_DEPTH 27
-#define R600_CONFIG__VGT_GROUP_PRIM_TYPE 28
-#define R600_CONFIG__VGT_GROUP_FIRST_DECR 29
-#define R600_CONFIG__VGT_GROUP_DECR 30
-#define R600_CONFIG__VGT_GROUP_VECT_0_CNTL 31
-#define R600_CONFIG__VGT_GROUP_VECT_1_CNTL 32
-#define R600_CONFIG__VGT_GROUP_VECT_0_FMT_CNTL 33
-#define R600_CONFIG__VGT_GROUP_VECT_1_FMT_CNTL 34
-#define R600_CONFIG__VGT_GS_MODE 35
-#define R600_CONFIG__PA_SC_MODE_CNTL 36
-#define R600_CONFIG__VGT_STRMOUT_EN 37
-#define R600_CONFIG__VGT_REUSE_OFF 38
-#define R600_CONFIG__VGT_VTX_CNT_EN 39
-#define R600_CONFIG__VGT_STRMOUT_BUFFER_EN 40
-#define R600_CONFIG_SIZE 41
-#define R600_CONFIG_PM4 128
-/* R600_CB_CNTL */
-#define R600_CB_CNTL__CB_CLEAR_RED 0
-#define R600_CB_CNTL__CB_CLEAR_GREEN 1
-#define R600_CB_CNTL__CB_CLEAR_BLUE 2
-#define R600_CB_CNTL__CB_CLEAR_ALPHA 3
-#define R600_CB_CNTL__CB_SHADER_MASK 4
-#define R600_CB_CNTL__CB_TARGET_MASK 5
-#define R600_CB_CNTL__CB_FOG_RED 6
-#define R600_CB_CNTL__CB_FOG_GREEN 7
-#define R600_CB_CNTL__CB_FOG_BLUE 8
-#define R600_CB_CNTL__CB_COLOR_CONTROL 9
-#define R600_CB_CNTL__PA_SC_AA_CONFIG 10
-#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_MCTX 11
-#define R600_CB_CNTL__PA_SC_AA_SAMPLE_LOCS_8S_WD1_MCTX 12
-#define R600_CB_CNTL__CB_CLRCMP_CONTROL 13
-#define R600_CB_CNTL__CB_CLRCMP_SRC 14
-#define R600_CB_CNTL__CB_CLRCMP_DST 15
-#define R600_CB_CNTL__CB_CLRCMP_MSK 16
-#define R600_CB_CNTL__PA_SC_AA_MASK 17
-#define R600_CB_CNTL_SIZE 18
-#define R600_CB_CNTL_PM4 128
-/* R600_RASTERIZER */
-#define R600_RASTERIZER__SPI_INTERP_CONTROL_0 0
-#define R600_RASTERIZER__PA_CL_CLIP_CNTL 1
-#define R600_RASTERIZER__PA_SU_SC_MODE_CNTL 2
-#define R600_RASTERIZER__PA_CL_VS_OUT_CNTL 3
-#define R600_RASTERIZER__PA_CL_NANINF_CNTL 4
-#define R600_RASTERIZER__PA_SU_POINT_SIZE 5
-#define R600_RASTERIZER__PA_SU_POINT_MINMAX 6
-#define R600_RASTERIZER__PA_SU_LINE_CNTL 7
-#define R600_RASTERIZER__PA_SC_LINE_STIPPLE 8
-#define R600_RASTERIZER__PA_SC_MPASS_PS_CNTL 9
-#define R600_RASTERIZER__PA_SC_LINE_CNTL 10
-#define R600_RASTERIZER__PA_CL_GB_VERT_CLIP_ADJ 11
-#define R600_RASTERIZER__PA_CL_GB_VERT_DISC_ADJ 12
-#define R600_RASTERIZER__PA_CL_GB_HORZ_CLIP_ADJ 13
-#define R600_RASTERIZER__PA_CL_GB_HORZ_DISC_ADJ 14
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_DB_FMT_CNTL 15
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_CLAMP 16
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_SCALE 17
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_FRONT_OFFSET 18
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_SCALE 19
-#define R600_RASTERIZER__PA_SU_POLY_OFFSET_BACK_OFFSET 20
-#define R600_RASTERIZER_SIZE 21
-#define R600_RASTERIZER_PM4 128
-/* R600_VIEWPORT */
-#define R600_VIEWPORT__PA_SC_VPORT_ZMIN_0 0
-#define R600_VIEWPORT__PA_SC_VPORT_ZMAX_0 1
-#define R600_VIEWPORT__PA_CL_VPORT_XSCALE_0 2
-#define R600_VIEWPORT__PA_CL_VPORT_YSCALE_0 3
-#define R600_VIEWPORT__PA_CL_VPORT_ZSCALE_0 4
-#define R600_VIEWPORT__PA_CL_VPORT_XOFFSET_0 5
-#define R600_VIEWPORT__PA_CL_VPORT_YOFFSET_0 6
-#define R600_VIEWPORT__PA_CL_VPORT_ZOFFSET_0 7
-#define R600_VIEWPORT__PA_CL_VTE_CNTL 8
-#define R600_VIEWPORT_SIZE 9
-#define R600_VIEWPORT_PM4 128
-/* R600_SCISSOR */
-#define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_TL 0
-#define R600_SCISSOR__PA_SC_SCREEN_SCISSOR_BR 1
-#define R600_SCISSOR__PA_SC_WINDOW_OFFSET 2
-#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_TL 3
-#define R600_SCISSOR__PA_SC_WINDOW_SCISSOR_BR 4
-#define R600_SCISSOR__PA_SC_CLIPRECT_RULE 5
-#define R600_SCISSOR__PA_SC_CLIPRECT_0_TL 6
-#define R600_SCISSOR__PA_SC_CLIPRECT_0_BR 7
-#define R600_SCISSOR__PA_SC_CLIPRECT_1_TL 8
-#define R600_SCISSOR__PA_SC_CLIPRECT_1_BR 9
-#define R600_SCISSOR__PA_SC_CLIPRECT_2_TL 10
-#define R600_SCISSOR__PA_SC_CLIPRECT_2_BR 11
-#define R600_SCISSOR__PA_SC_CLIPRECT_3_TL 12
-#define R600_SCISSOR__PA_SC_CLIPRECT_3_BR 13
-#define R600_SCISSOR__PA_SC_EDGERULE 14
-#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_TL 15
-#define R600_SCISSOR__PA_SC_GENERIC_SCISSOR_BR 16
-#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_TL 17
-#define R600_SCISSOR__PA_SC_VPORT_SCISSOR_0_BR 18
-#define R600_SCISSOR_SIZE 19
-#define R600_SCISSOR_PM4 128
-/* R600_BLEND */
-#define R600_BLEND__CB_BLEND_RED 0
-#define R600_BLEND__CB_BLEND_GREEN 1
-#define R600_BLEND__CB_BLEND_BLUE 2
-#define R600_BLEND__CB_BLEND_ALPHA 3
-#define R600_BLEND__CB_BLEND0_CONTROL 4
-#define R600_BLEND__CB_BLEND1_CONTROL 5
-#define R600_BLEND__CB_BLEND2_CONTROL 6
-#define R600_BLEND__CB_BLEND3_CONTROL 7
-#define R600_BLEND__CB_BLEND4_CONTROL 8
-#define R600_BLEND__CB_BLEND5_CONTROL 9
-#define R600_BLEND__CB_BLEND6_CONTROL 10
-#define R600_BLEND__CB_BLEND7_CONTROL 11
-#define R600_BLEND__CB_BLEND_CONTROL 12
-#define R600_BLEND_SIZE 13
-#define R600_BLEND_PM4 128
-/* R600_DSA */
-#define R600_DSA__DB_STENCIL_CLEAR 0
-#define R600_DSA__DB_DEPTH_CLEAR 1
-#define R600_DSA__SX_ALPHA_TEST_CONTROL 2
-#define R600_DSA__DB_STENCILREFMASK 3
-#define R600_DSA__DB_STENCILREFMASK_BF 4
-#define R600_DSA__SX_ALPHA_REF 5
-#define R600_DSA__SPI_FOG_FUNC_SCALE 6
-#define R600_DSA__SPI_FOG_FUNC_BIAS 7
-#define R600_DSA__SPI_FOG_CNTL 8
-#define R600_DSA__DB_DEPTH_CONTROL 9
-#define R600_DSA__DB_SHADER_CONTROL 10
-#define R600_DSA__DB_RENDER_CONTROL 11
-#define R600_DSA__DB_RENDER_OVERRIDE 12
-#define R600_DSA__DB_SRESULTS_COMPARE_STATE1 13
-#define R600_DSA__DB_PRELOAD_CONTROL 14
-#define R600_DSA__DB_ALPHA_TO_MASK 15
-#define R600_DSA_SIZE 16
-#define R600_DSA_PM4 128
-/* R600_VS_SHADER */
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_0 0
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_1 1
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_2 2
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_3 3
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_4 4
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_5 5
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_6 6
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_7 7
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_8 8
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_9 9
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_10 10
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_11 11
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_12 12
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_13 13
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_14 14
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_15 15
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_16 16
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_17 17
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_18 18
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_19 19
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_20 20
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_21 21
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_22 22
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_23 23
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_24 24
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_25 25
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_26 26
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_27 27
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_28 28
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_29 29
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_30 30
-#define R600_VS_SHADER__SQ_VTX_SEMANTIC_31 31
-#define R600_VS_SHADER__SPI_VS_OUT_ID_0 32
-#define R600_VS_SHADER__SPI_VS_OUT_ID_1 33
-#define R600_VS_SHADER__SPI_VS_OUT_ID_2 34
-#define R600_VS_SHADER__SPI_VS_OUT_ID_3 35
-#define R600_VS_SHADER__SPI_VS_OUT_ID_4 36
-#define R600_VS_SHADER__SPI_VS_OUT_ID_5 37
-#define R600_VS_SHADER__SPI_VS_OUT_ID_6 38
-#define R600_VS_SHADER__SPI_VS_OUT_ID_7 39
-#define R600_VS_SHADER__SPI_VS_OUT_ID_8 40
-#define R600_VS_SHADER__SPI_VS_OUT_ID_9 41
-#define R600_VS_SHADER__SPI_VS_OUT_CONFIG 42
-#define R600_VS_SHADER__SQ_PGM_START_VS 43
-#define R600_VS_SHADER__SQ_PGM_RESOURCES_VS 44
-#define R600_VS_SHADER__SQ_PGM_START_FS 45
-#define R600_VS_SHADER__SQ_PGM_RESOURCES_FS 46
-#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_VS 47
-#define R600_VS_SHADER__SQ_PGM_CF_OFFSET_FS 48
-#define R600_VS_SHADER_SIZE 49
-#define R600_VS_SHADER_PM4 128
-/* R600_PS_SHADER */
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_0 0
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_1 1
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_2 2
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_3 3
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_4 4
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_5 5
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_6 6
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_7 7
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_8 8
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_9 9
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_10 10
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_11 11
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_12 12
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_13 13
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_14 14
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_15 15
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_16 16
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_17 17
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_18 18
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_19 19
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_20 20
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_21 21
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_22 22
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_23 23
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_24 24
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_25 25
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_26 26
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_27 27
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_28 28
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_29 29
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_30 30
-#define R600_PS_SHADER__SPI_PS_INPUT_CNTL_31 31
-#define R600_PS_SHADER__SPI_PS_IN_CONTROL_0 32
-#define R600_PS_SHADER__SPI_PS_IN_CONTROL_1 33
-#define R600_PS_SHADER__SPI_INPUT_Z 34
-#define R600_PS_SHADER__SQ_PGM_START_PS 35
-#define R600_PS_SHADER__SQ_PGM_RESOURCES_PS 36
-#define R600_PS_SHADER__SQ_PGM_EXPORTS_PS 37
-#define R600_PS_SHADER__SQ_PGM_CF_OFFSET_PS 38
-#define R600_PS_SHADER_SIZE 39
-#define R600_PS_SHADER_PM4 128
-/* R600_PS_CONSTANT */
-#define R600_PS_CONSTANT__SQ_ALU_CONSTANT0_0 0
-#define R600_PS_CONSTANT__SQ_ALU_CONSTANT1_0 1
-#define R600_PS_CONSTANT__SQ_ALU_CONSTANT2_0 2
-#define R600_PS_CONSTANT__SQ_ALU_CONSTANT3_0 3
-#define R600_PS_CONSTANT_SIZE 4
-#define R600_PS_CONSTANT_PM4 128
-/* R600_VS_CONSTANT */
-#define R600_VS_CONSTANT__SQ_ALU_CONSTANT0_256 0
-#define R600_VS_CONSTANT__SQ_ALU_CONSTANT1_256 1
-#define R600_VS_CONSTANT__SQ_ALU_CONSTANT2_256 2
-#define R600_VS_CONSTANT__SQ_ALU_CONSTANT3_256 3
-#define R600_VS_CONSTANT_SIZE 4
-#define R600_VS_CONSTANT_PM4 128
-/* R600_PS_RESOURCE */
-#define R600_PS_RESOURCE__RESOURCE0_WORD0 0
-#define R600_PS_RESOURCE__RESOURCE0_WORD1 1
-#define R600_PS_RESOURCE__RESOURCE0_WORD2 2
-#define R600_PS_RESOURCE__RESOURCE0_WORD3 3
-#define R600_PS_RESOURCE__RESOURCE0_WORD4 4
-#define R600_PS_RESOURCE__RESOURCE0_WORD5 5
-#define R600_PS_RESOURCE__RESOURCE0_WORD6 6
-#define R600_PS_RESOURCE_SIZE 7
-#define R600_PS_RESOURCE_PM4 128
-/* R600_VS_RESOURCE */
-#define R600_VS_RESOURCE__RESOURCE160_WORD0 0
-#define R600_VS_RESOURCE__RESOURCE160_WORD1 1
-#define R600_VS_RESOURCE__RESOURCE160_WORD2 2
-#define R600_VS_RESOURCE__RESOURCE160_WORD3 3
-#define R600_VS_RESOURCE__RESOURCE160_WORD4 4
-#define R600_VS_RESOURCE__RESOURCE160_WORD5 5
-#define R600_VS_RESOURCE__RESOURCE160_WORD6 6
-#define R600_VS_RESOURCE_SIZE 7
-#define R600_VS_RESOURCE_PM4 128
-/* R600_FS_RESOURCE */
-#define R600_FS_RESOURCE__RESOURCE320_WORD0 0
-#define R600_FS_RESOURCE__RESOURCE320_WORD1 1
-#define R600_FS_RESOURCE__RESOURCE320_WORD2 2
-#define R600_FS_RESOURCE__RESOURCE320_WORD3 3
-#define R600_FS_RESOURCE__RESOURCE320_WORD4 4
-#define R600_FS_RESOURCE__RESOURCE320_WORD5 5
-#define R600_FS_RESOURCE__RESOURCE320_WORD6 6
-#define R600_FS_RESOURCE_SIZE 7
-#define R600_FS_RESOURCE_PM4 128
-/* R600_GS_RESOURCE */
-#define R600_GS_RESOURCE__RESOURCE336_WORD0 0
-#define R600_GS_RESOURCE__RESOURCE336_WORD1 1
-#define R600_GS_RESOURCE__RESOURCE336_WORD2 2
-#define R600_GS_RESOURCE__RESOURCE336_WORD3 3
-#define R600_GS_RESOURCE__RESOURCE336_WORD4 4
-#define R600_GS_RESOURCE__RESOURCE336_WORD5 5
-#define R600_GS_RESOURCE__RESOURCE336_WORD6 6
-#define R600_GS_RESOURCE_SIZE 7
-#define R600_GS_RESOURCE_PM4 128
-/* R600_PS_SAMPLER */
-#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD0_0 0
-#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD1_0 1
-#define R600_PS_SAMPLER__SQ_TEX_SAMPLER_WORD2_0 2
-#define R600_PS_SAMPLER_SIZE 3
-#define R600_PS_SAMPLER_PM4 128
-/* R600_VS_SAMPLER */
-#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD0_18 0
-#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD1_18 1
-#define R600_VS_SAMPLER__SQ_TEX_SAMPLER_WORD2_18 2
-#define R600_VS_SAMPLER_SIZE 3
-#define R600_VS_SAMPLER_PM4 128
-/* R600_GS_SAMPLER */
-#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD0_36 0
-#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD1_36 1
-#define R600_GS_SAMPLER__SQ_TEX_SAMPLER_WORD2_36 2
-#define R600_GS_SAMPLER_SIZE 3
-#define R600_GS_SAMPLER_PM4 128
-/* R600_PS_SAMPLER_BORDER */
-#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_RED 0
-#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_GREEN 1
-#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_BLUE 2
-#define R600_PS_SAMPLER_BORDER__TD_PS_SAMPLER0_BORDER_ALPHA 3
-#define R600_PS_SAMPLER_BORDER_SIZE 4
-#define R600_PS_SAMPLER_BORDER_PM4 128
-/* R600_VS_SAMPLER_BORDER */
-#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_RED 0
-#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_GREEN 1
-#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_BLUE 2
-#define R600_VS_SAMPLER_BORDER__TD_VS_SAMPLER0_BORDER_ALPHA 3
-#define R600_VS_SAMPLER_BORDER_SIZE 4
-#define R600_VS_SAMPLER_BORDER_PM4 128
-/* R600_GS_SAMPLER_BORDER */
-#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_RED 0
-#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_GREEN 1
-#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_BLUE 2
-#define R600_GS_SAMPLER_BORDER__TD_GS_SAMPLER0_BORDER_ALPHA 3
-#define R600_GS_SAMPLER_BORDER_SIZE 4
-#define R600_GS_SAMPLER_BORDER_PM4 128
-/* R600_CB0 */
-#define R600_CB0__CB_COLOR0_BASE 0
-#define R600_CB0__CB_COLOR0_INFO 1
-#define R600_CB0__CB_COLOR0_SIZE 2
-#define R600_CB0__CB_COLOR0_VIEW 3
-#define R600_CB0__CB_COLOR0_FRAG 4
-#define R600_CB0__CB_COLOR0_TILE 5
-#define R600_CB0__CB_COLOR0_MASK 6
-#define R600_CB0_SIZE 7
-#define R600_CB0_PM4 128
-/* R600_DB */
-#define R600_DB__DB_DEPTH_BASE 0
-#define R600_DB__DB_DEPTH_SIZE 1
-#define R600_DB__DB_DEPTH_VIEW 2
-#define R600_DB__DB_DEPTH_INFO 3
-#define R600_DB__DB_HTILE_SURFACE 4
-#define R600_DB__DB_PREFETCH_LIMIT 5
-#define R600_DB_SIZE 6
-#define R600_DB_PM4 128
-/* R600_VGT */
-#define R600_VGT__VGT_PRIMITIVE_TYPE 0
-#define R600_VGT__VGT_MAX_VTX_INDX 1
-#define R600_VGT__VGT_MIN_VTX_INDX 2
-#define R600_VGT__VGT_INDX_OFFSET 3
-#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX 4
-#define R600_VGT__VGT_DMA_INDEX_TYPE 5
-#define R600_VGT__VGT_PRIMITIVEID_EN 6
-#define R600_VGT__VGT_DMA_NUM_INSTANCES 7
-#define R600_VGT__VGT_MULTI_PRIM_IB_RESET_EN 8
-#define R600_VGT__VGT_INSTANCE_STEP_RATE_0 9
-#define R600_VGT__VGT_INSTANCE_STEP_RATE_1 10
-#define R600_VGT_SIZE 11
-#define R600_VGT_PM4 128
-/* R600_DRAW */
-#define R600_DRAW__VGT_NUM_INDICES 0
-#define R600_DRAW__VGT_DMA_BASE_HI 1
-#define R600_DRAW__VGT_DMA_BASE 2
-#define R600_DRAW__VGT_DRAW_INITIATOR 3
-#define R600_DRAW_SIZE 4
-#define R600_DRAW_PM4 128
-/* R600_CLIP */
-#define R600_CLIP__PA_CL_UCP_X_0 0
-#define R600_CLIP__PA_CL_UCP_Y_0 1
-#define R600_CLIP__PA_CL_UCP_Z_0 2
-#define R600_CLIP__PA_CL_UCP_W_0 3
-#define R600_CLIP__PA_CL_UCP_X_1 4
-#define R600_CLIP__PA_CL_UCP_Y_1 5
-#define R600_CLIP__PA_CL_UCP_Z_1 6
-#define R600_CLIP__PA_CL_UCP_W_1 7
-#define R600_CLIP__PA_CL_UCP_X_2 8
-#define R600_CLIP__PA_CL_UCP_Y_2 9
-#define R600_CLIP__PA_CL_UCP_Z_2 10
-#define R600_CLIP__PA_CL_UCP_W_2 11
-#define R600_CLIP__PA_CL_UCP_X_3 12
-#define R600_CLIP__PA_CL_UCP_Y_3 13
-#define R600_CLIP__PA_CL_UCP_Z_3 14
-#define R600_CLIP__PA_CL_UCP_W_3 15
-#define R600_CLIP__PA_CL_UCP_X_4 16
-#define R600_CLIP__PA_CL_UCP_Y_4 17
-#define R600_CLIP__PA_CL_UCP_Z_4 18
-#define R600_CLIP__PA_CL_UCP_W_4 19
-#define R600_CLIP__PA_CL_UCP_X_5 20
-#define R600_CLIP__PA_CL_UCP_Y_5 21
-#define R600_CLIP__PA_CL_UCP_Z_5 22
-#define R600_CLIP__PA_CL_UCP_W_5 23
-#define R600_CLIP_SIZE 24
-#define R600_CLIP_PM4 128
+#include "r600_states_inc.h"
+#include "eg_states_inc.h"
+
/* R600 QUERY BEGIN/END */
#define R600_QUERY__OFFSET 0
#define R600_QUERY_SIZE 1
diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
index b9f32ee6a9..961df482c2 100644
--- a/src/gallium/drivers/rbug/rbug_screen.c
+++ b/src/gallium/drivers/rbug/rbug_screen.c
@@ -79,6 +79,17 @@ rbug_screen_get_param(struct pipe_screen *_screen,
param);
}
+static int
+rbug_screen_get_shader_param(struct pipe_screen *_screen,
+ unsigned shader, enum pipe_shader_cap param)
+{
+ struct rbug_screen *rb_screen = rbug_screen(_screen);
+ struct pipe_screen *screen = rb_screen->screen;
+
+ return screen->get_shader_param(screen, shader,
+ param);
+}
+
static float
rbug_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
@@ -317,6 +328,7 @@ rbug_screen_create(struct pipe_screen *screen)
rb_screen->base.get_name = rbug_screen_get_name;
rb_screen->base.get_vendor = rbug_screen_get_vendor;
rb_screen->base.get_param = rbug_screen_get_param;
+ rb_screen->base.get_shader_param = rbug_screen_get_shader_param;
rb_screen->base.get_paramf = rbug_screen_get_paramf;
rb_screen->base.is_format_supported = rbug_screen_is_format_supported;
rb_screen->base.context_create = rbug_screen_context_create;
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 73ae2dea56..2053d02f62 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -31,6 +31,7 @@
#include "util/u_format_s3tc.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "draw/draw_context.h"
#include "state_tracker/sw_winsys.h"
#include "tgsi/tgsi_exec.h"
@@ -98,14 +99,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return SP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return SP_MAX_TEXTURE_2D_LEVELS;
- case PIPE_CAP_TGSI_CONT_SUPPORTED:
- return 1;
case PIPE_CAP_BLEND_EQUATION_SEPARATE:
return 1;
- case PIPE_CAP_MAX_CONST_BUFFERS:
- return PIPE_MAX_CONSTANT_BUFFERS;
- case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
- return 4096 * 4 * sizeof(float);
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
@@ -117,46 +112,27 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1;
case PIPE_CAP_STREAM_OUTPUT:
return 1;
-
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- /* There is no limit in number of instructions beyond available memory */
- return 32768;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- return TGSI_EXEC_MAX_NESTING;
- case PIPE_CAP_MAX_VS_INPUTS:
- case PIPE_CAP_MAX_FS_INPUTS:
- return TGSI_EXEC_MAX_INPUT_ATTRIBS;
- case PIPE_CAP_MAX_FS_CONSTS:
- case PIPE_CAP_MAX_VS_CONSTS:
- return TGSI_EXEC_MAX_CONST_BUFFER;
- case PIPE_CAP_MAX_VS_TEMPS:
- case PIPE_CAP_MAX_FS_TEMPS:
- return TGSI_EXEC_NUM_TEMPS;
- case PIPE_CAP_MAX_VS_ADDRS:
- case PIPE_CAP_MAX_FS_ADDRS:
- return TGSI_EXEC_NUM_ADDRS;
- case PIPE_CAP_MAX_VS_PREDS:
- case PIPE_CAP_MAX_FS_PREDS:
- return TGSI_EXEC_NUM_PREDS;
-
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 0;
-
- case PIPE_CAP_GEOMETRY_SHADER4:
- return 1;
default:
return 0;
}
}
+static int
+softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ switch(shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ return tgsi_exec_get_shader_param(param);
+ case PIPE_SHADER_VERTEX:
+ case PIPE_SHADER_GEOMETRY:
+ return draw_get_shader_param(shader, param);
+ default:
+ return 0;
+ }
+}
static float
softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
@@ -320,6 +296,7 @@ softpipe_create_screen(struct sw_winsys *winsys)
screen->base.get_name = softpipe_get_name;
screen->base.get_vendor = softpipe_get_vendor;
screen->base.get_param = softpipe_get_param;
+ screen->base.get_shader_param = softpipe_get_shader_param;
screen->base.get_paramf = softpipe_get_paramf;
screen->base.is_format_supported = softpipe_is_format_supported;
screen->base.context_create = softpipe_create_context;
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 077ff9a2cf..b5fae94f78 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -180,57 +180,6 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 0;
- /*
- * Fragment shader limits
- */
-
- case PIPE_CAP_MAX_FS_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_FS_TEX_INDIRECTIONS:
- return svgascreen->use_ps30 ? 512 : 96;
- case PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH:
- return SVGA3D_MAX_NESTING_LEVEL;
- case PIPE_CAP_MAX_FS_INPUTS:
- return 10;
- case PIPE_CAP_MAX_FS_CONSTS:
- return svgascreen->use_vs30 ? 224 : 16;
- case PIPE_CAP_MAX_FS_TEMPS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
- return svgascreen->use_ps30 ? 32 : 12;
- return result.u;
- case PIPE_CAP_MAX_FS_ADDRS:
- return svgascreen->use_ps30 ? 1 : 0;
- case PIPE_CAP_MAX_FS_PREDS:
- return svgascreen->use_ps30 ? 1 : 0;
-
- /*
- * Vertex shader limits
- */
- case PIPE_CAP_MAX_VS_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
- return svgascreen->use_vs30 ? 512 : 256;
- return result.u;
- case PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS:
- case PIPE_CAP_MAX_VS_TEX_INDIRECTIONS:
- /* XXX: until we have vertex texture support */
- return 0;
- case PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH:
- return SVGA3D_MAX_NESTING_LEVEL;
- case PIPE_CAP_MAX_VS_INPUTS:
- return 16;
- case PIPE_CAP_MAX_VS_CONSTS:
- return 256;
- case PIPE_CAP_MAX_VS_TEMPS:
- if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
- return svgascreen->use_vs30 ? 32 : 12;
- return result.u;
- case PIPE_CAP_MAX_VS_ADDRS:
- return svgascreen->use_vs30 ? 1 : 0;
- case PIPE_CAP_MAX_VS_PREDS:
- return svgascreen->use_vs30 ? 1 : 0;
-
case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
return 1;
@@ -248,6 +197,81 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
return (int) svga_get_paramf( screen, param );
}
+static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+{
+ struct svga_screen *svgascreen = svga_screen(screen);
+ struct svga_winsys_screen *sws = svgascreen->sws;
+ SVGA3dDevCapResult result;
+
+ switch (shader)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ return svgascreen->use_ps30 ? 512 : 96;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 10;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return svgascreen->use_ps30 ? 224 : 16;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
+ return svgascreen->use_ps30 ? 32 : 12;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return svgascreen->use_ps30 ? 1 : 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return svgascreen->use_ps30 ? 1 : 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ }
+ break;
+ case PIPE_SHADER_VERTEX:
+ switch (param)
+ {
+ case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
+ return svgascreen->use_vs30 ? 512 : 256;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
+ case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
+ /* XXX: until we have vertex texture support */
+ return 0;
+ case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
+ return SVGA3D_MAX_NESTING_LEVEL;
+ case PIPE_SHADER_CAP_MAX_INPUTS:
+ return 16;
+ case PIPE_SHADER_CAP_MAX_CONSTS:
+ return 256;
+ case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
+ return 1;
+ case PIPE_SHADER_CAP_MAX_TEMPS:
+ if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
+ return svgascreen->use_vs30 ? 32 : 12;
+ return result.u;
+ case PIPE_SHADER_CAP_MAX_ADDRS:
+ return svgascreen->use_vs30 ? 1 : 0;
+ case PIPE_SHADER_CAP_MAX_PREDS:
+ return svgascreen->use_vs30 ? 1 : 0;
+ case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
+ return 1;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
static INLINE SVGA3dDevCapIndex
svga_translate_format_cap(enum pipe_format format)
@@ -449,6 +473,7 @@ svga_screen_create(struct svga_winsys_screen *sws)
screen->get_name = svga_get_name;
screen->get_vendor = svga_get_vendor;
screen->get_param = svga_get_param;
+ screen->get_shader_param = svga_get_shader_param;
screen->get_paramf = svga_get_paramf;
screen->is_format_supported = svga_is_format_supported;
screen->context_create = svga_context_create;
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 32e519a68a..935831071e 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -106,6 +106,30 @@ trace_screen_get_param(struct pipe_screen *_screen,
}
+static int
+trace_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader,
+ enum pipe_shader_cap param)
+{
+ struct trace_screen *tr_scr = trace_screen(_screen);
+ struct pipe_screen *screen = tr_scr->screen;
+ int result;
+
+ trace_dump_call_begin("pipe_screen", "get_shader_param");
+
+ trace_dump_arg(ptr, screen);
+ trace_dump_arg(int, shader);
+ trace_dump_arg(int, param);
+
+ result = screen->get_shader_param(screen, shader, param);
+
+ trace_dump_ret(int, result);
+
+ trace_dump_call_end();
+
+ return result;
+}
+
+
static float
trace_screen_get_paramf(struct pipe_screen *_screen,
enum pipe_cap param)
@@ -547,6 +571,7 @@ trace_screen_create(struct pipe_screen *screen)
tr_scr->base.get_name = trace_screen_get_name;
tr_scr->base.get_vendor = trace_screen_get_vendor;
tr_scr->base.get_param = trace_screen_get_param;
+ tr_scr->base.get_shader_param = trace_screen_get_shader_param;
tr_scr->base.get_paramf = trace_screen_get_paramf;
tr_scr->base.is_format_supported = trace_screen_is_format_supported;
assert(screen->context_create);
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index 0a5be43f6b..5020599591 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -35,6 +35,7 @@
#include <string.h>
#include <stddef.h>
#include <stdarg.h>
+#include <limits.h>
#if defined(_WIN32) && !defined(__WIN32__)
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 627b5ae538..8b4663742f 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -449,16 +449,12 @@ enum pipe_cap {
PIPE_CAP_TEXTURE_MIRROR_CLAMP,
PIPE_CAP_TEXTURE_MIRROR_REPEAT,
PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS,
- PIPE_CAP_TGSI_CONT_SUPPORTED,
PIPE_CAP_BLEND_EQUATION_SEPARATE,
PIPE_CAP_SM3, /*< Shader Model, supported */
PIPE_CAP_STREAM_OUTPUT,
- PIPE_CAP_MAX_PREDICATE_REGISTERS,
/** Maximum texture image units accessible from vertex and fragment shaders
* combined */
PIPE_CAP_MAX_COMBINED_SAMPLERS,
- PIPE_CAP_MAX_CONST_BUFFERS,
- PIPE_CAP_MAX_CONST_BUFFER_SIZE, /*< In bytes */
/** blend enables and write masks per rendertarget */
PIPE_CAP_INDEP_BLEND_ENABLE,
/** different blend funcs per rendertarget */
@@ -468,35 +464,25 @@ enum pipe_cap {
PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER,
PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER,
-
- /*
- * Shader limits.
- */
- PIPE_CAP_MAX_FS_INSTRUCTIONS,
- PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS,
- PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS,
- PIPE_CAP_MAX_FS_TEX_INDIRECTIONS,
- PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH,
- PIPE_CAP_MAX_FS_INPUTS,
- PIPE_CAP_MAX_FS_CONSTS,
- PIPE_CAP_MAX_FS_TEMPS,
- PIPE_CAP_MAX_FS_ADDRS,
- PIPE_CAP_MAX_FS_PREDS,
- PIPE_CAP_MAX_VS_INSTRUCTIONS,
- PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS,
- PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS,
- PIPE_CAP_MAX_VS_TEX_INDIRECTIONS,
- PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH,
- PIPE_CAP_MAX_VS_INPUTS,
- PIPE_CAP_MAX_VS_CONSTS,
- PIPE_CAP_MAX_VS_TEMPS,
- PIPE_CAP_MAX_VS_ADDRS,
- PIPE_CAP_MAX_VS_PREDS,
-
- PIPE_CAP_GEOMETRY_SHADER4,
PIPE_CAP_DEPTH_CLAMP
};
+/* Shader caps not specific to any single stage */
+enum pipe_shader_cap
+{
+ PIPE_SHADER_CAP_MAX_INSTRUCTIONS, /* if 0, it means the stage is unsupported */
+ PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS,
+ PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS,
+ PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH,
+ PIPE_SHADER_CAP_MAX_INPUTS,
+ PIPE_SHADER_CAP_MAX_CONSTS,
+ PIPE_SHADER_CAP_MAX_CONST_BUFFERS,
+ PIPE_SHADER_CAP_MAX_TEMPS,
+ PIPE_SHADER_CAP_MAX_ADDRS,
+ PIPE_SHADER_CAP_MAX_PREDS,
+ PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED,
+};
/**
* Referenced query flags.
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 21f428ed4a..912631242f 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -86,6 +86,12 @@ struct pipe_screen {
*/
float (*get_paramf)( struct pipe_screen *, enum pipe_cap param );
+ /**
+ * Query a per-shader-stage integer-valued capability/parameter/limit
+ * \param param one of PIPE_CAP_x
+ */
+ int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
+
struct pipe_context * (*context_create)( struct pipe_screen *,
void *priv );
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index c4bd17e92b..74488de17e 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -199,7 +199,7 @@ struct tgsi_property_data {
*
* For more information on semantics of opcodes and
* which APIs are known to use which opcodes, see
- * auxiliary/tgsi/tgsi-instruction-set.txt
+ * gallium/docs/source/tgsi.rst
*/
#define TGSI_OPCODE_ARL 0
#define TGSI_OPCODE_MOV 1
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 1142461188..8ea1554568 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -47,14 +47,29 @@
*/
enum st_api_type {
ST_API_OPENGL,
- ST_API_OPENGL_ES1,
- ST_API_OPENGL_ES2,
ST_API_OPENVG,
ST_API_COUNT
};
/**
+ * The profile of a context.
+ */
+enum st_profile_type
+{
+ ST_PROFILE_DEFAULT,
+ ST_PROFILE_OPENGL_CORE,
+ ST_PROFILE_OPENGL_ES1,
+ ST_PROFILE_OPENGL_ES2
+};
+
+/* for profile_mask in st_api */
+#define ST_PROFILE_DEFAULT_MASK (1 << ST_PROFILE_DEFAULT)
+#define ST_PROFILE_OPENGL_CORE_MASK (1 << ST_PROFILE_OPENGL_CORE)
+#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
+#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
+
+/**
* Used in st_context_iface->teximage.
*/
enum st_texture_type {
@@ -180,6 +195,37 @@ struct st_visual
};
/**
+ * Represent the attributes of a context.
+ */
+struct st_context_attribs
+{
+ /**
+ * The profile and minimal version to support.
+ *
+ * The valid profiles and versions are rendering API dependent. The latest
+ * version satisfying the request should be returned, unless
+ * forward_compatiible is true.
+ */
+ enum st_profile_type profile;
+ int major, minor;
+
+ /**
+ * Enable debugging.
+ */
+ boolean debug;
+
+ /**
+ * Return the exact version and disallow the use of deprecated features.
+ */
+ boolean forward_compatible;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+};
+
+/**
* Represent a windowing system drawable.
*
* The framebuffer is implemented by the state tracker manager and
@@ -357,6 +403,16 @@ struct st_manager
struct st_api
{
/**
+ * The supported rendering API.
+ */
+ enum st_api_type api;
+
+ /**
+ * The supported profiles. Tested with ST_PROFILE_*_MASK.
+ */
+ unsigned profile_mask;
+
+ /**
* Destroy the API.
*/
void (*destroy)(struct st_api *stapi);
@@ -373,13 +429,14 @@ struct st_api
*/
struct st_context_iface *(*create_context)(struct st_api *stapi,
struct st_manager *smapi,
- const struct st_visual *visual,
+ const struct st_context_attribs *attribs,
struct st_context_iface *stsharei);
/**
* Bind the context to the calling thread with draw and read as drawables.
*
- * The framebuffers might have different visuals than the context does.
+ * The framebuffers might be NULL, or might have different visuals than the
+ * context does.
*/
boolean (*make_current)(struct st_api *stapi,
struct st_context_iface *stctxi,
@@ -401,18 +458,4 @@ st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
return ((visual->buffer_mask & mask) == mask);
}
-/* these symbols may need to be dynamically lookup up */
-extern PUBLIC struct st_api * st_api_create_OpenGL(void);
-extern PUBLIC struct st_api * st_api_create_OpenGL_ES1(void);
-extern PUBLIC struct st_api * st_api_create_OpenGL_ES2(void);
-extern PUBLIC struct st_api * st_api_create_OpenVG(void);
-
-/**
- * The entry points of the state trackers.
- */
-#define ST_CREATE_OPENGL_SYMBOL "st_api_create_OpenGL"
-#define ST_CREATE_OPENGL_ES1_SYMBOL "st_api_create_OpenGL_ES1"
-#define ST_CREATE_OPENGL_ES2_SYMBOL "st_api_create_OpenGL_ES2"
-#define ST_CREATE_OPENVG_SYMBOL "st_api_create_OpenVG"
-
#endif /* _ST_API_H_ */
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index 203682ef33..22e1b6dd70 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -57,7 +57,20 @@ dri_create_context(gl_api api, const __GLcontextModes * visual,
struct st_api *stapi = screen->st_api;
struct dri_context *ctx = NULL;
struct st_context_iface *st_share = NULL;
- struct st_visual stvis;
+ struct st_context_attribs attribs;
+
+ memset(&attribs, 0, sizeof(attribs));
+ switch (api) {
+ case API_OPENGLES:
+ attribs.profile = ST_PROFILE_OPENGL_ES1;
+ break;
+ case API_OPENGLES2:
+ attribs.profile = ST_PROFILE_OPENGL_ES2;
+ break;
+ default:
+ attribs.profile = ST_PROFILE_DEFAULT;
+ break;
+ }
if (sharedContextPrivate) {
st_share = ((struct dri_context *)sharedContextPrivate)->st;
@@ -75,13 +88,22 @@ dri_create_context(gl_api api, const __GLcontextModes * visual,
driParseConfigFiles(&ctx->optionCache,
&screen->optionCache, sPriv->myNum, "dri");
- dri_fill_st_visual(&stvis, screen, visual);
- ctx->st = stapi->create_context(stapi, &screen->base, &stvis, st_share);
+ dri_fill_st_visual(&attribs.visual, screen, visual);
+ ctx->st = stapi->create_context(stapi, &screen->base, &attribs, st_share);
if (ctx->st == NULL)
goto fail;
ctx->st->st_manager_private = (void *) ctx;
-
- dri_init_extensions(ctx);
+ ctx->stapi = stapi;
+
+ /*
+ * libmesagallium.a that this state tracker will be linked to expects
+ * OpenGL's _glapi_table. That is, it expects libGL.so instead of
+ * libGLESv1_CM.so or libGLESv2.so. As there is no clean way to know the
+ * shared library the app links to, use the api as a simple check.
+ * It might be as well to simply remove this function call though.
+ */
+ if (api == API_OPENGL)
+ dri_init_extensions(ctx);
return GL_TRUE;
@@ -90,7 +112,7 @@ dri_create_context(gl_api api, const __GLcontextModes * visual,
ctx->st->destroy(ctx->st);
FREE(ctx);
- return FALSE;
+ return GL_FALSE;
}
void
@@ -119,14 +141,12 @@ GLboolean
dri_unbind_context(__DRIcontext * cPriv)
{
/* dri_util.c ensures cPriv is not null */
- struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_context *ctx = dri_context(cPriv);
- struct st_api *stapi = screen->st_api;
if (--ctx->bind_count == 0) {
- if (ctx->st == stapi->get_current(stapi)) {
+ if (ctx->st == ctx->stapi->get_current(ctx->stapi)) {
ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- stapi->make_current(stapi, NULL, NULL, NULL);
+ ctx->stapi->make_current(ctx->stapi, NULL, NULL, NULL);
}
}
@@ -139,12 +159,10 @@ dri_make_current(__DRIcontext * cPriv,
__DRIdrawable * driReadPriv)
{
/* dri_util.c ensures cPriv is not null */
- struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
struct dri_context *ctx = dri_context(cPriv);
- struct st_api *stapi = screen->st_api;
struct dri_drawable *draw = dri_drawable(driDrawPriv);
struct dri_drawable *read = dri_drawable(driReadPriv);
- struct st_context_iface *old_st = stapi->get_current(stapi);
+ struct st_context_iface *old_st = ctx->stapi->get_current(ctx->stapi);
if (old_st && old_st != ctx->st)
old_st->flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
@@ -160,7 +178,7 @@ dri_make_current(__DRIcontext * cPriv,
read->texture_stamp = driReadPriv->lastStamp - 1;
}
- stapi->make_current(stapi, ctx->st, &draw->base, &read->base);
+ ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
return GL_TRUE;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_context.h b/src/gallium/state_trackers/dri/common/dri_context.h
index 35b870a8a3..ffe9eba13c 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.h
+++ b/src/gallium/state_trackers/dri/common/dri_context.h
@@ -37,7 +37,8 @@
struct pipe_context;
struct pipe_fence;
-struct st_context;
+struct st_api;
+struct st_context_iface;
struct dri_drawable;
struct dri_context
@@ -58,6 +59,7 @@ struct dri_context
unsigned int bind_count;
/* gallium */
+ struct st_api *stapi;
struct st_context_iface *st;
/* hooks filled in by dri2 & drisw */
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 0ab4dd1893..475a96d196 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -378,8 +378,8 @@ dri_init_screen_helper(struct dri_screen *screen,
screen->base.get_egl_image = dri_get_egl_image;
screen->base.get_param = dri_get_param;
- screen->st_api = st_gl_api_create();
+ screen->st_api = st_gl_api_create();
if (!screen->st_api)
return NULL;
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 93f910a26d..596309bfbd 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -380,6 +380,92 @@ dri2_create_image_from_renderbuffer(__DRIcontext *context,
return NULL;
}
+static __DRIimage *
+dri2_create_image(__DRIscreen *_screen,
+ int width, int height, int format,
+ unsigned int use, void *loaderPrivate)
+{
+ struct dri_screen *screen = dri_screen(_screen);
+ __DRIimage *img;
+ struct pipe_resource templ;
+ unsigned tex_usage;
+ enum pipe_format pf;
+
+ tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW;
+
+ switch (format) {
+ case __DRI_IMAGE_FORMAT_RGB565:
+ pf = PIPE_FORMAT_B5G6R5_UNORM;
+ break;
+ case __DRI_IMAGE_FORMAT_XRGB8888:
+ pf = PIPE_FORMAT_B8G8R8X8_UNORM;
+ break;
+ case __DRI_IMAGE_FORMAT_ARGB8888:
+ pf = PIPE_FORMAT_B8G8R8A8_UNORM;
+ break;
+ default:
+ pf = PIPE_FORMAT_NONE;
+ break;
+ }
+ if (pf == PIPE_FORMAT_NONE)
+ return NULL;
+
+ img = CALLOC_STRUCT(__DRIimageRec);
+ if (!img)
+ return NULL;
+
+ memset(&templ, 0, sizeof(templ));
+ templ.bind = tex_usage;
+ templ.format = pf;
+ templ.target = PIPE_TEXTURE_2D;
+ templ.last_level = 0;
+ templ.width0 = width;
+ templ.height0 = height;
+ templ.depth0 = 1;
+
+ img->texture = screen->base.screen->resource_create(screen->base.screen, &templ);
+ if (!img->texture) {
+ FREE(img);
+ return NULL;
+ }
+
+ img->face = 0;
+ img->level = 0;
+ img->zslice = 0;
+
+ img->loader_private = loaderPrivate;
+ return img;
+}
+
+static GLboolean
+dri2_query_image(__DRIimage *image, int attrib, int *value)
+{
+ struct winsys_handle whandle;
+ memset(&whandle, 0, sizeof(whandle));
+
+ switch (attrib) {
+ case __DRI_IMAGE_ATTRIB_STRIDE:
+ image->texture->screen->resource_get_handle(image->texture->screen,
+ image->texture, &whandle);
+ *value = whandle.stride;
+ return GL_TRUE;
+ case __DRI_IMAGE_ATTRIB_HANDLE:
+ whandle.type = DRM_API_HANDLE_TYPE_KMS;
+ image->texture->screen->resource_get_handle(image->texture->screen,
+ image->texture, &whandle);
+ *value = whandle.handle;
+ return GL_TRUE;
+ case __DRI_IMAGE_ATTRIB_NAME:
+ whandle.type = DRM_API_HANDLE_TYPE_SHARED;
+ image->texture->screen->resource_get_handle(image->texture->screen,
+ image->texture, &whandle);
+ *value = whandle.handle;
+ return GL_TRUE;
+ default:
+ return GL_FALSE;
+ }
+}
+
static void
dri2_destroy_image(__DRIimage *img)
{
@@ -392,6 +478,8 @@ static struct __DRIimageExtensionRec dri2ImageExtension = {
dri2_create_image_from_name,
dri2_create_image_from_renderbuffer,
dri2_destroy_image,
+ dri2_create_image,
+ dri2_query_image,
};
/*
@@ -439,6 +527,14 @@ dri2_init_screen(__DRIscreen * sPriv)
if (!configs)
goto fail;
+ sPriv->api_mask = 0;
+ if (screen->st_api->profile_mask & ST_PROFILE_DEFAULT_MASK)
+ sPriv->api_mask |= 1 << __DRI_API_OPENGL;
+ if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES1_MASK)
+ sPriv->api_mask |= 1 << __DRI_API_GLES;
+ if (screen->st_api->profile_mask & ST_PROFILE_OPENGL_ES2_MASK)
+ sPriv->api_mask |= 1 << __DRI_API_GLES2;
+
screen->auto_fake_front = dri_with_format(sPriv);
screen->broken_invalidate = !sPriv->dri2.useInvalidate;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 4e653bdf3b..33a838fb79 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -502,13 +502,13 @@ egl_g3d_initialize(_EGLDriver *drv, _EGLDisplay *dpy,
goto fail;
}
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_DEFAULT_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES1))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES1_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENGL_ES2))
+ if (gdpy->loader->profile_masks[ST_API_OPENGL] & ST_PROFILE_OPENGL_ES2_MASK)
dpy->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
- if (gdpy->loader->api_mask & (1 << ST_API_OPENVG))
+ if (gdpy->loader->profile_masks[ST_API_OPENVG] & ST_PROFILE_DEFAULT_MASK)
dpy->ClientAPIsMask |= EGL_OPENVG_BIT;
gdpy->smapi = egl_g3d_create_st_manager(dpy);
@@ -567,7 +567,7 @@ egl_g3d_get_proc_address(_EGLDriver *drv, const char *procname)
if (procname && procname[0] == 'v' && procname[1] == 'g')
stapi = gdrv->loader->get_st_api(ST_API_OPENVG);
else if (procname && procname[0] == 'g' && procname[1] == 'l')
- stapi = gdrv->loader->guess_gl_api();
+ stapi = gdrv->loader->get_st_api(ST_API_OPENGL);
return (_EGLProc) ((stapi) ?
stapi->get_proc_address(stapi, procname) : NULL);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_api.c b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
index 3ec53653f4..c0164daf9c 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_api.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_api.c
@@ -43,19 +43,25 @@
* Return the state tracker for the given context.
*/
static struct st_api *
-egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
+egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx,
+ enum st_profile_type *profile)
{
struct egl_g3d_driver *gdrv = egl_g3d_driver(drv);
- EGLint idx = -1;
+ struct st_api *stapi;
+ EGLint api = -1;
+
+ *profile = ST_PROFILE_DEFAULT;
switch (ctx->ClientAPI) {
case EGL_OPENGL_ES_API:
switch (ctx->ClientVersion) {
case 1:
- idx = ST_API_OPENGL_ES1;
+ api = ST_API_OPENGL;
+ *profile = ST_PROFILE_OPENGL_ES1;
break;
case 2:
- idx = ST_API_OPENGL_ES2;
+ api = ST_API_OPENGL;
+ *profile = ST_PROFILE_OPENGL_ES2;
break;
default:
_eglLog(_EGL_WARNING, "unknown client version %d",
@@ -64,17 +70,31 @@ egl_g3d_choose_st(_EGLDriver *drv, _EGLContext *ctx)
}
break;
case EGL_OPENVG_API:
- idx = ST_API_OPENVG;
+ api = ST_API_OPENVG;
break;
case EGL_OPENGL_API:
- idx = ST_API_OPENGL;
+ api = ST_API_OPENGL;
break;
default:
_eglLog(_EGL_WARNING, "unknown client API 0x%04x", ctx->ClientAPI);
break;
}
- return (idx >= 0) ? gdrv->loader->get_st_api(idx) : NULL;
+ switch (api) {
+ case ST_API_OPENGL:
+ stapi = gdrv->loader->guess_gl_api(*profile);
+ break;
+ case ST_API_OPENVG:
+ stapi = gdrv->loader->get_st_api(api);
+ break;
+ default:
+ stapi = NULL;
+ break;
+ }
+ if (stapi && !(stapi->profile_mask & (1 << *profile)))
+ stapi = NULL;
+
+ return stapi;
}
static _EGLContext *
@@ -85,6 +105,7 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
struct egl_g3d_context *gshare = egl_g3d_context(share);
struct egl_g3d_config *gconf = egl_g3d_config(conf);
struct egl_g3d_context *gctx;
+ struct st_context_attribs stattribs;
gctx = CALLOC_STRUCT(egl_g3d_context);
if (!gctx) {
@@ -97,14 +118,18 @@ egl_g3d_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf,
return NULL;
}
- gctx->stapi = egl_g3d_choose_st(drv, &gctx->base);
+ memset(&stattribs, 0, sizeof(stattribs));
+ if (gconf)
+ stattribs.visual = gconf->stvis;
+
+ gctx->stapi = egl_g3d_choose_st(drv, &gctx->base, &stattribs.profile);
if (!gctx->stapi) {
FREE(gctx);
return NULL;
}
gctx->stctxi = gctx->stapi->create_context(gctx->stapi, gdpy->smapi,
- (gconf) ? &gconf->stvis : NULL, (gshare) ? gshare->stctxi : NULL);
+ &stattribs, (gshare) ? gshare->stctxi : NULL);
if (!gctx->stctxi) {
FREE(gctx);
return NULL;
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_loader.h b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
index c9141f8ad4..78bfe2131e 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_loader.h
@@ -37,9 +37,9 @@ struct pipe_screen;
struct sw_winsys;
struct egl_g3d_loader {
- uint api_mask;
+ uint profile_masks[ST_API_COUNT];
struct st_api *(*get_st_api)(enum st_api_type api);
- struct st_api *(*guess_gl_api)(void);
+ struct st_api *(*guess_gl_api)(enum st_profile_type profile);
struct pipe_screen *(*create_drm_screen)(const char *name, int fd);
struct pipe_screen *(*create_sw_screen)(struct sw_winsys *ws);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.h b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
index aa25cc042d..1f9f07895b 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.h
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.h
@@ -45,33 +45,4 @@ egl_g3d_create_st_framebuffer(_EGLSurface *surf);
void
egl_g3d_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);
-/**
- * Return the EGL_<api>_BIT of the st api.
- */
-static INLINE int
-egl_g3d_st_api_bit(enum st_api_type api)
-{
- int bit;
-
- switch (api) {
- case ST_API_OPENGL:
- bit = EGL_OPENGL_BIT;
- break;
- case ST_API_OPENGL_ES1:
- bit = EGL_OPENGL_ES_BIT;
- break;
- case ST_API_OPENGL_ES2:
- bit = EGL_OPENGL_ES2_BIT;
- break;
- case ST_API_OPENVG:
- bit = EGL_OPENVG_BIT;
- break;
- default:
- bit = 0;
- break;
- }
-
- return bit;
-}
-
#endif /* _EGL_G3D_ST_H_ */
diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c
index eb4ce74266..36d63c30d6 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_api.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_api.c
@@ -849,6 +849,7 @@ PUBLIC
XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
{
XMesaDisplay xmdpy = xmesa_init_display(v->display);
+ struct st_context_attribs attribs;
XMesaContext c;
if (!xmdpy)
@@ -863,8 +864,12 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
c->xm_buffer = NULL; /* set later by XMesaMakeCurrent */
c->xm_read_buffer = NULL;
+ memset(&attribs, 0, sizeof(attribs));
+ attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.visual = v->stvis;
+
c->st = stapi->create_context(stapi, xmdpy->smapi,
- &v->stvis, (share_list) ? share_list->st : NULL);
+ &attribs, (share_list) ? share_list->st : NULL);
if (c->st == NULL)
goto fail;
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 0f74b3f7aa..4c0ce07a6b 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -122,6 +122,7 @@ xmesa_st_framebuffer_copy_textures(struct st_framebuffer_iface *stfbi,
/**
* Remove outdated textures and create the requested ones.
+ * This is a helper used during framebuffer validation.
*/
static boolean
xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
@@ -193,6 +194,10 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
return TRUE;
}
+
+/**
+ * Called via st_framebuffer_iface::validate()
+ */
static boolean
xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
@@ -249,6 +254,9 @@ xmesa_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
return TRUE;
}
+/**
+ * Called via st_framebuffer_iface::flush_front()
+ */
static boolean
xmesa_st_framebuffer_flush_front(struct st_framebuffer_iface *stfbi,
enum st_attachment_type statt)
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index c2aa98b231..e7996741d1 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -341,13 +341,20 @@ vg_context_destroy(struct st_context_iface *stctxi)
static struct st_context_iface *
vg_api_create_context(struct st_api *stapi, struct st_manager *smapi,
- const struct st_visual *visual,
+ const struct st_context_attribs *attribs,
struct st_context_iface *shared_stctxi)
{
struct vg_context *shared_ctx = (struct vg_context *) shared_stctxi;
struct vg_context *ctx;
struct pipe_context *pipe;
+ if (!(stapi->profile_mask & (1 << attribs->profile)))
+ return NULL;
+
+ /* only 1.0 is supported */
+ if (attribs->major != 1 || attribs->minor > 0)
+ return NULL;
+
pipe = smapi->screen->context_create(smapi->screen, NULL);
if (!pipe)
return NULL;
@@ -528,6 +535,8 @@ vg_api_destroy(struct st_api *stapi)
}
static const struct st_api vg_api = {
+ ST_API_OPENVG,
+ ST_PROFILE_DEFAULT_MASK,
vg_api_destroy,
vg_api_get_proc_address,
vg_api_create_context,
diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c
index a0e14b9601..85878b4673 100644
--- a/src/gallium/state_trackers/wgl/stw_context.c
+++ b/src/gallium/state_trackers/wgl/stw_context.c
@@ -129,6 +129,7 @@ DrvCreateLayerContext(
{
int iPixelFormat;
const struct stw_pixelformat_info *pfi;
+ struct st_context_attribs attribs;
struct stw_context *ctx = NULL;
if(!stw_dev)
@@ -150,8 +151,12 @@ DrvCreateLayerContext(
ctx->hdc = hdc;
ctx->iPixelFormat = iPixelFormat;
+ memset(&attribs, 0, sizeof(attribs));
+ attribs.profile = ST_PROFILE_DEFAULT;
+ attribs.visual = pfi->stvis;
+
ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
- stw_dev->smapi, &pfi->stvis, NULL);
+ stw_dev->smapi, &attribs, NULL);
if (ctx->st == NULL)
goto no_st_ctx;
diff --git a/src/gallium/targets/egl-gdi/egl-static.c b/src/gallium/targets/egl-gdi/egl-static.c
index 4655d79117..da6e5ce339 100644
--- a/src/gallium/targets/egl-gdi/egl-static.c
+++ b/src/gallium/targets/egl-gdi/egl-static.c
@@ -35,27 +35,6 @@
static struct st_api *stapis[ST_API_COUNT];
-static uint
-get_api_mask(void)
-{
- uint api_mask = 0x0;
-
-#if FEATURE_GL
- api_mask |= 1 << ST_API_OPENGL;
-#endif
-#if FEATURE_ES1
- api_mask |= 1 << ST_API_OPENGL_ES1;
-#endif
-#if FEATURE_ES2
- api_mask |= 1 << ST_API_OPENGL_ES2;
-#endif
-#if FEATURE_VG
- api_mask |= 1 << ST_API_OPENVG;
-#endif
-
- return api_mask;
-}
-
static struct st_api *
get_st_api(enum st_api_type api)
{
@@ -66,28 +45,18 @@ get_st_api(enum st_api_type api)
return stapi;
switch (api) {
-#if FEATURE_GL
- case ST_API_OPENGL:
- stapi = st_gl_api_create();
- break;
-#endif
-#if FEATURE_ES1
- case ST_API_OPENGL_ES1:
- stapi = st_gl_api_create_es1();
- break;
-#endif
-#if FEATURE_ES2
- case ST_API_OPENGL_ES2:
- stapi = st_gl_api_create_es2();
- break;
+#if FEATURE_GL || FEATURE_ES1 || FEATURE_ES2
+ case ST_API_OPENGL:
+ stapi = st_gl_api_create();
+ break;
#endif
#if FEATURE_VG
- case ST_API_OPENVG:
- stapi = (struct st_api *) vg_api_get();
- break;
+ case ST_API_OPENVG:
+ stapi = (struct st_api *) vg_api_get();
+ break;
#endif
- default:
- break;
+ default:
+ break;
}
stapis[api] = stapi;
@@ -96,27 +65,9 @@ get_st_api(enum st_api_type api)
}
static struct st_api *
-guess_gl_api(void)
+guess_gl_api(enum st_profile_type profile)
{
- struct st_api *stapi = NULL;
-
-#if FEATURE_GL
- stapi = get_st_api(ST_API_OPENGL);
- if (stapi)
- return stapi;
-#endif
-#if FEATURE_ES1
- stapi = get_st_api(ST_API_OPENGL_ES1);
- if (stapi)
- return stapi;
-#endif
-#if FEATURE_ES2
- stapi = get_st_api(ST_API_OPENGL_ES2);
- if (stapi)
- return stapi;
-#endif
-
- return stapi;
+ return get_st_api(ST_API_OPENGL);
}
static struct pipe_screen *
@@ -140,10 +91,19 @@ create_sw_screen(struct sw_winsys *ws)
static void
init_loader(struct egl_g3d_loader *loader)
{
- if (loader->api_mask)
- return;
+#if FEATURE_GL
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_DEFAULT_MASK;
+#endif
+#if FEATURE_ES1
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES1_MASK;
+#endif
+#if FEATURE_ES2
+ loader->profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES2_MASK;
+#endif
+#if FEATURE_VG
+ loader->profile_masks[ST_API_OPENVG] |= ST_PROFILE_DEFAULT_MASK;
+#endif
- loader->api_mask = get_api_mask();
loader->get_st_api = get_st_api;
loader->guess_gl_api = guess_gl_api;
loader->create_drm_screen = create_drm_screen;
diff --git a/src/gallium/targets/egl/Makefile b/src/gallium/targets/egl/Makefile
index 2784fd0d10..78f7241199 100644
--- a/src/gallium/targets/egl/Makefile
+++ b/src/gallium/targets/egl/Makefile
@@ -126,7 +126,8 @@ endif
# OpenGL state tracker
GL_CPPFLAGS := -I$(TOP)/src/mesa $(API_DEFINES)
-GL_SYS := $(DRI_LIB_DEPS) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+# do not link to $(GL_LIB) as the it supports GLES too
+GL_SYS := $(DRI_LIB_DEPS)
GL_LIBS := $(TOP)/src/mesa/libmesagallium.a
# OpenGL ES 1.x state tracker
diff --git a/src/gallium/targets/egl/egl.c b/src/gallium/targets/egl/egl.c
index a573b21217..786d5d1105 100644
--- a/src/gallium/targets/egl/egl.c
+++ b/src/gallium/targets/egl/egl.c
@@ -37,6 +37,8 @@
#include "state_tracker/drm_driver.h"
#include "common/egl_g3d_loader.h"
+#include "egl.h"
+
struct egl_g3d_loader egl_g3d_loader;
static struct st_module {
@@ -98,6 +100,8 @@ load_st_module(struct st_module *stmod,
{
struct st_api *(*create_api)(void);
+ _eglLog(_EGL_DEBUG, "searching for st module %s", name);
+
stmod->name = loader_strdup(name);
if (stmod->name)
_eglSearchPathForEach(dlopen_st_module_cb, (void *) stmod);
@@ -180,14 +184,11 @@ load_pipe_module(struct pipe_module *pmod, const char *name)
}
}
- if (!pmod->drmdd)
- pmod->name = NULL;
-
return (pmod->drmdd != NULL);
}
static struct st_api *
-get_st_api(enum st_api_type api)
+get_st_api_full(enum st_api_type api, enum st_profile_type profile)
{
struct st_module *stmod = &st_modules[api];
const char *names[8], *symbol;
@@ -199,17 +200,19 @@ get_st_api(enum st_api_type api)
switch (api) {
case ST_API_OPENGL:
symbol = ST_CREATE_OPENGL_SYMBOL;
- names[count++] = "GL";
- break;
- case ST_API_OPENGL_ES1:
- symbol = ST_CREATE_OPENGL_ES1_SYMBOL;
- names[count++] = "GLESv1_CM";
- names[count++] = "GL";
- break;
- case ST_API_OPENGL_ES2:
- symbol = ST_CREATE_OPENGL_ES2_SYMBOL;
- names[count++] = "GLESv2";
- names[count++] = "GL";
+ switch (profile) {
+ case ST_PROFILE_OPENGL_ES1:
+ names[count++] = "GLESv1_CM";
+ names[count++] = "GL";
+ break;
+ case ST_PROFILE_OPENGL_ES2:
+ names[count++] = "GLESv2";
+ names[count++] = "GL";
+ break;
+ default:
+ names[count++] = "GL";
+ break;
+ }
break;
case ST_API_OPENVG:
symbol = ST_CREATE_OPENVG_SYMBOL;
@@ -230,7 +233,7 @@ get_st_api(enum st_api_type api)
}
if (!stmod->stapi) {
- EGLint level = (egl_g3d_loader.api_mask & (1 << api)) ?
+ EGLint level = (egl_g3d_loader.profile_masks[api]) ?
_EGL_WARNING : _EGL_DEBUG;
_eglLog(level, "unable to load " ST_PREFIX "%s" UTIL_DL_EXT, names[0]);
}
@@ -241,50 +244,31 @@ get_st_api(enum st_api_type api)
}
static struct st_api *
-guess_gl_api(void)
+get_st_api(enum st_api_type api)
{
- struct st_api *stapi;
- int gl_apis[] = {
- ST_API_OPENGL,
- ST_API_OPENGL_ES1,
- ST_API_OPENGL_ES2,
- -1
- };
- int i, api = -1;
-
- /* determine the api from the loaded libraries */
- for (i = 0; gl_apis[i] != -1; i++) {
- if (st_modules[gl_apis[i]].stapi) {
- api = gl_apis[i];
- break;
- }
- }
- /* determine the api from the linked libraries */
- if (api == -1) {
- struct util_dl_library *self = util_dl_open(NULL);
+ enum st_profile_type profile = ST_PROFILE_DEFAULT;
+
+ /* determine the profile from the linked libraries */
+ if (api == ST_API_OPENGL) {
+ struct util_dl_library *self;
+ self = util_dl_open(NULL);
if (self) {
- if (util_dl_get_proc_address(self, "glColor4d"))
- api = ST_API_OPENGL;
- else if (util_dl_get_proc_address(self, "glColor4x"))
- api = ST_API_OPENGL_ES1;
+ if (util_dl_get_proc_address(self, "glColor4x"))
+ profile = ST_PROFILE_OPENGL_ES1;
else if (util_dl_get_proc_address(self, "glShaderBinary"))
- api = ST_API_OPENGL_ES2;
+ profile = ST_PROFILE_OPENGL_ES2;
util_dl_close(self);
}
}
- stapi = (api != -1) ? get_st_api(api) : NULL;
- if (!stapi) {
- for (i = 0; gl_apis[i] != -1; i++) {
- api = gl_apis[i];
- stapi = get_st_api(api);
- if (stapi)
- break;
- }
- }
+ return get_st_api_full(api, profile);
+}
- return stapi;
+static struct st_api *
+guess_gl_api(enum st_profile_type profile)
+{
+ return get_st_api_full(ST_API_OPENGL, profile);
}
static struct pipe_module *
@@ -318,7 +302,7 @@ static struct pipe_screen *
create_drm_screen(const char *name, int fd)
{
struct pipe_module *pmod = get_pipe_module(name);
- return (pmod && pmod->drmdd->create_screen) ?
+ return (pmod && pmod->drmdd && pmod->drmdd->create_screen) ?
pmod->drmdd->create_screen(fd) : NULL;
}
@@ -333,23 +317,20 @@ create_sw_screen(struct sw_winsys *ws)
static const struct egl_g3d_loader *
loader_init(void)
{
- uint api_mask = 0x0;
-
/* TODO detect at runtime? */
#if FEATURE_GL
- api_mask |= 1 << ST_API_OPENGL;
+ egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_DEFAULT_MASK;
#endif
#if FEATURE_ES1
- api_mask |= 1 << ST_API_OPENGL_ES1;
+ egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES1_MASK;
#endif
#if FEATURE_ES2
- api_mask |= 1 << ST_API_OPENGL_ES2;
+ egl_g3d_loader.profile_masks[ST_API_OPENGL] |= ST_PROFILE_OPENGL_ES2_MASK;
#endif
#if FEATURE_VG
- api_mask |= 1 << ST_API_OPENVG;
+ egl_g3d_loader.profile_masks[ST_API_OPENVG] |= ST_PROFILE_DEFAULT_MASK;
#endif
- egl_g3d_loader.api_mask = api_mask;
egl_g3d_loader.get_st_api = get_st_api;
egl_g3d_loader.guess_gl_api = guess_gl_api;
egl_g3d_loader.create_drm_screen = create_drm_screen;
diff --git a/src/gallium/targets/egl/egl.h b/src/gallium/targets/egl/egl.h
new file mode 100644
index 0000000000..5fd0678540
--- /dev/null
+++ b/src/gallium/targets/egl/egl.h
@@ -0,0 +1,44 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.9
+ *
+ * Copyright (C) 2010 LunarG Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Chia-I Wu <olv@lunarg.com>
+ */
+
+#ifndef _EGL_H_
+#define _EGL_H_
+
+#include "pipe/p_compiler.h"
+#include "state_tracker/st_api.h"
+
+#define ST_CREATE_OPENGL_SYMBOL "st_api_create_OpenGL"
+#define ST_CREATE_OPENVG_SYMBOL "st_api_create_OpenVG"
+
+PUBLIC struct st_api *
+st_api_create_OpenGL(void);
+
+PUBLIC struct st_api *
+st_api_create_OpenVG(void);
+
+#endif /* _EGL_H_ */
diff --git a/src/gallium/targets/egl/st_GL.c b/src/gallium/targets/egl/st_GL.c
index 17b7bf9d48..c1df844aa4 100644
--- a/src/gallium/targets/egl/st_GL.c
+++ b/src/gallium/targets/egl/st_GL.c
@@ -1,26 +1,8 @@
#include "state_tracker/st_gl_api.h"
-#include "state_tracker/st_api.h"
+#include "egl.h"
-#if FEATURE_GL
PUBLIC struct st_api *
st_api_create_OpenGL(void)
{
return st_gl_api_create();
}
-#endif
-
-#if FEATURE_ES1
-PUBLIC struct st_api *
-st_api_create_OpenGL_ES1(void)
-{
- return st_gl_api_create_es1();
-}
-#endif
-
-#if FEATURE_ES2
-PUBLIC struct st_api *
-st_api_create_OpenGL_ES2(void)
-{
- return st_gl_api_create_es2();
-}
-#endif
diff --git a/src/gallium/targets/egl/st_GLESv1_CM.c b/src/gallium/targets/egl/st_GLESv1_CM.c
index c1652d5131..c1df844aa4 100644
--- a/src/gallium/targets/egl/st_GLESv1_CM.c
+++ b/src/gallium/targets/egl/st_GLESv1_CM.c
@@ -1,8 +1,8 @@
-#include "state_tracker/st_api.h"
#include "state_tracker/st_gl_api.h"
+#include "egl.h"
PUBLIC struct st_api *
-st_api_create_OpenGL_ES1(void)
+st_api_create_OpenGL(void)
{
- return st_gl_api_create_es1();
+ return st_gl_api_create();
}
diff --git a/src/gallium/targets/egl/st_GLESv2.c b/src/gallium/targets/egl/st_GLESv2.c
index 9c26989008..c1df844aa4 100644
--- a/src/gallium/targets/egl/st_GLESv2.c
+++ b/src/gallium/targets/egl/st_GLESv2.c
@@ -1,8 +1,8 @@
-#include "state_tracker/st_api.h"
#include "state_tracker/st_gl_api.h"
+#include "egl.h"
PUBLIC struct st_api *
-st_api_create_OpenGL_ES2(void)
+st_api_create_OpenGL(void)
{
- return st_gl_api_create_es2();
+ return st_gl_api_create();
}
diff --git a/src/gallium/targets/egl/st_OpenVG.c b/src/gallium/targets/egl/st_OpenVG.c
index e29a237479..d0bf4dbae9 100644
--- a/src/gallium/targets/egl/st_OpenVG.c
+++ b/src/gallium/targets/egl/st_OpenVG.c
@@ -1,5 +1,5 @@
-#include "state_tracker/st_api.h"
#include "vg_api.h"
+#include "egl.h"
PUBLIC struct st_api *
st_api_create_OpenVG(void)
diff --git a/src/gallium/targets/libgl-xlib/Makefile b/src/gallium/targets/libgl-xlib/Makefile
index fe0541543a..79e516a2a7 100644
--- a/src/gallium/targets/libgl-xlib/Makefile
+++ b/src/gallium/targets/libgl-xlib/Makefile
@@ -25,7 +25,8 @@ INCLUDE_DIRS = \
$(X11_CFLAGS)
DEFINES += \
- -DGALLIUM_SOFTPIPE
+ -DGALLIUM_SOFTPIPE \
+ -DGALLIUM_GALAHAD
#-DGALLIUM_CELL will be defined by the config */
XLIB_TARGET_SOURCES = \
@@ -50,6 +51,14 @@ LIBS = \
$(CELL_SPU_LIB) \
+# LLVM
+ifeq ($(MESA_LLVM),1)
+DEFINES += -DGALLIUM_LLVMPIPE
+GL_LIB_DEPS += $(LLVM_LIBS)
+LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+
.SUFFIXES : .cpp
.c.o:
@@ -68,7 +77,7 @@ $(TOP)/$(LIB_DIR)/gallium:
# Make the libGL.so library
$(TOP)/$(LIB_DIR)/gallium/$(GL_LIB_NAME): $(XLIB_TARGET_OBJECTS) $(LIBS) Makefile
$(TOP)/bin/mklib -o $(GL_LIB) \
- -linker "$(CXX)" \
+ -linker "$(CXX)" -ldflags '$(LDFLAGS)' \
-major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \
-cplusplus \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/libgl-xlib/SConscript b/src/gallium/targets/libgl-xlib/SConscript
index 88e216a65b..27b562e1d5 100644
--- a/src/gallium/targets/libgl-xlib/SConscript
+++ b/src/gallium/targets/libgl-xlib/SConscript
@@ -48,6 +48,10 @@ if True:
env.Append(CPPDEFINES = 'GALLIUM_SOFTPIPE')
env.Prepend(LIBS = [softpipe])
+if True:
+ env.Append(CPPDEFINES = 'GALLIUM_GALAHAD')
+ env.Prepend(LIBS = [galahad])
+
if env['llvm']:
env.Append(CPPDEFINES = 'GALLIUM_LLVMPIPE')
env.Tool('udis86')
diff --git a/src/gallium/targets/libgl-xlib/xlib.c b/src/gallium/targets/libgl-xlib/xlib.c
index 5a9c80c856..5914f63352 100644
--- a/src/gallium/targets/libgl-xlib/xlib.c
+++ b/src/gallium/targets/libgl-xlib/xlib.c
@@ -78,6 +78,10 @@ st_api_create_OpenGL()
#include "cell/ppu/cell_public.h"
#endif
+#ifdef GALLIUM_GALAHAD
+#include "galahad/glhd_public.h"
+#endif
+
static struct pipe_screen *
swrast_create_screen(struct sw_winsys *winsys)
{
@@ -112,6 +116,14 @@ swrast_create_screen(struct sw_winsys *winsys)
screen = softpipe_create_screen( winsys );
#endif
+#if defined(GALLIUM_GALAHAD)
+ if (screen) {
+ struct pipe_screen *galahad_screen = galahad_screen_create(screen);
+ if (galahad_screen)
+ screen = galahad_screen;
+ }
+#endif
+
return screen;
}
diff --git a/src/gallium/tests/graw/SConscript b/src/gallium/tests/graw/SConscript
index 860a17e13e..ffde61965b 100644
--- a/src/gallium/tests/graw/SConscript
+++ b/src/gallium/tests/graw/SConscript
@@ -25,6 +25,7 @@ progs = [
'fs-test',
'vs-test',
'gs-test',
+ 'shader-leak',
'tri-gs',
]
diff --git a/src/gallium/tests/graw/shader-leak.c b/src/gallium/tests/graw/shader-leak.c
new file mode 100644
index 0000000000..ec30871e82
--- /dev/null
+++ b/src/gallium/tests/graw/shader-leak.c
@@ -0,0 +1,266 @@
+/**
+ * Create shaders in a loop to test memory usage.
+ */
+
+#include <stdio.h>
+#include "state_tracker/graw.h"
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+
+#include "util/u_debug.h" /* debug_dump_surface_bmp() */
+#include "util/u_memory.h" /* Offset() */
+#include "util/u_draw_quad.h"
+
+
+static int num_iters = 100;
+
+
+enum pipe_format formats[] = {
+ PIPE_FORMAT_R8G8B8A8_UNORM,
+ PIPE_FORMAT_B8G8R8A8_UNORM,
+ PIPE_FORMAT_NONE
+};
+
+static const int WIDTH = 300;
+static const int HEIGHT = 300;
+
+static struct pipe_screen *screen = NULL;
+static struct pipe_context *ctx = NULL;
+static struct pipe_surface *surf = NULL;
+static void *window = NULL;
+
+struct vertex {
+ float position[4];
+ float color[4];
+};
+
+static struct vertex vertices[1] =
+{
+ {
+ { 0.0f, -0.9f, 0.0f, 1.0f },
+ { 1.0f, 0.0f, 0.0f, 1.0f }
+ }
+};
+
+
+
+
+static void set_viewport( float x, float y,
+ float width, float height,
+ float near, float far)
+{
+ float z = far;
+ float half_width = (float)width / 2.0f;
+ float half_height = (float)height / 2.0f;
+ float half_depth = ((float)far - (float)near) / 2.0f;
+ struct pipe_viewport_state vp;
+
+ vp.scale[0] = half_width;
+ vp.scale[1] = half_height;
+ vp.scale[2] = half_depth;
+ vp.scale[3] = 1.0f;
+
+ vp.translate[0] = half_width + x;
+ vp.translate[1] = half_height + y;
+ vp.translate[2] = half_depth + z;
+ vp.translate[3] = 0.0f;
+
+ ctx->set_viewport_state( ctx, &vp );
+}
+
+static void set_vertices( void )
+{
+ struct pipe_vertex_element ve[2];
+ struct pipe_vertex_buffer vbuf;
+ void *handle;
+
+ memset(ve, 0, sizeof ve);
+
+ ve[0].src_offset = Offset(struct vertex, position);
+ ve[0].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+ ve[1].src_offset = Offset(struct vertex, color);
+ ve[1].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
+
+ handle = ctx->create_vertex_elements_state(ctx, 2, ve);
+ ctx->bind_vertex_elements_state(ctx, handle);
+
+
+ vbuf.stride = sizeof(struct vertex);
+ vbuf.max_index = sizeof(vertices) / vbuf.stride;
+ vbuf.buffer_offset = 0;
+ vbuf.buffer = screen->user_buffer_create(screen,
+ vertices,
+ sizeof(vertices),
+ PIPE_BIND_VERTEX_BUFFER);
+
+ ctx->set_vertex_buffers(ctx, 1, &vbuf);
+}
+
+static void set_vertex_shader( void )
+{
+ void *handle;
+ const char *text =
+ "VERT\n"
+ "DCL IN[0]\n"
+ "DCL IN[1]\n"
+ "DCL OUT[0], POSITION\n"
+ "DCL OUT[1], COLOR\n"
+ " 0: MOV OUT[1], IN[1]\n"
+ " 1: MOV OUT[0], IN[0]\n"
+ " 2: END\n";
+
+ handle = graw_parse_vertex_shader(ctx, text);
+ ctx->bind_vs_state(ctx, handle);
+}
+
+
+
+static void *
+set_fragment_shader( void )
+{
+ void *handle;
+ const char *text =
+ "FRAG\n"
+ "DCL IN[0], COLOR, LINEAR\n"
+ "DCL OUT[0], COLOR\n"
+ "DCL TEMP[0..1]\n"
+ " 0: MUL TEMP[0], IN[0], IN[0]\n"
+ " 1: ADD TEMP[1], IN[0], IN[0]\n"
+ " 2: SUB OUT[0], TEMP[0], TEMP[1]\n"
+ " 3: END\n";
+
+ handle = graw_parse_fragment_shader(ctx, text);
+ return handle;
+}
+
+
+static void draw( void )
+{
+ float clear_color[4] = {0, 0, 0, 1};
+ int i;
+
+ printf("Creating %d shaders\n", num_iters);
+
+ for (i = 0; i < num_iters; i++) {
+ void *fs = set_fragment_shader();
+
+ ctx->bind_fs_state(ctx, fs);
+
+ ctx->clear(ctx, PIPE_CLEAR_COLOR, clear_color, 0, 0);
+ util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1);
+ ctx->flush(ctx, PIPE_FLUSH_RENDER_CACHE, NULL);
+
+ ctx->bind_fs_state(ctx, NULL);
+ ctx->delete_fs_state(ctx, fs);
+ }
+
+ screen->flush_frontbuffer(screen, surf, window);
+ ctx->destroy(ctx);
+
+ exit(0);
+}
+
+
+static void init( void )
+{
+ struct pipe_framebuffer_state fb;
+ struct pipe_resource *tex, templat;
+ int i;
+
+ /* It's hard to say whether window or screen should be created
+ * first. Different environments would prefer one or the other.
+ *
+ * Also, no easy way of querying supported formats if the screen
+ * cannot be created first.
+ */
+ for (i = 0;
+ window == NULL && formats[i] != PIPE_FORMAT_NONE;
+ i++) {
+
+ screen = graw_create_window_and_screen(0,0,300,300,
+ formats[i],
+ &window);
+ }
+
+ ctx = screen->context_create(screen, NULL);
+ if (ctx == NULL)
+ exit(3);
+
+ templat.target = PIPE_TEXTURE_2D;
+ templat.format = formats[i];
+ templat.width0 = WIDTH;
+ templat.height0 = HEIGHT;
+ templat.depth0 = 1;
+ templat.last_level = 0;
+ templat.nr_samples = 1;
+ templat.bind = (PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_DISPLAY_TARGET);
+
+ tex = screen->resource_create(screen, &templat);
+ if (tex == NULL) {
+ fprintf(stderr, "Unable to create screen texture!\n");
+ exit(4);
+ }
+
+ surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
+ PIPE_BIND_RENDER_TARGET |
+ PIPE_BIND_DISPLAY_TARGET);
+ if (surf == NULL)
+ exit(5);
+
+ memset(&fb, 0, sizeof fb);
+ fb.nr_cbufs = 1;
+ fb.width = WIDTH;
+ fb.height = HEIGHT;
+ fb.cbufs[0] = surf;
+
+ ctx->set_framebuffer_state(ctx, &fb);
+
+ {
+ struct pipe_blend_state blend;
+ void *handle;
+ memset(&blend, 0, sizeof blend);
+ blend.rt[0].colormask = PIPE_MASK_RGBA;
+ handle = ctx->create_blend_state(ctx, &blend);
+ ctx->bind_blend_state(ctx, handle);
+ }
+
+ {
+ struct pipe_depth_stencil_alpha_state depthstencil;
+ void *handle;
+ memset(&depthstencil, 0, sizeof depthstencil);
+ handle = ctx->create_depth_stencil_alpha_state(ctx, &depthstencil);
+ ctx->bind_depth_stencil_alpha_state(ctx, handle);
+ }
+
+ {
+ struct pipe_rasterizer_state rasterizer;
+ void *handle;
+ memset(&rasterizer, 0, sizeof rasterizer);
+ rasterizer.cull_face = PIPE_FACE_NONE;
+ rasterizer.gl_rasterization_rules = 1;
+ handle = ctx->create_rasterizer_state(ctx, &rasterizer);
+ ctx->bind_rasterizer_state(ctx, handle);
+ }
+
+ set_viewport(0, 0, WIDTH, HEIGHT, 30, 1000);
+ set_vertices();
+ set_vertex_shader();
+ if (0)
+ set_fragment_shader();
+}
+
+
+int main( int argc, char *argv[] )
+{
+ if (argc > 1)
+ num_iters = atoi(argv[1]);
+
+ init();
+
+ graw_set_display_func( draw );
+ graw_main_loop();
+ return 0;
+}
diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c
index 4dbd2c062a..f7e39588a4 100644
--- a/src/gallium/tests/graw/tri.c
+++ b/src/gallium/tests/graw/tri.c
@@ -2,6 +2,8 @@
* any utility code, just the graw interface and gallium.
*/
+#include <stdio.h>
+
#include "state_tracker/graw.h"
#include "pipe/p_screen.h"
#include "pipe/p_context.h"
@@ -31,16 +33,19 @@ struct vertex {
float color[4];
};
-static struct vertex vertices[4] =
+static struct vertex vertices[3] =
{
- { { 0.0f, -0.9f, 0.0f, 1.0f },
- { 1.0f, 0.0f, 0.0f, 1.0f }
+ {
+ { 0.0f, -0.9f, 0.0f, 1.0f },
+ { 1.0f, 0.0f, 0.0f, 1.0f }
},
- { { -0.9f, 0.9f, 0.0f, 1.0f },
- { 0.0f, 1.0f, 0.0f, 1.0f }
+ {
+ { -0.9f, 0.9f, 0.0f, 1.0f },
+ { 0.0f, 1.0f, 0.0f, 1.0f }
},
- { { 0.9f, 0.9f, 0.0f, 1.0f },
- { 0.0f, 0.0f, 1.0f, 1.0f }
+ {
+ { 0.9f, 0.9f, 0.0f, 1.0f },
+ { 0.0f, 0.0f, 1.0f, 1.0f }
}
};
@@ -176,8 +181,10 @@ static void init( void )
}
ctx = screen->context_create(screen, NULL);
- if (ctx == NULL)
+ if (ctx == NULL) {
+ fprintf(stderr, "Unable to create context!\n");
exit(3);
+ }
templat.target = PIPE_TEXTURE_2D;
templat.format = formats[i];
@@ -191,14 +198,18 @@ static void init( void )
tex = screen->resource_create(screen,
&templat);
- if (tex == NULL)
+ if (tex == NULL) {
+ fprintf(stderr, "Unable to create screen texture!\n");
exit(4);
+ }
surf = screen->get_tex_surface(screen, tex, 0, 0, 0,
PIPE_BIND_RENDER_TARGET |
PIPE_BIND_DISPLAY_TARGET);
- if (surf == NULL)
+ if (surf == NULL) {
+ fprintf(stderr, "Unable to get tex surface!\n");
exit(5);
+ }
memset(&fb, 0, sizeof fb);
fb.nr_cbufs = 1;
diff --git a/src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh b/src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh
new file mode 100644
index 0000000000..583b0ca4a4
--- /dev/null
+++ b/src/gallium/tests/python/tests/regress/fragment-shader/frag-kil.sh
@@ -0,0 +1,18 @@
+FRAG
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+IMM FLT32 { 0.01, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+MOV OUT[0].w, IMM[2].xxxx
+SUB TEMP[0], TEMP[0], IMM[1].xxxy
+KIL TEMP[0]
+
+END
diff --git a/src/gallium/tests/unit/Makefile b/src/gallium/tests/unit/Makefile
index 345bd1f694..bb3039f3bc 100644
--- a/src/gallium/tests/unit/Makefile
+++ b/src/gallium/tests/unit/Makefile
@@ -23,6 +23,7 @@ SOURCES = \
u_cache_test.c \
u_half_test.c \
u_format_test.c \
+ u_format_compatible_test.c \
translate_test.c
diff --git a/src/gallium/tests/unit/SConscript b/src/gallium/tests/unit/SConscript
index edc68e34d9..359759e22b 100644
--- a/src/gallium/tests/unit/SConscript
+++ b/src/gallium/tests/unit/SConscript
@@ -14,6 +14,7 @@ progs = [
'pipe_barrier_test',
'u_cache_test',
'u_format_test',
+ 'u_format_compatible_test',
'u_half_test',
'translate_test'
]
diff --git a/src/gallium/tests/unit/u_format_compatible_test.c b/src/gallium/tests/unit/u_format_compatible_test.c
new file mode 100644
index 0000000000..c655c35f20
--- /dev/null
+++ b/src/gallium/tests/unit/u_format_compatible_test.c
@@ -0,0 +1,76 @@
+/**************************************************************************
+ *
+ * Copyright 2009-2010 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "util/u_format.h"
+
+
+static boolean
+test_all(void)
+{
+ enum pipe_format src_format;
+ enum pipe_format dst_format;
+
+ for (src_format = 1; src_format < PIPE_FORMAT_COUNT; ++src_format) {
+ const struct util_format_description *src_format_desc;
+ src_format_desc = util_format_description(src_format);
+ if (!src_format_desc) {
+ continue;
+ }
+
+ for (dst_format = 1; dst_format < PIPE_FORMAT_COUNT; ++dst_format) {
+ const struct util_format_description *dst_format_desc;
+ dst_format_desc = util_format_description(dst_format);
+ if (!dst_format_desc) {
+ continue;
+ }
+
+ if (dst_format == src_format) {
+ continue;
+ }
+
+ if (util_is_format_compatible(src_format_desc, dst_format_desc)) {
+ debug_printf("%s -> %s\n", src_format_desc->short_name, dst_format_desc->short_name);
+ }
+ }
+ }
+
+ return TRUE;
+}
+
+
+int main(int argc, char **argv)
+{
+ boolean success;
+
+ success = test_all();
+
+ return success ? 0 : 1;
+}
diff --git a/src/gallium/winsys/r600/drm/eg_states.h b/src/gallium/winsys/r600/drm/eg_states.h
new file mode 100644
index 0000000000..c26ba6c6cd
--- /dev/null
+++ b/src/gallium/winsys/r600/drm/eg_states.h
@@ -0,0 +1,449 @@
+/*
+ * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef EG_STATES_H
+#define EG_STATES_H
+
+static const struct radeon_register EG_names_CONFIG[] = {
+ {0x00008C00, 0, 0, "SQ_CONFIG"},
+ {0x00009100, 0, 0, "SPI_CONFIG_CNTL"},
+ {0x0000913C, 0, 0, "SPI_CONFIG_CNTL_1"},
+ {0x00008C04, 0, 0, "SQ_GPR_RESOURCE_MGMT_1"},
+ {0x00008C08, 0, 0, "SQ_GPR_RESOURCE_MGMT_2"},
+ {0x00008C0C, 0, 0, "SQ_GPR_RESOURCE_MGMT_3"},
+ {0x00008C18, 0, 0, "SQ_THREAD_RESOURCE_MGMT_1"},
+ {0x00008C1C, 0, 0, "SQ_THREAD_RESOURCE_MGMT_2"},
+ {0x00008C20, 0, 0, "SQ_STACK_RESOURCE_MGMT_1"},
+ {0x00008C24, 0, 0, "SQ_STACK_RESOURCE_MGMT_2"},
+ {0x00008C28, 0, 0, "SQ_STACK_RESOURCE_MGMT_3"},
+ {0x00008D8C, 0, 0, "SQ_DYN_GPR_CNTL_PS_FLUSH_REQ"},
+ {0x00008A14, 0, 0, "PA_CL_ENHANCE"},
+ {0x00028838, 0, 0, "SQ_DYN_GPR_RESOURCE_LIMIT_1"},
+ {0x000288EC, 0, 0, "SQ_LDS_ALLOC_PS"},
+ {0x00028350, 0, 0, "SX_MISC"},
+ {0x00028900, 0, 0, "SQ_ESGS_RING_ITEMSIZE"},
+ {0x00028904, 0, 0, "SQ_GSVS_RING_ITEMSIZE"},
+ {0x00028908, 0, 0, "SQ_ESTMP_RING_ITEMSIZE"},
+ {0x0002890C, 0, 0, "SQ_GSTMP_RING_ITEMSIZE"},
+ {0x00028910, 0, 0, "SQ_VSTMP_RING_ITEMSIZE"},
+ {0x00028914, 0, 0, "SQ_PSTMP_RING_ITEMSIZE"},
+ {0x0002891C, 0, 0, "SQ_GS_VERT_ITEMSIZE"},
+ {0x00028920, 0, 0, "SQ_GS_VERT_ITEMSIZE_1"},
+ {0x00028924, 0, 0, "SQ_GS_VERT_ITEMSIZE_2"},
+ {0x00028928, 0, 0, "SQ_GS_VERT_ITEMSIZE_3"},
+ {0x00028A10, 0, 0, "VGT_OUTPUT_PATH_CNTL"},
+ {0x00028A14, 0, 0, "VGT_HOS_CNTL"},
+ {0x00028A18, 0, 0, "VGT_HOS_MAX_TESS_LEVEL"},
+ {0x00028A1C, 0, 0, "VGT_HOS_MIN_TESS_LEVEL"},
+ {0x00028A20, 0, 0, "VGT_HOS_REUSE_DEPTH"},
+ {0x00028A24, 0, 0, "VGT_GROUP_PRIM_TYPE"},
+ {0x00028A28, 0, 0, "VGT_GROUP_FIRST_DECR"},
+ {0x00028A2C, 0, 0, "VGT_GROUP_DECR"},
+ {0x00028A30, 0, 0, "VGT_GROUP_VECT_0_CNTL"},
+ {0x00028A34, 0, 0, "VGT_GROUP_VECT_1_CNTL"},
+ {0x00028A38, 0, 0, "VGT_GROUP_VECT_0_FMT_CNTL"},
+ {0x00028A3C, 0, 0, "VGT_GROUP_VECT_1_FMT_CNTL"},
+ {0x00028A40, 0, 0, "VGT_GS_MODE"},
+ {0x00028A48, 0, 0, "PA_SC_MODE_CNTL_0"},
+ {0x00028A4C, 0, 0, "PA_SC_MODE_CNTL_1"},
+ {0x00028AB4, 0, 0, "VGT_REUSE_OFF"},
+ {0x00028AB8, 0, 0, "VGT_VTX_CNT_EN"},
+ {0x00028B54, 0, 0, "VGT_SHADER_STAGES_EN"},
+ {0x00028B94, 0, 0, "VGT_STRMOUT_CONFIG"},
+ {0x00028B98, 0, 0, "VGT_STRMOUT_BUFFER_CONFIG"},
+};
+
+static const struct radeon_register EG_names_CB_CNTL[] = {
+ {0x00028238, 0, 0, "CB_TARGET_MASK"},
+ {0x0002823C, 0, 0, "CB_SHADER_MASK"},
+ {0x00028808, 0, 0, "CB_COLOR_CONTROL"},
+ {0x00028C04, 0, 0, "PA_SC_AA_CONFIG"},
+ {0x00028C1C, 0, 0, "PA_SC_AA_SAMPLE_LOCS_MCTX"},
+ {0x00028C3C, 0, 0, "PA_SC_AA_MASK"},
+};
+
+static const struct radeon_register EG_names_RASTERIZER[] = {
+ {0x000286D4, 0, 0, "SPI_INTERP_CONTROL_0"},
+ {0x00028810, 0, 0, "PA_CL_CLIP_CNTL"},
+ {0x00028814, 0, 0, "PA_SU_SC_MODE_CNTL"},
+ {0x0002881C, 0, 0, "PA_CL_VS_OUT_CNTL"},
+ {0x00028820, 0, 0, "PA_CL_NANINF_CNTL"},
+ {0x00028A00, 0, 0, "PA_SU_POINT_SIZE"},
+ {0x00028A04, 0, 0, "PA_SU_POINT_MINMAX"},
+ {0x00028A08, 0, 0, "PA_SU_LINE_CNTL"},
+ {0x00028A48, 0, 0, "PA_SC_MPASS_PS_CNTL"},
+ {0x00028C00, 0, 0, "PA_SC_LINE_CNTL"},
+ {0x00028C08, 0, 0, "PA_SU_VTX_CNTL"},
+ {0x00028C0C, 0, 0, "PA_CL_GB_VERT_CLIP_ADJ"},
+ {0x00028C10, 0, 0, "PA_CL_GB_VERT_DISC_ADJ"},
+ {0x00028C14, 0, 0, "PA_CL_GB_HORZ_CLIP_ADJ"},
+ {0x00028C18, 0, 0, "PA_CL_GB_HORZ_DISC_ADJ"},
+ {0x00028B78, 0, 0, "PA_SU_POLY_OFFSET_DB_FMT_CNTL"},
+ {0x00028B7C, 0, 0, "PA_SU_POLY_OFFSET_CLAMP"},
+ {0x00028B80, 0, 0, "PA_SU_POLY_OFFSET_FRONT_SCALE"},
+ {0x00028B84, 0, 0, "PA_SU_POLY_OFFSET_FRONT_OFFSET"},
+ {0x00028B88, 0, 0, "PA_SU_POLY_OFFSET_BACK_SCALE"},
+ {0x00028B8C, 0, 0, "PA_SU_POLY_OFFSET_BACK_OFFSET"},
+};
+
+/* Viewport states are same as r600 */
+static const struct radeon_register EG_names_VIEWPORT[] = {
+ {0x000282D0, 0, 0, "PA_SC_VPORT_ZMIN_0"},
+ {0x000282D4, 0, 0, "PA_SC_VPORT_ZMAX_0"},
+ {0x0002843C, 0, 0, "PA_CL_VPORT_XSCALE_0"},
+ {0x00028444, 0, 0, "PA_CL_VPORT_YSCALE_0"},
+ {0x0002844C, 0, 0, "PA_CL_VPORT_ZSCALE_0"},
+ {0x00028440, 0, 0, "PA_CL_VPORT_XOFFSET_0"},
+ {0x00028448, 0, 0, "PA_CL_VPORT_YOFFSET_0"},
+ {0x00028450, 0, 0, "PA_CL_VPORT_ZOFFSET_0"},
+ {0x00028818, 0, 0, "PA_CL_VTE_CNTL"},
+};
+
+/* scissor is same as R600 */
+static const struct radeon_register EG_names_SCISSOR[] = {
+ {0x00028030, 0, 0, "PA_SC_SCREEN_SCISSOR_TL"},
+ {0x00028034, 0, 0, "PA_SC_SCREEN_SCISSOR_BR"},
+ {0x00028200, 0, 0, "PA_SC_WINDOW_OFFSET"},
+ {0x00028204, 0, 0, "PA_SC_WINDOW_SCISSOR_TL"},
+ {0x00028208, 0, 0, "PA_SC_WINDOW_SCISSOR_BR"},
+ {0x0002820C, 0, 0, "PA_SC_CLIPRECT_RULE"},
+ {0x00028210, 0, 0, "PA_SC_CLIPRECT_0_TL"},
+ {0x00028214, 0, 0, "PA_SC_CLIPRECT_0_BR"},
+ {0x00028218, 0, 0, "PA_SC_CLIPRECT_1_TL"},
+ {0x0002821C, 0, 0, "PA_SC_CLIPRECT_1_BR"},
+ {0x00028220, 0, 0, "PA_SC_CLIPRECT_2_TL"},
+ {0x00028224, 0, 0, "PA_SC_CLIPRECT_2_BR"},
+ {0x00028228, 0, 0, "PA_SC_CLIPRECT_3_TL"},
+ {0x0002822C, 0, 0, "PA_SC_CLIPRECT_3_BR"},
+ {0x00028230, 0, 0, "PA_SC_EDGERULE"},
+ {0x00028240, 0, 0, "PA_SC_GENERIC_SCISSOR_TL"},
+ {0x00028244, 0, 0, "PA_SC_GENERIC_SCISSOR_BR"},
+ {0x00028250, 0, 0, "PA_SC_VPORT_SCISSOR_0_TL"},
+ {0x00028254, 0, 0, "PA_SC_VPORT_SCISSOR_0_BR"},
+ {0x00028234, 0, 0, "PA_SU_HARDWARE_SCREEN_OFFSET"},
+};
+
+/* same as r700 i.e. no blend control */
+static const struct radeon_register EG_names_BLEND[] = {
+ {0x00028414, 0, 0, "CB_BLEND_RED"},
+ {0x00028418, 0, 0, "CB_BLEND_GREEN"},
+ {0x0002841C, 0, 0, "CB_BLEND_BLUE"},
+ {0x00028420, 0, 0, "CB_BLEND_ALPHA"},
+ {0x00028780, 0, 0, "CB_BLEND0_CONTROL"},
+ {0x00028784, 0, 0, "CB_BLEND1_CONTROL"},
+ {0x00028788, 0, 0, "CB_BLEND2_CONTROL"},
+ {0x0002878C, 0, 0, "CB_BLEND3_CONTROL"},
+ {0x00028790, 0, 0, "CB_BLEND4_CONTROL"},
+ {0x00028794, 0, 0, "CB_BLEND5_CONTROL"},
+ {0x00028798, 0, 0, "CB_BLEND6_CONTROL"},
+ {0x0002879C, 0, 0, "CB_BLEND7_CONTROL"},
+};
+
+/* different */
+static const struct radeon_register EG_names_DSA[] = {
+ {0x00028028, 0, 0, "DB_STENCIL_CLEAR"},
+ {0x0002802C, 0, 0, "DB_DEPTH_CLEAR"},
+ {0x00028410, 0, 0, "SX_ALPHA_TEST_CONTROL"},
+ {0x00028430, 0, 0, "DB_STENCILREFMASK"},
+ {0x00028434, 0, 0, "DB_STENCILREFMASK_BF"},
+ {0x00028438, 0, 0, "SX_ALPHA_REF"},
+ {0x000286DC, 0, 0, "SPI_FOG_CNTL"},
+ {0x00028800, 0, 0, "DB_DEPTH_CONTROL"},
+ {0x0002880C, 0, 0, "DB_SHADER_CONTROL"},
+ {0x00028000, 0, 0, "DB_RENDER_CONTROL"},
+ {0x0002800C, 0, 0, "DB_RENDER_OVERRIDE"},
+ {0x00028010, 0, 0, "DB_RENDER_OVERRIDE2"},
+ {0x00028AC0, 0, 0, "DB_SRESULTS_COMPARE_STATE0"},
+ {0x00028AC4, 0, 0, "DB_SRESULTS_COMPARE_STATE1"},
+ {0x00028AC8, 0, 0, "DB_PRELOAD_CONTROL"},
+ {0x00028B70, 0, 0, "DB_ALPHA_TO_MASK"},
+};
+
+/* different */
+static const struct radeon_register EG_names_VS_SHADER[] = {
+ {0x00028380, 0, 0, "SQ_VTX_SEMANTIC_0"},
+ {0x00028384, 0, 0, "SQ_VTX_SEMANTIC_1"},
+ {0x00028388, 0, 0, "SQ_VTX_SEMANTIC_2"},
+ {0x0002838C, 0, 0, "SQ_VTX_SEMANTIC_3"},
+ {0x00028390, 0, 0, "SQ_VTX_SEMANTIC_4"},
+ {0x00028394, 0, 0, "SQ_VTX_SEMANTIC_5"},
+ {0x00028398, 0, 0, "SQ_VTX_SEMANTIC_6"},
+ {0x0002839C, 0, 0, "SQ_VTX_SEMANTIC_7"},
+ {0x000283A0, 0, 0, "SQ_VTX_SEMANTIC_8"},
+ {0x000283A4, 0, 0, "SQ_VTX_SEMANTIC_9"},
+ {0x000283A8, 0, 0, "SQ_VTX_SEMANTIC_10"},
+ {0x000283AC, 0, 0, "SQ_VTX_SEMANTIC_11"},
+ {0x000283B0, 0, 0, "SQ_VTX_SEMANTIC_12"},
+ {0x000283B4, 0, 0, "SQ_VTX_SEMANTIC_13"},
+ {0x000283B8, 0, 0, "SQ_VTX_SEMANTIC_14"},
+ {0x000283BC, 0, 0, "SQ_VTX_SEMANTIC_15"},
+ {0x000283C0, 0, 0, "SQ_VTX_SEMANTIC_16"},
+ {0x000283C4, 0, 0, "SQ_VTX_SEMANTIC_17"},
+ {0x000283C8, 0, 0, "SQ_VTX_SEMANTIC_18"},
+ {0x000283CC, 0, 0, "SQ_VTX_SEMANTIC_19"},
+ {0x000283D0, 0, 0, "SQ_VTX_SEMANTIC_20"},
+ {0x000283D4, 0, 0, "SQ_VTX_SEMANTIC_21"},
+ {0x000283D8, 0, 0, "SQ_VTX_SEMANTIC_22"},
+ {0x000283DC, 0, 0, "SQ_VTX_SEMANTIC_23"},
+ {0x000283E0, 0, 0, "SQ_VTX_SEMANTIC_24"},
+ {0x000283E4, 0, 0, "SQ_VTX_SEMANTIC_25"},
+ {0x000283E8, 0, 0, "SQ_VTX_SEMANTIC_26"},
+ {0x000283EC, 0, 0, "SQ_VTX_SEMANTIC_27"},
+ {0x000283F0, 0, 0, "SQ_VTX_SEMANTIC_28"},
+ {0x000283F4, 0, 0, "SQ_VTX_SEMANTIC_29"},
+ {0x000283F8, 0, 0, "SQ_VTX_SEMANTIC_30"},
+ {0x000283FC, 0, 0, "SQ_VTX_SEMANTIC_31"},
+ {0x0002861C, 0, 0, "SPI_VS_OUT_ID_0"}, // all diff belwo
+ {0x00028620, 0, 0, "SPI_VS_OUT_ID_1"},
+ {0x00028624, 0, 0, "SPI_VS_OUT_ID_2"},
+ {0x00028628, 0, 0, "SPI_VS_OUT_ID_3"},
+ {0x0002862C, 0, 0, "SPI_VS_OUT_ID_4"},
+ {0x00028630, 0, 0, "SPI_VS_OUT_ID_5"},
+ {0x00028634, 0, 0, "SPI_VS_OUT_ID_6"},
+ {0x00028638, 0, 0, "SPI_VS_OUT_ID_7"},
+ {0x0002863C, 0, 0, "SPI_VS_OUT_ID_8"},
+ {0x00028640, 0, 0, "SPI_VS_OUT_ID_9"},
+ {0x000286C4, 0, 0, "SPI_VS_OUT_CONFIG"},
+ {0x0002885C, 1, 0, "SQ_PGM_START_VS"},
+ {0x00028860, 0, 0, "SQ_PGM_RESOURCES_VS"},
+ {0x00028864, 0, 0, "SQ_PGM_RESOURCES_2_VS"},
+ {0x000288A4, 1, 1, "SQ_PGM_START_FS"},
+ {0x000288A8, 0, 0, "SQ_PGM_RESOURCES_FS"},
+};
+
+static const struct radeon_register EG_names_PS_SHADER[] = {
+ {0x00028644, 0, 0, "SPI_PS_INPUT_CNTL_0"},
+ {0x00028648, 0, 0, "SPI_PS_INPUT_CNTL_1"},
+ {0x0002864C, 0, 0, "SPI_PS_INPUT_CNTL_2"},
+ {0x00028650, 0, 0, "SPI_PS_INPUT_CNTL_3"},
+ {0x00028654, 0, 0, "SPI_PS_INPUT_CNTL_4"},
+ {0x00028658, 0, 0, "SPI_PS_INPUT_CNTL_5"},
+ {0x0002865C, 0, 0, "SPI_PS_INPUT_CNTL_6"},
+ {0x00028660, 0, 0, "SPI_PS_INPUT_CNTL_7"},
+ {0x00028664, 0, 0, "SPI_PS_INPUT_CNTL_8"},
+ {0x00028668, 0, 0, "SPI_PS_INPUT_CNTL_9"},
+ {0x0002866C, 0, 0, "SPI_PS_INPUT_CNTL_10"},
+ {0x00028670, 0, 0, "SPI_PS_INPUT_CNTL_11"},
+ {0x00028674, 0, 0, "SPI_PS_INPUT_CNTL_12"},
+ {0x00028678, 0, 0, "SPI_PS_INPUT_CNTL_13"},
+ {0x0002867C, 0, 0, "SPI_PS_INPUT_CNTL_14"},
+ {0x00028680, 0, 0, "SPI_PS_INPUT_CNTL_15"},
+ {0x00028684, 0, 0, "SPI_PS_INPUT_CNTL_16"},
+ {0x00028688, 0, 0, "SPI_PS_INPUT_CNTL_17"},
+ {0x0002868C, 0, 0, "SPI_PS_INPUT_CNTL_18"},
+ {0x00028690, 0, 0, "SPI_PS_INPUT_CNTL_19"},
+ {0x00028694, 0, 0, "SPI_PS_INPUT_CNTL_20"},
+ {0x00028698, 0, 0, "SPI_PS_INPUT_CNTL_21"},
+ {0x0002869C, 0, 0, "SPI_PS_INPUT_CNTL_22"},
+ {0x000286A0, 0, 0, "SPI_PS_INPUT_CNTL_23"},
+ {0x000286A4, 0, 0, "SPI_PS_INPUT_CNTL_24"},
+ {0x000286A8, 0, 0, "SPI_PS_INPUT_CNTL_25"},
+ {0x000286AC, 0, 0, "SPI_PS_INPUT_CNTL_26"},
+ {0x000286B0, 0, 0, "SPI_PS_INPUT_CNTL_27"},
+ {0x000286B4, 0, 0, "SPI_PS_INPUT_CNTL_28"},
+ {0x000286B8, 0, 0, "SPI_PS_INPUT_CNTL_29"},
+ {0x000286BC, 0, 0, "SPI_PS_INPUT_CNTL_30"},
+ {0x000286C0, 0, 0, "SPI_PS_INPUT_CNTL_31"},
+ {0x000286C8, 0, 0, "SPI_THREAD_GROUPING"},
+ {0x000286CC, 0, 0, "SPI_PS_IN_CONTROL_0"},
+ {0x000286D0, 0, 0, "SPI_PS_IN_CONTROL_1"},
+ {0x000286D8, 0, 0, "SPI_INPUT_Z"},
+ {0x000286E0, 0, 0, "SPI_BARYC_CNTL"},
+ {0x000286E4, 0, 0, "SPI_PS_IN_CONTROL_2"},
+ {0x000286E8, 0, 0, "SPI_COMPUTE_INPUT_CNTL"},
+ {0x00028840, 1, 0, "SQ_PGM_START_PS"}, // diff
+ {0x00028844, 0, 0, "SQ_PGM_RESOURCES_PS"}, // diff
+ {0x00028848, 0, 0, "SQ_PGM_RESOURCES_2_PS"}, // diff
+ {0x0002884C, 0, 0, "SQ_PGM_EXPORTS_PS"}, // diff
+};
+
+/* different */
+static const struct radeon_register EG_names_UCP[] = {
+ {0x000285BC, 0, 0, "PA_CL_UCP0_X"},
+ {0x000285C0, 0, 0, "PA_CL_UCP0_Y"},
+ {0x000285C4, 0, 0, "PA_CL_UCP0_Z"},
+ {0x000285C8, 0, 0, "PA_CL_UCP0_W"},
+ {0x000285CC, 0, 0, "PA_CL_UCP1_X"},
+ {0x000285D0, 0, 0, "PA_CL_UCP1_Y"},
+ {0x000285D4, 0, 0, "PA_CL_UCP1_Z"},
+ {0x000285D8, 0, 0, "PA_CL_UCP1_W"},
+ {0x000285DC, 0, 0, "PA_CL_UCP2_X"},
+ {0x000285E0, 0, 0, "PA_CL_UCP2_Y"},
+ {0x000285E4, 0, 0, "PA_CL_UCP2_Z"},
+ {0x000285E8, 0, 0, "PA_CL_UCP2_W"},
+ {0x000285EC, 0, 0, "PA_CL_UCP3_X"},
+ {0x000285F0, 0, 0, "PA_CL_UCP3_Y"},
+ {0x000285F4, 0, 0, "PA_CL_UCP3_Z"},
+ {0x000285F8, 0, 0, "PA_CL_UCP3_W"},
+ {0x000285FC, 0, 0, "PA_CL_UCP4_X"},
+ {0x00028600, 0, 0, "PA_CL_UCP4_Y"},
+ {0x00028604, 0, 0, "PA_CL_UCP4_Z"},
+ {0x00028608, 0, 0, "PA_CL_UCP4_W"},
+ {0x0002860C, 0, 0, "PA_CL_UCP5_X"},
+ {0x00028610, 0, 0, "PA_CL_UCP5_Y"},
+ {0x00028614, 0, 0, "PA_CL_UCP5_Z"},
+ {0x0002861C, 0, 0, "PA_CL_UCP5_W"},
+};
+
+static const struct radeon_register EG_names_VS_CBUF[] = {
+ {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"},
+ {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"},
+};
+
+static const struct radeon_register EG_names_PS_CBUF[] = {
+ {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"},
+ {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"},
+};
+
+static const struct radeon_register EG_names_PS_RESOURCE[] = {
+ {0x00030000, 0, 0, "RESOURCE0_WORD0"},
+ {0x00030004, 0, 0, "RESOURCE0_WORD1"},
+ {0x00030008, 0, 0, "RESOURCE0_WORD2"},
+ {0x0003000C, 0, 0, "RESOURCE0_WORD3"},
+ {0x00030010, 0, 0, "RESOURCE0_WORD4"},
+ {0x00030014, 0, 0, "RESOURCE0_WORD5"},
+ {0x00030018, 0, 0, "RESOURCE0_WORD6"},
+ {0x0003001c, 0, 0, "RESOURCE0_WORD7"},
+};
+
+static const struct radeon_register EG_names_VS_RESOURCE[] = {
+ {0x00031600, 0, 0, "RESOURCE160_WORD0"},
+ {0x00031604, 0, 0, "RESOURCE160_WORD1"},
+ {0x00031608, 0, 0, "RESOURCE160_WORD2"},
+ {0x0003160C, 0, 0, "RESOURCE160_WORD3"},
+ {0x00031610, 0, 0, "RESOURCE160_WORD4"},
+ {0x00031614, 0, 0, "RESOURCE160_WORD5"},
+ {0x00031618, 0, 0, "RESOURCE160_WORD6"},
+ {0x0003161c, 0, 0, "RESOURCE160_WORD7"},
+};
+
+static const struct radeon_register EG_names_FS_RESOURCE[] = {
+ {0x0003A300, 0, 0, "RESOURCE320_WORD0"},
+ {0x0003A304, 0, 0, "RESOURCE320_WORD1"},
+ {0x0003A308, 0, 0, "RESOURCE320_WORD2"},
+ {0x0003A30C, 0, 0, "RESOURCE320_WORD3"},
+ {0x0003A310, 0, 0, "RESOURCE320_WORD4"},
+ {0x0003A314, 0, 0, "RESOURCE320_WORD5"},
+ {0x0003A318, 0, 0, "RESOURCE320_WORD6"},
+ {0x0003A31C, 0, 0, "RESOURCE320_WORD7"},
+};
+
+static const struct radeon_register EG_names_GS_RESOURCE[] = {
+ {0x0003A4C0, 0, 0, "RESOURCE336_WORD0"},
+ {0x0003A4C4, 0, 0, "RESOURCE336_WORD1"},
+ {0x0003A4C8, 0, 0, "RESOURCE336_WORD2"},
+ {0x0003A4CC, 0, 0, "RESOURCE336_WORD3"},
+ {0x0003A4D0, 0, 0, "RESOURCE336_WORD4"},
+ {0x0003A4D4, 0, 0, "RESOURCE336_WORD5"},
+ {0x0003A4D8, 0, 0, "RESOURCE336_WORD6"},
+ {0x0003A4DC, 0, 0, "RESOURCE336_WORD7"},
+};
+
+static const struct radeon_register EG_names_PS_SAMPLER[] = {
+ {0x0003C000, 0, 0, "SQ_TEX_SAMPLER_WORD0_0"},
+ {0x0003C004, 0, 0, "SQ_TEX_SAMPLER_WORD1_0"},
+ {0x0003C008, 0, 0, "SQ_TEX_SAMPLER_WORD2_0"},
+};
+
+static const struct radeon_register EG_names_VS_SAMPLER[] = {
+ {0x0003C0D8, 0, 0, "SQ_TEX_SAMPLER_WORD0_18"},
+ {0x0003C0DC, 0, 0, "SQ_TEX_SAMPLER_WORD1_18"},
+ {0x0003C0E0, 0, 0, "SQ_TEX_SAMPLER_WORD2_18"},
+};
+
+static const struct radeon_register EG_names_GS_SAMPLER[] = {
+ {0x0003C1B0, 0, 0, "SQ_TEX_SAMPLER_WORD0_36"},
+ {0x0003C1B4, 0, 0, "SQ_TEX_SAMPLER_WORD1_36"},
+ {0x0003C1B8, 0, 0, "SQ_TEX_SAMPLER_WORD2_36"},
+};
+
+static const struct radeon_register EG_names_PS_SAMPLER_BORDER[] = {
+ {0x0000A400, 0, 0, "TD_PS_SAMPLER0_BORDER_RED"},
+ {0x0000A404, 0, 0, "TD_PS_SAMPLER0_BORDER_GREEN"},
+ {0x0000A408, 0, 0, "TD_PS_SAMPLER0_BORDER_BLUE"},
+ {0x0000A40C, 0, 0, "TD_PS_SAMPLER0_BORDER_ALPHA"},
+};
+
+static const struct radeon_register EG_names_VS_SAMPLER_BORDER[] = {
+ {0x0000A600, 0, 0, "TD_VS_SAMPLER0_BORDER_RED"},
+ {0x0000A604, 0, 0, "TD_VS_SAMPLER0_BORDER_GREEN"},
+ {0x0000A608, 0, 0, "TD_VS_SAMPLER0_BORDER_BLUE"},
+ {0x0000A60C, 0, 0, "TD_VS_SAMPLER0_BORDER_ALPHA"},
+};
+
+static const struct radeon_register EG_names_GS_SAMPLER_BORDER[] = {
+ {0x0000A800, 0, 0, "TD_GS_SAMPLER0_BORDER_RED"},
+ {0x0000A804, 0, 0, "TD_GS_SAMPLER0_BORDER_GREEN"},
+ {0x0000A808, 0, 0, "TD_GS_SAMPLER0_BORDER_BLUE"},
+ {0x0000A80C, 0, 0, "TD_GS_SAMPLER0_BORDER_ALPHA"},
+};
+
+static const struct radeon_register EG_names_CB[] = {
+ {0x00028C60, 1, 0, "CB_COLOR0_BASE"},
+ {0x00028C64, 0, 0, "CB_COLOR0_PITCH"},
+ {0x00028C68, 0, 0, "CB_COLOR0_SLICE"},
+ {0x00028C6C, 0, 0, "CB_COLOR0_VIEW"},
+ {0x00028C70, 1, 0, "CB_COLOR0_INFO"},
+ {0x00028C74, 0, 0, "CB_COLOR0_ATTRIB"},
+ {0x00028C78, 0, 0, "CB_COLOR0_DIM"},
+};
+
+/* different - TODO */
+static const struct radeon_register EG_names_DB[] = {
+ {0x00028014, 1, 0, "DB_HTILE_DATA_BASE"},
+ {0x00028040, 1, 0, "DB_Z_INFO"},
+ {0x00028044, 0, 0, "DB_STENCIL_INFO"},
+ {0x00028058, 0, 0, "DB_DEPTH_SIZE"},
+ {0x0002805C, 0, 0, "DB_DEPTH_SLICE"},
+ {0x00028008, 0, 0, "DB_DEPTH_VIEW"},
+ {0x00028ABC, 0, 0, "DB_HTILE_SURFACE"},
+ {0x00028048, 1, 0, "DB_Z_READ_BASE"},
+ {0x0002804C, 1, 0, "DB_STENCIL_READ_BASE"},
+ {0x00028050, 1, 0, "DB_Z_WRITE_BASE"},
+ {0x00028054, 1, 0, "DB_STENCIL_WRITE_BASE"},
+};
+
+static const struct radeon_register EG_names_VGT[] = {
+ {0x00008958, 0, 0, "VGT_PRIMITIVE_TYPE"}, //s
+ {0x00028400, 0, 0, "VGT_MAX_VTX_INDX"}, //s
+ {0x00028404, 0, 0, "VGT_MIN_VTX_INDX"}, //s
+ {0x00028408, 0, 0, "VGT_INDX_OFFSET"}, //s
+ {0x00028A7C, 0, 0, "VGT_DMA_INDEX_TYPE"}, //s
+ {0x00028A84, 0, 0, "VGT_PRIMITIVEID_EN"}, //s
+ {0x00028A88, 0, 0, "VGT_DMA_NUM_INSTANCES"}, //s
+ {0x00028A94, 0, 0, "VGT_MULTI_PRIM_IB_RESET_EN"}, //s
+ {0x00028AA0, 0, 0, "VGT_INSTANCE_STEP_RATE_0"}, //s
+ {0x00028AA4, 0, 0, "VGT_INSTANCE_STEP_RATE_1"}, //s
+};
+
+static const struct radeon_register EG_names_DRAW[] = {
+ {0x00008970, 0, 0, "VGT_NUM_INDICES"},
+ {0x000287E4, 0, 0, "VGT_DMA_BASE_HI"}, //same
+ {0x000287E8, 1, 0, "VGT_DMA_BASE"}, //same
+ {0x000287F0, 0, 0, "VGT_DRAW_INITIATOR"}, //same
+};
+
+static const struct radeon_register EG_names_VGT_EVENT[] = {
+ {0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"}, //done
+};
+
+static const struct radeon_register EG_names_CB_FLUSH[] = {
+};
+
+static const struct radeon_register EG_names_DB_FLUSH[] = {
+};
+
+#endif
diff --git a/src/gallium/winsys/r600/drm/gen_eg_states.py b/src/gallium/winsys/r600/drm/gen_eg_states.py
new file mode 100644
index 0000000000..b2e5b2203a
--- /dev/null
+++ b/src/gallium/winsys/r600/drm/gen_eg_states.py
@@ -0,0 +1,39 @@
+import os
+import re
+
+def main():
+ fileIN = open('eg_states.h', 'r')
+ line = fileIN.readline()
+ next_is_reg = False
+ count = 0
+
+ print "/* This file is autogenerated from eg_states.h - do not edit directly */"
+ print "/* autogenerating script is gen_eg_states.py */"
+ print ""
+ while line:
+ if line[0:2] == "};":
+ if next_is_reg == True:
+ print "#define " + name + "_SIZE\t\t", count
+ print "#define " + name + "_PM4 128\t\t"
+ next_is_reg = False
+ count = 0
+ print ""
+
+ if line[0:6] == "static":
+ name = line.rstrip("\n")
+ cline = name.split()
+ name = cline[4].split('[')
+ name = name[0].replace("_names", "")
+ print "/* " + name + " */"
+ next_is_reg = True
+ elif next_is_reg == True:
+ reg = line.split();
+ reg = reg[3].replace("},", "")
+ reg = reg.replace("\"", "")
+ print "#define " + name + "__" + reg + "\t\t", count
+ count = count + 1
+
+ line = fileIN.readline()
+
+if __name__ == "__main__":
+ main()
diff --git a/src/gallium/winsys/r600/drm/gen_r600_states.py b/src/gallium/winsys/r600/drm/gen_r600_states.py
new file mode 100644
index 0000000000..9bd5ab2082
--- /dev/null
+++ b/src/gallium/winsys/r600/drm/gen_r600_states.py
@@ -0,0 +1,39 @@
+import os
+import re
+
+def main():
+ fileIN = open('r600_states.h', 'r')
+ line = fileIN.readline()
+ next_is_reg = False
+ count = 0
+
+ print "/* This file is autogenerated from r600_states.h - do not edit directly */"
+ print "/* autogenerating script is gen_r600_states.py */"
+ print ""
+ while line:
+ if line[0:2] == "};":
+ if next_is_reg == True:
+ print "#define " + name + "_SIZE\t\t", count
+ print "#define " + name + "_PM4 128\t\t"
+ next_is_reg = False
+ count = 0
+ print ""
+
+ if line[0:6] == "static":
+ name = line.rstrip("\n")
+ cline = name.split()
+ name = cline[4].split('[')
+ name = name[0].replace("_names", "")
+ print "/* " + name + " */"
+ next_is_reg = True
+ elif next_is_reg == True:
+ reg = line.split();
+ reg = reg[3].replace("},", "")
+ reg = reg.replace("\"", "")
+ print "#define " + name + "__" + reg + "\t\t", count
+ count = count + 1
+
+ line = fileIN.readline()
+
+if __name__ == "__main__":
+ main()
diff --git a/src/gallium/winsys/r600/drm/r600_state.c b/src/gallium/winsys/r600/drm/r600_state.c
index 71d65f0fea..b8ef89dfd6 100644
--- a/src/gallium/winsys/r600/drm/r600_state.c
+++ b/src/gallium/winsys/r600/drm/r600_state.c
@@ -43,10 +43,13 @@ static int r600_state_pm4_generic(struct radeon_state *state);
static int r600_state_pm4_query_begin(struct radeon_state *state);
static int r600_state_pm4_query_end(struct radeon_state *state);
static int r700_state_pm4_config(struct radeon_state *state);
-static int r700_state_pm4_cb0(struct radeon_state *state);
-static int r700_state_pm4_db(struct radeon_state *state);
+static int r600_state_pm4_db_flush(struct radeon_state *state);
+static int r600_state_pm4_cb_flush(struct radeon_state *state);
+
+static int eg_state_pm4_vgt(struct radeon_state *state);
#include "r600_states.h"
+#include "eg_states.h"
#define SUB_NONE(param) { { 0, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) } }
@@ -55,6 +58,12 @@ static int r700_state_pm4_db(struct radeon_state *state);
#define SUB_GS(param) { R600_SHADER_GS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
#define SUB_FS(param) { R600_SHADER_FS, R600_names_##param, (sizeof(R600_names_##param)/sizeof(struct radeon_register)) }
+#define EG_SUB_NONE(param) { { 0, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) } }
+#define EG_SUB_PS(param) { R600_SHADER_PS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
+#define EG_SUB_VS(param) { R600_SHADER_VS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
+#define EG_SUB_GS(param) { R600_SHADER_GS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
+#define EG_SUB_FS(param) { R600_SHADER_FS, EG_names_##param, (sizeof(EG_names_##param)/sizeof(struct radeon_register)) }
+
/* some of these are overriden at runtime for R700 */
struct radeon_stype_info r600_stypes[] = {
{ R600_STATE_CONFIG, 1, 0, r600_state_pm4_config, SUB_NONE(CONFIG), },
@@ -65,6 +74,7 @@ struct radeon_stype_info r600_stypes[] = {
{ R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, SUB_NONE(BLEND), },
{ R600_STATE_DSA, 1, 0, r600_state_pm4_generic, SUB_NONE(DSA), },
{ R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_SHADER), SUB_VS(VS_SHADER) } },
+ { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { SUB_PS(PS_CBUF), SUB_VS(VS_CBUF) } },
{ R600_STATE_CONSTANT, 256, 0x10, r600_state_pm4_generic, { SUB_PS(PS_CONSTANT), SUB_VS(VS_CONSTANT) } },
{ R600_STATE_RESOURCE, 160, 0x1c, r600_state_pm4_resource, { SUB_PS(PS_RESOURCE), SUB_VS(VS_RESOURCE), SUB_GS(GS_RESOURCE), SUB_FS(FS_RESOURCE)} },
{ R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { SUB_PS(PS_SAMPLER), SUB_VS(VS_SAMPLER), SUB_GS(GS_SAMPLER) } },
@@ -83,9 +93,37 @@ struct radeon_stype_info r600_stypes[] = {
{ R600_STATE_UCP, 1, 0, r600_state_pm4_generic, SUB_NONE(UCP) },
{ R600_STATE_VGT, 1, 0, r600_state_pm4_vgt, SUB_NONE(VGT) },
{ R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, SUB_NONE(DRAW) },
+ { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, SUB_NONE(CB_FLUSH) },
+ { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, SUB_NONE(DB_FLUSH) },
};
#define STYPES_SIZE Elements(r600_stypes)
+struct radeon_stype_info eg_stypes[] = {
+ { R600_STATE_CONFIG, 1, 0, r700_state_pm4_config, EG_SUB_NONE(CONFIG), },
+ { R600_STATE_CB_CNTL, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(CB_CNTL) },
+ { R600_STATE_RASTERIZER, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(RASTERIZER) },
+ { R600_STATE_VIEWPORT, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(VIEWPORT) },
+ { R600_STATE_SCISSOR, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(SCISSOR) },
+ { R600_STATE_BLEND, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(BLEND), },
+ { R600_STATE_DSA, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DSA), },
+ { R600_STATE_SHADER, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_SHADER), EG_SUB_VS(VS_SHADER) } },
+ { R600_STATE_CBUF, 1, 0, r600_state_pm4_shader, { EG_SUB_PS(PS_CBUF), EG_SUB_VS(VS_CBUF) } },
+ { R600_STATE_RESOURCE, 176, 0x20, r600_state_pm4_resource, { EG_SUB_PS(PS_RESOURCE), EG_SUB_VS(VS_RESOURCE), EG_SUB_GS(GS_RESOURCE), EG_SUB_FS(FS_RESOURCE)} },
+ { R600_STATE_SAMPLER, 18, 0xc, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER), EG_SUB_VS(VS_SAMPLER), EG_SUB_GS(GS_SAMPLER) } },
+ { R600_STATE_SAMPLER_BORDER, 18, 0x10, r600_state_pm4_generic, { EG_SUB_PS(PS_SAMPLER_BORDER), EG_SUB_VS(VS_SAMPLER_BORDER), EG_SUB_GS(GS_SAMPLER_BORDER) } },
+ { R600_STATE_CB0, 11, 0x3c, r600_state_pm4_generic, EG_SUB_NONE(CB) },
+ { R600_STATE_QUERY_BEGIN, 1, 0, r600_state_pm4_query_begin, EG_SUB_NONE(VGT_EVENT) },
+ { R600_STATE_QUERY_END, 1, 0, r600_state_pm4_query_end, EG_SUB_NONE(VGT_EVENT) },
+ { R600_STATE_DB, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(DB) },
+ { R600_STATE_UCP, 1, 0, r600_state_pm4_generic, EG_SUB_NONE(UCP) },
+ { R600_STATE_VGT, 1, 0, eg_state_pm4_vgt, EG_SUB_NONE(VGT) },
+ { R600_STATE_DRAW, 1, 0, r600_state_pm4_draw, EG_SUB_NONE(DRAW) },
+ { R600_STATE_CB_FLUSH, 1, 0, r600_state_pm4_cb_flush, EG_SUB_NONE(CB_FLUSH) },
+ { R600_STATE_DB_FLUSH, 1, 0, r600_state_pm4_db_flush, EG_SUB_NONE(DB_FLUSH) },
+
+};
+#define EG_STYPES_SIZE Elements(eg_stypes)
+
static const struct radeon_register *get_regs(struct radeon_state *state)
{
return state->stype->reginfo[state->shader_index].regs;
@@ -159,6 +197,72 @@ static int r600_state_pm4_bytecode(struct radeon_state *state, unsigned offset,
return -EINVAL;
}
+static int eg_state_pm4_bytecode(struct radeon_state *state, unsigned offset, unsigned id, unsigned nreg)
+{
+ const struct radeon_register *regs = get_regs(state);
+ unsigned i;
+ int r;
+
+ if (!offset) {
+ fprintf(stderr, "%s invalid register for state %d %d\n",
+ __func__, state->stype->stype, id);
+ return -EINVAL;
+ }
+ if (offset >= R600_CONFIG_REG_OFFSET && offset < R600_CONFIG_REG_END) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONFIG_REG, nreg);
+ state->pm4[state->cpm4++] = (offset - R600_CONFIG_REG_OFFSET) >> 2;
+ for (i = 0; i < nreg; i++) {
+ state->pm4[state->cpm4++] = state->states[id + i];
+ }
+ for (i = 0; i < nreg; i++) {
+ if (regs[id + i].need_reloc) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
+ r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
+ if (r)
+ return r;
+ state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle;
+ }
+ }
+ return 0;
+ }
+ if (offset >= R600_CONTEXT_REG_OFFSET && offset < R600_CONTEXT_REG_END) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_SET_CONTEXT_REG, nreg);
+ state->pm4[state->cpm4++] = (offset - R600_CONTEXT_REG_OFFSET) >> 2;
+ for (i = 0; i < nreg; i++) {
+ state->pm4[state->cpm4++] = state->states[id + i];
+ }
+ for (i = 0; i < nreg; i++) {
+ if (regs[id + i].need_reloc) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
+ r = radeon_state_reloc(state, state->cpm4, regs[id + i].bo_id);
+ if (r)
+ return r;
+ state->pm4[state->cpm4++] = state->bo[regs[id + i].bo_id]->handle;
+ }
+ }
+ return 0;
+ }
+ if (offset >= EG_RESOURCE_OFFSET && offset < EG_RESOURCE_END) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nreg);
+ state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2;
+ for (i = 0; i < nreg; i++) {
+ state->pm4[state->cpm4++] = state->states[id + i];
+ }
+ return 0;
+ }
+ if (offset >= R600_SAMPLER_OFFSET && offset < R600_SAMPLER_END) {
+ state->pm4[state->cpm4++] = PKT3(PKT3_SET_SAMPLER, nreg);
+ state->pm4[state->cpm4++] = (offset - R600_SAMPLER_OFFSET) >> 2;
+ for (i = 0; i < nreg; i++) {
+ state->pm4[state->cpm4++] = state->states[id + i];
+ }
+ return 0;
+ }
+ fprintf(stderr, "%s unsupported offset 0x%08X\n", __func__, offset);
+ return -EINVAL;
+}
+
+
static int r600_state_pm4_generic(struct radeon_state *state)
{
const struct radeon_register *regs = get_regs(state);
@@ -177,7 +281,10 @@ static int r600_state_pm4_generic(struct radeon_state *state)
nreg++;
loffset = coffset;
} else {
- r = r600_state_pm4_bytecode(state, offset, start, nreg);
+ if (state->radeon->family >= CHIP_CEDAR)
+ r = eg_state_pm4_bytecode(state, offset, start, nreg);
+ else
+ r = r600_state_pm4_bytecode(state, offset, start, nreg);
if (r) {
fprintf(stderr, "%s invalid 0x%08X %d\n", __func__, start, nreg);
return r;
@@ -187,10 +294,14 @@ static int r600_state_pm4_generic(struct radeon_state *state)
start = i;
}
}
- return r600_state_pm4_bytecode(state, offset, start, nreg);
+ if (state->radeon->family >= CHIP_CEDAR)
+ r = eg_state_pm4_bytecode(state, offset, start, nreg);
+ else
+ r = r600_state_pm4_bytecode(state, offset, start, nreg);
+ return r;
}
-static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags)
+static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags, int bufs_are_cbs)
{
unsigned i, j, add, size;
@@ -209,6 +320,8 @@ static void r600_state_pm4_with_flush(struct radeon_state *state, u32 flags)
for (i = 0; i < state->nreloc; i++) {
size = (state->bo[state->reloc_bo_id[i]]->size + 255) >> 8;
state->pm4[state->cpm4++] = PKT3(PKT3_SURFACE_SYNC, 3);
+ if (bufs_are_cbs)
+ flags |= S_0085F0_CB0_DEST_BASE_ENA(1 << i);
state->pm4[state->cpm4++] = flags;
state->pm4[state->cpm4++] = size;
state->pm4[state->cpm4++] = 0x00000000;
@@ -223,8 +336,6 @@ static int r600_state_pm4_cb0(struct radeon_state *state)
{
int r;
- r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) |
- S_0085F0_CB0_DEST_BASE_ENA(1));
r = r600_state_pm4_generic(state);
if (r)
return r;
@@ -233,24 +344,10 @@ static int r600_state_pm4_cb0(struct radeon_state *state)
return 0;
}
-static int r700_state_pm4_cb0(struct radeon_state *state)
-{
- int r;
-
- r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1) |
- S_0085F0_CB0_DEST_BASE_ENA(1));
- r = r600_state_pm4_generic(state);
- if (r)
- return r;
- return 0;
-}
-
static int r600_state_pm4_db(struct radeon_state *state)
{
int r;
- r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) |
- S_0085F0_DB_DEST_BASE_ENA(1));
r = r600_state_pm4_generic(state);
if (r)
return r;
@@ -259,18 +356,6 @@ static int r600_state_pm4_db(struct radeon_state *state)
return 0;
}
-static int r700_state_pm4_db(struct radeon_state *state)
-{
- int r;
-
- r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) |
- S_0085F0_DB_DEST_BASE_ENA(1));
- r = r600_state_pm4_generic(state);
- if (r)
- return r;
- return 0;
-}
-
static int r600_state_pm4_config(struct radeon_state *state)
{
state->pm4[state->cpm4++] = PKT3(PKT3_START_3D_CMDBUF, 0);
@@ -335,10 +420,32 @@ static int r700_state_pm4_config(struct radeon_state *state)
static int r600_state_pm4_shader(struct radeon_state *state)
{
- r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1));
+ r600_state_pm4_with_flush(state, S_0085F0_SH_ACTION_ENA(1), 0);
return r600_state_pm4_generic(state);
}
+static int eg_state_pm4_vgt(struct radeon_state *state)
+{
+ int r;
+ r = eg_state_pm4_bytecode(state, R_028400_VGT_MAX_VTX_INDX, EG_VGT__VGT_MAX_VTX_INDX, 1);
+ if (r)
+ return r;
+ r = eg_state_pm4_bytecode(state, R_028404_VGT_MIN_VTX_INDX, EG_VGT__VGT_MIN_VTX_INDX, 1);
+ if (r)
+ return r;
+ r = eg_state_pm4_bytecode(state, R_028408_VGT_INDX_OFFSET, EG_VGT__VGT_INDX_OFFSET, 1);
+ if (r)
+ return r;
+ r = eg_state_pm4_bytecode(state, R_008958_VGT_PRIMITIVE_TYPE, EG_VGT__VGT_PRIMITIVE_TYPE, 1);
+ if (r)
+ return r;
+ state->pm4[state->cpm4++] = PKT3(PKT3_INDEX_TYPE, 0);
+ state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_INDEX_TYPE];
+ state->pm4[state->cpm4++] = PKT3(PKT3_NUM_INSTANCES, 0);
+ state->pm4[state->cpm4++] = state->states[EG_VGT__VGT_DMA_NUM_INSTANCES];
+ return 0;
+}
+
static int r600_state_pm4_vgt(struct radeon_state *state)
{
int r;
@@ -387,17 +494,43 @@ static int r600_state_pm4_draw(struct radeon_state *state)
}
state->pm4[state->cpm4++] = PKT3(PKT3_EVENT_WRITE, 0);
state->pm4[state->cpm4++] = EVENT_TYPE_CACHE_FLUSH_AND_INV_EVENT;
+
+ return 0;
+}
+
+static int r600_state_pm4_cb_flush(struct radeon_state *state)
+{
+ if (!state->nbo)
+ return 0;
+
+ r600_state_pm4_with_flush(state, S_0085F0_CB_ACTION_ENA(1), 1);
+
+ return 0;
+}
+
+static int r600_state_pm4_db_flush(struct radeon_state *state)
+{
+ if (!state->nbo)
+ return 0;
+
+ r600_state_pm4_with_flush(state, S_0085F0_DB_ACTION_ENA(1) |
+ S_0085F0_DB_DEST_BASE_ENA(1), 0);
+
return 0;
}
static int r600_state_pm4_resource(struct radeon_state *state)
{
u32 flags, type, nbo, offset, soffset;
- int r;
+ int r, nres;
const struct radeon_register *regs = get_regs(state);
soffset = state->id * state->stype->stride;
- type = G_038018_TYPE(state->states[6]);
+ if (state->radeon->family >= CHIP_CEDAR)
+ type = G_038018_TYPE(state->states[7]);
+ else
+ type = G_038018_TYPE(state->states[6]);
+
switch (type) {
case 2:
flags = S_0085F0_TC_ACTION_ENA(1);
@@ -414,10 +547,17 @@ static int r600_state_pm4_resource(struct radeon_state *state)
fprintf(stderr, "%s need %d bo got %d\n", __func__, nbo, state->nbo);
return -EINVAL;
}
- r600_state_pm4_with_flush(state, flags);
+ r600_state_pm4_with_flush(state, flags, 0);
offset = regs[0].offset + soffset;
- state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, 7);
- state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2;
+ if (state->radeon->family >= CHIP_CEDAR)
+ nres = 8;
+ else
+ nres = 7;
+ state->pm4[state->cpm4++] = PKT3(PKT3_SET_RESOURCE, nres);
+ if (state->radeon->family >= CHIP_CEDAR)
+ state->pm4[state->cpm4++] = (offset - EG_RESOURCE_OFFSET) >> 2;
+ else
+ state->pm4[state->cpm4++] = (offset - R_038000_SQ_TEX_RESOURCE_WORD0_0) >> 2;
state->pm4[state->cpm4++] = state->states[0];
state->pm4[state->cpm4++] = state->states[1];
state->pm4[state->cpm4++] = state->states[2];
@@ -425,6 +565,9 @@ static int r600_state_pm4_resource(struct radeon_state *state)
state->pm4[state->cpm4++] = state->states[4];
state->pm4[state->cpm4++] = state->states[5];
state->pm4[state->cpm4++] = state->states[6];
+ if (state->radeon->family >= CHIP_CEDAR)
+ state->pm4[state->cpm4++] = state->states[7];
+
state->pm4[state->cpm4++] = PKT3(PKT3_NOP, 0);
r = radeon_state_reloc(state, state->cpm4, 0);
if (r)
@@ -463,39 +606,53 @@ static void r600_modify_type_array(struct radeon *radeon)
info->pm4 = r700_state_pm4_config;
break;
case R600_STATE_CB0:
- info->pm4 = r700_state_pm4_cb0;
+ info->pm4 = r600_state_pm4_generic;
break;
case R600_STATE_DB:
- info->pm4 = r700_state_pm4_db;
+ info->pm4 = r600_state_pm4_generic;
+ break;
};
}
}
-static void r600_build_types_array(struct radeon *radeon)
+static void build_types_array(struct radeon *radeon, struct radeon_stype_info *types, int size)
{
int i, j;
int id = 0;
- for (i = 0; i < STYPES_SIZE; i++) {
- r600_stypes[i].base_id = id;
- r600_stypes[i].npm4 = 128;
- if (r600_stypes[i].reginfo[0].shader_type == 0) {
- id += r600_stypes[i].num;
+ for (i = 0; i < size; i++) {
+ types[i].base_id = id;
+ types[i].npm4 = 128;
+ if (types[i].reginfo[0].shader_type == 0) {
+ id += types[i].num;
} else {
for (j = 0; j < R600_SHADER_MAX; j++) {
- if (r600_stypes[i].reginfo[j].shader_type)
- id += r600_stypes[i].num;
+ if (types[i].reginfo[j].shader_type)
+ id += types[i].num;
}
}
}
- radeon->stype = r600_stypes;
- radeon->nstype = STYPES_SIZE;
+ radeon->max_states = id;
+ radeon->stype = types;
+ radeon->nstype = size;
+}
+static void r600_build_types_array(struct radeon *radeon)
+{
+ build_types_array(radeon, r600_stypes, STYPES_SIZE);
r600_modify_type_array(radeon);
}
+static void eg_build_types_array(struct radeon *radeon)
+{
+ build_types_array(radeon, eg_stypes, EG_STYPES_SIZE);
+}
+
int r600_init(struct radeon *radeon)
{
- r600_build_types_array(radeon);
+ if (radeon->family >= CHIP_CEDAR)
+ eg_build_types_array(radeon);
+ else
+ r600_build_types_array(radeon);
return 0;
}
diff --git a/src/gallium/winsys/r600/drm/r600_states.h b/src/gallium/winsys/r600/drm/r600_states.h
index 09d79d498d..50b25a9940 100644
--- a/src/gallium/winsys/r600/drm/r600_states.h
+++ b/src/gallium/winsys/r600/drm/r600_states.h
@@ -269,6 +269,16 @@ static const struct radeon_register R600_names_PS_SHADER[] = {
{0x000288CC, 0, 0, "SQ_PGM_CF_OFFSET_PS"},
};
+static const struct radeon_register R600_names_VS_CBUF[] = {
+ {0x00028180, 0, 0, "ALU_CONST_BUFFER_SIZE_VS_0"},
+ {0x00028980, 1, 0, "ALU_CONST_CACHE_VS_0"},
+};
+
+static const struct radeon_register R600_names_PS_CBUF[] = {
+ {0x00028140, 0, 0, "ALU_CONST_BUFFER_SIZE_PS_0"},
+ {0x00028940, 1, 0, "ALU_CONST_CACHE_PS_0"},
+};
+
static const struct radeon_register R600_names_PS_CONSTANT[] = {
{0x00030000, 0, 0, "SQ_ALU_CONSTANT0_0"},
{0x00030004, 0, 0, "SQ_ALU_CONSTANT1_0"},
@@ -394,8 +404,8 @@ static const struct radeon_register R600_names_CB0[] = {
{0x000280A0, 0, 0, "CB_COLOR0_INFO"},
{0x00028060, 0, 0, "CB_COLOR0_SIZE"},
{0x00028080, 0, 0, "CB_COLOR0_VIEW"},
- {0x000280E0, 1, 1, "CB_COLOR0_FRAG"},
- {0x000280C0, 1, 2, "CB_COLOR0_TILE"},
+ {0x000280E0, 1, 0, "CB_COLOR0_FRAG"},
+ {0x000280C0, 1, 0, "CB_COLOR0_TILE"},
{0x00028100, 0, 0, "CB_COLOR0_MASK"},
};
@@ -404,8 +414,8 @@ static const struct radeon_register R600_names_CB1[] = {
{0x000280A4, 0, 0, "CB_COLOR1_INFO"},
{0x00028064, 0, 0, "CB_COLOR1_SIZE"},
{0x00028084, 0, 0, "CB_COLOR1_VIEW"},
- {0x000280E4, 1, 1, "CB_COLOR1_FRAG"},
- {0x000280C4, 1, 2, "CB_COLOR1_TILE"},
+ {0x000280E4, 1, 0, "CB_COLOR1_FRAG"},
+ {0x000280C4, 1, 0, "CB_COLOR1_TILE"},
{0x00028104, 0, 0, "CB_COLOR1_MASK"},
};
@@ -414,8 +424,8 @@ static const struct radeon_register R600_names_CB2[] = {
{0x000280A8, 0, 0, "CB_COLOR2_INFO"},
{0x00028068, 0, 0, "CB_COLOR2_SIZE"},
{0x00028088, 0, 0, "CB_COLOR2_VIEW"},
- {0x000280E8, 1, 1, "CB_COLOR2_FRAG"},
- {0x000280C8, 1, 2, "CB_COLOR2_TILE"},
+ {0x000280E8, 1, 0, "CB_COLOR2_FRAG"},
+ {0x000280C8, 1, 0, "CB_COLOR2_TILE"},
{0x00028108, 0, 0, "CB_COLOR2_MASK"},
};
@@ -424,8 +434,8 @@ static const struct radeon_register R600_names_CB3[] = {
{0x000280AC, 0, 0, "CB_COLOR3_INFO"},
{0x0002806C, 0, 0, "CB_COLOR3_SIZE"},
{0x0002808C, 0, 0, "CB_COLOR3_VIEW"},
- {0x000280EC, 1, 1, "CB_COLOR3_FRAG"},
- {0x000280CC, 1, 2, "CB_COLOR3_TILE"},
+ {0x000280EC, 1, 0, "CB_COLOR3_FRAG"},
+ {0x000280CC, 1, 0, "CB_COLOR3_TILE"},
{0x0002810C, 0, 0, "CB_COLOR3_MASK"},
};
@@ -434,8 +444,8 @@ static const struct radeon_register R600_names_CB4[] = {
{0x000280B0, 0, 0, "CB_COLOR4_INFO"},
{0x00028070, 0, 0, "CB_COLOR4_SIZE"},
{0x00028090, 0, 0, "CB_COLOR4_VIEW"},
- {0x000280F0, 1, 1, "CB_COLOR4_FRAG"},
- {0x000280D0, 1, 2, "CB_COLOR4_TILE"},
+ {0x000280F0, 1, 0, "CB_COLOR4_FRAG"},
+ {0x000280D0, 1, 0, "CB_COLOR4_TILE"},
{0x00028110, 0, 0, "CB_COLOR4_MASK"},
};
@@ -444,8 +454,8 @@ static const struct radeon_register R600_names_CB5[] = {
{0x000280B4, 0, 0, "CB_COLOR5_INFO"},
{0x00028074, 0, 0, "CB_COLOR5_SIZE"},
{0x00028094, 0, 0, "CB_COLOR5_VIEW"},
- {0x000280F4, 1, 1, "CB_COLOR5_FRAG"},
- {0x000280D4, 1, 2, "CB_COLOR5_TILE"},
+ {0x000280F4, 1, 0, "CB_COLOR5_FRAG"},
+ {0x000280D4, 1, 0, "CB_COLOR5_TILE"},
{0x00028114, 0, 0, "CB_COLOR5_MASK"},
};
@@ -454,8 +464,8 @@ static const struct radeon_register R600_names_CB6[] = {
{0x000280B8, 0, 0, "CB_COLOR6_INFO"},
{0x00028078, 0, 0, "CB_COLOR6_SIZE"},
{0x00028098, 0, 0, "CB_COLOR6_VIEW"},
- {0x000280F8, 1, 1, "CB_COLOR6_FRAG"},
- {0x000280D8, 1, 2, "CB_COLOR6_TILE"},
+ {0x000280F8, 1, 0, "CB_COLOR6_FRAG"},
+ {0x000280D8, 1, 0, "CB_COLOR6_TILE"},
{0x00028118, 0, 0, "CB_COLOR6_MASK"},
};
@@ -464,8 +474,8 @@ static const struct radeon_register R600_names_CB7[] = {
{0x000280BC, 0, 0, "CB_COLOR7_INFO"},
{0x0002807C, 0, 0, "CB_COLOR7_SIZE"},
{0x0002809C, 0, 0, "CB_COLOR7_VIEW"},
- {0x000280FC, 1, 1, "CB_COLOR7_FRAG"},
- {0x000280DC, 1, 2, "CB_COLOR7_TILE"},
+ {0x000280FC, 1, 0, "CB_COLOR7_FRAG"},
+ {0x000280DC, 1, 0, "CB_COLOR7_TILE"},
{0x0002811C, 0, 0, "CB_COLOR7_MASK"},
};
@@ -503,4 +513,10 @@ static const struct radeon_register R600_names_VGT_EVENT[] = {
{0x00028A90, 1, 0, "VGT_EVENT_INITIATOR"},
};
+static const struct radeon_register R600_names_CB_FLUSH[] = {
+};
+
+static const struct radeon_register R600_names_DB_FLUSH[] = {
+};
+
#endif
diff --git a/src/gallium/winsys/r600/drm/r600d.h b/src/gallium/winsys/r600/drm/r600d.h
index e8c2dc0651..05f31571f4 100644
--- a/src/gallium/winsys/r600/drm/r600d.h
+++ b/src/gallium/winsys/r600/drm/r600d.h
@@ -43,6 +43,15 @@
#define R600_BOOL_CONST_OFFSET 0X0003E380
#define R600_BOOL_CONST_END 0X00040000
+/* evergreen values */
+#define EG_RESOURCE_OFFSET 0x00030000
+#define EG_RESOURCE_END 0x00030400
+#define EG_LOOP_CONST_OFFSET 0x0003A200
+#define EG_LOOP_CONST_END 0x0003A26C
+#define EG_BOOL_CONST_OFFSET 0x0003A500
+#define EG_BOOL_CONST_END 0x0003A506
+
+
#define PKT3_NOP 0x10
#define PKT3_INDIRECT_BUFFER_END 0x17
#define PKT3_SET_PREDICATION 0x20
diff --git a/src/gallium/winsys/r600/drm/radeon.c b/src/gallium/winsys/r600/drm/radeon.c
index e2d813ebac..ccf60605ed 100644
--- a/src/gallium/winsys/r600/drm/radeon.c
+++ b/src/gallium/winsys/r600/drm/radeon.c
@@ -45,7 +45,7 @@ static int radeon_get_device(struct radeon *radeon)
struct radeon *radeon_new(int fd, unsigned device)
{
struct radeon *radeon;
- int r, i, id;
+ int r, i, id, j, k;
radeon = calloc(1, sizeof(*radeon));
if (radeon == NULL) {
@@ -79,6 +79,11 @@ struct radeon *radeon_new(int fd, unsigned device)
case CHIP_RV730:
case CHIP_RV710:
case CHIP_RV740:
+ case CHIP_CEDAR:
+ case CHIP_REDWOOD:
+ case CHIP_JUNIPER:
+ case CHIP_CYPRESS:
+ case CHIP_HEMLOCK:
if (r600_init(radeon)) {
return radeon_decref(radeon);
}
@@ -110,29 +115,11 @@ struct radeon *radeon_new(int fd, unsigned device)
case CHIP_RV560:
case CHIP_RV570:
case CHIP_R580:
- case CHIP_CEDAR:
- case CHIP_REDWOOD:
- case CHIP_JUNIPER:
- case CHIP_CYPRESS:
- case CHIP_HEMLOCK:
default:
fprintf(stderr, "%s unknown or unsupported chipset 0x%04X\n",
__func__, radeon->device);
break;
}
- radeon->state_type_id = calloc(radeon->nstype, sizeof(unsigned));
- if (radeon->state_type_id == NULL) {
- return radeon_decref(radeon);
- }
- for (i = 0, id = 0; i < radeon->nstype; i++) {
- radeon->state_type_id[i] = id;
- for (int j = 0; j < radeon->nstype; j++) {
- if (radeon->stype[j].stype != i)
- continue;
- id += radeon->stype[j].num;
- }
- }
- radeon->nstate_per_shader = id;
return radeon;
}
diff --git a/src/gallium/winsys/r600/drm/radeon_bo.c b/src/gallium/winsys/r600/drm/radeon_bo.c
index a1306f6e9d..f79135bfa1 100644
--- a/src/gallium/winsys/r600/drm/radeon_bo.c
+++ b/src/gallium/winsys/r600/drm/radeon_bo.c
@@ -96,8 +96,8 @@ int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
void *ptr;
int r;
- if (bo->map_count++ != 0) {
- return 0;
+ if (bo->map_count != 0) {
+ goto success;
}
/* Zero out args to make valgrind happy */
memset(&args, 0, sizeof(args));
@@ -117,6 +117,10 @@ int radeon_bo_map(struct radeon *radeon, struct radeon_bo *bo)
return -errno;
}
bo->data = ptr;
+
+success:
+ bo->map_count++;
+
return 0;
}
diff --git a/src/gallium/winsys/r600/drm/radeon_ctx.c b/src/gallium/winsys/r600/drm/radeon_ctx.c
index 47fca76136..a3ce7df756 100644
--- a/src/gallium/winsys/r600/drm/radeon_ctx.c
+++ b/src/gallium/winsys/r600/drm/radeon_ctx.c
@@ -34,7 +34,7 @@ static int radeon_ctx_set_bo_new(struct radeon_ctx *ctx, struct radeon_bo *bo)
{
if (ctx->nbo >= RADEON_CTX_MAX_PM4)
return -EBUSY;
- ctx->bo[ctx->nbo] = bo;
+ ctx->bo[ctx->nbo] = radeon_bo_incref(ctx->radeon, bo);
ctx->nbo++;
return 0;
}
@@ -137,7 +137,6 @@ static int radeon_ctx_state_bo(struct radeon_ctx *ctx, struct radeon_state *stat
break;
}
if (j == ctx->nbo) {
- radeon_bo_incref(ctx->radeon, state->bo[i]);
r = radeon_ctx_set_bo_new(ctx, state->bo[i]);
if (r)
return r;
@@ -259,25 +258,24 @@ int radeon_ctx_set_draw(struct radeon_ctx *ctx, struct radeon_draw *draw)
{
unsigned previous_cdwords;
int r = 0;
+ int i;
- for (int i = 0; i < (ctx->radeon->nstate_per_shader * R600_SHADER_MAX); i++) {
+ for (i = 0; i < ctx->radeon->max_states; i++) {
r = radeon_ctx_state_bo(ctx, draw->state[i]);
if (r)
return r;
}
previous_cdwords = ctx->cdwords;
- for (int i = 0, id = 0; i < ctx->radeon->nstate_per_shader; i++) {
- for (int j = 0; j < R600_SHADER_MAX; j++) {
- id = j * ctx->radeon->nstate_per_shader + i;
- if (draw->state[id]) {
- r = radeon_ctx_state_schedule(ctx, draw->state[id]);
- if (r) {
- ctx->cdwords = previous_cdwords;
- return r;
- }
+ for (i = 0; i < ctx->radeon->max_states; i++) {
+ if (draw->state[i]) {
+ r = radeon_ctx_state_schedule(ctx, draw->state[i]);
+ if (r) {
+ ctx->cdwords = previous_cdwords;
+ return r;
}
}
}
+
return 0;
}
@@ -321,7 +319,6 @@ void radeon_ctx_dump_bof(struct radeon_ctx *ctx, const char *file)
bof_decref(device_id);
device_id = NULL;
/* dump relocs */
-printf("%d relocs\n", ctx->nreloc);
blob = bof_blob(ctx->nreloc * 16, ctx->reloc);
if (blob == NULL)
goto out_err;
@@ -330,7 +327,6 @@ printf("%d relocs\n", ctx->nreloc);
bof_decref(blob);
blob = NULL;
/* dump cs */
-printf("%d pm4\n", ctx->cdwords);
blob = bof_blob(ctx->cdwords * 4, ctx->pm4);
if (blob == NULL)
goto out_err;
@@ -377,7 +373,6 @@ printf("%d pm4\n", ctx->cdwords);
if (bof_object_set(root, "bo", array))
goto out_err;
bof_dump_file(root, file);
-printf("done dump\n");
out_err:
bof_decref(blob);
bof_decref(array);
diff --git a/src/gallium/winsys/r600/drm/radeon_draw.c b/src/gallium/winsys/r600/drm/radeon_draw.c
index b992c4a55d..a126901495 100644
--- a/src/gallium/winsys/r600/drm/radeon_draw.c
+++ b/src/gallium/winsys/r600/drm/radeon_draw.c
@@ -34,7 +34,7 @@
int radeon_draw_init(struct radeon_draw *draw, struct radeon *radeon)
{
draw->radeon = radeon;
- draw->state = calloc(radeon->nstate_per_shader * R600_SHADER_MAX, sizeof(void*));
+ draw->state = calloc(radeon->max_states, sizeof(void*));
if (draw->state == NULL)
return -ENOMEM;
return 0;
diff --git a/src/gallium/winsys/r600/drm/radeon_priv.h b/src/gallium/winsys/r600/drm/radeon_priv.h
index 84e552ba4d..bcaa91d028 100644
--- a/src/gallium/winsys/r600/drm/radeon_priv.h
+++ b/src/gallium/winsys/r600/drm/radeon_priv.h
@@ -59,9 +59,8 @@ struct radeon {
unsigned device;
unsigned family;
unsigned nstype;
- unsigned nstate_per_shader;
- unsigned *state_type_id;
struct radeon_stype_info *stype;
+ unsigned max_states;
};
extern struct radeon *radeon_new(int fd, unsigned device);
diff --git a/src/gallium/winsys/r600/drm/radeon_state.c b/src/gallium/winsys/r600/drm/radeon_state.c
index ac60485b28..e37e714533 100644
--- a/src/gallium/winsys/r600/drm/radeon_state.c
+++ b/src/gallium/winsys/r600/drm/radeon_state.c
@@ -70,8 +70,8 @@ int radeon_state_init(struct radeon_state *state, struct radeon *radeon, u32 sty
}
memset(state, 0, sizeof(struct radeon_state));
- state->state_id = radeon->nstate_per_shader * shader_index + radeon->state_type_id[stype] + id;
state->stype = found;
+ state->state_id = state->stype->num * shader_index + state->stype->base_id + id;
state->radeon = radeon;
state->id = id;
state->shader_index = shader_index;
@@ -128,7 +128,7 @@ int radeon_state_convert(struct radeon_state *state, u32 stype, u32 id, u32 shad
state->stype = found;
state->id = id;
state->shader_index = shader_index;
- state->state_id = state->radeon->nstate_per_shader * shader_index + state->radeon->state_type_id[stype] + id;
+ state->state_id = state->stype->num * shader_index + state->stype->base_id + id;
return radeon_state_pm4(state);
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
index 017eac8464..cf665241c4 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_buffer.c
@@ -5,6 +5,7 @@
#include "radeon_cs_gem.h"
#include "radeon_buffer.h"
+#include "util/u_hash_table.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_simple_list.h"
@@ -20,9 +21,6 @@ struct radeon_drm_buffer {
struct radeon_bo *bo;
- /* The CS associated with the last buffer_map. */
- struct radeon_libdrm_cs *cs;
-
boolean flinked;
uint32_t flink;
@@ -44,6 +42,7 @@ struct radeon_drm_bufmgr {
struct pb_manager base;
struct radeon_libdrm_winsys *rws;
struct radeon_drm_buffer buffer_map_list;
+ struct util_hash_table *buffer_handles;
};
static INLINE struct radeon_drm_bufmgr *
@@ -57,12 +56,18 @@ static void
radeon_drm_buffer_destroy(struct pb_buffer *_buf)
{
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
+ int name;
if (buf->bo->ptr != NULL) {
remove_from_list(buf);
radeon_bo_unmap(buf->bo);
buf->bo->ptr = NULL;
}
+ name = radeon_gem_name_bo(buf->bo);
+ if (name) {
+ util_hash_table_remove(buf->mgr->buffer_handles,
+ (void*)(uintptr_t)name);
+ }
radeon_bo_unref(buf->bo);
FREE(buf);
@@ -89,15 +94,27 @@ static unsigned get_pb_usage_from_transfer_flags(enum pipe_transfer_usage usage)
static void *
radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
- unsigned flags)
+ unsigned flags, void *flush_ctx)
{
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf);
- struct radeon_libdrm_cs *cs = buf->cs;
+ struct radeon_libdrm_cs *cs = flush_ctx;
int write = 0;
+ /* Note how we use radeon_bo_is_referenced_by_cs here. There are
+ * basically two places this map function can be called from:
+ * - pb_map
+ * - create_buffer (in the buffer reuse case)
+ *
+ * Since pb managers are per-winsys managers, not per-context managers,
+ * and we shouldn't reuse buffers if they are in-use in any context,
+ * we simply ask: is this buffer referenced by *any* CS?
+ *
+ * The problem with buffer_create is that it comes from pipe_screen,
+ * so we have no CS to look at, though luckily the following code
+ * is sufficient to tell whether the buffer is in use. */
if (flags & PB_USAGE_DONTBLOCK) {
if (_buf->base.usage & RADEON_PB_USAGE_VERTEX)
- if (cs && radeon_bo_is_referenced_by_cs(buf->bo, cs->cs))
+ if (radeon_bo_is_referenced_by_cs(buf->bo, NULL))
return NULL;
}
@@ -110,6 +127,10 @@ radeon_drm_buffer_map_internal(struct pb_buffer *_buf,
return NULL;
}
+ /* If we don't have any CS and the buffer is referenced,
+ * we cannot flush. */
+ assert(cs || !radeon_bo_is_referenced_by_cs(buf->bo, NULL));
+
if (cs && radeon_bo_is_referenced_by_cs(buf->bo, cs->cs)) {
cs->flush_cs(cs->flush_data);
}
@@ -173,6 +194,13 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager
struct radeon_drm_buffer *buf;
struct radeon_bo *bo;
+ buf = util_hash_table_get(mgr->buffer_handles, (void*)(uintptr_t)handle);
+ if (buf) {
+ struct pb_buffer *b = NULL;
+ pb_reference(&b, &buf->base);
+ return b;
+ }
+
bo = radeon_bo_open(rws->bom, handle, 0,
0, 0, 0);
if (bo == NULL)
@@ -195,6 +223,8 @@ struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager
buf->bo = bo;
+ util_hash_table_set(mgr->buffer_handles, (void*)(uintptr_t)handle, buf);
+
return &buf->base;
}
@@ -248,9 +278,20 @@ static void
radeon_drm_bufmgr_destroy(struct pb_manager *_mgr)
{
struct radeon_drm_bufmgr *mgr = radeon_drm_bufmgr(_mgr);
+ util_hash_table_destroy(mgr->buffer_handles);
FREE(mgr);
}
+static unsigned handle_hash(void *key)
+{
+ return (unsigned)key;
+}
+
+static int handle_compare(void *key1, void *key2)
+{
+ return !((int)key1 == (int)key2);
+}
+
struct pb_manager *
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
{
@@ -266,6 +307,7 @@ radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws)
mgr->rws = rws;
make_empty_list(&mgr->buffer_map_list);
+ mgr->buffer_handles = util_hash_table_create(handle_hash, handle_compare);
return &mgr->base;
}
@@ -293,12 +335,8 @@ void *radeon_drm_buffer_map(struct r300_winsys_screen *ws,
enum pipe_transfer_usage usage)
{
struct pb_buffer *_buf = radeon_pb_buffer(buf);
- struct radeon_drm_buffer *rbuf = get_drm_buffer(_buf);
-
- if (rbuf)
- rbuf->cs = radeon_libdrm_cs(cs);
- return pb_map(_buf, get_pb_usage_from_transfer_flags(usage));
+ return pb_map(_buf, get_pb_usage_from_transfer_flags(usage), radeon_libdrm_cs(cs));
}
void radeon_drm_buffer_unmap(struct r300_winsys_screen *ws,
diff --git a/src/gallium/winsys/svga/drm/vmw_screen_svga.c b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
index 2b4e80f003..d96b2b9742 100644
--- a/src/gallium/winsys/svga/drm/vmw_screen_svga.c
+++ b/src/gallium/winsys/svga/drm/vmw_screen_svga.c
@@ -81,7 +81,7 @@ vmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws,
unsigned flags)
{
(void)sws;
- return pb_map(vmw_pb_buffer(buf), flags);
+ return pb_map(vmw_pb_buffer(buf), flags, NULL);
}
diff --git a/src/gallium/winsys/sw/null/null_sw_winsys.c b/src/gallium/winsys/sw/null/null_sw_winsys.c
index 157efa9973..73b777f629 100644
--- a/src/gallium/winsys/sw/null/null_sw_winsys.c
+++ b/src/gallium/winsys/sw/null/null_sw_winsys.c
@@ -35,6 +35,7 @@
* @author Jose Fonseca
*/
+#include <stdio.h>
#include "pipe/p_format.h"
#include "util/u_memory.h"
@@ -85,6 +86,7 @@ null_sw_displaytarget_create(struct sw_winsys *winsys,
unsigned alignment,
unsigned *stride)
{
+ fprintf(stderr, "null_sw_displaytarget_create() returning NULL\n");
return NULL;
}
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index aedca0f0d1..1746e18ad6 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -50,10 +50,10 @@ CXX_SOURCES = \
ir_function_inlining.cpp \
ir_hierarchical_visitor.cpp \
ir_hv_accept.cpp \
- ir_if_return.cpp \
ir_if_simplification.cpp \
ir_if_to_cond_assign.cpp \
ir_import_prototypes.cpp \
+ ir_lower_jumps.cpp \
ir_mat_op_to_vec.cpp \
ir_mod_to_fract.cpp \
ir_noop_swizzle.cpp \
@@ -72,6 +72,11 @@ CXX_SOURCES = \
ir_vec_index_to_swizzle.cpp \
linker.cpp \
link_functions.cpp \
+ loop_analysis.cpp \
+ loop_controls.cpp \
+ loop_unroll.cpp \
+ lower_noise.cpp \
+ opt_redundant_jumps.cpp \
s_expression.cpp
LIBS = \
diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
index 5728a8b63d..f62a85e893 100644
--- a/src/glsl/Makefile.am
+++ b/src/glsl/Makefile.am
@@ -62,7 +62,12 @@ glsl_SOURCES = \
ir_to_mesa.h \
ir_validate.cpp \
ir_vec_index_to_swizzle.cpp \
- linker.cpp
+ linker.cpp \
+ loop_analysis.cpp \
+ loop_controls.cpp \
+ loop_unroll.cpp \
+ lower_noise.cpp \
+ opt_redundant_jumps.cpp
BUILT_SOURCES = glsl_parser.h glsl_parser.cpp glsl_lexer.cpp
CLEANFILES = $(BUILT_SOURCES)
diff --git a/src/glsl/README b/src/glsl/README
index 2e501d6206..dd80a53d47 100644
--- a/src/glsl/README
+++ b/src/glsl/README
@@ -156,10 +156,10 @@ for the 965 fragment shader backend when that is developed.
Q: How should I expand instructions that take multiple backend instructions?
Sometimes you'll have to do the expansion in your code generation --
-see, for example, ir_to_mesa.cpp's handling of ir_binop_mul for
-matrices. However, in many cases you'll want to do a pass over the IR
-to convert non-native instructions to a series of native instructions.
-For example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because
+see, for example, ir_to_mesa.cpp's handling of ir_unop_sqrt. However,
+in many cases you'll want to do a pass over the IR to convert
+non-native instructions to a series of native instructions. For
+example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because
Mesa IR (and many hardware backends) only have a reciprocal
instruction, not a divide. Implementing non-native instructions this
way gives the chance for constant folding to occur, so (a / 2.0)
@@ -189,3 +189,41 @@ You may also need to update the backends if they will see the new expr type:
You can then use the new expression from builtins (if all backends
would rather see it), or scan the IR and convert to use your new
expression type (see ir_mod_to_fract, for example).
+
+Q: How is memory management handled in the compiler?
+
+The hierarchical memory allocator "talloc" developed for the Samba
+project is used, so that things like optimization passes don't have to
+worry about their garbage collection so much. It has a few nice
+features, including low performance overhead and good debugging
+support that's trivially available.
+
+Generally, each stage of the compile creates a talloc context and
+allocates its memory out of that or children of it. At the end of the
+stage, the pieces still live are stolen to a new context and the old
+one freed, or the whole context is kept for use by the next stage.
+
+For IR transformations, a temporary context is used, then at the end
+of all transformations, reparent_ir reparents all live nodes under the
+shader's IR list, and the old context full of dead nodes is freed.
+When developing a single IR transformation pass, this means that you
+want to allocate instruction nodes out of the temporary context, so if
+it becomes dead it doesn't live on as the child of a live node. At
+the moment, optimization passes aren't passed that temporary context,
+so they find it by calling talloc_parent() on a nearby IR node. The
+talloc_parent() call is expensive, so many passes will cache the
+result of the first talloc_parent(). Cleaning up all the optimization
+passes to take a context argument and not call talloc_parent() is left
+as an exercise.
+
+Q: What is the file naming convention in this directory?
+
+Initially, there really wasn't one. We have since adopted one:
+
+ - Files that implement code lowering passes should be named lower_*
+ (e.g., lower_noise.cpp).
+ - Files that implement optimization passes should be named opt_*.
+ - Files that implement a class that is used throught the code should
+ take the name of that class (e.g., ir_hierarchical_visitor.cpp).
+ - Files that contain code not fitting in one of the previous
+ categories should have a sensible name (e.g., glsl_parser.ypp).
diff --git a/src/glsl/SConscript b/src/glsl/SConscript
index a808a5bc5d..6e2ef2d61f 100644
--- a/src/glsl/SConscript
+++ b/src/glsl/SConscript
@@ -47,10 +47,10 @@ sources = [
'ir_function_inlining.cpp',
'ir_hierarchical_visitor.cpp',
'ir_hv_accept.cpp',
- 'ir_if_return.cpp',
'ir_if_simplification.cpp',
'ir_if_to_cond_assign.cpp',
'ir_import_prototypes.cpp',
+ 'ir_lower_jumps.cpp',
'ir_mat_op_to_vec.cpp',
'ir_mod_to_fract.cpp',
'ir_noop_swizzle.cpp',
@@ -69,6 +69,11 @@ sources = [
'ir_vec_index_to_swizzle.cpp',
'linker.cpp',
'link_functions.cpp',
+ 'loop_analysis.cpp',
+ 'loop_controls.cpp',
+ 'loop_unroll.cpp',
+ 'lower_noise.cpp',
+ 'opt_redundant_jumps.cpp',
's_expression.cpp',
]
diff --git a/src/glsl/TODO b/src/glsl/TODO
index 07ac5f5c6e..a3762384ff 100644
--- a/src/glsl/TODO
+++ b/src/glsl/TODO
@@ -1,30 +1,14 @@
-- Handle constant expressions of (struct == struct)
-
-- Handle constant expressions of (struct != struct)
-
-- Treat built-in functions with constant parameters as constant expressions.
- - Rewrite all built-in functions return a single expression.
- - Modify the HIR generator for functions to automatically inline built-in
- functions durning translation.
- - Care must be taken to handle both the 1.10 rules and the 1.20+ rules. In
- 1.10, built-in functions cannot be constant expressions.
-
- Detect code paths in non-void functions that don't reach a return statement
-- Handle over-riding built-in functions
- - Is the overload per-compilation unit or per-linked shader?
-
-- Handle redeclaration of built-in variables
- - Handle addition of qualifiers such as 'invariant' or 'centroid'.
- - Handle resizing of arrays.
- - Other? We'll have to look at the spec.
-
- Improve handling of constants and their initializers. Constant initializers
should never generate any code. This is trival for scalar constants. It is
also trivial for arrays, matrices, and vectors that are accessed with
constant index values. For others it is more complicated. Perhaps these
cases should be silently converted to uniforms?
+- Implement support for ir_binop_dot in ir_algebraic.cpp. Perform
+ transformations such as "dot(v, vec3(0.0, 1.0, 0.0))" -> v.y.
+
1.30 features:
- Implement AST-to-HIR conversion of bit-shift operators.
@@ -48,3 +32,7 @@
- Implement support for 1.30 style shadow compares which only return a float
instead of a vec4.
+
+- Implement support for gl_ClipDistance. This is non-trivial because
+ gl_ClipDistance is exposed as a float[8], but all hardware actually
+ implements it as vec4[2]. \ No newline at end of file
diff --git a/src/glsl/ast_function.cpp b/src/glsl/ast_function.cpp
index 61012b850a..5d9d35b2d9 100644
--- a/src/glsl/ast_function.cpp
+++ b/src/glsl/ast_function.cpp
@@ -1063,7 +1063,7 @@ ast_function_expression::hir(exec_list *instructions,
* "It is an error to construct matrices from other matrices. This
* is reserved for future use."
*/
- if ((state->language_version <= 110) && (matrix_parameters > 0)
+ if (state->language_version == 110 && matrix_parameters > 0
&& constructor_type->is_matrix()) {
_mesa_glsl_error(& loc, state, "cannot construct `%s' from a "
"matrix in GLSL 1.10",
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 762f802c2b..31bb40dd13 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -62,6 +62,8 @@ _mesa_ast_to_hir(exec_list *instructions, struct _mesa_glsl_parse_state *state)
_mesa_glsl_initialize_variables(instructions, state);
_mesa_glsl_initialize_functions(instructions, state);
+ state->symbols->language_version = state->language_version;
+
state->current_function = NULL;
/* Section 4.2 of the GLSL 1.20 specification states:
@@ -514,6 +516,12 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
_mesa_glsl_error(& lhs_loc, state, "non-lvalue in assignment");
error_emitted = true;
}
+
+ if (state->es_shader && lhs->type->is_array()) {
+ _mesa_glsl_error(&lhs_loc, state, "whole array assignment is not "
+ "allowed in GLSL ES 1.00.");
+ error_emitted = true;
+ }
}
ir_rvalue *new_rhs = validate_assignment(state, lhs->type, rhs);
@@ -628,8 +636,8 @@ ast_expression::hir(exec_list *instructions,
ir_binop_greater,
ir_binop_lequal,
ir_binop_gequal,
- ir_binop_equal,
- ir_binop_nequal,
+ ir_binop_all_equal,
+ ir_binop_any_nequal,
ir_binop_bit_and,
ir_binop_bit_xor,
ir_binop_bit_or,
@@ -1125,6 +1133,17 @@ ast_expression::hir(exec_list *instructions,
type = op[1]->type;
}
+ /* From page 33 (page 39 of the PDF) of the GLSL 1.10 spec:
+ *
+ * "The second and third expressions must be the same type, but can
+ * be of any type other than an array."
+ */
+ if ((state->language_version <= 110) && type->is_array()) {
+ _mesa_glsl_error(& loc, state, "Second and third operands of ?: "
+ "operator must not be arrays.");
+ error_emitted = true;
+ }
+
ir_constant *cond_val = op[0]->constant_expression_value();
ir_constant *then_val = op[1]->constant_expression_value();
ir_constant *else_val = op[2]->constant_expression_value();
@@ -1461,7 +1480,7 @@ ast_compound_statement::hir(exec_list *instructions,
static const glsl_type *
-process_array_type(const glsl_type *base, ast_node *array_size,
+process_array_type(YYLTYPE *loc, const glsl_type *base, ast_node *array_size,
struct _mesa_glsl_parse_state *state)
{
unsigned length = 0;
@@ -1497,6 +1516,12 @@ process_array_type(const glsl_type *base, ast_node *array_size,
}
}
}
+ } else if (state->es_shader) {
+ /* Section 10.17 of the GLSL ES 1.00 specification states that unsized
+ * array declarations have been removed from the language.
+ */
+ _mesa_glsl_error(loc, state, "unsized array declarations are not "
+ "allowed in GLSL ES 1.00.");
}
return glsl_type::get_array_instance(base, length);
@@ -1517,7 +1542,8 @@ ast_type_specifier::glsl_type(const char **name,
*name = this->type_name;
if (this->is_array) {
- type = process_array_type(type, this->array_size, state);
+ YYLTYPE loc = this->get_location();
+ type = process_array_type(&loc, type, this->array_size, state);
}
}
@@ -1604,7 +1630,7 @@ apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
qual_string);
}
- if (var->type->is_array() && (state->language_version >= 120)) {
+ if (var->type->is_array() && state->language_version != 110) {
var->array_lvalue = true;
}
}
@@ -1714,7 +1740,8 @@ ast_declarator_list::hir(exec_list *instructions,
}
if (decl->is_array) {
- var_type = process_array_type(decl_type, decl->array_size, state);
+ var_type = process_array_type(&loc, decl_type, decl->array_size,
+ state);
} else {
var_type = decl_type;
}
@@ -2129,7 +2156,7 @@ ast_parameter_declarator::hir(exec_list *instructions,
* call already handled the "vec4[..] foo" case.
*/
if (this->is_array) {
- type = process_array_type(type, this->array_size, state);
+ type = process_array_type(&loc, type, this->array_size, state);
}
if (type->array_size() == 0) {
@@ -2258,7 +2285,7 @@ ast_function::hir(exec_list *instructions,
* that the previously seen signature does not have an associated definition.
*/
f = state->symbols->get_function(name);
- if (f != NULL && !f->is_builtin) {
+ if (f != NULL && (state->es_shader || !f->has_builtin_signature())) {
sig = f->exact_matching_signature(&hir_parameters);
if (sig != NULL) {
const char *badvar = sig->qualifiers_match(&hir_parameters);
@@ -2694,16 +2721,26 @@ ast_struct_specifier::hir(exec_list *instructions,
decl_list->type->specifier->hir(instructions, state);
+ /* Section 10.9 of the GLSL ES 1.00 specification states that
+ * embedded structure definitions have been removed from the language.
+ */
+ if (state->es_shader && decl_list->type->specifier->structure != NULL) {
+ YYLTYPE loc = this->get_location();
+ _mesa_glsl_error(&loc, state, "Embedded structure definitions are "
+ "not allowed in GLSL ES 1.00.");
+ }
+
const glsl_type *decl_type =
decl_list->type->specifier->glsl_type(& type_name, state);
foreach_list_typed (ast_declaration, decl, link,
&decl_list->declarations) {
- const struct glsl_type *const field_type =
- (decl->is_array)
- ? process_array_type(decl_type, decl->array_size, state)
- : decl_type;
-
+ const struct glsl_type *field_type = decl_type;
+ if (decl->is_array) {
+ YYLTYPE loc = decl->get_location();
+ field_type = process_array_type(&loc, decl_type, decl->array_size,
+ state);
+ }
fields[i].type = (field_type != NULL)
? field_type : glsl_type::error_type;
fields[i].name = decl->identifier;
diff --git a/src/glsl/builtin_function.cpp b/src/glsl/builtin_function.cpp
index 892b5aa857..1e633e3f3a 100644
--- a/src/glsl/builtin_function.cpp
+++ b/src/glsl/builtin_function.cpp
@@ -35,9 +35,11 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
+ GLcontext fakeCtx;
+ fakeCtx.API = API_OPENGL;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
- new(sh) _mesa_glsl_parse_state(NULL, target, sh);
+ new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
st->language_version = 130;
st->symbols->language_version = 130;
@@ -60,6 +62,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
if (st->error) {
printf("error reading builtin: %.35s ...\n", functions[i]);
+ printf("Info log:\n%s\n", st->info_log);
talloc_free(sh);
return NULL;
}
@@ -316,25 +319,23 @@ static const char *builtin_atan =
" (\n"
" (declare () float r)\n"
" (declare ( ) float abs_retval)\n"
- " (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))\n"
- ") \n"
+ " (assign (constant bool (1)) (x) (var_ref abs_retval) (call abs ((var_ref x) ))\n"
+ ")\n"
" (if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (\n"
" (declare ( ) float atan_retval)\n"
- " (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n"
- ") \n"
- " (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) ) \n"
+ " (assign (constant bool (1)) (x) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))\n"
+ ")\n"
+ " (assign (constant bool (1)) (x) (var_ref r) (var_ref atan_retval) )\n"
" (if (expression bool < (var_ref x) (constant float (0.000000)) ) (\n"
- "\n"
- "\n"
" (if (expression bool >= (var_ref y) (constant float (0.000000)) ) (\n"
" (declare ( ) float assignment_tmp)\n"
- " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) ) \n"
- " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n"
+ " (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )\n"
+ " (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )\n"
" )\n"
" (\n"
" (declare ( ) float assignment_tmp)\n"
- " (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) ) \n"
- " (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) ) \n"
+ " (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )\n"
+ " (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )\n"
" ))\n"
"\n"
" )\n"
@@ -343,11 +344,9 @@ static const char *builtin_atan =
"\n"
" )\n"
" (\n"
- "\n"
" (declare () float sgn)\n"
- " (assign (constant bool (1)) (var_ref sgn) (expression float sign (var_ref y)))\n"
- " (assign (constant bool (1)) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))\n"
- "\n"
+ " (assign (constant bool (1)) (x) (var_ref sgn) (expression float sign (var_ref y)))\n"
+ " (assign (constant bool (1)) (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))\n"
" ))\n"
"\n"
" (return (var_ref r) )\n"
@@ -360,12 +359,10 @@ static const char *builtin_atan =
" (declare (in) vec2 y)\n"
" (declare (in) vec2 x))\n"
" ((declare () vec2 r)\n"
- " (assign (constant bool (1))\n"
- " (swiz x (var_ref r))\n"
+ " (assign (constant bool (1)) (x) (var_ref r)\n"
" (call atan ((swiz x (var_ref y))\n"
" (swiz x (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz y (var_ref r))\n"
+ " (assign (constant bool (1)) (y) (var_ref r)\n"
" (call atan ((swiz y (var_ref y))\n"
" (swiz y (var_ref x)))))\n"
" (return (var_ref r))))\n"
@@ -375,16 +372,13 @@ static const char *builtin_atan =
" (declare (in) vec3 y)\n"
" (declare (in) vec3 x))\n"
" ((declare () vec3 r)\n"
- " (assign (constant bool (1))\n"
- " (swiz x (var_ref r))\n"
+ " (assign (constant bool (1)) (x) (var_ref r)\n"
" (call atan ((swiz x (var_ref y))\n"
" (swiz x (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz y (var_ref r))\n"
+ " (assign (constant bool (1)) (y) (var_ref r)\n"
" (call atan ((swiz y (var_ref y))\n"
" (swiz y (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz z (var_ref r))\n"
+ " (assign (constant bool (1)) (z) (var_ref r)\n"
" (call atan ((swiz z (var_ref y))\n"
" (swiz z (var_ref x)))))\n"
" (return (var_ref r))))\n"
@@ -394,20 +388,16 @@ static const char *builtin_atan =
" (declare (in) vec4 y)\n"
" (declare (in) vec4 x))\n"
" ((declare () vec4 r)\n"
- " (assign (constant bool (1))\n"
- " (swiz x (var_ref r))\n"
+ " (assign (constant bool (1)) (x) (var_ref r)\n"
" (call atan ((swiz x (var_ref y))\n"
" (swiz x (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz y (var_ref r))\n"
+ " (assign (constant bool (1)) (y) (var_ref r)\n"
" (call atan ((swiz y (var_ref y))\n"
" (swiz y (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz z (var_ref r))\n"
+ " (assign (constant bool (1)) (z) (var_ref r)\n"
" (call atan ((swiz z (var_ref y))\n"
" (swiz z (var_ref x)))))\n"
- " (assign (constant bool (1))\n"
- " (swiz w (var_ref r))\n"
+ " (assign (constant bool (1)) (w) (var_ref r)\n"
" (call atan ((swiz w (var_ref y))\n"
" (swiz w (var_ref x)))))\n"
" (return (var_ref r)))))\n"
@@ -735,16 +725,14 @@ static const char *builtin_distance =
" (parameters\n"
" (declare (in) float p0)\n"
" (declare (in) float p1))\n"
- " ((declare () float p)\n"
- " (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))\n"
- " (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
+ " ((return (expression float abs (expression float - (var_ref p0) (var_ref p1))))))\n"
"\n"
" (signature float\n"
" (parameters\n"
" (declare (in) vec2 p0)\n"
" (declare (in) vec2 p1))\n"
" ((declare () vec2 p)\n"
- " (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n"
+ " (assign (constant bool (1)) (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))\n"
" (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
"\n"
" (signature float\n"
@@ -752,7 +740,7 @@ static const char *builtin_distance =
" (declare (in) vec3 p0)\n"
" (declare (in) vec3 p1))\n"
" ((declare () vec3 p)\n"
- " (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n"
+ " (assign (constant bool (1)) (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))\n"
" (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
"\n"
" (signature float\n"
@@ -760,7 +748,7 @@ static const char *builtin_distance =
" (declare (in) vec4 p0)\n"
" (declare (in) vec4 p1))\n"
" ((declare () vec4 p)\n"
- " (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n"
+ " (assign (constant bool (1)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))\n"
" (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))\n"
"))\n"
""
@@ -771,7 +759,7 @@ static const char *builtin_dot =
" (parameters\n"
" (declare (in) float arg0)\n"
" (declare (in) float arg1))\n"
- " ((return (expression float dot (var_ref arg0) (var_ref arg1)))))\n"
+ " ((return (expression float * (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature float\n"
" (parameters\n"
@@ -799,121 +787,73 @@ static const char *builtin_equal =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) bvec2 arg0)\n"
" (declare (in) bvec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) bvec3 arg0)\n"
" (declare (in) bvec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) bvec4 arg0)\n"
" (declare (in) bvec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -972,7 +912,7 @@ static const char *builtin_faceforward =
" (declare (in) float N)\n"
" (declare (in) float I)\n"
" (declare (in) float Nref))\n"
- " ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))\n"
+ " ((if (expression bool < (expression float * (var_ref Nref) (var_ref I)) (constant float (0)))\n"
" ((return (var_ref N)))\n"
" ((return (expression float neg (var_ref N)))))))\n"
"\n"
@@ -1105,8 +1045,8 @@ static const char *builtin_greaterThan =
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1114,9 +1054,9 @@ static const char *builtin_greaterThan =
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1124,10 +1064,10 @@ static const char *builtin_greaterThan =
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1135,8 +1075,8 @@ static const char *builtin_greaterThan =
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1144,9 +1084,9 @@ static const char *builtin_greaterThan =
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1154,10 +1094,10 @@ static const char *builtin_greaterThan =
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1165,8 +1105,8 @@ static const char *builtin_greaterThan =
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1174,9 +1114,9 @@ static const char *builtin_greaterThan =
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1184,10 +1124,10 @@ static const char *builtin_greaterThan =
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"))\n"
""
@@ -1199,8 +1139,8 @@ static const char *builtin_greaterThanEqual =
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1208,9 +1148,9 @@ static const char *builtin_greaterThanEqual =
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1218,10 +1158,10 @@ static const char *builtin_greaterThanEqual =
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1229,8 +1169,8 @@ static const char *builtin_greaterThanEqual =
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1238,9 +1178,9 @@ static const char *builtin_greaterThanEqual =
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1248,10 +1188,10 @@ static const char *builtin_greaterThanEqual =
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1259,8 +1199,8 @@ static const char *builtin_greaterThanEqual =
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1268,9 +1208,9 @@ static const char *builtin_greaterThanEqual =
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1278,10 +1218,10 @@ static const char *builtin_greaterThanEqual =
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"))\n"
""
@@ -1315,7 +1255,7 @@ static const char *builtin_length =
" (signature float\n"
" (parameters\n"
" (declare (in) float arg0))\n"
- " ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))\n"
+ " ((return (expression float abs (var_ref arg0)))))\n"
"\n"
" (signature float\n"
" (parameters\n"
@@ -1341,8 +1281,8 @@ static const char *builtin_lessThan =
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1350,9 +1290,9 @@ static const char *builtin_lessThan =
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1360,10 +1300,10 @@ static const char *builtin_lessThan =
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1371,8 +1311,8 @@ static const char *builtin_lessThan =
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1380,9 +1320,9 @@ static const char *builtin_lessThan =
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1390,10 +1330,10 @@ static const char *builtin_lessThan =
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1401,8 +1341,8 @@ static const char *builtin_lessThan =
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1410,9 +1350,9 @@ static const char *builtin_lessThan =
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1420,10 +1360,10 @@ static const char *builtin_lessThan =
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"))\n"
""
@@ -1435,8 +1375,8 @@ static const char *builtin_lessThanEqual =
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1444,9 +1384,9 @@ static const char *builtin_lessThanEqual =
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1454,10 +1394,10 @@ static const char *builtin_lessThanEqual =
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1465,8 +1405,8 @@ static const char *builtin_lessThanEqual =
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1474,9 +1414,9 @@ static const char *builtin_lessThanEqual =
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1484,10 +1424,10 @@ static const char *builtin_lessThanEqual =
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec2\n"
@@ -1495,8 +1435,8 @@ static const char *builtin_lessThanEqual =
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
" ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec3\n"
@@ -1504,9 +1444,9 @@ static const char *builtin_lessThanEqual =
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
" ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"\n"
" (signature bvec4\n"
@@ -1514,10 +1454,10 @@ static const char *builtin_lessThanEqual =
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
" ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
+ " (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
+ " (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
" (return (var_ref temp))))\n"
"))\n"
""
@@ -1577,8 +1517,8 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat2 x)\n"
" (declare (in) mat2 y))\n"
" ((declare () mat2 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat3\n"
@@ -1586,9 +1526,9 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat3 x)\n"
" (declare (in) mat3 y))\n"
" ((declare () mat3 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat4\n"
@@ -1596,10 +1536,10 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat4 x)\n"
" (declare (in) mat4 y))\n"
" ((declare () mat4 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat2x3\n"
@@ -1607,8 +1547,8 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat2x3 x)\n"
" (declare (in) mat2x3 y))\n"
" ((declare () mat2x3 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat3x2\n"
@@ -1616,9 +1556,9 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat3x2 x)\n"
" (declare (in) mat3x2 y))\n"
" ((declare () mat3x2 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat2x4\n"
@@ -1626,8 +1566,8 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat2x4 x)\n"
" (declare (in) mat2x4 y))\n"
" ((declare () mat2x4 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat4x2\n"
@@ -1635,10 +1575,10 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat4x2 x)\n"
" (declare (in) mat4x2 y))\n"
" ((declare () mat4x2 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat3x4\n"
@@ -1646,9 +1586,9 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat3x4 x)\n"
" (declare (in) mat3x4 y))\n"
" ((declare () mat3x4 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
"(return (var_ref z))))\n"
"\n"
" (signature mat4x3\n"
@@ -1656,10 +1596,10 @@ static const char *builtin_matrixCompMult =
" (declare (in) mat4x3 x)\n"
" (declare (in) mat4x3 y))\n"
" ((declare () mat4x3 z)\n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2))))) \n"
- " (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))\n"
"(return (var_ref z))))\n"
"))\n"
""
@@ -1988,8 +1928,8 @@ static const char *builtin_mix =
" (declare (in) vec2 v1)\n"
" (declare (in) vec2 v2)\n"
" (declare (in) bvec2 a))\n"
- " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
- " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
+ " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
" (return (var_ref v1))))\n"
"\n"
" (signature vec3\n"
@@ -1997,9 +1937,9 @@ static const char *builtin_mix =
" (declare (in) vec3 v1)\n"
" (declare (in) vec3 v2)\n"
" (declare (in) bvec3 a))\n"
- " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
- " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
- " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n"
+ " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
+ " (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n"
" (return (var_ref v1))))\n"
"\n"
" (signature vec4\n"
@@ -2007,10 +1947,10 @@ static const char *builtin_mix =
" (declare (in) vec4 v1)\n"
" (declare (in) vec4 v2)\n"
" (declare (in) bvec4 a))\n"
- " ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))\n"
- " (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))\n"
- " (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))\n"
- " (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))\n"
+ " ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))\n"
+ " (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))\n"
+ " (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))\n"
+ " (assign (swiz w (var_ref a)) (w) (var_ref v1) (swiz w (var_ref v2)))\n"
" (return (var_ref v1))))\n"
"))\n"
""
@@ -2066,82 +2006,259 @@ static const char *builtin_noise1 =
" (signature float\n"
" (parameters\n"
" (declare (in) float x))\n"
- " ((return (constant float (0)))))\n"
+ " ((return (expression float noise (var_ref x)))))\n"
" (signature float\n"
" (parameters\n"
" (declare (in) vec2 x))\n"
- " ((return (constant float (0)))))\n"
+ " ((return (expression float noise (var_ref x)))))\n"
" (signature float\n"
" (parameters\n"
" (declare (in) vec3 x))\n"
- " ((return (constant float (0)))))\n"
+ " ((return (expression float noise (var_ref x)))))\n"
" (signature float\n"
" (parameters\n"
" (declare (in) vec4 x))\n"
- " ((return (constant float (0)))))\n"
+ " ((return (expression float noise (var_ref x)))))\n"
"))\n"
""
;
static const char *builtin_noise2 =
"((function noise2\n"
- " (signature vec2\n"
- " (parameters\n"
- " (declare (in) float x))\n"
- " ((return (constant vec2 (0 0)))))\n"
- " (signature vec2\n"
- " (parameters\n"
- " (declare (in) vec2 x))\n"
- " ((return (constant vec2 (0 0)))))\n"
- " (signature vec2\n"
- " (parameters\n"
- " (declare (in) vec3 x))\n"
- " ((return (constant vec2 (0 0)))))\n"
- " (signature vec2\n"
- " (parameters\n"
- " (declare (in) vec4 x))\n"
- " ((return (constant vec2 (0 0)))))\n"
+ " (signature vec2\n"
+ " (parameters (declare (in) vec4 p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () vec2 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters (declare (in) vec3 p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () vec2 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in ) vec2 p)\n"
+ " )\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () vec2 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in ) float p)\n"
+ " )\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () vec2 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
"))\n"
""
;
static const char *builtin_noise3 =
"((function noise3\n"
- " (signature vec3\n"
- " (parameters\n"
- " (declare (in) float x))\n"
- " ((return (constant vec3 (0 0 0)))))\n"
- " (signature vec3\n"
- " (parameters\n"
- " (declare (in) vec2 x))\n"
- " ((return (constant vec3 (0 0 0)))))\n"
- " (signature vec3\n"
- " (parameters\n"
- " (declare (in) vec3 x))\n"
- " ((return (constant vec3 (0 0 0)))))\n"
- " (signature vec3\n"
- " (parameters\n"
- " (declare (in) vec4 x))\n"
- " ((return (constant vec3 (0 0 0)))))\n"
+ " (signature vec3\n"
+ " (parameters (declare (in) vec4 p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () float c)\n"
+ " (declare () vec3 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters (declare (in) vec3 p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () float c)\n"
+ " (declare () vec3 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters (declare (in) vec2 p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () float c)\n"
+ " (declare () vec3 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
+ "\n"
+ " (signature vec3\n"
+ " (parameters (declare (in) float p))\n"
+ " (\n"
+ " (declare () float a)\n"
+ " (declare () float b)\n"
+ " (declare () float c)\n"
+ " (declare () vec3 t)\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))\n"
+ " (return (var_ref t))\n"
+ " ))\n"
"))\n"
""
;
static const char *builtin_noise4 =
"((function noise4\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) float x))\n"
- " ((return (constant vec4 (0 0 0 0)))))\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) vec2 x))\n"
- " ((return (constant vec4 (0 0 0 0)))))\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) vec3 x))\n"
- " ((return (constant vec4 (0 0 0 0)))))\n"
- " (signature vec4\n"
- " (parameters\n"
- " (declare (in) vec4 x))\n"
- " ((return (constant vec4 (0 0 0 0)))))\n"
+ " (signature vec4\n"
+ " (parameters (declare (in) vec4 p))\n"
+ " (\n"
+ " (declare () float _x)\n"
+ " (declare () float _y)\n"
+ " (declare () float _z)\n"
+ " (declare () float _w)\n"
+ " (declare () vec4 _r)\n"
+ "\n"
+ " (declare () vec4 _p)\n"
+ " (assign (constant bool (1)) (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
+ " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
+ " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
+ " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
+ " (return (var_ref _r))\n"
+ " ))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters (declare (in) vec3 p))\n"
+ " (\n"
+ " (declare () float _x)\n"
+ " (declare () float _y)\n"
+ " (declare () float _z)\n"
+ " (declare () float _w)\n"
+ " (declare () vec4 _r)\n"
+ "\n"
+ " (declare () vec3 _p)\n"
+ " (assign (constant bool (1)) (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
+ " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
+ " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
+ " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
+ " (return (var_ref _r))\n"
+ " ))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters (declare (in) vec2 p))\n"
+ " (\n"
+ " (declare () float _x)\n"
+ " (declare () float _y)\n"
+ " (declare () float _z)\n"
+ " (declare () float _w)\n"
+ " (declare () vec4 _r)\n"
+ "\n"
+ " (declare () vec2 _p)\n"
+ " (assign (constant bool (1)) (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
+ " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
+ " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
+ " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
+ " (return (var_ref _r))\n"
+ " ))\n"
+ "\n"
+ " (signature vec4\n"
+ " (parameters (declare (in) float p))\n"
+ " (\n"
+ " (declare () float _x)\n"
+ " (declare () float _y)\n"
+ " (declare () float _z)\n"
+ " (declare () float _w)\n"
+ " (declare () vec4 _r)\n"
+ "\n"
+ " (declare () float _p)\n"
+ " (assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))\n"
+ " (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))\n"
+ "\n"
+ " (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))\n"
+ " (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))\n"
+ " (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))\n"
+ " (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))\n"
+ " (return (var_ref _r))\n"
+ " ))\n"
"))\n"
""
;
@@ -2150,7 +2267,7 @@ static const char *builtin_normalize =
" (signature float\n"
" (parameters\n"
" (declare (in) float arg0))\n"
- " ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))\n"
+ " ((return (expression float sign (var_ref arg0)))))\n"
"\n"
" (signature vec2\n"
" (parameters\n"
@@ -2194,121 +2311,73 @@ static const char *builtin_notEqual =
" (parameters\n"
" (declare (in) vec2 arg0)\n"
" (declare (in) vec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) vec3 arg0)\n"
" (declare (in) vec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) vec4 arg0)\n"
" (declare (in) vec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) bvec2 arg0)\n"
" (declare (in) bvec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) bvec3 arg0)\n"
" (declare (in) bvec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) bvec4 arg0)\n"
" (declare (in) bvec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) ivec2 arg0)\n"
" (declare (in) ivec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) ivec3 arg0)\n"
" (declare (in) ivec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) ivec4 arg0)\n"
" (declare (in) ivec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))\n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec2\n"
" (parameters\n"
" (declare (in) uvec2 arg0)\n"
" (declare (in) uvec2 arg1))\n"
- " ((declare () bvec2 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec3\n"
" (parameters\n"
" (declare (in) uvec3 arg0)\n"
" (declare (in) uvec3 arg1))\n"
- " ((declare () bvec3 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"\n"
" (signature bvec4\n"
" (parameters\n"
" (declare (in) uvec4 arg0)\n"
" (declare (in) uvec4 arg1))\n"
- " ((declare () bvec4 temp)\n"
- " (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1)))) \n"
- " (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1)))) \n"
- " (return (var_ref temp))))\n"
+ " ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))\n"
"))\n"
""
;
@@ -2319,8 +2388,8 @@ static const char *builtin_outerProduct =
" (declare (in) vec2 u)\n"
" (declare (in) vec2 v))\n"
" ((declare () mat2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat2x3\n"
@@ -2328,8 +2397,8 @@ static const char *builtin_outerProduct =
" (declare (in) vec3 u)\n"
" (declare (in) vec2 v))\n"
" ((declare () mat2x3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat2x4\n"
@@ -2337,8 +2406,8 @@ static const char *builtin_outerProduct =
" (declare (in) vec4 u)\n"
" (declare (in) vec2 v))\n"
" ((declare () mat2x4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat3x2\n"
@@ -2346,9 +2415,9 @@ static const char *builtin_outerProduct =
" (declare (in) vec2 u)\n"
" (declare (in) vec3 v))\n"
" ((declare () mat3x2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
" (return (var_ref m))\n"
" ))\n"
"\n"
@@ -2357,9 +2426,9 @@ static const char *builtin_outerProduct =
" (declare (in) vec3 u)\n"
" (declare (in) vec3 v))\n"
" ((declare () mat3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat3x4\n"
@@ -2367,9 +2436,9 @@ static const char *builtin_outerProduct =
" (declare (in) vec4 u)\n"
" (declare (in) vec3 v))\n"
" ((declare () mat3x4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat4x2\n"
@@ -2377,10 +2446,10 @@ static const char *builtin_outerProduct =
" (declare (in) vec2 u)\n"
" (declare (in) vec4 v))\n"
" ((declare () mat4x2 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat4x3\n"
@@ -2388,10 +2457,10 @@ static const char *builtin_outerProduct =
" (declare (in) vec3 u)\n"
" (declare (in) vec4 v))\n"
" ((declare () mat4x3 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))\n"
" (return (var_ref m))))\n"
"\n"
" (signature mat4\n"
@@ -2399,10 +2468,10 @@ static const char *builtin_outerProduct =
" (declare (in) vec4 u)\n"
" (declare (in) vec4 v))\n"
" ((declare () mat4 m)\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
- " (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))\n"
+ " (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))\n"
" (return (var_ref m))))\n"
"))\n"
""
@@ -2470,7 +2539,7 @@ static const char *builtin_reflect =
" (expression float *\n"
" (constant float (2.0))\n"
" (expression float *\n"
- " (expression float dot\n"
+ " (expression float *\n"
" (var_ref n)\n"
" (var_ref i))\n"
" (var_ref n)))))))\n"
@@ -2528,14 +2597,14 @@ static const char *builtin_refract =
" (declare (in) float n)\n"
" (declare (in) float eta))\n"
" ((declare () float k)\n"
- " (assign (constant bool (1)) (var_ref k)\n"
+ " (assign (constant bool (1)) (x) (var_ref k)\n"
" (expression float - (constant float (1.0))\n"
" (expression float * (var_ref eta)\n"
" (expression float * (var_ref eta)\n"
" (expression float - (constant float (1.0))\n"
" (expression float * \n"
- " (expression float dot (var_ref n) (var_ref i))\n"
- " (expression float dot (var_ref n) (var_ref i))))))))\n"
+ " (expression float * (var_ref n) (var_ref i))\n"
+ " (expression float * (var_ref n) (var_ref i))))))))\n"
" (if (expression bool < (var_ref k) (constant float (0.0)))\n"
" ((return (constant float (0.0))))\n"
" ((return (expression float -\n"
@@ -2543,7 +2612,7 @@ static const char *builtin_refract =
" (expression float *\n"
" (expression float +\n"
" (expression float * (var_ref eta)\n"
- " (expression float dot (var_ref n) (var_ref i)))\n"
+ " (expression float * (var_ref n) (var_ref i)))\n"
" (expression float sqrt (var_ref k)))\n"
" (var_ref n))))))))\n"
"\n"
@@ -2553,7 +2622,7 @@ static const char *builtin_refract =
" (declare (in) vec2 n)\n"
" (declare (in) float eta))\n"
" ((declare () float k)\n"
- " (assign (constant bool (1)) (var_ref k)\n"
+ " (assign (constant bool (1)) (x) (var_ref k)\n"
" (expression float - (constant float (1.0))\n"
" (expression float * (var_ref eta)\n"
" (expression float * (var_ref eta)\n"
@@ -2578,7 +2647,7 @@ static const char *builtin_refract =
" (declare (in) vec3 n)\n"
" (declare (in) float eta))\n"
" ((declare () float k)\n"
- " (assign (constant bool (1)) (var_ref k)\n"
+ " (assign (constant bool (1)) (x) (var_ref k)\n"
" (expression float - (constant float (1.0))\n"
" (expression float * (var_ref eta)\n"
" (expression float * (var_ref eta)\n"
@@ -2603,7 +2672,7 @@ static const char *builtin_refract =
" (declare (in) vec4 n)\n"
" (declare (in) float eta))\n"
" ((declare () float k)\n"
- " (assign (constant bool (1)) (var_ref k)\n"
+ " (assign (constant bool (1)) (x) (var_ref k)\n"
" (expression float - (constant float (1.0))\n"
" (expression float * (var_ref eta)\n"
" (expression float * (var_ref eta)\n"
@@ -2919,7 +2988,7 @@ static const char *builtin_smoothstep =
" (declare (in) float x))\n"
" ((declare () float t)\n"
"\n"
- " (assign (constant bool (1)) (var_ref t)\n"
+ " (assign (constant bool (1)) (x) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
@@ -2935,21 +3004,21 @@ static const char *builtin_smoothstep =
" ((declare () vec2 t)\n"
" (declare () vec2 retval)\n"
"\n"
- " (assign (constant bool (1)) (swiz x (var_ref t))\n"
+ " (assign (constant bool (1)) (x) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz y (var_ref t))\n"
+ " (assign (constant bool (1)) (y) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
" (return (var_ref retval))\n"
" ))\n"
"\n"
@@ -2961,29 +3030,29 @@ static const char *builtin_smoothstep =
" ((declare () vec3 t)\n"
" (declare () vec3 retval)\n"
"\n"
- " (assign (constant bool (1)) (swiz x (var_ref t))\n"
+ " (assign (constant bool (1)) (x) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz y (var_ref t))\n"
+ " (assign (constant bool (1)) (y) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz z (var_ref t))\n"
+ " (assign (constant bool (1)) (z) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
" (return (var_ref retval))\n"
" ))\n"
"\n"
@@ -2996,37 +3065,37 @@ static const char *builtin_smoothstep =
" ((declare () vec4 t)\n"
" (declare () vec4 retval)\n"
"\n"
- " (assign (constant bool (1)) (swiz x (var_ref t))\n"
+ " (assign (constant bool (1)) (x) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz y (var_ref t))\n"
+ " (assign (constant bool (1)) (y) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz z (var_ref t))\n"
+ " (assign (constant bool (1)) (z) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))\n"
"\n"
- " (assign (constant bool (1)) (swiz w (var_ref t))\n"
+ " (assign (constant bool (1)) (w) (var_ref t)\n"
" (expression float max\n"
" (expression float min\n"
" (expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))\n"
" (constant float (1.0)))\n"
" (constant float (0.0))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n"
+ " (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))\n"
" (return (var_ref retval))\n"
" ))\n"
"\n"
@@ -3103,8 +3172,8 @@ static const char *builtin_step =
" (declare (in) float edge)\n"
" (declare (in) vec2 x))\n"
" ((declare () vec2 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
" (return (var_ref t))))\n"
"\n"
" (signature vec3\n"
@@ -3112,9 +3181,9 @@ static const char *builtin_step =
" (declare (in) float edge)\n"
" (declare (in) vec3 x))\n"
" ((declare () vec3 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
" (return (var_ref t))))\n"
"\n"
" (signature vec4\n"
@@ -3122,10 +3191,10 @@ static const char *builtin_step =
" (declare (in) float edge)\n"
" (declare (in) vec4 x))\n"
" ((declare () vec4 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))\n"
+ " (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))\n"
" (return (var_ref t))))\n"
"\n"
" (signature vec2\n"
@@ -3133,8 +3202,8 @@ static const char *builtin_step =
" (declare (in) vec2 edge)\n"
" (declare (in) vec2 x))\n"
" ((declare () vec2 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
" (return (var_ref t))))\n"
"\n"
" (signature vec3\n"
@@ -3142,9 +3211,9 @@ static const char *builtin_step =
" (declare (in) vec3 edge)\n"
" (declare (in) vec3 x))\n"
" ((declare () vec3 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
" (return (var_ref t))))\n"
"\n"
" (signature vec4\n"
@@ -3152,10 +3221,10 @@ static const char *builtin_step =
" (declare (in) vec4 edge)\n"
" (declare (in) vec4 x))\n"
" ((declare () vec4 t)\n"
- " (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))\n"
- " (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))\n"
+ " (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))\n"
" (return (var_ref t))))\n"
"))\n"
"\n"
@@ -4638,135 +4707,135 @@ static const char *builtin_transpose =
" (parameters\n"
" (declare (in) mat2 m))\n"
" ((declare () mat2 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat3x2\n"
" (parameters\n"
" (declare (in) mat2x3 m))\n"
" ((declare () mat3x2 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat4x2\n"
" (parameters\n"
" (declare (in) mat2x4 m))\n"
" ((declare () mat4x2 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat2x3\n"
" (parameters\n"
" (declare (in) mat3x2 m))\n"
" ((declare () mat2x3 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat3\n"
" (parameters\n"
" (declare (in) mat3 m))\n"
" ((declare () mat3 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat4x3\n"
" (parameters\n"
" (declare (in) mat3x4 m))\n"
" ((declare () mat4x3 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat2x4\n"
" (parameters\n"
" (declare (in) mat4x2 m))\n"
" ((declare () mat2x4 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat3x4\n"
" (parameters\n"
" (declare (in) mat4x3 m))\n"
" ((declare () mat3x4 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n"
"(return (var_ref t))))\n"
"\n"
" (signature mat4\n"
" (parameters\n"
" (declare (in) mat4 m))\n"
" ((declare () mat4 t)\n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3))))) \n"
- " (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3))))) \n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))\n"
+ " (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))\n"
"(return (var_ref t))))\n"
")\n"
"\n"
@@ -4774,6 +4843,2334 @@ static const char *builtin_transpose =
"\n"
""
;
+static const char *prototypes_for_100_frag =
+ "(\n"
+ "(function radians\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float degrees))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 degrees))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 degrees))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 degrees))\n"
+ " ()))\n"
+ "(function degrees\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float radians))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 radians))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 radians))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 radians))\n"
+ " ()))\n"
+ "(function sin\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function cos\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function tan\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function asin\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function acos\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function atan\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float y)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float y_over_x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 y_over_x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 y_over_x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 y_over_x))\n"
+ " ()))\n"
+ "(function pow\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function exp\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function log\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function exp2\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function log2\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function sqrt\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function inversesqrt\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function abs\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function sign\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function floor\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function ceil\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function fract\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function mod\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function min\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ()))\n"
+ "(function max\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ()))\n"
+ "(function clamp\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 minVal)\n"
+ " (declare (in) vec2 maxVal))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 minVal)\n"
+ " (declare (in) vec3 maxVal))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 minVal)\n"
+ " (declare (in) vec4 maxVal))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ()))\n"
+ "(function mix\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) vec2 a))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) vec3 a))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) vec4 a))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) float a))\n"
+ " ()))\n"
+ "(function step\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 edge)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 edge)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 edge)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function smoothstep\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 edge0)\n"
+ " (declare (in) vec2 edge1)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 edge0)\n"
+ " (declare (in) vec3 edge1)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 edge0)\n"
+ " (declare (in) vec4 edge1)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function length\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function distance\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float p0)\n"
+ " (declare (in) float p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 p0)\n"
+ " (declare (in) vec2 p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 p0)\n"
+ " (declare (in) vec3 p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 p0)\n"
+ " (declare (in) vec4 p1))\n"
+ " ()))\n"
+ "(function dot\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function cross\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ()))\n"
+ "(function normalize\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function faceforward\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float N)\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float Nref))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 N)\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 Nref))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 N)\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 Nref))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 N)\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 Nref))\n"
+ " ()))\n"
+ "(function reflect\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float N))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 N))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 N))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 N))\n"
+ " ()))\n"
+ "(function refract\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 N)\n"
+ " (declare (in) float eta))\n"
+ " ()))\n"
+ "(function matrixCompMult\n"
+ " (signature mat2\n"
+ " (parameters\n"
+ " (declare (in) mat2 x)\n"
+ " (declare (in) mat2 y))\n"
+ " ())\n"
+ " (signature mat3\n"
+ " (parameters\n"
+ " (declare (in) mat3 x)\n"
+ " (declare (in) mat3 y))\n"
+ " ())\n"
+ " (signature mat4\n"
+ " (parameters\n"
+ " (declare (in) mat4 x)\n"
+ " (declare (in) mat4 y))\n"
+ " ()))\n"
+ "(function lessThan\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function lessThanEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function greaterThan\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function greaterThanEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function equal\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x)\n"
+ " (declare (in) bvec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x)\n"
+ " (declare (in) bvec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x)\n"
+ " (declare (in) bvec4 y))\n"
+ " ()))\n"
+ "(function notEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x)\n"
+ " (declare (in) bvec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x)\n"
+ " (declare (in) bvec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x)\n"
+ " (declare (in) bvec4 y))\n"
+ " ()))\n"
+ "(function any\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function all\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function not\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function texture2D\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec2 coord))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec2 coord)\n"
+ " (declare (in) float bias))\n"
+ " ()))\n"
+ "(function texture2DProj\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec3 coord))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec4 coord))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec3 coord)\n"
+ " (declare (in) float bias))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec4 coord)\n"
+ " (declare (in) float bias))\n"
+ " ()))\n"
+ "(function textureCube\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) samplerCube sampler)\n"
+ " (declare (in) vec3 coord))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) samplerCube sampler)\n"
+ " (declare (in) vec3 coord)\n"
+ " (declare (in) float bias))\n"
+ " ())))"
+;
+static const char *functions_for_100_frag [] = {
+ builtin_abs,
+ builtin_acos,
+ builtin_all,
+ builtin_any,
+ builtin_asin,
+ builtin_atan,
+ builtin_ceil,
+ builtin_clamp,
+ builtin_cos,
+ builtin_cross,
+ builtin_degrees,
+ builtin_distance,
+ builtin_dot,
+ builtin_equal,
+ builtin_exp,
+ builtin_exp2,
+ builtin_faceforward,
+ builtin_floor,
+ builtin_fract,
+ builtin_greaterThan,
+ builtin_greaterThanEqual,
+ builtin_inversesqrt,
+ builtin_length,
+ builtin_lessThan,
+ builtin_lessThanEqual,
+ builtin_log,
+ builtin_log2,
+ builtin_matrixCompMult,
+ builtin_max,
+ builtin_min,
+ builtin_mix,
+ builtin_mod,
+ builtin_normalize,
+ builtin_not,
+ builtin_notEqual,
+ builtin_pow,
+ builtin_radians,
+ builtin_reflect,
+ builtin_refract,
+ builtin_sign,
+ builtin_sin,
+ builtin_smoothstep,
+ builtin_sqrt,
+ builtin_step,
+ builtin_tan,
+ builtin_texture2D,
+ builtin_texture2DProj,
+ builtin_textureCube,
+};
+static const char *prototypes_for_100_vert =
+ "(\n"
+ "(function radians\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float degrees))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 degrees))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 degrees))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 degrees))\n"
+ " ()))\n"
+ "(function degrees\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float radians))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 radians))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 radians))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 radians))\n"
+ " ()))\n"
+ "(function sin\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function cos\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function tan\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function asin\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function acos\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float angle))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 angle))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 angle))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 angle))\n"
+ " ()))\n"
+ "(function atan\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float y)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float y_over_x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 y_over_x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 y_over_x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 y_over_x))\n"
+ " ()))\n"
+ "(function pow\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function exp\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function log\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function exp2\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function log2\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function sqrt\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function inversesqrt\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function abs\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function sign\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function floor\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function ceil\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function fract\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function mod\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function min\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ()))\n"
+ "(function max\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float y))\n"
+ " ()))\n"
+ "(function clamp\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 minVal)\n"
+ " (declare (in) vec2 maxVal))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 minVal)\n"
+ " (declare (in) vec3 maxVal))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 minVal)\n"
+ " (declare (in) vec4 maxVal))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) float minVal)\n"
+ " (declare (in) float maxVal))\n"
+ " ()))\n"
+ "(function mix\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) vec2 a))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) vec3 a))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) vec4 a))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y)\n"
+ " (declare (in) float a))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y)\n"
+ " (declare (in) float a))\n"
+ " ()))\n"
+ "(function step\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 edge)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 edge)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 edge)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) float edge)\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function smoothstep\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 edge0)\n"
+ " (declare (in) vec2 edge1)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 edge0)\n"
+ " (declare (in) vec3 edge1)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 edge0)\n"
+ " (declare (in) vec4 edge1)\n"
+ " (declare (in) vec4 x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) float edge0)\n"
+ " (declare (in) float edge1)\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function length\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function distance\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float p0)\n"
+ " (declare (in) float p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 p0)\n"
+ " (declare (in) vec2 p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 p0)\n"
+ " (declare (in) vec3 p1))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 p0)\n"
+ " (declare (in) vec4 p1))\n"
+ " ()))\n"
+ "(function dot\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x)\n"
+ " (declare (in) float y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ()))\n"
+ "(function cross\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ()))\n"
+ "(function normalize\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float x))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x))\n"
+ " ()))\n"
+ "(function faceforward\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float N)\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float Nref))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 N)\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 Nref))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 N)\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 Nref))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 N)\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 Nref))\n"
+ " ()))\n"
+ "(function reflect\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float N))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 N))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 N))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 N))\n"
+ " ()))\n"
+ "(function refract\n"
+ " (signature float\n"
+ " (parameters\n"
+ " (declare (in) float I)\n"
+ " (declare (in) float N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 I)\n"
+ " (declare (in) vec2 N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 I)\n"
+ " (declare (in) vec3 N)\n"
+ " (declare (in) float eta))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 I)\n"
+ " (declare (in) vec4 N)\n"
+ " (declare (in) float eta))\n"
+ " ()))\n"
+ "(function matrixCompMult\n"
+ " (signature mat2\n"
+ " (parameters\n"
+ " (declare (in) mat2 x)\n"
+ " (declare (in) mat2 y))\n"
+ " ())\n"
+ " (signature mat3\n"
+ " (parameters\n"
+ " (declare (in) mat3 x)\n"
+ " (declare (in) mat3 y))\n"
+ " ())\n"
+ " (signature mat4\n"
+ " (parameters\n"
+ " (declare (in) mat4 x)\n"
+ " (declare (in) mat4 y))\n"
+ " ()))\n"
+ "(function lessThan\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function lessThanEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function greaterThan\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function greaterThanEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ()))\n"
+ "(function equal\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x)\n"
+ " (declare (in) bvec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x)\n"
+ " (declare (in) bvec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x)\n"
+ " (declare (in) bvec4 y))\n"
+ " ()))\n"
+ "(function notEqual\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) vec2 x)\n"
+ " (declare (in) vec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) vec3 x)\n"
+ " (declare (in) vec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) vec4 x)\n"
+ " (declare (in) vec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) ivec2 x)\n"
+ " (declare (in) ivec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) ivec3 x)\n"
+ " (declare (in) ivec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) ivec4 x)\n"
+ " (declare (in) ivec4 y))\n"
+ " ())\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x)\n"
+ " (declare (in) bvec2 y))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x)\n"
+ " (declare (in) bvec3 y))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x)\n"
+ " (declare (in) bvec4 y))\n"
+ " ()))\n"
+ "(function any\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function all\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bool\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function not\n"
+ " (signature bvec2\n"
+ " (parameters\n"
+ " (declare (in) bvec2 x))\n"
+ " ())\n"
+ " (signature bvec3\n"
+ " (parameters\n"
+ " (declare (in) bvec3 x))\n"
+ " ())\n"
+ " (signature bvec4\n"
+ " (parameters\n"
+ " (declare (in) bvec4 x))\n"
+ " ()))\n"
+ "(function texture2D\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec2 coord))\n"
+ " ()))\n"
+ "(function texture2DProj\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec3 coord))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec4 coord))\n"
+ " ()))\n"
+ "(function texture2DLod\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec2 coord)\n"
+ " (declare (in) float lod))\n"
+ " ()))\n"
+ "(function texture2DProjLod\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec3 coord)\n"
+ " (declare (in) float lod))\n"
+ " ())\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) sampler2D sampler)\n"
+ " (declare (in) vec4 coord)\n"
+ " (declare (in) float lod))\n"
+ " ()))\n"
+ "(function textureCube\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) samplerCube sampler)\n"
+ " (declare (in) vec3 coord))\n"
+ " ()))\n"
+ "(function textureCubeLod\n"
+ " (signature vec4\n"
+ " (parameters\n"
+ " (declare (in) samplerCube sampler)\n"
+ " (declare (in) vec3 coord)\n"
+ " (declare (in) float lod))\n"
+ " ())))"
+;
+static const char *functions_for_100_vert [] = {
+ builtin_abs,
+ builtin_acos,
+ builtin_all,
+ builtin_any,
+ builtin_asin,
+ builtin_atan,
+ builtin_ceil,
+ builtin_clamp,
+ builtin_cos,
+ builtin_cross,
+ builtin_degrees,
+ builtin_distance,
+ builtin_dot,
+ builtin_equal,
+ builtin_exp,
+ builtin_exp2,
+ builtin_faceforward,
+ builtin_floor,
+ builtin_fract,
+ builtin_greaterThan,
+ builtin_greaterThanEqual,
+ builtin_inversesqrt,
+ builtin_length,
+ builtin_lessThan,
+ builtin_lessThanEqual,
+ builtin_log,
+ builtin_log2,
+ builtin_matrixCompMult,
+ builtin_max,
+ builtin_min,
+ builtin_mix,
+ builtin_mod,
+ builtin_normalize,
+ builtin_not,
+ builtin_notEqual,
+ builtin_pow,
+ builtin_radians,
+ builtin_reflect,
+ builtin_refract,
+ builtin_sign,
+ builtin_sin,
+ builtin_smoothstep,
+ builtin_sqrt,
+ builtin_step,
+ builtin_tan,
+ builtin_texture2D,
+ builtin_texture2DLod,
+ builtin_texture2DProj,
+ builtin_texture2DProjLod,
+ builtin_textureCube,
+ builtin_textureCubeLod,
+};
static const char *prototypes_for_110_frag =
"(\n"
"(function radians\n"
@@ -16819,7 +19216,7 @@ static const char *functions_for_EXT_texture_array_vert [] = {
builtin_texture2DArray,
builtin_texture2DArrayLod,
};
-static gl_shader *builtin_profiles[10];
+static gl_shader *builtin_profiles[12];
void *builtin_mem_ctx = NULL;
@@ -16828,6 +19225,7 @@ _mesa_glsl_release_functions(void)
{
talloc_free(builtin_mem_ctx);
builtin_mem_ctx = NULL;
+ memset(builtin_profiles, 0, sizeof(builtin_profiles));
}
static void
@@ -16862,71 +19260,85 @@ _mesa_glsl_initialize_functions(exec_list *instructions,
state->num_builtins_to_link = 0;
- if (state->target == fragment_shader && state->language_version == 110) {
+ if (state->target == fragment_shader && state->language_version == 100) {
_mesa_read_profile(state, instructions, 0,
+ prototypes_for_100_frag,
+ functions_for_100_frag,
+ Elements(functions_for_100_frag));
+ }
+
+ if (state->target == vertex_shader && state->language_version == 100) {
+ _mesa_read_profile(state, instructions, 1,
+ prototypes_for_100_vert,
+ functions_for_100_vert,
+ Elements(functions_for_100_vert));
+ }
+
+ if (state->target == fragment_shader && state->language_version == 110) {
+ _mesa_read_profile(state, instructions, 2,
prototypes_for_110_frag,
functions_for_110_frag,
Elements(functions_for_110_frag));
}
if (state->target == vertex_shader && state->language_version == 110) {
- _mesa_read_profile(state, instructions, 1,
+ _mesa_read_profile(state, instructions, 3,
prototypes_for_110_vert,
functions_for_110_vert,
Elements(functions_for_110_vert));
}
if (state->target == fragment_shader && state->language_version == 120) {
- _mesa_read_profile(state, instructions, 2,
+ _mesa_read_profile(state, instructions, 4,
prototypes_for_120_frag,
functions_for_120_frag,
Elements(functions_for_120_frag));
}
if (state->target == vertex_shader && state->language_version == 120) {
- _mesa_read_profile(state, instructions, 3,
+ _mesa_read_profile(state, instructions, 5,
prototypes_for_120_vert,
functions_for_120_vert,
Elements(functions_for_120_vert));
}
if (state->target == fragment_shader && state->language_version == 130) {
- _mesa_read_profile(state, instructions, 4,
+ _mesa_read_profile(state, instructions, 6,
prototypes_for_130_frag,
functions_for_130_frag,
Elements(functions_for_130_frag));
}
if (state->target == vertex_shader && state->language_version == 130) {
- _mesa_read_profile(state, instructions, 5,
+ _mesa_read_profile(state, instructions, 7,
prototypes_for_130_vert,
functions_for_130_vert,
Elements(functions_for_130_vert));
}
if (state->target == fragment_shader && state->ARB_texture_rectangle_enable) {
- _mesa_read_profile(state, instructions, 6,
+ _mesa_read_profile(state, instructions, 8,
prototypes_for_ARB_texture_rectangle_frag,
functions_for_ARB_texture_rectangle_frag,
Elements(functions_for_ARB_texture_rectangle_frag));
}
if (state->target == vertex_shader && state->ARB_texture_rectangle_enable) {
- _mesa_read_profile(state, instructions, 7,
+ _mesa_read_profile(state, instructions, 9,
prototypes_for_ARB_texture_rectangle_vert,
functions_for_ARB_texture_rectangle_vert,
Elements(functions_for_ARB_texture_rectangle_vert));
}
if (state->target == fragment_shader && state->EXT_texture_array_enable) {
- _mesa_read_profile(state, instructions, 8,
+ _mesa_read_profile(state, instructions, 10,
prototypes_for_EXT_texture_array_frag,
functions_for_EXT_texture_array_frag,
Elements(functions_for_EXT_texture_array_frag));
}
if (state->target == vertex_shader && state->EXT_texture_array_enable) {
- _mesa_read_profile(state, instructions, 9,
+ _mesa_read_profile(state, instructions, 11,
prototypes_for_EXT_texture_array_vert,
functions_for_EXT_texture_array_vert,
Elements(functions_for_EXT_texture_array_vert));
diff --git a/src/glsl/builtin_types.h b/src/glsl/builtin_types.h
index 7b94aac666..6dabbf0d32 100644
--- a/src/glsl/builtin_types.h
+++ b/src/glsl/builtin_types.h
@@ -51,16 +51,8 @@ const glsl_type glsl_type::builtin_core_types[] = {
glsl_type(GL_FLOAT_MAT2, GLSL_TYPE_FLOAT, 2, 2, "mat2"),
glsl_type(GL_FLOAT_MAT3, GLSL_TYPE_FLOAT, 3, 3, "mat3"),
glsl_type(GL_FLOAT_MAT4, GLSL_TYPE_FLOAT, 4, 4, "mat4"),
- glsl_type(GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT,
- "sampler1D"),
- glsl_type(GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT,
- "sampler1DShadow"),
glsl_type(GL_SAMPLER_2D, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT,
"sampler2D"),
- glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT,
- "sampler2DShadow"),
- glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT,
- "sampler3D"),
glsl_type(GL_SAMPLER_CUBE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT,
"samplerCube"),
};
@@ -178,6 +170,21 @@ const glsl_type glsl_type::builtin_110_deprecated_structure_types[] = {
};
/*@}*/
+/** \name Types in GLSL 1.10 (but not GLSL ES 1.00)
+ */
+/*@{*/
+const glsl_type glsl_type::builtin_110_types[] = {
+ glsl_type(GL_SAMPLER_1D, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT,
+ "sampler1D"),
+ glsl_type(GL_SAMPLER_1D_SHADOW, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT,
+ "sampler1DShadow"),
+ glsl_type(GL_SAMPLER_2D_SHADOW, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT,
+ "sampler2DShadow"),
+ glsl_type(GL_SAMPLER_3D, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT,
+ "sampler3D"),
+};
+/*@}*/
+
/** \name Types added in GLSL 1.20
*/
/*@{*/
diff --git a/src/glsl/builtin_variables.h b/src/glsl/builtin_variables.h
index a7dbe480e9..a34c67e348 100644
--- a/src/glsl/builtin_variables.h
+++ b/src/glsl/builtin_variables.h
@@ -39,6 +39,13 @@ static const builtin_variable builtin_core_fs_variables[] = {
{ ir_var_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" },
{ ir_var_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" },
{ ir_var_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" },
+};
+
+static const builtin_variable builtin_100ES_fs_variables[] = {
+ { ir_var_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" },
+};
+
+static const builtin_variable builtin_110_fs_variables[] = {
{ ir_var_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" },
};
diff --git a/src/glsl/builtins/ir/atan b/src/glsl/builtins/ir/atan
index 04e1898f9f..6dc99d74d3 100644
--- a/src/glsl/builtins/ir/atan
+++ b/src/glsl/builtins/ir/atan
@@ -55,23 +55,23 @@
(
(declare () float r)
(declare ( ) float abs_retval)
- (assign (constant bool (1)) (var_ref abs_retval) (call abs ((var_ref x) ))
-)
+ (assign (constant bool (1)) (x) (var_ref abs_retval) (call abs ((var_ref x) ))
+)
(if (expression bool > (var_ref abs_retval) (constant float (0.000100)) ) (
(declare ( ) float atan_retval)
- (assign (constant bool (1)) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))
-)
- (assign (constant bool (1)) (var_ref r) (var_ref atan_retval) )
+ (assign (constant bool (1)) (x) (var_ref atan_retval) (call atan ((expression float / (var_ref y) (var_ref x) ) ))
+)
+ (assign (constant bool (1)) (x) (var_ref r) (var_ref atan_retval) )
(if (expression bool < (var_ref x) (constant float (0.000000)) ) (
(if (expression bool >= (var_ref y) (constant float (0.000000)) ) (
(declare ( ) float assignment_tmp)
- (assign (constant bool (1)) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )
- (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
+ (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float + (var_ref r) (constant float (3.141593)) ) )
+ (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )
)
(
(declare ( ) float assignment_tmp)
- (assign (constant bool (1)) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )
- (assign (constant bool (1)) (var_ref r) (var_ref assignment_tmp) )
+ (assign (constant bool (1)) (x) (var_ref assignment_tmp) (expression float - (var_ref r) (constant float (3.141593)) ) )
+ (assign (constant bool (1)) (x) (var_ref r) (var_ref assignment_tmp) )
))
)
@@ -81,8 +81,8 @@
)
(
(declare () float sgn)
- (assign (constant bool (1)) (var_ref sgn) (expression float sign (var_ref y)))
- (assign (constant bool (1)) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
+ (assign (constant bool (1)) (x) (var_ref sgn) (expression float sign (var_ref y)))
+ (assign (constant bool (1)) (x) (var_ref r) (expression float * (var_ref sgn) (constant float (1.5707965))))
))
(return (var_ref r) )
@@ -95,12 +95,10 @@
(declare (in) vec2 y)
(declare (in) vec2 x))
((declare () vec2 r)
- (assign (constant bool (1))
- (swiz x (var_ref r))
+ (assign (constant bool (1)) (x) (var_ref r)
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
- (assign (constant bool (1))
- (swiz y (var_ref r))
+ (assign (constant bool (1)) (y) (var_ref r)
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
(return (var_ref r))))
@@ -110,16 +108,13 @@
(declare (in) vec3 y)
(declare (in) vec3 x))
((declare () vec3 r)
- (assign (constant bool (1))
- (swiz x (var_ref r))
+ (assign (constant bool (1)) (x) (var_ref r)
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
- (assign (constant bool (1))
- (swiz y (var_ref r))
+ (assign (constant bool (1)) (y) (var_ref r)
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
- (assign (constant bool (1))
- (swiz z (var_ref r))
+ (assign (constant bool (1)) (z) (var_ref r)
(call atan ((swiz z (var_ref y))
(swiz z (var_ref x)))))
(return (var_ref r))))
@@ -129,20 +124,16 @@
(declare (in) vec4 y)
(declare (in) vec4 x))
((declare () vec4 r)
- (assign (constant bool (1))
- (swiz x (var_ref r))
+ (assign (constant bool (1)) (x) (var_ref r)
(call atan ((swiz x (var_ref y))
(swiz x (var_ref x)))))
- (assign (constant bool (1))
- (swiz y (var_ref r))
+ (assign (constant bool (1)) (y) (var_ref r)
(call atan ((swiz y (var_ref y))
(swiz y (var_ref x)))))
- (assign (constant bool (1))
- (swiz z (var_ref r))
+ (assign (constant bool (1)) (z) (var_ref r)
(call atan ((swiz z (var_ref y))
(swiz z (var_ref x)))))
- (assign (constant bool (1))
- (swiz w (var_ref r))
+ (assign (constant bool (1)) (w) (var_ref r)
(call atan ((swiz w (var_ref y))
(swiz w (var_ref x)))))
(return (var_ref r)))))
diff --git a/src/glsl/builtins/ir/distance b/src/glsl/builtins/ir/distance
index a2309c484f..7789ca6314 100644
--- a/src/glsl/builtins/ir/distance
+++ b/src/glsl/builtins/ir/distance
@@ -3,16 +3,14 @@
(parameters
(declare (in) float p0)
(declare (in) float p1))
- ((declare () float p)
- (assign (constant bool (1)) (var_ref p) (expression float - (var_ref p0) (var_ref p1)))
- (return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
+ ((return (expression float abs (expression float - (var_ref p0) (var_ref p1))))))
(signature float
(parameters
(declare (in) vec2 p0)
(declare (in) vec2 p1))
((declare () vec2 p)
- (assign (constant bool (1)) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
+ (assign (constant bool (1)) (xy) (var_ref p) (expression vec2 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
(signature float
@@ -20,7 +18,7 @@
(declare (in) vec3 p0)
(declare (in) vec3 p1))
((declare () vec3 p)
- (assign (constant bool (1)) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
+ (assign (constant bool (1)) (xyz) (var_ref p) (expression vec3 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
(signature float
@@ -28,6 +26,6 @@
(declare (in) vec4 p0)
(declare (in) vec4 p1))
((declare () vec4 p)
- (assign (constant bool (1)) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
+ (assign (constant bool (1)) (xyzw) (var_ref p) (expression vec4 - (var_ref p0) (var_ref p1)))
(return (expression float sqrt (expression float dot (var_ref p) (var_ref p))))))
))
diff --git a/src/glsl/builtins/ir/dot b/src/glsl/builtins/ir/dot
index a91a6d2c56..1f27f32359 100644
--- a/src/glsl/builtins/ir/dot
+++ b/src/glsl/builtins/ir/dot
@@ -3,7 +3,7 @@
(parameters
(declare (in) float arg0)
(declare (in) float arg1))
- ((return (expression float dot (var_ref arg0) (var_ref arg1)))))
+ ((return (expression float * (var_ref arg0) (var_ref arg1)))))
(signature float
(parameters
diff --git a/src/glsl/builtins/ir/equal b/src/glsl/builtins/ir/equal
index c394776770..f6578dc1e3 100644
--- a/src/glsl/builtins/ir/equal
+++ b/src/glsl/builtins/ir/equal
@@ -3,119 +3,71 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) bvec2 arg0)
(declare (in) bvec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) bvec3 arg0)
(declare (in) bvec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) bvec4 arg0)
(declare (in) bvec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 all_equal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool == (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool == (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool == (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool == (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 all_equal (var_ref arg0) (var_ref arg1)))))
))
diff --git a/src/glsl/builtins/ir/faceforward b/src/glsl/builtins/ir/faceforward
index d170397238..35b79571c6 100644
--- a/src/glsl/builtins/ir/faceforward
+++ b/src/glsl/builtins/ir/faceforward
@@ -4,7 +4,7 @@
(declare (in) float N)
(declare (in) float I)
(declare (in) float Nref))
- ((if (expression bool < (expression float dot (var_ref Nref) (var_ref I)) (constant float (0)))
+ ((if (expression bool < (expression float * (var_ref Nref) (var_ref I)) (constant float (0)))
((return (var_ref N)))
((return (expression float neg (var_ref N)))))))
diff --git a/src/glsl/builtins/ir/greaterThan b/src/glsl/builtins/ir/greaterThan
index ce7bd29bed..f5489008ed 100644
--- a/src/glsl/builtins/ir/greaterThan
+++ b/src/glsl/builtins/ir/greaterThan
@@ -4,8 +4,8 @@
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -13,9 +13,9 @@
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -23,10 +23,10 @@
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -34,8 +34,8 @@
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -43,9 +43,9 @@
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -53,10 +53,10 @@
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -64,8 +64,8 @@
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -73,9 +73,9 @@
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -83,9 +83,9 @@
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool > (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool > (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool > (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool > (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))
diff --git a/src/glsl/builtins/ir/greaterThanEqual b/src/glsl/builtins/ir/greaterThanEqual
index de1a9f9516..d00354042a 100644
--- a/src/glsl/builtins/ir/greaterThanEqual
+++ b/src/glsl/builtins/ir/greaterThanEqual
@@ -4,8 +4,8 @@
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -13,9 +13,9 @@
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -23,10 +23,10 @@
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -34,8 +34,8 @@
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -43,9 +43,9 @@
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -53,10 +53,10 @@
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -64,8 +64,8 @@
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -73,9 +73,9 @@
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -83,9 +83,9 @@
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool >= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool >= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool >= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool >= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))
diff --git a/src/glsl/builtins/ir/length b/src/glsl/builtins/ir/length
index 89ff7f3ef1..b72334ee8a 100644
--- a/src/glsl/builtins/ir/length
+++ b/src/glsl/builtins/ir/length
@@ -2,7 +2,7 @@
(signature float
(parameters
(declare (in) float arg0))
- ((return (expression float sqrt (expression float dot (var_ref arg0) (var_ref arg0))))))
+ ((return (expression float abs (var_ref arg0)))))
(signature float
(parameters
diff --git a/src/glsl/builtins/ir/lessThan b/src/glsl/builtins/ir/lessThan
index 52113b7046..e29288a972 100644
--- a/src/glsl/builtins/ir/lessThan
+++ b/src/glsl/builtins/ir/lessThan
@@ -4,8 +4,8 @@
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -13,9 +13,9 @@
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -23,10 +23,10 @@
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -34,8 +34,8 @@
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -43,9 +43,9 @@
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -53,10 +53,10 @@
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -64,8 +64,8 @@
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -73,9 +73,9 @@
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -83,9 +83,9 @@
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool < (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool < (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool < (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool < (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))
diff --git a/src/glsl/builtins/ir/lessThanEqual b/src/glsl/builtins/ir/lessThanEqual
index 4b240be5d1..669f2341d4 100644
--- a/src/glsl/builtins/ir/lessThanEqual
+++ b/src/glsl/builtins/ir/lessThanEqual
@@ -4,8 +4,8 @@
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -13,9 +13,9 @@
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -23,10 +23,10 @@
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -34,8 +34,8 @@
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -43,9 +43,9 @@
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -53,10 +53,10 @@
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
(signature bvec2
@@ -64,8 +64,8 @@
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
(return (var_ref temp))))
(signature bvec3
@@ -73,9 +73,9 @@
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
(return (var_ref temp))))
(signature bvec4
@@ -83,9 +83,9 @@
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
+ (assign (constant bool (1)) (x) (var_ref temp) (expression bool <= (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
+ (assign (constant bool (1)) (y) (var_ref temp) (expression bool <= (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
+ (assign (constant bool (1)) (z) (var_ref temp) (expression bool <= (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
+ (assign (constant bool (1)) (w) (var_ref temp) (expression bool <= (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
(return (var_ref temp))))
))
diff --git a/src/glsl/builtins/ir/matrixCompMult b/src/glsl/builtins/ir/matrixCompMult
index 538da18a79..4be9b03e31 100644
--- a/src/glsl/builtins/ir/matrixCompMult
+++ b/src/glsl/builtins/ir/matrixCompMult
@@ -4,8 +4,8 @@
(declare (in) mat2 x)
(declare (in) mat2 y))
((declare () mat2 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat3
@@ -13,9 +13,9 @@
(declare (in) mat3 x)
(declare (in) mat3 y))
((declare () mat3 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat4
@@ -23,10 +23,10 @@
(declare (in) mat4 x)
(declare (in) mat4 y))
((declare () mat4 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (3))) (expression vec4 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
(signature mat2x3
@@ -34,8 +34,8 @@
(declare (in) mat2x3 x)
(declare (in) mat2x3 y))
((declare () mat2x3 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat3x2
@@ -43,9 +43,9 @@
(declare (in) mat3x2 x)
(declare (in) mat3x2 y))
((declare () mat3x2 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat2x4
@@ -53,8 +53,8 @@
(declare (in) mat2x4 x)
(declare (in) mat2x4 y))
((declare () mat2x4 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
(return (var_ref z))))
(signature mat4x2
@@ -62,10 +62,10 @@
(declare (in) mat4x2 x)
(declare (in) mat4x2 y))
((declare () mat4x2 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (0))) (expression vec2 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (1))) (expression vec2 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (2))) (expression vec2 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref z) (constant int (3))) (expression vec2 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
(signature mat3x4
@@ -73,9 +73,9 @@
(declare (in) mat3x4 x)
(declare (in) mat3x4 y))
((declare () mat3x4 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (0))) (expression vec4 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (1))) (expression vec4 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref z) (constant int (2))) (expression vec4 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
(return (var_ref z))))
(signature mat4x3
@@ -83,9 +83,9 @@
(declare (in) mat4x3 x)
(declare (in) mat4x3 y))
((declare () mat4x3 z)
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
- (assign (constant bool (1)) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (0))) (expression vec3 * (array_ref (var_ref x) (constant int (0))) (array_ref (var_ref y) (constant int (0)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (1))) (expression vec3 * (array_ref (var_ref x) (constant int (1))) (array_ref (var_ref y) (constant int (1)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (2))) (expression vec3 * (array_ref (var_ref x) (constant int (2))) (array_ref (var_ref y) (constant int (2)))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref z) (constant int (3))) (expression vec3 * (array_ref (var_ref x) (constant int (3))) (array_ref (var_ref y) (constant int (3)))))
(return (var_ref z))))
))
diff --git a/src/glsl/builtins/ir/mix b/src/glsl/builtins/ir/mix
index 6bc6f0a43e..a31f0fa708 100644
--- a/src/glsl/builtins/ir/mix
+++ b/src/glsl/builtins/ir/mix
@@ -61,8 +61,8 @@
(declare (in) vec2 v1)
(declare (in) vec2 v2)
(declare (in) bvec2 a))
- ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
- (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
+ ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))
+ (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))
(return (var_ref v1))))
(signature vec3
@@ -70,9 +70,9 @@
(declare (in) vec3 v1)
(declare (in) vec3 v2)
(declare (in) bvec3 a))
- ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
- (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
- (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))
+ ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))
+ (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))
+ (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))
(return (var_ref v1))))
(signature vec4
@@ -80,9 +80,9 @@
(declare (in) vec4 v1)
(declare (in) vec4 v2)
(declare (in) bvec4 a))
- ((assign (swiz x (var_ref a)) (swiz x (var_ref v1)) (swiz x (var_ref v2)))
- (assign (swiz y (var_ref a)) (swiz y (var_ref v1)) (swiz y (var_ref v2)))
- (assign (swiz z (var_ref a)) (swiz z (var_ref v1)) (swiz z (var_ref v2)))
- (assign (swiz w (var_ref a)) (swiz w (var_ref v1)) (swiz w (var_ref v2)))
+ ((assign (swiz x (var_ref a)) (x) (var_ref v1) (swiz x (var_ref v2)))
+ (assign (swiz y (var_ref a)) (y) (var_ref v1) (swiz y (var_ref v2)))
+ (assign (swiz z (var_ref a)) (z) (var_ref v1) (swiz z (var_ref v2)))
+ (assign (swiz w (var_ref a)) (w) (var_ref v1) (swiz w (var_ref v2)))
(return (var_ref v1))))
))
diff --git a/src/glsl/builtins/ir/noise1 b/src/glsl/builtins/ir/noise1
index eb7be35857..115505610a 100644
--- a/src/glsl/builtins/ir/noise1
+++ b/src/glsl/builtins/ir/noise1
@@ -2,17 +2,17 @@
(signature float
(parameters
(declare (in) float x))
- ((return (constant float (0)))))
+ ((return (expression float noise (var_ref x)))))
(signature float
(parameters
(declare (in) vec2 x))
- ((return (constant float (0)))))
+ ((return (expression float noise (var_ref x)))))
(signature float
(parameters
(declare (in) vec3 x))
- ((return (constant float (0)))))
+ ((return (expression float noise (var_ref x)))))
(signature float
(parameters
(declare (in) vec4 x))
- ((return (constant float (0)))))
+ ((return (expression float noise (var_ref x)))))
))
diff --git a/src/glsl/builtins/ir/noise2 b/src/glsl/builtins/ir/noise2
index ae4443a704..008f8b00f1 100644
--- a/src/glsl/builtins/ir/noise2
+++ b/src/glsl/builtins/ir/noise2
@@ -1,18 +1,61 @@
((function noise2
- (signature vec2
- (parameters
- (declare (in) float x))
- ((return (constant vec2 (0 0)))))
- (signature vec2
- (parameters
- (declare (in) vec2 x))
- ((return (constant vec2 (0 0)))))
- (signature vec2
- (parameters
- (declare (in) vec3 x))
- ((return (constant vec2 (0 0)))))
- (signature vec2
- (parameters
- (declare (in) vec4 x))
- ((return (constant vec2 (0 0)))))
+ (signature vec2
+ (parameters (declare (in) vec4 p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () vec2 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
+ (return (var_ref t))
+ ))
+
+ (signature vec2
+ (parameters (declare (in) vec3 p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () vec2 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
+ (return (var_ref t))
+ ))
+
+ (signature vec2
+ (parameters
+ (declare (in ) vec2 p)
+ )
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () vec2 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
+ (return (var_ref t))
+ ))
+
+ (signature vec2
+ (parameters
+ (declare (in ) float p)
+ )
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () vec2 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xx (var_ref b)))
+ (return (var_ref t))
+ ))
))
diff --git a/src/glsl/builtins/ir/noise3 b/src/glsl/builtins/ir/noise3
index 30d9681890..f191e145f9 100644
--- a/src/glsl/builtins/ir/noise3
+++ b/src/glsl/builtins/ir/noise3
@@ -1,18 +1,73 @@
((function noise3
- (signature vec3
- (parameters
- (declare (in) float x))
- ((return (constant vec3 (0 0 0)))))
- (signature vec3
- (parameters
- (declare (in) vec2 x))
- ((return (constant vec3 (0 0 0)))))
- (signature vec3
- (parameters
- (declare (in) vec3 x))
- ((return (constant vec3 (0 0 0)))))
- (signature vec3
- (parameters
- (declare (in) vec4 x))
- ((return (constant vec3 (0 0 0)))))
+ (signature vec3
+ (parameters (declare (in) vec4 p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () float c)
+ (declare () vec3 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+ (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
+ (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
+ (return (var_ref t))
+ ))
+
+ (signature vec3
+ (parameters (declare (in) vec3 p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () float c)
+ (declare () vec3 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+ (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
+ (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
+ (return (var_ref t))
+ ))
+
+ (signature vec3
+ (parameters (declare (in) vec2 p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () float c)
+ (declare () vec3 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+ (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
+ (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
+ (return (var_ref t))
+ ))
+
+ (signature vec3
+ (parameters (declare (in) float p))
+ (
+ (declare () float a)
+ (declare () float b)
+ (declare () float c)
+ (declare () vec3 t)
+
+ (assign (constant bool (1)) (x) (var_ref a) (expression float noise (var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref b) (expression float noise (expression float + (var_ref p) (constant float (601.0)))))
+ (assign (constant bool (1)) (x) (var_ref c) (expression float noise (expression float + (var_ref p) (constant float (1559.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref t) (swiz xxx (var_ref a)))
+ (assign (constant bool (1)) (y) (var_ref t) (swiz xxx (var_ref b)))
+ (assign (constant bool (1)) (z) (var_ref t) (swiz xxx (var_ref c)))
+ (return (var_ref t))
+ ))
))
diff --git a/src/glsl/builtins/ir/noise4 b/src/glsl/builtins/ir/noise4
index 913bef2aa1..fb300fd148 100644
--- a/src/glsl/builtins/ir/noise4
+++ b/src/glsl/builtins/ir/noise4
@@ -1,18 +1,97 @@
((function noise4
- (signature vec4
- (parameters
- (declare (in) float x))
- ((return (constant vec4 (0 0 0 0)))))
- (signature vec4
- (parameters
- (declare (in) vec2 x))
- ((return (constant vec4 (0 0 0 0)))))
- (signature vec4
- (parameters
- (declare (in) vec3 x))
- ((return (constant vec4 (0 0 0 0)))))
- (signature vec4
- (parameters
- (declare (in) vec4 x))
- ((return (constant vec4 (0 0 0 0)))))
+ (signature vec4
+ (parameters (declare (in) vec4 p))
+ (
+ (declare () float _x)
+ (declare () float _y)
+ (declare () float _z)
+ (declare () float _w)
+ (declare () vec4 _r)
+
+ (declare () vec4 _p)
+ (assign (constant bool (1)) (xyzw) (var_ref _p) (expression vec4 + (var_ref p) (constant vec4 (1559.0 113.0 1861.0 797.0))) )
+
+ (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec4 + (var_ref p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
+ (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec4 + (var_ref _p) (constant vec4 (601.0 313.0 29.0 277.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
+ (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
+ (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
+ (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
+ (return (var_ref _r))
+ ))
+
+ (signature vec4
+ (parameters (declare (in) vec3 p))
+ (
+ (declare () float _x)
+ (declare () float _y)
+ (declare () float _z)
+ (declare () float _w)
+ (declare () vec4 _r)
+
+ (declare () vec3 _p)
+ (assign (constant bool (1)) (xyz) (var_ref _p) (expression vec3 + (var_ref p) (constant vec3 (1559.0 113.0 1861.0))) )
+
+ (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec3 + (var_ref p) (constant vec3 (601.0 313.0 29.0)))))
+ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
+ (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec3 + (var_ref _p) (constant vec3 (601.0 313.0 29.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
+ (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
+ (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
+ (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
+ (return (var_ref _r))
+ ))
+
+ (signature vec4
+ (parameters (declare (in) vec2 p))
+ (
+ (declare () float _x)
+ (declare () float _y)
+ (declare () float _z)
+ (declare () float _w)
+ (declare () vec4 _r)
+
+ (declare () vec2 _p)
+ (assign (constant bool (1)) (xy) (var_ref _p) (expression vec2 + (var_ref p) (constant vec2 (1559.0 113.0))) )
+
+ (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression vec2 + (var_ref p) (constant vec2 (601.0 313.0)))))
+ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
+ (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression vec2 + (var_ref _p) (constant vec2 (601.0 313.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
+ (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
+ (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
+ (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
+ (return (var_ref _r))
+ ))
+
+ (signature vec4
+ (parameters (declare (in) float p))
+ (
+ (declare () float _x)
+ (declare () float _y)
+ (declare () float _z)
+ (declare () float _w)
+ (declare () vec4 _r)
+
+ (declare () float _p)
+ (assign (constant bool (1)) (xy) (var_ref _p) (expression float + (var_ref p) (constant float (1559.0))) )
+
+ (assign (constant bool (1)) (x) (var_ref _x) (expression float noise(var_ref p)))
+ (assign (constant bool (1)) (x) (var_ref _y) (expression float noise(expression float + (var_ref p) (constant float (601.0 313.0 29.0 277.0)))))
+ (assign (constant bool (1)) (x) (var_ref _z) (expression float noise(var_ref _p)))
+ (assign (constant bool (1)) (x) (var_ref _w) (expression float noise(expression float + (var_ref _p) (constant float (601.0 313.0 29.0 277.0)))))
+
+ (assign (constant bool (1)) (x) (var_ref _r) (swiz xxxx (var_ref _x)))
+ (assign (constant bool (1)) (y) (var_ref _r) (swiz xxxx (var_ref _y)))
+ (assign (constant bool (1)) (z) (var_ref _r) (swiz xxxx (var_ref _z)))
+ (assign (constant bool (1)) (w) (var_ref _r) (swiz xxxx (var_ref _w)))
+ (return (var_ref _r))
+ ))
))
diff --git a/src/glsl/builtins/ir/normalize b/src/glsl/builtins/ir/normalize
index be88a9830d..0de0db0b64 100644
--- a/src/glsl/builtins/ir/normalize
+++ b/src/glsl/builtins/ir/normalize
@@ -2,7 +2,7 @@
(signature float
(parameters
(declare (in) float arg0))
- ((return (expression float * (var_ref arg0) (expression float rsq (expression float dot (var_ref arg0) (var_ref arg0)))))))
+ ((return (expression float sign (var_ref arg0)))))
(signature vec2
(parameters
diff --git a/src/glsl/builtins/ir/notEqual b/src/glsl/builtins/ir/notEqual
index eeeda79042..d07cdbf41f 100644
--- a/src/glsl/builtins/ir/notEqual
+++ b/src/glsl/builtins/ir/notEqual
@@ -3,119 +3,71 @@
(parameters
(declare (in) vec2 arg0)
(declare (in) vec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) vec3 arg0)
(declare (in) vec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) vec4 arg0)
(declare (in) vec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) bvec2 arg0)
(declare (in) bvec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) bvec3 arg0)
(declare (in) bvec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) bvec4 arg0)
(declare (in) bvec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) ivec2 arg0)
(declare (in) ivec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) ivec3 arg0)
(declare (in) ivec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) ivec4 arg0)
(declare (in) ivec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec2
(parameters
(declare (in) uvec2 arg0)
(declare (in) uvec2 arg1))
- ((declare () bvec2 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec2 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec3
(parameters
(declare (in) uvec3 arg0)
(declare (in) uvec3 arg1))
- ((declare () bvec3 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec3 any_nequal (var_ref arg0) (var_ref arg1)))))
(signature bvec4
(parameters
(declare (in) uvec4 arg0)
(declare (in) uvec4 arg1))
- ((declare () bvec4 temp)
- (assign (constant bool (1)) (swiz x (var_ref temp)) (expression bool != (swiz x (var_ref arg0))(swiz x (var_ref arg1))))
- (assign (constant bool (1)) (swiz y (var_ref temp)) (expression bool != (swiz y (var_ref arg0))(swiz y (var_ref arg1))))
- (assign (constant bool (1)) (swiz z (var_ref temp)) (expression bool != (swiz z (var_ref arg0))(swiz z (var_ref arg1))))
- (assign (constant bool (1)) (swiz w (var_ref temp)) (expression bool != (swiz w (var_ref arg0))(swiz w (var_ref arg1))))
- (return (var_ref temp))))
+ ((return (expression bvec4 any_nequal (var_ref arg0) (var_ref arg1)))))
))
diff --git a/src/glsl/builtins/ir/outerProduct b/src/glsl/builtins/ir/outerProduct
index 69ae741e17..61d4626154 100644
--- a/src/glsl/builtins/ir/outerProduct
+++ b/src/glsl/builtins/ir/outerProduct
@@ -4,8 +4,8 @@
(declare (in) vec2 u)
(declare (in) vec2 v))
((declare () mat2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat2x3
@@ -13,8 +13,8 @@
(declare (in) vec3 u)
(declare (in) vec2 v))
((declare () mat2x3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat2x4
@@ -22,8 +22,8 @@
(declare (in) vec4 u)
(declare (in) vec2 v))
((declare () mat2x4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
(return (var_ref m))))
(signature mat3x2
@@ -31,9 +31,9 @@
(declare (in) vec2 u)
(declare (in) vec3 v))
((declare () mat3x2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))
))
@@ -42,9 +42,9 @@
(declare (in) vec3 u)
(declare (in) vec3 v))
((declare () mat3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))))
(signature mat3x4
@@ -52,9 +52,9 @@
(declare (in) vec4 u)
(declare (in) vec3 v))
((declare () mat3x4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
(return (var_ref m))))
(signature mat4x2
@@ -62,10 +62,10 @@
(declare (in) vec2 u)
(declare (in) vec4 v))
((declare () mat4x2 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (0))) (expression vec2 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (1))) (expression vec2 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (2))) (expression vec2 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xy) (array_ref (var_ref m) (constant int (3))) (expression vec2 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
(signature mat4x3
@@ -73,10 +73,10 @@
(declare (in) vec3 u)
(declare (in) vec4 v))
((declare () mat4x3 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (0))) (expression vec3 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (1))) (expression vec3 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (2))) (expression vec3 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xyz) (array_ref (var_ref m) (constant int (3))) (expression vec3 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
(signature mat4
@@ -84,9 +84,9 @@
(declare (in) vec4 u)
(declare (in) vec4 v))
((declare () mat4 m)
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
- (assign (constant bool (1)) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (0))) (expression vec4 * (var_ref u) (swiz x (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (1))) (expression vec4 * (var_ref u) (swiz y (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (2))) (expression vec4 * (var_ref u) (swiz z (var_ref v))))
+ (assign (constant bool (1)) (xyzw) (array_ref (var_ref m) (constant int (3))) (expression vec4 * (var_ref u) (swiz w (var_ref v))))
(return (var_ref m))))
))
diff --git a/src/glsl/builtins/ir/reflect b/src/glsl/builtins/ir/reflect
index 8238fdc93f..1fa394e3c9 100644
--- a/src/glsl/builtins/ir/reflect
+++ b/src/glsl/builtins/ir/reflect
@@ -8,7 +8,7 @@
(expression float *
(constant float (2.0))
(expression float *
- (expression float dot
+ (expression float *
(var_ref n)
(var_ref i))
(var_ref n)))))))
diff --git a/src/glsl/builtins/ir/refract b/src/glsl/builtins/ir/refract
index 522ab41173..f6319b0ed4 100644
--- a/src/glsl/builtins/ir/refract
+++ b/src/glsl/builtins/ir/refract
@@ -5,14 +5,14 @@
(declare (in) float n)
(declare (in) float eta))
((declare () float k)
- (assign (constant bool (1)) (var_ref k)
+ (assign (constant bool (1)) (x) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
(expression float - (constant float (1.0))
(expression float *
- (expression float dot (var_ref n) (var_ref i))
- (expression float dot (var_ref n) (var_ref i))))))))
+ (expression float * (var_ref n) (var_ref i))
+ (expression float * (var_ref n) (var_ref i))))))))
(if (expression bool < (var_ref k) (constant float (0.0)))
((return (constant float (0.0))))
((return (expression float -
@@ -20,7 +20,7 @@
(expression float *
(expression float +
(expression float * (var_ref eta)
- (expression float dot (var_ref n) (var_ref i)))
+ (expression float * (var_ref n) (var_ref i)))
(expression float sqrt (var_ref k)))
(var_ref n))))))))
@@ -30,7 +30,7 @@
(declare (in) vec2 n)
(declare (in) float eta))
((declare () float k)
- (assign (constant bool (1)) (var_ref k)
+ (assign (constant bool (1)) (x) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
@@ -55,7 +55,7 @@
(declare (in) vec3 n)
(declare (in) float eta))
((declare () float k)
- (assign (constant bool (1)) (var_ref k)
+ (assign (constant bool (1)) (x) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
@@ -80,7 +80,7 @@
(declare (in) vec4 n)
(declare (in) float eta))
((declare () float k)
- (assign (constant bool (1)) (var_ref k)
+ (assign (constant bool (1)) (x) (var_ref k)
(expression float - (constant float (1.0))
(expression float * (var_ref eta)
(expression float * (var_ref eta)
diff --git a/src/glsl/builtins/ir/smoothstep b/src/glsl/builtins/ir/smoothstep
index 663eec6341..0164219a05 100644
--- a/src/glsl/builtins/ir/smoothstep
+++ b/src/glsl/builtins/ir/smoothstep
@@ -6,7 +6,7 @@
(declare (in) float x))
((declare () float t)
- (assign (constant bool (1)) (var_ref t)
+ (assign (constant bool (1)) (x) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (var_ref x) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
@@ -22,21 +22,21 @@
((declare () vec2 t)
(declare () vec2 retval)
- (assign (constant bool (1)) (swiz x (var_ref t))
+ (assign (constant bool (1)) (x) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
+ (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
- (assign (constant bool (1)) (swiz y (var_ref t))
+ (assign (constant bool (1)) (y) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
+ (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
(return (var_ref retval))
))
@@ -48,29 +48,29 @@
((declare () vec3 t)
(declare () vec3 retval)
- (assign (constant bool (1)) (swiz x (var_ref t))
+ (assign (constant bool (1)) (x) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
+ (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
- (assign (constant bool (1)) (swiz y (var_ref t))
+ (assign (constant bool (1)) (y) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
+ (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
- (assign (constant bool (1)) (swiz z (var_ref t))
+ (assign (constant bool (1)) (z) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
+ (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
(return (var_ref retval))
))
@@ -83,37 +83,37 @@
((declare () vec4 t)
(declare () vec4 retval)
- (assign (constant bool (1)) (swiz x (var_ref t))
+ (assign (constant bool (1)) (x) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz x (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz x (var_ref retval)) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
+ (assign (constant bool (1)) (x) (var_ref retval) (expression float * (swiz x (var_ref t)) (expression float * (swiz x (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz x (var_ref t)))))))
- (assign (constant bool (1)) (swiz y (var_ref t))
+ (assign (constant bool (1)) (y) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz y (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz y (var_ref retval)) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
+ (assign (constant bool (1)) (y) (var_ref retval) (expression float * (swiz y (var_ref t)) (expression float * (swiz y (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz y (var_ref t)))))))
- (assign (constant bool (1)) (swiz z (var_ref t))
+ (assign (constant bool (1)) (z) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz z (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz z (var_ref retval)) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
+ (assign (constant bool (1)) (z) (var_ref retval) (expression float * (swiz z (var_ref t)) (expression float * (swiz z (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz z (var_ref t)))))))
- (assign (constant bool (1)) (swiz w (var_ref t))
+ (assign (constant bool (1)) (w) (var_ref t)
(expression float max
(expression float min
(expression float / (expression float - (swiz w (var_ref x)) (var_ref edge0)) (expression float - (var_ref edge1) (var_ref edge0)))
(constant float (1.0)))
(constant float (0.0))))
- (assign (constant bool (1)) (swiz w (var_ref retval)) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))
+ (assign (constant bool (1)) (w) (var_ref retval) (expression float * (swiz w (var_ref t)) (expression float * (swiz w (var_ref t)) (expression float - (constant float (3.000000)) (expression float * (constant float (2.000000)) (swiz w (var_ref t)))))))
(return (var_ref retval))
))
diff --git a/src/glsl/builtins/ir/step b/src/glsl/builtins/ir/step
index ce6f435422..7aec9d7a6c 100644
--- a/src/glsl/builtins/ir/step
+++ b/src/glsl/builtins/ir/step
@@ -10,8 +10,8 @@
(declare (in) float edge)
(declare (in) vec2 x))
((declare () vec2 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec3
@@ -19,9 +19,9 @@
(declare (in) float edge)
(declare (in) vec3 x))
((declare () vec3 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec4
@@ -29,10 +29,10 @@
(declare (in) float edge)
(declare (in) vec4 x))
((declare () vec4 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
- (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(var_ref edge))))
+ (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(var_ref edge))))
(return (var_ref t))))
(signature vec2
@@ -40,8 +40,8 @@
(declare (in) vec2 edge)
(declare (in) vec2 x))
((declare () vec2 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
(return (var_ref t))))
(signature vec3
@@ -49,9 +49,9 @@
(declare (in) vec3 edge)
(declare (in) vec3 x))
((declare () vec3 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
- (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+ (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
(return (var_ref t))))
(signature vec4
@@ -59,10 +59,10 @@
(declare (in) vec4 edge)
(declare (in) vec4 x))
((declare () vec4 t)
- (assign (constant bool (1)) (swiz x (var_ref t)) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
- (assign (constant bool (1)) (swiz y (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
- (assign (constant bool (1)) (swiz z (var_ref t)) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz z (var_ref edge)))))
- (assign (constant bool (1)) (swiz w (var_ref t)) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
+ (assign (constant bool (1)) (x) (var_ref t) (expression float b2f (expression bool >= (swiz x (var_ref x))(swiz x (var_ref edge)))))
+ (assign (constant bool (1)) (y) (var_ref t) (expression float b2f (expression bool >= (swiz y (var_ref x))(swiz y (var_ref edge)))))
+ (assign (constant bool (1)) (z) (var_ref t) (expression float b2f (expression bool >= (swiz z (var_ref x))(swiz z (var_ref edge)))))
+ (assign (constant bool (1)) (w) (var_ref t) (expression float b2f (expression bool >= (swiz w (var_ref x))(swiz w (var_ref edge)))))
(return (var_ref t))))
))
diff --git a/src/glsl/builtins/ir/transpose b/src/glsl/builtins/ir/transpose
index 416a0ee467..4bed4489bf 100644
--- a/src/glsl/builtins/ir/transpose
+++ b/src/glsl/builtins/ir/transpose
@@ -3,135 +3,135 @@
(parameters
(declare (in) mat2 m))
((declare () mat2 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat3x2
(parameters
(declare (in) mat2x3 m))
((declare () mat3x2 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat4x2
(parameters
(declare (in) mat2x4 m))
((declare () mat4x2 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
(return (var_ref t))))
(signature mat2x3
(parameters
(declare (in) mat3x2 m))
((declare () mat2x3 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat3
(parameters
(declare (in) mat3 m))
((declare () mat3 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat4x3
(parameters
(declare (in) mat3x4 m))
((declare () mat4x3 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
(return (var_ref t))))
(signature mat2x4
(parameters
(declare (in) mat4x2 m))
((declare () mat2x4 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
(signature mat3x4
(parameters
(declare (in) mat4x3 m))
((declare () mat3x4 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
(signature mat4
(parameters
(declare (in) mat4 m))
((declare () mat4 t)
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz x (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (0)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz y (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (1)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz z (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (2)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (0)))) (swiz x (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (1)))) (swiz y (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (2)))) (swiz z (array_ref (var_ref m) (constant int (3)))))
- (assign (constant bool (1)) (swiz w (array_ref (var_ref t) (constant int (3)))) (swiz w (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (x) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (0)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (y) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (1)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (z) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (2)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (0))) (swiz x (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (1))) (swiz y (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (2))) (swiz z (array_ref (var_ref m) (constant int (3)))))
+ (assign (constant bool (1)) (w) (array_ref (var_ref t) (constant int (3))) (swiz w (array_ref (var_ref m) (constant int (3)))))
(return (var_ref t))))
)
diff --git a/src/glsl/builtins/profiles/100.frag b/src/glsl/builtins/profiles/100.frag
new file mode 100644
index 0000000000..df4c7f042c
--- /dev/null
+++ b/src/glsl/builtins/profiles/100.frag
@@ -0,0 +1,300 @@
+#version 100
+/*
+ * 8.1 - Angle and Trigonometry Functions
+ */
+float radians(float degrees);
+vec2 radians(vec2 degrees);
+vec3 radians(vec3 degrees);
+vec4 radians(vec4 degrees);
+
+float degrees(float radians);
+vec2 degrees(vec2 radians);
+vec3 degrees(vec3 radians);
+vec4 degrees(vec4 radians);
+
+float sin(float angle);
+vec2 sin(vec2 angle);
+vec3 sin(vec3 angle);
+vec4 sin(vec4 angle);
+
+float cos(float angle);
+vec2 cos(vec2 angle);
+vec3 cos(vec3 angle);
+vec4 cos(vec4 angle);
+
+float tan(float angle);
+vec2 tan(vec2 angle);
+vec3 tan(vec3 angle);
+vec4 tan(vec4 angle);
+
+float asin(float angle);
+vec2 asin(vec2 angle);
+vec3 asin(vec3 angle);
+vec4 asin(vec4 angle);
+
+float acos(float angle);
+vec2 acos(vec2 angle);
+vec3 acos(vec3 angle);
+vec4 acos(vec4 angle);
+
+float atan(float y, float x);
+vec2 atan(vec2 y, vec2 x);
+vec3 atan(vec3 y, vec3 x);
+vec4 atan(vec4 y, vec4 x);
+
+float atan(float y_over_x);
+vec2 atan(vec2 y_over_x);
+vec3 atan(vec3 y_over_x);
+vec4 atan(vec4 y_over_x);
+
+/*
+ * 8.2 - Exponential Functions
+ */
+float pow(float x, float y);
+vec2 pow(vec2 x, vec2 y);
+vec3 pow(vec3 x, vec3 y);
+vec4 pow(vec4 x, vec4 y);
+
+float exp(float x);
+vec2 exp(vec2 x);
+vec3 exp(vec3 x);
+vec4 exp(vec4 x);
+
+float log(float x);
+vec2 log(vec2 x);
+vec3 log(vec3 x);
+vec4 log(vec4 x);
+
+float exp2(float x);
+vec2 exp2(vec2 x);
+vec3 exp2(vec3 x);
+vec4 exp2(vec4 x);
+
+float log2(float x);
+vec2 log2(vec2 x);
+vec3 log2(vec3 x);
+vec4 log2(vec4 x);
+
+float sqrt(float x);
+vec2 sqrt(vec2 x);
+vec3 sqrt(vec3 x);
+vec4 sqrt(vec4 x);
+
+float inversesqrt(float x);
+vec2 inversesqrt(vec2 x);
+vec3 inversesqrt(vec3 x);
+vec4 inversesqrt(vec4 x);
+
+/*
+ * 8.3 - Common Functions
+ */
+float abs(float x);
+vec2 abs(vec2 x);
+vec3 abs(vec3 x);
+vec4 abs(vec4 x);
+
+float sign(float x);
+vec2 sign(vec2 x);
+vec3 sign(vec3 x);
+vec4 sign(vec4 x);
+
+float floor(float x);
+vec2 floor(vec2 x);
+vec3 floor(vec3 x);
+vec4 floor(vec4 x);
+
+float ceil(float x);
+vec2 ceil(vec2 x);
+vec3 ceil(vec3 x);
+vec4 ceil(vec4 x);
+
+float fract(float x);
+vec2 fract(vec2 x);
+vec3 fract(vec3 x);
+vec4 fract(vec4 x);
+
+float mod(float x, float y);
+vec2 mod(vec2 x, float y);
+vec3 mod(vec3 x, float y);
+vec4 mod(vec4 x, float y);
+
+vec2 mod(vec2 x, vec2 y);
+vec3 mod(vec3 x, vec3 y);
+vec4 mod(vec4 x, vec4 y);
+
+float min(float x, float y);
+vec2 min(vec2 x, vec2 y);
+vec3 min(vec3 x, vec3 y);
+vec4 min(vec4 x, vec4 y);
+
+vec2 min(vec2 x, float y);
+vec3 min(vec3 x, float y);
+vec4 min(vec4 x, float y);
+
+float max(float x, float y);
+vec2 max(vec2 x, vec2 y);
+vec3 max(vec3 x, vec3 y);
+vec4 max(vec4 x, vec4 y);
+
+vec2 max(vec2 x, float y);
+vec3 max(vec3 x, float y);
+vec4 max(vec4 x, float y);
+
+float clamp(float x, float minVal, float maxVal);
+vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
+vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
+vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
+
+vec2 clamp(vec2 x, float minVal, float maxVal);
+vec3 clamp(vec3 x, float minVal, float maxVal);
+vec4 clamp(vec4 x, float minVal, float maxVal);
+
+float mix(float x, float y, float a);
+vec2 mix(vec2 x, vec2 y, vec2 a);
+vec3 mix(vec3 x, vec3 y, vec3 a);
+vec4 mix(vec4 x, vec4 y, vec4 a);
+
+vec2 mix(vec2 x, vec2 y, float a);
+vec3 mix(vec3 x, vec3 y, float a);
+vec4 mix(vec4 x, vec4 y, float a);
+
+float step(float edge, float x);
+vec2 step(vec2 edge, vec2 x);
+vec3 step(vec3 edge, vec3 x);
+vec4 step(vec4 edge, vec4 x);
+
+vec2 step(float edge, vec2 x);
+vec3 step(float edge, vec3 x);
+vec4 step(float edge, vec4 x);
+
+float smoothstep(float edge0, float edge1, float x);
+vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
+vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
+vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
+
+vec2 smoothstep(float edge0, float edge1, vec2 x);
+vec3 smoothstep(float edge0, float edge1, vec3 x);
+vec4 smoothstep(float edge0, float edge1, vec4 x);
+
+/*
+ * 8.4 - Geometric Functions
+ */
+float length(float x);
+float length(vec2 x);
+float length(vec3 x);
+float length(vec4 x);
+
+float distance(float p0, float p1);
+float distance(vec2 p0, vec2 p1);
+float distance(vec3 p0, vec3 p1);
+float distance(vec4 p0, vec4 p1);
+
+float dot(float x, float y);
+float dot(vec2 x, vec2 y);
+float dot(vec3 x, vec3 y);
+float dot(vec4 x, vec4 y);
+
+vec3 cross(vec3 x, vec3 y);
+
+float normalize(float x);
+vec2 normalize(vec2 x);
+vec3 normalize(vec3 x);
+vec4 normalize(vec4 x);
+
+float faceforward(float N, float I, float Nref);
+vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
+vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
+vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
+
+float reflect(float I, float N);
+vec2 reflect(vec2 I, vec2 N);
+vec3 reflect(vec3 I, vec3 N);
+vec4 reflect(vec4 I, vec4 N);
+
+float refract(float I, float N, float eta);
+vec2 refract(vec2 I, vec2 N, float eta);
+vec3 refract(vec3 I, vec3 N, float eta);
+vec4 refract(vec4 I, vec4 N, float eta);
+
+/*
+ * 8.5 - Matrix Functions
+ */
+mat2 matrixCompMult(mat2 x, mat2 y);
+mat3 matrixCompMult(mat3 x, mat3 y);
+mat4 matrixCompMult(mat4 x, mat4 y);
+
+/*
+ * 8.6 - Vector Relational Functions
+ */
+bvec2 lessThan( vec2 x, vec2 y);
+bvec3 lessThan( vec3 x, vec3 y);
+bvec4 lessThan( vec4 x, vec4 y);
+bvec2 lessThan(ivec2 x, ivec2 y);
+bvec3 lessThan(ivec3 x, ivec3 y);
+bvec4 lessThan(ivec4 x, ivec4 y);
+
+bvec2 lessThanEqual( vec2 x, vec2 y);
+bvec3 lessThanEqual( vec3 x, vec3 y);
+bvec4 lessThanEqual( vec4 x, vec4 y);
+bvec2 lessThanEqual(ivec2 x, ivec2 y);
+bvec3 lessThanEqual(ivec3 x, ivec3 y);
+bvec4 lessThanEqual(ivec4 x, ivec4 y);
+
+bvec2 greaterThan( vec2 x, vec2 y);
+bvec3 greaterThan( vec3 x, vec3 y);
+bvec4 greaterThan( vec4 x, vec4 y);
+bvec2 greaterThan(ivec2 x, ivec2 y);
+bvec3 greaterThan(ivec3 x, ivec3 y);
+bvec4 greaterThan(ivec4 x, ivec4 y);
+
+bvec2 greaterThanEqual( vec2 x, vec2 y);
+bvec3 greaterThanEqual( vec3 x, vec3 y);
+bvec4 greaterThanEqual( vec4 x, vec4 y);
+bvec2 greaterThanEqual(ivec2 x, ivec2 y);
+bvec3 greaterThanEqual(ivec3 x, ivec3 y);
+bvec4 greaterThanEqual(ivec4 x, ivec4 y);
+
+bvec2 equal( vec2 x, vec2 y);
+bvec3 equal( vec3 x, vec3 y);
+bvec4 equal( vec4 x, vec4 y);
+bvec2 equal(ivec2 x, ivec2 y);
+bvec3 equal(ivec3 x, ivec3 y);
+bvec4 equal(ivec4 x, ivec4 y);
+bvec2 equal(bvec2 x, bvec2 y);
+bvec3 equal(bvec3 x, bvec3 y);
+bvec4 equal(bvec4 x, bvec4 y);
+
+bvec2 notEqual( vec2 x, vec2 y);
+bvec3 notEqual( vec3 x, vec3 y);
+bvec4 notEqual( vec4 x, vec4 y);
+bvec2 notEqual(ivec2 x, ivec2 y);
+bvec3 notEqual(ivec3 x, ivec3 y);
+bvec4 notEqual(ivec4 x, ivec4 y);
+bvec2 notEqual(bvec2 x, bvec2 y);
+bvec3 notEqual(bvec3 x, bvec3 y);
+bvec4 notEqual(bvec4 x, bvec4 y);
+
+bool any(bvec2 x);
+bool any(bvec3 x);
+bool any(bvec4 x);
+
+bool all(bvec2 x);
+bool all(bvec3 x);
+bool all(bvec4 x);
+
+bvec2 not(bvec2 x);
+bvec3 not(bvec3 x);
+bvec4 not(bvec4 x);
+
+/*
+ * 8.7 - Texture Lookup Functions
+ */
+vec4 texture2D (sampler2D sampler, vec2 coord);
+vec4 texture2DProj (sampler2D sampler, vec3 coord);
+vec4 texture2DProj (sampler2D sampler, vec4 coord);
+vec4 texture2D (sampler2D sampler, vec2 coord, float bias);
+vec4 texture2DProj (sampler2D sampler, vec3 coord, float bias);
+vec4 texture2DProj (sampler2D sampler, vec4 coord, float bias);
+
+vec4 textureCube (samplerCube sampler, vec3 coord);
+vec4 textureCube (samplerCube sampler, vec3 coord, float bias);
diff --git a/src/glsl/builtins/profiles/100.vert b/src/glsl/builtins/profiles/100.vert
new file mode 100644
index 0000000000..e5d96f1db7
--- /dev/null
+++ b/src/glsl/builtins/profiles/100.vert
@@ -0,0 +1,300 @@
+#version 100
+/*
+ * 8.1 - Angle and Trigonometry Functions
+ */
+float radians(float degrees);
+vec2 radians(vec2 degrees);
+vec3 radians(vec3 degrees);
+vec4 radians(vec4 degrees);
+
+float degrees(float radians);
+vec2 degrees(vec2 radians);
+vec3 degrees(vec3 radians);
+vec4 degrees(vec4 radians);
+
+float sin(float angle);
+vec2 sin(vec2 angle);
+vec3 sin(vec3 angle);
+vec4 sin(vec4 angle);
+
+float cos(float angle);
+vec2 cos(vec2 angle);
+vec3 cos(vec3 angle);
+vec4 cos(vec4 angle);
+
+float tan(float angle);
+vec2 tan(vec2 angle);
+vec3 tan(vec3 angle);
+vec4 tan(vec4 angle);
+
+float asin(float angle);
+vec2 asin(vec2 angle);
+vec3 asin(vec3 angle);
+vec4 asin(vec4 angle);
+
+float acos(float angle);
+vec2 acos(vec2 angle);
+vec3 acos(vec3 angle);
+vec4 acos(vec4 angle);
+
+float atan(float y, float x);
+vec2 atan(vec2 y, vec2 x);
+vec3 atan(vec3 y, vec3 x);
+vec4 atan(vec4 y, vec4 x);
+
+float atan(float y_over_x);
+vec2 atan(vec2 y_over_x);
+vec3 atan(vec3 y_over_x);
+vec4 atan(vec4 y_over_x);
+
+/*
+ * 8.2 - Exponential Functions
+ */
+float pow(float x, float y);
+vec2 pow(vec2 x, vec2 y);
+vec3 pow(vec3 x, vec3 y);
+vec4 pow(vec4 x, vec4 y);
+
+float exp(float x);
+vec2 exp(vec2 x);
+vec3 exp(vec3 x);
+vec4 exp(vec4 x);
+
+float log(float x);
+vec2 log(vec2 x);
+vec3 log(vec3 x);
+vec4 log(vec4 x);
+
+float exp2(float x);
+vec2 exp2(vec2 x);
+vec3 exp2(vec3 x);
+vec4 exp2(vec4 x);
+
+float log2(float x);
+vec2 log2(vec2 x);
+vec3 log2(vec3 x);
+vec4 log2(vec4 x);
+
+float sqrt(float x);
+vec2 sqrt(vec2 x);
+vec3 sqrt(vec3 x);
+vec4 sqrt(vec4 x);
+
+float inversesqrt(float x);
+vec2 inversesqrt(vec2 x);
+vec3 inversesqrt(vec3 x);
+vec4 inversesqrt(vec4 x);
+
+/*
+ * 8.3 - Common Functions
+ */
+float abs(float x);
+vec2 abs(vec2 x);
+vec3 abs(vec3 x);
+vec4 abs(vec4 x);
+
+float sign(float x);
+vec2 sign(vec2 x);
+vec3 sign(vec3 x);
+vec4 sign(vec4 x);
+
+float floor(float x);
+vec2 floor(vec2 x);
+vec3 floor(vec3 x);
+vec4 floor(vec4 x);
+
+float ceil(float x);
+vec2 ceil(vec2 x);
+vec3 ceil(vec3 x);
+vec4 ceil(vec4 x);
+
+float fract(float x);
+vec2 fract(vec2 x);
+vec3 fract(vec3 x);
+vec4 fract(vec4 x);
+
+float mod(float x, float y);
+vec2 mod(vec2 x, float y);
+vec3 mod(vec3 x, float y);
+vec4 mod(vec4 x, float y);
+
+vec2 mod(vec2 x, vec2 y);
+vec3 mod(vec3 x, vec3 y);
+vec4 mod(vec4 x, vec4 y);
+
+float min(float x, float y);
+vec2 min(vec2 x, vec2 y);
+vec3 min(vec3 x, vec3 y);
+vec4 min(vec4 x, vec4 y);
+
+vec2 min(vec2 x, float y);
+vec3 min(vec3 x, float y);
+vec4 min(vec4 x, float y);
+
+float max(float x, float y);
+vec2 max(vec2 x, vec2 y);
+vec3 max(vec3 x, vec3 y);
+vec4 max(vec4 x, vec4 y);
+
+vec2 max(vec2 x, float y);
+vec3 max(vec3 x, float y);
+vec4 max(vec4 x, float y);
+
+float clamp(float x, float minVal, float maxVal);
+vec2 clamp(vec2 x, vec2 minVal, vec2 maxVal);
+vec3 clamp(vec3 x, vec3 minVal, vec3 maxVal);
+vec4 clamp(vec4 x, vec4 minVal, vec4 maxVal);
+
+vec2 clamp(vec2 x, float minVal, float maxVal);
+vec3 clamp(vec3 x, float minVal, float maxVal);
+vec4 clamp(vec4 x, float minVal, float maxVal);
+
+float mix(float x, float y, float a);
+vec2 mix(vec2 x, vec2 y, vec2 a);
+vec3 mix(vec3 x, vec3 y, vec3 a);
+vec4 mix(vec4 x, vec4 y, vec4 a);
+
+vec2 mix(vec2 x, vec2 y, float a);
+vec3 mix(vec3 x, vec3 y, float a);
+vec4 mix(vec4 x, vec4 y, float a);
+
+float step(float edge, float x);
+vec2 step(vec2 edge, vec2 x);
+vec3 step(vec3 edge, vec3 x);
+vec4 step(vec4 edge, vec4 x);
+
+vec2 step(float edge, vec2 x);
+vec3 step(float edge, vec3 x);
+vec4 step(float edge, vec4 x);
+
+float smoothstep(float edge0, float edge1, float x);
+vec2 smoothstep(vec2 edge0, vec2 edge1, vec2 x);
+vec3 smoothstep(vec3 edge0, vec3 edge1, vec3 x);
+vec4 smoothstep(vec4 edge0, vec4 edge1, vec4 x);
+
+vec2 smoothstep(float edge0, float edge1, vec2 x);
+vec3 smoothstep(float edge0, float edge1, vec3 x);
+vec4 smoothstep(float edge0, float edge1, vec4 x);
+
+/*
+ * 8.4 - Geometric Functions
+ */
+float length(float x);
+float length(vec2 x);
+float length(vec3 x);
+float length(vec4 x);
+
+float distance(float p0, float p1);
+float distance(vec2 p0, vec2 p1);
+float distance(vec3 p0, vec3 p1);
+float distance(vec4 p0, vec4 p1);
+
+float dot(float x, float y);
+float dot(vec2 x, vec2 y);
+float dot(vec3 x, vec3 y);
+float dot(vec4 x, vec4 y);
+
+vec3 cross(vec3 x, vec3 y);
+
+float normalize(float x);
+vec2 normalize(vec2 x);
+vec3 normalize(vec3 x);
+vec4 normalize(vec4 x);
+
+float faceforward(float N, float I, float Nref);
+vec2 faceforward(vec2 N, vec2 I, vec2 Nref);
+vec3 faceforward(vec3 N, vec3 I, vec3 Nref);
+vec4 faceforward(vec4 N, vec4 I, vec4 Nref);
+
+float reflect(float I, float N);
+vec2 reflect(vec2 I, vec2 N);
+vec3 reflect(vec3 I, vec3 N);
+vec4 reflect(vec4 I, vec4 N);
+
+float refract(float I, float N, float eta);
+vec2 refract(vec2 I, vec2 N, float eta);
+vec3 refract(vec3 I, vec3 N, float eta);
+vec4 refract(vec4 I, vec4 N, float eta);
+
+/*
+ * 8.5 - Matrix Functions
+ */
+mat2 matrixCompMult(mat2 x, mat2 y);
+mat3 matrixCompMult(mat3 x, mat3 y);
+mat4 matrixCompMult(mat4 x, mat4 y);
+
+/*
+ * 8.6 - Vector Relational Functions
+ */
+bvec2 lessThan( vec2 x, vec2 y);
+bvec3 lessThan( vec3 x, vec3 y);
+bvec4 lessThan( vec4 x, vec4 y);
+bvec2 lessThan(ivec2 x, ivec2 y);
+bvec3 lessThan(ivec3 x, ivec3 y);
+bvec4 lessThan(ivec4 x, ivec4 y);
+
+bvec2 lessThanEqual( vec2 x, vec2 y);
+bvec3 lessThanEqual( vec3 x, vec3 y);
+bvec4 lessThanEqual( vec4 x, vec4 y);
+bvec2 lessThanEqual(ivec2 x, ivec2 y);
+bvec3 lessThanEqual(ivec3 x, ivec3 y);
+bvec4 lessThanEqual(ivec4 x, ivec4 y);
+
+bvec2 greaterThan( vec2 x, vec2 y);
+bvec3 greaterThan( vec3 x, vec3 y);
+bvec4 greaterThan( vec4 x, vec4 y);
+bvec2 greaterThan(ivec2 x, ivec2 y);
+bvec3 greaterThan(ivec3 x, ivec3 y);
+bvec4 greaterThan(ivec4 x, ivec4 y);
+
+bvec2 greaterThanEqual( vec2 x, vec2 y);
+bvec3 greaterThanEqual( vec3 x, vec3 y);
+bvec4 greaterThanEqual( vec4 x, vec4 y);
+bvec2 greaterThanEqual(ivec2 x, ivec2 y);
+bvec3 greaterThanEqual(ivec3 x, ivec3 y);
+bvec4 greaterThanEqual(ivec4 x, ivec4 y);
+
+bvec2 equal( vec2 x, vec2 y);
+bvec3 equal( vec3 x, vec3 y);
+bvec4 equal( vec4 x, vec4 y);
+bvec2 equal(ivec2 x, ivec2 y);
+bvec3 equal(ivec3 x, ivec3 y);
+bvec4 equal(ivec4 x, ivec4 y);
+bvec2 equal(bvec2 x, bvec2 y);
+bvec3 equal(bvec3 x, bvec3 y);
+bvec4 equal(bvec4 x, bvec4 y);
+
+bvec2 notEqual( vec2 x, vec2 y);
+bvec3 notEqual( vec3 x, vec3 y);
+bvec4 notEqual( vec4 x, vec4 y);
+bvec2 notEqual(ivec2 x, ivec2 y);
+bvec3 notEqual(ivec3 x, ivec3 y);
+bvec4 notEqual(ivec4 x, ivec4 y);
+bvec2 notEqual(bvec2 x, bvec2 y);
+bvec3 notEqual(bvec3 x, bvec3 y);
+bvec4 notEqual(bvec4 x, bvec4 y);
+
+bool any(bvec2 x);
+bool any(bvec3 x);
+bool any(bvec4 x);
+
+bool all(bvec2 x);
+bool all(bvec3 x);
+bool all(bvec4 x);
+
+bvec2 not(bvec2 x);
+bvec3 not(bvec3 x);
+bvec4 not(bvec4 x);
+
+/*
+ * 8.7 - Texture Lookup Functions
+ */
+vec4 texture2D (sampler2D sampler, vec2 coord);
+vec4 texture2DProj (sampler2D sampler, vec3 coord);
+vec4 texture2DProj (sampler2D sampler, vec4 coord);
+vec4 texture2DLod (sampler2D sampler, vec2 coord, float lod);
+vec4 texture2DProjLod(sampler2D sampler, vec3 coord, float lod);
+vec4 texture2DProjLod(sampler2D sampler, vec4 coord, float lod);
+
+vec4 textureCube (samplerCube sampler, vec3 coord);
+vec4 textureCubeLod (samplerCube sampler, vec3 coord, float lod);
diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
index 5accc1b120..691a318c1c 100755
--- a/src/glsl/builtins/tools/generate_builtins.py
+++ b/src/glsl/builtins/tools/generate_builtins.py
@@ -128,9 +128,11 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
gl_shader *
read_builtins(GLenum target, const char *protos, const char **functions, unsigned count)
{
+ GLcontext fakeCtx;
+ fakeCtx.API = API_OPENGL;
gl_shader *sh = _mesa_new_shader(NULL, 0, target);
struct _mesa_glsl_parse_state *st =
- new(sh) _mesa_glsl_parse_state(NULL, target, sh);
+ new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
st->language_version = 130;
st->symbols->language_version = 130;
@@ -153,6 +155,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
if (st->error) {
printf("error reading builtin: %.35s ...\\n", functions[i]);
+ printf("Info log:\\n%s\\n", st->info_log);
talloc_free(sh);
return NULL;
}
@@ -180,6 +183,7 @@ _mesa_glsl_release_functions(void)
{
talloc_free(builtin_mem_ctx);
builtin_mem_ctx = NULL;
+ memset(builtin_profiles, 0, sizeof(builtin_profiles));
}
static void
diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c
index 91eb0bf972..1773ca5c13 100644
--- a/src/glsl/glcpp/glcpp-parse.c
+++ b/src/glsl/glcpp/glcpp-parse.c
@@ -1,10 +1,9 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +45,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.4.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -101,6 +100,7 @@
#include "glcpp.h"
#include "main/core.h" /* for struct gl_extensions */
+#include "main/mtypes.h" /* for gl_api enum */
#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str)
#define glcpp_printf(stream, fmt, args, ...) \
@@ -357,7 +357,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -632,17 +632,17 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 187, 187, 189, 193, 196, 201, 202, 206, 209,
- 215, 218, 221, 224, 232, 251, 261, 266, 271, 290,
- 305, 308, 311, 320, 324, 333, 338, 339, 342, 345,
- 348, 351, 354, 357, 360, 363, 366, 369, 372, 375,
- 378, 381, 384, 387, 390, 393, 396, 399, 402, 405,
- 411, 416, 424, 425, 429, 435, 436, 439, 441, 448,
- 452, 456, 461, 467, 475, 481, 489, 493, 497, 501,
- 505, 512, 513, 514, 515, 516, 517, 518, 519, 520,
- 521, 522, 523, 524, 525, 526, 527, 528, 529, 530,
- 531, 532, 533, 534, 535, 536, 537, 538, 539, 540,
- 541, 542
+ 0, 188, 188, 190, 194, 197, 202, 203, 207, 210,
+ 216, 219, 222, 225, 233, 252, 262, 267, 272, 291,
+ 306, 309, 312, 325, 329, 338, 343, 344, 347, 350,
+ 353, 356, 359, 362, 365, 368, 371, 374, 377, 380,
+ 383, 386, 389, 392, 395, 398, 401, 404, 407, 410,
+ 416, 421, 429, 430, 434, 440, 441, 444, 446, 453,
+ 457, 461, 466, 472, 480, 486, 494, 498, 502, 506,
+ 510, 517, 518, 519, 520, 521, 522, 523, 524, 525,
+ 526, 527, 528, 529, 530, 531, 532, 533, 534, 535,
+ 536, 537, 538, 539, 540, 541, 542, 543, 544, 545,
+ 546, 547
};
#endif
@@ -945,9 +945,18 @@ static const yytype_uint8 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -1004,7 +1013,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@@ -1546,7 +1555,7 @@ YYLTYPE yylloc;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
+ YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize;
@@ -1593,7 +1602,7 @@ YYLTYPE yylloc;
yyvsp = yyvs;
yylsp = yyls;
-#if YYLTYPE_IS_TRIVIAL
+#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
@@ -1601,8 +1610,8 @@ YYLTYPE yylloc;
/* User initialization code. */
-/* Line 1242 of yacc.c */
-#line 154 "glcpp/glcpp-parse.y"
+/* Line 1251 of yacc.c */
+#line 155 "glcpp/glcpp-parse.y"
{
yylloc.first_line = 1;
yylloc.first_column = 1;
@@ -1611,8 +1620,8 @@ YYLTYPE yylloc;
yylloc.source = 0;
}
-/* Line 1242 of yacc.c */
-#line 1616 "glcpp/glcpp-parse.c"
+/* Line 1251 of yacc.c */
+#line 1625 "glcpp/glcpp-parse.c"
yylsp[0] = yylloc;
goto yysetstate;
@@ -1799,8 +1808,8 @@ yyreduce:
{
case 4:
-/* Line 1455 of yacc.c */
-#line 193 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 194 "glcpp/glcpp-parse.y"
{
glcpp_print(parser->output, "\n");
;}
@@ -1808,8 +1817,8 @@ yyreduce:
case 5:
-/* Line 1455 of yacc.c */
-#line 196 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 197 "glcpp/glcpp-parse.y"
{
_glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list));
glcpp_print(parser->output, "\n");
@@ -1819,8 +1828,8 @@ yyreduce:
case 8:
-/* Line 1455 of yacc.c */
-#line 206 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 207 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival));
;}
@@ -1828,8 +1837,8 @@ yyreduce:
case 9:
-/* Line 1455 of yacc.c */
-#line 209 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 210 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival));
;}
@@ -1837,8 +1846,8 @@ yyreduce:
case 10:
-/* Line 1455 of yacc.c */
-#line 215 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 216 "glcpp/glcpp-parse.y"
{
_define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list));
;}
@@ -1846,8 +1855,8 @@ yyreduce:
case 11:
-/* Line 1455 of yacc.c */
-#line 218 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 219 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
;}
@@ -1855,8 +1864,8 @@ yyreduce:
case 12:
-/* Line 1455 of yacc.c */
-#line 221 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 222 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list));
;}
@@ -1864,8 +1873,8 @@ yyreduce:
case 13:
-/* Line 1455 of yacc.c */
-#line 224 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 225 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str));
if (macro) {
@@ -1878,8 +1887,8 @@ yyreduce:
case 14:
-/* Line 1455 of yacc.c */
-#line 232 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 233 "glcpp/glcpp-parse.y"
{
/* Be careful to only evaluate the 'if' expression if
* we are not skipping. When we are skipping, we
@@ -1903,8 +1912,8 @@ yyreduce:
case 15:
-/* Line 1455 of yacc.c */
-#line 251 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 252 "glcpp/glcpp-parse.y"
{
/* #if without an expression is only an error if we
* are not skipping */
@@ -1919,8 +1928,8 @@ yyreduce:
case 16:
-/* Line 1455 of yacc.c */
-#line 261 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 262 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1930,8 +1939,8 @@ yyreduce:
case 17:
-/* Line 1455 of yacc.c */
-#line 266 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 267 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1941,8 +1950,8 @@ yyreduce:
case 18:
-/* Line 1455 of yacc.c */
-#line 271 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 272 "glcpp/glcpp-parse.y"
{
/* Be careful to only evaluate the 'elif' expression
* if we are not skipping. When we are skipping, we
@@ -1966,8 +1975,8 @@ yyreduce:
case 19:
-/* Line 1455 of yacc.c */
-#line 290 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 291 "glcpp/glcpp-parse.y"
{
/* #elif without an expression is an error unless we
* are skipping. */
@@ -1987,8 +1996,8 @@ yyreduce:
case 20:
-/* Line 1455 of yacc.c */
-#line 305 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 306 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1);
;}
@@ -1996,8 +2005,8 @@ yyreduce:
case 21:
-/* Line 1455 of yacc.c */
-#line 308 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 309 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)]));
;}
@@ -2005,8 +2014,8 @@ yyreduce:
case 22:
-/* Line 1455 of yacc.c */
-#line 311 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 312 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
if (macro) {
@@ -2014,14 +2023,18 @@ yyreduce:
talloc_free (macro);
}
add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival));
+
+ if ((yyvsp[(2) - (3)].ival) == 100)
+ add_builtin_define (parser, "GL_ES", 1);
+
glcpp_printf(parser->output, "#version %" PRIiMAX, (yyvsp[(2) - (3)].ival));
;}
break;
case 24:
-/* Line 1455 of yacc.c */
-#line 324 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 329 "glcpp/glcpp-parse.y"
{
if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
(yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16);
@@ -2035,8 +2048,8 @@ yyreduce:
case 25:
-/* Line 1455 of yacc.c */
-#line 333 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 338 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (1)].ival);
;}
@@ -2044,8 +2057,8 @@ yyreduce:
case 27:
-/* Line 1455 of yacc.c */
-#line 339 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 344 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
;}
@@ -2053,8 +2066,8 @@ yyreduce:
case 28:
-/* Line 1455 of yacc.c */
-#line 342 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 347 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
;}
@@ -2062,8 +2075,8 @@ yyreduce:
case 29:
-/* Line 1455 of yacc.c */
-#line 345 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 350 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
;}
@@ -2071,8 +2084,8 @@ yyreduce:
case 30:
-/* Line 1455 of yacc.c */
-#line 348 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 353 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
;}
@@ -2080,8 +2093,8 @@ yyreduce:
case 31:
-/* Line 1455 of yacc.c */
-#line 351 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 356 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
;}
@@ -2089,8 +2102,8 @@ yyreduce:
case 32:
-/* Line 1455 of yacc.c */
-#line 354 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 359 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
;}
@@ -2098,8 +2111,8 @@ yyreduce:
case 33:
-/* Line 1455 of yacc.c */
-#line 357 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 362 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
;}
@@ -2107,8 +2120,8 @@ yyreduce:
case 34:
-/* Line 1455 of yacc.c */
-#line 360 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 365 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
;}
@@ -2116,8 +2129,8 @@ yyreduce:
case 35:
-/* Line 1455 of yacc.c */
-#line 363 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 368 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
;}
@@ -2125,8 +2138,8 @@ yyreduce:
case 36:
-/* Line 1455 of yacc.c */
-#line 366 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 371 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
;}
@@ -2134,8 +2147,8 @@ yyreduce:
case 37:
-/* Line 1455 of yacc.c */
-#line 369 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 374 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
;}
@@ -2143,8 +2156,8 @@ yyreduce:
case 38:
-/* Line 1455 of yacc.c */
-#line 372 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 377 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
;}
@@ -2152,8 +2165,8 @@ yyreduce:
case 39:
-/* Line 1455 of yacc.c */
-#line 375 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 380 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
;}
@@ -2161,8 +2174,8 @@ yyreduce:
case 40:
-/* Line 1455 of yacc.c */
-#line 378 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 383 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
;}
@@ -2170,8 +2183,8 @@ yyreduce:
case 41:
-/* Line 1455 of yacc.c */
-#line 381 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 386 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
;}
@@ -2179,8 +2192,8 @@ yyreduce:
case 42:
-/* Line 1455 of yacc.c */
-#line 384 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 389 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival);
;}
@@ -2188,8 +2201,8 @@ yyreduce:
case 43:
-/* Line 1455 of yacc.c */
-#line 387 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 392 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
;}
@@ -2197,8 +2210,8 @@ yyreduce:
case 44:
-/* Line 1455 of yacc.c */
-#line 390 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 395 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
;}
@@ -2206,8 +2219,8 @@ yyreduce:
case 45:
-/* Line 1455 of yacc.c */
-#line 393 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 398 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ! (yyvsp[(2) - (2)].ival);
;}
@@ -2215,8 +2228,8 @@ yyreduce:
case 46:
-/* Line 1455 of yacc.c */
-#line 396 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 401 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
;}
@@ -2224,8 +2237,8 @@ yyreduce:
case 47:
-/* Line 1455 of yacc.c */
-#line 399 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 404 "glcpp/glcpp-parse.y"
{
(yyval.ival) = - (yyvsp[(2) - (2)].ival);
;}
@@ -2233,8 +2246,8 @@ yyreduce:
case 48:
-/* Line 1455 of yacc.c */
-#line 402 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 407 "glcpp/glcpp-parse.y"
{
(yyval.ival) = + (yyvsp[(2) - (2)].ival);
;}
@@ -2242,8 +2255,8 @@ yyreduce:
case 49:
-/* Line 1455 of yacc.c */
-#line 405 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 410 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(2) - (3)].ival);
;}
@@ -2251,8 +2264,8 @@ yyreduce:
case 50:
-/* Line 1455 of yacc.c */
-#line 411 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 416 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = _string_list_create (parser);
_string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str));
@@ -2262,8 +2275,8 @@ yyreduce:
case 51:
-/* Line 1455 of yacc.c */
-#line 416 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 421 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = (yyvsp[(1) - (3)].string_list);
_string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str));
@@ -2273,15 +2286,15 @@ yyreduce:
case 52:
-/* Line 1455 of yacc.c */
-#line 424 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 429 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
case 54:
-/* Line 1455 of yacc.c */
-#line 429 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 434 "glcpp/glcpp-parse.y"
{
yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
;}
@@ -2289,15 +2302,15 @@ yyreduce:
case 55:
-/* Line 1455 of yacc.c */
-#line 435 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 440 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
case 58:
-/* Line 1455 of yacc.c */
-#line 441 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 446 "glcpp/glcpp-parse.y"
{
glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
;}
@@ -2305,8 +2318,8 @@ yyreduce:
case 59:
-/* Line 1455 of yacc.c */
-#line 448 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 453 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
@@ -2315,8 +2328,8 @@ yyreduce:
case 60:
-/* Line 1455 of yacc.c */
-#line 452 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 457 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
@@ -2325,8 +2338,8 @@ yyreduce:
case 62:
-/* Line 1455 of yacc.c */
-#line 461 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 466 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
@@ -2337,8 +2350,8 @@ yyreduce:
case 63:
-/* Line 1455 of yacc.c */
-#line 467 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 472 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2348,8 +2361,8 @@ yyreduce:
case 64:
-/* Line 1455 of yacc.c */
-#line 475 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 480 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
@@ -2360,8 +2373,8 @@ yyreduce:
case 65:
-/* Line 1455 of yacc.c */
-#line 481 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 486 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2371,8 +2384,8 @@ yyreduce:
case 66:
-/* Line 1455 of yacc.c */
-#line 489 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 494 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@@ -2381,8 +2394,8 @@ yyreduce:
case 67:
-/* Line 1455 of yacc.c */
-#line 493 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 498 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@@ -2391,8 +2404,8 @@ yyreduce:
case 68:
-/* Line 1455 of yacc.c */
-#line 497 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 502 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
(yyval.token)->location = yylloc;
@@ -2401,8 +2414,8 @@ yyreduce:
case 69:
-/* Line 1455 of yacc.c */
-#line 501 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 506 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
@@ -2411,8 +2424,8 @@ yyreduce:
case 70:
-/* Line 1455 of yacc.c */
-#line 505 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 510 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
(yyval.token)->location = yylloc;
@@ -2421,225 +2434,225 @@ yyreduce:
case 71:
-/* Line 1455 of yacc.c */
-#line 512 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 517 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '['; ;}
break;
case 72:
-/* Line 1455 of yacc.c */
-#line 513 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 518 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ']'; ;}
break;
case 73:
-/* Line 1455 of yacc.c */
-#line 514 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 519 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '('; ;}
break;
case 74:
-/* Line 1455 of yacc.c */
-#line 515 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 520 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ')'; ;}
break;
case 75:
-/* Line 1455 of yacc.c */
-#line 516 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 521 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '{'; ;}
break;
case 76:
-/* Line 1455 of yacc.c */
-#line 517 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 522 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '}'; ;}
break;
case 77:
-/* Line 1455 of yacc.c */
-#line 518 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 523 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '.'; ;}
break;
case 78:
-/* Line 1455 of yacc.c */
-#line 519 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 524 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '&'; ;}
break;
case 79:
-/* Line 1455 of yacc.c */
-#line 520 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 525 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '*'; ;}
break;
case 80:
-/* Line 1455 of yacc.c */
-#line 521 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 526 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '+'; ;}
break;
case 81:
-/* Line 1455 of yacc.c */
-#line 522 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 527 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '-'; ;}
break;
case 82:
-/* Line 1455 of yacc.c */
-#line 523 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 528 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '~'; ;}
break;
case 83:
-/* Line 1455 of yacc.c */
-#line 524 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 529 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '!'; ;}
break;
case 84:
-/* Line 1455 of yacc.c */
-#line 525 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 530 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '/'; ;}
break;
case 85:
-/* Line 1455 of yacc.c */
-#line 526 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 531 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '%'; ;}
break;
case 86:
-/* Line 1455 of yacc.c */
-#line 527 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 532 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LEFT_SHIFT; ;}
break;
case 87:
-/* Line 1455 of yacc.c */
-#line 528 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 533 "glcpp/glcpp-parse.y"
{ (yyval.ival) = RIGHT_SHIFT; ;}
break;
case 88:
-/* Line 1455 of yacc.c */
-#line 529 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 534 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '<'; ;}
break;
case 89:
-/* Line 1455 of yacc.c */
-#line 530 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 535 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '>'; ;}
break;
case 90:
-/* Line 1455 of yacc.c */
-#line 531 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 536 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LESS_OR_EQUAL; ;}
break;
case 91:
-/* Line 1455 of yacc.c */
-#line 532 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 537 "glcpp/glcpp-parse.y"
{ (yyval.ival) = GREATER_OR_EQUAL; ;}
break;
case 92:
-/* Line 1455 of yacc.c */
-#line 533 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 538 "glcpp/glcpp-parse.y"
{ (yyval.ival) = EQUAL; ;}
break;
case 93:
-/* Line 1455 of yacc.c */
-#line 534 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 539 "glcpp/glcpp-parse.y"
{ (yyval.ival) = NOT_EQUAL; ;}
break;
case 94:
-/* Line 1455 of yacc.c */
-#line 535 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 540 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '^'; ;}
break;
case 95:
-/* Line 1455 of yacc.c */
-#line 536 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 541 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '|'; ;}
break;
case 96:
-/* Line 1455 of yacc.c */
-#line 537 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 542 "glcpp/glcpp-parse.y"
{ (yyval.ival) = AND; ;}
break;
case 97:
-/* Line 1455 of yacc.c */
-#line 538 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 543 "glcpp/glcpp-parse.y"
{ (yyval.ival) = OR; ;}
break;
case 98:
-/* Line 1455 of yacc.c */
-#line 539 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 544 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ';'; ;}
break;
case 99:
-/* Line 1455 of yacc.c */
-#line 540 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 545 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ','; ;}
break;
case 100:
-/* Line 1455 of yacc.c */
-#line 541 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 546 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '='; ;}
break;
case 101:
-/* Line 1455 of yacc.c */
-#line 542 "glcpp/glcpp-parse.y"
+/* Line 1464 of yacc.c */
+#line 547 "glcpp/glcpp-parse.y"
{ (yyval.ival) = PASTE; ;}
break;
-/* Line 1455 of yacc.c */
-#line 2643 "glcpp/glcpp-parse.c"
+/* Line 1464 of yacc.c */
+#line 2656 "glcpp/glcpp-parse.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2711,7 +2724,7 @@ yyerrlab:
#endif
}
- yyerror_range[0] = yylloc;
+ yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
@@ -2748,7 +2761,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- yyerror_range[0] = yylsp[1-yylen];
+ yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@@ -2782,7 +2795,7 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
- yyerror_range[0] = *yylsp;
+ yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, parser);
YYPOPSTACK (1);
@@ -2792,10 +2805,10 @@ yyerrlab1:
*++yyvsp = yylval;
- yyerror_range[1] = yylloc;
+ yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc;
/* Shift the error token. */
@@ -2857,8 +2870,8 @@ yyreturn:
-/* Line 1675 of yacc.c */
-#line 545 "glcpp/glcpp-parse.y"
+/* Line 1684 of yacc.c */
+#line 550 "glcpp/glcpp-parse.y"
string_list_t *
@@ -3365,7 +3378,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
}
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions)
+glcpp_parser_create (const struct gl_extensions *extensions, int api)
{
glcpp_parser_t *parser;
int language_version;
@@ -3395,6 +3408,9 @@ glcpp_parser_create (const struct gl_extensions *extensions)
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
+ if (api == API_OPENGLES2)
+ add_builtin_define(parser, "GL_ES", 1);
+
if (extensions != NULL) {
if (extensions->EXT_texture_array) {
add_builtin_define(parser, "GL_EXT_texture_array", 1);
diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h
index 50758930e9..40556854f3 100644
--- a/src/glsl/glcpp/glcpp-parse.h
+++ b/src/glsl/glcpp/glcpp-parse.h
@@ -1,10 +1,9 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 3c28edf688..43513ebb66 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -30,6 +30,7 @@
#include "glcpp.h"
#include "main/core.h" /* for struct gl_extensions */
+#include "main/mtypes.h" /* for gl_api enum */
#define glcpp_print(stream, str) stream = talloc_strdup_append(stream, str)
#define glcpp_printf(stream, fmt, args, ...) \
@@ -315,6 +316,10 @@ control_line:
talloc_free (macro);
}
add_builtin_define (parser, "__VERSION__", $2);
+
+ if ($2 == 100)
+ add_builtin_define (parser, "GL_ES", 1);
+
glcpp_printf(parser->output, "#version %" PRIiMAX, $2);
}
| HASH NEWLINE
@@ -1048,7 +1053,7 @@ static void add_builtin_define(glcpp_parser_t *parser,
}
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions)
+glcpp_parser_create (const struct gl_extensions *extensions, int api)
{
glcpp_parser_t *parser;
int language_version;
@@ -1078,6 +1083,9 @@ glcpp_parser_create (const struct gl_extensions *extensions)
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
+ if (api == API_OPENGLES2)
+ add_builtin_define(parser, "GL_ES", 1);
+
if (extensions != NULL) {
if (extensions->EXT_texture_array) {
add_builtin_define(parser, "GL_EXT_texture_array", 1);
diff --git a/src/glsl/glcpp/glcpp.c b/src/glsl/glcpp/glcpp.c
index 56714936bb..8d1ced571b 100644
--- a/src/glsl/glcpp/glcpp.c
+++ b/src/glsl/glcpp/glcpp.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <errno.h>
#include "glcpp.h"
+#include "main/mtypes.h"
extern int yydebug;
@@ -111,7 +112,7 @@ main (int argc, char *argv[])
if (shader == NULL)
return 1;
- ret = preprocess(ctx, &shader, &info_log, NULL);
+ ret = preprocess(ctx, &shader, &info_log, NULL, API_OPENGL);
printf("%s", shader);
fprintf(stderr, "%s", info_log);
diff --git a/src/glsl/glcpp/glcpp.h b/src/glsl/glcpp/glcpp.h
index 0bebdb9ae8..7125d325df 100644
--- a/src/glsl/glcpp/glcpp.h
+++ b/src/glsl/glcpp/glcpp.h
@@ -180,7 +180,7 @@ struct glcpp_parser {
struct gl_extensions;
glcpp_parser_t *
-glcpp_parser_create (const struct gl_extensions *extensions);
+glcpp_parser_create (const struct gl_extensions *extensions, int api);
int
glcpp_parser_parse (glcpp_parser_t *parser);
@@ -190,7 +190,7 @@ glcpp_parser_destroy (glcpp_parser_t *parser);
int
preprocess(void *talloc_ctx, const char **shader, char **info_log,
- const struct gl_extensions *extensions);
+ const struct gl_extensions *extensions, int api);
/* Functions for writing to the info log */
diff --git a/src/glsl/glcpp/pp.c b/src/glsl/glcpp/pp.c
index a1d00c4193..e1a3a88a3e 100644
--- a/src/glsl/glcpp/pp.c
+++ b/src/glsl/glcpp/pp.c
@@ -143,10 +143,10 @@ remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
int
preprocess(void *talloc_ctx, const char **shader, char **info_log,
- const struct gl_extensions *extensions)
+ const struct gl_extensions *extensions, int api)
{
int errors;
- glcpp_parser_t *parser = glcpp_parser_create (extensions);
+ glcpp_parser_t *parser = glcpp_parser_create (extensions, api);
*shader = remove_line_continuations(parser, *shader);
glcpp_lex_set_source_string (parser, *shader);
diff --git a/src/glsl/glsl_lexer.cpp b/src/glsl/glsl_lexer.cpp
index 873df609d3..7661bbe982 100644
--- a/src/glsl/glsl_lexer.cpp
+++ b/src/glsl/glsl_lexer.cpp
@@ -54,6 +54,7 @@ typedef int flex_int32_t;
typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
+#endif /* ! C99 */
/* Limits of integral types. */
#ifndef INT8_MIN
@@ -84,8 +85,6 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
-#endif /* ! C99 */
-
#endif /* ! FLEXINT_H */
#ifdef __cplusplus
@@ -159,15 +158,7 @@ typedef void* yyscan_t;
/* Size of default input buffer. */
#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
#endif
/* The state buf must be large enough to hold one state per character in the main buffer.
@@ -974,6 +965,16 @@ static yyconst flex_int16_t yy_chk[1145] =
} \
} while (0)
+/* Handle reserved words in GLSL ES (version 100) */
+#define TOKEN_OR_IDENTIFIER_ES(version, token) \
+ do { \
+ if (yyextra->es_shader) { \
+ return token; \
+ } else { \
+ TOKEN_OR_IDENTIFIER(version, token); \
+ } \
+ } while (0)
+
#define RESERVED_WORD(version, token) \
do { \
if (yyextra->language_version >= version) { \
@@ -985,7 +986,7 @@ static yyconst flex_int16_t yy_chk[1145] =
} \
} while (0)
-#line 989 "glsl_lexer.cpp"
+#line 990 "glsl_lexer.cpp"
#define INITIAL 0
#define PP 1
@@ -1112,12 +1113,7 @@ static int input (yyscan_t yyscanner );
/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
#endif
/* Copy whatever the last rule matched to the standard output. */
@@ -1125,7 +1121,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -1136,7 +1132,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -1224,10 +1220,10 @@ YY_DECL
register int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 76 "glsl_lexer.lpp"
+#line 86 "glsl_lexer.lpp"
-#line 1231 "glsl_lexer.cpp"
+#line 1227 "glsl_lexer.cpp"
yylval = yylval_param;
@@ -1313,7 +1309,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 78 "glsl_lexer.lpp"
+#line 88 "glsl_lexer.lpp"
;
YY_BREAK
/* Preprocessor tokens. */
@@ -1322,17 +1318,17 @@ case 2:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 81 "glsl_lexer.lpp"
+#line 91 "glsl_lexer.lpp"
;
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 82 "glsl_lexer.lpp"
+#line 92 "glsl_lexer.lpp"
{ BEGIN PP; return VERSION; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 83 "glsl_lexer.lpp"
+#line 93 "glsl_lexer.lpp"
{ BEGIN PP; return EXTENSION; }
YY_BREAK
case 5:
@@ -1340,7 +1336,7 @@ case 5:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 84 "glsl_lexer.lpp"
+#line 94 "glsl_lexer.lpp"
{
/* Eat characters until the first digit is
* encountered
@@ -1362,7 +1358,7 @@ case 6:
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 99 "glsl_lexer.lpp"
+#line 109 "glsl_lexer.lpp"
{
/* Eat characters until the first digit is
* encountered
@@ -1380,7 +1376,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 113 "glsl_lexer.lpp"
+#line 123 "glsl_lexer.lpp"
{
BEGIN PP;
return PRAGMA_DEBUG_ON;
@@ -1388,7 +1384,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 117 "glsl_lexer.lpp"
+#line 127 "glsl_lexer.lpp"
{
BEGIN PP;
return PRAGMA_DEBUG_OFF;
@@ -1396,7 +1392,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 121 "glsl_lexer.lpp"
+#line 131 "glsl_lexer.lpp"
{
BEGIN PP;
return PRAGMA_OPTIMIZE_ON;
@@ -1404,7 +1400,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 125 "glsl_lexer.lpp"
+#line 135 "glsl_lexer.lpp"
{
BEGIN PP;
return PRAGMA_OPTIMIZE_OFF;
@@ -1412,38 +1408,38 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 129 "glsl_lexer.lpp"
+#line 139 "glsl_lexer.lpp"
{ BEGIN PRAGMA; }
YY_BREAK
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 131 "glsl_lexer.lpp"
+#line 141 "glsl_lexer.lpp"
{ BEGIN 0; yylineno++; yycolumn = 0; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 132 "glsl_lexer.lpp"
+#line 142 "glsl_lexer.lpp"
{ }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 134 "glsl_lexer.lpp"
+#line 144 "glsl_lexer.lpp"
{ }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 135 "glsl_lexer.lpp"
+#line 145 "glsl_lexer.lpp"
{ }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 136 "glsl_lexer.lpp"
+#line 146 "glsl_lexer.lpp"
return COLON;
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 137 "glsl_lexer.lpp"
+#line 147 "glsl_lexer.lpp"
{
yylval->identifier = strdup(yytext);
return IDENTIFIER;
@@ -1451,7 +1447,7 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 141 "glsl_lexer.lpp"
+#line 151 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext, NULL, 10);
return INTCONSTANT;
@@ -1460,283 +1456,283 @@ YY_RULE_SETUP
case 19:
/* rule 19 can match eol */
YY_RULE_SETUP
-#line 145 "glsl_lexer.lpp"
+#line 155 "glsl_lexer.lpp"
{ BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
YY_BREAK
case 20:
/* rule 20 can match eol */
YY_RULE_SETUP
-#line 147 "glsl_lexer.lpp"
+#line 157 "glsl_lexer.lpp"
{ yylineno++; yycolumn = 0; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 149 "glsl_lexer.lpp"
+#line 159 "glsl_lexer.lpp"
return ATTRIBUTE;
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 150 "glsl_lexer.lpp"
+#line 160 "glsl_lexer.lpp"
return CONST_TOK;
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 151 "glsl_lexer.lpp"
+#line 161 "glsl_lexer.lpp"
return BOOL_TOK;
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 152 "glsl_lexer.lpp"
+#line 162 "glsl_lexer.lpp"
return FLOAT_TOK;
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 153 "glsl_lexer.lpp"
+#line 163 "glsl_lexer.lpp"
return INT_TOK;
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 155 "glsl_lexer.lpp"
+#line 165 "glsl_lexer.lpp"
return BREAK;
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 156 "glsl_lexer.lpp"
+#line 166 "glsl_lexer.lpp"
return CONTINUE;
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 157 "glsl_lexer.lpp"
+#line 167 "glsl_lexer.lpp"
return DO;
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 158 "glsl_lexer.lpp"
+#line 168 "glsl_lexer.lpp"
return WHILE;
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 159 "glsl_lexer.lpp"
+#line 169 "glsl_lexer.lpp"
return ELSE;
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 160 "glsl_lexer.lpp"
+#line 170 "glsl_lexer.lpp"
return FOR;
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 161 "glsl_lexer.lpp"
+#line 171 "glsl_lexer.lpp"
return IF;
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 162 "glsl_lexer.lpp"
+#line 172 "glsl_lexer.lpp"
return DISCARD;
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 163 "glsl_lexer.lpp"
+#line 173 "glsl_lexer.lpp"
return RETURN;
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 165 "glsl_lexer.lpp"
+#line 175 "glsl_lexer.lpp"
return BVEC2;
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 166 "glsl_lexer.lpp"
+#line 176 "glsl_lexer.lpp"
return BVEC3;
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 167 "glsl_lexer.lpp"
+#line 177 "glsl_lexer.lpp"
return BVEC4;
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 168 "glsl_lexer.lpp"
+#line 178 "glsl_lexer.lpp"
return IVEC2;
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 169 "glsl_lexer.lpp"
+#line 179 "glsl_lexer.lpp"
return IVEC3;
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 170 "glsl_lexer.lpp"
+#line 180 "glsl_lexer.lpp"
return IVEC4;
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 171 "glsl_lexer.lpp"
+#line 181 "glsl_lexer.lpp"
return VEC2;
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 172 "glsl_lexer.lpp"
+#line 182 "glsl_lexer.lpp"
return VEC3;
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 173 "glsl_lexer.lpp"
+#line 183 "glsl_lexer.lpp"
return VEC4;
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 174 "glsl_lexer.lpp"
+#line 184 "glsl_lexer.lpp"
return MAT2X2;
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 175 "glsl_lexer.lpp"
+#line 185 "glsl_lexer.lpp"
return MAT3X3;
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 176 "glsl_lexer.lpp"
+#line 186 "glsl_lexer.lpp"
return MAT4X4;
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 177 "glsl_lexer.lpp"
+#line 187 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT2X2);
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 178 "glsl_lexer.lpp"
+#line 188 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT2X3);
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 179 "glsl_lexer.lpp"
+#line 189 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT2X4);
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 180 "glsl_lexer.lpp"
+#line 190 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT3X2);
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 181 "glsl_lexer.lpp"
+#line 191 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT3X3);
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 182 "glsl_lexer.lpp"
+#line 192 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT3X4);
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 183 "glsl_lexer.lpp"
+#line 193 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT4X2);
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 184 "glsl_lexer.lpp"
+#line 194 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT4X3);
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 185 "glsl_lexer.lpp"
+#line 195 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, MAT4X4);
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 187 "glsl_lexer.lpp"
+#line 197 "glsl_lexer.lpp"
return IN_TOK;
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 188 "glsl_lexer.lpp"
+#line 198 "glsl_lexer.lpp"
return OUT_TOK;
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 189 "glsl_lexer.lpp"
+#line 199 "glsl_lexer.lpp"
return INOUT_TOK;
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 190 "glsl_lexer.lpp"
+#line 200 "glsl_lexer.lpp"
return UNIFORM;
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 191 "glsl_lexer.lpp"
+#line 201 "glsl_lexer.lpp"
return VARYING;
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 192 "glsl_lexer.lpp"
+#line 202 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(120, CENTROID);
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 193 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, INVARIANT);
+#line 203 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, INVARIANT);
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 195 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(130, FLAT);
+#line 205 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(130, FLAT);
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 196 "glsl_lexer.lpp"
+#line 206 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, SMOOTH);
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 197 "glsl_lexer.lpp"
+#line 207 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE);
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 199 "glsl_lexer.lpp"
+#line 209 "glsl_lexer.lpp"
return SAMPLER1D;
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 200 "glsl_lexer.lpp"
+#line 210 "glsl_lexer.lpp"
return SAMPLER2D;
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 201 "glsl_lexer.lpp"
+#line 211 "glsl_lexer.lpp"
return SAMPLER3D;
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 202 "glsl_lexer.lpp"
+#line 212 "glsl_lexer.lpp"
return SAMPLERCUBE;
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 203 "glsl_lexer.lpp"
+#line 213 "glsl_lexer.lpp"
return SAMPLER1DSHADOW;
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 204 "glsl_lexer.lpp"
+#line 214 "glsl_lexer.lpp"
return SAMPLER2DSHADOW;
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 206 "glsl_lexer.lpp"
+#line 216 "glsl_lexer.lpp"
return STRUCT;
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 207 "glsl_lexer.lpp"
+#line 217 "glsl_lexer.lpp"
return VOID_TOK;
YY_BREAK
case 74:
YY_RULE_SETUP
-#line 209 "glsl_lexer.lpp"
+#line 219 "glsl_lexer.lpp"
{
if ((yyextra->language_version >= 140)
|| (yyextra->ARB_fragment_coord_conventions_enable)){
@@ -1749,102 +1745,102 @@ YY_RULE_SETUP
YY_BREAK
case 75:
YY_RULE_SETUP
-#line 219 "glsl_lexer.lpp"
+#line 229 "glsl_lexer.lpp"
return INC_OP;
YY_BREAK
case 76:
YY_RULE_SETUP
-#line 220 "glsl_lexer.lpp"
+#line 230 "glsl_lexer.lpp"
return DEC_OP;
YY_BREAK
case 77:
YY_RULE_SETUP
-#line 221 "glsl_lexer.lpp"
+#line 231 "glsl_lexer.lpp"
return LE_OP;
YY_BREAK
case 78:
YY_RULE_SETUP
-#line 222 "glsl_lexer.lpp"
+#line 232 "glsl_lexer.lpp"
return GE_OP;
YY_BREAK
case 79:
YY_RULE_SETUP
-#line 223 "glsl_lexer.lpp"
+#line 233 "glsl_lexer.lpp"
return EQ_OP;
YY_BREAK
case 80:
YY_RULE_SETUP
-#line 224 "glsl_lexer.lpp"
+#line 234 "glsl_lexer.lpp"
return NE_OP;
YY_BREAK
case 81:
YY_RULE_SETUP
-#line 225 "glsl_lexer.lpp"
+#line 235 "glsl_lexer.lpp"
return AND_OP;
YY_BREAK
case 82:
YY_RULE_SETUP
-#line 226 "glsl_lexer.lpp"
+#line 236 "glsl_lexer.lpp"
return OR_OP;
YY_BREAK
case 83:
YY_RULE_SETUP
-#line 227 "glsl_lexer.lpp"
+#line 237 "glsl_lexer.lpp"
return XOR_OP;
YY_BREAK
case 84:
YY_RULE_SETUP
-#line 229 "glsl_lexer.lpp"
+#line 239 "glsl_lexer.lpp"
return MUL_ASSIGN;
YY_BREAK
case 85:
YY_RULE_SETUP
-#line 230 "glsl_lexer.lpp"
+#line 240 "glsl_lexer.lpp"
return DIV_ASSIGN;
YY_BREAK
case 86:
YY_RULE_SETUP
-#line 231 "glsl_lexer.lpp"
+#line 241 "glsl_lexer.lpp"
return ADD_ASSIGN;
YY_BREAK
case 87:
YY_RULE_SETUP
-#line 232 "glsl_lexer.lpp"
+#line 242 "glsl_lexer.lpp"
return MOD_ASSIGN;
YY_BREAK
case 88:
YY_RULE_SETUP
-#line 233 "glsl_lexer.lpp"
+#line 243 "glsl_lexer.lpp"
return LEFT_ASSIGN;
YY_BREAK
case 89:
YY_RULE_SETUP
-#line 234 "glsl_lexer.lpp"
+#line 244 "glsl_lexer.lpp"
return RIGHT_ASSIGN;
YY_BREAK
case 90:
YY_RULE_SETUP
-#line 235 "glsl_lexer.lpp"
+#line 245 "glsl_lexer.lpp"
return AND_ASSIGN;
YY_BREAK
case 91:
YY_RULE_SETUP
-#line 236 "glsl_lexer.lpp"
+#line 246 "glsl_lexer.lpp"
return XOR_ASSIGN;
YY_BREAK
case 92:
YY_RULE_SETUP
-#line 237 "glsl_lexer.lpp"
+#line 247 "glsl_lexer.lpp"
return OR_ASSIGN;
YY_BREAK
case 93:
YY_RULE_SETUP
-#line 238 "glsl_lexer.lpp"
+#line 248 "glsl_lexer.lpp"
return SUB_ASSIGN;
YY_BREAK
case 94:
YY_RULE_SETUP
-#line 240 "glsl_lexer.lpp"
+#line 250 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext, NULL, 10);
return INTCONSTANT;
@@ -1852,7 +1848,7 @@ YY_RULE_SETUP
YY_BREAK
case 95:
YY_RULE_SETUP
-#line 244 "glsl_lexer.lpp"
+#line 254 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext + 2, NULL, 16);
return INTCONSTANT;
@@ -1860,7 +1856,7 @@ YY_RULE_SETUP
YY_BREAK
case 96:
YY_RULE_SETUP
-#line 248 "glsl_lexer.lpp"
+#line 258 "glsl_lexer.lpp"
{
yylval->n = strtol(yytext, NULL, 8);
return INTCONSTANT;
@@ -1868,7 +1864,7 @@ YY_RULE_SETUP
YY_BREAK
case 97:
YY_RULE_SETUP
-#line 253 "glsl_lexer.lpp"
+#line 263 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
@@ -1876,7 +1872,7 @@ YY_RULE_SETUP
YY_BREAK
case 98:
YY_RULE_SETUP
-#line 257 "glsl_lexer.lpp"
+#line 267 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
@@ -1884,7 +1880,7 @@ YY_RULE_SETUP
YY_BREAK
case 99:
YY_RULE_SETUP
-#line 261 "glsl_lexer.lpp"
+#line 271 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
@@ -1892,7 +1888,7 @@ YY_RULE_SETUP
YY_BREAK
case 100:
YY_RULE_SETUP
-#line 265 "glsl_lexer.lpp"
+#line 275 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
@@ -1900,7 +1896,7 @@ YY_RULE_SETUP
YY_BREAK
case 101:
YY_RULE_SETUP
-#line 269 "glsl_lexer.lpp"
+#line 279 "glsl_lexer.lpp"
{
yylval->real = strtod(yytext, NULL);
return FLOATCONSTANT;
@@ -1908,7 +1904,7 @@ YY_RULE_SETUP
YY_BREAK
case 102:
YY_RULE_SETUP
-#line 274 "glsl_lexer.lpp"
+#line 284 "glsl_lexer.lpp"
{
yylval->n = 1;
return BOOLCONSTANT;
@@ -1916,7 +1912,7 @@ YY_RULE_SETUP
YY_BREAK
case 103:
YY_RULE_SETUP
-#line 278 "glsl_lexer.lpp"
+#line 288 "glsl_lexer.lpp"
{
yylval->n = 0;
return BOOLCONSTANT;
@@ -1925,394 +1921,394 @@ YY_RULE_SETUP
/* Reserved words in GLSL 1.10. */
case 104:
YY_RULE_SETUP
-#line 285 "glsl_lexer.lpp"
+#line 295 "glsl_lexer.lpp"
RESERVED_WORD(999, ASM);
YY_BREAK
case 105:
YY_RULE_SETUP
-#line 286 "glsl_lexer.lpp"
+#line 296 "glsl_lexer.lpp"
RESERVED_WORD(999, CLASS);
YY_BREAK
case 106:
YY_RULE_SETUP
-#line 287 "glsl_lexer.lpp"
+#line 297 "glsl_lexer.lpp"
RESERVED_WORD(999, UNION);
YY_BREAK
case 107:
YY_RULE_SETUP
-#line 288 "glsl_lexer.lpp"
+#line 298 "glsl_lexer.lpp"
RESERVED_WORD(999, ENUM);
YY_BREAK
case 108:
YY_RULE_SETUP
-#line 289 "glsl_lexer.lpp"
+#line 299 "glsl_lexer.lpp"
RESERVED_WORD(999, TYPEDEF);
YY_BREAK
case 109:
YY_RULE_SETUP
-#line 290 "glsl_lexer.lpp"
+#line 300 "glsl_lexer.lpp"
RESERVED_WORD(999, TEMPLATE);
YY_BREAK
case 110:
YY_RULE_SETUP
-#line 291 "glsl_lexer.lpp"
+#line 301 "glsl_lexer.lpp"
RESERVED_WORD(999, THIS);
YY_BREAK
case 111:
YY_RULE_SETUP
-#line 292 "glsl_lexer.lpp"
+#line 302 "glsl_lexer.lpp"
RESERVED_WORD(999, PACKED_TOK);
YY_BREAK
case 112:
YY_RULE_SETUP
-#line 293 "glsl_lexer.lpp"
+#line 303 "glsl_lexer.lpp"
RESERVED_WORD(999, GOTO);
YY_BREAK
case 113:
YY_RULE_SETUP
-#line 294 "glsl_lexer.lpp"
+#line 304 "glsl_lexer.lpp"
RESERVED_WORD(130, SWITCH);
YY_BREAK
case 114:
YY_RULE_SETUP
-#line 295 "glsl_lexer.lpp"
+#line 305 "glsl_lexer.lpp"
RESERVED_WORD(130, DEFAULT);
YY_BREAK
case 115:
YY_RULE_SETUP
-#line 296 "glsl_lexer.lpp"
+#line 306 "glsl_lexer.lpp"
RESERVED_WORD(999, INLINE_TOK);
YY_BREAK
case 116:
YY_RULE_SETUP
-#line 297 "glsl_lexer.lpp"
+#line 307 "glsl_lexer.lpp"
RESERVED_WORD(999, NOINLINE);
YY_BREAK
case 117:
YY_RULE_SETUP
-#line 298 "glsl_lexer.lpp"
+#line 308 "glsl_lexer.lpp"
RESERVED_WORD(999, VOLATILE);
YY_BREAK
case 118:
YY_RULE_SETUP
-#line 299 "glsl_lexer.lpp"
+#line 309 "glsl_lexer.lpp"
RESERVED_WORD(999, PUBLIC_TOK);
YY_BREAK
case 119:
YY_RULE_SETUP
-#line 300 "glsl_lexer.lpp"
+#line 310 "glsl_lexer.lpp"
RESERVED_WORD(999, STATIC);
YY_BREAK
case 120:
YY_RULE_SETUP
-#line 301 "glsl_lexer.lpp"
+#line 311 "glsl_lexer.lpp"
RESERVED_WORD(999, EXTERN);
YY_BREAK
case 121:
YY_RULE_SETUP
-#line 302 "glsl_lexer.lpp"
+#line 312 "glsl_lexer.lpp"
RESERVED_WORD(999, EXTERNAL);
YY_BREAK
case 122:
YY_RULE_SETUP
-#line 303 "glsl_lexer.lpp"
+#line 313 "glsl_lexer.lpp"
RESERVED_WORD(999, INTERFACE);
YY_BREAK
case 123:
YY_RULE_SETUP
-#line 304 "glsl_lexer.lpp"
+#line 314 "glsl_lexer.lpp"
RESERVED_WORD(999, LONG_TOK);
YY_BREAK
case 124:
YY_RULE_SETUP
-#line 305 "glsl_lexer.lpp"
+#line 315 "glsl_lexer.lpp"
RESERVED_WORD(999, SHORT_TOK);
YY_BREAK
case 125:
YY_RULE_SETUP
-#line 306 "glsl_lexer.lpp"
+#line 316 "glsl_lexer.lpp"
RESERVED_WORD(999, DOUBLE_TOK);
YY_BREAK
case 126:
YY_RULE_SETUP
-#line 307 "glsl_lexer.lpp"
+#line 317 "glsl_lexer.lpp"
RESERVED_WORD(999, HALF);
YY_BREAK
case 127:
YY_RULE_SETUP
-#line 308 "glsl_lexer.lpp"
+#line 318 "glsl_lexer.lpp"
RESERVED_WORD(999, FIXED_TOK);
YY_BREAK
case 128:
YY_RULE_SETUP
-#line 309 "glsl_lexer.lpp"
+#line 319 "glsl_lexer.lpp"
RESERVED_WORD(999, UNSIGNED);
YY_BREAK
case 129:
YY_RULE_SETUP
-#line 310 "glsl_lexer.lpp"
+#line 320 "glsl_lexer.lpp"
RESERVED_WORD(999, INPUT_TOK);
YY_BREAK
case 130:
YY_RULE_SETUP
-#line 311 "glsl_lexer.lpp"
+#line 321 "glsl_lexer.lpp"
RESERVED_WORD(999, OUTPUT);
YY_BREAK
case 131:
YY_RULE_SETUP
-#line 312 "glsl_lexer.lpp"
+#line 322 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC2);
YY_BREAK
case 132:
YY_RULE_SETUP
-#line 313 "glsl_lexer.lpp"
+#line 323 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC3);
YY_BREAK
case 133:
YY_RULE_SETUP
-#line 314 "glsl_lexer.lpp"
+#line 324 "glsl_lexer.lpp"
RESERVED_WORD(999, HVEC4);
YY_BREAK
case 134:
YY_RULE_SETUP
-#line 315 "glsl_lexer.lpp"
+#line 325 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC2);
YY_BREAK
case 135:
YY_RULE_SETUP
-#line 316 "glsl_lexer.lpp"
+#line 326 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC3);
YY_BREAK
case 136:
YY_RULE_SETUP
-#line 317 "glsl_lexer.lpp"
+#line 327 "glsl_lexer.lpp"
RESERVED_WORD(999, DVEC4);
YY_BREAK
case 137:
YY_RULE_SETUP
-#line 318 "glsl_lexer.lpp"
+#line 328 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC2);
YY_BREAK
case 138:
YY_RULE_SETUP
-#line 319 "glsl_lexer.lpp"
+#line 329 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC3);
YY_BREAK
case 139:
YY_RULE_SETUP
-#line 320 "glsl_lexer.lpp"
+#line 330 "glsl_lexer.lpp"
RESERVED_WORD(999, FVEC4);
YY_BREAK
case 140:
YY_RULE_SETUP
-#line 321 "glsl_lexer.lpp"
+#line 331 "glsl_lexer.lpp"
return SAMPLER2DRECT;
YY_BREAK
case 141:
YY_RULE_SETUP
-#line 322 "glsl_lexer.lpp"
+#line 332 "glsl_lexer.lpp"
RESERVED_WORD(999, SAMPLER3DRECT);
YY_BREAK
case 142:
YY_RULE_SETUP
-#line 323 "glsl_lexer.lpp"
+#line 333 "glsl_lexer.lpp"
return SAMPLER2DRECTSHADOW;
YY_BREAK
case 143:
YY_RULE_SETUP
-#line 324 "glsl_lexer.lpp"
+#line 334 "glsl_lexer.lpp"
RESERVED_WORD(999, SIZEOF);
YY_BREAK
case 144:
YY_RULE_SETUP
-#line 325 "glsl_lexer.lpp"
+#line 335 "glsl_lexer.lpp"
RESERVED_WORD(999, CAST);
YY_BREAK
case 145:
YY_RULE_SETUP
-#line 326 "glsl_lexer.lpp"
+#line 336 "glsl_lexer.lpp"
RESERVED_WORD(999, NAMESPACE);
YY_BREAK
case 146:
YY_RULE_SETUP
-#line 327 "glsl_lexer.lpp"
+#line 337 "glsl_lexer.lpp"
RESERVED_WORD(999, USING);
YY_BREAK
/* Additional reserved words in GLSL 1.20. */
case 147:
YY_RULE_SETUP
-#line 330 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, LOWP);
+#line 340 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, LOWP);
YY_BREAK
case 148:
YY_RULE_SETUP
-#line 331 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, MEDIUMP);
+#line 341 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP);
YY_BREAK
case 149:
YY_RULE_SETUP
-#line 332 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, HIGHP);
+#line 342 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, HIGHP);
YY_BREAK
case 150:
YY_RULE_SETUP
-#line 333 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(120, PRECISION);
+#line 343 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(120, PRECISION);
YY_BREAK
/* Additional reserved words in GLSL 1.30. */
case 151:
YY_RULE_SETUP
-#line 336 "glsl_lexer.lpp"
+#line 346 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, COMMON);
YY_BREAK
case 152:
YY_RULE_SETUP
-#line 337 "glsl_lexer.lpp"
+#line 347 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, PARTITION);
YY_BREAK
case 153:
YY_RULE_SETUP
-#line 338 "glsl_lexer.lpp"
+#line 348 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, ACTIVE);
YY_BREAK
case 154:
YY_RULE_SETUP
-#line 339 "glsl_lexer.lpp"
-TOKEN_OR_IDENTIFIER(130, SUPERP);
+#line 349 "glsl_lexer.lpp"
+TOKEN_OR_IDENTIFIER_ES(130, SUPERP);
YY_BREAK
case 155:
YY_RULE_SETUP
-#line 340 "glsl_lexer.lpp"
+#line 350 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER);
YY_BREAK
case 156:
YY_RULE_SETUP
-#line 341 "glsl_lexer.lpp"
+#line 351 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, FILTER);
YY_BREAK
case 157:
YY_RULE_SETUP
-#line 342 "glsl_lexer.lpp"
+#line 352 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1D);
YY_BREAK
case 158:
YY_RULE_SETUP
-#line 343 "glsl_lexer.lpp"
+#line 353 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2D);
YY_BREAK
case 159:
YY_RULE_SETUP
-#line 344 "glsl_lexer.lpp"
+#line 354 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE3D);
YY_BREAK
case 160:
YY_RULE_SETUP
-#line 345 "glsl_lexer.lpp"
+#line 355 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGECUBE);
YY_BREAK
case 161:
YY_RULE_SETUP
-#line 346 "glsl_lexer.lpp"
+#line 356 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE1D);
YY_BREAK
case 162:
YY_RULE_SETUP
-#line 347 "glsl_lexer.lpp"
+#line 357 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE2D);
YY_BREAK
case 163:
YY_RULE_SETUP
-#line 348 "glsl_lexer.lpp"
+#line 358 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE3D);
YY_BREAK
case 164:
YY_RULE_SETUP
-#line 349 "glsl_lexer.lpp"
+#line 359 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGECUBE);
YY_BREAK
case 165:
YY_RULE_SETUP
-#line 350 "glsl_lexer.lpp"
+#line 360 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE1D);
YY_BREAK
case 166:
YY_RULE_SETUP
-#line 351 "glsl_lexer.lpp"
+#line 361 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE2D);
YY_BREAK
case 167:
YY_RULE_SETUP
-#line 352 "glsl_lexer.lpp"
+#line 362 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE3D);
YY_BREAK
case 168:
YY_RULE_SETUP
-#line 353 "glsl_lexer.lpp"
+#line 363 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGECUBE);
YY_BREAK
case 169:
YY_RULE_SETUP
-#line 354 "glsl_lexer.lpp"
+#line 364 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1DARRAY);
YY_BREAK
case 170:
YY_RULE_SETUP
-#line 355 "glsl_lexer.lpp"
+#line 365 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2DARRAY);
YY_BREAK
case 171:
YY_RULE_SETUP
-#line 356 "glsl_lexer.lpp"
+#line 366 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE1DARRAY);
YY_BREAK
case 172:
YY_RULE_SETUP
-#line 357 "glsl_lexer.lpp"
+#line 367 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGE2DARRAY);
YY_BREAK
case 173:
YY_RULE_SETUP
-#line 358 "glsl_lexer.lpp"
+#line 368 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE1DARRAY);
YY_BREAK
case 174:
YY_RULE_SETUP
-#line 359 "glsl_lexer.lpp"
+#line 369 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGE2DARRAY);
YY_BREAK
case 175:
YY_RULE_SETUP
-#line 360 "glsl_lexer.lpp"
+#line 370 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE1DSHADOW);
YY_BREAK
case 176:
YY_RULE_SETUP
-#line 361 "glsl_lexer.lpp"
+#line 371 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGE2DSHADOW);
YY_BREAK
case 177:
YY_RULE_SETUP
-#line 362 "glsl_lexer.lpp"
+#line 372 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IMAGEBUFFER);
YY_BREAK
case 178:
YY_RULE_SETUP
-#line 363 "glsl_lexer.lpp"
+#line 373 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, IIMAGEBUFFER);
YY_BREAK
case 179:
YY_RULE_SETUP
-#line 364 "glsl_lexer.lpp"
+#line 374 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, UIMAGEBUFFER);
YY_BREAK
case 180:
YY_RULE_SETUP
-#line 365 "glsl_lexer.lpp"
+#line 375 "glsl_lexer.lpp"
TOKEN_OR_IDENTIFIER(130, ROW_MAJOR);
YY_BREAK
case 181:
YY_RULE_SETUP
-#line 367 "glsl_lexer.lpp"
+#line 377 "glsl_lexer.lpp"
{
struct _mesa_glsl_parse_state *state = yyextra;
void *ctx = state;
@@ -2322,15 +2318,15 @@ YY_RULE_SETUP
YY_BREAK
case 182:
YY_RULE_SETUP
-#line 374 "glsl_lexer.lpp"
+#line 384 "glsl_lexer.lpp"
{ return yytext[0]; }
YY_BREAK
case 183:
YY_RULE_SETUP
-#line 376 "glsl_lexer.lpp"
+#line 386 "glsl_lexer.lpp"
ECHO;
YY_BREAK
-#line 2334 "glsl_lexer.cpp"
+#line 2330 "glsl_lexer.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(PP):
case YY_STATE_EOF(PRAGMA):
@@ -3066,8 +3062,8 @@ YY_BUFFER_STATE _mesa_glsl__scan_string (yyconst char * yystr , yyscan_t yyscann
/** Setup the input buffer state to scan the given bytes. The next call to _mesa_glsl_lex() will
* scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * @param bytes the byte buffer to scan
+ * @param len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
@@ -3473,7 +3469,7 @@ void _mesa_glsl_free (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 376 "glsl_lexer.lpp"
+#line 386 "glsl_lexer.lpp"
diff --git a/src/glsl/glsl_lexer.lpp b/src/glsl/glsl_lexer.lpp
index 1de1fb4cf7..ed3cb251a1 100644
--- a/src/glsl/glsl_lexer.lpp
+++ b/src/glsl/glsl_lexer.lpp
@@ -46,6 +46,16 @@
} \
} while (0)
+/* Handle reserved words in GLSL ES (version 100) */
+#define TOKEN_OR_IDENTIFIER_ES(version, token) \
+ do { \
+ if (yyextra->es_shader) { \
+ return token; \
+ } else { \
+ TOKEN_OR_IDENTIFIER(version, token); \
+ } \
+ } while (0)
+
#define RESERVED_WORD(version, token) \
do { \
if (yyextra->language_version >= version) { \
@@ -190,9 +200,9 @@ inout return INOUT_TOK;
uniform return UNIFORM;
varying return VARYING;
centroid TOKEN_OR_IDENTIFIER(120, CENTROID);
-invariant TOKEN_OR_IDENTIFIER(120, INVARIANT);
+invariant TOKEN_OR_IDENTIFIER_ES(120, INVARIANT);
-flat TOKEN_OR_IDENTIFIER(130, FLAT);
+flat TOKEN_OR_IDENTIFIER_ES(130, FLAT);
smooth TOKEN_OR_IDENTIFIER(130, SMOOTH);
noperspective TOKEN_OR_IDENTIFIER(130, NOPERSPECTIVE);
@@ -327,16 +337,16 @@ namespace RESERVED_WORD(999, NAMESPACE);
using RESERVED_WORD(999, USING);
/* Additional reserved words in GLSL 1.20. */
-lowp TOKEN_OR_IDENTIFIER(120, LOWP);
-mediump TOKEN_OR_IDENTIFIER(120, MEDIUMP);
-highp TOKEN_OR_IDENTIFIER(120, HIGHP);
-precision TOKEN_OR_IDENTIFIER(120, PRECISION);
+lowp TOKEN_OR_IDENTIFIER_ES(120, LOWP);
+mediump TOKEN_OR_IDENTIFIER_ES(120, MEDIUMP);
+highp TOKEN_OR_IDENTIFIER_ES(120, HIGHP);
+precision TOKEN_OR_IDENTIFIER_ES(120, PRECISION);
/* Additional reserved words in GLSL 1.30. */
common TOKEN_OR_IDENTIFIER(130, COMMON);
partition TOKEN_OR_IDENTIFIER(130, PARTITION);
active TOKEN_OR_IDENTIFIER(130, ACTIVE);
-superp TOKEN_OR_IDENTIFIER(130, SUPERP);
+superp TOKEN_OR_IDENTIFIER_ES(130, SUPERP);
samplerBuffer TOKEN_OR_IDENTIFIER(130, SAMPLERBUFFER);
filter TOKEN_OR_IDENTIFIER(130, FILTER);
image1D TOKEN_OR_IDENTIFIER(130, IMAGE1D);
diff --git a/src/glsl/glsl_parser.cpp b/src/glsl/glsl_parser.cpp
index e36bb03c43..301c221892 100644
--- a/src/glsl/glsl_parser.cpp
+++ b/src/glsl/glsl_parser.cpp
@@ -1,10 +1,9 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton implementation for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +45,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.4.1"
+#define YYBISON_VERSION "2.4.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -114,7 +113,7 @@
/* Line 189 of yacc.c */
-#line 118 "glsl_parser.cpp"
+#line 117 "glsl_parser.cpp"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -367,10 +366,15 @@ typedef union YYSTYPE
ast_expression *rest;
} for_rest_statement;
+ struct {
+ ast_node *then_statement;
+ ast_node *else_statement;
+ } selection_rest_statement;
+
/* Line 214 of yacc.c */
-#line 374 "glsl_parser.cpp"
+#line 378 "glsl_parser.cpp"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -395,7 +399,7 @@ typedef struct YYLTYPE
/* Line 264 of yacc.c */
-#line 399 "glsl_parser.cpp"
+#line 403 "glsl_parser.cpp"
#ifdef short
# undef short
@@ -445,7 +449,7 @@ typedef short int yytype_int16;
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -612,16 +616,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 5
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 4115
+#define YYLAST 4005
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 215
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 90
+#define YYNNTS 88
/* YYNRULES -- Number of rules. */
-#define YYNRULES 278
+#define YYNRULES 274
/* YYNRULES -- Number of states. */
-#define YYNSTATES 419
+#define YYNSTATES 409
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -709,10 +713,10 @@ static const yytype_uint16 yyprhs[] =
588, 590, 592, 594, 596, 598, 600, 602, 604, 606,
612, 617, 619, 622, 626, 628, 632, 634, 639, 641,
643, 645, 647, 649, 651, 653, 655, 657, 659, 661,
- 663, 665, 667, 670, 674, 676, 678, 681, 685, 687,
- 690, 692, 695, 703, 709, 715, 723, 725, 730, 736,
- 740, 743, 749, 757, 764, 766, 768, 770, 771, 774,
- 778, 781, 784, 787, 791, 794, 796, 798, 800
+ 664, 668, 670, 672, 675, 679, 681, 684, 686, 689,
+ 695, 699, 701, 703, 708, 714, 718, 721, 727, 735,
+ 742, 744, 746, 748, 749, 752, 756, 759, 762, 765,
+ 769, 772, 774, 776, 778
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -721,7 +725,7 @@ static const yytype_int16 yyrhs[] =
216, 0, -1, -1, 218, 220, 217, 222, -1, -1,
109, 78, 113, -1, 116, 113, -1, 117, 113, -1,
118, 113, -1, 119, 113, -1, -1, 220, 221, -1,
- 110, 76, 112, 76, 113, -1, 303, -1, 222, 303,
+ 110, 76, 112, 76, 113, -1, 301, -1, 222, 301,
-1, 76, -1, 223, -1, 78, -1, 79, -1, 77,
-1, 80, -1, 191, 250, 192, -1, 224, -1, 225,
193, 226, 194, -1, 227, -1, 225, 195, 76, -1,
@@ -782,29 +786,27 @@ static const yytype_int16 yyrhs[] =
214, -1, 73, 213, 278, 214, -1, 279, -1, 278,
279, -1, 272, 280, 212, -1, 281, -1, 280, 196,
281, -1, 76, -1, 76, 193, 251, 194, -1, 248,
- -1, 252, -1, 285, -1, 286, -1, 288, -1, 287,
- -1, 294, -1, 283, -1, 292, -1, 293, -1, 296,
- -1, 297, -1, 298, -1, 302, -1, 213, 214, -1,
- 213, 291, 214, -1, 290, -1, 287, -1, 213, 214,
- -1, 213, 291, 214, -1, 284, -1, 291, 284, -1,
- 212, -1, 250, 212, -1, 14, 191, 250, 192, 285,
- 12, 285, -1, 14, 191, 250, 192, 285, -1, 14,
- 191, 250, 192, 286, -1, 14, 191, 250, 192, 285,
- 12, 286, -1, 250, -1, 263, 76, 211, 282, -1,
- 17, 191, 250, 192, 288, -1, 18, 250, 210, -1,
- 19, 210, -1, 75, 191, 295, 192, 289, -1, 11,
- 284, 75, 191, 250, 192, 212, -1, 13, 191, 299,
- 301, 192, 289, -1, 292, -1, 283, -1, 295, -1,
- -1, 300, 212, -1, 300, 212, 250, -1, 10, 212,
- -1, 9, 212, -1, 16, 212, -1, 16, 250, 212,
- -1, 15, 212, -1, 304, -1, 252, -1, 219, -1,
- 253, 290, -1
+ -1, 252, -1, 286, -1, 285, -1, 283, -1, 290,
+ -1, 291, -1, 294, -1, 295, -1, 296, -1, 300,
+ -1, 213, 214, -1, 213, 289, 214, -1, 288, -1,
+ 285, -1, 213, 214, -1, 213, 289, 214, -1, 284,
+ -1, 289, 284, -1, 212, -1, 250, 212, -1, 14,
+ 191, 250, 192, 292, -1, 284, 12, 284, -1, 284,
+ -1, 250, -1, 263, 76, 211, 282, -1, 17, 191,
+ 250, 192, 286, -1, 18, 250, 210, -1, 19, 210,
+ -1, 75, 191, 293, 192, 287, -1, 11, 284, 75,
+ 191, 250, 192, 212, -1, 13, 191, 297, 299, 192,
+ 287, -1, 290, -1, 283, -1, 293, -1, -1, 298,
+ 212, -1, 298, 212, 250, -1, 10, 212, -1, 9,
+ 212, -1, 16, 212, -1, 16, 250, 212, -1, 15,
+ 212, -1, 302, -1, 252, -1, 219, -1, 253, 288,
+ -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 211, 211, 210, 219, 223, 242, 243, 244, 245,
+ 0, 214, 214, 213, 220, 222, 242, 243, 244, 245,
248, 250, 254, 263, 271, 282, 286, 293, 300, 307,
314, 321, 328, 329, 335, 339, 346, 352, 361, 365,
369, 370, 379, 380, 384, 385, 389, 395, 407, 411,
@@ -827,11 +829,11 @@ static const yytype_uint16 yyrline[] =
1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142,
1143, 1144, 1145, 1146, 1147, 1148, 1152, 1163, 1174, 1188,
1194, 1203, 1208, 1216, 1231, 1236, 1244, 1250, 1259, 1263,
- 1269, 1270, 1274, 1275, 1279, 1283, 1284, 1285, 1286, 1287,
- 1288, 1289, 1293, 1299, 1308, 1309, 1313, 1319, 1328, 1338,
- 1350, 1356, 1365, 1374, 1380, 1386, 1395, 1399, 1413, 1417,
- 1418, 1422, 1429, 1436, 1446, 1447, 1451, 1453, 1459, 1464,
- 1473, 1479, 1485, 1491, 1497, 1506, 1507, 1508, 1512
+ 1269, 1270, 1274, 1275, 1276, 1277, 1278, 1279, 1280, 1284,
+ 1290, 1299, 1300, 1304, 1310, 1319, 1329, 1341, 1347, 1356,
+ 1365, 1370, 1378, 1382, 1396, 1400, 1401, 1405, 1412, 1419,
+ 1429, 1430, 1434, 1436, 1442, 1447, 1456, 1462, 1468, 1474,
+ 1480, 1489, 1490, 1491, 1495
};
#endif
@@ -904,11 +906,11 @@ static const char *const yytname[] =
"basic_type_specifier_nonarray", "precision_qualifier",
"struct_specifier", "struct_declaration_list", "struct_declaration",
"struct_declarator_list", "struct_declarator", "initializer",
- "declaration_statement", "statement", "statement_matched",
- "statement_unmatched", "simple_statement", "compound_statement",
- "statement_no_new_scope", "compound_statement_no_new_scope",
- "statement_list", "expression_statement", "selection_statement_matched",
- "selection_statement_unmatched", "condition", "switch_statement",
+ "declaration_statement", "statement", "simple_statement",
+ "compound_statement", "statement_no_new_scope",
+ "compound_statement_no_new_scope", "statement_list",
+ "expression_statement", "selection_statement",
+ "selection_rest_statement", "condition", "switch_statement",
"case_label", "iteration_statement", "for_init_statement",
"conditionopt", "for_rest_statement", "jump_statement",
"external_declaration", "function_definition", 0
@@ -971,11 +973,11 @@ static const yytype_uint16 yyr1[] =
275, 275, 275, 275, 275, 275, 275, 275, 275, 275,
275, 275, 275, 275, 275, 275, 276, 276, 276, 277,
277, 278, 278, 279, 280, 280, 281, 281, 282, 283,
- 284, 284, 285, 285, 286, 287, 287, 287, 287, 287,
- 287, 287, 288, 288, 289, 289, 290, 290, 291, 291,
- 292, 292, 293, 294, 294, 294, 295, 295, 296, 297,
- 297, 298, 298, 298, 299, 299, 300, 300, 301, 301,
- 302, 302, 302, 302, 302, 303, 303, 303, 304
+ 284, 284, 285, 285, 285, 285, 285, 285, 285, 286,
+ 286, 287, 287, 288, 288, 289, 289, 290, 290, 291,
+ 292, 292, 293, 293, 294, 295, 295, 296, 296, 296,
+ 297, 297, 298, 298, 299, 299, 300, 300, 300, 300,
+ 300, 301, 301, 301, 302
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -1004,11 +1006,11 @@ static const yytype_uint8 yyr2[] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
4, 1, 2, 3, 1, 3, 1, 4, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 2, 3, 1, 1, 2, 3, 1, 2,
- 1, 2, 7, 5, 5, 7, 1, 4, 5, 3,
- 2, 5, 7, 6, 1, 1, 1, 0, 2, 3,
- 2, 2, 2, 3, 2, 1, 1, 1, 2
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 3, 1, 1, 2, 3, 1, 2, 1, 2, 5,
+ 3, 1, 1, 4, 5, 3, 2, 5, 7, 6,
+ 1, 1, 1, 0, 2, 3, 2, 2, 2, 3,
+ 2, 1, 1, 1, 2
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -1024,262 +1026,249 @@ static const yytype_uint16 yydefact[] =
197, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 0, 165,
164, 135, 218, 217, 216, 0, 0, 0, 0, 0,
- 0, 193, 198, 277, 135, 276, 0, 0, 103, 113,
+ 0, 193, 198, 273, 135, 272, 0, 0, 103, 113,
0, 118, 125, 0, 136, 135, 0, 145, 133, 157,
- 159, 162, 0, 163, 13, 275, 0, 154, 155, 151,
+ 159, 162, 0, 163, 13, 271, 0, 154, 155, 151,
0, 0, 132, 135, 147, 0, 6, 7, 8, 9,
- 0, 14, 98, 135, 278, 101, 113, 144, 114, 115,
+ 0, 14, 98, 135, 274, 101, 113, 144, 114, 115,
116, 104, 0, 113, 0, 99, 126, 152, 150, 146,
134, 0, 158, 0, 0, 0, 0, 221, 0, 140,
0, 138, 0, 0, 135, 0, 0, 0, 0, 0,
0, 0, 0, 15, 19, 17, 18, 20, 41, 0,
- 0, 0, 46, 47, 48, 49, 250, 135, 246, 16,
+ 0, 0, 46, 47, 48, 49, 247, 135, 243, 16,
22, 42, 24, 29, 30, 0, 0, 35, 0, 50,
0, 54, 57, 60, 65, 68, 70, 72, 74, 76,
- 78, 80, 82, 95, 0, 229, 0, 133, 235, 248,
- 230, 231, 233, 232, 135, 236, 237, 234, 238, 239,
- 240, 241, 105, 110, 112, 117, 0, 119, 106, 0,
- 0, 160, 50, 97, 0, 39, 12, 0, 226, 0,
- 224, 220, 222, 100, 137, 0, 271, 270, 0, 135,
- 0, 274, 272, 0, 0, 0, 260, 135, 43, 44,
- 0, 242, 135, 26, 27, 0, 0, 33, 32, 0,
- 165, 36, 38, 85, 86, 88, 87, 90, 91, 92,
- 93, 94, 89, 84, 0, 45, 0, 0, 0, 0,
+ 78, 80, 82, 95, 0, 229, 0, 133, 232, 245,
+ 231, 230, 135, 233, 234, 235, 236, 237, 238, 105,
+ 110, 112, 117, 0, 119, 106, 0, 0, 160, 50,
+ 97, 0, 39, 12, 0, 226, 0, 224, 220, 222,
+ 100, 137, 0, 267, 266, 0, 135, 0, 270, 268,
+ 0, 0, 0, 256, 135, 43, 44, 0, 239, 135,
+ 26, 27, 0, 0, 33, 32, 0, 165, 36, 38,
+ 85, 86, 88, 87, 90, 91, 92, 93, 94, 89,
+ 84, 0, 45, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 251, 247, 249,
- 107, 109, 111, 0, 0, 127, 0, 228, 131, 161,
- 219, 0, 0, 223, 139, 0, 265, 264, 135, 0,
- 273, 0, 259, 256, 0, 0, 21, 243, 0, 28,
- 25, 31, 37, 83, 51, 52, 53, 55, 56, 58,
- 59, 63, 64, 61, 62, 66, 67, 69, 71, 73,
- 75, 77, 79, 0, 96, 0, 120, 0, 124, 0,
- 128, 0, 225, 0, 266, 0, 0, 135, 0, 0,
- 135, 23, 0, 0, 0, 121, 129, 0, 227, 0,
- 268, 135, 253, 254, 258, 0, 0, 245, 261, 244,
- 81, 108, 122, 0, 130, 0, 269, 263, 135, 257,
- 0, 123, 262, 252, 255, 0, 135, 0, 135
+ 0, 0, 0, 0, 248, 244, 246, 107, 109, 111,
+ 0, 0, 127, 0, 228, 131, 161, 219, 0, 0,
+ 223, 139, 0, 261, 260, 135, 0, 269, 0, 255,
+ 252, 0, 0, 21, 240, 0, 28, 25, 31, 37,
+ 83, 51, 52, 53, 55, 56, 58, 59, 63, 64,
+ 61, 62, 66, 67, 69, 71, 73, 75, 77, 79,
+ 0, 96, 0, 120, 0, 124, 0, 128, 0, 225,
+ 0, 262, 0, 0, 135, 0, 0, 135, 23, 0,
+ 0, 0, 121, 129, 0, 227, 0, 264, 135, 251,
+ 249, 254, 0, 242, 257, 241, 81, 108, 122, 0,
+ 130, 0, 265, 259, 135, 253, 123, 258, 250
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 2, 9, 3, 83, 6, 10, 84, 179, 180,
- 181, 338, 182, 183, 184, 185, 186, 187, 188, 189,
+ 181, 335, 182, 183, 184, 185, 186, 187, 188, 189,
190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
- 200, 201, 202, 203, 284, 204, 234, 205, 206, 87,
- 88, 89, 223, 131, 132, 224, 90, 91, 92, 93,
- 94, 150, 151, 95, 133, 96, 97, 235, 99, 100,
- 101, 102, 103, 146, 147, 239, 240, 318, 208, 209,
- 210, 211, 212, 213, 398, 399, 214, 215, 216, 217,
- 335, 218, 219, 220, 328, 375, 376, 221, 104, 105
+ 200, 201, 202, 203, 281, 204, 231, 205, 206, 87,
+ 88, 89, 220, 131, 132, 221, 90, 91, 92, 93,
+ 94, 150, 151, 95, 133, 96, 97, 232, 99, 100,
+ 101, 102, 103, 146, 147, 236, 237, 315, 208, 209,
+ 210, 211, 394, 395, 212, 213, 214, 390, 332, 215,
+ 216, 217, 325, 372, 373, 218, 104, 105
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -367
+#define YYPACT_NINF -329
static const yytype_int16 yypact[] =
{
- -88, -21, 24, -367, -53, -367, -3, -367, 9, 3699,
- -367, 0, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- 126, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, -367, -367, -367, -367, -75, -367,
- -367, 29, -367, -367, -367, 92, 4, 12, 20, 26,
- -49, -367, -367, -367, 3580, -367, -197, -45, -46, 3,
- -134, -367, 82, 71, -367, 52, 3887, -367, -367, -367,
- -29, -367, 3959, -367, -367, -367, 97, -367, -367, -367,
- -19, 3887, -367, 52, -367, 3959, -367, -367, -367, -367,
- 130, -367, -367, 282, -367, -367, 47, -367, -367, -367,
- -367, -367, 3887, 187, 139, -367, -162, -367, -367, -367,
- -367, 2675, -367, 105, 3887, 154, 2064, -367, 23, -367,
- -62, -367, 27, 31, 1130, 50, 53, 33, 2296, 55,
- 3218, 37, 58, -67, -367, -367, -367, -367, -367, 3218,
- 3218, 3218, -367, -367, -367, -367, -367, 494, -367, -367,
- -367, -66, -367, -367, -367, 60, -56, 3399, 64, -54,
- 3218, 22, 6, 118, -84, 120, 51, 54, 56, 168,
- 167, -83, -367, -367, -103, -367, 48, 72, -367, -367,
- -367, -367, -367, -367, 706, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, -367, 186, 3887, -139, -367, 2856,
- 3218, -367, -367, -367, 73, -367, -367, 2180, 75, -102,
- -367, -367, -367, -367, -367, 130, -367, -367, 190, 1750,
- 3218, -367, -367, -90, 3218, -146, -367, 2494, -367, -367,
- -48, -367, 918, -367, -367, 3218, 3815, -367, -367, 3218,
- 74, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, 3218, -367, 3218, 3218, 3218, 3218,
- 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218, 3218,
- 3218, 3218, 3218, 3218, 3218, 3218, 3218, -367, -367, -367,
- 76, -367, -367, 3037, 3218, 59, 77, -367, -367, -367,
- -367, 3218, 154, -367, -367, 81, -367, -367, 1948, -40,
- -367, -27, -367, 78, 197, 83, -367, -367, 84, 78,
- 85, -367, -367, -367, -367, -367, -367, 22, 22, 6,
- 6, 118, 118, 118, 118, -84, -84, 120, 51, 54,
- 56, 168, 167, -97, -367, 3218, 66, 86, -367, 3218,
- 68, 87, -367, 3218, -367, 70, 91, 1130, 102, 106,
- 1341, -367, 3218, 90, 3218, 153, -367, 3218, -367, -26,
- 3218, 1341, 353, -367, -367, 3218, 103, -367, -367, -367,
- -367, -367, -367, 3218, -367, 157, 78, -367, 1130, -367,
- 3218, -367, -367, -367, -367, -25, 1552, 358, 1552
+ -58, -22, 72, -329, -28, -329, -15, -329, 22, 3589,
+ -329, -4, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ 44, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, -329, -329, -329, -329, -329, -329, -72, -329,
+ -329, 6, -329, -329, -329, 14, -8, 9, 11, 26,
+ -64, -329, -329, -329, 3470, -329, -159, -23, -12, -2,
+ -149, -329, 105, 57, -329, 140, 3777, -329, -329, -329,
+ 15, -329, 3849, -329, -329, -329, 131, -329, -329, -329,
+ -3, 3777, -329, 140, -329, 3849, -329, -329, -329, -329,
+ 133, -329, -329, 383, -329, -329, 32, -329, -329, -329,
+ -329, -329, 3777, 158, 135, -329, -150, -329, -329, -329,
+ -329, 2565, -329, 100, 3777, 141, 1954, -329, 4, -329,
+ -95, -329, 7, 8, 1231, 27, 31, 12, 2186, 37,
+ 3108, 13, 39, -59, -329, -329, -329, -329, -329, 3108,
+ 3108, 3108, -329, -329, -329, -329, -329, 595, -329, -329,
+ -329, -55, -329, -329, -329, 41, -92, 3289, 40, -75,
+ 3108, -7, -118, 51, -74, 109, 28, 29, 30, 145,
+ 147, -84, -329, -329, -148, -329, 34, 49, -329, -329,
+ -329, -329, 807, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, 166, 3777, -143, -329, 2746, 3108, -329, -329,
+ -329, 53, -329, -329, 2070, 55, -139, -329, -329, -329,
+ -329, -329, 133, -329, -329, 174, 1640, 3108, -329, -329,
+ -138, 3108, -134, -329, 2384, -329, -329, -81, -329, 1019,
+ -329, -329, 3108, 3705, -329, -329, 3108, 61, -329, -329,
+ -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, 3108, -329, 3108, 3108, 3108, 3108, 3108, 3108, 3108,
+ 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108, 3108,
+ 3108, 3108, 3108, 3108, -329, -329, -329, 62, -329, -329,
+ 2927, 3108, 43, 63, -329, -329, -329, -329, 3108, 141,
+ -329, -329, 65, -329, -329, 1838, -80, -329, -79, -329,
+ 66, 182, 69, -329, -329, 70, 66, 74, -329, -329,
+ -329, -329, -329, -329, -7, -7, -118, -118, 51, 51,
+ 51, 51, -74, -74, 109, 28, 29, 30, 145, 147,
+ -127, -329, 3108, 52, 75, -329, 3108, 59, 77, -329,
+ 3108, -329, 54, 76, 1231, 60, 64, 1442, -329, 3108,
+ 78, 3108, 67, -329, 3108, -329, -50, 3108, 1442, 262,
+ -329, -329, 3108, -329, -329, -329, -329, -329, -329, 3108,
+ -329, 71, 66, -329, 1231, -329, -329, -329, -329
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -367, -367, -367, -367, -367, -367, -367, -367, -367, -367,
- -367, -367, -367, -367, 107, -367, -367, -367, -367, -111,
- -367, -63, -59, -82, -60, 79, 80, 88, 89, 69,
- 93, -367, -114, -153, -367, -154, -224, 11, 14, -367,
- -367, -367, 148, 249, 243, 151, -367, -367, -245, -367,
- -367, -367, 134, -367, -367, -43, -367, -9, -89, -367,
- -367, 306, -367, 239, -136, -367, 62, -241, 143, -143,
- -342, -355, -366, 15, 5, 308, 218, 149, -367, -367,
- 94, -367, -367, -367, -367, -367, -367, -367, 316, -367
+ -329, -329, -329, -329, -329, -329, -329, -329, -329, -329,
+ -329, -329, -329, -329, 16, -329, -329, -329, -329, -135,
+ -329, -87, -83, -104, -93, -20, -16, -21, -13, -11,
+ -17, -329, -133, -99, -329, -155, -189, 2, 5, -329,
+ -329, -329, 68, 161, 155, 73, -329, -329, -215, -329,
+ -329, -329, 48, -329, -329, -43, -329, -9, -31, -329,
+ -329, 217, -329, 150, -131, -329, -24, -140, 56, -153,
+ -328, -78, -90, 213, 124, 58, -329, -329, -19, -329,
+ -329, -329, -329, -329, -329, -329, 219, -329
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -268
+#define YYTABLE_NINF -264
static const yytype_int16 yytable[] =
{
- 98, 110, 293, 294, 253, 316, 255, 127, 304, -164,
- 242, 248, 334, 142, 397, 122, 123, 260, 263, 264,
- 85, 1, 393, 86, 5, 397, 148, 233, 114, 228,
- 232, 229, 12, 13, 271, 392, 128, 129, 130, 273,
- 274, 275, 276, 277, 278, 279, 280, 281, 282, 230,
- 306, 127, 139, 414, 313, 12, 13, 4, 258, 259,
- 7, 30, 134, 31, 332, 32, 413, 33, 34, 35,
- 114, 309, 314, 368, 417, 98, 413, 317, 135, 285,
- 128, 129, 130, 334, 30, 11, 31, 140, 32, 367,
- 33, 34, 35, 306, 322, 85, 329, 371, 86, 306,
- 331, 242, 145, 333, 137, 112, 306, 8, 138, 307,
- 323, 339, 106, 382, 207, 233, 342, 116, 232, 309,
- 295, 296, 330, 225, -40, 117, 305, 265, 386, 266,
- 244, 343, 113, 118, 245, 145, 268, 145, 111, 119,
- 269, 383, 120, 402, 336, 207, 404, 125, 306, 80,
- 126, 363, 377, 364, 409, 113, 306, 283, 136, 107,
- 108, 317, 411, 109, 141, 378, 405, 416, 207, 306,
- 306, 306, 80, 143, 333, 344, 345, 346, 232, 232,
- 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 144, -102, 72, 73, 74, 233,
- 291, 292, 232, 289, 290, 207, 149, 233, 297, 298,
- 232, 351, 352, 353, 354, 227, 317, 225, 236, 389,
- 128, 129, 130, 286, 287, 288, 347, 348, 145, 400,
- 238, 317, 349, 350, 317, 243, 406, 355, 356, 246,
- 207, 249, 317, 247, 250, 251, 254, 256, 207, 257,
- 317, 233, 267, 207, 232, 272, 415, 299, 302, 303,
- 122, 300, 310, -39, 301, 325, -34, 319, 321, 365,
- 369, 370, 373, 379, 306, 380, -40, 384, 381, 387,
- 385, 388, 390, 391, 401, 12, 13, 14, 15, 16,
- 17, 152, 153, 154, 410, 155, 156, 157, 158, 159,
- 160, 161, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 177, 31, 395, 32, 207,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 162, 163, 164,
- 165, 166, 167, 168, 403, 408, 169, 170, 207, 412,
- 418, 207, 361, 341, 311, 222, 226, 312, 357, 324,
- 358, 115, 207, 237, 372, 71, 72, 73, 74, 359,
- 75, 360, 326, 394, 124, 262, 407, 362, 327, 207,
- 121, 0, 80, 0, 0, 0, 0, 207, 0, 207,
+ 98, 245, 127, 250, 110, 252, 229, 301, 230, 12,
+ 13, 85, 290, 291, 86, 239, 257, -164, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 114, 260,
+ 261, 128, 129, 130, 255, 256, 127, 313, 30, 331,
+ 31, 225, 32, 226, 33, 34, 35, 134, 303, 393,
+ 310, 1, 139, 122, 123, 282, 4, 319, 303, 306,
+ 393, 227, 303, 135, 304, 128, 129, 130, 311, 303,
+ 114, 142, 5, 320, 327, 98, 329, 107, 108, 286,
+ 287, 109, 112, 379, 148, 7, 85, 140, 268, 86,
+ 137, 229, 326, 230, 138, 8, 328, 241, 11, 330,
+ 265, 242, 145, 239, 266, 116, 306, 336, 106, 113,
+ 331, 333, 374, 375, 207, 303, 303, 303, 72, 73,
+ 74, 364, 117, 222, 118, 302, 80, 120, 314, 368,
+ 292, 293, -40, 288, 289, 145, 280, 145, 262, 119,
+ 263, 111, 401, 12, 13, 207, 303, 360, 341, 342,
+ 343, 229, 229, 229, 229, 229, 229, 229, 229, 229,
+ 229, 229, 229, 229, 229, 229, 229, 339, 207, 125,
+ 330, 365, 30, 380, 31, 229, 32, 230, 33, 34,
+ 35, 136, 340, 229, 126, 230, 348, 349, 350, 351,
+ -102, 128, 129, 130, 283, 284, 285, 294, 295, 344,
+ 345, 352, 353, 207, 361, 346, 347, 143, 141, 149,
+ 144, 224, 314, 233, 222, 386, 240, 235, 246, 243,
+ 244, 389, 247, 253, 248, 145, 383, 229, 251, 230,
+ 254, 269, 402, 264, 296, 299, 297, 207, 298, 300,
+ -39, 398, 307, 113, 400, 207, 122, 316, 318, 322,
+ 207, 408, 405, -34, 366, 362, 370, 367, 376, 406,
+ 80, 377, 303, 381, 378, -40, 387, 314, 388, 382,
+ 384, 385, 397, 177, 404, 392, 354, 356, 399, 338,
+ 396, 355, 314, 407, 359, 314, 357, 219, 223, 358,
+ 321, 308, 115, 314, 234, 369, 309, 391, 403, 124,
+ 314, 259, 323, 121, 324, 0, 371, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 207, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 374, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 81, 0, 82, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 171, 0, 0, 0, 0, 0, 172,
- 173, 174, 175, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 176, 177, 178, 12, 13, 14,
- 15, 16, 17, 152, 153, 154, 0, 155, 156, 157,
- 158, 159, 160, 161, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 0, 31, 0,
- 32, 0, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 162,
- 163, 164, 165, 166, 167, 168, 0, 0, 169, 170,
+ 0, 0, 0, 0, 0, 207, 0, 0, 207, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 207,
+ 0, 0, 0, 0, 0, 0, 12, 13, 14, 15,
+ 16, 17, 152, 153, 154, 207, 155, 156, 157, 158,
+ 159, 160, 161, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 0, 31, 0, 32,
+ 0, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 162, 163,
+ 164, 165, 166, 167, 168, 0, 0, 169, 170, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 71, 72, 73,
- 74, 0, 75, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 80, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 71, 72, 73, 74,
+ 0, 75, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 80, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 81, 0,
- 82, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 81, 0, 82,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 171, 0, 0, 0, 0,
- 0, 172, 173, 174, 175, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 176, 177, 261, 12,
- 13, 14, 15, 16, 17, 152, 153, 154, 0, 155,
- 156, 157, 158, 159, 160, 161, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
- 31, 0, 32, 0, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 162, 163, 164, 165, 166, 167, 168, 0, 0,
- 169, 170, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 71,
- 72, 73, 74, 0, 75, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 80, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 171, 0, 0, 0, 0, 0,
+ 172, 173, 174, 175, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 176, 177, 178, 12, 13,
+ 14, 15, 16, 17, 152, 153, 154, 0, 155, 156,
+ 157, 158, 159, 160, 161, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 0, 31,
+ 0, 32, 0, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 162, 163, 164, 165, 166, 167, 168, 0, 0, 169,
+ 170, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 71, 72,
+ 73, 74, 0, 75, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 80, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 81, 0, 82, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 81,
+ 0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 171, 0, 0,
- 0, 0, 0, 172, 173, 174, 175, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 176, 177,
- 308, 12, 13, 14, 15, 16, 17, 152, 153, 154,
- 0, 155, 156, 157, 158, 159, 160, 161, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 0, 31, 0, 32, 0, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 162, 163, 164, 165, 166, 167, 168,
- 0, 0, 169, 170, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 171, 0, 0, 0,
+ 0, 0, 172, 173, 174, 175, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 176, 177, 258,
+ 12, 13, 14, 15, 16, 17, 152, 153, 154, 0,
+ 155, 156, 157, 158, 159, 160, 161, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 0, 31, 0, 32, 0, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
+ 68, 69, 162, 163, 164, 165, 166, 167, 168, 0,
+ 0, 169, 170, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 71, 72, 73, 74, 0, 75, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 80, 0,
+ 71, 72, 73, 74, 0, 75, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 80, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 81, 0, 82, 0, 0, 0, 0, 0,
+ 0, 81, 0, 82, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 171,
- 0, 0, 0, 0, 0, 172, 173, 174, 175, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 171, 0,
+ 0, 0, 0, 0, 172, 173, 174, 175, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 176,
+ 177, 305, 12, 13, 14, 15, 16, 17, 152, 153,
+ 154, 0, 155, 156, 157, 158, 159, 160, 161, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 0, 31, 0, 32, 0, 33, 34, 35,
+ 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 162, 163, 164, 165, 166, 167,
+ 168, 0, 0, 169, 170, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 176, 177, 337, 12, 13, 14, 15, 16, 17, 152,
- 153, 154, 0, 155, 156, 157, 158, 159, 160, 161,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 0, 31, 0, 32, 0, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 162, 163, 164, 165, 166,
- 167, 168, 0, 0, 169, 170, 0, 0, 0, 0,
+ 0, 0, 71, 72, 73, 74, 0, 75, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 80,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 71, 72, 73, 74, 0, 75, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 81, 0, 82, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 81, 0, 82, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 171, 0, 0, 0, 0, 0, 172, 173, 174, 175,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 171, 0, 0, 0, 0, 0, 172, 173, 174,
- 175, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 176, 177, 12, 13, 14, 15, 16, 17,
- 152, 153, 154, 0, 155, 396, 157, 158, 159, 160,
+ 0, 176, 177, 334, 12, 13, 14, 15, 16, 17,
+ 152, 153, 154, 0, 155, 156, 157, 158, 159, 160,
161, 18, 19, 20, 21, 22, 23, 24, 25, 26,
27, 28, 29, 30, 0, 31, 0, 32, 0, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
@@ -1299,8 +1288,8 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 171, 0, 0, 0, 0, 0, 172, 173,
174, 175, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 176, 123, 12, 13, 14, 15, 16,
- 17, 152, 153, 154, 0, 155, 396, 157, 158, 159,
+ 0, 0, 0, 176, 177, 12, 13, 14, 15, 16,
+ 17, 152, 153, 154, 0, 155, 156, 157, 158, 159,
160, 161, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 0, 31, 0, 32, 0,
33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
@@ -1320,7 +1309,7 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 171, 0, 0, 0, 0, 0, 172,
173, 174, 175, 12, 13, 14, 15, 16, 17, 0,
- 0, 0, 0, 0, 176, 177, 0, 0, 0, 0,
+ 0, 0, 0, 0, 176, 123, 0, 0, 0, 0,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 0, 31, 0, 32, 0, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
@@ -1360,7 +1349,7 @@ static const yytype_int16 yytable[] =
61, 62, 63, 64, 65, 66, 67, 68, 69, 171,
70, 0, 0, 0, 0, 172, 173, 174, 175, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- -267, 0, 0, 0, 0, 0, 0, 0, 72, 73,
+ -263, 0, 0, 0, 0, 0, 0, 0, 72, 73,
74, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 14, 15, 16, 17, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1371,7 +1360,7 @@ static const yytype_int16 yytable[] =
55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 67, 68, 69, 0, 70, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 241, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 238, 0,
0, 0, 0, 0, 72, 73, 74, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 14, 15, 16, 17, 0, 0, 0, 0, 0,
@@ -1383,7 +1372,7 @@ static const yytype_int16 yytable[] =
59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
69, 0, 163, 164, 165, 166, 167, 168, 0, 0,
169, 170, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 320, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 317, 0, 0, 0, 0, 0,
72, 73, 74, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1394,7 +1383,7 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 171, 0, 0,
0, 0, 0, 172, 173, 174, 175, 12, 13, 14,
- 15, 16, 17, 0, 0, 0, 0, 0, 252, 0,
+ 15, 16, 17, 0, 0, 0, 0, 0, 249, 0,
0, 0, 0, 0, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, 30, 0, 31, 0,
32, 0, 33, 34, 35, 36, 37, 38, 39, 40,
@@ -1430,7 +1419,7 @@ static const yytype_int16 yytable[] =
0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 14, 15, 16, 17, 0, 171, 0, 0, 231,
+ 0, 14, 15, 16, 17, 0, 171, 0, 0, 228,
0, 0, 172, 173, 174, 175, 18, 19, 20, 21,
22, 23, 24, 25, 26, 27, 28, 29, 0, 0,
0, 0, 0, 0, 0, 0, 0, 36, 37, 38,
@@ -1449,7 +1438,7 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 14, 15, 16, 17, 0, 171, 0, 0,
- 315, 0, 0, 172, 173, 174, 175, 18, 19, 20,
+ 312, 0, 0, 172, 173, 174, 175, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 0,
0, 0, 0, 0, 0, 0, 0, 0, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@@ -1467,7 +1456,7 @@ static const yytype_int16 yytable[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 14, 15, 16, 17, 0, 171, 0,
- 0, 366, 0, 0, 172, 173, 174, 175, 18, 19,
+ 0, 363, 0, 0, 172, 173, 174, 175, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
0, 0, 0, 0, 0, 0, 0, 0, 0, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
@@ -1491,7 +1480,7 @@ static const yytype_int16 yytable[] =
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 270, 0, 163, 164, 165, 166, 167,
+ 66, 67, 68, 267, 0, 163, 164, 165, 166, 167,
168, 0, 0, 169, 170, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 72, 73, 74, 0, 0, 0, 0,
@@ -1533,7 +1522,7 @@ static const yytype_int16 yytable[] =
40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 0, 340, 14, 15, 16, 17, 168, 0, 0, 0,
+ 0, 337, 14, 15, 16, 17, 168, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 72,
73, 74, 0, 0, 0, 0, 0, 0, 36, 37,
@@ -1560,141 +1549,130 @@ static const yytype_int16 yytable[] =
static const yytype_int16 yycheck[] =
{
- 9, 76, 86, 87, 158, 229, 160, 4, 91, 76,
- 146, 154, 257, 102, 380, 212, 213, 171, 84, 85,
- 9, 109, 377, 9, 0, 391, 115, 141, 71, 191,
- 141, 193, 3, 4, 187, 377, 33, 34, 35, 93,
- 94, 95, 96, 97, 98, 99, 100, 101, 102, 211,
- 196, 4, 95, 408, 193, 3, 4, 78, 169, 170,
- 113, 32, 196, 34, 210, 36, 408, 38, 39, 40,
- 113, 214, 211, 314, 416, 84, 418, 230, 212, 190,
- 33, 34, 35, 328, 32, 76, 34, 96, 36, 313,
- 38, 39, 40, 196, 196, 84, 250, 321, 84, 196,
- 254, 237, 111, 257, 33, 76, 196, 110, 37, 212,
- 212, 265, 112, 210, 123, 229, 269, 113, 229, 262,
- 204, 205, 212, 132, 191, 113, 209, 193, 369, 195,
- 192, 284, 103, 113, 196, 144, 192, 146, 213, 113,
- 196, 365, 191, 384, 192, 154, 387, 192, 196, 120,
- 196, 305, 192, 306, 395, 103, 196, 211, 76, 33,
- 34, 314, 403, 37, 193, 192, 192, 192, 177, 196,
- 196, 196, 120, 76, 328, 286, 287, 288, 289, 290,
- 291, 292, 293, 294, 295, 296, 297, 298, 299, 300,
- 301, 302, 303, 304, 213, 192, 104, 105, 106, 313,
- 82, 83, 313, 197, 198, 214, 76, 321, 88, 89,
- 321, 293, 294, 295, 296, 76, 369, 226, 113, 373,
- 33, 34, 35, 201, 202, 203, 289, 290, 237, 382,
- 76, 384, 291, 292, 387, 212, 390, 297, 298, 212,
- 249, 191, 395, 212, 191, 212, 191, 210, 257, 191,
- 403, 365, 192, 262, 365, 191, 410, 206, 90, 92,
- 212, 207, 76, 191, 208, 75, 192, 194, 193, 193,
- 211, 194, 191, 76, 196, 192, 191, 211, 194, 211,
- 194, 194, 212, 192, 194, 3, 4, 5, 6, 7,
- 8, 9, 10, 11, 191, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 213, 34, 211, 36, 328,
- 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 211, 12, 84, 85, 377, 212,
- 12, 380, 303, 266, 226, 126, 133, 226, 299, 245,
- 300, 75, 391, 144, 322, 103, 104, 105, 106, 301,
- 108, 302, 249, 378, 86, 177, 391, 304, 249, 408,
- 84, -1, 120, -1, -1, -1, -1, 416, -1, 418,
+ 9, 154, 4, 158, 76, 160, 141, 91, 141, 3,
+ 4, 9, 86, 87, 9, 146, 171, 76, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102, 71, 84,
+ 85, 33, 34, 35, 169, 170, 4, 226, 32, 254,
+ 34, 191, 36, 193, 38, 39, 40, 196, 196, 377,
+ 193, 109, 95, 212, 213, 190, 78, 196, 196, 212,
+ 388, 211, 196, 212, 212, 33, 34, 35, 211, 196,
+ 113, 102, 0, 212, 212, 84, 210, 33, 34, 197,
+ 198, 37, 76, 210, 115, 113, 84, 96, 187, 84,
+ 33, 226, 247, 226, 37, 110, 251, 192, 76, 254,
+ 192, 196, 111, 234, 196, 113, 259, 262, 112, 103,
+ 325, 192, 192, 192, 123, 196, 196, 196, 104, 105,
+ 106, 310, 113, 132, 113, 209, 120, 191, 227, 318,
+ 204, 205, 191, 82, 83, 144, 211, 146, 193, 113,
+ 195, 213, 192, 3, 4, 154, 196, 302, 283, 284,
+ 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
+ 295, 296, 297, 298, 299, 300, 301, 266, 177, 192,
+ 325, 311, 32, 362, 34, 310, 36, 310, 38, 39,
+ 40, 76, 281, 318, 196, 318, 290, 291, 292, 293,
+ 192, 33, 34, 35, 201, 202, 203, 88, 89, 286,
+ 287, 294, 295, 212, 303, 288, 289, 76, 193, 76,
+ 213, 76, 311, 113, 223, 370, 212, 76, 191, 212,
+ 212, 374, 191, 210, 212, 234, 366, 362, 191, 362,
+ 191, 191, 387, 192, 206, 90, 207, 246, 208, 92,
+ 191, 381, 76, 103, 384, 254, 212, 194, 193, 75,
+ 259, 404, 392, 192, 211, 193, 191, 194, 76, 399,
+ 120, 192, 196, 211, 194, 191, 212, 366, 192, 194,
+ 211, 194, 194, 213, 12, 211, 296, 298, 211, 263,
+ 379, 297, 381, 212, 301, 384, 299, 126, 133, 300,
+ 242, 223, 75, 392, 144, 319, 223, 375, 388, 86,
+ 399, 177, 246, 84, 246, -1, 325, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 325, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 328, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 154, -1, 156, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 191, -1, -1, -1, -1, -1, 197,
- 198, 199, 200, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 212, 213, 214, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, -1, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, -1, 34, -1,
- 36, -1, 38, 39, 40, 41, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 76, 77, 78, 79, 80, 81, -1, -1, 84, 85,
+ -1, -1, -1, -1, -1, 374, -1, -1, 377, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 388,
+ -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 404, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, -1, 34, -1, 36,
+ -1, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ 77, 78, 79, 80, 81, -1, -1, 84, 85, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 103, 104, 105,
- 106, -1, 108, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 120, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 103, 104, 105, 106,
+ -1, 108, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 120, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 154, -1,
- 156, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 154, -1, 156,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 191, -1, -1, -1, -1,
- -1, 197, 198, 199, 200, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 212, 213, 214, 3,
- 4, 5, 6, 7, 8, 9, 10, 11, -1, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, -1,
- 34, -1, 36, -1, 38, 39, 40, 41, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 75, 76, 77, 78, 79, 80, 81, -1, -1,
- 84, 85, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 103,
- 104, 105, 106, -1, 108, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 120, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 191, -1, -1, -1, -1, -1,
+ 197, 198, 199, 200, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 212, 213, 214, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, -1, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, -1, 34,
+ -1, 36, -1, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 76, 77, 78, 79, 80, 81, -1, -1, 84,
+ 85, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 103, 104,
+ 105, 106, -1, 108, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 120, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 154, -1, 156, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 154,
+ -1, 156, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 191, -1, -1,
- -1, -1, -1, 197, 198, 199, 200, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 212, 213,
- 214, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- -1, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, -1, 34, -1, 36, -1, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
- -1, -1, 84, 85, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 191, -1, -1, -1,
+ -1, -1, 197, 198, 199, 200, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 212, 213, 214,
+ 3, 4, 5, 6, 7, 8, 9, 10, 11, -1,
+ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ -1, 34, -1, 36, -1, 38, 39, 40, 41, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
+ 73, 74, 75, 76, 77, 78, 79, 80, 81, -1,
+ -1, 84, 85, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 103, 104, 105, 106, -1, 108, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 120, -1,
+ 103, 104, 105, 106, -1, 108, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 120, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 154, -1, 156, -1, -1, -1, -1, -1,
+ -1, 154, -1, 156, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 191,
- -1, -1, -1, -1, -1, 197, 198, 199, 200, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 191, -1,
+ -1, -1, -1, -1, 197, 198, 199, 200, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 212,
+ 213, 214, 3, 4, 5, 6, 7, 8, 9, 10,
+ 11, -1, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, -1, 34, -1, 36, -1, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81, -1, -1, 84, 85, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 212, 213, 214, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, -1, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, -1, 34, -1, 36, -1, 38, 39,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, -1, -1, 84, 85, -1, -1, -1, -1,
+ -1, -1, 103, 104, 105, 106, -1, 108, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 120,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 103, 104, 105, 106, -1, 108, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 120, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 154, -1, 156, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 154, -1, 156, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 191, -1, -1, -1, -1, -1, 197, 198, 199, 200,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 191, -1, -1, -1, -1, -1, 197, 198, 199,
- 200, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 212, 213, 3, 4, 5, 6, 7, 8,
+ -1, 212, 213, 214, 3, 4, 5, 6, 7, 8,
9, 10, 11, -1, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, -1, 34, -1, 36, -1, 38,
@@ -1988,9 +1966,9 @@ static const yytype_uint16 yystos[] =
76, 103, 104, 105, 106, 108, 116, 117, 118, 119,
120, 154, 156, 219, 222, 252, 253, 254, 255, 256,
261, 262, 263, 264, 265, 268, 270, 271, 272, 273,
- 274, 275, 276, 277, 303, 304, 112, 33, 34, 37,
+ 274, 275, 276, 277, 301, 302, 112, 33, 34, 37,
76, 213, 76, 103, 270, 276, 113, 113, 113, 113,
- 191, 303, 212, 213, 290, 192, 196, 4, 33, 34,
+ 191, 301, 212, 213, 288, 192, 196, 4, 33, 34,
35, 258, 259, 269, 196, 212, 76, 33, 37, 270,
272, 193, 273, 76, 213, 272, 278, 279, 273, 76,
266, 267, 9, 10, 11, 13, 14, 15, 16, 17,
@@ -1999,27 +1977,26 @@ static const yytype_uint16 yystos[] =
224, 225, 227, 228, 229, 230, 231, 232, 233, 234,
235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
245, 246, 247, 248, 250, 252, 253, 272, 283, 284,
- 285, 286, 287, 288, 291, 292, 293, 294, 296, 297,
- 298, 302, 258, 257, 260, 272, 259, 76, 191, 193,
- 211, 194, 234, 247, 251, 272, 113, 278, 76, 280,
- 281, 214, 279, 212, 192, 196, 212, 212, 284, 191,
- 191, 212, 212, 250, 191, 250, 210, 191, 234, 234,
- 250, 214, 291, 84, 85, 193, 195, 192, 192, 196,
- 74, 248, 191, 93, 94, 95, 96, 97, 98, 99,
- 100, 101, 102, 211, 249, 234, 201, 202, 203, 197,
- 198, 82, 83, 86, 87, 204, 205, 88, 89, 206,
- 207, 208, 90, 92, 91, 209, 196, 212, 214, 284,
- 76, 257, 260, 193, 211, 194, 251, 248, 282, 194,
- 214, 193, 196, 212, 267, 75, 283, 292, 299, 250,
- 212, 250, 210, 250, 263, 295, 192, 214, 226, 250,
- 76, 229, 248, 248, 234, 234, 234, 236, 236, 237,
- 237, 238, 238, 238, 238, 239, 239, 240, 241, 242,
- 243, 244, 245, 250, 248, 193, 194, 251, 282, 211,
- 194, 251, 281, 191, 295, 300, 301, 192, 192, 76,
- 192, 194, 210, 251, 211, 194, 282, 211, 194, 250,
- 212, 192, 285, 286, 288, 211, 14, 287, 289, 290,
- 248, 194, 282, 211, 282, 192, 250, 289, 12, 282,
- 191, 282, 212, 285, 286, 250, 192, 285, 12
+ 285, 286, 289, 290, 291, 294, 295, 296, 300, 258,
+ 257, 260, 272, 259, 76, 191, 193, 211, 194, 234,
+ 247, 251, 272, 113, 278, 76, 280, 281, 214, 279,
+ 212, 192, 196, 212, 212, 284, 191, 191, 212, 212,
+ 250, 191, 250, 210, 191, 234, 234, 250, 214, 289,
+ 84, 85, 193, 195, 192, 192, 196, 74, 248, 191,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 211, 249, 234, 201, 202, 203, 197, 198, 82, 83,
+ 86, 87, 204, 205, 88, 89, 206, 207, 208, 90,
+ 92, 91, 209, 196, 212, 214, 284, 76, 257, 260,
+ 193, 211, 194, 251, 248, 282, 194, 214, 193, 196,
+ 212, 267, 75, 283, 290, 297, 250, 212, 250, 210,
+ 250, 263, 293, 192, 214, 226, 250, 76, 229, 248,
+ 248, 234, 234, 234, 236, 236, 237, 237, 238, 238,
+ 238, 238, 239, 239, 240, 241, 242, 243, 244, 245,
+ 250, 248, 193, 194, 251, 282, 211, 194, 251, 281,
+ 191, 293, 298, 299, 192, 192, 76, 192, 194, 210,
+ 251, 211, 194, 282, 211, 194, 250, 212, 192, 284,
+ 292, 286, 211, 285, 287, 288, 248, 194, 282, 211,
+ 282, 192, 250, 287, 12, 282, 282, 212, 284
};
#define yyerrok (yyerrstatus = 0)
@@ -2034,9 +2011,18 @@ static const yytype_uint16 yystos[] =
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -2093,7 +2079,7 @@ while (YYID (0))
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@@ -2635,7 +2621,7 @@ YYLTYPE yylloc;
YYLTYPE *yylsp;
/* The locations where the error started and ended. */
- YYLTYPE yyerror_range[2];
+ YYLTYPE yyerror_range[3];
YYSIZE_T yystacksize;
@@ -2682,7 +2668,7 @@ YYLTYPE yylloc;
yyvsp = yyvs;
yylsp = yyls;
-#if YYLTYPE_IS_TRIVIAL
+#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
/* Initialize the default location before parsing starts. */
yylloc.first_line = yylloc.last_line = 1;
yylloc.first_column = yylloc.last_column = 1;
@@ -2690,7 +2676,7 @@ YYLTYPE yylloc;
/* User initialization code. */
-/* Line 1242 of yacc.c */
+/* Line 1251 of yacc.c */
#line 41 "glsl_parser.ypp"
{
yylloc.first_line = 1;
@@ -2700,8 +2686,8 @@ YYLTYPE yylloc;
yylloc.source = 0;
}
-/* Line 1242 of yacc.c */
-#line 2705 "glsl_parser.cpp"
+/* Line 1251 of yacc.c */
+#line 2691 "glsl_parser.cpp"
yylsp[0] = yylloc;
goto yysetstate;
@@ -2888,35 +2874,26 @@ yyreduce:
{
case 2:
-/* Line 1455 of yacc.c */
-#line 211 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 214 "glsl_parser.ypp"
{
_mesa_glsl_initialize_types(state);
;}
break;
- case 4:
-
-/* Line 1455 of yacc.c */
-#line 219 "glsl_parser.ypp"
- {
- state->language_version = 110;
- state->symbols->language_version = 110;
- ;}
- break;
-
case 5:
-/* Line 1455 of yacc.c */
-#line 224 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 223 "glsl_parser.ypp"
{
switch ((yyvsp[(2) - (3)].n)) {
+ case 100:
+ state->es_shader = true;
case 110:
case 120:
case 130:
/* FINISHME: Check against implementation support versions. */
state->language_version = (yyvsp[(2) - (3)].n);
- state->symbols->language_version = (yyvsp[(2) - (3)].n);
break;
default:
_mesa_glsl_error(& (yylsp[(2) - (3)]), state, "Shading language version"
@@ -2928,7 +2905,7 @@ yyreduce:
case 12:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 255 "glsl_parser.ypp"
{
if (!_mesa_glsl_process_extension((yyvsp[(2) - (5)].identifier), & (yylsp[(2) - (5)]), (yyvsp[(4) - (5)].identifier), & (yylsp[(4) - (5)]), state)) {
@@ -2939,7 +2916,7 @@ yyreduce:
case 13:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 264 "glsl_parser.ypp"
{
/* FINISHME: The NULL test is only required because 'precision'
@@ -2952,7 +2929,7 @@ yyreduce:
case 14:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 272 "glsl_parser.ypp"
{
/* FINISHME: The NULL test is only required because 'precision'
@@ -2965,7 +2942,7 @@ yyreduce:
case 16:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 287 "glsl_parser.ypp"
{
void *ctx = state;
@@ -2977,7 +2954,7 @@ yyreduce:
case 17:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 294 "glsl_parser.ypp"
{
void *ctx = state;
@@ -2989,7 +2966,7 @@ yyreduce:
case 18:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 301 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3001,7 +2978,7 @@ yyreduce:
case 19:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 308 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3013,7 +2990,7 @@ yyreduce:
case 20:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 315 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3025,7 +3002,7 @@ yyreduce:
case 21:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 322 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(2) - (3)].expression);
@@ -3034,7 +3011,7 @@ yyreduce:
case 23:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 330 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3045,7 +3022,7 @@ yyreduce:
case 24:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 336 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (1)].expression);
@@ -3054,7 +3031,7 @@ yyreduce:
case 25:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 340 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3066,7 +3043,7 @@ yyreduce:
case 26:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 347 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3077,7 +3054,7 @@ yyreduce:
case 27:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 353 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3088,7 +3065,7 @@ yyreduce:
case 31:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 371 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3099,7 +3076,7 @@ yyreduce:
case 36:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 390 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (2)].expression);
@@ -3110,7 +3087,7 @@ yyreduce:
case 37:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 396 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (3)].expression);
@@ -3121,7 +3098,7 @@ yyreduce:
case 39:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 412 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3132,7 +3109,7 @@ yyreduce:
case 40:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 418 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3144,7 +3121,7 @@ yyreduce:
case 41:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 425 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3156,7 +3133,7 @@ yyreduce:
case 43:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 437 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3167,7 +3144,7 @@ yyreduce:
case 44:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 443 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3178,7 +3155,7 @@ yyreduce:
case 45:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 449 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3189,35 +3166,35 @@ yyreduce:
case 46:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 458 "glsl_parser.ypp"
{ (yyval.n) = ast_plus; ;}
break;
case 47:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 459 "glsl_parser.ypp"
{ (yyval.n) = ast_neg; ;}
break;
case 48:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 460 "glsl_parser.ypp"
{ (yyval.n) = ast_logic_not; ;}
break;
case 49:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 461 "glsl_parser.ypp"
{ (yyval.n) = ast_bit_not; ;}
break;
case 51:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 467 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3228,7 +3205,7 @@ yyreduce:
case 52:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 473 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3239,7 +3216,7 @@ yyreduce:
case 53:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 479 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3250,7 +3227,7 @@ yyreduce:
case 55:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 489 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3261,7 +3238,7 @@ yyreduce:
case 56:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 495 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3272,7 +3249,7 @@ yyreduce:
case 58:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 505 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3283,7 +3260,7 @@ yyreduce:
case 59:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 511 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3294,7 +3271,7 @@ yyreduce:
case 61:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 521 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3305,7 +3282,7 @@ yyreduce:
case 62:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 527 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3316,7 +3293,7 @@ yyreduce:
case 63:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 533 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3327,7 +3304,7 @@ yyreduce:
case 64:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 539 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3338,7 +3315,7 @@ yyreduce:
case 66:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 549 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3349,7 +3326,7 @@ yyreduce:
case 67:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 555 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3360,7 +3337,7 @@ yyreduce:
case 69:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 565 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3371,7 +3348,7 @@ yyreduce:
case 71:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 575 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3382,7 +3359,7 @@ yyreduce:
case 73:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 585 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3393,7 +3370,7 @@ yyreduce:
case 75:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 595 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3404,7 +3381,7 @@ yyreduce:
case 77:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 605 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3415,7 +3392,7 @@ yyreduce:
case 79:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 615 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3426,7 +3403,7 @@ yyreduce:
case 81:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 625 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3437,7 +3414,7 @@ yyreduce:
case 83:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 635 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3448,84 +3425,84 @@ yyreduce:
case 84:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 643 "glsl_parser.ypp"
{ (yyval.n) = ast_assign; ;}
break;
case 85:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 644 "glsl_parser.ypp"
{ (yyval.n) = ast_mul_assign; ;}
break;
case 86:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 645 "glsl_parser.ypp"
{ (yyval.n) = ast_div_assign; ;}
break;
case 87:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 646 "glsl_parser.ypp"
{ (yyval.n) = ast_mod_assign; ;}
break;
case 88:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 647 "glsl_parser.ypp"
{ (yyval.n) = ast_add_assign; ;}
break;
case 89:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 648 "glsl_parser.ypp"
{ (yyval.n) = ast_sub_assign; ;}
break;
case 90:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 649 "glsl_parser.ypp"
{ (yyval.n) = ast_ls_assign; ;}
break;
case 91:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 650 "glsl_parser.ypp"
{ (yyval.n) = ast_rs_assign; ;}
break;
case 92:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 651 "glsl_parser.ypp"
{ (yyval.n) = ast_and_assign; ;}
break;
case 93:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 652 "glsl_parser.ypp"
{ (yyval.n) = ast_xor_assign; ;}
break;
case 94:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 653 "glsl_parser.ypp"
{ (yyval.n) = ast_or_assign; ;}
break;
case 95:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 658 "glsl_parser.ypp"
{
(yyval.expression) = (yyvsp[(1) - (1)].expression);
@@ -3534,7 +3511,7 @@ yyreduce:
case 96:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 662 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3552,7 +3529,7 @@ yyreduce:
case 98:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 682 "glsl_parser.ypp"
{
(yyval.node) = (yyvsp[(1) - (2)].function);
@@ -3561,7 +3538,7 @@ yyreduce:
case 99:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 686 "glsl_parser.ypp"
{
(yyval.node) = (yyvsp[(1) - (2)].declarator_list);
@@ -3570,7 +3547,7 @@ yyreduce:
case 100:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 690 "glsl_parser.ypp"
{
if (((yyvsp[(3) - (4)].type_specifier)->type_specifier != ast_float)
@@ -3586,7 +3563,7 @@ yyreduce:
case 104:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 713 "glsl_parser.ypp"
{
(yyval.function) = (yyvsp[(1) - (2)].function);
@@ -3596,7 +3573,7 @@ yyreduce:
case 105:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 718 "glsl_parser.ypp"
{
(yyval.function) = (yyvsp[(1) - (3)].function);
@@ -3606,7 +3583,7 @@ yyreduce:
case 106:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 726 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3619,7 +3596,7 @@ yyreduce:
case 107:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 737 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3634,7 +3611,7 @@ yyreduce:
case 108:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 747 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3651,7 +3628,7 @@ yyreduce:
case 109:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 762 "glsl_parser.ypp"
{
(yyvsp[(1) - (3)].type_qualifier).i |= (yyvsp[(2) - (3)].type_qualifier).i;
@@ -3663,7 +3640,7 @@ yyreduce:
case 110:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 769 "glsl_parser.ypp"
{
(yyval.parameter_declarator) = (yyvsp[(2) - (2)].parameter_declarator);
@@ -3673,7 +3650,7 @@ yyreduce:
case 111:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 774 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3689,7 +3666,7 @@ yyreduce:
case 112:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 785 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3703,35 +3680,35 @@ yyreduce:
case 113:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 796 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; ;}
break;
case 114:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 797 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;}
break;
case 115:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 798 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;}
break;
case 116:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 799 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; (yyval.type_qualifier).q.out = 1; ;}
break;
case 119:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 809 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3745,7 +3722,7 @@ yyreduce:
case 120:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 818 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3759,7 +3736,7 @@ yyreduce:
case 121:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 827 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3773,7 +3750,7 @@ yyreduce:
case 122:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 836 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3787,7 +3764,7 @@ yyreduce:
case 123:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 845 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3801,7 +3778,7 @@ yyreduce:
case 124:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 854 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3815,7 +3792,7 @@ yyreduce:
case 125:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 867 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3831,7 +3808,7 @@ yyreduce:
case 126:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 878 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3845,7 +3822,7 @@ yyreduce:
case 127:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 887 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3859,7 +3836,7 @@ yyreduce:
case 128:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 896 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3873,7 +3850,7 @@ yyreduce:
case 129:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 905 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3887,7 +3864,7 @@ yyreduce:
case 130:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 914 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3901,7 +3878,7 @@ yyreduce:
case 131:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 923 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3915,7 +3892,7 @@ yyreduce:
case 132:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 932 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3931,7 +3908,7 @@ yyreduce:
case 133:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 946 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3943,7 +3920,7 @@ yyreduce:
case 134:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 953 "glsl_parser.ypp"
{
void *ctx = state;
@@ -3956,14 +3933,14 @@ yyreduce:
case 135:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 963 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; ;}
break;
case 137:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 969 "glsl_parser.ypp"
{
(yyval.type_qualifier) = (yyvsp[(3) - (4)].type_qualifier);
@@ -3972,7 +3949,7 @@ yyreduce:
case 139:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 977 "glsl_parser.ypp"
{
(yyval.type_qualifier).i = (yyvsp[(1) - (3)].type_qualifier).i | (yyvsp[(3) - (3)].type_qualifier).i;
@@ -3981,7 +3958,7 @@ yyreduce:
case 140:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 984 "glsl_parser.ypp"
{
(yyval.type_qualifier).i = 0;
@@ -4017,35 +3994,35 @@ yyreduce:
case 141:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1017 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.smooth = 1; ;}
break;
case 142:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1018 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.flat = 1; ;}
break;
case 143:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1019 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.noperspective = 1; ;}
break;
case 144:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1023 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;}
break;
case 146:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1029 "glsl_parser.ypp"
{
(yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i | (yyvsp[(2) - (2)].type_qualifier).i;
@@ -4054,7 +4031,7 @@ yyreduce:
case 147:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1033 "glsl_parser.ypp"
{
(yyval.type_qualifier) = (yyvsp[(2) - (2)].type_qualifier);
@@ -4064,70 +4041,70 @@ yyreduce:
case 148:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1040 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.constant = 1; ;}
break;
case 149:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1041 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.attribute = 1; ;}
break;
case 150:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1042 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = (yyvsp[(1) - (2)].type_qualifier).i; (yyval.type_qualifier).q.varying = 1; ;}
break;
case 151:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1043 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.varying = 1; ;}
break;
case 152:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1044 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.in = 1; ;}
break;
case 153:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1045 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.out = 1; ;}
break;
case 154:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1046 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.in = 1; ;}
break;
case 155:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1047 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.centroid = 1; (yyval.type_qualifier).q.out = 1; ;}
break;
case 156:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1048 "glsl_parser.ypp"
{ (yyval.type_qualifier).i = 0; (yyval.type_qualifier).q.uniform = 1; ;}
break;
case 158:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1054 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(2) - (2)].type_specifier);
@@ -4137,7 +4114,7 @@ yyreduce:
case 160:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1063 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(1) - (3)].type_specifier);
@@ -4148,7 +4125,7 @@ yyreduce:
case 161:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1069 "glsl_parser.ypp"
{
(yyval.type_specifier) = (yyvsp[(1) - (4)].type_specifier);
@@ -4159,7 +4136,7 @@ yyreduce:
case 162:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1078 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4170,7 +4147,7 @@ yyreduce:
case 163:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1084 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4181,7 +4158,7 @@ yyreduce:
case 164:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1090 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4192,415 +4169,415 @@ yyreduce:
case 165:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1098 "glsl_parser.ypp"
{ (yyval.n) = ast_void; ;}
break;
case 166:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1099 "glsl_parser.ypp"
{ (yyval.n) = ast_float; ;}
break;
case 167:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1100 "glsl_parser.ypp"
{ (yyval.n) = ast_int; ;}
break;
case 168:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1101 "glsl_parser.ypp"
{ (yyval.n) = ast_uint; ;}
break;
case 169:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1102 "glsl_parser.ypp"
{ (yyval.n) = ast_bool; ;}
break;
case 170:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1103 "glsl_parser.ypp"
{ (yyval.n) = ast_vec2; ;}
break;
case 171:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1104 "glsl_parser.ypp"
{ (yyval.n) = ast_vec3; ;}
break;
case 172:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1105 "glsl_parser.ypp"
{ (yyval.n) = ast_vec4; ;}
break;
case 173:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1106 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec2; ;}
break;
case 174:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1107 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec3; ;}
break;
case 175:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1108 "glsl_parser.ypp"
{ (yyval.n) = ast_bvec4; ;}
break;
case 176:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1109 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec2; ;}
break;
case 177:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1110 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec3; ;}
break;
case 178:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1111 "glsl_parser.ypp"
{ (yyval.n) = ast_ivec4; ;}
break;
case 179:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1112 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec2; ;}
break;
case 180:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1113 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec3; ;}
break;
case 181:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1114 "glsl_parser.ypp"
{ (yyval.n) = ast_uvec4; ;}
break;
case 182:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1115 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2; ;}
break;
case 183:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1116 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2x3; ;}
break;
case 184:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1117 "glsl_parser.ypp"
{ (yyval.n) = ast_mat2x4; ;}
break;
case 185:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1118 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3x2; ;}
break;
case 186:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1119 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3; ;}
break;
case 187:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1120 "glsl_parser.ypp"
{ (yyval.n) = ast_mat3x4; ;}
break;
case 188:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1121 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4x2; ;}
break;
case 189:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1122 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4x3; ;}
break;
case 190:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1123 "glsl_parser.ypp"
{ (yyval.n) = ast_mat4; ;}
break;
case 191:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1124 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1d; ;}
break;
case 192:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1125 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2d; ;}
break;
case 193:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1126 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2drect; ;}
break;
case 194:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1127 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler3d; ;}
break;
case 195:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1128 "glsl_parser.ypp"
{ (yyval.n) = ast_samplercube; ;}
break;
case 196:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1129 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1dshadow; ;}
break;
case 197:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1130 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2dshadow; ;}
break;
case 198:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1131 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2drectshadow; ;}
break;
case 199:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1132 "glsl_parser.ypp"
{ (yyval.n) = ast_samplercubeshadow; ;}
break;
case 200:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1133 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1darray; ;}
break;
case 201:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1134 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2darray; ;}
break;
case 202:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1135 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler1darrayshadow; ;}
break;
case 203:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1136 "glsl_parser.ypp"
{ (yyval.n) = ast_sampler2darrayshadow; ;}
break;
case 204:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1137 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler1d; ;}
break;
case 205:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1138 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler2d; ;}
break;
case 206:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1139 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler3d; ;}
break;
case 207:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1140 "glsl_parser.ypp"
{ (yyval.n) = ast_isamplercube; ;}
break;
case 208:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1141 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler1darray; ;}
break;
case 209:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1142 "glsl_parser.ypp"
{ (yyval.n) = ast_isampler2darray; ;}
break;
case 210:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1143 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler1d; ;}
break;
case 211:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1144 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler2d; ;}
break;
case 212:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1145 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler3d; ;}
break;
case 213:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1146 "glsl_parser.ypp"
{ (yyval.n) = ast_usamplercube; ;}
break;
case 214:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1147 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler1darray; ;}
break;
case 215:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1148 "glsl_parser.ypp"
{ (yyval.n) = ast_usampler2darray; ;}
break;
case 216:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1152 "glsl_parser.ypp"
{
- if (state->language_version < 130)
- _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
- (yyval.n) = ast_precision_high;
- ;}
+ (yyval.n) = ast_precision_high;
+ ;}
break;
case 217:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1163 "glsl_parser.ypp"
{
- if (state->language_version < 130)
- _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
- (yyval.n) = ast_precision_medium;
- ;}
+ (yyval.n) = ast_precision_medium;
+ ;}
break;
case 218:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1174 "glsl_parser.ypp"
{
- if (state->language_version < 130)
- _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& (yylsp[(1) - (1)]), state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
- (yyval.n) = ast_precision_low;
- ;}
+ (yyval.n) = ast_precision_low;
+ ;}
break;
case 219:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1189 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4611,7 +4588,7 @@ yyreduce:
case 220:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1195 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4622,7 +4599,7 @@ yyreduce:
case 221:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1204 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (1)].declarator_list);
@@ -4632,7 +4609,7 @@ yyreduce:
case 222:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1209 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (2)].node);
@@ -4642,7 +4619,7 @@ yyreduce:
case 223:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1217 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4659,7 +4636,7 @@ yyreduce:
case 224:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1232 "glsl_parser.ypp"
{
(yyval.declaration) = (yyvsp[(1) - (1)].declaration);
@@ -4669,7 +4646,7 @@ yyreduce:
case 225:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1237 "glsl_parser.ypp"
{
(yyval.declaration) = (yyvsp[(1) - (3)].declaration);
@@ -4679,7 +4656,7 @@ yyreduce:
case 226:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1245 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4690,7 +4667,7 @@ yyreduce:
case 227:
-/* Line 1455 of yacc.c */
+/* Line 1464 of yacc.c */
#line 1251 "glsl_parser.ypp"
{
void *ctx = state;
@@ -4699,31 +4676,31 @@ yyreduce:
;}
break;
- case 232:
+ case 230:
-/* Line 1455 of yacc.c */
-#line 1274 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1269 "glsl_parser.ypp"
{ (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
break;
- case 238:
+ case 235:
-/* Line 1455 of yacc.c */
-#line 1286 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1277 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 239:
+ case 236:
-/* Line 1455 of yacc.c */
-#line 1287 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1278 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 242:
+ case 239:
-/* Line 1455 of yacc.c */
-#line 1294 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1285 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(true, NULL);
@@ -4731,10 +4708,10 @@ yyreduce:
;}
break;
- case 243:
+ case 240:
-/* Line 1455 of yacc.c */
-#line 1300 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1291 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(true, (yyvsp[(2) - (3)].node));
@@ -4742,17 +4719,17 @@ yyreduce:
;}
break;
- case 244:
+ case 241:
-/* Line 1455 of yacc.c */
-#line 1308 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1299 "glsl_parser.ypp"
{ (yyval.node) = (ast_node *) (yyvsp[(1) - (1)].compound_statement); ;}
break;
- case 246:
+ case 243:
-/* Line 1455 of yacc.c */
-#line 1314 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1305 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(false, NULL);
@@ -4760,10 +4737,10 @@ yyreduce:
;}
break;
- case 247:
+ case 244:
-/* Line 1455 of yacc.c */
-#line 1320 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1311 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.compound_statement) = new(ctx) ast_compound_statement(false, (yyvsp[(2) - (3)].node));
@@ -4771,10 +4748,10 @@ yyreduce:
;}
break;
- case 248:
+ case 245:
-/* Line 1455 of yacc.c */
-#line 1329 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1320 "glsl_parser.ypp"
{
if ((yyvsp[(1) - (1)].node) == NULL) {
_mesa_glsl_error(& (yylsp[(1) - (1)]), state, "<nil> statement\n");
@@ -4786,10 +4763,10 @@ yyreduce:
;}
break;
- case 249:
+ case 246:
-/* Line 1455 of yacc.c */
-#line 1339 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1330 "glsl_parser.ypp"
{
if ((yyvsp[(2) - (2)].node) == NULL) {
_mesa_glsl_error(& (yylsp[(2) - (2)]), state, "<nil> statement\n");
@@ -4800,10 +4777,10 @@ yyreduce:
;}
break;
- case 250:
+ case 247:
-/* Line 1455 of yacc.c */
-#line 1351 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1342 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_expression_statement(NULL);
@@ -4811,10 +4788,10 @@ yyreduce:
;}
break;
- case 251:
+ case 248:
-/* Line 1455 of yacc.c */
-#line 1357 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1348 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_expression_statement((yyvsp[(1) - (2)].expression));
@@ -4822,63 +4799,50 @@ yyreduce:
;}
break;
- case 252:
-
-/* Line 1455 of yacc.c */
-#line 1366 "glsl_parser.ypp"
- {
- void *ctx = state;
- (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node));
- (yyval.node)->set_location(yylloc);
- ;}
- break;
-
- case 253:
+ case 249:
-/* Line 1455 of yacc.c */
-#line 1375 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1357 "glsl_parser.ypp"
{
- void *ctx = state;
- (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL);
+ (yyval.node) = new(state) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].selection_rest_statement).then_statement,
+ (yyvsp[(5) - (5)].selection_rest_statement).else_statement);
(yyval.node)->set_location(yylloc);
;}
break;
- case 254:
+ case 250:
-/* Line 1455 of yacc.c */
-#line 1381 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1366 "glsl_parser.ypp"
{
- void *ctx = state;
- (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (5)].expression), (yyvsp[(5) - (5)].node), NULL);
- (yyval.node)->set_location(yylloc);
+ (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (3)].node);
+ (yyval.selection_rest_statement).else_statement = (yyvsp[(3) - (3)].node);
;}
break;
- case 255:
+ case 251:
-/* Line 1455 of yacc.c */
-#line 1387 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1371 "glsl_parser.ypp"
{
- void *ctx = state;
- (yyval.node) = new(ctx) ast_selection_statement((yyvsp[(3) - (7)].expression), (yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node));
- (yyval.node)->set_location(yylloc);
+ (yyval.selection_rest_statement).then_statement = (yyvsp[(1) - (1)].node);
+ (yyval.selection_rest_statement).else_statement = NULL;
;}
break;
- case 256:
+ case 252:
-/* Line 1455 of yacc.c */
-#line 1396 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1379 "glsl_parser.ypp"
{
(yyval.node) = (ast_node *) (yyvsp[(1) - (1)].expression);
;}
break;
- case 257:
+ case 253:
-/* Line 1455 of yacc.c */
-#line 1400 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1383 "glsl_parser.ypp"
{
void *ctx = state;
ast_declaration *decl = new(ctx) ast_declaration((yyvsp[(2) - (4)].identifier), false, NULL, (yyvsp[(4) - (4)].expression));
@@ -4891,10 +4855,10 @@ yyreduce:
;}
break;
- case 261:
+ case 257:
-/* Line 1455 of yacc.c */
-#line 1423 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1406 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_while,
@@ -4903,10 +4867,10 @@ yyreduce:
;}
break;
- case 262:
+ case 258:
-/* Line 1455 of yacc.c */
-#line 1430 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1413 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_do_while,
@@ -4915,10 +4879,10 @@ yyreduce:
;}
break;
- case 263:
+ case 259:
-/* Line 1455 of yacc.c */
-#line 1437 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1420 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_iteration_statement(ast_iteration_statement::ast_for,
@@ -4927,39 +4891,39 @@ yyreduce:
;}
break;
- case 267:
+ case 263:
-/* Line 1455 of yacc.c */
-#line 1453 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1436 "glsl_parser.ypp"
{
(yyval.node) = NULL;
;}
break;
- case 268:
+ case 264:
-/* Line 1455 of yacc.c */
-#line 1460 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1443 "glsl_parser.ypp"
{
(yyval.for_rest_statement).cond = (yyvsp[(1) - (2)].node);
(yyval.for_rest_statement).rest = NULL;
;}
break;
- case 269:
+ case 265:
-/* Line 1455 of yacc.c */
-#line 1465 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1448 "glsl_parser.ypp"
{
(yyval.for_rest_statement).cond = (yyvsp[(1) - (3)].node);
(yyval.for_rest_statement).rest = (yyvsp[(3) - (3)].expression);
;}
break;
- case 270:
+ case 266:
-/* Line 1455 of yacc.c */
-#line 1474 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1457 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_continue, NULL);
@@ -4967,10 +4931,10 @@ yyreduce:
;}
break;
- case 271:
+ case 267:
-/* Line 1455 of yacc.c */
-#line 1480 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1463 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_break, NULL);
@@ -4978,10 +4942,10 @@ yyreduce:
;}
break;
- case 272:
+ case 268:
-/* Line 1455 of yacc.c */
-#line 1486 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1469 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, NULL);
@@ -4989,10 +4953,10 @@ yyreduce:
;}
break;
- case 273:
+ case 269:
-/* Line 1455 of yacc.c */
-#line 1492 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1475 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_return, (yyvsp[(2) - (3)].expression));
@@ -5000,10 +4964,10 @@ yyreduce:
;}
break;
- case 274:
+ case 270:
-/* Line 1455 of yacc.c */
-#line 1498 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1481 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.node) = new(ctx) ast_jump_statement(ast_jump_statement::ast_discard, NULL);
@@ -5011,31 +4975,31 @@ yyreduce:
;}
break;
- case 275:
+ case 271:
-/* Line 1455 of yacc.c */
-#line 1506 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1489 "glsl_parser.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].function_definition); ;}
break;
- case 276:
+ case 272:
-/* Line 1455 of yacc.c */
-#line 1507 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1490 "glsl_parser.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); ;}
break;
- case 277:
+ case 273:
-/* Line 1455 of yacc.c */
-#line 1508 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1491 "glsl_parser.ypp"
{ (yyval.node) = NULL; ;}
break;
- case 278:
+ case 274:
-/* Line 1455 of yacc.c */
-#line 1513 "glsl_parser.ypp"
+/* Line 1464 of yacc.c */
+#line 1496 "glsl_parser.ypp"
{
void *ctx = state;
(yyval.function_definition) = new(ctx) ast_function_definition();
@@ -5047,8 +5011,8 @@ yyreduce:
-/* Line 1455 of yacc.c */
-#line 5052 "glsl_parser.cpp"
+/* Line 1464 of yacc.c */
+#line 5016 "glsl_parser.cpp"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5120,7 +5084,7 @@ yyerrlab:
#endif
}
- yyerror_range[0] = yylloc;
+ yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
@@ -5157,7 +5121,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- yyerror_range[0] = yylsp[1-yylen];
+ yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@@ -5191,7 +5155,7 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
- yyerror_range[0] = *yylsp;
+ yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
yystos[yystate], yyvsp, yylsp, state);
YYPOPSTACK (1);
@@ -5201,10 +5165,10 @@ yyerrlab1:
*++yyvsp = yylval;
- yyerror_range[1] = yylloc;
+ yyerror_range[2] = yylloc;
/* Using YYLLOC is tempting, but would change the location of
the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2);
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
*++yylsp = yyloc;
/* Shift the error token. */
diff --git a/src/glsl/glsl_parser.h b/src/glsl/glsl_parser.h
index 3ed90853ad..4a780375bf 100644
--- a/src/glsl/glsl_parser.h
+++ b/src/glsl/glsl_parser.h
@@ -1,10 +1,9 @@
-
-/* A Bison parser, made by GNU Bison 2.4.1. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -236,7 +235,7 @@
typedef union YYSTYPE
{
-/* Line 1676 of yacc.c */
+/* Line 1685 of yacc.c */
#line 52 "glsl_parser.ypp"
int n;
@@ -265,10 +264,15 @@ typedef union YYSTYPE
ast_expression *rest;
} for_rest_statement;
+ struct {
+ ast_node *then_statement;
+ ast_node *else_statement;
+ } selection_rest_statement;
+
-/* Line 1676 of yacc.c */
-#line 272 "glsl_parser.h"
+/* Line 1685 of yacc.c */
+#line 276 "glsl_parser.h"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
diff --git a/src/glsl/glsl_parser.ypp b/src/glsl/glsl_parser.ypp
index 6d99c52503..0df1e480ce 100644
--- a/src/glsl/glsl_parser.ypp
+++ b/src/glsl/glsl_parser.ypp
@@ -75,6 +75,11 @@
ast_node *cond;
ast_expression *rest;
} for_rest_statement;
+
+ struct {
+ ast_node *then_statement;
+ ast_node *else_statement;
+ } selection_rest_statement;
}
%token ATTRIBUTE CONST_TOK BOOL_TOK FLOAT_TOK INT_TOK UINT_TOK
@@ -130,8 +135,6 @@
%type <node> statement
%type <node> statement_list
%type <node> simple_statement
-%type <node> statement_matched
-%type <node> statement_unmatched
%type <n> precision_qualifier
%type <type_qualifier> type_qualifier
%type <type_qualifier> storage_qualifier
@@ -197,8 +200,8 @@
%type <declarator_list> struct_declaration
%type <declaration> struct_declarator
%type <declaration> struct_declarator_list
-%type <node> selection_statement_matched
-%type <node> selection_statement_unmatched
+%type <node> selection_statement
+%type <selection_rest_statement> selection_rest_statement
%type <node> iteration_statement
%type <node> condition
%type <node> conditionopt
@@ -215,20 +218,17 @@ translation_unit:
;
version_statement:
- /* blank - no #version specified */
- {
- state->language_version = 110;
- state->symbols->language_version = 110;
- }
+ /* blank - no #version specified: defaults are already set */
| VERSION INTCONSTANT EOL
{
switch ($2) {
+ case 100:
+ state->es_shader = true;
case 110:
case 120:
case 130:
/* FINISHME: Check against implementation support versions. */
state->language_version = $2;
- state->symbols->language_version = $2;
break;
default:
_mesa_glsl_error(& @2, state, "Shading language version"
@@ -1149,39 +1149,39 @@ basic_type_specifier_nonarray:
;
precision_qualifier:
- HIGHP {
- if (state->language_version < 130)
- _mesa_glsl_error(& @1, state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
-
- $$ = ast_precision_high;
- }
- | MEDIUMP {
- if (state->language_version < 130)
- _mesa_glsl_error(& @1, state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
-
- $$ = ast_precision_medium;
- }
- | LOWP {
- if (state->language_version < 130)
- _mesa_glsl_error(& @1, state,
- "precision qualifier forbidden "
- "in GLSL %d.%d (1.30 or later "
- "required)\n",
- state->language_version / 100,
- state->language_version % 100);
-
- $$ = ast_precision_low;
- }
+ HIGHP {
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& @1, state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
+
+ $$ = ast_precision_high;
+ }
+ | MEDIUMP {
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& @1, state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
+
+ $$ = ast_precision_medium;
+ }
+ | LOWP {
+ if (!state->es_shader && state->language_version < 130)
+ _mesa_glsl_error(& @1, state,
+ "precision qualifier forbidden "
+ "in GLSL %d.%d (1.30 or later "
+ "required)\n",
+ state->language_version / 100,
+ state->language_version % 100);
+
+ $$ = ast_precision_low;
+ }
;
struct_specifier:
@@ -1266,23 +1266,14 @@ declaration_statement:
// Grammar Note: labeled statements for SWITCH only; 'goto' is not
// supported.
statement:
- statement_matched
- | statement_unmatched
- ;
-
-statement_matched:
compound_statement { $$ = (ast_node *) $1; }
| simple_statement
;
-statement_unmatched:
- selection_statement_unmatched
- ;
-
simple_statement:
declaration_statement
| expression_statement
- | selection_statement_matched
+ | selection_statement
| switch_statement { $$ = NULL; }
| case_label { $$ = NULL; }
| iteration_statement
@@ -1361,33 +1352,25 @@ expression_statement:
}
;
-selection_statement_matched:
- IF '(' expression ')' statement_matched ELSE statement_matched
+selection_statement:
+ IF '(' expression ')' selection_rest_statement
{
- void *ctx = state;
- $$ = new(ctx) ast_selection_statement($3, $5, $7);
+ $$ = new(state) ast_selection_statement($3, $5.then_statement,
+ $5.else_statement);
$$->set_location(yylloc);
}
;
-selection_statement_unmatched:
- IF '(' expression ')' statement_matched
+selection_rest_statement:
+ statement ELSE statement
{
- void *ctx = state;
- $$ = new(ctx) ast_selection_statement($3, $5, NULL);
- $$->set_location(yylloc);
- }
- | IF '(' expression ')' statement_unmatched
- {
- void *ctx = state;
- $$ = new(ctx) ast_selection_statement($3, $5, NULL);
- $$->set_location(yylloc);
+ $$.then_statement = $1;
+ $$.else_statement = $3;
}
- | IF '(' expression ')' statement_matched ELSE statement_unmatched
+ | statement
{
- void *ctx = state;
- $$ = new(ctx) ast_selection_statement($3, $5, $7);
- $$->set_location(yylloc);
+ $$.then_statement = $1;
+ $$.else_statement = NULL;
}
;
diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index bc56e4fcaf..4ac062b42c 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -34,6 +34,7 @@ extern "C" {
#include "glsl_parser_extras.h"
#include "glsl_parser.h"
#include "ir_optimization.h"
+#include "loop_analysis.h"
_mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx,
GLenum target, void *mem_ctx)
@@ -50,58 +51,34 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct __GLcontextRec *ctx,
this->info_log = talloc_strdup(mem_ctx, "");
this->error = false;
this->loop_or_switch_nesting = NULL;
- this->ARB_texture_rectangle_enable = true;
-
- if (ctx != NULL) {
- this->extensions = &ctx->Extensions;
-
- this->Const.MaxLights = ctx->Const.MaxLights;
- this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes;
- this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits;
- this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits;
- this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs;
- this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents;
- this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4;
- this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits;
- this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits;
- this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
- this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents;
-
- this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
- } else {
- /* If there is no GL context (standalone compiler), fill in constants
- * with the minimum required values.
- */
- static struct gl_extensions null_extensions;
-
- memset(&null_extensions, 0, sizeof(null_extensions));
- null_extensions.ARB_draw_buffers = GL_TRUE;
- null_extensions.ARB_fragment_coord_conventions = GL_TRUE;
- null_extensions.EXT_texture_array = GL_TRUE;
- null_extensions.NV_texture_rectangle = GL_TRUE;
- this->extensions = &null_extensions;
+ /* Set default language version and extensions */
+ this->language_version = 110;
+ this->es_shader = false;
+ this->ARB_texture_rectangle_enable = true;
- /* 1.10 minimums. */
- this->Const.MaxLights = 8;
- this->Const.MaxClipPlanes = 8;
- this->Const.MaxTextureUnits = 2;
+ /* OpenGL ES 2.0 has different defaults from desktop GL. */
+ if (ctx->API == API_OPENGLES2) {
+ this->language_version = 100;
+ this->es_shader = true;
+ this->ARB_texture_rectangle_enable = false;
+ }
- /* More than the 1.10 minimum to appease parser tests taken from
- * apps that (hopefully) already checked the number of coords.
- */
- this->Const.MaxTextureCoords = 4;
+ this->extensions = &ctx->Extensions;
- this->Const.MaxVertexAttribs = 16;
- this->Const.MaxVertexUniformComponents = 512;
- this->Const.MaxVaryingFloats = 32;
- this->Const.MaxVertexTextureImageUnits = 0;
- this->Const.MaxCombinedTextureImageUnits = 2;
- this->Const.MaxTextureImageUnits = 2;
- this->Const.MaxFragmentUniformComponents = 64;
+ this->Const.MaxLights = ctx->Const.MaxLights;
+ this->Const.MaxClipPlanes = ctx->Const.MaxClipPlanes;
+ this->Const.MaxTextureUnits = ctx->Const.MaxTextureUnits;
+ this->Const.MaxTextureCoords = ctx->Const.MaxTextureCoordUnits;
+ this->Const.MaxVertexAttribs = ctx->Const.VertexProgram.MaxAttribs;
+ this->Const.MaxVertexUniformComponents = ctx->Const.VertexProgram.MaxUniformComponents;
+ this->Const.MaxVaryingFloats = ctx->Const.MaxVarying * 4;
+ this->Const.MaxVertexTextureImageUnits = ctx->Const.MaxVertexTextureImageUnits;
+ this->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxCombinedTextureImageUnits;
+ this->Const.MaxTextureImageUnits = ctx->Const.MaxTextureImageUnits;
+ this->Const.MaxFragmentUniformComponents = ctx->Const.FragmentProgram.MaxUniformComponents;
- this->Const.MaxDrawBuffers = 2;
- }
+ this->Const.MaxDrawBuffers = ctx->Const.MaxDrawBuffers;
}
const char *
@@ -708,7 +685,7 @@ ast_struct_specifier::ast_struct_specifier(char *identifier,
}
bool
-do_common_optimization(exec_list *ir, bool linked)
+do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations)
{
GLboolean progress = GL_FALSE;
@@ -734,11 +711,18 @@ do_common_optimization(exec_list *ir, bool linked)
progress = do_constant_variable_unlinked(ir) || progress;
progress = do_constant_folding(ir) || progress;
progress = do_algebraic(ir) || progress;
- progress = do_if_return(ir) || progress;
+ progress = do_lower_jumps(ir) || progress;
progress = do_vec_index_to_swizzle(ir) || progress;
progress = do_swizzle_swizzle(ir) || progress;
progress = do_noop_swizzle(ir) || progress;
+ progress = optimize_redundant_jumps(ir) || progress;
+
+ loop_state *ls = analyze_loop_variables(ir);
+ progress = set_loop_controls(ir, ls) || progress;
+ progress = unroll_loops(ir, ls, max_unroll_iterations) || progress;
+ delete ls;
+
return progress;
}
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 3ccdab4ef2..ddc2138b76 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -68,6 +68,7 @@ struct _mesa_glsl_parse_state {
exec_list translation_unit;
glsl_symbol_table *symbols;
+ bool es_shader;
unsigned language_version;
enum _mesa_glsl_parser_targets target;
@@ -222,7 +223,7 @@ extern "C" {
#endif
extern int preprocess(void *ctx, const char **shader, char **info_log,
- const struct gl_extensions *extensions);
+ const struct gl_extensions *extensions, int api);
extern void _mesa_destroy_shader_compiler();
extern void _mesa_destroy_shader_compiler_caches();
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 92ad3efafc..82eb470605 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -111,9 +111,8 @@ add_types_to_symbol_table(glsl_symbol_table *symtab,
}
}
-
void
-glsl_type::generate_110_types(glsl_symbol_table *symtab)
+glsl_type::generate_100ES_types(glsl_symbol_table *symtab)
{
add_types_to_symbol_table(symtab, builtin_core_types,
Elements(builtin_core_types),
@@ -121,10 +120,20 @@ glsl_type::generate_110_types(glsl_symbol_table *symtab)
add_types_to_symbol_table(symtab, builtin_structure_types,
Elements(builtin_structure_types),
false);
+ add_types_to_symbol_table(symtab, &void_type, 1, false);
+}
+
+void
+glsl_type::generate_110_types(glsl_symbol_table *symtab)
+{
+ generate_100ES_types(symtab);
+
+ add_types_to_symbol_table(symtab, builtin_110_types,
+ Elements(builtin_110_types),
+ false);
add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
Elements(builtin_110_deprecated_structure_types),
false);
- add_types_to_symbol_table(symtab, & void_type, 1, false);
}
@@ -173,6 +182,10 @@ void
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
{
switch (state->language_version) {
+ case 100:
+ assert(state->es_shader);
+ glsl_type::generate_100ES_types(state->symbols);
+ break;
case 110:
glsl_type::generate_110_types(state->symbols);
break;
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index b4e83c9833..4f7d2f74af 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -430,6 +430,7 @@ private:
static const glsl_type builtin_core_types[];
static const glsl_type builtin_structure_types[];
static const glsl_type builtin_110_deprecated_structure_types[];
+ static const glsl_type builtin_110_types[];
static const glsl_type builtin_120_types[];
static const glsl_type builtin_130_types[];
static const glsl_type builtin_ARB_texture_rectangle_types[];
@@ -446,13 +447,12 @@ private:
* the world in a public header file.
*/
/*@{*/
+ static void generate_100ES_types(glsl_symbol_table *);
static void generate_110_types(glsl_symbol_table *);
static void generate_120_types(glsl_symbol_table *);
static void generate_130_types(glsl_symbol_table *);
- static void generate_ARB_texture_rectangle_types(glsl_symbol_table *,
- bool);
- static void generate_EXT_texture_array_types(glsl_symbol_table *,
- bool);
+ static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
+ static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
/*@}*/
/**
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 68ad512bf5..86dc490154 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -196,6 +196,8 @@ ir_expression::get_num_operands(ir_expression_operation op)
1, /* ir_unop_dFdx */
1, /* ir_unop_dFdy */
+ 1, /* ir_unop_noise */
+
2, /* ir_binop_add */
2, /* ir_binop_sub */
2, /* ir_binop_mul */
@@ -208,6 +210,8 @@ ir_expression::get_num_operands(ir_expression_operation op)
2, /* ir_binop_gequal */
2, /* ir_binop_equal */
2, /* ir_binop_nequal */
+ 2, /* ir_binop_all_equal */
+ 2, /* ir_binop_any_nequal */
2, /* ir_binop_lshift */
2, /* ir_binop_rshift */
@@ -261,6 +265,7 @@ static const char *const operator_strs[] = {
"cos",
"dFdx",
"dFdy",
+ "noise",
"+",
"-",
"*",
@@ -272,6 +277,8 @@ static const char *const operator_strs[] = {
">=",
"==",
"!=",
+ "all_equal",
+ "any_nequal",
"<<",
">>",
"&",
@@ -287,11 +294,16 @@ static const char *const operator_strs[] = {
"pow",
};
+const char *ir_expression::operator_string(ir_expression_operation op)
+{
+ assert((unsigned int) op < Elements(operator_strs));
+ assert(Elements(operator_strs) == (ir_binop_pow + 1));
+ return operator_strs[op];
+}
+
const char *ir_expression::operator_string()
{
- assert((unsigned int) operation <=
- sizeof(operator_strs) / sizeof(operator_strs[0]));
- return operator_strs[operation];
+ return operator_string(this->operation);
}
ir_expression_operation
@@ -701,6 +713,18 @@ ir_constant::has_value(const ir_constant *c) const
return true;
}
+
+ir_loop::ir_loop()
+{
+ this->ir_type = ir_type_loop;
+ this->cmp = ir_unop_neg;
+ this->from = NULL;
+ this->to = NULL;
+ this->increment = NULL;
+ this->counter = NULL;
+}
+
+
ir_dereference_variable::ir_dereference_variable(ir_variable *var)
{
this->ir_type = ir_type_dereference_variable;
@@ -1057,6 +1081,7 @@ ir_function_signature::ir_function_signature(const glsl_type *return_type)
: return_type(return_type), is_defined(false), _function(NULL)
{
this->ir_type = ir_type_function_signature;
+ this->is_builtin = false;
}
@@ -1108,7 +1133,18 @@ ir_function::ir_function(const char *name)
{
this->ir_type = ir_type_function;
this->name = talloc_strdup(this, name);
- this->is_builtin = false;
+}
+
+
+bool
+ir_function::has_builtin_signature()
+{
+ foreach_list(n, &this->signatures) {
+ ir_function_signature *const sig = (ir_function_signature *) n;
+ if (sig->is_builtin)
+ return true;
+ }
+ return false;
}
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 0f887a9327..70c6faaf15 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -342,6 +342,9 @@ public:
/** Whether or not this function has a body (which may be empty). */
unsigned is_defined:1;
+ /** Whether or not this function signature is a built-in. */
+ unsigned is_builtin:1;
+
/** Body of instructions in the function. */
struct exec_list body;
@@ -407,8 +410,8 @@ public:
*/
const char *name;
- /** Whether or not this function is a built-in. */
- unsigned is_builtin:1;
+ /** Whether or not this function has a signature that is a built-in. */
+ bool has_builtin_signature();
/**
* List of ir_function_signature for each overloaded function with this name.
@@ -461,10 +464,7 @@ public:
*/
class ir_loop : public ir_instruction {
public:
- ir_loop() : from(NULL), to(NULL), increment(NULL), counter(NULL)
- {
- ir_type = ir_type_loop;
- }
+ ir_loop();
virtual ir_loop *clone(void *mem_ctx, struct hash_table *ht) const;
@@ -493,12 +493,30 @@ public:
/**
* \name Loop counter and controls
+ *
+ * Represents a loop like a FORTRAN \c do-loop.
+ *
+ * \note
+ * If \c from and \c to are the same value, the loop will execute once.
*/
/*@{*/
- ir_rvalue *from;
- ir_rvalue *to;
+ ir_rvalue *from; /** Value of the loop counter on the first
+ * iteration of the loop.
+ */
+ ir_rvalue *to; /** Value of the loop counter on the last
+ * iteration of the loop.
+ */
ir_rvalue *increment;
ir_variable *counter;
+
+ /**
+ * Comparison operation in the loop terminator.
+ *
+ * If any of the loop control fields are non-\c NULL, this field must be
+ * one of \c ir_binop_less, \c ir_binop_greater, \c ir_binop_lequal,
+ * \c ir_binop_gequal, \c ir_binop_equal, or \c ir_binop_nequal.
+ */
+ int cmp;
/*@}*/
};
@@ -632,6 +650,8 @@ enum ir_expression_operation {
ir_unop_dFdy,
/*@}*/
+ ir_unop_noise,
+
ir_binop_add,
ir_binop_sub,
ir_binop_mul,
@@ -655,16 +675,18 @@ enum ir_expression_operation {
ir_binop_greater,
ir_binop_lequal,
ir_binop_gequal,
+ ir_binop_equal,
+ ir_binop_nequal,
/**
* Returns single boolean for whether all components of operands[0]
* equal the components of operands[1].
*/
- ir_binop_equal,
+ ir_binop_all_equal,
/**
* Returns single boolean for whether any component of operands[0]
* is not equal to the corresponding component of operands[1].
*/
- ir_binop_nequal,
+ ir_binop_any_nequal,
/*@}*/
/**
@@ -716,6 +738,12 @@ public:
const char *operator_string();
/**
+ * Return a string representing this expression's operator.
+ */
+ static const char *operator_string(ir_expression_operation);
+
+
+ /**
* Do a reverse-lookup to translate the given string into an operator.
*/
static ir_expression_operation get_operator(const char *);
diff --git a/src/glsl/ir_algebraic.cpp b/src/glsl/ir_algebraic.cpp
index ff81563f19..2ed66db476 100644
--- a/src/glsl/ir_algebraic.cpp
+++ b/src/glsl/ir_algebraic.cpp
@@ -270,6 +270,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
case ir_binop_gequal: new_op = ir_binop_less; break;
case ir_binop_equal: new_op = ir_binop_nequal; break;
case ir_binop_nequal: new_op = ir_binop_equal; break;
+ case ir_binop_all_equal: new_op = ir_binop_any_nequal; break;
+ case ir_binop_any_nequal: new_op = ir_binop_all_equal; break;
default:
/* The default case handler is here to silence a warning from GCC.
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 1d690a4da7..aa84cf0572 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -134,6 +134,7 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht));
}
+ new_loop->cmp = this->cmp;
return new_loop;
}
@@ -249,8 +250,6 @@ ir_function::clone(void *mem_ctx, struct hash_table *ht) const
{
ir_function *copy = new(mem_ctx) ir_function(this->name);
- copy->is_builtin = this->is_builtin;
-
foreach_list_const(node, &this->signatures) {
const ir_function_signature *const sig =
(const ir_function_signature *const) node;
@@ -273,6 +272,7 @@ ir_function_signature::clone(void *mem_ctx, struct hash_table *ht) const
new(mem_ctx) ir_function_signature(this->return_type);
copy->is_defined = this->is_defined;
+ copy->is_builtin = this->is_builtin;
/* Clone the parameter list.
*/
diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
index 458dca7977..ec0e26de18 100644
--- a/src/glsl/ir_constant_expression.cpp
+++ b/src/glsl/ir_constant_expression.cpp
@@ -89,9 +89,9 @@ ir_expression::constant_expression_value()
if (op[0]->type->is_array()) {
assert(op[1] != NULL && op[1]->type->is_array());
switch (this->operation) {
- case ir_binop_equal:
+ case ir_binop_all_equal:
return new(ctx) ir_constant(op[0]->has_value(op[1]));
- case ir_binop_nequal:
+ case ir_binop_any_nequal:
return new(ctx) ir_constant(!op[0]->has_value(op[1]));
default:
break;
@@ -622,11 +622,41 @@ ir_expression::constant_expression_value()
assert(0);
}
break;
-
case ir_binop_equal:
- data.b[0] = op[0]->has_value(op[1]);
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.b[0] = op[0]->value.u[0] == op[1]->value.u[0];
+ break;
+ case GLSL_TYPE_INT:
+ data.b[0] = op[0]->value.i[0] == op[1]->value.i[0];
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.b[0] = op[0]->value.f[0] == op[1]->value.f[0];
+ break;
+ default:
+ assert(0);
+ }
break;
case ir_binop_nequal:
+ switch (op[0]->type->base_type) {
+ case GLSL_TYPE_UINT:
+ data.b[0] = op[0]->value.u[0] != op[1]->value.u[0];
+ break;
+ case GLSL_TYPE_INT:
+ data.b[0] = op[0]->value.i[0] != op[1]->value.i[0];
+ break;
+ case GLSL_TYPE_FLOAT:
+ data.b[0] = op[0]->value.f[0] != op[1]->value.f[0];
+ break;
+ default:
+ assert(0);
+ }
+ break;
+
+ case ir_binop_all_equal:
+ data.b[0] = op[0]->has_value(op[1]);
+ break;
+ case ir_binop_any_nequal:
data.b[0] = !op[0]->has_value(op[1]);
break;
@@ -785,7 +815,7 @@ ir_call::constant_expression_value()
* "Function calls to user-defined functions (non-built-in functions)
* cannot be used to form constant expressions."
*/
- if (!this->callee->function()->is_builtin)
+ if (!this->callee->is_builtin)
return NULL;
unsigned num_parameters = 0;
diff --git a/src/glsl/ir_constant_propagation.cpp b/src/glsl/ir_constant_propagation.cpp
index 76c1ce7013..f7a0599f42 100644
--- a/src/glsl/ir_constant_propagation.cpp
+++ b/src/glsl/ir_constant_propagation.cpp
@@ -90,7 +90,7 @@ public:
virtual ir_visitor_status visit_enter(class ir_loop *);
virtual ir_visitor_status visit_enter(class ir_function_signature *);
virtual ir_visitor_status visit_enter(class ir_function *);
- virtual ir_visitor_status visit_enter(class ir_assignment *);
+ virtual ir_visitor_status visit_leave(class ir_assignment *);
virtual ir_visitor_status visit_enter(class ir_call *);
virtual ir_visitor_status visit_enter(class ir_if *);
@@ -119,7 +119,7 @@ public:
void
ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue)
{
- if (!*rvalue)
+ if (this->in_assignee || !*rvalue)
return;
const glsl_type *type = (*rvalue)->type;
@@ -216,22 +216,16 @@ ir_constant_propagation_visitor::visit_enter(ir_function_signature *ir)
}
ir_visitor_status
-ir_constant_propagation_visitor::visit_enter(ir_assignment *ir)
+ir_constant_propagation_visitor::visit_leave(ir_assignment *ir)
{
- /* Inline accepting children, skipping the LHS. */
- ir->rhs->accept(this);
- handle_rvalue(&ir->rhs);
-
- if (ir->condition) {
- ir->condition->accept(this);
- handle_rvalue(&ir->condition);
- }
+ if (this->in_assignee)
+ return visit_continue;
kill(ir->lhs->variable_referenced(), ir->write_mask);
add_constant(ir);
- return visit_continue_with_parent;
+ return visit_continue;
}
ir_visitor_status
diff --git a/src/glsl/ir_copy_propagation.cpp b/src/glsl/ir_copy_propagation.cpp
index 6c211f0e70..0fe8fa6c41 100644
--- a/src/glsl/ir_copy_propagation.cpp
+++ b/src/glsl/ir_copy_propagation.cpp
@@ -84,7 +84,7 @@ public:
virtual ir_visitor_status visit_enter(class ir_loop *);
virtual ir_visitor_status visit_enter(class ir_function_signature *);
virtual ir_visitor_status visit_enter(class ir_function *);
- virtual ir_visitor_status visit_enter(class ir_assignment *);
+ virtual ir_visitor_status visit_leave(class ir_assignment *);
virtual ir_visitor_status visit_enter(class ir_call *);
virtual ir_visitor_status visit_enter(class ir_if *);
@@ -132,30 +132,13 @@ ir_copy_propagation_visitor::visit_enter(ir_function_signature *ir)
}
ir_visitor_status
-ir_copy_propagation_visitor::visit_enter(ir_assignment *ir)
+ir_copy_propagation_visitor::visit_leave(ir_assignment *ir)
{
- ir_visitor_status s;
-
- /* ir_assignment::accept(ir_hv *v), skipping the LHS so that we can
- * avoid copy propagating into the LHS.
- *
- * Note that this means we won't copy propagate into the derefs of
- * an array index. Oh well.
- */
-
- s = ir->rhs->accept(this);
- assert(s == visit_continue);
-
- if (ir->condition) {
- s = ir->condition->accept(this);
- assert(s == visit_continue);
- }
-
kill(ir->lhs->variable_referenced());
add_copy(ir);
- return visit_continue_with_parent;
+ return visit_continue;
}
ir_visitor_status
@@ -175,6 +158,9 @@ ir_copy_propagation_visitor::visit_enter(ir_function *ir)
ir_visitor_status
ir_copy_propagation_visitor::visit(ir_dereference_variable *ir)
{
+ if (this->in_assignee)
+ return visit_continue;
+
ir_variable *var = ir->var;
foreach_iter(exec_list_iterator, iter, *this->acp) {
diff --git a/src/glsl/ir_hierarchical_visitor.cpp b/src/glsl/ir_hierarchical_visitor.cpp
index 809b08ee62..b5eacd6d2d 100644
--- a/src/glsl/ir_hierarchical_visitor.cpp
+++ b/src/glsl/ir_hierarchical_visitor.cpp
@@ -29,6 +29,7 @@ ir_hierarchical_visitor::ir_hierarchical_visitor()
this->base_ir = NULL;
this->callback = NULL;
this->data = NULL;
+ this->in_assignee = false;
}
ir_visitor_status
diff --git a/src/glsl/ir_hierarchical_visitor.h b/src/glsl/ir_hierarchical_visitor.h
index afa780dc91..dc177f5eb0 100644
--- a/src/glsl/ir_hierarchical_visitor.h
+++ b/src/glsl/ir_hierarchical_visitor.h
@@ -165,6 +165,13 @@ public:
* Extra data parameter passed to the per-node callback function
*/
void *data;
+
+ /**
+ * Currently in the LHS of an assignment?
+ *
+ * This is set and cleared by the \c ir_assignment::accept method.
+ */
+ bool in_assignee;
};
void visit_tree(ir_instruction *ir,
diff --git a/src/glsl/ir_hv_accept.cpp b/src/glsl/ir_hv_accept.cpp
index 6dae4ed2f3..be8b36a7cf 100644
--- a/src/glsl/ir_hv_accept.cpp
+++ b/src/glsl/ir_hv_accept.cpp
@@ -242,7 +242,14 @@ ir_dereference_array::accept(ir_hierarchical_visitor *v)
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ /* The array index is not the target of the assignment, so clear the
+ * 'in_assignee' flag. Restore it after returning from the array index.
+ */
+ const bool was_in_assignee = v->in_assignee;
+ v->in_assignee = false;
s = this->array_index->accept(v);
+ v->in_assignee = was_in_assignee;
+
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
@@ -270,7 +277,9 @@ ir_assignment::accept(ir_hierarchical_visitor *v)
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
+ v->in_assignee = true;
s = this->lhs->accept(v);
+ v->in_assignee = false;
if (s != visit_continue)
return (s == visit_continue_with_parent) ? visit_continue : s;
diff --git a/src/glsl/ir_if_return.cpp b/src/glsl/ir_if_return.cpp
deleted file mode 100644
index 5ab8759958..0000000000
--- a/src/glsl/ir_if_return.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright © 2010 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/**
- * \file ir_if_return.cpp
- *
- * This pass tries to normalize functions to always return from one
- * place by moving around blocks of code in if statements.
- *
- * This helps on hardware with no branching support, and may even be a
- * useful transform on hardware supporting control flow by turning
- * masked returns into normal returns.
- */
-
-#include <string.h>
-#include "glsl_types.h"
-#include "ir.h"
-
-class ir_if_return_visitor : public ir_hierarchical_visitor {
-public:
- ir_if_return_visitor()
- {
- this->progress = false;
- }
-
- ir_visitor_status visit_enter(ir_function_signature *);
- ir_visitor_status visit_leave(ir_if *);
-
- ir_visitor_status move_outer_block_inside(ir_instruction *ir,
- exec_list *inner_block);
- void move_returns_after_block(ir_instruction *ir,
- ir_return *then_return,
- ir_return *else_return);
- bool progress;
-};
-
-bool
-do_if_return(exec_list *instructions)
-{
- ir_if_return_visitor v;
-
- do {
- v.progress = false;
- visit_list_elements(&v, instructions);
- } while (v.progress);
-
- return v.progress;
-}
-
-/**
- * Removes any instructions after a (unconditional) return, since they will
- * never be executed.
- */
-static void
-truncate_after_instruction(ir_instruction *ir)
-{
- if (!ir)
- return;
-
- while (!ir->get_next()->is_tail_sentinel())
- ((ir_instruction *)ir->get_next())->remove();
-}
-
-/**
- * Returns an ir_instruction of the first ir_return in the exec_list, or NULL.
- */
-static ir_return *
-find_return_in_block(exec_list *instructions)
-{
- foreach_iter(exec_list_iterator, iter, *instructions) {
- ir_instruction *ir = (ir_instruction *)iter.get();
- if (ir->ir_type == ir_type_return)
- return (ir_return *)ir;
- }
-
- return NULL;
-}
-
-void
-ir_if_return_visitor::move_returns_after_block(ir_instruction *ir,
- ir_return *then_return,
- ir_return *else_return)
-{
-
- if (!then_return->value) {
- then_return->remove();
- else_return->remove();
- ir->insert_after(new(ir) ir_return(NULL));
- } else {
- ir_assignment *assign;
- ir_variable *new_var = new(ir) ir_variable(then_return->value->type,
- "if_return_tmp",
- ir_var_temporary);
- ir->insert_before(new_var);
-
- assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var),
- then_return->value, NULL);
- then_return->replace_with(assign);
-
- assign = new(ir) ir_assignment(new(ir) ir_dereference_variable(new_var),
- else_return->value, NULL);
- else_return->replace_with(assign);
-
- ir_dereference_variable *deref = new(ir) ir_dereference_variable(new_var);
- ir->insert_after(new(ir) ir_return(deref));
- }
- this->progress = true;
-}
-
-ir_visitor_status
-ir_if_return_visitor::move_outer_block_inside(ir_instruction *ir,
- exec_list *inner_block)
-{
- if (!ir->get_next()->is_tail_sentinel()) {
- while (!ir->get_next()->is_tail_sentinel()) {
- ir_instruction *move_ir = (ir_instruction *)ir->get_next();
-
- move_ir->remove();
- inner_block->push_tail(move_ir);
- }
-
- /* If we move the instructions following ir inside the block, it
- * will confuse the exec_list iteration in the parent that visited
- * us. So stop the visit at this point.
- */
- return visit_stop;
- } else {
- return visit_continue;
- }
-}
-
-/* Normalize a function to always have a return statement at the end.
- *
- * This avoids the ir_if handler needing to know whether it is at the
- * top level of the function to know if there's an implicit return at
- * the end of the outer block.
- */
-ir_visitor_status
-ir_if_return_visitor::visit_enter(ir_function_signature *ir)
-{
- ir_return *ret;
-
- if (!ir->is_defined)
- return visit_continue_with_parent;
- if (strcmp(ir->function_name(), "main") == 0)
- return visit_continue_with_parent;
-
- ret = find_return_in_block(&ir->body);
-
- if (ret) {
- truncate_after_instruction(ret);
- } else {
- if (ir->return_type->is_void()) {
- ir->body.push_tail(new(ir) ir_return(NULL));
- } else {
- /* Probably, if we've got a function with a return value
- * hitting this point, it's something like:
- *
- * float reduce_below_half(float val)
- * {
- * while () {
- * if (val >= 0.5)
- * val /= 2.0;
- * else
- * return val;
- * }
- * }
- *
- * So we gain a junk return statement of an undefined value
- * at the end that never gets executed. However, a backend
- * using this pass is probably desperate to get rid of
- * function calls, so go ahead and do it for their sake in
- * case it fixes apps.
- */
- ir_variable *undef = new(ir) ir_variable(ir->return_type,
- "if_return_undef",
- ir_var_temporary);
- ir->body.push_tail(undef);
-
- ir_dereference_variable *deref = new(ir) ir_dereference_variable(undef);
- ir->body.push_tail(new(ir) ir_return(deref));
- }
- }
-
- return visit_continue;
-}
-
-ir_visitor_status
-ir_if_return_visitor::visit_leave(ir_if *ir)
-{
- ir_return *then_return;
- ir_return *else_return;
-
- then_return = find_return_in_block(&ir->then_instructions);
- else_return = find_return_in_block(&ir->else_instructions);
- if (!then_return && !else_return)
- return visit_continue;
-
- /* Trim off any trailing instructions after the return statements
- * on both sides.
- */
- truncate_after_instruction(then_return);
- truncate_after_instruction(else_return);
-
- /* If both sides return, then we can move the returns to a single
- * one outside the if statement.
- */
- if (then_return && else_return) {
- move_returns_after_block(ir, then_return, else_return);
- return visit_continue;
- }
-
- /* If only one side returns, then the block of code after the "if"
- * is only executed by the other side, so those instructions don't
- * need to be anywhere but that other side.
- *
- * This will usually pull a return statement up into the other
- * side, so we'll trigger the above case on the next pass.
- */
- if (then_return) {
- return move_outer_block_inside(ir, &ir->else_instructions);
- } else {
- assert(else_return);
- return move_outer_block_inside(ir, &ir->then_instructions);
- }
-}
diff --git a/src/glsl/ir_if_simplification.cpp b/src/glsl/ir_if_simplification.cpp
index 6882ef72b9..021615ebd1 100644
--- a/src/glsl/ir_if_simplification.cpp
+++ b/src/glsl/ir_if_simplification.cpp
@@ -22,7 +22,7 @@
*/
/**
- * \file ir_function_inlining.cpp
+ * \file ir_if_simplification.cpp
*
* Moves constant branches of if statements out to the surrounding
* instruction stream.
diff --git a/src/glsl/ir_import_prototypes.cpp b/src/glsl/ir_import_prototypes.cpp
index a39b384071..066137e60a 100644
--- a/src/glsl/ir_import_prototypes.cpp
+++ b/src/glsl/ir_import_prototypes.cpp
@@ -59,7 +59,6 @@ public:
this->function = this->symbols->get_function(ir->name);
if (!this->function) {
this->function = new(this->mem_ctx) ir_function(ir->name);
- this->function->is_builtin = ir->is_builtin;
list->push_tail(this->function);
@@ -87,6 +86,7 @@ public:
new(mem_ctx) ir_function_signature(ir->return_type);
copy->is_defined = false;
+ copy->is_builtin = ir->is_builtin;
/* Clone the parameter list, but NOT the body.
*/
diff --git a/src/glsl/ir_lower_jumps.cpp b/src/glsl/ir_lower_jumps.cpp
new file mode 100644
index 0000000000..b69cc1ec31
--- /dev/null
+++ b/src/glsl/ir_lower_jumps.cpp
@@ -0,0 +1,544 @@
+/*
+ * Copyright © 2010 Luca Barbieri
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file ir_lower_jumps.cpp
+ */
+
+#include "glsl_types.h"
+#include <string.h>
+#include "ir.h"
+
+enum jump_strength
+{
+ strength_none,
+ strength_always_clears_execute_flag,
+ strength_continue,
+ strength_break,
+ strength_return,
+ strength_discard
+};
+
+struct block_record
+{
+ /* minimum jump strength (of lowered IR, not pre-lowering IR)
+ *
+ * If the block ends with a jump, must be the strength of the jump.
+ * Otherwise, the jump would be dead and have been deleted before)
+ *
+ * If the block doesn't end with a jump, it can be different than strength_none if all paths before it lead to some jump
+ * (e.g. an if with a return in one branch, and a break in the other, while not lowering them)
+ * Note that identical jumps are usually unified though.
+ */
+ jump_strength min_strength;
+
+ /* can anything clear the execute flag? */
+ bool may_clear_execute_flag;
+
+ block_record()
+ {
+ this->min_strength = strength_none;
+ this->may_clear_execute_flag = false;
+ }
+};
+
+struct loop_record
+{
+ ir_function_signature* signature;
+ ir_loop* loop;
+
+ /* used to avoid lowering the break used to represent lowered breaks */
+ unsigned nesting_depth;
+ bool in_if_at_the_end_of_the_loop;
+
+ bool may_set_return_flag;
+
+ ir_variable* break_flag;
+ ir_variable* execute_flag; /* cleared to emulate continue */
+
+ loop_record(ir_function_signature* p_signature = 0, ir_loop* p_loop = 0)
+ {
+ this->signature = p_signature;
+ this->loop = p_loop;
+ this->nesting_depth = 0;
+ this->in_if_at_the_end_of_the_loop = false;
+ this->may_set_return_flag = false;
+ this->break_flag = 0;
+ this->execute_flag = 0;
+ }
+
+ ir_variable* get_execute_flag()
+ {
+ /* also supported for the "function loop" */
+ if(!this->execute_flag) {
+ exec_list& list = this->loop ? this->loop->body_instructions : signature->body;
+ this->execute_flag = new(this->signature) ir_variable(glsl_type::bool_type, "execute_flag", ir_var_temporary);
+ list.push_head(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(execute_flag), new(this->signature) ir_constant(true), 0));
+ list.push_head(this->execute_flag);
+ }
+ return this->execute_flag;
+ }
+
+ ir_variable* get_break_flag()
+ {
+ assert(this->loop);
+ if(!this->break_flag) {
+ this->break_flag = new(this->signature) ir_variable(glsl_type::bool_type, "break_flag", ir_var_temporary);
+ this->loop->insert_before(this->break_flag);
+ this->loop->insert_before(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(break_flag), new(this->signature) ir_constant(false), 0));
+ }
+ return this->break_flag;
+ }
+};
+
+struct function_record
+{
+ ir_function_signature* signature;
+ ir_variable* return_flag; /* used to break out of all loops and then jump to the return instruction */
+ ir_variable* return_value;
+ bool is_main;
+ unsigned nesting_depth;
+
+ function_record(ir_function_signature* p_signature = 0)
+ {
+ this->signature = p_signature;
+ this->return_flag = 0;
+ this->return_value = 0;
+ this->nesting_depth = 0;
+ this->is_main = this->signature && (strcmp(this->signature->function_name(), "main") == 0);
+ }
+
+ ir_variable* get_return_flag()
+ {
+ if(!this->return_flag) {
+ this->return_flag = new(this->signature) ir_variable(glsl_type::bool_type, "return_flag", ir_var_temporary);
+ this->signature->body.push_head(new(this->signature) ir_assignment(new(this->signature) ir_dereference_variable(return_flag), new(this->signature) ir_constant(false), 0));
+ this->signature->body.push_head(this->return_flag);
+ }
+ return this->return_flag;
+ }
+
+ ir_variable* get_return_value()
+ {
+ if(!this->return_value) {
+ assert(!this->signature->return_type->is_void());
+ return_value = new(this->signature) ir_variable(this->signature->return_type, "return_value", ir_var_temporary);
+ this->signature->body.push_head(this->return_value);
+ }
+ return this->return_value;
+ }
+};
+
+struct ir_lower_jumps_visitor : public ir_control_flow_visitor {
+ bool progress;
+
+ struct function_record function;
+ struct loop_record loop;
+ struct block_record block;
+
+ bool pull_out_jumps;
+ bool lower_continue;
+ bool lower_break;
+ bool lower_sub_return;
+ bool lower_main_return;
+
+ ir_lower_jumps_visitor()
+ {
+ this->progress = false;
+ }
+
+ void truncate_after_instruction(exec_node *ir)
+ {
+ if (!ir)
+ return;
+
+ while (!ir->get_next()->is_tail_sentinel()) {
+ ((ir_instruction *)ir->get_next())->remove();
+ this->progress = true;
+ }
+ }
+
+ void move_outer_block_inside(ir_instruction *ir, exec_list *inner_block)
+ {
+ while (!ir->get_next()->is_tail_sentinel()) {
+ ir_instruction *move_ir = (ir_instruction *)ir->get_next();
+
+ move_ir->remove();
+ inner_block->push_tail(move_ir);
+ }
+ }
+
+ virtual void visit(class ir_loop_jump * ir)
+ {
+ truncate_after_instruction(ir);
+ this->block.min_strength = ir->is_break() ? strength_break : strength_continue;
+ }
+
+ virtual void visit(class ir_return * ir)
+ {
+ truncate_after_instruction(ir);
+ this->block.min_strength = strength_return;
+ }
+
+ virtual void visit(class ir_discard * ir)
+ {
+ truncate_after_instruction(ir);
+ this->block.min_strength = strength_discard;
+ }
+
+ enum jump_strength get_jump_strength(ir_instruction* ir)
+ {
+ if(!ir)
+ return strength_none;
+ else if(ir->ir_type == ir_type_loop_jump) {
+ if(((ir_loop_jump*)ir)->is_break())
+ return strength_break;
+ else
+ return strength_continue;
+ } else if(ir->ir_type == ir_type_return)
+ return strength_return;
+ else if(ir->ir_type == ir_type_discard)
+ return strength_discard;
+ else
+ return strength_none;
+ }
+
+ bool should_lower_jump(ir_jump* ir)
+ {
+ unsigned strength = get_jump_strength(ir);
+ bool lower;
+ switch(strength)
+ {
+ case strength_none:
+ lower = false; /* don't change this, code relies on it */
+ break;
+ case strength_continue:
+ lower = lower_continue;
+ break;
+ case strength_break:
+ assert(this->loop.loop);
+ /* never lower "canonical break" */
+ if(ir->get_next()->is_tail_sentinel() && (this->loop.nesting_depth == 0
+ || (this->loop.nesting_depth == 1 && this->loop.in_if_at_the_end_of_the_loop)))
+ lower = false;
+ else
+ lower = lower_break;
+ break;
+ case strength_return:
+ /* never lower return at the end of a this->function */
+ if(this->function.nesting_depth == 0 && ir->get_next()->is_tail_sentinel())
+ lower = false;
+ else if (this->function.is_main)
+ lower = lower_main_return;
+ else
+ lower = lower_sub_return;
+ break;
+ case strength_discard:
+ lower = false; /* probably nothing needs this lowered */
+ break;
+ }
+ return lower;
+ }
+
+ block_record visit_block(exec_list* list)
+ {
+ block_record saved_block = this->block;
+ this->block = block_record();
+ visit_exec_list(list, this);
+ block_record ret = this->block;
+ this->block = saved_block;
+ return ret;
+ }
+
+ virtual void visit(ir_if *ir)
+ {
+ if(this->loop.nesting_depth == 0 && ir->get_next()->is_tail_sentinel())
+ this->loop.in_if_at_the_end_of_the_loop = true;
+
+ ++this->function.nesting_depth;
+ ++this->loop.nesting_depth;
+
+ block_record block_records[2];
+ ir_jump* jumps[2];
+
+ block_records[0] = visit_block(&ir->then_instructions);
+ block_records[1] = visit_block(&ir->else_instructions);
+
+retry: /* we get here if we put code after the if inside a branch */
+ for(unsigned i = 0; i < 2; ++i) {
+ exec_list& list = i ? ir->else_instructions : ir->then_instructions;
+ jumps[i] = 0;
+ if(!list.is_empty() && get_jump_strength((ir_instruction*)list.get_tail()))
+ jumps[i] = (ir_jump*)list.get_tail();
+ }
+
+ for(;;) {
+ jump_strength jump_strengths[2];
+
+ for(unsigned i = 0; i < 2; ++i) {
+ if(jumps[i]) {
+ jump_strengths[i] = block_records[i].min_strength;
+ assert(jump_strengths[i] == get_jump_strength(jumps[i]));
+ } else
+ jump_strengths[i] = strength_none;
+ }
+
+ /* move both jumps out if possible */
+ if(pull_out_jumps && jump_strengths[0] == jump_strengths[1]) {
+ bool unify = true;
+ if(jump_strengths[0] == strength_continue)
+ ir->insert_after(new(ir) ir_loop_jump(ir_loop_jump::jump_continue));
+ else if(jump_strengths[0] == strength_break)
+ ir->insert_after(new(ir) ir_loop_jump(ir_loop_jump::jump_break));
+ /* FINISHME: unify returns with identical expressions */
+ else if(jump_strengths[0] == strength_return && this->function.signature->return_type->is_void())
+ ir->insert_after(new(ir) ir_return(NULL));
+ /* FINISHME: unify discards */
+ else
+ unify = false;
+
+ if(unify) {
+ jumps[0]->remove();
+ jumps[1]->remove();
+ this->progress = true;
+
+ jumps[0] = 0;
+ jumps[1] = 0;
+ block_records[0].min_strength = strength_none;
+ block_records[1].min_strength = strength_none;
+ break;
+ }
+ }
+
+ /* lower a jump: if both need to lowered, start with the strongest one, so that
+ * we might later unify the lowered version with the other one
+ */
+ bool should_lower[2];
+ for(unsigned i = 0; i < 2; ++i)
+ should_lower[i] = should_lower_jump(jumps[i]);
+
+ int lower;
+ if(should_lower[1] && should_lower[0])
+ lower = jump_strengths[1] > jump_strengths[0];
+ else if(should_lower[0])
+ lower = 0;
+ else if(should_lower[1])
+ lower = 1;
+ else
+ break;
+
+ if(jump_strengths[lower] == strength_return) {
+ ir_variable* return_flag = this->function.get_return_flag();
+ if(!this->function.signature->return_type->is_void()) {
+ ir_variable* return_value = this->function.get_return_value();
+ jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(return_value), ((ir_return*)jumps[lower])->value, NULL));
+ }
+ jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(return_flag), new (ir) ir_constant(true), NULL));
+ this->loop.may_set_return_flag = true;
+ if(this->loop.loop) {
+ ir_loop_jump* lowered = 0;
+ lowered = new(ir) ir_loop_jump(ir_loop_jump::jump_break);
+ block_records[lower].min_strength = strength_break;
+ jumps[lower]->replace_with(lowered);
+ jumps[lower] = lowered;
+ } else
+ goto lower_continue;
+ this->progress = true;
+ } else if(jump_strengths[lower] == strength_break) {
+ /* We can't lower to an actual continue because that would execute the increment.
+ *
+ * In the lowered code, we instead put the break check between the this->loop body and the increment,
+ * which is impossible with a real continue as defined by the GLSL IR currently.
+ *
+ * Smarter options (such as undoing the increment) are possible but it's not worth implementing them,
+ * because if break is lowered, continue is almost surely lowered too.
+ */
+ jumps[lower]->insert_before(new(ir) ir_assignment(new (ir) ir_dereference_variable(this->loop.get_break_flag()), new (ir) ir_constant(true), 0));
+ goto lower_continue;
+ } else if(jump_strengths[lower] == strength_continue) {
+lower_continue:
+ ir_variable* execute_flag = this->loop.get_execute_flag();
+ jumps[lower]->replace_with(new(ir) ir_assignment(new (ir) ir_dereference_variable(execute_flag), new (ir) ir_constant(false), 0));
+ jumps[lower] = 0;
+ block_records[lower].min_strength = strength_always_clears_execute_flag;
+ block_records[lower].may_clear_execute_flag = true;
+ this->progress = true;
+ break;
+ }
+ }
+
+ /* move out a jump out if possible */
+ if(pull_out_jumps) {
+ int move_out = -1;
+ if(jumps[0] && block_records[1].min_strength >= strength_continue)
+ move_out = 0;
+ else if(jumps[1] && block_records[0].min_strength >= strength_continue)
+ move_out = 1;
+
+ if(move_out >= 0)
+ {
+ jumps[move_out]->remove();
+ ir->insert_after(jumps[move_out]);
+ jumps[move_out] = 0;
+ block_records[move_out].min_strength = strength_none;
+ this->progress = true;
+ }
+ }
+
+ if(block_records[0].min_strength < block_records[1].min_strength)
+ this->block.min_strength = block_records[0].min_strength;
+ else
+ this->block.min_strength = block_records[1].min_strength;
+ this->block.may_clear_execute_flag = this->block.may_clear_execute_flag || block_records[0].may_clear_execute_flag || block_records[1].may_clear_execute_flag;
+
+ if(this->block.min_strength)
+ truncate_after_instruction(ir);
+ else if(this->block.may_clear_execute_flag)
+ {
+ int move_into = -1;
+ if(block_records[0].min_strength && !block_records[1].may_clear_execute_flag)
+ move_into = 1;
+ else if(block_records[1].min_strength && !block_records[0].may_clear_execute_flag)
+ move_into = 0;
+
+ if(move_into >= 0) {
+ assert(!block_records[move_into].min_strength && !block_records[move_into].may_clear_execute_flag); /* otherwise, we just truncated */
+
+ exec_list* list = move_into ? &ir->else_instructions : &ir->then_instructions;
+ exec_node* next = ir->get_next();
+ if(!next->is_tail_sentinel()) {
+ move_outer_block_inside(ir, list);
+
+ exec_list list;
+ list.head = next;
+ block_records[move_into] = visit_block(&list);
+
+ this->progress = true;
+ goto retry;
+ }
+ } else {
+ ir_instruction* ir_after;
+ for(ir_after = (ir_instruction*)ir->get_next(); !ir_after->is_tail_sentinel();)
+ {
+ ir_if* ir_if = ir_after->as_if();
+ if(ir_if && ir_if->else_instructions.is_empty()) {
+ ir_dereference_variable* ir_if_cond_deref = ir_if->condition->as_dereference_variable();
+ if(ir_if_cond_deref && ir_if_cond_deref->var == this->loop.execute_flag) {
+ ir_instruction* ir_next = (ir_instruction*)ir_after->get_next();
+ ir_after->insert_before(&ir_if->then_instructions);
+ ir_after->remove();
+ ir_after = ir_next;
+ continue;
+ }
+ }
+ ir_after = (ir_instruction*)ir_after->get_next();
+
+ /* only set this if we find any unprotected instruction */
+ this->progress = true;
+ }
+
+ if(!ir->get_next()->is_tail_sentinel()) {
+ assert(this->loop.execute_flag);
+ ir_if* if_execute = new(ir) ir_if(new(ir) ir_dereference_variable(this->loop.execute_flag));
+ move_outer_block_inside(ir, &if_execute->then_instructions);
+ ir->insert_after(if_execute);
+ }
+ }
+ }
+ --this->loop.nesting_depth;
+ --this->function.nesting_depth;
+ }
+
+ virtual void visit(ir_loop *ir)
+ {
+ ++this->function.nesting_depth;
+ loop_record saved_loop = this->loop;
+ this->loop = loop_record(this->function.signature, ir);
+
+ block_record body = visit_block(&ir->body_instructions);
+
+ if(body.min_strength >= strength_break) {
+ /* FINISHME: turn the this->loop into an if, or replace it with its body */
+ }
+
+ if(this->loop.break_flag) {
+ ir_if* break_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->loop.break_flag));
+ break_if->then_instructions.push_tail(new(ir) ir_loop_jump(ir_loop_jump::jump_break));
+ ir->body_instructions.push_tail(break_if);
+ }
+
+ if(this->loop.may_set_return_flag) {
+ assert(this->function.return_flag);
+ ir_if* return_if = new(ir) ir_if(new(ir) ir_dereference_variable(this->function.return_flag));
+ return_if->then_instructions.push_tail(new(ir) ir_loop_jump(saved_loop.loop ? ir_loop_jump::jump_break : ir_loop_jump::jump_continue));
+ ir->insert_after(return_if);
+ }
+
+ this->loop = saved_loop;
+ --this->function.nesting_depth;
+ }
+
+ virtual void visit(ir_function_signature *ir)
+ {
+ /* these are not strictly necessary */
+ assert(!this->function.signature);
+ assert(!this->loop.loop);
+
+ function_record saved_function = this->function;
+ loop_record saved_loop = this->loop;
+ this->function = function_record(ir);
+ this->loop = loop_record(ir);
+
+ assert(!this->loop.loop);
+ visit_block(&ir->body);
+
+ if(this->function.return_value)
+ ir->body.push_tail(new(ir) ir_return(new (ir) ir_dereference_variable(this->function.return_value)));
+
+ this->loop = saved_loop;
+ this->function = saved_function;
+ }
+
+ virtual void visit(class ir_function * ir)
+ {
+ visit_block(&ir->signatures);
+ }
+};
+
+bool
+do_lower_jumps(exec_list *instructions, bool pull_out_jumps, bool lower_sub_return, bool lower_main_return, bool lower_continue, bool lower_break)
+{
+ ir_lower_jumps_visitor v;
+ v.pull_out_jumps = pull_out_jumps;
+ v.lower_continue = lower_continue;
+ v.lower_break = lower_break;
+ v.lower_sub_return = lower_sub_return;
+ v.lower_main_return = lower_main_return;
+
+ do {
+ v.progress = false;
+ visit_exec_list(instructions, &v);
+ } while (v.progress);
+
+ return v.progress;
+}
diff --git a/src/glsl/ir_mat_op_to_vec.cpp b/src/glsl/ir_mat_op_to_vec.cpp
index da6de9492b..c32ca88b0f 100644
--- a/src/glsl/ir_mat_op_to_vec.cpp
+++ b/src/glsl/ir_mat_op_to_vec.cpp
@@ -307,7 +307,7 @@ ir_mat_op_to_vec_visitor::do_equal_mat_mat(ir_variable *result_var,
ir_dereference *const op1 = get_column(b_var, i);
ir_expression *const cmp =
- new(this->mem_ctx) ir_expression(ir_binop_nequal,
+ new(this->mem_ctx) ir_expression(ir_binop_any_nequal,
glsl_type::bool_type, op0, op1);
ir_rvalue *const swiz =
@@ -473,10 +473,10 @@ ir_mat_op_to_vec_visitor::visit_leave(ir_assignment *orig_assign)
}
break;
- case ir_binop_equal:
- case ir_binop_nequal:
+ case ir_binop_all_equal:
+ case ir_binop_any_nequal:
do_equal_mat_mat(result_var, op_var[1], op_var[0],
- (orig_expr->operation == ir_binop_equal));
+ (orig_expr->operation == ir_binop_all_equal));
break;
default:
diff --git a/src/glsl/ir_mod_to_fract.cpp b/src/glsl/ir_mod_to_fract.cpp
index 71c9472b12..c82a1f64fd 100644
--- a/src/glsl/ir_mod_to_fract.cpp
+++ b/src/glsl/ir_mod_to_fract.cpp
@@ -22,7 +22,7 @@
*/
/**
- * \file ir_mod_to_floor.cpp
+ * \file ir_mod_to_fract.cpp
*
* Breaks an ir_unop_mod expression down to (op1 * fract(op0 / op1))
*
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 33f4bc78f7..b365ed2b23 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -28,7 +28,7 @@
* Prototypes for optimization passes to be called by the compiler and drivers.
*/
-bool do_common_optimization(exec_list *ir, bool linked);
+bool do_common_optimization(exec_list *ir, bool linked, unsigned max_unroll_iterations);
bool do_algebraic(exec_list *instructions);
bool do_constant_folding(exec_list *instructions);
@@ -43,7 +43,7 @@ bool do_dead_functions(exec_list *instructions);
bool do_div_to_mul_rcp(exec_list *instructions);
bool do_explog_to_explog2(exec_list *instructions);
bool do_function_inlining(exec_list *instructions);
-bool do_if_return(exec_list *instructions);
+bool do_lower_jumps(exec_list *instructions, bool pull_out_jumps = true, bool lower_sub_return = true, bool lower_main_return = false, bool lower_continue = false, bool lower_break = false);
bool do_if_simplification(exec_list *instructions);
bool do_if_to_cond_assign(exec_list *instructions);
bool do_mat_op_to_vec(exec_list *instructions);
@@ -55,3 +55,5 @@ bool do_swizzle_swizzle(exec_list *instructions);
bool do_tree_grafting(exec_list *instructions);
bool do_vec_index_to_cond_assign(exec_list *instructions);
bool do_vec_index_to_swizzle(exec_list *instructions);
+bool lower_noise(exec_list *instructions);
+bool optimize_redundant_jumps(exec_list *instructions);
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index f47ad87550..eff950ebd7 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -153,15 +153,14 @@ void ir_print_visitor::visit(ir_function_signature *ir)
void ir_print_visitor::visit(ir_function *ir)
{
- /* Don't print built-in functions as part of the IR. */
- if (ir->is_builtin)
- return;
-
printf("(function %s\n", ir->name);
indentation++;
foreach_iter(exec_list_iterator, iter, *ir) {
ir_function_signature *const sig = (ir_function_signature *) iter.get();
+ if (sig->is_builtin)
+ continue;
+
indent();
sig->accept(this);
printf("\n");
@@ -405,19 +404,23 @@ ir_print_visitor::visit(ir_if *ir)
printf(")\n");
indent();
- printf("(\n");
- indentation++;
+ if (!ir->else_instructions.is_empty()) {
+ printf("(\n");
+ indentation++;
- foreach_iter(exec_list_iterator, iter, ir->else_instructions) {
- ir_instruction *const inst = (ir_instruction *) iter.get();
+ foreach_iter(exec_list_iterator, iter, ir->else_instructions) {
+ ir_instruction *const inst = (ir_instruction *) iter.get();
+ indent();
+ inst->accept(this);
+ printf("\n");
+ }
+ indentation--;
indent();
- inst->accept(this);
- printf("\n");
+ printf("))\n");
+ } else {
+ printf("())\n");
}
- indentation--;
- indent();
- printf("))\n");
}
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index e57e03c307..a9cbf8ea94 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -32,6 +32,8 @@ extern "C" {
#include "glsl_types.h"
#include "s_expression.h"
+const static bool debug = false;
+
static void ir_read_error(_mesa_glsl_parse_state *, s_expression *,
const char *fmt, ...);
static const glsl_type *read_type(_mesa_glsl_parse_state *, s_expression *);
@@ -84,6 +86,9 @@ _mesa_glsl_read_ir(_mesa_glsl_parse_state *state, exec_list *instructions,
read_instructions(state, instructions, expr, NULL);
talloc_free(expr);
+
+ if (debug)
+ validate_ir_tree(instructions);
}
static void
@@ -94,6 +99,10 @@ ir_read_error(_mesa_glsl_parse_state *state, s_expression *expr,
state->error = true;
+ if (state->current_function != NULL)
+ state->info_log = talloc_asprintf_append(state->info_log,
+ "In function %s:\n",
+ state->current_function->function_name());
state->info_log = talloc_strdup_append(state->info_log, "error: ");
va_start(ap, fmt);
@@ -209,7 +218,6 @@ read_function(_mesa_glsl_parse_state *st, s_list *list, bool skip_body)
ir_function *f = st->symbols->get_function(name->value());
if (f == NULL) {
f = new(ctx) ir_function(name->value());
- f->is_builtin = true;
added = st->symbols->add_function(f->name, f);
assert(added);
}
@@ -282,6 +290,7 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
if (sig == NULL && skip_body) {
/* If scanning for prototypes, generate a new signature. */
sig = new(ctx) ir_function_signature(return_type);
+ sig->is_builtin = true;
f->add_signature(sig);
} else if (sig != NULL) {
const char *badvar = sig->qualifiers_match(&hir_parameters);
@@ -310,7 +319,9 @@ read_function_sig(_mesa_glsl_parse_state *st, ir_function *f, s_list *list,
ir_read_error(st, list, "function %s redefined", f->name);
return;
}
+ st->current_function = sig;
read_instructions(st, &sig->body, body_list, NULL);
+ st->current_function = NULL;
sig->is_defined = true;
}
@@ -331,8 +342,17 @@ read_instructions(_mesa_glsl_parse_state *st, exec_list *instructions,
foreach_iter(exec_list_iterator, it, list->subexpressions) {
s_expression *sub = (s_expression*) it.get();
ir_instruction *ir = read_instruction(st, sub, loop_ctx);
- if (ir != NULL)
- instructions->push_tail(ir);
+ if (ir != NULL) {
+ /* Global variable declarations should be moved to the top, before
+ * any functions that might use them. Functions are added to the
+ * instruction stream when scanning for prototypes, so without this
+ * hack, they always appear before variable declarations.
+ */
+ if (st->current_function == NULL && ir->as_variable() != NULL)
+ instructions->push_head(ir);
+ else
+ instructions->push_tail(ir);
+ }
}
}
@@ -575,23 +595,56 @@ static ir_assignment *
read_assignment(_mesa_glsl_parse_state *st, s_list *list)
{
void *ctx = st;
- if (list->length() != 4) {
- ir_read_error(st, list, "expected (assign <condition> <lhs> <rhs>)");
+ if (list->length() != 5) {
+ ir_read_error(st, list, "expected (assign <condition> (<write mask>) "
+ "<lhs> <rhs>)");
return NULL;
}
s_expression *cond_expr = (s_expression*) list->subexpressions.head->next;
- s_expression *lhs_expr = (s_expression*) cond_expr->next;
+ s_list *mask_list = SX_AS_LIST(cond_expr->next);
+ s_expression *lhs_expr = (s_expression*) cond_expr->next->next;
s_expression *rhs_expr = (s_expression*) lhs_expr->next;
- // FINISHME: Deal with "true" condition
ir_rvalue *condition = read_rvalue(st, cond_expr);
if (condition == NULL) {
ir_read_error(st, NULL, "when reading condition of assignment");
return NULL;
}
- ir_rvalue *lhs = read_rvalue(st, lhs_expr);
+ if (mask_list == NULL || mask_list->length() > 1) {
+ ir_read_error(st, mask_list, "expected () or (<write mask>)");
+ return NULL;
+ }
+
+ unsigned mask = 0;
+ if (mask_list->length() == 1) {
+ s_symbol *mask_symbol = SX_AS_SYMBOL(mask_list->subexpressions.head);
+ if (mask_symbol == NULL) {
+ ir_read_error(st, list, "expected a write mask; found non-symbol");
+ return NULL;
+ }
+
+ const char *mask_str = mask_symbol->value();
+ unsigned mask_length = strlen(mask_str);
+ if (mask_length > 4) {
+ ir_read_error(st, list, "invalid write mask: %s", mask_str);
+ return NULL;
+ }
+
+ const unsigned idx_map[] = { 3, 0, 1, 2 }; /* w=bit 3, x=0, y=1, z=2 */
+
+ for (unsigned i = 0; i < mask_length; i++) {
+ if (mask_str[i] < 'w' || mask_str[i] > 'z') {
+ ir_read_error(st, list, "write mask contains invalid character: %c",
+ mask_str[i]);
+ return NULL;
+ }
+ mask |= 1 << idx_map[mask_str[i] - 'w'];
+ }
+ }
+
+ ir_dereference *lhs = read_dereference(st, lhs_expr);
if (lhs == NULL) {
ir_read_error(st, NULL, "when reading left-hand side of assignment");
return NULL;
@@ -603,7 +656,12 @@ read_assignment(_mesa_glsl_parse_state *st, s_list *list)
return NULL;
}
- return new(ctx) ir_assignment(lhs, rhs, condition);
+ if (mask == 0 && (lhs->type->is_vector() || lhs->type->is_scalar())) {
+ ir_read_error(st, list, "non-zero write mask required.");
+ return NULL;
+ }
+
+ return new(ctx) ir_assignment(lhs, rhs, condition, mask);
}
static ir_call *
diff --git a/src/glsl/ir_rvalue_visitor.cpp b/src/glsl/ir_rvalue_visitor.cpp
index 613b07c302..773bfcfa3e 100644
--- a/src/glsl/ir_rvalue_visitor.cpp
+++ b/src/glsl/ir_rvalue_visitor.cpp
@@ -83,7 +83,14 @@ ir_rvalue_visitor::visit_leave(ir_swizzle *ir)
ir_visitor_status
ir_rvalue_visitor::visit_leave(ir_dereference_array *ir)
{
+ /* The array index is not the target of the assignment, so clear the
+ * 'in_assignee' flag. Restore it after returning from the array index.
+ */
+ const bool was_in_assignee = this->in_assignee;
+ this->in_assignee = false;
handle_rvalue(&ir->array_index);
+ this->in_assignee = was_in_assignee;
+
handle_rvalue(&ir->array);
return visit_continue;
}
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index 9ea11dd400..58ab8aa58f 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -61,6 +61,7 @@ public:
virtual ir_visitor_status visit(ir_dereference_variable *ir);
virtual ir_visitor_status visit(ir_if *ir);
+ virtual ir_visitor_status visit_leave(ir_loop *ir);
virtual ir_visitor_status visit_enter(ir_function *ir);
virtual ir_visitor_status visit_leave(ir_function *ir);
virtual ir_visitor_status visit_enter(ir_function_signature *ir);
@@ -114,6 +115,40 @@ ir_validate::visit(ir_if *ir)
ir_visitor_status
+ir_validate::visit_leave(ir_loop *ir)
+{
+ if (ir->counter != NULL) {
+ if ((ir->from == NULL) || (ir->from == NULL) || (ir->increment == NULL)) {
+ printf("ir_loop has invalid loop controls:\n"
+ " counter: %p\n"
+ " from: %p\n"
+ " to: %p\n"
+ " increment: %p\n",
+ ir->counter, ir->from, ir->to, ir->increment);
+ abort();
+ }
+
+ if ((ir->cmp < ir_binop_less) || (ir->cmp > ir_binop_nequal)) {
+ printf("ir_loop has invalid comparitor %d\n", ir->cmp);
+ abort();
+ }
+ } else {
+ if ((ir->from != NULL) || (ir->from != NULL) || (ir->increment != NULL)) {
+ printf("ir_loop has invalid loop controls:\n"
+ " counter: %p\n"
+ " from: %p\n"
+ " to: %p\n"
+ " increment: %p\n",
+ ir->counter, ir->from, ir->to, ir->increment);
+ abort();
+ }
+ }
+
+ return visit_continue;
+}
+
+
+ir_visitor_status
ir_validate::visit_enter(ir_function *ir)
{
/* Function definitions cannot be nested.
@@ -240,6 +275,10 @@ ir_validate::visit_leave(ir_expression *ir)
assert(ir->operands[0]->type == ir->type);
break;
+ case ir_unop_noise:
+ /* XXX what can we assert here? */
+ break;
+
case ir_binop_add:
case ir_binop_sub:
case ir_binop_mul:
@@ -258,24 +297,30 @@ ir_validate::visit_leave(ir_expression *ir)
assert(ir->operands[0]->type == ir->type);
}
break;
+
case ir_binop_less:
case ir_binop_greater:
case ir_binop_lequal:
case ir_binop_gequal:
- /* GLSL < > <= >= operators take scalar floats/ints, but in the
- * IR we may want to do them for vectors instead to support the
- * lessEqual() and friends builtins.
+ case ir_binop_equal:
+ case ir_binop_nequal:
+ /* The semantics of the IR operators differ from the GLSL <, >, <=, >=,
+ * ==, and != operators. The IR operators perform a component-wise
+ * comparison on scalar or vector types and return a boolean scalar or
+ * vector type of the same size.
*/
- assert(ir->type == glsl_type::bool_type);
+ assert(ir->type->base_type == GLSL_TYPE_BOOL);
assert(ir->operands[0]->type == ir->operands[1]->type);
+ assert(ir->operands[0]->type->is_vector()
+ || ir->operands[0]->type->is_scalar());
+ assert(ir->operands[0]->type->vector_elements
+ == ir->type->vector_elements);
break;
- case ir_binop_equal:
- case ir_binop_nequal:
- /* GLSL == and != operate on vectors and return a bool, and the
- * IR matches that. We may want to switch up the IR to work on
- * vectors and return a bvec and make the operators break down
- * to ANDing/ORing the results of the vector comparison.
+ case ir_binop_all_equal:
+ case ir_binop_any_nequal:
+ /* GLSL == and != operate on scalars, vectors, matrices and arrays, and
+ * return a scalar boolean. The IR matches that.
*/
assert(ir->type == glsl_type::bool_type);
assert(ir->operands[0]->type == ir->operands[1]->type);
@@ -303,6 +348,7 @@ ir_validate::visit_leave(ir_expression *ir)
case ir_binop_dot:
assert(ir->type == glsl_type::float_type);
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
+ assert(ir->operands[0]->type->is_vector());
assert(ir->operands[0]->type == ir->operands[1]->type);
break;
diff --git a/src/glsl/ir_variable.cpp b/src/glsl/ir_variable.cpp
index e638c9602f..3fed4d9e6e 100644
--- a/src/glsl/ir_variable.cpp
+++ b/src/glsl/ir_variable.cpp
@@ -97,6 +97,32 @@ add_builtin_constant(exec_list *instructions,
var->constant_value = new(var) ir_constant(value);
}
+/* Several constants in GLSL ES have different names than normal desktop GLSL.
+ * Therefore, this function should only be called on the ES path.
+ */
+static void
+generate_100ES_uniforms(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ add_builtin_constant(instructions, state, "gl_MaxVertexAttribs",
+ state->Const.MaxVertexAttribs);
+ add_builtin_constant(instructions, state, "gl_MaxVertexUniformVectors",
+ state->Const.MaxVertexUniformComponents);
+ add_builtin_constant(instructions, state, "gl_MaxVaryingVectors",
+ state->Const.MaxVaryingFloats / 4);
+ add_builtin_constant(instructions, state, "gl_MaxVertexTextureImageUnits",
+ state->Const.MaxVertexTextureImageUnits);
+ add_builtin_constant(instructions, state, "gl_MaxCombinedTextureImageUnits",
+ state->Const.MaxCombinedTextureImageUnits);
+ add_builtin_constant(instructions, state, "gl_MaxTextureImageUnits",
+ state->Const.MaxTextureImageUnits);
+ add_builtin_constant(instructions, state, "gl_MaxFragmentUniformVectors",
+ state->Const.MaxFragmentUniformComponents);
+
+ add_uniform(instructions, state, "gl_DepthRange",
+ state->symbols->get_type("gl_DepthRangeParameters"));
+}
+
static void
generate_110_uniforms(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -189,6 +215,23 @@ generate_110_uniforms(exec_list *instructions,
state->symbols->get_type("gl_FogParameters"));
}
+/* This function should only be called for ES, not desktop GL. */
+static void
+generate_100ES_vs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_vs_variables); i++) {
+ add_builtin_variable(& builtin_core_vs_variables[i],
+ instructions, state->symbols);
+ }
+
+ generate_100ES_uniforms(instructions, state);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ vertex_shader);
+}
+
+
static void
generate_110_vs_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -264,6 +307,9 @@ initialize_vs_variables(exec_list *instructions,
{
switch (state->language_version) {
+ case 100:
+ generate_100ES_vs_variables(instructions, state);
+ break;
case 110:
generate_110_vs_variables(instructions, state);
break;
@@ -276,6 +322,27 @@ initialize_vs_variables(exec_list *instructions,
}
}
+/* This function should only be called for ES, not desktop GL. */
+static void
+generate_100ES_fs_variables(exec_list *instructions,
+ struct _mesa_glsl_parse_state *state)
+{
+ for (unsigned i = 0; i < Elements(builtin_core_fs_variables); i++) {
+ add_builtin_variable(& builtin_core_fs_variables[i],
+ instructions, state->symbols);
+ }
+
+ for (unsigned i = 0; i < Elements(builtin_100ES_fs_variables); i++) {
+ add_builtin_variable(& builtin_100ES_fs_variables[i],
+ instructions, state->symbols);
+ }
+
+ generate_100ES_uniforms(instructions, state);
+
+ generate_ARB_draw_buffers_variables(instructions, state, false,
+ fragment_shader);
+}
+
static void
generate_110_fs_variables(exec_list *instructions,
struct _mesa_glsl_parse_state *state)
@@ -285,6 +352,11 @@ generate_110_fs_variables(exec_list *instructions,
instructions, state->symbols);
}
+ for (unsigned i = 0; i < Elements(builtin_110_fs_variables); i++) {
+ add_builtin_variable(& builtin_110_fs_variables[i],
+ instructions, state->symbols);
+ }
+
for (unsigned i = 0
; i < Elements(builtin_110_deprecated_fs_variables)
; i++) {
@@ -382,6 +454,9 @@ initialize_fs_variables(exec_list *instructions,
{
switch (state->language_version) {
+ case 100:
+ generate_100ES_fs_variables(instructions, state);
+ break;
case 110:
generate_110_fs_variables(instructions, state);
break;
diff --git a/src/glsl/ir_visitor.h b/src/glsl/ir_visitor.h
index b87d737318..7dd35fe1dc 100644
--- a/src/glsl/ir_visitor.h
+++ b/src/glsl/ir_visitor.h
@@ -64,4 +64,21 @@ public:
/*@}*/
};
+/* NOTE: function calls may never return due to discards inside them
+ * This is usually not an issue, but if it is, keep it in mind
+ */
+class ir_control_flow_visitor : public ir_visitor {
+public:
+ virtual void visit(class ir_variable *) {}
+ virtual void visit(class ir_expression *) {}
+ virtual void visit(class ir_texture *) {}
+ virtual void visit(class ir_swizzle *) {}
+ virtual void visit(class ir_dereference_variable *) {}
+ virtual void visit(class ir_dereference_array *) {}
+ virtual void visit(class ir_dereference_record *) {}
+ virtual void visit(class ir_assignment *) {}
+ virtual void visit(class ir_constant *) {}
+ virtual void visit(class ir_call *) {}
+};
+
#endif /* IR_VISITOR_H */
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index e0823c3af4..c2c662152e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -740,14 +740,14 @@ link_intrastage_shaders(GLcontext *ctx,
ir_function_signature *sig =
(ir_function_signature *) iter.get();
- if (!sig->is_defined || f->is_builtin)
+ if (!sig->is_defined || sig->is_builtin)
continue;
ir_function_signature *other_sig =
other->exact_matching_signature(& sig->parameters);
if ((other_sig != NULL) && other_sig->is_defined
- && !other_sig->function()->is_builtin) {
+ && !other_sig->is_builtin) {
linker_error_printf(prog,
"function `%s' is multiply defined",
f->name);
@@ -1402,9 +1402,10 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
* match shading language versions. With GLSL 1.30 and later, the versions
* of all shaders must match.
*/
- assert(min_version >= 110);
+ assert(min_version >= 100);
assert(max_version <= 130);
- if ((max_version >= 130) && (min_version != max_version)) {
+ if ((max_version >= 130 || min_version == 100)
+ && min_version != max_version) {
linker_error_printf(prog, "all shaders must use same shading "
"language version\n");
goto done;
@@ -1470,13 +1471,13 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
* some of that unused.
*/
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
- while (do_common_optimization(prog->_LinkedShaders[i]->ir, true))
+ while (do_common_optimization(prog->_LinkedShaders[i]->ir, true, 32))
;
}
assign_uniform_locations(prog);
- if (prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
+ if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
/* FINISHME: The value of the max_attribute_index parameter is
* FINISHME: implementation dependent based on the value of
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
diff --git a/src/glsl/list.h b/src/glsl/list.h
index a70b79d571..3197b03cf2 100644
--- a/src/glsl/list.h
+++ b/src/glsl/list.h
@@ -165,6 +165,12 @@ struct exec_node {
this->prev->next = before;
this->prev = before;
}
+
+ /**
+ * Insert another list in the list before the current node
+ */
+ void insert_before(struct exec_list *before);
+
/**
* Replace the current node with the given node.
*/
@@ -378,6 +384,23 @@ struct exec_list {
}
/**
+ * Remove the first node from a list and return it
+ *
+ * \return
+ * The first node in the list or \c NULL if the list is empty.
+ *
+ * \sa exec_list::get_head
+ */
+ exec_node *pop_head()
+ {
+ exec_node *const n = this->get_head();
+ if (n != NULL)
+ n->remove();
+
+ return n;
+ }
+
+ /**
* Move all of the nodes from this list to the target list
*/
void move_nodes_to(exec_list *target)
@@ -432,6 +455,23 @@ struct exec_list {
#endif
};
+
+#ifdef __cplusplus
+inline void exec_node::insert_before(exec_list *before)
+{
+ if (before->is_empty())
+ return;
+
+ before->tail_pred->next = this;
+ before->head->prev = this->prev;
+
+ this->prev->next = before->head;
+ this->prev = before->tail_pred;
+
+ before->make_empty();
+}
+#endif
+
/**
* This version is safe even if the current node is removed.
*/
diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
new file mode 100644
index 0000000000..91e34da0ee
--- /dev/null
+++ b/src/glsl/loop_analysis.cpp
@@ -0,0 +1,496 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glsl_types.h"
+#include "loop_analysis.h"
+#include "ir_hierarchical_visitor.h"
+
+static bool is_loop_terminator(ir_if *ir);
+
+static bool all_expression_operands_are_loop_constant(ir_rvalue *,
+ hash_table *);
+
+static ir_rvalue *get_basic_induction_increment(ir_assignment *, hash_table *);
+
+
+loop_state::loop_state()
+{
+ this->ht = hash_table_ctor(0, hash_table_pointer_hash,
+ hash_table_pointer_compare);
+ this->mem_ctx = talloc_init("loop state");
+}
+
+
+loop_state::~loop_state()
+{
+ hash_table_dtor(this->ht);
+}
+
+
+loop_variable_state *
+loop_state::insert(ir_loop *ir)
+{
+ loop_variable_state *ls = new(this->mem_ctx) loop_variable_state;
+ hash_table_insert(this->ht, ls, ir);
+
+ return ls;
+}
+
+
+loop_variable_state *
+loop_state::get(const ir_loop *ir)
+{
+ return (loop_variable_state *) hash_table_find(this->ht, ir);
+}
+
+
+loop_variable *
+loop_variable_state::get(const ir_variable *ir)
+{
+ return (loop_variable *) hash_table_find(this->var_hash, ir);
+}
+
+
+loop_variable *
+loop_variable_state::insert(ir_variable *var)
+{
+ void *mem_ctx = talloc_parent(this);
+ loop_variable *lv = talloc_zero(mem_ctx, loop_variable);
+
+ lv->var = var;
+
+ hash_table_insert(this->var_hash, lv, lv->var);
+ this->variables.push_tail(lv);
+
+ return lv;
+}
+
+
+loop_terminator *
+loop_variable_state::insert(ir_if *if_stmt)
+{
+ void *mem_ctx = talloc_parent(this);
+ loop_terminator *t = talloc_zero(mem_ctx, loop_terminator);
+
+ t->ir = if_stmt;
+ this->terminators.push_tail(t);
+
+ return t;
+}
+
+
+class loop_analysis : public ir_hierarchical_visitor {
+public:
+ loop_analysis();
+
+ virtual ir_visitor_status visit(ir_loop_jump *);
+ virtual ir_visitor_status visit(ir_dereference_variable *);
+
+ virtual ir_visitor_status visit_enter(ir_loop *);
+ virtual ir_visitor_status visit_leave(ir_loop *);
+ virtual ir_visitor_status visit_enter(ir_assignment *);
+ virtual ir_visitor_status visit_leave(ir_assignment *);
+ virtual ir_visitor_status visit_enter(ir_if *);
+ virtual ir_visitor_status visit_leave(ir_if *);
+
+ loop_state *loops;
+
+ int if_statement_depth;
+
+ ir_assignment *current_assignment;
+
+ exec_list state;
+};
+
+
+loop_analysis::loop_analysis()
+{
+ this->loops = new loop_state;
+
+ this->if_statement_depth = 0;
+ this->current_assignment = NULL;
+}
+
+
+ir_visitor_status
+loop_analysis::visit(ir_loop_jump *ir)
+{
+ (void) ir;
+
+ assert(!this->state.is_empty());
+
+ loop_variable_state *const ls =
+ (loop_variable_state *) this->state.get_head();
+
+ ls->num_loop_jumps++;
+
+ return visit_continue;
+}
+
+
+ir_visitor_status
+loop_analysis::visit(ir_dereference_variable *ir)
+{
+ /* If we're not somewhere inside a loop, there's nothing to do.
+ */
+ if (this->state.is_empty())
+ return visit_continue;
+
+ loop_variable_state *const ls =
+ (loop_variable_state *) this->state.get_head();
+
+ ir_variable *var = ir->variable_referenced();
+ loop_variable *lv = ls->get(var);
+
+ if (lv == NULL) {
+ lv = ls->insert(var);
+ lv->read_before_write = !this->in_assignee;
+ }
+
+ if (this->in_assignee) {
+ assert(this->current_assignment != NULL);
+
+ lv->conditional_assignment = (this->if_statement_depth > 0)
+ || (this->current_assignment->condition != NULL);
+
+ if (lv->first_assignment == NULL) {
+ assert(lv->num_assignments == 0);
+
+ lv->first_assignment = this->current_assignment;
+ }
+
+ lv->num_assignments++;
+ } else if (lv->first_assignment == this->current_assignment) {
+ /* This catches the case where the variable is used in the RHS of an
+ * assignment where it is also in the LHS.
+ */
+ lv->read_before_write = true;
+ }
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_enter(ir_loop *ir)
+{
+ loop_variable_state *ls = this->loops->insert(ir);
+ this->state.push_head(ls);
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_leave(ir_loop *ir)
+{
+ loop_variable_state *const ls =
+ (loop_variable_state *) this->state.pop_head();
+
+
+ foreach_list(node, &ir->body_instructions) {
+ /* Skip over declarations at the start of a loop.
+ */
+ if (((ir_instruction *) node)->as_variable())
+ continue;
+
+ ir_if *if_stmt = ((ir_instruction *) node)->as_if();
+
+ if ((if_stmt != NULL) && is_loop_terminator(if_stmt))
+ ls->insert(if_stmt);
+ else
+ break;
+ }
+
+
+ foreach_list_safe(node, &ls->variables) {
+ loop_variable *lv = (loop_variable *) node;
+
+ /* Move variables that are already marked as being loop constant to
+ * a separate list. These trivially don't need to be tested.
+ */
+ if (lv->is_loop_constant()) {
+ lv->remove();
+ ls->constants.push_tail(lv);
+ }
+ }
+
+ /* Each variable assigned in the loop that isn't already marked as being loop
+ * constant might still be loop constant. The requirements at this point
+ * are:
+ *
+ * - Variable is written before it is read.
+ *
+ * - Only one assignment to the variable.
+ *
+ * - All operands on the RHS of the assignment are also loop constants.
+ *
+ * The last requirement is the reason for the progress loop. A variable
+ * marked as a loop constant on one pass may allow other variables to be
+ * marked as loop constant on following passes.
+ */
+ bool progress;
+ do {
+ progress = false;
+
+ foreach_list_safe(node, &ls->variables) {
+ loop_variable *lv = (loop_variable *) node;
+
+ if (lv->conditional_assignment || (lv->num_assignments > 1))
+ continue;
+
+ /* Process the RHS of the assignment. If all of the variables
+ * accessed there are loop constants, then add this
+ */
+ ir_rvalue *const rhs = lv->first_assignment->rhs;
+ if (all_expression_operands_are_loop_constant(rhs, ls->var_hash)) {
+ lv->rhs_clean = true;
+
+ if (lv->is_loop_constant()) {
+ progress = true;
+
+ lv->remove();
+ ls->constants.push_tail(lv);
+ }
+ }
+ }
+ } while (progress);
+
+ /* The remaining variables that are not loop invariant might be loop
+ * induction variables.
+ */
+ foreach_list_safe(node, &ls->variables) {
+ loop_variable *lv = (loop_variable *) node;
+
+ /* If there is more than one assignment to a variable, it cannot be a
+ * loop induction variable. This isn't strictly true, but this is a
+ * very simple induction variable detector, and it can't handle more
+ * complex cases.
+ */
+ if (lv->num_assignments > 1)
+ continue;
+
+ /* All of the variables with zero assignments in the loop are loop
+ * invariant, and they should have already been filtered out.
+ */
+ assert(lv->num_assignments == 1);
+ assert(lv->first_assignment != NULL);
+
+ /* The assignmnet to the variable in the loop must be unconditional.
+ */
+ if (lv->conditional_assignment)
+ continue;
+
+ /* Basic loop induction variables have a single assignment in the loop
+ * that has the form 'VAR = VAR + i' or 'VAR = VAR - i' where i is a
+ * loop invariant.
+ */
+ ir_rvalue *const inc =
+ get_basic_induction_increment(lv->first_assignment, ls->var_hash);
+ if (inc != NULL) {
+ lv->iv_scale = NULL;
+ lv->biv = lv->var;
+ lv->increment = inc;
+
+ lv->remove();
+ ls->induction_variables.push_tail(lv);
+ }
+ }
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_enter(ir_if *ir)
+{
+ (void) ir;
+
+ if (!this->state.is_empty())
+ this->if_statement_depth++;
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_leave(ir_if *ir)
+{
+ (void) ir;
+
+ if (!this->state.is_empty())
+ this->if_statement_depth--;
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_enter(ir_assignment *ir)
+{
+ /* If we're not somewhere inside a loop, there's nothing to do.
+ */
+ if (this->state.is_empty())
+ return visit_continue_with_parent;
+
+ this->current_assignment = ir;
+
+ return visit_continue;
+}
+
+ir_visitor_status
+loop_analysis::visit_leave(ir_assignment *ir)
+{
+ /* Since the visit_enter exits with visit_continue_with_parent for this
+ * case, the loop state stack should never be empty here.
+ */
+ assert(!this->state.is_empty());
+
+ assert(this->current_assignment == ir);
+ this->current_assignment = NULL;
+
+ return visit_continue;
+}
+
+
+class examine_rhs : public ir_hierarchical_visitor {
+public:
+ examine_rhs(hash_table *loop_variables)
+ {
+ this->only_uses_loop_constants = true;
+ this->loop_variables = loop_variables;
+ }
+
+ virtual ir_visitor_status visit(ir_dereference_variable *ir)
+ {
+ loop_variable *lv =
+ (loop_variable *) hash_table_find(this->loop_variables, ir->var);
+
+ assert(lv != NULL);
+
+ if (lv->is_loop_constant()) {
+ return visit_continue;
+ } else {
+ this->only_uses_loop_constants = false;
+ return visit_stop;
+ }
+ }
+
+ hash_table *loop_variables;
+ bool only_uses_loop_constants;
+};
+
+
+bool
+all_expression_operands_are_loop_constant(ir_rvalue *ir, hash_table *variables)
+{
+ examine_rhs v(variables);
+
+ ir->accept(&v);
+
+ return v.only_uses_loop_constants;
+}
+
+
+ir_rvalue *
+get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash)
+{
+ /* The RHS must be a binary expression.
+ */
+ ir_expression *const rhs = ir->rhs->as_expression();
+ if ((rhs == NULL)
+ || ((rhs->operation != ir_binop_add)
+ && (rhs->operation != ir_binop_sub)))
+ return NULL;
+
+ /* One of the of operands of the expression must be the variable assigned.
+ * If the operation is subtraction, the variable in question must be the
+ * "left" operand.
+ */
+ ir_variable *const var = ir->lhs->variable_referenced();
+
+ ir_variable *const op0 = rhs->operands[0]->variable_referenced();
+ ir_variable *const op1 = rhs->operands[1]->variable_referenced();
+
+ if (((op0 != var) && (op1 != var))
+ || ((op1 == var) && (rhs->operation == ir_binop_sub)))
+ return NULL;
+
+ ir_rvalue *inc = (op0 == var) ? rhs->operands[1] : rhs->operands[0];
+
+ if (inc->as_constant() == NULL) {
+ ir_variable *const inc_var = inc->variable_referenced();
+ if (inc_var != NULL) {
+ loop_variable *lv =
+ (loop_variable *) hash_table_find(var_hash, inc_var);
+
+ if (!lv->is_loop_constant())
+ inc = NULL;
+ } else
+ inc = NULL;
+ }
+
+ if ((inc != NULL) && (rhs->operation == ir_binop_sub)) {
+ void *mem_ctx = talloc_parent(ir);
+
+ inc = new(mem_ctx) ir_expression(ir_unop_neg,
+ inc->type,
+ inc->clone(mem_ctx, NULL),
+ NULL);
+ }
+
+ return inc;
+}
+
+
+/**
+ * Detect whether an if-statement is a loop terminating condition
+ *
+ * Detects if-statements of the form
+ *
+ * (if (expression bool ...) (break))
+ */
+bool
+is_loop_terminator(ir_if *ir)
+{
+ if (!ir->else_instructions.is_empty())
+ return false;
+
+ ir_instruction *const inst =
+ (ir_instruction *) ir->then_instructions.get_head();
+ assert(inst != NULL);
+
+ if (inst->ir_type != ir_type_loop_jump)
+ return false;
+
+ ir_loop_jump *const jump = (ir_loop_jump *) inst;
+ if (jump->mode != ir_loop_jump::jump_break)
+ return false;
+
+ return true;
+}
+
+
+loop_state *
+analyze_loop_variables(exec_list *instructions)
+{
+ loop_analysis v;
+
+ v.run(instructions);
+ return v.loops;
+}
diff --git a/src/glsl/loop_analysis.h b/src/glsl/loop_analysis.h
new file mode 100644
index 0000000000..7b0511fbbe
--- /dev/null
+++ b/src/glsl/loop_analysis.h
@@ -0,0 +1,230 @@
+/* -*- c++ -*- */
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#pragma once
+#ifndef LOOP_ANALYSIS_H
+#define LOOP_ANALYSIS_H
+
+#include "ir.h"
+#include "program/hash_table.h"
+
+/**
+ * Analyze and classify all variables used in all loops in the instruction list
+ */
+extern class loop_state *
+analyze_loop_variables(exec_list *instructions);
+
+
+/**
+ * Fill in loop control fields
+ *
+ * Based on analysis of loop variables, this function tries to remove sequences
+ * in the loop of the form
+ *
+ * (if (expression bool ...) (break))
+ *
+ * and fill in the \c ir_loop::from, \c ir_loop::to, and \c ir_loop::counter
+ * fields of the \c ir_loop.
+ *
+ * In this process, some conditional break-statements may be eliminated
+ * altogether. For example, if it is provable that one loop exit condition will
+ * always be satisfied before another, the unnecessary exit condition will be
+ * removed.
+ */
+extern bool
+set_loop_controls(exec_list *instructions, loop_state *ls);
+
+
+extern bool
+unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations);
+
+
+/**
+ * Tracking for all variables used in a loop
+ */
+class loop_variable_state : public exec_node {
+public:
+ class loop_variable *get(const ir_variable *);
+ class loop_variable *insert(ir_variable *);
+ class loop_terminator *insert(ir_if *);
+
+
+ /**
+ * Loop whose variable state is being tracked by this structure
+ */
+ ir_loop *loop;
+
+ /**
+ * Variables that have not yet been classified
+ */
+ exec_list variables;
+
+ /**
+ * Variables whose values are constant within the body of the loop
+ *
+ * This list contains \c loop_variable objects.
+ */
+ exec_list constants;
+
+ /**
+ * Induction variables for this loop
+ *
+ * This list contains \c loop_variable objects.
+ */
+ exec_list induction_variables;
+
+ /**
+ * Simple if-statements that lead to the termination of the loop
+ *
+ * This list contains \c loop_terminator objects.
+ *
+ * \sa is_loop_terminator
+ */
+ exec_list terminators;
+
+ /**
+ * Hash table containing all variables accessed in this loop
+ */
+ hash_table *var_hash;
+
+ /**
+ * Maximum number of loop iterations.
+ *
+ * If this value is negative, then the loop may be infinite. This actually
+ * means that analysis was unable to determine an upper bound on the number
+ * of loop iterations.
+ */
+ int max_iterations;
+
+ /**
+ * Number of ir_loop_jump instructions that operate on this loop
+ */
+ unsigned num_loop_jumps;
+
+ loop_variable_state()
+ {
+ this->max_iterations = -1;
+ this->num_loop_jumps = 0;
+ this->var_hash = hash_table_ctor(0, hash_table_pointer_hash,
+ hash_table_pointer_compare);
+ }
+
+ ~loop_variable_state()
+ {
+ hash_table_dtor(this->var_hash);
+ }
+};
+
+
+class loop_variable : public exec_node {
+public:
+ /** The variable in question. */
+ ir_variable *var;
+
+ /** Is the variable read in the loop before it is written? */
+ bool read_before_write;
+
+ /** Are all variables in the RHS of the assignment loop constants? */
+ bool rhs_clean;
+
+ /** Is there an assignment to the variable that is conditional? */
+ bool conditional_assignment;
+
+ /** Reference to the first assignment to the variable in the loop body. */
+ ir_assignment *first_assignment;
+
+ /** Number of assignments to the variable in the loop body. */
+ unsigned num_assignments;
+
+ /**
+ * Increment values for loop induction variables
+ *
+ * Loop induction variables have a single increment of the form
+ * \c b * \c biv + \c c, where \c b and \c c are loop constants and \c i
+ * is a basic loop induction variable.
+ *
+ * If \c iv_scale is \c NULL, 1 is used. If \c biv is the same as \c var,
+ * then \c var is a basic loop induction variable.
+ */
+ /*@{*/
+ ir_rvalue *iv_scale;
+ ir_variable *biv;
+ ir_rvalue *increment;
+ /*@}*/
+
+
+ inline bool is_loop_constant() const
+ {
+ const bool is_const = (this->num_assignments == 0)
+ || ((this->num_assignments == 1)
+ && !this->conditional_assignment
+ && !this->read_before_write
+ && this->rhs_clean);
+
+ /* If the RHS of *the* assignment is clean, then there must be exactly
+ * one assignment of the variable.
+ */
+ assert((this->rhs_clean && (this->num_assignments == 1))
+ || !this->rhs_clean);
+
+ /* Variables that are marked read-only *MUST* be loop constant.
+ */
+ assert(!this->var->read_only || (this->var->read_only && is_const));
+
+ return is_const;
+ }
+};
+
+
+class loop_terminator : public exec_node {
+public:
+ ir_if *ir;
+};
+
+
+class loop_state {
+public:
+ ~loop_state();
+
+ /**
+ * Get the loop variable state data for a particular loop
+ */
+ loop_variable_state *get(const ir_loop *);
+
+ loop_variable_state *insert(ir_loop *ir);
+
+private:
+ loop_state();
+
+ /**
+ * Hash table containing all loops that have been analyzed.
+ */
+ hash_table *ht;
+
+ void *mem_ctx;
+
+ friend class loop_analysis;
+};
+
+#endif /* LOOP_ANALYSIS_H */
diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp
new file mode 100644
index 0000000000..2ef3d30525
--- /dev/null
+++ b/src/glsl/loop_controls.cpp
@@ -0,0 +1,301 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include <climits>
+#include "main/compiler.h"
+#include "glsl_types.h"
+#include "loop_analysis.h"
+#include "ir_hierarchical_visitor.h"
+
+/**
+ * Find an initializer of a variable outside a loop
+ *
+ * Works backwards from the loop to find the pre-loop value of the variable.
+ * This is used, for example, to find the initial value of loop induction
+ * variables.
+ *
+ * \param loop Loop where \c var is an induction variable
+ * \param var Variable whose initializer is to be found
+ *
+ * \return
+ * The \c ir_rvalue assigned to the variable outside the loop. May return
+ * \c NULL if no initializer can be found.
+ */
+ir_rvalue *
+find_initial_value(ir_loop *loop, ir_variable *var)
+{
+ for (exec_node *node = loop->prev;
+ !node->is_head_sentinel();
+ node = node->prev) {
+ ir_instruction *ir = (ir_instruction *) node;
+
+ switch (ir->ir_type) {
+ case ir_type_call:
+ case ir_type_loop:
+ case ir_type_loop_jump:
+ case ir_type_return:
+ case ir_type_if:
+ return NULL;
+
+ case ir_type_function:
+ case ir_type_function_signature:
+ assert(!"Should not get here.");
+ return NULL;
+
+ case ir_type_assignment: {
+ ir_assignment *assign = ir->as_assignment();
+ ir_variable *assignee = assign->lhs->whole_variable_referenced();
+
+ if (assignee == var)
+ return (assign->condition != NULL) ? NULL : assign->rhs;
+
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+
+int
+calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
+ enum ir_expression_operation op)
+{
+ void *mem_ctx = talloc_init("%s", __func__);
+
+ ir_expression *const sub =
+ new(mem_ctx) ir_expression(ir_binop_sub, from->type, to, from);
+
+ ir_expression *const div =
+ new(mem_ctx) ir_expression(ir_binop_div, sub->type, sub, increment);
+
+ ir_constant *iter = div->constant_expression_value();
+
+ if (iter == NULL)
+ return -1;
+
+ if (!iter->type->is_integer()) {
+ ir_rvalue *cast =
+ new(mem_ctx) ir_expression(ir_unop_f2i, glsl_type::int_type, iter,
+ NULL);
+
+ iter = cast->constant_expression_value();
+ }
+
+ int iter_value = iter->get_int_component(0);
+
+ /* Make sure that the calculated number of iterations satisfies the exit
+ * condition. This is needed to catch off-by-one errors and some types of
+ * ill-formed loops. For example, we need to detect that the following
+ * loop does not have a maximum iteration count.
+ *
+ * for (float x = 0.0; x != 0.9; x += 0.2)
+ * ;
+ */
+ const int bias[] = { -1, 0, 1 };
+ bool valid_loop = false;
+
+ for (unsigned i = 0; i < Elements(bias); i++) {
+ iter = (increment->type->is_integer())
+ ? new(mem_ctx) ir_constant(iter_value + bias[i])
+ : new(mem_ctx) ir_constant(float(iter_value + bias[i]));
+
+ ir_expression *const mul =
+ new(mem_ctx) ir_expression(ir_binop_mul, increment->type, iter,
+ increment);
+
+ ir_expression *const add =
+ new(mem_ctx) ir_expression(ir_binop_add, mul->type, mul, from);
+
+ ir_expression *const cmp =
+ new(mem_ctx) ir_expression(op, glsl_type::bool_type, add, to);
+
+ ir_constant *const cmp_result = cmp->constant_expression_value();
+
+ assert(cmp_result != NULL);
+ if (cmp_result->get_bool_component(0)) {
+ iter_value += bias[i];
+ valid_loop = true;
+ break;
+ }
+ }
+
+ talloc_free(mem_ctx);
+ return (valid_loop) ? iter_value : -1;
+}
+
+
+class loop_control_visitor : public ir_hierarchical_visitor {
+public:
+ loop_control_visitor(loop_state *state)
+ {
+ this->state = state;
+ this->progress = false;
+ }
+
+ virtual ir_visitor_status visit_leave(ir_loop *ir);
+
+ loop_state *state;
+
+ bool progress;
+};
+
+
+ir_visitor_status
+loop_control_visitor::visit_leave(ir_loop *ir)
+{
+ loop_variable_state *const ls = this->state->get(ir);
+
+ /* If we've entered a loop that hasn't been analyzed, something really,
+ * really bad has happened.
+ */
+ if (ls == NULL) {
+ assert(ls != NULL);
+ return visit_continue;
+ }
+
+ /* Search the loop terminating conditions for one of the form 'i < c' where
+ * i is a loop induction variable, c is a constant, and < is any relative
+ * operator.
+ */
+ int max_iterations = ls->max_iterations;
+
+ if(ir->from && ir->to && ir->increment)
+ max_iterations = calculate_iterations(ir->from, ir->to, ir->increment, (ir_expression_operation)ir->cmp);
+
+ if(max_iterations < 0)
+ max_iterations = INT_MAX;
+
+ foreach_list(node, &ls->terminators) {
+ loop_terminator *t = (loop_terminator *) node;
+ ir_if *if_stmt = t->ir;
+
+ /* If-statements can be either 'if (expr)' or 'if (deref)'. We only care
+ * about the former here.
+ */
+ ir_expression *cond = if_stmt->condition->as_expression();
+ if (cond == NULL)
+ continue;
+
+ switch (cond->operation) {
+ case ir_binop_less:
+ case ir_binop_greater:
+ case ir_binop_lequal:
+ case ir_binop_gequal: {
+ /* The expressions that we care about will either be of the form
+ * 'counter < limit' or 'limit < counter'. Figure out which is
+ * which.
+ */
+ ir_rvalue *counter = cond->operands[0]->as_dereference_variable();
+ ir_constant *limit = cond->operands[1]->as_constant();
+ enum ir_expression_operation cmp = cond->operation;
+
+ if (limit == NULL) {
+ counter = cond->operands[1]->as_dereference_variable();
+ limit = cond->operands[0]->as_constant();
+
+ switch (cmp) {
+ case ir_binop_less: cmp = ir_binop_gequal; break;
+ case ir_binop_greater: cmp = ir_binop_lequal; break;
+ case ir_binop_lequal: cmp = ir_binop_greater; break;
+ case ir_binop_gequal: cmp = ir_binop_less; break;
+ default: assert(!"Should not get here.");
+ }
+ }
+
+ if ((counter == NULL) || (limit == NULL))
+ break;
+
+ ir_variable *var = counter->variable_referenced();
+
+ ir_rvalue *init = find_initial_value(ir, var);
+
+ foreach_list(iv_node, &ls->induction_variables) {
+ loop_variable *lv = (loop_variable *) iv_node;
+
+ if (lv->var == var) {
+ const int iterations = calculate_iterations(init, limit,
+ lv->increment,
+ cmp);
+ if (iterations >= 0) {
+ /* If the new iteration count is lower than the previously
+ * believed iteration count, update the loop control values.
+ */
+ if (iterations < max_iterations) {
+ ir->from = init->clone(ir, NULL);
+ ir->to = limit->clone(ir, NULL);
+ ir->increment = lv->increment->clone(ir, NULL);
+ ir->counter = lv->var;
+ ir->cmp = cmp;
+
+ max_iterations = iterations;
+ }
+
+ /* Remove the conditional break statement. The loop
+ * controls are now set such that the exit condition will be
+ * satisfied.
+ */
+ if_stmt->remove();
+
+ assert(ls->num_loop_jumps > 0);
+ ls->num_loop_jumps--;
+
+ this->progress = true;
+ }
+
+ break;
+ }
+ }
+ break;
+ }
+
+ default:
+ break;
+ }
+ }
+
+ /* If we have proven the one of the loop exit conditions is satisifed before
+ * running the loop once, remove the loop.
+ */
+ if (max_iterations == 0)
+ ir->remove();
+ else
+ ls->max_iterations = max_iterations;
+
+ return visit_continue;
+}
+
+
+bool
+set_loop_controls(exec_list *instructions, loop_state *ls)
+{
+ loop_control_visitor v(ls);
+
+ v.run(instructions);
+
+ return v.progress;
+}
diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
new file mode 100644
index 0000000000..90797bde37
--- /dev/null
+++ b/src/glsl/loop_unroll.cpp
@@ -0,0 +1,187 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "glsl_types.h"
+#include "loop_analysis.h"
+#include "ir_hierarchical_visitor.h"
+
+class loop_unroll_visitor : public ir_hierarchical_visitor {
+public:
+ loop_unroll_visitor(loop_state *state, unsigned max_iterations)
+ {
+ this->state = state;
+ this->progress = false;
+ this->max_iterations = max_iterations;
+ }
+
+ virtual ir_visitor_status visit_leave(ir_loop *ir);
+
+ loop_state *state;
+
+ bool progress;
+ unsigned max_iterations;
+};
+
+
+ir_visitor_status
+loop_unroll_visitor::visit_leave(ir_loop *ir)
+{
+ loop_variable_state *const ls = this->state->get(ir);
+ int iterations;
+
+ /* If we've entered a loop that hasn't been analyzed, something really,
+ * really bad has happened.
+ */
+ if (ls == NULL) {
+ assert(ls != NULL);
+ return visit_continue;
+ }
+
+ iterations = ls->max_iterations;
+
+ /* Don't try to unroll loops where the number of iterations is not known
+ * at compile-time.
+ */
+ if (iterations < 0)
+ return visit_continue;
+
+ /* Don't try to unroll loops that have zillions of iterations either.
+ */
+ if (iterations > max_iterations)
+ return visit_continue;
+
+ if (ls->num_loop_jumps > 1)
+ return visit_continue;
+ else if (ls->num_loop_jumps) {
+ /* recognize loops in the form produced by ir_lower_jumps */
+ ir_instruction *last_ir =
+ ((ir_instruction*)ir->body_instructions.get_tail());
+
+ assert(last_ir != NULL);
+
+ ir_if *last_if = last_ir->as_if();
+ if (last_if) {
+ bool continue_from_then_branch;
+
+ /* Determine which if-statement branch, if any, ends with a break.
+ * The branch that did *not* have the break will get a temporary
+ * continue inserted in each iteration of the loop unroll.
+ *
+ * Note that since ls->num_loop_jumps is <= 1, it is impossible for
+ * both branches to end with a break.
+ */
+ ir_instruction *last =
+ (ir_instruction *) last_if->then_instructions.get_tail();
+
+ if (last && last->ir_type == ir_type_loop_jump
+ && ((ir_loop_jump*) last)->is_break()) {
+ continue_from_then_branch = false;
+ } else {
+ last = (ir_instruction *) last_if->then_instructions.get_tail();
+
+ if (last && last->ir_type == ir_type_loop_jump
+ && ((ir_loop_jump*) last)->is_break())
+ continue_from_then_branch = true;
+ else
+ /* Bail out if neither if-statement branch ends with a break.
+ */
+ return visit_continue;
+ }
+
+ /* Remove the break from the if-statement.
+ */
+ last->remove();
+
+ void *const mem_ctx = talloc_parent(ir);
+ ir_instruction *ir_to_replace = ir;
+
+ for (int i = 0; i < iterations; i++) {
+ exec_list copy_list;
+
+ copy_list.make_empty();
+ clone_ir_list(mem_ctx, &copy_list, &ir->body_instructions);
+
+ last_if = ((ir_instruction*)copy_list.get_tail())->as_if();
+ assert(last_if);
+
+ ir_to_replace->insert_before(&copy_list);
+ ir_to_replace->remove();
+
+ /* placeholder that will be removed in the next iteration */
+ ir_to_replace =
+ new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_continue);
+
+ exec_list *const list = (continue_from_then_branch)
+ ? &last_if->then_instructions : &last_if->else_instructions;
+
+ list->push_tail(ir_to_replace);
+ }
+
+ ir_to_replace->remove();
+
+ this->progress = true;
+ return visit_continue;
+ } else if (last_ir->ir_type == ir_type_loop_jump
+ && ((ir_loop_jump *)last_ir)->is_break()) {
+ /* If the only loop-jump is a break at the end of the loop, the loop
+ * will execute exactly once. Remove the break, set the iteration
+ * count, and fall through to the normal unroller.
+ */
+ last_ir->remove();
+ iterations = 1;
+
+ this->progress = true;
+ } else
+ return visit_continue;
+ }
+
+ void *const mem_ctx = talloc_parent(ir);
+
+ for (int i = 0; i < iterations; i++) {
+ exec_list copy_list;
+
+ copy_list.make_empty();
+ clone_ir_list(mem_ctx, &copy_list, &ir->body_instructions);
+
+ ir->insert_before(&copy_list);
+ }
+
+ /* The loop has been replaced by the unrolled copies. Remove the original
+ * loop from the IR sequence.
+ */
+ ir->remove();
+
+ this->progress = true;
+ return visit_continue;
+}
+
+
+bool
+unroll_loops(exec_list *instructions, loop_state *ls, unsigned max_iterations)
+{
+ loop_unroll_visitor v(ls, max_iterations);
+
+ v.run(instructions);
+
+ return v.progress;
+}
diff --git a/src/glsl/lower_noise.cpp b/src/glsl/lower_noise.cpp
new file mode 100644
index 0000000000..cb32d28348
--- /dev/null
+++ b/src/glsl/lower_noise.cpp
@@ -0,0 +1,71 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file lower_noise.cpp
+ * IR lower pass to remove noise opcodes.
+ *
+ * \author Ian Romanick <ian.d.romanick@intel.com>
+ */
+
+#include "ir.h"
+#include "ir_rvalue_visitor.h"
+
+class lower_noise_visitor : public ir_rvalue_visitor {
+public:
+ lower_noise_visitor() : progress(false)
+ {
+ /* empty */
+ }
+
+ void handle_rvalue(ir_rvalue **rvalue)
+ {
+ if (!*rvalue)
+ return;
+
+ ir_expression *expr = (*rvalue)->as_expression();
+ if (!expr)
+ return;
+
+ /* In the future, ir_unop_noise may be replaced by a call to a function
+ * that implements noise. No hardware has a noise instruction.
+ */
+ if (expr->operation == ir_unop_noise) {
+ *rvalue = ir_constant::zero(talloc_parent(expr), expr->type);
+ this->progress = true;
+ }
+ }
+
+ bool progress;
+};
+
+
+bool
+lower_noise(exec_list *instructions)
+{
+ lower_noise_visitor v;
+
+ visit_list_elements(&v, instructions);
+
+ return v.progress;
+}
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index cb9f8a5277..94c14a58a7 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -35,6 +35,7 @@
#include "ir_optimization.h"
#include "ir_print_visitor.h"
#include "program.h"
+#include "loop_analysis.h"
extern "C" struct gl_shader *
_mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
@@ -58,6 +59,41 @@ _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type)
return shader;
}
+static void
+initialize_context(GLcontext *ctx, gl_api api)
+{
+ memset(ctx, 0, sizeof(*ctx));
+
+ ctx->API = api;
+
+ ctx->Extensions.ARB_draw_buffers = GL_TRUE;
+ ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
+ ctx->Extensions.EXT_texture_array = GL_TRUE;
+ ctx->Extensions.NV_texture_rectangle = GL_TRUE;
+
+ /* 1.10 minimums. */
+ ctx->Const.MaxLights = 8;
+ ctx->Const.MaxClipPlanes = 8;
+ ctx->Const.MaxTextureUnits = 2;
+
+ /* More than the 1.10 minimum to appease parser tests taken from
+ * apps that (hopefully) already checked the number of coords.
+ */
+ ctx->Const.MaxTextureCoordUnits = 4;
+
+ ctx->Const.VertexProgram.MaxAttribs = 16;
+ ctx->Const.VertexProgram.MaxUniformComponents = 512;
+ ctx->Const.MaxVarying = 8;
+ ctx->Const.MaxVertexTextureImageUnits = 0;
+ ctx->Const.MaxCombinedTextureImageUnits = 2;
+ ctx->Const.MaxTextureImageUnits = 2;
+ ctx->Const.FragmentProgram.MaxUniformComponents = 64;
+
+ ctx->Const.MaxDrawBuffers = 2;
+
+ ctx->Driver.NewShader = _mesa_new_shader;
+}
+
/* Returned string will have 'ctx' as its talloc owner. */
static char *
load_text_file(void *ctx, const char *file_name)
@@ -108,12 +144,14 @@ usage_fail(const char *name)
}
+int glsl_es = 0;
int dump_ast = 0;
int dump_hir = 0;
int dump_lir = 0;
int do_link = 0;
const struct option compiler_opts[] = {
+ { "glsl-es", 0, &glsl_es, 1 },
{ "dump-ast", 0, &dump_ast, 1 },
{ "dump-hir", 0, &dump_hir, 1 },
{ "dump-lir", 0, &dump_lir, 1 },
@@ -122,14 +160,14 @@ const struct option compiler_opts[] = {
};
void
-compile_shader(struct gl_shader *shader)
+compile_shader(GLcontext *ctx, struct gl_shader *shader)
{
struct _mesa_glsl_parse_state *state =
- new(shader) _mesa_glsl_parse_state(NULL, shader->Type, shader);
+ new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
const char *source = shader->Source;
state->error = preprocess(state, &source, &state->info_log,
- state->extensions);
+ state->extensions, ctx->API);
if (!state->error) {
_mesa_glsl_lexer_ctor(state, source);
@@ -174,6 +212,11 @@ compile_shader(struct gl_shader *shader)
progress = do_vec_index_to_swizzle(shader->ir) || progress;
progress = do_vec_index_to_cond_assign(shader->ir) || progress;
progress = do_swizzle_swizzle(shader->ir) || progress;
+
+ loop_state *ls = analyze_loop_variables(shader->ir);
+ progress = set_loop_controls(shader->ir, ls) || progress;
+ progress = unroll_loops(shader->ir, ls, 32) || progress;
+ delete ls;
} while (progress);
validate_ir_tree(shader->ir);
@@ -212,8 +255,6 @@ main(int argc, char **argv)
GLcontext local_ctx;
GLcontext *ctx = &local_ctx;
- ctx->Driver.NewShader = _mesa_new_shader;
-
int c;
int idx = 0;
while ((c = getopt_long(argc, argv, "", compiler_opts, &idx)) != -1)
@@ -223,6 +264,8 @@ main(int argc, char **argv)
if (argc <= optind)
usage_fail(argv[0]);
+ initialize_context(ctx, (glsl_es) ? API_OPENGLES2 : API_OPENGL);
+
struct gl_shader_program *whole_program;
whole_program = talloc_zero (NULL, struct gl_shader_program);
@@ -259,7 +302,7 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}
- compile_shader(shader);
+ compile_shader(ctx, shader);
if (!shader->CompileStatus) {
printf("Info log for %s:\n%s\n", argv[optind], shader->InfoLog);
diff --git a/src/glsl/opt_redundant_jumps.cpp b/src/glsl/opt_redundant_jumps.cpp
new file mode 100644
index 0000000000..edf4bb6c22
--- /dev/null
+++ b/src/glsl/opt_redundant_jumps.cpp
@@ -0,0 +1,111 @@
+/*
+ * Copyright © 2010 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file opt_redundant_jumps.cpp
+ * Remove certain types of redundant jumps
+ */
+
+#include "ir.h"
+
+class redundant_jumps_visitor : public ir_hierarchical_visitor {
+public:
+ redundant_jumps_visitor()
+ {
+ this->progress = false;
+ }
+
+ virtual ir_visitor_status visit_leave(ir_if *);
+ virtual ir_visitor_status visit_leave(ir_loop *);
+
+ bool progress;
+};
+
+
+ir_visitor_status
+redundant_jumps_visitor::visit_leave(ir_if *ir)
+{
+ /* If the last instruction in both branches is a 'break' or a 'continue',
+ * pull it out of the branches and insert it after the if-statment. Note
+ * that both must be the same type (either 'break' or 'continue').
+ */
+ ir_instruction *const last_then =
+ (ir_instruction *) ir->then_instructions.get_tail();
+ ir_instruction *const last_else =
+ (ir_instruction *) ir->else_instructions.get_tail();
+
+ if ((last_then == NULL) || (last_else == NULL))
+ return visit_continue;
+
+ if ((last_then->ir_type != ir_type_loop_jump)
+ || (last_else->ir_type != ir_type_loop_jump))
+ return visit_continue;
+
+ ir_loop_jump *const then_jump = (ir_loop_jump *) last_then;
+ ir_loop_jump *const else_jump = (ir_loop_jump *) last_else;
+
+ if (then_jump->mode != else_jump->mode)
+ return visit_continue;
+
+ then_jump->remove();
+ else_jump->remove();
+ this->progress = true;
+
+ ir->insert_after(then_jump);
+
+ /* If both branchs of the if-statement are now empty, remove the
+ * if-statement.
+ */
+ if (ir->then_instructions.is_empty() && ir->else_instructions.is_empty())
+ ir->remove();
+
+ return visit_continue;
+}
+
+
+ir_visitor_status
+redundant_jumps_visitor::visit_leave(ir_loop *ir)
+{
+ /* If the last instruction of a loop body is a 'continue', remove it.
+ */
+ ir_instruction *const last =
+ (ir_instruction *) ir->body_instructions.get_tail();
+
+ if (last && (last->ir_type == ir_type_loop_jump)
+ && (((ir_loop_jump *) last)->mode == ir_loop_jump::jump_continue)) {
+ last->remove();
+ this->progress = true;
+ }
+
+ return visit_continue;
+}
+
+
+bool
+optimize_redundant_jumps(exec_list *instructions)
+{
+ redundant_jumps_visitor v;
+
+ v.run(instructions);
+ return v.progress;
+}
diff --git a/src/glx/Makefile b/src/glx/Makefile
index ba5708ffed..2c94ef1cd4 100644
--- a/src/glx/Makefile
+++ b/src/glx/Makefile
@@ -1,7 +1,11 @@
TOP = ../..
include $(TOP)/configs/current
-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT \
+ifeq ($(HAVE_XF86VIDMODE),yes)
+EXTRA_DEFINES_XF86VIDMODE = -DXF86VIDMODE
+endif
+
+EXTRA_DEFINES = $(EXTRA_DEFINES_XF86VIDMODE) -D_REENTRANT \
-DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\"
SOURCES = \
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index d70ec5a3ec..30999c899a 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -103,7 +103,7 @@ DRI2WireToEvent(Display *dpy, XEvent *event, xEvent *wire)
/* Ignore swap events if we're not looking for them */
pdraw = dri2GetGlxDrawableFromXDrawableId(dpy, awire->drawable);
- if (!(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
+ if (!pdraw || !(pdraw->eventMask & GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK))
return False;
aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire);
@@ -175,6 +175,14 @@ DRI2Error(Display *display, xError *err, XExtCodes *codes, int *ret_code)
err->minorCode == X_DRI2CopyRegion)
return True;
+ /* If the X drawable was destroyed before the GLX drawable, the
+ * DRI2 drawble will be gone by the time we call
+ * DRI2DestroyDrawable. So just ignore BadDrawable here. */
+ if (err->majorCode == codes->major_opcode &&
+ err->errorCode == BadDrawable &&
+ err->minorCode == X_DRI2DestroyDrawable)
+ return True;
+
return False;
}
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index ff48c79c27..8247588e76 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -124,8 +124,6 @@ dri2_destroy_context(struct glx_context *context)
if (context->extensions)
XFree((char *) context->extensions);
- GarbageCollectDRIDrawables(context->psc);
-
(*psc->core->destroyContext) (pcp->driContext);
Xfree(pcp);
@@ -159,6 +157,8 @@ dri2_unbind_context(struct glx_context *context, struct glx_context *new)
struct dri2_screen *psc = (struct dri2_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
+
+ driReleaseDrawables(&pcp->base);
}
static struct glx_context *
@@ -210,7 +210,17 @@ dri2DestroyDrawable(__GLXDRIdrawable *base)
__glxHashDelete(pdp->dri2Hash, pdraw->base.xDrawable);
(*psc->core->destroyDrawable) (pdraw->driDrawable);
- DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable);
+
+ /* If it's a GLX 1.3 drawables, we can destroy the DRI2 drawable
+ * now, as the application explicitly asked to destroy the GLX
+ * drawable. Otherwise, for legacy drawables, we let the DRI2
+ * drawable linger on the server, since there's no good way of
+ * knowing when the application is done with it. The server will
+ * destroy the DRI2 drawable when it destroys the X drawable or the
+ * client exits anyway. */
+ if (pdraw->base.xDrawable != pdraw->base.drawable)
+ DRI2DestroyDrawable(psc->base.dpy, pdraw->base.xDrawable);
+
Xfree(pdraw);
}
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index a7fb4c6424..5fb5255416 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -380,4 +380,29 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable)
return pdraw;
}
+_X_HIDDEN void
+driReleaseDrawables(struct glx_context *gc)
+{
+ struct glx_display *const priv = __glXInitialize(gc->psc->dpy);
+ __GLXDRIdrawable *pdraw;
+
+ if (priv == NULL)
+ return;
+
+ if (__glxHashLookup(priv->drawHash,
+ gc->currentDrawable, (void *) &pdraw) == 0) {
+ if (pdraw->drawable == pdraw->xDrawable)
+ (*pdraw->destroyDrawable)(pdraw);
+ __glxHashDelete(priv->drawHash, gc->currentDrawable);
+ }
+
+ if (gc->currentDrawable != gc->currentReadable &&
+ __glxHashLookup(priv->drawHash,
+ gc->currentReadable, (void *) &pdraw) == 0) {
+ if (pdraw->drawable == pdraw->xDrawable)
+ (*pdraw->destroyDrawable)(pdraw);
+ __glxHashDelete(priv->drawHash, gc->currentReadable);
+ }
+}
+
#endif /* GLX_DIRECT_RENDERING */
diff --git a/src/glx/dri_common.h b/src/glx/dri_common.h
index 846a905a88..13b5ae471d 100644
--- a/src/glx/dri_common.h
+++ b/src/glx/dri_common.h
@@ -55,6 +55,9 @@ extern void driDestroyConfigs(const __DRIconfig **configs);
extern __GLXDRIdrawable *
driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable);
+extern void
+driReleaseDrawables(struct glx_context *gc);
+
extern const __DRIsystemTimeExtension systemTimeExtension;
extern void InfoMessageF(const char *f, ...);
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 43a2aa495a..42b263c637 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -509,8 +509,6 @@ dri_destroy_context(struct glx_context * context)
if (context->extensions)
XFree((char *) context->extensions);
- GarbageCollectDRIDrawables(context->psc);
-
(*psc->core->destroyContext) (pcp->driContext);
XF86DRIDestroyContext(psc->base.dpy, psc->base.scr, pcp->hwContextID);
@@ -545,6 +543,8 @@ dri_unbind_context(struct glx_context *context, struct glx_context *new)
struct dri_screen *psc = (struct dri_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
+
+ driReleaseDrawables(&pcp->base);
}
static const struct glx_context_vtable dri_context_vtable = {
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index c5b179157b..237ce17617 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -250,8 +250,6 @@ drisw_destroy_context(struct glx_context *context)
if (context->extensions)
XFree((char *) context->extensions);
- GarbageCollectDRIDrawables(context->psc);
-
(*psc->core->destroyContext) (pcp->driContext);
Xfree(pcp);
@@ -285,6 +283,8 @@ drisw_unbind_context(struct glx_context *context, struct glx_context *new)
struct drisw_screen *psc = (struct drisw_screen *) pcp->base.psc;
(*psc->core->unbindContext) (pcp->driContext);
+
+ driReleaseDrawables(&pcp->base);
}
static const struct glx_context_vtable drisw_context_vtable = {
diff --git a/src/glx/glx_pbuffer.c b/src/glx/glx_pbuffer.c
index 15bfb15919..34892e8b1a 100644
--- a/src/glx/glx_pbuffer.c
+++ b/src/glx/glx_pbuffer.c
@@ -86,7 +86,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
const CARD32 * attribs, size_t num_attribs)
{
struct glx_display *priv = __glXInitialize(dpy);
+#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw;
+#endif
CARD32 *output;
CARD8 opcode;
int i;
@@ -95,8 +97,6 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
return;
}
- pdraw = GetGLXDRIDrawable(dpy, drawable);
-
opcode = __glXSetupForCommand(dpy);
if (!opcode)
return;
@@ -133,6 +133,9 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
UnlockDisplay(dpy);
SyncHandle();
+#ifdef GLX_DIRECT_RENDERING
+ pdraw = GetGLXDRIDrawable(dpy, drawable);
+
for (i = 0; i < num_attribs; i++) {
switch(attribs[i * 2]) {
case GLX_EVENT_MASK:
@@ -141,6 +144,7 @@ ChangeDrawableAttribute(Display * dpy, GLXDrawable drawable,
break;
}
}
+#endif
return;
}
@@ -216,12 +220,14 @@ DestroyDRIDrawable(Display *dpy, GLXDrawable drawable, int destroy_xdrawable)
{
struct glx_display *const priv = __glXInitialize(dpy);
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
+ XID xid;
if (pdraw != NULL) {
- if (destroy_xdrawable)
- XFreePixmap(pdraw->psc->dpy, pdraw->xDrawable);
+ xid = pdraw->xDrawable;
(*pdraw->destroyDrawable) (pdraw);
__glxHashDelete(priv->drawHash, drawable);
+ if (destroy_xdrawable)
+ XFreePixmap(priv->dpy, xid);
}
}
diff --git a/src/glx/glxclient.h b/src/glx/glxclient.h
index 81c9a26669..b453e6dbd0 100644
--- a/src/glx/glxclient.h
+++ b/src/glx/glxclient.h
@@ -260,6 +260,8 @@ struct glx_context
GLint bufSize;
/*@} */
+ const struct glx_context_vtable *vtable;
+
/**
* The XID of this rendering context. When the context is created a
* new XID is allocated. This is set to None when the context is
@@ -423,8 +425,6 @@ struct glx_context
unsigned long thread_id;
char gl_extension_bits[__GL_EXT_BYTES];
-
- const struct glx_context_vtable *vtable;
};
extern Bool
@@ -494,13 +494,13 @@ struct glx_screen
struct glx_display *display;
+ Display *dpy;
+ int scr;
+
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
/**
* Per screen direct rendering interface functions and data.
*/
- Display *dpy;
- int scr;
-
__GLXDRIscreen *driScreen;
#endif
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index d4aa8b5866..4f7e84ef5f 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -44,7 +44,9 @@
#include "glx_error.h"
#else
#include <sys/time.h>
+#ifdef XF86VIDMODE
#include <X11/extensions/xf86vmode.h>
+#endif
#include "xf86dri.h"
#endif
#else
@@ -61,56 +63,6 @@ static const char __glXGLXClientVersion[] = "1.4";
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
-static Bool windowExistsFlag;
-static int
-windowExistsErrorHandler(Display * dpy, XErrorEvent * xerr)
-{
- (void) dpy;
-
- if (xerr->error_code == BadWindow) {
- windowExistsFlag = GL_FALSE;
- }
- return 0;
-}
-
-/**
- * Find drawables in the local hash that have been destroyed on the
- * server.
- *
- * \param dpy Display to destroy drawables for
- * \param screen Screen number to destroy drawables for
- */
-_X_HIDDEN void
-GarbageCollectDRIDrawables(struct glx_screen * sc)
-{
- XID draw;
- __GLXDRIdrawable *pdraw;
- struct glx_display *priv = sc->display;
- XWindowAttributes xwa;
- int (*oldXErrorHandler) (Display *, XErrorEvent *);
-
- /* Set no-op error handler so Xlib doesn't bail out if the windows
- * has alreay been destroyed on the server. */
- XSync(priv->dpy, GL_FALSE);
- oldXErrorHandler = XSetErrorHandler(windowExistsErrorHandler);
-
- if (__glxHashFirst(priv->drawHash, &draw, (void *) &pdraw) == 1) {
- do {
- windowExistsFlag = GL_TRUE;
- XGetWindowAttributes(priv->dpy, draw, &xwa); /* dummy request */
- if (!windowExistsFlag) {
- /* Destroy the local drawable data, if the drawable no
- longer exists in the Xserver */
- (*pdraw->destroyDrawable) (pdraw);
- __glxHashDelete(priv->drawHash, draw);
- }
- } while (__glxHashNext(priv->drawHash, &draw, (void *) &pdraw) == 1);
- }
-
- XSync(priv->dpy, GL_FALSE);
- XSetErrorHandler(oldXErrorHandler);
-}
-
/**
* Get the __DRIdrawable for the drawable associated with a GLXContext
*
@@ -2063,15 +2015,9 @@ __glxGetMscRate(__GLXDRIdrawable *glxDraw,
return True;
}
else
- return False;
-#else
- (void) draw;
- (void) numerator;
- (void) denominator;
- (void) private;
+#endif
return False;
-#endif
}
#endif
@@ -2161,9 +2107,9 @@ __glXWaitForMscOML(Display * dpy, GLXDrawable drawable,
{
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-#endif
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
int ret;
+#endif
/* The OML_sync_control spec says these should "generate a GLX_BAD_VALUE
@@ -2193,9 +2139,9 @@ __glXWaitForSbcOML(Display * dpy, GLXDrawable drawable,
{
#ifdef GLX_DIRECT_RENDERING
__GLXDRIdrawable *pdraw = GetGLXDRIDrawable(dpy, drawable);
-#endif
struct glx_screen *psc = pdraw ? pdraw->psc : NULL;
int ret;
+#endif
/* The OML_sync_control spec says this should "generate a GLX_BAD_VALUE
* error", but the return type in the spec is Bool.
diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c
index e2569974c2..3631738354 100644
--- a/src/glx/glxcurrent.c
+++ b/src/glx/glxcurrent.c
@@ -53,7 +53,7 @@
*/
static GLubyte dummyBuffer[__GLX_BUFFER_LIMIT_SIZE];
-
+static struct glx_context_vtable dummyVtable;
/*
** Dummy context used by small commands when there is no current context.
** All the
@@ -66,6 +66,7 @@ struct glx_context dummyContext = {
&dummyBuffer[0],
&dummyBuffer[__GLX_BUFFER_LIMIT_SIZE],
sizeof(dummyBuffer),
+ &dummyVtable
};
/*
@@ -241,31 +242,36 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
return False;
}
- if (oldGC != &dummyContext && oldGC != gc) {
+ if (oldGC == gc &&
+ gc->currentDrawable == draw && gc->currentReadable == read)
+ return True;
+
+ if (oldGC != &dummyContext) {
oldGC->vtable->unbind(oldGC, gc);
oldGC->currentDpy = 0;
oldGC->currentDrawable = None;
oldGC->currentReadable = None;
oldGC->thread_id = 0;
- if (oldGC->xid == None)
- /* We are switching away from a context that was
- * previously destroyed, so we need to free the memory
- * for the old handle.
- */
- oldGC->vtable->destroy(oldGC);
}
if (gc) {
- ret = gc->vtable->bind(gc, oldGC, draw, read);
gc->currentDpy = dpy;
gc->currentDrawable = draw;
gc->currentReadable = read;
gc->thread_id = _glthread_GetID();
__glXSetCurrentContext(gc);
+ ret = gc->vtable->bind(gc, oldGC, draw, read);
} else {
__glXSetCurrentContextNull();
}
+ if (oldGC != &dummyContext && oldGC->xid == None && oldGC != gc) {
+ /* We are switching away from a context that was
+ * previously destroyed, so we need to free the memory
+ * for the old handle. */
+ oldGC->vtable->destroy(oldGC);
+ }
+
if (ret) {
__glXGenerateError(dpy, gc, None, ret, X_GLXMakeContextCurrent);
return GL_FALSE;
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 9e42d83c4d..c5e9d0510b 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -41,7 +41,6 @@
#include "glxclient.h"
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
-#include <X11/extensions/dri2proto.h>
#ifdef GLX_USE_APPLEGL
#include "apple_glx.h"
#include "apple_visual.h"
@@ -131,16 +130,6 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
aevent->count = awire->count;
return True;
}
- /* No easy symbol to test for this, as GLX_BufferSwapComplete is
- * defined in the local glx.h header, but the
- * xGLXBufferSwapComplete typedef is only available in new versions
- * of the external glxproto.h header, which doesn't have any
- * testable versioning define.
- *
- * I'll use the related DRI2 define, in the hope that we won't
- * receive these events unless we know how to ask for them:
- */
-#ifdef X_DRI2SwapBuffers
case GLX_BufferSwapComplete:
{
GLXBufferSwapComplete *aevent = (GLXBufferSwapComplete *)event;
@@ -152,7 +141,6 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire)
aevent->sbc = ((CARD64)awire->sbc_hi << 32) | awire->sbc_lo;
return True;
}
-#endif
default:
/* client doesn't support server event */
break;
@@ -249,9 +237,9 @@ glx_display_free(struct glx_display *priv)
if (priv->serverGLXversion)
Xfree((char *) priv->serverGLXversion);
+#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
__glxHashDestroy(priv->drawHash);
-#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
/* Free the direct rendering per display data */
if (priv->driswDisplay)
(*priv->driswDisplay->destroyDisplay) (priv->driswDisplay);
diff --git a/src/glx/indirect.c b/src/glx/indirect.c
index c0fff6c4dc..2b09c1c3b5 100644
--- a/src/glx/indirect.c
+++ b/src/glx/indirect.c
@@ -91,7 +91,7 @@ __glXReadReply(Display * dpy, size_t size, void *dest,
}
NOINLINE void
-__glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
+__glXReadPixelReply(Display * dpy, struct glx_context *gc, unsigned max_dim,
GLint width, GLint height, GLint depth, GLenum format,
GLenum type, void *dest, GLboolean dimensions_in_reply)
{
@@ -138,7 +138,7 @@ __glXReadPixelReply(Display * dpy, struct glx_context * gc, unsigned max_dim,
#define X_GLXSingle 0
NOINLINE FASTCALL GLubyte *
-__glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen)
+__glXSetupSingleRequest(struct glx_context *gc, GLint sop, GLint cmdlen)
{
xGLXSingleReq *req;
Display *const dpy = gc->currentDpy;
@@ -153,7 +153,7 @@ __glXSetupSingleRequest(struct glx_context * gc, GLint sop, GLint cmdlen)
}
NOINLINE FASTCALL GLubyte *
-__glXSetupVendorRequest(struct glx_context * gc, GLint code, GLint vop,
+__glXSetupVendorRequest(struct glx_context *gc, GLint code, GLint vop,
GLint cmdlen)
{
xGLXVendorPrivateReq *req;
diff --git a/src/glx/indirect.h b/src/glx/indirect.h
index 36d68b066c..282de75c40 100644
--- a/src/glx/indirect.h
+++ b/src/glx/indirect.h
@@ -600,7 +600,7 @@ extern HIDDEN void __indirect_glSecondaryColor3uivEXT(const GLuint * v);
extern HIDDEN void __indirect_glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue);
extern HIDDEN void __indirect_glSecondaryColor3usvEXT(const GLushort * v);
extern HIDDEN void __indirect_glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer);
-extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount);
+extern HIDDEN void __indirect_glMultiDrawArraysEXT(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount);
extern HIDDEN void __indirect_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount);
extern HIDDEN void __indirect_glFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid * pointer);
extern HIDDEN void __indirect_glFogCoorddEXT(GLdouble coord);
diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index f0598409cd..1870edee37 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -137,10 +137,12 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old,
Display *dpy = gc->psc->dpy;
int opcode = __glXSetupForCommand(dpy);
- if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy)
+ if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) {
tag = old->currentContextTag;
- else
- tag = None;
+ old->currentContextTag = 0;
+ } else {
+ tag = 0;
+ }
SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, &reply);
@@ -166,14 +168,18 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new)
int opcode = __glXSetupForCommand(dpy);
xGLXMakeCurrentReply reply;
+ if (gc == new)
+ return;
+
/* We are either switching to no context, away from a indirect
* context to a direct context or from one dpy to another and have
* to send a request to the dpy to unbind the previous context.
*/
- if (!new || new->isDirect || new->psc->dpy != dpy)
+ if (!new || new->isDirect || new->psc->dpy != dpy) {
SendMakeCurrentRequest(dpy, opcode, None,
gc->currentContextTag, None, None, &reply);
- gc->currentContextTag = 0;
+ gc->currentContextTag = 0;
+ }
}
static void
diff --git a/src/glx/indirect_init.c b/src/glx/indirect_init.c
index ea05188398..9f1ee5930f 100644
--- a/src/glx/indirect_init.c
+++ b/src/glx/indirect_init.c
@@ -53,7 +53,7 @@ static int NoOp(void)
* Create and initialize a new GL dispatch table. The table is initialized
* with GLX indirect rendering protocol functions.
*/
-struct _glapi_table *__glXNewIndirectAPI( void )
+struct _glapi_table * __glXNewIndirectAPI( void )
{
struct _glapi_table *glAPI;
GLuint entries;
diff --git a/src/glx/indirect_vertex_array.c b/src/glx/indirect_vertex_array.c
index 372618de4f..115f755bb7 100644
--- a/src/glx/indirect_vertex_array.c
+++ b/src/glx/indirect_vertex_array.c
@@ -1034,8 +1034,8 @@ __indirect_glDrawRangeElements(GLenum mode, GLuint start, GLuint end,
void
-__indirect_glMultiDrawArraysEXT(GLenum mode, GLint * first, GLsizei * count,
- GLsizei primcount)
+__indirect_glMultiDrawArraysEXT(GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount)
{
struct glx_context *gc = __glXGetCurrentContext();
const __GLXattribute *state =
diff --git a/src/mapi/glapi/gen-es/es_EXT.xml b/src/mapi/glapi/gen-es/es_EXT.xml
index 113d8d74dd..0013df87e8 100644
--- a/src/mapi/glapi/gen-es/es_EXT.xml
+++ b/src/mapi/glapi/gen-es/es_EXT.xml
@@ -106,8 +106,8 @@
<category name="GL_EXT_multi_draw_arrays" number="69">
<function name="MultiDrawArraysEXT" offset="assign">
<param name="mode" type="GLenum"/>
- <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
- <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
+ <param name="first" type="const GLint *"/>
+ <param name="count" type="const GLsizei *"/>
<param name="primcount" type="GLsizei"/>
<glx handcode="true"/>
</function>
diff --git a/src/mapi/glapi/gen/Makefile b/src/mapi/glapi/gen/Makefile
index 586c302f18..41640b3b04 100644
--- a/src/mapi/glapi/gen/Makefile
+++ b/src/mapi/glapi/gen/Makefile
@@ -106,7 +106,7 @@ xorg: check-xorg-source $(XORG_OUTPUTS)
check-xorg-source:
@if ! test -d $(XORG_GLX_DIR); then \
- echo "ERROR: Must specify path to xserver/GL/GLX checkout; set XORG_GLX_DIR."; \
+ echo "ERROR: Must specify path to xserver/GL/ checkout; set XORG_BASE env var."; \
exit 1; \
fi
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index 71a1a8c013..5cf216c91f 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -4666,8 +4666,8 @@
<function name="MultiDrawArrays" alias="MultiDrawArraysEXT">
<param name="mode" type="GLenum"/>
- <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
- <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
+ <param name="first" type="const GLint *"/>
+ <param name="count" type="const GLsizei *"/>
<param name="primcount" type="GLsizei"/>
</function>
@@ -9794,8 +9794,8 @@
<category name="GL_EXT_multi_draw_arrays" number="148">
<function name="MultiDrawArraysEXT" offset="assign">
<param name="mode" type="GLenum"/>
- <param name="first" type="GLint *"/> <!-- Spec bug. Should be const. -->
- <param name="count" type="GLsizei *"/> <!-- Spec bug. Should be const. -->
+ <param name="first" type="const GLint *"/>
+ <param name="count" type="const GLsizei *"/>
<param name="primcount" type="GLsizei"/>
<glx handcode="true"/>
</function>
diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index 89f81c723e..3ab553a2b8 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -38,7 +38,7 @@
#include "GL/gl.h"
#include "GL/glext.h"
-#ifndef GL_FIXED
+#ifndef GL_OES_fixed_point
typedef int GLfixed;
typedef int GLclampx;
#endif
diff --git a/src/mapi/glapi/glapidispatch.h b/src/mapi/glapi/glapidispatch.h
index f8a68ee302..0c19d90294 100644
--- a/src/mapi/glapi/glapidispatch.h
+++ b/src/mapi/glapi/glapidispatch.h
@@ -3625,7 +3625,7 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ];
#define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters)
#define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index])
#define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn)
-#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters)
+#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *, const GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters)
#define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index])
#define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn)
#define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters)
diff --git a/src/mapi/glapi/glapitable.h b/src/mapi/glapi/glapitable.h
index 7da958981a..7c8da64ab1 100644
--- a/src/mapi/glapi/glapitable.h
+++ b/src/mapi/glapi/glapitable.h
@@ -667,7 +667,7 @@ struct _glapi_table
void (GLAPIENTRYP SecondaryColor3usEXT)(GLushort red, GLushort green, GLushort blue); /* 624 */
void (GLAPIENTRYP SecondaryColor3usvEXT)(const GLushort * v); /* 625 */
void (GLAPIENTRYP SecondaryColorPointerEXT)(GLint size, GLenum type, GLsizei stride, const GLvoid * pointer); /* 626 */
- void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount); /* 627 */
+ void (GLAPIENTRYP MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); /* 627 */
void (GLAPIENTRYP MultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const GLvoid ** indices, GLsizei primcount); /* 628 */
void (GLAPIENTRYP FogCoordPointerEXT)(GLenum type, GLsizei stride, const GLvoid * pointer); /* 629 */
void (GLAPIENTRYP FogCoorddEXT)(GLdouble coord); /* 630 */
diff --git a/src/mapi/glapi/glapitemp.h b/src/mapi/glapi/glapitemp.h
index f27f6ab22b..2050e213d8 100644
--- a/src/mapi/glapi/glapitemp.h
+++ b/src/mapi/glapi/glapitemp.h
@@ -4336,12 +4336,12 @@ KEYWORD1 void KEYWORD2 NAME(SecondaryColorPointerEXT)(GLint size, GLenum type, G
DISPATCH(SecondaryColorPointerEXT, (size, type, stride, pointer), (F, "glSecondaryColorPointerEXT(%d, 0x%x, %d, %p);\n", size, type, stride, (const void *) pointer));
}
-KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount)
+KEYWORD1 void KEYWORD2 NAME(MultiDrawArrays)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount)
{
DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArrays(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount));
}
-KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, GLint * first, GLsizei * count, GLsizei primcount)
+KEYWORD1 void KEYWORD2 NAME(MultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount)
{
DISPATCH(MultiDrawArraysEXT, (mode, first, count, primcount), (F, "glMultiDrawArraysEXT(0x%x, %p, %p, %d);\n", mode, (const void *) first, (const void *) count, primcount));
}
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index ef31fd24f0..c41c38cba6 100644
--- a/src/mesa/Makefile
+++ b/src/mesa/Makefile
@@ -16,16 +16,6 @@ MESA_OBJ_DIR := .
ES1_OBJ_DIR := objs-es1
ES2_OBJ_DIR := objs-es2
-MESA_CPPFLAGS := $(API_DEFINES)
-ES1_CPPFLAGS := -DFEATURE_ES1=1
-ES2_CPPFLAGS := -DFEATURE_ES2=1
-
-ifeq ($(MESA_LLVM),1)
-MESA_CPPFLAGS += $(LLVM_CFLAGS)
-ES1_CPPFLAGS += $(LLVM_CFLAGS)
-ES2_CPPFLAGS += $(LLVM_CFLAGS)
-endif
-
include sources.mak
@@ -38,24 +28,33 @@ ES1_GALLIUM_OBJECTS := $(addprefix $(ES1_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
ES2_GALLIUM_OBJECTS := $(addprefix $(ES2_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
MESA_GALLIUM_OBJECTS := $(addprefix $(MESA_OBJ_DIR)/, $(MESA_GALLIUM_OBJECTS))
-# adjust include dirs
-MESA_INCLUDES := $(INCLUDE_DIRS)
-ES1_INCLUDES := -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
-ES2_INCLUDES := -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
-MESA_INCLUDES := -I$(TOP)/src/glsl $(MESA_INCLUDES)
-ES1_INCLUDES := -I$(TOP)/src/glsl $(ES1_INCLUDES)
-ES2_INCLUDES := -I$(TOP)/src/glsl $(ES2_INCLUDES)
-# For symbol_table.h in glsl compiler headers.
-MESA_INCLUDES := -I$(TOP)/src/mesa/shader $(MESA_INCLUDES)
+# define preprocessor flags
+MESA_CPPFLAGS := $(API_DEFINES) $(DEFINES)
+ES1_CPPFLAGS := -DFEATURE_ES1=1 $(DEFINES)
+ES2_CPPFLAGS := -DFEATURE_ES2=1 $(DEFINES)
+
+# append include dirs
+MESA_CPPFLAGS += $(INCLUDE_DIRS)
+ES1_CPPFLAGS += -I$(TOP)/src/mapi/es1api $(INCLUDE_DIRS)
+ES2_CPPFLAGS += -I$(TOP)/src/mapi/es2api $(INCLUDE_DIRS)
+
+# tidy compiler flags
+CFLAGS := $(filter-out $(DEFINES), $(CFLAGS))
+CXXFLAGS := $(filter-out $(DEFINES), $(CXXFLAGS))
+
+# LLVM is needed for the state tracker
+MESA_CFLAGS := $(LLVM_CFLAGS)
+ES1_CFLAGS := $(LLVM_CFLAGS)
+ES2_CFLAGS := $(LLVM_CFLAGS)
define mesa-cc-c
@mkdir -p $(dir $@)
- $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_INCLUDES) $(CFLAGS)
+ $(CC) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CFLAGS)
endef
define mesa-cxx-c
@mkdir -p $(dir $@)
- $(CXX) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_INCLUDES) $(CXXFLAGS)
+ $(CXX) -c -o $@ $< $($(1)_CPPFLAGS) $($(1)_CFLAGS) $(CXXFLAGS)
endef
$(MESA_OBJ_DIR)/%.o: %.c
@@ -144,22 +143,20 @@ asm_subdirs:
depend: $(ALL_SOURCES)
@ echo "running $(MKDEP)"
@ touch depend
- @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(DEFINES) \
- $(INCLUDE_DIRS) $(ALL_SOURCES) > /dev/null 2>/dev/null
+ @$(MKDEP) $(MKDEP_OPTIONS) -p$(MESA_OBJ_DIR)/ $(MESA_CPPFLAGS) \
+ $(ALL_SOURCES) > /dev/null 2>/dev/null
depend.es1: $(ALL_SOURCES)
@echo "running $(MKDEP) for ES1"
@touch $@
- @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(DEFINES) \
- $(ES1_CPPFLAGS) $(ES1_INCLUDES) $(ALL_SOURCES) \
- > /dev/null 2>/dev/null
+ @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES1_OBJ_DIR)/ $(ES1_CPPFLAGS) \
+ $(ALL_SOURCES) > /dev/null 2>/dev/null
depend.es2: $(ALL_SOURCES)
@echo "running $(MKDEP) for ES2"
@touch $@
- @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(DEFINES) \
- $(ES2_CPPFLAGS) $(ES2_INCLUDES) $(ALL_SOURCES) \
- > /dev/null 2>/dev/null
+ @$(MKDEP) $(MKDEP_OPTIONS) -f$@ -p$(ES2_OBJ_DIR)/ $(ES2_CPPFLAGS) \
+ $(ALL_SOURCES) > /dev/null 2>/dev/null
######################################################################
# Installation rules
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 227710fb02..f92cdc5a77 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -38,19 +38,11 @@
#include "main/teximage.h"
#include "main/texobj.h"
#include "main/texstore.h"
-#if FEATURE_ARB_vertex_buffer_object
#include "main/bufferobj.h"
-#endif
-#if FEATURE_EXT_framebuffer_object
#include "main/fbobject.h"
#include "main/texrender.h"
-#endif
-#if FEATURE_ARB_sync
#include "main/syncobj.h"
-#endif
-#if FEATURE_EXT_transform_feedback
#include "main/transformfeedback.h"
-#endif
#include "program/program.h"
#include "tnl/tnl.h"
@@ -187,21 +179,15 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
/* query objects */
_mesa_init_query_object_functions(driver);
-#if FEATURE_ARB_sync
_mesa_init_sync_object_functions(driver);
-#endif
-#if FEATURE_EXT_framebuffer_object
driver->NewFramebuffer = _mesa_new_framebuffer;
driver->NewRenderbuffer = _mesa_new_soft_renderbuffer;
driver->RenderTexture = _mesa_render_texture;
driver->FinishRenderTexture = _mesa_finish_render_texture;
driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer;
-#endif
-#if FEATURE_EXT_framebuffer_blit
driver->BlitFramebuffer = _swrast_BlitFramebuffer;
-#endif
/* APPLE_vertex_array_object */
driver->NewArrayObject = _mesa_new_array_object;
@@ -210,9 +196,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
_mesa_init_shader_object_functions(driver);
-#if FEATURE_EXT_transform_feedback
_mesa_init_transform_feedback_functions(driver);
-#endif
/* T&L stuff */
driver->NeedValidate = GL_FALSE;
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index dc6e7120c6..a03cb68ec8 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -2583,12 +2583,10 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Prepare for new texture image size/data
*/
-#if FEATURE_convolve
if (_mesa_is_color_format(internalFormat)) {
_mesa_adjust_image_for_convolution(ctx, 2,
&postConvWidth, &postConvHeight);
}
-#endif
if (texImage->Data) {
ctx->Driver.FreeTexImageData(ctx, texImage);
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index a581c6663f..f07c3da4bb 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -635,6 +635,7 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
__DRIcontext *shared, void *data)
{
__DRIcontext *context;
+ const __GLcontextModes *modes = (config != NULL) ? &config->modes : NULL;
void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
gl_api mesa_api;
@@ -651,6 +652,8 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
case __DRI_API_GLES2:
mesa_api = API_OPENGLES2;
break;
+ default:
+ return NULL;
}
context = malloc(sizeof *context);
@@ -661,7 +664,7 @@ dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
context->driDrawablePriv = NULL;
context->loaderPrivate = data;
- if (!(*screen->DriverAPI.CreateContext)(api, &config->modes,
+ if (!(*screen->DriverAPI.CreateContext)(mesa_api, modes,
context, shareCtx) ) {
free(context);
return NULL;
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index d8715cf026..450e66e0d3 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -174,7 +174,12 @@ i915CreateContext(int api,
ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;
- ctx->Shader.EmitNoIfs = GL_TRUE;
+ /* FINISHME: Are there other options that should be enabled for software
+ * FINISHME: vertex shaders?
+ */
+ ctx->ShaderCompilerOptions[MESA_SHADER_VERTEX].EmitCondCodes = GL_TRUE;
+ ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoIfs = GL_TRUE;
+ ctx->ShaderCompilerOptions[MESA_SHADER_FRAGMENT].EmitNoNoise = GL_TRUE;
ctx->Const.MaxDrawBuffers = 1;
diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c
index 4a2e6209d0..31988f3d81 100644
--- a/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ b/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -680,21 +680,6 @@ upload_program(struct i915_fragment_program *p)
EMIT_2ARG_ARITH(A0_MUL);
break;
- case OPCODE_NOISE1:
- case OPCODE_NOISE2:
- case OPCODE_NOISE3:
- case OPCODE_NOISE4:
- /* Don't implement noise because we just don't have the instructions
- * to spare. We aren't the first vendor to do so.
- */
- i915_program_error(p, "Stubbed-out noise functions");
- i915_emit_arith(p,
- A0_MOV,
- get_result_vector(p, inst),
- get_result_flags(inst), 0,
- swizzle(tmp, ZERO, ZERO, ZERO, ZERO), 0, 0);
- break;
-
case OPCODE_POW:
src0 = src_vector(p, &inst->SrcReg[0], program);
src1 = src_vector(p, &inst->SrcReg[1], program);
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d2b20165f9..de78400d42 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -66,6 +66,7 @@ GLboolean brwCreateContext( int api,
struct brw_context *brw = (struct brw_context *) CALLOC_STRUCT(brw_context);
struct intel_context *intel = &brw->intel;
GLcontext *ctx = &intel->ctx;
+ unsigned i;
if (!brw) {
printf("%s: failed to alloc context\n", __FUNCTION__);
@@ -110,8 +111,12 @@ GLboolean brwCreateContext( int api,
ctx->Const.MaxPointSizeAA = 255.0;
/* We want the GLSL compiler to emit code that uses condition codes */
- ctx->Shader.EmitCondCodes = GL_TRUE;
- ctx->Shader.EmitNVTempInitialization = GL_TRUE;
+ for (i = 0; i <= MESA_SHADER_FRAGMENT; i++) {
+ ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE;
+ ctx->ShaderCompilerOptions[i].EmitNVTempInitialization = GL_TRUE;
+ ctx->ShaderCompilerOptions[i].EmitNoNoise = GL_TRUE;
+ ctx->ShaderCompilerOptions[i].EmitNoMainReturn = GL_TRUE;
+ }
ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024);
ctx->Const.VertexProgram.MaxAluInstructions = 0;
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 0906150613..ddd3a94eb0 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -103,12 +103,92 @@ static void brw_set_dest( struct brw_instruction *insn,
guess_execution_size(insn, dest);
}
+extern int reg_type_size[];
+
+static void
+validate_reg(struct brw_instruction *insn, struct brw_reg reg)
+{
+ int hstride_for_reg[] = {0, 1, 2, 4};
+ int vstride_for_reg[] = {0, 1, 2, 4, 8, 16, 32, 64, 128, 256};
+ int width_for_reg[] = {1, 2, 4, 8, 16};
+ int execsize_for_reg[] = {1, 2, 4, 8, 16};
+ int width, hstride, vstride, execsize;
+
+ if (reg.file == BRW_IMMEDIATE_VALUE) {
+ /* 3.3.6: Region Parameters. Restriction: Immediate vectors
+ * mean the destination has to be 128-bit aligned and the
+ * destination horiz stride has to be a word.
+ */
+ if (reg.type == BRW_REGISTER_TYPE_V) {
+ assert(hstride_for_reg[insn->bits1.da1.dest_horiz_stride] *
+ reg_type_size[insn->bits1.da1.dest_reg_type] == 2);
+ }
+
+ return;
+ }
+
+ if (reg.file == BRW_ARCHITECTURE_REGISTER_FILE &&
+ reg.file == BRW_ARF_NULL)
+ return;
+
+ assert(reg.hstride >= 0 && reg.hstride < Elements(hstride_for_reg));
+ hstride = hstride_for_reg[reg.hstride];
+
+ if (reg.vstride == 0xf) {
+ vstride = -1;
+ } else {
+ assert(reg.vstride >= 0 && reg.vstride < Elements(vstride_for_reg));
+ vstride = vstride_for_reg[reg.vstride];
+ }
+
+ assert(reg.width >= 0 && reg.width < Elements(width_for_reg));
+ width = width_for_reg[reg.width];
+
+ assert(insn->header.execution_size >= 0 &&
+ insn->header.execution_size < Elements(execsize_for_reg));
+ execsize = execsize_for_reg[insn->header.execution_size];
+
+ /* Restrictions from 3.3.10: Register Region Restrictions. */
+ /* 3. */
+ assert(execsize >= width);
+
+ /* 4. */
+ if (execsize == width && hstride != 0) {
+ assert(vstride == -1 || vstride == width * hstride);
+ }
+
+ /* 5. */
+ if (execsize == width && hstride == 0) {
+ /* no restriction on vstride. */
+ }
+
+ /* 6. */
+ if (width == 1) {
+ assert(hstride == 0);
+ }
+
+ /* 7. */
+ if (execsize == 1 && width == 1) {
+ assert(hstride == 0);
+ assert(vstride == 0);
+ }
+
+ /* 8. */
+ if (vstride == 0 && hstride == 0) {
+ assert(width == 1);
+ }
+
+ /* 10. Check destination issues. */
+}
+
static void brw_set_src0( struct brw_instruction *insn,
struct brw_reg reg )
{
if (reg.type != BRW_ARCHITECTURE_REGISTER_FILE)
assert(reg.nr < 128);
+ validate_reg(insn, reg);
+
insn->bits1.da1.src0_reg_file = reg.file;
insn->bits1.da1.src0_reg_type = reg.type;
insn->bits2.da1.src0_abs = reg.abs;
@@ -184,6 +264,8 @@ void brw_set_src1( struct brw_instruction *insn,
assert(reg.nr < 128);
+ validate_reg(insn, reg);
+
insn->bits1.da1.src1_reg_file = reg.file;
insn->bits1.da1.src1_reg_type = reg.type;
insn->bits3.da1.src1_abs = reg.abs;
@@ -579,8 +661,6 @@ ALU2(SHL)
ALU2(RSR)
ALU2(RSL)
ALU2(ASR)
-ALU2(ADD)
-ALU2(MUL)
ALU1(FRC)
ALU1(RNDD)
ALU1(RNDZ)
@@ -594,6 +674,63 @@ ALU2(DP2)
ALU2(LINE)
ALU2(PLN)
+struct brw_instruction *brw_ADD(struct brw_compile *p,
+ struct brw_reg dest,
+ struct brw_reg src0,
+ struct brw_reg src1)
+{
+ /* 6.2.2: add */
+ if (src0.type == BRW_REGISTER_TYPE_F ||
+ (src0.file == BRW_IMMEDIATE_VALUE &&
+ src0.type == BRW_REGISTER_TYPE_VF)) {
+ assert(src1.type != BRW_REGISTER_TYPE_UD);
+ assert(src1.type != BRW_REGISTER_TYPE_D);
+ }
+
+ if (src1.type == BRW_REGISTER_TYPE_F ||
+ (src1.file == BRW_IMMEDIATE_VALUE &&
+ src1.type == BRW_REGISTER_TYPE_VF)) {
+ assert(src0.type != BRW_REGISTER_TYPE_UD);
+ assert(src0.type != BRW_REGISTER_TYPE_D);
+ }
+
+ return brw_alu2(p, BRW_OPCODE_ADD, dest, src0, src1);
+}
+
+struct brw_instruction *brw_MUL(struct brw_compile *p,
+ struct brw_reg dest,
+ struct brw_reg src0,
+ struct brw_reg src1)
+{
+ /* 6.32.38: mul */
+ if (src0.type == BRW_REGISTER_TYPE_D ||
+ src0.type == BRW_REGISTER_TYPE_UD ||
+ src1.type == BRW_REGISTER_TYPE_D ||
+ src1.type == BRW_REGISTER_TYPE_UD) {
+ assert(dest.type != BRW_REGISTER_TYPE_F);
+ }
+
+ if (src0.type == BRW_REGISTER_TYPE_F ||
+ (src0.file == BRW_IMMEDIATE_VALUE &&
+ src0.type == BRW_REGISTER_TYPE_VF)) {
+ assert(src1.type != BRW_REGISTER_TYPE_UD);
+ assert(src1.type != BRW_REGISTER_TYPE_D);
+ }
+
+ if (src1.type == BRW_REGISTER_TYPE_F ||
+ (src1.file == BRW_IMMEDIATE_VALUE &&
+ src1.type == BRW_REGISTER_TYPE_VF)) {
+ assert(src0.type != BRW_REGISTER_TYPE_UD);
+ assert(src0.type != BRW_REGISTER_TYPE_D);
+ }
+
+ assert(src0.file != BRW_ARCHITECTURE_REGISTER_FILE ||
+ src0.nr != BRW_ARF_ACCUMULATOR);
+ assert(src1.file != BRW_ARCHITECTURE_REGISTER_FILE ||
+ src1.nr != BRW_ARF_ACCUMULATOR);
+
+ return brw_alu2(p, BRW_OPCODE_MUL, dest, src0, src1);
+}
void brw_NOP(struct brw_compile *p)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 34c5d5262f..cf5c52119a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -141,7 +141,7 @@ brw_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
do {
progress = false;
- progress = do_common_optimization(shader->ir, true) || progress;
+ progress = do_common_optimization(shader->ir, true, 32) || progress;
} while (progress);
validate_ir_tree(shader->ir);
@@ -202,63 +202,56 @@ public:
return node;
}
- /** Generic unset register constructor. */
- fs_reg()
+ void init()
{
- this->file = BAD_FILE;
this->reg = 0;
this->reg_offset = 0;
- this->hw_reg = -1;
this->negate = 0;
this->abs = 0;
+ this->hw_reg = -1;
+ }
+
+ /** Generic unset register constructor. */
+ fs_reg()
+ {
+ init();
+ this->file = BAD_FILE;
}
/** Immediate value constructor. */
fs_reg(float f)
{
+ init();
this->file = IMM;
- this->reg = 0;
- this->hw_reg = 0;
this->type = BRW_REGISTER_TYPE_F;
this->imm.f = f;
- this->negate = 0;
- this->abs = 0;
}
/** Immediate value constructor. */
fs_reg(int32_t i)
{
+ init();
this->file = IMM;
- this->reg = 0;
- this->hw_reg = 0;
this->type = BRW_REGISTER_TYPE_D;
this->imm.i = i;
- this->negate = 0;
- this->abs = 0;
}
/** Immediate value constructor. */
fs_reg(uint32_t u)
{
+ init();
this->file = IMM;
- this->reg = 0;
- this->hw_reg = 0;
this->type = BRW_REGISTER_TYPE_UD;
this->imm.u = u;
- this->negate = 0;
- this->abs = 0;
}
/** Fixed brw_reg Immediate value constructor. */
fs_reg(struct brw_reg fixed_hw_reg)
{
+ init();
this->file = FIXED_HW_REG;
this->fixed_hw_reg = fixed_hw_reg;
- this->reg = 0;
- this->hw_reg = 0;
this->type = fixed_hw_reg.type;
- this->negate = 0;
- this->abs = 0;
}
fs_reg(enum register_file file, int hw_reg);
@@ -482,25 +475,21 @@ public:
/** Fixed HW reg constructor. */
fs_reg::fs_reg(enum register_file file, int hw_reg)
{
+ init();
this->file = file;
- this->reg = 0;
- this->reg_offset = 0;
this->hw_reg = hw_reg;
this->type = BRW_REGISTER_TYPE_F;
- this->negate = 0;
- this->abs = 0;
}
/** Automatic reg constructor. */
fs_reg::fs_reg(class fs_visitor *v, const struct glsl_type *type)
{
+ init();
+
this->file = GRF;
this->reg = v->next_abstract_grf;
this->reg_offset = 0;
v->next_abstract_grf += type_size(type);
- this->hw_reg = -1;
- this->negate = 0;
- this->abs = 0;
switch (type->base_type) {
case GLSL_TYPE_FLOAT:
@@ -764,6 +753,10 @@ fs_visitor::visit(ir_expression *ir)
assert(!"not reached: should be handled by brw_channel_expressions");
break;
+ case ir_unop_noise:
+ assert(!"not reached: should be handled by lower_noise");
+ break;
+
case ir_unop_sqrt:
emit(fs_inst(FS_OPCODE_SQRT, this->result, op[0]));
break;
@@ -778,7 +771,7 @@ fs_visitor::visit(ir_expression *ir)
emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0]));
break;
case ir_unop_f2i:
- emit(fs_inst(BRW_OPCODE_RNDZ, this->result, op[0]));
+ emit(fs_inst(BRW_OPCODE_MOV, this->result, op[0]));
break;
case ir_unop_f2b:
case ir_unop_i2b:
@@ -1222,6 +1215,8 @@ fs_visitor::emit_interpolation()
this->current_annotation = "compute pixel centers";
this->pixel_x = fs_reg(this, glsl_type::uint_type);
this->pixel_y = fs_reg(this, glsl_type::uint_type);
+ this->pixel_x.type = BRW_REGISTER_TYPE_UW;
+ this->pixel_y.type = BRW_REGISTER_TYPE_UW;
emit(fs_inst(BRW_OPCODE_ADD,
this->pixel_x,
fs_reg(stride(suboffset(g1_uw, 4), 2, 4, 0)),
@@ -1525,6 +1520,14 @@ fs_visitor::assign_curb_setup()
c->prog_data.first_curbe_grf = c->key.nr_payload_regs;
c->prog_data.curb_read_length = ALIGN(c->prog_data.nr_params, 8) / 8;
+ if (intel->gen == 5 && (c->prog_data.first_curbe_grf +
+ c->prog_data.curb_read_length) & 1) {
+ /* Align the start of the interpolation coefficients so that we can use
+ * the PLN instruction.
+ */
+ c->prog_data.first_curbe_grf++;
+ }
+
/* Map the offsets in the UNIFORM file to fixed HW regs. */
foreach_iter(exec_list_iterator, iter, this->instructions) {
fs_inst *inst = (fs_inst *)iter.get();
@@ -1882,9 +1885,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c)
ir->accept(&v);
}
- if (v.fail)
- return GL_FALSE;
-
v.emit_fb_writes();
v.assign_curb_setup();
v.assign_urb_setup();
@@ -1893,6 +1893,11 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c)
v.generate_code();
+ assert(!v.fail); /* FINISHME: Cleanly fail, tested at link time, etc. */
+
+ if (v.fail)
+ return GL_FALSE;
+
if (INTEL_DEBUG & DEBUG_WM) {
const char *last_annotation_string = NULL;
ir_instruction *last_annotation_ir = NULL;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index d8d58a9467..478614090a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -356,6 +356,9 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
assign(ir, 0, last);
break;
}
+ case ir_unop_noise:
+ assert(!"noise should have been broken down to function call");
+ break;
}
ir->remove();
diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c
index bc152204a4..3e52be5d4b 100644
--- a/src/mesa/drivers/dri/i965/brw_program.c
+++ b/src/mesa/drivers/dri/i965/brw_program.c
@@ -132,6 +132,7 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx,
struct brw_fragment_program *newFP = brw_fragment_program(fprog);
const struct brw_fragment_program *curFP =
brw_fragment_program_const(brw->fragment_program);
+ struct gl_shader_program *shader_program;
if (fprog->FogOption) {
_mesa_append_fog_code(ctx, fprog);
@@ -142,6 +143,21 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx,
brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
newFP->id = brw->program_id++;
newFP->isGLSL = brw_wm_is_glsl(fprog);
+
+ /* Don't reject fragment shaders for their Mesa IR state when we're
+ * using the new FS backend.
+ */
+ shader_program = _mesa_lookup_shader_program(ctx, prog->Id);
+ if (shader_program) {
+ for (i = 0; i < shader_program->_NumLinkedShaders; i++) {
+ struct brw_shader *shader;
+
+ shader = (struct brw_shader *)shader_program->_LinkedShaders[i];
+ if (shader->base.Type == GL_FRAGMENT_SHADER && shader->ir) {
+ return GL_TRUE;
+ }
+ }
+ }
}
else if (target == GL_VERTEX_PROGRAM_ARB) {
struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 1d88c6b5a4..ad0d00b87c 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -954,7 +954,7 @@ get_reladdr_constant(struct brw_vs_compile *c,
struct brw_compile *p = &c->func;
struct brw_reg const_reg = c->current_const[argIndex].reg;
struct brw_reg addrReg = c->regs[PROGRAM_ADDRESS][0];
- struct brw_reg byte_addr_reg = get_tmp(c);
+ struct brw_reg byte_addr_reg = retype(get_tmp(c), BRW_REGISTER_TYPE_D);
assert(argIndex < 3);
@@ -1069,6 +1069,12 @@ move_to_reladdr_dst(struct brw_vs_compile *c,
struct brw_reg indirect = brw_vec4_indirect(0,0);
struct brw_reg acc = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UW);
+ /* Because destination register indirect addressing can only use
+ * one index, we'll write each vertex's vec4 value separately.
+ */
+ val.width = BRW_WIDTH_4;
+ val.vstride = BRW_VERTICAL_STRIDE_4;
+
brw_push_insn_state(p);
brw_set_access_mode(p, BRW_ALIGN_1);
diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
index c1083c5942..7d6724dc1c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -6,10 +6,6 @@
#include "brw_eu.h"
#include "brw_wm.h"
-enum _subroutine {
- SUB_NOISE1, SUB_NOISE2, SUB_NOISE3, SUB_NOISE4
-};
-
static struct brw_reg get_dst_reg(struct brw_wm_compile *c,
const struct prog_instruction *inst,
GLuint component);
@@ -35,10 +31,6 @@ GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
case OPCODE_CAL:
case OPCODE_BRK:
case OPCODE_RET:
- case OPCODE_NOISE1:
- case OPCODE_NOISE2:
- case OPCODE_NOISE3:
- case OPCODE_NOISE4:
case OPCODE_BGNLOOP:
return GL_TRUE;
default:
@@ -167,11 +159,6 @@ static int mark_tmps(struct brw_wm_compile *c)
return c->tmp_index;
}
-static struct brw_reg lookup_tmp( struct brw_wm_compile *c, int index )
-{
- return brw_vec8_grf( c->tmp_regs[ index ], 0 );
-}
-
static void release_tmps(struct brw_wm_compile *c, int mark)
{
c->tmp_index = mark;
@@ -614,70 +601,6 @@ static struct brw_reg get_src_reg(struct brw_wm_compile *c,
}
}
-/**
- * Subroutines are minimal support for resusable instruction sequences.
- * They are implemented as simply as possible to minimise overhead: there
- * is no explicit support for communication between the caller and callee
- * other than saving the return address in a temporary register, nor is
- * there any automatic local storage. This implies that great care is
- * required before attempting reentrancy or any kind of nested
- * subroutine invocations.
- */
-static void invoke_subroutine( struct brw_wm_compile *c,
- enum _subroutine subroutine,
- void (*emit)( struct brw_wm_compile * ) )
-{
- struct brw_compile *p = &c->func;
-
- assert( subroutine < BRW_WM_MAX_SUBROUTINE );
-
- if( c->subroutines[ subroutine ] ) {
- /* subroutine previously emitted: reuse existing instructions */
-
- int mark = mark_tmps( c );
- struct brw_reg return_address = retype( alloc_tmp( c ),
- BRW_REGISTER_TYPE_UD );
- int here = p->nr_insn;
-
- brw_push_insn_state(p);
- brw_set_mask_control(p, BRW_MASK_DISABLE);
- brw_ADD( p, return_address, brw_ip_reg(), brw_imm_ud( 2 << 4 ) );
-
- brw_ADD( p, brw_ip_reg(), brw_ip_reg(),
- brw_imm_d( ( c->subroutines[ subroutine ] -
- here - 1 ) << 4 ) );
- brw_pop_insn_state(p);
-
- release_tmps( c, mark );
- } else {
- /* previously unused subroutine: emit, and mark for later reuse */
-
- int mark = mark_tmps( c );
- struct brw_reg return_address = retype( alloc_tmp( c ),
- BRW_REGISTER_TYPE_UD );
- struct brw_instruction *calc;
- int base = p->nr_insn;
-
- brw_push_insn_state(p);
- brw_set_mask_control(p, BRW_MASK_DISABLE);
- calc = brw_ADD( p, return_address, brw_ip_reg(), brw_imm_ud( 0 ) );
- brw_pop_insn_state(p);
-
- c->subroutines[ subroutine ] = p->nr_insn;
-
- emit( c );
-
- brw_push_insn_state(p);
- brw_set_mask_control(p, BRW_MASK_DISABLE);
- brw_MOV( p, brw_ip_reg(), return_address );
- brw_pop_insn_state(p);
-
- brw_set_src1( calc, brw_imm_ud( ( p->nr_insn - base ) << 4 ) );
-
- release_tmps( c, mark );
- }
-}
-
static void emit_arl(struct brw_wm_compile *c,
const struct prog_instruction *inst)
{
@@ -728,1037 +651,6 @@ static INLINE struct brw_reg odd_bytes( struct brw_reg reg )
0, 16, 2 );
}
-/* One-, two- and three-dimensional Perlin noise, similar to the description
- in _Improving Noise_, Ken Perlin, Computer Graphics vol. 35 no. 3. */
-static void noise1_sub( struct brw_wm_compile *c ) {
-
- struct brw_compile *p = &c->func;
- struct brw_reg param,
- x0, x1, /* gradients at each end */
- t, tmp[ 2 ], /* float temporaries */
- itmp[ 5 ]; /* unsigned integer temporaries (aliases of floats above) */
- int i;
- int mark = mark_tmps( c );
-
- x0 = alloc_tmp( c );
- x1 = alloc_tmp( c );
- t = alloc_tmp( c );
- tmp[ 0 ] = alloc_tmp( c );
- tmp[ 1 ] = alloc_tmp( c );
- itmp[ 0 ] = retype( tmp[ 0 ], BRW_REGISTER_TYPE_UD );
- itmp[ 1 ] = retype( tmp[ 1 ], BRW_REGISTER_TYPE_UD );
- itmp[ 2 ] = retype( x0, BRW_REGISTER_TYPE_UD );
- itmp[ 3 ] = retype( x1, BRW_REGISTER_TYPE_UD );
- itmp[ 4 ] = retype( t, BRW_REGISTER_TYPE_UD );
-
- param = lookup_tmp( c, mark - 2 );
-
- brw_set_access_mode( p, BRW_ALIGN_1 );
-
- brw_MOV( p, itmp[ 2 ], brw_imm_ud( 0xBA97 ) ); /* constant used later */
-
- /* Arrange the two end coordinates into scalars (itmp0/itmp1) to
- be hashed. Also compute the remainder (offset within the unit
- length), interleaved to reduce register dependency penalties. */
- brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param );
- brw_FRC( p, param, param );
- brw_ADD( p, itmp[ 1 ], itmp[ 0 ], brw_imm_ud( 1 ) );
- brw_MOV( p, itmp[ 3 ], brw_imm_ud( 0x79D9 ) ); /* constant used later */
- brw_MOV( p, itmp[ 4 ], brw_imm_ud( 0xD5B1 ) ); /* constant used later */
-
- /* We're now ready to perform the hashing. The two hashes are
- interleaved for performance. The hash function used is
- designed to rapidly achieve avalanche and require only 32x16
- bit multiplication, and 16-bit swizzles (which we get for
- free). We can't use immediate operands in the multiplies,
- because immediates are permitted only in src1 and the 16-bit
- factor is permitted only in src0. */
- for( i = 0; i < 2; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 2 ], itmp[ i ] );
- for( i = 0; i < 2; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
- for( i = 0; i < 2; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 3 ], itmp[ i ] );
- for( i = 0; i < 2; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
- for( i = 0; i < 2; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 4 ], itmp[ i ] );
- for( i = 0; i < 2; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
-
- /* Now we want to initialise the two gradients based on the
- hashes. Format conversion from signed integer to float leaves
- everything scaled too high by a factor of pow( 2, 31 ), but
- we correct for that right at the end. */
- brw_ADD( p, t, param, brw_imm_f( -1.0 ) );
- brw_MOV( p, x0, retype( tmp[ 0 ], BRW_REGISTER_TYPE_D ) );
- brw_MOV( p, x1, retype( tmp[ 1 ], BRW_REGISTER_TYPE_D ) );
-
- brw_MUL( p, x0, x0, param );
- brw_MUL( p, x1, x1, t );
-
- /* We interpolate between the gradients using the polynomial
- 6t^5 - 15t^4 + 10t^3 (Perlin). */
- brw_MUL( p, tmp[ 0 ], param, brw_imm_f( 6.0 ) );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], brw_imm_f( -15.0 ) );
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], brw_imm_f( 10.0 ) );
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param );
- brw_ADD( p, x1, x1, negate( x0 ) ); /* unrelated work to fill the
- pipeline */
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param );
- brw_MUL( p, param, tmp[ 0 ], param );
- brw_MUL( p, x1, x1, param );
- brw_ADD( p, x0, x0, x1 );
- /* scale by pow( 2, -30 ), to compensate for the format conversion
- above and an extra factor of 2 so that a single gradient covers
- the [-1,1] range */
- brw_MUL( p, param, x0, brw_imm_f( 0.000000000931322574615478515625 ) );
-
- release_tmps( c, mark );
-}
-
-static void emit_noise1( struct brw_wm_compile *c,
- const struct prog_instruction *inst )
-{
- struct brw_compile *p = &c->func;
- struct brw_reg src, param, dst;
- GLuint mask = inst->DstReg.WriteMask;
- int i;
- int mark = mark_tmps( c );
-
- assert( mark == 0 );
-
- src = get_src_reg( c, inst, 0, 0 );
-
- param = alloc_tmp( c );
-
- brw_MOV( p, param, src );
-
- invoke_subroutine( c, SUB_NOISE1, noise1_sub );
-
- /* Fill in the result: */
- brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
- for (i = 0 ; i < 4; i++) {
- if (mask & (1<<i)) {
- dst = get_dst_reg(c, inst, i);
- brw_MOV( p, dst, param );
- }
- }
- if( inst->SaturateMode == SATURATE_ZERO_ONE )
- brw_set_saturate( p, 0 );
-
- release_tmps( c, mark );
-}
-
-static void noise2_sub( struct brw_wm_compile *c ) {
-
- struct brw_compile *p = &c->func;
- struct brw_reg param0, param1,
- x0y0, x0y1, x1y0, x1y1, /* gradients at each corner */
- t, tmp[ 4 ], /* float temporaries */
- itmp[ 7 ]; /* unsigned integer temporaries (aliases of floats above) */
- int i;
- int mark = mark_tmps( c );
-
- x0y0 = alloc_tmp( c );
- x0y1 = alloc_tmp( c );
- x1y0 = alloc_tmp( c );
- x1y1 = alloc_tmp( c );
- t = alloc_tmp( c );
- for( i = 0; i < 4; i++ ) {
- tmp[ i ] = alloc_tmp( c );
- itmp[ i ] = retype( tmp[ i ], BRW_REGISTER_TYPE_UD );
- }
- itmp[ 4 ] = retype( x0y0, BRW_REGISTER_TYPE_UD );
- itmp[ 5 ] = retype( x0y1, BRW_REGISTER_TYPE_UD );
- itmp[ 6 ] = retype( x1y0, BRW_REGISTER_TYPE_UD );
-
- param0 = lookup_tmp( c, mark - 3 );
- param1 = lookup_tmp( c, mark - 2 );
-
- brw_set_access_mode( p, BRW_ALIGN_1 );
-
- /* Arrange the four corner coordinates into scalars (itmp0..itmp3) to
- be hashed. Also compute the remainders (offsets within the unit
- square), interleaved to reduce register dependency penalties. */
- brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param0 );
- brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param1 );
- brw_FRC( p, param0, param0 );
- brw_FRC( p, param1, param1 );
- brw_MOV( p, itmp[ 4 ], brw_imm_ud( 0xBA97 ) ); /* constant used later */
- brw_ADD( p, high_words( itmp[ 0 ] ), high_words( itmp[ 0 ] ),
- low_words( itmp[ 1 ] ) );
- brw_MOV( p, itmp[ 5 ], brw_imm_ud( 0x79D9 ) ); /* constant used later */
- brw_MOV( p, itmp[ 6 ], brw_imm_ud( 0xD5B1 ) ); /* constant used later */
- brw_ADD( p, itmp[ 1 ], itmp[ 0 ], brw_imm_ud( 0x10000 ) );
- brw_ADD( p, itmp[ 2 ], itmp[ 0 ], brw_imm_ud( 0x1 ) );
- brw_ADD( p, itmp[ 3 ], itmp[ 0 ], brw_imm_ud( 0x10001 ) );
-
- /* We're now ready to perform the hashing. The four hashes are
- interleaved for performance. The hash function used is
- designed to rapidly achieve avalanche and require only 32x16
- bit multiplication, and 16-bit swizzles (which we get for
- free). We can't use immediate operands in the multiplies,
- because immediates are permitted only in src1 and the 16-bit
- factor is permitted only in src0. */
- for( i = 0; i < 4; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 4 ], itmp[ i ] );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
- for( i = 0; i < 4; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 5 ], itmp[ i ] );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
- for( i = 0; i < 4; i++ )
- brw_MUL( p, itmp[ i ], itmp[ 6 ], itmp[ i ] );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, low_words( itmp[ i ] ), low_words( itmp[ i ] ),
- high_words( itmp[ i ] ) );
-
- /* Now we want to initialise the four gradients based on the
- hashes. Format conversion from signed integer to float leaves
- everything scaled too high by a factor of pow( 2, 15 ), but
- we correct for that right at the end. */
- brw_ADD( p, t, param0, brw_imm_f( -1.0 ) );
- brw_MOV( p, x0y0, low_words( tmp[ 0 ] ) );
- brw_MOV( p, x0y1, low_words( tmp[ 1 ] ) );
- brw_MOV( p, x1y0, low_words( tmp[ 2 ] ) );
- brw_MOV( p, x1y1, low_words( tmp[ 3 ] ) );
-
- brw_MOV( p, tmp[ 0 ], high_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 1 ], high_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 2 ], high_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 3 ], high_words( tmp[ 3 ] ) );
-
- brw_MUL( p, x1y0, x1y0, t );
- brw_MUL( p, x1y1, x1y1, t );
- brw_ADD( p, t, param1, brw_imm_f( -1.0 ) );
- brw_MUL( p, x0y0, x0y0, param0 );
- brw_MUL( p, x0y1, x0y1, param0 );
-
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param1 );
- brw_MUL( p, tmp[ 2 ], tmp[ 2 ], param1 );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], t );
- brw_MUL( p, tmp[ 3 ], tmp[ 3 ], t );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 0 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 2 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 1 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 3 ] );
-
- /* We interpolate between the gradients using the polynomial
- 6t^5 - 15t^4 + 10t^3 (Perlin). */
- brw_MUL( p, tmp[ 0 ], param0, brw_imm_f( 6.0 ) );
- brw_MUL( p, tmp[ 1 ], param1, brw_imm_f( 6.0 ) );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], brw_imm_f( -15.0 ) );
- brw_ADD( p, tmp[ 1 ], tmp[ 1 ], brw_imm_f( -15.0 ) );
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param0 );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], param1 );
- brw_ADD( p, x0y1, x0y1, negate( x0y0 ) ); /* unrelated work to fill the
- pipeline */
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], brw_imm_f( 10.0 ) );
- brw_ADD( p, tmp[ 1 ], tmp[ 1 ], brw_imm_f( 10.0 ) );
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param0 );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], param1 );
- brw_ADD( p, x1y1, x1y1, negate( x1y0 ) ); /* unrelated work to fill the
- pipeline */
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], param0 );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], param1 );
- brw_MUL( p, param0, tmp[ 0 ], param0 );
- brw_MUL( p, param1, tmp[ 1 ], param1 );
-
- /* Here we interpolate in the y dimension... */
- brw_MUL( p, x0y1, x0y1, param1 );
- brw_MUL( p, x1y1, x1y1, param1 );
- brw_ADD( p, x0y0, x0y0, x0y1 );
- brw_ADD( p, x1y0, x1y0, x1y1 );
-
- /* And now in x. There are horrible register dependencies here,
- but we have nothing else to do. */
- brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
- brw_MUL( p, x1y0, x1y0, param0 );
- brw_ADD( p, x0y0, x0y0, x1y0 );
-
- /* scale by pow( 2, -15 ), as described above */
- brw_MUL( p, param0, x0y0, brw_imm_f( 0.000030517578125 ) );
-
- release_tmps( c, mark );
-}
-
-static void emit_noise2( struct brw_wm_compile *c,
- const struct prog_instruction *inst )
-{
- struct brw_compile *p = &c->func;
- struct brw_reg src0, src1, param0, param1, dst;
- GLuint mask = inst->DstReg.WriteMask;
- int i;
- int mark = mark_tmps( c );
-
- assert( mark == 0 );
-
- src0 = get_src_reg( c, inst, 0, 0 );
- src1 = get_src_reg( c, inst, 0, 1 );
-
- param0 = alloc_tmp( c );
- param1 = alloc_tmp( c );
-
- brw_MOV( p, param0, src0 );
- brw_MOV( p, param1, src1 );
-
- invoke_subroutine( c, SUB_NOISE2, noise2_sub );
-
- /* Fill in the result: */
- brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
- for (i = 0 ; i < 4; i++) {
- if (mask & (1<<i)) {
- dst = get_dst_reg(c, inst, i);
- brw_MOV( p, dst, param0 );
- }
- }
- if( inst->SaturateMode == SATURATE_ZERO_ONE )
- brw_set_saturate( p, 0 );
-
- release_tmps( c, mark );
-}
-
-/**
- * The three-dimensional case is much like the one- and two- versions above,
- * but since the number of corners is rapidly growing we now pack 16 16-bit
- * hashes into each register to extract more parallelism from the EUs.
- */
-static void noise3_sub( struct brw_wm_compile *c ) {
-
- struct brw_compile *p = &c->func;
- struct brw_reg param0, param1, param2,
- x0y0, x0y1, x1y0, x1y1, /* gradients at four of the corners */
- xi, yi, zi, /* interpolation coefficients */
- t, tmp[ 8 ], /* float temporaries */
- itmp[ 8 ], /* unsigned integer temporaries (aliases of floats above) */
- wtmp[ 8 ]; /* 16-way unsigned word temporaries (aliases of above) */
- int i;
- int mark = mark_tmps( c );
-
- x0y0 = alloc_tmp( c );
- x0y1 = alloc_tmp( c );
- x1y0 = alloc_tmp( c );
- x1y1 = alloc_tmp( c );
- xi = alloc_tmp( c );
- yi = alloc_tmp( c );
- zi = alloc_tmp( c );
- t = alloc_tmp( c );
- for( i = 0; i < 8; i++ ) {
- tmp[ i ] = alloc_tmp( c );
- itmp[ i ] = retype( tmp[ i ], BRW_REGISTER_TYPE_UD );
- wtmp[ i ] = brw_uw16_grf( tmp[ i ].nr, 0 );
- }
-
- param0 = lookup_tmp( c, mark - 4 );
- param1 = lookup_tmp( c, mark - 3 );
- param2 = lookup_tmp( c, mark - 2 );
-
- brw_set_access_mode( p, BRW_ALIGN_1 );
-
- /* Arrange the eight corner coordinates into scalars (itmp0..itmp3) to
- be hashed. Also compute the remainders (offsets within the unit
- cube), interleaved to reduce register dependency penalties. */
- brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param0 );
- brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param1 );
- brw_RNDD( p, retype( itmp[ 2 ], BRW_REGISTER_TYPE_D ), param2 );
- brw_FRC( p, param0, param0 );
- brw_FRC( p, param1, param1 );
- brw_FRC( p, param2, param2 );
- /* Since we now have only 16 bits of precision in the hash, we must
- be more careful about thorough mixing to maintain entropy as we
- squash the input vector into a small scalar. */
- brw_MUL( p, brw_null_reg(), low_words( itmp[ 0 ] ), brw_imm_uw( 0xBC8F ) );
- brw_MAC( p, brw_null_reg(), low_words( itmp[ 1 ] ), brw_imm_uw( 0xD0BD ) );
- brw_MAC( p, low_words( itmp[ 0 ] ), low_words( itmp[ 2 ] ),
- brw_imm_uw( 0x9B93 ) );
- brw_ADD( p, high_words( itmp[ 0 ] ), low_words( itmp[ 0 ] ),
- brw_imm_uw( 0xBC8F ) );
-
- /* Temporarily disable the execution mask while we work with ExecSize=16
- channels (the mask is set for ExecSize=8 and is probably incorrect).
- Although this might cause execution of unwanted channels, the code
- writes only to temporary registers and has no side effects, so
- disabling the mask is harmless. */
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_ADD( p, wtmp[ 1 ], wtmp[ 0 ], brw_imm_uw( 0xD0BD ) );
- brw_ADD( p, wtmp[ 2 ], wtmp[ 0 ], brw_imm_uw( 0x9B93 ) );
- brw_ADD( p, wtmp[ 3 ], wtmp[ 1 ], brw_imm_uw( 0x9B93 ) );
-
- /* We're now ready to perform the hashing. The eight hashes are
- interleaved for performance. The hash function used is
- designed to rapidly achieve avalanche and require only 16x16
- bit multiplication, and 8-bit swizzles (which we get for
- free). */
- for( i = 0; i < 4; i++ )
- brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0x28D9 ) );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
- odd_bytes( wtmp[ i ] ) );
- for( i = 0; i < 4; i++ )
- brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0xC6D5 ) );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
- odd_bytes( wtmp[ i ] ) );
- brw_pop_insn_state( p );
-
- /* Now we want to initialise the four rear gradients based on the
- hashes. Format conversion from signed integer to float leaves
- everything scaled too high by a factor of pow( 2, 15 ), but
- we correct for that right at the end. */
- /* x component */
- brw_ADD( p, t, param0, brw_imm_f( -1.0 ) );
- brw_MOV( p, x0y0, low_words( tmp[ 0 ] ) );
- brw_MOV( p, x0y1, low_words( tmp[ 1 ] ) );
- brw_MOV( p, x1y0, high_words( tmp[ 0 ] ) );
- brw_MOV( p, x1y1, high_words( tmp[ 1 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 5 ) );
- brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 5 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, x1y0, x1y0, t );
- brw_MUL( p, x1y1, x1y1, t );
- brw_ADD( p, t, param1, brw_imm_f( -1.0 ) );
- brw_MUL( p, x0y0, x0y0, param0 );
- brw_MUL( p, x0y1, x0y1, param0 );
-
- /* y component */
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 5 ) );
- brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 5 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- brw_ADD( p, t, param0, brw_imm_f( -1.0 ) );
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param1 );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param1 );
-
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
-
- /* z component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param2 );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], param2 );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param2 );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], param2 );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* We interpolate between the gradients using the polynomial
- 6t^5 - 15t^4 + 10t^3 (Perlin). */
- brw_MUL( p, xi, param0, brw_imm_f( 6.0 ) );
- brw_MUL( p, yi, param1, brw_imm_f( 6.0 ) );
- brw_MUL( p, zi, param2, brw_imm_f( 6.0 ) );
- brw_ADD( p, xi, xi, brw_imm_f( -15.0 ) );
- brw_ADD( p, yi, yi, brw_imm_f( -15.0 ) );
- brw_ADD( p, zi, zi, brw_imm_f( -15.0 ) );
- brw_MUL( p, xi, xi, param0 );
- brw_MUL( p, yi, yi, param1 );
- brw_MUL( p, zi, zi, param2 );
- brw_ADD( p, xi, xi, brw_imm_f( 10.0 ) );
- brw_ADD( p, yi, yi, brw_imm_f( 10.0 ) );
- brw_ADD( p, zi, zi, brw_imm_f( 10.0 ) );
- brw_ADD( p, x0y1, x0y1, negate( x0y0 ) ); /* unrelated work */
- brw_ADD( p, x1y1, x1y1, negate( x1y0 ) ); /* unrelated work */
- brw_MUL( p, xi, xi, param0 );
- brw_MUL( p, yi, yi, param1 );
- brw_MUL( p, zi, zi, param2 );
- brw_MUL( p, xi, xi, param0 );
- brw_MUL( p, yi, yi, param1 );
- brw_MUL( p, zi, zi, param2 );
- brw_MUL( p, xi, xi, param0 );
- brw_MUL( p, yi, yi, param1 );
- brw_MUL( p, zi, zi, param2 );
-
- /* Here we interpolate in the y dimension... */
- brw_MUL( p, x0y1, x0y1, yi );
- brw_MUL( p, x1y1, x1y1, yi );
- brw_ADD( p, x0y0, x0y0, x0y1 );
- brw_ADD( p, x1y0, x1y0, x1y1 );
-
- /* And now in x. Leave the result in tmp[ 0 ] (see below)... */
- brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
- brw_MUL( p, x1y0, x1y0, xi );
- brw_ADD( p, tmp[ 0 ], x0y0, x1y0 );
-
- /* Now do the same thing for the front four gradients... */
- /* x component */
- brw_MOV( p, x0y0, low_words( tmp[ 2 ] ) );
- brw_MOV( p, x0y1, low_words( tmp[ 3 ] ) );
- brw_MOV( p, x1y0, high_words( tmp[ 2 ] ) );
- brw_MOV( p, x1y1, high_words( tmp[ 3 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 5 ) );
- brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 5 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, x1y0, x1y0, t );
- brw_MUL( p, x1y1, x1y1, t );
- brw_ADD( p, t, param1, brw_imm_f( -1.0 ) );
- brw_MUL( p, x0y0, x0y0, param0 );
- brw_MUL( p, x0y1, x0y1, param0 );
-
- /* y component */
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 5 ) );
- brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 5 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- brw_ADD( p, t, param2, brw_imm_f( -1.0 ) );
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param1 );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param1 );
-
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
-
- /* z component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* The interpolation coefficients are still around from last time, so
- again interpolate in the y dimension... */
- brw_ADD( p, x0y1, x0y1, negate( x0y0 ) );
- brw_ADD( p, x1y1, x1y1, negate( x1y0 ) );
- brw_MUL( p, x0y1, x0y1, yi );
- brw_MUL( p, x1y1, x1y1, yi );
- brw_ADD( p, x0y0, x0y0, x0y1 );
- brw_ADD( p, x1y0, x1y0, x1y1 );
-
- /* And now in x. The rear face is in tmp[ 0 ] (see above), so this
- time put the front face in tmp[ 1 ] and we're nearly there... */
- brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
- brw_MUL( p, x1y0, x1y0, xi );
- brw_ADD( p, tmp[ 1 ], x0y0, x1y0 );
-
- /* The final interpolation, in the z dimension: */
- brw_ADD( p, tmp[ 1 ], tmp[ 1 ], negate( tmp[ 0 ] ) );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], zi );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], tmp[ 1 ] );
-
- /* scale by pow( 2, -15 ), as described above */
- brw_MUL( p, param0, tmp[ 0 ], brw_imm_f( 0.000030517578125 ) );
-
- release_tmps( c, mark );
-}
-
-static void emit_noise3( struct brw_wm_compile *c,
- const struct prog_instruction *inst )
-{
- struct brw_compile *p = &c->func;
- struct brw_reg src0, src1, src2, param0, param1, param2, dst;
- GLuint mask = inst->DstReg.WriteMask;
- int i;
- int mark = mark_tmps( c );
-
- assert( mark == 0 );
-
- src0 = get_src_reg( c, inst, 0, 0 );
- src1 = get_src_reg( c, inst, 0, 1 );
- src2 = get_src_reg( c, inst, 0, 2 );
-
- param0 = alloc_tmp( c );
- param1 = alloc_tmp( c );
- param2 = alloc_tmp( c );
-
- brw_MOV( p, param0, src0 );
- brw_MOV( p, param1, src1 );
- brw_MOV( p, param2, src2 );
-
- invoke_subroutine( c, SUB_NOISE3, noise3_sub );
-
- /* Fill in the result: */
- brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
- for (i = 0 ; i < 4; i++) {
- if (mask & (1<<i)) {
- dst = get_dst_reg(c, inst, i);
- brw_MOV( p, dst, param0 );
- }
- }
- if( inst->SaturateMode == SATURATE_ZERO_ONE )
- brw_set_saturate( p, 0 );
-
- release_tmps( c, mark );
-}
-
-/**
- * For the four-dimensional case, the little micro-optimisation benefits
- * we obtain by unrolling all the loops aren't worth the massive bloat it
- * now causes. Instead, we loop twice around performing a similar operation
- * to noise3, once for the w=0 cube and once for the w=1, with a bit more
- * code to glue it all together.
- */
-static void noise4_sub( struct brw_wm_compile *c )
-{
- struct brw_compile *p = &c->func;
- struct brw_reg param[ 4 ],
- x0y0, x0y1, x1y0, x1y1, /* gradients at four of the corners */
- w0, /* noise for the w=0 cube */
- floors[ 2 ], /* integer coordinates of base corner of hypercube */
- interp[ 4 ], /* interpolation coefficients */
- t, tmp[ 8 ], /* float temporaries */
- itmp[ 8 ], /* unsigned integer temporaries (aliases of floats above) */
- wtmp[ 8 ]; /* 16-way unsigned word temporaries (aliases of above) */
- int i, j;
- int mark = mark_tmps( c );
- GLuint loop, origin;
-
- x0y0 = alloc_tmp( c );
- x0y1 = alloc_tmp( c );
- x1y0 = alloc_tmp( c );
- x1y1 = alloc_tmp( c );
- t = alloc_tmp( c );
- w0 = alloc_tmp( c );
- floors[ 0 ] = retype( alloc_tmp( c ), BRW_REGISTER_TYPE_UD );
- floors[ 1 ] = retype( alloc_tmp( c ), BRW_REGISTER_TYPE_UD );
-
- for( i = 0; i < 4; i++ ) {
- param[ i ] = lookup_tmp( c, mark - 5 + i );
- interp[ i ] = alloc_tmp( c );
- }
-
- for( i = 0; i < 8; i++ ) {
- tmp[ i ] = alloc_tmp( c );
- itmp[ i ] = retype( tmp[ i ], BRW_REGISTER_TYPE_UD );
- wtmp[ i ] = brw_uw16_grf( tmp[ i ].nr, 0 );
- }
-
- brw_set_access_mode( p, BRW_ALIGN_1 );
-
- /* We only want 16 bits of precision from the integral part of each
- co-ordinate, but unfortunately the RNDD semantics would saturate
- at 16 bits if we performed the operation directly to a 16-bit
- destination. Therefore, we round to 32-bit temporaries where
- appropriate, and then store only the lower 16 bits. */
- brw_RNDD( p, retype( floors[ 0 ], BRW_REGISTER_TYPE_D ), param[ 0 ] );
- brw_RNDD( p, retype( itmp[ 0 ], BRW_REGISTER_TYPE_D ), param[ 1 ] );
- brw_RNDD( p, retype( floors[ 1 ], BRW_REGISTER_TYPE_D ), param[ 2 ] );
- brw_RNDD( p, retype( itmp[ 1 ], BRW_REGISTER_TYPE_D ), param[ 3 ] );
- brw_MOV( p, high_words( floors[ 0 ] ), low_words( itmp[ 0 ] ) );
- brw_MOV( p, high_words( floors[ 1 ] ), low_words( itmp[ 1 ] ) );
-
- /* Modify the flag register here, because the side effect is useful
- later (see below). We know for certain that all flags will be
- cleared, since the FRC instruction cannot possibly generate
- negative results. Even for exceptional inputs (infinities, denormals,
- NaNs), the architecture guarantees that the L conditional is false. */
- brw_set_conditionalmod( p, BRW_CONDITIONAL_L );
- brw_FRC( p, param[ 0 ], param[ 0 ] );
- brw_set_predicate_control( p, BRW_PREDICATE_NONE );
- for( i = 1; i < 4; i++ )
- brw_FRC( p, param[ i ], param[ i ] );
-
- /* Calculate the interpolation coefficients (6t^5 - 15t^4 + 10t^3) first
- of all. */
- for( i = 0; i < 4; i++ )
- brw_MUL( p, interp[ i ], param[ i ], brw_imm_f( 6.0 ) );
- for( i = 0; i < 4; i++ )
- brw_ADD( p, interp[ i ], interp[ i ], brw_imm_f( -15.0 ) );
- for( i = 0; i < 4; i++ )
- brw_MUL( p, interp[ i ], interp[ i ], param[ i ] );
- for( i = 0; i < 4; i++ )
- brw_ADD( p, interp[ i ], interp[ i ], brw_imm_f( 10.0 ) );
- for( j = 0; j < 3; j++ )
- for( i = 0; i < 4; i++ )
- brw_MUL( p, interp[ i ], interp[ i ], param[ i ] );
-
- /* Mark the current address, as it will be a jump destination. The
- following code will be executed twice: first, with the flag
- register clear indicating the w=0 case, and second with flags
- set for w=1. */
- loop = p->nr_insn;
-
- /* Arrange the eight corner coordinates into scalars (itmp0..itmp3) to
- be hashed. Since we have only 16 bits of precision in the hash, we
- must be careful about thorough mixing to maintain entropy as we
- squash the input vector into a small scalar. */
- brw_MUL( p, brw_null_reg(), low_words( floors[ 0 ] ),
- brw_imm_uw( 0xBC8F ) );
- brw_MAC( p, brw_null_reg(), high_words( floors[ 0 ] ),
- brw_imm_uw( 0xD0BD ) );
- brw_MAC( p, brw_null_reg(), low_words( floors[ 1 ] ),
- brw_imm_uw( 0x9B93 ) );
- brw_MAC( p, low_words( itmp[ 0 ] ), high_words( floors[ 1 ] ),
- brw_imm_uw( 0xA359 ) );
- brw_ADD( p, high_words( itmp[ 0 ] ), low_words( itmp[ 0 ] ),
- brw_imm_uw( 0xBC8F ) );
-
- /* Temporarily disable the execution mask while we work with ExecSize=16
- channels (the mask is set for ExecSize=8 and is probably incorrect).
- Although this might cause execution of unwanted channels, the code
- writes only to temporary registers and has no side effects, so
- disabling the mask is harmless. */
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_ADD( p, wtmp[ 1 ], wtmp[ 0 ], brw_imm_uw( 0xD0BD ) );
- brw_ADD( p, wtmp[ 2 ], wtmp[ 0 ], brw_imm_uw( 0x9B93 ) );
- brw_ADD( p, wtmp[ 3 ], wtmp[ 1 ], brw_imm_uw( 0x9B93 ) );
-
- /* We're now ready to perform the hashing. The eight hashes are
- interleaved for performance. The hash function used is
- designed to rapidly achieve avalanche and require only 16x16
- bit multiplication, and 8-bit swizzles (which we get for
- free). */
- for( i = 0; i < 4; i++ )
- brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0x28D9 ) );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
- odd_bytes( wtmp[ i ] ) );
- for( i = 0; i < 4; i++ )
- brw_MUL( p, wtmp[ i ], wtmp[ i ], brw_imm_uw( 0xC6D5 ) );
- for( i = 0; i < 4; i++ )
- brw_XOR( p, even_bytes( wtmp[ i ] ), even_bytes( wtmp[ i ] ),
- odd_bytes( wtmp[ i ] ) );
- brw_pop_insn_state( p );
-
- /* Now we want to initialise the four rear gradients based on the
- hashes. Format conversion from signed integer to float leaves
- everything scaled too high by a factor of pow( 2, 15 ), but
- we correct for that right at the end. */
- /* x component */
- brw_ADD( p, t, param[ 0 ], brw_imm_f( -1.0 ) );
- brw_MOV( p, x0y0, low_words( tmp[ 0 ] ) );
- brw_MOV( p, x0y1, low_words( tmp[ 1 ] ) );
- brw_MOV( p, x1y0, high_words( tmp[ 0 ] ) );
- brw_MOV( p, x1y1, high_words( tmp[ 1 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, x1y0, x1y0, t );
- brw_MUL( p, x1y1, x1y1, t );
- brw_ADD( p, t, param[ 1 ], brw_imm_f( -1.0 ) );
- brw_MUL( p, x0y0, x0y0, param[ 0 ] );
- brw_MUL( p, x0y1, x0y1, param[ 0 ] );
-
- /* y component */
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- /* prepare t for the w component (used below): w the first time through
- the loop; w - 1 the second time) */
- brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
- brw_ADD( p, t, param[ 3 ], brw_imm_f( -1.0 ) );
- p->current->header.predicate_inverse = 1;
- brw_MOV( p, t, param[ 3 ] );
- p->current->header.predicate_inverse = 0;
- brw_set_predicate_control( p, BRW_PREDICATE_NONE );
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 1 ] );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 1 ] );
-
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
-
- /* z component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 0 ], wtmp[ 0 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 1 ], wtmp[ 1 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 2 ] );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], param[ 2 ] );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 2 ] );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], param[ 2 ] );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* w component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 1 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 0 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 1 ] ) );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- brw_ADD( p, t, param[ 0 ], brw_imm_f( -1.0 ) );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* Here we interpolate in the y dimension... */
- brw_ADD( p, x0y1, x0y1, negate( x0y0 ) );
- brw_ADD( p, x1y1, x1y1, negate( x1y0 ) );
- brw_MUL( p, x0y1, x0y1, interp[ 1 ] );
- brw_MUL( p, x1y1, x1y1, interp[ 1 ] );
- brw_ADD( p, x0y0, x0y0, x0y1 );
- brw_ADD( p, x1y0, x1y0, x1y1 );
-
- /* And now in x. Leave the result in tmp[ 0 ] (see below)... */
- brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
- brw_MUL( p, x1y0, x1y0, interp[ 0 ] );
- brw_ADD( p, tmp[ 0 ], x0y0, x1y0 );
-
- /* Now do the same thing for the front four gradients... */
- /* x component */
- brw_MOV( p, x0y0, low_words( tmp[ 2 ] ) );
- brw_MOV( p, x0y1, low_words( tmp[ 3 ] ) );
- brw_MOV( p, x1y0, high_words( tmp[ 2 ] ) );
- brw_MOV( p, x1y1, high_words( tmp[ 3 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, x1y0, x1y0, t );
- brw_MUL( p, x1y1, x1y1, t );
- brw_ADD( p, t, param[ 1 ], brw_imm_f( -1.0 ) );
- brw_MUL( p, x0y0, x0y0, param[ 0 ] );
- brw_MUL( p, x0y1, x0y1, param[ 0 ] );
-
- /* y component */
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- brw_ADD( p, t, param[ 2 ], brw_imm_f( -1.0 ) );
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], param[ 1 ] );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], param[ 1 ] );
-
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
-
- /* z component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
-
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_SHL( p, wtmp[ 2 ], wtmp[ 2 ], brw_imm_uw( 4 ) );
- brw_SHL( p, wtmp[ 3 ], wtmp[ 3 ], brw_imm_uw( 4 ) );
- brw_pop_insn_state( p );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
- /* prepare t for the w component (used below): w the first time through
- the loop; w - 1 the second time) */
- brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
- brw_ADD( p, t, param[ 3 ], brw_imm_f( -1.0 ) );
- p->current->header.predicate_inverse = 1;
- brw_MOV( p, t, param[ 3 ] );
- p->current->header.predicate_inverse = 0;
- brw_set_predicate_control( p, BRW_PREDICATE_NONE );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* w component */
- brw_MOV( p, tmp[ 4 ], low_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 5 ], low_words( tmp[ 3 ] ) );
- brw_MOV( p, tmp[ 6 ], high_words( tmp[ 2 ] ) );
- brw_MOV( p, tmp[ 7 ], high_words( tmp[ 3 ] ) );
-
- brw_MUL( p, tmp[ 4 ], tmp[ 4 ], t );
- brw_MUL( p, tmp[ 5 ], tmp[ 5 ], t );
- brw_MUL( p, tmp[ 6 ], tmp[ 6 ], t );
- brw_MUL( p, tmp[ 7 ], tmp[ 7 ], t );
-
- brw_ADD( p, x0y0, x0y0, tmp[ 4 ] );
- brw_ADD( p, x0y1, x0y1, tmp[ 5 ] );
- brw_ADD( p, x1y0, x1y0, tmp[ 6 ] );
- brw_ADD( p, x1y1, x1y1, tmp[ 7 ] );
-
- /* Interpolate in the y dimension: */
- brw_ADD( p, x0y1, x0y1, negate( x0y0 ) );
- brw_ADD( p, x1y1, x1y1, negate( x1y0 ) );
- brw_MUL( p, x0y1, x0y1, interp[ 1 ] );
- brw_MUL( p, x1y1, x1y1, interp[ 1 ] );
- brw_ADD( p, x0y0, x0y0, x0y1 );
- brw_ADD( p, x1y0, x1y0, x1y1 );
-
- /* And now in x. The rear face is in tmp[ 0 ] (see above), so this
- time put the front face in tmp[ 1 ] and we're nearly there... */
- brw_ADD( p, x1y0, x1y0, negate( x0y0 ) );
- brw_MUL( p, x1y0, x1y0, interp[ 0 ] );
- brw_ADD( p, tmp[ 1 ], x0y0, x1y0 );
-
- /* Another interpolation, in the z dimension: */
- brw_ADD( p, tmp[ 1 ], tmp[ 1 ], negate( tmp[ 0 ] ) );
- brw_MUL( p, tmp[ 1 ], tmp[ 1 ], interp[ 2 ] );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], tmp[ 1 ] );
-
- /* Exit the loop if we've computed both cubes... */
- origin = p->nr_insn;
- brw_push_insn_state( p );
- brw_set_predicate_control( p, BRW_PREDICATE_NORMAL );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_ADD( p, brw_ip_reg(), brw_ip_reg(), brw_imm_d( 0 ) );
- brw_pop_insn_state( p );
-
- /* Save the result for the w=0 case, and increment the w coordinate: */
- brw_MOV( p, w0, tmp[ 0 ] );
- brw_ADD( p, high_words( floors[ 1 ] ), high_words( floors[ 1 ] ),
- brw_imm_uw( 1 ) );
-
- /* Loop around for the other cube. Explicitly set the flag register
- (unfortunately we must spend an extra instruction to do this: we
- can't rely on a side effect of the previous MOV or ADD because
- conditional modifiers which are normally true might be false in
- exceptional circumstances, e.g. given a NaN input; the add to
- brw_ip_reg() is not suitable because the IP is not an 8-vector). */
- brw_push_insn_state( p );
- brw_set_mask_control( p, BRW_MASK_DISABLE );
- brw_MOV( p, brw_flag_reg(), brw_imm_uw( 0xFF ) );
- brw_ADD( p, brw_ip_reg(), brw_ip_reg(),
- brw_imm_d( ( loop - p->nr_insn ) << 4 ) );
- brw_pop_insn_state( p );
-
- /* Patch the previous conditional branch now that we know the
- destination address. */
- brw_set_src1( p->store + origin,
- brw_imm_d( ( p->nr_insn - origin ) << 4 ) );
-
- /* The very last interpolation. */
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], negate( w0 ) );
- brw_MUL( p, tmp[ 0 ], tmp[ 0 ], interp[ 3 ] );
- brw_ADD( p, tmp[ 0 ], tmp[ 0 ], w0 );
-
- /* scale by pow( 2, -15 ), as described above */
- brw_MUL( p, param[ 0 ], tmp[ 0 ], brw_imm_f( 0.000030517578125 ) );
-
- release_tmps( c, mark );
-}
-
-static void emit_noise4( struct brw_wm_compile *c,
- const struct prog_instruction *inst )
-{
- struct brw_compile *p = &c->func;
- struct brw_reg src0, src1, src2, src3, param0, param1, param2, param3, dst;
- GLuint mask = inst->DstReg.WriteMask;
- int i;
- int mark = mark_tmps( c );
-
- assert( mark == 0 );
-
- src0 = get_src_reg( c, inst, 0, 0 );
- src1 = get_src_reg( c, inst, 0, 1 );
- src2 = get_src_reg( c, inst, 0, 2 );
- src3 = get_src_reg( c, inst, 0, 3 );
-
- param0 = alloc_tmp( c );
- param1 = alloc_tmp( c );
- param2 = alloc_tmp( c );
- param3 = alloc_tmp( c );
-
- brw_MOV( p, param0, src0 );
- brw_MOV( p, param1, src1 );
- brw_MOV( p, param2, src2 );
- brw_MOV( p, param3, src3 );
-
- invoke_subroutine( c, SUB_NOISE4, noise4_sub );
-
- /* Fill in the result: */
- brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
- for (i = 0 ; i < 4; i++) {
- if (mask & (1<<i)) {
- dst = get_dst_reg(c, inst, i);
- brw_MOV( p, dst, param0 );
- }
- }
- if( inst->SaturateMode == SATURATE_ZERO_ONE )
- brw_set_saturate( p, 0 );
-
- release_tmps( c, mark );
-}
-
/**
* Resolve subroutine calls after code emit is done.
*/
@@ -1990,18 +882,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
case OPCODE_MAD:
emit_mad(p, dst, dst_flags, args[0], args[1], args[2]);
break;
- case OPCODE_NOISE1:
- emit_noise1(c, inst);
- break;
- case OPCODE_NOISE2:
- emit_noise2(c, inst);
- break;
- case OPCODE_NOISE3:
- emit_noise3(c, inst);
- break;
- case OPCODE_NOISE4:
- emit_noise4(c, inst);
- break;
case OPCODE_TEX:
emit_tex(c, dst, dst_flags, args[0],
get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH,
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index a9ba93d24b..08069d71dd 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -873,6 +873,9 @@ intelDestroyContext(__DRIcontext * driContextPriv)
GLboolean
intelUnbindContext(__DRIcontext * driContextPriv)
{
+ /* Unset current context and dispath table */
+ _mesa_make_current(NULL, NULL, NULL);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
index de34bbb2ae..24f64045ef 100644
--- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c
@@ -39,6 +39,7 @@ static const char *es2_extensions[] = {
"GL_ARB_window_pos",
"GL_EXT_blend_func_separate",
"GL_EXT_compiled_vertex_array",
+ "GL_EXT_framebuffer_blit",
"GL_EXT_multi_draw_arrays",
"GL_EXT_polygon_offset",
"GL_EXT_texture_object",
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_class.h b/src/mesa/drivers/dri/nouveau/nouveau_class.h
index 5eff4af4d5..32ee8157d5 120000..100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_class.h
+++ b/src/mesa/drivers/dri/nouveau/nouveau_class.h
@@ -1 +1,4953 @@
-../../../../gallium/drivers/nouveau/nouveau_class.h \ No newline at end of file
+/*************************************************************************
+
+ Autogenerated file, do not edit !
+
+ This file was generated by renouveau-gen from renouveau.xml, the
+ XML database of nvidia objects and methods. renouveau-gen and
+ renouveau.xml can be found in CVS module renouveau of sourceforge.net
+ project nouveau:
+
+cvs -z3 -d:pserver:anonymous@nouveau.cvs.sourceforge.net:/cvsroot/nouveau co -P renouveau
+
+**************************************************************************
+
+ Copyright (C) 2006-2008 :
+ Dmitry Baryshkov,
+ Laurent Carlier,
+ Matthieu Castet,
+ Dawid Gajownik,
+ Jeremy Kolb,
+ Stephane Loeuillet,
+ Patrice Mandin,
+ Stephane Marchesin,
+ Serge Martin,
+ Sylvain Munaut,
+ Simon Raffeiner,
+ Ben Skeggs,
+ Erik Waling,
+ koala_br,
+
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+*************************************************************************/
+
+
+#ifndef NOUVEAU_REG_H
+#define NOUVEAU_REG_H 1
+
+
+#define NV01_ROOT 0x00000001
+
+
+
+#define NV01_CONTEXT_DMA 0x00000002
+
+
+
+#define NV01_DEVICE 0x00000003
+
+
+
+#define NV01_TIMER 0x00000004
+
+#define NV01_TIMER_SYNCHRONIZE 0x00000100
+#define NV01_TIMER_STOP_ALARM 0x00000104
+#define NV01_TIMER_DMA_NOTIFY 0x00000180
+#define NV01_TIMER_TIME(x) (0x00000300+((x)*4))
+#define NV01_TIMER_TIME__SIZE 0x00000002
+#define NV01_TIMER_ALARM_NOTIFY 0x00000308
+
+
+#define NV01_CONTEXT_BETA1 0x00000012
+
+#define NV01_CONTEXT_BETA1_NOP 0x00000100
+#define NV01_CONTEXT_BETA1_NOTIFY 0x00000104
+#define NV01_CONTEXT_BETA1_DMA_NOTIFY 0x00000180
+#define NV01_CONTEXT_BETA1_BETA_1D31 0x00000300
+
+
+#define NV01_CONTEXT_COLOR_KEY 0x00000017
+
+#define NV01_CONTEXT_COLOR_KEY_NOP 0x00000100
+#define NV01_CONTEXT_COLOR_KEY_NOTIFY 0x00000104
+#define NV01_CONTEXT_COLOR_KEY_DMA_NOTIFY 0x00000180
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT 0x00000300
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16A8Y8 0x00000001
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X24Y8 0x00000002
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16A1R5G5B5 0x00000003
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X17R5G5B5 0x00000004
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A8R8G8B8 0x00000005
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X8R8G8B8 0x00000006
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_A16Y16 0x00000007
+#define NV01_CONTEXT_COLOR_KEY_COLOR_FORMAT_X16Y16 0x00000008
+#define NV01_CONTEXT_COLOR_KEY_COLOR 0x00000304
+
+
+#define NV04_CONTEXT_COLOR_KEY 0x00000057
+
+
+
+#define NV01_CONTEXT_PATTERN 0x00000018
+
+#define NV01_CONTEXT_PATTERN_NOP 0x00000100
+#define NV01_CONTEXT_PATTERN_NOTIFY 0x00000104
+#define NV01_CONTEXT_PATTERN_DMA_NOTIFY 0x00000180
+#define NV01_CONTEXT_PATTERN_COLOR_FORMAT 0x00000300
+#define NV01_CONTEXT_PATTERN_MONOCHROME_FORMAT 0x00000304
+#define NV01_CONTEXT_PATTERN_SHAPE 0x00000308
+#define NV01_CONTEXT_PATTERN_COLOR(x) (0x00000310+((x)*4))
+#define NV01_CONTEXT_PATTERN_COLOR__SIZE 0x00000002
+#define NV01_CONTEXT_PATTERN_PATTERN(x) (0x00000318+((x)*4))
+#define NV01_CONTEXT_PATTERN_PATTERN__SIZE 0x00000002
+
+
+#define NV01_CONTEXT_CLIP_RECTANGLE 0x00000019
+
+#define NV01_CONTEXT_CLIP_RECTANGLE_NOP 0x00000100
+#define NV01_CONTEXT_CLIP_RECTANGLE_NOTIFY 0x00000104
+#define NV01_CONTEXT_CLIP_RECTANGLE_DMA_NOTIFY 0x00000180
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT 0x00000300
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X_SHIFT 0
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_X_MASK 0x0000ffff
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y_SHIFT 16
+#define NV01_CONTEXT_CLIP_RECTANGLE_POINT_Y_MASK 0xffff0000
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE 0x00000304
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W_SHIFT 0
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_W_MASK 0x0000ffff
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H_SHIFT 16
+#define NV01_CONTEXT_CLIP_RECTANGLE_SIZE_H_MASK 0xffff0000
+
+
+#define NV01_RENDER_SOLID_LINE 0x0000001c
+
+#define NV01_RENDER_SOLID_LINE_NOP 0x00000100
+#define NV01_RENDER_SOLID_LINE_NOTIFY 0x00000104
+#define NV01_RENDER_SOLID_LINE_PATCH 0x0000010c
+#define NV01_RENDER_SOLID_LINE_DMA_NOTIFY 0x00000180
+#define NV01_RENDER_SOLID_LINE_CLIP_RECTANGLE 0x00000184
+#define NV01_RENDER_SOLID_LINE_PATTERN 0x00000188
+#define NV01_RENDER_SOLID_LINE_ROP 0x0000018c
+#define NV01_RENDER_SOLID_LINE_BETA1 0x00000190
+#define NV01_RENDER_SOLID_LINE_SURFACE 0x00000194
+#define NV01_RENDER_SOLID_LINE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_LINE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_LINE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_LINE_OPERATION_BLEND_PREMULT 0x00000005
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16A8Y8 0x00000001
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X24Y8 0x00000002
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16A1R5G5B5 0x00000003
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X17R5G5B5 0x00000004
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A8R8G8B8 0x00000005
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X8R8G8B8 0x00000006
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_A16Y16 0x00000007
+#define NV01_RENDER_SOLID_LINE_COLOR_FORMAT_X16Y16 0x00000008
+#define NV01_RENDER_SOLID_LINE_COLOR 0x00000304
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0(x) (0x00000400+((x)*8))
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X_SHIFT 0
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y_SHIFT 16
+#define NV01_RENDER_SOLID_LINE_LINE_POINT0_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1(x) (0x00000404+((x)*8))
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X_SHIFT 0
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y_SHIFT 16
+#define NV01_RENDER_SOLID_LINE_LINE_POINT1_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X(x) (0x00000480+((x)*16))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_X__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y(x) (0x00000484+((x)*16))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT0_Y__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X(x) (0x00000488+((x)*16))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_X__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y(x) (0x0000048c+((x)*16))
+#define NV01_RENDER_SOLID_LINE_LINE32_POINT1_Y__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_POLYLINE(x) (0x00000500+((x)*4))
+#define NV01_RENDER_SOLID_LINE_POLYLINE__SIZE 0x00000020
+#define NV01_RENDER_SOLID_LINE_POLYLINE_X_SHIFT 0
+#define NV01_RENDER_SOLID_LINE_POLYLINE_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_POLYLINE_Y_SHIFT 16
+#define NV01_RENDER_SOLID_LINE_POLYLINE_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X(x) (0x00000580+((x)*8))
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_X__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y(x) (0x00000584+((x)*8))
+#define NV01_RENDER_SOLID_LINE_POLYLINE32_POINT_Y__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR(x) (0x00000600+((x)*8))
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_COLOR__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT(x) (0x00000604+((x)*8))
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT__SIZE 0x00000010
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X_SHIFT 0
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y_SHIFT 16
+#define NV01_RENDER_SOLID_LINE_CPOLYLINE_POINT_Y_MASK 0xffff0000
+
+
+#define NV04_RENDER_SOLID_LINE 0x0000005c
+
+#define NV04_RENDER_SOLID_LINE_BETA4 0x00000194
+#define NV04_RENDER_SOLID_LINE_SURFACE 0x00000198
+
+
+#define NV01_RENDER_SOLID_TRIANGLE 0x0000001d
+
+#define NV01_RENDER_SOLID_TRIANGLE_NOP 0x00000100
+#define NV01_RENDER_SOLID_TRIANGLE_NOTIFY 0x00000104
+#define NV01_RENDER_SOLID_TRIANGLE_PATCH 0x0000010c
+#define NV01_RENDER_SOLID_TRIANGLE_DMA_NOTIFY 0x00000180
+#define NV01_RENDER_SOLID_TRIANGLE_CLIP_RECTANGLE 0x00000184
+#define NV01_RENDER_SOLID_TRIANGLE_PATTERN 0x00000188
+#define NV01_RENDER_SOLID_TRIANGLE_ROP 0x0000018c
+#define NV01_RENDER_SOLID_TRIANGLE_BETA1 0x00000190
+#define NV01_RENDER_SOLID_TRIANGLE_SURFACE 0x00000194
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_TRIANGLE_OPERATION_BLEND_PREMULT 0x00000005
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_TRIANGLE_COLOR 0x00000304
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0 0x00000310
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT0_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1 0x00000314
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT1_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2 0x00000318
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE_POINT2_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_X 0x00000320
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT0_Y 0x00000324
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_X 0x00000328
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT1_Y 0x0000032c
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_X 0x00000330
+#define NV01_RENDER_SOLID_TRIANGLE_TRIANGLE32_POINT2_Y 0x00000334
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH(x) (0x00000400+((x)*4))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH__SIZE 0x00000020
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X(x) (0x00000480+((x)*8))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_X__SIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y(x) (0x00000484+((x)*8))
+#define NV01_RENDER_SOLID_TRIANGLE_TRIMESH32_POINT_Y__SIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR(x) (0x00000500+((x)*16))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_COLOR__SIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0(x) (0x00000504+((x)*16))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0__SIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT0_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1(x) (0x00000508+((x)*16))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1__SIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT1_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2(x) (0x0000050c+((x)*16))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2__SIZE 0x00000008
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIANGLE_POINT2_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR(x) (0x00000580+((x)*8))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_COLOR__SIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT(x) (0x00000584+((x)*8))
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT__SIZE 0x00000010
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X_SHIFT 0
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y_SHIFT 16
+#define NV01_RENDER_SOLID_TRIANGLE_CTRIMESH_POINT_Y_MASK 0xffff0000
+
+
+#define NV04_RENDER_SOLID_TRIANGLE 0x0000005d
+
+#define NV04_RENDER_SOLID_TRIANGLE_BETA4 0x00000194
+#define NV04_RENDER_SOLID_TRIANGLE_SURFACE 0x00000198
+
+
+#define NV01_RENDER_SOLID_RECTANGLE 0x0000001e
+
+#define NV01_RENDER_SOLID_RECTANGLE_NOP 0x00000100
+#define NV01_RENDER_SOLID_RECTANGLE_NOTIFY 0x00000104
+#define NV01_RENDER_SOLID_RECTANGLE_PATCH 0x0000010c
+#define NV01_RENDER_SOLID_RECTANGLE_DMA_NOTIFY 0x00000180
+#define NV01_RENDER_SOLID_RECTANGLE_CLIP_RECTANGLE 0x00000184
+#define NV01_RENDER_SOLID_RECTANGLE_PATTERN 0x00000188
+#define NV01_RENDER_SOLID_RECTANGLE_ROP 0x0000018c
+#define NV01_RENDER_SOLID_RECTANGLE_BETA1 0x00000190
+#define NV01_RENDER_SOLID_RECTANGLE_SURFACE 0x00000194
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION 0x000002fc
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_ROP_AND 0x00000001
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_AND 0x00000002
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY 0x00000003
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_RENDER_SOLID_RECTANGLE_OPERATION_BLEND_PREMULT 0x00000005
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR_FORMAT 0x00000300
+#define NV01_RENDER_SOLID_RECTANGLE_COLOR 0x00000304
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT(x) (0x00000400+((x)*8))
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT__SIZE 0x00000010
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X_SHIFT 0
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_X_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y_SHIFT 16
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_POINT_Y_MASK 0xffff0000
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE(x) (0x00000404+((x)*8))
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE__SIZE 0x00000010
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W_SHIFT 0
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_W_MASK 0x0000ffff
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H_SHIFT 16
+#define NV01_RENDER_SOLID_RECTANGLE_RECTANGLE_SIZE_H_MASK 0xffff0000
+
+
+#define NV04_RENDER_SOLID_RECTANGLE 0x0000005e
+
+#define NV04_RENDER_SOLID_RECTANGLE_BETA4 0x00000194
+#define NV04_RENDER_SOLID_RECTANGLE_SURFACE 0x00000198
+
+
+#define NV01_IMAGE_BLIT 0x0000001f
+
+#define NV01_IMAGE_BLIT_NOP 0x00000100
+#define NV01_IMAGE_BLIT_NOTIFY 0x00000104
+#define NV01_IMAGE_BLIT_PATCH 0x0000010c
+#define NV01_IMAGE_BLIT_DMA_NOTIFY 0x00000180
+#define NV01_IMAGE_BLIT_COLOR_KEY 0x00000184
+#define NV01_IMAGE_BLIT_CLIP_RECTANGLE 0x00000188
+#define NV01_IMAGE_BLIT_PATTERN 0x0000018c
+#define NV01_IMAGE_BLIT_ROP 0x00000190
+#define NV01_IMAGE_BLIT_BETA1 0x00000194
+#define NV01_IMAGE_BLIT_SURFACE 0x0000019c
+#define NV01_IMAGE_BLIT_OPERATION 0x000002fc
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_IMAGE_BLIT_OPERATION_ROP_AND 0x00000001
+#define NV01_IMAGE_BLIT_OPERATION_BLEND_AND 0x00000002
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY 0x00000003
+#define NV01_IMAGE_BLIT_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_IMAGE_BLIT_OPERATION_BLEND_PREMULT 0x00000005
+#define NV01_IMAGE_BLIT_IMAGE_INPUT 0x00000204
+#define NV01_IMAGE_BLIT_POINT_IN 0x00000300
+#define NV01_IMAGE_BLIT_POINT_IN_X_SHIFT 0
+#define NV01_IMAGE_BLIT_POINT_IN_X_MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_POINT_IN_Y_SHIFT 16
+#define NV01_IMAGE_BLIT_POINT_IN_Y_MASK 0xffff0000
+#define NV01_IMAGE_BLIT_POINT_OUT 0x00000304
+#define NV01_IMAGE_BLIT_POINT_OUT_X_SHIFT 0
+#define NV01_IMAGE_BLIT_POINT_OUT_X_MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_POINT_OUT_Y_SHIFT 16
+#define NV01_IMAGE_BLIT_POINT_OUT_Y_MASK 0xffff0000
+#define NV01_IMAGE_BLIT_SIZE 0x00000308
+#define NV01_IMAGE_BLIT_SIZE_W_SHIFT 0
+#define NV01_IMAGE_BLIT_SIZE_W_MASK 0x0000ffff
+#define NV01_IMAGE_BLIT_SIZE_H_SHIFT 16
+#define NV01_IMAGE_BLIT_SIZE_H_MASK 0xffff0000
+
+
+#define NV04_IMAGE_BLIT 0x0000005f
+
+#define NV04_IMAGE_BLIT_ROP 0x00000190
+#define NV04_IMAGE_BLIT_BETA4 0x00000198
+#define NV04_IMAGE_BLIT_SURFACE 0x0000019c
+
+
+#define NV12_IMAGE_BLIT 0x0000009f
+
+#define NV12_IMAGE_BLIT_WAIT_FOR_IDLE 0x00000108
+
+
+#define NV01_IMAGE_FROM_CPU 0x00000021
+
+#define NV01_IMAGE_FROM_CPU_NOP 0x00000100
+#define NV01_IMAGE_FROM_CPU_NOTIFY 0x00000104
+#define NV01_IMAGE_FROM_CPU_PATCH 0x0000010c
+#define NV01_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+#define NV01_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+#define NV01_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x00000188
+#define NV01_IMAGE_FROM_CPU_PATTERN 0x0000018c
+#define NV01_IMAGE_FROM_CPU_ROP 0x00000190
+#define NV01_IMAGE_FROM_CPU_BETA1 0x00000194
+#define NV01_IMAGE_FROM_CPU_SURFACE 0x00000198
+#define NV01_IMAGE_FROM_CPU_OPERATION 0x000002fc
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_AND 0x00000000
+#define NV01_IMAGE_FROM_CPU_OPERATION_ROP_AND 0x00000001
+#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_AND 0x00000002
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY 0x00000003
+#define NV01_IMAGE_FROM_CPU_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV01_IMAGE_FROM_CPU_OPERATION_BLEND_PREMULT 0x00000005
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_Y8 0x00000001
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A1R5G5B5 0x00000002
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X1R5G5B5 0x00000003
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_A8R8G8B8 0x00000004
+#define NV01_IMAGE_FROM_CPU_COLOR_FORMAT_X8R8G8B8 0x00000005
+#define NV01_IMAGE_FROM_CPU_POINT 0x00000304
+#define NV01_IMAGE_FROM_CPU_POINT_X_SHIFT 0
+#define NV01_IMAGE_FROM_CPU_POINT_X_MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_POINT_Y_SHIFT 16
+#define NV01_IMAGE_FROM_CPU_POINT_Y_MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT 0x00000308
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W_SHIFT 0
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_W_MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H_SHIFT 16
+#define NV01_IMAGE_FROM_CPU_SIZE_OUT_H_MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_SIZE_IN 0x0000030c
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_W_SHIFT 0
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_W_MASK 0x0000ffff
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_H_SHIFT 16
+#define NV01_IMAGE_FROM_CPU_SIZE_IN_H_MASK 0xffff0000
+#define NV01_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
+#define NV01_IMAGE_FROM_CPU_COLOR__SIZE 0x00000020
+
+
+#define NV04_IMAGE_FROM_CPU 0x00000061
+
+#define NV04_IMAGE_FROM_CPU_BETA4 0x00000198
+#define NV04_IMAGE_FROM_CPU_SURFACE 0x0000019c
+
+
+#define NV05_IMAGE_FROM_CPU 0x00000065
+
+#define NV05_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
+
+
+#define NV10_IMAGE_FROM_CPU 0x0000008a
+
+#define NV10_IMAGE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
+
+
+#define NV30_IMAGE_FROM_CPU 0x0000038a
+
+
+
+#define NV40_IMAGE_FROM_CPU 0x0000308a
+
+
+
+#define NV01_NULL 0x00000030
+
+
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU 0x00000036
+
+#define NV03_STRETCHED_IMAGE_FROM_CPU_NOP 0x00000100
+#define NV03_STRETCHED_IMAGE_FROM_CPU_NOTIFY 0x00000104
+#define NV03_STRETCHED_IMAGE_FROM_CPU_PATCH 0x0000010c
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_KEY 0x00000184
+#define NV03_STRETCHED_IMAGE_FROM_CPU_PATTERN 0x00000188
+#define NV03_STRETCHED_IMAGE_FROM_CPU_ROP 0x0000018c
+#define NV03_STRETCHED_IMAGE_FROM_CPU_BETA1 0x00000190
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SURFACE 0x00000194
+#define NV03_STRETCHED_IMAGE_FROM_CPU_OPERATION 0x000002fc
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR_FORMAT 0x00000300
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN 0x00000304
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W_SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_W_MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H_SHIFT 16
+#define NV03_STRETCHED_IMAGE_FROM_CPU_SIZE_IN_H_MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DX_DU 0x00000308
+#define NV03_STRETCHED_IMAGE_FROM_CPU_DY_DV 0x0000030c
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT 0x00000310
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X_SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_X_MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y_SHIFT 16
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_POINT_Y_MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE 0x00000314
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W_SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_W_MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H_SHIFT 16
+#define NV03_STRETCHED_IMAGE_FROM_CPU_CLIP_SIZE_H_MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4 0x00000318
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X_SHIFT 0
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_X_MASK 0x0000ffff
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y_SHIFT 16
+#define NV03_STRETCHED_IMAGE_FROM_CPU_POINT12D4_Y_MASK 0xffff0000
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
+#define NV03_STRETCHED_IMAGE_FROM_CPU_COLOR__SIZE 0x00000020
+
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU 0x00000076
+
+#define NV04_STRETCHED_IMAGE_FROM_CPU_BETA4 0x00000194
+#define NV04_STRETCHED_IMAGE_FROM_CPU_SURFACE 0x00000198
+
+
+#define NV05_STRETCHED_IMAGE_FROM_CPU 0x00000066
+
+#define NV05_STRETCHED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000002f8
+
+
+#define NV30_STRETCHED_IMAGE_FROM_CPU 0x00000366
+
+
+
+#define NV40_STRETCHED_IMAGE_FROM_CPU 0x00003066
+
+
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY 0x00000037
+
+#define NV03_SCALED_IMAGE_FROM_MEMORY_NOP 0x00000100
+#define NV03_SCALED_IMAGE_FROM_MEMORY_NOTIFY 0x00000104
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_NOTIFY 0x00000180
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE 0x00000184
+#define NV03_SCALED_IMAGE_FROM_MEMORY_PATTERN 0x00000188
+#define NV03_SCALED_IMAGE_FROM_MEMORY_ROP 0x0000018c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_BETA1 0x00000190
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000194
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT 0x00000300
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5 0x00000001
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X1R5G5B5 0x00000002
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A8R8G8B8 0x00000003
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8 0x00000004
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_V8YB8U8YA8 0x00000005
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_YB8V8YA8U8 0x00000006
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5 0x00000007
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8 0x00000008
+#define NV03_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_AY8 0x00000009
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION 0x00000304
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_AND 0x00000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_ROP_AND 0x00000001
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_AND 0x00000002
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY 0x00000003
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OPERATION_BLEND_PREMULT 0x00000005
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT 0x00000308
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_X_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_POINT_Y_MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE 0x0000030c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_W_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT 0x00000310
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_X_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_POINT_Y_MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE 0x00000314
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_W_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DU_DX 0x00000318
+#define NV03_SCALED_IMAGE_FROM_MEMORY_DV_DY 0x0000031c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE 0x00000400
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_W_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_SIZE_H_MASK 0xffff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT 0x00000404
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_PITCH_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_MASK 0x00ff0000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER 0x00010000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CORNER 0x00020000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_SHIFT 24
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_MASK 0xff000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE 0x00000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_BILINEAR 0x01000000
+#define NV03_SCALED_IMAGE_FROM_MEMORY_OFFSET 0x00000408
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT 0x0000040c
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U_SHIFT 0
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_U_MASK 0x0000ffff
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V_SHIFT 16
+#define NV03_SCALED_IMAGE_FROM_MEMORY_POINT_V_MASK 0xffff0000
+
+
+#define NV04_SCALED_IMAGE_FROM_MEMORY 0x00000077
+
+#define NV04_SCALED_IMAGE_FROM_MEMORY_BETA4 0x00000194
+#define NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE 0x00000198
+
+
+#define NV05_SCALED_IMAGE_FROM_MEMORY 0x00000063
+
+#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION 0x000002fc
+#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_DITHER 0x00000000
+#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE 0x00000001
+#define NV05_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_SUBTR_TRUNCATE 0x00000002
+
+
+#define NV10_SCALED_IMAGE_FROM_MEMORY 0x00000089
+
+#define NV10_SCALED_IMAGE_FROM_MEMORY_WAIT_FOR_IDLE 0x00000108
+
+
+#define NV30_SCALED_IMAGE_FROM_MEMORY 0x00000389
+
+
+
+#define NV40_SCALED_IMAGE_FROM_MEMORY 0x00003089
+
+
+
+#define NV04_DVD_SUBPICTURE 0x00000038
+
+#define NV04_DVD_SUBPICTURE_NOP 0x00000100
+#define NV04_DVD_SUBPICTURE_NOTIFY 0x00000104
+#define NV04_DVD_SUBPICTURE_DMA_NOTIFY 0x00000180
+#define NV04_DVD_SUBPICTURE_DMA_OVERLAY 0x00000184
+#define NV04_DVD_SUBPICTURE_DMA_IMAGEIN 0x00000188
+#define NV04_DVD_SUBPICTURE_DMA_IMAGEOUT 0x0000018c
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT 0x00000300
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_X_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_X_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_Y_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_POINT_Y_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE 0x00000304
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_W_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_W_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_H_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_SIZE_H_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT 0x00000308
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_PITCH_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_PITCH_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_COLOR_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_FORMAT_COLOR_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_IMAGEOUT_OFFSET 0x0000030c
+#define NV04_DVD_SUBPICTURE_IMAGEIN_DELTA_DU_DX 0x00000310
+#define NV04_DVD_SUBPICTURE_IMAGEIN_DELTA_DV_DY 0x00000314
+#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE 0x00000318
+#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_W_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_W_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_H_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEIN_SIZE_H_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT 0x0000031c
+#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_PITCH_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_PITCH_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_COLOR_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEIN_FORMAT_COLOR_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_IMAGEIN_OFFSET 0x00000320
+#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT 0x00000324
+#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_U_SHIFT 0
+#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_U_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_V_SHIFT 16
+#define NV04_DVD_SUBPICTURE_IMAGEIN_POINT_V_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_OVERLAY_DELTA_DU_DX 0x00000328
+#define NV04_DVD_SUBPICTURE_OVERLAY_DELTA_DV_DY 0x0000032c
+#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE 0x00000330
+#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_W_SHIFT 0
+#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_W_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_H_SHIFT 16
+#define NV04_DVD_SUBPICTURE_OVERLAY_SIZE_H_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT 0x00000334
+#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_PITCH_SHIFT 0
+#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_PITCH_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_COLOR_SHIFT 16
+#define NV04_DVD_SUBPICTURE_OVERLAY_FORMAT_COLOR_MASK 0xffff0000
+#define NV04_DVD_SUBPICTURE_OVERLAY_OFFSET 0x00000338
+#define NV04_DVD_SUBPICTURE_OVERLAY_POINT 0x0000033c
+#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_U_SHIFT 0
+#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_U_MASK 0x0000ffff
+#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_V_SHIFT 16
+#define NV04_DVD_SUBPICTURE_OVERLAY_POINT_V_MASK 0xffff0000
+
+
+#define NV10_DVD_SUBPICTURE 0x00000088
+
+#define NV10_DVD_SUBPICTURE_WAIT_FOR_IDLE 0x00000108
+
+
+#define NV04_MEMORY_TO_MEMORY_FORMAT 0x00000039
+
+#define NV04_MEMORY_TO_MEMORY_FORMAT_NOP 0x00000100
+#define NV04_MEMORY_TO_MEMORY_FORMAT_NOTIFY 0x00000104
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_NOTIFY 0x00000180
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN 0x00000184
+#define NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_OUT 0x00000188
+#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN 0x0000030c
+#define NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT 0x00000310
+#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_IN 0x00000314
+#define NV04_MEMORY_TO_MEMORY_FORMAT_PITCH_OUT 0x00000318
+#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_LENGTH_IN 0x0000031c
+#define NV04_MEMORY_TO_MEMORY_FORMAT_LINE_COUNT 0x00000320
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT 0x00000324
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_SHIFT 0
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_INPUT_INC_MASK 0x000000ff
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_SHIFT 8
+#define NV04_MEMORY_TO_MEMORY_FORMAT_FORMAT_OUTPUT_INC_MASK 0x0000ff00
+#define NV04_MEMORY_TO_MEMORY_FORMAT_BUF_NOTIFY 0x00000328
+
+
+#define NV50_MEMORY_TO_MEMORY_FORMAT 0x00005039
+
+#define NV50_MEMORY_TO_MEMORY_FORMAT_SERIALIZE 0x00000110
+#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_IN 0x00000200
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_IN 0x00000204
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_IN 0x00000208
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_IN 0x0000020c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_IN 0x00000210
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Z 0x00000214
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN 0x00000218
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_SHIFT 0
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_X_MASK 0x0000ffff
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_SHIFT 16
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_IN_Y_MASK 0xffff0000
+#define NV50_MEMORY_TO_MEMORY_FORMAT_LINEAR_OUT 0x0000021c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_MODE_OUT 0x00000220
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_PITCH_OUT 0x00000224
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_HEIGHT_OUT 0x00000228
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_DEPTH_OUT 0x0000022c
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Z 0x00000230
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT 0x00000234
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_SHIFT 0
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_X_MASK 0x0000ffff
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_SHIFT 16
+#define NV50_MEMORY_TO_MEMORY_FORMAT_TILING_POSITION_OUT_Y_MASK 0xffff0000
+#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN_HIGH 0x00000238
+#define NV50_MEMORY_TO_MEMORY_FORMAT_OFFSET_OUT_HIGH 0x0000023c
+
+
+#define NV01_MEMORY_LOCAL_BANKED 0x0000003d
+
+
+
+#define NV01_MAPPING_SYSTEM 0x0000003e
+
+
+
+#define NV03_MEMORY_LOCAL_CURSOR 0x0000003f
+
+
+
+#define NV01_MEMORY_LOCAL_LINEAR 0x00000040
+
+
+
+#define NV01_MAPPING_LOCAL 0x00000041
+
+
+
+#define NV04_CONTEXT_SURFACES_2D 0x00000042
+
+#define NV04_CONTEXT_SURFACES_2D_NOP 0x00000100
+#define NV04_CONTEXT_SURFACES_2D_NOTIFY 0x00000104
+#define NV04_CONTEXT_SURFACES_2D_PM_TRIGGER 0x00000140
+#define NV04_CONTEXT_SURFACES_2D_DMA_NOTIFY 0x00000180
+#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_SOURCE 0x00000184
+#define NV04_CONTEXT_SURFACES_2D_DMA_IMAGE_DESTIN 0x00000188
+#define NV04_CONTEXT_SURFACES_2D_FORMAT 0x00000300
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y8 0x00000001
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_Z1R5G5B5 0x00000002
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1R5G5B5_X1R5G5B5 0x00000003
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5 0x00000004
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y16 0x00000005
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_Z8R8G8B8 0x00000006
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X8R8G8B8_X8R8G8B8 0x00000007
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_X1A7R8G8B8_X1A7R8G8B8 0x00000009
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_A8R8G8B8 0x0000000a
+#define NV04_CONTEXT_SURFACES_2D_FORMAT_Y32 0x0000000b
+#define NV04_CONTEXT_SURFACES_2D_PITCH 0x00000304
+#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE_SHIFT 0
+#define NV04_CONTEXT_SURFACES_2D_PITCH_SOURCE_MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN_SHIFT 16
+#define NV04_CONTEXT_SURFACES_2D_PITCH_DESTIN_MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_2D_OFFSET_SOURCE 0x00000308
+#define NV04_CONTEXT_SURFACES_2D_OFFSET_DESTIN 0x0000030c
+
+
+#define NV10_CONTEXT_SURFACES_2D 0x00000062
+
+
+
+#define NV30_CONTEXT_SURFACES_2D 0x00000362
+
+
+
+#define NV40_CONTEXT_SURFACES_2D 0x00003062
+
+
+
+#define NV03_CONTEXT_ROP 0x00000043
+
+#define NV03_CONTEXT_ROP_NOP 0x00000100
+#define NV03_CONTEXT_ROP_NOTIFY 0x00000104
+#define NV03_CONTEXT_ROP_DMA_NOTIFY 0x00000180
+#define NV03_CONTEXT_ROP_ROP 0x00000300
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_SHIFT 0
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_MASK 0x0000000f
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_CLEAR 0x00000000
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NOR 0x00000001
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND_INVERTED 0x00000002
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_COPY_INVERTED 0x00000003
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND_REVERSE 0x00000004
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_INVERT 0x00000005
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_XOR 0x00000006
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NAND 0x00000007
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_AND 0x00000008
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_EQUI 0x00000009
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_NOOP 0x0000000a
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR_INVERTED 0x0000000b
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_COPY 0x0000000c
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR_REVERSE 0x0000000d
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_OR 0x0000000e
+#define NV03_CONTEXT_ROP_ROP_DST_LOGIC_OP_SET 0x0000000f
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_SHIFT 4
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_MASK 0x000000f0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_CLEAR 0x00000000
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NOR 0x00000010
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND_INVERTED 0x00000020
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_COPY_INVERTED 0x00000030
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND_REVERSE 0x00000040
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_INVERT 0x00000050
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_XOR 0x00000060
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NAND 0x00000070
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_AND 0x00000080
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_EQUI 0x00000090
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_NOOP 0x000000a0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR_INVERTED 0x000000b0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_COPY 0x000000c0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR_REVERSE 0x000000d0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_OR 0x000000e0
+#define NV03_CONTEXT_ROP_ROP_SRC_LOGIC_OP_SET 0x000000f0
+
+
+#define NV04_IMAGE_PATTERN 0x00000044
+
+#define NV04_IMAGE_PATTERN_NOP 0x00000100
+#define NV04_IMAGE_PATTERN_NOTIFY 0x00000104
+#define NV04_IMAGE_PATTERN_DMA_NOTIFY 0x00000180
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT 0x00000300
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV04_IMAGE_PATTERN_COLOR_FORMAT_A8R8G8B8 0x00000003
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT 0x00000304
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_CGA6 0x00000001
+#define NV04_IMAGE_PATTERN_MONOCHROME_FORMAT_LE 0x00000002
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE 0x00000308
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_8X8 0x00000000
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_64X1 0x00000001
+#define NV04_IMAGE_PATTERN_MONOCHROME_SHAPE_1X64 0x00000002
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT 0x0000030c
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT_MONO 0x00000001
+#define NV04_IMAGE_PATTERN_PATTERN_SELECT_COLOR 0x00000002
+#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR0 0x00000310
+#define NV04_IMAGE_PATTERN_MONOCHROME_COLOR1 0x00000314
+#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN0 0x00000318
+#define NV04_IMAGE_PATTERN_MONOCHROME_PATTERN1 0x0000031c
+#define NV04_IMAGE_PATTERN_PATTERN_Y8(x) (0x00000400+((x)*4))
+#define NV04_IMAGE_PATTERN_PATTERN_Y8__SIZE 0x00000010
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0_SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y0_MASK 0x000000ff
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1_SHIFT 8
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y1_MASK 0x0000ff00
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2_SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y2_MASK 0x00ff0000
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3_SHIFT 24
+#define NV04_IMAGE_PATTERN_PATTERN_Y8_Y3_MASK 0xff000000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5(x) (0x00000500+((x)*4))
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5__SIZE 0x00000020
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0_SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B0_MASK 0x0000001f
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0_SHIFT 5
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G0_MASK 0x000007e0
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0_SHIFT 11
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R0_MASK 0x0000f800
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1_SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_B1_MASK 0x001f0000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1_SHIFT 21
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_G1_MASK 0x07e00000
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1_SHIFT 27
+#define NV04_IMAGE_PATTERN_PATTERN_R5G6B5_R1_MASK 0xf8000000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5(x) (0x00000600+((x)*4))
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5__SIZE 0x00000020
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0_SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B0_MASK 0x0000001f
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0_SHIFT 5
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G0_MASK 0x000003e0
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0_SHIFT 10
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R0_MASK 0x00007c00
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1_SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_B1_MASK 0x001f0000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1_SHIFT 21
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_G1_MASK 0x03e00000
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1_SHIFT 26
+#define NV04_IMAGE_PATTERN_PATTERN_X1R5G5B5_R1_MASK 0x7c000000
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8(x) (0x00000700+((x)*4))
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8__SIZE 0x00000040
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B_SHIFT 0
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_B_MASK 0x000000ff
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G_SHIFT 8
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_G_MASK 0x0000ff00
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R_SHIFT 16
+#define NV04_IMAGE_PATTERN_PATTERN_X8R8G8B8_R_MASK 0x00ff0000
+
+
+#define NV03_VIDEO_LUT_CURSOR_DAC 0x00000046
+
+#define NV03_VIDEO_LUT_CURSOR_DAC_SYNCHRONIZE 0x00000100
+#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_IMAGE 0x00000104
+#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_CURSOR 0x00000108
+#define NV03_VIDEO_LUT_CURSOR_DAC_STOP_DAC 0x0000010c
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_NOTIFY 0x00000180
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_IMAGE(x) (0x00000184+((x)*4))
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_IMAGE__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_LUT(x) (0x0000018c+((x)*4))
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_LUT__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_CURSOR(x) (0x00000194+((x)*4))
+#define NV03_VIDEO_LUT_CURSOR_DAC_DMA_CURSOR__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_GET 0x000002fc
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_OFFSET(x) (0x00000300+((x)*8))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_OFFSET__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT(x) (0x00000304+((x)*8))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_PITCH_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_PITCH_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_COLOR_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_COLOR_MASK 0x0fff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_NOTIFY_SHIFT 28
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_IMAGE_FORMAT_NOTIFY_MASK 0xf0000000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_OFFSET(x) (0x00000340+((x)*12))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_OFFSET__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT(x) (0x00000344+((x)*12))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_X_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_X_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_Y_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_Y_MASK 0xffff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_FORMAT(x) (0x00000348+((x)*12))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_FORMAT__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A 0x00000358
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_X_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_X_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_Y_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_CURSOR_POINT_OUT_A_Y_MASK 0xffff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE(x) (0x00000380+((x)*16))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_W_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_W_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_H_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_IMAGE_SIZE_H_MASK 0xffff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC(x) (0x00000384+((x)*16))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_START_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_START_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_WIDTH_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_WIDTH_MASK 0x0fff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_POLARITY_SHIFT 28
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_HSYNC_POLARITY_MASK 0xf0000000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC(x) (0x00000388+((x)*16))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_START_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_START_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_WIDTH_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_WIDTH_MASK 0x0fff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_POLARITY_SHIFT 28
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_VSYNC_POLARITY_MASK 0xf0000000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE(x) (0x0000038c+((x)*16))
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE__SIZE 0x00000002
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_WIDTH_SHIFT 0
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_WIDTH_MASK 0x0000ffff
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_HEIGHT_SHIFT 16
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_HEIGHT_MASK 0x0fff0000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_NOTIFY_SHIFT 28
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_DAC_TOTAL_SIZE_NOTIFY_MASK 0xf0000000
+#define NV03_VIDEO_LUT_CURSOR_DAC_SET_PIXEL_CLOCK 0x000003a0
+
+
+#define NV03_TEXTURED_TRIANGLE 0x00000048
+
+#define NV03_TEXTURED_TRIANGLE_NOP 0x00000100
+#define NV03_TEXTURED_TRIANGLE_NOTIFY 0x00000104
+#define NV03_TEXTURED_TRIANGLE_PATCH 0x0000010c
+#define NV03_TEXTURED_TRIANGLE_DMA_NOTIFY 0x00000180
+#define NV03_TEXTURED_TRIANGLE_DMA_TEXTURE 0x00000184
+#define NV03_TEXTURED_TRIANGLE_CLIP_RECTANGLE 0x00000188
+#define NV03_TEXTURED_TRIANGLE_SURFACE 0x0000018c
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_OFFSET 0x00000304
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT 0x00000308
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_MASK_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_MASK_MASK 0x0000ffff
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_ENABLE_SHIFT 16
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_KEY_ENABLE_MASK 0x000f0000
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_SHIFT 20
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_COLOR_MASK 0x00f00000
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MIN_SHIFT 24
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MIN_MASK 0x0f000000
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MAX_SHIFT 28
+#define NV03_TEXTURED_TRIANGLE_TEXTURE_FORMAT_SIZE_MAX_MASK 0xf0000000
+#define NV03_TEXTURED_TRIANGLE_FILTER 0x0000030c
+#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_X_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_X_MASK 0x0000001f
+#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_Y_SHIFT 8
+#define NV03_TEXTURED_TRIANGLE_FILTER_SPREAD_Y_MASK 0x00001f00
+#define NV03_TEXTURED_TRIANGLE_FILTER_SIZE_ADJUST_SHIFT 16
+#define NV03_TEXTURED_TRIANGLE_FILTER_SIZE_ADJUST_MASK 0x00ff0000
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR 0x00000310
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_B_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_B_MASK 0x000000ff
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_G_SHIFT 8
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_G_MASK 0x0000ff00
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_R_SHIFT 16
+#define NV03_TEXTURED_TRIANGLE_FOG_COLOR_R_MASK 0x00ff0000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT 0x00000314
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_INTERPOLATOR_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_INTERPOLATOR_MASK 0x0000000f
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_U_SHIFT 4
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_U_MASK 0x00000030
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_V_SHIFT 6
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_WRAP_V_MASK 0x000000c0
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SOURCE_COLOR_SHIFT 8
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SOURCE_COLOR_MASK 0x00000f00
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_CULLING_SHIFT 12
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_CULLING_MASK 0x00007000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_PERSPECTIVE_ENABLE (1 << 15)
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_FUNC_SHIFT 16
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_FUNC_MASK 0x000f0000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_WRITE_ENABLE_SHIFT 20
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_Z_WRITE_ENABLE_MASK 0x00f00000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_COLOR_WRITE_ENABLE_SHIFT 24
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_COLOR_WRITE_ENABLE_MASK 0x07000000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_ROP_SHIFT 27
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_ROP_MASK 0x18000000
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_BETA (1 << 29)
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_DST_BLEND (1 << 30)
+#define NV03_TEXTURED_TRIANGLE_CONTROL_OUT_SRC_BLEND (1 << 31)
+#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL 0x00000318
+#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_REF_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_REF_MASK 0x000000ff
+#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_FUNC_SHIFT 8
+#define NV03_TEXTURED_TRIANGLE_ALPHA_CONTROL_ALPHA_FUNC_MASK 0xffffff00
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR(x) (0x00001000+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I0_SHIFT 0
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I0_MASK 0x0000000f
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I1_SHIFT 4
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I1_MASK 0x000000f0
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I2_SHIFT 8
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I2_MASK 0x00000f00
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I3_SHIFT 12
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I3_MASK 0x0000f000
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I4_SHIFT 16
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I4_MASK 0x000f0000
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I5_SHIFT 20
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_I5_MASK 0x00f00000
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_SHIFT 24
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_MASK 0xff000000
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_COLOR(x) (0x00001004+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_COLOR__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SX(x) (0x00001008+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SX__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SY(x) (0x0000100c+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SY__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SZ(x) (0x00001010+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_SZ__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_RHW(x) (0x00001014+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_RHW__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TU(x) (0x00001018+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TU__SIZE 0x00000080
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TV(x) (0x0000101c+((x)*32))
+#define NV03_TEXTURED_TRIANGLE_TLVERTEX_TV__SIZE 0x00000080
+
+
+#define NV04_GDI_RECTANGLE_TEXT 0x0000004a
+
+#define NV04_GDI_RECTANGLE_TEXT_NOP 0x00000100
+#define NV04_GDI_RECTANGLE_TEXT_NOTIFY 0x00000104
+#define NV04_GDI_RECTANGLE_TEXT_PATCH 0x0000010c
+#define NV04_GDI_RECTANGLE_TEXT_PM_TRIGGER 0x00000140
+#define NV04_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
+#define NV04_GDI_RECTANGLE_TEXT_DMA_FONTS 0x00000184
+#define NV04_GDI_RECTANGLE_TEXT_PATTERN 0x00000188
+#define NV04_GDI_RECTANGLE_TEXT_ROP 0x0000018c
+#define NV04_GDI_RECTANGLE_TEXT_BETA1 0x00000190
+#define NV04_GDI_RECTANGLE_TEXT_BETA4 0x00000194
+#define NV04_GDI_RECTANGLE_TEXT_SURFACE 0x00000198
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_AND 0x00000000
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_ROP_AND 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_AND 0x00000002
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY 0x00000003
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_SRCCOPY_PREMULT 0x00000004
+#define NV04_GDI_RECTANGLE_TEXT_OPERATION_BLEND_PREMULT 0x00000005
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_X16A1R5G5B5 0x00000002
+#define NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8 0x00000003
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_CGA6 0x00000001
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT_LE 0x00000002
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT(x) (0x00000400+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT__SIZE 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE(x) (0x00000404+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE__SIZE 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0 0x000005f4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1 0x000005f8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_B_POINT1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_B 0x000005fc
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0(x) (0x00000600+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0__SIZE 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1(x) (0x00000604+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1__SIZE 0x00000020
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x000007ec
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x000007f0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_C 0x000007f4
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C 0x000007f8
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_W_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_C_H_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C 0x000007fc
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_X_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_POINT_C_Y_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(x) (0x00000800+((x)*4))
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__SIZE 0x00000080
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x00000be4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x00000be8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_COLOR0_E 0x00000bec
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_E 0x00000bf0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x00000bf4
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x00000bf8
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E 0x00000bfc
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_X_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_POINT_E_Y_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(x) (0x00000c00+((x)*4))
+#define NV04_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__SIZE 0x00000080
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F 0x00000ff0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_OFFSET_MASK 0x0fffffff
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH_SHIFT 28
+#define NV04_GDI_RECTANGLE_TEXT_FONT_F_PITCH_MASK 0xf0000000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0 0x00000ff4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1 0x00000ff8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_F_POINT1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_F 0x00000ffc
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F(x) (0x00001000+((x)*4))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F__SIZE 0x00000100
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_INDEX_MASK 0x000000ff
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X_SHIFT 8
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_X_MASK 0x000fff00
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y_SHIFT 20
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_F_Y_MASK 0xfff00000
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G 0x000017f0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_OFFSET_MASK 0x0fffffff
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH_SHIFT 28
+#define NV04_GDI_RECTANGLE_TEXT_FONT_G_PITCH_MASK 0xf0000000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0 0x000017f4
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_L_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT0_T_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1 0x000017f8
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_R_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CLIP_G_POINT1_B_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_COLOR1_G 0x000017fc
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT(x) (0x00001800+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT__SIZE 0x00000100
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X_SHIFT 0
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_X_MASK 0x0000ffff
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y_SHIFT 16
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_POINT_Y_MASK 0xffff0000
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX(x) (0x00001804+((x)*8))
+#define NV04_GDI_RECTANGLE_TEXT_CHARACTER_COLOR1_G_INDEX__SIZE 0x00000100
+
+
+#define NV03_GDI_RECTANGLE_TEXT 0x0000004b
+
+#define NV03_GDI_RECTANGLE_TEXT_NOP 0x00000100
+#define NV03_GDI_RECTANGLE_TEXT_NOTIFY 0x00000104
+#define NV03_GDI_RECTANGLE_TEXT_DMA_NOTIFY 0x00000180
+#define NV03_GDI_RECTANGLE_TEXT_PATTERN 0x00000184
+#define NV03_GDI_RECTANGLE_TEXT_ROP 0x00000188
+#define NV03_GDI_RECTANGLE_TEXT_BETA1 0x0000018c
+#define NV03_GDI_RECTANGLE_TEXT_SURFACE 0x00000190
+#define NV03_GDI_RECTANGLE_TEXT_OPERATION 0x000002fc
+#define NV03_GDI_RECTANGLE_TEXT_COLOR_FORMAT 0x00000300
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_FORMAT 0x00000304
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_A 0x000003fc
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT 0x00000400
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_Y_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_POINT_X_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE 0x00000404
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_H_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_UNCLIPPED_RECTANGLE_SIZE_W_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B 0x000007f4
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_L_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT0_B_T_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B 0x000007f8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_R_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_POINT1_B_B_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_B 0x000007fc
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0 0x00000800
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_L_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_0_T_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1 0x00000804
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_R_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIPPED_RECTANGLE_POINT_1_B_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0 0x00000bec
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_L_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT0_T_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1 0x00000bf0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_R_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_C_POINT1_B_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_C 0x00000bf4
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C 0x00000bf8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_W_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_C_H_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C 0x00000bfc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_X_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_POINT_C_Y_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C(x) (0x00000c00+((x)*4))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_C__SIZE 0x00000020
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0 0x00000fe8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_L_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT0_T_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1 0x00000fec
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_R_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_D_POINT1_B_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_D 0x00000ff0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D 0x00000ff4
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_W_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_D_H_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D 0x00000ff8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_W_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_D_H_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D 0x00000ffc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_X_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_POINT_D_Y_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D(x) (0x00001000+((x)*4))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR1_D__SIZE 0x00000020
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0 0x000013e4
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_L_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT0_T_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1 0x000013e8
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_R_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_CLIP_E_POINT1_B_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_COLOR0_E 0x000013ec
+#define NV03_GDI_RECTANGLE_TEXT_COLOR1_E 0x000013f0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E 0x000013f4
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_W_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_IN_E_H_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E 0x000013f8
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_W_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_SIZE_OUT_E_H_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E 0x000013fc
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X_SHIFT 0
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_X_MASK 0x0000ffff
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y_SHIFT 16
+#define NV03_GDI_RECTANGLE_TEXT_POINT_E_Y_MASK 0xffff0000
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E(x) (0x00001400+((x)*4))
+#define NV03_GDI_RECTANGLE_TEXT_MONOCHROME_COLOR01_E__SIZE 0x00000020
+
+
+#define NV04_SWIZZLED_SURFACE 0x00000052
+
+#define NV04_SWIZZLED_SURFACE_NOP 0x00000100
+#define NV04_SWIZZLED_SURFACE_NOTIFY 0x00000104
+#define NV04_SWIZZLED_SURFACE_DMA_NOTIFY 0x00000180
+#define NV04_SWIZZLED_SURFACE_DMA_IMAGE 0x00000184
+#define NV04_SWIZZLED_SURFACE_FORMAT 0x00000300
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_SHIFT 0
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_MASK 0x000000ff
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y8 0x00000001
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_Z1R5G5B5 0x00000002
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1R5G5B5_X1R5G5B5 0x00000003
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_R5G6B5 0x00000004
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y16 0x00000005
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_Z8R8G8B8 0x00000006
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X8R8G8B8_X8R8G8B8 0x00000007
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_Z1A7R8G8B8 0x00000008
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_X1A7R8G8B8_X1A7R8G8B8 0x00000009
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_A8R8G8B8 0x0000000a
+#define NV04_SWIZZLED_SURFACE_FORMAT_COLOR_Y32 0x0000000b
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT 16
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_MASK 0x00ff0000
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT 24
+#define NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_MASK 0xff000000
+#define NV04_SWIZZLED_SURFACE_OFFSET 0x00000304
+
+
+#define NV20_SWIZZLED_SURFACE 0x0000009e
+
+
+
+#define NV30_SWIZZLED_SURFACE 0x0000039e
+
+
+
+#define NV40_SWIZZLED_SURFACE 0x0000309e
+
+
+
+#define NV04_CONTEXT_SURFACES_3D 0x00000053
+
+#define NV04_CONTEXT_SURFACES_3D_NOP 0x00000100
+#define NV04_CONTEXT_SURFACES_3D_NOTIFY 0x00000104
+#define NV04_CONTEXT_SURFACES_3D_DMA_NOTIFY 0x00000180
+#define NV04_CONTEXT_SURFACES_3D_DMA_COLOR 0x00000184
+#define NV04_CONTEXT_SURFACES_3D_DMA_ZETA 0x00000188
+#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL 0x000002f8
+#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_X_SHIFT 0
+#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_X_MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_W_SHIFT 16
+#define NV04_CONTEXT_SURFACES_3D_CLIP_HORIZONTAL_W_MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL 0x000002fc
+#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_Y_SHIFT 0
+#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_Y_MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_H_SHIFT 16
+#define NV04_CONTEXT_SURFACES_3D_CLIP_VERTICAL_H_MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_3D_FORMAT 0x00000300
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_SHIFT 0
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_MASK 0x000000ff
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1R5G5B5_Z1R5G5B5 0x00000001
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1R5G5B5_X1R5G5B5 0x00000002
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_R5G6B5 0x00000003
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X8R8G8B8_Z8R8G8B8 0x00000004
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X8R8G8B8_X8R8G8B8 0x00000005
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1A7R8G8B8_Z1A7R8G8B8 0x00000006
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_X1A7R8G8B8_X1A7R8G8B8 0x00000007
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_COLOR_A8R8G8B8 0x00000008
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_SHIFT 8
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_MASK 0x0000ff00
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_PITCH 0x00000100
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_TYPE_SWIZZLE 0x00000200
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_U_SHIFT 16
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_U_MASK 0x00ff0000
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_V_SHIFT 24
+#define NV04_CONTEXT_SURFACES_3D_FORMAT_BASE_SIZE_V_MASK 0xff000000
+#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE 0x00000304
+#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_W_SHIFT 0
+#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_W_MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_H_SHIFT 16
+#define NV04_CONTEXT_SURFACES_3D_CLIP_SIZE_H_MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_3D_PITCH 0x00000308
+#define NV04_CONTEXT_SURFACES_3D_PITCH_COLOR_SHIFT 0
+#define NV04_CONTEXT_SURFACES_3D_PITCH_COLOR_MASK 0x0000ffff
+#define NV04_CONTEXT_SURFACES_3D_PITCH_ZETA_SHIFT 16
+#define NV04_CONTEXT_SURFACES_3D_PITCH_ZETA_MASK 0xffff0000
+#define NV04_CONTEXT_SURFACES_3D_OFFSET_COLOR 0x0000030c
+#define NV04_CONTEXT_SURFACES_3D_OFFSET_ZETA 0x00000310
+
+
+#define NV10_CONTEXT_SURFACES_3D 0x00000093
+
+
+
+#define NV04_TEXTURED_TRIANGLE 0x00000054
+
+#define NV04_TEXTURED_TRIANGLE_NOP 0x00000100
+#define NV04_TEXTURED_TRIANGLE_NOTIFY 0x00000104
+#define NV04_TEXTURED_TRIANGLE_DMA_NOTIFY 0x00000180
+#define NV04_TEXTURED_TRIANGLE_DMA_A 0x00000184
+#define NV04_TEXTURED_TRIANGLE_DMA_B 0x00000188
+#define NV04_TEXTURED_TRIANGLE_SURFACE 0x0000018c
+#define NV04_TEXTURED_TRIANGLE_COLORKEY 0x00000300
+#define NV04_TEXTURED_TRIANGLE_OFFSET 0x00000304
+#define NV04_TEXTURED_TRIANGLE_FORMAT 0x00000308
+#define NV04_TEXTURED_TRIANGLE_FORMAT_DMA_A (1 << 0)
+#define NV04_TEXTURED_TRIANGLE_FORMAT_DMA_B (1 << 1)
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_KEY_MATCH_SHIFT 2
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_KEY_MATCH_MASK 0x0000000c
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_SHIFT 4
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_MASK 0x00000030
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CENTER 0x00000010
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_ZOH_CORNER 0x00000020
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_SHIFT 6
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_MASK 0x000000c0
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CENTER 0x00000040
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER 0x00000080
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_MASK 0x00000f00
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_Y8 0x00000100
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A1R5G5B5 0x00000200
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X1R5G5B5 0x00000300
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A4R4G4B4 0x00000400
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_R5G6B5 0x00000500
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8 0x00000600
+#define NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X8R8G8B8 0x00000700
+#define NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT 12
+#define NV04_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_MASK 0x0000f000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_MASK 0x000f0000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT 20
+#define NV04_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_MASK 0x00f00000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_MASK 0x07000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_REPEAT 0x01000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_MIRRORED_REPEAT 0x02000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE 0x03000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_BORDER 0x04000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP 0x05000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_WRAPU (1 << 27)
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_SHIFT 28
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_MASK 0x70000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_REPEAT 0x10000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_MIRRORED_REPEAT 0x20000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE 0x30000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_BORDER 0x40000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP 0x50000000
+#define NV04_TEXTURED_TRIANGLE_FORMAT_WRAPV (1 << 31)
+#define NV04_TEXTURED_TRIANGLE_FILTER 0x0000030c
+#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_X_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_X_MASK 0x000000ff
+#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_Y_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_FILTER_KERNEL_SIZE_Y_MASK 0x00007f00
+#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_DITHER_ENABLE (1 << 15)
+#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_LODBIAS_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_FILTER_MIPMAP_LODBIAS_MASK 0x00ff0000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_MASK 0x07000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST 0x01000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR 0x02000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x03000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x04000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x05000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x06000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_ANISOTROPIC_MINIFY_ENABLE (1 << 27)
+#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_SHIFT 28
+#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_MASK 0x70000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_NEAREST 0x10000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_MAGNIFY_LINEAR 0x20000000
+#define NV04_TEXTURED_TRIANGLE_FILTER_ANISOTROPIC_MAGNIFY_ENABLE (1 << 31)
+#define NV04_TEXTURED_TRIANGLE_BLEND 0x00000310
+#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_MAP_MASK 0x0000000f
+#define NV04_TEXTURED_TRIANGLE_BLEND_MASK_BIT_SHIFT 4
+#define NV04_TEXTURED_TRIANGLE_BLEND_MASK_BIT_MASK 0x00000030
+#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_SHIFT 6
+#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_MASK 0x000000c0
+#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_FLAT 0x00000040
+#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_GOURAUD 0x00000080
+#define NV04_TEXTURED_TRIANGLE_BLEND_SHADE_MODE_PHONG 0x000000c0
+#define NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE (1 << 8)
+#define NV04_TEXTURED_TRIANGLE_BLEND_SPECULAR_ENABLE (1 << 12)
+#define NV04_TEXTURED_TRIANGLE_BLEND_FOG_ENABLE (1 << 16)
+#define NV04_TEXTURED_TRIANGLE_BLEND_BLEND_ENABLE (1 << 20)
+#define NV04_TEXTURED_TRIANGLE_BLEND_SRC_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_BLEND_SRC_MASK 0x0f000000
+#define NV04_TEXTURED_TRIANGLE_BLEND_DST_SHIFT 28
+#define NV04_TEXTURED_TRIANGLE_BLEND_DST_MASK 0xf0000000
+#define NV04_TEXTURED_TRIANGLE_CONTROL 0x00000314
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_REF_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_REF_MASK 0x000000ff
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_FUNC_MASK 0x00000f00
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ALPHA_ENABLE (1 << 12)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_ORIGIN (1 << 13)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_ENABLE (1 << 14)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FUNC_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FUNC_MASK 0x000f0000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_SHIFT 20
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_MASK 0x00300000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_BOTH 0x00000000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_NONE 0x00100000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CW 0x00200000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_CULL_MODE_CCW 0x00300000
+#define NV04_TEXTURED_TRIANGLE_CONTROL_DITHER_ENABLE (1 << 22)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_PERSPECTIVE_ENABLE (1 << 23)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_WRITE (1 << 24)
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FORMAT_SHIFT 30
+#define NV04_TEXTURED_TRIANGLE_CONTROL_Z_FORMAT_MASK 0xc0000000
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR 0x00000318
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_B_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_B_MASK 0x000000ff
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_G_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_G_MASK 0x0000ff00
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_R_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_R_MASK 0x00ff0000
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_A_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_FOGCOLOR_A_MASK 0xff000000
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SX(x) (0x00000400+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SX__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SY(x) (0x00000404+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SY__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SZ(x) (0x00000408+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SZ__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_RHW(x) (0x0000040c+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_RHW__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR(x) (0x00000410+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_B_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_B_MASK 0x000000ff
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_G_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_G_MASK 0x0000ff00
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_R_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_R_MASK 0x00ff0000
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_A_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_COLOR_A_MASK 0xff000000
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR(x) (0x00000414+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_B_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_B_MASK 0x000000ff
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_G_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_G_MASK 0x0000ff00
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_R_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_R_MASK 0x00ff0000
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_SHIFT 24
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_SPECULAR_FOG_MASK 0xff000000
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TU(x) (0x00000418+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TU__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TV(x) (0x0000041c+((x)*32))
+#define NV04_TEXTURED_TRIANGLE_TLVERTEX_TV__SIZE 0x00000010
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE(x) (0x00000600+((x)*4))
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE__SIZE 0x00000040
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I0_SHIFT 0
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I0_MASK 0x0000000f
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I1_SHIFT 4
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I1_MASK 0x000000f0
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I2_SHIFT 8
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I2_MASK 0x00000f00
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I3_SHIFT 12
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I3_MASK 0x0000f000
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I4_SHIFT 16
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I4_MASK 0x000f0000
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I5_SHIFT 20
+#define NV04_TEXTURED_TRIANGLE_DRAWPRIMITIVE_I5_MASK 0x00f00000
+
+
+#define NV10_TEXTURED_TRIANGLE 0x00000094
+
+
+
+#define NV04_MULTITEX_TRIANGLE 0x00000055
+
+#define NV04_MULTITEX_TRIANGLE_NOP 0x00000100
+#define NV04_MULTITEX_TRIANGLE_NOTIFY 0x00000104
+#define NV04_MULTITEX_TRIANGLE_DMA_NOTIFY 0x00000180
+#define NV04_MULTITEX_TRIANGLE_DMA_A 0x00000184
+#define NV04_MULTITEX_TRIANGLE_DMA_B 0x00000188
+#define NV04_MULTITEX_TRIANGLE_SURFACE 0x0000018c
+#define NV04_MULTITEX_TRIANGLE_OFFSET(x) (0x00000308+((x)*4))
+#define NV04_MULTITEX_TRIANGLE_OFFSET__SIZE 0x00000002
+#define NV04_MULTITEX_TRIANGLE_FORMAT(x) (0x00000310+((x)*4))
+#define NV04_MULTITEX_TRIANGLE_FORMAT__SIZE 0x00000002
+#define NV04_MULTITEX_TRIANGLE_FORMAT_DMA_A (1 << 0)
+#define NV04_MULTITEX_TRIANGLE_FORMAT_DMA_B (1 << 1)
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_ZOH_SHIFT 4
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_ZOH_MASK 0x00000030
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_FOH_SHIFT 6
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ORIGIN_FOH_MASK 0x000000c0
+#define NV04_MULTITEX_TRIANGLE_FORMAT_COLOR_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_FORMAT_COLOR_MASK 0x00000f00
+#define NV04_MULTITEX_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT 12
+#define NV04_MULTITEX_TRIANGLE_FORMAT_MIPMAP_LEVELS_MASK 0x0000f000
+#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_U_MASK 0x000f0000
+#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT 20
+#define NV04_MULTITEX_TRIANGLE_FORMAT_BASE_SIZE_V_MASK 0x00f00000
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSU_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSU_MASK 0x07000000
+#define NV04_MULTITEX_TRIANGLE_FORMAT_WRAPU (1 << 27)
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSV_SHIFT 28
+#define NV04_MULTITEX_TRIANGLE_FORMAT_ADDRESSV_MASK 0x70000000
+#define NV04_MULTITEX_TRIANGLE_FORMAT_WRAPV (1 << 31)
+#define NV04_MULTITEX_TRIANGLE_FILTER(x) (0x00000318+((x)*4))
+#define NV04_MULTITEX_TRIANGLE_FILTER__SIZE 0x00000002
+#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_X_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_X_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_Y_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_FILTER_KERNEL_SIZE_Y_MASK 0x00007f00
+#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_DITHER_ENABLE (1 << 15)
+#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_LODBIAS_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_FILTER_MIPMAP_LODBIAS_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_FILTER_MINIFY_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_FILTER_MINIFY_MASK 0x07000000
+#define NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MINIFY_ENABLE (1 << 27)
+#define NV04_MULTITEX_TRIANGLE_FILTER_MAGNIFY_SHIFT 28
+#define NV04_MULTITEX_TRIANGLE_FILTER_MAGNIFY_MASK 0x70000000
+#define NV04_MULTITEX_TRIANGLE_FILTER_ANISOTROPIC_MAGNIFY_ENABLE (1 << 31)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA(x) (0x00000320+((x)*12))
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA__SIZE 0x00000002
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE0 (1 << 0)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_SHIFT 2
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_MASK 0x000000fc
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_ZERO 0x00000004
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_CONSTANT 0x00000008
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_PRIMARY_COLOR 0x0000000c
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_PREVIOUS 0x00000010
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_TEXTURE0 0x00000014
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT0_TEXTURE1 0x00000018
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE1 (1 << 8)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_SHIFT 10
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_MASK 0x0000fc00
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_ZERO 0x00000400
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_CONSTANT 0x00000800
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_PRIMARY_COLOR 0x00000c00
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_PREVIOUS 0x00001000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_TEXTURE0 0x00001400
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT1_TEXTURE1 0x00001800
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE2 (1 << 16)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_SHIFT 18
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_MASK 0x00fc0000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_ZERO 0x00040000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_CONSTANT 0x00080000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_PRIMARY_COLOR 0x000c0000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_PREVIOUS 0x00100000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_TEXTURE0 0x00140000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT2_TEXTURE1 0x00180000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_INVERSE3 (1 << 24)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_SHIFT 26
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_MASK 0x1c000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_ZERO 0x04000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_CONSTANT 0x08000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_PRIMARY_COLOR 0x0c000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_PREVIOUS 0x10000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_TEXTURE0 0x14000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_ARGUMENT3_TEXTURE1 0x18000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SHIFT 29
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_MASK 0xe0000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_IDENTITY 0x20000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SCALE2 0x40000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_SCALE4 0x60000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_BIAS 0x80000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_ALPHA_MAP_BIAS_SCALE2 0xe0000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR(x) (0x00000324+((x)*12))
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR__SIZE 0x00000002
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE0 (1 << 0)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA0 (1 << 1)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_SHIFT 2
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_MASK 0x000000fc
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_ZERO 0x00000004
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_CONSTANT 0x00000008
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_PRIMARY_COLOR 0x0000000c
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_PREVIOUS 0x00000010
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_TEXTURE0 0x00000014
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT0_TEXTURE1 0x00000018
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE1 (1 << 8)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA1 (1 << 9)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_SHIFT 10
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_MASK 0x0000fc00
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_ZERO 0x00000400
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_CONSTANT 0x00000800
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_PRIMARY_COLOR 0x00000c00
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_PREVIOUS 0x00001000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_TEXTURE0 0x00001400
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT1_TEXTURE1 0x00001800
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE2 (1 << 16)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA2 (1 << 17)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_SHIFT 18
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_MASK 0x00fc0000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_ZERO 0x00040000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_CONSTANT 0x00080000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_PRIMARY_COLOR 0x000c0000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_PREVIOUS 0x00100000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_TEXTURE0 0x00140000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT2_TEXTURE1 0x00180000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_INVERSE3 (1 << 24)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ALPHA3 (1 << 25)
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_SHIFT 26
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_MASK 0x1c000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_ZERO 0x04000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_CONSTANT 0x08000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_PRIMARY_COLOR 0x0c000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_PREVIOUS 0x10000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_TEXTURE0 0x14000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_ARGUMENT3_TEXTURE1 0x18000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SHIFT 29
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_MASK 0xe0000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_IDENTITY 0x20000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SCALE2 0x40000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_SCALE4 0x60000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_BIAS 0x80000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_COLOR_MAP_BIAS_SCALE2 0xe0000000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR 0x00000334
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_B_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_B_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_G_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_G_MASK 0x0000ff00
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_R_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_R_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_A_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_COMBINE_FACTOR_A_MASK 0xff000000
+#define NV04_MULTITEX_TRIANGLE_BLEND 0x00000338
+#define NV04_MULTITEX_TRIANGLE_BLEND_MASK_BIT_SHIFT 4
+#define NV04_MULTITEX_TRIANGLE_BLEND_MASK_BIT_MASK 0x00000030
+#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_SHIFT 6
+#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_MASK 0x000000c0
+#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_FLAT 0x00000040
+#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_GOURAUD 0x00000080
+#define NV04_MULTITEX_TRIANGLE_BLEND_SHADE_MODE_PHONG 0x000000c0
+#define NV04_MULTITEX_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE (1 << 8)
+#define NV04_MULTITEX_TRIANGLE_BLEND_SPECULAR_ENABLE (1 << 12)
+#define NV04_MULTITEX_TRIANGLE_BLEND_FOG_ENABLE (1 << 16)
+#define NV04_MULTITEX_TRIANGLE_BLEND_BLEND_ENABLE (1 << 20)
+#define NV04_MULTITEX_TRIANGLE_BLEND_SRC_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_BLEND_SRC_MASK 0x0f000000
+#define NV04_MULTITEX_TRIANGLE_BLEND_DST_SHIFT 28
+#define NV04_MULTITEX_TRIANGLE_BLEND_DST_MASK 0xf0000000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0 0x0000033c
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_REF_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_REF_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_FUNC_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_FUNC_MASK 0x00000f00
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_ENABLE (1 << 12)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ORIGIN (1 << 13)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_ENABLE (1 << 14)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FUNC_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FUNC_MASK 0x000f0000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_SHIFT 20
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_MASK 0x00300000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_BOTH 0x00000000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_NONE 0x00100000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_CW 0x00200000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_CULL_MODE_CCW 0x00300000
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_DITHER_ENABLE (1 << 22)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_PERSPECTIVE_ENABLE (1 << 23)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_WRITE (1 << 24)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_STENCIL_WRITE (1 << 25)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_ALPHA_WRITE (1 << 26)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_RED_WRITE (1 << 27)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_GREEN_WRITE (1 << 28)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_BLUE_WRITE (1 << 29)
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FORMAT_SHIFT 30
+#define NV04_MULTITEX_TRIANGLE_CONTROL0_Z_FORMAT_MASK 0xc0000000
+#define NV04_MULTITEX_TRIANGLE_CONTROL1 0x00000340
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_ENABLE (1 << 0)
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_FUNC_SHIFT 4
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_FUNC_MASK 0x000000f0
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_REF_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_REF_MASK 0x0000ff00
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_READ_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_READ_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_WRITE_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_CONTROL1_STENCIL_MASK_WRITE_MASK 0xff000000
+#define NV04_MULTITEX_TRIANGLE_CONTROL2 0x00000344
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_FAIL_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_FAIL_MASK 0x0000000f
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZFAIL_SHIFT 4
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZFAIL_MASK 0x000000f0
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZPASS_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_CONTROL2_STENCIL_OP_ZPASS_MASK 0x00000f00
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR 0x00000348
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_B_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_B_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_G_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_G_MASK 0x0000ff00
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_R_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_R_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_A_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_FOGCOLOR_A_MASK 0xff000000
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SX(x) (0x00000400+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SX__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SY(x) (0x00000404+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SY__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SZ(x) (0x00000408+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SZ__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_RHW(x) (0x0000040c+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_RHW__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR(x) (0x00000410+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_B_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_B_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_G_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_G_MASK 0x0000ff00
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_R_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_R_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_A_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_COLOR_A_MASK 0xff000000
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR(x) (0x00000414+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_B_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_B_MASK 0x000000ff
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_G_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_G_MASK 0x0000ff00
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_R_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_R_MASK 0x00ff0000
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_FOG_SHIFT 24
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_SPECULAR_FOG_MASK 0xff000000
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU0(x) (0x00000418+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU0__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV0(x) (0x0000041c+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV0__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU1(x) (0x00000420+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TU1__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV1(x) (0x00000424+((x)*40))
+#define NV04_MULTITEX_TRIANGLE_TLMTVERTEX_TV1__SIZE 0x00000008
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE(x) (0x00000540+((x)*4))
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE__SIZE 0x00000030
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I0_SHIFT 0
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I0_MASK 0x0000000f
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I1_SHIFT 4
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I1_MASK 0x000000f0
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I2_SHIFT 8
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I2_MASK 0x00000f00
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I3_SHIFT 12
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I3_MASK 0x0000f000
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I4_SHIFT 16
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I4_MASK 0x000f0000
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I5_SHIFT 20
+#define NV04_MULTITEX_TRIANGLE_DRAWPRIMITIVE_I5_MASK 0x00f00000
+
+
+#define NV10_MULTITEX_TRIANGLE 0x00000095
+
+
+
+#define NV10TCL 0x00000056
+
+#define NV10TCL_NOP 0x00000100
+#define NV10TCL_NOTIFY 0x00000104
+#define NV10TCL_DMA_NOTIFY 0x00000180
+#define NV10TCL_DMA_IN_MEMORY0 0x00000184
+#define NV10TCL_DMA_IN_MEMORY1 0x00000188
+#define NV10TCL_DMA_VTXBUF0 0x0000018c
+#define NV10TCL_DMA_IN_MEMORY2 0x00000194
+#define NV10TCL_DMA_IN_MEMORY3 0x00000198
+#define NV10TCL_RT_HORIZ 0x00000200
+#define NV10TCL_RT_HORIZ_X_SHIFT 0
+#define NV10TCL_RT_HORIZ_X_MASK 0x0000ffff
+#define NV10TCL_RT_HORIZ_W_SHIFT 16
+#define NV10TCL_RT_HORIZ_W_MASK 0xffff0000
+#define NV10TCL_RT_VERT 0x00000204
+#define NV10TCL_RT_VERT_Y_SHIFT 0
+#define NV10TCL_RT_VERT_Y_MASK 0x0000ffff
+#define NV10TCL_RT_VERT_H_SHIFT 16
+#define NV10TCL_RT_VERT_H_MASK 0xffff0000
+#define NV10TCL_RT_FORMAT 0x00000208
+#define NV10TCL_RT_FORMAT_TYPE_SHIFT 8
+#define NV10TCL_RT_FORMAT_TYPE_MASK 0x00000f00
+#define NV10TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
+#define NV10TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
+#define NV10TCL_RT_FORMAT_COLOR_SHIFT 0
+#define NV10TCL_RT_FORMAT_COLOR_MASK 0x0000001f
+#define NV10TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
+#define NV10TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
+#define NV10TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
+#define NV10TCL_RT_FORMAT_COLOR_B8 0x00000009
+#define NV10TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
+#define NV10TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
+#define NV10TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
+#define NV10TCL_RT_PITCH 0x0000020c
+#define NV10TCL_RT_PITCH_COLOR_PITCH_SHIFT 0
+#define NV10TCL_RT_PITCH_COLOR_PITCH_MASK 0x0000ffff
+#define NV10TCL_RT_PITCH_ZETA_PITCH_SHIFT 16
+#define NV10TCL_RT_PITCH_ZETA_PITCH_MASK 0xffff0000
+#define NV10TCL_COLOR_OFFSET 0x00000210
+#define NV10TCL_ZETA_OFFSET 0x00000214
+#define NV10TCL_TX_OFFSET(x) (0x00000218+((x)*4))
+#define NV10TCL_TX_OFFSET__SIZE 0x00000002
+#define NV10TCL_TX_FORMAT(x) (0x00000220+((x)*4))
+#define NV10TCL_TX_FORMAT__SIZE 0x00000002
+#define NV10TCL_TX_FORMAT_DMA0 (1 << 0)
+#define NV10TCL_TX_FORMAT_DMA1 (1 << 1)
+#define NV10TCL_TX_FORMAT_CUBE_MAP (1 << 2)
+#define NV10TCL_TX_FORMAT_FORMAT_SHIFT 7
+#define NV10TCL_TX_FORMAT_FORMAT_MASK 0x00000f80
+#define NV10TCL_TX_FORMAT_FORMAT_L8 0x00000000
+#define NV10TCL_TX_FORMAT_FORMAT_A8 0x00000080
+#define NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5 0x00000100
+#define NV10TCL_TX_FORMAT_FORMAT_A4R4G4B4 0x00000200
+#define NV10TCL_TX_FORMAT_FORMAT_R5G6B5 0x00000280
+#define NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8 0x00000300
+#define NV10TCL_TX_FORMAT_FORMAT_X8R8G8B8 0x00000380
+#define NV10TCL_TX_FORMAT_FORMAT_INDEX8 0x00000580
+#define NV10TCL_TX_FORMAT_FORMAT_DXT1 0x00000600
+#define NV10TCL_TX_FORMAT_FORMAT_DXT3 0x00000700
+#define NV10TCL_TX_FORMAT_FORMAT_DXT5 0x00000780
+#define NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00000800
+#define NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT 0x00000880
+#define NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00000900
+#define NV10TCL_TX_FORMAT_FORMAT_A8_RECT 0x00000980
+#define NV10TCL_TX_FORMAT_MIPMAP (1 << 15)
+#define NV10TCL_TX_FORMAT_BASE_SIZE_U_SHIFT 16
+#define NV10TCL_TX_FORMAT_BASE_SIZE_U_MASK 0x000f0000
+#define NV10TCL_TX_FORMAT_BASE_SIZE_V_SHIFT 20
+#define NV10TCL_TX_FORMAT_BASE_SIZE_V_MASK 0x00f00000
+#define NV10TCL_TX_FORMAT_WRAP_S_SHIFT 24
+#define NV10TCL_TX_FORMAT_WRAP_S_MASK 0x0f000000
+#define NV10TCL_TX_FORMAT_WRAP_S_REPEAT 0x01000000
+#define NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT 0x02000000
+#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE 0x03000000
+#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER 0x04000000
+#define NV10TCL_TX_FORMAT_WRAP_S_CLAMP 0x05000000
+#define NV10TCL_TX_FORMAT_WRAP_T_SHIFT 28
+#define NV10TCL_TX_FORMAT_WRAP_T_MASK 0xf0000000
+#define NV10TCL_TX_FORMAT_WRAP_T_REPEAT 0x10000000
+#define NV10TCL_TX_FORMAT_WRAP_T_MIRRORED_REPEAT 0x20000000
+#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_EDGE 0x30000000
+#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP_TO_BORDER 0x40000000
+#define NV10TCL_TX_FORMAT_WRAP_T_CLAMP 0x50000000
+#define NV10TCL_TX_ENABLE(x) (0x00000228+((x)*4))
+#define NV10TCL_TX_ENABLE__SIZE 0x00000002
+#define NV10TCL_TX_ENABLE_CULL_SHIFT 0
+#define NV10TCL_TX_ENABLE_CULL_MASK 0x0000000f
+#define NV10TCL_TX_ENABLE_CULL_DISABLED 0x00000000
+#define NV10TCL_TX_ENABLE_CULL_TEST_ALL 0x00000003
+#define NV10TCL_TX_ENABLE_CULL_TEST_ALPHA 0x00000004
+#define NV10TCL_TX_ENABLE_ANISOTROPY_SHIFT 4
+#define NV10TCL_TX_ENABLE_ANISOTROPY_MASK 0x00000030
+#define NV10TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT 14
+#define NV10TCL_TX_ENABLE_MIPMAP_MAX_LOD_MASK 0x0003c000
+#define NV10TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT 26
+#define NV10TCL_TX_ENABLE_MIPMAP_MIN_LOD_MASK 0x3c000000
+#define NV10TCL_TX_ENABLE_ENABLE (1 << 30)
+#define NV10TCL_TX_NPOT_PITCH(x) (0x00000230+((x)*4))
+#define NV10TCL_TX_NPOT_PITCH__SIZE 0x00000002
+#define NV10TCL_TX_NPOT_PITCH_PITCH_SHIFT 16
+#define NV10TCL_TX_NPOT_PITCH_PITCH_MASK 0xffff0000
+#define NV10TCL_TX_NPOT_SIZE(x) (0x00000240+((x)*4))
+#define NV10TCL_TX_NPOT_SIZE__SIZE 0x00000002
+#define NV10TCL_TX_NPOT_SIZE_H_SHIFT 0
+#define NV10TCL_TX_NPOT_SIZE_H_MASK 0x0000ffff
+#define NV10TCL_TX_NPOT_SIZE_W_SHIFT 16
+#define NV10TCL_TX_NPOT_SIZE_W_MASK 0xffff0000
+#define NV10TCL_TX_FILTER(x) (0x00000248+((x)*4))
+#define NV10TCL_TX_FILTER__SIZE 0x00000002
+#define NV10TCL_TX_FILTER_LOD_BIAS_SHIFT 8
+#define NV10TCL_TX_FILTER_LOD_BIAS_MASK 0x00000f00
+#define NV10TCL_TX_FILTER_MINIFY_SHIFT 24
+#define NV10TCL_TX_FILTER_MINIFY_MASK 0x0f000000
+#define NV10TCL_TX_FILTER_MINIFY_NEAREST 0x01000000
+#define NV10TCL_TX_FILTER_MINIFY_LINEAR 0x02000000
+#define NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x03000000
+#define NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x04000000
+#define NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x05000000
+#define NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x06000000
+#define NV10TCL_TX_FILTER_MAGNIFY_SHIFT 28
+#define NV10TCL_TX_FILTER_MAGNIFY_MASK 0xf0000000
+#define NV10TCL_TX_FILTER_MAGNIFY_NEAREST 0x10000000
+#define NV10TCL_TX_FILTER_MAGNIFY_LINEAR 0x20000000
+#define NV10TCL_TX_PALETTE_OFFSET(x) (0x00000250+((x)*4))
+#define NV10TCL_TX_PALETTE_OFFSET__SIZE 0x00000002
+#define NV10TCL_RC_IN_ALPHA(x) (0x00000260+((x)*4))
+#define NV10TCL_RC_IN_ALPHA__SIZE 0x00000002
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_SHIFT 0
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_MASK 0x0000000f
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
+#define NV10TCL_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
+#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE (1 << 4)
+#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
+#define NV10TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SHIFT 5
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_MASK 0x000000e0
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV10TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_SHIFT 8
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_MASK 0x00000f00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE (1 << 12)
+#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
+#define NV10TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SHIFT 13
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_MASK 0x0000e000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV10TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_SHIFT 16
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_MASK 0x000f0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
+#define NV10TCL_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
+#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE (1 << 20)
+#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
+#define NV10TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SHIFT 21
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_MASK 0x00e00000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV10TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_SHIFT 24
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_MASK 0x0f000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
+#define NV10TCL_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
+#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE (1 << 28)
+#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
+#define NV10TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SHIFT 29
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_MASK 0xe0000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV10TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV10TCL_RC_IN_RGB(x) (0x00000268+((x)*4))
+#define NV10TCL_RC_IN_RGB__SIZE 0x00000002
+#define NV10TCL_RC_IN_RGB_D_INPUT_SHIFT 0
+#define NV10TCL_RC_IN_RGB_D_INPUT_MASK 0x0000000f
+#define NV10TCL_RC_IN_RGB_D_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV10TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV10TCL_RC_IN_RGB_D_INPUT_FOG 0x00000003
+#define NV10TCL_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV10TCL_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
+#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
+#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
+#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
+#define NV10TCL_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV10TCL_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
+#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
+#define NV10TCL_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
+#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE (1 << 4)
+#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV10TCL_RC_IN_RGB_D_MAPPING_SHIFT 5
+#define NV10TCL_RC_IN_RGB_D_MAPPING_MASK 0x000000e0
+#define NV10TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV10TCL_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV10TCL_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV10TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV10TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV10TCL_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV10TCL_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV10TCL_RC_IN_RGB_C_INPUT_SHIFT 8
+#define NV10TCL_RC_IN_RGB_C_INPUT_MASK 0x00000f00
+#define NV10TCL_RC_IN_RGB_C_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_IN_RGB_C_INPUT_FOG 0x00000300
+#define NV10TCL_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE (1 << 12)
+#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_SHIFT 13
+#define NV10TCL_RC_IN_RGB_C_MAPPING_MASK 0x0000e000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV10TCL_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV10TCL_RC_IN_RGB_B_INPUT_SHIFT 16
+#define NV10TCL_RC_IN_RGB_B_INPUT_MASK 0x000f0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV10TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV10TCL_RC_IN_RGB_B_INPUT_FOG 0x00030000
+#define NV10TCL_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV10TCL_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
+#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
+#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
+#define NV10TCL_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
+#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE (1 << 20)
+#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_SHIFT 21
+#define NV10TCL_RC_IN_RGB_B_MAPPING_MASK 0x00e00000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV10TCL_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV10TCL_RC_IN_RGB_A_INPUT_SHIFT 24
+#define NV10TCL_RC_IN_RGB_A_INPUT_MASK 0x0f000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_FOG 0x03000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
+#define NV10TCL_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
+#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE (1 << 28)
+#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_SHIFT 29
+#define NV10TCL_RC_IN_RGB_A_MAPPING_MASK 0xe0000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV10TCL_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV10TCL_RC_COLOR(x) (0x00000270+((x)*4))
+#define NV10TCL_RC_COLOR__SIZE 0x00000002
+#define NV10TCL_RC_COLOR_B_SHIFT 0
+#define NV10TCL_RC_COLOR_B_MASK 0x000000ff
+#define NV10TCL_RC_COLOR_G_SHIFT 8
+#define NV10TCL_RC_COLOR_G_MASK 0x0000ff00
+#define NV10TCL_RC_COLOR_R_SHIFT 16
+#define NV10TCL_RC_COLOR_R_MASK 0x00ff0000
+#define NV10TCL_RC_COLOR_A_SHIFT 24
+#define NV10TCL_RC_COLOR_A_MASK 0xff000000
+#define NV10TCL_RC_OUT_ALPHA(x) (0x00000278+((x)*4))
+#define NV10TCL_RC_OUT_ALPHA__SIZE 0x00000002
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SHIFT 0
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_MASK 0x0000000f
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV10TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SHIFT 4
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_MASK 0x000000f0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV10TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SHIFT 8
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_MASK 0x00000f00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_OUT_ALPHA_CD_DOT_PRODUCT (1 << 12)
+#define NV10TCL_RC_OUT_ALPHA_AB_DOT_PRODUCT (1 << 13)
+#define NV10TCL_RC_OUT_ALPHA_MUX_SUM (1 << 14)
+#define NV10TCL_RC_OUT_ALPHA_BIAS (1 << 15)
+#define NV10TCL_RC_OUT_ALPHA_BIAS_NONE 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV10TCL_RC_OUT_ALPHA_SCALE_SHIFT 17
+#define NV10TCL_RC_OUT_ALPHA_SCALE_MASK 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_SCALE_NONE 0x00000000
+#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00020000
+#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00040000
+#define NV10TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00060000
+#define NV10TCL_RC_OUT_RGB(x) (0x00000280+((x)*4))
+#define NV10TCL_RC_OUT_RGB__SIZE 0x00000002
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT 0
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_MASK 0x0000000f
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV10TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SHIFT 4
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_MASK 0x000000f0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV10TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SHIFT 8
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_MASK 0x00000f00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_OUT_RGB_CD_DOT_PRODUCT (1 << 12)
+#define NV10TCL_RC_OUT_RGB_AB_DOT_PRODUCT (1 << 13)
+#define NV10TCL_RC_OUT_RGB_MUX_SUM (1 << 14)
+#define NV10TCL_RC_OUT_RGB_BIAS (1 << 15)
+#define NV10TCL_RC_OUT_RGB_BIAS_NONE 0x00000000
+#define NV10TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV10TCL_RC_OUT_RGB_SCALE_SHIFT 17
+#define NV10TCL_RC_OUT_RGB_SCALE_MASK 0x00000000
+#define NV10TCL_RC_OUT_RGB_SCALE_NONE 0x00000000
+#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00020000
+#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00040000
+#define NV10TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00060000
+#define NV10TCL_RC_OUT_RGB_OPERATION_SHIFT 27
+#define NV10TCL_RC_OUT_RGB_OPERATION_MASK 0x38000000
+#define NV10TCL_RC_FINAL0 0x00000288
+#define NV10TCL_RC_FINAL0_D_INPUT_SHIFT 0
+#define NV10TCL_RC_FINAL0_D_INPUT_MASK 0x0000000f
+#define NV10TCL_RC_FINAL0_D_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV10TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV10TCL_RC_FINAL0_D_INPUT_FOG 0x00000003
+#define NV10TCL_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV10TCL_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
+#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
+#define NV10TCL_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
+#define NV10TCL_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
+#define NV10TCL_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV10TCL_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
+#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
+#define NV10TCL_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
+#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE (1 << 4)
+#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV10TCL_RC_FINAL0_D_MAPPING_SHIFT 5
+#define NV10TCL_RC_FINAL0_D_MAPPING_MASK 0x000000e0
+#define NV10TCL_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV10TCL_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV10TCL_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV10TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV10TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV10TCL_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV10TCL_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV10TCL_RC_FINAL0_C_INPUT_SHIFT 8
+#define NV10TCL_RC_FINAL0_C_INPUT_MASK 0x00000f00
+#define NV10TCL_RC_FINAL0_C_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_FINAL0_C_INPUT_FOG 0x00000300
+#define NV10TCL_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE (1 << 12)
+#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV10TCL_RC_FINAL0_C_MAPPING_SHIFT 13
+#define NV10TCL_RC_FINAL0_C_MAPPING_MASK 0x0000e000
+#define NV10TCL_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV10TCL_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV10TCL_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV10TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV10TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV10TCL_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV10TCL_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV10TCL_RC_FINAL0_B_INPUT_SHIFT 16
+#define NV10TCL_RC_FINAL0_B_INPUT_MASK 0x000f0000
+#define NV10TCL_RC_FINAL0_B_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV10TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV10TCL_RC_FINAL0_B_INPUT_FOG 0x00030000
+#define NV10TCL_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV10TCL_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
+#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
+#define NV10TCL_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
+#define NV10TCL_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
+#define NV10TCL_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV10TCL_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
+#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
+#define NV10TCL_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
+#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE (1 << 20)
+#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV10TCL_RC_FINAL0_B_MAPPING_SHIFT 21
+#define NV10TCL_RC_FINAL0_B_MAPPING_MASK 0x00e00000
+#define NV10TCL_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV10TCL_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV10TCL_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV10TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV10TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV10TCL_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV10TCL_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV10TCL_RC_FINAL0_A_INPUT_SHIFT 24
+#define NV10TCL_RC_FINAL0_A_INPUT_MASK 0x0f000000
+#define NV10TCL_RC_FINAL0_A_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV10TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV10TCL_RC_FINAL0_A_INPUT_FOG 0x03000000
+#define NV10TCL_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV10TCL_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
+#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
+#define NV10TCL_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
+#define NV10TCL_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
+#define NV10TCL_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV10TCL_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
+#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
+#define NV10TCL_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
+#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE (1 << 28)
+#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_SHIFT 29
+#define NV10TCL_RC_FINAL0_A_MAPPING_MASK 0xe0000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV10TCL_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV10TCL_RC_FINAL1 0x0000028c
+#define NV10TCL_RC_FINAL1_COLOR_SUM_CLAMP (1 << 7)
+#define NV10TCL_RC_FINAL1_G_INPUT_SHIFT 8
+#define NV10TCL_RC_FINAL1_G_INPUT_MASK 0x00000f00
+#define NV10TCL_RC_FINAL1_G_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV10TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV10TCL_RC_FINAL1_G_INPUT_FOG 0x00000300
+#define NV10TCL_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
+#define NV10TCL_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
+#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
+#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
+#define NV10TCL_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
+#define NV10TCL_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
+#define NV10TCL_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV10TCL_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
+#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
+#define NV10TCL_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
+#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE (1 << 12)
+#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV10TCL_RC_FINAL1_G_MAPPING_SHIFT 13
+#define NV10TCL_RC_FINAL1_G_MAPPING_MASK 0x0000e000
+#define NV10TCL_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV10TCL_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV10TCL_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV10TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV10TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV10TCL_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV10TCL_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV10TCL_RC_FINAL1_F_INPUT_SHIFT 16
+#define NV10TCL_RC_FINAL1_F_INPUT_MASK 0x000f0000
+#define NV10TCL_RC_FINAL1_F_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV10TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV10TCL_RC_FINAL1_F_INPUT_FOG 0x00030000
+#define NV10TCL_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
+#define NV10TCL_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
+#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
+#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
+#define NV10TCL_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
+#define NV10TCL_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
+#define NV10TCL_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV10TCL_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
+#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
+#define NV10TCL_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
+#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE (1 << 20)
+#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV10TCL_RC_FINAL1_F_MAPPING_SHIFT 21
+#define NV10TCL_RC_FINAL1_F_MAPPING_MASK 0x00e00000
+#define NV10TCL_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV10TCL_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV10TCL_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV10TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV10TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV10TCL_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV10TCL_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV10TCL_RC_FINAL1_E_INPUT_SHIFT 24
+#define NV10TCL_RC_FINAL1_E_INPUT_MASK 0x0f000000
+#define NV10TCL_RC_FINAL1_E_INPUT_ZERO 0x00000000
+#define NV10TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV10TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV10TCL_RC_FINAL1_E_INPUT_FOG 0x03000000
+#define NV10TCL_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
+#define NV10TCL_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
+#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
+#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
+#define NV10TCL_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
+#define NV10TCL_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
+#define NV10TCL_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV10TCL_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
+#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
+#define NV10TCL_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
+#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE (1 << 28)
+#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
+#define NV10TCL_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_SHIFT 29
+#define NV10TCL_RC_FINAL1_E_MAPPING_MASK 0xe0000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV10TCL_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV10TCL_LIGHT_MODEL 0x00000294
+#define NV10TCL_LIGHT_MODEL_VERTEX_SPECULAR (1 << 0)
+#define NV10TCL_LIGHT_MODEL_SEPARATE_SPECULAR (1 << 1)
+#define NV10TCL_LIGHT_MODEL_LOCAL_VIEWER (1 << 16)
+#define NV10TCL_COLOR_MATERIAL 0x00000298
+#define NV10TCL_COLOR_MATERIAL_EMISSION (1 << 0)
+#define NV10TCL_COLOR_MATERIAL_AMBIENT (1 << 1)
+#define NV10TCL_COLOR_MATERIAL_DIFFUSE (1 << 2)
+#define NV10TCL_COLOR_MATERIAL_SPECULAR (1 << 3)
+#define NV10TCL_FOG_MODE 0x0000029c
+#define NV10TCL_FOG_MODE_LINEAR 0x00002601
+#define NV10TCL_FOG_MODE_EXP 0x00000800
+#define NV10TCL_FOG_MODE_EXP_ABS 0x00000802
+#define NV10TCL_FOG_MODE_EXP2 0x00000803
+#define NV10TCL_FOG_COORD 0x000002a0
+#define NV10TCL_FOG_COORD_FOG 0x00000000
+#define NV10TCL_FOG_COORD_DIST_RADIAL 0x00000001
+#define NV10TCL_FOG_COORD_DIST_ORTHOGONAL 0x00000002
+#define NV10TCL_FOG_COORD_DIST_ORTHOGONAL_ABS 0x00000003
+#define NV10TCL_FOG_ENABLE 0x000002a4
+#define NV10TCL_FOG_COLOR 0x000002a8
+#define NV10TCL_FOG_COLOR_R_SHIFT 0
+#define NV10TCL_FOG_COLOR_R_MASK 0x000000ff
+#define NV10TCL_FOG_COLOR_G_SHIFT 8
+#define NV10TCL_FOG_COLOR_G_MASK 0x0000ff00
+#define NV10TCL_FOG_COLOR_B_SHIFT 16
+#define NV10TCL_FOG_COLOR_B_MASK 0x00ff0000
+#define NV10TCL_FOG_COLOR_A_SHIFT 24
+#define NV10TCL_FOG_COLOR_A_MASK 0xff000000
+#define NV10TCL_VIEWPORT_CLIP_MODE 0x000002b4
+#define NV10TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*4))
+#define NV10TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_L_SHIFT 0
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_L_MASK 0x000007ff
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_LEFT_ENABLE (1 << 11)
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_R_SHIFT 16
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_R_MASK 0x07ff0000
+#define NV10TCL_VIEWPORT_CLIP_HORIZ_CLIP_RIGHT_ENABLE (1 << 27)
+#define NV10TCL_VIEWPORT_CLIP_VERT(x) (0x000002e0+((x)*4))
+#define NV10TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_T_SHIFT 0
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_T_MASK 0x000007ff
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_TOP_ENABLE (1 << 11)
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_B_SHIFT 16
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_B_MASK 0x07ff0000
+#define NV10TCL_VIEWPORT_CLIP_VERT_CLIP_BOTTOM_ENABLE (1 << 27)
+#define NV10TCL_ALPHA_FUNC_ENABLE 0x00000300
+#define NV10TCL_BLEND_FUNC_ENABLE 0x00000304
+#define NV10TCL_CULL_FACE_ENABLE 0x00000308
+#define NV10TCL_DEPTH_TEST_ENABLE 0x0000030c
+#define NV10TCL_DITHER_ENABLE 0x00000310
+#define NV10TCL_LIGHTING_ENABLE 0x00000314
+#define NV10TCL_POINT_PARAMETERS_ENABLE 0x00000318
+#define NV10TCL_POINT_SMOOTH_ENABLE 0x0000031c
+#define NV10TCL_LINE_SMOOTH_ENABLE 0x00000320
+#define NV10TCL_POLYGON_SMOOTH_ENABLE 0x00000324
+#define NV10TCL_VERTEX_WEIGHT_ENABLE 0x00000328
+#define NV10TCL_STENCIL_ENABLE 0x0000032c
+#define NV10TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000330
+#define NV10TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000334
+#define NV10TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000338
+#define NV10TCL_ALPHA_FUNC_FUNC 0x0000033c
+#define NV10TCL_ALPHA_FUNC_FUNC_NEVER 0x00000200
+#define NV10TCL_ALPHA_FUNC_FUNC_LESS 0x00000201
+#define NV10TCL_ALPHA_FUNC_FUNC_EQUAL 0x00000202
+#define NV10TCL_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
+#define NV10TCL_ALPHA_FUNC_FUNC_GREATER 0x00000204
+#define NV10TCL_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV10TCL_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
+#define NV10TCL_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
+#define NV10TCL_ALPHA_FUNC_REF 0x00000340
+#define NV10TCL_BLEND_FUNC_SRC 0x00000344
+#define NV10TCL_BLEND_FUNC_SRC_ZERO 0x00000000
+#define NV10TCL_BLEND_FUNC_SRC_ONE 0x00000001
+#define NV10TCL_BLEND_FUNC_SRC_SRC_COLOR 0x00000300
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV10TCL_BLEND_FUNC_SRC_SRC_ALPHA 0x00000302
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV10TCL_BLEND_FUNC_SRC_DST_ALPHA 0x00000304
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV10TCL_BLEND_FUNC_SRC_DST_COLOR 0x00000306
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_COLOR 0x00000307
+#define NV10TCL_BLEND_FUNC_SRC_SRC_ALPHA_SATURATE 0x00000308
+#define NV10TCL_BLEND_FUNC_SRC_CONSTANT_COLOR 0x00008001
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV10TCL_BLEND_FUNC_SRC_CONSTANT_ALPHA 0x00008003
+#define NV10TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV10TCL_BLEND_FUNC_DST 0x00000348
+#define NV10TCL_BLEND_FUNC_DST_ZERO 0x00000000
+#define NV10TCL_BLEND_FUNC_DST_ONE 0x00000001
+#define NV10TCL_BLEND_FUNC_DST_SRC_COLOR 0x00000300
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV10TCL_BLEND_FUNC_DST_SRC_ALPHA 0x00000302
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV10TCL_BLEND_FUNC_DST_DST_ALPHA 0x00000304
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV10TCL_BLEND_FUNC_DST_DST_COLOR 0x00000306
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_DST_COLOR 0x00000307
+#define NV10TCL_BLEND_FUNC_DST_SRC_ALPHA_SATURATE 0x00000308
+#define NV10TCL_BLEND_FUNC_DST_CONSTANT_COLOR 0x00008001
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV10TCL_BLEND_FUNC_DST_CONSTANT_ALPHA 0x00008003
+#define NV10TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV10TCL_BLEND_COLOR 0x0000034c
+#define NV10TCL_BLEND_COLOR_B_SHIFT 0
+#define NV10TCL_BLEND_COLOR_B_MASK 0x000000ff
+#define NV10TCL_BLEND_COLOR_G_SHIFT 8
+#define NV10TCL_BLEND_COLOR_G_MASK 0x0000ff00
+#define NV10TCL_BLEND_COLOR_R_SHIFT 16
+#define NV10TCL_BLEND_COLOR_R_MASK 0x00ff0000
+#define NV10TCL_BLEND_COLOR_A_SHIFT 24
+#define NV10TCL_BLEND_COLOR_A_MASK 0xff000000
+#define NV10TCL_BLEND_EQUATION 0x00000350
+#define NV10TCL_BLEND_EQUATION_FUNC_ADD 0x00008006
+#define NV10TCL_BLEND_EQUATION_MIN 0x00008007
+#define NV10TCL_BLEND_EQUATION_MAX 0x00008008
+#define NV10TCL_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
+#define NV10TCL_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
+#define NV10TCL_DEPTH_FUNC 0x00000354
+#define NV10TCL_DEPTH_FUNC_NEVER 0x00000200
+#define NV10TCL_DEPTH_FUNC_LESS 0x00000201
+#define NV10TCL_DEPTH_FUNC_EQUAL 0x00000202
+#define NV10TCL_DEPTH_FUNC_LEQUAL 0x00000203
+#define NV10TCL_DEPTH_FUNC_GREATER 0x00000204
+#define NV10TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
+#define NV10TCL_DEPTH_FUNC_GEQUAL 0x00000206
+#define NV10TCL_DEPTH_FUNC_ALWAYS 0x00000207
+#define NV10TCL_COLOR_MASK 0x00000358
+#define NV10TCL_COLOR_MASK_B (1 << 0)
+#define NV10TCL_COLOR_MASK_G (1 << 8)
+#define NV10TCL_COLOR_MASK_R (1 << 16)
+#define NV10TCL_COLOR_MASK_A (1 << 24)
+#define NV10TCL_DEPTH_WRITE_ENABLE 0x0000035c
+#define NV10TCL_STENCIL_MASK 0x00000360
+#define NV10TCL_STENCIL_FUNC_FUNC 0x00000364
+#define NV10TCL_STENCIL_FUNC_FUNC_NEVER 0x00000200
+#define NV10TCL_STENCIL_FUNC_FUNC_LESS 0x00000201
+#define NV10TCL_STENCIL_FUNC_FUNC_EQUAL 0x00000202
+#define NV10TCL_STENCIL_FUNC_FUNC_LEQUAL 0x00000203
+#define NV10TCL_STENCIL_FUNC_FUNC_GREATER 0x00000204
+#define NV10TCL_STENCIL_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV10TCL_STENCIL_FUNC_FUNC_GEQUAL 0x00000206
+#define NV10TCL_STENCIL_FUNC_FUNC_ALWAYS 0x00000207
+#define NV10TCL_STENCIL_FUNC_REF 0x00000368
+#define NV10TCL_STENCIL_FUNC_MASK 0x0000036c
+#define NV10TCL_STENCIL_OP_FAIL 0x00000370
+#define NV10TCL_STENCIL_OP_FAIL_ZERO 0x00000000
+#define NV10TCL_STENCIL_OP_FAIL_INVERT 0x0000150a
+#define NV10TCL_STENCIL_OP_FAIL_KEEP 0x00001e00
+#define NV10TCL_STENCIL_OP_FAIL_REPLACE 0x00001e01
+#define NV10TCL_STENCIL_OP_FAIL_INCR 0x00001e02
+#define NV10TCL_STENCIL_OP_FAIL_DECR 0x00001e03
+#define NV10TCL_STENCIL_OP_FAIL_INCR_WRAP 0x00008507
+#define NV10TCL_STENCIL_OP_FAIL_DECR_WRAP 0x00008508
+#define NV10TCL_STENCIL_OP_ZFAIL 0x00000374
+#define NV10TCL_STENCIL_OP_ZFAIL_ZERO 0x00000000
+#define NV10TCL_STENCIL_OP_ZFAIL_INVERT 0x0000150a
+#define NV10TCL_STENCIL_OP_ZFAIL_KEEP 0x00001e00
+#define NV10TCL_STENCIL_OP_ZFAIL_REPLACE 0x00001e01
+#define NV10TCL_STENCIL_OP_ZFAIL_INCR 0x00001e02
+#define NV10TCL_STENCIL_OP_ZFAIL_DECR 0x00001e03
+#define NV10TCL_STENCIL_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NV10TCL_STENCIL_OP_ZFAIL_DECR_WRAP 0x00008508
+#define NV10TCL_STENCIL_OP_ZPASS 0x00000378
+#define NV10TCL_STENCIL_OP_ZPASS_ZERO 0x00000000
+#define NV10TCL_STENCIL_OP_ZPASS_INVERT 0x0000150a
+#define NV10TCL_STENCIL_OP_ZPASS_KEEP 0x00001e00
+#define NV10TCL_STENCIL_OP_ZPASS_REPLACE 0x00001e01
+#define NV10TCL_STENCIL_OP_ZPASS_INCR 0x00001e02
+#define NV10TCL_STENCIL_OP_ZPASS_DECR 0x00001e03
+#define NV10TCL_STENCIL_OP_ZPASS_INCR_WRAP 0x00008507
+#define NV10TCL_STENCIL_OP_ZPASS_DECR_WRAP 0x00008508
+#define NV10TCL_SHADE_MODEL 0x0000037c
+#define NV10TCL_SHADE_MODEL_FLAT 0x00001d00
+#define NV10TCL_SHADE_MODEL_SMOOTH 0x00001d01
+#define NV10TCL_LINE_WIDTH 0x00000380
+#define NV10TCL_POLYGON_OFFSET_FACTOR 0x00000384
+#define NV10TCL_POLYGON_OFFSET_UNITS 0x00000388
+#define NV10TCL_POLYGON_MODE_FRONT 0x0000038c
+#define NV10TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
+#define NV10TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
+#define NV10TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
+#define NV10TCL_POLYGON_MODE_BACK 0x00000390
+#define NV10TCL_POLYGON_MODE_BACK_POINT 0x00001b00
+#define NV10TCL_POLYGON_MODE_BACK_LINE 0x00001b01
+#define NV10TCL_POLYGON_MODE_BACK_FILL 0x00001b02
+#define NV10TCL_DEPTH_RANGE_NEAR 0x00000394
+#define NV10TCL_DEPTH_RANGE_FAR 0x00000398
+#define NV10TCL_CULL_FACE 0x0000039c
+#define NV10TCL_CULL_FACE_FRONT 0x00000404
+#define NV10TCL_CULL_FACE_BACK 0x00000405
+#define NV10TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
+#define NV10TCL_FRONT_FACE 0x000003a0
+#define NV10TCL_FRONT_FACE_CW 0x00000900
+#define NV10TCL_FRONT_FACE_CCW 0x00000901
+#define NV10TCL_NORMALIZE_ENABLE 0x000003a4
+#define NV10TCL_MATERIAL_FACTOR_R 0x000003a8
+#define NV10TCL_MATERIAL_FACTOR_G 0x000003ac
+#define NV10TCL_MATERIAL_FACTOR_B 0x000003b0
+#define NV10TCL_MATERIAL_FACTOR_A 0x000003b4
+#define NV10TCL_SEPARATE_SPECULAR_ENABLE 0x000003b8
+#define NV10TCL_ENABLED_LIGHTS 0x000003bc
+#define NV10TCL_ENABLED_LIGHTS_0_SHIFT 0
+#define NV10TCL_ENABLED_LIGHTS_0_MASK 0x00000003
+#define NV10TCL_ENABLED_LIGHTS_0_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_0_NONPOSITIONAL 0x00000001
+#define NV10TCL_ENABLED_LIGHTS_0_POSITIONAL 0x00000002
+#define NV10TCL_ENABLED_LIGHTS_0_DIRECTIONAL 0x00000003
+#define NV10TCL_ENABLED_LIGHTS_1_SHIFT 2
+#define NV10TCL_ENABLED_LIGHTS_1_MASK 0x0000000c
+#define NV10TCL_ENABLED_LIGHTS_1_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_1_NONPOSITIONAL 0x00000004
+#define NV10TCL_ENABLED_LIGHTS_1_POSITIONAL 0x00000008
+#define NV10TCL_ENABLED_LIGHTS_1_DIRECTIONAL 0x0000000c
+#define NV10TCL_ENABLED_LIGHTS_2_SHIFT 4
+#define NV10TCL_ENABLED_LIGHTS_2_MASK 0x00000030
+#define NV10TCL_ENABLED_LIGHTS_2_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_2_NONPOSITIONAL 0x00000010
+#define NV10TCL_ENABLED_LIGHTS_2_POSITIONAL 0x00000020
+#define NV10TCL_ENABLED_LIGHTS_2_DIRECTIONAL 0x00000030
+#define NV10TCL_ENABLED_LIGHTS_3_SHIFT 6
+#define NV10TCL_ENABLED_LIGHTS_3_MASK 0x000000c0
+#define NV10TCL_ENABLED_LIGHTS_3_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_3_NONPOSITIONAL 0x00000040
+#define NV10TCL_ENABLED_LIGHTS_3_POSITIONAL 0x00000080
+#define NV10TCL_ENABLED_LIGHTS_3_DIRECTIONAL 0x000000c0
+#define NV10TCL_ENABLED_LIGHTS_4_SHIFT 8
+#define NV10TCL_ENABLED_LIGHTS_4_MASK 0x00000300
+#define NV10TCL_ENABLED_LIGHTS_4_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_4_NONPOSITIONAL 0x00000100
+#define NV10TCL_ENABLED_LIGHTS_4_POSITIONAL 0x00000200
+#define NV10TCL_ENABLED_LIGHTS_4_DIRECTIONAL 0x00000300
+#define NV10TCL_ENABLED_LIGHTS_5_SHIFT 10
+#define NV10TCL_ENABLED_LIGHTS_5_MASK 0x00000c00
+#define NV10TCL_ENABLED_LIGHTS_5_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_5_NONPOSITIONAL 0x00000400
+#define NV10TCL_ENABLED_LIGHTS_5_POSITIONAL 0x00000800
+#define NV10TCL_ENABLED_LIGHTS_5_DIRECTIONAL 0x00000c00
+#define NV10TCL_ENABLED_LIGHTS_6_SHIFT 12
+#define NV10TCL_ENABLED_LIGHTS_6_MASK 0x00003000
+#define NV10TCL_ENABLED_LIGHTS_6_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_6_NONPOSITIONAL 0x00001000
+#define NV10TCL_ENABLED_LIGHTS_6_POSITIONAL 0x00002000
+#define NV10TCL_ENABLED_LIGHTS_6_DIRECTIONAL 0x00003000
+#define NV10TCL_ENABLED_LIGHTS_7_SHIFT 14
+#define NV10TCL_ENABLED_LIGHTS_7_MASK 0x0000c000
+#define NV10TCL_ENABLED_LIGHTS_7_DISABLED 0x00000000
+#define NV10TCL_ENABLED_LIGHTS_7_NONPOSITIONAL 0x00004000
+#define NV10TCL_ENABLED_LIGHTS_7_POSITIONAL 0x00008000
+#define NV10TCL_ENABLED_LIGHTS_7_DIRECTIONAL 0x0000c000
+#define NV10TCL_TX_GEN_MODE_S(x) (0x000003c0+((x)*16))
+#define NV10TCL_TX_GEN_MODE_S__SIZE 0x00000002
+#define NV10TCL_TX_GEN_MODE_S_FALSE 0x00000000
+#define NV10TCL_TX_GEN_MODE_S_EYE_LINEAR 0x00002400
+#define NV10TCL_TX_GEN_MODE_S_OBJECT_LINEAR 0x00002401
+#define NV10TCL_TX_GEN_MODE_S_SPHERE_MAP 0x00002402
+#define NV10TCL_TX_GEN_MODE_S_NORMAL_MAP 0x00008511
+#define NV10TCL_TX_GEN_MODE_S_REFLECTION_MAP 0x00008512
+#define NV10TCL_TX_GEN_MODE_T(x) (0x000003c4+((x)*16))
+#define NV10TCL_TX_GEN_MODE_T__SIZE 0x00000002
+#define NV10TCL_TX_GEN_MODE_T_FALSE 0x00000000
+#define NV10TCL_TX_GEN_MODE_T_EYE_LINEAR 0x00002400
+#define NV10TCL_TX_GEN_MODE_T_OBJECT_LINEAR 0x00002401
+#define NV10TCL_TX_GEN_MODE_T_SPHERE_MAP 0x00002402
+#define NV10TCL_TX_GEN_MODE_T_NORMAL_MAP 0x00008511
+#define NV10TCL_TX_GEN_MODE_T_REFLECTION_MAP 0x00008512
+#define NV10TCL_TX_GEN_MODE_R(x) (0x000003c8+((x)*16))
+#define NV10TCL_TX_GEN_MODE_R__SIZE 0x00000002
+#define NV10TCL_TX_GEN_MODE_R_FALSE 0x00000000
+#define NV10TCL_TX_GEN_MODE_R_EYE_LINEAR 0x00002400
+#define NV10TCL_TX_GEN_MODE_R_OBJECT_LINEAR 0x00002401
+#define NV10TCL_TX_GEN_MODE_R_SPHERE_MAP 0x00002402
+#define NV10TCL_TX_GEN_MODE_R_NORMAL_MAP 0x00008511
+#define NV10TCL_TX_GEN_MODE_R_REFLECTION_MAP 0x00008512
+#define NV10TCL_TX_GEN_MODE_Q(x) (0x000003cc+((x)*16))
+#define NV10TCL_TX_GEN_MODE_Q__SIZE 0x00000002
+#define NV10TCL_TX_GEN_MODE_Q_FALSE 0x00000000
+#define NV10TCL_TX_GEN_MODE_Q_EYE_LINEAR 0x00002400
+#define NV10TCL_TX_GEN_MODE_Q_OBJECT_LINEAR 0x00002401
+#define NV10TCL_TX_GEN_MODE_Q_SPHERE_MAP 0x00002402
+#define NV10TCL_TX_GEN_MODE_Q_NORMAL_MAP 0x00008511
+#define NV10TCL_TX_GEN_MODE_Q_REFLECTION_MAP 0x00008512
+#define NV10TCL_TX_MATRIX_ENABLE(x) (0x000003e0+((x)*4))
+#define NV10TCL_TX_MATRIX_ENABLE__SIZE 0x00000002
+#define NV10TCL_VIEW_MATRIX_ENABLE 0x000003e8
+#define NV10TCL_VIEW_MATRIX_ENABLE_MODELVIEW1 (1 << 0)
+#define NV10TCL_VIEW_MATRIX_ENABLE_MODELVIEW0 (1 << 1)
+#define NV10TCL_VIEW_MATRIX_ENABLE_PROJECTION (1 << 2)
+#define NV10TCL_POINT_SIZE 0x000003ec
+#define NV10TCL_MODELVIEW0_MATRIX(x) (0x00000400+((x)*4))
+#define NV10TCL_MODELVIEW0_MATRIX__SIZE 0x00000010
+#define NV10TCL_MODELVIEW1_MATRIX(x) (0x00000440+((x)*4))
+#define NV10TCL_MODELVIEW1_MATRIX__SIZE 0x00000010
+#define NV10TCL_INVERSE_MODELVIEW0_MATRIX(x) (0x00000480+((x)*4))
+#define NV10TCL_INVERSE_MODELVIEW0_MATRIX__SIZE 0x00000010
+#define NV10TCL_INVERSE_MODELVIEW1_MATRIX(x) (0x000004c0+((x)*4))
+#define NV10TCL_INVERSE_MODELVIEW1_MATRIX__SIZE 0x00000010
+#define NV10TCL_PROJECTION_MATRIX(x) (0x00000500+((x)*4))
+#define NV10TCL_PROJECTION_MATRIX__SIZE 0x00000010
+#define NV10TCL_TX0_MATRIX(x) (0x00000540+((x)*4))
+#define NV10TCL_TX0_MATRIX__SIZE 0x00000010
+#define NV10TCL_TX1_MATRIX(x) (0x00000580+((x)*4))
+#define NV10TCL_TX1_MATRIX__SIZE 0x00000010
+#define NV10TCL_TX_GEN_COEFF_S_A(x) (0x00000600+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_S_A__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_S_B(x) (0x00000604+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_S_B__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_S_C(x) (0x00000608+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_S_C__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_S_D(x) (0x0000060c+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_S_D__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_T_A(x) (0x00000610+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_T_A__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_T_B(x) (0x00000614+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_T_B__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_T_C(x) (0x00000618+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_T_C__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_T_D(x) (0x0000061c+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_T_D__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_R_A(x) (0x00000620+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_R_A__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_R_B(x) (0x00000624+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_R_B__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_R_C(x) (0x00000628+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_R_C__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_R_D(x) (0x0000062c+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_R_D__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_Q_A(x) (0x00000630+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_Q_A__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_Q_B(x) (0x00000634+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_Q_B__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_Q_C(x) (0x00000638+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_Q_C__SIZE 0x00000002
+#define NV10TCL_TX_GEN_COEFF_Q_D(x) (0x0000063c+((x)*64))
+#define NV10TCL_TX_GEN_COEFF_Q_D__SIZE 0x00000002
+#define NV10TCL_FOG_EQUATION_CONSTANT 0x00000680
+#define NV10TCL_FOG_EQUATION_LINEAR 0x00000684
+#define NV10TCL_FOG_EQUATION_QUADRATIC 0x00000688
+#define NV10TCL_MATERIAL_SHININESS(x) (0x000006a0+((x)*4))
+#define NV10TCL_MATERIAL_SHININESS__SIZE 0x00000006
+#define NV10TCL_LIGHT_MODEL_AMBIENT_R 0x000006c4
+#define NV10TCL_LIGHT_MODEL_AMBIENT_G 0x000006c8
+#define NV10TCL_LIGHT_MODEL_AMBIENT_B 0x000006cc
+#define NV10TCL_VIEWPORT_TRANSLATE_X 0x000006e8
+#define NV10TCL_VIEWPORT_TRANSLATE_Y 0x000006ec
+#define NV10TCL_VIEWPORT_TRANSLATE_Z 0x000006f0
+#define NV10TCL_VIEWPORT_TRANSLATE_W 0x000006f4
+#define NV10TCL_POINT_PARAMETER(x) (0x000006f8+((x)*4))
+#define NV10TCL_POINT_PARAMETER__SIZE 0x00000008
+#define NV10TCL_LIGHT_AMBIENT_R(x) (0x00000800+((x)*128))
+#define NV10TCL_LIGHT_AMBIENT_R__SIZE 0x00000008
+#define NV10TCL_LIGHT_AMBIENT_G(x) (0x00000804+((x)*128))
+#define NV10TCL_LIGHT_AMBIENT_G__SIZE 0x00000008
+#define NV10TCL_LIGHT_AMBIENT_B(x) (0x00000808+((x)*128))
+#define NV10TCL_LIGHT_AMBIENT_B__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIFFUSE_R(x) (0x0000080c+((x)*128))
+#define NV10TCL_LIGHT_DIFFUSE_R__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIFFUSE_G(x) (0x00000810+((x)*128))
+#define NV10TCL_LIGHT_DIFFUSE_G__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIFFUSE_B(x) (0x00000814+((x)*128))
+#define NV10TCL_LIGHT_DIFFUSE_B__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPECULAR_R(x) (0x00000818+((x)*128))
+#define NV10TCL_LIGHT_SPECULAR_R__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPECULAR_G(x) (0x0000081c+((x)*128))
+#define NV10TCL_LIGHT_SPECULAR_G__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPECULAR_B(x) (0x00000820+((x)*128))
+#define NV10TCL_LIGHT_SPECULAR_B__SIZE 0x00000008
+#define NV10TCL_LIGHT_HALF_VECTOR_X(x) (0x00000828+((x)*128))
+#define NV10TCL_LIGHT_HALF_VECTOR_X__SIZE 0x00000008
+#define NV10TCL_LIGHT_HALF_VECTOR_Y(x) (0x0000082c+((x)*128))
+#define NV10TCL_LIGHT_HALF_VECTOR_Y__SIZE 0x00000008
+#define NV10TCL_LIGHT_HALF_VECTOR_Z(x) (0x00000830+((x)*128))
+#define NV10TCL_LIGHT_HALF_VECTOR_Z__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIRECTION_X(x) (0x00000834+((x)*128))
+#define NV10TCL_LIGHT_DIRECTION_X__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIRECTION_Y(x) (0x00000838+((x)*128))
+#define NV10TCL_LIGHT_DIRECTION_Y__SIZE 0x00000008
+#define NV10TCL_LIGHT_DIRECTION_Z(x) (0x0000083c+((x)*128))
+#define NV10TCL_LIGHT_DIRECTION_Z__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_CUTOFF_A(x) (0x00000840+((x)*128))
+#define NV10TCL_LIGHT_SPOT_CUTOFF_A__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_CUTOFF_B(x) (0x00000844+((x)*128))
+#define NV10TCL_LIGHT_SPOT_CUTOFF_B__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_CUTOFF_C(x) (0x00000848+((x)*128))
+#define NV10TCL_LIGHT_SPOT_CUTOFF_C__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_DIR_X(x) (0x0000084c+((x)*128))
+#define NV10TCL_LIGHT_SPOT_DIR_X__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_DIR_Y(x) (0x00000850+((x)*128))
+#define NV10TCL_LIGHT_SPOT_DIR_Y__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_DIR_Z(x) (0x00000854+((x)*128))
+#define NV10TCL_LIGHT_SPOT_DIR_Z__SIZE 0x00000008
+#define NV10TCL_LIGHT_SPOT_CUTOFF_D(x) (0x00000858+((x)*128))
+#define NV10TCL_LIGHT_SPOT_CUTOFF_D__SIZE 0x00000008
+#define NV10TCL_LIGHT_POSITION_X(x) (0x0000085c+((x)*128))
+#define NV10TCL_LIGHT_POSITION_X__SIZE 0x00000008
+#define NV10TCL_LIGHT_POSITION_Y(x) (0x00000860+((x)*128))
+#define NV10TCL_LIGHT_POSITION_Y__SIZE 0x00000008
+#define NV10TCL_LIGHT_POSITION_Z(x) (0x00000864+((x)*128))
+#define NV10TCL_LIGHT_POSITION_Z__SIZE 0x00000008
+#define NV10TCL_LIGHT_ATTENUATION_CONSTANT(x) (0x00000868+((x)*128))
+#define NV10TCL_LIGHT_ATTENUATION_CONSTANT__SIZE 0x00000008
+#define NV10TCL_LIGHT_ATTENUATION_LINEAR(x) (0x0000086c+((x)*128))
+#define NV10TCL_LIGHT_ATTENUATION_LINEAR__SIZE 0x00000008
+#define NV10TCL_LIGHT_ATTENUATION_QUADRATIC(x) (0x00000870+((x)*128))
+#define NV10TCL_LIGHT_ATTENUATION_QUADRATIC__SIZE 0x00000008
+#define NV10TCL_VERTEX_POS_3F_X 0x00000c00
+#define NV10TCL_VERTEX_POS_3F_Y 0x00000c04
+#define NV10TCL_VERTEX_POS_3F_Z 0x00000c08
+#define NV10TCL_VERTEX_POS_4F_X 0x00000c18
+#define NV10TCL_VERTEX_POS_4F_Y 0x00000c1c
+#define NV10TCL_VERTEX_POS_4F_Z 0x00000c20
+#define NV10TCL_VERTEX_POS_4F_W 0x00000c24
+#define NV10TCL_VERTEX_NOR_3F_X 0x00000c30
+#define NV10TCL_VERTEX_NOR_3F_Y 0x00000c34
+#define NV10TCL_VERTEX_NOR_3F_Z 0x00000c38
+#define NV10TCL_VERTEX_NOR_3I_XY 0x00000c40
+#define NV10TCL_VERTEX_NOR_3I_XY_X_SHIFT 0
+#define NV10TCL_VERTEX_NOR_3I_XY_X_MASK 0x0000ffff
+#define NV10TCL_VERTEX_NOR_3I_XY_Y_SHIFT 16
+#define NV10TCL_VERTEX_NOR_3I_XY_Y_MASK 0xffff0000
+#define NV10TCL_VERTEX_NOR_3I_Z 0x00000c44
+#define NV10TCL_VERTEX_NOR_3I_Z_Z_SHIFT 0
+#define NV10TCL_VERTEX_NOR_3I_Z_Z_MASK 0x0000ffff
+#define NV10TCL_VERTEX_COL_4F_R 0x00000c50
+#define NV10TCL_VERTEX_COL_4F_G 0x00000c54
+#define NV10TCL_VERTEX_COL_4F_B 0x00000c58
+#define NV10TCL_VERTEX_COL_4F_A 0x00000c5c
+#define NV10TCL_VERTEX_COL_3F_R 0x00000c60
+#define NV10TCL_VERTEX_COL_3F_G 0x00000c64
+#define NV10TCL_VERTEX_COL_3F_B 0x00000c68
+#define NV10TCL_VERTEX_COL_4I 0x00000c6c
+#define NV10TCL_VERTEX_COL_4I_R_SHIFT 0
+#define NV10TCL_VERTEX_COL_4I_R_MASK 0x000000ff
+#define NV10TCL_VERTEX_COL_4I_G_SHIFT 8
+#define NV10TCL_VERTEX_COL_4I_G_MASK 0x0000ff00
+#define NV10TCL_VERTEX_COL_4I_B_SHIFT 16
+#define NV10TCL_VERTEX_COL_4I_B_MASK 0x00ff0000
+#define NV10TCL_VERTEX_COL_4I_A_SHIFT 24
+#define NV10TCL_VERTEX_COL_4I_A_MASK 0xff000000
+#define NV10TCL_VERTEX_COL2_3F_R 0x00000c80
+#define NV10TCL_VERTEX_COL2_3F_G 0x00000c84
+#define NV10TCL_VERTEX_COL2_3F_B 0x00000c88
+#define NV10TCL_VERTEX_COL2_3I 0x00000c8c
+#define NV10TCL_VERTEX_COL2_3I_R_SHIFT 0
+#define NV10TCL_VERTEX_COL2_3I_R_MASK 0x000000ff
+#define NV10TCL_VERTEX_COL2_3I_G_SHIFT 8
+#define NV10TCL_VERTEX_COL2_3I_G_MASK 0x0000ff00
+#define NV10TCL_VERTEX_COL2_3I_B_SHIFT 16
+#define NV10TCL_VERTEX_COL2_3I_B_MASK 0x00ff0000
+#define NV10TCL_VERTEX_TX0_2F_S 0x00000c90
+#define NV10TCL_VERTEX_TX0_2F_T 0x00000c94
+#define NV10TCL_VERTEX_TX0_2I 0x00000c98
+#define NV10TCL_VERTEX_TX0_2I_S_SHIFT 0
+#define NV10TCL_VERTEX_TX0_2I_S_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX0_2I_T_SHIFT 16
+#define NV10TCL_VERTEX_TX0_2I_T_MASK 0xffff0000
+#define NV10TCL_VERTEX_TX0_4F_S 0x00000ca0
+#define NV10TCL_VERTEX_TX0_4F_T 0x00000ca4
+#define NV10TCL_VERTEX_TX0_4F_R 0x00000ca8
+#define NV10TCL_VERTEX_TX0_4F_Q 0x00000cac
+#define NV10TCL_VERTEX_TX0_4I_ST 0x00000cb0
+#define NV10TCL_VERTEX_TX0_4I_ST_S_SHIFT 0
+#define NV10TCL_VERTEX_TX0_4I_ST_S_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX0_4I_ST_T_SHIFT 16
+#define NV10TCL_VERTEX_TX0_4I_ST_T_MASK 0xffff0000
+#define NV10TCL_VERTEX_TX0_4I_RQ 0x00000cb4
+#define NV10TCL_VERTEX_TX0_4I_RQ_R_SHIFT 0
+#define NV10TCL_VERTEX_TX0_4I_RQ_R_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX0_4I_RQ_Q_SHIFT 16
+#define NV10TCL_VERTEX_TX0_4I_RQ_Q_MASK 0xffff0000
+#define NV10TCL_VERTEX_TX1_2F_S 0x00000cb8
+#define NV10TCL_VERTEX_TX1_2F_T 0x00000cbc
+#define NV10TCL_VERTEX_TX1_2I 0x00000cc0
+#define NV10TCL_VERTEX_TX1_2I_S_SHIFT 0
+#define NV10TCL_VERTEX_TX1_2I_S_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX1_2I_T_SHIFT 16
+#define NV10TCL_VERTEX_TX1_2I_T_MASK 0xffff0000
+#define NV10TCL_VERTEX_TX1_4F_S 0x00000cc8
+#define NV10TCL_VERTEX_TX1_4F_T 0x00000ccc
+#define NV10TCL_VERTEX_TX1_4F_R 0x00000cd0
+#define NV10TCL_VERTEX_TX1_4F_Q 0x00000cd4
+#define NV10TCL_VERTEX_TX1_4I_ST 0x00000cd8
+#define NV10TCL_VERTEX_TX1_4I_ST_S_SHIFT 0
+#define NV10TCL_VERTEX_TX1_4I_ST_S_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX1_4I_ST_T_SHIFT 16
+#define NV10TCL_VERTEX_TX1_4I_ST_T_MASK 0xffff0000
+#define NV10TCL_VERTEX_TX1_4I_RQ 0x00000cdc
+#define NV10TCL_VERTEX_TX1_4I_RQ_R_SHIFT 0
+#define NV10TCL_VERTEX_TX1_4I_RQ_R_MASK 0x0000ffff
+#define NV10TCL_VERTEX_TX1_4I_RQ_Q_SHIFT 16
+#define NV10TCL_VERTEX_TX1_4I_RQ_Q_MASK 0xffff0000
+#define NV10TCL_VERTEX_FOG_1F 0x00000ce0
+#define NV10TCL_VERTEX_WGH_1F 0x00000ce4
+#define NV10TCL_EDGEFLAG_ENABLE 0x00000cec
+#define NV10TCL_VERTEX_ARRAY_VALIDATE 0x00000cf0
+#define NV10TCL_VTXBUF_ADDRESS(x) (0x00000d00+((x)*8))
+#define NV10TCL_VTXBUF_ADDRESS__SIZE 0x00000008
+#define NV10TCL_VTXFMT(x) (0x00000d04+((x)*8))
+#define NV10TCL_VTXFMT__SIZE 0x00000008
+#define NV10TCL_VTXFMT_TYPE_SHIFT 0
+#define NV10TCL_VTXFMT_TYPE_MASK 0x0000000f
+#define NV10TCL_VTXFMT_TYPE_BYTE_BGRA 0x00000000
+#define NV10TCL_VTXFMT_TYPE_SHORT 0x00000001
+#define NV10TCL_VTXFMT_TYPE_FLOAT 0x00000002
+#define NV10TCL_VTXFMT_TYPE_BYTE_RGBA 0x00000004
+#define NV10TCL_VTXFMT_FIELDS_SHIFT 4
+#define NV10TCL_VTXFMT_FIELDS_MASK 0x000000f0
+#define NV10TCL_VTXFMT_STRIDE_SHIFT 8
+#define NV10TCL_VTXFMT_STRIDE_MASK 0x0000ff00
+#define NV10TCL_VTXFMT_POS_HOMOGENEOUS (1 << 24)
+#define NV10TCL_VERTEX_BEGIN_END 0x00000dfc
+#define NV10TCL_VERTEX_BEGIN_END_STOP 0x00000000
+#define NV10TCL_VERTEX_BEGIN_END_POINTS 0x00000001
+#define NV10TCL_VERTEX_BEGIN_END_LINES 0x00000002
+#define NV10TCL_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
+#define NV10TCL_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
+#define NV10TCL_VERTEX_BEGIN_END_TRIANGLES 0x00000005
+#define NV10TCL_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
+#define NV10TCL_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
+#define NV10TCL_VERTEX_BEGIN_END_QUADS 0x00000008
+#define NV10TCL_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
+#define NV10TCL_VERTEX_BEGIN_END_POLYGON 0x0000000a
+#define NV10TCL_VB_ELEMENT_U16 0x00000e00
+#define NV10TCL_VB_ELEMENT_U16_I0_SHIFT 0
+#define NV10TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
+#define NV10TCL_VB_ELEMENT_U16_I1_SHIFT 16
+#define NV10TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
+#define NV10TCL_VB_ELEMENT_U32 0x00001100
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END 0x000013fc
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_STOP 0x00000000
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_POINTS 0x00000001
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINES 0x00000002
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINE_LOOP 0x00000003
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_LINE_STRIP 0x00000004
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLES 0x00000005
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLE_STRIP 0x00000006
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_TRIANGLE_FAN 0x00000007
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_QUADS 0x00000008
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_QUAD_STRIP 0x00000009
+#define NV10TCL_VERTEX_BUFFER_BEGIN_END_POLYGON 0x0000000a
+#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS 0x00001400
+#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_FIRST_SHIFT 0
+#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_FIRST_MASK 0x0000ffff
+#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_LAST_SHIFT 24
+#define NV10TCL_VERTEX_BUFFER_DRAW_ARRAYS_LAST_MASK 0xff000000
+#define NV10TCL_VERTEX_ARRAY_DATA 0x00001800
+
+
+#define NV11TCL 0x00000096
+
+#define NV11TCL_COLOR_LOGIC_OP_ENABLE 0x00000d40
+#define NV11TCL_COLOR_LOGIC_OP_OP 0x00000d44
+#define NV11TCL_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
+#define NV11TCL_COLOR_LOGIC_OP_OP_AND 0x00001501
+#define NV11TCL_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
+#define NV11TCL_COLOR_LOGIC_OP_OP_COPY 0x00001503
+#define NV11TCL_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
+#define NV11TCL_COLOR_LOGIC_OP_OP_NOOP 0x00001505
+#define NV11TCL_COLOR_LOGIC_OP_OP_XOR 0x00001506
+#define NV11TCL_COLOR_LOGIC_OP_OP_OR 0x00001507
+#define NV11TCL_COLOR_LOGIC_OP_OP_NOR 0x00001508
+#define NV11TCL_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
+#define NV11TCL_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
+#define NV11TCL_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
+#define NV11TCL_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
+#define NV11TCL_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
+#define NV11TCL_COLOR_LOGIC_OP_OP_NAND 0x0000150e
+#define NV11TCL_COLOR_LOGIC_OP_OP_SET 0x0000150f
+
+
+#define NV17TCL 0x00000099
+
+#define NV17TCL_DMA_IN_MEMORY4 0x000001ac
+#define NV17TCL_DMA_IN_MEMORY5 0x000001b0
+#define NV17TCL_COLOR_MASK_ENABLE 0x000002bc
+#define NV17TCL_LMA_DEPTH_BUFFER_PITCH 0x00000d5c
+#define NV17TCL_LMA_DEPTH_BUFFER_OFFSET 0x00000d60
+#define NV17TCL_LMA_DEPTH_FILL_VALUE 0x00000d68
+#define NV17TCL_LMA_DEPTH_BUFFER_CLEAR 0x00000d6c
+#define NV17TCL_LMA_DEPTH_WINDOW_X 0x00001638
+#define NV17TCL_LMA_DEPTH_WINDOW_Y 0x0000163c
+#define NV17TCL_LMA_DEPTH_WINDOW_Z 0x00001640
+#define NV17TCL_LMA_DEPTH_WINDOW_W 0x00001644
+#define NV17TCL_LMA_DEPTH_ENABLE 0x00001658
+
+
+#define NV03_CONTEXT_SURFACES_2D 0x00000058
+
+#define NV03_CONTEXT_SURFACES_2D_SYNCHRONIZE 0x00000100
+#define NV03_CONTEXT_SURFACES_2D_DMA_NOTIFY 0x00000180
+#define NV03_CONTEXT_SURFACES_2D_DMA_SOURCE 0x00000184
+#define NV03_CONTEXT_SURFACES_2D_DMA_DESTIN 0x00000188
+#define NV03_CONTEXT_SURFACES_2D_COLOR_FORMAT 0x00000300
+#define NV03_CONTEXT_SURFACES_2D_PITCH 0x00000304
+#define NV03_CONTEXT_SURFACES_2D_PITCH_SOURCE_SHIFT 0
+#define NV03_CONTEXT_SURFACES_2D_PITCH_SOURCE_MASK 0x0000ffff
+#define NV03_CONTEXT_SURFACES_2D_PITCH_DESTIN_SHIFT 16
+#define NV03_CONTEXT_SURFACES_2D_PITCH_DESTIN_MASK 0xffff0000
+#define NV03_CONTEXT_SURFACES_2D_OFFSET_SOURCE 0x00000308
+#define NV03_CONTEXT_SURFACES_2D_OFFSET_DESTIN 0x0000030c
+
+
+#define NV03_CONTEXT_SURFACES_3D 0x0000005a
+
+#define NV03_CONTEXT_SURFACES_3D_SYNCHRONIZE 0x00000100
+#define NV03_CONTEXT_SURFACES_3D_DMA_NOTIFY 0x00000180
+#define NV03_CONTEXT_SURFACES_3D_DMA_SURFACE 0x00000184
+#define NV03_CONTEXT_SURFACES_3D_PITCH 0x00000300
+#define NV03_CONTEXT_SURFACES_3D_OFFSET_COLOR 0x00000304
+#define NV03_CONTEXT_SURFACES_3D_OFFSET_ZETA 0x00000308
+
+
+#define NV04_INDEXED_IMAGE_FROM_CPU 0x00000060
+
+#define NV04_INDEXED_IMAGE_FROM_CPU_NOP 0x00000100
+#define NV04_INDEXED_IMAGE_FROM_CPU_NOTIFY 0x00000104
+#define NV04_INDEXED_IMAGE_FROM_CPU_PATCH 0x0000010c
+#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_NOTIFY 0x00000180
+#define NV04_INDEXED_IMAGE_FROM_CPU_DMA_LUT 0x00000184
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_KEY 0x00000188
+#define NV04_INDEXED_IMAGE_FROM_CPU_CLIP_RECTANGLE 0x0000018c
+#define NV04_INDEXED_IMAGE_FROM_CPU_PATTERN 0x00000190
+#define NV04_INDEXED_IMAGE_FROM_CPU_ROP 0x00000194
+#define NV04_INDEXED_IMAGE_FROM_CPU_BETA1 0x00000198
+#define NV04_INDEXED_IMAGE_FROM_CPU_BETA4 0x0000019c
+#define NV04_INDEXED_IMAGE_FROM_CPU_SURFACE 0x000001a0
+#define NV04_INDEXED_IMAGE_FROM_CPU_OPERATION 0x000003e4
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR_FORMAT 0x000003e8
+#define NV04_INDEXED_IMAGE_FROM_CPU_INDEX_FORMAT 0x000003ec
+#define NV04_INDEXED_IMAGE_FROM_CPU_LUT_OFFSET 0x000003f0
+#define NV04_INDEXED_IMAGE_FROM_CPU_POINT 0x000003f4
+#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_OUT 0x000003f8
+#define NV04_INDEXED_IMAGE_FROM_CPU_SIZE_IN 0x000003fc
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
+#define NV04_INDEXED_IMAGE_FROM_CPU_COLOR__SIZE 0x00000700
+
+
+#define NV05_INDEXED_IMAGE_FROM_CPU 0x00000064
+
+#define NV05_INDEXED_IMAGE_FROM_CPU_COLOR_CONVERSION 0x000003e0
+
+
+#define NV03_CHANNEL_PIO 0x0000006a
+
+
+
+#define NV03_CHANNEL_DMA 0x0000006b
+
+
+
+#define NV04_BETA_SOLID 0x00000072
+
+#define NV04_BETA_SOLID_NOP 0x00000100
+#define NV04_BETA_SOLID_NOTIFY 0x00000104
+#define NV04_BETA_SOLID_DMA_NOTIFY 0x00000180
+#define NV04_BETA_SOLID_BETA_OUTPUT 0x00000200
+#define NV04_BETA_SOLID_BETA_FACTOR 0x00000300
+
+
+#define NV10_TEXTURE_FROM_CPU 0x0000007b
+
+#define NV10_TEXTURE_FROM_CPU_NOP 0x00000100
+#define NV10_TEXTURE_FROM_CPU_NOTIFY 0x00000104
+#define NV10_TEXTURE_FROM_CPU_WAIT_FOR_IDLE 0x00000108
+#define NV10_TEXTURE_FROM_CPU_PM_TRIGGER 0x00000140
+#define NV10_TEXTURE_FROM_CPU_DMA_NOTIFY 0x00000180
+#define NV10_TEXTURE_FROM_CPU_SURFACE 0x00000184
+#define NV10_TEXTURE_FROM_CPU_COLOR_FORMAT 0x00000300
+#define NV10_TEXTURE_FROM_CPU_POINT 0x00000304
+#define NV10_TEXTURE_FROM_CPU_POINT_X_SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_POINT_X_MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_POINT_Y_SHIFT 16
+#define NV10_TEXTURE_FROM_CPU_POINT_Y_MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_SIZE 0x00000308
+#define NV10_TEXTURE_FROM_CPU_SIZE_W_SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_SIZE_W_MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_SIZE_H_SHIFT 16
+#define NV10_TEXTURE_FROM_CPU_SIZE_H_MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL 0x0000030c
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X_SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_X_MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W_SHIFT 16
+#define NV10_TEXTURE_FROM_CPU_CLIP_HORIZONTAL_W_MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL 0x00000310
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y_SHIFT 0
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_Y_MASK 0x0000ffff
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H_SHIFT 16
+#define NV10_TEXTURE_FROM_CPU_CLIP_VERTICAL_H_MASK 0xffff0000
+#define NV10_TEXTURE_FROM_CPU_COLOR(x) (0x00000400+((x)*4))
+#define NV10_TEXTURE_FROM_CPU_COLOR__SIZE 0x00000700
+
+
+#define NV30_TEXTURE_FROM_CPU 0x0000037b
+
+
+
+#define NV40_TEXTURE_FROM_CPU 0x0000307b
+
+
+
+#define NV10_VIDEO_DISPLAY 0x0000007c
+
+
+
+#define NV20TCL 0x00000097
+
+#define NV20TCL_NOP 0x00000100
+#define NV20TCL_NOTIFY 0x00000104
+#define NV20TCL_DMA_NOTIFY 0x00000180
+#define NV20TCL_DMA_TEXTURE0 0x00000184
+#define NV20TCL_DMA_TEXTURE1 0x00000188
+#define NV20TCL_DMA_COLOR 0x00000194
+#define NV20TCL_DMA_ZETA 0x00000198
+#define NV20TCL_DMA_VTXBUF0 0x0000019c
+#define NV20TCL_DMA_VTXBUF1 0x000001a0
+#define NV20TCL_DMA_FENCE 0x000001a4
+#define NV20TCL_DMA_QUERY 0x000001a8
+#define NV20TCL_RT_HORIZ 0x00000200
+#define NV20TCL_RT_HORIZ_X_SHIFT 0
+#define NV20TCL_RT_HORIZ_X_MASK 0x0000ffff
+#define NV20TCL_RT_HORIZ_W_SHIFT 16
+#define NV20TCL_RT_HORIZ_W_MASK 0xffff0000
+#define NV20TCL_RT_VERT 0x00000204
+#define NV20TCL_RT_VERT_Y_SHIFT 0
+#define NV20TCL_RT_VERT_Y_MASK 0x0000ffff
+#define NV20TCL_RT_VERT_H_SHIFT 16
+#define NV20TCL_RT_VERT_H_MASK 0xffff0000
+#define NV20TCL_RT_FORMAT 0x00000208
+#define NV20TCL_RT_FORMAT_TYPE_SHIFT 8
+#define NV20TCL_RT_FORMAT_TYPE_MASK 0x00000f00
+#define NV20TCL_RT_FORMAT_TYPE_LINEAR 0x00000100
+#define NV20TCL_RT_FORMAT_TYPE_SWIZZLED 0x00000200
+#define NV20TCL_RT_FORMAT_COLOR_SHIFT 0
+#define NV20TCL_RT_FORMAT_COLOR_MASK 0x0000001f
+#define NV20TCL_RT_FORMAT_COLOR_R5G6B5 0x00000003
+#define NV20TCL_RT_FORMAT_COLOR_X8R8G8B8 0x00000005
+#define NV20TCL_RT_FORMAT_COLOR_A8R8G8B8 0x00000008
+#define NV20TCL_RT_FORMAT_COLOR_B8 0x00000009
+#define NV20TCL_RT_FORMAT_COLOR_UNKNOWN 0x0000000d
+#define NV20TCL_RT_FORMAT_COLOR_X8B8G8R8 0x0000000f
+#define NV20TCL_RT_FORMAT_COLOR_A8B8G8R8 0x00000010
+#define NV20TCL_RT_PITCH 0x0000020c
+#define NV20TCL_RT_PITCH_COLOR_PITCH_SHIFT 0
+#define NV20TCL_RT_PITCH_COLOR_PITCH_MASK 0x0000ffff
+#define NV20TCL_RT_PITCH_ZETA_PITCH_SHIFT 16
+#define NV20TCL_RT_PITCH_ZETA_PITCH_MASK 0xffff0000
+#define NV20TCL_COLOR_OFFSET 0x00000210
+#define NV20TCL_ZETA_OFFSET 0x00000214
+#define NV20TCL_RC_IN_ALPHA(x) (0x00000260+((x)*4))
+#define NV20TCL_RC_IN_ALPHA__SIZE 0x00000008
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_SHIFT 0
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_MASK 0x0000000f
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_FOG 0x00000003
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE0 0x00000008
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE1 0x00000009
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE0 0x0000000c
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE1 0x0000000d
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_E_TIMES_F 0x0000000f
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE2 0x0000000a
+#define NV20TCL_RC_IN_ALPHA_D_INPUT_TEXTURE3 0x0000000b
+#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE (1 << 4)
+#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_BLUE 0x00000000
+#define NV20TCL_RC_IN_ALPHA_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SHIFT 5
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_MASK 0x000000e0
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV20TCL_RC_IN_ALPHA_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_SHIFT 8
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_MASK 0x00000f00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_FOG 0x00000300
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_IN_ALPHA_C_INPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE (1 << 12)
+#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_BLUE 0x00000000
+#define NV20TCL_RC_IN_ALPHA_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SHIFT 13
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_MASK 0x0000e000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV20TCL_RC_IN_ALPHA_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_SHIFT 16
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_MASK 0x000f0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_FOG 0x00030000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE0 0x00080000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE1 0x00090000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE0 0x000c0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE1 0x000d0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_E_TIMES_F 0x000f0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE2 0x000a0000
+#define NV20TCL_RC_IN_ALPHA_B_INPUT_TEXTURE3 0x000b0000
+#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE (1 << 20)
+#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_BLUE 0x00000000
+#define NV20TCL_RC_IN_ALPHA_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SHIFT 21
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_MASK 0x00e00000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV20TCL_RC_IN_ALPHA_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_SHIFT 24
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_MASK 0x0f000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_FOG 0x03000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE0 0x08000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE1 0x09000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE0 0x0c000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE1 0x0d000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_E_TIMES_F 0x0f000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE2 0x0a000000
+#define NV20TCL_RC_IN_ALPHA_A_INPUT_TEXTURE3 0x0b000000
+#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE (1 << 28)
+#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_BLUE 0x00000000
+#define NV20TCL_RC_IN_ALPHA_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SHIFT 29
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_MASK 0xe0000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV20TCL_RC_IN_ALPHA_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV20TCL_RC_FINAL0 0x00000288
+#define NV20TCL_RC_FINAL0_D_INPUT_SHIFT 0
+#define NV20TCL_RC_FINAL0_D_INPUT_MASK 0x0000000f
+#define NV20TCL_RC_FINAL0_D_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV20TCL_RC_FINAL0_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV20TCL_RC_FINAL0_D_INPUT_FOG 0x00000003
+#define NV20TCL_RC_FINAL0_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV20TCL_RC_FINAL0_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE0 0x00000008
+#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE1 0x00000009
+#define NV20TCL_RC_FINAL0_D_INPUT_SPARE0 0x0000000c
+#define NV20TCL_RC_FINAL0_D_INPUT_SPARE1 0x0000000d
+#define NV20TCL_RC_FINAL0_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV20TCL_RC_FINAL0_D_INPUT_E_TIMES_F 0x0000000f
+#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE2 0x0000000a
+#define NV20TCL_RC_FINAL0_D_INPUT_TEXTURE3 0x0000000b
+#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE (1 << 4)
+#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL0_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV20TCL_RC_FINAL0_D_MAPPING_SHIFT 5
+#define NV20TCL_RC_FINAL0_D_MAPPING_MASK 0x000000e0
+#define NV20TCL_RC_FINAL0_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL0_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV20TCL_RC_FINAL0_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV20TCL_RC_FINAL0_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV20TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV20TCL_RC_FINAL0_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV20TCL_RC_FINAL0_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV20TCL_RC_FINAL0_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV20TCL_RC_FINAL0_C_INPUT_SHIFT 8
+#define NV20TCL_RC_FINAL0_C_INPUT_MASK 0x00000f00
+#define NV20TCL_RC_FINAL0_C_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_FINAL0_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_FINAL0_C_INPUT_FOG 0x00000300
+#define NV20TCL_RC_FINAL0_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_FINAL0_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_FINAL0_C_INPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_FINAL0_C_INPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_FINAL0_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_FINAL0_C_INPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_FINAL0_C_INPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE (1 << 12)
+#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL0_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV20TCL_RC_FINAL0_C_MAPPING_SHIFT 13
+#define NV20TCL_RC_FINAL0_C_MAPPING_MASK 0x0000e000
+#define NV20TCL_RC_FINAL0_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL0_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV20TCL_RC_FINAL0_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV20TCL_RC_FINAL0_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV20TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV20TCL_RC_FINAL0_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV20TCL_RC_FINAL0_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV20TCL_RC_FINAL0_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV20TCL_RC_FINAL0_B_INPUT_SHIFT 16
+#define NV20TCL_RC_FINAL0_B_INPUT_MASK 0x000f0000
+#define NV20TCL_RC_FINAL0_B_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV20TCL_RC_FINAL0_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV20TCL_RC_FINAL0_B_INPUT_FOG 0x00030000
+#define NV20TCL_RC_FINAL0_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV20TCL_RC_FINAL0_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE0 0x00080000
+#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE1 0x00090000
+#define NV20TCL_RC_FINAL0_B_INPUT_SPARE0 0x000c0000
+#define NV20TCL_RC_FINAL0_B_INPUT_SPARE1 0x000d0000
+#define NV20TCL_RC_FINAL0_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV20TCL_RC_FINAL0_B_INPUT_E_TIMES_F 0x000f0000
+#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE2 0x000a0000
+#define NV20TCL_RC_FINAL0_B_INPUT_TEXTURE3 0x000b0000
+#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE (1 << 20)
+#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL0_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV20TCL_RC_FINAL0_B_MAPPING_SHIFT 21
+#define NV20TCL_RC_FINAL0_B_MAPPING_MASK 0x00e00000
+#define NV20TCL_RC_FINAL0_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL0_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV20TCL_RC_FINAL0_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV20TCL_RC_FINAL0_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV20TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV20TCL_RC_FINAL0_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV20TCL_RC_FINAL0_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV20TCL_RC_FINAL0_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV20TCL_RC_FINAL0_A_INPUT_SHIFT 24
+#define NV20TCL_RC_FINAL0_A_INPUT_MASK 0x0f000000
+#define NV20TCL_RC_FINAL0_A_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV20TCL_RC_FINAL0_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV20TCL_RC_FINAL0_A_INPUT_FOG 0x03000000
+#define NV20TCL_RC_FINAL0_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV20TCL_RC_FINAL0_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE0 0x08000000
+#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE1 0x09000000
+#define NV20TCL_RC_FINAL0_A_INPUT_SPARE0 0x0c000000
+#define NV20TCL_RC_FINAL0_A_INPUT_SPARE1 0x0d000000
+#define NV20TCL_RC_FINAL0_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV20TCL_RC_FINAL0_A_INPUT_E_TIMES_F 0x0f000000
+#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE2 0x0a000000
+#define NV20TCL_RC_FINAL0_A_INPUT_TEXTURE3 0x0b000000
+#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE (1 << 28)
+#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL0_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_SHIFT 29
+#define NV20TCL_RC_FINAL0_A_MAPPING_MASK 0xe0000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV20TCL_RC_FINAL0_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV20TCL_RC_FINAL1 0x0000028c
+#define NV20TCL_RC_FINAL1_COLOR_SUM_CLAMP (1 << 7)
+#define NV20TCL_RC_FINAL1_G_INPUT_SHIFT 8
+#define NV20TCL_RC_FINAL1_G_INPUT_MASK 0x00000f00
+#define NV20TCL_RC_FINAL1_G_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_FINAL1_G_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_FINAL1_G_INPUT_FOG 0x00000300
+#define NV20TCL_RC_FINAL1_G_INPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_FINAL1_G_INPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_FINAL1_G_INPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_FINAL1_G_INPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_FINAL1_G_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_FINAL1_G_INPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_FINAL1_G_INPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE (1 << 12)
+#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL1_G_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV20TCL_RC_FINAL1_G_MAPPING_SHIFT 13
+#define NV20TCL_RC_FINAL1_G_MAPPING_MASK 0x0000e000
+#define NV20TCL_RC_FINAL1_G_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL1_G_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV20TCL_RC_FINAL1_G_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV20TCL_RC_FINAL1_G_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV20TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV20TCL_RC_FINAL1_G_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV20TCL_RC_FINAL1_G_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV20TCL_RC_FINAL1_G_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV20TCL_RC_FINAL1_F_INPUT_SHIFT 16
+#define NV20TCL_RC_FINAL1_F_INPUT_MASK 0x000f0000
+#define NV20TCL_RC_FINAL1_F_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV20TCL_RC_FINAL1_F_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV20TCL_RC_FINAL1_F_INPUT_FOG 0x00030000
+#define NV20TCL_RC_FINAL1_F_INPUT_PRIMARY_COLOR 0x00040000
+#define NV20TCL_RC_FINAL1_F_INPUT_SECONDARY_COLOR 0x00050000
+#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE0 0x00080000
+#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE1 0x00090000
+#define NV20TCL_RC_FINAL1_F_INPUT_SPARE0 0x000c0000
+#define NV20TCL_RC_FINAL1_F_INPUT_SPARE1 0x000d0000
+#define NV20TCL_RC_FINAL1_F_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV20TCL_RC_FINAL1_F_INPUT_E_TIMES_F 0x000f0000
+#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE2 0x000a0000
+#define NV20TCL_RC_FINAL1_F_INPUT_TEXTURE3 0x000b0000
+#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE (1 << 20)
+#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL1_F_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV20TCL_RC_FINAL1_F_MAPPING_SHIFT 21
+#define NV20TCL_RC_FINAL1_F_MAPPING_MASK 0x00e00000
+#define NV20TCL_RC_FINAL1_F_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL1_F_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV20TCL_RC_FINAL1_F_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV20TCL_RC_FINAL1_F_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV20TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV20TCL_RC_FINAL1_F_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV20TCL_RC_FINAL1_F_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV20TCL_RC_FINAL1_F_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV20TCL_RC_FINAL1_E_INPUT_SHIFT 24
+#define NV20TCL_RC_FINAL1_E_INPUT_MASK 0x0f000000
+#define NV20TCL_RC_FINAL1_E_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV20TCL_RC_FINAL1_E_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV20TCL_RC_FINAL1_E_INPUT_FOG 0x03000000
+#define NV20TCL_RC_FINAL1_E_INPUT_PRIMARY_COLOR 0x04000000
+#define NV20TCL_RC_FINAL1_E_INPUT_SECONDARY_COLOR 0x05000000
+#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE0 0x08000000
+#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE1 0x09000000
+#define NV20TCL_RC_FINAL1_E_INPUT_SPARE0 0x0c000000
+#define NV20TCL_RC_FINAL1_E_INPUT_SPARE1 0x0d000000
+#define NV20TCL_RC_FINAL1_E_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV20TCL_RC_FINAL1_E_INPUT_E_TIMES_F 0x0f000000
+#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE2 0x0a000000
+#define NV20TCL_RC_FINAL1_E_INPUT_TEXTURE3 0x0b000000
+#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE (1 << 28)
+#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_FINAL1_E_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_SHIFT 29
+#define NV20TCL_RC_FINAL1_E_MAPPING_MASK 0xe0000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV20TCL_RC_FINAL1_E_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV20TCL_LIGHT_MODEL 0x00000294
+#define NV20TCL_LIGHT_MODEL_VIEWER_SHIFT 16
+#define NV20TCL_LIGHT_MODEL_VIEWER_MASK 0x00030000
+#define NV20TCL_LIGHT_MODEL_VIEWER_NONLOCAL 0x00020000
+#define NV20TCL_LIGHT_MODEL_VIEWER_LOCAL 0x00030000
+#define NV20TCL_LIGHT_MODEL_SEPARATE_SPECULAR (1 << 0)
+#define NV20TCL_COLOR_MATERIAL 0x00000298
+#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_SHIFT 0
+#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_MASK 0x00000003
+#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_COL1 0x00000001
+#define NV20TCL_COLOR_MATERIAL_FRONT_EMISSION_COL2 0x00000002
+#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_SHIFT 2
+#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_MASK 0x0000000c
+#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_COL1 0x00000004
+#define NV20TCL_COLOR_MATERIAL_FRONT_AMBIENT_COL2 0x00000008
+#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_SHIFT 4
+#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_MASK 0x00000030
+#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_COL1 0x00000010
+#define NV20TCL_COLOR_MATERIAL_FRONT_DIFFUSE_COL2 0x00000020
+#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_SHIFT 6
+#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_MASK 0x000000c0
+#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_COL1 0x00000040
+#define NV20TCL_COLOR_MATERIAL_FRONT_SPECULAR_COL2 0x00000080
+#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_SHIFT 8
+#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_MASK 0x00000300
+#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_COL1 0x00000100
+#define NV20TCL_COLOR_MATERIAL_BACK_EMISSION_COL2 0x00000200
+#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_SHIFT 10
+#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_MASK 0x00000c00
+#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_COL1 0x00000400
+#define NV20TCL_COLOR_MATERIAL_BACK_AMBIENT_COL2 0x00000800
+#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_SHIFT 12
+#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_MASK 0x00003000
+#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_COL1 0x00001000
+#define NV20TCL_COLOR_MATERIAL_BACK_DIFFUSE_COL2 0x00002000
+#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_SHIFT 14
+#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_MASK 0x0000c000
+#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_OFF 0x00000000
+#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_COL1 0x00004000
+#define NV20TCL_COLOR_MATERIAL_BACK_SPECULAR_COL2 0x00008000
+#define NV20TCL_FOG_MODE 0x0000029c
+#define NV20TCL_FOG_MODE_LINEAR_UNSIGNED 0x00000804
+#define NV20TCL_FOG_MODE_LINEAR_SIGNED 0x00002601
+#define NV20TCL_FOG_MODE_EXP_UNSIGNED 0x00000802
+#define NV20TCL_FOG_MODE_EXP_SIGNED 0x00000800
+#define NV20TCL_FOG_MODE_EXP2_UNSIGNED 0x00000803
+#define NV20TCL_FOG_MODE_EXP2_SIGNED 0x00000801
+#define NV20TCL_FOG_COORD 0x000002a0
+#define NV20TCL_FOG_COORD_DIST_RADIAL 0x00000001
+#define NV20TCL_FOG_COORD_DIST_ORTHOGONAL 0x00000002
+#define NV20TCL_FOG_COORD_DIST_ORTHOGONAL_ABS 0x00000003
+#define NV20TCL_FOG_COORD_FOG 0x00000006
+#define NV20TCL_FOG_ENABLE 0x000002a4
+#define NV20TCL_FOG_COLOR 0x000002a8
+#define NV20TCL_FOG_COLOR_R_SHIFT 0
+#define NV20TCL_FOG_COLOR_R_MASK 0x000000ff
+#define NV20TCL_FOG_COLOR_G_SHIFT 8
+#define NV20TCL_FOG_COLOR_G_MASK 0x0000ff00
+#define NV20TCL_FOG_COLOR_B_SHIFT 16
+#define NV20TCL_FOG_COLOR_B_MASK 0x00ff0000
+#define NV20TCL_FOG_COLOR_A_SHIFT 24
+#define NV20TCL_FOG_COLOR_A_MASK 0xff000000
+#define NV20TCL_VIEWPORT_CLIP_MODE 0x000002b4
+#define NV20TCL_VIEWPORT_CLIP_HORIZ(x) (0x000002c0+((x)*4))
+#define NV20TCL_VIEWPORT_CLIP_HORIZ__SIZE 0x00000008
+#define NV20TCL_VIEWPORT_CLIP_VERT(x) (0x000002e0+((x)*4))
+#define NV20TCL_VIEWPORT_CLIP_VERT__SIZE 0x00000008
+#define NV20TCL_ALPHA_FUNC_ENABLE 0x00000300
+#define NV20TCL_BLEND_FUNC_ENABLE 0x00000304
+#define NV20TCL_CULL_FACE_ENABLE 0x00000308
+#define NV20TCL_DEPTH_TEST_ENABLE 0x0000030c
+#define NV20TCL_DITHER_ENABLE 0x00000310
+#define NV20TCL_LIGHTING_ENABLE 0x00000314
+#define NV20TCL_POINT_PARAMETERS_ENABLE 0x00000318
+#define NV20TCL_POINT_SMOOTH_ENABLE 0x0000031c
+#define NV20TCL_LINE_SMOOTH_ENABLE 0x00000320
+#define NV20TCL_POLYGON_SMOOTH_ENABLE 0x00000324
+#define NV20TCL_STENCIL_ENABLE 0x0000032c
+#define NV20TCL_POLYGON_OFFSET_POINT_ENABLE 0x00000330
+#define NV20TCL_POLYGON_OFFSET_LINE_ENABLE 0x00000334
+#define NV20TCL_POLYGON_OFFSET_FILL_ENABLE 0x00000338
+#define NV20TCL_ALPHA_FUNC_FUNC 0x0000033c
+#define NV20TCL_ALPHA_FUNC_FUNC_NEVER 0x00000200
+#define NV20TCL_ALPHA_FUNC_FUNC_LESS 0x00000201
+#define NV20TCL_ALPHA_FUNC_FUNC_EQUAL 0x00000202
+#define NV20TCL_ALPHA_FUNC_FUNC_LEQUAL 0x00000203
+#define NV20TCL_ALPHA_FUNC_FUNC_GREATER 0x00000204
+#define NV20TCL_ALPHA_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV20TCL_ALPHA_FUNC_FUNC_GEQUAL 0x00000206
+#define NV20TCL_ALPHA_FUNC_FUNC_ALWAYS 0x00000207
+#define NV20TCL_ALPHA_FUNC_REF 0x00000340
+#define NV20TCL_BLEND_FUNC_SRC 0x00000344
+#define NV20TCL_BLEND_FUNC_SRC_ZERO 0x00000000
+#define NV20TCL_BLEND_FUNC_SRC_ONE 0x00000001
+#define NV20TCL_BLEND_FUNC_SRC_SRC_COLOR 0x00000300
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV20TCL_BLEND_FUNC_SRC_SRC_ALPHA 0x00000302
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV20TCL_BLEND_FUNC_SRC_DST_ALPHA 0x00000304
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV20TCL_BLEND_FUNC_SRC_DST_COLOR 0x00000306
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_DST_COLOR 0x00000307
+#define NV20TCL_BLEND_FUNC_SRC_SRC_ALPHA_SATURATE 0x00000308
+#define NV20TCL_BLEND_FUNC_SRC_CONSTANT_COLOR 0x00008001
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV20TCL_BLEND_FUNC_SRC_CONSTANT_ALPHA 0x00008003
+#define NV20TCL_BLEND_FUNC_SRC_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV20TCL_BLEND_FUNC_DST 0x00000348
+#define NV20TCL_BLEND_FUNC_DST_ZERO 0x00000000
+#define NV20TCL_BLEND_FUNC_DST_ONE 0x00000001
+#define NV20TCL_BLEND_FUNC_DST_SRC_COLOR 0x00000300
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_COLOR 0x00000301
+#define NV20TCL_BLEND_FUNC_DST_SRC_ALPHA 0x00000302
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_SRC_ALPHA 0x00000303
+#define NV20TCL_BLEND_FUNC_DST_DST_ALPHA 0x00000304
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_DST_ALPHA 0x00000305
+#define NV20TCL_BLEND_FUNC_DST_DST_COLOR 0x00000306
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_DST_COLOR 0x00000307
+#define NV20TCL_BLEND_FUNC_DST_SRC_ALPHA_SATURATE 0x00000308
+#define NV20TCL_BLEND_FUNC_DST_CONSTANT_COLOR 0x00008001
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_COLOR 0x00008002
+#define NV20TCL_BLEND_FUNC_DST_CONSTANT_ALPHA 0x00008003
+#define NV20TCL_BLEND_FUNC_DST_ONE_MINUS_CONSTANT_ALPHA 0x00008004
+#define NV20TCL_BLEND_COLOR 0x0000034c
+#define NV20TCL_BLEND_COLOR_B_SHIFT 0
+#define NV20TCL_BLEND_COLOR_B_MASK 0x000000ff
+#define NV20TCL_BLEND_COLOR_G_SHIFT 8
+#define NV20TCL_BLEND_COLOR_G_MASK 0x0000ff00
+#define NV20TCL_BLEND_COLOR_R_SHIFT 16
+#define NV20TCL_BLEND_COLOR_R_MASK 0x00ff0000
+#define NV20TCL_BLEND_COLOR_A_SHIFT 24
+#define NV20TCL_BLEND_COLOR_A_MASK 0xff000000
+#define NV20TCL_BLEND_EQUATION 0x00000350
+#define NV20TCL_BLEND_EQUATION_FUNC_ADD 0x00008006
+#define NV20TCL_BLEND_EQUATION_MIN 0x00008007
+#define NV20TCL_BLEND_EQUATION_MAX 0x00008008
+#define NV20TCL_BLEND_EQUATION_FUNC_SUBTRACT 0x0000800a
+#define NV20TCL_BLEND_EQUATION_FUNC_REVERSE_SUBTRACT 0x0000800b
+#define NV20TCL_DEPTH_FUNC 0x00000354
+#define NV20TCL_DEPTH_FUNC_NEVER 0x00000200
+#define NV20TCL_DEPTH_FUNC_LESS 0x00000201
+#define NV20TCL_DEPTH_FUNC_EQUAL 0x00000202
+#define NV20TCL_DEPTH_FUNC_LEQUAL 0x00000203
+#define NV20TCL_DEPTH_FUNC_GREATER 0x00000204
+#define NV20TCL_DEPTH_FUNC_NOTEQUAL 0x00000205
+#define NV20TCL_DEPTH_FUNC_GEQUAL 0x00000206
+#define NV20TCL_DEPTH_FUNC_ALWAYS 0x00000207
+#define NV20TCL_COLOR_MASK 0x00000358
+#define NV20TCL_COLOR_MASK_B (1 << 0)
+#define NV20TCL_COLOR_MASK_G (1 << 8)
+#define NV20TCL_COLOR_MASK_R (1 << 16)
+#define NV20TCL_COLOR_MASK_A (1 << 24)
+#define NV20TCL_DEPTH_WRITE_ENABLE 0x0000035c
+#define NV20TCL_STENCIL_MASK 0x00000360
+#define NV20TCL_STENCIL_FUNC_FUNC 0x00000364
+#define NV20TCL_STENCIL_FUNC_FUNC_NEVER 0x00000200
+#define NV20TCL_STENCIL_FUNC_FUNC_LESS 0x00000201
+#define NV20TCL_STENCIL_FUNC_FUNC_EQUAL 0x00000202
+#define NV20TCL_STENCIL_FUNC_FUNC_LEQUAL 0x00000203
+#define NV20TCL_STENCIL_FUNC_FUNC_GREATER 0x00000204
+#define NV20TCL_STENCIL_FUNC_FUNC_NOTEQUAL 0x00000205
+#define NV20TCL_STENCIL_FUNC_FUNC_GEQUAL 0x00000206
+#define NV20TCL_STENCIL_FUNC_FUNC_ALWAYS 0x00000207
+#define NV20TCL_STENCIL_FUNC_REF 0x00000368
+#define NV20TCL_STENCIL_FUNC_MASK 0x0000036c
+#define NV20TCL_STENCIL_OP_FAIL 0x00000370
+#define NV20TCL_STENCIL_OP_FAIL_ZERO 0x00000000
+#define NV20TCL_STENCIL_OP_FAIL_INVERT 0x0000150a
+#define NV20TCL_STENCIL_OP_FAIL_KEEP 0x00001e00
+#define NV20TCL_STENCIL_OP_FAIL_REPLACE 0x00001e01
+#define NV20TCL_STENCIL_OP_FAIL_INCR 0x00001e02
+#define NV20TCL_STENCIL_OP_FAIL_DECR 0x00001e03
+#define NV20TCL_STENCIL_OP_FAIL_INCR_WRAP 0x00008507
+#define NV20TCL_STENCIL_OP_FAIL_DECR_WRAP 0x00008508
+#define NV20TCL_STENCIL_OP_ZFAIL 0x00000374
+#define NV20TCL_STENCIL_OP_ZFAIL_ZERO 0x00000000
+#define NV20TCL_STENCIL_OP_ZFAIL_INVERT 0x0000150a
+#define NV20TCL_STENCIL_OP_ZFAIL_KEEP 0x00001e00
+#define NV20TCL_STENCIL_OP_ZFAIL_REPLACE 0x00001e01
+#define NV20TCL_STENCIL_OP_ZFAIL_INCR 0x00001e02
+#define NV20TCL_STENCIL_OP_ZFAIL_DECR 0x00001e03
+#define NV20TCL_STENCIL_OP_ZFAIL_INCR_WRAP 0x00008507
+#define NV20TCL_STENCIL_OP_ZFAIL_DECR_WRAP 0x00008508
+#define NV20TCL_STENCIL_OP_ZPASS 0x00000378
+#define NV20TCL_STENCIL_OP_ZPASS_ZERO 0x00000000
+#define NV20TCL_STENCIL_OP_ZPASS_INVERT 0x0000150a
+#define NV20TCL_STENCIL_OP_ZPASS_KEEP 0x00001e00
+#define NV20TCL_STENCIL_OP_ZPASS_REPLACE 0x00001e01
+#define NV20TCL_STENCIL_OP_ZPASS_INCR 0x00001e02
+#define NV20TCL_STENCIL_OP_ZPASS_DECR 0x00001e03
+#define NV20TCL_STENCIL_OP_ZPASS_INCR_WRAP 0x00008507
+#define NV20TCL_STENCIL_OP_ZPASS_DECR_WRAP 0x00008508
+#define NV20TCL_SHADE_MODEL 0x0000037c
+#define NV20TCL_SHADE_MODEL_FLAT 0x00001d00
+#define NV20TCL_SHADE_MODEL_SMOOTH 0x00001d01
+#define NV20TCL_LINE_WIDTH 0x00000380
+#define NV20TCL_POLYGON_OFFSET_FACTOR 0x00000384
+#define NV20TCL_POLYGON_OFFSET_UNITS 0x00000388
+#define NV20TCL_POLYGON_MODE_FRONT 0x0000038c
+#define NV20TCL_POLYGON_MODE_FRONT_POINT 0x00001b00
+#define NV20TCL_POLYGON_MODE_FRONT_LINE 0x00001b01
+#define NV20TCL_POLYGON_MODE_FRONT_FILL 0x00001b02
+#define NV20TCL_POLYGON_MODE_BACK 0x00000390
+#define NV20TCL_POLYGON_MODE_BACK_POINT 0x00001b00
+#define NV20TCL_POLYGON_MODE_BACK_LINE 0x00001b01
+#define NV20TCL_POLYGON_MODE_BACK_FILL 0x00001b02
+#define NV20TCL_DEPTH_RANGE_NEAR 0x00000394
+#define NV20TCL_DEPTH_RANGE_FAR 0x00000398
+#define NV20TCL_CULL_FACE 0x0000039c
+#define NV20TCL_CULL_FACE_FRONT 0x00000404
+#define NV20TCL_CULL_FACE_BACK 0x00000405
+#define NV20TCL_CULL_FACE_FRONT_AND_BACK 0x00000408
+#define NV20TCL_FRONT_FACE 0x000003a0
+#define NV20TCL_FRONT_FACE_CW 0x00000900
+#define NV20TCL_FRONT_FACE_CCW 0x00000901
+#define NV20TCL_NORMALIZE_ENABLE 0x000003a4
+#define NV20TCL_MATERIAL_FACTOR_FRONT_R 0x000003a8
+#define NV20TCL_MATERIAL_FACTOR_FRONT_G 0x000003ac
+#define NV20TCL_MATERIAL_FACTOR_FRONT_B 0x000003b0
+#define NV20TCL_MATERIAL_FACTOR_FRONT_A 0x000003b4
+#define NV20TCL_SEPARATE_SPECULAR_ENABLE 0x000003b8
+#define NV20TCL_ENABLED_LIGHTS 0x000003bc
+#define NV20TCL_ENABLED_LIGHTS_0_SHIFT 0
+#define NV20TCL_ENABLED_LIGHTS_0_MASK 0x00000003
+#define NV20TCL_ENABLED_LIGHTS_0_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_0_NONPOSITIONAL 0x00000001
+#define NV20TCL_ENABLED_LIGHTS_0_POSITIONAL 0x00000002
+#define NV20TCL_ENABLED_LIGHTS_0_DIRECTIONAL 0x00000003
+#define NV20TCL_ENABLED_LIGHTS_1_SHIFT 2
+#define NV20TCL_ENABLED_LIGHTS_1_MASK 0x0000000c
+#define NV20TCL_ENABLED_LIGHTS_1_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_1_NONPOSITIONAL 0x00000004
+#define NV20TCL_ENABLED_LIGHTS_1_POSITIONAL 0x00000008
+#define NV20TCL_ENABLED_LIGHTS_1_DIRECTIONAL 0x0000000c
+#define NV20TCL_ENABLED_LIGHTS_2_SHIFT 4
+#define NV20TCL_ENABLED_LIGHTS_2_MASK 0x00000030
+#define NV20TCL_ENABLED_LIGHTS_2_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_2_NONPOSITIONAL 0x00000010
+#define NV20TCL_ENABLED_LIGHTS_2_POSITIONAL 0x00000020
+#define NV20TCL_ENABLED_LIGHTS_2_DIRECTIONAL 0x00000030
+#define NV20TCL_ENABLED_LIGHTS_3_SHIFT 6
+#define NV20TCL_ENABLED_LIGHTS_3_MASK 0x000000c0
+#define NV20TCL_ENABLED_LIGHTS_3_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_3_NONPOSITIONAL 0x00000040
+#define NV20TCL_ENABLED_LIGHTS_3_POSITIONAL 0x00000080
+#define NV20TCL_ENABLED_LIGHTS_3_DIRECTIONAL 0x000000c0
+#define NV20TCL_ENABLED_LIGHTS_4_SHIFT 8
+#define NV20TCL_ENABLED_LIGHTS_4_MASK 0x00000300
+#define NV20TCL_ENABLED_LIGHTS_4_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_4_NONPOSITIONAL 0x00000100
+#define NV20TCL_ENABLED_LIGHTS_4_POSITIONAL 0x00000200
+#define NV20TCL_ENABLED_LIGHTS_4_DIRECTIONAL 0x00000300
+#define NV20TCL_ENABLED_LIGHTS_5_SHIFT 10
+#define NV20TCL_ENABLED_LIGHTS_5_MASK 0x00000c00
+#define NV20TCL_ENABLED_LIGHTS_5_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_5_NONPOSITIONAL 0x00000400
+#define NV20TCL_ENABLED_LIGHTS_5_POSITIONAL 0x00000800
+#define NV20TCL_ENABLED_LIGHTS_5_DIRECTIONAL 0x00000c00
+#define NV20TCL_ENABLED_LIGHTS_6_SHIFT 12
+#define NV20TCL_ENABLED_LIGHTS_6_MASK 0x00003000
+#define NV20TCL_ENABLED_LIGHTS_6_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_6_NONPOSITIONAL 0x00001000
+#define NV20TCL_ENABLED_LIGHTS_6_POSITIONAL 0x00002000
+#define NV20TCL_ENABLED_LIGHTS_6_DIRECTIONAL 0x00003000
+#define NV20TCL_ENABLED_LIGHTS_7_SHIFT 14
+#define NV20TCL_ENABLED_LIGHTS_7_MASK 0x0000c000
+#define NV20TCL_ENABLED_LIGHTS_7_DISABLED 0x00000000
+#define NV20TCL_ENABLED_LIGHTS_7_NONPOSITIONAL 0x00004000
+#define NV20TCL_ENABLED_LIGHTS_7_POSITIONAL 0x00008000
+#define NV20TCL_ENABLED_LIGHTS_7_DIRECTIONAL 0x0000c000
+#define NV20TCL_TX_GEN_MODE_S(x) (0x000003c0+((x)*16))
+#define NV20TCL_TX_GEN_MODE_S__SIZE 0x00000004
+#define NV20TCL_TX_GEN_MODE_S_FALSE 0x00000000
+#define NV20TCL_TX_GEN_MODE_S_EYE_LINEAR 0x00002400
+#define NV20TCL_TX_GEN_MODE_S_OBJECT_LINEAR 0x00002401
+#define NV20TCL_TX_GEN_MODE_S_SPHERE_MAP 0x00002402
+#define NV20TCL_TX_GEN_MODE_S_NORMAL_MAP 0x00008511
+#define NV20TCL_TX_GEN_MODE_S_REFLECTION_MAP 0x00008512
+#define NV20TCL_TX_GEN_MODE_T(x) (0x000003c4+((x)*16))
+#define NV20TCL_TX_GEN_MODE_T__SIZE 0x00000004
+#define NV20TCL_TX_GEN_MODE_T_FALSE 0x00000000
+#define NV20TCL_TX_GEN_MODE_T_EYE_LINEAR 0x00002400
+#define NV20TCL_TX_GEN_MODE_T_OBJECT_LINEAR 0x00002401
+#define NV20TCL_TX_GEN_MODE_T_SPHERE_MAP 0x00002402
+#define NV20TCL_TX_GEN_MODE_T_NORMAL_MAP 0x00008511
+#define NV20TCL_TX_GEN_MODE_T_REFLECTION_MAP 0x00008512
+#define NV20TCL_TX_GEN_MODE_R(x) (0x000003c8+((x)*16))
+#define NV20TCL_TX_GEN_MODE_R__SIZE 0x00000004
+#define NV20TCL_TX_GEN_MODE_R_FALSE 0x00000000
+#define NV20TCL_TX_GEN_MODE_R_EYE_LINEAR 0x00002400
+#define NV20TCL_TX_GEN_MODE_R_OBJECT_LINEAR 0x00002401
+#define NV20TCL_TX_GEN_MODE_R_SPHERE_MAP 0x00002402
+#define NV20TCL_TX_GEN_MODE_R_NORMAL_MAP 0x00008511
+#define NV20TCL_TX_GEN_MODE_R_REFLECTION_MAP 0x00008512
+#define NV20TCL_TX_GEN_MODE_Q(x) (0x000003cc+((x)*16))
+#define NV20TCL_TX_GEN_MODE_Q__SIZE 0x00000004
+#define NV20TCL_TX_GEN_MODE_Q_FALSE 0x00000000
+#define NV20TCL_TX_GEN_MODE_Q_EYE_LINEAR 0x00002400
+#define NV20TCL_TX_GEN_MODE_Q_OBJECT_LINEAR 0x00002401
+#define NV20TCL_TX_GEN_MODE_Q_SPHERE_MAP 0x00002402
+#define NV20TCL_TX_GEN_MODE_Q_NORMAL_MAP 0x00008511
+#define NV20TCL_TX_GEN_MODE_Q_REFLECTION_MAP 0x00008512
+#define NV20TCL_TX_MATRIX_ENABLE(x) (0x00000420+((x)*4))
+#define NV20TCL_TX_MATRIX_ENABLE__SIZE 0x00000004
+#define NV20TCL_POINT_SIZE 0x0000043c
+#define NV20TCL_MODELVIEW0_MATRIX(x) (0x00000480+((x)*4))
+#define NV20TCL_MODELVIEW0_MATRIX__SIZE 0x00000010
+#define NV20TCL_MODELVIEW1_MATRIX(x) (0x000004c0+((x)*4))
+#define NV20TCL_MODELVIEW1_MATRIX__SIZE 0x00000010
+#define NV20TCL_MODELVIEW2_MATRIX(x) (0x00000500+((x)*4))
+#define NV20TCL_MODELVIEW2_MATRIX__SIZE 0x00000010
+#define NV20TCL_MODELVIEW3_MATRIX(x) (0x00000540+((x)*4))
+#define NV20TCL_MODELVIEW3_MATRIX__SIZE 0x00000010
+#define NV20TCL_INVERSE_MODELVIEW0_MATRIX(x) (0x00000580+((x)*4))
+#define NV20TCL_INVERSE_MODELVIEW0_MATRIX__SIZE 0x00000010
+#define NV20TCL_INVERSE_MODELVIEW1_MATRIX(x) (0x000005c0+((x)*4))
+#define NV20TCL_INVERSE_MODELVIEW1_MATRIX__SIZE 0x00000010
+#define NV20TCL_INVERSE_MODELVIEW2_MATRIX(x) (0x00000600+((x)*4))
+#define NV20TCL_INVERSE_MODELVIEW2_MATRIX__SIZE 0x00000010
+#define NV20TCL_INVERSE_MODELVIEW3_MATRIX(x) (0x00000640+((x)*4))
+#define NV20TCL_INVERSE_MODELVIEW3_MATRIX__SIZE 0x00000010
+#define NV20TCL_PROJECTION_MATRIX(x) (0x00000680+((x)*4))
+#define NV20TCL_PROJECTION_MATRIX__SIZE 0x00000010
+#define NV20TCL_TX0_MATRIX(x) (0x000006c0+((x)*4))
+#define NV20TCL_TX0_MATRIX__SIZE 0x00000010
+#define NV20TCL_TX1_MATRIX(x) (0x00000700+((x)*4))
+#define NV20TCL_TX1_MATRIX__SIZE 0x00000010
+#define NV20TCL_TX2_MATRIX(x) (0x00000740+((x)*4))
+#define NV20TCL_TX2_MATRIX__SIZE 0x00000010
+#define NV20TCL_TX3_MATRIX(x) (0x00000780+((x)*4))
+#define NV20TCL_TX3_MATRIX__SIZE 0x00000010
+#define NV20TCL_TX_GEN_COEFF_S_A(x) (0x00000840+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_S_A__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_S_B(x) (0x00000844+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_S_B__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_S_C(x) (0x00000848+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_S_C__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_S_D(x) (0x0000084c+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_S_D__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_T_A(x) (0x00000850+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_T_A__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_T_B(x) (0x00000854+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_T_B__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_T_C(x) (0x00000858+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_T_C__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_T_D(x) (0x0000085c+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_T_D__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_R_A(x) (0x00000860+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_R_A__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_R_B(x) (0x00000864+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_R_B__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_R_C(x) (0x00000868+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_R_C__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_R_D(x) (0x0000086c+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_R_D__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_Q_A(x) (0x00000870+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_Q_A__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_Q_B(x) (0x00000874+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_Q_B__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_Q_C(x) (0x00000878+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_Q_C__SIZE 0x00000004
+#define NV20TCL_TX_GEN_COEFF_Q_D(x) (0x0000087c+((x)*64))
+#define NV20TCL_TX_GEN_COEFF_Q_D__SIZE 0x00000004
+#define NV20TCL_FOG_EQUATION_CONSTANT 0x000009c0
+#define NV20TCL_FOG_EQUATION_LINEAR 0x000009c4
+#define NV20TCL_FOG_EQUATION_QUADRATIC 0x000009c8
+#define NV20TCL_FRONT_MATERIAL_SHININESS(x) (0x000009e0+((x)*4))
+#define NV20TCL_FRONT_MATERIAL_SHININESS__SIZE 0x00000006
+#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R 0x00000a10
+#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_G 0x00000a14
+#define NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_B 0x00000a18
+#define NV20TCL_VIEWPORT_TRANSLATE_X 0x00000a20
+#define NV20TCL_VIEWPORT_TRANSLATE_Y 0x00000a24
+#define NV20TCL_VIEWPORT_TRANSLATE_Z 0x00000a28
+#define NV20TCL_VIEWPORT_TRANSLATE_W 0x00000a2c
+#define NV20TCL_POINT_PARAMETER(x) (0x00000a30+((x)*4))
+#define NV20TCL_POINT_PARAMETER__SIZE 0x00000008
+#define NV20TCL_RC_CONSTANT_COLOR0(x) (0x00000a60+((x)*4))
+#define NV20TCL_RC_CONSTANT_COLOR0__SIZE 0x00000008
+#define NV20TCL_RC_CONSTANT_COLOR0_B_SHIFT 0
+#define NV20TCL_RC_CONSTANT_COLOR0_B_MASK 0x000000ff
+#define NV20TCL_RC_CONSTANT_COLOR0_G_SHIFT 8
+#define NV20TCL_RC_CONSTANT_COLOR0_G_MASK 0x0000ff00
+#define NV20TCL_RC_CONSTANT_COLOR0_R_SHIFT 16
+#define NV20TCL_RC_CONSTANT_COLOR0_R_MASK 0x00ff0000
+#define NV20TCL_RC_CONSTANT_COLOR0_A_SHIFT 24
+#define NV20TCL_RC_CONSTANT_COLOR0_A_MASK 0xff000000
+#define NV20TCL_RC_CONSTANT_COLOR1(x) (0x00000a80+((x)*4))
+#define NV20TCL_RC_CONSTANT_COLOR1__SIZE 0x00000008
+#define NV20TCL_RC_CONSTANT_COLOR1_B_SHIFT 0
+#define NV20TCL_RC_CONSTANT_COLOR1_B_MASK 0x000000ff
+#define NV20TCL_RC_CONSTANT_COLOR1_G_SHIFT 8
+#define NV20TCL_RC_CONSTANT_COLOR1_G_MASK 0x0000ff00
+#define NV20TCL_RC_CONSTANT_COLOR1_R_SHIFT 16
+#define NV20TCL_RC_CONSTANT_COLOR1_R_MASK 0x00ff0000
+#define NV20TCL_RC_CONSTANT_COLOR1_A_SHIFT 24
+#define NV20TCL_RC_CONSTANT_COLOR1_A_MASK 0xff000000
+#define NV20TCL_RC_OUT_ALPHA(x) (0x00000aa0+((x)*4))
+#define NV20TCL_RC_OUT_ALPHA__SIZE 0x00000008
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SHIFT 0
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_MASK 0x0000000f
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_FOG 0x00000003
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0 0x0000000c
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE1 0x0000000d
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV20TCL_RC_OUT_ALPHA_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SHIFT 4
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_MASK 0x000000f0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_FOG 0x00000030
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0 0x000000c0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE1 0x000000d0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV20TCL_RC_OUT_ALPHA_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SHIFT 8
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_MASK 0x00000f00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_FOG 0x00000300
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_OUT_ALPHA_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_OUT_ALPHA_CD_DOT_PRODUCT (1 << 12)
+#define NV20TCL_RC_OUT_ALPHA_AB_DOT_PRODUCT (1 << 13)
+#define NV20TCL_RC_OUT_ALPHA_MUX_SUM (1 << 14)
+#define NV20TCL_RC_OUT_ALPHA_BIAS (1 << 15)
+#define NV20TCL_RC_OUT_ALPHA_BIAS_NONE 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV20TCL_RC_OUT_ALPHA_SCALE_SHIFT 17
+#define NV20TCL_RC_OUT_ALPHA_SCALE_MASK 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_SCALE_NONE 0x00000000
+#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_TWO 0x00020000
+#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_FOUR 0x00040000
+#define NV20TCL_RC_OUT_ALPHA_SCALE_SCALE_BY_ONE_HALF 0x00060000
+#define NV20TCL_RC_IN_RGB(x) (0x00000ac0+((x)*4))
+#define NV20TCL_RC_IN_RGB__SIZE 0x00000008
+#define NV20TCL_RC_IN_RGB_D_INPUT_SHIFT 0
+#define NV20TCL_RC_IN_RGB_D_INPUT_MASK 0x0000000f
+#define NV20TCL_RC_IN_RGB_D_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR0 0x00000001
+#define NV20TCL_RC_IN_RGB_D_INPUT_CONSTANT_COLOR1 0x00000002
+#define NV20TCL_RC_IN_RGB_D_INPUT_FOG 0x00000003
+#define NV20TCL_RC_IN_RGB_D_INPUT_PRIMARY_COLOR 0x00000004
+#define NV20TCL_RC_IN_RGB_D_INPUT_SECONDARY_COLOR 0x00000005
+#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE0 0x00000008
+#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE1 0x00000009
+#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE0 0x0000000c
+#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE1 0x0000000d
+#define NV20TCL_RC_IN_RGB_D_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV20TCL_RC_IN_RGB_D_INPUT_E_TIMES_F 0x0000000f
+#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE2 0x0000000a
+#define NV20TCL_RC_IN_RGB_D_INPUT_TEXTURE3 0x0000000b
+#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE (1 << 4)
+#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_IN_RGB_D_COMPONENT_USAGE_ALPHA 0x00000010
+#define NV20TCL_RC_IN_RGB_D_MAPPING_SHIFT 5
+#define NV20TCL_RC_IN_RGB_D_MAPPING_MASK 0x000000e0
+#define NV20TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_RGB_D_MAPPING_UNSIGNED_INVERT 0x00000020
+#define NV20TCL_RC_IN_RGB_D_MAPPING_EXPAND_NORMAL 0x00000040
+#define NV20TCL_RC_IN_RGB_D_MAPPING_EXPAND_NEGATE 0x00000060
+#define NV20TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NORMAL 0x00000080
+#define NV20TCL_RC_IN_RGB_D_MAPPING_HALF_BIAS_NEGATE 0x000000a0
+#define NV20TCL_RC_IN_RGB_D_MAPPING_SIGNED_IDENTITY 0x000000c0
+#define NV20TCL_RC_IN_RGB_D_MAPPING_SIGNED_NEGATE 0x000000e0
+#define NV20TCL_RC_IN_RGB_C_INPUT_SHIFT 8
+#define NV20TCL_RC_IN_RGB_C_INPUT_MASK 0x00000f00
+#define NV20TCL_RC_IN_RGB_C_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_IN_RGB_C_INPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_IN_RGB_C_INPUT_FOG 0x00000300
+#define NV20TCL_RC_IN_RGB_C_INPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_IN_RGB_C_INPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_IN_RGB_C_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_IN_RGB_C_INPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_IN_RGB_C_INPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE (1 << 12)
+#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_IN_RGB_C_COMPONENT_USAGE_ALPHA 0x00001000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_SHIFT 13
+#define NV20TCL_RC_IN_RGB_C_MAPPING_MASK 0x0000e000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_UNSIGNED_INVERT 0x00002000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_EXPAND_NORMAL 0x00004000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_EXPAND_NEGATE 0x00006000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NORMAL 0x00008000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_HALF_BIAS_NEGATE 0x0000a000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_SIGNED_IDENTITY 0x0000c000
+#define NV20TCL_RC_IN_RGB_C_MAPPING_SIGNED_NEGATE 0x0000e000
+#define NV20TCL_RC_IN_RGB_B_INPUT_SHIFT 16
+#define NV20TCL_RC_IN_RGB_B_INPUT_MASK 0x000f0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR0 0x00010000
+#define NV20TCL_RC_IN_RGB_B_INPUT_CONSTANT_COLOR1 0x00020000
+#define NV20TCL_RC_IN_RGB_B_INPUT_FOG 0x00030000
+#define NV20TCL_RC_IN_RGB_B_INPUT_PRIMARY_COLOR 0x00040000
+#define NV20TCL_RC_IN_RGB_B_INPUT_SECONDARY_COLOR 0x00050000
+#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE0 0x00080000
+#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE1 0x00090000
+#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE0 0x000c0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE1 0x000d0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000e0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_E_TIMES_F 0x000f0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE2 0x000a0000
+#define NV20TCL_RC_IN_RGB_B_INPUT_TEXTURE3 0x000b0000
+#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE (1 << 20)
+#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_IN_RGB_B_COMPONENT_USAGE_ALPHA 0x00100000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_SHIFT 21
+#define NV20TCL_RC_IN_RGB_B_MAPPING_MASK 0x00e00000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_UNSIGNED_INVERT 0x00200000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_EXPAND_NORMAL 0x00400000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_EXPAND_NEGATE 0x00600000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NORMAL 0x00800000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_HALF_BIAS_NEGATE 0x00a00000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_SIGNED_IDENTITY 0x00c00000
+#define NV20TCL_RC_IN_RGB_B_MAPPING_SIGNED_NEGATE 0x00e00000
+#define NV20TCL_RC_IN_RGB_A_INPUT_SHIFT 24
+#define NV20TCL_RC_IN_RGB_A_INPUT_MASK 0x0f000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_ZERO 0x00000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR0 0x01000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_CONSTANT_COLOR1 0x02000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_FOG 0x03000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_PRIMARY_COLOR 0x04000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_SECONDARY_COLOR 0x05000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE0 0x08000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE1 0x09000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE0 0x0c000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE1 0x0d000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0e000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_E_TIMES_F 0x0f000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE2 0x0a000000
+#define NV20TCL_RC_IN_RGB_A_INPUT_TEXTURE3 0x0b000000
+#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE (1 << 28)
+#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE_RGB 0x00000000
+#define NV20TCL_RC_IN_RGB_A_COMPONENT_USAGE_ALPHA 0x10000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_SHIFT 29
+#define NV20TCL_RC_IN_RGB_A_MAPPING_MASK 0xe0000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_IDENTITY 0x00000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_UNSIGNED_INVERT 0x20000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_EXPAND_NORMAL 0x40000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_EXPAND_NEGATE 0x60000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NORMAL 0x80000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_HALF_BIAS_NEGATE 0xa0000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_SIGNED_IDENTITY 0xc0000000
+#define NV20TCL_RC_IN_RGB_A_MAPPING_SIGNED_NEGATE 0xe0000000
+#define NV20TCL_VIEWPORT_SCALE_X 0x00000af0
+#define NV20TCL_VIEWPORT_SCALE_Y 0x00000af4
+#define NV20TCL_VIEWPORT_SCALE_Z 0x00000af8
+#define NV20TCL_VIEWPORT_SCALE_W 0x00000afc
+#define NV20TCL_VP_UPLOAD_INST(x) (0x00000b00+((x)*4))
+#define NV20TCL_VP_UPLOAD_INST__SIZE 0x00000004
+#define NV20TCL_VP_UPLOAD_CONST(x) (0x00000b80+((x)*4))
+#define NV20TCL_VP_UPLOAD_CONST__SIZE 0x00000004
+#define NV20TCL_LIGHT_BACK_AMBIENT_R(x) (0x00000c00+((x)*64))
+#define NV20TCL_LIGHT_BACK_AMBIENT_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_AMBIENT_G(x) (0x00000c04+((x)*64))
+#define NV20TCL_LIGHT_BACK_AMBIENT_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_AMBIENT_B(x) (0x00000c08+((x)*64))
+#define NV20TCL_LIGHT_BACK_AMBIENT_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_DIFFUSE_R(x) (0x00000c0c+((x)*64))
+#define NV20TCL_LIGHT_BACK_DIFFUSE_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_DIFFUSE_G(x) (0x00000c10+((x)*64))
+#define NV20TCL_LIGHT_BACK_DIFFUSE_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_DIFFUSE_B(x) (0x00000c14+((x)*64))
+#define NV20TCL_LIGHT_BACK_DIFFUSE_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_SPECULAR_R(x) (0x00000c18+((x)*64))
+#define NV20TCL_LIGHT_BACK_SPECULAR_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_SPECULAR_G(x) (0x00000c1c+((x)*64))
+#define NV20TCL_LIGHT_BACK_SPECULAR_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_BACK_SPECULAR_B(x) (0x00000c20+((x)*64))
+#define NV20TCL_LIGHT_BACK_SPECULAR_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_AMBIENT_R(x) (0x00001000+((x)*128))
+#define NV20TCL_LIGHT_FRONT_AMBIENT_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_AMBIENT_G(x) (0x00001004+((x)*128))
+#define NV20TCL_LIGHT_FRONT_AMBIENT_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_AMBIENT_B(x) (0x00001008+((x)*128))
+#define NV20TCL_LIGHT_FRONT_AMBIENT_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_R(x) (0x0000100c+((x)*128))
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_G(x) (0x00001010+((x)*128))
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_B(x) (0x00001014+((x)*128))
+#define NV20TCL_LIGHT_FRONT_DIFFUSE_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_SPECULAR_R(x) (0x00001018+((x)*128))
+#define NV20TCL_LIGHT_FRONT_SPECULAR_R__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_SPECULAR_G(x) (0x0000101c+((x)*128))
+#define NV20TCL_LIGHT_FRONT_SPECULAR_G__SIZE 0x00000008
+#define NV20TCL_LIGHT_FRONT_SPECULAR_B(x) (0x00001020+((x)*128))
+#define NV20TCL_LIGHT_FRONT_SPECULAR_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_HALF_VECTOR_X(x) (0x00001028+((x)*128))
+#define NV20TCL_LIGHT_HALF_VECTOR_X__SIZE 0x00000008
+#define NV20TCL_LIGHT_HALF_VECTOR_Y(x) (0x0000102c+((x)*128))
+#define NV20TCL_LIGHT_HALF_VECTOR_Y__SIZE 0x00000008
+#define NV20TCL_LIGHT_HALF_VECTOR_Z(x) (0x00001030+((x)*128))
+#define NV20TCL_LIGHT_HALF_VECTOR_Z__SIZE 0x00000008
+#define NV20TCL_LIGHT_DIRECTION_X(x) (0x00001034+((x)*128))
+#define NV20TCL_LIGHT_DIRECTION_X__SIZE 0x00000008
+#define NV20TCL_LIGHT_DIRECTION_Y(x) (0x00001038+((x)*128))
+#define NV20TCL_LIGHT_DIRECTION_Y__SIZE 0x00000008
+#define NV20TCL_LIGHT_DIRECTION_Z(x) (0x0000103c+((x)*128))
+#define NV20TCL_LIGHT_DIRECTION_Z__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_CUTOFF_A(x) (0x00001040+((x)*128))
+#define NV20TCL_LIGHT_SPOT_CUTOFF_A__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_CUTOFF_B(x) (0x00001044+((x)*128))
+#define NV20TCL_LIGHT_SPOT_CUTOFF_B__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_CUTOFF_C(x) (0x00001048+((x)*128))
+#define NV20TCL_LIGHT_SPOT_CUTOFF_C__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_DIR_X(x) (0x0000104c+((x)*128))
+#define NV20TCL_LIGHT_SPOT_DIR_X__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_DIR_Y(x) (0x00001050+((x)*128))
+#define NV20TCL_LIGHT_SPOT_DIR_Y__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_DIR_Z(x) (0x00001054+((x)*128))
+#define NV20TCL_LIGHT_SPOT_DIR_Z__SIZE 0x00000008
+#define NV20TCL_LIGHT_SPOT_CUTOFF_D(x) (0x00001058+((x)*128))
+#define NV20TCL_LIGHT_SPOT_CUTOFF_D__SIZE 0x00000008
+#define NV20TCL_LIGHT_POSITION_X(x) (0x0000105c+((x)*128))
+#define NV20TCL_LIGHT_POSITION_X__SIZE 0x00000008
+#define NV20TCL_LIGHT_POSITION_Y(x) (0x00001060+((x)*128))
+#define NV20TCL_LIGHT_POSITION_Y__SIZE 0x00000008
+#define NV20TCL_LIGHT_POSITION_Z(x) (0x00001064+((x)*128))
+#define NV20TCL_LIGHT_POSITION_Z__SIZE 0x00000008
+#define NV20TCL_LIGHT_ATTENUATION_CONSTANT(x) (0x00001068+((x)*128))
+#define NV20TCL_LIGHT_ATTENUATION_CONSTANT__SIZE 0x00000008
+#define NV20TCL_LIGHT_ATTENUATION_LINEAR(x) (0x0000106c+((x)*128))
+#define NV20TCL_LIGHT_ATTENUATION_LINEAR__SIZE 0x00000008
+#define NV20TCL_LIGHT_ATTENUATION_QUADRATIC(x) (0x00001070+((x)*128))
+#define NV20TCL_LIGHT_ATTENUATION_QUADRATIC__SIZE 0x00000008
+#define NV20TCL_POLYGON_STIPPLE_ENABLE 0x0000147c
+#define NV20TCL_POLYGON_STIPPLE_PATTERN(x) (0x00001480+((x)*4))
+#define NV20TCL_POLYGON_STIPPLE_PATTERN__SIZE 0x00000020
+#define NV20TCL_VERTEX_POS_3F_X 0x00001500
+#define NV20TCL_VERTEX_POS_3F_Y 0x00001504
+#define NV20TCL_VERTEX_POS_3F_Z 0x00001508
+#define NV20TCL_VERTEX_POS_4F_X 0x00001518
+#define NV20TCL_VERTEX_POS_4F_Y 0x0000151c
+#define NV20TCL_VERTEX_POS_4F_Z 0x00001520
+#define NV20TCL_VERTEX_POS_3I_XY 0x00001528
+#define NV20TCL_VERTEX_POS_3I_XY_X_SHIFT 0
+#define NV20TCL_VERTEX_POS_3I_XY_X_MASK 0x0000ffff
+#define NV20TCL_VERTEX_POS_3I_XY_Y_SHIFT 16
+#define NV20TCL_VERTEX_POS_3I_XY_Y_MASK 0xffff0000
+#define NV20TCL_VERTEX_POS_3I_Z 0x0000152c
+#define NV20TCL_VERTEX_POS_3I_Z_Z_SHIFT 0
+#define NV20TCL_VERTEX_POS_3I_Z_Z_MASK 0x0000ffff
+#define NV20TCL_VERTEX_NOR_3F_X 0x00001530
+#define NV20TCL_VERTEX_NOR_3F_Y 0x00001534
+#define NV20TCL_VERTEX_NOR_3F_Z 0x00001538
+#define NV20TCL_VERTEX_NOR_3I_XY 0x00001540
+#define NV20TCL_VERTEX_NOR_3I_XY_X_SHIFT 0
+#define NV20TCL_VERTEX_NOR_3I_XY_X_MASK 0x0000ffff
+#define NV20TCL_VERTEX_NOR_3I_XY_Y_SHIFT 16
+#define NV20TCL_VERTEX_NOR_3I_XY_Y_MASK 0xffff0000
+#define NV20TCL_VERTEX_NOR_3I_Z 0x00001544
+#define NV20TCL_VERTEX_NOR_3I_Z_Z_SHIFT 0
+#define NV20TCL_VERTEX_NOR_3I_Z_Z_MASK 0x0000ffff
+#define NV20TCL_VERTEX_COL_4F_X 0x00001550
+#define NV20TCL_VERTEX_COL_4F_Y 0x00001554
+#define NV20TCL_VERTEX_COL_4F_Z 0x00001558
+#define NV20TCL_VERTEX_COL_4F_W 0x0000155c
+#define NV20TCL_VERTEX_COL_3F_X 0x00001560
+#define NV20TCL_VERTEX_COL_3F_Y 0x00001564
+#define NV20TCL_VERTEX_COL_3F_Z 0x00001568
+#define NV20TCL_VERTEX_COL_4I 0x0000156c
+#define NV20TCL_VERTEX_COL_4I_R_SHIFT 0
+#define NV20TCL_VERTEX_COL_4I_R_MASK 0x000000ff
+#define NV20TCL_VERTEX_COL_4I_G_SHIFT 8
+#define NV20TCL_VERTEX_COL_4I_G_MASK 0x0000ff00
+#define NV20TCL_VERTEX_COL_4I_B_SHIFT 16
+#define NV20TCL_VERTEX_COL_4I_B_MASK 0x00ff0000
+#define NV20TCL_VERTEX_COL_4I_A_SHIFT 24
+#define NV20TCL_VERTEX_COL_4I_A_MASK 0xff000000
+#define NV20TCL_VERTEX_COL2_3F_X 0x00001580
+#define NV20TCL_VERTEX_COL2_3F_Y 0x00001584
+#define NV20TCL_VERTEX_COL2_3F_Z 0x00001588
+#define NV20TCL_VERTEX_COL2_4I 0x0000158c
+#define NV20TCL_VERTEX_COL2_4I_R_SHIFT 0
+#define NV20TCL_VERTEX_COL2_4I_R_MASK 0x000000ff
+#define NV20TCL_VERTEX_COL2_4I_G_SHIFT 8
+#define NV20TCL_VERTEX_COL2_4I_G_MASK 0x0000ff00
+#define NV20TCL_VERTEX_COL2_4I_B_SHIFT 16
+#define NV20TCL_VERTEX_COL2_4I_B_MASK 0x00ff0000
+#define NV20TCL_VERTEX_COL2_4I_A_SHIFT 24
+#define NV20TCL_VERTEX_COL2_4I_A_MASK 0xff000000
+#define NV20TCL_VERTEX_TX0_2F_S 0x00001590
+#define NV20TCL_VERTEX_TX0_2F_T 0x00001594
+#define NV20TCL_VERTEX_TX0_2I 0x00001598
+#define NV20TCL_VERTEX_TX0_2I_S_SHIFT 0
+#define NV20TCL_VERTEX_TX0_2I_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX0_2I_T_SHIFT 16
+#define NV20TCL_VERTEX_TX0_2I_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX0_4F_S 0x000015a0
+#define NV20TCL_VERTEX_TX0_4F_T 0x000015a4
+#define NV20TCL_VERTEX_TX0_4F_R 0x000015a8
+#define NV20TCL_VERTEX_TX0_4F_Q 0x000015ac
+#define NV20TCL_VERTEX_TX0_4I_ST 0x000015b0
+#define NV20TCL_VERTEX_TX0_4I_ST_S_SHIFT 0
+#define NV20TCL_VERTEX_TX0_4I_ST_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX0_4I_ST_T_SHIFT 16
+#define NV20TCL_VERTEX_TX0_4I_ST_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX0_4I_RQ 0x000015b4
+#define NV20TCL_VERTEX_TX0_4I_RQ_R_SHIFT 0
+#define NV20TCL_VERTEX_TX0_4I_RQ_R_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX0_4I_RQ_Q_SHIFT 16
+#define NV20TCL_VERTEX_TX0_4I_RQ_Q_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX1_2F_S 0x000015b8
+#define NV20TCL_VERTEX_TX1_2F_T 0x000015bc
+#define NV20TCL_VERTEX_TX1_2I 0x000015c0
+#define NV20TCL_VERTEX_TX1_2I_S_SHIFT 0
+#define NV20TCL_VERTEX_TX1_2I_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX1_2I_T_SHIFT 16
+#define NV20TCL_VERTEX_TX1_2I_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX1_4F_S 0x000015c8
+#define NV20TCL_VERTEX_TX1_4F_T 0x000015cc
+#define NV20TCL_VERTEX_TX1_4F_R 0x000015d0
+#define NV20TCL_VERTEX_TX1_4F_Q 0x000015d4
+#define NV20TCL_VERTEX_TX1_4I_ST 0x000015d8
+#define NV20TCL_VERTEX_TX1_4I_ST_S_SHIFT 0
+#define NV20TCL_VERTEX_TX1_4I_ST_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX1_4I_ST_T_SHIFT 16
+#define NV20TCL_VERTEX_TX1_4I_ST_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX1_4I_RQ 0x000015dc
+#define NV20TCL_VERTEX_TX1_4I_RQ_R_SHIFT 0
+#define NV20TCL_VERTEX_TX1_4I_RQ_R_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX1_4I_RQ_Q_SHIFT 16
+#define NV20TCL_VERTEX_TX1_4I_RQ_Q_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX2_2F_S 0x000015e0
+#define NV20TCL_VERTEX_TX2_2F_T 0x000015e4
+#define NV20TCL_VERTEX_TX2_2I 0x000015e8
+#define NV20TCL_VERTEX_TX2_2I_S_SHIFT 0
+#define NV20TCL_VERTEX_TX2_2I_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX2_2I_T_SHIFT 16
+#define NV20TCL_VERTEX_TX2_2I_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX2_4F_S 0x000015f0
+#define NV20TCL_VERTEX_TX2_4F_T 0x000015f4
+#define NV20TCL_VERTEX_TX2_4F_R 0x000015f8
+#define NV20TCL_VERTEX_TX2_4F_Q 0x000015fc
+#define NV20TCL_VERTEX_TX2_4I_ST 0x00001600
+#define NV20TCL_VERTEX_TX2_4I_ST_S_SHIFT 0
+#define NV20TCL_VERTEX_TX2_4I_ST_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX2_4I_ST_T_SHIFT 16
+#define NV20TCL_VERTEX_TX2_4I_ST_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX2_4I_RQ 0x00001604
+#define NV20TCL_VERTEX_TX2_4I_RQ_R_SHIFT 0
+#define NV20TCL_VERTEX_TX2_4I_RQ_R_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX2_4I_RQ_Q_SHIFT 16
+#define NV20TCL_VERTEX_TX2_4I_RQ_Q_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX3_2F_S 0x00001608
+#define NV20TCL_VERTEX_TX3_2F_T 0x0000160c
+#define NV20TCL_VERTEX_TX3_2I 0x00001610
+#define NV20TCL_VERTEX_TX3_2I_S_SHIFT 0
+#define NV20TCL_VERTEX_TX3_2I_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX3_2I_T_SHIFT 16
+#define NV20TCL_VERTEX_TX3_2I_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX3_4F_S 0x00001620
+#define NV20TCL_VERTEX_TX3_4F_T 0x00001624
+#define NV20TCL_VERTEX_TX3_4F_R 0x00001628
+#define NV20TCL_VERTEX_TX3_4F_Q 0x0000162c
+#define NV20TCL_VERTEX_TX3_4I_ST 0x00001630
+#define NV20TCL_VERTEX_TX3_4I_ST_S_SHIFT 0
+#define NV20TCL_VERTEX_TX3_4I_ST_S_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX3_4I_ST_T_SHIFT 16
+#define NV20TCL_VERTEX_TX3_4I_ST_T_MASK 0xffff0000
+#define NV20TCL_VERTEX_TX3_4I_RQ 0x00001634
+#define NV20TCL_VERTEX_TX3_4I_RQ_R_SHIFT 0
+#define NV20TCL_VERTEX_TX3_4I_RQ_R_MASK 0x0000ffff
+#define NV20TCL_VERTEX_TX3_4I_RQ_Q_SHIFT 16
+#define NV20TCL_VERTEX_TX3_4I_RQ_Q_MASK 0xffff0000
+#define NV20TCL_VERTEX_FOG_1F 0x00001698
+#define NV20TCL_EDGEFLAG_ENABLE 0x000016bc
+#define NV20TCL_VTX_CACHE_INVALIDATE 0x00001710
+#define NV20TCL_VTXBUF_ADDRESS(x) (0x00001720+((x)*4))
+#define NV20TCL_VTXBUF_ADDRESS__SIZE 0x00000010
+#define NV20TCL_VTXBUF_ADDRESS_DMA1 (1 << 31)
+#define NV20TCL_VTXBUF_ADDRESS_OFFSET_SHIFT 0
+#define NV20TCL_VTXBUF_ADDRESS_OFFSET_MASK 0x0fffffff
+#define NV20TCL_VTXFMT(x) (0x00001760+((x)*4))
+#define NV20TCL_VTXFMT__SIZE 0x00000010
+#define NV20TCL_VTXFMT_TYPE_SHIFT 0
+#define NV20TCL_VTXFMT_TYPE_MASK 0x0000000f
+#define NV20TCL_VTXFMT_TYPE_FLOAT 0x00000002
+#define NV20TCL_VTXFMT_TYPE_UBYTE 0x00000004
+#define NV20TCL_VTXFMT_TYPE_USHORT 0x00000005
+#define NV20TCL_VTXFMT_SIZE_SHIFT 4
+#define NV20TCL_VTXFMT_SIZE_MASK 0x000000f0
+#define NV20TCL_VTXFMT_STRIDE_SHIFT 8
+#define NV20TCL_VTXFMT_STRIDE_MASK 0x0000ff00
+#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R 0x000017a0
+#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_G 0x000017a4
+#define NV20TCL_LIGHT_MODEL_BACK_AMBIENT_B 0x000017a8
+#define NV20TCL_MATERIAL_FACTOR_BACK_A 0x000017ac
+#define NV20TCL_MATERIAL_FACTOR_BACK_R 0x000017b0
+#define NV20TCL_MATERIAL_FACTOR_BACK_G 0x000017b4
+#define NV20TCL_MATERIAL_FACTOR_BACK_B 0x000017b8
+#define NV20TCL_COLOR_LOGIC_OP_ENABLE 0x000017bc
+#define NV20TCL_COLOR_LOGIC_OP_OP 0x000017c0
+#define NV20TCL_COLOR_LOGIC_OP_OP_CLEAR 0x00001500
+#define NV20TCL_COLOR_LOGIC_OP_OP_AND 0x00001501
+#define NV20TCL_COLOR_LOGIC_OP_OP_AND_REVERSE 0x00001502
+#define NV20TCL_COLOR_LOGIC_OP_OP_COPY 0x00001503
+#define NV20TCL_COLOR_LOGIC_OP_OP_AND_INVERTED 0x00001504
+#define NV20TCL_COLOR_LOGIC_OP_OP_NOOP 0x00001505
+#define NV20TCL_COLOR_LOGIC_OP_OP_XOR 0x00001506
+#define NV20TCL_COLOR_LOGIC_OP_OP_OR 0x00001507
+#define NV20TCL_COLOR_LOGIC_OP_OP_NOR 0x00001508
+#define NV20TCL_COLOR_LOGIC_OP_OP_EQUIV 0x00001509
+#define NV20TCL_COLOR_LOGIC_OP_OP_INVERT 0x0000150a
+#define NV20TCL_COLOR_LOGIC_OP_OP_OR_REVERSE 0x0000150b
+#define NV20TCL_COLOR_LOGIC_OP_OP_COPY_INVERTED 0x0000150c
+#define NV20TCL_COLOR_LOGIC_OP_OP_OR_INVERTED 0x0000150d
+#define NV20TCL_COLOR_LOGIC_OP_OP_NAND 0x0000150e
+#define NV20TCL_COLOR_LOGIC_OP_OP_SET 0x0000150f
+#define NV20TCL_LIGHT_MODEL_TWO_SIDE_ENABLE 0x000017c4
+#define NV20TCL_TX_SHADER_CULL_MODE 0x000017f8
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S (1 << 0)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_S_LESS 0x00000001
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T (1 << 1)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_T_LESS 0x00000002
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R (1 << 2)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_R_LESS 0x00000004
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q (1 << 3)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX0_Q_LESS 0x00000008
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S (1 << 4)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_S_LESS 0x00000010
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T (1 << 5)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_T_LESS 0x00000020
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R (1 << 6)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_R_LESS 0x00000040
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q (1 << 7)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX1_Q_LESS 0x00000080
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S (1 << 8)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_S_LESS 0x00000100
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T (1 << 9)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_T_LESS 0x00000200
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R (1 << 10)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_R_LESS 0x00000400
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q (1 << 11)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX2_Q_LESS 0x00000800
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S (1 << 12)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_S_LESS 0x00001000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T (1 << 13)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_T_LESS 0x00002000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R (1 << 14)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_R_LESS 0x00004000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q (1 << 15)
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q_GEQUAL 0x00000000
+#define NV20TCL_TX_SHADER_CULL_MODE_TX3_Q_LESS 0x00008000
+#define NV20TCL_VERTEX_BEGIN_END 0x000017fc
+#define NV20TCL_VERTEX_BEGIN_END_STOP 0x00000000
+#define NV20TCL_VERTEX_BEGIN_END_POINTS 0x00000001
+#define NV20TCL_VERTEX_BEGIN_END_LINES 0x00000002
+#define NV20TCL_VERTEX_BEGIN_END_LINE_LOOP 0x00000003
+#define NV20TCL_VERTEX_BEGIN_END_LINE_STRIP 0x00000004
+#define NV20TCL_VERTEX_BEGIN_END_TRIANGLES 0x00000005
+#define NV20TCL_VERTEX_BEGIN_END_TRIANGLE_STRIP 0x00000006
+#define NV20TCL_VERTEX_BEGIN_END_TRIANGLE_FAN 0x00000007
+#define NV20TCL_VERTEX_BEGIN_END_QUADS 0x00000008
+#define NV20TCL_VERTEX_BEGIN_END_QUAD_STRIP 0x00000009
+#define NV20TCL_VERTEX_BEGIN_END_POLYGON 0x0000000a
+#define NV20TCL_VB_ELEMENT_U16 0x00001800
+#define NV20TCL_VB_ELEMENT_U16_I0_SHIFT 0
+#define NV20TCL_VB_ELEMENT_U16_I0_MASK 0x0000ffff
+#define NV20TCL_VB_ELEMENT_U16_I1_SHIFT 16
+#define NV20TCL_VB_ELEMENT_U16_I1_MASK 0xffff0000
+#define NV20TCL_VB_ELEMENT_U32 0x00001808
+#define NV20TCL_VB_VERTEX_BATCH 0x00001810
+#define NV20TCL_VB_VERTEX_BATCH_OFFSET_SHIFT 0
+#define NV20TCL_VB_VERTEX_BATCH_OFFSET_MASK 0x00ffffff
+#define NV20TCL_VB_VERTEX_BATCH_COUNT_SHIFT 24
+#define NV20TCL_VB_VERTEX_BATCH_COUNT_MASK 0xff000000
+#define NV20TCL_VERTEX_DATA 0x00001818
+#define NV20TCL_TX_SHADER_CONST_EYE_X 0x0000181c
+#define NV20TCL_TX_SHADER_CONST_EYE_Y 0x00001820
+#define NV20TCL_TX_SHADER_CONST_EYE_Z 0x00001824
+#define NV20TCL_VTX_ATTR_4F_X(x) (0x00001a00+((x)*16))
+#define NV20TCL_VTX_ATTR_4F_X__SIZE 0x00000010
+#define NV20TCL_VTX_ATTR_4F_Y(x) (0x00001a04+((x)*16))
+#define NV20TCL_VTX_ATTR_4F_Y__SIZE 0x00000010
+#define NV20TCL_VTX_ATTR_4F_Z(x) (0x00001a08+((x)*16))
+#define NV20TCL_VTX_ATTR_4F_Z__SIZE 0x00000010
+#define NV20TCL_VTX_ATTR_4F_W(x) (0x00001a0c+((x)*16))
+#define NV20TCL_VTX_ATTR_4F_W__SIZE 0x00000010
+#define NV20TCL_TX_OFFSET(x) (0x00001b00+((x)*64))
+#define NV20TCL_TX_OFFSET__SIZE 0x00000004
+#define NV20TCL_TX_FORMAT(x) (0x00001b04+((x)*64))
+#define NV20TCL_TX_FORMAT__SIZE 0x00000004
+#define NV20TCL_TX_FORMAT_DMA0 (1 << 0)
+#define NV20TCL_TX_FORMAT_DMA1 (1 << 1)
+#define NV20TCL_TX_FORMAT_CUBIC (1 << 2)
+#define NV20TCL_TX_FORMAT_NO_BORDER (1 << 3)
+#define NV20TCL_TX_FORMAT_DIMS_SHIFT 4
+#define NV20TCL_TX_FORMAT_DIMS_MASK 0x000000f0
+#define NV20TCL_TX_FORMAT_DIMS_1D 0x00000010
+#define NV20TCL_TX_FORMAT_DIMS_2D 0x00000020
+#define NV20TCL_TX_FORMAT_DIMS_3D 0x00000030
+#define NV20TCL_TX_FORMAT_FORMAT_SHIFT 8
+#define NV20TCL_TX_FORMAT_FORMAT_MASK 0x0000ff00
+#define NV20TCL_TX_FORMAT_FORMAT_L8 0x00000000
+#define NV20TCL_TX_FORMAT_FORMAT_A8 0x00000100
+#define NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5 0x00000200
+#define NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4 0x00000400
+#define NV20TCL_TX_FORMAT_FORMAT_R5G6B5 0x00000500
+#define NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8 0x00000600
+#define NV20TCL_TX_FORMAT_FORMAT_X8R8G8B8 0x00000700
+#define NV20TCL_TX_FORMAT_FORMAT_INDEX8 0x00000b00
+#define NV20TCL_TX_FORMAT_FORMAT_DXT1 0x00000c00
+#define NV20TCL_TX_FORMAT_FORMAT_DXT3 0x00000e00
+#define NV20TCL_TX_FORMAT_FORMAT_DXT5 0x00000f00
+#define NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT 0x00001000
+#define NV20TCL_TX_FORMAT_FORMAT_R5G6B5_RECT 0x00001100
+#define NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT 0x00001200
+#define NV20TCL_TX_FORMAT_FORMAT_L8_RECT 0x00001300
+#define NV20TCL_TX_FORMAT_FORMAT_DSDT8_RECT 0x00001700
+#define NV20TCL_TX_FORMAT_FORMAT_A8L8 0x00001a00
+#define NV20TCL_TX_FORMAT_FORMAT_A8_RECT 0x00001b00
+#define NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT 0x00001d00
+#define NV20TCL_TX_FORMAT_FORMAT_R8G8B8_RECT 0x00001e00
+#define NV20TCL_TX_FORMAT_FORMAT_A8L8_RECT 0x00002000
+#define NV20TCL_TX_FORMAT_FORMAT_DSDT8 0x00002800
+#define NV20TCL_TX_FORMAT_FORMAT_HILO16 0x00003300
+#define NV20TCL_TX_FORMAT_FORMAT_HILO16_RECT 0x00003600
+#define NV20TCL_TX_FORMAT_FORMAT_HILO8 0x00004400
+#define NV20TCL_TX_FORMAT_FORMAT_SIGNED_HILO8 0x00004500
+#define NV20TCL_TX_FORMAT_FORMAT_HILO8_RECT 0x00004600
+#define NV20TCL_TX_FORMAT_FORMAT_SIGNED_HILO8_RECT 0x00004700
+#define NV20TCL_TX_FORMAT_FORMAT_A16 0x00003200
+#define NV20TCL_TX_FORMAT_FORMAT_A16_RECT 0x00003500
+#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_RGBA16_NV 0x00004a00
+#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_RGBA32_NV 0x00004b00
+#define NV20TCL_TX_FORMAT_FORMAT_FLOAT_R32_NV 0x00004c00
+#define NV20TCL_TX_FORMAT_MIPMAP (1 << 19)
+#define NV20TCL_TX_FORMAT_BASE_SIZE_U_SHIFT 20
+#define NV20TCL_TX_FORMAT_BASE_SIZE_U_MASK 0x00f00000
+#define NV20TCL_TX_FORMAT_BASE_SIZE_V_SHIFT 24
+#define NV20TCL_TX_FORMAT_BASE_SIZE_V_MASK 0x0f000000
+#define NV20TCL_TX_FORMAT_BASE_SIZE_W_SHIFT 28
+#define NV20TCL_TX_FORMAT_BASE_SIZE_W_MASK 0xf0000000
+#define NV20TCL_TX_WRAP(x) (0x00001b08+((x)*64))
+#define NV20TCL_TX_WRAP__SIZE 0x00000004
+#define NV20TCL_TX_WRAP_S_SHIFT 0
+#define NV20TCL_TX_WRAP_S_MASK 0x000000ff
+#define NV20TCL_TX_WRAP_S_REPEAT 0x00000001
+#define NV20TCL_TX_WRAP_S_MIRRORED_REPEAT 0x00000002
+#define NV20TCL_TX_WRAP_S_CLAMP_TO_EDGE 0x00000003
+#define NV20TCL_TX_WRAP_S_CLAMP_TO_BORDER 0x00000004
+#define NV20TCL_TX_WRAP_S_CLAMP 0x00000005
+#define NV20TCL_TX_WRAP_T_SHIFT 8
+#define NV20TCL_TX_WRAP_T_MASK 0x00000f00
+#define NV20TCL_TX_WRAP_T_REPEAT 0x00000100
+#define NV20TCL_TX_WRAP_T_MIRRORED_REPEAT 0x00000200
+#define NV20TCL_TX_WRAP_T_CLAMP_TO_EDGE 0x00000300
+#define NV20TCL_TX_WRAP_T_CLAMP_TO_BORDER 0x00000400
+#define NV20TCL_TX_WRAP_T_CLAMP 0x00000500
+#define NV20TCL_TX_WRAP_R_SHIFT 16
+#define NV20TCL_TX_WRAP_R_MASK 0x000f0000
+#define NV20TCL_TX_WRAP_R_REPEAT 0x00010000
+#define NV20TCL_TX_WRAP_R_MIRRORED_REPEAT 0x00020000
+#define NV20TCL_TX_WRAP_R_CLAMP_TO_EDGE 0x00030000
+#define NV20TCL_TX_WRAP_R_CLAMP_TO_BORDER 0x00040000
+#define NV20TCL_TX_WRAP_R_CLAMP 0x00050000
+#define NV20TCL_TX_ENABLE(x) (0x00001b0c+((x)*64))
+#define NV20TCL_TX_ENABLE__SIZE 0x00000004
+#define NV20TCL_TX_ENABLE_ANISO_SHIFT 4
+#define NV20TCL_TX_ENABLE_ANISO_MASK 0x00000030
+#define NV20TCL_TX_ENABLE_ANISO_NONE 0x00000000
+#define NV20TCL_TX_ENABLE_ANISO_2X 0x00000010
+#define NV20TCL_TX_ENABLE_ANISO_4X 0x00000020
+#define NV20TCL_TX_ENABLE_ANISO_8X 0x00000030
+#define NV20TCL_TX_ENABLE_MIPMAP_MAX_LOD_SHIFT 14
+#define NV20TCL_TX_ENABLE_MIPMAP_MAX_LOD_MASK 0x0003c000
+#define NV20TCL_TX_ENABLE_MIPMAP_MIN_LOD_SHIFT 26
+#define NV20TCL_TX_ENABLE_MIPMAP_MIN_LOD_MASK 0x3c000000
+#define NV20TCL_TX_ENABLE_ENABLE (1 << 30)
+#define NV20TCL_TX_NPOT_PITCH(x) (0x00001b10+((x)*64))
+#define NV20TCL_TX_NPOT_PITCH__SIZE 0x00000004
+#define NV20TCL_TX_NPOT_PITCH_PITCH_SHIFT 16
+#define NV20TCL_TX_NPOT_PITCH_PITCH_MASK 0xffff0000
+#define NV20TCL_TX_FILTER(x) (0x00001b14+((x)*64))
+#define NV20TCL_TX_FILTER__SIZE 0x00000004
+#define NV20TCL_TX_FILTER_LOD_BIAS_SHIFT 8
+#define NV20TCL_TX_FILTER_LOD_BIAS_MASK 0x00000f00
+#define NV20TCL_TX_FILTER_MINIFY_SHIFT 16
+#define NV20TCL_TX_FILTER_MINIFY_MASK 0x000f0000
+#define NV20TCL_TX_FILTER_MINIFY_NEAREST 0x00010000
+#define NV20TCL_TX_FILTER_MINIFY_LINEAR 0x00020000
+#define NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST 0x00030000
+#define NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST 0x00040000
+#define NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR 0x00050000
+#define NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR 0x00060000
+#define NV20TCL_TX_FILTER_MAGNIFY_SHIFT 24
+#define NV20TCL_TX_FILTER_MAGNIFY_MASK 0x0f000000
+#define NV20TCL_TX_FILTER_MAGNIFY_NEAREST 0x01000000
+#define NV20TCL_TX_FILTER_MAGNIFY_LINEAR 0x02000000
+#define NV20TCL_TX_NPOT_SIZE(x) (0x00001b1c+((x)*64))
+#define NV20TCL_TX_NPOT_SIZE__SIZE 0x00000004
+#define NV20TCL_TX_NPOT_SIZE_H_SHIFT 0
+#define NV20TCL_TX_NPOT_SIZE_H_MASK 0x0000ffff
+#define NV20TCL_TX_NPOT_SIZE_W_SHIFT 16
+#define NV20TCL_TX_NPOT_SIZE_W_MASK 0xffff0000
+#define NV20TCL_TX_PALETTE_OFFSET(x) (0x00001b20+((x)*64))
+#define NV20TCL_TX_PALETTE_OFFSET__SIZE 0x00000004
+#define NV20TCL_TX_BORDER_COLOR(x) (0x00001b24+((x)*64))
+#define NV20TCL_TX_BORDER_COLOR__SIZE 0x00000004
+#define NV20TCL_TX_BORDER_COLOR_B_SHIFT 0
+#define NV20TCL_TX_BORDER_COLOR_B_MASK 0x000000ff
+#define NV20TCL_TX_BORDER_COLOR_G_SHIFT 8
+#define NV20TCL_TX_BORDER_COLOR_G_MASK 0x0000ff00
+#define NV20TCL_TX_BORDER_COLOR_R_SHIFT 16
+#define NV20TCL_TX_BORDER_COLOR_R_MASK 0x00ff0000
+#define NV20TCL_TX_BORDER_COLOR_A_SHIFT 24
+#define NV20TCL_TX_BORDER_COLOR_A_MASK 0xff000000
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX00(x) (0x00001b28+((x)*64))
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX00__SIZE 0x00000004
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX01(x) (0x00001b2c+((x)*64))
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX01__SIZE 0x00000004
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX11(x) (0x00001b30+((x)*64))
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX11__SIZE 0x00000004
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX10(x) (0x00001b34+((x)*64))
+#define NV20TCL_TX_SHADER_OFFSET_MATRIX10__SIZE 0x00000004
+#define NV20TCL_DEPTH_UNK17D8 0x00001d78
+#define NV20TCL_DEPTH_UNK17D8_CLAMP_SHIFT 4
+#define NV20TCL_DEPTH_UNK17D8_CLAMP_MASK 0x000000f0
+#define NV20TCL_MULTISAMPLE_CONTROL 0x00001d7c
+#define NV20TCL_CLEAR_DEPTH_VALUE 0x00001d8c
+#define NV20TCL_CLEAR_VALUE 0x00001d90
+#define NV20TCL_CLEAR_BUFFERS 0x00001d94
+#define NV20TCL_CLEAR_BUFFERS_COLOR_A (1 << 7)
+#define NV20TCL_CLEAR_BUFFERS_COLOR_B (1 << 6)
+#define NV20TCL_CLEAR_BUFFERS_COLOR_G (1 << 5)
+#define NV20TCL_CLEAR_BUFFERS_COLOR_R (1 << 4)
+#define NV20TCL_CLEAR_BUFFERS_STENCIL (1 << 1)
+#define NV20TCL_CLEAR_BUFFERS_DEPTH (1 << 0)
+#define NV20TCL_RC_COLOR0 0x00001e20
+#define NV20TCL_RC_COLOR0_B_SHIFT 0
+#define NV20TCL_RC_COLOR0_B_MASK 0x000000ff
+#define NV20TCL_RC_COLOR0_G_SHIFT 8
+#define NV20TCL_RC_COLOR0_G_MASK 0x0000ff00
+#define NV20TCL_RC_COLOR0_R_SHIFT 16
+#define NV20TCL_RC_COLOR0_R_MASK 0x00ff0000
+#define NV20TCL_RC_COLOR0_A_SHIFT 24
+#define NV20TCL_RC_COLOR0_A_MASK 0xff000000
+#define NV20TCL_RC_COLOR1 0x00001e24
+#define NV20TCL_RC_COLOR1_B_SHIFT 0
+#define NV20TCL_RC_COLOR1_B_MASK 0x000000ff
+#define NV20TCL_RC_COLOR1_G_SHIFT 8
+#define NV20TCL_RC_COLOR1_G_MASK 0x0000ff00
+#define NV20TCL_RC_COLOR1_R_SHIFT 16
+#define NV20TCL_RC_COLOR1_R_MASK 0x00ff0000
+#define NV20TCL_RC_COLOR1_A_SHIFT 24
+#define NV20TCL_RC_COLOR1_A_MASK 0xff000000
+#define NV20TCL_BACK_MATERIAL_SHININESS(x) (0x00001e28+((x)*4))
+#define NV20TCL_BACK_MATERIAL_SHININESS__SIZE 0x00000006
+#define NV20TCL_RC_OUT_RGB(x) (0x00001e40+((x)*4))
+#define NV20TCL_RC_OUT_RGB__SIZE 0x00000008
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SHIFT 0
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_MASK 0x0000000f
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR0 0x00000001
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_CONSTANT_COLOR1 0x00000002
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_FOG 0x00000003
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_PRIMARY_COLOR 0x00000004
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SECONDARY_COLOR 0x00000005
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE0 0x00000008
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE1 0x00000009
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0 0x0000000c
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE1 0x0000000d
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x0000000e
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_E_TIMES_F 0x0000000f
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE2 0x0000000a
+#define NV20TCL_RC_OUT_RGB_CD_OUTPUT_TEXTURE3 0x0000000b
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SHIFT 4
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_MASK 0x000000f0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR0 0x00000010
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_CONSTANT_COLOR1 0x00000020
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_FOG 0x00000030
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_PRIMARY_COLOR 0x00000040
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SECONDARY_COLOR 0x00000050
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE0 0x00000080
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE1 0x00000090
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0 0x000000c0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE1 0x000000d0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x000000e0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_E_TIMES_F 0x000000f0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE2 0x000000a0
+#define NV20TCL_RC_OUT_RGB_AB_OUTPUT_TEXTURE3 0x000000b0
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SHIFT 8
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_MASK 0x00000f00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_ZERO 0x00000000
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR0 0x00000100
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_CONSTANT_COLOR1 0x00000200
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_FOG 0x00000300
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_PRIMARY_COLOR 0x00000400
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SECONDARY_COLOR 0x00000500
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE0 0x00000800
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE1 0x00000900
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0 0x00000c00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE1 0x00000d00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_SPARE0_PLUS_SECONDARY_COLOR 0x00000e00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_E_TIMES_F 0x00000f00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE2 0x00000a00
+#define NV20TCL_RC_OUT_RGB_SUM_OUTPUT_TEXTURE3 0x00000b00
+#define NV20TCL_RC_OUT_RGB_CD_DOT_PRODUCT (1 << 12)
+#define NV20TCL_RC_OUT_RGB_AB_DOT_PRODUCT (1 << 13)
+#define NV20TCL_RC_OUT_RGB_MUX_SUM (1 << 14)
+#define NV20TCL_RC_OUT_RGB_BIAS (1 << 15)
+#define NV20TCL_RC_OUT_RGB_BIAS_NONE 0x00000000
+#define NV20TCL_RC_OUT_RGB_BIAS_BIAS_BY_NEGATIVE_ONE_HALF 0x00008000
+#define NV20TCL_RC_OUT_RGB_SCALE_SHIFT 17
+#define NV20TCL_RC_OUT_RGB_SCALE_MASK 0x00000000
+#define NV20TCL_RC_OUT_RGB_SCALE_NONE 0x00000000
+#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_TWO 0x00020000
+#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_FOUR 0x00040000
+#define NV20TCL_RC_OUT_RGB_SCALE_SCALE_BY_ONE_HALF 0x00060000
+#define NV20TCL_RC_ENABLE 0x00001e60
+#define NV20TCL_RC_ENABLE_NUM_COMBINERS_SHIFT 0
+#define NV20TCL_RC_ENABLE_NUM_COMBINERS_MASK 0x0000000f
+#define NV20TCL_TX_RCOMP 0x00001e6c
+#define NV20TCL_TX_RCOMP_NEVER 0x00000000
+#define NV20TCL_TX_RCOMP_GREATER 0x00000001
+#define NV20TCL_TX_RCOMP_EQUAL 0x00000002
+#define NV20TCL_TX_RCOMP_GEQUAL 0x00000003
+#define NV20TCL_TX_RCOMP_LESS 0x00000004
+#define NV20TCL_TX_RCOMP_NOTEQUAL 0x00000005
+#define NV20TCL_TX_RCOMP_LEQUAL 0x00000006
+#define NV20TCL_TX_RCOMP_ALWAYS 0x00000007
+#define NV20TCL_TX_SHADER_OP 0x00001e70
+#define NV20TCL_TX_SHADER_OP_TX0_SHIFT 0
+#define NV20TCL_TX_SHADER_OP_TX0_MASK 0x0000001f
+#define NV20TCL_TX_SHADER_OP_TX0_NONE 0x00000000
+#define NV20TCL_TX_SHADER_OP_TX0_TEXTURE_2D 0x00000001
+#define NV20TCL_TX_SHADER_OP_TX0_PASS_THROUGH 0x00000004
+#define NV20TCL_TX_SHADER_OP_TX0_CULL_FRAGMENT 0x00000005
+#define NV20TCL_TX_SHADER_OP_TX0_OFFSET_TEXTURE_2D 0x00000006
+#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT_TEXTURE_2D 0x00000009
+#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT_DEPTH_REPLACE 0x0000000a
+#define NV20TCL_TX_SHADER_OP_TX0_DEPENDANT_AR_TEXTURE_2D 0x0000000f
+#define NV20TCL_TX_SHADER_OP_TX0_DEPENDANT_GB_TEXTURE_2D 0x00000010
+#define NV20TCL_TX_SHADER_OP_TX0_DOT_PRODUCT 0x00000011
+#define NV20TCL_TX_SHADER_OP_TX1_SHIFT 5
+#define NV20TCL_TX_SHADER_OP_TX1_MASK 0x000003e0
+#define NV20TCL_TX_SHADER_OP_TX1_NONE 0x00000000
+#define NV20TCL_TX_SHADER_OP_TX1_TEXTURE_2D 0x00000020
+#define NV20TCL_TX_SHADER_OP_TX1_PASS_THROUGH 0x00000080
+#define NV20TCL_TX_SHADER_OP_TX1_CULL_FRAGMENT 0x000000a0
+#define NV20TCL_TX_SHADER_OP_TX1_OFFSET_TEXTURE_2D 0x000000c0
+#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT_TEXTURE_2D 0x00000120
+#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT_DEPTH_REPLACE 0x00000140
+#define NV20TCL_TX_SHADER_OP_TX1_DEPENDANT_AR_TEXTURE_2D 0x000001e0
+#define NV20TCL_TX_SHADER_OP_TX1_DEPENDANT_GB_TEXTURE_2D 0x00000200
+#define NV20TCL_TX_SHADER_OP_TX1_DOT_PRODUCT 0x00000220
+#define NV20TCL_TX_SHADER_OP_TX2_SHIFT 10
+#define NV20TCL_TX_SHADER_OP_TX2_MASK 0x00007c00
+#define NV20TCL_TX_SHADER_OP_TX2_NONE 0x00000000
+#define NV20TCL_TX_SHADER_OP_TX2_TEXTURE_2D 0x00000400
+#define NV20TCL_TX_SHADER_OP_TX2_PASS_THROUGH 0x00001000
+#define NV20TCL_TX_SHADER_OP_TX2_CULL_FRAGMENT 0x00001400
+#define NV20TCL_TX_SHADER_OP_TX2_OFFSET_TEXTURE_2D 0x00001800
+#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT_TEXTURE_2D 0x00002400
+#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT_DEPTH_REPLACE 0x00002800
+#define NV20TCL_TX_SHADER_OP_TX2_DEPENDANT_AR_TEXTURE_2D 0x00003c00
+#define NV20TCL_TX_SHADER_OP_TX2_DEPENDANT_GB_TEXTURE_2D 0x00004000
+#define NV20TCL_TX_SHADER_OP_TX2_DOT_PRODUCT 0x00004400
+#define NV20TCL_TX_SHADER_OP_TX3_SHIFT 15
+#define NV20TCL_TX_SHADER_OP_TX3_MASK 0x000f8000
+#define NV20TCL_TX_SHADER_OP_TX3_NONE 0x00000000
+#define NV20TCL_TX_SHADER_OP_TX3_TEXTURE_2D 0x00008000
+#define NV20TCL_TX_SHADER_OP_TX3_PASS_THROUGH 0x00020000
+#define NV20TCL_TX_SHADER_OP_TX3_CULL_FRAGMENT 0x00028000
+#define NV20TCL_TX_SHADER_OP_TX3_OFFSET_TEXTURE_2D 0x00030000
+#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT_TEXTURE_2D 0x00048000
+#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT_DEPTH_REPLACE 0x00050000
+#define NV20TCL_TX_SHADER_OP_TX3_DEPENDANT_AR_TEXTURE_2D 0x00078000
+#define NV20TCL_TX_SHADER_OP_TX3_DEPENDANT_GB_TEXTURE_2D 0x00080000
+#define NV20TCL_TX_SHADER_OP_TX3_DOT_PRODUCT 0x00088000
+#define NV20TCL_TX_SHADER_DOTMAPPING 0x00001e74
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX0_SHIFT 0
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX0_MASK 0x0000000f
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX1_SHIFT 4
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX1_MASK 0x000000f0
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX2_SHIFT 8
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX2_MASK 0x00000f00
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX3_SHIFT 12
+#define NV20TCL_TX_SHADER_DOTMAPPING_TX3_MASK 0x0000f000
+#define NV20TCL_TX_SHADER_PREVIOUS 0x00001e78
+#define NV20TCL_TX_SHADER_PREVIOUS_TX0_SHIFT 8
+#define NV20TCL_TX_SHADER_PREVIOUS_TX0_MASK 0x00000f00
+#define NV20TCL_TX_SHADER_PREVIOUS_TX1_SHIFT 12
+#define NV20TCL_TX_SHADER_PREVIOUS_TX1_MASK 0x0000f000
+#define NV20TCL_TX_SHADER_PREVIOUS_TX2_SHIFT 16
+#define NV20TCL_TX_SHADER_PREVIOUS_TX2_MASK 0x00030000
+#define NV20TCL_TX_SHADER_PREVIOUS_TX3_SHIFT 20
+#define NV20TCL_TX_SHADER_PREVIOUS_TX3_MASK 0x00300000
+#define NV20TCL_ENGINE 0x00001e94
+#define NV20TCL_ENGINE_VP (1 << 1)
+#define NV20TCL_ENGINE_FIXED (1 << 2)
+#define NV20TCL_VP_UPLOAD_FROM_ID 0x00001e9c
+#define NV20TCL_VP_START_FROM_ID 0x00001ea0
+#define NV20TCL_VP_UPLOAD_CONST_ID 0x00001ea4
+
+
+#define NV25TCL 0x00000597
+
+#define NV25TCL_DMA_IN_MEMORY4 0x0000019c
+#define NV25TCL_DMA_IN_MEMORY5 0x000001a0
+#define NV25TCL_DMA_IN_MEMORY8 0x000001ac
+#define NV25TCL_DMA_IN_MEMORY9 0x000001b0
+
+#endif /* NOUVEAU_REG_H */
+
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index f481161d46..4a1534bee1 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -58,8 +58,10 @@ static const struct dri_extension nouveau_extensions[] = {
{ "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
{ "GL_EXT_stencil_wrap", NULL },
+ { "GL_EXT_texture_env_combine", NULL },
{ "GL_EXT_texture_lod_bias", NULL },
{ "GL_NV_blend_square", NULL },
+ { "GL_NV_texture_env_combine4", NULL },
{ "GL_SGIS_generate_mipmap", NULL },
{ NULL, NULL }
};
@@ -306,6 +308,9 @@ nouveau_context_make_current(__DRIcontext *dri_ctx, __DRIdrawable *dri_draw,
GLboolean
nouveau_context_unbind(__DRIcontext *dri_ctx)
{
+ /* Unset current context and dispath table */
+ _mesa_make_current(NULL, NULL, NULL);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/nouveau/nv04_context.c b/src/mesa/drivers/dri/nouveau/nv04_context.c
index 6834f7cd3d..1d34c86350 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_context.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_context.c
@@ -39,6 +39,7 @@ nv04_context_engine(GLcontext *ctx)
struct nouveau_grobj *fahrenheit;
if (ctx->Texture.Unit[0].EnvMode == GL_COMBINE ||
+ ctx->Texture.Unit[0].EnvMode == GL_COMBINE4_NV ||
ctx->Texture.Unit[0].EnvMode == GL_BLEND ||
ctx->Texture.Unit[0].EnvMode == GL_ADD ||
ctx->Texture.Unit[1]._ReallyEnabled ||
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
index d7c86d4178..bb5d7dc20f 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_frag.c
@@ -44,6 +44,7 @@ struct combiner_state {
GLcontext *ctx;
int unit;
GLboolean alpha;
+ GLboolean premodulate;
/* GL state */
GLenum mode;
@@ -66,6 +67,7 @@ struct combiner_state {
(rc)->ctx = ctx; \
(rc)->unit = i; \
(rc)->alpha = __INIT_COMBINER_ALPHA_##chan; \
+ (rc)->premodulate = c->_NumArgs##chan == 4; \
(rc)->mode = c->Mode##chan; \
(rc)->source = c->Source##chan; \
(rc)->operand = c->Operand##chan; \
@@ -79,6 +81,9 @@ static uint32_t
get_input_source(struct combiner_state *rc, int source)
{
switch (source) {
+ case GL_ZERO:
+ return COMBINER_SOURCE(ZERO);
+
case GL_TEXTURE:
return rc->unit ? COMBINER_SOURCE(TEXTURE1) :
COMBINER_SOURCE(TEXTURE0);
@@ -195,11 +200,24 @@ setup_combiner(struct combiner_state *rc)
break;
case GL_ADD:
- INPUT_ARG(rc, 0, 0, 0);
- INPUT_SRC(rc, 1, ZERO, INVERT);
- INPUT_ARG(rc, 2, 1, 0);
- INPUT_SRC(rc, 3, ZERO, INVERT);
- UNSIGNED_OP(rc);
+ case GL_ADD_SIGNED:
+ if (rc->premodulate) {
+ INPUT_ARG(rc, 0, 0, 0);
+ INPUT_ARG(rc, 1, 1, 0);
+ INPUT_ARG(rc, 2, 2, 0);
+ INPUT_ARG(rc, 3, 3, 0);
+ } else {
+ INPUT_ARG(rc, 0, 0, 0);
+ INPUT_SRC(rc, 1, ZERO, INVERT);
+ INPUT_ARG(rc, 2, 1, 0);
+ INPUT_SRC(rc, 3, ZERO, INVERT);
+ }
+
+ if (rc->mode == GL_ADD_SIGNED)
+ SIGNED_OP(rc);
+ else
+ UNSIGNED_OP(rc);
+
break;
case GL_INTERPOLATE:
@@ -210,14 +228,6 @@ setup_combiner(struct combiner_state *rc)
UNSIGNED_OP(rc);
break;
- case GL_ADD_SIGNED:
- INPUT_ARG(rc, 0, 0, 0);
- INPUT_SRC(rc, 1, ZERO, INVERT);
- INPUT_ARG(rc, 2, 1, 0);
- INPUT_SRC(rc, 3, ZERO, INVERT);
- SIGNED_OP(rc);
- break;
-
default:
assert(0);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index 76b95fdd51..ab713f9dbf 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -63,6 +63,7 @@
struct combiner_state {
GLcontext *ctx;
int unit;
+ GLboolean premodulate;
/* GL state */
GLenum mode;
@@ -82,6 +83,7 @@ struct combiner_state {
ctx->Texture.Unit[i]._CurrentCombine; \
(rc)->ctx = ctx; \
(rc)->unit = i; \
+ (rc)->premodulate = c->_NumArgs##chan == 4; \
(rc)->mode = c->Mode##chan; \
(rc)->source = c->Source##chan; \
(rc)->operand = c->Operand##chan; \
@@ -95,6 +97,9 @@ static uint32_t
get_input_source(struct combiner_state *rc, int source)
{
switch (source) {
+ case GL_ZERO:
+ return RC_IN_SOURCE(ZERO);
+
case GL_TEXTURE:
return RC_IN_SOURCE(TEXTURE0) + rc->unit;
@@ -228,21 +233,21 @@ setup_combiner(struct combiner_state *rc)
break;
case GL_ADD:
- INPUT_ARG(rc, A, 0, 0);
- INPUT_ONE(rc, B, 0);
- INPUT_ARG(rc, C, 1, 0);
- INPUT_ONE(rc, D, 0);
-
- rc->out = RC_OUT_SUM;
- break;
-
case GL_ADD_SIGNED:
- INPUT_ARG(rc, A, 0, 0);
- INPUT_ONE(rc, B, 0);
- INPUT_ARG(rc, C, 1, 0);
- INPUT_ONE(rc, D, 0);
+ if (rc->premodulate) {
+ INPUT_ARG(rc, A, 0, 0);
+ INPUT_ARG(rc, B, 1, 0);
+ INPUT_ARG(rc, C, 2, 0);
+ INPUT_ARG(rc, D, 3, 0);
+ } else {
+ INPUT_ARG(rc, A, 0, 0);
+ INPUT_ONE(rc, B, 0);
+ INPUT_ARG(rc, C, 1, 0);
+ INPUT_ONE(rc, D, 0);
+ }
- rc->out = RC_OUT_SUM | RC_OUT_BIAS;
+ rc->out = RC_OUT_SUM |
+ (rc->mode == GL_ADD_SIGNED ? RC_OUT_BIAS : 0);
break;
case GL_INTERPOLATE:
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
index 62efe80fe4..2daaae260c 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tnl.c
@@ -32,6 +32,28 @@
#include "nv10_driver.h"
#include "nv20_driver.h"
+#define LIGHT_MODEL_AMBIENT_R(side) \
+ ((side) ? NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R : \
+ NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R)
+#define LIGHT_AMBIENT_R(side, i) \
+ ((side) ? NV20TCL_LIGHT_BACK_AMBIENT_R(i) : \
+ NV20TCL_LIGHT_FRONT_AMBIENT_R(i))
+#define LIGHT_DIFFUSE_R(side, i) \
+ ((side) ? NV20TCL_LIGHT_BACK_DIFFUSE_R(i) : \
+ NV20TCL_LIGHT_FRONT_DIFFUSE_R(i))
+#define LIGHT_SPECULAR_R(side, i) \
+ ((side) ? NV20TCL_LIGHT_BACK_SPECULAR_R(i) : \
+ NV20TCL_LIGHT_FRONT_SPECULAR_R(i))
+#define MATERIAL_FACTOR_R(side) \
+ ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_R : \
+ NV20TCL_MATERIAL_FACTOR_FRONT_R)
+#define MATERIAL_FACTOR_A(side) \
+ ((side) ? NV20TCL_MATERIAL_FACTOR_BACK_A : \
+ NV20TCL_MATERIAL_FACTOR_FRONT_A)
+#define MATERIAL_SHININESS(side) \
+ ((side) ? NV20TCL_BACK_MATERIAL_SHININESS(0) : \
+ NV20TCL_FRONT_MATERIAL_SHININESS(0))
+
void
nv20_emit_clip_plane(GLcontext *ctx, int emit)
{
@@ -210,10 +232,6 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
float (*mat)[4] = ctx->Light.Material.Attrib;
- uint32_t m_scene[] = { NV20TCL_LIGHT_MODEL_FRONT_AMBIENT_R,
- NV20TCL_LIGHT_MODEL_BACK_AMBIENT_R };
- uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_R,
- NV20TCL_MATERIAL_FACTOR_BACK_R };
float c_scene[3], c_factor[3];
struct gl_light *l;
@@ -231,23 +249,21 @@ nv20_emit_material_ambient(GLcontext *ctx, int emit)
ZERO_3V(c_factor);
}
- BEGIN_RING(chan, kelvin, m_scene[side], 3);
+ BEGIN_RING(chan, kelvin, LIGHT_MODEL_AMBIENT_R(side), 3);
OUT_RINGp(chan, c_scene, 3);
if (ctx->Light.ColorMaterialEnabled) {
- BEGIN_RING(chan, kelvin, m_factor[side], 3);
+ BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_R(side), 3);
OUT_RINGp(chan, c_factor, 3);
}
foreach(l, &ctx->Light.EnabledList) {
const int i = l - ctx->Light.Light;
- uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_AMBIENT_R(i),
- NV20TCL_LIGHT_BACK_AMBIENT_R(i) };
float *c_light = (USE_COLOR_MATERIAL(AMBIENT, side) ?
l->Ambient :
l->_MatAmbient[side]);
- BEGIN_RING(chan, kelvin, m_light[side], 3);
+ BEGIN_RING(chan, kelvin, LIGHT_AMBIENT_R(side, i), 3);
OUT_RINGp(chan, c_light, 3);
}
}
@@ -259,22 +275,18 @@ nv20_emit_material_diffuse(GLcontext *ctx, int emit)
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
GLfloat (*mat)[4] = ctx->Light.Material.Attrib;
- uint32_t m_factor[] = { NV20TCL_MATERIAL_FACTOR_FRONT_A,
- NV20TCL_MATERIAL_FACTOR_BACK_A };
struct gl_light *l;
- BEGIN_RING(chan, kelvin, m_factor[side], 1);
+ BEGIN_RING(chan, kelvin, MATERIAL_FACTOR_A(side), 1);
OUT_RINGf(chan, mat[MAT_ATTRIB_DIFFUSE(side)][3]);
foreach(l, &ctx->Light.EnabledList) {
const int i = l - ctx->Light.Light;
- uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_DIFFUSE_R(i),
- NV20TCL_LIGHT_BACK_DIFFUSE_R(i) };
float *c_light = (USE_COLOR_MATERIAL(DIFFUSE, side) ?
l->Diffuse :
l->_MatDiffuse[side]);
- BEGIN_RING(chan, kelvin, m_light[side], 3);
+ BEGIN_RING(chan, kelvin, LIGHT_DIFFUSE_R(side, i), 3);
OUT_RINGp(chan, c_light, 3);
}
}
@@ -289,13 +301,11 @@ nv20_emit_material_specular(GLcontext *ctx, int emit)
foreach(l, &ctx->Light.EnabledList) {
const int i = l - ctx->Light.Light;
- uint32_t m_light[] = { NV20TCL_LIGHT_FRONT_SPECULAR_R(i),
- NV20TCL_LIGHT_BACK_SPECULAR_R(i) };
float *c_light = (USE_COLOR_MATERIAL(SPECULAR, side) ?
l->Specular :
l->_MatSpecular[side]);
- BEGIN_RING(chan, kelvin, m_light[side], 3);
+ BEGIN_RING(chan, kelvin, LIGHT_SPECULAR_R(side, i), 3);
OUT_RINGp(chan, c_light, 3);
}
}
@@ -307,15 +317,13 @@ nv20_emit_material_shininess(GLcontext *ctx, int emit)
struct nouveau_channel *chan = context_chan(ctx);
struct nouveau_grobj *kelvin = context_eng3d(ctx);
float (*mat)[4] = ctx->Light.Material.Attrib;
- uint32_t mthd[] = { NV20TCL_FRONT_MATERIAL_SHININESS(0),
- NV20TCL_BACK_MATERIAL_SHININESS(0) };
float k[6];
nv10_get_shininess_coeff(
CLAMP(mat[MAT_ATTRIB_SHININESS(side)][0], 0, 1024),
k);
- BEGIN_RING(chan, kelvin, mthd[side], 6);
+ BEGIN_RING(chan, kelvin, MATERIAL_SHININESS(side), 6);
OUT_RINGp(chan, k, 6);
}
diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile
index c9c1346c3a..8013768e9f 100644
--- a/src/mesa/drivers/dri/r200/Makefile
+++ b/src/mesa/drivers/dri/r200/Makefile
@@ -13,6 +13,7 @@ endif
RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
+ radeon_buffer_objects.c \
radeon_common_context.c \
radeon_common.c \
radeon_cs_legacy.c \
diff --git a/src/mesa/drivers/dri/r200/radeon_buffer_objects.c b/src/mesa/drivers/dri/r200/radeon_buffer_objects.c
new file mode 120000
index 0000000000..f6a5f66470
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_buffer_objects.c
@@ -0,0 +1 @@
+../radeon/radeon_buffer_objects.c \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r200/radeon_buffer_objects.h b/src/mesa/drivers/dri/r200/radeon_buffer_objects.h
new file mode 120000
index 0000000000..2f134fd17b
--- /dev/null
+++ b/src/mesa/drivers/dri/r200/radeon_buffer_objects.h
@@ -0,0 +1 @@
+../radeon/radeon_buffer_objects.h \ No newline at end of file
diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c
index 794db8335a..782671bac0 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c
@@ -31,10 +31,29 @@
#include "../r300_reg.h"
+static void presub_string(char out[10], unsigned int inst)
+{
+ switch(inst & 0x600000){
+ case R300_ALU_SRCP_1_MINUS_2_SRC0:
+ sprintf(out, "bias");
+ break;
+ case R300_ALU_SRCP_SRC1_MINUS_SRC0:
+ sprintf(out, "sub");
+ break;
+ case R300_ALU_SRCP_SRC1_PLUS_SRC0:
+ sprintf(out, "add");
+ break;
+ case R300_ALU_SRCP_1_MINUS_SRC0:
+ sprintf(out, "inv ");
+ break;
+ }
+}
+
/* just some random things... */
-void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
+void r300FragmentProgramDump(struct radeon_compiler *c, void *user)
{
- struct r300_fragment_program_code *code = &c->code.r300;
+ struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c;
+ struct r300_fragment_program_code *code = &compiler->code->code.r300;
int n, i, j;
static int pc = 0;
@@ -97,8 +116,8 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
for (i = alu_offset;
i <= alu_offset + alu_end; ++i) {
- char srcc[3][10], dstc[20];
- char srca[3][10], dsta[20];
+ char srcc[4][10], dstc[20];
+ char srca[4][10], dsta[20];
char argc[3][20];
char arga[3][20];
char flags[5], tmp[10];
@@ -141,6 +160,9 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
flags);
strcat(dstc, tmp);
}
+ /* Presub */
+ presub_string(srcc[3], code->alu.inst[i].rgb_inst);
+ presub_string(srca[3], code->alu.inst[i].alpha_inst);
dsta[0] = 0;
if (code->alu.inst[i].alpha_addr & R300_ALU_DSTA_REG) {
@@ -159,11 +181,12 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
}
fprintf(stderr,
- "%3i: xyz: %3s %3s %3s -> %-20s (%08x)\n"
- " w: %3s %3s %3s -> %-20s (%08x)\n", i,
- srcc[0], srcc[1], srcc[2], dstc,
+ "%3i: xyz: %3s %3s %3s %5s-> %-20s (%08x)\n"
+ " w: %3s %3s %3s %5s-> %-20s (%08x)\n", i,
+ srcc[0], srcc[1], srcc[2], srcc[3], dstc,
code->alu.inst[i].rgb_addr, srca[0], srca[1],
- srca[2], dsta, code->alu.inst[i].alpha_addr);
+ srca[2], srca[3], dsta,
+ code->alu.inst[i].alpha_addr);
for (j = 0; j < 3; ++j) {
int regc = code->alu.inst[i].rgb_inst >> (j * 7);
@@ -193,6 +216,24 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
}
} else if (d < 15) {
sprintf(buf, "%s.www", srca[d - 12]);
+ } else if (d < 20 ) {
+ switch(d) {
+ case R300_ALU_ARGC_SRCP_XYZ:
+ sprintf(buf, "srcp.xyz");
+ break;
+ case R300_ALU_ARGC_SRCP_XXX:
+ sprintf(buf, "srcp.xxx");
+ break;
+ case R300_ALU_ARGC_SRCP_YYY:
+ sprintf(buf, "srcp.yyy");
+ break;
+ case R300_ALU_ARGC_SRCP_ZZZ:
+ sprintf(buf, "srcp.zzz");
+ break;
+ case R300_ALU_ARGC_SRCP_WWW:
+ sprintf(buf, "srcp.www");
+ break;
+ }
} else if (d == 20) {
sprintf(buf, "0.0");
} else if (d == 21) {
@@ -230,6 +271,21 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
'x' + (char)(d % 3));
} else if (d < 12) {
sprintf(buf, "%s.w", srca[d - 9]);
+ } else if (d < 16) {
+ switch(d) {
+ case R300_ALU_ARGA_SRCP_X:
+ sprintf(buf, "srcp.x");
+ break;
+ case R300_ALU_ARGA_SRCP_Y:
+ sprintf(buf, "srcp.y");
+ break;
+ case R300_ALU_ARGA_SRCP_Z:
+ sprintf(buf, "srcp.z");
+ break;
+ case R300_ALU_ARGA_SRCP_W:
+ sprintf(buf, "srcp.w");
+ break;
+ }
} else if (d == 16) {
sprintf(buf, "0.0");
} else if (d == 17) {
@@ -246,11 +302,14 @@ void r300FragmentProgramDump(struct rX00_fragment_program_code *c)
buf, (rega & 64) ? "|" : "");
}
- fprintf(stderr, " xyz: %8s %8s %8s op: %08x\n"
+ fprintf(stderr, " xyz: %8s %8s %8s op: %08x %s\n"
" w: %8s %8s %8s op: %08x\n",
argc[0], argc[1], argc[2],
- code->alu.inst[i].rgb_inst, arga[0], arga[1],
- arga[2], code->alu.inst[i].alpha_inst);
+ code->alu.inst[i].rgb_inst,
+ code->alu.inst[i].rgb_inst & R300_ALU_INSERT_NOP ?
+ "NOP" : "",
+ arga[0], arga[1],arga[2],
+ code->alu.inst[i].alpha_inst);
}
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h
index 8b755703be..0c88bab2f3 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h
@@ -37,8 +37,8 @@
#include "radeon_program.h"
-extern void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler);
+extern void r300BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user);
-extern void r300FragmentProgramDump(struct rX00_fragment_program_code *c);
+extern void r300FragmentProgramDump(struct radeon_compiler *c, void *user);
#endif
diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
index b27a683c39..3b2b06fc2b 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c
@@ -135,7 +135,7 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i
{
PROG_CODE;
- if (code->alu.length >= R300_PFS_MAX_ALU_INST) {
+ if (code->alu.length >= c->Base.max_alu_insts) {
error("Too many ALU instructions");
return 0;
}
@@ -164,6 +164,53 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i
code->alu.inst[ip].alpha_inst |= arg << (7*j);
}
+ /* Presubtract */
+ if (inst->RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
+ switch(inst->RGB.Src[RC_PAIR_PRESUB_SRC].Index) {
+ case RC_PRESUB_BIAS:
+ code->alu.inst[ip].rgb_inst |=
+ R300_ALU_SRCP_1_MINUS_2_SRC0;
+ break;
+ case RC_PRESUB_ADD:
+ code->alu.inst[ip].rgb_inst |=
+ R300_ALU_SRCP_SRC1_PLUS_SRC0;
+ break;
+ case RC_PRESUB_SUB:
+ code->alu.inst[ip].rgb_inst |=
+ R300_ALU_SRCP_SRC1_MINUS_SRC0;
+ break;
+ case RC_PRESUB_INV:
+ code->alu.inst[ip].rgb_inst |=
+ R300_ALU_SRCP_1_MINUS_SRC0;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (inst->Alpha.Src[RC_PAIR_PRESUB_SRC].Used) {
+ switch(inst->Alpha.Src[RC_PAIR_PRESUB_SRC].Index) {
+ case RC_PRESUB_BIAS:
+ code->alu.inst[ip].alpha_inst |=
+ R300_ALU_SRCP_1_MINUS_2_SRC0;
+ break;
+ case RC_PRESUB_ADD:
+ code->alu.inst[ip].alpha_inst |=
+ R300_ALU_SRCP_SRC1_PLUS_SRC0;
+ break;
+ case RC_PRESUB_SUB:
+ code->alu.inst[ip].alpha_inst |=
+ R300_ALU_SRCP_SRC1_MINUS_SRC0;
+ break;
+ case RC_PRESUB_INV:
+ code->alu.inst[ip].alpha_inst |=
+ R300_ALU_SRCP_1_MINUS_SRC0;
+ break;
+ default:
+ break;
+ }
+ }
+
if (inst->RGB.Saturate)
code->alu.inst[ip].rgb_inst |= R300_ALU_OUTC_CLAMP;
if (inst->Alpha.Saturate)
@@ -198,6 +245,8 @@ static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* i
emit->node_flags |= R300_W_OUT;
c->code->writes_depth = 1;
}
+ if (inst->Nop)
+ code->alu.inst[ip].rgb_inst |= R300_ALU_INSERT_NOP;
return 1;
}
@@ -328,8 +377,9 @@ static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst)
* Final compilation step: Turn the intermediate radeon_program into
* machine-readable instructions.
*/
-void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler)
+void r300BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user)
{
+ struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c;
struct r300_emit_state emit;
struct r300_fragment_program_code *code = &compiler->code->code.r300;
diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
index 5d5de2f1b2..caa48fe478 100644
--- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
+++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c
@@ -44,25 +44,25 @@ struct swizzle_data {
unsigned int hash; /**< swizzle value this matches */
unsigned int base; /**< base value for hw swizzle */
unsigned int stride; /**< difference in base between arg0/1/2 */
+ unsigned int srcp_stride; /**< difference in base between arg0/scrp */
};
static const struct swizzle_data native_swizzles[] = {
- {MAKE_SWZ3(X, Y, Z), R300_ALU_ARGC_SRC0C_XYZ, 4},
- {MAKE_SWZ3(X, X, X), R300_ALU_ARGC_SRC0C_XXX, 4},
- {MAKE_SWZ3(Y, Y, Y), R300_ALU_ARGC_SRC0C_YYY, 4},
- {MAKE_SWZ3(Z, Z, Z), R300_ALU_ARGC_SRC0C_ZZZ, 4},
- {MAKE_SWZ3(W, W, W), R300_ALU_ARGC_SRC0A, 1},
- {MAKE_SWZ3(Y, Z, X), R300_ALU_ARGC_SRC0C_YZX, 1},
- {MAKE_SWZ3(Z, X, Y), R300_ALU_ARGC_SRC0C_ZXY, 1},
- {MAKE_SWZ3(W, Z, Y), R300_ALU_ARGC_SRC0CA_WZY, 1},
- {MAKE_SWZ3(ONE, ONE, ONE), R300_ALU_ARGC_ONE, 0},
- {MAKE_SWZ3(ZERO, ZERO, ZERO), R300_ALU_ARGC_ZERO, 0},
- {MAKE_SWZ3(HALF, HALF, HALF), R300_ALU_ARGC_HALF, 0}
+ {MAKE_SWZ3(X, Y, Z), R300_ALU_ARGC_SRC0C_XYZ, 4, 15},
+ {MAKE_SWZ3(X, X, X), R300_ALU_ARGC_SRC0C_XXX, 4, 15},
+ {MAKE_SWZ3(Y, Y, Y), R300_ALU_ARGC_SRC0C_YYY, 4, 15},
+ {MAKE_SWZ3(Z, Z, Z), R300_ALU_ARGC_SRC0C_ZZZ, 4, 15},
+ {MAKE_SWZ3(W, W, W), R300_ALU_ARGC_SRC0A, 1, 7},
+ {MAKE_SWZ3(Y, Z, X), R300_ALU_ARGC_SRC0C_YZX, 1, 0},
+ {MAKE_SWZ3(Z, X, Y), R300_ALU_ARGC_SRC0C_ZXY, 1, 0},
+ {MAKE_SWZ3(W, Z, Y), R300_ALU_ARGC_SRC0CA_WZY, 1, 0},
+ {MAKE_SWZ3(ONE, ONE, ONE), R300_ALU_ARGC_ONE, 0, 0},
+ {MAKE_SWZ3(ZERO, ZERO, ZERO), R300_ALU_ARGC_ZERO, 0, 0},
+ {MAKE_SWZ3(HALF, HALF, HALF), R300_ALU_ARGC_HALF, 0, 0}
};
static const int num_native_swizzles = sizeof(native_swizzles)/sizeof(native_swizzles[0]);
-
/**
* Find a native RGB swizzle that matches the given swizzle.
* Returns 0 if none found.
@@ -205,7 +205,11 @@ unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle)
return 0;
}
- return sd->base + src*sd->stride;
+ if (src == RC_PAIR_PRESUB_SRC) {
+ return sd->base + sd->srcp_stride;
+ } else {
+ return sd->base + src*sd->stride;
+ }
}
@@ -215,6 +219,9 @@ unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle)
*/
unsigned int r300FPTranslateAlphaSwizzle(unsigned int src, unsigned int swizzle)
{
+ if (src == RC_PAIR_PRESUB_SRC) {
+ return R300_ALU_ARGA_SRCP_X + swizzle;
+ }
if (swizzle < 3)
return swizzle + 3*src;
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
index 8613ec5109..4793f33577 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c
@@ -47,8 +47,9 @@ static void dataflow_outputs_mark_use(void * userdata, void * data,
callback(data, c->OutputDepth, RC_MASK_W);
}
-static void rewrite_depth_out(struct r300_fragment_program_compiler * c)
+static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
{
+ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
struct rc_instruction *rci;
for (rci = c->Base.Program.Instructions.Next; rci != &c->Base.Program.Instructions; rci = rci->Next) {
@@ -89,157 +90,69 @@ static void rewrite_depth_out(struct r300_fragment_program_compiler * c)
}
}
-static void debug_program_log(struct r300_fragment_program_compiler* c, const char * where)
-{
- if (c->Base.Debug) {
- fprintf(stderr, "Fragment Program: %s\n", where);
- rc_print_program(&c->Base.Program);
- }
-}
-
void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
{
- struct emulate_loop_state loop_state;
-
- rewrite_depth_out(c);
-
- /* This transformation needs to be done before any of the IF
- * instructions are modified. */
- radeonTransformKILP(&c->Base);
-
- debug_program_log(c, "before compilation");
-
- if (c->Base.is_r500){
- rc_unroll_loops(&c->Base, R500_PFS_MAX_INST);
- debug_program_log(c, "after unroll loops");
- }
- else{
- rc_transform_loops(&c->Base, &loop_state, -1);
- debug_program_log(c, "after transform loops");
-
- rc_emulate_branches(&c->Base);
- debug_program_log(c, "after emulate branches");
- }
-
- if (c->Base.is_r500) {
- struct radeon_program_transformation transformations[] = {
- { &r500_transform_IF, 0 },
- { &radeonTransformALU, 0 },
- { &radeonTransformDeriv, 0 },
- { &radeonTransformTrigScale, 0 }
- };
- radeonLocalTransform(&c->Base, 4, transformations);
+ int is_r500 = c->Base.is_r500;
+ int kill_consts = c->Base.remove_unused_constants;
+ int opt = !c->Base.disable_optimizations;
- debug_program_log(c, "after native rewrite part 1");
-
- c->Base.SwizzleCaps = &r500_swizzle_caps;
- } else {
- struct radeon_program_transformation transformations[] = {
- { &radeonTransformALU, 0 },
- { &radeonTransformTrigSimple, 0 }
- };
- radeonLocalTransform(&c->Base, 2, transformations);
-
- debug_program_log(c, "after native rewrite part 1");
-
- c->Base.SwizzleCaps = &r300_swizzle_caps;
- }
-
- /* Run the common transformations too.
- * Remember, lowering comes last! */
- struct radeon_program_transformation common_transformations[] = {
+ /* Lists of instruction transformations. */
+ struct radeon_program_transformation rewrite_tex[] = {
{ &radeonTransformTEX, c },
+ { 0, 0 }
};
- radeonLocalTransform(&c->Base, 1, common_transformations);
-
- common_transformations[0].function = &radeonTransformALU;
- radeonLocalTransform(&c->Base, 1, common_transformations);
-
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after native rewrite part 2");
-
- rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_use, c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after deadcode");
-
- if(!c->Base.is_r500){
- rc_emulate_loops(&loop_state, R300_PFS_MAX_ALU_INST);
- debug_program_log(c, "after emulate loops");
- }
- rc_optimize(&c->Base);
-
- debug_program_log(c, "after dataflow optimize");
-
- rc_dataflow_swizzles(&c->Base);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after dataflow passes");
-
- if (c->Base.remove_unused_constants) {
- rc_remove_unused_constants(&c->Base,
- &c->code->constants_remap_table);
+ struct radeon_program_transformation native_rewrite_r500[] = {
+ { &r500_transform_IF, 0 },
+ { &radeonTransformALU, 0 },
+ { &radeonTransformDeriv, 0 },
+ { &radeonTransformTrigScale, 0 },
+ { 0, 0 }
+ };
- debug_program_log(c, "after constants cleanup");
- }
+ struct radeon_program_transformation native_rewrite_r300[] = {
+ { &radeonTransformALU, 0 },
+ { &r300_transform_trig_simple, 0 },
+ { 0, 0 }
+ };
- if(!c->Base.is_r500) {
+ /* List of compiler passes. */
+ struct radeon_compiler_pass fs_list[] = {
+ /* NAME DUMP PREDICATE FUNCTION PARAM */
+ {"rewrite depth out", 1, 1, rc_rewrite_depth_out, NULL},
+ /* This transformation needs to be done before any of the IF
+ * instructions are modified. */
+ {"transform KILP", 1, 1, rc_transform_KILP, NULL},
+ {"unroll loops", 1, is_r500, rc_unroll_loops, NULL},
+ {"transform loops", 1, !is_r500, rc_transform_loops, NULL},
+ {"emulate branches", 1, !is_r500, rc_emulate_branches, NULL},
+ {"transform TEX", 1, 1, rc_local_transform, rewrite_tex},
+ {"native rewrite", 1, is_r500, rc_local_transform, native_rewrite_r500},
+ {"native rewrite", 1, !is_r500, rc_local_transform, native_rewrite_r300},
+ {"deadcode", 1, opt, rc_dataflow_deadcode, dataflow_outputs_mark_use},
+ {"emulate loops", 1, !is_r500, rc_emulate_loops, NULL},
+ {"dataflow optimize", 1, opt, rc_optimize, NULL},
+ {"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL},
+ {"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
/* This pass makes it easier for the scheduler to group TEX
* instructions and reduces the chances of creating too
* many texture indirections.*/
- rc_rename_regs(&c->Base);
- if (c->Base.Error)
- return;
- debug_program_log(c, "after register rename");
- }
-
- rc_pair_translate(c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after pair translate");
-
- rc_pair_schedule(c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after pair scheduling");
-
- rc_pair_regalloc(c, c->Base.max_temp_regs);
-
- if (c->Base.Error)
- return;
+ {"register rename", 1, !is_r500, rc_rename_regs, NULL},
+ {"pair translate", 1, 1, rc_pair_translate, NULL},
+ {"pair scheduling", 1, 1, rc_pair_schedule, NULL},
+ {"register allocation", 1, opt, rc_pair_regalloc, NULL},
+ {"dumb register allocation", 1, !opt, rc_pair_regalloc_inputs_only, NULL},
+ {"final code validation", 0, 1, rc_validate_final_shader, NULL},
+ {"machine code generation", 0, is_r500, r500BuildFragmentProgramHwCode, NULL},
+ {"machine code generation", 0, !is_r500, r300BuildFragmentProgramHwCode, NULL},
+ {"dump machine code", 0, is_r500 && c->Base.Debug, r500FragmentProgramDump, NULL},
+ {"dump machine code", 0, !is_r500 && c->Base.Debug, r300FragmentProgramDump, NULL},
+ {NULL, 0, 0, NULL, NULL}
+ };
- debug_program_log(c, "after register allocation");
+ c->Base.SwizzleCaps = c->Base.is_r500 ? &r500_swizzle_caps : &r300_swizzle_caps;
- if (c->Base.is_r500) {
- r500BuildFragmentProgramHwCode(c);
- } else {
- r300BuildFragmentProgramHwCode(c);
- }
+ rc_run_compiler(&c->Base, fs_list, "Fragment Program");
rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
-
- if (c->Base.Debug) {
- if (c->Base.is_r500) {
- r500FragmentProgramDump(c->code);
- } else {
- r300FragmentProgramDump(c->code);
- }
- }
-
- /* Check the number of constants. */
- if (!c->Base.Error) {
- unsigned max = c->Base.is_r500 ? R500_PFS_NUM_CONST_REGS : R300_PFS_NUM_CONST_REGS;
-
- if (c->Base.Program.Constants.Count > max) {
- rc_error(&c->Base, "Too many constants. Max: %i, Got: %i\n",
- max, c->Base.Program.Constants.Count);
- }
- }
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
index b05b3aabf3..08785716db 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c
@@ -391,7 +391,7 @@ static void ei_if(struct r300_vertex_program_compiler * compiler,
/* Reserve a temporary to use as our predicate stack counter, if we
* don't already have one. */
if (!compiler->PredicateMask) {
- unsigned int writemasks[R300_VS_MAX_TEMPS];
+ unsigned int writemasks[RC_REGISTER_MAX_INDEX];
memset(writemasks, 0, sizeof(writemasks));
struct rc_instruction * inst;
unsigned int i;
@@ -400,7 +400,7 @@ static void ei_if(struct r300_vertex_program_compiler * compiler,
inst = inst->Next) {
rc_for_all_writes_mask(inst, mark_write, writemasks);
}
- for(i = 0; i < R300_VS_MAX_TEMPS; i++) {
+ for(i = 0; i < compiler->Base.max_temp_regs; i++) {
unsigned int mask = ~writemasks[i] & RC_MASK_XYZW;
/* Only the W component can be used fo the predicate
* stack counter. */
@@ -410,7 +410,7 @@ static void ei_if(struct r300_vertex_program_compiler * compiler,
break;
}
}
- if (i == R300_VS_MAX_TEMPS) {
+ if (i == compiler->Base.max_temp_regs) {
rc_error(&compiler->Base, "No free temporary to use for"
" predicate stack counter.\n");
return;
@@ -462,8 +462,9 @@ static void ei_endif(struct r300_vertex_program_compiler *compiler,
inst[3] = 0;
}
-static void translate_vertex_program(struct r300_vertex_program_compiler * compiler)
+static void translate_vertex_program(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
struct rc_instruction *rci;
struct loop * loops = NULL;
@@ -474,18 +475,20 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
compiler->code->pos_end = 0; /* Not supported yet */
compiler->code->length = 0;
+ compiler->code->num_temporaries = 0;
compiler->SetHwInputOutput(compiler);
for(rci = compiler->Base.Program.Instructions.Next; rci != &compiler->Base.Program.Instructions; rci = rci->Next) {
struct rc_sub_instruction *vpi = &rci->U.I;
unsigned int *inst = compiler->code->body.d + compiler->code->length;
+ const struct rc_opcode_info *info = rc_get_opcode_info(vpi->Opcode);
/* Skip instructions writing to non-existing destination */
if (!valid_dst(compiler->code, &vpi->DstReg))
continue;
- if (rc_get_opcode_info(vpi->Opcode)->HasDstReg) {
+ if (info->HasDstReg) {
/* Relative addressing of destination operands is not supported yet. */
if (vpi->DstReg.RelAddr) {
rc_error(&compiler->Base, "Vertex program does not support relative "
@@ -500,8 +503,7 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
}
}
- if (compiler->code->length >= R500_VS_MAX_ALU_DWORDS ||
- (compiler->code->length >= R300_VS_MAX_ALU_DWORDS && !compiler->Base.is_r500)) {
+ if (compiler->code->length >= c->max_alu_insts * 4) {
rc_error(&compiler->Base, "Vertex program has too many instructions\n");
return;
}
@@ -607,7 +609,7 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
}
default:
- rc_error(&compiler->Base, "Unknown opcode %s\n", rc_get_opcode_info(vpi->Opcode)->Name);
+ rc_error(&compiler->Base, "Unknown opcode %s\n", info->Name);
return;
}
@@ -624,6 +626,25 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi
<< PVS_DST_PRED_SENSE_SHIFT);
}
+ /* Update the number of temporaries. */
+ if (info->HasDstReg && vpi->DstReg.File == RC_FILE_TEMPORARY &&
+ vpi->DstReg.Index >= compiler->code->num_temporaries)
+ compiler->code->num_temporaries = vpi->DstReg.Index + 1;
+
+ for (unsigned i = 0; i < info->NumSrcRegs; i++)
+ if (vpi->SrcReg[i].File == RC_FILE_TEMPORARY &&
+ vpi->SrcReg[i].Index >= compiler->code->num_temporaries)
+ compiler->code->num_temporaries = vpi->SrcReg[i].Index + 1;
+
+ if (compiler->PredicateMask)
+ if (compiler->PredicateIndex >= compiler->code->num_temporaries)
+ compiler->code->num_temporaries = compiler->PredicateIndex + 1;
+
+ if (compiler->code->num_temporaries > compiler->Base.max_temp_regs) {
+ rc_error(&compiler->Base, "Too many temporaries.\n");
+ return;
+ }
+
compiler->code->length += 4;
if (compiler->Base.Error)
@@ -637,17 +658,21 @@ struct temporary_allocation {
struct rc_instruction * LastRead;
};
-static void allocate_temporary_registers(struct r300_vertex_program_compiler * compiler)
+static void allocate_temporary_registers(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler *compiler = (struct r300_vertex_program_compiler*)c;
struct rc_instruction *inst;
struct rc_instruction *end_loop = NULL;
unsigned int num_orig_temps = 0;
- char hwtemps[R300_VS_MAX_TEMPS];
+ char hwtemps[RC_REGISTER_MAX_INDEX];
struct temporary_allocation * ta;
unsigned int i, j;
+ struct rc_instruction *last_inst_src_reladdr = NULL;
memset(hwtemps, 0, sizeof(hwtemps));
+ rc_recompute_ips(c);
+
/* Pass 1: Count original temporaries. */
for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
@@ -666,9 +691,9 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c
}
}
}
- compiler->code->num_temporaries = num_orig_temps;
- /* Pass 2: If there is relative addressing of temporaries, we cannot change register indices. Give up. */
+ /* Pass 2: If there is relative addressing of dst temporaries, we cannot change register indices. Give up.
+ * For src temporaries, save the last instruction which uses relative addressing. */
for (inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) {
const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode);
@@ -679,12 +704,11 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c
for (i = 0; i < opcode->NumSrcRegs; ++i) {
if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY &&
inst->U.I.SrcReg[i].RelAddr) {
- return;
+ last_inst_src_reladdr = inst;
}
}
}
- compiler->code->num_temporaries = 0;
ta = (struct temporary_allocation*)memory_pool_malloc(&compiler->Base.Pool,
sizeof(struct temporary_allocation) * num_orig_temps);
memset(ta, 0, sizeof(struct temporary_allocation) * num_orig_temps);
@@ -718,9 +742,26 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c
}
for (i = 0; i < opcode->NumSrcRegs; ++i) {
- if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY)
- ta[inst->U.I.SrcReg[i].Index].LastRead =
- end_loop ? end_loop : inst;
+ if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) {
+ struct rc_instruction *last_read;
+
+ /* From "last_inst_src_reladdr", "end_loop", and "inst",
+ * select the instruction with the highest instruction index (IP).
+ * Note that "end_loop", if available, has always a higher index than "inst". */
+ if (last_inst_src_reladdr) {
+ if (end_loop) {
+ last_read = last_inst_src_reladdr->IP > end_loop->IP ?
+ last_inst_src_reladdr : end_loop;
+ } else {
+ last_read = last_inst_src_reladdr->IP > inst->IP ?
+ last_inst_src_reladdr : inst;
+ }
+ } else {
+ last_read = end_loop ? end_loop : inst;
+ }
+
+ ta[inst->U.I.SrcReg[i].Index].LastRead = last_read;
+ }
}
}
@@ -728,13 +769,15 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c
for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
- for (i = 0; i < opcode->NumSrcRegs; ++i) {
- if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) {
- unsigned int orig = inst->U.I.SrcReg[i].Index;
- inst->U.I.SrcReg[i].Index = ta[orig].HwTemp;
+ if (!last_inst_src_reladdr || last_inst_src_reladdr->IP < inst->IP) {
+ for (i = 0; i < opcode->NumSrcRegs; ++i) {
+ if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) {
+ unsigned int orig = inst->U.I.SrcReg[i].Index;
+ inst->U.I.SrcReg[i].Index = ta[orig].HwTemp;
- if (ta[orig].Allocated && inst == ta[orig].LastRead)
- hwtemps[ta[orig].HwTemp] = 0;
+ if (ta[orig].Allocated && inst == ta[orig].LastRead)
+ hwtemps[ta[orig].HwTemp] = 0;
+ }
}
}
@@ -743,19 +786,22 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c
unsigned int orig = inst->U.I.DstReg.Index;
if (!ta[orig].Allocated) {
- for(j = 0; j < R300_VS_MAX_TEMPS; ++j) {
+ for(j = 0; j < c->max_temp_regs; ++j) {
if (!hwtemps[j])
break;
}
- if (j >= R300_VS_MAX_TEMPS) {
- fprintf(stderr, "Out of hw temporaries\n");
+ if (j >= c->max_temp_regs) {
+ rc_error(c, "Too many temporaries\n");
+ return;
} else {
ta[orig].Allocated = 1;
- ta[orig].HwTemp = j;
- hwtemps[j] = 1;
-
- if (j >= compiler->code->num_temporaries)
- compiler->code->num_temporaries = j + 1;
+ if (last_inst_src_reladdr &&
+ last_inst_src_reladdr->IP > inst->IP) {
+ ta[orig].HwTemp = orig;
+ } else {
+ ta[orig].HwTemp = j;
+ }
+ hwtemps[ta[orig].HwTemp] = 1;
}
}
@@ -849,8 +895,9 @@ static int transform_source_conflicts(
return 1;
}
-static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler)
+static void rc_vs_add_artificial_outputs(struct radeon_compiler *c, void *user)
{
+ struct r300_vertex_program_compiler * compiler = (struct r300_vertex_program_compiler*)c;
int i;
for(i = 0; i < 32; ++i) {
@@ -926,8 +973,9 @@ static void transform_negative_addressing(struct r300_vertex_program_compiler *c
}
}
-static void rc_emulate_negative_addressing(struct r300_vertex_program_compiler *c)
+static void rc_emulate_negative_addressing(struct radeon_compiler *compiler, void *user)
{
+ struct r300_vertex_program_compiler * c = (struct r300_vertex_program_compiler*)compiler;
struct rc_instruction *inst, *lastARL = NULL;
int min_offset = 0;
@@ -962,145 +1010,72 @@ static void rc_emulate_negative_addressing(struct r300_vertex_program_compiler *
transform_negative_addressing(c, lastARL, inst, min_offset);
}
-static void debug_program_log(struct r300_vertex_program_compiler* c, const char * where)
-{
- if (c->Base.Debug) {
- fprintf(stderr, "Vertex Program: %s\n", where);
- rc_print_program(&c->Base.Program);
- }
-}
-
-
static struct rc_swizzle_caps r300_vertprog_swizzle_caps = {
.IsNative = &swizzle_is_native,
.Split = 0 /* should never be called */
};
-
void r3xx_compile_vertex_program(struct r300_vertex_program_compiler *c)
{
- struct emulate_loop_state loop_state;
+ int is_r500 = c->Base.is_r500;
+ int kill_consts = c->Base.remove_unused_constants;
+ int opt = !c->Base.disable_optimizations;
+
+ /* Lists of instruction transformations. */
+ struct radeon_program_transformation alu_rewrite_r500[] = {
+ { &r300_transform_vertex_alu, 0 },
+ { &r300_transform_trig_scale_vertex, 0 },
+ { 0, 0 }
+ };
+
+ struct radeon_program_transformation alu_rewrite_r300[] = {
+ { &r300_transform_vertex_alu, 0 },
+ { &r300_transform_trig_simple, 0 },
+ { 0, 0 }
+ };
+
+ /* Note: These passes have to be done seperately from ALU rewrite,
+ * otherwise non-native ALU instructions with source conflits
+ * or non-native modifiers will not be treated properly.
+ */
+ struct radeon_program_transformation emulate_modifiers[] = {
+ { &transform_nonnative_modifiers, 0 },
+ { 0, 0 }
+ };
+
+ struct radeon_program_transformation resolve_src_conflicts[] = {
+ { &transform_source_conflicts, 0 },
+ { 0, 0 }
+ };
+
+ /* List of compiler passes. */
+ struct radeon_compiler_pass vs_list[] = {
+ /* NAME DUMP PREDICATE FUNCTION PARAM */
+ {"add artificial outputs", 0, 1, rc_vs_add_artificial_outputs, NULL},
+ {"transform loops", 1, 1, rc_transform_loops, NULL},
+ {"emulate branches", 1, !is_r500, rc_emulate_branches, NULL},
+ {"emulate negative addressing", 1, 1, rc_emulate_negative_addressing, NULL},
+ {"native rewrite", 1, is_r500, rc_local_transform, alu_rewrite_r500},
+ {"native rewrite", 1, !is_r500, rc_local_transform, alu_rewrite_r300},
+ {"emulate modifiers", 1, !is_r500, rc_local_transform, emulate_modifiers},
+ {"deadcode", 1, opt, rc_dataflow_deadcode, dataflow_outputs_mark_used},
+ {"dataflow optimize", 1, opt, rc_optimize, NULL},
+ /* This pass must be done after optimizations. */
+ {"source conflict resolve", 1, 1, rc_local_transform, resolve_src_conflicts},
+ {"dataflow swizzles", 1, 1, rc_dataflow_swizzles, NULL},
+ {"register allocation", 1, opt, allocate_temporary_registers, NULL},
+ {"dead constants", 1, kill_consts, rc_remove_unused_constants, &c->code->constants_remap_table},
+ {"final code validation", 0, 1, rc_validate_final_shader, NULL},
+ {"machine code generation", 0, 1, translate_vertex_program, NULL},
+ {"dump machine code", 0,c->Base.Debug,r300_vertex_program_dump, NULL},
+ {NULL, 0, 0, NULL, NULL}
+ };
c->Base.SwizzleCaps = &r300_vertprog_swizzle_caps;
- addArtificialOutputs(c);
-
- debug_program_log(c, "before compilation");
-
- if (c->Base.is_r500)
- rc_transform_loops(&c->Base, &loop_state, R500_VS_MAX_ALU);
- else
- rc_transform_loops(&c->Base, &loop_state, R300_VS_MAX_ALU);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after emulate loops");
-
- if (!c->Base.is_r500) {
- rc_emulate_branches(&c->Base);
- if (c->Base.Error)
- return;
- debug_program_log(c, "after emulate branches");
- }
-
- rc_emulate_negative_addressing(c);
-
- debug_program_log(c, "after negative addressing emulation");
-
- if (c->Base.is_r500) {
- struct radeon_program_transformation transformations[] = {
- { &r300_transform_vertex_alu, 0 },
- { &r300_transform_trig_scale_vertex, 0 }
- };
- radeonLocalTransform(&c->Base, 2, transformations);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after native rewrite");
- } else {
- struct radeon_program_transformation transformations[] = {
- { &r300_transform_vertex_alu, 0 },
- { &radeonTransformTrigSimple, 0 }
- };
- radeonLocalTransform(&c->Base, 2, transformations);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after native rewrite");
-
- /* Note: This pass has to be done seperately from ALU rewrite,
- * because it needs to check every instruction.
- */
- struct radeon_program_transformation transformations2[] = {
- { &transform_nonnative_modifiers, 0 },
- };
- radeonLocalTransform(&c->Base, 1, transformations2);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after emulate modifiers");
- }
-
- {
- /* Note: This pass has to be done seperately from ALU rewrite,
- * otherwise non-native ALU instructions with source conflits
- * will not be treated properly.
- */
- struct radeon_program_transformation transformations[] = {
- { &transform_source_conflicts, 0 },
- };
- radeonLocalTransform(&c->Base, 1, transformations);
- if (c->Base.Error)
- return;
- }
-
- debug_program_log(c, "after source conflict resolve");
-
- rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_used, c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after deadcode");
-
- rc_dataflow_swizzles(&c->Base);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after dataflow");
-
- allocate_temporary_registers(c);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after register allocation");
-
- if (c->Base.remove_unused_constants) {
- rc_remove_unused_constants(&c->Base,
- &c->code->constants_remap_table);
- if (c->Base.Error)
- return;
-
- debug_program_log(c, "after constants cleanup");
- }
-
- translate_vertex_program(c);
- if (c->Base.Error)
- return;
-
- rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
+ rc_run_compiler(&c->Base, vs_list, "Vertex Program");
c->code->InputsRead = c->Base.Program.InputsRead;
c->code->OutputsWritten = c->Base.Program.OutputsWritten;
-
- if (c->Base.Debug) {
- fprintf(stderr, "Final vertex program code:\n");
- r300_vertex_program_dump(c);
- }
-
- /* Check the number of constants. */
- if (!c->Base.Error &&
- c->Base.Program.Constants.Count > 256) {
- rc_error(&c->Base, "Too many constants. Max: 256, Got: %i\n",
- c->Base.Program.Constants.Count);
- }
+ rc_constants_copy(&c->code->constants, &c->Base.Program.Constants);
}
diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
index e6009338e2..2bc0a87eed 100644
--- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
+++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c
@@ -166,12 +166,15 @@ static void r300_vs_src_dump(uint32_t src)
r300_vs_swiz_debug[(src >> 22) & 0x7]);
}
-void r300_vertex_program_dump(struct r300_vertex_program_compiler * c)
+void r300_vertex_program_dump(struct radeon_compiler *compiler, void *user)
{
+ struct r300_vertex_program_compiler *c = (struct r300_vertex_program_compiler*)compiler;
struct r300_vertex_program_code * vs = c->code;
unsigned instrcount = vs->length / 4;
unsigned i;
+ fprintf(stderr, "Final vertex program code:\n");
+
for(i = 0; i < instrcount; i++) {
unsigned offset = i*4;
unsigned src;
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
index 80a120497e..627ce374ef 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c
@@ -247,9 +247,10 @@ static char *to_texop(int val)
return NULL;
}
-void r500FragmentProgramDump(struct rX00_fragment_program_code *c)
+void r500FragmentProgramDump(struct radeon_compiler *c, void *user)
{
- struct r500_fragment_program_code *code = &c->code.r500;
+ struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c;
+ struct r500_fragment_program_code *code = &compiler->code->code.r500;
fprintf(stderr, "R500 Fragment Program:\n--------\n");
int n, i;
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h
index 34173351f8..1e665e2764 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h
@@ -36,11 +36,9 @@
#include "radeon_compiler.h"
#include "radeon_swizzle.h"
-struct emulate_loop_state;
+extern void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user);
-extern void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler);
-
-extern void r500FragmentProgramDump(struct rX00_fragment_program_code *c);
+extern void r500FragmentProgramDump(struct radeon_compiler *c, void *user);
extern struct rc_swizzle_caps r500_swizzle_caps;
diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
index 9b60e30f58..54cff9169a 100644
--- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
+++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c
@@ -63,7 +63,7 @@ struct branch_info {
int Endif;
};
-struct loop_info {
+struct r500_loop_info {
int BgnLoop;
int BranchDepth;
@@ -84,7 +84,7 @@ struct emit_state {
unsigned int CurrentBranchDepth;
unsigned int BranchesReserved;
- struct loop_info * Loops;
+ struct r500_loop_info * Loops;
unsigned int CurrentLoopDepth;
unsigned int LoopsReserved;
@@ -229,7 +229,7 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
{
PROG_CODE;
- if (code->inst_end >= 511) {
+ if (code->inst_end >= c->Base.max_alu_insts-1) {
error("emit_alu: Too many instructions");
return;
}
@@ -260,6 +260,9 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
code->inst[ip].inst0 |= (inst->RGB.WriteMask << 11) | (inst->Alpha.WriteMask << 14);
code->inst[ip].inst0 |= (inst->RGB.OutputWriteMask << 15) | (inst->Alpha.OutputWriteMask << 18);
+ if (inst->Nop) {
+ code->inst[ip].inst0 |= R500_INST_NOP;
+ }
if (inst->Alpha.DepthWriteMask) {
code->inst[ip].inst4 |= R500_ALPHA_W_OMASK;
c->code->writes_depth = 1;
@@ -275,6 +278,40 @@ static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair
if (inst->Alpha.Saturate)
code->inst[ip].inst0 |= R500_INST_ALPHA_CLAMP;
+ /* Set the presubtract operation. */
+ switch(inst->RGB.Src[RC_PAIR_PRESUB_SRC].Index) {
+ case RC_PRESUB_BIAS:
+ code->inst[ip].inst1 |= R500_RGB_SRCP_OP_1_MINUS_2RGB0;
+ break;
+ case RC_PRESUB_SUB:
+ code->inst[ip].inst1 |= R500_RGB_SRCP_OP_RGB1_MINUS_RGB0;
+ break;
+ case RC_PRESUB_ADD:
+ code->inst[ip].inst1 |= R500_RGB_SRCP_OP_RGB1_PLUS_RGB0;
+ break;
+ case RC_PRESUB_INV:
+ code->inst[ip].inst1 |= R500_RGB_SRCP_OP_1_MINUS_RGB0;
+ break;
+ default:
+ break;
+ }
+ switch(inst->Alpha.Src[RC_PAIR_PRESUB_SRC].Index) {
+ case RC_PRESUB_BIAS:
+ code->inst[ip].inst2 |= R500_ALPHA_SRCP_OP_1_MINUS_2A0;
+ break;
+ case RC_PRESUB_SUB:
+ code->inst[ip].inst2 |= R500_ALPHA_SRCP_OP_A1_MINUS_A0;
+ break;
+ case RC_PRESUB_ADD:
+ code->inst[ip].inst2 |= R500_ALPHA_SRCP_OP_A1_PLUS_A0;
+ break;
+ case RC_PRESUB_INV:
+ code->inst[ip].inst2 |= R500_ALPHA_SRCP_OP_1_MINUS_A0;
+ break;
+ default:
+ break;
+ }
+
code->inst[ip].inst1 |= R500_RGB_ADDR0(use_source(code, inst->RGB.Src[0]));
code->inst[ip].inst1 |= R500_RGB_ADDR1(use_source(code, inst->RGB.Src[1]));
code->inst[ip].inst1 |= R500_RGB_ADDR2(use_source(code, inst->RGB.Src[2]));
@@ -322,7 +359,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst
{
PROG_CODE;
- if (code->inst_end >= 511) {
+ if (code->inst_end >= c->Base.max_alu_insts-1) {
error("emit_tex: Too many instructions");
return 0;
}
@@ -370,7 +407,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst
static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst)
{
- if (s->Code->inst_end >= 511) {
+ if (s->Code->inst_end >= s->C->max_alu_insts-1) {
rc_error(s->C, "emit_tex: Too many instructions");
return;
}
@@ -387,13 +424,13 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst
switch(inst->U.I.Opcode){
struct branch_info * branch;
- struct loop_info * loop;
+ struct r500_loop_info * loop;
case RC_OPCODE_BGNLOOP:
- memory_pool_array_reserve(&s->C->Pool, struct loop_info,
+ memory_pool_array_reserve(&s->C->Pool, struct r500_loop_info,
s->Loops, s->CurrentLoopDepth, s->LoopsReserved, 1);
loop = &s->Loops[s->CurrentLoopDepth++];
- memset(loop, 0, sizeof(struct loop_info));
+ memset(loop, 0, sizeof(struct r500_loop_info));
loop->BranchDepth = s->CurrentBranchDepth;
loop->BgnLoop = newip;
@@ -546,8 +583,9 @@ static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst
}
}
-void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler)
+void r500BuildFragmentProgramHwCode(struct radeon_compiler *c, void *user)
{
+ struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)c;
struct emit_state s;
struct r500_fragment_program_code *code = &compiler->code->code.r500;
@@ -577,7 +615,7 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi
}
}
- if (code->max_temp_idx >= 128)
+ if (code->max_temp_idx >= compiler->Base.max_temp_regs)
rc_error(&compiler->Base, "Too many hardware temporaries used");
if (compiler->Base.Error)
@@ -587,7 +625,7 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi
(code->inst[code->inst_end].inst0 & R500_INST_TYPE_MASK) != R500_INST_TYPE_OUT) {
/* This may happen when dead-code elimination is disabled or
* when most of the fragment program logic is leading to a KIL */
- if (code->inst_end >= 511) {
+ if (code->inst_end >= compiler->Base.max_alu_insts-1) {
rc_error(&compiler->Base, "Introducing fake OUT: Too many instructions");
return;
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
index 935dc9b0a8..b410b2daf4 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
@@ -350,3 +350,36 @@ void rc_transform_fragment_face(struct radeon_compiler *c, unsigned face)
}
}
}
+
+/* Executes a list of compiler passes given in the parameter 'list'. */
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
+ const char *shader_name)
+{
+ if (c->Debug) {
+ fprintf(stderr, "%s: before compilation\n", shader_name);
+ rc_print_program(&c->Program);
+ }
+
+ for (unsigned i = 0; list[i].name; i++) {
+ if (list[i].predicate) {
+ list[i].run(c, list[i].user);
+
+ if (c->Error)
+ return;
+
+ if (c->Debug && list[i].dump) {
+ fprintf(stderr, "%s: after '%s'\n", shader_name, list[i].name);
+ rc_print_program(&c->Program);
+ }
+ }
+ }
+}
+
+void rc_validate_final_shader(struct radeon_compiler *c, void *user)
+{
+ /* Check the number of constants. */
+ if (c->Program.Constants.Count > c->max_constants) {
+ rc_error(c, "Too many constants. Max: 256, Got: %i\n",
+ c->Program.Constants.Count);
+ }
+}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
index 5155b912e1..6d96ac9fdd 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h
@@ -28,6 +28,7 @@
#include "memory_pool.h"
#include "radeon_code.h"
#include "radeon_program.h"
+#include "radeon_emulate_loops.h"
struct rc_swizzle_caps;
@@ -40,7 +41,12 @@ struct radeon_compiler {
/* Hardware specification. */
unsigned is_r500:1;
+ unsigned has_half_swizzles:1;
+ unsigned has_presub:1;
+ unsigned disable_optimizations:1;
unsigned max_temp_regs;
+ unsigned max_constants;
+ int max_alu_insts;
/* Whether to remove unused constants and empty holes in constant space. */
unsigned remove_unused_constants:1;
@@ -52,6 +58,8 @@ struct radeon_compiler {
/*@{*/
struct rc_swizzle_caps * SwizzleCaps;
/*@}*/
+
+ struct emulate_loop_state loop_state;
};
void rc_init(struct radeon_compiler * c);
@@ -106,7 +114,6 @@ struct r300_fragment_program_compiler {
void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c);
-
struct r300_vertex_program_compiler {
struct radeon_compiler Base;
struct r300_vertex_program_code *code;
@@ -120,6 +127,19 @@ struct r300_vertex_program_compiler {
};
void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* c);
-void r300_vertex_program_dump(struct r300_vertex_program_compiler * c);
+void r300_vertex_program_dump(struct radeon_compiler *compiler, void *user);
+
+struct radeon_compiler_pass {
+ const char *name; /* Name of the pass. */
+ int dump; /* Dump the program if Debug == 1? */
+ int predicate; /* Run this pass? */
+ void (*run)(struct radeon_compiler *c, void *user); /* The main entrypoint. */
+ void *user; /* Optional parameter which is passed to the run function. */
+};
+
+/* Executes a list of compiler passes given in the parameter 'list'. */
+void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list,
+ const char *shader_name);
+void rc_validate_final_shader(struct radeon_compiler *c, void *user);
#endif /* RADEON_COMPILER_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
index 0e6c62541f..e73700f84a 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
@@ -29,6 +29,25 @@
#include "radeon_program.h"
+static void reads_normal_callback(
+ rc_read_write_chan_fn cb,
+ struct rc_instruction * fullinst,
+ struct rc_src_register src,
+ void * userdata)
+{
+ unsigned int refmask = 0;
+ unsigned int chan;
+ for(chan = 0; chan < 4; chan++) {
+ refmask |= 1 << GET_SWZ(src.Swizzle, chan);
+ }
+ refmask &= RC_MASK_XYZW;
+
+ if (refmask)
+ cb(userdata, fullinst, src.File, src.Index, refmask);
+
+ if (refmask && src.RelAddr)
+ cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X);
+}
static void reads_normal(struct rc_instruction * fullinst, rc_read_write_chan_fn cb, void * userdata)
{
@@ -36,47 +55,81 @@ static void reads_normal(struct rc_instruction * fullinst, rc_read_write_chan_fn
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
- unsigned int refmask = 0;
if (inst->SrcReg[src].File == RC_FILE_NONE)
return;
- for(unsigned int chan = 0; chan < 4; ++chan)
- refmask |= 1 << GET_SWZ(inst->SrcReg[src].Swizzle, chan);
-
- refmask &= RC_MASK_XYZW;
-
- if (refmask)
- cb(userdata, fullinst, inst->SrcReg[src].File, inst->SrcReg[src].Index, refmask);
-
- if (refmask && inst->SrcReg[src].RelAddr)
- cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X);
+ if (inst->SrcReg[src].File == RC_FILE_PRESUB) {
+ unsigned int i;
+ unsigned int srcp_regs = rc_presubtract_src_reg_count(
+ inst->PreSub.Opcode);
+ for( i = 0; i < srcp_regs; i++) {
+ reads_normal_callback(cb, fullinst,
+ inst->PreSub.SrcReg[i],
+ userdata);
+ }
+ } else {
+ reads_normal_callback(cb, fullinst,
+ inst->SrcReg[src], userdata);
+ }
}
}
-static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata)
+static void pair_get_src_refmasks(unsigned int * refmasks,
+ struct rc_pair_instruction * inst,
+ unsigned int swz, unsigned int src)
{
- struct rc_pair_instruction * inst = &fullinst->U.P;
- unsigned int refmasks[3] = { 0, 0, 0 };
-
- if (inst->RGB.Opcode != RC_OPCODE_NOP) {
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->RGB.Opcode);
+ if (swz >= 4)
+ return;
+
+ if (swz == RC_SWIZZLE_X || swz == RC_SWIZZLE_Y || swz == RC_SWIZZLE_Z) {
+ if(src == RC_PAIR_PRESUB_SRC) {
+ unsigned int i;
+ int srcp_regs =
+ rc_presubtract_src_reg_count(
+ inst->RGB.Src[src].Index);
+ for(i = 0; i < srcp_regs; i++) {
+ refmasks[i] |= 1 << swz;
+ }
+ }
+ else {
+ refmasks[src] |= 1 << swz;
+ }
+ }
- for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) {
- for(unsigned int chan = 0; chan < 3; ++chan) {
- unsigned int swz = GET_SWZ(inst->RGB.Arg[arg].Swizzle, chan);
- if (swz < 4)
- refmasks[inst->RGB.Arg[arg].Source] |= 1 << swz;
+ if (swz == RC_SWIZZLE_W) {
+ if (src == RC_PAIR_PRESUB_SRC) {
+ unsigned int i;
+ int srcp_regs = rc_presubtract_src_reg_count(
+ inst->Alpha.Src[src].Index);
+ for(i = 0; i < srcp_regs; i++) {
+ refmasks[i] |= 1 << swz;
}
}
+ else {
+ refmasks[src] |= 1 << swz;
+ }
}
+}
- if (inst->Alpha.Opcode != RC_OPCODE_NOP) {
- const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Alpha.Opcode);
+static void reads_pair(struct rc_instruction * fullinst, rc_read_write_mask_fn cb, void * userdata)
+{
+ struct rc_pair_instruction * inst = &fullinst->U.P;
+ unsigned int refmasks[3] = { 0, 0, 0 };
- for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) {
- if (inst->Alpha.Arg[arg].Swizzle < 4)
- refmasks[inst->Alpha.Arg[arg].Source] |= 1 << inst->Alpha.Arg[arg].Swizzle;
+ unsigned int arg;
+
+ for(arg = 0; arg < 3; ++arg) {
+ unsigned int chan;
+ for(chan = 0; chan < 3; ++chan) {
+ unsigned int swz_rgb =
+ GET_SWZ(inst->RGB.Arg[arg].Swizzle, chan);
+ unsigned int swz_alpha =
+ GET_SWZ(inst->Alpha.Arg[arg].Swizzle, chan);
+ pair_get_src_refmasks(refmasks, inst, swz_rgb,
+ inst->RGB.Arg[arg].Source);
+ pair_get_src_refmasks(refmasks, inst, swz_alpha,
+ inst->Alpha.Arg[arg].Source);
}
}
@@ -212,10 +265,25 @@ static void remap_normal_instruction(struct rc_instruction * fullinst,
rc_register_file file = inst->SrcReg[src].File;
unsigned int index = inst->SrcReg[src].Index;
- cb(userdata, fullinst, &file, &index);
+ if (file == RC_FILE_PRESUB) {
+ unsigned int i;
+ unsigned int srcp_srcs = rc_presubtract_src_reg_count(
+ inst->PreSub.Opcode);
+ for(i = 0; i < srcp_srcs; i++) {
+ file = inst->PreSub.SrcReg[i].File;
+ index = inst->PreSub.SrcReg[i].Index;
+ cb(userdata, fullinst, &file, &index);
+ inst->PreSub.SrcReg[i].File = file;
+ inst->PreSub.SrcReg[i].Index = index;
+ }
- inst->SrcReg[src].File = file;
- inst->SrcReg[src].Index = index;
+ }
+ else {
+ cb(userdata, fullinst, &file, &index);
+
+ inst->SrcReg[src].File = file;
+ inst->SrcReg[src].Index = index;
+ }
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
index 60a6e192a9..795d9cc2b6 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h
@@ -61,10 +61,10 @@ void rc_remap_registers(struct rc_instruction * inst, rc_remap_register_fn cb, v
/*@{*/
typedef void (*rc_dataflow_mark_outputs_fn)(void * userdata, void * data,
void (*mark_fn)(void * data, unsigned int index, unsigned int mask));
-void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata);
-void rc_dataflow_swizzles(struct radeon_compiler * c);
+void rc_dataflow_deadcode(struct radeon_compiler * c, void *user);
+void rc_dataflow_swizzles(struct radeon_compiler * c, void *user);
/*@}*/
-void rc_optimize(struct radeon_compiler * c);
+void rc_optimize(struct radeon_compiler * c, void *user);
#endif /* RADEON_DATAFLOW_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
index acdb371de9..9d17b4772a 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c
@@ -213,11 +213,24 @@ static void mark_output_use(void * data, unsigned int index, unsigned int mask)
mark_used(s, RC_FILE_OUTPUT, index, mask);
}
-void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata)
+void rc_dataflow_deadcode(struct radeon_compiler * c, void *user)
{
struct deadcode_state s;
unsigned int nr_instructions;
unsigned has_temp_reladdr_src = 0;
+ rc_dataflow_mark_outputs_fn dce = (rc_dataflow_mark_outputs_fn)user;
+
+ /* Give up if there is relative addressing of destination operands. */
+ for(struct rc_instruction * inst = c->Program.Instructions.Next;
+ inst != &c->Program.Instructions;
+ inst = inst->Next) {
+ const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ if (opcode->HasDstReg &&
+ inst->U.I.DstReg.WriteMask &&
+ inst->U.I.DstReg.RelAddr) {
+ return;
+ }
+ }
memset(&s, 0, sizeof(s));
s.C = c;
@@ -226,7 +239,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f
s.Instructions = memory_pool_malloc(&c->Pool, sizeof(struct instruction_state)*nr_instructions);
memset(s.Instructions, 0, sizeof(struct instruction_state)*nr_instructions);
- dce(userdata, &s, &mark_output_use);
+ dce(c, &s, &mark_output_use);
for(struct rc_instruction * inst = c->Program.Instructions.Prev;
inst != &c->Program.Instructions;
@@ -315,6 +328,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f
for (struct rc_instruction *ptr = inst->Prev;
ptr != &c->Program.Instructions;
ptr = ptr->Prev) {
+ opcode = rc_get_opcode_info(ptr->U.I.Opcode);
if (opcode->HasDstReg &&
ptr->U.I.DstReg.File == RC_FILE_TEMPORARY &&
ptr->U.I.DstReg.WriteMask) {
@@ -326,6 +340,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f
}
has_temp_reladdr_src = 1;
+ break;
}
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
index 33acbd30f4..a0f7bd8174 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c
@@ -86,7 +86,7 @@ static void rewrite_source(struct radeon_compiler * c,
}
}
-void rc_dataflow_swizzles(struct radeon_compiler * c)
+void rc_dataflow_swizzles(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
index 863654cf68..222e5b7e02 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.c
@@ -296,7 +296,7 @@ static void fix_output_writes(struct emulate_branch_state * s, struct rc_instruc
* on different register sets and choose between their results
* using CMP instructions in place of the original ENDIF.
*/
-void rc_emulate_branches(struct radeon_compiler * c)
+void rc_emulate_branches(struct radeon_compiler *c, void *user)
{
struct emulate_branch_state s;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
index e07279f093..818ab84d0c 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_branches.h
@@ -25,6 +25,6 @@
struct radeon_compiler;
-void rc_emulate_branches(struct radeon_compiler * c);
+void rc_emulate_branches(struct radeon_compiler *c, void *user);
#endif /* RADEON_EMULATE_BRANCHES_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
index 32d4b45dd6..cd4fcbabb9 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.c
@@ -78,12 +78,12 @@ static int src_reg_is_immediate(struct rc_src_register * src,
}
static unsigned int loop_max_possible_iterations(struct radeon_compiler *c,
- struct loop_info * loop, unsigned int prog_inst_limit)
+ struct loop_info * loop)
{
unsigned int total_i = rc_recompute_ips(c);
unsigned int loop_i = (loop->EndLoop->IP - loop->BeginLoop->IP) - 1;
/* +1 because the program already has one iteration of the loop. */
- return 1 + ((prog_inst_limit - total_i) / loop_i);
+ return 1 + ((c->max_alu_insts - total_i) / loop_i);
}
static void unroll_loop(struct radeon_compiler * c, struct loop_info * loop,
@@ -187,11 +187,10 @@ static void get_incr_amount(void * data, struct rc_instruction * inst,
}
/**
- * If prog_inst_limit is -1, then all eligible loops will be unrolled regardless
+ * If c->max_alu_inst is -1, then all eligible loops will be unrolled regardless
* of how many iterations they have.
*/
-static int try_unroll_loop(struct radeon_compiler * c, struct loop_info * loop,
- unsigned int prog_inst_limit)
+static int try_unroll_loop(struct radeon_compiler * c, struct loop_info * loop)
{
int end_loops;
int iterations;
@@ -300,9 +299,8 @@ static int try_unroll_loop(struct radeon_compiler * c, struct loop_info * loop,
return 0;
}
- if (prog_inst_limit > 0
- && iterations > loop_max_possible_iterations(c, loop,
- prog_inst_limit)) {
+ if (c->max_alu_insts > 0
+ && iterations > loop_max_possible_iterations(c, loop)) {
return 0;
}
@@ -436,7 +434,7 @@ static int transform_loop(struct emulate_loop_state * s,
if (!build_loop_info(s->C, loop, inst))
return 0;
- if(try_unroll_loop(s->C, loop, s->prog_inst_limit)){
+ if(try_unroll_loop(s->C, loop)){
return 1;
}
@@ -472,14 +470,13 @@ static int transform_loop(struct emulate_loop_state * s,
return 1;
}
-void rc_transform_loops(struct radeon_compiler *c,
- struct emulate_loop_state * s, int prog_inst_limit)
+void rc_transform_loops(struct radeon_compiler *c, void *user)
{
+ struct emulate_loop_state * s = &c->loop_state;
struct rc_instruction * ptr;
memset(s, 0, sizeof(struct emulate_loop_state));
s->C = c;
- s->prog_inst_limit = prog_inst_limit;
for(ptr = s->C->Program.Instructions.Next;
ptr != &s->C->Program.Instructions; ptr = ptr->Next) {
if(ptr->Type == RC_INSTRUCTION_NORMAL &&
@@ -490,7 +487,7 @@ void rc_transform_loops(struct radeon_compiler *c,
}
}
-void rc_unroll_loops(struct radeon_compiler *c, int prog_inst_limit)
+void rc_unroll_loops(struct radeon_compiler *c, void *user)
{
struct rc_instruction * inst;
struct loop_info loop;
@@ -500,14 +497,15 @@ void rc_unroll_loops(struct radeon_compiler *c, int prog_inst_limit)
if (inst->U.I.Opcode == RC_OPCODE_BGNLOOP) {
if (build_loop_info(c, &loop, inst)) {
- try_unroll_loop(c, &loop, prog_inst_limit);
+ try_unroll_loop(c, &loop);
}
}
}
}
-void rc_emulate_loops(struct emulate_loop_state *s, int prog_inst_limit)
+void rc_emulate_loops(struct radeon_compiler *c, void *user)
{
+ struct emulate_loop_state * s = &c->loop_state;
int i;
/* Iterate backwards of the list of loops so that loops that nested
* loops are unrolled first.
@@ -517,7 +515,7 @@ void rc_emulate_loops(struct emulate_loop_state *s, int prog_inst_limit)
continue;
}
unsigned int iterations = loop_max_possible_iterations(
- s->C, &s->Loops[i], prog_inst_limit);
+ s->C, &s->Loops[i]);
unroll_loop(s->C, &s->Loops[i], iterations);
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
index bba1f68e30..cd800c059d 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_emulate_loops.h
@@ -21,14 +21,12 @@ struct emulate_loop_state {
struct loop_info * Loops;
unsigned int LoopCount;
unsigned int LoopReserved;
- int prog_inst_limit;
};
-void rc_transform_loops(struct radeon_compiler *c,
- struct emulate_loop_state * s, int prog_inst_limit);
+void rc_transform_loops(struct radeon_compiler *c, void *user);
-void rc_unroll_loops(struct radeon_compiler * c, int prog_inst_limit);
+void rc_unroll_loops(struct radeon_compiler * c, void *user);
-void rc_emulate_loops(struct emulate_loop_state * s, int prog_inst_limit);
+void rc_emulate_loops(struct radeon_compiler * c, void *user);
#endif /* RADEON_EMULATE_LOOPS_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
index 7a3f35950a..c15a9b1c45 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_optimize.c
@@ -30,6 +30,17 @@
#include "radeon_compiler.h"
#include "radeon_swizzle.h"
+struct peephole_state {
+ struct rc_instruction * Inst;
+ /** Stores a bitmask of the components that are still "alive" (i.e.
+ * they have not been written to since Inst was executed.)
+ */
+ unsigned int WriteMask;
+};
+
+typedef void (*rc_presub_replace_fn)(struct peephole_state *,
+ struct rc_instruction *,
+ unsigned int);
static struct rc_src_register chain_srcregs(struct rc_src_register outer, struct rc_src_register inner)
{
@@ -54,7 +65,7 @@ static struct rc_src_register chain_srcregs(struct rc_src_register outer, struct
return combine;
}
-struct peephole_state {
+struct copy_propagate_state {
struct radeon_compiler * C;
struct rc_instruction * Mov;
unsigned int Conflict:1;
@@ -84,10 +95,16 @@ struct peephole_state {
* @param index The index of the source register.
* @param mask The components of the source register that are being read from.
*/
-static void peephole_scan_read(void * data, struct rc_instruction * inst,
+static void copy_propagate_scan_read(void * data, struct rc_instruction * inst,
rc_register_file file, unsigned int index, unsigned int mask)
{
- struct peephole_state * s = data;
+ struct copy_propagate_state * s = data;
+
+ /* XXX This could probably be handled better. */
+ if (file == RC_FILE_ADDRESS) {
+ s->Conflict = 1;
+ return;
+ }
if (file != RC_FILE_TEMPORARY || index != s->Mov->U.I.DstReg.Index)
return;
@@ -117,10 +134,10 @@ static void peephole_scan_read(void * data, struct rc_instruction * inst,
}
}
-static void peephole_scan_write(void * data, struct rc_instruction * inst,
+static void copy_propagate_scan_write(void * data, struct rc_instruction * inst,
rc_register_file file, unsigned int index, unsigned int mask)
{
- struct peephole_state * s = data;
+ struct copy_propagate_state * s = data;
if (s->BranchDepth < 0)
return;
@@ -140,11 +157,13 @@ static void peephole_scan_write(void * data, struct rc_instruction * inst,
}
}
-static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mov)
+static void copy_propagate(struct radeon_compiler * c, struct rc_instruction * inst_mov)
{
- struct peephole_state s;
+ struct copy_propagate_state s;
- if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY || inst_mov->U.I.WriteALUResult)
+ if (inst_mov->U.I.DstReg.File != RC_FILE_TEMPORARY ||
+ inst_mov->U.I.DstReg.RelAddr ||
+ inst_mov->U.I.WriteALUResult)
return;
memset(&s, 0, sizeof(s));
@@ -162,14 +181,23 @@ static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mo
for(struct rc_instruction * inst = inst_mov->Next;
inst != &c->Program.Instructions;
inst = inst->Next) {
+ const struct rc_opcode_info * info = rc_get_opcode_info(inst->U.I.Opcode);
/* XXX In the future we might be able to make the optimizer
* smart enough to handle loops. */
if(inst->U.I.Opcode == RC_OPCODE_BGNLOOP
|| inst->U.I.Opcode == RC_OPCODE_ENDLOOP){
return;
}
- rc_for_all_reads_mask(inst, peephole_scan_read, &s);
- rc_for_all_writes_mask(inst, peephole_scan_write, &s);
+
+ /* It is possible to do copy propigation in this situation,
+ * just not right now, see peephole_add_presub_inv() */
+ if (inst_mov->U.I.PreSub.Opcode != RC_PRESUB_NONE &&
+ (info->NumSrcRegs > 2 || info->HasTexture)) {
+ return;
+ }
+
+ rc_for_all_reads_mask(inst, copy_propagate_scan_read, &s);
+ rc_for_all_writes_mask(inst, copy_propagate_scan_write, &s);
if (s.Conflict)
return;
@@ -198,7 +226,6 @@ static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mo
inst != &c->Program.Instructions;
inst = inst->Next) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
-
for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) {
if (inst->U.I.SrcReg[src].File == RC_FILE_TEMPORARY &&
inst->U.I.SrcReg[src].Index == s.Mov->U.I.DstReg.Index) {
@@ -209,8 +236,11 @@ static void peephole(struct radeon_compiler * c, struct rc_instruction * inst_mo
refmask |= (1 << swz) & RC_MASK_XYZW;
}
- if ((refmask & s.MovMask) == refmask)
+ if ((refmask & s.MovMask) == refmask) {
inst->U.I.SrcReg[src] = chain_srcregs(inst->U.I.SrcReg[src], s.Mov->U.I.SrcReg[0]);
+ if (s.Mov->U.I.SrcReg[0].File == RC_FILE_PRESUB)
+ inst->U.I.PreSub = s.Mov->U.I.PreSub;
+ }
}
}
@@ -275,7 +305,6 @@ static int is_src_uniform_constant(struct rc_src_register src,
return 1;
}
-
static void constant_folding_mad(struct rc_instruction * inst)
{
rc_swizzle swz;
@@ -371,7 +400,6 @@ static void constant_folding_add(struct rc_instruction * inst)
}
}
-
/**
* Replace 0.0, 1.0 and 0.5 immediate constants by their
* respective swizzles. Simplify instructions like ADD dst, src, 0;
@@ -410,7 +438,7 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction *
newswz = RC_SWIZZLE_ZERO;
} else if (baseimm == 1.0) {
newswz = RC_SWIZZLE_ONE;
- } else if (baseimm == 0.5) {
+ } else if (baseimm == 0.5 && c->has_half_swizzles) {
newswz = RC_SWIZZLE_HALF;
} else {
have_real_reference = 1;
@@ -446,7 +474,301 @@ static void constant_folding(struct radeon_compiler * c, struct rc_instruction *
constant_folding_add(inst);
}
-void rc_optimize(struct radeon_compiler * c)
+/**
+ * This function returns a writemask that indicates wich components are
+ * read by src and also written by dst.
+ */
+static unsigned int src_reads_dst_mask(struct rc_src_register src,
+ struct rc_dst_register dst)
+{
+ unsigned int mask = 0;
+ unsigned int i;
+ if (dst.File != src.File || dst.Index != src.Index) {
+ return 0;
+ }
+
+ for(i = 0; i < 4; i++) {
+ mask |= 1 << GET_SWZ(src.Swizzle, i);
+ }
+ mask &= RC_MASK_XYZW;
+
+ return mask;
+}
+
+/* Return 1 if the source registers has a constant swizzle (e.g. 0, 0.5, 1.0)
+ * in any of its channels. Return 0 otherwise. */
+static int src_has_const_swz(struct rc_src_register src) {
+ int chan;
+ for(chan = 0; chan < 4; chan++) {
+ unsigned int swz = GET_SWZ(src.Swizzle, chan);
+ if (swz == RC_SWIZZLE_ZERO || swz == RC_SWIZZLE_HALF
+ || swz == RC_SWIZZLE_ONE) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static void peephole_scan_write(void * data, struct rc_instruction * inst,
+ rc_register_file file, unsigned int index, unsigned int mask)
+{
+ struct peephole_state * s = data;
+ if(s->Inst->U.I.DstReg.File == file
+ && s->Inst->U.I.DstReg.Index == index) {
+ unsigned int common_mask = s->WriteMask & mask;
+ s->WriteMask &= ~common_mask;
+ }
+}
+
+static int presub_helper(
+ struct radeon_compiler * c,
+ struct peephole_state * s,
+ rc_presubtract_op presub_opcode,
+ rc_presub_replace_fn presub_replace)
+{
+ struct rc_instruction * inst;
+ unsigned int can_remove = 0;
+ unsigned int cant_sub = 0;
+
+ for(inst = s->Inst->Next; inst != &c->Program.Instructions;
+ inst = inst->Next) {
+ unsigned int i;
+ unsigned char can_use_presub = 1;
+ const struct rc_opcode_info * info =
+ rc_get_opcode_info(inst->U.I.Opcode);
+ /* XXX: There are some situations where instructions
+ * with more than 2 src registers can use the
+ * presubtract select, but to keep things simple we
+ * will disable presubtract on these instructions for
+ * now. */
+ if (info->NumSrcRegs > 2 || info->HasTexture) {
+ can_use_presub = 0;
+ }
+
+ /* We can't use more than one presubtract value in an
+ * instruction, unless the two prsubtract operations
+ * are the same and read from the same registers. */
+ if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) {
+ if (inst->U.I.PreSub.Opcode != presub_opcode
+ || inst->U.I.PreSub.SrcReg[0].File !=
+ s->Inst->U.I.SrcReg[1].File
+ || inst->U.I.PreSub.SrcReg[0].Index !=
+ s->Inst->U.I.SrcReg[1].Index) {
+ can_use_presub = 0;
+ }
+ }
+
+ /* Even if the instruction can't use a presubtract operation
+ * we still need to check if the instruction reads from
+ * s->Inst->U.I.DstReg, because if it does we must not
+ * remove s->Inst. */
+ for(i = 0; i < info->NumSrcRegs; i++) {
+ if(s->Inst->U.I.DstReg.WriteMask !=
+ src_reads_dst_mask(inst->U.I.SrcReg[i],
+ s->Inst->U.I.DstReg)) {
+ continue;
+ }
+ if (cant_sub || !can_use_presub) {
+ can_remove = 0;
+ break;
+ }
+ presub_replace(s, inst, i);
+ can_remove = 1;
+ }
+ if(!can_remove)
+ break;
+ rc_for_all_writes_mask(inst, peephole_scan_write, s);
+ /* If all components of inst_add's destination register have
+ * been written to by subsequent instructions, the original
+ * value of the destination register is no longer valid and
+ * we can't keep doing substitutions. */
+ if (!s->WriteMask){
+ break;
+ }
+ /* Make this instruction doesn't write to the presubtract source. */
+ if (inst->U.I.DstReg.WriteMask &
+ src_reads_dst_mask(s->Inst->U.I.SrcReg[1],
+ inst->U.I.DstReg)
+ || src_reads_dst_mask(s->Inst->U.I.SrcReg[0],
+ inst->U.I.DstReg)
+ || info->IsFlowControl) {
+ cant_sub = 1;
+ }
+ }
+ return can_remove;
+}
+
+/* This function assumes that s->Inst->U.I.SrcReg[0] and
+ * s->Inst->U.I.SrcReg[1] aren't both negative. */
+static void presub_replace_add(struct peephole_state *s,
+ struct rc_instruction * inst,
+ unsigned int src_index)
+{
+ rc_presubtract_op presub_opcode;
+ if (s->Inst->U.I.SrcReg[1].Negate || s->Inst->U.I.SrcReg[0].Negate)
+ presub_opcode = RC_PRESUB_SUB;
+ else
+ presub_opcode = RC_PRESUB_ADD;
+
+ if (s->Inst->U.I.SrcReg[1].Negate) {
+ inst->U.I.PreSub.SrcReg[0] = s->Inst->U.I.SrcReg[1];
+ inst->U.I.PreSub.SrcReg[1] = s->Inst->U.I.SrcReg[0];
+ } else {
+ inst->U.I.PreSub.SrcReg[0] = s->Inst->U.I.SrcReg[0];
+ inst->U.I.PreSub.SrcReg[1] = s->Inst->U.I.SrcReg[1];
+ }
+ inst->U.I.PreSub.SrcReg[0].Negate = 0;
+ inst->U.I.PreSub.SrcReg[1].Negate = 0;
+ inst->U.I.PreSub.Opcode = presub_opcode;
+ inst->U.I.SrcReg[src_index] = chain_srcregs(inst->U.I.SrcReg[src_index],
+ inst->U.I.PreSub.SrcReg[0]);
+ inst->U.I.SrcReg[src_index].File = RC_FILE_PRESUB;
+ inst->U.I.SrcReg[src_index].Index = presub_opcode;
+}
+
+static int peephole_add_presub_add(
+ struct radeon_compiler * c,
+ struct rc_instruction * inst_add)
+{
+ struct rc_src_register * src0 = NULL;
+ struct rc_src_register * src1 = NULL;
+ unsigned int i;
+ struct peephole_state s;
+
+ if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE)
+ return 0;
+
+ if (inst_add->U.I.SaturateMode)
+ return 0;
+
+ if (inst_add->U.I.SrcReg[0].Swizzle != inst_add->U.I.SrcReg[1].Swizzle)
+ return 0;
+
+ /* src0 and src1 can't have absolute values only one can be negative and they must be all negative or all positive. */
+ for (i = 0; i < 2; i++) {
+ if (inst_add->U.I.SrcReg[i].Abs)
+ return 0;
+ if ((inst_add->U.I.SrcReg[i].Negate
+ & inst_add->U.I.DstReg.WriteMask) ==
+ inst_add->U.I.DstReg.WriteMask) {
+ src0 = &inst_add->U.I.SrcReg[i];
+ } else if (!src1) {
+ src1 = &inst_add->U.I.SrcReg[i];
+ } else {
+ src0 = &inst_add->U.I.SrcReg[i];
+ }
+ }
+
+ if (!src1)
+ return 0;
+
+ s.Inst = inst_add;
+ s.WriteMask = inst_add->U.I.DstReg.WriteMask;
+ if (presub_helper(c, &s, RC_PRESUB_ADD, presub_replace_add)) {
+ rc_remove_instruction(inst_add);
+ return 1;
+ }
+ return 0;
+}
+
+static void presub_replace_inv(struct peephole_state * s,
+ struct rc_instruction * inst,
+ unsigned int src_index)
+{
+ /* We must be careful not to modify s->Inst, since it
+ * is possible it will remain part of the program.
+ * XXX Maybe pass a struct instead of a pointer for s->Inst.*/
+ inst->U.I.PreSub.SrcReg[0] = s->Inst->U.I.SrcReg[1];
+ inst->U.I.PreSub.SrcReg[0].Negate = 0;
+ inst->U.I.PreSub.Opcode = RC_PRESUB_INV;
+ inst->U.I.SrcReg[src_index] = chain_srcregs(inst->U.I.SrcReg[src_index],
+ inst->U.I.PreSub.SrcReg[0]);
+
+ inst->U.I.SrcReg[src_index].File = RC_FILE_PRESUB;
+ inst->U.I.SrcReg[src_index].Index = RC_PRESUB_INV;
+}
+
+/**
+ * PRESUB_INV: ADD TEMP[0], none.1, -TEMP[1]
+ * Use the presubtract 1 - src0 for all readers of TEMP[0]. The first source
+ * of the add instruction must have the constatnt 1 swizzle. This function
+ * does not check const registers to see if their value is 1.0, so it should
+ * be called after the constant_folding optimization.
+ * @return
+ * 0 if the ADD instruction is still part of the program.
+ * 1 if the ADD instruction is no longer part of the program.
+ */
+static int peephole_add_presub_inv(
+ struct radeon_compiler * c,
+ struct rc_instruction * inst_add)
+{
+ unsigned int i, swz, mask;
+ struct peephole_state s;
+
+ if (inst_add->U.I.PreSub.Opcode != RC_PRESUB_NONE)
+ return 0;
+
+ if (inst_add->U.I.SaturateMode)
+ return 0;
+
+ mask = inst_add->U.I.DstReg.WriteMask;
+
+ /* Check if src0 is 1. */
+ /* XXX It would be nice to use is_src_uniform_constant here, but that
+ * function only works if the register's file is RC_FILE_NONE */
+ for(i = 0; i < 4; i++ ) {
+ swz = GET_SWZ(inst_add->U.I.SrcReg[0].Swizzle, i);
+ if(((1 << i) & inst_add->U.I.DstReg.WriteMask)
+ && swz != RC_SWIZZLE_ONE) {
+ return 0;
+ }
+ }
+
+ /* Check src1. */
+ if ((inst_add->U.I.SrcReg[1].Negate & inst_add->U.I.DstReg.WriteMask) !=
+ inst_add->U.I.DstReg.WriteMask
+ || inst_add->U.I.SrcReg[1].Abs
+ || (inst_add->U.I.SrcReg[1].File != RC_FILE_TEMPORARY
+ && inst_add->U.I.SrcReg[1].File != RC_FILE_CONSTANT)
+ || src_has_const_swz(inst_add->U.I.SrcReg[1])) {
+
+ return 0;
+ }
+
+ /* Setup the peephole_state information. */
+ s.Inst = inst_add;
+ s.WriteMask = inst_add->U.I.DstReg.WriteMask;
+
+ if (presub_helper(c, &s, RC_PRESUB_INV, presub_replace_inv)) {
+ rc_remove_instruction(inst_add);
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * @return
+ * 0 if inst is still part of the program.
+ * 1 if inst is no longer part of the program.
+ */
+static int peephole(struct radeon_compiler * c, struct rc_instruction * inst)
+{
+ switch(inst->U.I.Opcode){
+ case RC_OPCODE_ADD:
+ if (c->has_presub) {
+ if(peephole_add_presub_inv(c, inst))
+ return 1;
+ if(peephole_add_presub_add(c, inst))
+ return 1;
+ }
+ break;
+ default:
+ break;
+ }
+ return 0;
+}
+
+void rc_optimize(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst = c->Program.Instructions.Next;
while(inst != &c->Program.Instructions) {
@@ -455,8 +777,11 @@ void rc_optimize(struct radeon_compiler * c)
constant_folding(c, cur);
+ if(peephole(c, cur))
+ continue;
+
if (cur->U.I.Opcode == RC_OPCODE_MOV) {
- peephole(c, cur);
+ copy_propagate(c, cur);
/* cur may no longer be part of the program */
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
index ce72cd97ab..c73845512f 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c
@@ -189,8 +189,17 @@ static void scan_callback(void * data, struct rc_instruction * inst,
reg->Live.End = inst->IP;
}
-static void compute_live_intervals(struct regalloc_state * s)
+static void compute_live_intervals(struct radeon_compiler *c,
+ struct regalloc_state *s)
{
+ memset(s, 0, sizeof(*s));
+ s->C = c;
+ s->NumHwTemporaries = c->max_temp_regs;
+ s->HwTemporary =
+ memory_pool_malloc(&c->Pool,
+ s->NumHwTemporaries * sizeof(struct hardware_register));
+ memset(s->HwTemporary, 0, s->NumHwTemporaries * sizeof(struct hardware_register));
+
rc_recompute_ips(s->C);
for(struct rc_instruction * inst = s->C->Program.Instructions.Next;
@@ -207,7 +216,6 @@ static void compute_live_intervals(struct regalloc_state * s)
tmp = tmp->Next) {
if (tmp->U.I.Opcode == RC_OPCODE_BGNLOOP) {
loops++;
- break;
} else if (tmp->U.I.Opcode
== RC_OPCODE_ENDLOOP) {
if(!--loops) {
@@ -292,19 +300,53 @@ static void alloc_input(void * data, unsigned int input, unsigned int hwreg)
}
-void rc_pair_regalloc(struct r300_fragment_program_compiler *c, unsigned maxtemps)
+void rc_pair_regalloc(struct radeon_compiler *cc, void *user)
{
+ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
struct regalloc_state s;
- memset(&s, 0, sizeof(s));
- s.C = &c->Base;
- s.NumHwTemporaries = maxtemps;
- s.HwTemporary = memory_pool_malloc(&s.C->Pool, maxtemps*sizeof(struct hardware_register));
- memset(s.HwTemporary, 0, maxtemps*sizeof(struct hardware_register));
-
- compute_live_intervals(&s);
+ compute_live_intervals(cc, &s);
c->AllocateHwInputs(c, &alloc_input, &s);
do_regalloc(&s);
}
+
+/* This functions offsets the temporary register indices by the number
+ * of input registers, because input registers are actually temporaries and
+ * should not occupy the same space.
+ *
+ * This pass is supposed to be used to maintain correct allocation of inputs
+ * if the standard register allocation is disabled. */
+void rc_pair_regalloc_inputs_only(struct radeon_compiler *cc, void *user)
+{
+ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
+ struct regalloc_state s;
+
+ compute_live_intervals(cc, &s);
+
+ c->AllocateHwInputs(c, &alloc_input, &s);
+
+ int temp_reg_offset = 0;
+ for (unsigned i = 0; i < RC_REGISTER_MAX_INDEX; i++) {
+ if (s.Input[i].Allocated && temp_reg_offset <= s.Input[i].Index)
+ temp_reg_offset = s.Input[i].Index + 1;
+ }
+
+ if (temp_reg_offset) {
+ for (unsigned i = 0; i < RC_REGISTER_MAX_INDEX; i++) {
+ if (s.Temporary[i].Used) {
+ s.Temporary[i].Allocated = 1;
+ s.Temporary[i].File = RC_FILE_TEMPORARY;
+ s.Temporary[i].Index = i + temp_reg_offset;
+ }
+ }
+
+ /* Rewrite all registers. */
+ for (struct rc_instruction *inst = cc->Program.Instructions.Next;
+ inst != &cc->Program.Instructions;
+ inst = inst->Next) {
+ rc_remap_registers(inst, &remap_register, &s);
+ }
+ }
+}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
index fc540496c4..5269d65985 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c
@@ -279,11 +279,144 @@ static int destructive_merge_instructions(
struct rc_pair_instruction * rgb,
struct rc_pair_instruction * alpha)
{
+ const struct rc_opcode_info * opcode;
assert(rgb->Alpha.Opcode == RC_OPCODE_NOP);
assert(alpha->RGB.Opcode == RC_OPCODE_NOP);
+ /* Presubtract registers need to be merged first so that registers
+ * needed by the presubtract operation can be placed in src0 and/or
+ * src1. */
+
+ /* Merge the rgb presubtract registers. */
+ const struct rc_opcode_info * rgb_info =
+ rc_get_opcode_info(rgb->RGB.Opcode);
+ if (alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
+ unsigned int srcp_src;
+ unsigned int srcp_regs;
+ if (rgb->RGB.Src[RC_PAIR_PRESUB_SRC].Used)
+ return 0;
+ srcp_regs = rc_presubtract_src_reg_count(
+ alpha->RGB.Src[RC_PAIR_PRESUB_SRC].Index);
+ for(srcp_src = 0; srcp_src < srcp_regs; srcp_src++) {
+ unsigned int arg;
+ int free_source;
+ unsigned int one_way = 0;
+ struct radeon_pair_instruction_source srcp =
+ alpha->RGB.Src[srcp_src];
+ struct radeon_pair_instruction_source temp;
+ /* 2nd arg of 1 means this is an rgb source.
+ * 3rd arg of 0 means this is not an alpha source. */
+ free_source = rc_pair_alloc_source(rgb, 1, 0,
+ srcp.File, srcp.Index);
+ /* If free_source < 0 then there are no free source
+ * slots. */
+ if (free_source < 0)
+ return 0;
+
+ temp = rgb->RGB.Src[srcp_src];
+ rgb->RGB.Src[srcp_src] = rgb->RGB.Src[free_source];
+ /* srcp needs src0 and src1 to be the same */
+ if (free_source < srcp_src) {
+ if (!temp.Used)
+ continue;
+ free_source = rc_pair_alloc_source(rgb, 1, 0,
+ srcp.File, srcp.Index);
+ one_way = 1;
+ } else {
+ rgb->RGB.Src[free_source] = temp;
+ }
+ /* If free_source == srcp_src, then the presubtract
+ * source is already in the correct place. */
+ if (free_source == srcp_src)
+ continue;
+ /* Shuffle the sources, so we can put the
+ * presubtract source in the correct place. */
+ for (arg = 0; arg < rgb_info->NumSrcRegs; arg++) {
+ /*If this arg does not read from an rgb source,
+ * do nothing. */
+ if (rc_source_type_that_arg_reads(
+ rgb->RGB.Arg[arg].Source,
+ rgb->RGB.Arg[arg].Swizzle, 3)
+ != RC_PAIR_SOURCE_RGB) {
+ continue;
+ }
+ if (rgb->RGB.Arg[arg].Source == srcp_src)
+ rgb->RGB.Arg[arg].Source = free_source;
+ /* We need to do this just in case register
+ * is one of the sources already, but in the
+ * wrong spot. */
+ else if(rgb->RGB.Arg[arg].Source == free_source
+ && !one_way) {
+ rgb->RGB.Arg[arg].Source = srcp_src;
+ }
+ }
+ }
+ }
+
+ /* Merge the alpha presubtract registers */
+ if (alpha->Alpha.Src[RC_PAIR_PRESUB_SRC].Used) {
+ unsigned int srcp_src;
+ unsigned int srcp_regs;
+ if(rgb->Alpha.Src[RC_PAIR_PRESUB_SRC].Used)
+ return 0;
+
+ srcp_regs = rc_presubtract_src_reg_count(
+ alpha->Alpha.Src[RC_PAIR_PRESUB_SRC].Index);
+ for(srcp_src = 0; srcp_src < srcp_regs; srcp_src++) {
+ unsigned int arg;
+ int free_source;
+ unsigned int one_way = 0;
+ struct radeon_pair_instruction_source srcp =
+ alpha->Alpha.Src[srcp_src];
+ struct radeon_pair_instruction_source temp;
+ /* 2nd arg of 0 means this is not an rgb source.
+ * 3rd arg of 1 means this is an alpha source. */
+ free_source = rc_pair_alloc_source(rgb, 0, 1,
+ srcp.File, srcp.Index);
+ /* If free_source < 0 then there are no free source
+ * slots. */
+ if (free_source < 0)
+ return 0;
+
+ temp = rgb->Alpha.Src[srcp_src];
+ rgb->Alpha.Src[srcp_src] = rgb->Alpha.Src[free_source];
+ /* srcp needs src0 and src1 to be the same. */
+ if (free_source < srcp_src) {
+ if (!temp.Used)
+ continue;
+ free_source = rc_pair_alloc_source(rgb, 0, 1,
+ temp.File, temp.Index);
+ one_way = 1;
+ } else {
+ rgb->Alpha.Src[free_source] = temp;
+ }
+ /* If free_source == srcp_src, then the presubtract
+ * source is already in the correct place. */
+ if (free_source == srcp_src)
+ continue;
+ /* Shuffle the sources, so we can put the
+ * presubtract source in the correct place. */
+ for(arg = 0; arg < rgb_info->NumSrcRegs; arg++) {
+ /*If this arg does not read from an alpha
+ * source, do nothing. */
+ if (rc_source_type_that_arg_reads(
+ rgb->RGB.Arg[arg].Source,
+ rgb->RGB.Arg[arg].Swizzle, 3)
+ != RC_PAIR_SOURCE_ALPHA) {
+ continue;
+ }
+ if (rgb->RGB.Arg[arg].Source == srcp_src)
+ rgb->RGB.Arg[arg].Source = free_source;
+ else if (rgb->RGB.Arg[arg].Source == free_source
+ && !one_way) {
+ rgb->RGB.Arg[arg].Source = srcp_src;
+ }
+ }
+ }
+ }
+
/* Copy alpha args into rgb */
- const struct rc_opcode_info * opcode = rc_get_opcode_info(alpha->Alpha.Opcode);
+ opcode = rc_get_opcode_info(alpha->Alpha.Opcode);
for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) {
unsigned int srcrgb = 0;
@@ -351,7 +484,52 @@ static int merge_instructions(struct rc_pair_instruction * rgb, struct rc_pair_i
return 0;
}
+static void presub_nop(struct rc_instruction * emitted) {
+ int prev_rgb_index, prev_alpha_index, i, num_src;
+ /* We don't need a nop if the previous instruction is a TEX. */
+ if (emitted->Prev->Type != RC_INSTRUCTION_PAIR) {
+ return;
+ }
+ if (emitted->Prev->U.P.RGB.WriteMask)
+ prev_rgb_index = emitted->Prev->U.P.RGB.DestIndex;
+ else
+ prev_rgb_index = -1;
+ if (emitted->Prev->U.P.Alpha.WriteMask)
+ prev_alpha_index = emitted->Prev->U.P.Alpha.DestIndex;
+ else
+ prev_alpha_index = 1;
+
+ /* Check the previous rgb instruction */
+ if (emitted->U.P.RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
+ num_src = rc_presubtract_src_reg_count(
+ emitted->U.P.RGB.Src[RC_PAIR_PRESUB_SRC].Index);
+ for (i = 0; i < num_src; i++) {
+ unsigned int index = emitted->U.P.RGB.Src[i].Index;
+ if (emitted->U.P.RGB.Src[i].File == RC_FILE_TEMPORARY
+ && (index == prev_rgb_index
+ || index == prev_alpha_index)) {
+ emitted->Prev->U.P.Nop = 1;
+ return;
+ }
+ }
+ }
+
+ /* Check the previous alpha instruction. */
+ if (!emitted->U.P.Alpha.Src[RC_PAIR_PRESUB_SRC].Used)
+ return;
+
+ num_src = rc_presubtract_src_reg_count(
+ emitted->U.P.Alpha.Src[RC_PAIR_PRESUB_SRC].Index);
+ for (i = 0; i < num_src; i++) {
+ unsigned int index = emitted->U.P.Alpha.Src[i].Index;
+ if(emitted->U.P.Alpha.Src[i].File == RC_FILE_TEMPORARY
+ && (index == prev_rgb_index || index == prev_alpha_index)) {
+ emitted->Prev->U.P.Nop = 1;
+ return;
+ }
+ }
+}
/**
* Find a good ALU instruction or pair of ALU instruction and emit it.
*
@@ -408,6 +586,10 @@ static void emit_one_alu(struct schedule_state *s, struct rc_instruction * befor
commit_alu_instruction(s, sinst);
success: ;
}
+ /* If the instruction we just emitted uses a presubtract value, and
+ * the presubtract sources were written by the previous intstruction,
+ * the previous instruction needs a nop. */
+ presub_nop(before->Prev);
}
static void scan_read(void * data, struct rc_instruction * inst,
@@ -529,8 +711,9 @@ static int is_controlflow(struct rc_instruction * inst)
return 0;
}
-void rc_pair_schedule(struct r300_fragment_program_compiler *c)
+void rc_pair_schedule(struct radeon_compiler *cc, void *user)
{
+ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
struct rc_instruction * inst = c->Base.Program.Instructions.Next;
while(inst != &c->Base.Program.Instructions) {
if (is_controlflow(inst)) {
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
index 8327e9aced..ff82584466 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c
@@ -127,6 +127,18 @@ static void classify_instruction(struct rc_sub_instruction * inst,
}
}
+static void src_uses(struct rc_src_register src, unsigned int * rgb,
+ unsigned int * alpha)
+{
+ int j;
+ for(j = 0; j < 4; ++j) {
+ unsigned int swz = GET_SWZ(src.Swizzle, j);
+ if (swz < 3)
+ *rgb = 1;
+ else if (swz < 4)
+ *alpha = 1;
+ }
+}
/**
* Fill the given ALU instruction's opcodes and source operands into the given pair,
@@ -158,12 +170,51 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
int i;
+ /* Presubtract handling:
+ * We need to make sure that the values used by the presubtract
+ * operation end up in src0 or src1. */
+ if(inst->PreSub.Opcode != RC_PRESUB_NONE) {
+ /* rc_pair_alloc_source() will fill in data for
+ * pair->{RGB,ALPHA}.Src[RC_PAIR_PRESUB_SRC] */
+ int j;
+ for(j = 0; j < 3; j++) {
+ int src_regs;
+ if(inst->SrcReg[j].File != RC_FILE_PRESUB)
+ continue;
+
+ src_regs = rc_presubtract_src_reg_count(
+ inst->PreSub.Opcode);
+ for(i = 0; i < src_regs; i++) {
+ unsigned int rgb = 0;
+ unsigned int alpha = 0;
+ src_uses(inst->SrcReg[j], &rgb, &alpha);
+ if(rgb) {
+ pair->RGB.Src[i].File =
+ inst->PreSub.SrcReg[i].File;
+ pair->RGB.Src[i].Index =
+ inst->PreSub.SrcReg[i].Index;
+ pair->RGB.Src[i].Used = 1;
+ }
+ if(alpha) {
+ pair->Alpha.Src[i].File =
+ inst->PreSub.SrcReg[i].File;
+ pair->Alpha.Src[i].Index =
+ inst->PreSub.SrcReg[i].Index;
+ pair->Alpha.Src[i].Used = 1;
+ }
+ }
+ }
+ }
+
for(i = 0; i < opcode->NumSrcRegs; ++i) {
int source;
if (needrgb && !istranscendent) {
unsigned int srcrgb = 0;
unsigned int srcalpha = 0;
int j;
+ /* We don't care about the alpha channel here. We only
+ * want the part of the swizzle that writes to rgb,
+ * since we are creating an rgb instruction. */
for(j = 0; j < 3; ++j) {
unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j);
if (swz < 3)
@@ -173,6 +224,11 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
}
source = rc_pair_alloc_source(pair, srcrgb, srcalpha,
inst->SrcReg[i].File, inst->SrcReg[i].Index);
+ if (source < 0) {
+ rc_error(&c->Base, "Failed to translate "
+ "rgb instruction.\n");
+ return;
+ }
pair->RGB.Arg[i].Source = source;
pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff;
pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs;
@@ -188,6 +244,11 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c,
srcalpha = 1;
source = rc_pair_alloc_source(pair, srcrgb, srcalpha,
inst->SrcReg[i].File, inst->SrcReg[i].Index);
+ if (source < 0) {
+ rc_error(&c->Base, "Failed to translate "
+ "alpha instruction.\n");
+ return;
+ }
pair->Alpha.Arg[i].Source = source;
pair->Alpha.Arg[i].Swizzle = swz;
pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs;
@@ -262,8 +323,10 @@ static void check_opcode_support(struct r300_fragment_program_compiler *c,
* Translate all ALU instructions into corresponding pair instructions,
* performing no other changes.
*/
-void rc_pair_translate(struct r300_fragment_program_compiler *c)
+void rc_pair_translate(struct radeon_compiler *cc, void *user)
{
+ struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
+
for(struct rc_instruction * inst = c->Base.Program.Instructions.Next;
inst != &c->Base.Program.Instructions;
inst = inst->Next) {
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
index a3c41d7bd4..24b685fbeb 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c
@@ -47,11 +47,12 @@
* \note The transform is called 'local' because it can only look at
* one instruction at a time.
*/
-void radeonLocalTransform(
+void rc_local_transform(
struct radeon_compiler * c,
- int num_transformations,
- struct radeon_program_transformation* transformations)
+ void *user)
{
+ struct radeon_program_transformation *transformations =
+ (struct radeon_program_transformation*)user;
struct rc_instruction * inst = c->Program.Instructions.Next;
while(inst != &c->Program.Instructions) {
@@ -60,7 +61,7 @@ void radeonLocalTransform(
inst = inst->Next;
- for(i = 0; i < num_transformations; ++i) {
+ for(i = 0; transformations[i].function; ++i) {
struct radeon_program_transformation* t = transformations + i;
if (t->function(c, current, t->userData))
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
index e318867696..f0a77d7b53 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h
@@ -39,7 +39,7 @@
struct radeon_compiler;
struct rc_src_register {
- unsigned int File:3;
+ unsigned int File:4;
/** Negative values may be used for relative addressing. */
signed int Index:(RC_REGISTER_INDEX_BITS+1);
@@ -64,6 +64,11 @@ struct rc_dst_register {
unsigned int WriteMask:4;
};
+struct rc_presub_instruction {
+ rc_presubtract_op Opcode;
+ struct rc_src_register SrcReg[2];
+};
+
/**
* Instructions are maintained by the compiler in a doubly linked list
* of these structures.
@@ -108,6 +113,10 @@ struct rc_sub_instruction {
/** True if tex instruction should do shadow comparison */
unsigned int TexShadow:1;
/*@}*/
+
+ /** This holds information about the presubtract operation used by
+ * this instruction. */
+ struct rc_presub_instruction PreSub;
};
typedef enum {
@@ -150,11 +159,6 @@ struct rc_program {
struct rc_constant_list Constants;
};
-enum {
- OPCODE_REPL_ALPHA = MAX_RC_OPCODE /**< used in paired instructions */
-};
-
-
static inline rc_swizzle get_swz(unsigned int swz, rc_swizzle idx)
{
if (idx & 0x4)
@@ -197,7 +201,7 @@ static inline void reset_srcreg(struct rc_src_register* reg)
/**
- * A transformation that can be passed to \ref radeonLocalTransform.
+ * A transformation that can be passed to \ref rc_local_transform.
*
* The function will be called once for each instruction.
* It has to either emit the appropriate transformed code for the instruction
@@ -214,10 +218,9 @@ struct radeon_program_transformation {
void *userData;
};
-void radeonLocalTransform(
+void rc_local_transform(
struct radeon_compiler *c,
- int num_transformations,
- struct radeon_program_transformation* transformations);
+ void *user);
unsigned int rc_find_free_temporary(struct radeon_compiler * c);
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
index 704a7bb2d2..4d3e26f28c 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c
@@ -770,7 +770,7 @@ static void transform_r300_vertex_SSG(struct radeon_compiler* c,
}
/**
- * For use with radeonLocalTransform, this transforms non-native ALU
+ * For use with rc_local_transform, this transforms non-native ALU
* instructions of the r300 up to r500 vertex engine.
*/
int r300_transform_vertex_alu(
@@ -870,7 +870,7 @@ static void sin_approx(
* using only the basic instructions
* MOV, ADD, MUL, MAD, FRC
*/
-int radeonTransformTrigSimple(struct radeon_compiler* c,
+int r300_transform_trig_simple(struct radeon_compiler* c,
struct rc_instruction* inst,
void* unused)
{
@@ -1081,7 +1081,7 @@ int radeonTransformDeriv(struct radeon_compiler* c,
* This needs to be done in its own pass, because it modifies the instructions
* before and after KILP.
*/
-void radeonTransformKILP(struct radeon_compiler * c)
+void rc_transform_KILP(struct radeon_compiler * c, void *user)
{
struct rc_instruction * inst;
for (inst = c->Program.Instructions.Next;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
index e6e2cc20c5..b5f361e624 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h
@@ -40,7 +40,7 @@ int r300_transform_vertex_alu(
struct rc_instruction * inst,
void*);
-int radeonTransformTrigSimple(
+int r300_transform_trig_simple(
struct radeon_compiler * c,
struct rc_instruction * inst,
void*);
@@ -60,6 +60,7 @@ int radeonTransformDeriv(
struct rc_instruction * inst,
void*);
-void radeonTransformKILP(struct radeon_compiler * c);
+void rc_transform_KILP(struct radeon_compiler * c,
+ void *user);
#endif /* __RADEON_PROGRAM_ALU_H_ */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h
index 2ddf60b677..9dcd44c522 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h
@@ -79,7 +79,13 @@ typedef enum {
/**
* Indicates a special register, see RC_SPECIAL_xxx.
*/
- RC_FILE_SPECIAL
+ RC_FILE_SPECIAL,
+
+ /**
+ * Indicates this register should use the result of the presubtract
+ * operation.
+ */
+ RC_FILE_PRESUB
} rc_register_file;
enum {
@@ -147,4 +153,32 @@ typedef enum {
RC_ALURESULT_W
} rc_write_aluresult;
+typedef enum {
+ RC_PRESUB_NONE = 0,
+
+ /** 1 - 2 * src0 */
+ RC_PRESUB_BIAS,
+
+ /** src1 - src0 */
+ RC_PRESUB_SUB,
+
+ /** src1 + src0 */
+ RC_PRESUB_ADD,
+
+ /** 1 - src0 */
+ RC_PRESUB_INV
+} rc_presubtract_op;
+
+static inline int rc_presubtract_src_reg_count(rc_presubtract_op op){
+ switch(op){
+ case RC_PRESUB_BIAS:
+ case RC_PRESUB_INV:
+ return 1;
+ case RC_PRESUB_ADD:
+ case RC_PRESUB_SUB:
+ return 2;
+ default:
+ return 0;
+ }
+}
#endif /* RADEON_PROGRAM_CONSTANTS_H */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
index ee839596aa..c31efdb059 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
@@ -38,26 +38,45 @@ int rc_pair_alloc_source(struct rc_pair_instruction *pair,
{
int candidate = -1;
int candidate_quality = -1;
+ unsigned int alpha_used = 0;
+ unsigned int rgb_used = 0;
int i;
if ((!rgb && !alpha) || file == RC_FILE_NONE)
return 0;
+ /* Make sure only one presubtract operation is used per instruction. */
+ if (file == RC_FILE_PRESUB) {
+ if (rgb && pair->RGB.Src[RC_PAIR_PRESUB_SRC].Used
+ && index != pair->RGB.Src[RC_PAIR_PRESUB_SRC].Index) {
+ return -1;
+ }
+
+ if (alpha && pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Used
+ && index != pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Index) {
+ return -1;
+ }
+ }
+
for(i = 0; i < 3; ++i) {
int q = 0;
if (rgb) {
if (pair->RGB.Src[i].Used) {
if (pair->RGB.Src[i].File != file ||
- pair->RGB.Src[i].Index != index)
+ pair->RGB.Src[i].Index != index) {
+ rgb_used++;
continue;
+ }
q++;
}
}
if (alpha) {
if (pair->Alpha.Src[i].Used) {
if (pair->Alpha.Src[i].File != file ||
- pair->Alpha.Src[i].Index != index)
+ pair->Alpha.Src[i].Index != index) {
+ alpha_used++;
continue;
+ }
q++;
}
}
@@ -67,18 +86,154 @@ int rc_pair_alloc_source(struct rc_pair_instruction *pair,
}
}
- if (candidate >= 0) {
- if (rgb) {
- pair->RGB.Src[candidate].Used = 1;
- pair->RGB.Src[candidate].File = file;
- pair->RGB.Src[candidate].Index = index;
+ if (file == RC_FILE_PRESUB) {
+ candidate = RC_PAIR_PRESUB_SRC;
+ } else if (candidate < 0 || (rgb && rgb_used > 2)
+ || (alpha && alpha_used > 2)) {
+ return -1;
+ }
+
+ /* candidate >= 0 */
+
+ if (rgb) {
+ pair->RGB.Src[candidate].Used = 1;
+ pair->RGB.Src[candidate].File = file;
+ pair->RGB.Src[candidate].Index = index;
+ if (candidate == RC_PAIR_PRESUB_SRC) {
+ /* For registers with the RC_FILE_PRESUB file,
+ * the index stores the presubtract op. */
+ int src_regs = rc_presubtract_src_reg_count(index);
+ for(i = 0; i < src_regs; i++) {
+ pair->RGB.Src[i].Used = 1;
+ }
}
- if (alpha) {
- pair->Alpha.Src[candidate].Used = 1;
- pair->Alpha.Src[candidate].File = file;
- pair->Alpha.Src[candidate].Index = index;
+ }
+ if (alpha) {
+ pair->Alpha.Src[candidate].Used = 1;
+ pair->Alpha.Src[candidate].File = file;
+ pair->Alpha.Src[candidate].Index = index;
+ if (candidate == RC_PAIR_PRESUB_SRC) {
+ /* For registers with the RC_FILE_PRESUB file,
+ * the index stores the presubtract op. */
+ int src_regs = rc_presubtract_src_reg_count(index);
+ for(i=0; i < src_regs; i++) {
+ pair->Alpha.Src[i].Used = 1;
+ }
}
}
return candidate;
}
+
+static void pair_foreach_source_callback(
+ struct rc_pair_instruction * pair,
+ void * data,
+ rc_pair_foreach_src_fn cb,
+ unsigned int swz,
+ unsigned int src)
+{
+ /* swz > 3 means that the swizzle is either not used, or a constant
+ * swizzle (e.g. 0, 1, 0.5). */
+ if(swz > 3)
+ return;
+
+ if(swz == RC_SWIZZLE_W) {
+ if (src == RC_PAIR_PRESUB_SRC) {
+ unsigned int i;
+ unsigned int src_count = rc_presubtract_src_reg_count(
+ pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Index);
+ for(i = 0; i < src_count; i++) {
+ cb(data, &pair->Alpha.Src[i]);
+ }
+ } else {
+ cb(data, &pair->Alpha.Src[src]);
+ }
+ } else {
+ if (src == RC_PAIR_PRESUB_SRC) {
+ unsigned int i;
+ unsigned int src_count = rc_presubtract_src_reg_count(
+ pair->RGB.Src[RC_PAIR_PRESUB_SRC].Index);
+ for(i = 0; i < src_count; i++) {
+ cb(data, &pair->RGB.Src[i]);
+ }
+ }
+ else {
+ cb(data, &pair->RGB.Src[src]);
+ }
+ }
+}
+
+void rc_pair_foreach_source_that_alpha_reads(
+ struct rc_pair_instruction * pair,
+ void * data,
+ rc_pair_foreach_src_fn cb)
+{
+ unsigned int i;
+ const struct rc_opcode_info * info =
+ rc_get_opcode_info(pair->Alpha.Opcode);
+ for(i = 0; i < info->NumSrcRegs; i++) {
+ pair_foreach_source_callback(pair, data, cb,
+ GET_SWZ(pair->Alpha.Arg[i].Swizzle, 0),
+ pair->Alpha.Arg[i].Source);
+ }
+}
+
+void rc_pair_foreach_source_that_rgb_reads(
+ struct rc_pair_instruction * pair,
+ void * data,
+ rc_pair_foreach_src_fn cb)
+{
+ unsigned int i;
+ const struct rc_opcode_info * info =
+ rc_get_opcode_info(pair->RGB.Opcode);
+ for(i = 0; i < info->NumSrcRegs; i++) {
+ unsigned int chan;
+ unsigned int swz = RC_SWIZZLE_UNUSED;
+ /* Find a swizzle that is either X,Y,Z,or W. We assume here
+ * that if one channel swizzles X,Y, or Z, then none of the
+ * other channels swizzle W, and vice-versa. */
+ for(chan = 0; chan < 4; chan++) {
+ swz = GET_SWZ(pair->RGB.Arg[i].Swizzle, chan);
+ if(swz == RC_SWIZZLE_X || swz == RC_SWIZZLE_Y
+ || swz == RC_SWIZZLE_Z || swz == RC_SWIZZLE_W)
+ continue;
+ }
+ pair_foreach_source_callback(pair, data, cb,
+ swz,
+ pair->RGB.Arg[i].Source);
+ }
+}
+
+/*return 0 for rgb, 1 for alpha -1 for error. */
+
+rc_pair_source_type rc_source_type_that_arg_reads(
+ unsigned int source,
+ unsigned int swizzle,
+ unsigned int channels)
+{
+ unsigned int chan;
+ unsigned int swz = RC_SWIZZLE_UNUSED;
+ int isRGB = 0;
+ int isAlpha = 0;
+ /* Find a swizzle that is either X,Y,Z,or W. We assume here
+ * that if one channel swizzles X,Y, or Z, then none of the
+ * other channels swizzle W, and vice-versa. */
+ for(chan = 0; chan < channels; chan++) {
+ swz = GET_SWZ(swizzle, chan);
+ if (swz == RC_SWIZZLE_W) {
+ isAlpha = 1;
+ } else if (swz == RC_SWIZZLE_X || swz == RC_SWIZZLE_Y
+ || swz == RC_SWIZZLE_Z) {
+ isRGB = 1;
+ }
+ }
+ assert(!isRGB || !isAlpha);
+
+ if(!isRGB && !isAlpha)
+ return RC_PAIR_SOURCE_NONE;
+
+ if (isRGB)
+ return RC_PAIR_SOURCE_RGB;
+ /*isAlpha*/
+ return RC_PAIR_SOURCE_ALPHA;
+}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h
index 511cc707a3..e0061e454b 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h
@@ -32,7 +32,7 @@
#include "radeon_opcodes.h"
#include "radeon_program_constants.h"
-struct r300_fragment_program_compiler;
+struct radeon_compiler;
/**
@@ -49,6 +49,11 @@ struct r300_fragment_program_compiler;
* see \ref rc_pair_translate
*/
+/* For rgb and alpha instructions when arg[n].Source = RC_PAIR_PRESUB_SRC, then
+ * the presubtract value will be used, and
+ * {RGB,Alpha}.Src[RC_PAIR_PRESUB_SRC].File will be set to RC_FILE_PRESUB.
+ */
+#define RC_PAIR_PRESUB_SRC 3
struct radeon_pair_instruction_source {
unsigned int Used:1;
@@ -64,7 +69,7 @@ struct radeon_pair_instruction_rgb {
unsigned int OutputWriteMask:3;
unsigned int Saturate:1;
- struct radeon_pair_instruction_source Src[3];
+ struct radeon_pair_instruction_source Src[4];
struct {
unsigned int Source:2;
@@ -83,7 +88,7 @@ struct radeon_pair_instruction_alpha {
unsigned int DepthWriteMask:1;
unsigned int Saturate:1;
- struct radeon_pair_instruction_source Src[3];
+ struct radeon_pair_instruction_source Src[4];
struct {
unsigned int Source:2;
@@ -99,8 +104,17 @@ struct rc_pair_instruction {
unsigned int WriteALUResult:2;
unsigned int ALUResultCompare:3;
+ unsigned int Nop:1;
};
+typedef void (*rc_pair_foreach_src_fn)
+ (void *, struct radeon_pair_instruction_source *);
+
+typedef enum {
+ RC_PAIR_SOURCE_NONE = 0,
+ RC_PAIR_SOURCE_RGB,
+ RC_PAIR_SOURCE_ALPHA
+} rc_pair_source_type;
/**
* General helper functions for dealing with the paired instruction format.
@@ -109,6 +123,21 @@ struct rc_pair_instruction {
int rc_pair_alloc_source(struct rc_pair_instruction *pair,
unsigned int rgb, unsigned int alpha,
rc_register_file file, unsigned int index);
+
+void rc_pair_foreach_source_that_alpha_reads(
+ struct rc_pair_instruction * pair,
+ void * data,
+ rc_pair_foreach_src_fn cb);
+
+void rc_pair_foreach_source_that_rgb_reads(
+ struct rc_pair_instruction * pair,
+ void * data,
+ rc_pair_foreach_src_fn cb);
+
+rc_pair_source_type rc_source_type_that_arg_reads(
+ unsigned int source,
+ unsigned int swizzle,
+ unsigned int channels);
/*@}*/
@@ -118,9 +147,10 @@ int rc_pair_alloc_source(struct rc_pair_instruction *pair,
/*@{*/
struct radeon_pair_handler;
-void rc_pair_translate(struct r300_fragment_program_compiler *c);
-void rc_pair_schedule(struct r300_fragment_program_compiler *c);
-void rc_pair_regalloc(struct r300_fragment_program_compiler *c, unsigned maxtemps);
+void rc_pair_translate(struct radeon_compiler *cc, void *user);
+void rc_pair_schedule(struct radeon_compiler *cc, void *user);
+void rc_pair_regalloc(struct radeon_compiler *cc, void *user);
+void rc_pair_regalloc_inputs_only(struct radeon_compiler *cc, void *user);
/*@}*/
#endif /* __RADEON_PROGRAM_PAIR_H_ */
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c
index 28fb9eae92..618ab5a099 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c
@@ -38,6 +38,24 @@ static const char * textarget_to_string(rc_texture_target target)
}
}
+static const char * presubtract_op_to_string(rc_presubtract_op op)
+{
+ switch(op) {
+ case RC_PRESUB_NONE:
+ return "NONE";
+ case RC_PRESUB_BIAS:
+ return "(1 - 2 * src0)";
+ case RC_PRESUB_SUB:
+ return "(src1 - src0)";
+ case RC_PRESUB_ADD:
+ return "(src1 + src0)";
+ case RC_PRESUB_INV:
+ return "(1 - src0)";
+ default:
+ return "BAD_PRESUBTRACT_OP";
+ }
+}
+
static void rc_print_comparefunc(FILE * f, const char * lhs, rc_compare_func func, const char * rhs)
{
if (func == RC_COMPARE_FUNC_NEVER) {
@@ -125,7 +143,43 @@ static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate
}
}
-static void rc_print_src_register(FILE * f, struct rc_src_register src)
+static void rc_print_presub_instruction(FILE * f,
+ struct rc_presub_instruction inst)
+{
+ fprintf(f,"(");
+ switch(inst.Opcode){
+ case RC_PRESUB_BIAS:
+ fprintf(f, "1 - 2 * ");
+ rc_print_register(f, inst.SrcReg[0].File,
+ inst.SrcReg[0].Index,inst.SrcReg[0].RelAddr);
+ break;
+ case RC_PRESUB_SUB:
+ rc_print_register(f, inst.SrcReg[1].File,
+ inst.SrcReg[1].Index,inst.SrcReg[1].RelAddr);
+ fprintf(f, " - ");
+ rc_print_register(f, inst.SrcReg[0].File,
+ inst.SrcReg[0].Index,inst.SrcReg[0].RelAddr);
+ break;
+ case RC_PRESUB_ADD:
+ rc_print_register(f, inst.SrcReg[1].File,
+ inst.SrcReg[1].Index,inst.SrcReg[1].RelAddr);
+ fprintf(f, " + ");
+ rc_print_register(f, inst.SrcReg[0].File,
+ inst.SrcReg[0].Index,inst.SrcReg[0].RelAddr);
+ break;
+ case RC_PRESUB_INV:
+ fprintf(f, "1 - ");
+ rc_print_register(f, inst.SrcReg[0].File,
+ inst.SrcReg[0].Index,inst.SrcReg[0].RelAddr);
+ break;
+ default:
+ break;
+ }
+ fprintf(f, ")");
+}
+
+static void rc_print_src_register(FILE * f, struct rc_instruction * inst,
+ struct rc_src_register src)
{
int trivial_negate = (src.Negate == RC_MASK_NONE || src.Negate == RC_MASK_XYZW);
@@ -134,7 +188,10 @@ static void rc_print_src_register(FILE * f, struct rc_src_register src)
if (src.Abs)
fprintf(f, "|");
- rc_print_register(f, src.File, src.Index, src.RelAddr);
+ if(src.File == RC_FILE_PRESUB)
+ rc_print_presub_instruction(f, inst->U.I.PreSub);
+ else
+ rc_print_register(f, src.File, src.Index, src.RelAddr);
if (src.Abs && !trivial_negate)
fprintf(f, "|");
@@ -148,10 +205,35 @@ static void rc_print_src_register(FILE * f, struct rc_src_register src)
fprintf(f, "|");
}
-static void rc_print_normal_instruction(FILE * f, struct rc_instruction * inst)
+static unsigned update_branch_depth(rc_opcode opcode, unsigned *branch_depth)
+{
+ switch (opcode) {
+ case RC_OPCODE_IF:
+ case RC_OPCODE_BGNLOOP:
+ return (*branch_depth)++ * 2;
+
+ case RC_OPCODE_ENDIF:
+ case RC_OPCODE_ENDLOOP:
+ assert(*branch_depth > 0);
+ return --(*branch_depth) * 2;
+
+ case RC_OPCODE_ELSE:
+ assert(*branch_depth > 0);
+ return (*branch_depth - 1) * 2;
+
+ default:
+ return *branch_depth * 2;
+ }
+}
+
+static void rc_print_normal_instruction(FILE * f, struct rc_instruction * inst, unsigned *branch_depth)
{
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);
unsigned int reg;
+ unsigned spaces = update_branch_depth(inst->U.I.Opcode, branch_depth);
+
+ for (unsigned i = 0; i < spaces; i++)
+ fprintf(f, " ");
fprintf(f, "%s", opcode->Name);
@@ -173,7 +255,7 @@ static void rc_print_normal_instruction(FILE * f, struct rc_instruction * inst)
if (reg > 0)
fprintf(f, ",");
fprintf(f, " ");
- rc_print_src_register(f, inst->U.I.SrcReg[reg]);
+ rc_print_src_register(f, inst, inst->U.I.SrcReg[reg]);
}
if (opcode->HasTexture) {
@@ -196,10 +278,15 @@ static void rc_print_normal_instruction(FILE * f, struct rc_instruction * inst)
fprintf(f, "\n");
}
-static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst)
+static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst, unsigned *branch_depth)
{
struct rc_pair_instruction * inst = &fullinst->U.P;
int printedsrc = 0;
+ unsigned spaces = update_branch_depth(inst->RGB.Opcode != RC_OPCODE_NOP ?
+ inst->RGB.Opcode : inst->Alpha.Opcode, branch_depth);
+
+ for (unsigned i = 0; i < spaces; i++)
+ fprintf(f, " ");
for(unsigned int src = 0; src < 3; ++src) {
if (inst->RGB.Src[src].Used) {
@@ -217,11 +304,24 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
printedsrc = 1;
}
}
+ if(inst->RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
+ fprintf(f, ", srcp.xyz = %s",
+ presubtract_op_to_string(
+ inst->RGB.Src[RC_PAIR_PRESUB_SRC].Index));
+ }
+ if(inst->Alpha.Src[RC_PAIR_PRESUB_SRC].Used) {
+ fprintf(f, ", srcp.w = %s",
+ presubtract_op_to_string(
+ inst->Alpha.Src[RC_PAIR_PRESUB_SRC].Index));
+ }
fprintf(f, "\n");
if (inst->RGB.Opcode != RC_OPCODE_NOP) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->RGB.Opcode);
+ for (unsigned i = 0; i < spaces; i++)
+ fprintf(f, " ");
+
fprintf(f, " %s%s", opcode->Name, inst->RGB.Saturate ? "_SAT" : "");
if (inst->RGB.WriteMask)
fprintf(f, " temp[%i].%s%s%s", inst->RGB.DestIndex,
@@ -239,7 +339,12 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) {
const char* abs = inst->RGB.Arg[arg].Abs ? "|" : "";
const char* neg = inst->RGB.Arg[arg].Negate ? "-" : "";
- fprintf(f, ", %s%ssrc%i.%c%c%c%s", neg, abs, inst->RGB.Arg[arg].Source,
+ fprintf(f, ", %s%ssrc", neg, abs);
+ if(inst->RGB.Arg[arg].Source == RC_PAIR_PRESUB_SRC)
+ fprintf(f,"p");
+ else
+ fprintf(f,"%d", inst->RGB.Arg[arg].Source);
+ fprintf(f,".%c%c%c%s",
rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 0)),
rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 1)),
rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 2)),
@@ -251,6 +356,9 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
if (inst->Alpha.Opcode != RC_OPCODE_NOP) {
const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Alpha.Opcode);
+ for (unsigned i = 0; i < spaces; i++)
+ fprintf(f, " ");
+
fprintf(f, " %s%s", opcode->Name, inst->Alpha.Saturate ? "_SAT" : "");
if (inst->Alpha.WriteMask)
fprintf(f, " temp[%i].w", inst->Alpha.DestIndex);
@@ -264,13 +372,21 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) {
const char* abs = inst->Alpha.Arg[arg].Abs ? "|" : "";
const char* neg = inst->Alpha.Arg[arg].Negate ? "-" : "";
- fprintf(f, ", %s%ssrc%i.%c%s", neg, abs, inst->Alpha.Arg[arg].Source,
+ fprintf(f, ", %s%ssrc", neg, abs);
+ if(inst->Alpha.Arg[arg].Source == RC_PAIR_PRESUB_SRC)
+ fprintf(f,"p");
+ else
+ fprintf(f,"%d", inst->Alpha.Arg[arg].Source);
+ fprintf(f,".%c%s",
rc_swizzle_char(inst->Alpha.Arg[arg].Swizzle), abs);
}
fprintf(f, "\n");
}
if (inst->WriteALUResult) {
+ for (unsigned i = 0; i < spaces; i++)
+ fprintf(f, " ");
+
fprintf(f, " [aluresult = (");
rc_print_comparefunc(f, "result", inst->ALUResultCompare, "0");
fprintf(f, ")]\n");
@@ -283,6 +399,7 @@ static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst
void rc_print_program(const struct rc_program *prog)
{
unsigned int linenum = 0;
+ unsigned branch_depth = 0;
struct rc_instruction *inst;
fprintf(stderr, "# Radeon Compiler Program\n");
@@ -291,9 +408,9 @@ void rc_print_program(const struct rc_program *prog)
fprintf(stderr, "%3d: ", linenum);
if (inst->Type == RC_INSTRUCTION_PAIR)
- rc_print_pair_instruction(stderr, inst);
+ rc_print_pair_instruction(stderr, inst, &branch_depth);
else
- rc_print_normal_instruction(stderr, inst);
+ rc_print_normal_instruction(stderr, inst, &branch_depth);
linenum++;
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
index be89e9fa5b..d111319d3d 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.c
@@ -26,10 +26,21 @@
*/
#include "radeon_remove_constants.h"
+#include "radeon_dataflow.h"
-void rc_remove_unused_constants(struct radeon_compiler *c,
- unsigned **out_remap_table)
+static void remap_regs(void * userdata, struct rc_instruction * inst,
+ rc_register_file * pfile, unsigned int * pindex)
{
+ unsigned *inv_remap_table = userdata;
+
+ if (*pfile == RC_FILE_CONSTANT) {
+ *pindex = inv_remap_table[*pindex];
+ }
+}
+
+void rc_remove_unused_constants(struct radeon_compiler *c, void *user)
+{
+ unsigned **out_remap_table = (unsigned**)user;
unsigned char *const_used;
unsigned *remap_table;
unsigned *inv_remap_table;
@@ -51,6 +62,10 @@ void rc_remove_unused_constants(struct radeon_compiler *c,
inst != &c->Program.Instructions; inst = inst->Next) {
const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode);
+ /* XXX: This loop and the if statement after it should be
+ * replaced by a call to one of the rc_for_all_reads_* functions.
+ * The reason it does not use one of those functions now is
+ * because none of them have RelAddr as an argument. */
for (unsigned i = 0; i < opcode->NumSrcRegs; i++) {
if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) {
if (inst->U.I.SrcReg[i].RelAddr) {
@@ -60,6 +75,18 @@ void rc_remove_unused_constants(struct radeon_compiler *c,
}
}
}
+ if (inst->U.I.PreSub.Opcode != RC_PRESUB_NONE) {
+ unsigned int i;
+ unsigned int srcp_regs = rc_presubtract_src_reg_count(
+ inst->U.I.PreSub.Opcode);
+ for( i = 0; i < srcp_regs; i++) {
+ if (inst->U.I.PreSub.SrcReg[i].File ==
+ RC_FILE_CONSTANT) {
+ const_used[
+ inst->U.I.PreSub.SrcReg[i].Index] = 1;
+ }
+ }
+ }
}
/* Pass 2: If there is relative addressing, mark all externals as used. */
@@ -100,13 +127,7 @@ void rc_remove_unused_constants(struct radeon_compiler *c,
if (!is_identity) {
for (struct rc_instruction *inst = c->Program.Instructions.Next;
inst != &c->Program.Instructions; inst = inst->Next) {
- const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->U.I.Opcode);
-
- for (unsigned i = 0; i < opcode->NumSrcRegs; i++) {
- if (inst->U.I.SrcReg[i].File == RC_FILE_CONSTANT) {
- inst->U.I.SrcReg[i].Index = inv_remap_table[inst->U.I.SrcReg[i].Index];
- }
- }
+ rc_remap_registers(inst, remap_regs, inv_remap_table);
}
}
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
index 0d3a26ca1c..f29113b922 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_remove_constants.h
@@ -30,7 +30,6 @@
#include "radeon_compiler.h"
-void rc_remove_unused_constants(struct radeon_compiler *c,
- unsigned **out_remap_table);
+void rc_remove_unused_constants(struct radeon_compiler *c, void *user);
#endif
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
index 31c9866883..31d25f9ab8 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.c
@@ -87,7 +87,7 @@ static void rename_all(
* This function assumes all the instructions are still of type
* RC_INSTRUCTION_NORMAL.
*/
-void rc_rename_regs(struct radeon_compiler * c)
+void rc_rename_regs(struct radeon_compiler *c, void *user)
{
unsigned int cur_index = 0;
unsigned int icount;
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.h b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.h
index 4323b995d8..3baf29f612 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.h
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_rename_regs.h
@@ -4,6 +4,6 @@
struct radeon_compiler;
-void rc_rename_regs(struct radeon_compiler * c);
+void rc_rename_regs(struct radeon_compiler *c, void *user);
#endif /* RADEON_RENAME_REGS_H */
diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c
index d2c25fb9cd..74aef765e3 100644
--- a/src/mesa/drivers/dri/r300/r300_blit.c
+++ b/src/mesa/drivers/dri/r300/r300_blit.c
@@ -56,6 +56,7 @@ static void create_vertex_program(struct r300_context *r300)
struct r300_vertex_program_compiler compiler;
struct rc_instruction *inst;
+ memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
inst = rc_insert_new_instruction(&compiler.Base, compiler.Base.Program.Instructions.Prev);
@@ -88,6 +89,12 @@ static void create_vertex_program(struct r300_context *r300)
compiler.RequiredOutputs = compiler.Base.Program.OutputsWritten = (1 << VERT_RESULT_HPOS) | (1 << VERT_RESULT_TEX0);
compiler.SetHwInputOutput = vp_ins_outs;
compiler.code = &r300->blit.vp_code;
+ compiler.Base.is_r500 = r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515;
+ compiler.Base.disable_optimizations = 0;
+ compiler.Base.has_half_swizzles = 0;
+ compiler.Base.max_temp_regs = 32;
+ compiler.Base.max_constants = 256;
+ compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256;
r3xx_compile_vertex_program(&compiler);
}
@@ -119,7 +126,11 @@ static void create_fragment_program(struct r300_context *r300)
compiler.OutputDepth = FRAG_RESULT_DEPTH;
compiler.enable_shadow_ambient = GL_TRUE;
compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515);
+ compiler.Base.disable_optimizations = 0;
+ compiler.Base.has_half_swizzles = 1;
compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32;
+ compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32;
+ compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64;
compiler.code = &r300->blit.fp_code;
compiler.AllocateHwInputs = fp_allocate_hw_inputs;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 7b6521c748..4af91f114d 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -213,6 +213,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
r300ContextPtr r300 = R300_CONTEXT(ctx);
struct r300_fragment_program_compiler compiler;
+ memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
compiler.Base.Debug = (RADEON_DEBUG & RADEON_PIXEL) ? GL_TRUE : GL_FALSE;
@@ -220,7 +221,11 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
compiler.state = fp->state;
compiler.enable_shadow_ambient = GL_TRUE;
compiler.Base.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) ? GL_TRUE : GL_FALSE;
+ compiler.Base.disable_optimizations = 0;
+ compiler.Base.has_half_swizzles = 1;
compiler.Base.max_temp_regs = (compiler.Base.is_r500) ? 128 : 32;
+ compiler.Base.max_constants = compiler.Base.is_r500 ? 256 : 32;
+ compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 512 : 64;
compiler.OutputDepth = FRAG_RESULT_DEPTH;
memset(compiler.OutputColor, 0, 4 * sizeof(unsigned));
compiler.OutputColor[0] = FRAG_RESULT_COLOR;
diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c
index 67d8b2b328..a160128091 100644
--- a/src/mesa/drivers/dri/r300/r300_vertprog.c
+++ b/src/mesa/drivers/dri/r300/r300_vertprog.c
@@ -238,12 +238,19 @@ static struct r300_vertex_program *build_program(GLcontext *ctx,
vp->Base = _mesa_clone_vertex_program(ctx, mesa_vp);
memcpy(&vp->key, wanted_key, sizeof(vp->key));
+ memset(&compiler, 0, sizeof(compiler));
rc_init(&compiler.Base);
compiler.Base.Debug = (RADEON_DEBUG & RADEON_VERTS) ? GL_TRUE : GL_FALSE;
compiler.code = &vp->code;
compiler.RequiredOutputs = compute_required_outputs(vp->Base, vp->key.FpReads);
compiler.SetHwInputOutput = &t_inputs_outputs;
+ compiler.Base.is_r500 = R300_CONTEXT(ctx)->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515;
+ compiler.Base.disable_optimizations = 0;
+ compiler.Base.has_half_swizzles = 0;
+ compiler.Base.max_temp_regs = 32;
+ compiler.Base.max_constants = 256;
+ compiler.Base.max_alu_insts = compiler.Base.is_r500 ? 1024 : 256;
if (compiler.Base.Debug) {
fprintf(stderr, "Initial vertex program:\n");
diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile
index 03c17540e0..200bc20f64 100644
--- a/src/mesa/drivers/dri/r600/Makefile
+++ b/src/mesa/drivers/dri/r600/Makefile
@@ -68,6 +68,7 @@ DRIVER_SOURCES = \
evergreen_vertprog.c \
evergreen_fragprog.c \
evergreen_oglprog.c \
+ evergreen_blit.c \
$(RADEON_COMMON_SOURCES) \
$(EGL_SOURCES) \
$(CS_SOURCES)
diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.c b/src/mesa/drivers/dri/r600/evergreen_blit.c
new file mode 100644
index 0000000000..1ed8a08b78
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/evergreen_blit.c
@@ -0,0 +1,1789 @@
+/*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "radeon_common.h"
+#include "r600_context.h"
+
+#include "evergreen_off.h"
+#include "evergreen_diff.h"
+
+#include "evergreen_blit.h"
+#include "evergreen_blit_shaders.h"
+#include "r600_cmdbuf.h"
+
+/* common formats supported as both textures and render targets */
+unsigned evergreen_check_blit(gl_format mesa_format)
+{
+ switch (mesa_format) {
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_SIGNED_RGBA8888:
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_SIGNED_RGBA8888_REV:
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ case MESA_FORMAT_RGB565:
+ case MESA_FORMAT_RGB565_REV:
+ case MESA_FORMAT_ARGB4444:
+ case MESA_FORMAT_ARGB4444_REV:
+ case MESA_FORMAT_ARGB1555:
+ case MESA_FORMAT_ARGB1555_REV:
+ case MESA_FORMAT_AL88:
+ case MESA_FORMAT_AL88_REV:
+ case MESA_FORMAT_RGB332:
+ case MESA_FORMAT_A8:
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_CI8:
+ case MESA_FORMAT_L8:
+ case MESA_FORMAT_RGBA_FLOAT32:
+ case MESA_FORMAT_RGBA_FLOAT16:
+ case MESA_FORMAT_ALPHA_FLOAT32:
+ case MESA_FORMAT_ALPHA_FLOAT16:
+ case MESA_FORMAT_LUMINANCE_FLOAT32:
+ case MESA_FORMAT_LUMINANCE_FLOAT16:
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+ case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */
+ case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */
+ case MESA_FORMAT_X8_Z24:
+ case MESA_FORMAT_S8_Z24:
+ case MESA_FORMAT_Z24_S8:
+ case MESA_FORMAT_Z16:
+ case MESA_FORMAT_Z32:
+ case MESA_FORMAT_SARGB8:
+ case MESA_FORMAT_SLA8:
+ case MESA_FORMAT_SL8:
+ break;
+ default:
+ return 0;
+ }
+
+ /* ??? */
+ /* not sure blit to depth works or not yet */
+ if (_mesa_get_format_bits(mesa_format, GL_DEPTH_BITS) > 0)
+ return 0;
+
+ return 1;
+}
+
+static inline void
+eg_set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_format,
+ int nPitchInPixel, int w, int h, intptr_t dst_offset)
+{
+ uint32_t cb_color0_base, cb_color0_info = 0;
+ uint32_t cb_color0_pitch = 0, cb_color0_slice = 0, cb_color0_attrib = 0;
+ int id = 0;
+ uint32_t comp_swap, format, source_format, number_type;
+ BATCH_LOCALS(&context->radeon);
+
+ cb_color0_base = dst_offset / 256;
+
+ /* pitch */
+ SETfield(cb_color0_pitch, (nPitchInPixel / 8) - 1,
+ EG_CB_COLOR0_PITCH__TILE_MAX_shift,
+ EG_CB_COLOR0_PITCH__TILE_MAX_mask);
+
+ /* slice */
+ SETfield(cb_color0_slice,
+ ((nPitchInPixel * h) / 64) - 1,
+ EG_CB_COLOR0_SLICE__TILE_MAX_shift,
+ EG_CB_COLOR0_SLICE__TILE_MAX_mask);
+
+ /* CB_COLOR0_ATTRIB */ /* TODO : for z clear, this should be set to 0 */
+ SETbit(cb_color0_attrib,
+ EG_CB_COLOR0_ATTRIB__NON_DISP_TILING_ORDER_bit);
+
+ SETfield(cb_color0_info,
+ ENDIAN_NONE,
+ EG_CB_COLOR0_INFO__ENDIAN_shift,
+ EG_CB_COLOR0_INFO__ENDIAN_mask);
+ SETfield(cb_color0_info,
+ ARRAY_LINEAR_GENERAL,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+
+ SETbit(cb_color0_info, EG_CB_COLOR0_INFO__BLEND_BYPASS_bit);
+
+ switch(mesa_format) {
+ case MESA_FORMAT_RGBA8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SIGNED_RGBA8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_SNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SIGNED_RGBA8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_SNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB565:
+ format = COLOR_5_6_5;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ format = COLOR_5_6_5;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB4444:
+ format = COLOR_4_4_4_4;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ format = COLOR_4_4_4_4;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB1555:
+ format = COLOR_1_5_5_5;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB1555_REV:
+ format = COLOR_1_5_5_5;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_AL88:
+ format = COLOR_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_AL88_REV:
+ format = COLOR_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB332:
+ format = COLOR_3_3_2;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_A8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_CI8:
+ format = COLOR_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_L8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGBA_FLOAT32:
+ format = COLOR_32_32_32_32_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_RGBA_FLOAT16:
+ format = COLOR_16_16_16_16_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT32:
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT16:
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT32:
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT16:
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+ format = COLOR_32_32_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+ format = COLOR_16_16_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_X8_Z24:
+ case MESA_FORMAT_S8_Z24:
+ format = COLOR_8_24;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(cb_color0_info,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z24_S8:
+ format = COLOR_24_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(cb_color0_info,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z16:
+ format = COLOR_16;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(cb_color0_info,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z32:
+ format = COLOR_32;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(cb_color0_info,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_SARGB8:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SLA8:
+ format = COLOR_8_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SL8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ default:
+ fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format));
+ assert("Invalid format for US output\n");
+ return;
+ }
+
+ SETfield(cb_color0_info,
+ format,
+ EG_CB_COLOR0_INFO__FORMAT_shift,
+ EG_CB_COLOR0_INFO__FORMAT_mask);
+ SETfield(cb_color0_info,
+ comp_swap,
+ EG_CB_COLOR0_INFO__COMP_SWAP_shift,
+ EG_CB_COLOR0_INFO__COMP_SWAP_mask);
+ SETfield(cb_color0_info,
+ number_type,
+ EG_CB_COLOR0_INFO__NUMBER_TYPE_shift,
+ EG_CB_COLOR0_INFO__NUMBER_TYPE_mask);
+ SETfield(cb_color0_info,
+ source_format,
+ EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift,
+ EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask);
+
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_BASE + (4 * id), 1);
+ R600_OUT_BATCH(cb_color0_base);
+ R600_OUT_BATCH_RELOC(cb_color0_base,
+ bo,
+ cb_color0_base,
+ 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR0_INFO, cb_color0_info);
+ R600_OUT_BATCH_RELOC(cb_color0_info,
+ bo,
+ cb_color0_info,
+ 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(5);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_PITCH, 3);
+ R600_OUT_BATCH(cb_color0_pitch);
+ R600_OUT_BATCH(cb_color0_slice);
+ R600_OUT_BATCH(0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(4);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR0_ATTRIB, 2);
+ R600_OUT_BATCH(cb_color0_attrib);
+ R600_OUT_BATCH(0);
+ /*
+ R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK.u32All);
+ R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_CMASK_SLICE.u32All);
+ R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK.u32All);
+ R600_OUT_BATCH(evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All);
+ */
+ END_BATCH();
+
+ COMMIT_BATCH();
+
+}
+
+static inline void eg_load_shaders(GLcontext * ctx)
+{
+
+ radeonContextPtr radeonctx = RADEON_CONTEXT(ctx);
+ context_t *context = EVERGREEN_CONTEXT(ctx);
+ int i, size;
+ uint32_t *shader;
+
+ if (context->blit_bo_loaded == 1)
+ return;
+
+ size = 4096;
+ context->blit_bo = radeon_bo_open(radeonctx->radeonScreen->bom, 0,
+ size, 256, RADEON_GEM_DOMAIN_GTT, 0);
+ radeon_bo_map(context->blit_bo, 1);
+ shader = context->blit_bo->ptr;
+
+ for(i=0; i<sizeof(evergreen_vs)/4; i++) {
+ shader[128+i] = evergreen_vs[i];
+ }
+ for(i=0; i<sizeof(evergreen_ps)/4; i++) {
+ shader[256+i] = evergreen_ps[i];
+ }
+
+ radeon_bo_unmap(context->blit_bo);
+ context->blit_bo_loaded = 1;
+
+}
+
+static inline void
+eg_set_shaders(context_t *context)
+{
+ struct radeon_bo * pbo = context->blit_bo;
+ uint32_t sq_pgm_start_fs = (512 >> 8);
+ uint32_t sq_pgm_resources_fs = 0;
+
+ uint32_t sq_pgm_start_vs = (512 >> 8);
+ uint32_t sq_pgm_resources_vs = (2 << NUM_GPRS_shift);
+
+ uint32_t sq_pgm_start_ps = (1024 >> 8);
+ uint32_t sq_pgm_resources_ps = (1 << NUM_GPRS_shift);
+ uint32_t sq_pgm_exports_ps = (1 << 1);
+ BATCH_LOCALS(&context->radeon);
+
+ r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
+
+ /* FS */
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_FS, 1);
+ R600_OUT_BATCH(sq_pgm_start_fs);
+ R600_OUT_BATCH_RELOC(sq_pgm_start_fs,
+ pbo,
+ sq_pgm_start_fs,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_PGM_RESOURCES_FS, sq_pgm_resources_fs);
+ END_BATCH();
+
+ /* VS */
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_VS, 1);
+ R600_OUT_BATCH(sq_pgm_start_vs);
+ R600_OUT_BATCH_RELOC(sq_pgm_start_vs,
+ pbo,
+ sq_pgm_start_vs,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(4);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_VS, 2);
+ R600_OUT_BATCH(sq_pgm_resources_vs);
+ R600_OUT_BATCH(0);
+ END_BATCH();
+
+ /* PS */
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_START_PS, 1);
+ R600_OUT_BATCH(sq_pgm_start_ps);
+ R600_OUT_BATCH_RELOC(sq_pgm_start_ps,
+ pbo,
+ sq_pgm_start_ps,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
+
+ BEGIN_BATCH_NO_AUTOSTATE(5);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_PGM_RESOURCES_PS, 3);
+ R600_OUT_BATCH(sq_pgm_resources_ps);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(sq_pgm_exports_ps);
+ END_BATCH();
+
+ COMMIT_BATCH();
+
+}
+
+static inline void
+eg_set_vtx_resource(context_t *context)
+{
+ struct radeon_bo *bo = context->blit_bo;
+ uint32_t sq_vtx_constant_word3 = 0;
+ BATCH_LOCALS(&context->radeon);
+
+ BEGIN_BATCH_NO_AUTOSTATE(6);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1));
+ R600_OUT_BATCH(mmSQ_VTX_BASE_VTX_LOC - ASIC_CTL_CONST_BASE_INDEX);
+ R600_OUT_BATCH(0);
+
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CTL_CONST, 1));
+ R600_OUT_BATCH(mmSQ_VTX_START_INST_LOC - ASIC_CTL_CONST_BASE_INDEX);
+ R600_OUT_BATCH(0);
+ END_BATCH();
+
+ if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR)
+ r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit);
+ else
+ r700SyncSurf(context, bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit);
+
+ SETfield(sq_vtx_constant_word3, SQ_SEL_X,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_shift,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_X_mask);
+ SETfield(sq_vtx_constant_word3, SQ_SEL_Y,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_shift,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Y_mask);
+ SETfield(sq_vtx_constant_word3, SQ_SEL_Z,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_shift,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_Z_mask);
+ SETfield(sq_vtx_constant_word3, SQ_SEL_W,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_shift,
+ EG_SQ_VTX_CONSTANT_WORD3_0__DST_SEL_W_mask);
+
+ BEGIN_BATCH_NO_AUTOSTATE(10 + 2);
+
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8));
+ R600_OUT_BATCH(EG_SQ_FETCH_RESOURCE_VS_OFFSET * EG_FETCH_RESOURCE_STRIDE);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(48 - 1);
+ R600_OUT_BATCH(16 << SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift);
+ R600_OUT_BATCH(sq_vtx_constant_word3);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(SQ_TEX_VTX_VALID_BUFFER << SQ_TEX_RESOURCE_WORD6_0__TYPE_shift);
+ R600_OUT_BATCH_RELOC(0,
+ bo,
+ 0,
+ RADEON_GEM_DOMAIN_GTT, 0, 0);
+ END_BATCH();
+ COMMIT_BATCH();
+
+}
+
+static inline void
+eg_set_tex_resource(context_t * context,
+ gl_format mesa_format, struct radeon_bo *bo, int w, int h,
+ int TexelPitch, intptr_t src_offset)
+{
+ uint32_t sq_tex_resource0, sq_tex_resource1, sq_tex_resource2, sq_tex_resource4, sq_tex_resource7;
+
+ sq_tex_resource0 = sq_tex_resource1 = sq_tex_resource2 = sq_tex_resource4 = sq_tex_resource7 = 0;
+ BATCH_LOCALS(&context->radeon);
+
+ SETfield(sq_tex_resource0, SQ_TEX_DIM_2D, DIM_shift, DIM_mask);
+ SETfield(sq_tex_resource0, ARRAY_LINEAR_GENERAL,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
+
+ switch (mesa_format) {
+ case MESA_FORMAT_RGBA8888:
+ case MESA_FORMAT_SIGNED_RGBA8888:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) {
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
+ }
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ case MESA_FORMAT_SIGNED_RGBA8888_REV:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) {
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_X_shift, FORMAT_COMP_X_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask);
+ SETfield(sq_tex_resource4, SQ_FORMAT_COMP_SIGNED,
+ FORMAT_COMP_W_shift, FORMAT_COMP_W_mask);
+ }
+ break;
+ case MESA_FORMAT_ARGB8888:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_XRGB8888:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ARGB8888_REV:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_XRGB8888_REV:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_RGB565:
+ SETfield(sq_tex_resource7, FMT_5_6_5,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ SETfield(sq_tex_resource7, FMT_5_6_5,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ARGB4444:
+ SETfield(sq_tex_resource7, FMT_4_4_4_4,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ SETfield(sq_tex_resource7, FMT_4_4_4_4,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ARGB1555:
+ SETfield(sq_tex_resource7, FMT_1_5_5_5,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ARGB1555_REV:
+ SETfield(sq_tex_resource7, FMT_1_5_5_5,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_AL88:
+ case MESA_FORMAT_AL88_REV: /* TODO : Check this. */
+ SETfield(sq_tex_resource7, FMT_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_RGB332:
+ SETfield(sq_tex_resource7, FMT_3_3_2,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_A8: /* ZERO, ZERO, ZERO, X */
+ SETfield(sq_tex_resource7, FMT_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_L8: /* X, X, X, ONE */
+ SETfield(sq_tex_resource7, FMT_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_I8: /* X, X, X, X */
+ case MESA_FORMAT_CI8:
+ SETfield(sq_tex_resource7, FMT_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_RGBA_FLOAT32:
+ SETfield(sq_tex_resource7, FMT_32_32_32_32_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_RGBA_FLOAT16:
+ SETfield(sq_tex_resource7, FMT_16_16_16_16_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT32: /* ZERO, ZERO, ZERO, X */
+ SETfield(sq_tex_resource7, FMT_32_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT16: /* ZERO, ZERO, ZERO, X */
+ SETfield(sq_tex_resource7, FMT_16_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT32: /* X, X, X, ONE */
+ SETfield(sq_tex_resource7, FMT_32_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT16: /* X, X, X, ONE */
+ SETfield(sq_tex_resource7, FMT_16_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+ SETfield(sq_tex_resource7, FMT_32_32_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+ SETfield(sq_tex_resource7, FMT_16_16_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */
+ SETfield(sq_tex_resource7, FMT_32_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */
+ SETfield(sq_tex_resource7, FMT_16_FLOAT,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_Z16:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_16,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_X8_Z24:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_8_24,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_S8_Z24:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETbit(sq_tex_resource0, TILE_TYPE_bit);
+ SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_8_24,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_Z24_S8:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETbit(sq_tex_resource0, TILE_TYPE_bit);
+ SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_24_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_0,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_Z32:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETbit(sq_tex_resource0, TILE_TYPE_bit);
+ SETfield(sq_tex_resource0, ARRAY_1D_TILED_THIN1,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_shift,
+ SQ_TEX_RESOURCE_WORD0_0__TILE_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_32,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_S8:
+ /* ??? */
+ CLEARbit(sq_tex_resource0, EG_SQ_TEX_RESOURCE_WORD0_0__NDTO_bit);
+ SETfield(sq_tex_resource1, ARRAY_1D_TILED_THIN1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__ARRAY_MODE_mask);
+ SETfield(sq_tex_resource7, FMT_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ break;
+ case MESA_FORMAT_SARGB8:
+ SETfield(sq_tex_resource7, FMT_8_8_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Z,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_W,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
+ break;
+ case MESA_FORMAT_SLA8:
+ SETfield(sq_tex_resource7, FMT_8_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_Y,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
+ break;
+ case MESA_FORMAT_SL8: /* X, X, X, ONE */
+ SETfield(sq_tex_resource7, FMT_8,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift,
+ EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_X,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+ SETfield(sq_tex_resource4, SQ_SEL_1,
+ SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
+ SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
+ break;
+ default:
+ fprintf(stderr,"Invalid format for copy %s\n",_mesa_get_format_name(mesa_format));
+ assert("Invalid format for US output\n");
+ return;
+ };
+
+ SETfield(sq_tex_resource0, (TexelPitch/8)-1,
+ EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_shift,
+ EG_SQ_TEX_RESOURCE_WORD0_0__PITCH_mask);
+ SETfield(sq_tex_resource0, w - 1,
+ EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_shift,
+ EG_SQ_TEX_RESOURCE_WORD0_0__TEX_WIDTH_mask);
+ SETfield(sq_tex_resource1, h - 1,
+ EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_shift,
+ EG_SQ_TEX_RESOURCE_WORD1_0__TEX_HEIGHT_mask);
+
+ sq_tex_resource2 = src_offset / 256;
+
+ SETfield(sq_tex_resource7, SQ_TEX_VTX_VALID_TEXTURE,
+ SQ_TEX_RESOURCE_WORD6_0__TYPE_shift,
+ SQ_TEX_RESOURCE_WORD6_0__TYPE_mask);
+
+ r700SyncSurf(context, bo,
+ RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM,
+ 0, TC_ACTION_ENA_bit);
+
+ BEGIN_BATCH_NO_AUTOSTATE(10 + 4);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 8));
+ R600_OUT_BATCH(0 * 7);
+ R600_OUT_BATCH(sq_tex_resource0);
+ R600_OUT_BATCH(sq_tex_resource1);
+ R600_OUT_BATCH(sq_tex_resource2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(sq_tex_resource4);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(sq_tex_resource7);
+ R600_OUT_BATCH_RELOC(0,
+ bo,
+ 0,
+ RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
+ R600_OUT_BATCH_RELOC(0,
+ bo,
+ 0,
+ RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0);
+ END_BATCH();
+ COMMIT_BATCH();
+}
+
+static inline void
+eg_set_tex_sampler(context_t * context)
+{
+ uint32_t sq_tex_sampler_word0 = 0, sq_tex_sampler_word1 = 0, sq_tex_sampler_word2 = 0;
+ int i = 0;
+
+ SETbit(sq_tex_sampler_word2, EG_SQ_TEX_SAMPLER_WORD2_0__TYPE_bit);
+
+ BATCH_LOCALS(&context->radeon);
+
+ BEGIN_BATCH_NO_AUTOSTATE(5);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3));
+ R600_OUT_BATCH(i * 3);
+ R600_OUT_BATCH(sq_tex_sampler_word0);
+ R600_OUT_BATCH(sq_tex_sampler_word1);
+ R600_OUT_BATCH(sq_tex_sampler_word2);
+ END_BATCH();
+
+}
+
+static inline void
+eg_set_scissors(context_t *context, int x1, int y1, int x2, int y2)
+{
+ BATCH_LOCALS(&context->radeon);
+
+ BEGIN_BATCH_NO_AUTOSTATE(17);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_SCREEN_SCISSOR_TL, 2);
+ R600_OUT_BATCH((x1 << 0) | (y1 << 16));
+ R600_OUT_BATCH((x2 << 0) | (y2 << 16));
+
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_WINDOW_OFFSET, 3);
+ R600_OUT_BATCH(0); //PA_SC_WINDOW_OFFSET
+ R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit)); //PA_SC_WINDOW_SCISSOR_TL
+ R600_OUT_BATCH((x2 << 0) | (y2 << 16));
+
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_GENERIC_SCISSOR_TL, 2);
+ R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit));
+ R600_OUT_BATCH((x2 << 0) | (y2 << 16));
+
+ /* XXX 16 of these PA_SC_VPORT_SCISSOR_0_TL_num ... */
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_SCISSOR_0_TL, 2);
+ R600_OUT_BATCH((x1 << 0) | (y1 << 16) | (WINDOW_OFFSET_DISABLE_bit));
+ R600_OUT_BATCH((x2 << 0) | (y2 << 16));
+ END_BATCH();
+
+ COMMIT_BATCH();
+
+}
+
+static inline void
+eg_set_vb_data(context_t * context, int src_x, int src_y, int dst_x, int dst_y,
+ int w, int h, int src_h, unsigned flip_y)
+{
+ float *vb;
+ radeon_bo_map(context->blit_bo, 1);
+ vb = context->blit_bo->ptr;
+
+ vb[0] = (float)(dst_x);
+ vb[1] = (float)(dst_y);
+ vb[2] = (float)(src_x);
+ vb[3] = (flip_y) ? (float)(src_h - src_y) : (float)src_y;
+
+ vb[4] = (float)(dst_x);
+ vb[5] = (float)(dst_y + h);
+ vb[6] = (float)(src_x);
+ vb[7] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h);
+
+ vb[8] = (float)(dst_x + w);
+ vb[9] = (float)(dst_y + h);
+ vb[10] = (float)(src_x + w);
+ vb[11] = (flip_y) ? (float)(src_h - (src_y + h)) : (float)(src_y + h);
+
+ radeon_bo_unmap(context->blit_bo);
+
+}
+
+static inline void
+eg_draw_auto(context_t *context)
+{
+ BATCH_LOCALS(&context->radeon);
+ uint32_t vgt_primitive_type = 0, vgt_index_type = 0, vgt_draw_initiator = 0, vgt_num_indices;
+
+ SETfield(vgt_primitive_type, DI_PT_RECTLIST,
+ VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift,
+ VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask);
+ SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift,
+ INDEX_TYPE_mask);
+ SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift,
+ MAJOR_MODE_mask);
+ SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift,
+ SOURCE_SELECT_mask);
+
+ vgt_num_indices = 3;
+
+ BEGIN_BATCH_NO_AUTOSTATE(10);
+ // prim
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_PRIMITIVE_TYPE, 1);
+ R600_OUT_BATCH(vgt_primitive_type);
+ // index type
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0));
+ R600_OUT_BATCH(vgt_index_type);
+ // num instances
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0));
+ R600_OUT_BATCH(1);
+ //
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1));
+ R600_OUT_BATCH(vgt_num_indices);
+ R600_OUT_BATCH(vgt_draw_initiator);
+
+ END_BATCH();
+ COMMIT_BATCH();
+}
+
+static inline void
+eg_set_default_state(context_t *context)
+{
+ int num_ps_gprs;
+ int num_vs_gprs;
+ int num_gs_gprs;
+ int num_es_gprs;
+ int num_hs_gprs;
+ int num_ls_gprs;
+ int num_temp_gprs;
+ int num_ps_threads;
+ int num_vs_threads;
+ int num_gs_threads;
+ int num_es_threads;
+ int num_hs_threads;
+ int num_ls_threads;
+ int num_ps_stack_entries;
+ int num_vs_stack_entries;
+ int num_gs_stack_entries;
+ int num_es_stack_entries;
+ int num_hs_stack_entries;
+ int num_ls_stack_entries;
+ uint32_t sq_config = 0, sq_gpr_resource_mgmt_1 = 0, sq_gpr_resource_mgmt_2 = 0;
+ uint32_t sq_gpr_resource_mgmt_3 = 0;
+ uint32_t sq_thread_resource_mgmt = 0, sq_thread_resource_mgmt_2 = 0;
+ uint32_t sq_stack_resource_mgmt_1 = 0, sq_stack_resource_mgmt_2 = 0, sq_stack_resource_mgmt_3 = 0;
+ BATCH_LOCALS(&context->radeon);
+
+ switch (context->radeon.radeonScreen->chip_family) {
+ case CHIP_FAMILY_CEDAR:
+ default:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 96;
+ num_vs_threads = 16;
+ num_gs_threads = 16;
+ num_es_threads = 16;
+ num_hs_threads = 16;
+ num_ls_threads = 16;
+ num_ps_stack_entries = 42;
+ num_vs_stack_entries = 42;
+ num_gs_stack_entries = 42;
+ num_es_stack_entries = 42;
+ num_hs_stack_entries = 42;
+ num_ls_stack_entries = 42;
+ break;
+ case CHIP_FAMILY_REDWOOD:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 42;
+ num_vs_stack_entries = 42;
+ num_gs_stack_entries = 42;
+ num_es_stack_entries = 42;
+ num_hs_stack_entries = 42;
+ num_ls_stack_entries = 42;
+ break;
+ case CHIP_FAMILY_JUNIPER:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 85;
+ num_vs_stack_entries = 85;
+ num_gs_stack_entries = 85;
+ num_es_stack_entries = 85;
+ num_hs_stack_entries = 85;
+ num_ls_stack_entries = 85;
+ break;
+ case CHIP_FAMILY_CYPRESS:
+ case CHIP_FAMILY_HEMLOCK:
+ num_ps_gprs = 93;
+ num_vs_gprs = 46;
+ num_temp_gprs = 4;
+ num_gs_gprs = 31;
+ num_es_gprs = 31;
+ num_hs_gprs = 23;
+ num_ls_gprs = 23;
+ num_ps_threads = 128;
+ num_vs_threads = 20;
+ num_gs_threads = 20;
+ num_es_threads = 20;
+ num_hs_threads = 20;
+ num_ls_threads = 20;
+ num_ps_stack_entries = 85;
+ num_vs_stack_entries = 85;
+ num_gs_stack_entries = 85;
+ num_es_stack_entries = 85;
+ num_hs_stack_entries = 85;
+ num_ls_stack_entries = 85;
+ break;
+ }
+
+ if (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_CEDAR)
+ CLEARbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit);
+ else
+ SETbit(sq_config, EG_SQ_CONFIG__VC_ENABLE_bit);
+ SETbit(sq_config, EG_SQ_CONFIG__EXPORT_SRC_C_bit);
+
+ SETfield(sq_config, 0,
+ EG_SQ_CONFIG__PS_PRIO_shift,
+ EG_SQ_CONFIG__PS_PRIO_mask);
+ SETfield(sq_config, 1,
+ EG_SQ_CONFIG__VS_PRIO_shift,
+ EG_SQ_CONFIG__VS_PRIO_mask);
+ SETfield(sq_config, 2,
+ EG_SQ_CONFIG__GS_PRIO_shift,
+ EG_SQ_CONFIG__GS_PRIO_mask);
+ SETfield(sq_config, 3,
+ EG_SQ_CONFIG__ES_PRIO_shift,
+ EG_SQ_CONFIG__ES_PRIO_mask);
+
+
+ SETfield(sq_gpr_resource_mgmt_1, num_ps_gprs,
+ NUM_PS_GPRS_shift, NUM_PS_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_1, num_vs_gprs,
+ NUM_VS_GPRS_shift, NUM_VS_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_1, num_temp_gprs,
+ NUM_CLAUSE_TEMP_GPRS_shift, NUM_CLAUSE_TEMP_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_2, num_gs_gprs,
+ NUM_GS_GPRS_shift, NUM_GS_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_2, num_es_gprs,
+ NUM_ES_GPRS_shift, NUM_ES_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_3, num_hs_gprs,
+ NUM_PS_GPRS_shift, NUM_PS_GPRS_mask);
+ SETfield(sq_gpr_resource_mgmt_3, num_ls_gprs,
+ NUM_VS_GPRS_shift, NUM_VS_GPRS_mask);
+
+ SETfield(sq_thread_resource_mgmt, num_ps_threads,
+ NUM_PS_THREADS_shift, NUM_PS_THREADS_mask);
+ SETfield(sq_thread_resource_mgmt, num_vs_threads,
+ NUM_VS_THREADS_shift, NUM_VS_THREADS_mask);
+ SETfield(sq_thread_resource_mgmt, num_gs_threads,
+ NUM_GS_THREADS_shift, NUM_GS_THREADS_mask);
+ SETfield(sq_thread_resource_mgmt, num_es_threads,
+ NUM_ES_THREADS_shift, NUM_ES_THREADS_mask);
+ SETfield(sq_thread_resource_mgmt_2, num_hs_threads,
+ NUM_PS_THREADS_shift, NUM_PS_THREADS_mask);
+ SETfield(sq_thread_resource_mgmt_2, num_ls_threads,
+ NUM_VS_THREADS_shift, NUM_VS_THREADS_mask);
+
+ SETfield(sq_stack_resource_mgmt_1, num_ps_stack_entries,
+ NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask);
+ SETfield(sq_stack_resource_mgmt_1, num_vs_stack_entries,
+ NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask);
+ SETfield(sq_stack_resource_mgmt_2, num_gs_stack_entries,
+ NUM_GS_STACK_ENTRIES_shift, NUM_GS_STACK_ENTRIES_mask);
+ SETfield(sq_stack_resource_mgmt_2, num_es_stack_entries,
+ NUM_ES_STACK_ENTRIES_shift, NUM_ES_STACK_ENTRIES_mask);
+ SETfield(sq_stack_resource_mgmt_3, num_hs_stack_entries,
+ NUM_PS_STACK_ENTRIES_shift, NUM_PS_STACK_ENTRIES_mask);
+ SETfield(sq_stack_resource_mgmt_3, num_ls_stack_entries,
+ NUM_VS_STACK_ENTRIES_shift, NUM_VS_STACK_ENTRIES_mask);
+
+
+ BEGIN_BATCH_NO_AUTOSTATE(196);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_DYN_GPR_CNTL_PS_FLUSH_REQ, 0);
+ //6
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_CONFIG, 4);
+ R600_OUT_BATCH(sq_config);
+ R600_OUT_BATCH(sq_gpr_resource_mgmt_1);
+ R600_OUT_BATCH(sq_gpr_resource_mgmt_2);
+ R600_OUT_BATCH(sq_gpr_resource_mgmt_3);
+ //7
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_THREAD_RESOURCE_MGMT, 5);
+ R600_OUT_BATCH(sq_thread_resource_mgmt);
+ R600_OUT_BATCH(sq_thread_resource_mgmt_2);
+ R600_OUT_BATCH(sq_stack_resource_mgmt_1);
+ R600_OUT_BATCH(sq_stack_resource_mgmt_2);
+ R600_OUT_BATCH(sq_stack_resource_mgmt_3);
+ //3
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_CONTEXT_CONTROL, 1));
+ R600_OUT_BATCH(0x80000000);
+ R600_OUT_BATCH(0x80000000);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_LDS_ALLOC_PS, 0);
+ //8
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_ESGS_RING_ITEMSIZE, 6);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //6
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SQ_GS_VERT_ITEMSIZE, 4);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_DB_DEPTH_CONTROL, 0);
+ //7
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_RENDER_CONTROL, 5);
+ R600_OUT_BATCH(0x00000060);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x0000002a);
+ R600_OUT_BATCH(0);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_DB_STENCIL_CLEAR, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_DB_ALPHA_TO_MASK, 0x0000aa00);
+ //15
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_CLIPRECT_RULE, 13);
+ R600_OUT_BATCH(0x0000ffff);
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH(0x20002000);
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH(0x20002000);
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH(0x20002000);
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH(0x20002000);
+ R600_OUT_BATCH(0xaaaaaaaa);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x0000000f);
+ R600_OUT_BATCH(0x0000000f);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_VPORT_ZMIN_0, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x3f800000);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SX_MISC, 0);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_MODE_CNTL_0, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //18
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SC_LINE_CNTL, 16);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x00000005);
+ R600_OUT_BATCH(0x3f800000);
+ R600_OUT_BATCH(0x3f800000);
+ R600_OUT_BATCH(0x3f800000);
+ R600_OUT_BATCH(0x3f800000);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0xffffffff);
+ //15
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_COLOR_CONTROL, 13);
+ R600_OUT_BATCH(0x00cc0010);
+ R600_OUT_BATCH(0x00000210);
+ R600_OUT_BATCH(0x00010000);
+ R600_OUT_BATCH(0x00000004);
+ R600_OUT_BATCH(0x00000100);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //8
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POLY_OFFSET_DB_FMT_CNTL, 6);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //11
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_MAX_VTX_INDX, 9);
+ R600_OUT_BATCH(0x00ffffff);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_INSTANCE_STEP_RATE_0, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_REUSE_OFF, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //19
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_PA_SU_POINT_SIZE, 17);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x00000008);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_PRIMITIVEID_EN, 0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_MULTI_PRIM_IB_RESET_EN, 0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_VGT_SHADER_STAGES_EN, 0);
+ //4
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_VGT_STRMOUT_CONFIG, 2);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND0_CONTROL, 0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_VS_OUT_CONFIG, 0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_VS_OUT_ID_0, 0);
+ //3
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SPI_PS_INPUT_CNTL_0, 0);
+ //13
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_SPI_PS_IN_CONTROL_0, 11);
+ R600_OUT_BATCH(0x20000001);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0x00100000);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+ R600_OUT_BATCH(0);
+
+ END_BATCH();
+ COMMIT_BATCH();
+}
+
+static GLboolean eg_validate_buffers(context_t *rmesa,
+ struct radeon_bo *src_bo,
+ struct radeon_bo *dst_bo)
+{
+ int ret;
+
+ radeon_cs_space_reset_bos(rmesa->radeon.cmdbuf.cs);
+
+ ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
+ src_bo, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
+
+ ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
+ dst_bo, 0, RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT);
+ if (ret)
+ return GL_FALSE;
+
+ ret = radeon_cs_space_check_with_bo(rmesa->radeon.cmdbuf.cs,
+ rmesa->blit_bo,
+ RADEON_GEM_DOMAIN_GTT, 0);
+ if (ret)
+ return GL_FALSE;
+
+ return GL_TRUE;
+}
+
+unsigned evergreen_blit(GLcontext *ctx,
+ struct radeon_bo *src_bo,
+ intptr_t src_offset,
+ gl_format src_mesaformat,
+ unsigned src_pitch,
+ unsigned src_width,
+ unsigned src_height,
+ unsigned src_x,
+ unsigned src_y,
+ struct radeon_bo *dst_bo,
+ intptr_t dst_offset,
+ gl_format dst_mesaformat,
+ unsigned dst_pitch,
+ unsigned dst_width,
+ unsigned dst_height,
+ unsigned dst_x,
+ unsigned dst_y,
+ unsigned w,
+ unsigned h,
+ unsigned flip_y)
+{
+ context_t *context = EVERGREEN_CONTEXT(ctx);
+ int id = 0;
+
+ if (!evergreen_check_blit(dst_mesaformat))
+ return GL_FALSE;
+
+ if (src_bo == dst_bo) {
+ return GL_FALSE;
+ }
+
+ if (src_offset % 256 || dst_offset % 256) {
+ return GL_FALSE;
+ }
+
+ if (0) {
+ fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n",
+ src_width, src_height, src_pitch,
+ _mesa_format_row_stride(src_mesaformat, src_width),
+ _mesa_get_format_name(src_mesaformat));
+ fprintf(stderr, "dst: width %d, height %d, pitch %d, format %s\n",
+ dst_width, dst_height,
+ _mesa_format_row_stride(dst_mesaformat, dst_width),
+ _mesa_get_format_name(dst_mesaformat));
+ }
+
+ /* Flush is needed to make sure that source buffer has correct data */
+ radeonFlush(ctx);
+
+ rcommonEnsureCmdBufSpace(&context->radeon, 327, __FUNCTION__);
+
+ /* load shaders */
+ eg_load_shaders(context->radeon.glCtx);
+
+ if (!eg_validate_buffers(context, src_bo, dst_bo))
+ return GL_FALSE;
+
+ /* set clear state */
+ /* 196 */
+ eg_set_default_state(context);
+
+ /* shaders */
+ /* 34 */
+ eg_set_shaders(context);
+
+ /* src */
+ /* 21 */
+ eg_set_tex_resource(context, src_mesaformat, src_bo,
+ src_width, src_height, src_pitch, src_offset);
+
+ /* 5 */
+ eg_set_tex_sampler(context);
+
+ /* dst */
+ /* 19 */
+ eg_set_render_target(context, dst_bo, dst_mesaformat,
+ dst_pitch, dst_width, dst_height, dst_offset);
+ /* scissors */
+ /* 17 */
+ eg_set_scissors(context, dst_x, dst_y, dst_x + dst_width, dst_y + dst_height);
+
+ eg_set_vb_data(context, src_x, src_y, dst_x, dst_y, w, h, src_height, flip_y);
+ /* Vertex buffer setup */
+ /* 18 */
+ eg_set_vtx_resource(context);
+
+ /* draw */
+ /* 10 */
+ eg_draw_auto(context);
+
+ /* 7 */
+ r700SyncSurf(context, dst_bo, 0,
+ RADEON_GEM_DOMAIN_VRAM|RADEON_GEM_DOMAIN_GTT,
+ CB_ACTION_ENA_bit | (1 << (id + 6)));
+
+ radeonFlush(ctx);
+
+ return GL_TRUE;
+}
diff --git a/src/mesa/drivers/dri/r600/evergreen_blit.h b/src/mesa/drivers/dri/r600/evergreen_blit.h
new file mode 100644
index 0000000000..68d072ecb0
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/evergreen_blit.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#ifndef EVERGREEN_BLIT_H
+#define EVERGREEN_BLIT_H
+
+unsigned evergreen_check_blit(gl_format mesa_format);
+
+unsigned evergreen_blit(GLcontext *ctx,
+ struct radeon_bo *src_bo,
+ intptr_t src_offset,
+ gl_format src_mesaformat,
+ unsigned src_pitch,
+ unsigned src_width,
+ unsigned src_height,
+ unsigned src_x_offset,
+ unsigned src_y_offset,
+ struct radeon_bo *dst_bo,
+ intptr_t dst_offset,
+ gl_format dst_mesaformat,
+ unsigned dst_pitch,
+ unsigned dst_width,
+ unsigned dst_height,
+ unsigned dst_x_offset,
+ unsigned dst_y_offset,
+ unsigned w,
+ unsigned h,
+ unsigned flip_y);
+
+#endif // EVERGREEN_BLIT_H
diff --git a/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h b/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h
new file mode 100644
index 0000000000..eb02528073
--- /dev/null
+++ b/src/mesa/drivers/dri/r600/evergreen_blit_shaders.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 Advanced Micro Devices, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+const uint32_t evergreen_vs[] =
+{
+ 0x00000004,
+ 0x80800400,
+ 0x0000a03c,
+ 0x95000688,
+ 0x00004000,
+ 0x15200688,
+ 0x00000000,
+ 0x00000000,
+ 0x3c000000,
+ 0x67961001,
+ 0x00080000,
+ 0x00000000,
+ 0x1c000000,
+ 0x67961000,
+ 0x00000008,
+ 0x00000000,
+};
+
+const uint32_t evergreen_ps[] =
+{
+ 0x00000003,
+ 0xa00c0000,
+ 0x00000008,
+ 0x80400000,
+ 0x00000000,
+ 0x95200688,
+ 0x00380400,
+ 0x00146b10,
+ 0x00380000,
+ 0x20146b10,
+ 0x00380400,
+ 0x40146b00,
+ 0x80380000,
+ 0x60146b00,
+ 0x00000000,
+ 0x00000000,
+ 0x00000010,
+ 0x000d1000,
+ 0xb0800000,
+ 0x00000000,
+};
+
diff --git a/src/mesa/drivers/dri/r600/evergreen_chip.c b/src/mesa/drivers/dri/r600/evergreen_chip.c
index f925f215bc..1050c776bf 100644
--- a/src/mesa/drivers/dri/r600/evergreen_chip.c
+++ b/src/mesa/drivers/dri/r600/evergreen_chip.c
@@ -60,7 +60,46 @@ do { \
insert_at_tail(&context->radeon.hw.atomlist, &context->evergreen_atoms.ATOM); \
} while (0)
-/*
+static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ struct radeon_query_object *query = radeon->query.current;
+ int count;
+
+ if (!query || query->emitted_begin)
+ count = 0;
+ else
+ count = atom->cmd_size;
+ radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count);
+ return count;
+}
+
+static void evergreenSendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom)
+{
+ radeonContextPtr radeon = RADEON_CONTEXT(ctx);
+ struct radeon_query_object *query = radeon->query.current;
+ BATCH_LOCALS(radeon);
+ radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
+
+ /* clear the buffer */
+ radeon_bo_map(query->bo, GL_FALSE);
+ memset(query->bo->ptr, 0, 8 * 2 * sizeof(uint64_t)); /* 8 DBs, 2 qwords each */
+ radeon_bo_unmap(query->bo);
+
+ radeon_cs_space_check_with_bo(radeon->cmdbuf.cs,
+ query->bo,
+ 0, RADEON_GEM_DOMAIN_GTT);
+
+ BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
+ R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+ query->emitted_begin = GL_TRUE;
+}
+
static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ)
{
radeon->query.queryobj.cmd_size = (SZ);
@@ -69,11 +108,11 @@ static void evergreen_init_query_stateobj(radeonContextPtr radeon, int SZ)
radeon->query.queryobj.idx = 0;
radeon->query.queryobj.check = check_queryobj;
radeon->query.queryobj.dirty = GL_FALSE;
- radeon->query.queryobj.emit = r700SendQueryBegin;
+ radeon->query.queryobj.emit = evergreenSendQueryBegin;
radeon->hw.max_state_size += (SZ);
insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj);
}
-*/
+
static int check_always(GLcontext *ctx, struct radeon_state_atom *atom)
{
@@ -107,7 +146,6 @@ static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom
}
if (bo)
{
- radeon_bo_unmap(bo);
r700SyncSurf(context, bo,
RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM,
@@ -118,7 +156,7 @@ static void evergreenSendTexState(GLcontext *ctx, struct radeon_state_atom *atom
if( (1<<i) & vp->r700AsmCode.unVetTexBits )
{ /* vs texture */
- R600_OUT_BATCH((i + VERT_ATTRIB_MAX + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE);
+ R600_OUT_BATCH((i + VERT_ATTRIB_MAX + EG_SQ_FETCH_RESOURCE_VS_OFFSET) * EG_FETCH_RESOURCE_STRIDE);
}
else
{
@@ -512,8 +550,9 @@ static void evergreenSendPSresource(GLcontext *ctx)
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
struct radeon_bo * pbo;
-
- struct radeon_bo * pbo_const;
+ struct radeon_bo * pbo_const;
+ /* const size reg is in units of 16 consts */
+ int const_size = ((evergreen->ps.num_consts * 4) + 15) & ~15;
BATCH_LOCALS(&context->radeon);
radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
@@ -544,17 +583,8 @@ static void evergreenSendPSresource(GLcontext *ctx)
{
r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
- BEGIN_BATCH_NO_AUTOSTATE(3);
-
- if(evergreen->ps.num_consts < 4)
- {
- EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, 1);
- }
- else
- {
- EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, (evergreen->ps.num_consts * 4)/16 );
- }
-
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_PS_0, const_size / 16);
END_BATCH();
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
@@ -575,8 +605,9 @@ static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *at
context_t *context = EVERGREEN_CONTEXT(ctx);
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
struct radeon_bo * pbo;
-
- struct radeon_bo * pbo_const;
+ struct radeon_bo * pbo_const;
+ /* const size reg is in units of 16 consts */
+ int const_size = ((evergreen->vs.num_consts * 4) + 15) & ~15;
BATCH_LOCALS(&context->radeon);
radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
@@ -608,17 +639,8 @@ static void evergreenSendVSresource(GLcontext *ctx, struct radeon_state_atom *at
{
r700SyncSurf(context, pbo_const, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit);
- BEGIN_BATCH_NO_AUTOSTATE(3);
-
- if(evergreen->vs.num_consts < 4)
- {
- EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, 1);
- }
- else
- {
- EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, (evergreen->vs.num_consts * 4)/16 );
- }
-
+ BEGIN_BATCH_NO_AUTOSTATE(3);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_SQ_ALU_CONST_BUFFER_SIZE_VS_0, const_size / 16);
END_BATCH();
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
@@ -843,7 +865,7 @@ static void evergreenSetDepthTarget(context_t *context)
{
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
struct radeon_renderbuffer *rrb;
- unsigned int nPitchInPixel;
+ unsigned int nPitchInPixel, height;
rrb = radeon_get_depthbuffer(&context->radeon);
if (!rrb)
@@ -855,13 +877,24 @@ static void evergreenSetDepthTarget(context_t *context)
evergreen->DB_DEPTH_SIZE.u32All = 0;
+ nPitchInPixel = rrb->pitch/rrb->cpp;
+
+ if (context->radeon.radeonScreen->driScreen->dri2.enabled)
+ {
+ height = rrb->base.Height;
+ }
+ else
+ {
+ height = context->radeon.radeonScreen->driScreen->fbHeight;
+ }
+
SETfield(evergreen->DB_DEPTH_SIZE.u32All, (nPitchInPixel/8)-1,
EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_shift,
EG_DB_DEPTH_SIZE__PITCH_TILE_MAX_mask);
- SETfield(evergreen->DB_DEPTH_SIZE.u32All, (context->radeon.radeonScreen->driScreen->fbHeight/8)-1,
+ SETfield(evergreen->DB_DEPTH_SIZE.u32All, (height/8)-1,
EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_shift,
EG_DB_DEPTH_SIZE__HEIGHT_TILE_MAX_mask);
- evergreen->DB_DEPTH_SLICE.u32All = ( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1;
+ evergreen->DB_DEPTH_SLICE.u32All = ( (nPitchInPixel * height)/64 )-1;
if(4 == rrb->cpp)
{
@@ -898,9 +931,6 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom)
R600_OUT_BATCH(evergreen->DB_DEPTH_VIEW.u32All);
R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE.u32All);
R600_OUT_BATCH(evergreen->DB_RENDER_OVERRIDE2.u32All);
- /*
- R600_OUT_BATCH(evergreen->DB_HTILE_DATA_BASE.u32All);
- */
END_BATCH();
//4
@@ -943,6 +973,16 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom)
rrb = radeon_get_depthbuffer(&context->radeon);
if( (rrb != NULL) && (rrb->bo != NULL) )
{
+
+ /* make the hw happy */
+ BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
+ EVERGREEN_OUT_BATCH_REGVAL(EG_DB_HTILE_DATA_BASE, evergreen->DB_HTILE_DATA_BASE.u32All);
+ R600_OUT_BATCH_RELOC(evergreen->DB_HTILE_DATA_BASE.u32All,
+ rrb->bo,
+ evergreen->DB_HTILE_DATA_BASE.u32All,
+ 0, RADEON_GEM_DOMAIN_VRAM, 0);
+ END_BATCH();
+
//5
BEGIN_BATCH_NO_AUTOSTATE(3 + 2);
EVERGREEN_OUT_BATCH_REGVAL(EG_DB_Z_INFO, evergreen->DB_Z_INFO.u32All);
@@ -1019,9 +1059,9 @@ static void evergreenSendDB(GLcontext *ctx, struct radeon_state_atom *atom)
static void evergreenSetRenderTarget(context_t *context, int id)
{
EVERGREEN_CHIP_CONTEXT *evergreen = GET_EVERGREEN_CHIP(context);
-
+ uint32_t format = COLOR_8_8_8_8, comp_swap = SWAP_ALT, number_type = NUMBER_UNORM, source_format = 1;
struct radeon_renderbuffer *rrb;
- unsigned int nPitchInPixel;
+ unsigned int nPitchInPixel, height;
rrb = radeon_get_colorbuffer(&context->radeon);
if (!rrb || !rrb->bo) {
@@ -1036,14 +1076,22 @@ static void evergreenSetRenderTarget(context_t *context, int id)
/* pitch */
nPitchInPixel = rrb->pitch/rrb->cpp;
+ if (context->radeon.radeonScreen->driScreen->dri2.enabled)
+ {
+ height = rrb->base.Height;
+ }
+ else
+ {
+ height = context->radeon.radeonScreen->driScreen->fbHeight;
+ }
+
SETfield(evergreen->render_target[id].CB_COLOR0_PITCH.u32All, (nPitchInPixel/8)-1,
EG_CB_COLOR0_PITCH__TILE_MAX_shift,
EG_CB_COLOR0_PITCH__TILE_MAX_mask);
- /* skice */
+ /* slice */
SETfield(evergreen->render_target[id].CB_COLOR0_SLICE.u32All,
- //( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1,
- ( (nPitchInPixel * 240)/64 )-1,
+ ( (nPitchInPixel * height)/64 )-1,
EG_CB_COLOR0_SLICE__TILE_MAX_shift,
EG_CB_COLOR0_SLICE__TILE_MAX_mask);
@@ -1060,43 +1108,266 @@ static void evergreenSetRenderTarget(context_t *context, int id)
ARRAY_LINEAR_GENERAL,
EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
- if(4 == rrb->cpp)
- {
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- COLOR_8_8_8_8,
- EG_CB_COLOR0_INFO__FORMAT_shift,
- EG_CB_COLOR0_INFO__FORMAT_mask);
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- SWAP_ALT, //SWAP_STD
- EG_CB_COLOR0_INFO__COMP_SWAP_shift,
- EG_CB_COLOR0_INFO__COMP_SWAP_mask);
- }
- else
- {
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- COLOR_5_6_5,
- EG_CB_COLOR0_INFO__FORMAT_shift,
- EG_CB_COLOR0_INFO__FORMAT_mask);
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- SWAP_ALT_REV,
- EG_CB_COLOR0_INFO__COMP_SWAP_shift,
- EG_CB_COLOR0_INFO__COMP_SWAP_mask);
+
+ switch (rrb->base.Format) {
+ case MESA_FORMAT_RGBA8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SIGNED_RGBA8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_SNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGBA8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SIGNED_RGBA8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_SNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB8888:
+ case MESA_FORMAT_XRGB8888:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB8888_REV:
+ case MESA_FORMAT_XRGB8888_REV:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB565:
+ format = COLOR_5_6_5;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB565_REV:
+ format = COLOR_5_6_5;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB4444:
+ format = COLOR_4_4_4_4;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB4444_REV:
+ format = COLOR_4_4_4_4;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB1555:
+ format = COLOR_1_5_5_5;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_ARGB1555_REV:
+ format = COLOR_1_5_5_5;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_AL88:
+ format = COLOR_8_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_AL88_REV:
+ format = COLOR_8_8;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGB332:
+ format = COLOR_3_3_2;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_A8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_I8:
+ case MESA_FORMAT_CI8:
+ format = COLOR_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_L8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_UNORM;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_RGBA_FLOAT32:
+ format = COLOR_32_32_32_32_FLOAT;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_RGBA_FLOAT16:
+ format = COLOR_16_16_16_16_FLOAT;
+ comp_swap = SWAP_STD_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT32:
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_ALPHA_FLOAT16:
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT32:
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_FLOAT16:
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32:
+ format = COLOR_32_32_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16:
+ format = COLOR_16_16_FLOAT;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT32: /* X, X, X, X */
+ format = COLOR_32_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_FLOAT;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_INTENSITY_FLOAT16: /* X, X, X, X */
+ format = COLOR_16_FLOAT;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ source_format = 0;
+ break;
+ case MESA_FORMAT_X8_Z24:
+ case MESA_FORMAT_S8_Z24:
+ format = COLOR_8_24;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z24_S8:
+ format = COLOR_24_8;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z16:
+ format = COLOR_16;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_Z32:
+ format = COLOR_32;
+ comp_swap = SWAP_STD;
+ number_type = NUMBER_UNORM;
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ ARRAY_1D_TILED_THIN1,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_shift,
+ EG_CB_COLOR0_INFO__ARRAY_MODE_mask);
+ source_format = 0;
+ break;
+ case MESA_FORMAT_SARGB8:
+ format = COLOR_8_8_8_8;
+ comp_swap = SWAP_ALT;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SLA8:
+ format = COLOR_8_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ case MESA_FORMAT_SL8:
+ format = COLOR_8;
+ comp_swap = SWAP_ALT_REV;
+ number_type = NUMBER_SRGB;
+ source_format = 1;
+ break;
+ default:
+ _mesa_problem(context->radeon.glCtx, "unexpected format in evergreenSetRenderTarget()");
+ break;
}
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- 1,
- EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift,
+
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ format,
+ EG_CB_COLOR0_INFO__FORMAT_shift,
+ EG_CB_COLOR0_INFO__FORMAT_mask);
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ comp_swap,
+ EG_CB_COLOR0_INFO__COMP_SWAP_shift,
+ EG_CB_COLOR0_INFO__COMP_SWAP_mask);
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ number_type,
+ EG_CB_COLOR0_INFO__NUMBER_TYPE_shift,
+ EG_CB_COLOR0_INFO__NUMBER_TYPE_mask);
+ SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ source_format,
+ EG_CB_COLOR0_INFO__SOURCE_FORMAT_shift,
EG_CB_COLOR0_INFO__SOURCE_FORMAT_mask);
- SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
+ SETbit(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
EG_CB_COLOR0_INFO__BLEND_CLAMP_bit);
- SETfield(evergreen->render_target[id].CB_COLOR0_INFO.u32All,
- NUMBER_UNORM,
- EG_CB_COLOR0_INFO__NUMBER_TYPE_shift,
- EG_CB_COLOR0_INFO__NUMBER_TYPE_mask);
evergreen->render_target[id].CB_COLOR0_VIEW.u32All = 0;
evergreen->render_target[id].CB_COLOR0_CMASK.u32All = 0;
evergreen->render_target[id].CB_COLOR0_FMASK.u32All = 0;
- evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0;
+ evergreen->render_target[id].CB_COLOR0_FMASK_SLICE.u32All = 0;
evergreen->render_target[id].enabled = GL_TRUE;
}
@@ -1162,37 +1433,22 @@ static void evergreenSendCB(GLcontext *ctx, struct radeon_state_atom *atom)
R600_OUT_BATCH(evergreen->CB_SHADER_MASK.u32All);
END_BATCH();
- BEGIN_BATCH_NO_AUTOSTATE(5);
- EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_BLEND_RED, 3);
+ BEGIN_BATCH_NO_AUTOSTATE(6);
+ EVERGREEN_OUT_BATCH_REGSEQ(EG_CB_BLEND_RED, 4);
R600_OUT_BATCH(evergreen->CB_BLEND_RED.u32All);
R600_OUT_BATCH(evergreen->CB_BLEND_GREEN.u32All);
R600_OUT_BATCH(evergreen->CB_BLEND_BLUE.u32All);
+ R600_OUT_BATCH(evergreen->CB_BLEND_ALPHA.u32All);
END_BATCH();
- BEGIN_BATCH_NO_AUTOSTATE(9);
- EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND_ALPHA, evergreen->CB_BLEND_ALPHA.u32All);
+ BEGIN_BATCH_NO_AUTOSTATE(6);
EVERGREEN_OUT_BATCH_REGVAL(EG_CB_BLEND0_CONTROL, evergreen->CB_BLEND0_CONTROL.u32All);
EVERGREEN_OUT_BATCH_REGVAL(EG_CB_COLOR_CONTROL, evergreen->CB_COLOR_CONTROL.u32All);
END_BATCH();
COMMIT_BATCH();
}
-static void evergreenSendCP(GLcontext *ctx, struct radeon_state_atom *atom)
-{
- context_t *context = EVERGREEN_CONTEXT(ctx);
- BATCH_LOCALS(&context->radeon);
- radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
-
- //first to send
- //r700Start3D
- BEGIN_BATCH_NO_AUTOSTATE(3);
- R600_OUT_BATCH(CP_PACKET3(R600_IT_CONTEXT_CONTROL, 1)); //IT_CONTEXT_CONTROL 0x28
- R600_OUT_BATCH(0x80000000);
- R600_OUT_BATCH(0x80000000);
- END_BATCH();
- COMMIT_BATCH();
-}
static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom)
{
context_t *context = EVERGREEN_CONTEXT(ctx);
@@ -1248,13 +1504,6 @@ static void evergreenSendVGT(GLcontext *ctx, struct radeon_state_atom *atom)
COMMIT_BATCH();
}
-static void evergreenSendTIMESTAMP(GLcontext *ctx, struct radeon_state_atom *atom)
-{
- context_t *context = EVERGREEN_CONTEXT(ctx);
- BATCH_LOCALS(&context->radeon);
- radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__);
-}
-
void evergreenInitAtoms(context_t *context)
{
radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context);
@@ -1265,10 +1514,6 @@ void evergreenInitAtoms(context_t *context)
context->radeon.hw.atomlist.name = "atom-list";
EVERGREEN_ALLOC_STATE(init, always, 19, evergreenSendSQConfig);
-
- //make sure send first
- EVERGREEN_ALLOC_STATE(cp, always, 3, evergreenSendCP);
-
EVERGREEN_ALLOC_STATE(vtx, evergreen_vtx, (6 + (VERT_ATTRIB_MAX * 12)), evergreenSendVTX);
EVERGREEN_ALLOC_STATE(pa, always, 124, evergreenSendPA);
EVERGREEN_ALLOC_STATE(tp, always, 0, evergreenSendTP);
@@ -1277,12 +1522,11 @@ void evergreenInitAtoms(context_t *context)
EVERGREEN_ALLOC_STATE(spi, always, 59, evergreenSendSPI);
EVERGREEN_ALLOC_STATE(sx, always, 9, evergreenSendSX);
EVERGREEN_ALLOC_STATE(tx, evergreen_tx, (R700_TEXTURE_NUMBERUNITS * (21+5) + 6), evergreenSendTexState); /* 21 for resource, 5 for sampler */
- EVERGREEN_ALLOC_STATE(db, always, 60, evergreenSendDB);
- EVERGREEN_ALLOC_STATE(cb, always, 35, evergreenSendCB);
+ EVERGREEN_ALLOC_STATE(db, always, 65, evergreenSendDB);
+ EVERGREEN_ALLOC_STATE(cb, always, 33, evergreenSendCB);
EVERGREEN_ALLOC_STATE(vgt, always, 29, evergreenSendVGT);
- EVERGREEN_ALLOC_STATE(timestamp, always, 3, evergreenSendTIMESTAMP);
- //evergreen_init_query_stateobj(&context->radeon, 6 * 2);
+ evergreen_init_query_stateobj(&context->radeon, 6 * 2);
context->radeon.hw.is_dirty = GL_TRUE;
context->radeon.hw.all_dirty = GL_TRUE;
diff --git a/src/mesa/drivers/dri/r600/evergreen_context.c b/src/mesa/drivers/dri/r600/evergreen_context.c
index 65b5898efa..fff7c20031 100644
--- a/src/mesa/drivers/dri/r600/evergreen_context.c
+++ b/src/mesa/drivers/dri/r600/evergreen_context.c
@@ -35,7 +35,9 @@
#include "radeon_common_context.h"
#include "evergreen_context.h"
#include "evergreen_state.h"
-#include "r600_blit.h"
+#include "evergreen_blit.h"
+#include "r600_cmdbuf.h"
+#include "radeon_queryobj.h"
static void evergreen_get_lock(radeonContextPtr rmesa)
{
@@ -56,8 +58,7 @@ static void evergreen_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr
static void evergreen_vtbl_pre_emit_atoms(radeonContextPtr radeon)
{
- //TODO apr.01
- //r700Start3D((context_t *)radeon);
+ r700Start3D((context_t *)radeon);
}
static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
@@ -71,20 +72,19 @@ static void evergreen_fallback(GLcontext *ctx, GLuint bit, GLboolean mode)
static void evergreen_emit_query_finish(radeonContextPtr radeon)
{
- //TODO apr.01
- //context_t *context = (context_t*) radeon;
- //BATCH_LOCALS(&context->radeon);
+ context_t *context = (context_t*) radeon;
+ BATCH_LOCALS(&context->radeon);
struct radeon_query_object *query = radeon->query.current;
- //BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
- //R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
- //R600_OUT_BATCH(ZPASS_DONE);
- //R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
- //R600_OUT_BATCH(0x00000000);
- //R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
- //END_BATCH();
- //assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
+ BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
+ R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
+ R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
+ R600_OUT_BATCH(0x00000000);
+ R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
+ END_BATCH();
+ assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
query->emitted_begin = GL_FALSE;
}
@@ -97,9 +97,9 @@ void evergreen_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.pre_emit_atoms = evergreen_vtbl_pre_emit_atoms;
radeon->vtbl.fallback = evergreen_fallback;
radeon->vtbl.emit_query_finish = evergreen_emit_query_finish;
- radeon->vtbl.check_blit = r600_check_blit;
- radeon->vtbl.blit = r600_blit;
- radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
+ radeon->vtbl.check_blit = evergreen_check_blit;
+ radeon->vtbl.blit = evergreen_blit;
+ radeon->vtbl.is_format_renderable = r600IsFormatRenderable;
}
diff --git a/src/mesa/drivers/dri/r600/evergreen_fragprog.c b/src/mesa/drivers/dri/r600/evergreen_fragprog.c
index b53ff424a0..0e7edf4fbe 100644
--- a/src/mesa/drivers/dri/r600/evergreen_fragprog.c
+++ b/src/mesa/drivers/dri/r600/evergreen_fragprog.c
@@ -99,7 +99,6 @@ void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm,
{
unsigned int unBit;
unsigned int i;
- GLuint ui;
/* match fp inputs with vp exports. */
struct evergreen_vertex_program_cont *vpc =
@@ -246,12 +245,6 @@ void evergreen_Map_Fragment_Program(r700_AssemblerBase *pAsm,
pAsm->pR700Shader->depthIsExported = 1;
}
- pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
- for(ui=0; ui<pAsm->number_of_exports; ui++)
- {
- pAsm->pucOutMask[ui] = 0x0;
- }
-
pAsm->flag_reg_index = pAsm->number_used_registers++;
pAsm->uFirstHelpReg = pAsm->number_used_registers;
@@ -755,6 +748,7 @@ GLboolean evergreenSetupFPconstants(GLcontext * ctx)
struct gl_program_parameter_list *paramList;
unsigned int unNumParamData;
unsigned int ui;
+ int alloc_size;
/* sent out shader constants. */
paramList = fp->mesa_program.Base.Parameters;
@@ -778,14 +772,17 @@ GLboolean evergreenSetupFPconstants(GLcontext * ctx)
evergreen->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2];
evergreen->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3];
}
-
+
+ /* alloc multiple of 16 constants */
+ alloc_size = ((unNumParamData * 4 * 4) + 255) & ~255;
+
/* Load fp constants to gpu */
if(unNumParamData > 0)
{
radeonAllocDmaRegion(&context->radeon,
&context->fp_Constbo,
&context->fp_bo_offset,
- 256,
+ alloc_size,
256);
r600EmitShaderConsts(ctx,
context->fp_Constbo,
@@ -814,4 +811,7 @@ GLboolean evergreenSetupFPconstants(GLcontext * ctx)
}
unConstOffset += pCompiledSub->NumParameters;
}
-} \ No newline at end of file
+
+ return GL_TRUE;
+}
+
diff --git a/src/mesa/drivers/dri/r600/evergreen_vertprog.c b/src/mesa/drivers/dri/r600/evergreen_vertprog.c
index 4f3db00c7d..6840fa3c86 100644
--- a/src/mesa/drivers/dri/r600/evergreen_vertprog.c
+++ b/src/mesa/drivers/dri/r600/evergreen_vertprog.c
@@ -200,7 +200,6 @@ void evergreen_Map_Vertex_Program(GLcontext *ctx,
struct evergreen_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
- GLuint ui;
r700_AssemblerBase *pAsm = &(vp->r700AsmCode);
unsigned int num_inputs;
@@ -226,13 +225,6 @@ void evergreen_Map_Vertex_Program(GLcontext *ctx,
pAsm->number_used_registers += pAsm->number_of_exports;
- pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
-
- for(ui=0; ui<pAsm->number_of_exports; ui++)
- {
- pAsm->pucOutMask[ui] = 0x0;
- }
-
/* Map temporary registers (GPRs) */
pAsm->starting_temp_register_number = pAsm->number_used_registers;
@@ -663,6 +655,7 @@ GLboolean evergreenSetupVPconstants(GLcontext * ctx)
struct gl_program_parameter_list *paramList;
unsigned int unNumParamData;
unsigned int ui;
+ int alloc_size;
/* sent out shader constants. */
paramList = vp->mesa_program->Base.Parameters;
@@ -685,6 +678,9 @@ GLboolean evergreenSetupVPconstants(GLcontext * ctx)
unNumParamData = paramList->NumParameters;
+ /* alloc multiple of 16 constants */
+ alloc_size = ((unNumParamData * 4 * 4) + 255) & ~255;
+
for(ui=0; ui<unNumParamData; ui++) {
if(paramList->Parameters[ui].Type == PROGRAM_UNIFORM)
{
@@ -705,7 +701,7 @@ GLboolean evergreenSetupVPconstants(GLcontext * ctx)
radeonAllocDmaRegion(&context->radeon,
&context->vp_Constbo,
&context->vp_bo_offset,
- 256,
+ alloc_size,
256);
r600EmitShaderConsts(ctx,
context->vp_Constbo,
@@ -733,4 +729,7 @@ GLboolean evergreenSetupVPconstants(GLcontext * ctx)
}
unConstOffset += pCompiledSub->NumParameters;
}
-} \ No newline at end of file
+
+ return GL_TRUE;
+}
+
diff --git a/src/mesa/drivers/dri/r600/r600_blit.c b/src/mesa/drivers/dri/r600/r600_blit.c
index ef47ae1c05..3090c9f613 100644
--- a/src/mesa/drivers/dri/r600/r600_blit.c
+++ b/src/mesa/drivers/dri/r600/r600_blit.c
@@ -224,14 +224,14 @@ set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_forma
break;
case MESA_FORMAT_RGBA_FLOAT32:
format = COLOR_32_32_32_32_FLOAT;
- comp_swap = SWAP_STD_REV;
+ comp_swap = SWAP_STD;
SETbit(cb_color0_info, BLEND_FLOAT32_bit);
CLEARbit(cb_color0_info, SOURCE_FORMAT_bit);
SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask);
break;
case MESA_FORMAT_RGBA_FLOAT16:
format = COLOR_16_16_16_16_FLOAT;
- comp_swap = SWAP_STD_REV;
+ comp_swap = SWAP_STD;
CLEARbit(cb_color0_info, SOURCE_FORMAT_bit);
SETfield(cb_color0_info, NUMBER_FLOAT, NUMBER_TYPE_shift, NUMBER_TYPE_mask);
break;
@@ -554,9 +554,9 @@ set_vtx_resource(context_t *context)
R600_OUT_BATCH(0);
R600_OUT_BATCH(0);
R600_OUT_BATCH(SQ_TEX_VTX_VALID_BUFFER << SQ_TEX_RESOURCE_WORD6_0__TYPE_shift);
- R600_OUT_BATCH_RELOC(SQ_VTX_CONSTANT_WORD0_0,
+ R600_OUT_BATCH_RELOC(0,
bo,
- SQ_VTX_CONSTANT_WORD0_0,
+ 0,
RADEON_GEM_DOMAIN_GTT, 0, 0);
END_BATCH();
COMMIT_BATCH();
diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.h b/src/mesa/drivers/dri/r600/r600_cmdbuf.h
index 801bb013f6..ffd6c8b092 100644
--- a/src/mesa/drivers/dri/r600/r600_cmdbuf.h
+++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.h
@@ -105,6 +105,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R600_IT_ME_INITIALIZE 0x00004400
#define R600_IT_COND_WRITE 0x00004500
#define R600_IT_EVENT_WRITE 0x00004600
+# define R600_EVENT_TYPE(x) ((x) << 0)
+# define R600_EVENT_INDEX(x) ((x) << 8)
#define R600_IT_EVENT_WRITE_EOP 0x00004700
#define R600_IT_ONE_REG_WRITE 0x00005700
#define R600_IT_SET_CONFIG_REG 0x00006800
diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c
index bb959e7d2d..9c8fe2a24f 100644
--- a/src/mesa/drivers/dri/r600/r600_context.c
+++ b/src/mesa/drivers/dri/r600/r600_context.c
@@ -43,6 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "main/extensions.h"
#include "main/bufferobj.h"
#include "main/texobj.h"
+#include "main/points.h"
#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
@@ -227,7 +228,7 @@ static void r600_emit_query_finish(radeonContextPtr radeon)
BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
- R600_OUT_BATCH(ZPASS_DONE);
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */
R600_OUT_BATCH(0x00000000);
R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
@@ -337,6 +338,9 @@ static void r600ParseOptions(context_t *r600, radeonScreenPtr screen)
static void r600InitGLExtensions(GLcontext *ctx)
{
context_t *r600 = R700_CONTEXT(ctx);
+#ifdef R600_ENABLE_GLSL_TEST
+ unsigned i;
+#endif
driInitExtensions(ctx, card_extensions, GL_TRUE);
if (r600->radeon.radeonScreen->kernel_mm)
@@ -346,8 +350,9 @@ static void r600InitGLExtensions(GLcontext *ctx)
driInitExtensions(ctx, gl_20_extension, GL_TRUE);
_mesa_enable_2_0_extensions(ctx);
- /* glsl compiler has problem if this is not GL_TRUE */
- ctx->Shader.EmitCondCodes = GL_TRUE;
+ /* glsl compiler has problem if this is not GL_TRUE */
+ for (i = 0; i <= MESA_SHADER_FRAGMENT; i++)
+ ctx->ShaderCompilerOptions[i].EmitCondCodes = GL_TRUE;
#endif /* R600_ENABLE_GLSL_TEST */
if (driQueryOptionb
@@ -455,6 +460,9 @@ GLboolean r600CreateContext(gl_api api,
r600InitConstValues(ctx, screen);
+ /* reinit, it depends on consts above */
+ _mesa_init_point(ctx);
+
_mesa_set_mvp_with_dp4( ctx, GL_TRUE );
/* Initialize the software rasterizer and helper modules.
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c
index 45ff9c0624..2bf24096a0 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.c
+++ b/src/mesa/drivers/dri/r600/r700_assembler.c
@@ -619,7 +619,7 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700
GLboolean IsTex(gl_inst_opcode Opcode)
{
if( (OPCODE_TEX==Opcode) || (OPCODE_TXP==Opcode) || (OPCODE_TXB==Opcode) ||
- (OPCODE_DDX==Opcode) || (OPCODE_DDY==Opcode) )
+ (OPCODE_DDX==Opcode) || (OPCODE_DDY==Opcode) || (OPCODE_TXL==Opcode) )
{
return GL_TRUE;
}
@@ -914,7 +914,7 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm,
{
unsigned int count = GETbits(pAsm->cf_current_tex_clause_ptr->m_Word1.val,
EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask) + 1;
- SETfield(pAsm->cf_current_vtx_clause_ptr->m_Word1.val, count,
+ SETfield(pAsm->cf_current_tex_clause_ptr->m_Word1.val, count,
EG_CF_WORD1__COUNT_shift, EG_CF_WORD1__COUNT_mask);
}
else
@@ -923,9 +923,10 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm,
}
}
- // If this clause constains any TEX instruction that is dependent on a previous instruction,
- // set the barrier bit
- if( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) || pAsm->need_tex_barrier == GL_TRUE )
+ // If this clause constains any TEX instruction that is dependent on a
+ // previous instruction, set the barrier bit, also always set for vert
+ // programs as tex deps are not(yet) computed for them
+ if( pAsm->currentShaderType == SPT_VP || pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) || pAsm->need_tex_barrier == GL_TRUE )
{
pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x1;
}
@@ -1413,17 +1414,6 @@ static GLboolean next_ins(r700_AssemblerBase *pAsm)
if (pAsm->D.dst.rtype == DST_REG_OUT)
{
assert(pAsm->D.dst.reg >= pAsm->starting_export_register_number);
-
- if (pAsm->D.dst.op3)
- {
- // There is no mask for OP3 instructions, so all channels are written
- pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF;
- }
- else
- {
- pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number]
- |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask;
- }
}
//reset for next inst.
@@ -1645,10 +1635,17 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
}
else
{
+ if (1 == pILInst->SrcReg[src].RelAddr)
+ {
+ setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_RELATIVE_A0);
+ }
+ else
+ {
+ setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
+ }
switch (pILInst->SrcReg[src].File)
{
case PROGRAM_TEMPORARY:
- setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
pAsm->S[fld].src.rtype = SRC_REG_TEMPORARY;
pAsm->S[fld].src.reg = pILInst->SrcReg[src].Index + pAsm->starting_temp_register_number;
break;
@@ -1657,15 +1654,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
case PROGRAM_ENV_PARAM:
case PROGRAM_STATE_VAR:
case PROGRAM_UNIFORM:
- if (1 == pILInst->SrcReg[src].RelAddr)
- {
- setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_RELATIVE_A0);
- }
- else
- {
- setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
- }
-
pAsm->S[fld].src.rtype = SRC_REG_CONSTANT;
if(pILInst->SrcReg[src].Index < 0)
{
@@ -1678,7 +1666,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
}
break;
case PROGRAM_INPUT:
- setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
pAsm->S[fld].src.rtype = SRC_REG_GPR;
switch (pAsm->currentShaderType)
{
@@ -1691,7 +1678,6 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm,
}
break;
case PROGRAM_OUTPUT:
- setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE);
pAsm->S[fld].src.rtype = SRC_REG_GPR;
switch (pAsm->currentShaderType)
{
@@ -1728,7 +1714,14 @@ GLboolean assemble_dst(r700_AssemblerBase *pAsm)
switch (pILInst->DstReg.File)
{
case PROGRAM_TEMPORARY:
+ if (1 == pILInst->DstReg.RelAddr)
+ {
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_RELATIVE_A0);
+ }
+ else
+ {
setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ }
pAsm->D.dst.rtype = DST_REG_TEMPORARY;
pAsm->D.dst.reg = pILInst->DstReg.Index + pAsm->starting_temp_register_number;
break;
@@ -1738,7 +1731,14 @@ GLboolean assemble_dst(r700_AssemblerBase *pAsm)
pAsm->D.dst.reg = 0;
break;
case PROGRAM_OUTPUT:
+ if (1 == pILInst->DstReg.RelAddr)
+ {
+ setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_RELATIVE_A0);
+ }
+ else
+ {
setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
+ }
pAsm->D.dst.rtype = DST_REG_OUT;
switch (pAsm->currentShaderType)
{
@@ -3026,7 +3026,14 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm)
return GL_FALSE;
}
- alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype
+ if ( ADDR_RELATIVE_A0 == addrmode_PVSDST(&(pAsm->D.dst)) )
+ {
+ alu_instruction_ptr->m_Word1.f.dst_rel = SQ_RELATIVE;
+ }
+ else
+ {
+ alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE;
+ }
if ( is_single_scalar_operation == GL_TRUE )
{
@@ -3189,6 +3196,9 @@ GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode)
return GL_FALSE;
}
+ if( pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_RSQ )
+ pAsm->S[0].src.abs = 1;
+
if ( GL_FALSE == next_ins(pAsm) )
{
return GL_FALSE;
@@ -4293,8 +4303,6 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm)
{
unsigned int dstReg;
unsigned int dstType;
- unsigned int srcReg;
- unsigned int srcType;
checkop1(pAsm);
int tmp = gethelpr(pAsm);
@@ -4302,182 +4310,178 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm)
{
return GL_FALSE;
}
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
- {
- return GL_FALSE;
- }
dstReg = pAsm->D.dst.reg;
dstType = pAsm->D.dst.rtype;
- srcReg = pAsm->S[0].src.reg;
- srcType = pAsm->S[0].src.rtype;
/* dst.xw, <- 1.0 */
- pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
- pAsm->D.dst.rtype = dstType;
- pAsm->D.dst.reg = dstReg;
- pAsm->D.dst.writex = 1;
- pAsm->D.dst.writey = 0;
- pAsm->D.dst.writez = 0;
- pAsm->D.dst.writew = 1;
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- noneg_PVSSRC(&(pAsm->S[0].src));
- pAsm->S[0].src.swizzlex = SQ_SEL_1;
- pAsm->S[0].src.swizzley = SQ_SEL_1;
- pAsm->S[0].src.swizzlez = SQ_SEL_1;
- pAsm->S[0].src.swizzlew = SQ_SEL_1;
- if( GL_FALSE == next_ins(pAsm) )
+ if( pAsm->D.dst.writex || pAsm->D.dst.writew )
{
- return GL_FALSE;
- }
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
- {
- return GL_FALSE;
+ pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 0;
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp;
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.swizzlex = SQ_SEL_1;
+ pAsm->S[0].src.swizzley = SQ_SEL_1;
+ pAsm->S[0].src.swizzlez = SQ_SEL_1;
+ pAsm->S[0].src.swizzlew = SQ_SEL_1;
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
}
- /* dst.y = max(src.x, 0.0) */
- pAsm->D.dst.opcode = SQ_OP2_INST_MAX;
- pAsm->D.dst.rtype = dstType;
- pAsm->D.dst.reg = dstReg;
- pAsm->D.dst.writex = 0;
- pAsm->D.dst.writey = 1;
- pAsm->D.dst.writez = 0;
- pAsm->D.dst.writew = 0;
- pAsm->S[0].src.rtype = srcType;
- pAsm->S[0].src.reg = srcReg;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X);
- pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[1].src.reg = tmp;
- setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
- noneg_PVSSRC(&(pAsm->S[1].src));
- pAsm->S[1].src.swizzlex = SQ_SEL_0;
- pAsm->S[1].src.swizzley = SQ_SEL_0;
- pAsm->S[1].src.swizzlez = SQ_SEL_0;
- pAsm->S[1].src.swizzlew = SQ_SEL_0;
- if( GL_FALSE == next_ins(pAsm) )
+ if( GL_FALSE == assemble_dst(pAsm) )
{
return GL_FALSE;
}
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
- {
- return GL_FALSE;
- }
+ if( pAsm->D.dst.writey ) {
- swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y);
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
- /* dst.z = log(src.y) */
- if(8 == pAsm->unAsic)
- {
- pAsm->D.dst.opcode = EG_OP2_INST_LOG_CLAMPED;
- }
- else
- {
- pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED;
- }
- pAsm->D.dst.math = 1;
- pAsm->D.dst.rtype = dstType;
- pAsm->D.dst.reg = dstReg;
- pAsm->D.dst.writex = 0;
- pAsm->D.dst.writey = 0;
- pAsm->D.dst.writez = 1;
- pAsm->D.dst.writew = 0;
- pAsm->S[0].src.rtype = srcType;
- pAsm->S[0].src.reg = srcReg;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
+ /* dst.y = max(src.x, 0.0) */
+ pAsm->D.dst.opcode = SQ_OP2_INST_MAX;
+ pAsm->D.dst.writex = 0;
+ pAsm->D.dst.writey = 1;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
+ swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X);
+ pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[1].src.reg = tmp;
+ setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[1].src));
+ pAsm->S[1].src.swizzlex = SQ_SEL_0;
+ pAsm->S[1].src.swizzley = SQ_SEL_0;
+ pAsm->S[1].src.swizzlez = SQ_SEL_0;
+ pAsm->S[1].src.swizzlew = SQ_SEL_0;
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
}
- if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ if( GL_FALSE == assemble_dst(pAsm) )
{
return GL_FALSE;
}
+ if ( pAsm->D.dst.writez) {
- if( GL_FALSE == assemble_src(pAsm, 0, 2) )
- {
- return GL_FALSE;
- }
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
- swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W);
+ /* dst.z = log(src.y) */
+ if(8 == pAsm->unAsic)
+ {
+ pAsm->D.dst.opcode = EG_OP2_INST_LOG_CLAMPED;
+ }
+ else
+ {
+ pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED;
+ }
+ pAsm->D.dst.math = 1;
+ pAsm->D.dst.writex = 0;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 1;
+ pAsm->D.dst.writew = 0;
+ swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y);
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
- swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X);
+ if( GL_FALSE == assemble_src(pAsm, 0, -1) )
+ {
+ return GL_FALSE;
+ }
- /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
- if(8 == pAsm->unAsic)
- {
- pAsm->D.dst.opcode = EG_OP3_INST_MUL_LIT;
- }
- else
- {
- pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT;
- }
- pAsm->D.dst.math = 1;
- pAsm->D.dst.op3 = 1;
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = tmp;
- pAsm->D.dst.writex = 1;
- pAsm->D.dst.writey = 0;
- pAsm->D.dst.writez = 0;
- pAsm->D.dst.writew = 0;
+ if( GL_FALSE == assemble_src(pAsm, 0, 2) )
+ {
+ return GL_FALSE;
+ }
- pAsm->S[0].src.rtype = srcType;
- pAsm->S[0].src.reg = srcReg;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W);
- pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[1].src.reg = dstReg;
- setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
- noneg_PVSSRC(&(pAsm->S[1].src));
- pAsm->S[1].src.swizzlex = SQ_SEL_Z;
- pAsm->S[1].src.swizzley = SQ_SEL_Z;
- pAsm->S[1].src.swizzlez = SQ_SEL_Z;
- pAsm->S[1].src.swizzlew = SQ_SEL_Z;
+ swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X);
- pAsm->S[2].src.rtype = srcType;
- pAsm->S[2].src.reg = srcReg;
- setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE);
+ /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */
+ if(8 == pAsm->unAsic)
+ {
+ pAsm->D.dst.opcode = EG_OP3_INST_MUL_LIT;
+ }
+ else
+ {
+ pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT;
+ }
+ pAsm->D.dst.math = 1;
+ pAsm->D.dst.op3 = 1;
+ pAsm->D.dst.rtype = DST_REG_TEMPORARY;
+ pAsm->D.dst.reg = tmp;
+ pAsm->D.dst.writex = 1;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 0;
+ pAsm->D.dst.writew = 0;
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
- /* dst.z = exp(tmp.x) */
- if(8 == pAsm->unAsic)
- {
- pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE;
- }
- else
- {
- pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE;
- }
- pAsm->D.dst.math = 1;
- pAsm->D.dst.rtype = dstType;
- pAsm->D.dst.reg = dstReg;
- pAsm->D.dst.writex = 0;
- pAsm->D.dst.writey = 0;
- pAsm->D.dst.writez = 1;
- pAsm->D.dst.writew = 0;
+ pAsm->S[1].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[1].src.reg = dstReg;
+ setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[1].src));
+ pAsm->S[1].src.swizzlex = SQ_SEL_Z;
+ pAsm->S[1].src.swizzley = SQ_SEL_Z;
+ pAsm->S[1].src.swizzlez = SQ_SEL_Z;
+ pAsm->S[1].src.swizzlew = SQ_SEL_Z;
- pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
- pAsm->S[0].src.reg = tmp;
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- noneg_PVSSRC(&(pAsm->S[0].src));
- pAsm->S[0].src.swizzlex = SQ_SEL_X;
- pAsm->S[0].src.swizzley = SQ_SEL_X;
- pAsm->S[0].src.swizzlez = SQ_SEL_X;
- pAsm->S[0].src.swizzlew = SQ_SEL_X;
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
+ /* dst.z = exp(tmp.x) */
+ if( GL_FALSE == assemble_dst(pAsm) )
+ {
+ return GL_FALSE;
+ }
+ if(8 == pAsm->unAsic)
+ {
+ pAsm->D.dst.opcode = EG_OP2_INST_EXP_IEEE;
+ }
+ else
+ {
+ pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE;
+ }
+ pAsm->D.dst.math = 1;
+ pAsm->D.dst.writex = 0;
+ pAsm->D.dst.writey = 0;
+ pAsm->D.dst.writez = 1;
+ pAsm->D.dst.writew = 0;
+ pAsm->S[0].src.rtype = SRC_REG_TEMPORARY;
+ pAsm->S[0].src.reg = tmp;
+ setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
+ noneg_PVSSRC(&(pAsm->S[0].src));
+ pAsm->S[0].src.swizzlex = SQ_SEL_X;
+ pAsm->S[0].src.swizzley = SQ_SEL_X;
+ pAsm->S[0].src.swizzlez = SQ_SEL_X;
+ pAsm->S[0].src.swizzlew = SQ_SEL_X;
+
+ if( GL_FALSE == next_ins(pAsm) )
+ {
+ return GL_FALSE;
+ }
+ }
return GL_TRUE;
}
@@ -5274,6 +5278,11 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm)
pAsm->D.dst.opcode = SQ_TEX_INST_GET_GRADIENTS_V;
break;
case OPCODE_TXB:
+ /* this should actually be SAMPLE_LB but that needs bias to be
+ * embedded in the instruction - cant do here */
+ pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_L;
+ break;
+ case OPCODE_TXL:
pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_L;
break;
default:
@@ -7101,7 +7110,8 @@ GLboolean AssembleInstr(GLuint uiFirstInst,
case OPCODE_DDX:
case OPCODE_DDY:
case OPCODE_TEX:
- case OPCODE_TXB:
+ case OPCODE_TXB:
+ case OPCODE_TXL:
case OPCODE_TXP:
if ( GL_FALSE == assemble_TEX(pR700AsmCode) )
return GL_FALSE;
@@ -7656,8 +7666,6 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm,
GLuint starting_register_number,
GLboolean is_depth_export)
{
- unsigned char ucWriteMask;
-
check_current_clause(pAsm, CF_EMPTY_CLAUSE);
check_current_clause(pAsm, CF_EXPORT_CLAUSE); //alloc the cf_current_export_clause_ptr
@@ -7737,43 +7745,21 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm,
{
assert(starting_register_number >= pAsm->starting_export_register_number);
- ucWriteMask = pAsm->pucOutMask[starting_register_number - pAsm->starting_export_register_number];
/* exports Z as a float into Red channel */
if (GL_TRUE == is_depth_export)
- ucWriteMask = 0x1;
-
- if( (ucWriteMask & 0x1) != 0)
{
- pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_X;
+ pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_Z;
+ pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_MASK;
+ pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_MASK;
+ pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_MASK;
}
else
{
- pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_MASK;
- }
- if( ((ucWriteMask>>1) & 0x1) != 0)
- {
+ pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_x = SQ_SEL_X;
pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_Y;
- }
- else
- {
- pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_y = SQ_SEL_MASK;
- }
- if( ((ucWriteMask>>2) & 0x1) != 0)
- {
pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_Z;
- }
- else
- {
- pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_z = SQ_SEL_MASK;
- }
- if( ((ucWriteMask>>3) & 0x1) != 0)
- {
pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_W;
}
- else
- {
- pAsm->cf_current_export_clause_ptr->m_Word1_SWIZ.f.sel_w = SQ_SEL_MASK;
- }
}
else
{
@@ -7789,39 +7775,6 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm,
return GL_TRUE;
}
-GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm, BITS depth_channel_select)
-{
- gl_inst_opcode Opcode_save = pAsm->pILInst[pAsm->uiCurInst].Opcode; //Should be OPCODE_END
- pAsm->pILInst[pAsm->uiCurInst].Opcode = OPCODE_MOV;
-
- // MOV depth_export_register.hw_depth_channel, depth_export_register.depth_channel_select
-
- pAsm->D.dst.opcode = SQ_OP2_INST_MOV;
-
- setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE);
- pAsm->D.dst.rtype = DST_REG_TEMPORARY;
- pAsm->D.dst.reg = pAsm->depth_export_register_number;
-
- pAsm->D.dst.writex = 1; // depth goes in R channel for HW
-
- setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE);
- pAsm->S[0].src.rtype = DST_REG_TEMPORARY;
- pAsm->S[0].src.reg = pAsm->depth_export_register_number;
-
- setswizzle_PVSSRC(&(pAsm->S[0].src), depth_channel_select);
-
- noneg_PVSSRC(&(pAsm->S[0].src));
-
- if( GL_FALSE == next_ins(pAsm) )
- {
- return GL_FALSE;
- }
-
- pAsm->pILInst[pAsm->uiCurInst].Opcode = Opcode_save;
-
- return GL_TRUE;
-}
-
GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
GLbitfield OutputsWritten)
{
@@ -7829,14 +7782,6 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode,
GLuint export_count = 0;
unsigned int i;
- if(pR700AsmCode->depth_export_register_number >= 0)
- {
- if( GL_FALSE == Move_Depth_Exports_To_Correct_Channels(pR700AsmCode, SQ_SEL_Z) ) // depth
- {
- return GL_FALSE;
- }
- }
-
for (i = 0; i < FRAG_RESULT_MAX; ++i)
{
unBit = 1 << i;
@@ -8073,21 +8018,27 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode,
GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode)
{
- FREE(pR700AsmCode->pucOutMask);
- FREE(pR700AsmCode->pInstDeps);
+ if(NULL != pR700AsmCode->pInstDeps)
+ {
+ FREE(pR700AsmCode->pInstDeps);
+ pR700AsmCode->pInstDeps = NULL;
+ }
if(NULL != pR700AsmCode->subs)
{
FREE(pR700AsmCode->subs);
+ pR700AsmCode->subs = NULL;
}
if(NULL != pR700AsmCode->callers)
{
FREE(pR700AsmCode->callers);
+ pR700AsmCode->callers = NULL;
}
if(NULL != pR700AsmCode->presubs)
{
FREE(pR700AsmCode->presubs);
+ pR700AsmCode->presubs = NULL;
}
return GL_TRUE;
diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h
index d357b0e3ec..c7c7ab2d4f 100644
--- a/src/mesa/drivers/dri/r600/r700_assembler.h
+++ b/src/mesa/drivers/dri/r600/r700_assembler.h
@@ -414,8 +414,6 @@ typedef struct r700_AssemblerBase
unsigned char ucVP_AttributeMap[VERT_ATTRIB_MAX];
unsigned char ucVP_OutputMap[VERT_RESULT_MAX];
- unsigned char * pucOutMask;
-
//-----------------------------------------------------------------------------------
// flow control members
//-----------------------------------------------------------------------------------
diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c
index 71f1af7562..3bb194eb6d 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.c
+++ b/src/mesa/drivers/dri/r600/r700_chip.c
@@ -270,7 +270,7 @@ static void r700SetRenderTarget(context_t *context, int id)
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
uint32_t format = COLOR_8_8_8_8, comp_swap = SWAP_ALT, number_type = NUMBER_UNORM;
struct radeon_renderbuffer *rrb;
- unsigned int nPitchInPixel;
+ unsigned int nPitchInPixel, height;
rrb = radeon_get_colorbuffer(&context->radeon);
if (!rrb || !rrb->bo) {
@@ -283,9 +283,19 @@ static void r700SetRenderTarget(context_t *context, int id)
r700->render_target[id].CB_COLOR0_BASE.u32All = context->radeon.state.color.draw_offset / 256;
nPitchInPixel = rrb->pitch/rrb->cpp;
+
+ if (context->radeon.radeonScreen->driScreen->dri2.enabled)
+ {
+ height = rrb->base.Height;
+ }
+ else
+ {
+ height = context->radeon.radeonScreen->driScreen->fbHeight;
+ }
+
SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, (nPitchInPixel/8)-1,
PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask);
- SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, ( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1,
+ SETfield(r700->render_target[id].CB_COLOR0_SIZE.u32All, ( (nPitchInPixel * height)/64 )-1,
SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask);
SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ENDIAN_NONE, ENDIAN_shift, ENDIAN_mask);
SETfield(r700->render_target[id].CB_COLOR0_INFO.u32All, ARRAY_LINEAR_GENERAL,
@@ -544,7 +554,7 @@ static void r700SetDepthTarget(context_t *context)
R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw);
struct radeon_renderbuffer *rrb;
- unsigned int nPitchInPixel;
+ unsigned int nPitchInPixel, height;
rrb = radeon_get_depthbuffer(&context->radeon);
if (!rrb)
@@ -560,9 +570,18 @@ static void r700SetDepthTarget(context_t *context)
nPitchInPixel = rrb->pitch/rrb->cpp;
+ if (context->radeon.radeonScreen->driScreen->dri2.enabled)
+ {
+ height = rrb->base.Height;
+ }
+ else
+ {
+ height = context->radeon.radeonScreen->driScreen->fbHeight;
+ }
+
SETfield(r700->DB_DEPTH_SIZE.u32All, (nPitchInPixel/8)-1,
PITCH_TILE_MAX_shift, PITCH_TILE_MAX_mask);
- SETfield(r700->DB_DEPTH_SIZE.u32All, ( (nPitchInPixel * context->radeon.radeonScreen->driScreen->fbHeight)/64 )-1,
+ SETfield(r700->DB_DEPTH_SIZE.u32All, ( (nPitchInPixel * height)/64 )-1,
SLICE_TILE_MAX_shift, SLICE_TILE_MAX_mask); /* size in pixel / 64 - 1 */
if(4 == rrb->cpp)
@@ -1416,7 +1435,7 @@ static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom)
BEGIN_BATCH_NO_AUTOSTATE(4 + 2);
R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2));
- R600_OUT_BATCH(ZPASS_DONE);
+ R600_OUT_BATCH(R600_EVENT_TYPE(ZPASS_DONE) | R600_EVENT_INDEX(1));
R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */
R600_OUT_BATCH(0x00000000);
R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0);
diff --git a/src/mesa/drivers/dri/r600/r700_chip.h b/src/mesa/drivers/dri/r600/r700_chip.h
index ebf1840a79..0ca237b1fe 100644
--- a/src/mesa/drivers/dri/r600/r700_chip.h
+++ b/src/mesa/drivers/dri/r600/r700_chip.h
@@ -38,7 +38,7 @@
#include "r700_chipoffset.h"
-#define SETfield(x, val, shift, mask) ( (x) = ((x) & ~(mask)) | ((val) << (shift)) ) /* u32All */
+#define SETfield(x, val, shift, mask) ( (x) = ((x) & ~(mask)) | (((val) << (shift)) & (mask)) )/* u32All */
#define CLEARfield(x, mask) ( (x) &= ~(mask) )
#define SETbit(x, bit) ( (x) |= (bit) )
#define CLEARbit(x, bit) ( (x) &= ~(bit) )
diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c
index 6fdd93a330..217b0e27a4 100644
--- a/src/mesa/drivers/dri/r600/r700_fragprog.c
+++ b/src/mesa/drivers/dri/r600/r700_fragprog.c
@@ -99,7 +99,6 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
{
unsigned int unBit;
unsigned int i;
- GLuint ui;
/* match fp inputs with vp exports. */
struct r700_vertex_program_cont *vpc =
@@ -245,12 +244,6 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm,
}
}
- pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
- for(ui=0; ui<pAsm->number_of_exports; ui++)
- {
- pAsm->pucOutMask[ui] = 0x0;
- }
-
pAsm->flag_reg_index = pAsm->number_used_registers++;
pAsm->uFirstHelpReg = pAsm->number_used_registers;
diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c
index 67b0d40308..8b3ed5cd82 100644
--- a/src/mesa/drivers/dri/r600/r700_shader.c
+++ b/src/mesa/drivers/dri/r600/r700_shader.c
@@ -584,7 +584,11 @@ void cleanup_vfetch_shaderinst(R700_Shader *pShader)
void Clean_Up_Shader(R700_Shader *pShader)
{
- FREE(pShader->pProgram);
+ if(NULL != pShader->pProgram)
+ {
+ FREE(pShader->pProgram);
+ pShader->pProgram = NULL;
+ }
R700ShaderInstruction *pInst;
R700ShaderInstruction *pInstToFree;
@@ -596,6 +600,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstCFInstructions.pHead = NULL;
+
pInst = pShader->lstALUInstructions.pHead;
while(NULL != pInst)
{
@@ -603,6 +609,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstALUInstructions.pHead = NULL;
+
pInst = pShader->lstTEXInstructions.pHead;
while(NULL != pInst)
{
@@ -610,6 +618,8 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstTEXInstructions.pHead = NULL;
+
pInst = pShader->lstVTXInstructions.pHead;
while(NULL != pInst)
{
@@ -617,5 +627,6 @@ void Clean_Up_Shader(R700_Shader *pShader)
pInst = pInst->pNextInst;
FREE(pInstToFree);
};
+ pShader->lstVTXInstructions.pHead = NULL;
}
diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c
index 7ed4b7d238..2fee5b4433 100644
--- a/src/mesa/drivers/dri/r600/r700_vertprog.c
+++ b/src/mesa/drivers/dri/r600/r700_vertprog.c
@@ -201,7 +201,6 @@ void Map_Vertex_Program(GLcontext *ctx,
struct r700_vertex_program *vp,
struct gl_vertex_program *mesa_vp)
{
- GLuint ui;
r700_AssemblerBase *pAsm = &(vp->r700AsmCode);
unsigned int num_inputs;
@@ -227,13 +226,6 @@ void Map_Vertex_Program(GLcontext *ctx,
pAsm->number_used_registers += pAsm->number_of_exports;
- pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports);
-
- for(ui=0; ui<pAsm->number_of_exports; ui++)
- {
- pAsm->pucOutMask[ui] = 0x0;
- }
-
/* Map temporary registers (GPRs) */
pAsm->starting_temp_register_number = pAsm->number_used_registers;
diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile
index 19df62742e..93219e40af 100644
--- a/src/mesa/drivers/dri/radeon/Makefile
+++ b/src/mesa/drivers/dri/radeon/Makefile
@@ -14,6 +14,7 @@ endif
RADEON_COMMON_SOURCES = \
radeon_bo_legacy.c \
+ radeon_buffer_objects.c \
radeon_common_context.c \
radeon_common.c \
radeon_cs_legacy.c \
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c
index 07f7cba354..b0340cee21 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c
@@ -363,6 +363,9 @@ GLboolean radeonUnbindContext(__DRIcontext * driContextPriv)
fprintf(stderr, "%s ctx %p\n", __FUNCTION__,
radeon->glCtx);
+ /* Unset current context and dispath table */
+ _mesa_make_current(NULL, NULL, NULL);
+
return GL_TRUE;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
index fb741173ca..216eb932db 100644
--- a/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
+++ b/src/mesa/drivers/dri/radeon/radeon_pixel_read.c
@@ -32,6 +32,7 @@
#include "main/state.h"
#include "swrast/swrast.h"
+#include "radeon_buffer_objects.h"
#include "radeon_common_context.h"
#include "radeon_debug.h"
#include "radeon_mipmap_tree.h"
@@ -96,6 +97,7 @@ do_blit_readpixels(GLcontext * ctx,
unsigned dst_rowstride, dst_imagesize, aligned_rowstride, flip_y;
struct radeon_bo *dst_buffer;
GLint dst_x = 0, dst_y = 0;
+ intptr_t dst_offset;
/* It's not worth if number of pixels to copy is really small */
if (width * height < 100) {
@@ -127,10 +129,23 @@ do_blit_readpixels(GLcontext * ctx,
assert(x >= 0 && y >= 0);
aligned_rowstride = get_texture_image_row_stride(radeon, dst_format, dst_rowstride, 0);
+ dst_rowstride *= _mesa_get_format_bytes(dst_format);
+ if (_mesa_is_bufferobj(pack->BufferObj) && aligned_rowstride != dst_rowstride)
+ return GL_FALSE;
dst_imagesize = get_texture_image_size(dst_format,
aligned_rowstride,
height, 1, 0);
- dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ {
+ dst_buffer = radeon_bo_open(radeon->radeonScreen->bom, 0, dst_imagesize, 1024, RADEON_GEM_DOMAIN_GTT, 0);
+ dst_offset = 0;
+ }
+ else
+ {
+ dst_buffer = get_radeon_buffer_object(pack->BufferObj)->bo;
+ dst_offset = (intptr_t)pixels;
+ }
/* Disable source Y flipping for FBOs */
flip_y = (ctx->ReadBuffer->Name == 0);
@@ -149,7 +164,7 @@ do_blit_readpixels(GLcontext * ctx,
x,
y,
dst_buffer,
- 0, /* dst_offset */
+ dst_offset,
dst_format,
aligned_rowstride / _mesa_get_format_bytes(dst_format),
width,
@@ -160,17 +175,22 @@ do_blit_readpixels(GLcontext * ctx,
height,
flip_y))
{
- radeon_bo_map(dst_buffer, 0);
- dst_rowstride *= _mesa_get_format_bytes(dst_format);
- copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
- aligned_rowstride, height, dst_rowstride);
- radeon_bo_unmap(dst_buffer);
- radeon_bo_unref(dst_buffer);
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ {
+ radeon_bo_map(dst_buffer, 0);
+ copy_rows(pixels, dst_rowstride, dst_buffer->ptr,
+ aligned_rowstride, height, dst_rowstride);
+ radeon_bo_unmap(dst_buffer);
+ radeon_bo_unref(dst_buffer);
+ }
+
return GL_TRUE;
- } else {
- radeon_bo_unref(dst_buffer);
- return GL_FALSE;
}
+
+ if (!_mesa_is_bufferobj(pack->BufferObj))
+ radeon_bo_unref(dst_buffer);
+
+ return GL_FALSE;
}
void
diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
index ab6d02e56b..5b7178bcca 100644
--- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c
+++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c
@@ -56,7 +56,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q)
* hw writes zpass end counts to qwords 1, 3, 5, 7.
* then we substract. MSB is the valid bit.
*/
- for (i = 0; i < 16; i += 4) {
+ for (i = 0; i < 32; i += 4) {
uint64_t start = (uint64_t)LE32_TO_CPU(result[i]) |
(uint64_t)LE32_TO_CPU(result[i + 1]) << 32;
uint64_t end = (uint64_t)LE32_TO_CPU(result[i + 2]) |
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index f3903c2e38..ff53ffd0de 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -713,6 +713,10 @@ dri_unbind_context(__DRIcontext * cPriv)
{
TRACE;
(void) cPriv;
+
+ /* Unset current context and dispath table */
+ _mesa_make_current(NULL, NULL, NULL);
+
return GL_TRUE;
}
diff --git a/src/mesa/main/accum.h b/src/mesa/main/accum.h
index c2b74b23cb..4b628bafa0 100644
--- a/src/mesa/main/accum.h
+++ b/src/mesa/main/accum.h
@@ -42,11 +42,6 @@
#if FEATURE_accum
-#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) \
- do { \
- (driver)->Accum = impl ## Accum; \
- } while (0)
-
extern void GLAPIENTRY
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
@@ -57,8 +52,6 @@ _mesa_init_accum_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void
_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
{
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 82e1f0fdba..c3c710f5ef 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -101,9 +101,7 @@
#include "shaderapi.h"
#include "uniforms.h"
#endif
-#if FEATURE_ARB_sync
#include "syncobj.h"
-#endif
#include "main/dispatch.h"
@@ -634,15 +632,7 @@ _mesa_create_exec_table(void)
#endif
/* GL_ARB_sync */
-#if FEATURE_ARB_sync
- SET_IsSync(exec, _mesa_IsSync);
- SET_DeleteSync(exec, _mesa_DeleteSync);
- SET_FenceSync(exec, _mesa_FenceSync);
- SET_ClientWaitSync(exec, _mesa_ClientWaitSync);
- SET_WaitSync(exec, _mesa_WaitSync);
- SET_GetInteger64v(exec, _mesa_GetInteger64v);
- SET_GetSynciv(exec, _mesa_GetSynciv);
-#endif
+ _mesa_init_sync_dispatch(exec);
/* GL_ATI_fragment_shader */
_mesa_init_ati_fragment_shader_dispatch(exec);
diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h
index 744f092d93..303c9fb302 100644
--- a/src/mesa/main/colortab.h
+++ b/src/mesa/main/colortab.h
@@ -31,13 +31,6 @@
#if FEATURE_colortable
-#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) \
- do { \
- (driver)->CopyColorTable = impl ## CopyColorTable; \
- (driver)->CopyColorSubTable = impl ## CopyColorSubTable; \
- (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \
- } while (0)
-
extern void GLAPIENTRY
_mesa_ColorTable( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
@@ -55,8 +48,6 @@ _mesa_init_colortable_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void GLAPIENTRY
_mesa_ColorTable( GLenum target, GLenum internalformat,
GLsizei width, GLenum format, GLenum type,
diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h
index ded69c3106..800eb83900 100644
--- a/src/mesa/main/compiler.h
+++ b/src/mesa/main/compiler.h
@@ -224,6 +224,18 @@ extern "C" {
# endif
# endif
#endif
+#ifndef __func__
+# if (__STDC_VERSION__ >= 199901L) || \
+ (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+ /* __func__ is part of C99 */
+# elif defined(_MSC_VER)
+# if _MSC_VER >= 1300
+# define __func__ __FUNCTION__
+# else
+# define __func__ "<unknown>"
+# endif
+# endif
+#endif
/**
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8e34ec4124..b1f800f4c2 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -111,9 +111,7 @@
#include "points.h"
#include "polygon.h"
#include "queryobj.h"
-#if FEATURE_ARB_sync
#include "syncobj.h"
-#endif
#include "rastpos.h"
#include "remap.h"
#include "scissor.h"
@@ -737,9 +735,7 @@ init_attrib_groups(GLcontext *ctx)
_mesa_init_polygon( ctx );
_mesa_init_program( ctx );
_mesa_init_queryobj( ctx );
-#if FEATURE_ARB_sync
_mesa_init_sync( ctx );
-#endif
_mesa_init_rastpos( ctx );
_mesa_init_scissor( ctx );
_mesa_init_shader_state( ctx );
@@ -1100,9 +1096,7 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_program_data(ctx);
_mesa_free_shader_state(ctx);
_mesa_free_queryobj_data(ctx);
-#if FEATURE_ARB_sync
_mesa_free_sync_data(ctx);
-#endif
_mesa_free_varray_data(ctx);
_mesa_free_transform_feedback(ctx);
@@ -1300,6 +1294,9 @@ check_compatible(const GLcontext *ctx, const GLframebuffer *buffer)
if (ctxvis == bufvis)
return GL_TRUE;
+ if (buffer == _mesa_get_incomplete_framebuffer())
+ return GL_TRUE;
+
#if 0
/* disabling this fixes the fgl_glxgears pbuffer demo */
if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode)
diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h
index d1401885df..80caf942fb 100644
--- a/src/mesa/main/convolve.h
+++ b/src/mesa/main/convolve.h
@@ -33,12 +33,6 @@
#if FEATURE_convolve
-#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) \
- do { \
- (driver)->CopyConvolutionFilter1D = impl ## CopyConvolutionFilter1D; \
- (driver)->CopyConvolutionFilter2D = impl ## CopyConvolutionFilter2D; \
- } while (0)
-
extern void GLAPIENTRY
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
GLenum format, GLenum type, const GLvoid *image);
@@ -72,8 +66,6 @@ _mesa_init_convolve_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void GLAPIENTRY
_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width,
GLenum format, GLenum type, const GLvoid *image)
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 5042e14a54..d847d4d5d3 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -6818,7 +6818,7 @@ _mesa_compile_error(GLcontext *ctx, GLenum error, const char *s)
if (ctx->CompileFlag)
save_error(ctx, error, s);
if (ctx->ExecuteFlag)
- _mesa_error(ctx, error, s);
+ _mesa_error(ctx, error, "%s", s);
}
@@ -6885,7 +6885,7 @@ execute_list(GLcontext *ctx, GLuint list)
else {
switch (opcode) {
case OPCODE_ERROR:
- _mesa_error(ctx, n[1].e, (const char *) n[2].data);
+ _mesa_error(ctx, n[1].e, "%s", (const char *) n[2].data);
break;
case OPCODE_ACCUM:
CALL_Accum(ctx->Exec, (n[1].e, n[2].f));
@@ -7917,7 +7917,7 @@ execute_list(GLcontext *ctx, GLuint list)
char msg[1000];
_mesa_snprintf(msg, sizeof(msg), "Error in execute_list: opcode=%d",
(int) opcode);
- _mesa_problem(ctx, msg);
+ _mesa_problem(ctx, "%s", msg);
}
done = GL_TRUE;
}
@@ -8892,8 +8892,8 @@ exec_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr)
/* GL_EXT_multi_draw_arrays */
static void GLAPIENTRY
-exec_MultiDrawArraysEXT(GLenum mode, GLint * first,
- GLsizei * count, GLsizei primcount)
+exec_MultiDrawArraysEXT(GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount)
{
GET_CURRENT_CONTEXT(ctx);
FLUSH_VERTICES(ctx, 0);
diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h
index d3f5c5cb4e..86bb132e56 100644
--- a/src/mesa/main/dlist.h
+++ b/src/mesa/main/dlist.h
@@ -38,16 +38,6 @@
#if FEATURE_dlist
-#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) \
- do { \
- (driver)->NewList = impl ## NewList; \
- (driver)->EndList = impl ## EndList; \
- (driver)->BeginCallList = impl ## BeginCallList; \
- (driver)->EndCallList = impl ## EndCallList; \
- (driver)->SaveFlushVertices = impl ## SaveFlushVertices; \
- (driver)->NotifySaveBegin = impl ## NotifyBegin; \
- } while (0)
-
#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \
do { \
(vfmt)->CallList = impl ## CallList; \
@@ -83,7 +73,6 @@ extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0)
#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0)
static INLINE void
diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h
index 8ffb1a6d88..1f95ff5294 100644
--- a/src/mesa/main/drawpix.h
+++ b/src/mesa/main/drawpix.h
@@ -31,20 +31,11 @@
#if FEATURE_drawpix
-#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) \
- do { \
- (driver)->DrawPixels = impl ## DrawPixels; \
- (driver)->CopyPixels = impl ## CopyPixels; \
- (driver)->Bitmap = impl ## Bitmap; \
- } while (0)
-
extern void
_mesa_init_drawpix_dispatch(struct _glapi_table *disp);
#else /* FEATURE_drawpix */
-#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void
_mesa_init_drawpix_dispatch(struct _glapi_table *disp)
{
diff --git a/src/mesa/main/drawtex.h b/src/mesa/main/drawtex.h
index 95f4ac86f0..d7d507566b 100644
--- a/src/mesa/main/drawtex.h
+++ b/src/mesa/main/drawtex.h
@@ -30,11 +30,6 @@
#if FEATURE_OES_draw_texture
-#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) \
- do { \
- (driver)->DrawTex = impl ## DrawTex; \
- } while (0)
-
extern void GLAPIENTRY
_mesa_DrawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
@@ -59,10 +54,6 @@ _mesa_DrawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
extern void GLAPIENTRY
_mesa_DrawTexxv(const GLfixed *coords);
-#else /* FEATURE_OES_draw_texture */
-
-#define _MESA_INIT_DRAWTEX_FUNCTIONS(driver, impl) do { } while (0)
-
#endif /* FEATURE_OES_draw_texture */
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c9862ca29e..50b97f5113 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -58,7 +58,8 @@ static const struct {
{ OFF, "GL_ARB_fragment_shader", F(ARB_fragment_shader) },
{ OFF, "GL_ARB_framebuffer_object", F(ARB_framebuffer_object) },
{ OFF, "GL_ARB_explicit_attrib_location", F(ARB_explicit_attrib_location) },
- { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) },
+ /* TODO: reenable this when the new GLSL compiler actually supports them */
+ /* { OFF, "GL_ARB_geometry_shader4", F(ARB_geometry_shader4) }, */
{ OFF, "GL_ARB_half_float_pixel", F(ARB_half_float_pixel) },
{ OFF, "GL_ARB_half_float_vertex", F(ARB_half_float_vertex) },
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index f80dd85993..5201f50252 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -71,6 +71,10 @@
static struct gl_framebuffer DummyFramebuffer;
static struct gl_renderbuffer DummyRenderbuffer;
+/* We bind this framebuffer when applications pass a NULL
+ * drawable/surface in make current. */
+static struct gl_framebuffer IncompleteFramebuffer;
+
#define IS_CUBE_FACE(TARGET) \
((TARGET) >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && \
@@ -95,14 +99,16 @@ _mesa_init_fbobjects(GLcontext *ctx)
{
_glthread_INIT_MUTEX(DummyFramebuffer.Mutex);
_glthread_INIT_MUTEX(DummyRenderbuffer.Mutex);
+ _glthread_INIT_MUTEX(IncompleteFramebuffer.Mutex);
DummyFramebuffer.Delete = delete_dummy_framebuffer;
DummyRenderbuffer.Delete = delete_dummy_renderbuffer;
+ IncompleteFramebuffer.Delete = delete_dummy_framebuffer;
}
struct gl_framebuffer *
_mesa_get_incomplete_framebuffer(void)
{
- return &DummyFramebuffer;
+ return &IncompleteFramebuffer;
}
/**
@@ -925,6 +931,12 @@ GLenum
_mesa_base_fbo_format(GLcontext *ctx, GLenum internalFormat)
{
switch (internalFormat) {
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ return GL_ALPHA;
case GL_RGB:
case GL_R3_G3_B2:
case GL_RGB4:
@@ -1022,7 +1034,7 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
rb = ctx->CurrentRenderbuffer;
if (!rb) {
- _mesa_error(ctx, GL_INVALID_OPERATION, func);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", func);
return;
}
diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h
index 0762930044..c6354b97bc 100644
--- a/src/mesa/main/feedback.h
+++ b/src/mesa/main/feedback.h
@@ -32,11 +32,6 @@
#if FEATURE_feedback
-#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) \
- do { \
- (driver)->RenderMode = impl ## RenderMode; \
- } while (0)
-
extern void
_mesa_feedback_vertex( GLcontext *ctx,
const GLfloat win[4],
@@ -65,8 +60,6 @@ _mesa_init_feedback_dispatch(struct _glapi_table *disp);
#include "main/compiler.h"
-#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void
_mesa_feedback_vertex( GLcontext *ctx,
const GLfloat win[4],
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index a3cb5ec168..2062134a39 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -128,6 +128,7 @@ enum value_extra {
EXTRA_VERSION_30,
EXTRA_VERSION_31,
EXTRA_VERSION_32,
+ EXTRA_VERSION_ES2,
EXTRA_NEW_BUFFERS,
EXTRA_VALID_DRAW_BUFFER,
EXTRA_VALID_TEXTURE_UNIT,
@@ -326,6 +327,13 @@ static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
+static const int
+extra_ARB_vertex_program_version_es2[] = {
+ EXT(ARB_vertex_program),
+ EXTRA_VERSION_ES2,
+ EXTRA_END
+};
+
#define API_OPENGL_BIT (1 << API_OPENGL)
#define API_OPENGLES_BIT (1 << API_OPENGLES)
#define API_OPENGLES2_BIT (1 << API_OPENGLES2)
@@ -661,7 +669,8 @@ static const struct value_desc values[] = {
{ GL_STENCIL_BACK_PASS_DEPTH_PASS, CONTEXT_ENUM(Stencil.ZPassFunc[1]), NO_EXTRA },
{ GL_MAX_VERTEX_ATTRIBS_ARB,
- CONTEXT_INT(Const.VertexProgram.MaxAttribs), extra_ARB_vertex_program },
+ CONTEXT_INT(Const.VertexProgram.MaxAttribs),
+ extra_ARB_vertex_program_version_es2 },
/* OES_texture_3D */
{ GL_TEXTURE_BINDING_3D, LOC_CUSTOM, TYPE_INT, TEXTURE_3D_INDEX, NO_EXTRA },
@@ -1678,6 +1687,12 @@ check_extra(GLcontext *ctx, const char *func, const struct value_desc *d)
enabled++;
}
break;
+ case EXTRA_VERSION_ES2:
+ if (ctx->API == API_OPENGLES2) {
+ total++;
+ enabled++;
+ }
+ break;
case EXTRA_NEW_BUFFERS:
if (ctx->NewState & _NEW_BUFFERS)
_mesa_update_state(ctx);
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index a4044ff5cb..45f7b55ad2 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -55,11 +55,11 @@
#include "GL/internal/glcore.h"
-#ifndef GL_FIXED
-#define GL_FIXED 0x140C
+/**
+ * GL_FIXED is defined in glext.h version 64 but these typedefs aren't (yet).
+ */
typedef int GLfixed;
typedef int GLclampx;
-#endif
#ifndef GL_OES_EGL_image
@@ -122,10 +122,24 @@ typedef void *GLeglImageOES;
#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
#endif
+
+
/**
- * Special, internal token
+ * Internal token to represent a GLSL shader program (a collection of
+ * one or more shaders that get linked together). Note that GLSL
+ * shaders and shader programs share one name space (one hash table)
+ * so we need a value that's different from any of the
+ * GL_VERTEX/FRAGMENT/GEOMETRY_PROGRAM tokens.
*/
#define GL_SHADER_PROGRAM_MESA 0x9999
+/**
+ * Internal token for geometry programs.
+ * Use the value for GL_GEOMETRY_PROGRAM_NV for now.
+ */
+#define MESA_GEOMETRY_PROGRAM 0x8c26
+
+
+
#endif /* GLHEADER_H */
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 5b87b8c8ac..43ae28c25a 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -599,7 +599,7 @@ _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
bitmask |= MAT_BIT_FRONT_INDEXES | MAT_BIT_BACK_INDEXES;
break;
default:
- _mesa_error( ctx, GL_INVALID_ENUM, where );
+ _mesa_error( ctx, GL_INVALID_ENUM, "%s", where );
return 0;
}
@@ -610,12 +610,12 @@ _mesa_material_bitmask( GLcontext *ctx, GLenum face, GLenum pname,
bitmask &= BACK_MATERIAL_BITS;
}
else if (face != GL_FRONT_AND_BACK) {
- _mesa_error( ctx, GL_INVALID_ENUM, where );
+ _mesa_error( ctx, GL_INVALID_ENUM, "%s", where );
return 0;
}
if (bitmask & ~legal) {
- _mesa_error( ctx, GL_INVALID_ENUM, where );
+ _mesa_error( ctx, GL_INVALID_ENUM, "%s", where );
return 0;
}
diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h
index 4e838abe03..92311ef7f0 100644
--- a/src/mesa/main/mfeatures.h
+++ b/src/mesa/main/mfeatures.h
@@ -42,9 +42,6 @@
/**
* A feature can be anything. But most of them share certain characteristics.
*
- * When a feature defines driver entries, they can be initialized by
- * _MESA_INIT_<FEATURE>_FUNCTIONS
- *
* When a feature defines vtxfmt entries, they can be initialized and
* installed by
* _MESA_INIT_<FEATURE>_VTXFMT
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index d44eff69cc..864805af0e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -41,13 +41,14 @@
#include "math/m_matrix.h" /* GLmatrix */
#include "main/simple_list.h" /* struct simple_node */
-/**
- * Internal token
- * Must be simply different than GL_VERTEX_PROGRAM
- * and GL_FRAGMENT_PROGRAM_ARB
- * FIXME: this will have to be a real GL extension
+/* Shader stages. Note that these will become 5 with tessellation.
+ * These MUST have the same values as PIPE_SHADER_*
*/
-#define MESA_GEOMETRY_PROGRAM 0x9999
+#define MESA_SHADER_VERTEX 0
+#define MESA_SHADER_FRAGMENT 1
+#define MESA_SHADER_GEOMETRY 2
+#define MESA_SHADER_TYPES 3
+
/**
* Color channel data type.
@@ -2166,23 +2167,35 @@ struct gl_shader_program
struct gl_shader_state
{
struct gl_shader_program *CurrentProgram; /**< The user-bound program */
+ void *MemPool;
+
+ GLbitfield Flags; /**< Mask of GLSL_x flags */
+};
+
+/**
+ * Compiler options for a single GLSL shaders type
+ */
+struct gl_shader_compiler_options
+{
/** Driver-selectable options: */
- GLboolean EmitHighLevelInstructions; /**< IF/ELSE/ENDIF vs. BRA, etc. */
- GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */
GLboolean EmitCondCodes; /**< Use condition codes? */
- GLboolean EmitComments; /**< Annotated instructions */
GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */
/**
* Attempts to flatten all ir_if (OPCODE_IF) for GPUs that can't
* support control flow.
*/
GLboolean EmitNoIfs;
- void *MemPool;
- GLbitfield Flags; /**< Mask of GLSL_x flags */
+ GLboolean EmitNoLoops;
+ GLboolean EmitNoFunctions;
+ GLboolean EmitNoCont; /**< Emit CONT opcode? */
+ GLboolean EmitNoMainReturn; /**< Emit CONT/RET opcodes? */
+ GLboolean EmitNoNoise; /**< Emit NOISE opcodes? */
+
+ GLuint MaxUnrollIterations;
+
struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */
};
-
/**
* Transform feedback object state
*/
@@ -2585,7 +2598,8 @@ struct gl_constants
GLuint MaxVarying; /**< Number of float[4] varying parameters */
- GLbitfield SupportedBumpUnits; /**> units supporting GL_ATI_envmap_bumpmap as targets */
+ /** Which texture units support GL_ATI_envmap_bumpmap as targets */
+ GLbitfield SupportedBumpUnits;
/**
* Maximum amount of time, measured in nanseconds, that the server can wait.
@@ -3202,6 +3216,7 @@ struct __GLcontextRec
struct gl_ati_fragment_shader_state ATIFragmentShader;
struct gl_shader_state Shader; /**< GLSL shader object state */
+ struct gl_shader_compiler_options ShaderCompilerOptions[MESA_SHADER_TYPES];
struct gl_query_state Query; /**< occlusion, timer queries */
diff --git a/src/mesa/main/nvprogram.c b/src/mesa/main/nvprogram.c
index 100ff2c4ab..3a570b7dda 100644
--- a/src/mesa/main/nvprogram.c
+++ b/src/mesa/main/nvprogram.c
@@ -516,8 +516,10 @@ _mesa_emit_nv_temp_initialization(GLcontext *ctx,
{
struct prog_instruction *inst;
GLuint i;
+ struct gl_shader_compiler_options* options =
+ &ctx->ShaderCompilerOptions[_mesa_program_target_to_index(program->Target)];
- if (!ctx->Shader.EmitNVTempInitialization)
+ if (!options->EmitNVTempInitialization)
return;
/* We'll swizzle up a zero temporary so we can use it for the
diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h
index b044c0d5d4..8746ed15e9 100644
--- a/src/mesa/main/queryobj.h
+++ b/src/mesa/main/queryobj.h
@@ -33,17 +33,6 @@
#if FEATURE_queryobj
-#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) \
- do { \
- (driver)->NewQueryObject = impl ## NewQueryObject; \
- (driver)->DeleteQuery = impl ## DeleteQuery; \
- (driver)->BeginQuery = impl ## BeginQuery; \
- (driver)->EndQuery = impl ## EndQuery; \
- (driver)->WaitQuery = impl ## WaitQuery; \
- (driver)->CheckQuery = impl ## CheckQuery; \
- } while (0)
-
-
static INLINE struct gl_query_object *
_mesa_lookup_query_object(GLcontext *ctx, GLuint id)
{
@@ -78,8 +67,6 @@ _mesa_init_queryobj_dispatch(struct _glapi_table *disp);
#else /* FEATURE_queryobj */
-#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE struct gl_query_object *
_mesa_lookup_query_object(GLcontext *ctx, GLuint id)
{
diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h
index b2127225b6..4994616d40 100644
--- a/src/mesa/main/rastpos.h
+++ b/src/mesa/main/rastpos.h
@@ -37,18 +37,11 @@
#if FEATURE_rastpos
-#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) \
- do { \
- (driver)->RasterPos = impl ## RasterPos; \
- } while (0)
-
extern void
_mesa_init_rastpos_dispatch(struct _glapi_table *disp);
#else /* FEATURE_rastpos */
-#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) do { } while (0)
-
static INLINE void
_mesa_init_rastpos_dispatch(struct _glapi_table *disp)
{
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index cc350c93b9..c25d2a1974 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -94,18 +94,19 @@ _mesa_init_shader_state(GLcontext *ctx)
/* Device drivers may override these to control what kind of instructions
* are generated by the GLSL compiler.
*/
- ctx->Shader.EmitHighLevelInstructions = GL_TRUE;
- ctx->Shader.EmitContReturn = GL_TRUE;
- ctx->Shader.EmitCondCodes = GL_FALSE;
- ctx->Shader.EmitComments = GL_FALSE;
- ctx->Shader.EmitNoIfs = GL_FALSE;
- ctx->Shader.Flags = get_shader_flags();
+ struct gl_shader_compiler_options options;
+ GLuint i;
+
+ memset(&options, 0, sizeof(options));
+ options.MaxUnrollIterations = 32;
/* Default pragma settings */
- ctx->Shader.DefaultPragmas.IgnoreOptimize = GL_FALSE;
- ctx->Shader.DefaultPragmas.IgnoreDebug = GL_FALSE;
- ctx->Shader.DefaultPragmas.Optimize = GL_TRUE;
- ctx->Shader.DefaultPragmas.Debug = GL_FALSE;
+ options.DefaultPragmas.Optimize = GL_TRUE;
+
+ for(i = 0; i < MESA_SHADER_TYPES; ++i)
+ memcpy(&ctx->ShaderCompilerOptions[i], &options, sizeof(options));
+
+ ctx->Shader.Flags = get_shader_flags();
}
@@ -789,13 +790,16 @@ static void
compile_shader(GLcontext *ctx, GLuint shaderObj)
{
struct gl_shader *sh;
+ struct gl_shader_compiler_options *options;
sh = _mesa_lookup_shader_err(ctx, shaderObj, "glCompileShader");
if (!sh)
return;
+ options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)];
+
/* set default pragma state for shader */
- sh->Pragmas = ctx->Shader.DefaultPragmas;
+ sh->Pragmas = options->DefaultPragmas;
/* this call will set the sh->CompileStatus field to indicate if
* compilation was successful.
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c
index 59198d788b..2de8f27981 100644
--- a/src/mesa/main/shaderobj.c
+++ b/src/mesa/main/shaderobj.c
@@ -156,18 +156,18 @@ struct gl_shader *
_mesa_lookup_shader_err(GLcontext *ctx, GLuint name, const char *caller)
{
if (!name) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller);
return NULL;
}
else {
struct gl_shader *sh = (struct gl_shader *)
_mesa_HashLookup(ctx->Shared->ShaderObjects, name);
if (!sh) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller);
return NULL;
}
if (sh->Type == GL_SHADER_PROGRAM_MESA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, caller);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
return NULL;
}
return sh;
@@ -377,18 +377,18 @@ _mesa_lookup_shader_program_err(GLcontext *ctx, GLuint name,
const char *caller)
{
if (!name) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller);
return NULL;
}
else {
struct gl_shader_program *shProg = (struct gl_shader_program *)
_mesa_HashLookup(ctx->Shared->ShaderObjects, name);
if (!shProg) {
- _mesa_error(ctx, GL_INVALID_VALUE, caller);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", caller);
return NULL;
}
if (shProg->Type != GL_SHADER_PROGRAM_MESA) {
- _mesa_error(ctx, GL_INVALID_OPERATION, caller);
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
return NULL;
}
return shProg;
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index 4800046375..cbe7ae7b06 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -96,6 +96,37 @@ _mesa_init_shader_state(GLcontext *ctx);
extern void
_mesa_free_shader_state(GLcontext *ctx);
+static INLINE GLuint
+_mesa_shader_type_to_index(GLenum v)
+{
+ switch(v)
+ {
+ case GL_VERTEX_SHADER:
+ return MESA_SHADER_VERTEX;
+ case GL_FRAGMENT_SHADER:
+ return MESA_SHADER_FRAGMENT;
+ case GL_GEOMETRY_SHADER:
+ return MESA_SHADER_GEOMETRY;
+ default:
+ ASSERT(0);
+ return ~0;
+ }
+}
+
+static INLINE GLenum
+_mesa_shader_index_to_type(GLuint i)
+{
+ GLenum enums[MESA_SHADER_TYPES] = {
+ GL_VERTEX_SHADER,
+ GL_FRAGMENT_SHADER,
+ GL_GEOMETRY_SHADER ,
+ };
+ if(i >= MESA_SHADER_TYPES)
+ return 0;
+ else
+ return enums[i];
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index ea7e503cf3..a56c70fa7f 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -40,9 +40,7 @@
#include "program/program.h"
#include "dlist.h"
#include "shaderobj.h"
-#if FEATURE_ARB_sync
#include "syncobj.h"
-#endif
/**
* Allocate and initialize a shared context state structure.
@@ -122,9 +120,7 @@ _mesa_alloc_shared_state(GLcontext *ctx)
shared->RenderBuffers = _mesa_NewHashTable();
#endif
-#if FEATURE_ARB_sync
make_empty_list(& shared->SyncObjects);
-#endif
return shared;
}
@@ -337,7 +333,6 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
_mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL);
#endif
-#if FEATURE_ARB_sync
{
struct simple_node *node;
struct simple_node *temp;
@@ -346,7 +341,6 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
_mesa_unref_sync_object(ctx, (struct gl_sync_object *) node);
}
}
-#endif
/*
* Free texture objects (after FBOs since some textures might have
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index 1bff308177..ac948cc1ef 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -59,6 +59,8 @@
#include "imports.h"
#include "context.h"
#include "macros.h"
+#include "get.h"
+#include "dispatch.h"
#if FEATURE_ARB_sync
#include "syncobj.h"
@@ -136,6 +138,19 @@ _mesa_init_sync_object_functions(struct dd_function_table *driver)
}
+void
+_mesa_init_sync_dispatch(struct _glapi_table *disp)
+{
+ SET_IsSync(disp, _mesa_IsSync);
+ SET_DeleteSync(disp, _mesa_DeleteSync);
+ SET_FenceSync(disp, _mesa_FenceSync);
+ SET_ClientWaitSync(disp, _mesa_ClientWaitSync);
+ SET_WaitSync(disp, _mesa_WaitSync);
+ SET_GetInteger64v(disp, _mesa_GetInteger64v);
+ SET_GetSynciv(disp, _mesa_GetSynciv);
+}
+
+
/**
* Allocate/init the context state related to sync objects.
*/
diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h
index c53511995b..82e141d408 100644
--- a/src/mesa/main/syncobj.h
+++ b/src/mesa/main/syncobj.h
@@ -31,15 +31,19 @@
#ifndef SYNCOBJ_H
#define SYNCOBJ_H
-#include "glheader.h"
-#include "mtypes.h"
+#include "main/mtypes.h"
struct dd_function_table;
+#if FEATURE_ARB_sync
+
extern void
_mesa_init_sync_object_functions(struct dd_function_table *driver);
extern void
+_mesa_init_sync_dispatch(struct _glapi_table *disp);
+
+extern void
_mesa_init_sync(GLcontext *);
extern void
@@ -70,4 +74,42 @@ extern void GLAPIENTRY
_mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
GLint *values);
+#else /* FEATURE_ARB_sync */
+
+#include "main/compiler.h"
+
+static INLINE void
+_mesa_init_sync_object_functions(struct dd_function_table *driver)
+{
+}
+
+static INLINE void
+_mesa_init_sync_dispatch(struct _glapi_table *disp)
+{
+}
+
+static INLINE void
+_mesa_init_sync(GLcontext *ctx)
+{
+}
+
+static INLINE void
+_mesa_free_sync_data(GLcontext *ctx)
+{
+}
+
+static INLINE void
+_mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+{
+ ASSERT_NO_FEATURE();
+}
+
+static INLINE void
+_mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
+{
+ ASSERT_NO_FEATURE();
+}
+
+#endif /* FEATURE_ARB_sync */
+
#endif /* SYNCOBJ_H */
diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c
index 4442fb8cf8..3a55128c73 100644
--- a/src/mesa/main/texenv.c
+++ b/src/mesa/main/texenv.c
@@ -196,57 +196,34 @@ set_combiner_source(GLcontext *ctx,
/*
* Translate pname to (term, alpha).
+ *
+ * The enums were given sequential values for a reason.
*/
switch (pname) {
case GL_SOURCE0_RGB:
- term = 0;
- alpha = GL_FALSE;
- break;
case GL_SOURCE1_RGB:
- term = 1;
- alpha = GL_FALSE;
- break;
case GL_SOURCE2_RGB:
- term = 2;
- alpha = GL_FALSE;
- break;
case GL_SOURCE3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_SOURCE0_RGB;
+ alpha = GL_FALSE;
break;
case GL_SOURCE0_ALPHA:
- term = 0;
- alpha = GL_TRUE;
- break;
case GL_SOURCE1_ALPHA:
- term = 1;
- alpha = GL_TRUE;
- break;
case GL_SOURCE2_ALPHA:
- term = 2;
- alpha = GL_TRUE;
- break;
case GL_SOURCE3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_SOURCE0_ALPHA;
+ alpha = GL_TRUE;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
+ if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+
assert(term < MAX_COMBINER_TERMS);
/*
@@ -310,68 +287,33 @@ set_combiner_operand(GLcontext *ctx,
return;
}
+ /* The enums were given sequential values for a reason.
+ */
switch (pname) {
case GL_OPERAND0_RGB:
- term = 0;
- alpha = GL_FALSE;
- break;
case GL_OPERAND1_RGB:
- term = 1;
- alpha = GL_FALSE;
- break;
case GL_OPERAND2_RGB:
- if (ctx->Extensions.ARB_texture_env_combine) {
- term = 2;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
case GL_OPERAND3_RGB_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_FALSE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_OPERAND0_RGB;
+ alpha = GL_FALSE;
break;
case GL_OPERAND0_ALPHA:
- term = 0;
- alpha = GL_TRUE;
- break;
case GL_OPERAND1_ALPHA:
- term = 1;
- alpha = GL_TRUE;
- break;
case GL_OPERAND2_ALPHA:
- if (ctx->Extensions.ARB_texture_env_combine) {
- term = 2;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
- break;
case GL_OPERAND3_ALPHA_NV:
- if (ctx->Extensions.NV_texture_env_combine4) {
- term = 3;
- alpha = GL_TRUE;
- }
- else {
- TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
- return;
- }
+ term = pname - GL_OPERAND0_ALPHA;
+ alpha = GL_TRUE;
break;
default:
TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
return;
}
+ if ((term == 3) && !ctx->Extensions.NV_texture_env_combine4) {
+ TE_ERROR(GL_INVALID_ENUM, "glTexEnv(pname=%s)", pname);
+ return;
+ }
+
assert(term < MAX_COMBINER_TERMS);
/*
@@ -380,10 +322,23 @@ set_combiner_operand(GLcontext *ctx,
switch (param) {
case GL_SRC_COLOR:
case GL_ONE_MINUS_SRC_COLOR:
- legal = !alpha;
+ /* The color input can only be used with GL_OPERAND[01]_RGB in the EXT
+ * version. In the ARB and NV versions they can be used for any RGB
+ * operand.
+ */
+ legal = !alpha
+ && ((term < 2) || ctx->Extensions.ARB_texture_env_combine
+ || ctx->Extensions.NV_texture_env_combine4);
break;
- case GL_SRC_ALPHA:
case GL_ONE_MINUS_SRC_ALPHA:
+ /* GL_ONE_MINUS_SRC_ALPHA can only be used with
+ * GL_OPERAND[01]_(RGB|ALPHA) in the EXT version. In the ARB and NV
+ * versions it can be used for any operand.
+ */
+ legal = (term < 2) || ctx->Extensions.ARB_texture_env_combine
+ || ctx->Extensions.NV_texture_env_combine4;
+ break;
+ case GL_SRC_ALPHA:
legal = GL_TRUE;
break;
default:
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index 9fa8f02a8b..20f02cefe9 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -907,7 +907,7 @@ static struct ureg get_zero( struct texenv_fragment_program *p )
static void program_error( struct texenv_fragment_program *p, const char *msg )
{
- _mesa_problem(NULL, msg);
+ _mesa_problem(NULL, "%s", msg);
p->error = 1;
}
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
index 2224a93761..9ed8023836 100644
--- a/src/mesa/main/texgen.h
+++ b/src/mesa/main/texgen.h
@@ -35,11 +35,6 @@ struct _glapi_table;
#if FEATURE_texgen
-#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) \
- do { \
- (driver)->TexGen = impl ## TexGen; \
- } while (0)
-
extern void GLAPIENTRY
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params );
@@ -68,8 +63,6 @@ _es_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params);
#else /* FEATURE_texgen */
-#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) do { } while (0)
-
static void
_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params )
{
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 9b7a021561..ca1bd6096e 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1405,7 +1405,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
char message[100];
_mesa_snprintf(message, sizeof(message),
"glTexImage%dD(format/type YCBCR mismatch", dimensions);
- _mesa_error(ctx, GL_INVALID_ENUM, message);
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s", message);
return GL_TRUE; /* error */
}
if (target != GL_TEXTURE_2D &&
@@ -1422,7 +1422,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
_mesa_snprintf(message, sizeof(message),
"glTexImage%dD(format=GL_YCBCR_MESA and border=%d)",
dimensions, border);
- _mesa_error(ctx, GL_INVALID_VALUE, message);
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s", message);
}
return GL_TRUE;
}
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 6c0cfc4e32..d19de7ff62 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -1256,8 +1256,8 @@ _mesa_UnlockArraysEXT( void )
/* GL_EXT_multi_draw_arrays */
/* Somebody forgot to spec the first and count parameters as const! <sigh> */
void GLAPIENTRY
-_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first,
- GLsizei *count, GLsizei primcount )
+_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount )
{
GET_CURRENT_CONTEXT(ctx);
GLint i;
diff --git a/src/mesa/main/varray.h b/src/mesa/main/varray.h
index 26889f5ad4..c7c3e3ec70 100644
--- a/src/mesa/main/varray.h
+++ b/src/mesa/main/varray.h
@@ -159,8 +159,8 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
extern void GLAPIENTRY
-_mesa_MultiDrawArraysEXT( GLenum mode, GLint *first,
- GLsizei *count, GLsizei primcount );
+_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
+ const GLsizei *count, GLsizei primcount );
extern void GLAPIENTRY
_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c
index d833a160e9..9e1f5f2a4f 100644
--- a/src/mesa/main/version.c
+++ b/src/mesa/main/version.c
@@ -260,11 +260,15 @@ compute_version_es2(GLcontext *ctx)
/**
* Set the context's VersionMajor, VersionMinor, VersionString fields.
- * This should only be called once as part of context initialization.
+ * This should only be called once as part of context initialization
+ * or to perform version check for GLX_ARB_create_context_profile.
*/
void
_mesa_compute_version(GLcontext *ctx)
{
+ if (ctx->VersionMajor)
+ return;
+
switch (ctx->API) {
case API_OPENGL:
compute_version(ctx);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index f0e14b8ece..2edf01bb8f 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -186,6 +186,7 @@ public:
GLcontext *ctx;
struct gl_program *prog;
struct gl_shader_program *shader_program;
+ struct gl_shader_compiler_options *options;
int next_temp;
@@ -703,6 +704,10 @@ static struct statevar_element gl_Fog_elements[] = {
{"scale", {STATE_FOG_PARAMS}, SWIZZLE_WWWW},
};
+static struct statevar_element gl_NormalScale_elements[] = {
+ {NULL, {STATE_NORMAL_SCALE}, SWIZZLE_XXXX},
+};
+
#define MATRIX(name, statevar, modifier) \
static struct statevar_element name ## _elements[] = { \
{ NULL, { statevar, 0, 0, 0, modifier}, SWIZZLE_XYZW }, \
@@ -760,10 +765,10 @@ static struct statevar_element gl_NormalMatrix_elements[] = {
#define STATEVAR(name) {#name, name ## _elements, Elements(name ## _elements)}
-static struct {
+static const struct statevar {
const char *name;
struct statevar_element *elements;
- int num_elements;
+ unsigned int num_elements;
} statevars[] = {
STATEVAR(gl_DepthRange),
STATEVAR(gl_ClipPlane),
@@ -808,6 +813,7 @@ static struct {
STATEVAR(gl_TextureMatrixInverseTranspose),
STATEVAR(gl_NormalMatrix),
+ STATEVAR(gl_NormalScale),
};
void
@@ -823,12 +829,6 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
unsigned int i;
- struct variable_storage *entry;
- entry = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY,
- this->next_temp);
- this->variables.push_tail(entry);
- this->next_temp += type_size(ir->type);
-
for (i = 0; i < Elements(statevars); i++) {
if (strcmp(ir->name, statevars[i].name) == 0)
break;
@@ -840,9 +840,7 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
return;
}
- ir_to_mesa_dst_reg dst =
- ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg(PROGRAM_TEMPORARY,
- entry->index, NULL));
+ const struct statevar *statevar = &statevars[i];
int array_count;
if (ir->type->is_array()) {
@@ -851,9 +849,41 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
array_count = 1;
}
+ /* Check if this statevar's setup in the STATE file exactly
+ * matches how we'll want to reference it as a
+ * struct/array/whatever. If not, then we need to move it into
+ * temporary storage and hope that it'll get copy-propagated
+ * out.
+ */
+ for (i = 0; i < statevar->num_elements; i++) {
+ if (statevar->elements[i].swizzle != SWIZZLE_XYZW) {
+ break;
+ }
+ }
+
+ struct variable_storage *storage;
+ ir_to_mesa_dst_reg dst;
+ if (i == statevar->num_elements) {
+ /* We'll set the index later. */
+ storage = new(mem_ctx) variable_storage(ir, PROGRAM_STATE_VAR, -1);
+ this->variables.push_tail(storage);
+
+ dst = ir_to_mesa_undef_dst;
+ } else {
+ storage = new(mem_ctx) variable_storage(ir, PROGRAM_TEMPORARY,
+ this->next_temp);
+ this->variables.push_tail(storage);
+ this->next_temp += type_size(ir->type);
+
+ dst = ir_to_mesa_dst_reg_from_src(ir_to_mesa_src_reg(PROGRAM_TEMPORARY,
+ storage->index,
+ NULL));
+ }
+
+
for (int a = 0; a < array_count; a++) {
- for (int j = 0; j < statevars[i].num_elements; j++) {
- struct statevar_element *element = &statevars[i].elements[j];
+ for (unsigned int i = 0; i < statevar->num_elements; i++) {
+ struct statevar_element *element = &statevar->elements[i];
int tokens[STATE_LENGTH];
memcpy(tokens, element->tokens, sizeof(element->tokens));
@@ -863,17 +893,28 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
int index = _mesa_add_state_reference(this->prog->Parameters,
(gl_state_index *)tokens);
- ir_to_mesa_src_reg src(PROGRAM_STATE_VAR, index, NULL);
- src.swizzle = element->swizzle;
- ir_to_mesa_emit_op1(ir, OPCODE_MOV, dst, src);
- /* even a float takes up a whole vec4 reg in a struct/array. */
- dst.index++;
+
+ if (storage->file == PROGRAM_STATE_VAR) {
+ if (storage->index == -1) {
+ storage->index = index;
+ } else {
+ assert(index == ((int)storage->index +
+ a * statevar->num_elements + i));
+ }
+ } else {
+ ir_to_mesa_src_reg src(PROGRAM_STATE_VAR, index, NULL);
+ src.swizzle = element->swizzle;
+ ir_to_mesa_emit_op1(ir, OPCODE_MOV, dst, src);
+ /* even a float takes up a whole vec4 reg in a struct/array. */
+ dst.index++;
+ }
}
}
- if (dst.index != entry->index + type_size(ir->type)) {
+ if (storage->file == PROGRAM_TEMPORARY &&
+ dst.index != storage->index + type_size(ir->type)) {
fail_link(this->shader_program,
"failed to load builtin uniform `%s' (%d/%d regs loaded)\n",
- ir->name, dst.index - entry->index,
+ ir->name, dst.index - storage->index,
type_size(ir->type));
}
}
@@ -882,13 +923,53 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
void
ir_to_mesa_visitor::visit(ir_loop *ir)
{
- assert(!ir->from);
- assert(!ir->to);
- assert(!ir->increment);
- assert(!ir->counter);
+ ir_dereference_variable *counter = NULL;
+
+ if (ir->counter != NULL)
+ counter = new(ir) ir_dereference_variable(ir->counter);
+
+ if (ir->from != NULL) {
+ assert(ir->counter != NULL);
+
+ ir_assignment *a = new(ir) ir_assignment(counter, ir->from, NULL);
+
+ a->accept(this);
+ delete a;
+ }
ir_to_mesa_emit_op0(NULL, OPCODE_BGNLOOP);
+
+ if (ir->to) {
+ ir_expression *e =
+ new(ir) ir_expression(ir->cmp, glsl_type::bool_type,
+ counter, ir->to);
+ ir_if *if_stmt = new(ir) ir_if(e);
+
+ ir_loop_jump *brk = new(ir) ir_loop_jump(ir_loop_jump::jump_break);
+
+ if_stmt->then_instructions.push_tail(brk);
+
+ if_stmt->accept(this);
+
+ delete if_stmt;
+ delete e;
+ delete brk;
+ }
+
visit_exec_list(&ir->body_instructions, this);
+
+ if (ir->increment) {
+ ir_expression *e =
+ new(ir) ir_expression(ir_binop_add, counter->type,
+ counter, ir->increment);
+
+ ir_assignment *a = new(ir) ir_assignment(counter, e, NULL);
+
+ a->accept(this);
+ delete a;
+ delete e;
+ }
+
ir_to_mesa_emit_op0(NULL, OPCODE_ENDLOOP);
}
@@ -1073,6 +1154,16 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
ir_to_mesa_emit_op1(ir, OPCODE_DDY, result_dst, op[0]);
break;
+ case ir_unop_noise: {
+ const enum prog_opcode opcode =
+ prog_opcode(OPCODE_NOISE1
+ + (ir->operands[0]->type->vector_elements) - 1);
+ assert((opcode >= OPCODE_NOISE1) && (opcode <= OPCODE_NOISE4));
+
+ ir_to_mesa_emit_op1(ir, opcode, result_dst, op[0]);
+ break;
+ }
+
case ir_binop_add:
ir_to_mesa_emit_op2(ir, OPCODE_ADD, result_dst, op[0], op[1]);
break;
@@ -1102,6 +1193,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
ir_to_mesa_emit_op2(ir, OPCODE_SGE, result_dst, op[0], op[1]);
break;
case ir_binop_equal:
+ ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]);
+ break;
+ case ir_binop_nequal:
+ ir_to_mesa_emit_op2(ir, OPCODE_SNE, result_dst, op[0], op[1]);
+ break;
+ case ir_binop_all_equal:
/* "==" operator producing a scalar boolean. */
if (ir->operands[0]->type->is_vector() ||
ir->operands[1]->type->is_vector()) {
@@ -1115,7 +1212,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
ir_to_mesa_emit_op2(ir, OPCODE_SEQ, result_dst, op[0], op[1]);
}
break;
- case ir_binop_nequal:
+ case ir_binop_any_nequal:
/* "!=" operator producing a scalar boolean. */
if (ir->operands[0]->type->is_vector() ||
ir->operands[1]->type->is_vector()) {
@@ -2016,7 +2113,7 @@ ir_to_mesa_visitor::visit(ir_if *ir)
ir->condition->accept(this);
assert(this->result.file != PROGRAM_UNDEFINED);
- if (ctx->Shader.EmitCondCodes) {
+ if (this->options->EmitCondCodes) {
cond_inst = (ir_to_mesa_instruction *)this->instructions.get_tail();
/* See if we actually generated any instruction for generating
@@ -2446,6 +2543,8 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
GLenum target;
const char *target_string;
GLboolean progress;
+ struct gl_shader_compiler_options *options =
+ &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)];
switch (shader->Type) {
case GL_VERTEX_SHADER:
@@ -2472,6 +2571,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
v.ctx = ctx;
v.prog = prog;
v.shader_program = shader_program;
+ v.options = options;
add_uniforms_to_parameters_list(shader_program, shader, prog);
@@ -2549,7 +2649,7 @@ get_mesa_program(GLcontext *ctx, struct gl_shader_program *shader_program,
if (mesa_inst->SrcReg[src].RelAddr)
prog->IndirectRegisterFiles |= 1 << mesa_inst->SrcReg[src].File;
- if (ctx->Shader.EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) {
+ if (options->EmitNoIfs && mesa_inst->Opcode == OPCODE_IF) {
fail_link(shader_program, "Couldn't flatten if statement\n");
}
@@ -2623,6 +2723,8 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
for (unsigned i = 0; i < prog->_NumLinkedShaders; i++) {
bool progress;
exec_list *ir = prog->_LinkedShaders[i]->ir;
+ struct gl_shader_compiler_options *options =
+ &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)];
do {
progress = false;
@@ -2633,11 +2735,16 @@ _mesa_ir_link_shader(GLcontext *ctx, struct gl_shader_program *prog)
do_div_to_mul_rcp(ir);
do_explog_to_explog2(ir);
- progress = do_common_optimization(ir, true) || progress;
+ progress = do_lower_jumps(ir, true, true, options->EmitNoMainReturn, options->EmitNoCont, options->EmitNoLoops) || progress;
- if (ctx->Shader.EmitNoIfs)
+ progress = do_common_optimization(ir, true, options->MaxUnrollIterations) || progress;
+
+ if (options->EmitNoIfs)
progress = do_if_to_cond_assign(ir) || progress;
+ if (options->EmitNoNoise)
+ progress = lower_noise(ir) || progress;
+
progress = do_vec_index_to_cond_assign(ir) || progress;
} while (progress);
@@ -2680,8 +2787,16 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
new(shader) _mesa_glsl_parse_state(ctx, shader->Type, shader);
const char *source = shader->Source;
+ /* Check if the user called glCompileShader without first calling
+ * glShaderSource. This should fail to compile, but not raise a GL_ERROR.
+ */
+ if (source == NULL) {
+ shader->CompileStatus = GL_FALSE;
+ return;
+ }
+
state->error = preprocess(state, &source, &state->info_log,
- &ctx->Extensions);
+ &ctx->Extensions, ctx->API);
if (ctx->Shader.Flags & GLSL_DUMP) {
printf("GLSL source for shader %d:\n", shader->Name);
@@ -2705,7 +2820,7 @@ _mesa_glsl_compile_shader(GLcontext *ctx, struct gl_shader *shader)
/* Do some optimization at compile time to reduce shader IR size
* and reduce later work if the same shader is linked multiple times
*/
- while (do_common_optimization(shader->ir, false))
+ while (do_common_optimization(shader->ir, false, 32))
;
validate_ir_tree(shader->ir);
diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c
index ead3ece95d..2687f8ae2c 100644
--- a/src/mesa/program/prog_statevars.c
+++ b/src/mesa/program/prog_statevars.c
@@ -1052,6 +1052,8 @@ _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
append_token(str, state[1]);
append_index(str, state[2]);
break;
+ case STATE_NORMAL_SCALE:
+ break;
case STATE_INTERNAL:
append_token(str, state[1]);
if (state[1] == STATE_CURRENT_ATTRIB)
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c
index 3b6d682744..06b9539bda 100644
--- a/src/mesa/program/program.c
+++ b/src/mesa/program/program.c
@@ -876,12 +876,16 @@ _mesa_find_used_registers(const struct gl_program *prog,
const GLuint n = _mesa_num_inst_src_regs(inst->Opcode);
if (inst->DstReg.File == file) {
- used[inst->DstReg.Index] = GL_TRUE;
+ ASSERT(inst->DstReg.Index < usedSize);
+ if(inst->DstReg.Index < usedSize)
+ used[inst->DstReg.Index] = GL_TRUE;
}
for (j = 0; j < n; j++) {
if (inst->SrcReg[j].File == file) {
- used[inst->SrcReg[j].Index] = GL_TRUE;
+ ASSERT(inst->SrcReg[j].Index < usedSize);
+ if(inst->SrcReg[j].Index < usedSize)
+ used[inst->SrcReg[j].Index] = GL_TRUE;
}
}
}
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 286573de1f..03b1066f32 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -40,6 +40,7 @@
#ifndef PROGRAM_H
#define PROGRAM_H
+#include "main/compiler.h"
#include "main/mtypes.h"
@@ -167,5 +168,37 @@ _mesa_find_free_register(const GLboolean used[],
extern void
_mesa_postprocess_program(GLcontext *ctx, struct gl_program *prog);
+/* keep these in the same order as TGSI_PROCESSOR_* */
+
+static INLINE GLuint
+_mesa_program_target_to_index(GLenum v)
+{
+ switch(v)
+ {
+ case GL_VERTEX_PROGRAM_ARB:
+ return MESA_SHADER_VERTEX;
+ case GL_FRAGMENT_PROGRAM_ARB:
+ return MESA_SHADER_FRAGMENT;
+ case GL_GEOMETRY_PROGRAM_NV:
+ return MESA_SHADER_GEOMETRY;
+ default:
+ ASSERT(0);
+ return ~0;
+ }
+}
+
+static INLINE GLenum
+_mesa_program_index_to_target(GLuint i)
+{
+ GLenum enums[MESA_SHADER_TYPES] = {
+ GL_VERTEX_PROGRAM_ARB,
+ GL_FRAGMENT_PROGRAM_ARB,
+ GL_GEOMETRY_PROGRAM_NV,
+ };
+ if(i >= MESA_SHADER_TYPES)
+ return 0;
+ else
+ return enums[i];
+}
#endif /* PROGRAM_H */
diff --git a/src/mesa/program/program_parse.tab.c b/src/mesa/program/program_parse.tab.c
index 31a609600b..08ead30def 100644
--- a/src/mesa/program/program_parse.tab.c
+++ b/src/mesa/program/program_parse.tab.c
@@ -5589,7 +5589,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
err_str = make_error_string("glProgramStringARB(%s)\n", s);
if (err_str) {
- _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
+ _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
free(err_str);
}
diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y
index fb6ef85a9f..cf621ae424 100644
--- a/src/mesa/program/program_parse.y
+++ b/src/mesa/program/program_parse.y
@@ -2628,7 +2628,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
err_str = make_error_string("glProgramStringARB(%s)\n", s);
if (err_str) {
- _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
+ _mesa_error(state->ctx, GL_INVALID_OPERATION, "%s", err_str);
free(err_str);
}
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index 9156024d47..b35d09335d 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -358,6 +358,7 @@ GLSL_LIBS = \
INCLUDE_DIRS = \
-I$(TOP)/include \
+ -I$(TOP)/src/glsl \
-I$(TOP)/src/mesa \
-I$(TOP)/src/mapi \
-I$(TOP)/src/gallium/include \
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 9eb14033ee..124cd32e13 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -996,6 +996,8 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level,
dest = (GLubyte *) pixels;
+ _mesa_set_fetch_functions(texImage, get_texture_dims(target));
+
for (i = 0; i < depth; i++) {
if (compressed_dst) {
_mesa_get_compressed_teximage(ctx, target, level, dest,
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 6cd74db897..4c223f3374 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -68,6 +68,7 @@ void st_init_limits(struct st_context *st)
struct pipe_screen *screen = st->pipe->screen;
struct gl_constants *c = &st->ctx->Const;
struct gl_program_constants *pc;
+ unsigned i;
c->MaxTextureLevels
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
@@ -134,40 +135,54 @@ void st_init_limits(struct st_context *st)
= CLAMP(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS),
1, MAX_DRAW_BUFFERS);
- /* Is TGSI_OPCODE_CONT supported? */
- /* XXX separate query for early function return? */
- st->ctx->Shader.EmitContReturn =
- screen->get_param(screen, PIPE_CAP_TGSI_CONT_SUPPORTED);
-
/* Quads always follow GL provoking rules. */
c->QuadsFollowProvokingVertexConvention = GL_FALSE;
- pc = &c->FragmentProgram;
- pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_INSTRUCTIONS);
- pc->MaxNativeAluInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS);
- pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS);
- pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_FS_TEX_INDIRECTIONS);
- pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS);
- pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_FS_TEMPS);
- pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_FS_ADDRS);
- pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_FS_CONSTS);
-
- pc = &c->VertexProgram;
- pc->MaxNativeInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_INSTRUCTIONS);
- pc->MaxNativeAluInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS);
- pc->MaxNativeTexInstructions = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS);
- pc->MaxNativeTexIndirections = screen->get_param(screen, PIPE_CAP_MAX_VS_TEX_INDIRECTIONS);
- pc->MaxNativeAttribs = screen->get_param(screen, PIPE_CAP_MAX_VS_INPUTS);
- pc->MaxNativeTemps = screen->get_param(screen, PIPE_CAP_MAX_VS_TEMPS);
- pc->MaxNativeAddressRegs = screen->get_param(screen, PIPE_CAP_MAX_VS_ADDRS);
- pc->MaxNativeParameters = screen->get_param(screen, PIPE_CAP_MAX_VS_CONSTS);
+ for(i = 0; i < MESA_SHADER_TYPES; ++i) {
+ struct gl_shader_compiler_options *options = &st->ctx->ShaderCompilerOptions[i];
+ switch(i)
+ {
+ case PIPE_SHADER_FRAGMENT:
+ pc = &c->FragmentProgram;
+ break;
+ case PIPE_SHADER_VERTEX:
+ pc = &c->VertexProgram;
+ break;
+ case PIPE_SHADER_GEOMETRY:
+ pc = &c->GeometryProgram;
+ break;
+ }
+
+ pc->MaxNativeInstructions = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS);
+ pc->MaxNativeAluInstructions = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS);
+ pc->MaxNativeTexInstructions = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS);
+ pc->MaxNativeTexIndirections = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS);
+ pc->MaxNativeAttribs = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INPUTS);
+ pc->MaxNativeTemps = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_TEMPS);
+ pc->MaxNativeAddressRegs = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_ADDRS);
+ pc->MaxNativeParameters = screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONSTS);
+
+ options->EmitNoNoise = TRUE;
+
+ /* TODO: make these more fine-grained if anyone needs it */
+ options->EmitNoIfs = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoFunctions = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoLoops = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+ options->EmitNoMainReturn = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH);
+
+ options->EmitNoCont = !screen->get_shader_param(screen, i, PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED);
+
+ if(options->EmitNoLoops)
+ options->MaxUnrollIterations = MIN2(screen->get_shader_param(screen, i, PIPE_SHADER_CAP_MAX_INSTRUCTIONS), 65536);
+ }
/* PIPE_CAP_MAX_FS_INPUTS specifies the number of COLORn + GENERICn inputs
* and is set in MaxNativeAttribs. It's always 2 colors + N generic
* attributes. The GLSL compiler never uses COLORn for varyings, so we
* subtract the 2 colors to get the maximum number of varyings (generic
* attributes) supported by a driver. */
- c->MaxVarying = screen->get_param(screen, PIPE_CAP_MAX_FS_INPUTS) - 2;
+ c->MaxVarying = screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_MAX_INPUTS) - 2;
+ c->MaxVarying = MIN2(c->MaxVarying, MAX_VARYING);
}
@@ -401,7 +416,7 @@ void st_init_extensions(struct st_context *st)
}
#endif
- if (screen->get_param(screen, PIPE_CAP_GEOMETRY_SHADER4)) {
+ if (screen->get_shader_param(screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) {
ctx->Extensions.ARB_geometry_shader4 = GL_TRUE;
}
diff --git a/src/mesa/state_tracker/st_gl_api.h b/src/mesa/state_tracker/st_gl_api.h
index 57c6d9f24d..55ad778c97 100644
--- a/src/mesa/state_tracker/st_gl_api.h
+++ b/src/mesa/state_tracker/st_gl_api.h
@@ -3,7 +3,5 @@
#define ST_GL_API_H
struct st_api *st_gl_api_create(void);
-struct st_api *st_gl_api_create_es1(void);
-struct st_api *st_gl_api_create_es2(void);
#endif
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index ccce574c36..450b0453cf 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -44,6 +44,7 @@
#include "main/framebuffer.h"
#include "main/fbobject.h"
#include "main/renderbuffer.h"
+#include "main/version.h"
#include "st_texture.h"
#include "st_context.h"
@@ -303,10 +304,6 @@ st_visual_to_context_mode(const struct st_visual *visual,
{
memset(mode, 0, sizeof(*mode));
- /* FBO-only context */
- if (!visual)
- return;
-
if (st_visual_have_buffers(visual, ST_ATTACHMENT_BACK_LEFT_MASK))
mode->doubleBufferMode = GL_TRUE;
if (st_visual_have_buffers(visual,
@@ -612,26 +609,57 @@ st_context_destroy(struct st_context_iface *stctxi)
}
static struct st_context_iface *
-create_context(gl_api api, struct st_manager *smapi,
- const struct st_visual *visual,
- struct st_context_iface *shared_stctxi)
+st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
+ const struct st_context_attribs *attribs,
+ struct st_context_iface *shared_stctxi)
{
struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
struct st_context *st;
struct pipe_context *pipe;
__GLcontextModes mode;
+ gl_api api;
+
+ if (!(stapi->profile_mask & (1 << attribs->profile)))
+ return NULL;
+
+ switch (attribs->profile) {
+ case ST_PROFILE_DEFAULT:
+ api = API_OPENGL;
+ break;
+ case ST_PROFILE_OPENGL_ES1:
+ api = API_OPENGLES;
+ break;
+ case ST_PROFILE_OPENGL_ES2:
+ api = API_OPENGLES2;
+ break;
+ case ST_PROFILE_OPENGL_CORE:
+ default:
+ return NULL;
+ break;
+ }
pipe = smapi->screen->context_create(smapi->screen, NULL);
if (!pipe)
return NULL;
- st_visual_to_context_mode(visual, &mode);
+ st_visual_to_context_mode(&attribs->visual, &mode);
st = st_create_context(api, pipe, &mode, shared_ctx);
if (!st) {
pipe->destroy(pipe);
return NULL;
}
+ /* need to perform version check */
+ if (attribs->major > 1 || attribs->minor > 0) {
+ _mesa_compute_version(st->ctx);
+
+ if (st->ctx->VersionMajor < attribs->major ||
+ st->ctx->VersionMajor < attribs->minor) {
+ st_destroy_context(st);
+ return NULL;
+ }
+ }
+
st->invalidate_on_gl_viewport =
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
@@ -646,30 +674,6 @@ create_context(gl_api api, struct st_manager *smapi,
return &st->iface;
}
-static struct st_context_iface *
-st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
- const struct st_visual *visual,
- struct st_context_iface *shared_stctxi)
-{
- return create_context(API_OPENGL, smapi, visual, shared_stctxi);
-}
-
-static struct st_context_iface *
-st_api_create_context_es1(struct st_api *stapi, struct st_manager *smapi,
- const struct st_visual *visual,
- struct st_context_iface *shared_stctxi)
-{
- return create_context(API_OPENGLES, smapi, visual, shared_stctxi);
-}
-
-static struct st_context_iface *
-st_api_create_context_es2(struct st_api *stapi, struct st_manager *smapi,
- const struct st_visual *visual,
- struct st_context_iface *shared_stctxi)
-{
- return create_context(API_OPENGLES2, smapi, visual, shared_stctxi);
-}
-
static boolean
st_api_make_current(struct st_api *stapi, struct st_context_iface *stctxi,
struct st_framebuffer_iface *stdrawi,
@@ -852,6 +856,17 @@ st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
}
static const struct st_api st_gl_api = {
+ ST_API_OPENGL,
+#if FEATURE_GL
+ ST_PROFILE_DEFAULT_MASK |
+#endif
+#if FEATURE_ES1
+ ST_PROFILE_OPENGL_ES1_MASK |
+#endif
+#if FEATURE_ES2
+ ST_PROFILE_OPENGL_ES2_MASK |
+#endif
+ 0,
st_api_destroy,
st_api_get_proc_address,
st_api_create_context,
@@ -859,52 +874,8 @@ static const struct st_api st_gl_api = {
st_api_get_current,
};
-static const struct st_api st_gl_api_es1 = {
- st_api_destroy,
- st_api_get_proc_address,
- st_api_create_context_es1,
- st_api_make_current,
- st_api_get_current,
-};
-
-static const struct st_api st_gl_api_es2 = {
- st_api_destroy,
- st_api_get_proc_address,
- st_api_create_context_es2,
- st_api_make_current,
- st_api_get_current,
-};
-
struct st_api *
st_gl_api_create(void)
{
- (void) st_gl_api;
- (void) st_gl_api_es1;
- (void) st_gl_api_es2;
-
-#if FEATURE_GL
return (struct st_api *) &st_gl_api;
-#else
- return NULL;
-#endif
-}
-
-struct st_api *
-st_gl_api_create_es1(void)
-{
-#if FEATURE_ES1
- return (struct st_api *) &st_gl_api_es1;
-#else
- return NULL;
-#endif
-}
-
-struct st_api *
-st_gl_api_create_es2(void)
-{
-#if FEATURE_ES2
- return (struct st_api *) &st_gl_api_es2;
-#else
- return NULL;
-#endif
}
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c
index 553fd9a76d..1de481248b 100644
--- a/src/mesa/swrast/s_readpix.c
+++ b/src/mesa/swrast/s_readpix.c
@@ -191,7 +191,8 @@ fast_read_rgba_pixels( GLcontext *ctx,
if (!rb)
return GL_FALSE;
- ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
+ ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_ALPHA);
/* clipping should have already been done */
ASSERT(x + width <= (GLint) rb->Width);
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 8931cdec1b..28c82990e0 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1248,7 +1248,8 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
4 * span->end * sizeof(GLchan));
}
- ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB);
+ ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB ||
+ rb->_BaseFormat == GL_ALPHA);
if (ctx->Color._LogicOpEnabled) {
_swrast_logicop_rgba_span(ctx, rb, span);
@@ -1346,7 +1347,8 @@ _swrast_read_rgba_span( GLcontext *ctx, struct gl_renderbuffer *rb,
ASSERT(rb);
ASSERT(rb->GetRow);
- ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA);
+ ASSERT(rb->_BaseFormat == GL_RGB || rb->_BaseFormat == GL_RGBA ||
+ rb->_BaseFormat == GL_ALPHA);
if (rb->DataType == dstType) {
rb->GetRow(ctx, rb, length, x + skip, y,