|
|
@ -46,21 +46,26 @@ void DrawManager::ProcessMethodCall(u32 method, u32 argument) {
|
|
|
|
SetInlineIndexBuffer(regs.inline_index_4x8.index2);
|
|
|
|
SetInlineIndexBuffer(regs.inline_index_4x8.index2);
|
|
|
|
SetInlineIndexBuffer(regs.inline_index_4x8.index3);
|
|
|
|
SetInlineIndexBuffer(regs.inline_index_4x8.index3);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case MAXWELL3D_REG_INDEX(topology_override):
|
|
|
|
case MAXWELL3D_REG_INDEX(vertex_array_instance_first):
|
|
|
|
use_topology_override = true;
|
|
|
|
case MAXWELL3D_REG_INDEX(vertex_array_instance_subsequent): {
|
|
|
|
|
|
|
|
LOG_WARNING(HW_GPU, "(STUBBED) called");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawManager::Clear(u32 layer_count) {
|
|
|
|
void DrawManager::Clear(u32 layer_count) {
|
|
|
|
maxwell3d->rasterizer->Clear(layer_count);
|
|
|
|
if (maxwell3d->ShouldExecute()) {
|
|
|
|
|
|
|
|
maxwell3d->rasterizer->Clear(layer_count);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawManager::DrawDeferred() {
|
|
|
|
void DrawManager::DrawDeferred() {
|
|
|
|
if (draw_state.draw_mode != DrawMode::Instance || draw_state.instance_count == 0)
|
|
|
|
if (draw_state.draw_mode != DrawMode::Instance || draw_state.instance_count == 0) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
DrawEnd(draw_state.instance_count + 1, true);
|
|
|
|
DrawEnd(draw_state.instance_count + 1, true);
|
|
|
|
draw_state.instance_count = 0;
|
|
|
|
draw_state.instance_count = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -115,8 +120,9 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) {
|
|
|
|
const auto& regs{maxwell3d->regs};
|
|
|
|
const auto& regs{maxwell3d->regs};
|
|
|
|
switch (draw_state.draw_mode) {
|
|
|
|
switch (draw_state.draw_mode) {
|
|
|
|
case DrawMode::Instance:
|
|
|
|
case DrawMode::Instance:
|
|
|
|
if (!force_draw)
|
|
|
|
if (!force_draw) {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
[[fallthrough]];
|
|
|
|
[[fallthrough]];
|
|
|
|
case DrawMode::General:
|
|
|
|
case DrawMode::General:
|
|
|
|
draw_state.base_instance = regs.global_base_instance_index;
|
|
|
|
draw_state.base_instance = regs.global_base_instance_index;
|
|
|
@ -156,25 +162,28 @@ void DrawManager::DrawIndexSmall(u32 argument) {
|
|
|
|
ProcessDraw(true, 1);
|
|
|
|
ProcessDraw(true, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawManager::ProcessTopologyOverride() {
|
|
|
|
void DrawManager::UpdateTopology() {
|
|
|
|
if (!use_topology_override)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto& regs{maxwell3d->regs};
|
|
|
|
const auto& regs{maxwell3d->regs};
|
|
|
|
switch (regs.topology_override) {
|
|
|
|
switch (regs.primitive_topology_control) {
|
|
|
|
case PrimitiveTopologyOverride::None:
|
|
|
|
case PrimitiveTopologyControl::UseInBeginMethods:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case PrimitiveTopologyOverride::Points:
|
|
|
|
case PrimitiveTopologyControl::UseSeparateState:
|
|
|
|
draw_state.topology = PrimitiveTopology::Points;
|
|
|
|
switch (regs.topology_override) {
|
|
|
|
break;
|
|
|
|
case PrimitiveTopologyOverride::None:
|
|
|
|
case PrimitiveTopologyOverride::Lines:
|
|
|
|
break;
|
|
|
|
draw_state.topology = PrimitiveTopology::Lines;
|
|
|
|
case PrimitiveTopologyOverride::Points:
|
|
|
|
break;
|
|
|
|
draw_state.topology = PrimitiveTopology::Points;
|
|
|
|
case PrimitiveTopologyOverride::LineStrip:
|
|
|
|
break;
|
|
|
|
draw_state.topology = PrimitiveTopology::LineStrip;
|
|
|
|
case PrimitiveTopologyOverride::Lines:
|
|
|
|
break;
|
|
|
|
draw_state.topology = PrimitiveTopology::Lines;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
draw_state.topology = static_cast<PrimitiveTopology>(regs.topology_override);
|
|
|
|
case PrimitiveTopologyOverride::LineStrip:
|
|
|
|
|
|
|
|
draw_state.topology = PrimitiveTopology::LineStrip;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
draw_state.topology = static_cast<PrimitiveTopology>(regs.topology_override);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -183,9 +192,10 @@ void DrawManager::ProcessDraw(bool draw_indexed, u32 instance_count) {
|
|
|
|
LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology,
|
|
|
|
LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology,
|
|
|
|
draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count);
|
|
|
|
draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count);
|
|
|
|
|
|
|
|
|
|
|
|
ProcessTopologyOverride();
|
|
|
|
UpdateTopology();
|
|
|
|
|
|
|
|
|
|
|
|
if (maxwell3d->ShouldExecute())
|
|
|
|
if (maxwell3d->ShouldExecute()) {
|
|
|
|
maxwell3d->rasterizer->Draw(draw_indexed, instance_count);
|
|
|
|
maxwell3d->rasterizer->Draw(draw_indexed, instance_count);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace Tegra::Engines
|
|
|
|
} // namespace Tegra::Engines
|
|
|
|