forked from ShuriZma/suyu
metal: use texture cache to create textures render passes
This commit is contained in:
parent
88154b6c6d
commit
863842948b
|
@ -40,7 +40,7 @@ void CommandRecorder::RequireBlitEncoder() {
|
|||
void CommandRecorder::EndEncoding() {
|
||||
if (encoder) {
|
||||
[encoder endEncoding];
|
||||
[encoder release];
|
||||
//[encoder release];
|
||||
encoder = nil;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ void CommandRecorder::Submit() {
|
|||
if (command_buffer) {
|
||||
EndEncoding();
|
||||
[command_buffer commit];
|
||||
[command_buffer release];
|
||||
//[command_buffer release];
|
||||
command_buffer = nil;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
|||
//command_recorder.CheckIfRenderPassIsActive();
|
||||
//const auto& draw_state = maxwell3d->draw_manager->GetDrawState();
|
||||
if (is_indexed) {
|
||||
std::cout << "DrawIndexed" << std::endl;
|
||||
std::cout << "Draw indexed" << std::endl;
|
||||
/*[command_buffer drawIndexedPrimitives:MTLPrimitiveTypeTriangle
|
||||
indexCount:draw_params.num_indices
|
||||
indexType:MTLIndexTypeUInt32
|
||||
|
@ -61,8 +61,24 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
|||
// draw_params.base_vertex, draw_params.base_instance);
|
||||
}
|
||||
}
|
||||
void RasterizerMetal::DrawTexture() {}
|
||||
void RasterizerMetal::Clear(u32 layer_count) {}
|
||||
|
||||
void RasterizerMetal::DrawTexture() {
|
||||
std::cout << "Draw texture" << std::endl;
|
||||
}
|
||||
|
||||
void RasterizerMetal::Clear(u32 layer_count) {
|
||||
std::cout << "Clear" << std::endl;
|
||||
|
||||
texture_cache.UpdateRenderTargets(true);
|
||||
const Framebuffer* const framebuffer = texture_cache.GetFramebuffer();
|
||||
if (!framebuffer) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Begin render pass
|
||||
command_recorder.BeginRenderPass(framebuffer->GetHandle());
|
||||
}
|
||||
|
||||
void RasterizerMetal::DispatchCompute() {}
|
||||
void RasterizerMetal::ResetCounter(VideoCommon::QueryType type) {}
|
||||
void RasterizerMetal::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
|
||||
|
@ -135,12 +151,15 @@ void RasterizerMetal::LoadDiskResources(u64 title_id, std::stop_token stop_loadi
|
|||
const VideoCore::DiskResourceLoadCallback& callback) {}
|
||||
void RasterizerMetal::InitializeChannel(Tegra::Control::ChannelState& channel) {
|
||||
CreateChannel(channel);
|
||||
texture_cache.CreateChannel(channel);
|
||||
}
|
||||
void RasterizerMetal::BindChannel(Tegra::Control::ChannelState& channel) {
|
||||
BindToChannel(channel.bind_id);
|
||||
texture_cache.BindToChannel(channel.bind_id);
|
||||
}
|
||||
void RasterizerMetal::ReleaseChannel(s32 channel_id) {
|
||||
EraseChannel(channel_id);
|
||||
texture_cache.EraseChannel(channel_id);
|
||||
}
|
||||
|
||||
} // namespace Metal
|
||||
|
|
|
@ -20,6 +20,7 @@ public:
|
|||
|
||||
void Present();
|
||||
|
||||
// Can only be called between AcquireNextDrawable and Present
|
||||
MTLTexture_t GetDrawableTexture();
|
||||
|
||||
private:
|
||||
|
|
|
@ -15,21 +15,17 @@ SwapChain::SwapChain(const Device& device_, CommandRecorder& command_recorder_,
|
|||
}
|
||||
|
||||
SwapChain::~SwapChain() {
|
||||
if (drawable) {
|
||||
// TODO: should drawable be released?
|
||||
[drawable release];
|
||||
}
|
||||
[layer release];
|
||||
}
|
||||
|
||||
void SwapChain::AcquireNextDrawable() {
|
||||
// Get the next drawable
|
||||
drawable = [layer nextDrawable];
|
||||
drawable = [[layer nextDrawable] retain];
|
||||
}
|
||||
|
||||
void SwapChain::Present() {
|
||||
command_recorder.EndEncoding();
|
||||
command_recorder.Present(drawable);
|
||||
[drawable release];
|
||||
}
|
||||
|
||||
MTLTexture_t SwapChain::GetDrawableTexture() {
|
||||
|
|
|
@ -37,6 +37,7 @@ void RendererMetal::Composite(std::span<const Tegra::FramebufferConfig> framebuf
|
|||
render_pass_descriptor.colorAttachments[0].texture = swap_chain.GetDrawableTexture();
|
||||
|
||||
command_recorder.BeginRenderPass(render_pass_descriptor);
|
||||
command_recorder.EndEncoding();
|
||||
|
||||
swap_chain.Present();
|
||||
command_recorder.Submit();
|
||||
|
|
Loading…
Reference in New Issue