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;
|
||||
}
|
||||
MakePipeline(framebuffer->GetHandle());
|
||||
// configure_func = ConfigureFunc(functions, stage_infos);
|
||||
}
|
||||
|
||||
template <typename Spec>
|
||||
void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
|
||||
// TODO: implement
|
||||
}
|
||||
void GraphicsPipeline::Configure(bool is_indexed) {
|
||||
buffer_cache.UpdateGraphicsBuffers(is_indexed);
|
||||
buffer_cache.BindHostGeometryBuffers(is_indexed);
|
||||
|
||||
void GraphicsPipeline::ConfigureDraw() {
|
||||
Framebuffer* framebuffer = texture_cache.GetFramebuffer();
|
||||
texture_cache.UpdateRenderTargets(true);
|
||||
const Framebuffer* const framebuffer = texture_cache.GetFramebuffer();
|
||||
if (!framebuffer) {
|
||||
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) {
|
||||
|
|
|
@ -80,9 +80,7 @@ public:
|
|||
// TODO: implement
|
||||
void AddTransition(GraphicsPipeline* transition) {}
|
||||
|
||||
void Configure(bool is_indexed) {
|
||||
// configure_func(this, is_indexed);
|
||||
}
|
||||
void Configure(bool is_indexed);
|
||||
|
||||
[[nodiscard]] GraphicsPipeline* Next(const GraphicsPipelineCacheKey& current_key) noexcept {
|
||||
// TODO: implement
|
||||
|
@ -93,26 +91,12 @@ public:
|
|||
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_) {
|
||||
maxwell3d = maxwell3d_;
|
||||
gpu_memory = gpu_memory_;
|
||||
}
|
||||
|
||||
MTL::RenderPipelineState* GetPipelineState() const noexcept {
|
||||
return pipeline_state;
|
||||
}
|
||||
|
||||
private:
|
||||
template <typename Spec>
|
||||
void ConfigureImpl(bool is_indexed);
|
||||
|
||||
void ConfigureDraw();
|
||||
|
||||
void MakePipeline(MTL::RenderPassDescriptor* render_pass);
|
||||
|
||||
void Validate();
|
||||
|
|
|
@ -48,12 +48,7 @@ void RasterizerMetal::Draw(bool is_indexed, u32 instance_count) {
|
|||
if (!pipeline) {
|
||||
return;
|
||||
}
|
||||
command_recorder.GetRenderCommandEncoder()->setRenderPipelineState(
|
||||
pipeline->GetPipelineState());
|
||||
|
||||
// HACK: test is buffers are being correctly created
|
||||
buffer_cache.UpdateGraphicsBuffers(is_indexed);
|
||||
buffer_cache.BindHostGeometryBuffers(is_indexed);
|
||||
pipeline->Configure(is_indexed);
|
||||
|
||||
// HACK: dummy draw call
|
||||
command_recorder.GetRenderCommandEncoder()->drawPrimitives(MTL::PrimitiveTypeTriangle,
|
||||
|
@ -95,7 +90,8 @@ void RasterizerMetal::Clear(u32 layer_count) {
|
|||
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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue