diff --git a/src/dawn_native/Forward.h b/src/dawn_native/Forward.h index 518444b41b..211fdc5b9d 100644 --- a/src/dawn_native/Forward.h +++ b/src/dawn_native/Forward.h @@ -28,7 +28,6 @@ namespace dawn_native { class BufferBase; class BufferBuilder; class ComputePipelineBase; - class ComputePipelineBuilder; class CommandBufferBase; class CommandBufferBuilder; class ComputePassEncoderBase; @@ -44,7 +43,6 @@ namespace dawn_native { class RenderPassDescriptorBuilder; class RenderPassEncoderBase; class RenderPipelineBase; - class RenderPipelineBuilder; class SamplerBase; class ShaderModuleBase; class ShaderModuleBuilder; diff --git a/src/dawn_native/Pipeline.cpp b/src/dawn_native/Pipeline.cpp index afa388b0a2..175e864732 100644 --- a/src/dawn_native/Pipeline.cpp +++ b/src/dawn_native/Pipeline.cpp @@ -30,30 +30,6 @@ namespace dawn_native { : ObjectBase(device), mStageMask(stages), mLayout(layout), mDevice(device) { } - PipelineBase::PipelineBase(DeviceBase* device, PipelineBuilder* builder) - : ObjectBase(device), - mStageMask(builder->mStageMask), - mLayout(std::move(builder->mLayout)), - mDevice(device) { - if (!mLayout) { - PipelineLayoutDescriptor descriptor; - descriptor.numBindGroupLayouts = 0; - descriptor.bindGroupLayouts = nullptr; - mLayout = device->CreatePipelineLayout(&descriptor); - // Remove the external ref objects are created with - mLayout->Release(); - } - - for (auto stage : IterateStages(builder->mStageMask)) { - if (!builder->mStages[stage].module->IsCompatibleWithPipelineLayout(mLayout.Get())) { - builder->GetParentBuilder()->HandleError("Stage not compatible with layout"); - return; - } - - ExtractModuleData(stage, builder->mStages[stage].module.Get()); - } - } - void PipelineBase::ExtractModuleData(dawn::ShaderStage stage, ShaderModuleBase* module) { PushConstantInfo* info = &mPushConstants[stage]; @@ -90,57 +66,4 @@ namespace dawn_native { return mDevice; } - // PipelineBuilder - - PipelineBuilder::PipelineBuilder(BuilderBase* parentBuilder) - : mParentBuilder(parentBuilder), mStageMask(static_cast(0)) { - } - - const PipelineBuilder::StageInfo& PipelineBuilder::GetStageInfo(dawn::ShaderStage stage) const { - ASSERT(mStageMask & StageBit(stage)); - return mStages[stage]; - } - - BuilderBase* PipelineBuilder::GetParentBuilder() const { - return mParentBuilder; - } - - void PipelineBuilder::SetLayout(PipelineLayoutBase* layout) { - if (layout == nullptr) { - mParentBuilder->HandleError("Layout must not be null"); - return; - } - - mLayout = layout; - } - - void PipelineBuilder::SetStage(dawn::ShaderStage stage, - ShaderModuleBase* module, - const char* entryPoint) { - if (module == nullptr) { - mParentBuilder->HandleError("Module must not be null"); - return; - } - - if (entryPoint != std::string("main")) { - mParentBuilder->HandleError("Currently the entry point has to be main()"); - return; - } - - if (stage != module->GetExecutionModel()) { - mParentBuilder->HandleError("Setting module with wrong execution model"); - return; - } - - dawn::ShaderStageBit bit = StageBit(stage); - if (mStageMask & bit) { - mParentBuilder->HandleError("Setting already set stage"); - return; - } - mStageMask |= bit; - - mStages[stage].module = module; - mStages[stage].entryPoint = entryPoint; - } - } // namespace dawn_native diff --git a/src/dawn_native/Pipeline.h b/src/dawn_native/Pipeline.h index d91dc5bde9..47c1079607 100644 --- a/src/dawn_native/Pipeline.h +++ b/src/dawn_native/Pipeline.h @@ -35,12 +35,9 @@ namespace dawn_native { Float, }; - class PipelineBuilder; - class PipelineBase : public ObjectBase { public: PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStageBit stages); - PipelineBase(DeviceBase* device, PipelineBuilder* builder); struct PushConstantInfo { std::bitset mask; @@ -62,30 +59,6 @@ namespace dawn_native { DeviceBase* mDevice; }; - class PipelineBuilder { - public: - PipelineBuilder(BuilderBase* parentBuilder); - - struct StageInfo { - std::string entryPoint; - Ref module; - }; - const StageInfo& GetStageInfo(dawn::ShaderStage stage) const; - BuilderBase* GetParentBuilder() const; - - // Dawn API - void SetLayout(PipelineLayoutBase* layout); - void SetStage(dawn::ShaderStage stage, ShaderModuleBase* module, const char* entryPoint); - - private: - friend class PipelineBase; - - BuilderBase* mParentBuilder; - Ref mLayout; - dawn::ShaderStageBit mStageMask; - PerStage mStages; - }; - } // namespace dawn_native #endif // DAWNNATIVE_PIPELINE_H_