<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242575] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242575">242575</a></dd>
<dt>Author</dt> <dd>justin_fan@apple.com</dd>
<dt>Date</dt> <dd>2019-03-06 15:57:58 -0800 (Wed, 06 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
https://bugs.webkit.org/show_bug.cgi?id=195347

Reviewed by Dean Jackson.

Source/WebCore:

Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and
GPUTextureView implementations. Rename various bind group classes to GPU* to match API.

Test: webgpu/texture-triangle-strip.html

* Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
(WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
* Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
(WebCore::WebGPUCommandBuffer::copyBufferToTexture):
(WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
(WebCore::WebGPUCommandBuffer::copyTextureToTexture):
* Modules/webgpu/WebGPUCommandBuffer.h:
(WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
* Modules/webgpu/WebGPUDevice.cpp:
(WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
* Modules/webgpu/WebGPUDevice.h: Ditto.
* Modules/webgpu/WebGPUDevice.idl: Ditto.
* Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
(WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
* Modules/webgpu/WebGPUProgrammablePassEncoder.h:
* Modules/webgpu/WebGPUQueue.cpp:
(WebCore::WebGPUQueue::submit):
* Modules/webgpu/WebGPURenderPassDescriptor.cpp:
(WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
* Modules/webgpu/WebGPUTexture.cpp:
(WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
(WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
(WebCore::WebGPUTexture::destroy):
(WebCore::WebGPUTexture::destroyImpl):
* Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
* Modules/webgpu/WebGPUTexture.idl: Enable destroy.
* Modules/webgpu/WebGPUTextureView.cpp:
(WebCore::WebGPUTextureView::create):
(WebCore::WebGPUTextureView::WebGPUTextureView):
(WebCore::WebGPUTextureView::destroy):
* Modules/webgpu/WebGPUTextureView.h:
(WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
(WebCore::WebGPUTextureView::texture const):
(WebCore::WebGPUTextureView::texture): Deleted.
* platform/graphics/gpu/GPUBindGroupLayout.h:
* platform/graphics/gpu/GPUCommandBuffer.h:
(WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
(WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
(WebCore::GPUCommandBuffer::setIsEncodingPass):
(WebCore::GPUCommandBuffer::useTexture):
* platform/graphics/gpu/GPUDevice.cpp:
(WebCore::GPUDevice::tryCreateBindGroupLayout const):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/GPUPipelineLayout.cpp:
(WebCore::GPUPipelineLayout::GPUPipelineLayout):
* platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
(WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
* platform/graphics/gpu/GPUProgrammablePassEncoder.h:
(WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
(WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
(): Deleted.
* platform/graphics/gpu/GPUQueue.h:
* platform/graphics/gpu/GPURenderPassEncoder.h:
* platform/graphics/gpu/GPUTexture.h:
(WebCore::GPUTexture::isReadOnly const):
(WebCore::GPUTexture::destroy):
* platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
(WebCore::MTLDataTypeForBindingType):
(WebCore::GPUBindGroupLayout::tryCreate):
* platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
(WebCore::GPUCommandBuffer::create):
(WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
(WebCore::GPUCommandBuffer::endBlitEncoding):
(WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
(WebCore::GPUCommandBuffer::copyTextureToBuffer):
(WebCore::GPUCommandBuffer::copyTextureToTexture):
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::create):
(WebCore::GPUDevice::GPUDevice):
* platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
(WebCore::GPUProgrammablePassEncoder::endPass):
(WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
(WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
(WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
* platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
(WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
* platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
(WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
(WebCore::GPURenderPassEncoder::platformPassEncoder const):
(WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
(WebCore::GPURenderPassEncoder::setPipeline):
(WebCore::GPURenderPassEncoder::setVertexBuffers):
(WebCore::GPURenderPassEncoder::draw):
(WebCore::GPURenderPassEncoder::useResource):
(WebCore::GPURenderPassEncoder::setVertexBuffer):
(WebCore::GPURenderPassEncoder::setFragmentBuffer):
* platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
(WebCore::GPUSwapChain::getNextTexture):
* platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
(WebCore::storageModeForPixelFormatAndSampleCount):
        Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
(WebCore::tryCreateMtlTextureDescriptor):
(WebCore::GPUTexture::create):
(WebCore::GPUTexture::GPUTexture):
(WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.

Update files and symbols in project:
* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
* Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
* Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
* Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
* Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
* Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
* Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/WebCoreBuiltinNames.h:

LayoutTests:

* webgpu/blit-commands.html:
* webgpu/resources/blue-checkered.png: Added.
* webgpu/texture-triangle-strip-expected.html: Added. Draw a reference for blue-checkered.png with Canvas2D.
* webgpu/texture-triangle-strip.html: Added. Draw blue-checkered.png as a texture on a Web GPU quad.

Renaming updates, no change in behavior:
* webgpu/bind-groups.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/pipeline-layouts.html:
* webgpu/render-pipelines.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestswebgpubindgroupshtml">trunk/LayoutTests/webgpu/bind-groups.html</a></li>
<li><a href="#trunkLayoutTestswebgpublitcommandshtml">trunk/LayoutTests/webgpu/blit-commands.html</a></li>
<li><a href="#trunkLayoutTestswebgpubufferresourcetriangleshtml">trunk/LayoutTests/webgpu/buffer-resource-triangles.html</a></li>
<li><a href="#trunkLayoutTestswebgpupipelinelayoutshtml">trunk/LayoutTests/webgpu/pipeline-layouts.html</a></li>
<li><a href="#trunkLayoutTestswebgpurenderpipelineshtml">trunk/LayoutTests/webgpu/render-pipelines.html</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesinputxcfilelist">trunk/Source/WebCore/DerivedSources-input.xcfilelist</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesoutputxcfilelist">trunk/Source/WebCore/DerivedSources-output.xcfilelist</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUBindGroupDescriptorcpp">trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUCommandBuffercpp">trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUCommandBufferh">trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUDevicecpp">trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUDeviceh">trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUDeviceidl">trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUProgrammablePassEncodercpp">trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUProgrammablePassEncoderh">trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUQueuecpp">trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPURenderPassDescriptorcpp">trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUTexturecpp">trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUTextureh">trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUTextureidl">trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUTextureViewcpp">trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.cpp</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUTextureViewh">trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.h</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsWebCoreBuiltinNamesh">trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayouth">trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUCommandBufferh">trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUDevicecpp">trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUDeviceh">trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUPipelineLayoutcpp">trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUProgrammablePassEncodercpp">trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUProgrammablePassEncoderh">trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUQueueh">trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPURenderPassEncoderh">trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUTextureh">trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUBindGroupLayoutMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUCommandBufferMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUDeviceMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUProgrammablePassEncoderMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUQueueMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPURenderPassEncoderMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUSwapChainMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpucocoaGPUTextureMetalmm">trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUTextureMetal.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestswebgpuresourcesbluecheckeredpng">trunk/LayoutTests/webgpu/resources/blue-checkered.png</a></li>
<li><a href="#trunkLayoutTestswebgputexturetrianglestripexpectedhtml">trunk/LayoutTests/webgpu/texture-triangle-strip-expected.html</a></li>
<li><a href="#trunkLayoutTestswebgputexturetrianglestriphtml">trunk/LayoutTests/webgpu/texture-triangle-strip.html</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutBindingh">trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutBindingidl">trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutDescriptorh">trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutDescriptoridl">trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUShaderStageBith">trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuGPUShaderStageBitidl">trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.idl</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreModulesstreamsWebGPUBindGroupLayoutDescriptorh">trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutBindingh">trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutBindingidl">trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutDescriptoridl">trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUShaderStageBith">trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h</a></li>
<li><a href="#trunkSourceWebCoreModuleswebgpuWebGPUShaderStageBitidl">trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutBindingh">trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutDescriptorh">trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/ChangeLog 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2019-03-06  Justin Fan  <justin_fan@apple.com>
+
+        [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
+        https://bugs.webkit.org/show_bug.cgi?id=195347
+
+        Reviewed by Dean Jackson.
+
+        * webgpu/blit-commands.html:
+        * webgpu/resources/blue-checkered.png: Added.
+        * webgpu/texture-triangle-strip-expected.html: Added. Draw a reference for blue-checkered.png with Canvas2D.
+        * webgpu/texture-triangle-strip.html: Added. Draw blue-checkered.png as a texture on a Web GPU quad.
+
+        Renaming updates, no change in behavior:
+        * webgpu/bind-groups.html:
+        * webgpu/buffer-resource-triangles.html:
+        * webgpu/pipeline-layouts.html:
+        * webgpu/render-pipelines.html:
+
</ins><span class="cx"> 2019-03-06  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS] Basic hit testing for content overlapping fast-scrollable overflow
</span></span></pre></div>
<a id="trunkLayoutTestswebgpubindgroupshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgpu/bind-groups.html (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/bind-groups.html        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/webgpu/bind-groups.html   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -13,8 +13,8 @@
</span><span class="cx">     // FIXME: Also test sampled texture bindings. 
</span><span class="cx">     const bufferLayoutBinding = {
</span><span class="cx">         binding: 1,
</span><del>-        visibility: WebGPUShaderStageBit.VERTEX,
-        type: "storageBuffer"
</del><ins>+        visibility: GPUShaderStageBit.VERTEX,
+        type: "storage-buffer"
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     const bindGroupLayout = device.createBindGroupLayout({ bindings: [bufferLayoutBinding] });
</span></span></pre></div>
<a id="trunkLayoutTestswebgpublitcommandshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgpu/blit-commands.html (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/blit-commands.html      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/webgpu/blit-commands.html 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     const bufferViewB = {
</span><span class="cx">         buffer: bufferB,
</span><span class="cx">         offset: 0,
</span><del>-        rowPitch: 0,
</del><ins>+        rowPitch: image.width * 4,
</ins><span class="cx">         imageHeight: 0
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">     const readBufferView = {
</span><span class="cx">         buffer: readBuffer,
</span><span class="cx">         offset: 0,
</span><del>-        rowPitch: 0,
</del><ins>+        rowPitch: image.width * 4,
</ins><span class="cx">         imageHeight: 0
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="lines">@@ -91,6 +91,10 @@
</span><span class="cx">     commandBuffer.copyTextureToTexture(textureViewA, textureViewB, textureSize);
</span><span class="cx">     commandBuffer.copyTextureToBuffer(textureViewB, readBufferView, textureSize);
</span><span class="cx">     device.getQueue().submit([commandBuffer]);
</span><ins>+    bufferA.destroy();
+    bufferB.destroy();
+    textureA.destroy();
+    textureB.destroy();
</ins><span class="cx"> 
</span><span class="cx">     const resultContext = document.querySelector('canvas').getContext('2d');
</span><span class="cx"> 
</span><span class="lines">@@ -100,7 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">         resultContext.putImageData(resultImageData, 0, 0);
</span><span class="cx"> 
</span><del>-        readBuffer.unmap();
</del><ins>+        readBuffer.destroy();
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     if (window.testRunner)
</span></span></pre></div>
<a id="trunkLayoutTestswebgpubufferresourcetriangleshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgpu/buffer-resource-triangles.html (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/buffer-resource-triangles.html  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/webgpu/buffer-resource-triangles.html     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -72,11 +72,11 @@
</span><span class="cx">     G: 5
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-function createUniformBufferBindGroupLayout(bindNum, stage = WebGPUShaderStageBit.VERTEX) {
</del><ins>+function createUniformBufferBindGroupLayout(bindNum, stage = GPUShaderStageBit.VERTEX) {
</ins><span class="cx">     return {
</span><span class="cx">         binding: bindNum,
</span><span class="cx">         visibility: stage,
</span><del>-        type: "uniformBuffer"
</del><ins>+        type: "uniform-buffer"
</ins><span class="cx">     };
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -157,7 +157,7 @@
</span><span class="cx">     const layoutUR = createUniformBufferBindGroupLayout(bindingNums.UR);
</span><span class="cx">     const layoutLL = createUniformBufferBindGroupLayout(bindingNums.LL);
</span><span class="cx">     const layoutLR = createUniformBufferBindGroupLayout(bindingNums.LR);
</span><del>-    const layoutG = createUniformBufferBindGroupLayout(bindingNums.G, WebGPUShaderStageBit.FRAGMENT);
</del><ins>+    const layoutG = createUniformBufferBindGroupLayout(bindingNums.G, GPUShaderStageBit.FRAGMENT);
</ins><span class="cx"> 
</span><span class="cx">     // WebGPUBindGroupLayouts
</span><span class="cx">     const leftTriangleBGLayout = device.createBindGroupLayout({ bindings: [layoutUL, layoutUM, layoutLL, layoutG] });
</span></span></pre></div>
<a id="trunkLayoutTestswebgpupipelinelayoutshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgpu/pipeline-layouts.html (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/pipeline-layouts.html   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/webgpu/pipeline-layouts.html      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -9,16 +9,16 @@
</span><span class="cx"> function createBindGroupLayoutBinding() {
</span><span class="cx">     return {
</span><span class="cx">         binding: 0,
</span><del>-        visibility: WebGPUShaderStageBit.FRAGMENT | WebGPUShaderStageBit.VERTEX,
-        type: "storageBuffer"
</del><ins>+        visibility: GPUShaderStageBit.FRAGMENT | GPUShaderStageBit.VERTEX,
+        type: "storage-buffer"
</ins><span class="cx">     };
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> test(() => {
</span><span class="cx">     const bindGroupLayoutDescriptor = { bindings: [createBindGroupLayoutBinding()] };
</span><del>-    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & WebGPUShaderStageBit.FRAGMENT, 0);
-    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & WebGPUShaderStageBit.VERTEX, 0);
-    assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storageBuffer");
</del><ins>+    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.FRAGMENT, 0);
+    assert_not_equals(bindGroupLayoutDescriptor.bindings[0].visibility & GPUShaderStageBit.VERTEX, 0);
+    assert_equals(bindGroupLayoutDescriptor.bindings[0].type, "storage-buffer");
</ins><span class="cx"> }, "Create a basic WebGPUBindGroupLayoutDescriptor."); 
</span><span class="cx"> 
</span><span class="cx"> promise_test(async () => {
</span></span></pre></div>
<a id="trunkLayoutTestswebgpurenderpipelineshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgpu/render-pipelines.html (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/render-pipelines.html   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/LayoutTests/webgpu/render-pipelines.html      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     const device = await getBasicDevice();
</span><span class="cx">     const shaderModule = device.createShaderModule({ code: shaderCode });
</span><span class="cx"> 
</span><del>-    const layoutBinding = { binding: 0, visibility: WebGPUShaderStageBit.VERTEX, type: "storageBuffer" };
</del><ins>+    const layoutBinding = { binding: 0, visibility: GPUShaderStageBit.VERTEX, type: "storage-buffer" };
</ins><span class="cx">     const bindGroupLayout = device.createBindGroupLayout({ bindings: [layoutBinding] });
</span><span class="cx">     const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestswebgpuresourcesbluecheckeredpng"></a>
<div class="binary"><h4>Added: trunk/LayoutTests/webgpu/resources/blue-checkered.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Index: trunk/LayoutTests/webgpu/resources/blue-checkered.png
</span><span class="cx">===================================================================
</span><del>--- trunk/LayoutTests/webgpu/resources/blue-checkered.png       2019-03-06 23:43:41 UTC (rev 242574)
</del><ins>+++ trunk/LayoutTests/webgpu/resources/blue-checkered.png        2019-03-06 23:57:58 UTC (rev 242575)
</ins><span class="cx">Property changes on: trunk/LayoutTests/webgpu/resources/blue-checkered.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+image/png
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestswebgputexturetrianglestripexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/texture-triangle-strip-expected.html (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/texture-triangle-strip-expected.html                            (rev 0)
+++ trunk/LayoutTests/webgpu/texture-triangle-strip-expected.html       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>HTML Reference File</title>
+<p>Pass if square canvas below is a 4 by 4 blue/green checkerboard.</p>
+<canvas width="400" height="400"></canvas>
+<script>
+const canvas = document.querySelector("canvas");
+const context = canvas.getContext('2d');
+
+context.fillStyle = 'rgb(0, 255, 0)';
+context.fillRect(0, 0, canvas.width, canvas.height);
+
+const numColumns = 4;
+const numRows = 4;
+context.beginPath();
+context.fillStyle = 'rgb(0, 0, 255)';
+for (let x = 0; x < numColumns; ++x) {
+    for (let y = 0; y < numRows; ++y) {
+        if (x % 2 == 0 && y % 2 == 0 || x % 2 == 1 && y % 2 == 1)
+            context.rect(
+                x * canvas.width / numColumns, 
+                y * canvas.height / numRows, 
+                canvas.width / numColumns, 
+                canvas.height / numRows
+                );
+    }
+}
+context.fill();
+</script>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestswebgputexturetrianglestriphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/webgpu/texture-triangle-strip.html (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgpu/texture-triangle-strip.html                             (rev 0)
+++ trunk/LayoutTests/webgpu/texture-triangle-strip.html        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>WebGPU Hello Triangles</title>
+<meta name="assert" content="WebGPU correctly renders a green canvas.">
+<link rel="match" href="vertex-buffer-triangle-strip-expected.html">
+<p>Pass if square canvas below is a 4 by 4 blue/green checkerboard.</p>
+<canvas width="400" height="400"></canvas>
+<script src="js/webgpu-functions.js"></script>
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+const shaderCode = `
+#include <metal_stdlib>
+    
+using namespace metal;
+
+struct VertexIn
+{
+    float4 position [[attribute(0)]];
+    float2 texCoords [[attribute(1)]];
+};
+
+struct VertexOut
+{
+    float4 position [[position]];
+    float2 texCoords;
+};
+
+vertex VertexOut vertex_main(VertexIn vertexIn [[stage_in]])
+{
+    VertexOut vOut;
+    vOut.position = vertexIn.position;
+    vOut.texCoords = vertexIn.texCoords;
+    return vOut;
+}
+
+struct Texture
+{
+    texture2d<float> image [[id(0)]];
+};
+
+fragment float4 fragment_main(VertexOut v [[stage_in]], const device Texture& t [[buffer(0)]])
+{
+    constexpr sampler s(coord::normalized, address::clamp_to_zero, filter::nearest);
+    return t.image.sample(s, v.texCoords);
+}
+`
+
+function createInputStateDescriptor() {
+    return {
+        indexFormat: WebGPUIndexFormat.UINT32,
+        attributes: [{
+            shaderLocation: 0,
+            inputSlot: 0,
+            offset: 0,
+            format: WebGPUVertexFormat.FLOAT_R32_G32_B32_A32
+        }, {
+            shaderLocation: 1,
+            inputSlot: 1,
+            offset: 0,
+            format: WebGPUVertexFormat.FLOAT_R32_G32
+        }],
+        inputs: [{
+            inputSlot: 0,
+            stride: 4 * 4,
+            stepMode: WebGPUInputStepMode.VERTEX
+        }, {
+            inputSlot: 1,
+            stride: 4 * 2,
+            stepMode: WebGPUInputStepMode.VERTEX
+        }]
+    }
+}
+
+async function test() {
+    const device = await getBasicDevice();
+    const canvas = document.querySelector("canvas");
+    const context = createBasicContext(canvas, device);
+    // FIXME: Replace with non-MSL shaders.
+    const shaderModule = device.createShaderModule({ code: shaderCode });
+
+    const vertexArray = new Float32Array([
+        // float4 xyzw
+        -1, 1, 0, 1,
+        -1, -1, 0, 1,
+        1, 1, 0, 1, 
+        1, -1, 0, 1
+    ]);
+    const vertexBuffer = device.createBuffer({ size: vertexArray.byteLength, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.TRANSFER_DST });
+    vertexBuffer.setSubData(0, vertexArray.buffer);
+
+    const textureCoordArray = new Float32Array([
+        // float2 texCoords
+        0, 0,
+        0, 1,
+        1, 0,
+        1, 1
+    ]);
+    const textureCoordBuffer = device.createBuffer({ size: textureCoordArray.byteLength, usage: GPUBufferUsage.VERTEX | GPUBufferUsage.TRANSFER_DST });
+    textureCoordBuffer.setSubData(0, textureCoordArray.buffer);
+
+    const inputStateDescriptor = createInputStateDescriptor();
+
+    // Load texture image
+    const image = new Image();
+    const imageLoadPromise = new Promise(resolve => { 
+        image.onload = () => resolve(); 
+        image.src = "resources/blue-checkered.png";
+    });
+    await Promise.resolve(imageLoadPromise);
+
+    // Convert image to data and fill GPUBuffer
+    const canvas2d = document.createElement("canvas");
+    canvas2d.width = image.width;
+    canvas2d.height = image.height;
+    const context2d = canvas2d.getContext("2d");
+    context2d.drawImage(image, 0, 0);
+    const imageData = context2d.getImageData(0, 0, image.width, image.height);
+
+    const textureBufferDescriptor = {
+        size: imageData.data.length,
+        usage: GPUBufferUsage.TRANSFER_SRC | GPUBufferUsage.TRANSFER_DST
+    };
+    const textureBuffer = device.createBuffer(textureBufferDescriptor);
+    textureBuffer.setSubData(0, imageData.data.buffer);
+
+    // Create GPUTexture
+    const textureSize = {
+        width: image.width,
+        height: image.height,
+        depth: 1
+    };
+
+    const textureDescriptor = {
+        size: { width: image.width, height: image.height, depth: 1 },
+        arrayLayerCount: 1,
+        mipLevelCount: 1,
+        sampleCount: 1,
+        dimension: "2d",
+        format: "r8g8b8a8-unorm",
+        usage: GPUTextureUsage.TRANSFER_DST | GPUTextureUsage.SAMPLED
+    };
+    const texture = device.createTexture(textureDescriptor);
+
+    // Bind texture to pipeline
+    const textureBindingNum = 0;
+    const bindGroupLayoutDescriptor = {
+        bindings: [{ binding: textureBindingNum, visibility: GPUShaderStageBit.FRAGMENT, type: "sampled-texture" }]
+    };
+    bindGroupLayout = device.createBindGroupLayout(bindGroupLayoutDescriptor);
+    const pipelineLayout = device.createPipelineLayout({ bindGroupLayouts: [bindGroupLayout] });
+
+    const bindGroupDescriptor = {
+        layout: bindGroupLayout,
+        bindings: [{ binding: textureBindingNum, resource: texture.createDefaultTextureView() }]
+    };
+    const bindGroup = device.createBindGroup(bindGroupDescriptor);
+
+    // Pipeline and render
+    const pipeline = createBasicPipeline(shaderModule, device, pipelineLayout, inputStateDescriptor);
+    const commandBuffer = device.createCommandBuffer();
+
+    const bufferCopyView = {
+        buffer: textureBuffer,
+        offset: 0,
+        rowPitch: image.width * 4,
+        imageHeight: 0
+    };
+    const textureCopyView = {
+        texture: texture,
+        mipLevel: 0,
+        arrayLayer: 0,
+        origin: { x: 0, y: 0, z: 0 }
+    };
+    commandBuffer.copyBufferToTexture(bufferCopyView, textureCopyView, textureSize);
+    const passEncoder = beginBasicRenderPass(context, commandBuffer);
+    passEncoder.setPipeline(pipeline);
+    passEncoder.setBindGroup(0, bindGroup);
+    passEncoder.setVertexBuffers(0, [vertexBuffer, textureCoordBuffer], [0, 0]);
+    passEncoder.draw(4, 1, 0, 0);
+    passEncoder.endPass();
+
+    const queue = device.getQueue();
+    queue.submit([commandBuffer]);
+    vertexBuffer.destroy();
+    textureCoordBuffer.destroy();
+    texture.destroy();
+    context.present();
+
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+test();
+</script>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/CMakeLists.txt 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -462,6 +462,8 @@
</span><span class="cx">     Modules/webdriver/NavigatorWebDriver.idl
</span><span class="cx"> 
</span><span class="cx">     Modules/webgpu/DOMWindowWebGPU.idl
</span><ins>+    Modules/webgpu/GPUBindGroupLayoutBinding.idl
+    Modules/webgpu/GPUBindGroupLayoutDescriptor.idl
</ins><span class="cx">     Modules/webgpu/GPUBufferDescriptor.idl
</span><span class="cx">     Modules/webgpu/GPUBufferUsage.idl
</span><span class="cx">     Modules/webgpu/GPUColor.idl
</span><span class="lines">@@ -471,6 +473,7 @@
</span><span class="cx">     Modules/webgpu/GPULoadOp.idl
</span><span class="cx">     Modules/webgpu/GPUOrigin3D.idl
</span><span class="cx">     Modules/webgpu/GPURequestAdapterOptions.idl
</span><ins>+    Modules/webgpu/GPUShaderStageBit.idl
</ins><span class="cx">     Modules/webgpu/GPUStoreOp.idl
</span><span class="cx">     Modules/webgpu/GPUTextureDescriptor.idl
</span><span class="cx">     Modules/webgpu/GPUTextureDimension.idl
</span><span class="lines">@@ -482,8 +485,6 @@
</span><span class="cx">     Modules/webgpu/WebGPUBindGroupBinding.idl
</span><span class="cx">     Modules/webgpu/WebGPUBindGroupDescriptor.idl
</span><span class="cx">     Modules/webgpu/WebGPUBindGroupLayout.idl
</span><del>-    Modules/webgpu/WebGPUBindGroupLayoutBinding.idl
-    Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl
</del><span class="cx">     Modules/webgpu/WebGPUBuffer.idl
</span><span class="cx">     Modules/webgpu/WebGPUBufferBinding.idl
</span><span class="cx">     Modules/webgpu/WebGPUCommandBuffer.idl
</span><span class="lines">@@ -504,7 +505,6 @@
</span><span class="cx">     Modules/webgpu/WebGPURenderingContext.idl
</span><span class="cx">     Modules/webgpu/WebGPUShaderModule.idl
</span><span class="cx">     Modules/webgpu/WebGPUShaderModuleDescriptor.idl
</span><del>-    Modules/webgpu/WebGPUShaderStageBit.idl
</del><span class="cx">     Modules/webgpu/WebGPUSwapChain.idl
</span><span class="cx">     Modules/webgpu/WebGPUTexture.idl
</span><span class="cx">     Modules/webgpu/WebGPUTextureView.idl
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/ChangeLog      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,3 +1,127 @@
</span><ins>+2019-03-06  Justin Fan  <justin_fan@apple.com>
+
+        [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
+        https://bugs.webkit.org/show_bug.cgi?id=195347
+
+        Reviewed by Dean Jackson.
+
+        Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and 
+        GPUTextureView implementations. Rename various bind group classes to GPU* to match API.
+
+        Test: webgpu/texture-triangle-strip.html
+
+        * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
+        (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
+        * Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
+        (WebCore::WebGPUCommandBuffer::copyBufferToTexture):
+        (WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
+        (WebCore::WebGPUCommandBuffer::copyTextureToTexture):
+        * Modules/webgpu/WebGPUCommandBuffer.h:
+        (WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
+        * Modules/webgpu/WebGPUDevice.cpp:
+        (WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
+        * Modules/webgpu/WebGPUDevice.h: Ditto.
+        * Modules/webgpu/WebGPUDevice.idl: Ditto.
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
+        (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
+        * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
+        * Modules/webgpu/WebGPUQueue.cpp:
+        (WebCore::WebGPUQueue::submit):
+        * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
+        (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
+        * Modules/webgpu/WebGPUTexture.cpp:
+        (WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
+        (WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
+        (WebCore::WebGPUTexture::destroy):
+        (WebCore::WebGPUTexture::destroyImpl):
+        * Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
+        * Modules/webgpu/WebGPUTexture.idl: Enable destroy.
+        * Modules/webgpu/WebGPUTextureView.cpp:
+        (WebCore::WebGPUTextureView::create):
+        (WebCore::WebGPUTextureView::WebGPUTextureView):
+        (WebCore::WebGPUTextureView::destroy):
+        * Modules/webgpu/WebGPUTextureView.h:
+        (WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
+        (WebCore::WebGPUTextureView::texture const):
+        (WebCore::WebGPUTextureView::texture): Deleted.
+        * platform/graphics/gpu/GPUBindGroupLayout.h:
+        * platform/graphics/gpu/GPUCommandBuffer.h:
+        (WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
+        (WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
+        (WebCore::GPUCommandBuffer::setIsEncodingPass):
+        (WebCore::GPUCommandBuffer::useTexture):
+        * platform/graphics/gpu/GPUDevice.cpp:
+        (WebCore::GPUDevice::tryCreateBindGroupLayout const):
+        * platform/graphics/gpu/GPUDevice.h:
+        * platform/graphics/gpu/GPUPipelineLayout.cpp:
+        (WebCore::GPUPipelineLayout::GPUPipelineLayout):
+        * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
+        (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
+        * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
+        (WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
+        (WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
+        (): Deleted.
+        * platform/graphics/gpu/GPUQueue.h:
+        * platform/graphics/gpu/GPURenderPassEncoder.h:
+        * platform/graphics/gpu/GPUTexture.h:
+        (WebCore::GPUTexture::isReadOnly const):
+        (WebCore::GPUTexture::destroy):
+        * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
+        (WebCore::MTLDataTypeForBindingType):
+        (WebCore::GPUBindGroupLayout::tryCreate):
+        * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
+        (WebCore::GPUCommandBuffer::create):
+        (WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
+        (WebCore::GPUCommandBuffer::endBlitEncoding):
+        (WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
+        (WebCore::GPUCommandBuffer::copyTextureToBuffer):
+        (WebCore::GPUCommandBuffer::copyTextureToTexture):
+        * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
+        (WebCore::GPUDevice::create):
+        (WebCore::GPUDevice::GPUDevice):
+        * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
+        (WebCore::GPUProgrammablePassEncoder::endPass):
+        (WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
+        (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
+        (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
+        * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
+        (WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
+        * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
+        (WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
+        (WebCore::GPURenderPassEncoder::platformPassEncoder const):
+        (WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
+        (WebCore::GPURenderPassEncoder::setPipeline):
+        (WebCore::GPURenderPassEncoder::setVertexBuffers):
+        (WebCore::GPURenderPassEncoder::draw):
+        (WebCore::GPURenderPassEncoder::useResource):
+        (WebCore::GPURenderPassEncoder::setVertexBuffer):
+        (WebCore::GPURenderPassEncoder::setFragmentBuffer):
+        * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
+        (WebCore::GPUSwapChain::getNextTexture):
+        * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
+        (WebCore::storageModeForPixelFormatAndSampleCount): 
+                Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
+        (WebCore::tryCreateMtlTextureDescriptor):
+        (WebCore::GPUTexture::create):
+        (WebCore::GPUTexture::GPUTexture):
+        (WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.
+
+        Update files and symbols in project:
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
+        * Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
+        * Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
+        * Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
+        * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
+        * Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
+        * Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/WebCoreBuiltinNames.h:
+
</ins><span class="cx"> 2019-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [WHLSL] Pack and unpack data at entry points and exit points
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesinputxcfilelist"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources-input.xcfilelist     2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -321,6 +321,8 @@
</span><span class="cx"> $(PROJECT_DIR)/Modules/webdatabase/SQLTransactionErrorCallback.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webdriver/NavigatorWebDriver.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/DOMWindowWebGPU.idl
</span><ins>+$(PROJECT_DIR)/Modules/webgpu/GPUBindGroupLayoutBinding.idl
+$(PROJECT_DIR)/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl
</ins><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUBufferDescriptor.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUBufferUsage.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUColor.idl
</span><span class="lines">@@ -330,6 +332,7 @@
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPULoadOp.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUOrigin3D.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPURequestAdapterOptions.idl
</span><ins>+$(PROJECT_DIR)/Modules/webgpu/GPUShaderStageBit.idl
</ins><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUStoreOp.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUTextureDescriptor.idl
</span><span class="cx"> $(PROJECT_DIR)/Modules/webgpu/GPUTextureDimension.idl
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesoutputxcfilelist"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources-output.xcfilelist    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -577,6 +577,10 @@
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSFontFaceSet.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGCObservation.cpp
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGCObservation.h
</span><ins>+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBindGroupLayoutBinding.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBindGroupLayoutBinding.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBindGroupLayoutDescriptor.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBindGroupLayoutDescriptor.h
</ins><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferDescriptor.cpp
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferDescriptor.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUBufferUsage.cpp
</span><span class="lines">@@ -595,6 +599,8 @@
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUOrigin3D.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPURequestAdapterOptions.cpp
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPURequestAdapterOptions.h
</span><ins>+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUShaderStageBit.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUShaderStageBit.h
</ins><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUStoreOp.cpp
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUStoreOp.h
</span><span class="cx"> $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSGPUTextureDescriptor.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make 2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/DerivedSources.make    2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -373,6 +373,8 @@
</span><span class="cx">     $(WebCore)/Modules/webdriver/NavigatorWebDriver.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUColor.idl \
</span><ins>+    $(WebCore)/Modules/webgpu/GPUBindGroupLayoutBinding.idl \
+    $(WebCore)/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl \
</ins><span class="cx">     $(WebCore)/Modules/webgpu/GPUBufferDescriptor.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUBufferUsage.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUCompareFunction.idl \
</span><span class="lines">@@ -381,6 +383,7 @@
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPULoadOp.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUOrigin3D.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPURequestAdapterOptions.idl \
</span><ins>+    $(WebCore)/Modules/webgpu/GPUShaderStageBit.idl \
</ins><span class="cx">     $(WebCore)/Modules/webgpu/GPUStoreOp.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUTextureDescriptor.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/GPUTextureDimension.idl \
</span><span class="lines">@@ -392,8 +395,6 @@
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUBindGroupBinding.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUBindGroupDescriptor.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUBindGroupLayout.idl \
</span><del>-    $(WebCore)/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl \
-    $(WebCore)/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl \
</del><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUBuffer.idl \
</span><span class="cx">  $(WebCore)/Modules/webgpu/WebGPUBufferBinding.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUCommandBuffer.idl \
</span><span class="lines">@@ -414,7 +415,6 @@
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPURenderingContext.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUShaderModule.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUShaderModuleDescriptor.idl \
</span><del>-    $(WebCore)/Modules/webgpu/WebGPUShaderStageBit.idl \
</del><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUSwapChain.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUTexture.idl \
</span><span class="cx">     $(WebCore)/Modules/webgpu/WebGPUTextureView.idl \
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesstreamsWebGPUBindGroupLayoutDescriptorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,38 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUBindGroupLayoutDescriptor.h"
-
-namespace WebCore {
-
-using WebGPUBindGroupLayoutDescriptor = GPUBindGroupLayoutDescriptor;
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutBindinghfromrev242571trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutBindingh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h (from rev 242571, trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h                          (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+/*
+ * Copyright (C) 2018 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUShaderStageBit.h"
+
+namespace WebCore {
+
+struct GPUBindGroupLayoutBinding {
+    enum class BindingType {
+        UniformBuffer,
+        DynamicUniformBuffer,
+        Sampler,
+        SampledTexture,
+        StorageBuffer,
+        DynamicStorageBuffer
+    };
+
+    unsigned long binding;
+    GPUShaderStageFlags visibility;
+    BindingType type;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutBindingidlfromrev242571trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutBindingidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl (from rev 242571, trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl                                (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+typedef unsigned long u32;
+typedef u32 GPUShaderStageFlags;
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] enum GPUBindingType {
+    "uniform-buffer",
+    "dynamic-uniform-buffer",
+    "sampler",
+    "sampled-texture",
+    "storage-buffer",
+    "dynamic-storage-buffer"
+    // TODO other binding types
+};
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary GPUBindGroupLayoutBinding {
+    u32 binding;
+    GPUShaderStageFlags visibility;
+    GPUBindingType type;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutDescriptorhfromrev242571trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutDescriptorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.h (from rev 242571, trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.h                               (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.h  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include "GPUBindGroupLayoutBinding.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct GPUBindGroupLayoutDescriptor {
+    Vector<GPUBindGroupLayoutBinding> bindings;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUBindGroupLayoutDescriptoridlfromrev242571trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutDescriptoridl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl (from rev 242571, trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl                             (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+[
+    Conditional=WEBGPU,
+    EnabledAtRuntime=WebGPU
+] dictionary GPUBindGroupLayoutDescriptor {
+    sequence<GPUBindGroupLayoutBinding> bindings;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUShaderStageBithfromrev242571trunkSourceWebCoreModulesstreamsWebGPUBindGroupLayoutDescriptorh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.h (from rev 242571, trunk/Source/WebCore/Modules/streams/WebGPUBindGroupLayoutDescriptor.h) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.h                          (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(WEBGPU)
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+using GPUShaderStageFlags = unsigned;
+
+class GPUShaderStageBit : public RefCounted<GPUShaderStageBit> {
+public:
+    enum Flags : GPUShaderStageFlags {
+        None = 0,
+        Vertex = 1 << 0,
+        Fragment = 1 << 1,
+        Compute = 1 << 2,
+    };
+};
+
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGPU)
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuGPUShaderStageBitidlfromrev242571trunkSourceWebCoreModuleswebgpuWebGPUShaderStageBitidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.idl (from rev 242571, trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl) (0 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.idl                                (rev 0)
+++ trunk/Source/WebCore/Modules/webgpu/GPUShaderStageBit.idl   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
+
+typedef unsigned long u32;
+
+[
+    Conditional=WEBGPU,
+    DoNotCheckConstants,
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
+] interface GPUShaderStageBit {
+    const u32 NONE = 0;
+    const u32 VERTEX = 1;
+    const u32 FRAGMENT = 2;
+    const u32 COMPUTE = 4;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUBindGroupDescriptorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.cpp   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -88,26 +88,32 @@
</span><span class="cx"> 
</span><span class="cx">         const auto layoutBinding = iterator->value;
</span><span class="cx"> 
</span><del>-        auto bindingResourceVisitor = WTF::makeVisitor([] (RefPtr<WebGPUTextureView> view) -> Optional<GPUBindingResource> {
-            // FIXME: Validate binding type with the texture's usage flags.
</del><ins>+        auto bindingResourceVisitor = WTF::makeVisitor([](const RefPtr<WebGPUTextureView>& view) -> Optional<GPUBindingResource> {
</ins><span class="cx">             if (!view)
</span><span class="cx">                 return WTF::nullopt;
</span><ins>+            auto texture = view->texture();
+            if (!texture)
+                return WTF::nullopt;
</ins><span class="cx"> 
</span><del>-            return static_cast<GPUBindingResource>(view->texture());
</del><ins>+            return static_cast<GPUBindingResource>(texture.releaseNonNull());
</ins><span class="cx">         }, [&layoutBinding, functionName] (WebGPUBufferBinding bufferBinding) -> Optional<GPUBindingResource> {
</span><del>-            if (!bufferBinding.buffer || !bufferBinding.buffer->buffer()) {
-                LOG(WebGPU, "%s: Invalid GPUBufferBinding for binding %lu in GPUBindGroupBindings!", functionName, layoutBinding.binding);
</del><ins>+            if (!bufferBinding.buffer)
</ins><span class="cx">                 return WTF::nullopt;
</span><del>-            }
-            if (!validateBufferBindingType(bufferBinding.buffer->buffer().get(), layoutBinding, functionName))
</del><ins>+            auto buffer = bufferBinding.buffer->buffer();
+            if (!buffer)
</ins><span class="cx">                 return WTF::nullopt;
</span><span class="cx"> 
</span><del>-            return static_cast<GPUBindingResource>(GPUBufferBinding { bufferBinding.buffer->buffer().releaseNonNull(), bufferBinding.offset, bufferBinding.size });
</del><ins>+            if (!validateBufferBindingType(buffer.get(), layoutBinding, functionName))
+                return WTF::nullopt;
+
+            return static_cast<GPUBindingResource>(GPUBufferBinding { buffer.releaseNonNull(), bufferBinding.offset, bufferBinding.size });
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         auto bindingResource = WTF::visit(bindingResourceVisitor, binding.resource);
</span><del>-        if (!bindingResource)
</del><ins>+        if (!bindingResource) {
+            LOG(WebGPU, "%s: Invalid resource for binding %lu!", functionName, layoutBinding.binding);
</ins><span class="cx">             return WTF::nullopt;
</span><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">         bindGroupBindings.uncheckedAppend(GPUBindGroupBinding { binding.binding, WTFMove(bindingResource.value()) });
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutBindingh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h       2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.h  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,41 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUBindGroupLayoutBinding.h"
-#include "WebGPUShaderStageBit.h"
-
-namespace WebCore {
-
-using WebGPUBindGroupLayoutBinding = GPUBindGroupLayoutBinding;
-using WebGPUBindingType = GPUBindGroupLayoutBinding::BindingType;
-using WebGPUShaderStageFlags = GPUShaderStageFlags;
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutBindingidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl     2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-typedef unsigned long u32;
-typedef u32 WebGPUShaderStageFlags;
-
-[
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
-] enum WebGPUBindingType {
-    "uniformBuffer",
-    "sampler",
-    "sampledTexture",
-    "storageBuffer"
-    // TODO other binding types
-};
-
-[
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
-] dictionary WebGPUBindGroupLayoutBinding {
-    u32 binding;
-    WebGPUShaderStageFlags visibility;
-    WebGPUBindingType type;
-};
-
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUBindGroupLayoutDescriptoridl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-[
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
-] dictionary WebGPUBindGroupLayoutDescriptor {
-    sequence<WebGPUBindGroupLayoutBinding> bindings;
-};
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUCommandBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.cpp 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Add Web GPU validation.
</span><span class="cx"> 
</span><del>-    m_commandBuffer->copyBufferToTexture(*gpuBufferView, *gpuTextureView, size);
</del><ins>+    m_commandBuffer->copyBufferToTexture(WTFMove(*gpuBufferView), WTFMove(*gpuTextureView), size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebGPUCommandBuffer::copyTextureToBuffer(const WebGPUTextureCopyView& srcTexture, const WebGPUBufferCopyView& dstBuffer, const GPUExtent3D& size)
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Add Web GPU validation.
</span><span class="cx"> 
</span><del>-    m_commandBuffer->copyTextureToBuffer(*gpuTextureView, *gpuBufferView, size);
</del><ins>+    m_commandBuffer->copyTextureToBuffer(WTFMove(*gpuTextureView), WTFMove(*gpuBufferView), size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebGPUCommandBuffer::copyTextureToTexture(const WebGPUTextureCopyView& src, const WebGPUTextureCopyView& dst, const GPUExtent3D& size)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Add Web GPU validation.
</span><span class="cx"> 
</span><del>-    m_commandBuffer->copyTextureToTexture(*gpuSrcView, *gpuDstView, size);
</del><ins>+    m_commandBuffer->copyTextureToTexture(WTFMove(*gpuSrcView), WTFMove(*gpuDstView), size);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUCommandBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandBuffer.h   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> public:
</span><span class="cx">     static Ref<WebGPUCommandBuffer> create(Ref<GPUCommandBuffer>&&);
</span><span class="cx"> 
</span><del>-    const GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
</del><ins>+    GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
</ins><span class="cx"> 
</span><span class="cx">     RefPtr<WebGPURenderPassEncoder> beginRenderPass(WebGPURenderPassDescriptor&&);
</span><span class="cx">     void copyBufferToBuffer(const WebGPUBuffer&, unsigned long srcOffset, const WebGPUBuffer&, unsigned long dstOffset, unsigned long size);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUDevicecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp     2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.cpp        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "GPUBindGroup.h"
</span><span class="cx"> #include "GPUBindGroupBinding.h"
</span><span class="cx"> #include "GPUBindGroupDescriptor.h"
</span><ins>+#include "GPUBindGroupLayoutDescriptor.h"
</ins><span class="cx"> #include "GPUBufferBinding.h"
</span><span class="cx"> #include "GPUBufferDescriptor.h"
</span><span class="cx"> #include "GPUCommandBuffer.h"
</span><span class="lines">@@ -41,7 +42,6 @@
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "WebGPUBindGroup.h"
</span><span class="cx"> #include "WebGPUBindGroupBinding.h"
</span><del>-#include "WebGPUBindGroupDescriptor.h"
</del><span class="cx"> #include "WebGPUBindGroupLayout.h"
</span><span class="cx"> #include "WebGPUBuffer.h"
</span><span class="cx"> #include "WebGPUBufferBinding.h"
</span><span class="lines">@@ -84,9 +84,9 @@
</span><span class="cx">     return WebGPUTexture::create(WTFMove(texture));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref<WebGPUBindGroupLayout> WebGPUDevice::createBindGroupLayout(WebGPUBindGroupLayoutDescriptor&& descriptor) const
</del><ins>+Ref<WebGPUBindGroupLayout> WebGPUDevice::createBindGroupLayout(const GPUBindGroupLayoutDescriptor& descriptor) const
</ins><span class="cx"> {
</span><del>-    auto layout = m_device->tryCreateBindGroupLayout(GPUBindGroupLayoutDescriptor { descriptor.bindings });
</del><ins>+    auto layout = m_device->tryCreateBindGroupLayout(descriptor);
</ins><span class="cx">     return WebGPUBindGroupLayout::create(WTFMove(layout));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUDeviceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h       2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.h  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include "GPUDevice.h"
</span><span class="cx"> #include "WebGPUAdapter.h"
</span><del>-#include "WebGPUBindGroupLayoutDescriptor.h"
</del><span class="cx"> #include "WebGPUQueue.h"
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/Ref.h>
</span><span class="lines">@@ -48,6 +47,7 @@
</span><span class="cx"> class WebGPUShaderModule;
</span><span class="cx"> class WebGPUTexture;
</span><span class="cx"> 
</span><ins>+struct GPUBindGroupLayoutDescriptor;
</ins><span class="cx"> struct GPUBufferDescriptor;
</span><span class="cx"> struct GPUTextureDescriptor;
</span><span class="cx"> struct WebGPUBindGroupDescriptor;
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">     Ref<WebGPUBuffer> createBuffer(GPUBufferDescriptor&&) const;
</span><span class="cx">     Ref<WebGPUTexture> createTexture(GPUTextureDescriptor&&) const;
</span><span class="cx"> 
</span><del>-    Ref<WebGPUBindGroupLayout> createBindGroupLayout(WebGPUBindGroupLayoutDescriptor&&) const;
</del><ins>+    Ref<WebGPUBindGroupLayout> createBindGroupLayout(const GPUBindGroupLayoutDescriptor&) const;
</ins><span class="cx">     Ref<WebGPUPipelineLayout> createPipelineLayout(WebGPUPipelineLayoutDescriptor&&) const;
</span><span class="cx">     Ref<WebGPUBindGroup> createBindGroup(WebGPUBindGroupDescriptor&&) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUDeviceidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl     2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUDevice.idl        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">     WebGPUBuffer createBuffer(GPUBufferDescriptor descriptor);
</span><span class="cx">     WebGPUTexture createTexture(GPUTextureDescriptor descriptor);
</span><span class="cx"> 
</span><del>-    WebGPUBindGroupLayout createBindGroupLayout(WebGPUBindGroupLayoutDescriptor descriptor);
</del><ins>+    WebGPUBindGroupLayout createBindGroupLayout(GPUBindGroupLayoutDescriptor descriptor);
</ins><span class="cx">     WebGPUPipelineLayout createPipelineLayout(WebGPUPipelineLayoutDescriptor descriptor);
</span><span class="cx">     WebGPUBindGroup createBindGroup(WebGPUBindGroupDescriptor descriptor);
</span><span class="cx"> 
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx">     // readonly attribute WebGPUExtensions extensions;
</span><span class="cx">     // readonly attribute WebGPULimits limits;
</span><span class="cx"> 
</span><del>-    // WebGPUTexture createTexture(WebGPUTextureDescriptor descriptor);
</del><span class="cx">     // WebGPUSampler createSampler(WebGPUSamplerDescriptor descriptor);
</span><span class="cx"> 
</span><span class="cx">     // WebGPUComputePipeline createComputePipeline(WebGPUComputePipelineDescriptor descriptor);
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUProgrammablePassEncodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.cpp       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx">     return m_commandBuffer.copyRef();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebGPUProgrammablePassEncoder::setBindGroup(unsigned long index, WebGPUBindGroup& bindGroup) const
</del><ins>+void WebGPUProgrammablePassEncoder::setBindGroup(unsigned index, WebGPUBindGroup& bindGroup) const
</ins><span class="cx"> {
</span><span class="cx">     // Maximum number of bind groups supported in Web GPU.
</span><span class="cx">     if (index >= 4) {
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUProgrammablePassEncoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUProgrammablePassEncoder.h 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx">     virtual ~WebGPUProgrammablePassEncoder() = default;
</span><span class="cx"> 
</span><span class="cx">     Ref<WebGPUCommandBuffer> endPass();
</span><del>-    void setBindGroup(unsigned long, WebGPUBindGroup&) const;
</del><ins>+    void setBindGroup(unsigned, WebGPUBindGroup&) const;
</ins><span class="cx">     void setPipeline(Ref<WebGPURenderPipeline>&&);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUQueuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUQueue.cpp 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> void WebGPUQueue::submit(Vector<RefPtr<WebGPUCommandBuffer>>&& buffers)
</span><span class="cx"> {
</span><del>-    auto gpuBuffers = buffers.map([] (const auto& buffer) -> Ref<const GPUCommandBuffer> {
</del><ins>+    auto gpuBuffers = buffers.map([] (auto& buffer) -> Ref<GPUCommandBuffer> {
</ins><span class="cx">         return buffer->commandBuffer();
</span><span class="cx">     });
</span><span class="cx">     m_queue->submit(WTFMove(gpuBuffers));
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPURenderPassDescriptorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.cpp       2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.cpp  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -56,21 +56,25 @@
</span><span class="cx">     Vector<GPURenderPassColorAttachmentDescriptor> gpuColorAttachments;
</span><span class="cx"> 
</span><span class="cx">     for (const auto& colorAttachment : colorAttachments) {
</span><del>-        if (!colorAttachment.attachment || !colorAttachment.attachment->texture()->isOutputAttachment()) {
</del><ins>+        if (!colorAttachment.attachment
+            || !colorAttachment.attachment->texture()
+            || !colorAttachment.attachment->texture()->isOutputAttachment()) {
</ins><span class="cx">             LOG(WebGPU, "GPURenderPassDescriptor: Invalid attachment in GPURenderPassColorAttachmentDescriptor!");
</span><span class="cx">             return WTF::nullopt;
</span><span class="cx">         }
</span><del>-        gpuColorAttachments.append(GPURenderPassColorAttachmentDescriptor { colorAttachment.attachment->texture(), colorAttachment });
</del><ins>+        gpuColorAttachments.append(GPURenderPassColorAttachmentDescriptor { colorAttachment.attachment->texture().releaseNonNull(), colorAttachment });
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Optional<GPURenderPassDepthStencilAttachmentDescriptor> gpuDepthAttachment;
</span><span class="cx"> 
</span><span class="cx">     if (depthStencilAttachment) {
</span><del>-        if (!depthStencilAttachment->attachment || !depthStencilAttachment->attachment->texture()->isOutputAttachment()) {
</del><ins>+        if (!depthStencilAttachment->attachment
+            || !depthStencilAttachment->attachment->texture()
+            || !depthStencilAttachment->attachment->texture()->isOutputAttachment()) {
</ins><span class="cx">             LOG(WebGPU, "GPURenderPassDescriptor: Invalid attachment in GPURenderPassDepthStencilAttachmentDescriptor!");
</span><span class="cx">             return WTF::nullopt;
</span><span class="cx">         }
</span><del>-        gpuDepthAttachment = GPURenderPassDepthStencilAttachmentDescriptor { depthStencilAttachment->attachment->texture(), *depthStencilAttachment };
</del><ins>+        gpuDepthAttachment = GPURenderPassDepthStencilAttachmentDescriptor { depthStencilAttachment->attachment->texture().releaseNonNull(), *depthStencilAttachment };
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return GPURenderPassDescriptor { WTFMove(gpuColorAttachments), WTFMove(gpuDepthAttachment) };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUShaderStageBith"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h       2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,38 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUBindGroupLayoutBinding.h"
-
-namespace WebCore {
-
-using WebGPUShaderStageBit = GPUShaderStageBit;
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUShaderStageBitidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl     2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl        2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,38 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl
-
-typedef unsigned long u32;
-
-[
-    Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU,
-    ImplementationLacksVTable
-] interface WebGPUShaderStageBit {
-    const u32 NONE = 0;
-    const u32 VERTEX = 1;
-    const u32 FRAGMENT = 2;
-    const u32 COMPUTE = 4;
-};
</del></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUTexturecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.cpp       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -42,13 +42,32 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<WebGPUTextureView> WebGPUTexture::createDefaultTextureView()
</del><ins>+Ref<WebGPUTextureView> WebGPUTexture::createDefaultTextureView()
</ins><span class="cx"> {
</span><del>-    if (auto gpuTexture = m_texture->createDefaultTextureView())
-        return WebGPUTextureView::create(gpuTexture.releaseNonNull());
-    return nullptr;
</del><ins>+    if (!m_texture) {
+        LOG(WebGPU, "GPUTexture::createDefaultTextureView(): Invalid operation!");
+        return WebGPUTextureView::create(nullptr);
+    }
+
+    auto view = WebGPUTextureView::create(m_texture->tryCreateDefaultTextureView());
+    m_textureViews.append(view.copyRef());
+    return view;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGPUTexture::destroy()
+{
+    if (!m_texture) {
+        LOG(WebGPU, "GPUTexture::destroy(): Invalid operation!");
+        return;
+    }
+    for (auto& view : m_textureViews)
+        view->destroy();
+    m_textureViews.clear();
+
+    m_texture->destroy();
+    m_texture = nullptr;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGPU)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUTextureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.h      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.h 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</span><ins>+#include <wtf/Vector.h>
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -42,12 +43,14 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr<GPUTexture> texture() const { return m_texture; }
</span><span class="cx"> 
</span><del>-    RefPtr<WebGPUTextureView> createDefaultTextureView();
</del><ins>+    Ref<WebGPUTextureView> createDefaultTextureView();
+    void destroy();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit WebGPUTexture(RefPtr<GPUTexture>&&);
</span><span class="cx"> 
</span><span class="cx">     RefPtr<GPUTexture> m_texture;
</span><ins>+    Vector<Ref<WebGPUTextureView>> m_textureViews;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUTextureidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.idl (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.idl    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUTexture.idl       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -30,9 +30,8 @@
</span><span class="cx">     ImplementationLacksVTable
</span><span class="cx"> ] interface WebGPUTexture {
</span><span class="cx">     WebGPUTextureView createDefaultTextureView();
</span><del>-/* Not Yet Implemented:
-    WebGPUTextureView createTextureView(WebGPUTextureViewDescriptor desc);
</del><ins>+    void destroy();
</ins><span class="cx"> 
</span><del>-    void destroy();
-*/
</del><ins>+    // Not Yet Implemented:
+    // WebGPUTextureView createTextureView(WebGPUTextureViewDescriptor desc);
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUTextureViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.cpp        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.cpp   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -28,18 +28,29 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBGPU)
</span><span class="cx"> 
</span><ins>+#include "GPUTexture.h"
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref<WebGPUTextureView> WebGPUTextureView::create(Ref<GPUTexture>&& view)
</del><ins>+Ref<WebGPUTextureView> WebGPUTextureView::create(RefPtr<GPUTexture>&& view)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new WebGPUTextureView(WTFMove(view)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-WebGPUTextureView::WebGPUTextureView(Ref<GPUTexture>&& view)
</del><ins>+WebGPUTextureView::WebGPUTextureView(RefPtr<GPUTexture>&& view)
</ins><span class="cx">     : m_texture(WTFMove(view))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebGPUTextureView::destroy()
+{
+    if (!m_texture)
+        return;
+
+    m_texture->destroy();
+    m_texture = nullptr;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(WEBGPU)
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebgpuWebGPUTextureViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.h  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUTextureView.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -27,21 +27,25 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBGPU)
</span><span class="cx"> 
</span><del>-#include "GPUTexture.h"
</del><span class="cx"> #include <wtf/Ref.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class GPUTexture;
+
</ins><span class="cx"> class WebGPUTextureView : public RefCounted<WebGPUTextureView> {
</span><span class="cx"> public:
</span><del>-    static Ref<WebGPUTextureView> create(Ref<GPUTexture>&&);
</del><ins>+    static Ref<WebGPUTextureView> create(RefPtr<GPUTexture>&&);
+    ~WebGPUTextureView() { destroy(); }
</ins><span class="cx"> 
</span><del>-    Ref<GPUTexture> texture() { return m_texture.copyRef(); }
</del><ins>+    RefPtr<GPUTexture> texture() const { return m_texture; }
+
+    void destroy();
</ins><span class="cx"> private:
</span><del>-    explicit WebGPUTextureView(Ref<GPUTexture>&&);
</del><ins>+    explicit WebGPUTextureView(RefPtr<GPUTexture>&&);
</ins><span class="cx">     
</span><del>-    Ref<GPUTexture> m_texture;
</del><ins>+    RefPtr<GPUTexture> m_texture;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/Sources.txt    2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -2771,6 +2771,8 @@
</span><span class="cx"> JSFontFace.cpp
</span><span class="cx"> JSFontFaceSet.cpp
</span><span class="cx"> JSGPUColor.cpp
</span><ins>+JSGPUBindGroupLayoutBinding.cpp
+JSGPUBindGroupLayoutDescriptor.cpp
</ins><span class="cx"> JSGPUBufferDescriptor.cpp
</span><span class="cx"> JSGPUBufferUsage.cpp
</span><span class="cx"> JSGPUCompareFunction.cpp
</span><span class="lines">@@ -2779,6 +2781,7 @@
</span><span class="cx"> JSGPULoadOp.cpp
</span><span class="cx"> JSGPUOrigin3D.cpp
</span><span class="cx"> JSGPURequestAdapterOptions.cpp
</span><ins>+JSGPUShaderStageBit.cpp
</ins><span class="cx"> JSGPUStoreOp.cpp
</span><span class="cx"> JSGPUTextureDescriptor.cpp
</span><span class="cx"> JSGPUTextureDimension.cpp
</span><span class="lines">@@ -3318,8 +3321,6 @@
</span><span class="cx"> JSWebGPUBindGroupBinding.cpp
</span><span class="cx"> JSWebGPUBindGroupDescriptor.cpp
</span><span class="cx"> JSWebGPUBindGroupLayout.cpp
</span><del>-JSWebGPUBindGroupLayoutBinding.cpp
-JSWebGPUBindGroupLayoutDescriptor.cpp
</del><span class="cx"> JSWebGPUBuffer.cpp
</span><span class="cx"> JSWebGPUBufferBinding.cpp
</span><span class="cx"> JSWebGPUCommandBuffer.cpp
</span><span class="lines">@@ -3340,7 +3341,6 @@
</span><span class="cx"> JSWebGPURenderPipelineDescriptor.cpp
</span><span class="cx"> JSWebGPUShaderModule.cpp
</span><span class="cx"> JSWebGPUShaderModuleDescriptor.cpp
</span><del>-JSWebGPUShaderStageBit.cpp
</del><span class="cx"> JSWebGPUSwapChain.cpp
</span><span class="cx"> JSWebGPUTexture.cpp
</span><span class="cx"> JSWebGPUTextureView.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -13974,7 +13974,6 @@
</span><span class="cx">          D026F489220A539800AC5F49 /* GPUTextureDimension.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDimension.idl; sourceTree = "<group>"; };
</span><span class="cx">          D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUTextureDescriptor.idl; sourceTree = "<group>"; };
</span><span class="cx">          D026F48C220A5BAD00AC5F49 /* GPUTextureDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUTextureDescriptor.h; sourceTree = "<group>"; };
</span><del>-               D02B83ED21C8397A00F85473 /* WebGPUBindGroupLayoutDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutDescriptor.idl; sourceTree = "<group>"; };
</del><span class="cx">           D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPURequestAdapterOptions.idl; sourceTree = "<group>"; };
</span><span class="cx">          D02F854E21682A4A0088EE74 /* WebMetalCommandQueue.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebMetalCommandQueue.idl; sourceTree = "<group>"; };
</span><span class="cx">          D02F855021682A560088EE74 /* WebMetalComputeCommandEncoder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebMetalComputeCommandEncoder.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -14074,8 +14073,6 @@
</span><span class="cx">          D06EF553220BA26A0018724E /* GPUUtilsMetal.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = GPUUtilsMetal.mm; sourceTree = "<group>"; };
</span><span class="cx">          D07DEAB70A36554A00CA30F8 /* InsertListCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = InsertListCommand.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D07DEAB80A36554A00CA30F8 /* InsertListCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = InsertListCommand.h; sourceTree = "<group>"; };
</span><del>-               D083D98421C48050008E8EFF /* GPUBindGroupLayoutDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayoutDescriptor.h; sourceTree = "<group>"; };
-               D083D98621C4813E008E8EFF /* WebGPUBindGroupLayoutDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebGPUBindGroupLayoutDescriptor.h; path = Modules/streams/WebGPUBindGroupLayoutDescriptor.h; sourceTree = SOURCE_ROOT; };
</del><span class="cx">           D084033A221CBF5400007205 /* GPUBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUBuffer.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D084033D221E186400007205 /* WebGPUBindGroupDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUBindGroupDescriptor.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0843A4A20FEBE3D00FE860E /* GraphicsContext3DManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GraphicsContext3DManager.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -14106,10 +14103,6 @@
</span><span class="cx">          D0B0556609C6700100307E43 /* CreateLinkCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CreateLinkCommand.h; sourceTree = "<group>"; };
</span><span class="cx">          D0B0556709C6700100307E43 /* CreateLinkCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CreateLinkCommand.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayoutBinding.h; sourceTree = "<group>"; };
</span><del>-               D0B8BB0321C4711D000C7681 /* WebGPUShaderStageBit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUShaderStageBit.h; sourceTree = "<group>"; };
-               D0B8BB0421C4711D000C7681 /* WebGPUShaderStageBit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUShaderStageBit.idl; sourceTree = "<group>"; };
-               D0B8BB0521C47256000C7681 /* WebGPUBindGroupLayoutBinding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBindGroupLayoutBinding.h; sourceTree = "<group>"; };
-               D0B8BB0621C47256000C7681 /* WebGPUBindGroupLayoutBinding.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUBindGroupLayoutBinding.idl; sourceTree = "<group>"; };
</del><span class="cx">           D0BC54481443AC4A00E105DA /* CachedStyleSheetClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedStyleSheetClient.h; sourceTree = "<group>"; };
</span><span class="cx">          D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationCommandIOS.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictationCommandIOS.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -14144,6 +14137,9 @@
</span><span class="cx">          D0CAAE9E216824A8001C91C7 /* WebMetalCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebMetalCommandBuffer.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0CCA94922299F97006979B6 /* GPUOrigin3D.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUOrigin3D.h; sourceTree = "<group>"; };
</span><span class="cx">          D0CCA94A22299F97006979B6 /* GPUOrigin3D.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUOrigin3D.idl; sourceTree = "<group>"; };
</span><ins>+               D0D69C9C222E00C20032927E /* GPUBindGroupLayoutDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBindGroupLayoutDescriptor.h; sourceTree = "<group>"; };
+               D0D69C9D222E00C20032927E /* GPUBindGroupLayoutDescriptor.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUBindGroupLayoutDescriptor.idl; sourceTree = "<group>"; };
+               D0D69C9F222E015E0032927E /* GPUBindGroupLayoutBinding.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUBindGroupLayoutBinding.idl; sourceTree = "<group>"; };
</ins><span class="cx">           D0D8648721B64CAA003C983C /* GPUBufferDescriptor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUBufferDescriptor.h; sourceTree = "<group>"; };
</span><span class="cx">          D0D8648C21B70676003C983C /* WebGPUBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUBuffer.h; sourceTree = "<group>"; };
</span><span class="cx">          D0D8648D21B70676003C983C /* WebGPUBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUBuffer.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -14162,6 +14158,8 @@
</span><span class="cx">          D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUSwapChain.h; sourceTree = "<group>"; };
</span><span class="cx">          D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUSwapChain.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUSwapChain.idl; sourceTree = "<group>"; };
</span><ins>+               D0DE8FB8222E09E200882550 /* GPUShaderStageBit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GPUShaderStageBit.h; sourceTree = "<group>"; };
+               D0DE8FB9222E09E200882550 /* GPUShaderStageBit.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = GPUShaderStageBit.idl; sourceTree = "<group>"; };
</ins><span class="cx">           D0EACF7621937228000FA75C /* WebGPUCommandBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUCommandBuffer.h; sourceTree = "<group>"; };
</span><span class="cx">          D0EACF7721937228000FA75C /* WebGPUCommandBuffer.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUCommandBuffer.cpp; sourceTree = "<group>"; };
</span><span class="cx">          D0EACF7821937228000FA75C /* WebGPUCommandBuffer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUCommandBuffer.idl; sourceTree = "<group>"; };
</span><span class="lines">@@ -18469,8 +18467,6 @@
</span><span class="cx">                          D0BE104E21E695E200E42A89 /* GPUBindGroupBinding.h */,
</span><span class="cx">                          D0BE105121E6A70E00E42A89 /* GPUBindGroupDescriptor.h */,
</span><span class="cx">                          D02454D021C4A41C00B73628 /* GPUBindGroupLayout.h */,
</span><del>-                               D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */,
-                               D083D98421C48050008E8EFF /* GPUBindGroupLayoutDescriptor.h */,
</del><span class="cx">                           D084033A221CBF5400007205 /* GPUBuffer.cpp */,
</span><span class="cx">                          D0D8649221B760F2003C983C /* GPUBuffer.h */,
</span><span class="cx">                          D0BE104A21E6872F00E42A89 /* GPUBufferBinding.h */,
</span><span class="lines">@@ -26080,6 +26076,10 @@
</span><span class="cx">                          D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */,
</span><span class="cx">                          D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */,
</span><span class="cx">                          D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */,
</span><ins>+                               D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */,
+                               D0D69C9F222E015E0032927E /* GPUBindGroupLayoutBinding.idl */,
+                               D0D69C9C222E00C20032927E /* GPUBindGroupLayoutDescriptor.h */,
+                               D0D69C9D222E00C20032927E /* GPUBindGroupLayoutDescriptor.idl */,
</ins><span class="cx">                           D01B811922135EB900627B6C /* GPUBufferDescriptor.idl */,
</span><span class="cx">                          D01B811C2213627300627B6C /* GPUBufferUsage.idl */,
</span><span class="cx">                          D01B811222125AFC00627B6C /* GPUColor.idl */,
</span><span class="lines">@@ -26090,6 +26090,8 @@
</span><span class="cx">                          D0CCA94922299F97006979B6 /* GPUOrigin3D.h */,
</span><span class="cx">                          D0CCA94A22299F97006979B6 /* GPUOrigin3D.idl */,
</span><span class="cx">                          D02C26922181416D00D818E4 /* GPURequestAdapterOptions.idl */,
</span><ins>+                               D0DE8FB8222E09E200882550 /* GPUShaderStageBit.h */,
+                               D0DE8FB9222E09E200882550 /* GPUShaderStageBit.idl */,
</ins><span class="cx">                           D08AA031220D0CE60058C502 /* GPUStoreOp.idl */,
</span><span class="cx">                          D026F48B220A5B0B00AC5F49 /* GPUTextureDescriptor.idl */,
</span><span class="cx">                          D026F489220A539800AC5F49 /* GPUTextureDimension.idl */,
</span><span class="lines">@@ -26112,10 +26114,6 @@
</span><span class="cx">                          D003287A21C8645B00622AA6 /* WebGPUBindGroupLayout.cpp */,
</span><span class="cx">                          D003287921C8645B00622AA6 /* WebGPUBindGroupLayout.h */,
</span><span class="cx">                          D003287B21C8645B00622AA6 /* WebGPUBindGroupLayout.idl */,
</span><del>-                               D0B8BB0521C47256000C7681 /* WebGPUBindGroupLayoutBinding.h */,
-                               D0B8BB0621C47256000C7681 /* WebGPUBindGroupLayoutBinding.idl */,
-                               D083D98621C4813E008E8EFF /* WebGPUBindGroupLayoutDescriptor.h */,
-                               D02B83ED21C8397A00F85473 /* WebGPUBindGroupLayoutDescriptor.idl */,
</del><span class="cx">                           D0D8648D21B70676003C983C /* WebGPUBuffer.cpp */,
</span><span class="cx">                          D0D8648C21B70676003C983C /* WebGPUBuffer.h */,
</span><span class="cx">                          D0D8648E21B70676003C983C /* WebGPUBuffer.idl */,
</span><span class="lines">@@ -26167,8 +26165,6 @@
</span><span class="cx">                          D0615FCE217FE5C6008A48A8 /* WebGPUShaderModule.idl */,
</span><span class="cx">                          D060D8872182697000339318 /* WebGPUShaderModuleDescriptor.h */,
</span><span class="cx">                          D060D88421825D5F00339318 /* WebGPUShaderModuleDescriptor.idl */,
</span><del>-                               D0B8BB0321C4711D000C7681 /* WebGPUShaderStageBit.h */,
-                               D0B8BB0421C4711D000C7681 /* WebGPUShaderStageBit.idl */,
</del><span class="cx">                           D0DA0BE5217930E2007FE2AC /* WebGPUSwapChain.cpp */,
</span><span class="cx">                          D0DA0BE4217930E2007FE2AC /* WebGPUSwapChain.h */,
</span><span class="cx">                          D0DA0BE6217930E2007FE2AC /* WebGPUSwapChain.idl */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsWebCoreBuiltinNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx">     macro(GamepadButton) \
</span><span class="cx">     macro(GamepadEvent) \
</span><span class="cx">     macro(GPUBufferUsage) \
</span><ins>+    macro(GPUShaderStageBit) \
</ins><span class="cx">     macro(GPUTextureUsage) \
</span><span class="cx">     macro(HTMLAttachmentElement) \
</span><span class="cx">     macro(HTMLAudioElement) \
</span><span class="lines">@@ -208,7 +209,6 @@
</span><span class="cx">     macro(WebGPURenderPassEncoder) \
</span><span class="cx">     macro(WebGPURenderPipeline) \
</span><span class="cx">     macro(WebGPUShaderModule) \
</span><del>-    macro(WebGPUShaderStageBit) \
</del><span class="cx">     macro(WebGPUSwapChain) \
</span><span class="cx">     macro(WebGPUTexture) \
</span><span class="cx">     macro(WebGPUTextureView) \
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayouth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayout.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> class GPUBindGroupLayout : public RefCounted<GPUBindGroupLayout> {
</span><span class="cx"> public:
</span><del>-    static RefPtr<GPUBindGroupLayout> tryCreate(const GPUDevice&, GPUBindGroupLayoutDescriptor&&);
</del><ins>+    static RefPtr<GPUBindGroupLayout> tryCreate(const GPUDevice&, const GPUBindGroupLayoutDescriptor&);
</ins><span class="cx"> 
</span><span class="cx">     using BindingsMapType = HashMap<unsigned long long, GPUBindGroupLayoutBinding, WTF::IntHash<unsigned long long>, WTF::UnsignedWithZeroKeyHashTraits<unsigned long long>>;
</span><span class="cx">     const BindingsMapType& bindingsMap() const { return m_bindingsMap; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutBindingh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,59 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-using GPUShaderStageFlags = unsigned long;
-
-class GPUShaderStageBit : public RefCounted<GPUShaderStageBit> {
-public:
-    static const GPUShaderStageFlags NONE = 0;
-    static const GPUShaderStageFlags VERTEX = 1;
-    static const GPUShaderStageFlags FRAGMENT = 2;
-    static const GPUShaderStageFlags COMPUTE = 4;
-};
-
-struct GPUBindGroupLayoutBinding {
-    enum class BindingType {
-        UniformBuffer,
-        Sampler,
-        SampledTexture,
-        StorageBuffer
-    };
-
-    unsigned long binding;
-    GPUShaderStageFlags visibility;
-    BindingType type;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUBindGroupLayoutDescriptorh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include "GPUBindGroupLayoutBinding.h"
-
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-struct GPUBindGroupLayoutDescriptor {
-    Vector<GPUBindGroupLayoutBinding> bindings;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGPU)
-
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUCommandBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUCommandBuffer.h       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -85,16 +85,22 @@
</span><span class="cx"> 
</span><span class="cx">     PlatformCommandBuffer* platformCommandBuffer() const { return m_platformCommandBuffer.get(); }
</span><span class="cx">     const Vector<Ref<GPUBuffer>>& usedBuffers() const { return m_usedBuffers; }
</span><ins>+    const Vector<Ref<GPUTexture>>& usedTextures() const { return m_usedTextures; }
+    bool isEncodingPass() const { return m_isEncodingPass; }
+
+    void setIsEncodingPass(bool isEncoding) { m_isEncodingPass = isEncoding; }
</ins><span class="cx"> #if USE(METAL)
</span><del>-    MTLBlitCommandEncoder *blitEncoder() const;
</del><ins>+    ~GPUCommandBuffer();
+    void endBlitEncoding();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void copyBufferToBuffer(Ref<GPUBuffer>&&, unsigned long srcOffset, Ref<GPUBuffer>&&, unsigned long dstOffset, unsigned long size);
</span><del>-    void copyBufferToTexture(const GPUBufferCopyView&, const GPUTextureCopyView&, const GPUExtent3D&);
-    void copyTextureToBuffer(const GPUTextureCopyView&, const GPUBufferCopyView&, const GPUExtent3D&);
-    void copyTextureToTexture(const GPUTextureCopyView&, const GPUTextureCopyView&, const GPUExtent3D&);
</del><ins>+    void copyBufferToTexture(GPUBufferCopyView&&, GPUTextureCopyView&&, const GPUExtent3D&);
+    void copyTextureToBuffer(GPUTextureCopyView&&, GPUBufferCopyView&&, const GPUExtent3D&);
+    void copyTextureToTexture(GPUTextureCopyView&&, GPUTextureCopyView&&, const GPUExtent3D&);
</ins><span class="cx"> 
</span><span class="cx">     void useBuffer(Ref<GPUBuffer>&& buffer) { m_usedBuffers.append(WTFMove(buffer)); }
</span><ins>+    void useTexture(Ref<GPUTexture>&& texture) { m_usedTextures.append(WTFMove(texture)); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     GPUCommandBuffer(PlatformCommandBufferSmartPtr&&);
</span><span class="lines">@@ -101,7 +107,10 @@
</span><span class="cx"> 
</span><span class="cx">     PlatformCommandBufferSmartPtr m_platformCommandBuffer;
</span><span class="cx">     Vector<Ref<GPUBuffer>> m_usedBuffers;
</span><ins>+    Vector<Ref<GPUTexture>> m_usedTextures;
+    bool m_isEncodingPass = false;
</ins><span class="cx"> #if USE(METAL)
</span><ins>+    MTLBlitCommandEncoder *blitEncoder() const;
</ins><span class="cx">     mutable RetainPtr<MTLBlitCommandEncoder> m_blitEncoder;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUDevicecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp 2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.cpp    2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -54,9 +54,9 @@
</span><span class="cx">     return GPUTexture::tryCreate(*this, WTFMove(descriptor));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<GPUBindGroupLayout> GPUDevice::tryCreateBindGroupLayout(GPUBindGroupLayoutDescriptor&& descriptor) const
</del><ins>+RefPtr<GPUBindGroupLayout> GPUDevice::tryCreateBindGroupLayout(const GPUBindGroupLayoutDescriptor& descriptor) const
</ins><span class="cx"> {
</span><del>-    return GPUBindGroupLayout::tryCreate(*this, WTFMove(descriptor));
</del><ins>+    return GPUBindGroupLayout::tryCreate(*this, descriptor);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref<GPUPipelineLayout> GPUDevice::createPipelineLayout(GPUPipelineLayoutDescriptor&& descriptor) const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUDeviceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h   2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h      2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     RefPtr<GPUBuffer> tryCreateBuffer(GPUBufferDescriptor&&);
</span><span class="cx">     RefPtr<GPUTexture> tryCreateTexture(GPUTextureDescriptor&&) const;
</span><span class="cx"> 
</span><del>-    RefPtr<GPUBindGroupLayout> tryCreateBindGroupLayout(GPUBindGroupLayoutDescriptor&&) const;
</del><ins>+    RefPtr<GPUBindGroupLayout> tryCreateBindGroupLayout(const GPUBindGroupLayoutDescriptor&) const;
</ins><span class="cx">     Ref<GPUPipelineLayout> createPipelineLayout(GPUPipelineLayoutDescriptor&&) const;
</span><span class="cx"> 
</span><span class="cx">     RefPtr<GPUShaderModule> createShaderModule(GPUShaderModuleDescriptor&&) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUPipelineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp 2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUPipelineLayout.cpp    2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> GPUPipelineLayout::GPUPipelineLayout(GPUPipelineLayoutDescriptor&& descriptor)
</span><del>-    : m_bindGroupLayouts(descriptor.bindGroupLayouts)
</del><ins>+    : m_bindGroupLayouts(WTFMove(descriptor.bindGroupLayouts))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUProgrammablePassEncodercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.cpp (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.cpp        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.cpp   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> GPUProgrammablePassEncoder::GPUProgrammablePassEncoder(Ref<GPUCommandBuffer>&& commandBuffer)
</span><span class="cx">     : m_commandBuffer(WTFMove(commandBuffer))
</span><span class="cx"> {
</span><ins>+    m_commandBuffer->setIsEncodingPass(true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUProgrammablePassEncoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUProgrammablePassEncoder.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -49,28 +49,28 @@
</span><span class="cx"> public:
</span><span class="cx">     virtual ~GPUProgrammablePassEncoder() = default;
</span><span class="cx"> 
</span><del>-    void endPass();
-    void setBindGroup(unsigned long, GPUBindGroup&);
</del><ins>+    virtual void endPass();
+    void setBindGroup(unsigned, GPUBindGroup&);
</ins><span class="cx">     virtual void setPipeline(Ref<GPURenderPipeline>&&) = 0;
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     GPUProgrammablePassEncoder(Ref<GPUCommandBuffer>&&);
</span><del>-    virtual PlatformProgrammablePassEncoder* platformPassEncoder() const = 0;
</del><span class="cx"> 
</span><span class="cx">     GPUCommandBuffer& commandBuffer() const { return m_commandBuffer.get(); }
</span><ins>+    virtual PlatformProgrammablePassEncoder* platformPassEncoder() const = 0;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx"> #if USE(METAL)
</span><del>-    void setResourceAsBufferOnEncoder(MTLArgumentEncoder *, const GPUBindingResource&, unsigned long, const char* const);
-    virtual void useResource(MTLResource *, unsigned long) = 0;
</del><ins>+    void setResourceAsBufferOnEncoder(MTLArgumentEncoder *, const GPUBindingResource&, unsigned, const char* const);
+    void setResourceAsTextureOnEncoder(MTLArgumentEncoder *, const GPUBindingResource&, unsigned, const char* const);
+    virtual void useResource(MTLResource *, unsigned) = 0;
</ins><span class="cx"> 
</span><span class="cx">     // Render command encoder methods.
</span><del>-    virtual void setVertexBuffer(MTLBuffer *, unsigned long, unsigned long) { }
-    virtual void setFragmentBuffer(MTLBuffer *, unsigned long, unsigned long) { }
</del><ins>+    virtual void setVertexBuffer(MTLBuffer *, unsigned, unsigned) { }
+    virtual void setFragmentBuffer(MTLBuffer *, unsigned, unsigned) { }
</ins><span class="cx"> #endif // USE(METAL)
</span><span class="cx"> 
</span><span class="cx">     Ref<GPUCommandBuffer> m_commandBuffer;
</span><del>-    bool m_isEncoding { true };
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUQueue.h       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> 
</span><span class="cx">     PlatformQueue* platformQueue() const { return m_platformQueue.get(); }
</span><span class="cx"> 
</span><del>-    void submit(Vector<Ref<const GPUCommandBuffer>>&&);
</del><ins>+    void submit(Vector<Ref<GPUCommandBuffer>>&&);
</ins><span class="cx"> 
</span><span class="cx">     String label() const;
</span><span class="cx">     void setLabel(const String&) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPURenderPassEncoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassEncoder.h   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> public:
</span><span class="cx">     static RefPtr<GPURenderPassEncoder> tryCreate(Ref<GPUCommandBuffer>&&, GPURenderPassDescriptor&&);
</span><span class="cx"> 
</span><ins>+    void endPass() final;
</ins><span class="cx">     void setPipeline(Ref<GPURenderPipeline>&&) final;
</span><span class="cx"> 
</span><span class="cx">     void setVertexBuffers(unsigned long, Vector<Ref<GPUBuffer>>&&, Vector<unsigned long long>&&);
</span><span class="lines">@@ -64,9 +65,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(METAL)
</span><span class="cx">     // GPUProgrammablePassEncoder
</span><del>-    void useResource(MTLResource *, unsigned long usage) final;
-    void setVertexBuffer(MTLBuffer *, unsigned long offset, unsigned long index) final;
-    void setFragmentBuffer(MTLBuffer *, unsigned long offset, unsigned long index) final;
</del><ins>+    void useResource(MTLResource *, unsigned usage) final;
+    void setVertexBuffer(MTLBuffer *, unsigned offset, unsigned index) final;
+    void setFragmentBuffer(MTLBuffer *, unsigned offset, unsigned index) final;
</ins><span class="cx"> #endif // USE(METAL)
</span><span class="cx"> 
</span><span class="cx">     PlatformRenderPassEncoderSmartPtr m_platformRenderPassEncoder;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpuGPUTextureh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h  2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUTexture.h     2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -53,8 +53,10 @@
</span><span class="cx">     bool isTransferSource() const { return m_usage.contains(GPUTextureUsage::Flags::TransferSource); }
</span><span class="cx">     bool isTransferDestination() const { return m_usage.contains(GPUTextureUsage::Flags::TransferDestination); }
</span><span class="cx">     bool isOutputAttachment() const { return m_usage.contains(GPUTextureUsage::Flags::OutputAttachment); }
</span><ins>+    bool isReadOnly() const { return m_usage.containsAny({ GPUTextureUsage::Flags::TransferSource, GPUTextureUsage::Flags::Sampled }); }
</ins><span class="cx"> 
</span><del>-    RefPtr<GPUTexture> createDefaultTextureView();
</del><ins>+    RefPtr<GPUTexture> tryCreateDefaultTextureView();
+    void destroy() { m_platformTexture = nullptr; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     explicit GPUTexture(PlatformTextureSmartPtr&&, OptionSet<GPUTextureUsage::Flags>);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUBindGroupLayoutMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -45,7 +45,9 @@
</span><span class="cx">     case GPUBindGroupLayoutBinding::BindingType::SampledTexture:
</span><span class="cx">         return MTLDataTypeTexture;
</span><span class="cx">     case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
</span><ins>+    case GPUBindGroupLayoutBinding::BindingType::DynamicUniformBuffer:
</ins><span class="cx">     case GPUBindGroupLayoutBinding::BindingType::StorageBuffer:
</span><ins>+    case GPUBindGroupLayoutBinding::BindingType::DynamicStorageBuffer:
</ins><span class="cx">         return MTLDataTypePointer;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +87,7 @@
</span><span class="cx">     return args;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-RefPtr<GPUBindGroupLayout> GPUBindGroupLayout::tryCreate(const GPUDevice& device, GPUBindGroupLayoutDescriptor&& descriptor)
</del><ins>+RefPtr<GPUBindGroupLayout> GPUBindGroupLayout::tryCreate(const GPUDevice& device, const GPUBindGroupLayoutDescriptor& descriptor)
</ins><span class="cx"> {
</span><span class="cx">     if (!device.platformDevice()) {
</span><span class="cx">         LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Invalid MTLDevice!");
</span><span class="lines">@@ -97,7 +99,7 @@
</span><span class="cx"> 
</span><span class="cx">     for (const auto& binding : descriptor.bindings) {
</span><span class="cx">         if (!bindingsMap.add(binding.binding, binding)) {
</span><del>-            LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Duplicate binding %lu found in WebGPUBindGroupLayoutDescriptor!", binding.binding);
</del><ins>+            LOG(WebGPU, "GPUBindGroupLayout::tryCreate(): Duplicate binding %lu found in GPUBindGroupLayoutDescriptor!", binding.binding);
</ins><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -115,11 +117,11 @@
</span><span class="cx">         mtlArgument.get().dataType = MTLDataTypeForBindingType(binding.type);
</span><span class="cx">         mtlArgument.get().index = binding.binding;
</span><span class="cx"> 
</span><del>-        if (binding.visibility & GPUShaderStageBit::VERTEX)
</del><ins>+        if (binding.visibility & GPUShaderStageBit::Flags::Vertex)
</ins><span class="cx">             appendArgumentToArray(vertexArgsArray, mtlArgument);
</span><del>-        if (binding.visibility & GPUShaderStageBit::FRAGMENT)
</del><ins>+        if (binding.visibility & GPUShaderStageBit::Flags::Fragment)
</ins><span class="cx">             appendArgumentToArray(fragmentArgsArray, mtlArgument);
</span><del>-        if (binding.visibility & GPUShaderStageBit::COMPUTE)
</del><ins>+        if (binding.visibility & GPUShaderStageBit::Flags::Compute)
</ins><span class="cx">             appendArgumentToArray(computeArgsArray, mtlArgument);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUCommandBufferMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    buffer = retainPtr([mtlQueue commandBuffer]);
</del><ins>+    buffer = [mtlQueue commandBuffer];
</ins><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="lines">@@ -75,11 +75,26 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+GPUCommandBuffer::~GPUCommandBuffer()
+{
+    endBlitEncoding();
+}
+
</ins><span class="cx"> MTLBlitCommandEncoder *GPUCommandBuffer::blitEncoder() const
</span><span class="cx"> {
</span><span class="cx">     return m_blitEncoder ? m_blitEncoder.get() : (m_blitEncoder = [m_platformCommandBuffer blitCommandEncoder]).get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GPUCommandBuffer::endBlitEncoding()
+{
+    if (!m_blitEncoder)
+        return;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [m_blitEncoder endEncoding];
+    END_BLOCK_OBJC_EXCEPTIONS;
+    m_blitEncoder = nullptr;
+}
+
</ins><span class="cx"> void GPUCommandBuffer::copyBufferToBuffer(Ref<GPUBuffer>&& src, unsigned long srcOffset, Ref<GPUBuffer>&& dst, unsigned long dstOffset, unsigned long size)
</span><span class="cx"> {
</span><span class="cx">     if (!src->isTransferSource() || !dst->isTransferDestination()) {
</span><span class="lines">@@ -117,7 +132,7 @@
</span><span class="cx">     useBuffer(WTFMove(dst));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUCommandBuffer::copyBufferToTexture(const GPUBufferCopyView& srcBuffer, const GPUTextureCopyView& dstTexture, const GPUExtent3D& size)
</del><ins>+void GPUCommandBuffer::copyBufferToTexture(GPUBufferCopyView&& srcBuffer, GPUTextureCopyView&& dstTexture, const GPUExtent3D& size)
</ins><span class="cx"> {
</span><span class="cx">     if (!srcBuffer.buffer->isTransferSource() || !dstTexture.texture->isTransferDestination()) {
</span><span class="cx">         LOG(WebGPU, "GPUComandBuffer::copyBufferToTexture(): Invalid operation!");
</span><span class="lines">@@ -151,10 +166,11 @@
</span><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    useBuffer(srcBuffer.buffer.copyRef());
</del><ins>+    useBuffer(WTFMove(srcBuffer.buffer));
+    useTexture(WTFMove(dstTexture.texture));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUCommandBuffer::copyTextureToBuffer(const GPUTextureCopyView& srcTexture, const GPUBufferCopyView& dstBuffer, const GPUExtent3D& size)
</del><ins>+void GPUCommandBuffer::copyTextureToBuffer(GPUTextureCopyView&& srcTexture, GPUBufferCopyView&& dstBuffer, const GPUExtent3D& size)
</ins><span class="cx"> {
</span><span class="cx">     if (!srcTexture.texture->isTransferSource() || !dstBuffer.buffer->isTransferDestination()) {
</span><span class="cx">         LOG(WebGPU, "GPUCommandBuffer::copyTextureToBuffer(): Invalid operation!");
</span><span class="lines">@@ -178,10 +194,11 @@
</span><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    useBuffer(dstBuffer.buffer.copyRef());
</del><ins>+    useTexture(WTFMove(srcTexture.texture));
+    useBuffer(WTFMove(dstBuffer.buffer));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUCommandBuffer::copyTextureToTexture(const GPUTextureCopyView& src, const GPUTextureCopyView& dst, const GPUExtent3D& size)
</del><ins>+void GPUCommandBuffer::copyTextureToTexture(GPUTextureCopyView&& src, GPUTextureCopyView&& dst, const GPUExtent3D& size)
</ins><span class="cx"> {
</span><span class="cx">     if (!src.texture->isTransferSource() || !dst.texture->isTransferDestination()) {
</span><span class="cx">         LOG(WebGPU, "GPUCommandBuffer::copyTextureToTexture(): Invalid operation!");
</span><span class="lines">@@ -204,6 +221,9 @@
</span><span class="cx">         destinationOrigin:MTLOriginMake(dst.origin.x, dst.origin.y, dst.origin.z)];
</span><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><ins>+
+    useTexture(WTFMove(src.texture));
+    useTexture(WTFMove(dst.texture));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUDeviceMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm       2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm  2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr<GPUDevice> GPUDevice::create(Optional<GPURequestAdapterOptions>&& options)
</span><span class="cx"> {
</span><del>-    PlatformDeviceSmartPtr devicePtr;
</del><ins>+    RetainPtr<MTLDevice> devicePtr;
</ins><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx">     
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">         
</span><span class="cx">         for (id <MTLDevice> device : devices.get()) {
</span><span class="cx">             if (device.lowPower) {
</span><del>-                devicePtr = retainPtr(device);
</del><ins>+                devicePtr = device;
</ins><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     return adoptRef(new GPUDevice(WTFMove(devicePtr)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-GPUDevice::GPUDevice(PlatformDeviceSmartPtr&& device)
</del><ins>+GPUDevice::GPUDevice(RetainPtr<MTLDevice>&& device)
</ins><span class="cx">     : m_platformDevice(WTFMove(device))
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUProgrammablePassEncoderMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -38,15 +38,73 @@
</span><span class="cx"> 
</span><span class="cx"> void GPUProgrammablePassEncoder::endPass()
</span><span class="cx"> {
</span><del>-    if (!m_isEncoding)
-        return;
</del><ins>+    ASSERT(platformPassEncoder());
</ins><span class="cx"> 
</span><ins>+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
</ins><span class="cx">     [platformPassEncoder() endEncoding];
</span><del>-    m_isEncoding = false;
</del><ins>+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    m_commandBuffer->setIsEncodingPass(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder(MTLArgumentEncoder *argumentEncoder, const GPUBindingResource& resource, unsigned long index, const char* const functionName)
</del><ins>+void GPUProgrammablePassEncoder::setBindGroup(unsigned index, GPUBindGroup& bindGroup)
</ins><span class="cx"> {
</span><ins>+    const char* const functionName = "GPUProgrammablePassEncoder::setBindGroup()";
+
+    if (!platformPassEncoder()) {
+        LOG(WebGPU, "%s: Invalid operation: Encoding is ended!");
+        return;
+    }
+
+    const auto& vertexArgs = bindGroup.layout().vertexArguments();
+    const auto& fragmentArgs = bindGroup.layout().fragmentArguments();
+    // FIXME: Finish support for compute.
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
+    if (vertexArgs.buffer)
+        setVertexBuffer(vertexArgs.buffer.get(), 0, index);
+    if (fragmentArgs.buffer)
+        setFragmentBuffer(fragmentArgs.buffer.get(), 0, index);
+
+    END_BLOCK_OBJC_EXCEPTIONS;
+
+    // Set each resource on each MTLArgumentEncoder it should be visible on.
+    const auto& bindingsMap = bindGroup.layout().bindingsMap();
+    for (const auto& binding : bindGroup.bindings()) {
+        auto iterator = bindingsMap.find(binding.binding);
+        if (iterator == bindingsMap.end()) {
+            LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, binding.binding);
+            return;
+        }
+        auto bindGroupLayoutBinding = iterator->value;
+
+        switch (bindGroupLayoutBinding.type) {
+        // FIXME: Support more resource types.
+        case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
+        case GPUBindGroupLayoutBinding::BindingType::StorageBuffer: {
+            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::Flags::Vertex)
+                setResourceAsBufferOnEncoder(vertexArgs.encoder.get(), binding.resource, binding.binding, functionName);
+            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::Flags::Fragment)
+                setResourceAsBufferOnEncoder(fragmentArgs.encoder.get(), binding.resource, binding.binding, functionName);
+            break;
+        }
+        case GPUBindGroupLayoutBinding::BindingType::SampledTexture: {
+            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::Flags::Vertex)
+                setResourceAsTextureOnEncoder(vertexArgs.encoder.get(), binding.resource, binding.binding, functionName);
+            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::Flags::Fragment)
+                setResourceAsTextureOnEncoder(fragmentArgs.encoder.get(), binding.resource, binding.binding, functionName);
+            break;
+        }
+        default:
+            LOG(WebGPU, "%s: Resource type not yet implemented.", functionName);
+            return;
+        }
+    }
+}
+
+void GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder(MTLArgumentEncoder *argumentEncoder, const GPUBindingResource& resource, unsigned index, const char* const functionName)
+{
</ins><span class="cx"> #if LOG_DISABLED
</span><span class="cx">     UNUSED_PARAM(functionName);
</span><span class="cx"> #endif
</span><span class="lines">@@ -79,51 +137,37 @@
</span><span class="cx">     m_commandBuffer->useBuffer(bufferRef.copyRef());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUProgrammablePassEncoder::setBindGroup(unsigned long index, GPUBindGroup& bindGroup)
</del><ins>+void GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder(MTLArgumentEncoder *argumentEncoder, const GPUBindingResource& resource, unsigned index, const char* const functionName)
</ins><span class="cx"> {
</span><del>-    const char* const functionName = "GPUProgrammablePassEncoder::setBindGroup()";
</del><span class="cx"> #if LOG_DISABLED
</span><span class="cx">     UNUSED_PARAM(functionName);
</span><span class="cx"> #endif
</span><ins>+    if (!argumentEncoder) {
+        LOG(WebGPU, "%s: No argument encoder for requested stage found!", functionName);
+        return;
+    }
</ins><span class="cx"> 
</span><del>-    const auto& vertexArgs = bindGroup.layout().vertexArguments();
-    const auto& fragmentArgs = bindGroup.layout().fragmentArguments();
-    // FIXME: Finish support for compute.
</del><ins>+    if (!WTF::holds_alternative<Ref<GPUTexture>>(resource)) {
+        LOG(WebGPU, "%s: Resource is not a texture type!", functionName);
+        return;
+    }
</ins><span class="cx"> 
</span><ins>+    auto& textureRef = WTF::get<Ref<GPUTexture>>(resource);
+    auto mtlTexture = textureRef->platformTexture();
+
+    if (!mtlTexture) {
+        LOG(WebGPU, "%s: Invalid MTLTexture in GPUTextureView binding!", functionName);
+        return;
+    }
+
</ins><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    if (vertexArgs.buffer)
-        setVertexBuffer(vertexArgs.buffer.get(), 0, index);
-    if (fragmentArgs.buffer)
-        setFragmentBuffer(fragmentArgs.buffer.get(), 0, index);
</del><ins>+    [argumentEncoder setTexture:mtlTexture atIndex:index];
+    useResource(mtlTexture, textureRef->isReadOnly() ? MTLResourceUsageRead : MTLResourceUsageRead | MTLResourceUsageWrite);
</ins><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    // Set each resource on each MTLArgumentEncoder it should be visible on.
-    const auto& bindingsMap = bindGroup.layout().bindingsMap();
-    for (const auto& binding : bindGroup.bindings()) {
-        auto iterator = bindingsMap.find(binding.binding);
-        if (iterator == bindingsMap.end()) {
-            LOG(WebGPU, "%s: GPUBindGroupBinding %lu not found in GPUBindGroupLayout!", functionName, binding.binding);
-            return;
-        }
-        auto bindGroupLayoutBinding = iterator->value;
-
-        switch (bindGroupLayoutBinding.type) {
-        // FIXME: Support more resource types.
-        case GPUBindGroupLayoutBinding::BindingType::UniformBuffer:
-        case GPUBindGroupLayoutBinding::BindingType::StorageBuffer: {
-            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::VERTEX)
-                setResourceAsBufferOnEncoder(vertexArgs.encoder.get(), binding.resource, binding.binding, functionName);
-            if (bindGroupLayoutBinding.visibility & GPUShaderStageBit::FRAGMENT)
-                setResourceAsBufferOnEncoder(fragmentArgs.encoder.get(), binding.resource, binding.binding, functionName);
-            break;
-        }
-        default:
-            LOG(WebGPU, "%s: Resource type not yet implemented.", functionName);
-            return;
-        }
-    }
</del><ins>+    m_commandBuffer->useTexture(textureRef.copyRef());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUQueueMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm        2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUQueueMetal.mm   2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -70,13 +70,12 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPUQueue::submit(Vector<Ref<const GPUCommandBuffer>>&& commandBuffers)
</del><ins>+void GPUQueue::submit(Vector<Ref<GPUCommandBuffer>>&& commandBuffers)
</ins><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="cx">     for (auto& commandBuffer : commandBuffers) {
</span><del>-        if (commandBuffer->blitEncoder())
-            [commandBuffer->blitEncoder() endEncoding];
</del><ins>+        commandBuffer->endBlitEncoding();
</ins><span class="cx">         // Prevent any buffer mapping callbacks from executing until command buffer is complete.
</span><span class="cx">         for (auto& buffer : commandBuffer->usedBuffers()) {
</span><span class="cx">             if (buffer->state() != GPUBuffer::State::Unmapped) {
</span><span class="lines">@@ -85,6 +84,13 @@
</span><span class="cx">             }
</span><span class="cx">             buffer->commandBufferCommitted(commandBuffer->platformCommandBuffer());
</span><span class="cx">         }
</span><ins>+        // Also ensure textures are still valid.
+        for (auto& texture : commandBuffer->usedTextures()) {
+            if (!texture->platformTexture()) {
+                LOG(WebGPU, "GPUQueue::submit(): Invalid GPUTexture set on a GPUCommandBuffer!");
+                return;
+            }
+        }
</ins><span class="cx"> 
</span><span class="cx">         [commandBuffer->platformCommandBuffer() commit];
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPURenderPassEncoderMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -117,6 +117,12 @@
</span><span class="cx"> {
</span><span class="cx">     const char* const functionName = "GPURenderPassEncoder::tryCreate()";
</span><span class="cx"> 
</span><ins>+    // Only one command encoder may be active at a time.
+    if (buffer->isEncodingPass()) {
+        LOG(WebGPU, "%s: Existing pass encoder must be ended first!");
+        return nullptr;
+    }
+
</ins><span class="cx">     RetainPtr<MTLRenderPassDescriptor> mtlDescriptor;
</span><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="lines">@@ -137,11 +143,13 @@
</span><span class="cx">         && !populateMtlDepthStencilAttachment(mtlDescriptor.get().depthAttachment, *descriptor.depthStencilAttachment, functionName))
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><ins>+    buffer->endBlitEncoding();
+
</ins><span class="cx">     RetainPtr<MTLRenderCommandEncoder> mtlEncoder;
</span><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    mtlEncoder = retainPtr([buffer->platformCommandBuffer() renderCommandEncoderWithDescriptor:mtlDescriptor.get()]);
</del><ins>+    mtlEncoder = [buffer->platformCommandBuffer() renderCommandEncoderWithDescriptor:mtlDescriptor.get()];
</ins><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="lines">@@ -149,7 +157,7 @@
</span><span class="cx">         LOG(WebGPU, "%s: Unable to create MTLRenderCommandEncoder!", functionName);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-
</del><ins>+    
</ins><span class="cx">     return adoptRef(new GPURenderPassEncoder(WTFMove(buffer), WTFMove(mtlEncoder)));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -159,13 +167,26 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PlatformProgrammablePassEncoder *GPURenderPassEncoder::platformPassEncoder() const
</del><ins>+MTLCommandEncoder *GPURenderPassEncoder::platformPassEncoder() const
</ins><span class="cx"> {
</span><span class="cx">     return m_platformRenderPassEncoder.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GPURenderPassEncoder::endPass()
+{
+    if (!m_platformRenderPassEncoder)
+        return;
+    GPUProgrammablePassEncoder::endPass();
+    m_platformRenderPassEncoder = nullptr;
+}
+
</ins><span class="cx"> void GPURenderPassEncoder::setPipeline(Ref<GPURenderPipeline>&& pipeline)
</span><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder::setPipeline(): Invalid operation: Encoding is ended!");
+        return;
+    }
+
</ins><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="cx">     if (pipeline->depthStencilState())
</span><span class="lines">@@ -180,6 +201,11 @@
</span><span class="cx"> 
</span><span class="cx"> void GPURenderPassEncoder::setVertexBuffers(unsigned long index, Vector<Ref<GPUBuffer>>&& buffers, Vector<unsigned long long>&& offsets)
</span><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder::setVertexBuffers(): Invalid operation: Encoding is ended!");
+        return;
+    }
+
</ins><span class="cx">     ASSERT(buffers.size() && offsets.size() == buffers.size());
</span><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="lines">@@ -214,6 +240,16 @@
</span><span class="cx"> 
</span><span class="cx"> void GPURenderPassEncoder::draw(unsigned long vertexCount, unsigned long instanceCount, unsigned long firstVertex, unsigned long firstInstance)
</span><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder::draw(): Invalid operation: Encoding is ended!");
+        return;
+    }
+
+    if (!m_pipeline) {
+        LOG(WebGPU, "GPURenderPassEncoder::draw(): No valid GPURenderPipeline found!");
+        return;
+    }
+
</ins><span class="cx">     [m_platformRenderPassEncoder 
</span><span class="cx">         drawPrimitives:primitiveTypeForGPUPrimitiveTopology(m_pipeline->primitiveTopology())
</span><span class="cx">         vertexStart:firstVertex
</span><span class="lines">@@ -224,18 +260,33 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(METAL)
</span><span class="cx"> 
</span><del>-void GPURenderPassEncoder::useResource(MTLResource *resource, unsigned long usage)
</del><ins>+void GPURenderPassEncoder::useResource(MTLResource *resource, unsigned usage)
</ins><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+        return;
+    }
+
</ins><span class="cx">     [m_platformRenderPassEncoder useResource:resource usage:usage];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPURenderPassEncoder::setVertexBuffer(MTLBuffer *buffer, unsigned long offset, unsigned long index)
</del><ins>+void GPURenderPassEncoder::setVertexBuffer(MTLBuffer *buffer, unsigned offset, unsigned index)
</ins><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+        return;
+    }
+
</ins><span class="cx">     [m_platformRenderPassEncoder setVertexBuffer:buffer offset:offset atIndex:index];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void GPURenderPassEncoder::setFragmentBuffer(MTLBuffer *buffer, unsigned long offset, unsigned long index)
</del><ins>+void GPURenderPassEncoder::setFragmentBuffer(MTLBuffer *buffer, unsigned offset, unsigned index)
</ins><span class="cx"> {
</span><ins>+    if (!m_platformRenderPassEncoder) {
+        LOG(WebGPU, "GPURenderPassEncoder: Invalid operation: Encoding is ended!");
+        return;
+    }
+
</ins><span class="cx">     [m_platformRenderPassEncoder setFragmentBuffer:buffer offset:offset atIndex:index];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUSwapChainMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm    2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm       2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="cx">     m_currentDrawable = retainPtr([m_platformSwapLayer nextDrawable]);
</span><del>-    mtlTexture = retainPtr([m_currentDrawable texture]);
</del><ins>+    mtlTexture = [m_currentDrawable texture];
</ins><span class="cx"> 
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsgpucocoaGPUTextureMetalmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUTextureMetal.mm (242574 => 242575)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUTextureMetal.mm      2019-03-06 23:43:41 UTC (rev 242574)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUTextureMetal.mm 2019-03-06 23:57:58 UTC (rev 242575)
</span><span class="lines">@@ -82,6 +82,7 @@
</span><span class="cx">     return MTLTextureUsageUnknown;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if !PLATFORM(MAC)
</ins><span class="cx"> static MTLStorageMode storageModeForPixelFormatAndSampleCount(MTLPixelFormat format, unsigned long samples)
</span><span class="cx"> {
</span><span class="cx">     // Depth, Stencil, DepthStencil, and Multisample textures must be allocated with the MTLStorageModePrivate resource option.
</span><span class="lines">@@ -88,12 +89,9 @@
</span><span class="cx">     if (format == MTLPixelFormatDepth32Float_Stencil8 || samples > 1)
</span><span class="cx">         return MTLStorageModePrivate;
</span><span class="cx"> 
</span><del>-#if PLATFORM(MAC)
-    return MTLStorageModeManaged;
-#else
</del><span class="cx">     return MTLStorageModeShared;
</span><ins>+}
</ins><span class="cx"> #endif
</span><del>-}
</del><span class="cx"> 
</span><span class="cx"> static RetainPtr<MTLTextureDescriptor> tryCreateMtlTextureDescriptor(const char* const functionName, const GPUTextureDescriptor& descriptor, OptionSet<GPUTextureUsage::Flags> usage)
</span><span class="cx"> {
</span><span class="lines">@@ -117,7 +115,11 @@
</span><span class="cx">     if (!mtlUsage)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC)
+    auto storageMode = MTLStorageModePrivate;
+#else
</ins><span class="cx">     auto storageMode = storageModeForPixelFormatAndSampleCount(pixelFormat, descriptor.sampleCount);
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><span class="lines">@@ -168,18 +170,18 @@
</span><span class="cx">     return adoptRef(new GPUTexture(WTFMove(mtlTexture), usage));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref<GPUTexture> GPUTexture::create(PlatformTextureSmartPtr&& texture, OptionSet<GPUTextureUsage::Flags> usage)
</del><ins>+Ref<GPUTexture> GPUTexture::create(RetainPtr<MTLTexture>&& texture, OptionSet<GPUTextureUsage::Flags> usage)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new GPUTexture(WTFMove(texture), usage));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-GPUTexture::GPUTexture(PlatformTextureSmartPtr&& texture, OptionSet<GPUTextureUsage::Flags> usage)
</del><ins>+GPUTexture::GPUTexture(RetainPtr<MTLTexture>&& texture, OptionSet<GPUTextureUsage::Flags> usage)
</ins><span class="cx">     : m_platformTexture(WTFMove(texture))
</span><span class="cx">     , m_usage(usage)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr<GPUTexture> GPUTexture::createDefaultTextureView()
</del><ins>+RefPtr<GPUTexture> GPUTexture::tryCreateDefaultTextureView()
</ins><span class="cx"> {
</span><span class="cx">     RetainPtr<MTLTexture> texture;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>