Diff
Modified: trunk/Source/WebCore/ChangeLog (252422 => 252423)
--- trunk/Source/WebCore/ChangeLog 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Source/WebCore/ChangeLog 2019-11-13 20:16:12 UTC (rev 252423)
@@ -1,3 +1,19 @@
+2019-11-13 Dean Jackson <[email protected]>
+
+ Fix some WebGPU demos
+ https://bugs.webkit.org/show_bug.cgi?id=204167
+ <rdar://problem/57160316>
+
+ Reviewed by Myles C. Maxfield.
+
+ Add a note referencing a bug I detected while fixing this demo.
+ And a drive-by typo.
+
+ * Modules/webgpu/WebGPUBuffer.cpp:
+ (WebCore::WebGPUBuffer::rejectOrRegisterPromiseCallback):
+ * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
+ (WebCore::GPUCommandBuffer::copyBufferToTexture):
+
2019-11-13 Antti Koivisto <[email protected]>
Google Docs spreadsheet tiles render very slowly (because of event region painting)
Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp (252422 => 252423)
--- trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBuffer.cpp 2019-11-13 20:16:12 UTC (rev 252423)
@@ -91,6 +91,9 @@
if (arrayBuffer)
promise.resolve(*arrayBuffer);
else {
+ // FIXME: It's possible to hit this code path in response to an unmap call, where
+ // the ArrayBuffer will definitely be null, and thus an out of memory error makes no sense.
+ // https://bugs.webkit.org/show_bug.cgi?id=204166
protectedErrorScopes->generateError("", GPUErrorFilter::OutOfMemory);
promise.reject();
}
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm (252422 => 252423)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm 2019-11-13 20:16:12 UTC (rev 252423)
@@ -135,7 +135,7 @@
void GPUCommandBuffer::copyBufferToTexture(GPUBufferCopyView&& srcBuffer, GPUTextureCopyView&& dstTexture, const GPUExtent3D& size)
{
if (isEncodingPass() || !srcBuffer.buffer->isCopySource() || !dstTexture.texture->isCopyDestination()) {
- LOG(WebGPU, "GPUComandBuffer::copyBufferToTexture(): Invalid operation!");
+ LOG(WebGPU, "GPUCommandBuffer::copyBufferToTexture(): Invalid operation!");
return;
}
Modified: trunk/Websites/webkit.org/ChangeLog (252422 => 252423)
--- trunk/Websites/webkit.org/ChangeLog 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/ChangeLog 2019-11-13 20:16:12 UTC (rev 252423)
@@ -1,3 +1,20 @@
+2019-11-13 Dean Jackson <[email protected]>
+
+ Fix some WebGPU demos
+ https://bugs.webkit.org/show_bug.cgi?id=204167
+
+ Reviewed by Myles C. Maxfield.
+
+ Use COPY_ rather than TRANSFER_.
+
+ * demos/webgpu/babylon/babylonWebGpu.max.js:
+ * demos/webgpu/babylon/oneSphereWebGPU.html:
+ * demos/webgpu/hello-cube.html:
+ * demos/webgpu/scripts/compute-boids-compile.js:
+ * demos/webgpu/scripts/compute-boids-utils.js:
+ (async.createTextureFromImage):
+ * demos/webgpu/textured-cube.html:
+
2019-11-08 Ryosuke Niwa <[email protected]>
Add punctuation rules for C++ lambdas
Modified: trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js 2019-11-13 20:16:12 UTC (rev 252423)
@@ -32945,8 +32945,8 @@
WebGPUConstants.GPUBufferUsage_NONE = 0;
WebGPUConstants.GPUBufferUsage_MAP_READ = 1;
WebGPUConstants.GPUBufferUsage_MAP_WRITE = 2;
- WebGPUConstants.GPUBufferUsage_TRANSFER_SRC = 4;
- WebGPUConstants.GPUBufferUsage_TRANSFER_DST = 8;
+ WebGPUConstants.GPUBufferUsage_COPY_SRC = 4;
+ WebGPUConstants.GPUBufferUsage_COPY_DST = 8;
WebGPUConstants.GPUBufferUsage_INDEX = 16;
WebGPUConstants.GPUBufferUsage_VERTEX = 32;
WebGPUConstants.GPUBufferUsage_UNIFORM = 64;
@@ -42295,7 +42295,7 @@
// TODO WEBGPU. Deprecated soon to be removed... replace by mappedBuffers
var bufferDescriptor = {
size: byteLength,
- usage: _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_MAP_WRITE | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_SRC
+ usage: _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_MAP_WRITE | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_SRC
};
var [tempBuffer, arr] = this._device.createBufferMapped(bufferDescriptor);
var uint8Src = new Uint8Array(src.buffer, src.byteOffset);
@@ -42323,7 +42323,7 @@
else {
view = data;
}
- var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_VERTEX | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_VERTEX | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
return dataBuffer;
};
WebGPUEngine.prototype.createDynamicVertexBuffer = function (data) {
@@ -42379,7 +42379,7 @@
is32Bits = false;
}
}
- var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_INDEX | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_INDEX | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
dataBuffer.is32Bits = is32Bits;
return dataBuffer;
};
@@ -42443,7 +42443,7 @@
else {
view = elements;
}
- var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_UNIFORM | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ var dataBuffer = this._createBuffer(view, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_UNIFORM | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
return dataBuffer;
};
WebGPUEngine.prototype.createDynamicUniformBuffer = function (elements) {
@@ -42664,7 +42664,7 @@
var rowPitch = Math.ceil(width * 4 / 256) * 256;
var dataBuffer;
if (rowPitch == width * 4) {
- dataBuffer = this._createBuffer(pixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ dataBuffer = this._createBuffer(pixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
var bufferView = {
buffer: dataBuffer.underlyingResource,
rowPitch: rowPitch,
@@ -42686,7 +42686,7 @@
pixelsIndex += 4;
}
}
- dataBuffer = this._createBuffer(alignedPixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ dataBuffer = this._createBuffer(alignedPixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
var bufferView = {
buffer: dataBuffer.underlyingResource,
rowPitch: rowPitch,
@@ -42760,7 +42760,7 @@
var rowPitch = Math.ceil(width * 4 / 256) * 256;
var dataBuffer;
if (rowPitch == width * 4) {
- dataBuffer = this._createBuffer(pixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ dataBuffer = this._createBuffer(pixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
var bufferView = {
buffer: dataBuffer.underlyingResource,
rowPitch: rowPitch,
@@ -42782,7 +42782,7 @@
pixelsIndex += 4;
}
}
- dataBuffer = this._createBuffer(alignedPixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_TRANSFER_DST);
+ dataBuffer = this._createBuffer(alignedPixels, _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_SRC | _WebGPU_webgpuConstants__WEBPACK_IMPORTED_MODULE_9__["WebGPUConstants"].GPUBufferUsage_COPY_DST);
var bufferView = {
buffer: dataBuffer.underlyingResource,
rowPitch: rowPitch,
Modified: trunk/Websites/webkit.org/demos/webgpu/babylon/oneSphereWebGPU.html (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/babylon/oneSphereWebGPU.html 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/babylon/oneSphereWebGPU.html 2019-11-13 20:16:12 UTC (rev 252423)
@@ -206,6 +206,9 @@
scene.render();
divFps.innerHTML = engine.getFps().toFixed() + " fps";
});
+ setTimeout(() => {
+ engine.stopRenderLoop();
+ }, 2000);
})();
</script>
</body>
Modified: trunk/Websites/webkit.org/demos/webgpu/hello-cube.html (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/hello-cube.html 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/hello-cube.html 2019-11-13 20:16:12 UTC (rev 252423)
@@ -147,7 +147,7 @@
const verticesBufferDescriptor = {
size: verticesArray.byteLength,
- usage: GPUBufferUsage.VERTEX | GPUBufferUsage.TRANSFER_DST
+ usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
};
let verticesArrayBuffer;
[verticesBuffer, verticesArrayBuffer] = device.createBufferMapped(verticesBufferDescriptor);
Modified: trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js 2019-11-13 20:16:12 UTC (rev 252423)
@@ -205,8 +205,8 @@
async function init() {
if (!isChrome) {
- GPUBufferUsage.COPY_DST = GPUBufferUsage.TRANSFER_DST;
- GPUBufferUsage.COPY_SRC = GPUBufferUsage.TRANSFER_SRC;
+ GPUBufferUsage.COPY_DST = GPUBufferUsage.COPY_DST;
+ GPUBufferUsage.COPY_SRC = GPUBufferUsage.COPY_SRC;
}
const adapter = await navigator.gpu.requestAdapter();
Modified: trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-utils.js (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-utils.js 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-utils.js 2019-11-13 20:16:12 UTC (rev 252423)
@@ -105,12 +105,12 @@
sampleCount: 1,
dimension: "2d",
format: "rgba8unorm",
- usage: GPUTextureUsage.TRANSFER_DST | usage,
+ usage: GPUTextureUsage.COPY_DST | usage,
});
const textureDataBuffer = device.createBuffer({
size: data.byteLength,
- usage: GPUBufferUsage.TRANSFER_DST | GPUBufferUsage.TRANSFER_SRC,
+ usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC,
});
textureDataBuffer.setSubData(0, data);
Modified: trunk/Websites/webkit.org/demos/webgpu/textured-cube.html (252422 => 252423)
--- trunk/Websites/webkit.org/demos/webgpu/textured-cube.html 2019-11-13 20:07:29 UTC (rev 252422)
+++ trunk/Websites/webkit.org/demos/webgpu/textured-cube.html 2019-11-13 20:16:12 UTC (rev 252423)
@@ -80,6 +80,8 @@
}
`;
+//console.log(`Shader is: ${shader}`);
+
let device, swapChain, verticesBuffer, bindGroupLayout, pipeline, renderPassDescriptor, queue, textureViewBinding, samplerBinding;
let projectionMatrix = mat4.create();
@@ -134,6 +136,10 @@
const adapter = await navigator.gpu.requestAdapter();
device = await adapter.requestDevice();
+ device._onuncapturederror_ = function (e) {
+ console.log(`ERROR:`, e);
+ };
+
const canvas = document.querySelector('canvas');
const aspect = Math.abs(canvas.width / canvas.height);
@@ -204,7 +210,7 @@
sampleCount: 1,
dimension: "2d",
format: "rgba8unorm",
- usage: GPUTextureUsage.TRANSFER_DST | GPUTextureUsage.SAMPLED
+ usage: GPUTextureUsage.COPY_DST | GPUTextureUsage.SAMPLED
};
const texture = device.createTexture(textureDescriptor);