⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285868 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 9:11:23 AM (5 years ago)
Author:
mmaxfield@apple.com
Message:

[WebGPU] Vertex and fragment shaders are not hooked up to pipeline creation
https://bugs.webkit.org/show_bug.cgi?id=233166

Reviewed by Dean Jackson.

I simply forgot to implement them in r285831.

  • pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp:

(PAL::WebGPU::supportedLimits):

  • pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:

(PAL::WebGPU::convertToBacking):

Location:
trunk/Source/WebCore/PAL
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/PAL/ChangeLog

    r285846 r285868  
     12021-11-16  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        [WebGPU] Vertex and fragment shaders are not hooked up to pipeline creation
     4        https://bugs.webkit.org/show_bug.cgi?id=233166
     5
     6        Reviewed by Dean Jackson.
     7
     8        I simply forgot to implement them in r285831.
     9
     10        * pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp:
     11        (PAL::WebGPU::supportedLimits):
     12        * pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:
     13        (PAL::WebGPU::convertToBacking):
     14
    1152021-11-15  Sam Weinig  <weinig@apple.com>
    216
  • trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp

    r285831 r285868  
    9090{
    9191    WGPUSupportedLimits limits;
    92     wgpuAdapterGetLimits(adapter, &limits);
     92    limits.nextInChain = nullptr;
     93    auto result = wgpuAdapterGetLimits(adapter, &limits);
     94    ASSERT_UNUSED(result, result);
    9395    return SupportedLimits::create(
    9496        limits.limits.maxTextureDimension1D,
  • trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp

    r285831 r285868  
    236236    auto label = descriptor.label.utf8();
    237237
     238    auto source = descriptor.code.utf8();
     239
     240    WGPUShaderModuleWGSLDescriptor backingWGSLDescriptor {
     241        {
     242            nullptr,
     243            WGPUSType_ShaderModuleWGSLDescriptor,
     244        },
     245        source.data(),
     246    };
     247
    238248    WGPUShaderModuleDescriptor backingDescriptor {
    239         nullptr,
     249        &backingWGSLDescriptor.chain,
    240250        label.data(),
    241251    };
     
    251261    auto entryPoint = descriptor.compute.entryPoint.utf8();
    252262
    253     Vector<CString> keys;
    254     keys.reserveInitialCapacity(descriptor.compute.constants.size());
     263    Vector<CString> constantNames;
     264    constantNames.reserveInitialCapacity(descriptor.compute.constants.size());
    255265    for (const auto& constant : descriptor.compute.constants)
    256         keys.uncheckedAppend(constant.key.utf8());
     266        constantNames.uncheckedAppend(constant.key.utf8());
    257267
    258268    Vector<WGPUConstantEntry> backingConstantEntries;
     
    262272        backingConstantEntries.uncheckedAppend(WGPUConstantEntry {
    263273            nullptr,
    264             keys[i].data(),
     274            constantNames[i].data(),
    265275            constant.value
    266276        });
     
    293303{
    294304    auto label = descriptor.label.utf8();
     305
     306    auto vertexEntryPoint = descriptor.vertex.entryPoint.utf8();
     307
     308    Vector<CString> vertexConstantNames;
     309    vertexConstantNames.reserveInitialCapacity(descriptor.vertex.constants.size());
     310    for (const auto& constant : descriptor.vertex.constants)
     311        vertexConstantNames.uncheckedAppend(constant.key.utf8());
     312
     313    Vector<WGPUConstantEntry> vertexConstantEntries;
     314    vertexConstantEntries.reserveInitialCapacity(descriptor.vertex.constants.size());
     315    for (size_t i = 0; i < descriptor.vertex.constants.size(); ++i) {
     316        const auto& constant = descriptor.vertex.constants[i];
     317        vertexConstantEntries.uncheckedAppend(WGPUConstantEntry {
     318            nullptr,
     319            vertexConstantNames[i].data(),
     320            constant.value,
     321        });
     322    }
    295323
    296324    Vector<Vector<WGPUVertexAttribute>> backingAttributes;
     
    345373        descriptor.depthStencil ? descriptor.depthStencil->depthBiasClamp : 0,
    346374    };
     375
     376    auto fragmentEntryPoint = descriptor.fragment ? descriptor.fragment->entryPoint.utf8() : CString("");
     377
     378    Vector<CString> fragmentConstantNames;
     379    if (descriptor.fragment) {
     380        fragmentConstantNames.reserveInitialCapacity(descriptor.fragment->constants.size());
     381        for (const auto& constant : descriptor.fragment->constants)
     382            fragmentConstantNames.uncheckedAppend(constant.key.utf8());
     383    }
     384
     385    Vector<WGPUConstantEntry> fragmentConstantEntries;
     386    if (descriptor.fragment) {
     387        fragmentConstantEntries.reserveInitialCapacity(descriptor.fragment->constants.size());
     388        for (size_t i = 0; i < descriptor.fragment->constants.size(); ++i) {
     389            const auto& constant = descriptor.fragment->constants[i];
     390            fragmentConstantEntries.uncheckedAppend(WGPUConstantEntry {
     391                nullptr,
     392                fragmentConstantNames[i].data(),
     393                constant.value,
     394            });
     395        }
     396    }
    347397
    348398    Vector<std::optional<WGPUBlendState>> blendStates;
     
    383433    WGPUFragmentState fragmentState {
    384434        nullptr,
    385         nullptr,
    386         nullptr,
    387         0,
    388         nullptr,
     435        descriptor.fragment ? convertToBackingContext.convertToBacking(descriptor.fragment->module) : nullptr,
     436        fragmentEntryPoint.data(),
     437        static_cast<uint32_t>(fragmentConstantEntries.size()),
     438        fragmentConstantEntries.data(),
    389439        static_cast<uint32_t>(colorTargets.size()),
    390440        colorTargets.data(),
     
    396446        descriptor.layout ? convertToBackingContext.convertToBacking(*descriptor.layout) : nullptr, {
    397447            nullptr,
    398             nullptr,
    399             nullptr,
    400             0,
    401             nullptr,
     448            convertToBackingContext.convertToBacking(descriptor.vertex.module),
     449            vertexEntryPoint.data(),
     450            static_cast<uint32_t>(vertexConstantEntries.size()),
     451            vertexConstantEntries.data(),
    402452            static_cast<uint32_t>(backingBuffers.size()),
    403453            backingBuffers.data(),
  • trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.h

    r285831 r285868  
    4444    }
    4545
    46     ~DeviceImpl();
     46    virtual ~DeviceImpl();
    4747
    4848private:
  • trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPURenderBundleEncoderImpl.h

    r285831 r285868  
    4343    }
    4444
    45     ~RenderBundleEncoderImpl();
     45    virtual ~RenderBundleEncoderImpl();
    4646
    4747private:
  • trunk/Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPURenderPassEncoderImpl.h

    r285831 r285868  
    4343    }
    4444
    45     ~RenderPassEncoderImpl();
     45    virtual ~RenderPassEncoderImpl();
    4646
    4747private:
Note: See TracChangeset for help on using the changeset viewer.