mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 14:13:39 +00:00
Notes: - Separates ChainedStruct to be reusable without cpp header. (Also updates native structs to directly use it.) - Manually implements the descriptor in DawnNative. - Reworks ChainUtils with mapping from struct to STypes. - Updates the tests to use either SetPlatformForTesting which is still required because DawnTest uses a "global" instance for all tests and some tests require setting (and cleaning up) a test specific platform. Bug: dawn:1374 Change-Id: I078c78f22c5137030cf3cf0e8358fe4373ee9c6c Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/132268 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Loko Kung <lokokung@google.com>
49 lines
1.7 KiB
C++
49 lines
1.7 KiB
C++
//* Copyright 2023 The Dawn Authors
|
|
//*
|
|
//* Licensed under the Apache License, Version 2.0 (the "License");
|
|
//* you may not use this file except in compliance with the License.
|
|
//* You may obtain a copy of the License at
|
|
//*
|
|
//* http://www.apache.org/licenses/LICENSE-2.0
|
|
//*
|
|
//* Unless required by applicable law or agreed to in writing, software
|
|
//* distributed under the License is distributed on an "AS IS" BASIS,
|
|
//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
//* See the License for the specific language governing permissions and
|
|
//* limitations under the License.
|
|
{% set API = metadata.api.upper() %}
|
|
{% if 'dawn' in enabled_tags %}
|
|
#ifdef __EMSCRIPTEN__
|
|
#error "Do not include this header. Emscripten already provides headers needed for {{metadata.api}}."
|
|
#endif
|
|
{% endif %}
|
|
#ifndef {{API}}_CPP_CHAINED_STRUCT_H_
|
|
#define {{API}}_CPP_CHAINED_STRUCT_H_
|
|
|
|
// This header file declares the ChainedStruct structures separately from the {{metadata.api}}
|
|
// headers so that dependencies can directly extend structures without including the larger header
|
|
// which exposes capabilities that may require correctly set proc tables.
|
|
namespace {{metadata.namespace}} {
|
|
|
|
namespace detail {
|
|
constexpr size_t ConstexprMax(size_t a, size_t b) {
|
|
return a > b ? a : b;
|
|
}
|
|
} // namespace detail
|
|
|
|
enum class SType : uint32_t;
|
|
|
|
struct ChainedStruct {
|
|
ChainedStruct const * nextInChain = nullptr;
|
|
SType sType = SType(0u);
|
|
};
|
|
|
|
struct ChainedStructOut {
|
|
ChainedStructOut * nextInChain = nullptr;
|
|
SType sType = SType(0u);
|
|
};
|
|
|
|
} // namespace {{metadata.namespace}}}
|
|
|
|
#endif // {{API}}_CPP_CHAINED_STRUCT_H_
|