summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp14
-rw-r--r--src/video_core/engines/maxwell_3d.h18
2 files changed, 30 insertions, 2 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 5d6d217bb..2d640bd43 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -208,6 +208,10 @@ void Maxwell3D::ProcessMethodCall(u32 method, u32 argument, u32 nonshadow_argume
208 return ProcessCBBind(4); 208 return ProcessCBBind(4);
209 case MAXWELL3D_REG_INDEX(draw.vertex_end_gl): 209 case MAXWELL3D_REG_INDEX(draw.vertex_end_gl):
210 return DrawArrays(); 210 return DrawArrays();
211 case MAXWELL3D_REG_INDEX(small_index):
212 regs.index_array.count = regs.small_index.count;
213 regs.index_array.first = regs.small_index.first;
214 return DrawArrays();
211 case MAXWELL3D_REG_INDEX(clear_buffers): 215 case MAXWELL3D_REG_INDEX(clear_buffers):
212 return ProcessClearBuffers(); 216 return ProcessClearBuffers();
213 case MAXWELL3D_REG_INDEX(query.query_get): 217 case MAXWELL3D_REG_INDEX(query.query_get):
@@ -360,6 +364,12 @@ void Maxwell3D::CallMethodFromMME(u32 method, u32 method_argument) {
360 } 364 }
361} 365}
362 366
367void Maxwell3D::ProcessTopologyOverride() {
368 if (regs.draw.topology != regs.topology_override) {
369 regs.draw.topology.Assign(regs.topology_override);
370 }
371}
372
363void Maxwell3D::FlushMMEInlineDraw() { 373void Maxwell3D::FlushMMEInlineDraw() {
364 LOG_TRACE(HW_GPU, "called, topology={}, count={}", regs.draw.topology.Value(), 374 LOG_TRACE(HW_GPU, "called, topology={}, count={}", regs.draw.topology.Value(),
365 regs.vertex_buffer.count); 375 regs.vertex_buffer.count);
@@ -370,6 +380,8 @@ void Maxwell3D::FlushMMEInlineDraw() {
370 ASSERT_MSG(!regs.draw.instance_next || !regs.draw.instance_cont, 380 ASSERT_MSG(!regs.draw.instance_next || !regs.draw.instance_cont,
371 "Illegal combination of instancing parameters"); 381 "Illegal combination of instancing parameters");
372 382
383 ProcessTopologyOverride();
384
373 const bool is_indexed = mme_draw.current_mode == MMEDrawMode::Indexed; 385 const bool is_indexed = mme_draw.current_mode == MMEDrawMode::Indexed;
374 if (ShouldExecute()) { 386 if (ShouldExecute()) {
375 rasterizer->Draw(is_indexed, true); 387 rasterizer->Draw(is_indexed, true);
@@ -529,6 +541,8 @@ void Maxwell3D::DrawArrays() {
529 ASSERT_MSG(!regs.draw.instance_next || !regs.draw.instance_cont, 541 ASSERT_MSG(!regs.draw.instance_next || !regs.draw.instance_cont,
530 "Illegal combination of instancing parameters"); 542 "Illegal combination of instancing parameters");
531 543
544 ProcessTopologyOverride();
545
532 if (regs.draw.instance_next) { 546 if (regs.draw.instance_next) {
533 // Increment the current instance *before* drawing. 547 // Increment the current instance *before* drawing.
534 state.current_instance += 1; 548 state.current_instance += 1;
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index dc9df6c8b..e28937b01 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1200,7 +1200,12 @@ public:
1200 } 1200 }
1201 } index_array; 1201 } index_array;
1202 1202
1203 INSERT_PADDING_WORDS_NOINIT(0x7); 1203 union {
1204 BitField<0, 16, u32> first;
1205 BitField<16, 16, u32> count;
1206 } small_index;
1207
1208 INSERT_PADDING_WORDS_NOINIT(0x6);
1204 1209
1205 INSERT_PADDING_WORDS_NOINIT(0x1F); 1210 INSERT_PADDING_WORDS_NOINIT(0x1F);
1206 1211
@@ -1244,7 +1249,11 @@ public:
1244 BitField<11, 1, u32> depth_clamp_disabled; 1249 BitField<11, 1, u32> depth_clamp_disabled;
1245 } view_volume_clip_control; 1250 } view_volume_clip_control;
1246 1251
1247 INSERT_PADDING_WORDS_NOINIT(0x1F); 1252 INSERT_PADDING_WORDS_NOINIT(0xC);
1253
1254 PrimitiveTopology topology_override;
1255
1256 INSERT_PADDING_WORDS_NOINIT(0x12);
1248 1257
1249 u32 depth_bounds_enable; 1258 u32 depth_bounds_enable;
1250 1259
@@ -1531,6 +1540,9 @@ private:
1531 /// Handles a write to the VERTEX_END_GL register, triggering a draw. 1540 /// Handles a write to the VERTEX_END_GL register, triggering a draw.
1532 void DrawArrays(); 1541 void DrawArrays();
1533 1542
1543 /// Handles use of topology overrides (e.g., to avoid using a topology assigned from a macro)
1544 void ProcessTopologyOverride();
1545
1534 // Handles a instance drawcall from MME 1546 // Handles a instance drawcall from MME
1535 void StepInstance(MMEDrawMode expected_mode, u32 count); 1547 void StepInstance(MMEDrawMode expected_mode, u32 count);
1536 1548
@@ -1685,6 +1697,7 @@ ASSERT_REG_POSITION(draw, 0x585);
1685ASSERT_REG_POSITION(primitive_restart, 0x591); 1697ASSERT_REG_POSITION(primitive_restart, 0x591);
1686ASSERT_REG_POSITION(provoking_vertex_last, 0x5A1); 1698ASSERT_REG_POSITION(provoking_vertex_last, 0x5A1);
1687ASSERT_REG_POSITION(index_array, 0x5F2); 1699ASSERT_REG_POSITION(index_array, 0x5F2);
1700ASSERT_REG_POSITION(small_index, 0x5F9);
1688ASSERT_REG_POSITION(polygon_offset_clamp, 0x61F); 1701ASSERT_REG_POSITION(polygon_offset_clamp, 0x61F);
1689ASSERT_REG_POSITION(instanced_arrays, 0x620); 1702ASSERT_REG_POSITION(instanced_arrays, 0x620);
1690ASSERT_REG_POSITION(vp_point_size, 0x644); 1703ASSERT_REG_POSITION(vp_point_size, 0x644);
@@ -1694,6 +1707,7 @@ ASSERT_REG_POSITION(cull_face, 0x648);
1694ASSERT_REG_POSITION(pixel_center_integer, 0x649); 1707ASSERT_REG_POSITION(pixel_center_integer, 0x649);
1695ASSERT_REG_POSITION(viewport_transform_enabled, 0x64B); 1708ASSERT_REG_POSITION(viewport_transform_enabled, 0x64B);
1696ASSERT_REG_POSITION(view_volume_clip_control, 0x64F); 1709ASSERT_REG_POSITION(view_volume_clip_control, 0x64F);
1710ASSERT_REG_POSITION(topology_override, 0x65C);
1697ASSERT_REG_POSITION(depth_bounds_enable, 0x66F); 1711ASSERT_REG_POSITION(depth_bounds_enable, 0x66F);
1698ASSERT_REG_POSITION(logic_op, 0x671); 1712ASSERT_REG_POSITION(logic_op, 0x671);
1699ASSERT_REG_POSITION(clear_buffers, 0x674); 1713ASSERT_REG_POSITION(clear_buffers, 0x674);