maxwell_3d.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <cinttypes>
  5. #include <cstring>
  6. #include "common/assert.h"
  7. #include "core/core.h"
  8. #include "core/core_timing.h"
  9. #include "core/memory.h"
  10. #include "video_core/debug_utils/debug_utils.h"
  11. #include "video_core/engines/maxwell_3d.h"
  12. #include "video_core/rasterizer_interface.h"
  13. #include "video_core/renderer_base.h"
  14. #include "video_core/textures/texture.h"
  15. namespace Tegra::Engines {
  16. /// First register id that is actually a Macro call.
  17. constexpr u32 MacroRegistersStart = 0xE00;
  18. Maxwell3D::Maxwell3D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager)
  19. : memory_manager(memory_manager), rasterizer{rasterizer}, macro_interpreter(*this) {
  20. InitializeRegisterDefaults();
  21. }
  22. void Maxwell3D::InitializeRegisterDefaults() {
  23. // Initializes registers to their default values - what games expect them to be at boot. This is
  24. // for certain registers that may not be explicitly set by games.
  25. // Reset all registers to zero
  26. std::memset(&regs, 0, sizeof(regs));
  27. // Depth range near/far is not always set, but is expected to be the default 0.0f, 1.0f. This is
  28. // needed for ARMS.
  29. for (std::size_t viewport{}; viewport < Regs::NumViewports; ++viewport) {
  30. regs.viewports[viewport].depth_range_near = 0.0f;
  31. regs.viewports[viewport].depth_range_far = 1.0f;
  32. }
  33. // Doom and Bomberman seems to use the uninitialized registers and just enable blend
  34. // so initialize blend registers with sane values
  35. regs.blend.equation_rgb = Regs::Blend::Equation::Add;
  36. regs.blend.factor_source_rgb = Regs::Blend::Factor::One;
  37. regs.blend.factor_dest_rgb = Regs::Blend::Factor::Zero;
  38. regs.blend.equation_a = Regs::Blend::Equation::Add;
  39. regs.blend.factor_source_a = Regs::Blend::Factor::One;
  40. regs.blend.factor_dest_a = Regs::Blend::Factor::Zero;
  41. for (std::size_t blend_index = 0; blend_index < Regs::NumRenderTargets; blend_index++) {
  42. regs.independent_blend[blend_index].equation_rgb = Regs::Blend::Equation::Add;
  43. regs.independent_blend[blend_index].factor_source_rgb = Regs::Blend::Factor::One;
  44. regs.independent_blend[blend_index].factor_dest_rgb = Regs::Blend::Factor::Zero;
  45. regs.independent_blend[blend_index].equation_a = Regs::Blend::Equation::Add;
  46. regs.independent_blend[blend_index].factor_source_a = Regs::Blend::Factor::One;
  47. regs.independent_blend[blend_index].factor_dest_a = Regs::Blend::Factor::Zero;
  48. }
  49. regs.stencil_front_op_fail = Regs::StencilOp::Keep;
  50. regs.stencil_front_op_zfail = Regs::StencilOp::Keep;
  51. regs.stencil_front_op_zpass = Regs::StencilOp::Keep;
  52. regs.stencil_front_func_func = Regs::ComparisonOp::Always;
  53. regs.stencil_front_func_mask = 0xFFFFFFFF;
  54. regs.stencil_front_mask = 0xFFFFFFFF;
  55. regs.stencil_two_side_enable = 1;
  56. regs.stencil_back_op_fail = Regs::StencilOp::Keep;
  57. regs.stencil_back_op_zfail = Regs::StencilOp::Keep;
  58. regs.stencil_back_op_zpass = Regs::StencilOp::Keep;
  59. regs.stencil_back_func_func = Regs::ComparisonOp::Always;
  60. regs.stencil_back_func_mask = 0xFFFFFFFF;
  61. regs.stencil_back_mask = 0xFFFFFFFF;
  62. // TODO(Rodrigo): Most games do not set a point size. I think this is a case of a
  63. // register carrying a default value. Assume it's OpenGL's default (1).
  64. regs.point_size = 1.0f;
  65. // TODO(bunnei): Some games do not initialize the color masks (e.g. Sonic Mania). Assuming a
  66. // default of enabled fixes rendering here.
  67. for (std::size_t color_mask = 0; color_mask < Regs::NumRenderTargets; color_mask++) {
  68. regs.color_mask[color_mask].R.Assign(1);
  69. regs.color_mask[color_mask].G.Assign(1);
  70. regs.color_mask[color_mask].B.Assign(1);
  71. regs.color_mask[color_mask].A.Assign(1);
  72. }
  73. }
  74. void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) {
  75. // Reset the current macro.
  76. executing_macro = 0;
  77. // Lookup the macro offset
  78. const u32 entry{(method - MacroRegistersStart) >> 1};
  79. const auto& search{macro_offsets.find(entry)};
  80. if (search == macro_offsets.end()) {
  81. LOG_CRITICAL(HW_GPU, "macro not found for method 0x{:X}!", method);
  82. UNREACHABLE();
  83. return;
  84. }
  85. // Execute the current macro.
  86. macro_interpreter.Execute(search->second, std::move(parameters));
  87. }
  88. void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) {
  89. auto debug_context = Core::System::GetInstance().GetGPUDebugContext();
  90. // It is an error to write to a register other than the current macro's ARG register before it
  91. // has finished execution.
  92. if (executing_macro != 0) {
  93. ASSERT(method_call.method == executing_macro + 1);
  94. }
  95. // Methods after 0xE00 are special, they're actually triggers for some microcode that was
  96. // uploaded to the GPU during initialization.
  97. if (method_call.method >= MacroRegistersStart) {
  98. // We're trying to execute a macro
  99. if (executing_macro == 0) {
  100. // A macro call must begin by writing the macro method's register, not its argument.
  101. ASSERT_MSG((method_call.method % 2) == 0,
  102. "Can't start macro execution by writing to the ARGS register");
  103. executing_macro = method_call.method;
  104. }
  105. macro_params.push_back(method_call.argument);
  106. // Call the macro when there are no more parameters in the command buffer
  107. if (method_call.IsLastCall()) {
  108. CallMacroMethod(executing_macro, std::move(macro_params));
  109. }
  110. return;
  111. }
  112. ASSERT_MSG(method_call.method < Regs::NUM_REGS,
  113. "Invalid Maxwell3D register, increase the size of the Regs structure");
  114. if (debug_context) {
  115. debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr);
  116. }
  117. if (regs.reg_array[method_call.method] != method_call.argument) {
  118. regs.reg_array[method_call.method] = method_call.argument;
  119. // Vertex format
  120. if (method_call.method >= MAXWELL3D_REG_INDEX(vertex_attrib_format) &&
  121. method_call.method <
  122. MAXWELL3D_REG_INDEX(vertex_attrib_format) + regs.vertex_attrib_format.size()) {
  123. dirty_flags.vertex_attrib_format = true;
  124. }
  125. // Vertex buffer
  126. if (method_call.method >= MAXWELL3D_REG_INDEX(vertex_array) &&
  127. method_call.method < MAXWELL3D_REG_INDEX(vertex_array) + 4 * 32) {
  128. dirty_flags.vertex_array |=
  129. 1u << ((method_call.method - MAXWELL3D_REG_INDEX(vertex_array)) >> 2);
  130. } else if (method_call.method >= MAXWELL3D_REG_INDEX(vertex_array_limit) &&
  131. method_call.method < MAXWELL3D_REG_INDEX(vertex_array_limit) + 2 * 32) {
  132. dirty_flags.vertex_array |=
  133. 1u << ((method_call.method - MAXWELL3D_REG_INDEX(vertex_array_limit)) >> 1);
  134. } else if (method_call.method >= MAXWELL3D_REG_INDEX(instanced_arrays) &&
  135. method_call.method < MAXWELL3D_REG_INDEX(instanced_arrays) + 32) {
  136. dirty_flags.vertex_array |=
  137. 1u << (method_call.method - MAXWELL3D_REG_INDEX(instanced_arrays));
  138. }
  139. }
  140. switch (method_call.method) {
  141. case MAXWELL3D_REG_INDEX(macros.data): {
  142. ProcessMacroUpload(method_call.argument);
  143. break;
  144. }
  145. case MAXWELL3D_REG_INDEX(macros.bind): {
  146. ProcessMacroBind(method_call.argument);
  147. break;
  148. }
  149. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[0]):
  150. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[1]):
  151. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[2]):
  152. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[3]):
  153. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[4]):
  154. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[5]):
  155. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[6]):
  156. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[7]):
  157. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[8]):
  158. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[9]):
  159. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[10]):
  160. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[11]):
  161. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[12]):
  162. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[13]):
  163. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[14]):
  164. case MAXWELL3D_REG_INDEX(const_buffer.cb_data[15]): {
  165. ProcessCBData(method_call.argument);
  166. break;
  167. }
  168. case MAXWELL3D_REG_INDEX(cb_bind[0].raw_config): {
  169. ProcessCBBind(Regs::ShaderStage::Vertex);
  170. break;
  171. }
  172. case MAXWELL3D_REG_INDEX(cb_bind[1].raw_config): {
  173. ProcessCBBind(Regs::ShaderStage::TesselationControl);
  174. break;
  175. }
  176. case MAXWELL3D_REG_INDEX(cb_bind[2].raw_config): {
  177. ProcessCBBind(Regs::ShaderStage::TesselationEval);
  178. break;
  179. }
  180. case MAXWELL3D_REG_INDEX(cb_bind[3].raw_config): {
  181. ProcessCBBind(Regs::ShaderStage::Geometry);
  182. break;
  183. }
  184. case MAXWELL3D_REG_INDEX(cb_bind[4].raw_config): {
  185. ProcessCBBind(Regs::ShaderStage::Fragment);
  186. break;
  187. }
  188. case MAXWELL3D_REG_INDEX(draw.vertex_end_gl): {
  189. DrawArrays();
  190. break;
  191. }
  192. case MAXWELL3D_REG_INDEX(clear_buffers): {
  193. ProcessClearBuffers();
  194. break;
  195. }
  196. case MAXWELL3D_REG_INDEX(query.query_get): {
  197. ProcessQueryGet();
  198. break;
  199. }
  200. default:
  201. break;
  202. }
  203. if (debug_context) {
  204. debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, nullptr);
  205. }
  206. }
  207. void Maxwell3D::ProcessMacroUpload(u32 data) {
  208. ASSERT_MSG(regs.macros.upload_address < macro_memory.size(),
  209. "upload_address exceeded macro_memory size!");
  210. macro_memory[regs.macros.upload_address++] = data;
  211. }
  212. void Maxwell3D::ProcessMacroBind(u32 data) {
  213. macro_offsets[regs.macros.entry] = data;
  214. }
  215. void Maxwell3D::ProcessQueryGet() {
  216. GPUVAddr sequence_address = regs.query.QueryAddress();
  217. // Since the sequence address is given as a GPU VAddr, we have to convert it to an application
  218. // VAddr before writing.
  219. std::optional<VAddr> address = memory_manager.GpuToCpuAddress(sequence_address);
  220. // TODO(Subv): Support the other query units.
  221. ASSERT_MSG(regs.query.query_get.unit == Regs::QueryUnit::Crop,
  222. "Units other than CROP are unimplemented");
  223. u64 result = 0;
  224. // TODO(Subv): Support the other query variables
  225. switch (regs.query.query_get.select) {
  226. case Regs::QuerySelect::Zero:
  227. // This seems to actually write the query sequence to the query address.
  228. result = regs.query.query_sequence;
  229. break;
  230. default:
  231. UNIMPLEMENTED_MSG("Unimplemented query select type {}",
  232. static_cast<u32>(regs.query.query_get.select.Value()));
  233. }
  234. // TODO(Subv): Research and implement how query sync conditions work.
  235. struct LongQueryResult {
  236. u64_le value;
  237. u64_le timestamp;
  238. };
  239. static_assert(sizeof(LongQueryResult) == 16, "LongQueryResult has wrong size");
  240. switch (regs.query.query_get.mode) {
  241. case Regs::QueryMode::Write:
  242. case Regs::QueryMode::Write2: {
  243. u32 sequence = regs.query.query_sequence;
  244. if (regs.query.query_get.short_query) {
  245. // Write the current query sequence to the sequence address.
  246. // TODO(Subv): Find out what happens if you use a long query type but mark it as a short
  247. // query.
  248. Memory::Write32(*address, sequence);
  249. } else {
  250. // Write the 128-bit result structure in long mode. Note: We emulate an infinitely fast
  251. // GPU, this command may actually take a while to complete in real hardware due to GPU
  252. // wait queues.
  253. LongQueryResult query_result{};
  254. query_result.value = result;
  255. // TODO(Subv): Generate a real GPU timestamp and write it here instead of CoreTiming
  256. query_result.timestamp = CoreTiming::GetTicks();
  257. Memory::WriteBlock(*address, &query_result, sizeof(query_result));
  258. }
  259. dirty_flags.OnMemoryWrite();
  260. break;
  261. }
  262. default:
  263. UNIMPLEMENTED_MSG("Query mode {} not implemented",
  264. static_cast<u32>(regs.query.query_get.mode.Value()));
  265. }
  266. }
  267. void Maxwell3D::DrawArrays() {
  268. LOG_DEBUG(HW_GPU, "called, topology={}, count={}", static_cast<u32>(regs.draw.topology.Value()),
  269. regs.vertex_buffer.count);
  270. ASSERT_MSG(!(regs.index_array.count && regs.vertex_buffer.count), "Both indexed and direct?");
  271. auto debug_context = Core::System::GetInstance().GetGPUDebugContext();
  272. if (debug_context) {
  273. debug_context->OnEvent(Tegra::DebugContext::Event::IncomingPrimitiveBatch, nullptr);
  274. }
  275. // Both instance configuration registers can not be set at the same time.
  276. ASSERT_MSG(!regs.draw.instance_next || !regs.draw.instance_cont,
  277. "Illegal combination of instancing parameters");
  278. if (regs.draw.instance_next) {
  279. // Increment the current instance *before* drawing.
  280. state.current_instance += 1;
  281. } else if (!regs.draw.instance_cont) {
  282. // Reset the current instance to 0.
  283. state.current_instance = 0;
  284. }
  285. const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count};
  286. rasterizer.AccelerateDrawBatch(is_indexed);
  287. if (debug_context) {
  288. debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr);
  289. }
  290. // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if
  291. // the game is trying to draw indexed or direct mode. This needs to be verified on HW still -
  292. // it's possible that it is incorrect and that there is some other register used to specify the
  293. // drawing mode.
  294. if (is_indexed) {
  295. regs.index_array.count = 0;
  296. } else {
  297. regs.vertex_buffer.count = 0;
  298. }
  299. }
  300. void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
  301. // Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage.
  302. auto& shader = state.shader_stages[static_cast<std::size_t>(stage)];
  303. auto& bind_data = regs.cb_bind[static_cast<std::size_t>(stage)];
  304. auto& buffer = shader.const_buffers[bind_data.index];
  305. ASSERT(bind_data.index < Regs::MaxConstBuffers);
  306. buffer.enabled = bind_data.valid.Value() != 0;
  307. buffer.index = bind_data.index;
  308. buffer.address = regs.const_buffer.BufferAddress();
  309. buffer.size = regs.const_buffer.cb_size;
  310. }
  311. void Maxwell3D::ProcessCBData(u32 value) {
  312. // Write the input value to the current const buffer at the current position.
  313. GPUVAddr buffer_address = regs.const_buffer.BufferAddress();
  314. ASSERT(buffer_address != 0);
  315. // Don't allow writing past the end of the buffer.
  316. ASSERT(regs.const_buffer.cb_pos + sizeof(u32) <= regs.const_buffer.cb_size);
  317. std::optional<VAddr> address =
  318. memory_manager.GpuToCpuAddress(buffer_address + regs.const_buffer.cb_pos);
  319. Memory::Write32(*address, value);
  320. dirty_flags.OnMemoryWrite();
  321. // Increment the current buffer position.
  322. regs.const_buffer.cb_pos = regs.const_buffer.cb_pos + 4;
  323. }
  324. Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {
  325. GPUVAddr tic_base_address = regs.tic.TICAddress();
  326. GPUVAddr tic_address_gpu = tic_base_address + tic_index * sizeof(Texture::TICEntry);
  327. std::optional<VAddr> tic_address_cpu = memory_manager.GpuToCpuAddress(tic_address_gpu);
  328. Texture::TICEntry tic_entry;
  329. Memory::ReadBlock(*tic_address_cpu, &tic_entry, sizeof(Texture::TICEntry));
  330. ASSERT_MSG(tic_entry.header_version == Texture::TICHeaderVersion::BlockLinear ||
  331. tic_entry.header_version == Texture::TICHeaderVersion::Pitch,
  332. "TIC versions other than BlockLinear or Pitch are unimplemented");
  333. auto r_type = tic_entry.r_type.Value();
  334. auto g_type = tic_entry.g_type.Value();
  335. auto b_type = tic_entry.b_type.Value();
  336. auto a_type = tic_entry.a_type.Value();
  337. // TODO(Subv): Different data types for separate components are not supported
  338. ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
  339. return tic_entry;
  340. }
  341. Texture::TSCEntry Maxwell3D::GetTSCEntry(u32 tsc_index) const {
  342. GPUVAddr tsc_base_address = regs.tsc.TSCAddress();
  343. GPUVAddr tsc_address_gpu = tsc_base_address + tsc_index * sizeof(Texture::TSCEntry);
  344. std::optional<VAddr> tsc_address_cpu = memory_manager.GpuToCpuAddress(tsc_address_gpu);
  345. Texture::TSCEntry tsc_entry;
  346. Memory::ReadBlock(*tsc_address_cpu, &tsc_entry, sizeof(Texture::TSCEntry));
  347. return tsc_entry;
  348. }
  349. std::vector<Texture::FullTextureInfo> Maxwell3D::GetStageTextures(Regs::ShaderStage stage) const {
  350. std::vector<Texture::FullTextureInfo> textures;
  351. auto& fragment_shader = state.shader_stages[static_cast<std::size_t>(stage)];
  352. auto& tex_info_buffer = fragment_shader.const_buffers[regs.tex_cb_index];
  353. ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
  354. GPUVAddr tex_info_buffer_end = tex_info_buffer.address + tex_info_buffer.size;
  355. // Offset into the texture constbuffer where the texture info begins.
  356. static constexpr std::size_t TextureInfoOffset = 0x20;
  357. for (GPUVAddr current_texture = tex_info_buffer.address + TextureInfoOffset;
  358. current_texture < tex_info_buffer_end; current_texture += sizeof(Texture::TextureHandle)) {
  359. Texture::TextureHandle tex_handle{
  360. Memory::Read32(*memory_manager.GpuToCpuAddress(current_texture))};
  361. Texture::FullTextureInfo tex_info{};
  362. // TODO(Subv): Use the shader to determine which textures are actually accessed.
  363. tex_info.index =
  364. static_cast<u32>(current_texture - tex_info_buffer.address - TextureInfoOffset) /
  365. sizeof(Texture::TextureHandle);
  366. // Load the TIC data.
  367. if (tex_handle.tic_id != 0) {
  368. tex_info.enabled = true;
  369. auto tic_entry = GetTICEntry(tex_handle.tic_id);
  370. // TODO(Subv): Workaround for BitField's move constructor being deleted.
  371. std::memcpy(&tex_info.tic, &tic_entry, sizeof(tic_entry));
  372. }
  373. // Load the TSC data
  374. if (tex_handle.tsc_id != 0) {
  375. auto tsc_entry = GetTSCEntry(tex_handle.tsc_id);
  376. // TODO(Subv): Workaround for BitField's move constructor being deleted.
  377. std::memcpy(&tex_info.tsc, &tsc_entry, sizeof(tsc_entry));
  378. }
  379. if (tex_info.enabled)
  380. textures.push_back(tex_info);
  381. }
  382. return textures;
  383. }
  384. Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage,
  385. std::size_t offset) const {
  386. auto& shader = state.shader_stages[static_cast<std::size_t>(stage)];
  387. auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index];
  388. ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0);
  389. GPUVAddr tex_info_address = tex_info_buffer.address + offset * sizeof(Texture::TextureHandle);
  390. ASSERT(tex_info_address < tex_info_buffer.address + tex_info_buffer.size);
  391. std::optional<VAddr> tex_address_cpu = memory_manager.GpuToCpuAddress(tex_info_address);
  392. Texture::TextureHandle tex_handle{Memory::Read32(*tex_address_cpu)};
  393. Texture::FullTextureInfo tex_info{};
  394. tex_info.index = static_cast<u32>(offset);
  395. // Load the TIC data.
  396. if (tex_handle.tic_id != 0) {
  397. tex_info.enabled = true;
  398. auto tic_entry = GetTICEntry(tex_handle.tic_id);
  399. // TODO(Subv): Workaround for BitField's move constructor being deleted.
  400. std::memcpy(&tex_info.tic, &tic_entry, sizeof(tic_entry));
  401. }
  402. // Load the TSC data
  403. if (tex_handle.tsc_id != 0) {
  404. auto tsc_entry = GetTSCEntry(tex_handle.tsc_id);
  405. // TODO(Subv): Workaround for BitField's move constructor being deleted.
  406. std::memcpy(&tex_info.tsc, &tsc_entry, sizeof(tsc_entry));
  407. }
  408. return tex_info;
  409. }
  410. u32 Maxwell3D::GetRegisterValue(u32 method) const {
  411. ASSERT_MSG(method < Regs::NUM_REGS, "Invalid Maxwell3D register");
  412. return regs.reg_array[method];
  413. }
  414. void Maxwell3D::ProcessClearBuffers() {
  415. ASSERT(regs.clear_buffers.R == regs.clear_buffers.G &&
  416. regs.clear_buffers.R == regs.clear_buffers.B &&
  417. regs.clear_buffers.R == regs.clear_buffers.A);
  418. rasterizer.Clear();
  419. }
  420. } // namespace Tegra::Engines