// _mesa_draw_arrays

// r300_draw_vbo

// r300_draw_arrays_immediate

  vertex_size = 3
  dwords = 13

  // r300_prepare_for_rendering
    // r300_emit_states
      // r300_reserve_cs_dwords
        389
      // r300_emit_dirty_state
        // r300_emit_gpu_flush
          SC_SCISSOR0 = 0
          SC_SCISSOR1 = (width - 1), (height - 1) // 600, 600
          // cb_flush_clean
          RB3D_DSTCACHE_CTLSTAT = 0xa
          ZB_ZCACHE_CTLSTAT = 0x3
          WAIT_UNTIL [0x1720] =  RADEON_WAIT_3D_IDLECLEAN
        // r300_emit_aa_state
          GB_AA_CONFIG = 0
          RB3D_AARESOLVE_CTL = 0
        // r300_emit_fb_state
          RB3D_CCTL = 16384
          RB3D_COLOROFFSET0 = 0
          //OUT_CS_RELOC
            OUT_CS(0xc0001000); /* PKT3_NOP */ \
            OUT_CS(0);

          RB3D_COLORPITCH0 = 0xc10640
          //OUT_CS_RELOC
            OUT_CS(0xc0001000); /* PKT3_NOP */ \
            OUT_CS(0);

          ZB_FORMAT = 2
          ZB_DEPTHOFFSET = 0
          //OUT_CS_RELOC
            OUT_CS(0xc0001000); /* PKT3_NOP */ \
            OUT_CS(4);

          ZB_DEPTHPITCH = 0x30640
          //OUT_CS_RELOC
            OUT_CS(0xc0001000); /* PKT3_NOP */ \
            OUT_CS(4);
        // r300_emit_hyperz_state
          ZB_BW_CNTL = 0
          ZB_DEPTHCLEARVALUE = 0
          SC_HYPERZ_EN = 0x1c
          GB_Z_PEQ_CONFIG = 0
        // r300_emit_ztop_state
          ZB_ZTOP = 1
        // r300_emit_dsa_state
          FG_ALPHA_FUNC = 0
          ZB_CNTL = 0
          ZB_ZSTENCILCNTL = 0
          ZB_STENCILREFMASK = 0
          ZB_STENCILREFMASK_BF = 0
          FG_ALPHA_VALUE = 0
        // r300_emit_blend_state
          RB3D_ROPCNTL = 0
          RB3D_BLENDCNTL = 0
          RB3D_ABLENDCNTL = 0
          RB3D_COLOR_CHANNEL_MASK = 15
          RB3D_DITHER_CTL = 0
        // r300_emit_blend_color_state
          RB3D_CONSTANT_COLOR_AR = 0
          RB3D_CONSTANT_COLOR_GB = 0
        // r300_emit_scissor_state
          SC_CLIP_0_A = 0, 0
          SC_CLIP_0_B = 0 - 1, 0 - 1
        // r300_emit_sample_mask
          SC_SCREENDOOR = 63 | (63 << 6) | (63 << 12) | (63 << 18)
        // r300_emit_invariant_state
          GB_SELECT = 0
          FG_FOG_BLEND = 0
          GA_OFFSET = 0
          SU_TEX_WRAP = 0
          SU_DEPTH_SCALE = 16777215.0f (0x4b7fffff)
          SU_DEPTH_OFFSET = 0
          SC_EDGERULE = 0x2da49525
          RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD = 0x1010101
          RB3D_DISCARD_SRC_PIXEL_GTE_THRESHOLD = 0xfefefefe
          GA_COLOR_CONTROL_PS3 = 0
          SU_TEX_WRAP_PS3 = 0
        // r300_emit_viewport_state
          VAP_VPORT_XSCALE = 300
          VAP_VPORT_XOFFSET = 300
          VAP_VPORT_YSCALE = -300
          VAP_VPORT_YOFFSET = 300
          VAP_VPORT_ZSCALE = 0.5
          VAP_VPORT_ZOFFSET = 0.5
          VAP_VTE_CNTL = 0x43f
        // r300_emit_pvs_flush
          VAP_PVS_STATE_FLUSH_REG = 0
        // r300_emit_vap_invariant_state
          VAP_PVS_VTX_TIMEOUT_REG = 0xffff
          VAP_GB_VERT_CLIP_ADJ = 1.0f (0x3f800000)
          VAP_GB_VERT_DISC_ADJ = 1.0f (0x3f800000)
          VAP_GB_HORZ_CLIP_ADJ = 1.0f (0x3f800000)
          VAP_GB_HORZ_DISC_ADJ = 1.0f (0x3f800000)
          VAP_PSC_SGN_NORM_CNTL = 0xaaaaaaaa
          VAP_TEX_TO_COLOR_CNTL = 0
        // r300_emit_vertex_stream_state
          VAP_PROG_STREAM_CNTL_0 = 0x2002
          VAP_PROG_STREAM_CNTL_EXT_0 = 0xfa88
        // r300_emit_vs_state
          VAP_PVS_CODE_CNTL_0 = 0
          VAP_PVS_CODE_CNTL_1 = 0
          VAP_PVS_VECTOR_INDX_REG = 0
          VAP_PVS_VECTOR_DATA_REG_128 = (ONE_REG_WR:)
            {0xf00203, 0xd10001, 0x1248001, 0x1248001}
          VAP_CNTL = 0xb0055a
          VAP_PVS_FLOW_CNTL_OPC = 0
          VAP_PVS_FLOW_CNTL_ADDRS_LW_[0-15] = 0
          VAP_PVS_FLOW_CNTL_ADDRS_UW_[0-15] = 0
          VAP_PVS_FLOW_CNTL_LOOP_INDEX_[0-15] = 0
        // r300_emit_clip_state
          VAP_PVS_VECTOR_INDX_REG = 0x600
          VAP_PVS_VECTOR_DATA_REG_128 =
            {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} (24)
        // r300_emit_rs_block_state
          VAP_VTX_STATE_CNTL = 0x5555
          VAP_VSM_VTX_ASSM [0x2184] = 0x1
          VAP_OUTPUT_VTX_FMT_0 = 1
          VAP_OUTPUT_VTX_FMT_1 = 4
          GB_ENABLE = 0
          RS_IP_0 = 0x30000000
          RS_COUNT = 0x40080
          RS_INST_COUNT = 0
          RS_INST_0 = 0
        // r300_emit_rs_state
          VAP_CNTL_STATUS = 0
          VAP_CLIP_CNTL = 0xc000
          GA_POINT_SIZE = 0x60006
          GA_POINT_MINMAX = 0x60006
          GA_LINE_CNTL = 0x20006
          SU_POLY_OFFSET_ENABLE = 0
          SU_CULL_MODE = 0
          GA_LINE_STIPPLE_CONFIG = 0
          GA_LINE_STIPPLE_VALUE = 0
          GA_POLY_MODE = 0
          GA_ROUND_MODE = 0x31
          SC_CLIP_RULE = 0xffff
          GA_POINT_S0 = 0
          GA_POINT_T0 = 1.0f (0x3f800000)
          GA_POINT_S1 = 1.0f (0x3f800000)
          GA_POINT_T1 = 0
        // r300_emit_fb_state_pipelined
          US_OUT_FMT_0 = 0x1b00
          US_OUT_FMT_1 = 0xf
          US_OUT_FMT_2 = 0xf
          US_OUT_FMT_3 = 0xf
          GB_MSPOS0 = 0x66666666
          GB_MSPOS1 = 0x6666666
        // r500_emit_fs
          US_CONFIG = 2
          US_PIXSIZE = 1
          US_FC_CTRL = 0
          US_CODE_RANGE = 0
          US_CODE_OFFSET = 0
          US_CODE_ADDR = 0
          GA_US_VECTOR_INDEX = 0
          GA_US_VECTOR_DATA = (ONE_REG_WR:)
            {0x78005, 0x8020080, 0x8020080, 0x1c9b04d8, 0x1c810003, 0x5}
          FG_DEPTH_SRC = 0
          US_W_FMT = 0
        // r500_emit_fs_rc_constant_state
          [nothing]
        // r500_emit_fs_constants
          [nothing]
        // r300_emit_vs_constants
          VAP_PVS_CONST_CNTL = 0
        // r300_emit_texture_cache_inval
          TX_INVALTAGS = 0
        // r300_emit_textures_state
          TX_ENABLE = 0
        // r300_emit_query_start
          [nothing]
        // r500_emit_index_bias
          VAP_INDEX_OFFSET = 0
        // r300_emit_draw_init
          GA_COLOR_CONTROL = 0x3aaaa
          VAP_VF_MAX_VTX_INDX = 2
          VAP_VF_MIN_VTX_INDX = 0

        // r300_draw_arrays_immediate
          VAP_VTX_SIZE = 3

          [
            PACKET3_3D_DRAW_IMMD_2 (3 * 3)
            0x30034 // VAP_VF_CNTL
            {0.5, -0.5, 0}
            {-0.5, -0.5, 0}
            {0, 0.5, 0}
          ]
