Add flag to use spvc parser in tests
This also changes the name to be consistent with the option being set in the spvc API. BUG=dawn:335 Change-Id: I6f7431095493874e1fef0856e563f7f1225cfc21 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15780 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
28e054e8cb
commit
6f3e8d8f0f
|
@ -180,6 +180,9 @@ namespace dawn_native {
|
|||
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor)
|
||||
: CachedObject(device), mCode(descriptor->code, descriptor->code + descriptor->codeSize) {
|
||||
mFragmentOutputFormatBaseTypes.fill(Format::Other);
|
||||
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvcParser)) {
|
||||
mSpvcContext.SetUseSpvcParser(true);
|
||||
}
|
||||
}
|
||||
|
||||
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
||||
|
|
|
@ -91,8 +91,8 @@ namespace dawn_native {
|
|||
"Enable use of spvc for shader compilation, instead of accessing spirv_cross "
|
||||
"directly.",
|
||||
"https://crbug.com/dawn/288"}},
|
||||
{Toggle::UseSpvcIRGen,
|
||||
{"use_spvc_ir_gen",
|
||||
{Toggle::UseSpvcParser,
|
||||
{"use_spvc_parser",
|
||||
"Enable usage of spvc's internal parsing and IR generation code, instead of "
|
||||
"spirv_cross's.",
|
||||
"https://crbug.com/dawn/288"}},
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace dawn_native {
|
|||
UseD3D12RenderPass,
|
||||
SkipValidation,
|
||||
UseSpvc,
|
||||
UseSpvcIRGen,
|
||||
UseSpvcParser,
|
||||
VulkanUseD32S8,
|
||||
|
||||
EnumCount,
|
||||
|
|
|
@ -149,6 +149,13 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (strcmp("--use-spvc-parser", argv[i]) == 0) {
|
||||
mUseSpvc = true; // It's impossible to use the spvc parser without using spvc, so
|
||||
// turning on mUseSpvc implicitly.
|
||||
mUseSpvcParser = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id=";
|
||||
if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) {
|
||||
const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg);
|
||||
|
@ -217,6 +224,9 @@ void DawnTestEnvironment::SetUp() {
|
|||
<< "\n"
|
||||
"UseSpvc: "
|
||||
<< (mUseSpvc ? "true" : "false")
|
||||
<< "\n"
|
||||
"UseSpvcParser: "
|
||||
<< (mUseSpvcParser ? "true" : "false")
|
||||
<< "\n"
|
||||
"BeginCaptureOnStartup: "
|
||||
<< (mBeginCaptureOnStartup ? "true" : "false")
|
||||
|
@ -270,6 +280,10 @@ bool DawnTestEnvironment::IsSpvcBeingUsed() const {
|
|||
return mUseSpvc;
|
||||
}
|
||||
|
||||
bool DawnTestEnvironment::IsSpvcParserBeingUsed() const {
|
||||
return mUseSpvcParser;
|
||||
}
|
||||
|
||||
dawn_native::Instance* DawnTestEnvironment::GetInstance() const {
|
||||
return mInstance.get();
|
||||
}
|
||||
|
@ -519,10 +533,19 @@ void DawnTestBase::SetUp() {
|
|||
}
|
||||
|
||||
static constexpr char kUseSpvcToggle[] = "use_spvc";
|
||||
static constexpr char kUseSpvcParserToggle[] = "use_spvc_parser";
|
||||
if (gTestEnv->IsSpvcBeingUsed()) {
|
||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
||||
deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcToggle);
|
||||
|
||||
if (gTestEnv->IsSpvcParserBeingUsed()) {
|
||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcParserToggle) != nullptr);
|
||||
deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcParserToggle);
|
||||
}
|
||||
|
||||
} else {
|
||||
// Turning on spvc parser should always turn on spvc.
|
||||
ASSERT(!gTestEnv->IsSpvcParserBeingUsed());
|
||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
||||
deviceDescriptor.forceDisabledToggles.push_back(kUseSpvcToggle);
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ class DawnTestEnvironment : public testing::Environment {
|
|||
bool IsBackendValidationEnabled() const;
|
||||
bool IsDawnValidationSkipped() const;
|
||||
bool IsSpvcBeingUsed() const;
|
||||
bool IsSpvcParserBeingUsed() const;
|
||||
dawn_native::Instance* GetInstance() const;
|
||||
bool HasVendorIdFilter() const;
|
||||
uint32_t GetVendorIdFilter() const;
|
||||
|
@ -152,6 +153,7 @@ class DawnTestEnvironment : public testing::Environment {
|
|||
bool mEnableBackendValidation = false;
|
||||
bool mSkipDawnValidation = false;
|
||||
bool mUseSpvc = false;
|
||||
bool mUseSpvcParser = false;
|
||||
bool mBeginCaptureOnStartup = false;
|
||||
bool mHasVendorIdFilter = false;
|
||||
uint32_t mVendorIdFilter = 0;
|
||||
|
|
Loading…
Reference in New Issue