put query object into a separate file

This commit is contained in:
Samuliak 2024-09-12 08:05:27 +02:00
parent a328c5e753
commit 4cce3699f3
5 changed files with 61 additions and 43 deletions

View File

@ -567,6 +567,8 @@ if(ENABLE_METAL)
HW/Latte/Renderer/Metal/MetalSamplerCache.h
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.cpp
HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h
HW/Latte/Renderer/Metal/MetalQuery.cpp
HW/Latte/Renderer/Metal/MetalQuery.h
HW/Latte/Renderer/Metal/MetalPerformanceMonitor.h
HW/Latte/Renderer/Metal/UtilityShaderSource.h
)

View File

@ -0,0 +1,17 @@
#include "Cafe/HW/Latte/Renderer/Metal/MetalQuery.h"
bool LatteQueryObjectMtl::getResult(uint64& numSamplesPassed)
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::getResult: occlusion queries are not yet supported on Metal");
return true;
}
void LatteQueryObjectMtl::begin()
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::begin: occlusion queries are not yet supported on Metal");
}
void LatteQueryObjectMtl::end()
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::end: occlusion queries are not yet supported on Metal");
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "Cafe/HW/Latte/Core/LatteQueryObject.h"
#include "Cafe/HW/Latte/Renderer/Metal/MetalCommon.h"
// HACK: Dummy occlusion query object
class LatteQueryObjectMtl : public LatteQueryObject
{
public:
LatteQueryObjectMtl(class MetalRenderer* mtlRenderer) : m_mtlr{mtlRenderer} {}
bool getResult(uint64& numSamplesPassed) override;
void begin() override;
void end() override;
private:
class MetalRenderer* m_mtlr;
};

View File

@ -9,6 +9,7 @@
#include "Cafe/HW/Latte/Renderer/Metal/MetalSamplerCache.h"
#include "Cafe/HW/Latte/Renderer/Metal/LatteTextureReadbackMtl.h"
#include "Cafe/HW/Latte/Renderer/Metal/MetalHybridComputePipeline.h"
#include "Cafe/HW/Latte/Renderer/Metal/MetalQuery.h"
#include "Cafe/HW/Latte/Renderer/Metal/LatteToMtl.h"
#include "Cafe/HW/Latte/Renderer/Metal/UtilityShaderSource.h"
@ -1282,6 +1283,24 @@ void MetalRenderer::indexData_uploadIndexMemory(uint32 bufferIndex, uint32 offse
*/
}
LatteQueryObject* MetalRenderer::occlusionQuery_create() {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_create: Occlusion queries are not yet supported on Metal");
return new LatteQueryObjectMtl(this);
}
void MetalRenderer::occlusionQuery_destroy(LatteQueryObject* queryObj) {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_destroy: occlusion queries are not yet supported on Metal");
}
void MetalRenderer::occlusionQuery_flush() {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_flush: occlusion queries are not yet supported on Metal");
}
void MetalRenderer::occlusionQuery_updateState() {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_updateState: occlusion queries are not yet supported on Metal");
}
void MetalRenderer::SetBuffer(MTL::RenderCommandEncoder* renderCommandEncoder, MetalShaderType shaderType, MTL::Buffer* buffer, size_t offset, uint32 index)
{
auto& boundBuffer = m_state.m_encoderState.m_buffers[shaderType][index];

View File

@ -155,32 +155,6 @@ enum class MetalEncoderType
Blit,
};
// HACK: Dummy occlusion query object for Metal
class LatteQueryObjectMtl : public LatteQueryObject
{
public:
LatteQueryObjectMtl(class MetalRenderer* mtlRenderer) : m_mtlr{mtlRenderer} {}
bool getResult(uint64& numSamplesPassed) override
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::getResult: occlusion queries are not yet supported on Metal");
return true;
}
void begin() override
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::begin: occlusion queries are not yet supported on Metal");
}
void end() override
{
cemuLog_log(LogType::MetalLogging, "LatteQueryObjectMtl::end: occlusion queries are not yet supported on Metal");
}
private:
class MetalRenderer* m_mtlr;
};
class MetalRenderer : public Renderer
{
public:
@ -296,23 +270,10 @@ public:
void indexData_uploadIndexMemory(uint32 bufferIndex, uint32 offset, uint32 size) override;
// occlusion queries
LatteQueryObject* occlusionQuery_create() override {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_create: Occlusion queries are not yet supported on Metal");
return new LatteQueryObjectMtl(this);
}
void occlusionQuery_destroy(LatteQueryObject* queryObj) override {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_destroy: occlusion queries are not yet supported on Metal");
}
void occlusionQuery_flush() override {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_flush: occlusion queries are not yet supported on Metal");
}
void occlusionQuery_updateState() override {
cemuLog_log(LogType::MetalLogging, "MetalRenderer::occlusionQuery_updateState: occlusion queries are not yet supported on Metal");
}
LatteQueryObject* occlusionQuery_create() override;
void occlusionQuery_destroy(LatteQueryObject* queryObj) override;
void occlusionQuery_flush() override;
void occlusionQuery_updateState() override;
// Helpers
MetalPerformanceMonitor& GetPerformanceMonitor() { return m_performanceMonitor; }