maxwell_3d: Restructure macro upload to use a single macro code memory.

- Fixes an issue where macros could be skipped.
- Fixes rendering of distant objects in Super Mario Odyssey.
This commit is contained in:
bunnei
2018-10-29 23:36:03 -04:00
parent d08457f879
commit de0ab806df
4 changed files with 55 additions and 27 deletions

View File

@ -475,12 +475,13 @@ public:
INSERT_PADDING_WORDS(0x45);
struct {
INSERT_PADDING_WORDS(1);
u32 upload_address;
u32 data;
u32 entry;
u32 bind;
} macros;
INSERT_PADDING_WORDS(0x189);
INSERT_PADDING_WORDS(0x188);
u32 tfb_enabled;
@ -994,12 +995,25 @@ public:
/// Returns the texture information for a specific texture in a specific shader stage.
Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const;
/// Memory for macro code - it's undetermined how big this is, however 1MB is much larger than
/// we've seen used.
using MacroMemory = std::array<u32, 0x40000>;
/// Gets a reference to macro memory.
const MacroMemory& GetMacroMemory() const {
return macro_memory;
}
private:
void InitializeRegisterDefaults();
VideoCore::RasterizerInterface& rasterizer;
std::unordered_map<u32, std::vector<u32>> uploaded_macros;
/// Start offsets of each macro in macro_memory
std::unordered_map<u32, u32> macro_offsets;
/// Memory for macro code
MacroMemory macro_memory;
/// Macro method that is currently being executed / being fed parameters.
u32 executing_macro = 0;
@ -1022,9 +1036,12 @@ private:
*/
void CallMacroMethod(u32 method, std::vector<u32> parameters);
/// Handles writes to the macro uploading registers.
/// Handles writes to the macro uploading register.
void ProcessMacroUpload(u32 data);
/// Handles writes to the macro bind register.
void ProcessMacroBind(u32 data);
/// Handles a write to the CLEAR_BUFFERS register.
void ProcessClearBuffers();