D3D12: Support caching DX shaders.

This change is a prerequisite to D3D pipeline caching.

This change introduces:
- Caching interface which enables the cache.
- Helper for backends to load/store blobs to be cached.
- Ability to cache HLSL shaders.

Bug:dawn:549
Change-Id: I2af759882d18b3f45dc63e49dcb6a3caa1be3485
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32305
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Bryan Bernhart
2020-11-20 20:38:37 +00:00
committed by Commit Bot service account
parent cf89a68f46
commit 41b3f9c1e4
18 changed files with 683 additions and 89 deletions

View File

@@ -31,4 +31,9 @@ dawn_component("dawn_platform") {
]
deps = [ "${dawn_root}/src/common" ]
public_deps = [
# DawnPlatform.h has #include <dawn/webgpu.h>
"${dawn_root}/src/dawn:dawn_headers",
]
}

View File

@@ -27,4 +27,4 @@ target_sources(dawn_platform PRIVATE
"tracing/EventTracer.h"
"tracing/TraceEvent.h"
)
target_link_libraries(dawn_platform PRIVATE dawn_internal_config dawn_common)
target_link_libraries(dawn_platform PUBLIC dawn_headers PRIVATE dawn_internal_config dawn_common)

View File

@@ -14,10 +14,45 @@
#include "dawn_platform/DawnPlatform.h"
#include "common/Assert.h"
namespace dawn_platform {
CachingInterface::CachingInterface() = default;
CachingInterface::~CachingInterface() = default;
Platform::Platform() = default;
Platform::~Platform() = default;
const unsigned char* Platform::GetTraceCategoryEnabledFlag(TraceCategory category) {
static unsigned char disabled = 0;
return &disabled;
}
double Platform::MonotonicallyIncreasingTime() {
return 0;
}
uint64_t Platform::AddTraceEvent(char phase,
const unsigned char* categoryGroupEnabled,
const char* name,
uint64_t id,
double timestamp,
int numArgs,
const char** argNames,
const unsigned char* argTypes,
const uint64_t* argValues,
unsigned char flags) {
// AddTraceEvent cannot be called if events are disabled.
ASSERT(false);
return 0;
}
dawn_platform::CachingInterface* Platform::GetCachingInterface(const void* fingerprint,
size_t fingerprintSize) {
return nullptr;
}
} // namespace dawn_platform