Changeset 249373 in webkit
- Timestamp:
- Sep 1, 2019 9:38:38 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r249369 r249373 1 2019-09-01 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r249369. 4 https://bugs.webkit.org/show_bug.cgi?id=201394 5 6 broke WHLSL tests (Requested by litherum on #webkit). 7 8 Reverted changeset: 9 10 "[WHLSL] Resources don't work when only a subset of a bind 11 group is referenced by a shader" 12 https://bugs.webkit.org/show_bug.cgi?id=201383 13 https://trac.webkit.org/changeset/249369 14 1 15 2019-09-01 Myles C. Maxfield <mmaxfield@apple.com> 2 16 -
trunk/LayoutTests/webgpu/whlsl/compute.html
r249369 r249373 75 75 resultsBuffer.unmap(); 76 76 } 77 78 77 window.jsTestIsAsync = true; 79 78 getBasicDevice().then(function(device) { -
trunk/Source/WebCore/ChangeLog
r249371 r249373 1 2019-09-01 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r249369. 4 https://bugs.webkit.org/show_bug.cgi?id=201394 5 6 broke WHLSL tests (Requested by litherum on #webkit). 7 8 Reverted changeset: 9 10 "[WHLSL] Resources don't work when only a subset of a bind 11 group is referenced by a shader" 12 https://bugs.webkit.org/show_bug.cgi?id=201383 13 https://trac.webkit.org/changeset/249369 14 1 15 2019-09-01 Fujii Hironori <Hironori.Fujii@sony.com> 2 16 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp
r249369 r249373 140 140 } 141 141 142 void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent , ShaderStage shaderStage)142 void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent) 143 143 { 144 144 for (size_t i = 0; i < m_layout.size(); ++i) { … … 148 148 Vector<std::pair<unsigned, String>> structItems; 149 149 for (size_t j = 0; j < m_layout[i].bindings.size(); ++j) { 150 auto & binding = m_layout[i].bindings[j];151 if ( !binding.visibility.contains(shaderStage))150 auto iterator = m_resourceMap.find(&m_layout[i].bindings[j]); 151 if (iterator == m_resourceMap.end()) 152 152 continue; 153 154 auto elementName = m_namedBindGroups[i].namedBindings[j].elementName; 155 auto index = m_namedBindGroups[i].namedBindings[j].index; 156 if (auto lengthInformation = m_namedBindGroups[i].namedBindings[j].lengthInformation) 157 structItems.append(std::make_pair(lengthInformation->index, makeString("uint2 ", lengthInformation->elementName, " [[id(", lengthInformation->index, ")]];"))); 158 159 auto iterator = m_resourceMap.find(&m_layout[i].bindings[j]); 160 if (iterator != m_resourceMap.end()) { 161 auto& type = m_entryPointItems.inputs[iterator->value].unnamedType->unifyNode(); 162 if (is<AST::UnnamedType>(type) && is<AST::ReferenceType>(downcast<AST::UnnamedType>(type))) { 163 auto& referenceType = downcast<AST::ReferenceType>(downcast<AST::UnnamedType>(type)); 164 auto mangledTypeName = m_typeNamer.mangledNameForType(referenceType.elementType()); 165 auto addressSpace = toString(referenceType.addressSpace()); 166 structItems.append(std::make_pair(index, makeString(addressSpace, " ", mangledTypeName, "* ", elementName, " [[id(", index, ")]];"))); 167 } else if (is<AST::NamedType>(type) && is<AST::NativeTypeDeclaration>(downcast<AST::NamedType>(type))) { 168 auto& namedType = downcast<AST::NativeTypeDeclaration>(downcast<AST::NamedType>(type)); 169 auto mangledTypeName = m_typeNamer.mangledNameForType(namedType); 170 structItems.append(std::make_pair(index, makeString(mangledTypeName, ' ', elementName, " [[id(", index, ")]];"))); 171 } 172 } else { 173 // The binding doesn't appear in the shader source. 174 // However, we must still emit a placeholder, so successive items in the argument buffer struct have the correct offset. 175 // Because the binding doesn't appear in the shader source, we don't know which exact type the bind point should have. 176 // Therefore, we must synthesize a type out of thin air. 177 WTF::visit(WTF::makeVisitor([&](UniformBufferBinding) { 178 structItems.append(std::make_pair(index, makeString("constant void* ", elementName, " [[id(", index, ")]];"))); 179 }, [&](SamplerBinding) { 180 structItems.append(std::make_pair(index, makeString("sampler ", elementName, " [[id(", index, ")]];"))); 181 }, [&](TextureBinding) { 182 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=201384 We don't know which texture type the binding represents. This is no good very bad. 183 structItems.append(std::make_pair(index, makeString("texture2d<float4> ", elementName, " [[id(", index, ")]];"))); 184 }, [&](StorageBufferBinding) { 185 structItems.append(std::make_pair(index, makeString("device void* ", elementName, " [[id(", index, ")]];"))); 186 }), binding.binding); 153 auto& type = m_entryPointItems.inputs[iterator->value].unnamedType->unifyNode(); 154 if (is<AST::UnnamedType>(type) && is<AST::ReferenceType>(downcast<AST::UnnamedType>(type))) { 155 auto& referenceType = downcast<AST::ReferenceType>(downcast<AST::UnnamedType>(type)); 156 auto mangledTypeName = m_typeNamer.mangledNameForType(referenceType.elementType()); 157 auto addressSpace = toString(referenceType.addressSpace()); 158 auto elementName = m_namedBindGroups[i].namedBindings[j].elementName; 159 auto index = m_namedBindGroups[i].namedBindings[j].index; 160 structItems.append(std::make_pair(index, makeString(addressSpace, " ", mangledTypeName, "* ", elementName, " [[id(", index, ")]];"))); 161 if (auto lengthInformation = m_namedBindGroups[i].namedBindings[j].lengthInformation) 162 structItems.append(std::make_pair(lengthInformation->index, makeString("uint2 ", lengthInformation->elementName, " [[id(", lengthInformation->index, ")]];"))); 163 } else if (is<AST::NamedType>(type) && is<AST::NativeTypeDeclaration>(downcast<AST::NamedType>(type))) { 164 auto& namedType = downcast<AST::NativeTypeDeclaration>(downcast<AST::NamedType>(type)); 165 auto mangledTypeName = m_typeNamer.mangledNameForType(namedType); 166 auto elementName = m_namedBindGroups[i].namedBindings[j].elementName; 167 auto index = m_namedBindGroups[i].namedBindings[j].index; 168 structItems.append(std::make_pair(index, makeString(mangledTypeName, ' ', elementName, " [[id(", index, ")]];"))); 187 169 } 188 170 } … … 444 426 stringBuilder.append(indent, "};\n\n"); 445 427 446 emitResourceHelperTypes(stringBuilder, indent , ShaderStage::Vertex);428 emitResourceHelperTypes(stringBuilder, indent); 447 429 } 448 430 … … 549 531 stringBuilder.append(indent, "};\n\n"); 550 532 551 emitResourceHelperTypes(stringBuilder, indent , ShaderStage::Fragment);533 emitResourceHelperTypes(stringBuilder, indent); 552 534 } 553 535 … … 599 581 void ComputeEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent) 600 582 { 601 emitResourceHelperTypes(stringBuilder, indent , ShaderStage::Compute);583 emitResourceHelperTypes(stringBuilder, indent); 602 584 } 603 585 -
trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h
r249369 r249373 65 65 EntryPointScaffolding(AST::FunctionDefinition&, Intrinsics&, TypeNamer&, EntryPointItems&, HashMap<Binding*, size_t>& resourceMap, Layout&, std::function<MangledVariableName()>&& generateNextVariableName); 66 66 67 void emitResourceHelperTypes(StringBuilder&, Indentation<4> , ShaderStage);67 void emitResourceHelperTypes(StringBuilder&, Indentation<4>); 68 68 69 69 enum class IncludePrecedingComma { -
trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp
r249369 r249373 62 62 { 63 63 HashMap<Binding*, size_t> result; 64 HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<size_t>> itemIndices; 64 HashSet<size_t> itemIndices; 65 if (entryPointItems.size() == std::numeric_limits<size_t>::max()) 66 return WTF::nullopt; // Work around the fact that HashSet's keys are restricted. 65 67 for (auto& bindGroup : layout) { 66 68 auto space = bindGroup.name; … … 81 83 continue; 82 84 result.add(&binding, i); 83 itemIndices.add(i );85 itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted. 84 86 } 85 87 } … … 91 93 if (!WTF::holds_alternative<AST::ResourceSemantic>(semantic)) 92 94 continue; 93 if (!itemIndices.contains(i ))95 if (!itemIndices.contains(i + 1)) 94 96 return WTF::nullopt; 95 97 } … … 141 143 { 142 144 HashMap<VertexAttribute*, size_t> result; 143 HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<size_t>> itemIndices; 145 HashSet<size_t> itemIndices; 146 if (vertexInputs.size() == std::numeric_limits<size_t>::max()) 147 return WTF::nullopt; // Work around the fact that HashSet's keys are restricted. 144 148 for (auto& vertexAttribute : vertexAttributes) { 145 149 for (size_t i = 0; i < vertexInputs.size(); ++i) { … … 154 158 return WTF::nullopt; 155 159 result.add(&vertexAttribute, i); 156 itemIndices.add(i );160 itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted. 157 161 } 158 162 } … … 163 167 if (!WTF::holds_alternative<AST::StageInOutSemantic>(semantic)) 164 168 continue; 165 if (!itemIndices.contains(i ))169 if (!itemIndices.contains(i + 1)) 166 170 return WTF::nullopt; 167 171 } … … 227 231 { 228 232 HashMap<AttachmentDescriptor*, size_t> result; 229 HashSet<size_t, DefaultHash<size_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<size_t>> itemIndices; 233 HashSet<size_t> itemIndices; 234 if (attachmentDescriptors.size() == std::numeric_limits<size_t>::max()) 235 return WTF::nullopt; // Work around the fact that HashSet's keys are restricted. 230 236 for (auto& attachmentDescriptor : attachmentDescriptors) { 231 237 for (size_t i = 0; i < fragmentOutputs.size(); ++i) { … … 240 246 return WTF::nullopt; 241 247 result.add(&attachmentDescriptor, i); 242 itemIndices.add(i );248 itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted. 243 249 } 244 250 } … … 249 255 if (!WTF::holds_alternative<AST::StageInOutSemantic>(semantic)) 250 256 continue; 251 if (!itemIndices.contains(i ))257 if (!itemIndices.contains(i + 1)) 252 258 return WTF::nullopt; 253 259 } -
trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm
r249369 r249373 85 85 END_BLOCK_OBJC_EXCEPTIONS; 86 86 87 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=201384 This needs to set the "textureType" field88 87 [mtlArgument setDataType:dataType]; 89 88 [mtlArgument setIndex:index];
Note: See TracChangeset
for help on using the changeset viewer.