Use the spvc translated version of the Vulkan shader
BUG=dawn:325 Change-Id: I66bed7fec65cadecc956878bf11fc204b66ad195 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/15500 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
48e7da791f
commit
1edaa1d1e1
|
@ -42,7 +42,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||||
shaderc_spvc::CompileOptions options;
|
shaderc_spvc::CompileOptions options;
|
||||||
DAWN_TRY(CheckSpvcSuccess(
|
DAWN_TRY(CheckSpvcSuccess(
|
||||||
mSpvcContext.InitializeForGlsl(descriptor->code, descriptor->codeSize, options),
|
mSpvcContext.InitializeForVulkan(descriptor->code, descriptor->codeSize, options),
|
||||||
"Unable to initialize instance of spvc"));
|
"Unable to initialize instance of spvc"));
|
||||||
|
|
||||||
spirv_cross::Compiler* compiler;
|
spirv_cross::Compiler* compiler;
|
||||||
|
@ -58,8 +58,19 @@ namespace dawn_native { namespace vulkan {
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||||
createInfo.pNext = nullptr;
|
createInfo.pNext = nullptr;
|
||||||
createInfo.flags = 0;
|
createInfo.flags = 0;
|
||||||
|
std::vector<uint32_t> vulkanSource;
|
||||||
|
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
|
||||||
|
shaderc_spvc::CompilationResult result;
|
||||||
|
DAWN_TRY(CheckSpvcSuccess(mSpvcContext.CompileShader(&result),
|
||||||
|
"Unable to generate Vulkan shader"));
|
||||||
|
DAWN_TRY(CheckSpvcSuccess(result.GetBinaryOutput(&vulkanSource),
|
||||||
|
"Unable to get binary output of Vulkan shader"));
|
||||||
|
createInfo.codeSize = vulkanSource.size() * sizeof(uint32_t);
|
||||||
|
createInfo.pCode = vulkanSource.data();
|
||||||
|
} else {
|
||||||
createInfo.codeSize = descriptor->codeSize * sizeof(uint32_t);
|
createInfo.codeSize = descriptor->codeSize * sizeof(uint32_t);
|
||||||
createInfo.pCode = descriptor->code;
|
createInfo.pCode = descriptor->code;
|
||||||
|
}
|
||||||
|
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
return CheckVkSuccess(
|
return CheckVkSuccess(
|
||||||
|
|
Loading…
Reference in New Issue