Title: [292748] trunk/Source/WebGPU
Revision
292748
Author
mmaxfi...@apple.com
Date
2022-04-11 17:40:29 -0700 (Mon, 11 Apr 2022)

Log Message

[WebGPU] WebGPU strings are UTF-8, not Latin-1
https://bugs.webkit.org/show_bug.cgi?id=239057

Reviewed by Kimmo Kinnunen.

Replace String::fromLatin1() with String::fromUTF8().

* WebGPU/APIConversions.h:
(WebGPU::fromAPI):
* WebGPU/Adapter.mm:
(WebGPU::Adapter::requestDevice):
* WebGPU/ComputePipeline.mm:
(WebGPU::createConstantValues):
(WebGPU::Device::createComputePipeline):
* WebGPU/ShaderModule.mm:
(WebGPU::earlyCompileShaderModule):
(WebGPU::Device::createShaderModule):

Modified Paths

Diff

Modified: trunk/Source/WebGPU/ChangeLog (292747 => 292748)


--- trunk/Source/WebGPU/ChangeLog	2022-04-12 00:30:21 UTC (rev 292747)
+++ trunk/Source/WebGPU/ChangeLog	2022-04-12 00:40:29 UTC (rev 292748)
@@ -1,5 +1,25 @@
 2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
 
+        [WebGPU] WebGPU strings are UTF-8, not Latin-1
+        https://bugs.webkit.org/show_bug.cgi?id=239057
+
+        Reviewed by Kimmo Kinnunen.
+
+        Replace String::fromLatin1() with String::fromUTF8().
+
+        * WebGPU/APIConversions.h:
+        (WebGPU::fromAPI):
+        * WebGPU/Adapter.mm:
+        (WebGPU::Adapter::requestDevice):
+        * WebGPU/ComputePipeline.mm:
+        (WebGPU::createConstantValues):
+        (WebGPU::Device::createComputePipeline):
+        * WebGPU/ShaderModule.mm:
+        (WebGPU::earlyCompileShaderModule):
+        (WebGPU::Device::createShaderModule):
+
+2022-04-11  Myles C. Maxfield  <mmaxfi...@apple.com>
+
         [WebGPU] Make sure asynchronous things are asynchronous
         https://bugs.webkit.org/show_bug.cgi?id=239056
 

Modified: trunk/Source/WebGPU/WebGPU/APIConversions.h (292747 => 292748)


--- trunk/Source/WebGPU/WebGPU/APIConversions.h	2022-04-12 00:30:21 UTC (rev 292747)
+++ trunk/Source/WebGPU/WebGPU/APIConversions.h	2022-04-12 00:40:29 UTC (rev 292748)
@@ -171,7 +171,7 @@
 
 inline String fromAPI(const char* string)
 {
-    return String::fromLatin1(string);
+    return String::fromUTF8(string);
 }
 
 template <typename T>

Modified: trunk/Source/WebGPU/WebGPU/Adapter.mm (292747 => 292748)


--- trunk/Source/WebGPU/WebGPU/Adapter.mm	2022-04-12 00:30:21 UTC (rev 292747)
+++ trunk/Source/WebGPU/WebGPU/Adapter.mm	2022-04-12 00:40:29 UTC (rev 292748)
@@ -134,7 +134,7 @@
         return;
     }
 
-    auto label = String::fromLatin1(descriptor.label);
+    auto label = fromAPI(descriptor.label);
     instance().scheduleWork([strongThis = Ref { *this }, label = WTFMove(label), callback = WTFMove(callback)]() mutable {
         callback(WGPURequestDeviceStatus_Success, Device::create(strongThis->m_device, WTFMove(label), strongThis), { });
     });

Modified: trunk/Source/WebGPU/WebGPU/ComputePipeline.mm (292747 => 292748)


--- trunk/Source/WebGPU/WebGPU/ComputePipeline.mm	2022-04-12 00:30:21 UTC (rev 292747)
+++ trunk/Source/WebGPU/WebGPU/ComputePipeline.mm	2022-04-12 00:40:29 UTC (rev 292748)
@@ -71,7 +71,7 @@
     auto constantValues = [MTLFunctionConstantValues new];
     for (uint32_t i = 0; i < constantCount; ++i) {
         const auto& entry = constants[i];
-        auto nameIterator = entryPointInformation.specializationConstantIndices.find(String::fromLatin1(entry.key));
+        auto nameIterator = entryPointInformation.specializationConstantIndices.find(fromAPI(entry.key));
         if (nameIterator == entryPointInformation.specializationConstantIndices.end())
             return nullptr;
         auto specializationConstantIndex = nameIterator->value;
@@ -150,7 +150,7 @@
     const PipelineLayout& pipelineLayout = WebGPU::fromAPI(descriptor.layout);
     auto label = fromAPI(descriptor.label);
 
-    auto libraryCreationResult = createLibrary(m_device, shaderModule, pipelineLayout, String::fromLatin1(descriptor.compute.entryPoint), label);
+    auto libraryCreationResult = createLibrary(m_device, shaderModule, pipelineLayout, fromAPI(descriptor.compute.entryPoint), label);
     if (!libraryCreationResult)
         return ComputePipeline::createInvalid(*this);
 

Modified: trunk/Source/WebGPU/WebGPU/ShaderModule.mm (292747 => 292748)


--- trunk/Source/WebGPU/WebGPU/ShaderModule.mm	2022-04-12 00:30:21 UTC (rev 292747)
+++ trunk/Source/WebGPU/WebGPU/ShaderModule.mm	2022-04-12 00:40:29 UTC (rev 292748)
@@ -88,7 +88,7 @@
         const auto& hint = suppliedHints.hints[i];
         if (hint.nextInChain)
             return nullptr;
-        auto hintKey = String::fromLatin1(hint.key);
+        auto hintKey = fromAPI(hint.key);
         hints.add(hintKey, WebGPU::fromAPI(hint.hint.layout));
         auto convertedPipelineLayout = ShaderModule::convertPipelineLayout(WebGPU::fromAPI(hint.hint.layout));
         wgslHints.add(hintKey, WTFMove(convertedPipelineLayout));
@@ -109,7 +109,7 @@
     if (!shaderModuleParameters)
         return ShaderModule::createInvalid(*this);
 
-    auto checkResult = WGSL::staticCheck(String::fromLatin1(shaderModuleParameters->wgsl.code), std::nullopt);
+    auto checkResult = WGSL::staticCheck(fromAPI(shaderModuleParameters->wgsl.code), std::nullopt);
 
     if (std::holds_alternative<WGSL::SuccessfulCheck>(checkResult) && shaderModuleParameters->hints && shaderModuleParameters->hints->hintsCount) {
         if (auto result = earlyCompileShaderModule(*this, WTFMove(checkResult), *shaderModuleParameters->hints, fromAPI(descriptor.label)))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to