mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
GLSL writer: validate all entry points with glslang.
Generate and validate all entry points individually. This is required since GLSL has separate shader files, and can only have a single "main" entry point. Bug: tint:1217 Change-Id: Ie5cb510aaef3b7c8a7573f5fa9446815284afecb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/61920 Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
f3f2d0a218
commit
7cf3b28a87
@@ -28,6 +28,7 @@
|
||||
#include "src/transform/pad_array_elements.h"
|
||||
#include "src/transform/promote_initializers_to_const_var.h"
|
||||
#include "src/transform/simplify.h"
|
||||
#include "src/transform/single_entry_point.h"
|
||||
#include "src/transform/zero_init_workgroup_memory.h"
|
||||
|
||||
TINT_INSTANTIATE_TYPEINFO(tint::transform::Glsl);
|
||||
@@ -69,6 +70,10 @@ Output Glsl::Run(const Program* in, const DataMap& inputs) {
|
||||
// variables directly.
|
||||
data.Add<CanonicalizeEntryPointIO::Config>(
|
||||
CanonicalizeEntryPointIO::ShaderStyle::kHlsl);
|
||||
if (cfg) {
|
||||
manager.Add<SingleEntryPoint>();
|
||||
data.Add<SingleEntryPoint::Config>(cfg->entry_point);
|
||||
}
|
||||
auto out = manager.Run(in, data);
|
||||
if (!out.program.IsValid()) {
|
||||
return out;
|
||||
@@ -94,7 +99,8 @@ void Glsl::AddEmptyEntryPoint(CloneContext& ctx) const {
|
||||
ctx.dst->WorkgroupSize(1)});
|
||||
}
|
||||
|
||||
Glsl::Config::Config(bool disable_wi) : disable_workgroup_init(disable_wi) {}
|
||||
Glsl::Config::Config(const std::string& ep, bool disable_wi)
|
||||
: entry_point(ep), disable_workgroup_init(disable_wi) {}
|
||||
Glsl::Config::Config(const Config&) = default;
|
||||
Glsl::Config::~Config() = default;
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#ifndef SRC_TRANSFORM_GLSL_H_
|
||||
#define SRC_TRANSFORM_GLSL_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/transform/transform.h"
|
||||
|
||||
namespace tint {
|
||||
@@ -32,9 +34,11 @@ class Glsl : public Castable<Glsl, Transform> {
|
||||
/// Configuration options for the Glsl sanitizer transform.
|
||||
struct Config : public Castable<Data, transform::Data> {
|
||||
/// Constructor
|
||||
/// @param entry_point the root entry point function to generate
|
||||
/// @param disable_workgroup_init `true` to disable workgroup memory zero
|
||||
/// initialization
|
||||
explicit Config(bool disable_workgroup_init = false);
|
||||
explicit Config(const std::string& entry_point,
|
||||
bool disable_workgroup_init = false);
|
||||
|
||||
/// Copy constructor
|
||||
Config(const Config&);
|
||||
@@ -42,6 +46,9 @@ class Glsl : public Castable<Glsl, Transform> {
|
||||
/// Destructor
|
||||
~Config() override;
|
||||
|
||||
/// GLSL generator wraps a single entry point in a main() function.
|
||||
std::string entry_point;
|
||||
|
||||
/// Set to `true` to disable workgroup memory zero initialization
|
||||
bool disable_workgroup_init = false;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user