Changeset 246628 in webkit
- Timestamp:
- Jun 19, 2019, 8:18:37 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/webgpu/js/whlsl-test-harness.js (added)
-
LayoutTests/webgpu/whlsl-harness-test-expected.txt (added)
-
LayoutTests/webgpu/whlsl-harness-test.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp (modified) (3 diffs)
-
Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246625 r246628 1 2019-06-19 Justin Fan <justin_fan@apple.com> 2 3 [WHLSL] Create a shading language test harness 4 https://bugs.webkit.org/show_bug.cgi?id=198978 5 6 Reviewed by Myles C. Maxfield. 7 8 Introduce a test harness that can be used to test WebGPU shader compilation and functionality. 9 Currently using MSL. 10 Will be replaced with WHLSL as it gains the minimum features needed to support. 11 12 * webgpu/js/whlsl-test-harness.js: Added. 13 (isVectorType): 14 (convertTypeToArrayType): 15 (convertTypeToWHLSLType): 16 (Data): 17 (Data.prototype.async.getArrayBuffer): 18 (Data.prototype.get type): 19 (Data.prototype.get isPointer): 20 (Data.prototype.get buffer): 21 (Data.prototype.get byteLength): 22 (Harness.prototype._initialize): 23 (Harness.prototype.async.callTypedFunction): 24 (Harness.prototype.async.callVoidFunction): 25 (Harness.prototype._setUpArguments): 26 (Harness.prototype._callFunction): 27 (Harness): 28 (harness._initialize.async): 29 (makeBool): 30 (makeInt): 31 (makeUchar): 32 (makeUint): 33 (makeFloat): 34 (makeFloat4): 35 (async.callBoolFunction): 36 (async.callIntFunction): 37 (async.callUcharFunction): 38 (async.callUintFunction): 39 (async.callFloatFunction): 40 (async.callFloat4Function): 41 (callVoidFunction): 42 * webgpu/whlsl-harness-test-expected.txt: Added. 43 * webgpu/whlsl-harness-test.html: Added. 44 1 45 2019-06-19 Saam Barati <sbarati@apple.com> 2 46 -
trunk/Source/WebCore/ChangeLog
r246625 r246628 1 2019-06-19 Justin Fan <justin_fan@apple.com> 2 3 [WHLSL] Create a shading language test harness 4 https://bugs.webkit.org/show_bug.cgi?id=198978 5 6 Reviewed by Myles C. Maxfield. 7 8 When creating MTLArgumentEncoders for argument buffers, the user's arguments 9 must match the order that they are declared in the shader. Move back-end information 10 such as buffer lengths to the end of the argument arrays. 11 12 Test: webgpu/whlsl-harness-test.html 13 14 * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp: 15 (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes): 16 * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: 17 (WebCore::GPUBindGroupLayout::tryCreate): 18 1 19 2019-06-19 Saam Barati <sbarati@apple.com> 2 20 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp
r246515 r246628 38 38 #include "WHLSLStructureDefinition.h" 39 39 #include "WHLSLTypeNamer.h" 40 #include <algorithm> 40 41 #include <wtf/Optional.h> 41 42 #include <wtf/text/StringBuilder.h> … … 144 145 for (size_t i = 0; i < m_layout.size(); ++i) { 145 146 stringBuilder.append(makeString("struct ", m_namedBindGroups[i].structName, " {\n")); 147 Vector<std::pair<unsigned, String>> structItems; 146 148 for (size_t j = 0; j < m_layout[i].bindings.size(); ++j) { 147 149 auto iterator = m_resourceMap.find(&m_layout[i].bindings[j]); … … 154 156 auto elementName = m_namedBindGroups[i].namedBindings[j].elementName; 155 157 auto index = m_namedBindGroups[i].namedBindings[j].index; 156 str ingBuilder.append(makeString(" ", addressSpace, " ", mangledTypeName, "* ", elementName, " [[id(", index, ")]];\n"));158 structItems.append(std::make_pair(index, makeString(" ", addressSpace, " ", mangledTypeName, "* ", elementName, " [[id(", index, ")]];\n"))); 157 159 if (auto lengthInformation = m_namedBindGroups[i].namedBindings[j].lengthInformation) 158 str ingBuilder.append(makeString(" uint2 ", lengthInformation->elementName, " [[id(", lengthInformation->index, ")]];\n"));160 structItems.append(std::make_pair(lengthInformation->index, makeString("uint2 ", lengthInformation->elementName, " [[id(", lengthInformation->index, ")]];"))); 159 161 } 162 std::sort(structItems.begin(), structItems.end(), [](const std::pair<unsigned, String>& left, const std::pair<unsigned, String>& right) { 163 return left.first < right.first; 164 }); 165 for (const auto& structItem : structItems) 166 stringBuilder.append(makeString(" ", structItem.second, '\n')); 160 167 stringBuilder.append("};\n\n"); 161 168 } -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm
r246394 r246628 97 97 } 98 98 99 ArgumentArray vertexArgs Array, fragmentArgsArray, computeArgsArray;99 ArgumentArray vertexArgs, fragmentArgs, computeArgs, vertexLengths, fragmentLengths, computeLengths; 100 100 BindingsMapType bindingsMap; 101 101 … … 138 138 } 139 139 140 auto addIndices = [&](ArgumentArray& ar ray) -> bool {141 appendArgumentToArray(ar ray, mtlArgument);140 auto addIndices = [&](ArgumentArray& args, ArgumentArray& lengths) -> bool { 141 appendArgumentToArray(args, mtlArgument); 142 142 if (extraIndex) { 143 143 RetainPtr<MTLArgumentDescriptor> mtlArgument = argumentDescriptor(MTLDataTypeUInt2, *extraIndex); … … 146 146 return false; 147 147 } 148 appendArgumentToArray( array, mtlArgument);148 appendArgumentToArray(lengths, mtlArgument); 149 149 } 150 150 return true; 151 151 }; 152 if ((binding.visibility & GPUShaderStageBit::Flags::Vertex) && !addIndices(vertexArgs Array))152 if ((binding.visibility & GPUShaderStageBit::Flags::Vertex) && !addIndices(vertexArgs, vertexLengths)) 153 153 return nullptr; 154 if ((binding.visibility & GPUShaderStageBit::Flags::Fragment) && !addIndices(fragmentArgs Array))154 if ((binding.visibility & GPUShaderStageBit::Flags::Fragment) && !addIndices(fragmentArgs, fragmentLengths)) 155 155 return nullptr; 156 if ((binding.visibility & GPUShaderStageBit::Flags::Compute) && !addIndices(computeArgs Array))156 if ((binding.visibility & GPUShaderStageBit::Flags::Compute) && !addIndices(computeArgs, computeLengths)) 157 157 return nullptr; 158 158 } 159 159 160 BEGIN_BLOCK_OBJC_EXCEPTIONS; 161 [vertexArgs addObjectsFromArray:vertexLengths.get()]; 162 [fragmentArgs addObjectsFromArray:fragmentLengths.get()]; 163 [computeArgs addObjectsFromArray:computeLengths.get()]; 164 END_BLOCK_OBJC_EXCEPTIONS; 165 160 166 RetainPtr<MTLArgumentEncoder> vertex, fragment, compute; 161 167 162 if (vertexArgs Array && !(vertex = tryCreateMtlArgumentEncoder(device, vertexArgsArray)))168 if (vertexArgs && !(vertex = tryCreateMtlArgumentEncoder(device, vertexArgs))) 163 169 return nullptr; 164 if (fragmentArgs Array && !(fragment = tryCreateMtlArgumentEncoder(device, fragmentArgsArray)))170 if (fragmentArgs && !(fragment = tryCreateMtlArgumentEncoder(device, fragmentArgs))) 165 171 return nullptr; 166 if (computeArgs Array && !(compute = tryCreateMtlArgumentEncoder(device, computeArgsArray)))172 if (computeArgs && !(compute = tryCreateMtlArgumentEncoder(device, computeArgs))) 167 173 return nullptr; 168 174
Note:
See TracChangeset
for help on using the changeset viewer.