mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-26 08:42:45 +01:00
metal: configure pipeline before drawing
This commit is contained in:
parent
22ec7e72f0
commit
3fa495840a
3 changed files with 11 additions and 33 deletions
|
@ -53,22 +53,20 @@ GraphicsPipeline::GraphicsPipeline(const Device& device_, CommandRecorder& comma
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MakePipeline(framebuffer->GetHandle());
|
MakePipeline(framebuffer->GetHandle());
|
||||||
// configure_func = ConfigureFunc(functions, stage_infos);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Spec>
|
void GraphicsPipeline::Configure(bool is_indexed) {
|
||||||
void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
buffer_cache.UpdateGraphicsBuffers(is_indexed);
|
||||||
// TODO: implement
|
buffer_cache.BindHostGeometryBuffers(is_indexed);
|
||||||
}
|
|
||||||
|
|
||||||
void GraphicsPipeline::ConfigureDraw() {
|
texture_cache.UpdateRenderTargets(true);
|
||||||
Framebuffer* framebuffer = texture_cache.GetFramebuffer();
|
const Framebuffer* const framebuffer = texture_cache.GetFramebuffer();
|
||||||
if (!framebuffer) {
|
if (!framebuffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// MTL::RenderPassDescriptor* render_pass = framebuffer->GetHandle();
|
command_recorder.BeginOrContinueRenderPass(framebuffer->GetHandle());
|
||||||
|
|
||||||
// TODO: bind resources
|
command_recorder.GetRenderCommandEncoder()->setRenderPipelineState(pipeline_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsPipeline::MakePipeline(MTL::RenderPassDescriptor* render_pass) {
|
void GraphicsPipeline::MakePipeline(MTL::RenderPassDescriptor* render_pass) {
|
||||||
|
|
|
@ -80,9 +80,7 @@ public:
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
void AddTransition(GraphicsPipeline* transition) {}
|
void AddTransition(GraphicsPipeline* transition) {}
|
||||||
|
|
||||||
void Configure(bool is_indexed) {
|
void Configure(bool is_indexed);
|
||||||
// configure_func(this, is_indexed);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] GraphicsPipeline* Next(const GraphicsPipelineCacheKey& current_key) noexcept {
|
[[nodiscard]] GraphicsPipeline* Next(const GraphicsPipelineCacheKey& current_key) noexcept {
|
||||||
// TODO: implement
|
// TODO: implement
|
||||||
|
@ -93,26 +91,12 @@ public:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Spec>
|
|
||||||
static auto MakeConfigureSpecFunc() {
|
|
||||||
return [](GraphicsPipeline* pl, bool is_indexed) { pl->ConfigureImpl<Spec>(is_indexed); };
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetEngine(Tegra::Engines::Maxwell3D* maxwell3d_, Tegra::MemoryManager* gpu_memory_) {
|
void SetEngine(Tegra::Engines::Maxwell3D* maxwell3d_, Tegra::MemoryManager* gpu_memory_) {
|
||||||
maxwell3d = maxwell3d_;
|
maxwell3d = maxwell3d_;
|
||||||
gpu_memory = gpu_memory_;
|
gpu_memory = gpu_memory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
MTL::RenderPipelineState* GetPipelineState() const noexcept {
|
|
||||||
return pipeline_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename Spec>
|
|
||||||
void ConfigureImpl(bool is_indexed);
|
|
||||||
|
|
||||||
void ConfigureDraw();
|
|
||||||
|
|
||||||
void MakePipeline(MTL::RenderPassDescriptor* render_pass);
|
void MakePipeline(MTL::RenderPassDescriptor* render_pass);
|
||||||
|
|
||||||
void Validate();
|
void Validate();
|
||||||
|
|
|
@ -48,12 +48,7 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
||||||
if (!pipeline) {
|
if (!pipeline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
command_recorder.GetRenderCommandEncoder()->setRenderPipelineState(
|
pipeline->Configure(is_indexed);
|
||||||
pipeline->GetPipelineState());
|
|
||||||
|
|
||||||
// HACK: test is buffers are being correctly created
|
|
||||||
buffer_cache.UpdateGraphicsBuffers(is_indexed);
|
|
||||||
buffer_cache.BindHostGeometryBuffers(is_indexed);
|
|
||||||
|
|
||||||
// HACK: dummy draw call
|
// HACK: dummy draw call
|
||||||
command_recorder.GetRenderCommandEncoder()->drawPrimitives(MTL::PrimitiveTypeTriangle,
|
command_recorder.GetRenderCommandEncoder()->drawPrimitives(MTL::PrimitiveTypeTriangle,
|
||||||
|
@ -95,7 +90,8 @@ void RasterizerMetal::Clear(u32 layer_count) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin render pass
|
// TODO: track the textures used by render pass and only begin the render pass if their contents
|
||||||
|
// are needed Begin render pass
|
||||||
command_recorder.BeginOrContinueRenderPass(framebuffer->GetHandle());
|
command_recorder.BeginOrContinueRenderPass(framebuffer->GetHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue