Update spirv-tools to get new code folding optimization.
This change includes a fix for an issue we filed against spirv-tools: https://github.com/KhronosGroup/SPIRV-Tools/issues/4371 So, it should reduce the number of extraneous matrix copies in finalized GLSL code. I did quick size total of all filamat files (*) before and after this update, it went from 11.3 MB to 11.1 MB. (*) All backends are enabled, includes built-in Filament shaders and gltfio ubershaders.
This commit is contained in:
+18
-19
@@ -147,8 +147,8 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _,
|
||||
"type of the same index.";
|
||||
}
|
||||
|
||||
// Validate that PhysicalStorageBufferEXT have one of Restrict, Aliased,
|
||||
// RestrictPointerEXT, or AliasedPointerEXT.
|
||||
// Validate that PhysicalStorageBuffer have one of Restrict, Aliased,
|
||||
// RestrictPointer, or AliasedPointer.
|
||||
auto param_nonarray_type_id = param_type->id();
|
||||
while (_.GetIdOpcode(param_nonarray_type_id) == SpvOpTypeArray) {
|
||||
param_nonarray_type_id =
|
||||
@@ -157,7 +157,7 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _,
|
||||
if (_.GetIdOpcode(param_nonarray_type_id) == SpvOpTypePointer) {
|
||||
auto param_nonarray_type = _.FindDef(param_nonarray_type_id);
|
||||
if (param_nonarray_type->GetOperandAs<uint32_t>(1u) ==
|
||||
SpvStorageClassPhysicalStorageBufferEXT) {
|
||||
SpvStorageClassPhysicalStorageBuffer) {
|
||||
// check for Aliased or Restrict
|
||||
const auto& decorations = _.id_decorations(inst->id());
|
||||
|
||||
@@ -174,14 +174,14 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _,
|
||||
if (!foundAliased && !foundRestrict) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpFunctionParameter " << inst->id()
|
||||
<< ": expected Aliased or Restrict for PhysicalStorageBufferEXT "
|
||||
<< ": expected Aliased or Restrict for PhysicalStorageBuffer "
|
||||
"pointer.";
|
||||
}
|
||||
if (foundAliased && foundRestrict) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpFunctionParameter " << inst->id()
|
||||
<< ": can't specify both Aliased and Restrict for "
|
||||
"PhysicalStorageBufferEXT pointer.";
|
||||
"PhysicalStorageBuffer pointer.";
|
||||
}
|
||||
} else {
|
||||
const auto pointee_type_id =
|
||||
@@ -189,31 +189,31 @@ spv_result_t ValidateFunctionParameter(ValidationState_t& _,
|
||||
const auto pointee_type = _.FindDef(pointee_type_id);
|
||||
if (SpvOpTypePointer == pointee_type->opcode() &&
|
||||
pointee_type->GetOperandAs<uint32_t>(1u) ==
|
||||
SpvStorageClassPhysicalStorageBufferEXT) {
|
||||
// check for AliasedPointerEXT/RestrictPointerEXT
|
||||
SpvStorageClassPhysicalStorageBuffer) {
|
||||
// check for AliasedPointer/RestrictPointer
|
||||
const auto& decorations = _.id_decorations(inst->id());
|
||||
|
||||
bool foundAliased = std::any_of(
|
||||
decorations.begin(), decorations.end(), [](const Decoration& d) {
|
||||
return SpvDecorationAliasedPointerEXT == d.dec_type();
|
||||
return SpvDecorationAliasedPointer == d.dec_type();
|
||||
});
|
||||
|
||||
bool foundRestrict = std::any_of(
|
||||
decorations.begin(), decorations.end(), [](const Decoration& d) {
|
||||
return SpvDecorationRestrictPointerEXT == d.dec_type();
|
||||
return SpvDecorationRestrictPointer == d.dec_type();
|
||||
});
|
||||
|
||||
if (!foundAliased && !foundRestrict) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpFunctionParameter " << inst->id()
|
||||
<< ": expected AliasedPointerEXT or RestrictPointerEXT for "
|
||||
"PhysicalStorageBufferEXT pointer.";
|
||||
<< ": expected AliasedPointer or RestrictPointer for "
|
||||
"PhysicalStorageBuffer pointer.";
|
||||
}
|
||||
if (foundAliased && foundRestrict) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "OpFunctionParameter " << inst->id()
|
||||
<< ": can't specify both AliasedPointerEXT and "
|
||||
"RestrictPointerEXT for PhysicalStorageBufferEXT pointer.";
|
||||
<< ": can't specify both AliasedPointer and "
|
||||
"RestrictPointer for PhysicalStorageBuffer pointer.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,7 +300,7 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _,
|
||||
// These are always allowed.
|
||||
break;
|
||||
case SpvStorageClassStorageBuffer:
|
||||
if (!_.features().variable_pointers_storage_buffer) {
|
||||
if (!_.features().variable_pointers) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
<< "StorageBuffer pointer operand "
|
||||
<< _.getIdName(argument_id)
|
||||
@@ -316,11 +316,10 @@ spv_result_t ValidateFunctionCall(ValidationState_t& _,
|
||||
// Validate memory object declaration requirements.
|
||||
if (argument->opcode() != SpvOpVariable &&
|
||||
argument->opcode() != SpvOpFunctionParameter) {
|
||||
const bool ssbo_vptr =
|
||||
_.features().variable_pointers_storage_buffer &&
|
||||
sc == SpvStorageClassStorageBuffer;
|
||||
const bool wg_vptr =
|
||||
_.features().variable_pointers && sc == SpvStorageClassWorkgroup;
|
||||
const bool ssbo_vptr = _.features().variable_pointers &&
|
||||
sc == SpvStorageClassStorageBuffer;
|
||||
const bool wg_vptr = _.HasCapability(SpvCapabilityVariablePointers) &&
|
||||
sc == SpvStorageClassWorkgroup;
|
||||
const bool uc_ptr = sc == SpvStorageClassUniformConstant;
|
||||
if (!ssbo_vptr && !wg_vptr && !uc_ptr) {
|
||||
return _.diag(SPV_ERROR_INVALID_ID, inst)
|
||||
|
||||
Reference in New Issue
Block a user