Properly handle SPVC errors.
Also removes a MaybeError from a function that can't return errors. Bug: chromium:1063810 Change-Id: I9125b2b164a2892006442e26d6070d226fec8665 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/17481 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
d920adc772
commit
26e42d31f3
|
@ -123,19 +123,16 @@ namespace dawn_native {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<SingleShaderStage> ToSingleShaderStage(
|
SingleShaderStage ToSingleShaderStage(shaderc_spvc_execution_model execution_model) {
|
||||||
shaderc_spvc_execution_model execution_model) {
|
|
||||||
switch (execution_model) {
|
switch (execution_model) {
|
||||||
case shaderc_spvc_execution_model_vertex:
|
case shaderc_spvc_execution_model_vertex:
|
||||||
return {SingleShaderStage::Vertex};
|
return SingleShaderStage::Vertex;
|
||||||
case shaderc_spvc_execution_model_fragment:
|
case shaderc_spvc_execution_model_fragment:
|
||||||
return {SingleShaderStage::Fragment};
|
return SingleShaderStage::Fragment;
|
||||||
case shaderc_spvc_execution_model_glcompute:
|
case shaderc_spvc_execution_model_glcompute:
|
||||||
return {SingleShaderStage::Compute};
|
return SingleShaderStage::Compute;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return DAWN_VALIDATION_ERROR(
|
|
||||||
"Attempted to convert invalid spvc execution model to SingleShaderStage");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,8 +357,7 @@ namespace dawn_native {
|
||||||
shaderc_spvc_execution_model execution_model;
|
shaderc_spvc_execution_model execution_model;
|
||||||
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetExecutionModel(&execution_model),
|
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.GetExecutionModel(&execution_model),
|
||||||
"Unable to get execution model for shader."));
|
"Unable to get execution model for shader."));
|
||||||
|
mExecutionModel = ToSingleShaderStage(execution_model);
|
||||||
DAWN_TRY_ASSIGN(mExecutionModel, ToSingleShaderStage(execution_model));
|
|
||||||
|
|
||||||
size_t push_constant_buffers_count;
|
size_t push_constant_buffers_count;
|
||||||
DAWN_TRY(
|
DAWN_TRY(
|
||||||
|
@ -804,7 +800,7 @@ namespace dawn_native {
|
||||||
MaybeError ShaderModuleBase::CheckSpvcSuccess(shaderc_spvc_status status,
|
MaybeError ShaderModuleBase::CheckSpvcSuccess(shaderc_spvc_status status,
|
||||||
const char* error_msg) {
|
const char* error_msg) {
|
||||||
if (status != shaderc_spvc_status_success) {
|
if (status != shaderc_spvc_status_success) {
|
||||||
DAWN_VALIDATION_ERROR(error_msg);
|
return DAWN_VALIDATION_ERROR(error_msg);
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue