D3DCommon/Shader: Use std::optional with CompileShader()

Allows removing the use of an out parameter, making it nicer to use.
This commit is contained in:
Lioncash
2019-07-26 19:34:27 -04:00
parent 0ce6264f90
commit aca02f9734
4 changed files with 13 additions and 14 deletions

View File

@ -26,11 +26,11 @@ std::unique_ptr<DXShader> DXShader::CreateFromBytecode(ShaderStage stage, Binary
std::unique_ptr<DXShader> DXShader::CreateFromSource(ShaderStage stage, std::string_view source)
{
BinaryData bytecode;
if (!CompileShader(g_dx_context->GetFeatureLevel(), &bytecode, stage, source))
auto bytecode = CompileShader(g_dx_context->GetFeatureLevel(), stage, source);
if (!bytecode)
return nullptr;
return CreateFromBytecode(stage, std::move(bytecode));
return CreateFromBytecode(stage, std::move(*bytecode));
}
D3D12_SHADER_BYTECODE DXShader::GetD3DByteCode() const