rsx: Dump DRAW_ARRAYS and DRAW_INDEX_ARRAYS.

This commit is contained in:
vlj 2016-09-12 23:50:52 +02:00
parent 8d54bcbc0d
commit f87e396958
2 changed files with 134 additions and 158 deletions

View File

@ -4309,6 +4309,78 @@ struct registers_decoder<NV4097_SET_TRANSFORM_PROGRAM_LOAD>
}
};
template <>
struct registers_decoder<NV4097_DRAW_ARRAYS>
{
struct decoded_type
{
private:
union {
u32 raw_value;
bitfield_decoder_t<0, 24> start;
bitfield_decoder_t<24, 8> count;
} m_data;
public:
decoded_type(u32 raw_value)
{
m_data.raw_value = raw_value;
}
u32 start() const
{
return m_data.start;
}
u16 count() const
{
return m_data.count + 1;
}
};
static std::string dump(decoded_type&& decoded_values)
{
return "Draw vertexes range [" + std::to_string(decoded_values.start()) + ", " +
std::to_string(decoded_values.start() + decoded_values.count()) + "]";
}
};
template <>
struct registers_decoder<NV4097_DRAW_INDEX_ARRAY>
{
struct decoded_type
{
private:
union {
u32 raw_value;
bitfield_decoder_t<0, 24> start;
bitfield_decoder_t<24, 8> count;
} m_data;
public:
decoded_type(u32 raw_value)
{
m_data.raw_value = raw_value;
}
u32 start() const
{
return m_data.start;
}
u16 count() const
{
return m_data.count + 1;
}
};
static std::string dump(decoded_type&& decoded_values)
{
return "Draw vertexes range [IdxArray[" + std::to_string(decoded_values.start()) +
"], IdxArray[" + std::to_string(decoded_values.start() + decoded_values.count()) + "}]";
}
};
#define TRANSFORM_PROGRAM(index) template<> struct registers_decoder<NV4097_SET_TRANSFORM_PROGRAM + index> : public transform_program_helper<index> {};
#define DECLARE_TRANSFORM_PROGRAM(index) NV4097_SET_TRANSFORM_PROGRAM + index,
EXPAND_RANGE_512(0, TRANSFORM_PROGRAM)
@ -4504,156 +4576,60 @@ EXPAND_RANGE_16(0, VERTEX_DATA4F)
EXPAND_RANGE_16(0, VERTEX_DATA2S)
EXPAND_RANGE_16(0, VERTEX_DATA4S)
constexpr std::integer_sequence<u32,
NV4097_SET_VIEWPORT_HORIZONTAL,
NV4097_SET_VIEWPORT_VERTICAL,
NV4097_SET_SCISSOR_HORIZONTAL,
NV4097_SET_SCISSOR_VERTICAL,
NV4097_SET_SURFACE_CLIP_HORIZONTAL,
NV4097_SET_SURFACE_CLIP_VERTICAL,
NV4097_SET_CLEAR_RECT_HORIZONTAL,
NV4097_SET_CLEAR_RECT_VERTICAL,
NV3089_CLIP_POINT,
NV3089_CLIP_SIZE,
NV3089_IMAGE_OUT_POINT,
NV3089_IMAGE_OUT_SIZE,
NV3089_IMAGE_IN_SIZE,
NV3062_SET_PITCH,
NV308A_POINT,
NV4097_SET_DEPTH_TEST_ENABLE,
NV4097_SET_DEPTH_MASK,
NV4097_SET_ALPHA_TEST_ENABLE,
NV4097_SET_STENCIL_TEST_ENABLE,
NV4097_SET_RESTART_INDEX_ENABLE,
NV4097_SET_DEPTH_BOUNDS_TEST_ENABLE,
NV4097_SET_LOGIC_OP_ENABLE,
NV4097_SET_DITHER_ENABLE,
NV4097_SET_BLEND_ENABLE,
NV4097_SET_LINE_SMOOTH_ENABLE,
NV4097_SET_POLY_OFFSET_POINT_ENABLE,
NV4097_SET_POLY_OFFSET_LINE_ENABLE,
NV4097_SET_POLY_OFFSET_FILL_ENABLE,
NV4097_SET_CULL_FACE_ENABLE,
NV4097_SET_POLY_SMOOTH_ENABLE,
NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE,
NV4097_SET_TWO_SIDE_LIGHT_EN,
NV4097_SET_RESTART_INDEX,
NV4097_SET_SURFACE_COLOR_AOFFSET,
NV4097_SET_SURFACE_COLOR_BOFFSET,
NV4097_SET_SURFACE_COLOR_COFFSET,
NV4097_SET_SURFACE_COLOR_DOFFSET,
NV4097_SET_SURFACE_PITCH_A,
NV4097_SET_SURFACE_PITCH_B,
NV4097_SET_SURFACE_PITCH_C,
NV4097_SET_SURFACE_PITCH_D,
NV4097_SET_SURFACE_ZETA_OFFSET,
NV4097_SET_SURFACE_PITCH_Z,
NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK,
NV4097_SET_SHADER_CONTROL,
NV4097_SET_VERTEX_DATA_BASE_OFFSET,
NV4097_SET_INDEX_ARRAY_ADDRESS,
NV4097_SET_VERTEX_DATA_BASE_INDEX,
NV4097_SET_SHADER_PROGRAM,
NV4097_SET_TRANSFORM_PROGRAM_START,
NV406E_SEMAPHORE_OFFSET,
NV4097_SET_SEMAPHORE_OFFSET,
NV3089_IMAGE_IN_OFFSET,
NV3062_SET_OFFSET_DESTIN,
NV309E_SET_OFFSET,
NV3089_DS_DX,
NV3089_DT_DY,
NV0039_PITCH_IN,
NV0039_PITCH_OUT,
NV0039_LINE_LENGTH_IN,
NV0039_LINE_COUNT,
NV0039_OFFSET_OUT,
NV0039_OFFSET_IN,
NV4097_SET_VERTEX_ATTRIB_INPUT_MASK,
NV4097_SET_FREQUENCY_DIVIDER_OPERATION,
NV4097_SET_DEPTH_BOUNDS_MIN,
NV4097_SET_DEPTH_BOUNDS_MAX,
NV4097_SET_FOG_PARAMS,
NV4097_SET_FOG_PARAMS + 1,
NV4097_SET_CLIP_MIN,
NV4097_SET_CLIP_MAX,
NV4097_SET_POLYGON_OFFSET_SCALE_FACTOR,
NV4097_SET_POLYGON_OFFSET_BIAS,
NV4097_SET_VIEWPORT_SCALE,
NV4097_SET_VIEWPORT_SCALE + 1,
NV4097_SET_VIEWPORT_SCALE + 2,
NV4097_SET_VIEWPORT_SCALE + 3,
NV4097_SET_VIEWPORT_OFFSET,
NV4097_SET_VIEWPORT_OFFSET + 1,
NV4097_SET_VIEWPORT_OFFSET + 2,
NV4097_SET_VIEWPORT_OFFSET + 3,
NV4097_SET_DEPTH_FUNC,
NV4097_SET_STENCIL_FUNC,
NV4097_SET_BACK_STENCIL_FUNC,
NV4097_SET_STENCIL_OP_FAIL,
NV4097_SET_STENCIL_OP_ZFAIL,
NV4097_SET_STENCIL_OP_ZPASS,
NV4097_SET_BACK_STENCIL_OP_FAIL,
NV4097_SET_BACK_STENCIL_OP_ZFAIL,
NV4097_SET_BACK_STENCIL_OP_ZPASS,
NV4097_SET_LOGIC_OP,
NV4097_SET_FRONT_FACE,
NV4097_SET_CULL_FACE,
NV4097_SET_SURFACE_COLOR_TARGET,
NV4097_SET_FOG_MODE,
NV4097_SET_ALPHA_FUNC,
NV4097_SET_BEGIN_END,
NV3089_SET_OPERATION,
NV3089_SET_COLOR_FORMAT,
NV3089_SET_CONTEXT_SURFACE,
NV3062_SET_COLOR_FORMAT,
NV4097_SET_STENCIL_FUNC_REF,
NV4097_SET_BACK_STENCIL_FUNC_REF,
NV4097_SET_STENCIL_FUNC_MASK,
NV4097_SET_BACK_STENCIL_FUNC_MASK,
NV4097_SET_ALPHA_REF,
NV4097_SET_COLOR_CLEAR_VALUE,
NV4097_SET_STENCIL_MASK,
NV4097_SET_BACK_STENCIL_MASK,
NV4097_SET_BLEND_EQUATION,
NV4097_SET_BLEND_FUNC_SFACTOR,
NV4097_SET_BLEND_FUNC_DFACTOR,
NV4097_SET_COLOR_MASK,
NV4097_SET_SHADER_WINDOW,
NV4097_SET_BLEND_ENABLE_MRT,
NV4097_SET_USER_CLIP_PLANE_CONTROL,
NV4097_SET_LINE_WIDTH,
NV4097_SET_SURFACE_FORMAT,
NV4097_SET_WINDOW_OFFSET,
NV4097_SET_ZSTENCIL_CLEAR_VALUE,
NV4097_SET_INDEX_ARRAY_DMA,
NV4097_SET_CONTEXT_DMA_COLOR_A,
NV4097_SET_CONTEXT_DMA_COLOR_B,
NV4097_SET_CONTEXT_DMA_COLOR_C,
NV4097_SET_CONTEXT_DMA_COLOR_D,
NV4097_SET_CONTEXT_DMA_ZETA,
NV3089_SET_CONTEXT_DMA_IMAGE,
NV3062_SET_CONTEXT_DMA_IMAGE_DESTIN,
NV309E_SET_CONTEXT_DMA_IMAGE,
NV0039_SET_CONTEXT_DMA_BUFFER_OUT,
NV0039_SET_CONTEXT_DMA_BUFFER_IN,
NV4097_SET_CONTEXT_DMA_REPORT,
NV3089_IMAGE_IN_FORMAT,
NV309E_SET_FORMAT,
NV0039_FORMAT,
NV4097_SET_BLEND_COLOR2,
NV4097_SET_BLEND_COLOR,
NV3089_IMAGE_IN,
NV4097_NO_OPERATION,
NV4097_INVALIDATE_VERTEX_CACHE_FILE,
NV4097_INVALIDATE_VERTEX_FILE,
NV4097_SET_ANTI_ALIASING_CONTROL,
NV4097_SET_FRONT_POLYGON_MODE,
constexpr std::integer_sequence<u32, NV4097_SET_VIEWPORT_HORIZONTAL, NV4097_SET_VIEWPORT_VERTICAL,
NV4097_SET_SCISSOR_HORIZONTAL, NV4097_SET_SCISSOR_VERTICAL, NV4097_SET_SURFACE_CLIP_HORIZONTAL,
NV4097_SET_SURFACE_CLIP_VERTICAL, NV4097_SET_CLEAR_RECT_HORIZONTAL,
NV4097_SET_CLEAR_RECT_VERTICAL, NV3089_CLIP_POINT, NV3089_CLIP_SIZE, NV3089_IMAGE_OUT_POINT,
NV3089_IMAGE_OUT_SIZE, NV3089_IMAGE_IN_SIZE, NV3062_SET_PITCH, NV308A_POINT,
NV4097_SET_DEPTH_TEST_ENABLE, NV4097_SET_DEPTH_MASK, NV4097_SET_ALPHA_TEST_ENABLE,
NV4097_SET_STENCIL_TEST_ENABLE, NV4097_SET_RESTART_INDEX_ENABLE,
NV4097_SET_DEPTH_BOUNDS_TEST_ENABLE, NV4097_SET_LOGIC_OP_ENABLE, NV4097_SET_DITHER_ENABLE,
NV4097_SET_BLEND_ENABLE, NV4097_SET_LINE_SMOOTH_ENABLE, NV4097_SET_POLY_OFFSET_POINT_ENABLE,
NV4097_SET_POLY_OFFSET_LINE_ENABLE, NV4097_SET_POLY_OFFSET_FILL_ENABLE,
NV4097_SET_CULL_FACE_ENABLE, NV4097_SET_POLY_SMOOTH_ENABLE,
NV4097_SET_TWO_SIDED_STENCIL_TEST_ENABLE, NV4097_SET_TWO_SIDE_LIGHT_EN,
NV4097_SET_RESTART_INDEX, NV4097_SET_SURFACE_COLOR_AOFFSET, NV4097_SET_SURFACE_COLOR_BOFFSET,
NV4097_SET_SURFACE_COLOR_COFFSET, NV4097_SET_SURFACE_COLOR_DOFFSET, NV4097_SET_SURFACE_PITCH_A,
NV4097_SET_SURFACE_PITCH_B, NV4097_SET_SURFACE_PITCH_C, NV4097_SET_SURFACE_PITCH_D,
NV4097_SET_SURFACE_ZETA_OFFSET, NV4097_SET_SURFACE_PITCH_Z,
NV4097_SET_VERTEX_ATTRIB_OUTPUT_MASK, NV4097_SET_SHADER_CONTROL,
NV4097_SET_VERTEX_DATA_BASE_OFFSET, NV4097_SET_INDEX_ARRAY_ADDRESS,
NV4097_SET_VERTEX_DATA_BASE_INDEX, NV4097_SET_SHADER_PROGRAM,
NV4097_SET_TRANSFORM_PROGRAM_START, NV406E_SEMAPHORE_OFFSET, NV4097_SET_SEMAPHORE_OFFSET,
NV3089_IMAGE_IN_OFFSET, NV3062_SET_OFFSET_DESTIN, NV309E_SET_OFFSET, NV3089_DS_DX, NV3089_DT_DY,
NV0039_PITCH_IN, NV0039_PITCH_OUT, NV0039_LINE_LENGTH_IN, NV0039_LINE_COUNT, NV0039_OFFSET_OUT,
NV0039_OFFSET_IN, NV4097_SET_VERTEX_ATTRIB_INPUT_MASK, NV4097_SET_FREQUENCY_DIVIDER_OPERATION,
NV4097_SET_DEPTH_BOUNDS_MIN, NV4097_SET_DEPTH_BOUNDS_MAX, NV4097_SET_FOG_PARAMS,
NV4097_SET_FOG_PARAMS + 1, NV4097_SET_CLIP_MIN, NV4097_SET_CLIP_MAX,
NV4097_SET_POLYGON_OFFSET_SCALE_FACTOR, NV4097_SET_POLYGON_OFFSET_BIAS,
NV4097_SET_VIEWPORT_SCALE, NV4097_SET_VIEWPORT_SCALE + 1, NV4097_SET_VIEWPORT_SCALE + 2,
NV4097_SET_VIEWPORT_SCALE + 3, NV4097_SET_VIEWPORT_OFFSET, NV4097_SET_VIEWPORT_OFFSET + 1,
NV4097_SET_VIEWPORT_OFFSET + 2, NV4097_SET_VIEWPORT_OFFSET + 3, NV4097_SET_DEPTH_FUNC,
NV4097_SET_STENCIL_FUNC, NV4097_SET_BACK_STENCIL_FUNC, NV4097_SET_STENCIL_OP_FAIL,
NV4097_SET_STENCIL_OP_ZFAIL, NV4097_SET_STENCIL_OP_ZPASS, NV4097_SET_BACK_STENCIL_OP_FAIL,
NV4097_SET_BACK_STENCIL_OP_ZFAIL, NV4097_SET_BACK_STENCIL_OP_ZPASS, NV4097_SET_LOGIC_OP,
NV4097_SET_FRONT_FACE, NV4097_SET_CULL_FACE, NV4097_SET_SURFACE_COLOR_TARGET,
NV4097_SET_FOG_MODE, NV4097_SET_ALPHA_FUNC, NV4097_SET_BEGIN_END, NV3089_SET_OPERATION,
NV3089_SET_COLOR_FORMAT, NV3089_SET_CONTEXT_SURFACE, NV3062_SET_COLOR_FORMAT,
NV4097_SET_STENCIL_FUNC_REF, NV4097_SET_BACK_STENCIL_FUNC_REF, NV4097_SET_STENCIL_FUNC_MASK,
NV4097_SET_BACK_STENCIL_FUNC_MASK, NV4097_SET_ALPHA_REF, NV4097_SET_COLOR_CLEAR_VALUE,
NV4097_SET_STENCIL_MASK, NV4097_SET_BACK_STENCIL_MASK, NV4097_SET_BLEND_EQUATION,
NV4097_SET_BLEND_FUNC_SFACTOR, NV4097_SET_BLEND_FUNC_DFACTOR, NV4097_SET_COLOR_MASK,
NV4097_SET_SHADER_WINDOW, NV4097_SET_BLEND_ENABLE_MRT, NV4097_SET_USER_CLIP_PLANE_CONTROL,
NV4097_SET_LINE_WIDTH, NV4097_SET_SURFACE_FORMAT, NV4097_SET_WINDOW_OFFSET,
NV4097_SET_ZSTENCIL_CLEAR_VALUE, NV4097_SET_INDEX_ARRAY_DMA, NV4097_SET_CONTEXT_DMA_COLOR_A,
NV4097_SET_CONTEXT_DMA_COLOR_B, NV4097_SET_CONTEXT_DMA_COLOR_C, NV4097_SET_CONTEXT_DMA_COLOR_D,
NV4097_SET_CONTEXT_DMA_ZETA, NV3089_SET_CONTEXT_DMA_IMAGE, NV3062_SET_CONTEXT_DMA_IMAGE_DESTIN,
NV309E_SET_CONTEXT_DMA_IMAGE, NV0039_SET_CONTEXT_DMA_BUFFER_OUT,
NV0039_SET_CONTEXT_DMA_BUFFER_IN, NV4097_SET_CONTEXT_DMA_REPORT, NV3089_IMAGE_IN_FORMAT,
NV309E_SET_FORMAT, NV0039_FORMAT, NV4097_SET_BLEND_COLOR2, NV4097_SET_BLEND_COLOR,
NV3089_IMAGE_IN, NV4097_NO_OPERATION, NV4097_INVALIDATE_VERTEX_CACHE_FILE,
NV4097_INVALIDATE_VERTEX_FILE, NV4097_SET_ANTI_ALIASING_CONTROL, NV4097_SET_FRONT_POLYGON_MODE,
NV4097_SET_BACK_POLYGON_MODE,
EXPAND_RANGE_16(0, DECLARE_VERTEX_DATA_ARRAY_FORMAT)
EXPAND_RANGE_16(0, DECLARE_VERTEX_DATA_ARRAY_OFFSET)
EXPAND_RANGE_32(0, DECLARE_TRANSFORM_CONSTANT)
NV4097_SET_TRANSFORM_CONSTANT_LOAD,
EXPAND_RANGE_512(0, DECLARE_TRANSFORM_PROGRAM)
NV4097_SET_TRANSFORM_PROGRAM_LOAD
> opcode_list{};
EXPAND_RANGE_32(0, DECLARE_TRANSFORM_CONSTANT) NV4097_SET_TRANSFORM_CONSTANT_LOAD,
NV4097_DRAW_ARRAYS, NV4097_DRAW_INDEX_ARRAY,
EXPAND_RANGE_512(0, DECLARE_TRANSFORM_PROGRAM) NV4097_SET_TRANSFORM_PROGRAM_LOAD>
opcode_list{};
} // end namespace rsx

View File

@ -188,19 +188,19 @@ namespace rsx
void draw_arrays(thread* rsx, u32 _reg, u32 arg)
{
rsx::method_registers.current_draw_clause.command = rsx::draw_command::array;
u32 first = arg & 0xffffff;
u32 count = (arg >> 24) + 1;
rsx::registers_decoder<NV4097_DRAW_ARRAYS>::decoded_type v(arg);
rsx::method_registers.current_draw_clause.first_count_commands.emplace_back(std::make_pair(first, count));
rsx::method_registers.current_draw_clause.first_count_commands.emplace_back(
std::make_pair(v.start(), v.count()));
}
void draw_index_array(thread* rsx, u32 _reg, u32 arg)
{
rsx::method_registers.current_draw_clause.command = rsx::draw_command::indexed;
u32 first = arg & 0xffffff;
u32 count = (arg >> 24) + 1;
rsx::registers_decoder<NV4097_DRAW_INDEX_ARRAY>::decoded_type v(arg);
rsx::method_registers.current_draw_clause.first_count_commands.emplace_back(std::make_pair(first, count));
rsx::method_registers.current_draw_clause.first_count_commands.emplace_back(
std::make_pair(v.start(), v.count()));
}
void draw_inline_array(thread* rsx, u32 _reg, u32 arg)