mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-07 21:55:53 +00:00
Make ShaderModuleBase use an internal EntryPointMetadata
WGSL and SPIR-V modules can contain multiple entrypoints, for different shader stages, that the pipelines can choose from. This is the first CL in a stack that will change Dawn internals to not rely on ShaderModules having a single entrypoint. EntryPointMetadata is introduced that will contain all reflection data for an entrypoint of a shader module. To ease review this CL doesn't introduce any functional changes and doesn't expose the EntryPointMetadata at the ShaderModuleBase interface. Instead ShaderModuleBase contains a single metadata object for its single entry point, and layout-related queries and proxied to the EntryPointMetadata object. Finally some small renames and formatting changes are done. Bug: dawn:216 Change-Id: I0f4d12a5075ba14c5e8fd666be4073d34288f6f9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27240 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
c3e3c30b0d
commit
4f8bdaf473
File diff suppressed because it is too large
Load Diff
@ -43,8 +43,6 @@ namespace dawn_native {
|
||||
|
||||
class ShaderModuleBase : public CachedObject {
|
||||
public:
|
||||
enum class Type { Undefined, Spirv, Wgsl };
|
||||
|
||||
ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor);
|
||||
~ShaderModuleBase() override;
|
||||
|
||||
@ -98,6 +96,15 @@ namespace dawn_native {
|
||||
uint32_t pullingBufferBindingSet) const;
|
||||
#endif
|
||||
|
||||
struct EntryPointMetadata {
|
||||
EntryPointMetadata();
|
||||
|
||||
ModuleBindingInfo bindings;
|
||||
std::bitset<kMaxVertexAttributes> usedVertexAttributes;
|
||||
SingleShaderStage stage;
|
||||
FragmentOutputBaseTypes fragmentOutputFormatBaseTypes;
|
||||
};
|
||||
|
||||
protected:
|
||||
static MaybeError CheckSpvcSuccess(shaderc_spvc_status status, const char* error_msg);
|
||||
shaderc_spvc::CompileOptions GetCompileOptions() const;
|
||||
@ -108,27 +115,18 @@ namespace dawn_native {
|
||||
private:
|
||||
ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag);
|
||||
|
||||
MaybeError ValidateCompatibilityWithBindGroupLayout(
|
||||
BindGroupIndex group,
|
||||
const BindGroupLayoutBase* layout) const;
|
||||
|
||||
std::vector<uint64_t> GetBindGroupMinBufferSizes(const BindingInfoMap& shaderMap,
|
||||
const BindGroupLayoutBase* layout) const;
|
||||
|
||||
// Different implementations reflection into the shader depending on
|
||||
// whether using spvc, or directly accessing spirv-cross.
|
||||
MaybeError ExtractSpirvInfoWithSpvc();
|
||||
MaybeError ExtractSpirvInfoWithSpirvCross(const spirv_cross::Compiler& compiler);
|
||||
ResultOrError<std::unique_ptr<EntryPointMetadata>> ExtractSpirvInfoWithSpvc();
|
||||
ResultOrError<std::unique_ptr<EntryPointMetadata>> ExtractSpirvInfoWithSpirvCross(
|
||||
const spirv_cross::Compiler& compiler);
|
||||
|
||||
enum class Type { Undefined, Spirv, Wgsl };
|
||||
Type mType;
|
||||
std::vector<uint32_t> mSpirv;
|
||||
std::string mWgsl;
|
||||
|
||||
ModuleBindingInfo mBindingInfo;
|
||||
std::bitset<kMaxVertexAttributes> mUsedVertexAttributes;
|
||||
SingleShaderStage mExecutionModel;
|
||||
|
||||
FragmentOutputBaseTypes mFragmentOutputFormatBaseTypes;
|
||||
std::unique_ptr<EntryPointMetadata> mMainEntryPoint;
|
||||
};
|
||||
|
||||
} // namespace dawn_native
|
||||
|
Loading…
x
Reference in New Issue
Block a user