Changeset 249373 in webkit


Ignore:
Timestamp:
Sep 1, 2019 9:38:38 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r249369.
https://bugs.webkit.org/show_bug.cgi?id=201394

broke WHLSL tests (Requested by litherum on #webkit).

Reverted changeset:

"[WHLSL] Resources don't work when only a subset of a bind
group is referenced by a shader"
https://bugs.webkit.org/show_bug.cgi?id=201383
https://trac.webkit.org/changeset/249369

Location:
trunk
Files:
6 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r249369 r249373  
     12019-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
    1152019-09-01  Myles C. Maxfield  <mmaxfield@apple.com>
    216
  • trunk/LayoutTests/webgpu/whlsl/compute.html

    r249369 r249373  
    7575    resultsBuffer.unmap();
    7676}
    77 
    7877window.jsTestIsAsync = true;
    7978getBasicDevice().then(function(device) {
  • trunk/Source/WebCore/ChangeLog

    r249371 r249373  
     12019-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
    1152019-09-01  Fujii Hironori  <Hironori.Fujii@sony.com>
    216
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp

    r249369 r249373  
    140140}
    141141
    142 void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent, ShaderStage shaderStage)
     142void EntryPointScaffolding::emitResourceHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent)
    143143{
    144144    for (size_t i = 0; i < m_layout.size(); ++i) {
     
    148148            Vector<std::pair<unsigned, String>> structItems;
    149149            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())
    152152                    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, ")]];")));
    187169                }
    188170            }
     
    444426    stringBuilder.append(indent, "};\n\n");
    445427   
    446     emitResourceHelperTypes(stringBuilder, indent, ShaderStage::Vertex);
     428    emitResourceHelperTypes(stringBuilder, indent);
    447429}
    448430
     
    549531    stringBuilder.append(indent, "};\n\n");
    550532
    551     emitResourceHelperTypes(stringBuilder, indent, ShaderStage::Fragment);
     533    emitResourceHelperTypes(stringBuilder, indent);
    552534}
    553535
     
    599581void ComputeEntryPointScaffolding::emitHelperTypes(StringBuilder& stringBuilder, Indentation<4> indent)
    600582{
    601     emitResourceHelperTypes(stringBuilder, indent, ShaderStage::Compute);
     583    emitResourceHelperTypes(stringBuilder, indent);
    602584}
    603585
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h

    r249369 r249373  
    6565    EntryPointScaffolding(AST::FunctionDefinition&, Intrinsics&, TypeNamer&, EntryPointItems&, HashMap<Binding*, size_t>& resourceMap, Layout&, std::function<MangledVariableName()>&& generateNextVariableName);
    6666
    67     void emitResourceHelperTypes(StringBuilder&, Indentation<4>, ShaderStage);
     67    void emitResourceHelperTypes(StringBuilder&, Indentation<4>);
    6868
    6969    enum class IncludePrecedingComma {
  • trunk/Source/WebCore/Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp

    r249369 r249373  
    6262{
    6363    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.
    6567    for (auto& bindGroup : layout) {
    6668        auto space = bindGroup.name;
     
    8183                    continue;
    8284                result.add(&binding, i);
    83                 itemIndices.add(i);
     85                itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted.
    8486            }
    8587        }
     
    9193        if (!WTF::holds_alternative<AST::ResourceSemantic>(semantic))
    9294            continue;
    93         if (!itemIndices.contains(i))
     95        if (!itemIndices.contains(i + 1))
    9496            return WTF::nullopt;
    9597    }
     
    141143{
    142144    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.
    144148    for (auto& vertexAttribute : vertexAttributes) {
    145149        for (size_t i = 0; i < vertexInputs.size(); ++i) {
     
    154158                return WTF::nullopt;
    155159            result.add(&vertexAttribute, i);
    156             itemIndices.add(i);
     160            itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted.
    157161        }
    158162    }
     
    163167        if (!WTF::holds_alternative<AST::StageInOutSemantic>(semantic))
    164168            continue;
    165         if (!itemIndices.contains(i))
     169        if (!itemIndices.contains(i + 1))
    166170            return WTF::nullopt;
    167171    }
     
    227231{
    228232    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.
    230236    for (auto& attachmentDescriptor : attachmentDescriptors) {
    231237        for (size_t i = 0; i < fragmentOutputs.size(); ++i) {
     
    240246                return WTF::nullopt;
    241247            result.add(&attachmentDescriptor, i);
    242             itemIndices.add(i);
     248            itemIndices.add(i + 1); // Work around the fact that HashSet's keys are restricted.
    243249        }
    244250    }
     
    249255        if (!WTF::holds_alternative<AST::StageInOutSemantic>(semantic))
    250256            continue;
    251         if (!itemIndices.contains(i))
     257        if (!itemIndices.contains(i + 1))
    252258            return WTF::nullopt;
    253259    }
  • trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm

    r249369 r249373  
    8585    END_BLOCK_OBJC_EXCEPTIONS;
    8686
    87     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=201384 This needs to set the "textureType" field
    8887    [mtlArgument setDataType:dataType];
    8988    [mtlArgument setIndex:index];
Note: See TracChangeset for help on using the changeset viewer.