Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp (285867 => 285868)
--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp 2021-11-16 17:11:06 UTC (rev 285867)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp 2021-11-16 17:11:23 UTC (rev 285868)
@@ -89,7 +89,9 @@
static Ref<SupportedLimits> supportedLimits(WGPUAdapter adapter)
{
WGPUSupportedLimits limits;
- wgpuAdapterGetLimits(adapter, &limits);
+ limits.nextInChain = nullptr;
+ auto result = wgpuAdapterGetLimits(adapter, &limits);
+ ASSERT_UNUSED(result, result);
return SupportedLimits::create(
limits.limits.maxTextureDimension1D,
limits.limits.maxTextureDimension2D,
Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp (285867 => 285868)
--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp 2021-11-16 17:11:06 UTC (rev 285867)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp 2021-11-16 17:11:23 UTC (rev 285868)
@@ -235,8 +235,18 @@
{
auto label = descriptor.label.utf8();
+ auto source = descriptor.code.utf8();
+
+ WGPUShaderModuleWGSLDescriptor backingWGSLDescriptor {
+ {
+ nullptr,
+ WGPUSType_ShaderModuleWGSLDescriptor,
+ },
+ source.data(),
+ };
+
WGPUShaderModuleDescriptor backingDescriptor {
- nullptr,
+ &backingWGSLDescriptor.chain,
label.data(),
};
@@ -250,10 +260,10 @@
auto entryPoint = descriptor.compute.entryPoint.utf8();
- Vector<CString> keys;
- keys.reserveInitialCapacity(descriptor.compute.constants.size());
+ Vector<CString> constantNames;
+ constantNames.reserveInitialCapacity(descriptor.compute.constants.size());
for (const auto& constant : descriptor.compute.constants)
- keys.uncheckedAppend(constant.key.utf8());
+ constantNames.uncheckedAppend(constant.key.utf8());
Vector<WGPUConstantEntry> backingConstantEntries;
backingConstantEntries.reserveInitialCapacity(descriptor.compute.constants.size());
@@ -261,7 +271,7 @@
const auto& constant = descriptor.compute.constants[i];
backingConstantEntries.uncheckedAppend(WGPUConstantEntry {
nullptr,
- keys[i].data(),
+ constantNames[i].data(),
constant.value
});
}
@@ -293,6 +303,24 @@
{
auto label = descriptor.label.utf8();
+ auto vertexEntryPoint = descriptor.vertex.entryPoint.utf8();
+
+ Vector<CString> vertexConstantNames;
+ vertexConstantNames.reserveInitialCapacity(descriptor.vertex.constants.size());
+ for (const auto& constant : descriptor.vertex.constants)
+ vertexConstantNames.uncheckedAppend(constant.key.utf8());
+
+ Vector<WGPUConstantEntry> vertexConstantEntries;
+ vertexConstantEntries.reserveInitialCapacity(descriptor.vertex.constants.size());
+ for (size_t i = 0; i < descriptor.vertex.constants.size(); ++i) {
+ const auto& constant = descriptor.vertex.constants[i];
+ vertexConstantEntries.uncheckedAppend(WGPUConstantEntry {
+ nullptr,
+ vertexConstantNames[i].data(),
+ constant.value,
+ });
+ }
+
Vector<Vector<WGPUVertexAttribute>> backingAttributes;
backingAttributes.reserveInitialCapacity(descriptor.vertex.buffers.size());
for (const auto& buffer : descriptor.vertex.buffers) {
@@ -345,6 +373,28 @@
descriptor.depthStencil ? descriptor.depthStencil->depthBiasClamp : 0,
};
+ auto fragmentEntryPoint = descriptor.fragment ? descriptor.fragment->entryPoint.utf8() : CString("");
+
+ Vector<CString> fragmentConstantNames;
+ if (descriptor.fragment) {
+ fragmentConstantNames.reserveInitialCapacity(descriptor.fragment->constants.size());
+ for (const auto& constant : descriptor.fragment->constants)
+ fragmentConstantNames.uncheckedAppend(constant.key.utf8());
+ }
+
+ Vector<WGPUConstantEntry> fragmentConstantEntries;
+ if (descriptor.fragment) {
+ fragmentConstantEntries.reserveInitialCapacity(descriptor.fragment->constants.size());
+ for (size_t i = 0; i < descriptor.fragment->constants.size(); ++i) {
+ const auto& constant = descriptor.fragment->constants[i];
+ fragmentConstantEntries.uncheckedAppend(WGPUConstantEntry {
+ nullptr,
+ fragmentConstantNames[i].data(),
+ constant.value,
+ });
+ }
+ }
+
Vector<std::optional<WGPUBlendState>> blendStates;
if (descriptor.fragment) {
blendStates.reserveInitialCapacity(descriptor.fragment->targets.size());
@@ -382,10 +432,10 @@
WGPUFragmentState fragmentState {
nullptr,
- nullptr,
- nullptr,
- 0,
- nullptr,
+ descriptor.fragment ? convertToBackingContext.convertToBacking(descriptor.fragment->module) : nullptr,
+ fragmentEntryPoint.data(),
+ static_cast<uint32_t>(fragmentConstantEntries.size()),
+ fragmentConstantEntries.data(),
static_cast<uint32_t>(colorTargets.size()),
colorTargets.data(),
};
@@ -395,10 +445,10 @@
label.data(),
descriptor.layout ? convertToBackingContext.convertToBacking(*descriptor.layout) : nullptr, {
nullptr,
- nullptr,
- nullptr,
- 0,
- nullptr,
+ convertToBackingContext.convertToBacking(descriptor.vertex.module),
+ vertexEntryPoint.data(),
+ static_cast<uint32_t>(vertexConstantEntries.size()),
+ vertexConstantEntries.data(),
static_cast<uint32_t>(backingBuffers.size()),
backingBuffers.data(),
}, {
Modified: trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h (285867 => 285868)
--- trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h 2021-11-16 17:11:06 UTC (rev 285867)
+++ trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h 2021-11-16 17:11:23 UTC (rev 285868)
@@ -43,7 +43,7 @@
return adoptRef(*new DeviceImpl(device, WTFMove(features), WTFMove(limits), convertToBackingContext));
}
- ~DeviceImpl();
+ virtual ~DeviceImpl();
private:
friend class DowncastConvertToBackingContext;