mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-11-15 20:36:11 +00:00
Updated spirv-tools.
This commit is contained in:
@@ -550,6 +550,39 @@ bool IsNullConstantSupported(const opt::analysis::Type& type) {
|
||||
type.AsDeviceEvent() || type.AsReserveId() || type.AsQueue();
|
||||
}
|
||||
|
||||
bool GlobalVariablesMustBeDeclaredInEntryPointInterfaces(
|
||||
const opt::IRContext* ir_context) {
|
||||
// TODO(afd): We capture the universal environments for which this requirement
|
||||
// holds. The check should be refined on demand for other target
|
||||
// environments.
|
||||
switch (ir_context->grammar().target_env()) {
|
||||
case SPV_ENV_UNIVERSAL_1_0:
|
||||
case SPV_ENV_UNIVERSAL_1_1:
|
||||
case SPV_ENV_UNIVERSAL_1_2:
|
||||
case SPV_ENV_UNIVERSAL_1_3:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void AddVariableIdToEntryPointInterfaces(opt::IRContext* context, uint32_t id) {
|
||||
if (GlobalVariablesMustBeDeclaredInEntryPointInterfaces(context)) {
|
||||
// Conservatively add this global to the interface of every entry point in
|
||||
// the module. This means that the global is available for other
|
||||
// transformations to use.
|
||||
//
|
||||
// A downside of this is that the global will be in the interface even if it
|
||||
// ends up never being used.
|
||||
//
|
||||
// TODO(https://github.com/KhronosGroup/SPIRV-Tools/issues/3111) revisit
|
||||
// this if a more thorough approach to entry point interfaces is taken.
|
||||
for (auto& entry_point : context->module()->entry_points()) {
|
||||
entry_point.AddOperand({SPV_OPERAND_TYPE_ID, {id}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace fuzzerutil
|
||||
|
||||
} // namespace fuzz
|
||||
|
||||
Reference in New Issue
Block a user