Primitive reset.

This commit is contained in:
Ben Vanik 2015-03-22 08:52:05 -07:00
parent 559cda3215
commit cef9a684cd
3 changed files with 24 additions and 2 deletions

View File

@ -1999,6 +1999,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRasterizerState() {
XE_GPU_REG_PA_SC_SCREEN_SCISSOR_TL); XE_GPU_REG_PA_SC_SCREEN_SCISSOR_TL);
dirty |= SetShadowRegister(regs.pa_sc_screen_scissor_br, dirty |= SetShadowRegister(regs.pa_sc_screen_scissor_br,
XE_GPU_REG_PA_SC_SCREEN_SCISSOR_BR); XE_GPU_REG_PA_SC_SCREEN_SCISSOR_BR);
dirty |= SetShadowRegister(regs.multi_prim_ib_reset_index,
XE_GPU_REG_VGT_MULTI_PRIM_IB_RESET_INDX);
if (!dirty) { if (!dirty) {
return UpdateStatus::kCompatible; return UpdateStatus::kCompatible;
} }
@ -2059,12 +2061,19 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateRasterizerState() {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} }
if (regs.pa_su_sc_mode_cntl & (1 << 20)) { if (regs.pa_su_sc_mode_cntl & (1 << 19)) {
glProvokingVertex(GL_LAST_VERTEX_CONVENTION); glProvokingVertex(GL_LAST_VERTEX_CONVENTION);
} else { } else {
glProvokingVertex(GL_FIRST_VERTEX_CONVENTION); glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);
} }
if (regs.pa_su_sc_mode_cntl & (1 << 21)) {
glEnable(GL_PRIMITIVE_RESTART);
} else {
glDisable(GL_PRIMITIVE_RESTART);
}
glPrimitiveRestartIndex(regs.multi_prim_ib_reset_index);
return UpdateStatus::kMismatch; return UpdateStatus::kMismatch;
} }

View File

@ -323,6 +323,7 @@ class CommandProcessor {
uint32_t pa_su_sc_mode_cntl; uint32_t pa_su_sc_mode_cntl;
uint32_t pa_sc_screen_scissor_tl; uint32_t pa_sc_screen_scissor_tl;
uint32_t pa_sc_screen_scissor_br; uint32_t pa_sc_screen_scissor_br;
uint32_t multi_prim_ib_reset_index;
UpdateRasterizerStateRegisters() { Reset(); } UpdateRasterizerStateRegisters() { Reset(); }
void Reset() { std::memset(this, 0, sizeof(*this)); } void Reset() { std::memset(this, 0, sizeof(*this)); }

View File

@ -1601,7 +1601,7 @@ void DrawStateUI(xe::ui::MainWindow* window, TracePlayer& player,
} else { } else {
ImGui::BulletText("Polygon Mode: fill"); ImGui::BulletText("Polygon Mode: fill");
} }
if (pa_su_sc_mode_cntl & (1 << 20)) { if (pa_su_sc_mode_cntl & (1 << 19)) {
ImGui::BulletText("Provoking Vertex: last"); ImGui::BulletText("Provoking Vertex: last");
} else { } else {
ImGui::BulletText("Provoking Vertex: first"); ImGui::BulletText("Provoking Vertex: first");
@ -1835,6 +1835,18 @@ void DrawStateUI(xe::ui::MainWindow* window, TracePlayer& player,
draw_info.index_buffer_size, draw_info.index_buffer_size,
kIndexFormatNames[int(draw_info.index_format)], kIndexFormatNames[int(draw_info.index_format)],
kEndiannessNames[int(draw_info.index_endianness)]); kEndiannessNames[int(draw_info.index_endianness)]);
uint32_t pa_su_sc_mode_cntl = regs[XE_GPU_REG_PA_SU_SC_MODE_CNTL].u32;
if (pa_su_sc_mode_cntl & (1 << 21)) {
uint32_t reset_index =
regs[XE_GPU_REG_VGT_MULTI_PRIM_IB_RESET_INDX].u32;
if (draw_info.index_format == IndexFormat::kInt16) {
ImGui::Text("Reset Index: %.4X", reset_index & 0xFFFF);
} else {
ImGui::Text("Reset Index: %.8X", reset_index);
}
} else {
ImGui::Text("Reset Index: disabled");
}
ImGui::BeginChild("#indices", ImVec2(0, 300)); ImGui::BeginChild("#indices", ImVec2(0, 300));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
int display_start, display_end; int display_start, display_end;