diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp index 3c34203b5d..96bb4ba87d 100644 --- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp @@ -372,11 +372,14 @@ namespace dawn_native { namespace d3d12 { // blob. // These strings can be HLSL comments because Tint does not emit HLSL comments. // TODO(dawn:549): Replace guards strings with something more secure. - ASSERT(hlslSource.find("//") == std::string::npos); + constexpr char kStartGuard[] = "// Start shader autogenerated by Dawn."; + constexpr char kEndGuard[] = "// End shader autogenerated by Dawn."; + ASSERT(hlslSource.find(kStartGuard) == std::string::npos); + ASSERT(hlslSource.find(kEndGuard) == std::string::npos); - stream << "// Start shader autogenerated by Dawn."; + stream << kStartGuard << "\n"; stream << hlslSource; - stream << "// End of shader autogenerated by Dawn."; + stream << "\n" << kEndGuard; stream << compileFlags;