Title: [250032] trunk/Websites
Revision
250032
Author
mmaxfi...@apple.com
Date
2019-09-18 07:31:12 -0700 (Wed, 18 Sep 2019)

Log Message

[WebGPU] Update demos to work on STP 92
https://bugs.webkit.org/show_bug.cgi?id=201872

Reviewed by Dean Jackson.

Websites/browserbench.org:

GPUShaderStageBit => GPUShaderStage

* MotionMark1.1/tests/3d/resources/webgpu.js:
(Stage.call.initialize):

Websites/webkit.org:

Updating for new WSL buffer layouts.
Updating for new WSL compiler struct validation rules.
GPUShaderStageBit => GPUShaderStage
GPUColorWriteBits => GPUColorWrite
GPUBufferUsage.TRANSFER_DST => GPUBufferUsage.COPY_DST
GPUBufferUsage.TRANSFER_SRC => GPUBufferUsage.COPY_SRC

* demos/webgpu/babylon/babylonWebGpu.max.js:
* demos/webgpu/babylon/oneHelmetWebGPUWSLShaders.js:
(sampler.bumpSamplerSampler.register):
(sampler.reflectionSamplerSampler.register):
(float2.uv.attribute): Deleted.
(float3.normal.attribute): Deleted.
* demos/webgpu/compute-boids.html:
* demos/webgpu/hello-cube.html:
* demos/webgpu/scripts/compute-blur.js:
(setUpCompute):
(createShaderCode):
* demos/webgpu/scripts/compute-boids-compile.js:
* demos/webgpu/scripts/hello-triangle.js:
(async.helloTriangle):
* demos/webgpu/textured-cube.html:

Modified Paths

Diff

Modified: trunk/Websites/browserbench.org/ChangeLog (250031 => 250032)


--- trunk/Websites/browserbench.org/ChangeLog	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/browserbench.org/ChangeLog	2019-09-18 14:31:12 UTC (rev 250032)
@@ -1,3 +1,15 @@
+2019-09-18  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WebGPU] Update demos to work on STP 92
+        https://bugs.webkit.org/show_bug.cgi?id=201872
+
+        Reviewed by Dean Jackson.
+
+        GPUShaderStageBit => GPUShaderStage
+
+        * MotionMark1.1/tests/3d/resources/webgpu.js:
+        (Stage.call.initialize):
+
 2019-09-09  Jon Lee  <jon...@apple.com>
 
         Upload triangles tests for 3D suite in MotionMark

Modified: trunk/Websites/browserbench.org/MotionMark1.1/tests/3d/resources/webgpu.js (250031 => 250032)


--- trunk/Websites/browserbench.org/MotionMark1.1/tests/3d/resources/webgpu.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/browserbench.org/MotionMark1.1/tests/3d/resources/webgpu.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -94,13 +94,13 @@
 
                     this._timeBindGroupLayout = device.createBindGroupLayout({
                         bindings: [
-                            { binding: 0, visibility: GPUShaderStageBit.VERTEX, type: "uniform-buffer" },
+                            { binding: 0, visibility: GPUShaderStage.VERTEX, type: "uniform-buffer" },
                         ],
                     });
 
                     this._bindGroupLayout = device.createBindGroupLayout({
                         bindings: [
-                            { binding: 0, visibility: GPUShaderStageBit.VERTEX, type: "uniform-buffer" },
+                            { binding: 0, visibility: GPUShaderStage.VERTEX, type: "uniform-buffer" },
                         ],
                     });
 

Modified: trunk/Websites/webkit.org/ChangeLog (250031 => 250032)


--- trunk/Websites/webkit.org/ChangeLog	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/ChangeLog	2019-09-18 14:31:12 UTC (rev 250032)
@@ -1,3 +1,33 @@
+2019-09-18  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [WebGPU] Update demos to work on STP 92
+        https://bugs.webkit.org/show_bug.cgi?id=201872
+
+        Reviewed by Dean Jackson.
+
+        Updating for new WSL buffer layouts.
+        Updating for new WSL compiler struct validation rules.
+        GPUShaderStageBit => GPUShaderStage
+        GPUColorWriteBits => GPUColorWrite
+        GPUBufferUsage.TRANSFER_DST => GPUBufferUsage.COPY_DST
+        GPUBufferUsage.TRANSFER_SRC => GPUBufferUsage.COPY_SRC
+
+        * demos/webgpu/babylon/babylonWebGpu.max.js:
+        * demos/webgpu/babylon/oneHelmetWebGPUWSLShaders.js:
+        (sampler.bumpSamplerSampler.register):
+        (sampler.reflectionSamplerSampler.register):
+        (float2.uv.attribute): Deleted.
+        (float3.normal.attribute): Deleted.
+        * demos/webgpu/compute-boids.html:
+        * demos/webgpu/hello-cube.html:
+        * demos/webgpu/scripts/compute-blur.js:
+        (setUpCompute):
+        (createShaderCode):
+        * demos/webgpu/scripts/compute-boids-compile.js:
+        * demos/webgpu/scripts/hello-triangle.js:
+        (async.helloTriangle):
+        * demos/webgpu/textured-cube.html:
+
 2019-09-09  Justin Fan  <justin_...@apple.com>
 
         [WebGPU] Upload Babylon.js, WSL compile, and MotionMark links to demo page

Modified: trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/babylon/babylonWebGpu.max.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -74556,82 +74556,6 @@
         ubo.addUniform("vSphericalXY", 3);
         ubo.addUniform("vSphericalYZ", 3);
         ubo.addUniform("vSphericalZX", 3);
-        ubo._uniformLocations = {vAlbedoInfos: 0,
-        vAmbientInfos: 4,
-        vOpacityInfos: 8,
-        vEmissiveInfos: 10,
-        vLightmapInfos: 12,
-        vReflectivityInfos: 16,
-        vMicroSurfaceSamplerInfos: 20,
-        vReflectionInfos: 22,
-        vReflectionPosition: 24,
-        vReflectionSize: 28,
-        vBumpInfos: 32,
-        albedoMatrix: 36,
-        ambientMatrix: 52,
-        opacityMatrix: 68,
-        emissiveMatrix: 84,
-        lightmapMatrix: 100,
-        reflectivityMatrix: 116,
-        microSurfaceSamplerMatrix: 132,
-        bumpMatrix: 148,
-        vTangentSpaceParams: 164,
-        reflectionMatrix: 166,
-        vReflectionColor: 184,
-        vAlbedoColor: 188,
-        vLightingIntensity: 192,
-        vReflectionMicrosurfaceInfos: 196,
-        pointSize: 200,
-        vReflectivityColor: 204,
-        vEmissiveColor: 208,
-        vEyePosition: 212,
-        vAmbientColor: 216,
-        vDebugMode: 220,
-        vClearCoatParams: 222,
-        vClearCoatRefractionParams: 224,
-        vClearCoatInfos: 228,
-        clearCoatMatrix: 230,
-        vClearCoatBumpInfos: 246,
-        vClearCoatTangentSpaceParams: 248,
-        clearCoatBumpMatrix: 250,
-        vClearCoatTintParams: 268,
-        clearCoatColorAtDistance: 272,
-        vClearCoatTintInfos: 274,
-        clearCoatTintMatrix: 276,
-        vAnisotropy: 292,
-        vAnisotropyInfos: 296,
-        anisotropyMatrix: 298,
-        vSheenColor: 316,
-        vSheenInfos: 320,
-        sheenMatrix: 322,
-        vRefractionMicrosurfaceInfos: 340,
-        vRefractionInfos: 344,
-        refractionMatrix: 348,
-        vThicknessInfos: 364,
-        thicknessMatrix: 366,
-        vThicknessParam: 382,
-        vDiffusionDistance: 384,
-        vTintColor: 388,
-        vSubSurfaceIntensity: 392,
-        vSphericalL00: 396,
-        vSphericalL1_1: 400,
-        vSphericalL10: 404,
-        vSphericalL11: 408,
-        vSphericalL2_2: 412,
-        vSphericalL2_1: 416,
-        vSphericalL20: 420,
-        vSphericalL21: 424,
-        vSphericalL22: 428,
-        vSphericalX: 432,
-        vSphericalY: 436,
-        vSphericalZ: 440,
-        vSphericalXX_ZZ: 444,
-        vSphericalYY_ZZ: 448,
-        vSphericalZZ: 452,
-        vSphericalXY: 456,
-        vSphericalYZ: 460,
-        vSphericalZX: 464};
-        ubo._data = Array(468).fill(0);
         ubo.create();
     };
     /**

Modified: trunk/Websites/webkit.org/demos/webgpu/babylon/oneHelmetWebGPUWSLShaders.js (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/babylon/oneHelmetWebGPUWSLShaders.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/babylon/oneHelmetWebGPUWSLShaders.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -11,12 +11,6 @@
     float4x4 view;
 }
 
-struct BindGroupA {
-    constant Scene[] scene : register(b0, space0);
-    Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0);
-    sampler environmentBrdfSamplerSampler : register(s2, space0);
-}
-
 struct Material {
     float2 vAlbedoInfos;
     float4 vAmbientInfos;
@@ -100,26 +94,6 @@
     float visibility;
 }
 
-struct BindGroupB {
-    constant Material[] material : register(b0, space1);
-    constant Mesh[] mesh : register(b1, space1);
-}
-
-struct BindGroupC {
-    Texture2D<float4> reflectionSamplerTexture : register(t0, space2);
-    sampler reflectionSamplerSampler : register(s1, space2);
-    Texture2D<float4> albedoSamplerTexture : register(t2, space2);
-    sampler albedoSamplerSampler : register(s3, space2);
-    Texture2D<float4> reflectivitySamplerTexture : register(t4, space2);
-    sampler reflectivitySamplerSampler : register(s5, space2);
-    Texture2D<float4> ambientSamplerTexture : register(t6, space2);
-    sampler ambientSamplerSampler : register(s7, space2);
-    Texture2D<float4> emissiveSamplerTexture : register(t8, space2);
-    sampler emissiveSamplerSampler : register(s9, space2);
-    Texture2D<float4> bumpSamplerTexture : register(t10, space2);
-    sampler bumpSamplerSampler : register(s11, space2);
-}
-
 float3x3 transposeMat3(float3x3 inMatrix) {
     float3 i0 = inMatrix[0];
     float3 i1 = inMatrix[1];
@@ -190,13 +164,30 @@
     return rgbd.xyz / rgbd.w;
 }
 
-vertex Output main(float3 position : attribute(0), float3 normal : attribute(1), float2 uv : attribute(2), BindGroupA bindGroupA, BindGroupB bindGroupB, BindGroupC bindGroupC) {
+vertex Output main(float3 position : attribute(0), float3 normal : attribute(1), float2 uv : attribute(2),
+        constant Scene[] scene : register(b0, space0),
+        Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0),
+        sampler environmentBrdfSamplerSampler : register(s2, space0),
+        constant Material[] material : register(b0, space1),
+        constant Mesh[] mesh : register(b1, space1),
+        Texture2D<float4> reflectionSamplerTexture : register(t0, space2),
+        sampler reflectionSamplerSampler : register(s1, space2),
+        Texture2D<float4> albedoSamplerTexture : register(t2, space2),
+        sampler albedoSamplerSampler : register(s3, space2),
+        Texture2D<float4> reflectivitySamplerTexture : register(t4, space2),
+        sampler reflectivitySamplerSampler : register(s5, space2),
+        Texture2D<float4> ambientSamplerTexture : register(t6, space2),
+        sampler ambientSamplerSampler : register(s7, space2),
+        Texture2D<float4> emissiveSamplerTexture : register(t8, space2),
+        sampler emissiveSamplerSampler : register(s9, space2),
+        Texture2D<float4> bumpSamplerTexture : register(t10, space2),
+        sampler bumpSamplerSampler : register(s11, space2)) {
     Output output;
     float3 positionUpdated = position;
     float3 normalUpdated = normal;
     float2 uvUpdated = uv;
-    float4x4 finalWorld = bindGroupB.mesh[0].world;
-    output.position = mul(mul(bindGroupA.scene[0].viewProjection, finalWorld), float4(positionUpdated, 1.0));
+    float4x4 finalWorld = mesh[0].world;
+    output.position = mul(mul(scene[0].viewProjection, finalWorld), float4(positionUpdated, 1.0));
     float4 worldPos = mul(finalWorld, float4(positionUpdated, 1.0));
     output.vPositionW = worldPos.xyz;
     float3x3 normalWorld;
@@ -216,12 +207,6 @@
     float4x4 view;
 }
 
-struct BindGroupA {
-    constant Scene[] scene : register(b0, space0);
-    Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0);
-    sampler environmentBrdfSamplerSampler : register(s2, space0);
-}
-
 struct Material {
     float2 vAlbedoInfos;
     float4 vAmbientInfos;
@@ -305,26 +290,6 @@
     float visibility;
 }
 
-struct BindGroupB {
-    constant Material[] material : register(b0, space1);
-    constant Mesh[] mesh : register(b1, space1);
-}
-
-struct BindGroupC {
-    Texture2D<float4> reflectionSamplerTexture : register(t0, space2);
-    sampler reflectionSamplerSampler : register(s1, space2);
-    Texture2D<float4> albedoSamplerTexture : register(t2, space2);
-    sampler albedoSamplerSampler : register(s3, space2);
-    Texture2D<float4> reflectivitySamplerTexture : register(t4, space2);
-    sampler reflectivitySamplerSampler : register(s5, space2);
-    Texture2D<float4> ambientSamplerTexture : register(t6, space2);
-    sampler ambientSamplerSampler : register(s7, space2);
-    Texture2D<float4> emissiveSamplerTexture : register(t8, space2);
-    sampler emissiveSamplerSampler : register(s9, space2);
-    Texture2D<float4> bumpSamplerTexture : register(t10, space2);
-    sampler bumpSamplerSampler : register(s11, space2);
-}
-
 float3x3 transposeMat3(float3x3 inMatrix) {
     float3 i0 = inMatrix[0];
     float3 i1 = inMatrix[1];
@@ -727,26 +692,44 @@
     return computeCubicCoords(worldPos, worldNormal, vEyePosition.xyz, reflectionMatrix);
 }
 
-fragment float4 main(float3 vPositionW : attribute(0), float3 vNormalW : attribute(1), float2 vMainUV1 : attribute(2), BindGroupA bindGroupA, BindGroupB bindGroupB, BindGroupC bindGroupC, bool frontFace : SV_IsFrontFace) : SV_Target 0 {
-    float3 viewDirectionW = normalize(bindGroupB.material[0].vEyePosition.xyz - vPositionW);
+fragment float4 main(float3 vPositionW : attribute(0), float3 vNormalW : attribute(1), float2 vMainUV1 : attribute(2),
+        constant Scene[] scene : register(b0, space0),
+        Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0),
+        sampler environmentBrdfSamplerSampler : register(s2, space0),
+        constant Material[] material : register(b0, space1),
+        constant Mesh[] mesh : register(b1, space1),
+        Texture2D<float4> reflectionSamplerTexture : register(t0, space2),
+        sampler reflectionSamplerSampler : register(s1, space2),
+        Texture2D<float4> albedoSamplerTexture : register(t2, space2),
+        sampler albedoSamplerSampler : register(s3, space2),
+        Texture2D<float4> reflectivitySamplerTexture : register(t4, space2),
+        sampler reflectivitySamplerSampler : register(s5, space2),
+        Texture2D<float4> ambientSamplerTexture : register(t6, space2),
+        sampler ambientSamplerSampler : register(s7, space2),
+        Texture2D<float4> emissiveSamplerTexture : register(t8, space2),
+        sampler emissiveSamplerSampler : register(s9, space2),
+        Texture2D<float4> bumpSamplerTexture : register(t10, space2),
+        sampler bumpSamplerSampler : register(s11, space2),
+        bool frontFace : SV_IsFrontFace) : SV_Target 0 {
+    float3 viewDirectionW = normalize(material[0].vEyePosition.xyz - vPositionW);
     float3 normalW = normalize(vNormalW);
     float2 uvOffset = float2(0.0, 0.0);
     float normalScale = 1.0;
-    float3x3 TBN = cotangent_frame(normalW * normalScale, vPositionW, vMainUV1, bindGroupB.material[0].vTangentSpaceParams, frontFace);
-    normalW = perturbNormal(TBN, vMainUV1 + uvOffset, bindGroupC.bumpSamplerTexture, bindGroupC.bumpSamplerSampler, bindGroupB.material[0].vBumpInfos);
-    float3 surfaceAlbedo = bindGroupB.material[0].vAlbedoColor.xyz;
-    float alpha = bindGroupB.material[0].vAlbedoColor.w;
-    float4 albedoTexture = Sample(bindGroupC.albedoSamplerTexture, bindGroupC.albedoSamplerSampler, vMainUV1 + uvOffset);
+    float3x3 TBN = cotangent_frame(normalW * normalScale, vPositionW, vMainUV1, material[0].vTangentSpaceParams, frontFace);
+    normalW = perturbNormal(TBN, vMainUV1 + uvOffset, bumpSamplerTexture, bumpSamplerSampler, material[0].vBumpInfos);
+    float3 surfaceAlbedo = material[0].vAlbedoColor.xyz;
+    float alpha = material[0].vAlbedoColor.w;
+    float4 albedoTexture = Sample(albedoSamplerTexture, albedoSamplerSampler, vMainUV1 + uvOffset);
     surfaceAlbedo *= toLinearSpace(albedoTexture.xyz);
-    surfaceAlbedo *= bindGroupB.material[0].vAlbedoInfos.y;
+    surfaceAlbedo *= material[0].vAlbedoInfos.y;
     float3 ambientOcclusionColor = float3(1., 1., 1.);
-    float3 ambientOcclusionColorMap = Sample(bindGroupC.ambientSamplerTexture, bindGroupC.ambientSamplerSampler, vMainUV1 + uvOffset).xyz * bindGroupB.material[0].vAmbientInfos.y;
+    float3 ambientOcclusionColorMap = Sample(ambientSamplerTexture, ambientSamplerSampler, vMainUV1 + uvOffset).xyz * material[0].vAmbientInfos.y;
     ambientOcclusionColorMap = float3(ambientOcclusionColorMap.x, ambientOcclusionColorMap.x, ambientOcclusionColorMap.x);
-    ambientOcclusionColor = lerp(ambientOcclusionColor, ambientOcclusionColorMap, float3(bindGroupB.material[0].vAmbientInfos.z, bindGroupB.material[0].vAmbientInfos.z, bindGroupB.material[0].vAmbientInfos.z));
-    float microSurface = bindGroupB.material[0].vReflectivityColor.w;
-    float3 surfaceReflectivityColor = bindGroupB.material[0].vReflectivityColor.xyz;
+    ambientOcclusionColor = lerp(ambientOcclusionColor, ambientOcclusionColorMap, float3(material[0].vAmbientInfos.z, material[0].vAmbientInfos.z, material[0].vAmbientInfos.z));
+    float microSurface = material[0].vReflectivityColor.w;
+    float3 surfaceReflectivityColor = material[0].vReflectivityColor.xyz;
     float2 metallicRoughness = surfaceReflectivityColor.xy;
-    float4 surfaceMetallicColorMap = Sample(bindGroupC.reflectivitySamplerTexture, bindGroupC.reflectivitySamplerSampler, vMainUV1 + uvOffset);
+    float4 surfaceMetallicColorMap = Sample(reflectivitySamplerTexture, reflectivitySamplerSampler, vMainUV1 + uvOffset);
     metallicRoughness.x *= surfaceMetallicColorMap.z;
     metallicRoughness.y *= surfaceMetallicColorMap.y;
     microSurface = 1.0 - metallicRoughness.y;
@@ -763,23 +746,23 @@
     alphaG += AARoughnessFactors.y;
     float4 environmentRadiance = float4(0.,0., 0., 0.);
     float3 environmentIrradiance = float3(0., 0., 0.);
-    float3 reflectionVector = computeReflectionCoords(float4(vPositionW, 1.0), normalW, bindGroupB.material[0].vEyePosition, bindGroupB.material[0].reflectionMatrix);
+    float3 reflectionVector = computeReflectionCoords(float4(vPositionW, 1.0), normalW, material[0].vEyePosition, material[0].reflectionMatrix);
     float3 reflectionCoords = reflectionVector;
-    float reflectionLOD = getLodFromAlphaG(bindGroupB.material[0].vReflectionMicrosurfaceInfos.x, alphaG);
-    reflectionLOD = reflectionLOD * bindGroupB.material[0].vReflectionMicrosurfaceInfos.y + bindGroupB.material[0].vReflectionMicrosurfaceInfos.z;
+    float reflectionLOD = getLodFromAlphaG(material[0].vReflectionMicrosurfaceInfos.x, alphaG);
+    reflectionLOD = reflectionLOD * material[0].vReflectionMicrosurfaceInfos.y + material[0].vReflectionMicrosurfaceInfos.z;
     float requestedReflectionLOD = reflectionLOD;
-    environmentRadiance = Sample(bindGroupC.reflectionSamplerTexture, bindGroupC.reflectionSamplerSampler, reflectionCoords.xy); //SampleLevel(bindGroupC.reflectionSamplerTexture, bindGroupC.reflectionSamplerSampler, reflectionCoords, requestedReflectionLOD);
+    environmentRadiance = Sample(reflectionSamplerTexture, reflectionSamplerSampler, reflectionCoords.xy); //SampleLevel(reflectionSamplerTexture, reflectionSamplerSampler, reflectionCoords, requestedReflectionLOD);
     environmentRadiance.xyz = fromRGBD(environmentRadiance);
-    float3 irradianceVector = mul(bindGroupB.material[0].reflectionMatrix, float4(normalW, 0)).xyz;
-    environmentIrradiance = computeEnvironmentIrradiance(irradianceVector, &bindGroupB.material[0]);
-    environmentRadiance.xyz *= bindGroupB.material[0].vReflectionInfos.x;
-    environmentRadiance.xyz *= bindGroupB.material[0].vReflectionColor.xyz;
-    environmentIrradiance *= bindGroupB.material[0].vReflectionColor.xyz;
+    float3 irradianceVector = mul(material[0].reflectionMatrix, float4(normalW, 0)).xyz;
+    environmentIrradiance = computeEnvironmentIrradiance(irradianceVector, &material[0]);
+    environmentRadiance.xyz *= material[0].vReflectionInfos.x;
+    environmentRadiance.xyz *= material[0].vReflectionColor.xyz;
+    environmentIrradiance *= material[0].vReflectionColor.xyz;
     float reflectance = max(max(surfaceReflectivityColor.x, surfaceReflectivityColor.y), surfaceReflectivityColor.z);
     float reflectance90 = fresnelGrazingReflectance(reflectance);
     float3 specularEnvironmentR0 = surfaceReflectivityColor.xyz;
     float3 specularEnvironmentR90 = float3(1.0, 1.0, 1.0) * reflectance90;
-    float3 environmentBrdf = getBRDFLookup(NdotV, roughness, bindGroupA.environmentBrdfSamplerTexture, bindGroupA.environmentBrdfSamplerSampler);
+    float3 environmentBrdf = getBRDFLookup(NdotV, roughness, environmentBrdfSamplerTexture, environmentBrdfSamplerSampler);
     float3 energyConservationFactor = getEnergyConservationFactor(specularEnvironmentR0, environmentBrdf);
     float3 diffuseBase = float3(0., 0., 0.);
     PreLightingInfo preInfo;
@@ -795,28 +778,28 @@
     finalIrradiance *= surfaceAlbedo.xyz;
     float3 finalRadiance = environmentRadiance.xyz;
     finalRadiance *= specularEnvironmentReflectance;
-    float3 finalRadianceScaled = finalRadiance * bindGroupB.material[0].vLightingIntensity.z;
+    float3 finalRadianceScaled = finalRadiance * material[0].vLightingIntensity.z;
     finalRadianceScaled *= energyConservationFactor;
     float3 finalDiffuse = diffuseBase;
     finalDiffuse *= surfaceAlbedo.xyz;
     finalDiffuse = max(finalDiffuse, float3(0.0, 0.0, 0.0));
-    float3 finalAmbient = bindGroupB.material[0].vAmbientColor;
+    float3 finalAmbient = material[0].vAmbientColor;
     finalAmbient *= surfaceAlbedo.xyz;
-    float3 finalEmissive = bindGroupB.material[0].vEmissiveColor;
-    float3 emissiveColorTex = Sample(bindGroupC.emissiveSamplerTexture, bindGroupC.emissiveSamplerSampler, vMainUV1 + uvOffset).xyz;
+    float3 finalEmissive = material[0].vEmissiveColor;
+    float3 emissiveColorTex = Sample(emissiveSamplerTexture, emissiveSamplerSampler, vMainUV1 + uvOffset).xyz;
     finalEmissive *= toLinearSpace(emissiveColorTex);
-    finalEmissive *= bindGroupB.material[0].vEmissiveInfos.y;
-    float3 ambientOcclusionForDirectDiffuse = lerp(float3(1., 1., 1.), ambientOcclusionColor, float3(bindGroupB.material[0].vAmbientInfos.w, bindGroupB.material[0].vAmbientInfos.w, bindGroupB.material[0].vAmbientInfos.w));
+    finalEmissive *= material[0].vEmissiveInfos.y;
+    float3 ambientOcclusionForDirectDiffuse = lerp(float3(1., 1., 1.), ambientOcclusionColor, float3(material[0].vAmbientInfos.w, material[0].vAmbientInfos.w, material[0].vAmbientInfos.w));
     float4 finalColor = float4(
         finalAmbient * ambientOcclusionColor +
-        finalDiffuse * ambientOcclusionForDirectDiffuse * bindGroupB.material[0].vLightingIntensity.x +
-        finalIrradiance * ambientOcclusionColor * bindGroupB.material[0].vLightingIntensity.z +
+        finalDiffuse * ambientOcclusionForDirectDiffuse * material[0].vLightingIntensity.x +
+        finalIrradiance * ambientOcclusionColor * material[0].vLightingIntensity.z +
         finalRadianceScaled +
-        finalEmissive * bindGroupB.material[0].vLightingIntensity.y,
+        finalEmissive * material[0].vLightingIntensity.y,
         alpha);
     finalColor = max(finalColor, float4(0.0, 0.0, 0.0, 0.0));
     finalColor = applyImageProcessing(finalColor);
-    finalColor.w *= bindGroupB.mesh[0].visibility;
+    finalColor.w *= mesh[0].visibility;
     return finalColor;
 }
 `;
@@ -834,12 +817,6 @@
     float4x4 view;
 }
 
-struct BindGroupA {
-    constant Scene[] scene : register(b0, space0);
-    Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0);
-    sampler environmentBrdfSamplerSampler : register(s2, space0);
-}
-
 struct Material {
     float2 vAlbedoInfos;
     float4 vAmbientInfos;
@@ -923,16 +900,6 @@
     float visibility;
 }
 
-struct BindGroupB {
-    constant Material[] material : register(b0, space1);
-    constant Mesh[] mesh : register(b1, space1);
-}
-
-struct BindGroupC {
-    Texture2D<float4> reflectionSamplerTexture : register(t0, space2);
-    sampler reflectionSamplerSampler : register(s1, space2);
-}
-
 float3x3 transposeMat3(float3x3 inMatrix) {
     float3 i0 = inMatrix[0];
     float3 i1 = inMatrix[1];
@@ -1003,13 +970,20 @@
     return rgbd.xyz / rgbd.w;
 }
 
-vertex Output main(float3 position : attribute(0), float3 normal : attribute(1), BindGroupA bindGroupA, BindGroupB bindGroupB, BindGroupC bindGroupC) {
+vertex Output main(float3 position : attribute(0), float3 normal : attribute(1),
+        constant Scene[] scene : register(b0, space0),
+        Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0),
+        sampler environmentBrdfSamplerSampler : register(s2, space0),
+        constant Material[] material : register(b0, space1),
+        constant Mesh[] mesh : register(b1, space1),
+        Texture2D<float4> reflectionSamplerTexture : register(t0, space2),
+        sampler reflectionSamplerSampler : register(s1, space2)) {
     Output output;
     float3 positionUpdated = position;
     float3 normalUpdated = normal;
     output.vPositionUVW = positionUpdated;
-    float4x4 finalWorld = bindGroupB.mesh[0].world;
-    output.position = mul(mul(bindGroupA.scene[0].viewProjection, finalWorld), float4(positionUpdated, 1.0));
+    float4x4 finalWorld = mesh[0].world;
+    output.position = mul(mul(scene[0].viewProjection, finalWorld), float4(positionUpdated, 1.0));
     float4 worldPos = mul(finalWorld, float4(positionUpdated, 1.0));
     output.vPositionW = worldPos.xyz;
     float3x3 normalWorld;
@@ -1029,12 +1003,6 @@
     float4x4 view;
 }
 
-struct BindGroupA {
-    constant Scene[] scene : register(b0, space0);
-    Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0);
-    sampler environmentBrdfSamplerSampler : register(s2, space0);
-}
-
 struct Material {
     float2 vAlbedoInfos;
     float4 vAmbientInfos;
@@ -1118,16 +1086,6 @@
     float visibility;
 }
 
-struct BindGroupB {
-    constant Material[] material : register(b0, space1);
-    constant Mesh[] mesh : register(b1, space1);
-}
-
-struct BindGroupC {
-    Texture2D<float4> reflectionSamplerTexture : register(t0, space2);
-    sampler reflectionSamplerSampler : register(s1, space2);
-}
-
 float3x3 transposeMat3(float3x3 inMatrix) {
     float3 i0 = inMatrix[0];
     float3 i1 = inMatrix[1];
@@ -1496,16 +1454,24 @@
     return float3(gamma / 3.1415926535897932384626433832795 + 0.5, theta / 3.1415926535897932384626433832795, r);
 }
 
-fragment float4 main(float3 vPositionW : attribute(0), float3 vNormalW : attribute(1), float3 vPositionUVW : attribute(2), BindGroupA bindGroupA, BindGroupB bindGroupB, BindGroupC bindGroupC, bool frontFace : SV_IsFrontFace) : SV_Target 0 {
-    float3 viewDirectionW = normalize(bindGroupB.material[0].vEyePosition.xyz - vPositionW);
+fragment float4 main(float3 vPositionW : attribute(0), float3 vNormalW : attribute(1), float3 vPositionUVW : attribute(2),
+        constant Scene[] scene : register(b0, space0),
+        Texture2D<float4> environmentBrdfSamplerTexture : register(t1, space0),
+        sampler environmentBrdfSamplerSampler : register(s2, space0),
+        constant Material[] material : register(b0, space1),
+        constant Mesh[] mesh : register(b1, space1),
+        Texture2D<float4> reflectionSamplerTexture : register(t0, space2),
+        sampler reflectionSamplerSampler : register(s1, space2),
+        bool frontFace : SV_IsFrontFace) : SV_Target 0 {
+    float3 viewDirectionW = normalize(material[0].vEyePosition.xyz - vPositionW);
     float3 normalW = normalize(vNormalW);
     float2 uvOffset = float2(0.0, 0.0);
     normalW = frontFace ? normalW : -normalW;
-    float3 surfaceAlbedo = bindGroupB.material[0].vAlbedoColor.xyz;
-    float alpha = bindGroupB.material[0].vAlbedoColor.w;
+    float3 surfaceAlbedo = material[0].vAlbedoColor.xyz;
+    float alpha = material[0].vAlbedoColor.w;
     float3 ambientOcclusionColor = float3(1., 1., 1.);
-    float microSurface = bindGroupB.material[0].vReflectivityColor.w;
-    float3 surfaceReflectivityColor = bindGroupB.material[0].vReflectivityColor.xyz;
+    float microSurface = material[0].vReflectivityColor.w;
+    float3 surfaceReflectivityColor = material[0].vReflectivityColor.xyz;
     microSurface = clamp(microSurface, 0.0, 1.0);
     float roughness = 1. - microSurface;
     float NdotVUnclamped = dot(normalW, viewDirectionW);
@@ -1514,21 +1480,21 @@
     float2 AARoughnessFactors = getAARoughnessFactors(normalW);
     float4 environmentRadiance = float4(0., 0., 0., 0.);
     float3 environmentIrradiance = float3(0., 0., 0.);
-    float3 reflectionVector = computeReflectionCoords(float4(vPositionW, 1.0), normalW, vPositionUVW, bindGroupB.material[0].reflectionMatrix);
+    float3 reflectionVector = computeReflectionCoords(float4(vPositionW, 1.0), normalW, vPositionUVW, material[0].reflectionMatrix);
     float3 reflectionCoords = reflectionVector;
-    float reflectionLOD = getLodFromAlphaG(bindGroupB.material[0].vReflectionMicrosurfaceInfos.x, alphaG);
-    reflectionLOD = reflectionLOD * bindGroupB.material[0].vReflectionMicrosurfaceInfos.y + bindGroupB.material[0].vReflectionMicrosurfaceInfos.z;
+    float reflectionLOD = getLodFromAlphaG(material[0].vReflectionMicrosurfaceInfos.x, alphaG);
+    reflectionLOD = reflectionLOD * material[0].vReflectionMicrosurfaceInfos.y + material[0].vReflectionMicrosurfaceInfos.z;
     float requestedReflectionLOD = reflectionLOD;
-    environmentRadiance = Sample(bindGroupC.reflectionSamplerTexture, bindGroupC.reflectionSamplerSampler, reflectionCoords.xy); //SampleLevel(bindGroupC.reflectionSamplerTexture, bindGroupC.reflectionSamplerSampler, reflectionCoords, requestedReflectionLOD);
+    environmentRadiance = Sample(reflectionSamplerTexture, reflectionSamplerSampler, reflectionCoords.xy); //SampleLevel(reflectionSamplerTexture, reflectionSamplerSampler, reflectionCoords, requestedReflectionLOD);
     environmentRadiance.xyz = fromRGBD(environmentRadiance);
-    environmentRadiance.xyz *= bindGroupB.material[0].vReflectionInfos.x;
-    environmentRadiance.xyz *= bindGroupB.material[0].vReflectionColor.xyz;
-    environmentIrradiance *= bindGroupB.material[0].vReflectionColor.xyz;
+    environmentRadiance.xyz *= material[0].vReflectionInfos.x;
+    environmentRadiance.xyz *= material[0].vReflectionColor.xyz;
+    environmentIrradiance *= material[0].vReflectionColor.xyz;
     float reflectance = max(max(surfaceReflectivityColor.x, surfaceReflectivityColor.y), surfaceReflectivityColor.z);
     float reflectance90 = fresnelGrazingReflectance(reflectance);
     float3 specularEnvironmentR0 = surfaceReflectivityColor.xyz;
     float3 specularEnvironmentR90 = float3(1.0, 1.0, 1.0) * reflectance90;
-    float3 environmentBrdf = getBRDFLookup(NdotV, roughness, bindGroupA.environmentBrdfSamplerTexture, bindGroupA.environmentBrdfSamplerSampler);
+    float3 environmentBrdf = getBRDFLookup(NdotV, roughness, environmentBrdfSamplerTexture, environmentBrdfSamplerSampler);
     float3 energyConservationFactor = getEnergyConservationFactor(specularEnvironmentR0, environmentBrdf);
     float3 diffuseBase = float3(0., 0., 0.);
     PreLightingInfo preInfo;
@@ -1540,25 +1506,25 @@
     finalIrradiance *= surfaceAlbedo.xyz;
     float3 finalRadiance = environmentRadiance.xyz;
     finalRadiance *= specularEnvironmentReflectance;
-    float3 finalRadianceScaled = finalRadiance * bindGroupB.material[0].vLightingIntensity.z;
+    float3 finalRadianceScaled = finalRadiance * material[0].vLightingIntensity.z;
     finalRadianceScaled *= energyConservationFactor;
     float3 finalDiffuse = diffuseBase;
     finalDiffuse *= surfaceAlbedo.xyz;
     finalDiffuse = max(finalDiffuse, float3(0.0, 0.0, 0.0));
-    float3 finalAmbient = bindGroupB.material[0].vAmbientColor;
+    float3 finalAmbient = material[0].vAmbientColor;
     finalAmbient *= surfaceAlbedo.xyz;
-    float3 finalEmissive = bindGroupB.material[0].vEmissiveColor;
+    float3 finalEmissive = material[0].vEmissiveColor;
     float3 ambientOcclusionForDirectDiffuse = ambientOcclusionColor;
     float4 finalColor = float4(
         finalAmbient * ambientOcclusionColor +
-        finalDiffuse * ambientOcclusionForDirectDiffuse * bindGroupB.material[0].vLightingIntensity.x +
-        finalIrradiance * ambientOcclusionColor * bindGroupB.material[0].vLightingIntensity.z +
+        finalDiffuse * ambientOcclusionForDirectDiffuse * material[0].vLightingIntensity.x +
+        finalIrradiance * ambientOcclusionColor * material[0].vLightingIntensity.z +
         finalRadianceScaled +
-        finalEmissive * bindGroupB.material[0].vLightingIntensity.y,
+        finalEmissive * material[0].vLightingIntensity.y,
         alpha);
     finalColor = max(finalColor, float4(0.0, 0.0, 0.0, 0.0));
     finalColor = applyImageProcessing(finalColor);
-    finalColor.w *= bindGroupB.mesh[0].visibility;
+    finalColor.w *= mesh[0].visibility;
     return finalColor;
 }
 `;

Modified: trunk/Websites/webkit.org/demos/webgpu/compute-boids.html (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/compute-boids.html	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/compute-boids.html	2019-09-18 14:31:12 UTC (rev 250032)
@@ -154,9 +154,9 @@
 
       const computeBindGroupLayout = device.createBindGroupLayout({
         bindings: [
-          { binding: 0, visibility: GPUShaderStageBit.COMPUTE, type: "uniform-buffer" },
-          { binding: 1, visibility: GPUShaderStageBit.COMPUTE, type: "storage-buffer" },
-          { binding: 2, visibility: GPUShaderStageBit.COMPUTE, type: "storage-buffer" },
+          { binding: 0, visibility: GPUShaderStage.COMPUTE, type: "uniform-buffer" },
+          { binding: 1, visibility: GPUShaderStage.COMPUTE, type: "storage-buffer" },
+          { binding: 2, visibility: GPUShaderStage.COMPUTE, type: "storage-buffer" },
         ],
       });
 

Modified: trunk/Websites/webkit.org/demos/webgpu/hello-cube.html (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/hello-cube.html	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/hello-cube.html	2019-09-18 14:31:12 UTC (rev 250032)
@@ -173,7 +173,7 @@
     // Bind group binding layout
     const transformBufferBindGroupLayoutBinding = {
         binding: transformBindingNum, // id[[(0)]]
-        visibility: GPUShaderStageBit.VERTEX,
+        visibility: GPUShaderStage.VERTEX,
         type: "uniform-buffer"
     };
 
@@ -208,7 +208,7 @@
             dstFactor: "one-minus-src-alpha",
             operation: "add"
         },
-        writeMask: GPUColorWriteBits.ALL
+        writeMask: GPUColorWrite.ALL
     };
     const pipelineDescriptor = {
         layout: pipelineLayout,

Modified: trunk/Websites/webkit.org/demos/webgpu/scripts/compute-blur.js (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/scripts/compute-blur.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/scripts/compute-blur.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -82,15 +82,15 @@
     const bindGroupLayout = device.createBindGroupLayout({
         bindings: [{
             binding: sourceBufferBindingNum,
-            visibility: GPUShaderStageBit.COMPUTE,
+            visibility: GPUShaderStage.COMPUTE,
             type: "storage-buffer"
         }, {
             binding: outputBufferBindingNum,
-            visibility: GPUShaderStageBit.COMPUTE,
+            visibility: GPUShaderStage.COMPUTE,
             type: "storage-buffer"
         }, {
             binding: uniformsBufferBindingNum,
-            visibility: GPUShaderStageBit.COMPUTE,
+            visibility: GPUShaderStage.COMPUTE,
             type: "uniform-buffer"
         }]
     });
@@ -351,4 +351,4 @@
     output[globalIndex] = makeRGBA(channels[0], channels[1], channels[2], channels[3]);
 }
 `;
-}
\ No newline at end of file
+}

Modified: trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/scripts/compute-boids-compile.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -207,7 +207,6 @@
     if (!isChrome) {
         GPUBufferUsage.COPY_DST = GPUBufferUsage.TRANSFER_DST;
         GPUBufferUsage.COPY_SRC = GPUBufferUsage.TRANSFER_SRC;
-        GPUShaderStage = GPUShaderStageBit;
     }
 
     const adapter = await navigator.gpu.requestAdapter();

Modified: trunk/Websites/webkit.org/demos/webgpu/scripts/hello-triangle.js (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/scripts/hello-triangle.js	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/scripts/hello-triangle.js	2019-09-18 14:31:12 UTC (rev 250032)
@@ -105,7 +105,7 @@
         format: "bgra8unorm",
         alphaBlend: alphaBlendDescriptor,
         colorBlend: colorBlendDescriptor,
-        writeMask: GPUColorWriteBits.ALL
+        writeMask: GPUColorWrite.ALL
     };
     
     /* GPURenderPipelineDescriptor */
@@ -175,4 +175,4 @@
     queue.submit([commandBuffer]);
 }
 
-window.addEventListener("DOMContentLoaded", helloTriangle);
\ No newline at end of file
+window.addEventListener("DOMContentLoaded", helloTriangle);

Modified: trunk/Websites/webkit.org/demos/webgpu/textured-cube.html (250031 => 250032)


--- trunk/Websites/webkit.org/demos/webgpu/textured-cube.html	2019-09-18 11:30:16 UTC (rev 250031)
+++ trunk/Websites/webkit.org/demos/webgpu/textured-cube.html	2019-09-18 14:31:12 UTC (rev 250032)
@@ -149,7 +149,7 @@
 
     const verticesBufferDescriptor = { 
         size: verticesArray.byteLength, 
-        usage: GPUBufferUsage.VERTEX | GPUBufferUsage.TRANSFER_DST
+        usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST
     };
     let verticesArrayBuffer;
     [verticesBuffer, verticesArrayBuffer] = device.createBufferMapped(verticesBufferDescriptor);
@@ -215,7 +215,7 @@
 
     const textureDataBufferDescriptor = {
         size: imageData.data.length,
-        usage: GPUBufferUsage.TRANSFER_SRC
+        usage: GPUBufferUsage.COPY_SRC
     };
     const [textureDataBuffer, textureArrayBuffer] = device.createBufferMapped(textureDataBufferDescriptor);
     
@@ -246,13 +246,13 @@
     // Bind group binding layout
     const transformBufferBindGroupLayoutBinding = {
         binding: transformBindingNum, // id[[(0)]]
-        visibility: GPUShaderStageBit.VERTEX,
+        visibility: GPUShaderStage.VERTEX,
         type: "uniform-buffer"
     };
 
     const textureBindGroupLayoutBinding = {
         binding: textureBindingNum,
-        visibility: GPUShaderStageBit.FRAGMENT,
+        visibility: GPUShaderStage.FRAGMENT,
         type: "sampled-texture"
     };
     textureViewBinding = {
@@ -262,7 +262,7 @@
 
     const samplerBindGroupLayoutBinding = {
         binding: samplerBindingNum,
-        visibility: GPUShaderStageBit.FRAGMENT,
+        visibility: GPUShaderStage.FRAGMENT,
         type: "sampler"
     };
     samplerBinding = {
@@ -303,7 +303,7 @@
             dstFactor: "one-minus-src-alpha",
             operation: "add"
         },
-        writeMask: GPUColorWriteBits.ALL
+        writeMask: GPUColorWrite.ALL
     };
     const pipelineDescriptor = {
         layout: pipelineLayout,
@@ -438,4 +438,4 @@
 window.addEventListener("load", init);
 </script>
 </body>
-</html>
\ No newline at end of file
+</html>
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to