Remove "Builders" related with pipeline
RenderPipeline and ComputePipeline has been created with descriptors and PipelineBuilder is not needed anymore. This patch remove these remain "Builders" in dawn. BUG=dawn:52 Change-Id: I8b119c540952beb3386913197f25b9c441f53ba4 Reviewed-on: https://dawn-review.googlesource.com/c/3460 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
2745f37875
commit
c8bf89ddf0
|
@ -28,7 +28,6 @@ namespace dawn_native {
|
||||||
class BufferBase;
|
class BufferBase;
|
||||||
class BufferBuilder;
|
class BufferBuilder;
|
||||||
class ComputePipelineBase;
|
class ComputePipelineBase;
|
||||||
class ComputePipelineBuilder;
|
|
||||||
class CommandBufferBase;
|
class CommandBufferBase;
|
||||||
class CommandBufferBuilder;
|
class CommandBufferBuilder;
|
||||||
class ComputePassEncoderBase;
|
class ComputePassEncoderBase;
|
||||||
|
@ -44,7 +43,6 @@ namespace dawn_native {
|
||||||
class RenderPassDescriptorBuilder;
|
class RenderPassDescriptorBuilder;
|
||||||
class RenderPassEncoderBase;
|
class RenderPassEncoderBase;
|
||||||
class RenderPipelineBase;
|
class RenderPipelineBase;
|
||||||
class RenderPipelineBuilder;
|
|
||||||
class SamplerBase;
|
class SamplerBase;
|
||||||
class ShaderModuleBase;
|
class ShaderModuleBase;
|
||||||
class ShaderModuleBuilder;
|
class ShaderModuleBuilder;
|
||||||
|
|
|
@ -30,30 +30,6 @@ namespace dawn_native {
|
||||||
: ObjectBase(device), mStageMask(stages), mLayout(layout), mDevice(device) {
|
: 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) {
|
void PipelineBase::ExtractModuleData(dawn::ShaderStage stage, ShaderModuleBase* module) {
|
||||||
PushConstantInfo* info = &mPushConstants[stage];
|
PushConstantInfo* info = &mPushConstants[stage];
|
||||||
|
|
||||||
|
@ -90,57 +66,4 @@ namespace dawn_native {
|
||||||
return mDevice;
|
return mDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
// PipelineBuilder
|
|
||||||
|
|
||||||
PipelineBuilder::PipelineBuilder(BuilderBase* parentBuilder)
|
|
||||||
: mParentBuilder(parentBuilder), mStageMask(static_cast<dawn::ShaderStageBit>(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
|
} // namespace dawn_native
|
||||||
|
|
|
@ -35,12 +35,9 @@ namespace dawn_native {
|
||||||
Float,
|
Float,
|
||||||
};
|
};
|
||||||
|
|
||||||
class PipelineBuilder;
|
|
||||||
|
|
||||||
class PipelineBase : public ObjectBase {
|
class PipelineBase : public ObjectBase {
|
||||||
public:
|
public:
|
||||||
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStageBit stages);
|
PipelineBase(DeviceBase* device, PipelineLayoutBase* layout, dawn::ShaderStageBit stages);
|
||||||
PipelineBase(DeviceBase* device, PipelineBuilder* builder);
|
|
||||||
|
|
||||||
struct PushConstantInfo {
|
struct PushConstantInfo {
|
||||||
std::bitset<kMaxPushConstants> mask;
|
std::bitset<kMaxPushConstants> mask;
|
||||||
|
@ -62,30 +59,6 @@ namespace dawn_native {
|
||||||
DeviceBase* mDevice;
|
DeviceBase* mDevice;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PipelineBuilder {
|
|
||||||
public:
|
|
||||||
PipelineBuilder(BuilderBase* parentBuilder);
|
|
||||||
|
|
||||||
struct StageInfo {
|
|
||||||
std::string entryPoint;
|
|
||||||
Ref<ShaderModuleBase> 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<PipelineLayoutBase> mLayout;
|
|
||||||
dawn::ShaderStageBit mStageMask;
|
|
||||||
PerStage<StageInfo> mStages;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace dawn_native
|
} // namespace dawn_native
|
||||||
|
|
||||||
#endif // DAWNNATIVE_PIPELINE_H_
|
#endif // DAWNNATIVE_PIPELINE_H_
|
||||||
|
|
Loading…
Reference in New Issue