mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-14 19:31:25 +00:00
Return error instead of crash if compile shader failed on D3D12
Bug: dawn:347 Change-Id: Id5cc8c9c7c3acf5daa6f17fd3235b584dd52d522 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/18720 Commit-Queue: Hao Li <hao.x.li@intel.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
2b24fab368
commit
c00163ba09
@ -15,6 +15,7 @@
|
||||
#include "dawn_native/d3d12/RenderPipelineD3D12.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
#include "common/Log.h"
|
||||
#include "dawn_native/d3d12/D3D12Error.h"
|
||||
#include "dawn_native/d3d12/DeviceD3D12.h"
|
||||
#include "dawn_native/d3d12/PipelineLayoutD3D12.h"
|
||||
@ -341,11 +342,14 @@ namespace dawn_native { namespace d3d12 {
|
||||
DAWN_TRY_ASSIGN(hlslSource, module->GetHLSLSource(ToBackend(GetLayout())));
|
||||
|
||||
const PlatformFunctions* functions = device->GetFunctions();
|
||||
if (FAILED(functions->d3dCompile(hlslSource.c_str(), hlslSource.length(), nullptr,
|
||||
nullptr, nullptr, entryPoint, compileTarget,
|
||||
compileFlags, 0, &compiledShader[stage], &errors))) {
|
||||
printf("%s\n", reinterpret_cast<char*>(errors->GetBufferPointer()));
|
||||
ASSERT(false);
|
||||
MaybeError error = CheckHRESULT(
|
||||
functions->d3dCompile(hlslSource.c_str(), hlslSource.length(), nullptr, nullptr,
|
||||
nullptr, entryPoint, compileTarget, compileFlags, 0,
|
||||
&compiledShader[stage], &errors),
|
||||
"D3DCompile");
|
||||
if (error.IsError()) {
|
||||
dawn::WarningLog() << reinterpret_cast<char*>(errors->GetBufferPointer());
|
||||
DAWN_TRY(std::move(error));
|
||||
}
|
||||
|
||||
if (shader != nullptr) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user