Stop tint.h from including program_builder.h

ProgramBuilder is about as internal as you can get - this really should not be public.

MSVC seems to try an instantiate some of the template methods in ProgramBuilder when it is included externally (for PCH or DLL exports perhaps?), and failing with bizzare error messages that contain no point-of-instantiation.

As this header was never intended to be public in the first place, detect and error if the tint.h include guard is found while processing program_builder.h, and fix up the couple of bad transitive includes.

Fixes tint -> dawn autoroller

Change-Id: Ic9a81a44ab1b4a29a7297b94bbf85bcfdb1310b5
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53384
Auto-Submit: Ben Clayton <bclayton@google.com>
Commit-Queue: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
Ben Clayton 2021-06-05 12:45:50 +00:00 committed by Tint LUCI CQ
parent 1858854f7e
commit 03d10721e7
6 changed files with 21 additions and 3 deletions

View File

@ -18,6 +18,7 @@
#include "src/ast/stage_decoration.h" #include "src/ast/stage_decoration.h"
#include "src/ast/struct_block_decoration.h" #include "src/ast/struct_block_decoration.h"
#include "src/ast/workgroup_decoration.h" #include "src/ast/workgroup_decoration.h"
#include "src/program_builder.h"
#include "src/sem/depth_texture_type.h" #include "src/sem/depth_texture_type.h"
#include "src/sem/external_texture_type.h" #include "src/sem/external_texture_type.h"
#include "src/sem/multisampled_texture_type.h" #include "src/sem/multisampled_texture_type.h"

View File

@ -78,6 +78,10 @@
#include "src/sem/vector_type.h" #include "src/sem/vector_type.h"
#include "src/sem/void_type.h" #include "src/sem/void_type.h"
#ifdef INCLUDE_TINT_TINT_H_
#error "internal tint header being #included from tint.h"
#endif
namespace tint { namespace tint {
// Forward declarations // Forward declarations

View File

@ -14,6 +14,8 @@
#include "src/writer/hlsl/generator.h" #include "src/writer/hlsl/generator.h"
#include "src/writer/hlsl/generator_impl.h"
namespace tint { namespace tint {
namespace writer { namespace writer {
namespace hlsl { namespace hlsl {

View File

@ -18,13 +18,15 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include "src/writer/hlsl/generator_impl.h"
#include "src/writer/text.h" #include "src/writer/text.h"
namespace tint { namespace tint {
namespace writer { namespace writer {
namespace hlsl { namespace hlsl {
// Forward declarations
class GeneratorImpl;
/// Class to generate HLSL source /// Class to generate HLSL source
class Generator : public Text { class Generator : public Text {
public: public:

View File

@ -14,6 +14,8 @@
#include "src/writer/spirv/generator.h" #include "src/writer/spirv/generator.h"
#include "src/writer/spirv/binary_writer.h"
namespace tint { namespace tint {
namespace writer { namespace writer {
namespace spirv { namespace spirv {
@ -35,6 +37,10 @@ bool Generator::Generate() {
return true; return true;
} }
const std::vector<uint32_t>& Generator::result() const {
return writer_->result();
}
} // namespace spirv } // namespace spirv
} // namespace writer } // namespace writer
} // namespace tint } // namespace tint

View File

@ -19,13 +19,16 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "src/writer/spirv/binary_writer.h"
#include "src/writer/writer.h" #include "src/writer/writer.h"
namespace tint { namespace tint {
namespace writer { namespace writer {
namespace spirv { namespace spirv {
/// Forward declarations
class Builder;
class BinaryWriter;
/// Class to generate SPIR-V from a Tint program /// Class to generate SPIR-V from a Tint program
class Generator : public writer::Writer { class Generator : public writer::Writer {
public: public:
@ -41,7 +44,7 @@ class Generator : public writer::Writer {
bool Generate() override; bool Generate() override;
/// @returns the result data /// @returns the result data
const std::vector<uint32_t>& result() const { return writer_->result(); } const std::vector<uint32_t>& result() const;
private: private:
std::unique_ptr<Builder> builder_; std::unique_ptr<Builder> builder_;