diff options
| author | 2018-04-17 11:34:22 -0400 | |
|---|---|---|
| committer | 2018-04-17 11:34:22 -0400 | |
| commit | 0905dc1ff44ba87d73cee5620ea12a34959da50e (patch) | |
| tree | 664653514751da1c4c92d186b06bd3e4616ae498 /src/video_core/engines | |
| parent | Merge pull request #338 from bunnei/unrequire-shared-font (diff) | |
| parent | gl_rendering: Use NGLOG* for changed code. (diff) | |
| download | yuzu-0905dc1ff44ba87d73cee5620ea12a34959da50e.tar.gz yuzu-0905dc1ff44ba87d73cee5620ea12a34959da50e.tar.xz yuzu-0905dc1ff44ba87d73cee5620ea12a34959da50e.zip | |
Merge pull request #342 from bunnei/indexed-verts
Implement indexed mode rendering
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 44 |
2 files changed, 46 insertions, 2 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 98ed11ec5..0e1d6d785 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -165,6 +165,7 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 165 | void Maxwell3D::DrawArrays() { | 165 | void Maxwell3D::DrawArrays() { |
| 166 | LOG_DEBUG(HW_GPU, "called, topology=%d, count=%d", regs.draw.topology.Value(), | 166 | LOG_DEBUG(HW_GPU, "called, topology=%d, count=%d", regs.draw.topology.Value(), |
| 167 | regs.vertex_buffer.count); | 167 | regs.vertex_buffer.count); |
| 168 | ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?"); | ||
| 168 | 169 | ||
| 169 | auto debug_context = Core::System::GetInstance().GetGPUDebugContext(); | 170 | auto debug_context = Core::System::GetInstance().GetGPUDebugContext(); |
| 170 | 171 | ||
| @@ -176,7 +177,8 @@ void Maxwell3D::DrawArrays() { | |||
| 176 | debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr); | 177 | debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr); |
| 177 | } | 178 | } |
| 178 | 179 | ||
| 179 | VideoCore::g_renderer->Rasterizer()->AccelerateDrawBatch(false /*is_indexed*/); | 180 | const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; |
| 181 | VideoCore::g_renderer->Rasterizer()->AccelerateDrawBatch(is_indexed); | ||
| 180 | } | 182 | } |
| 181 | 183 | ||
| 182 | void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { | 184 | void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 1fae41cb2..2b45ffed7 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -248,6 +248,12 @@ public: | |||
| 248 | Patches = 0xe, | 248 | Patches = 0xe, |
| 249 | }; | 249 | }; |
| 250 | 250 | ||
| 251 | enum class IndexFormat : u32 { | ||
| 252 | UnsignedByte = 0x0, | ||
| 253 | UnsignedShort = 0x1, | ||
| 254 | UnsignedInt = 0x2, | ||
| 255 | }; | ||
| 256 | |||
| 251 | union { | 257 | union { |
| 252 | struct { | 258 | struct { |
| 253 | INSERT_PADDING_WORDS(0x200); | 259 | INSERT_PADDING_WORDS(0x200); |
| @@ -375,7 +381,42 @@ public: | |||
| 375 | }; | 381 | }; |
| 376 | } draw; | 382 | } draw; |
| 377 | 383 | ||
| 378 | INSERT_PADDING_WORDS(0x139); | 384 | INSERT_PADDING_WORDS(0x6B); |
| 385 | |||
| 386 | struct { | ||
| 387 | u32 start_addr_high; | ||
| 388 | u32 start_addr_low; | ||
| 389 | u32 end_addr_high; | ||
| 390 | u32 end_addr_low; | ||
| 391 | IndexFormat format; | ||
| 392 | u32 first; | ||
| 393 | u32 count; | ||
| 394 | |||
| 395 | unsigned FormatSizeInBytes() const { | ||
| 396 | switch (format) { | ||
| 397 | case IndexFormat::UnsignedByte: | ||
| 398 | return 1; | ||
| 399 | case IndexFormat::UnsignedShort: | ||
| 400 | return 2; | ||
| 401 | case IndexFormat::UnsignedInt: | ||
| 402 | return 4; | ||
| 403 | } | ||
| 404 | UNREACHABLE(); | ||
| 405 | } | ||
| 406 | |||
| 407 | GPUVAddr StartAddress() const { | ||
| 408 | return static_cast<GPUVAddr>( | ||
| 409 | (static_cast<GPUVAddr>(start_addr_high) << 32) | start_addr_low); | ||
| 410 | } | ||
| 411 | |||
| 412 | GPUVAddr EndAddress() const { | ||
| 413 | return static_cast<GPUVAddr>((static_cast<GPUVAddr>(end_addr_high) << 32) | | ||
| 414 | end_addr_low); | ||
| 415 | } | ||
| 416 | } index_array; | ||
| 417 | |||
| 418 | INSERT_PADDING_WORDS(0xC7); | ||
| 419 | |||
| 379 | struct { | 420 | struct { |
| 380 | u32 query_address_high; | 421 | u32 query_address_high; |
| 381 | u32 query_address_low; | 422 | u32 query_address_low; |
| @@ -572,6 +613,7 @@ ASSERT_REG_POSITION(tsc, 0x557); | |||
| 572 | ASSERT_REG_POSITION(tic, 0x55D); | 613 | ASSERT_REG_POSITION(tic, 0x55D); |
| 573 | ASSERT_REG_POSITION(code_address, 0x582); | 614 | ASSERT_REG_POSITION(code_address, 0x582); |
| 574 | ASSERT_REG_POSITION(draw, 0x585); | 615 | ASSERT_REG_POSITION(draw, 0x585); |
| 616 | ASSERT_REG_POSITION(index_array, 0x5F2); | ||
| 575 | ASSERT_REG_POSITION(query, 0x6C0); | 617 | ASSERT_REG_POSITION(query, 0x6C0); |
| 576 | ASSERT_REG_POSITION(vertex_array[0], 0x700); | 618 | ASSERT_REG_POSITION(vertex_array[0], 0x700); |
| 577 | ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0); | 619 | ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0); |