mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-01-09 08:29:21 +01:00
handle special state 8 and 5
This commit is contained in:
parent
07c62d5f95
commit
ea0a30b564
@ -20,10 +20,6 @@
|
|||||||
#include "Cemu/Logging/CemuLogging.h"
|
#include "Cemu/Logging/CemuLogging.h"
|
||||||
#include "Cafe/HW/Latte/Core/FetchShader.h"
|
#include "Cafe/HW/Latte/Core/FetchShader.h"
|
||||||
#include "Cafe/HW/Latte/Core/LatteConst.h"
|
#include "Cafe/HW/Latte/Core/LatteConst.h"
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalCommon.h"
|
|
||||||
#include "Cafe/HW/Latte/Renderer/Metal/MetalLayerHandle.h"
|
|
||||||
#include "Cafe/HW/Latte/Renderer/Renderer.h"
|
|
||||||
#include "HW/Latte/Renderer/Metal/MetalPipelineCompiler.h"
|
|
||||||
#include "config/CemuConfig.h"
|
#include "config/CemuConfig.h"
|
||||||
|
|
||||||
#define IMGUI_IMPL_METAL_CPP
|
#define IMGUI_IMPL_METAL_CPP
|
||||||
@ -34,6 +30,9 @@ extern bool hasValidFramebufferAttached;
|
|||||||
|
|
||||||
float supportBufferData[512 * 4];
|
float supportBufferData[512 * 4];
|
||||||
|
|
||||||
|
// Defined in the OpenGL renderer
|
||||||
|
void LatteDraw_handleSpecialState8_clearAsDepth();
|
||||||
|
|
||||||
MetalRenderer::MetalRenderer()
|
MetalRenderer::MetalRenderer()
|
||||||
{
|
{
|
||||||
m_device = MTL::CreateSystemDefaultDevice();
|
m_device = MTL::CreateSystemDefaultDevice();
|
||||||
@ -827,7 +826,19 @@ void MetalRenderer::draw_execute(uint32 baseVertex, uint32 baseInstance, uint32
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: special state 8 and 5
|
// fast clear color as depth
|
||||||
|
if (LatteGPUState.contextNew.GetSpecialStateValues()[8] != 0)
|
||||||
|
{
|
||||||
|
LatteDraw_handleSpecialState8_clearAsDepth();
|
||||||
|
LatteGPUState.drawCallCounter++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (LatteGPUState.contextNew.GetSpecialStateValues()[5] != 0)
|
||||||
|
{
|
||||||
|
draw_handleSpecialState5();
|
||||||
|
LatteGPUState.drawCallCounter++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto& encoderState = m_state.m_encoderState;
|
auto& encoderState = m_state.m_encoderState;
|
||||||
|
|
||||||
@ -1254,6 +1265,23 @@ void MetalRenderer::draw_updateUniformBuffersDirectAccess(LatteDecompilerShader*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetalRenderer::draw_handleSpecialState5()
|
||||||
|
{
|
||||||
|
LatteMRT::UpdateCurrentFBO();
|
||||||
|
LatteRenderTarget_updateViewport();
|
||||||
|
|
||||||
|
LatteTextureView* colorBuffer = LatteMRT::GetColorAttachment(0);
|
||||||
|
LatteTextureView* depthBuffer = LatteMRT::GetDepthAttachment();
|
||||||
|
|
||||||
|
sint32 vpWidth, vpHeight;
|
||||||
|
LatteMRT::GetVirtualViewportDimensions(vpWidth, vpHeight);
|
||||||
|
|
||||||
|
surfaceCopy_copySurfaceWithFormatConversion(
|
||||||
|
depthBuffer->baseTexture, depthBuffer->firstMip, depthBuffer->firstSlice,
|
||||||
|
colorBuffer->baseTexture, colorBuffer->firstMip, colorBuffer->firstSlice,
|
||||||
|
vpWidth, vpHeight);
|
||||||
|
}
|
||||||
|
|
||||||
void* MetalRenderer::indexData_reserveIndexMemory(uint32 size, uint32& offset, uint32& bufferIndex)
|
void* MetalRenderer::indexData_reserveIndexMemory(uint32 size, uint32& offset, uint32& bufferIndex)
|
||||||
{
|
{
|
||||||
auto& bufferAllocator = m_memoryManager->GetTemporaryBufferAllocator();
|
auto& bufferAllocator = m_memoryManager->GetTemporaryBufferAllocator();
|
||||||
|
@ -263,6 +263,8 @@ public:
|
|||||||
void draw_updateVertexBuffersDirectAccess();
|
void draw_updateVertexBuffersDirectAccess();
|
||||||
void draw_updateUniformBuffersDirectAccess(LatteDecompilerShader* shader, const uint32 uniformBufferRegOffset);
|
void draw_updateUniformBuffersDirectAccess(LatteDecompilerShader* shader, const uint32 uniformBufferRegOffset);
|
||||||
|
|
||||||
|
void draw_handleSpecialState5();
|
||||||
|
|
||||||
// index
|
// index
|
||||||
void* indexData_reserveIndexMemory(uint32 size, uint32& offset, uint32& bufferIndex) override;
|
void* indexData_reserveIndexMemory(uint32 size, uint32& offset, uint32& bufferIndex) override;
|
||||||
void indexData_uploadIndexMemory(uint32 bufferIndex, uint32 offset, uint32 size) override;
|
void indexData_uploadIndexMemory(uint32 bufferIndex, uint32 offset, uint32 size) override;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user