mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-06 06:33:30 +00:00
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)
|
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, const ShaderModuleDescriptor* descriptor)
|
||||||
: CachedObject(device), mCode(descriptor->code, descriptor->code + descriptor->codeSize) {
|
: CachedObject(device), mCode(descriptor->code, descriptor->code + descriptor->codeSize) {
|
||||||
mFragmentOutputFormatBaseTypes.fill(Format::Other);
|
mFragmentOutputFormatBaseTypes.fill(Format::Other);
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvcParser)) {
|
||||||
|
mSpvcContext.SetUseSpvcParser(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderModuleBase::ShaderModuleBase(DeviceBase* device, ObjectBase::ErrorTag tag)
|
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 "
|
"Enable use of spvc for shader compilation, instead of accessing spirv_cross "
|
||||||
"directly.",
|
"directly.",
|
||||||
"https://crbug.com/dawn/288"}},
|
"https://crbug.com/dawn/288"}},
|
||||||
{Toggle::UseSpvcIRGen,
|
{Toggle::UseSpvcParser,
|
||||||
{"use_spvc_ir_gen",
|
{"use_spvc_parser",
|
||||||
"Enable usage of spvc's internal parsing and IR generation code, instead of "
|
"Enable usage of spvc's internal parsing and IR generation code, instead of "
|
||||||
"spirv_cross's.",
|
"spirv_cross's.",
|
||||||
"https://crbug.com/dawn/288"}},
|
"https://crbug.com/dawn/288"}},
|
||||||
|
@ -34,7 +34,7 @@ namespace dawn_native {
|
|||||||
UseD3D12RenderPass,
|
UseD3D12RenderPass,
|
||||||
SkipValidation,
|
SkipValidation,
|
||||||
UseSpvc,
|
UseSpvc,
|
||||||
UseSpvcIRGen,
|
UseSpvcParser,
|
||||||
VulkanUseD32S8,
|
VulkanUseD32S8,
|
||||||
|
|
||||||
EnumCount,
|
EnumCount,
|
||||||
|
@ -149,6 +149,13 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
|||||||
continue;
|
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=";
|
constexpr const char kVendorIdFilterArg[] = "--adapter-vendor-id=";
|
||||||
if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) {
|
if (strstr(argv[i], kVendorIdFilterArg) == argv[i]) {
|
||||||
const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg);
|
const char* vendorIdFilter = argv[i] + strlen(kVendorIdFilterArg);
|
||||||
@ -217,6 +224,9 @@ void DawnTestEnvironment::SetUp() {
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
"UseSpvc: "
|
"UseSpvc: "
|
||||||
<< (mUseSpvc ? "true" : "false")
|
<< (mUseSpvc ? "true" : "false")
|
||||||
|
<< "\n"
|
||||||
|
"UseSpvcParser: "
|
||||||
|
<< (mUseSpvcParser ? "true" : "false")
|
||||||
<< "\n"
|
<< "\n"
|
||||||
"BeginCaptureOnStartup: "
|
"BeginCaptureOnStartup: "
|
||||||
<< (mBeginCaptureOnStartup ? "true" : "false")
|
<< (mBeginCaptureOnStartup ? "true" : "false")
|
||||||
@ -270,6 +280,10 @@ bool DawnTestEnvironment::IsSpvcBeingUsed() const {
|
|||||||
return mUseSpvc;
|
return mUseSpvc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DawnTestEnvironment::IsSpvcParserBeingUsed() const {
|
||||||
|
return mUseSpvcParser;
|
||||||
|
}
|
||||||
|
|
||||||
dawn_native::Instance* DawnTestEnvironment::GetInstance() const {
|
dawn_native::Instance* DawnTestEnvironment::GetInstance() const {
|
||||||
return mInstance.get();
|
return mInstance.get();
|
||||||
}
|
}
|
||||||
@ -519,10 +533,19 @@ void DawnTestBase::SetUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static constexpr char kUseSpvcToggle[] = "use_spvc";
|
static constexpr char kUseSpvcToggle[] = "use_spvc";
|
||||||
|
static constexpr char kUseSpvcParserToggle[] = "use_spvc_parser";
|
||||||
if (gTestEnv->IsSpvcBeingUsed()) {
|
if (gTestEnv->IsSpvcBeingUsed()) {
|
||||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
||||||
deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcToggle);
|
deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcToggle);
|
||||||
|
|
||||||
|
if (gTestEnv->IsSpvcParserBeingUsed()) {
|
||||||
|
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcParserToggle) != nullptr);
|
||||||
|
deviceDescriptor.forceEnabledToggles.push_back(kUseSpvcParserToggle);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
// Turning on spvc parser should always turn on spvc.
|
||||||
|
ASSERT(!gTestEnv->IsSpvcParserBeingUsed());
|
||||||
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
ASSERT(gTestEnv->GetInstance()->GetToggleInfo(kUseSpvcToggle) != nullptr);
|
||||||
deviceDescriptor.forceDisabledToggles.push_back(kUseSpvcToggle);
|
deviceDescriptor.forceDisabledToggles.push_back(kUseSpvcToggle);
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@ class DawnTestEnvironment : public testing::Environment {
|
|||||||
bool IsBackendValidationEnabled() const;
|
bool IsBackendValidationEnabled() const;
|
||||||
bool IsDawnValidationSkipped() const;
|
bool IsDawnValidationSkipped() const;
|
||||||
bool IsSpvcBeingUsed() const;
|
bool IsSpvcBeingUsed() const;
|
||||||
|
bool IsSpvcParserBeingUsed() const;
|
||||||
dawn_native::Instance* GetInstance() const;
|
dawn_native::Instance* GetInstance() const;
|
||||||
bool HasVendorIdFilter() const;
|
bool HasVendorIdFilter() const;
|
||||||
uint32_t GetVendorIdFilter() const;
|
uint32_t GetVendorIdFilter() const;
|
||||||
@ -152,6 +153,7 @@ class DawnTestEnvironment : public testing::Environment {
|
|||||||
bool mEnableBackendValidation = false;
|
bool mEnableBackendValidation = false;
|
||||||
bool mSkipDawnValidation = false;
|
bool mSkipDawnValidation = false;
|
||||||
bool mUseSpvc = false;
|
bool mUseSpvc = false;
|
||||||
|
bool mUseSpvcParser = false;
|
||||||
bool mBeginCaptureOnStartup = false;
|
bool mBeginCaptureOnStartup = false;
|
||||||
bool mHasVendorIdFilter = false;
|
bool mHasVendorIdFilter = false;
|
||||||
uint32_t mVendorIdFilter = 0;
|
uint32_t mVendorIdFilter = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user