Use TINT_REFLECT for OverrideId

Adds tint_public_config to Dawn's internal config so Tint headers
can be included.

Fixed: dawn:1594
Change-Id: I4068fd95b6eae3138fbcc04f29f054c7cffdcf12
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/111260
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Shrek Shao <shrekshao@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Austin Eng <enga@chromium.org>
This commit is contained in:
Austin Eng 2022-11-22 22:23:55 +00:00 committed by Dawn LUCI CQ
parent f9c6633006
commit c982cd45c4
3 changed files with 10 additions and 5 deletions

View File

@ -18,11 +18,16 @@
#include <stdint.h>
#include <functional>
#include "src/tint/reflection.h"
namespace tint {
/// OverrideId is a numerical identifier for an override variable, unique per program.
struct OverrideId {
uint16_t value = 0;
/// Reflect the fields of this struct so that it can be used by tint::ForeachField()
TINT_REFLECT(value);
};
/// Equality operator for OverrideId

View File

@ -59,7 +59,10 @@ group("abseil") {
}
config("internal") {
configs = [ "${dawn_root}/src/dawn/common:internal_config" ]
configs = [
"${dawn_root}/src/dawn/common:internal_config",
"${dawn_root}/src/tint:tint_public_config",
]
}
config("weak_framework") {

View File

@ -76,10 +76,7 @@ void stream::Stream<tint::transform::SubstituteOverride::Config>::Write(
// static
template <>
void stream::Stream<tint::OverrideId>::Write(stream::Sink* sink, const tint::OverrideId& id) {
// TODO(tint:1640): fix the include build issues and use StreamInTintObject instead.
static_assert(offsetof(tint::OverrideId, value) == 0,
"Please update serialization for tint::OverrideId");
StreamIn(sink, id.value);
StreamInTintObject(id, sink);
}
// static