Merge two calls to InitializeHLSL into one
BUG=dawn:290
Change-Id: I6dca2120278be998ef342a24ac027c1aa60d3a78
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14221
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
index 8471d6e..3f841d1 100644
--- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
+++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp
@@ -42,6 +42,16 @@
mSpirv.assign(descriptor->code, descriptor->code + descriptor->codeSize);
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
shaderc_spvc::CompileOptions options;
+
+ options.SetHLSLShaderModel(51);
+ // PointCoord and PointSize are not supported in HLSL
+ // TODO (hao.x.li@intel.com): The point_coord_compat and point_size_compat are
+ // required temporarily for https://bugs.chromium.org/p/dawn/issues/detail?id=146,
+ // but should be removed once WebGPU requires there is no gl_PointSize builtin.
+ // See https://github.com/gpuweb/gpuweb/issues/332
+ options.SetHLSLPointCoordCompat(true);
+ options.SetHLSLPointSizeCompat(true);
+
shaderc_spvc_status status =
mSpvcContext.InitializeForHlsl(descriptor->code, descriptor->codeSize, options);
if (status != shaderc_spvc_status_success) {
@@ -62,18 +72,6 @@
std::unique_ptr<spirv_cross::CompilerHLSL> compiler_impl;
spirv_cross::CompilerHLSL* compiler;
if (GetDevice()->IsToggleEnabled(Toggle::UseSpvc)) {
- shaderc_spvc::CompileOptions options;
-
- options.SetHLSLShaderModel(51);
- // PointCoord and PointSize are not supported in HLSL
- // TODO (hao.x.li@intel.com): The point_coord_compat and point_size_compat are
- // required temporarily for https://bugs.chromium.org/p/dawn/issues/detail?id=146,
- // but should be removed once WebGPU requires there is no gl_PointSize builtin.
- // See https://github.com/gpuweb/gpuweb/issues/332
- options.SetHLSLPointCoordCompat(true);
- options.SetHLSLPointSizeCompat(true);
-
- mSpvcContext.InitializeForHlsl(mSpirv.data(), mSpirv.size(), options);
compiler = reinterpret_cast<spirv_cross::CompilerHLSL*>(mSpvcContext.GetCompiler());
// TODO(rharrison): Check status & have some sort of meaningful error path
} else {