├── .eslintignore ├── src ├── demo │ ├── a │ │ ├── README.txt │ │ ├── b │ │ │ ├── README.txt │ │ │ └── d.spec.ts │ │ └── b.spec.ts │ ├── README.txt │ ├── webworker │ │ └── .gitignore │ ├── file_depth_2 │ │ └── in_single_child_dir │ │ │ └── r.spec.ts │ ├── a.spec.ts │ └── json.spec.ts ├── unittests │ ├── README.txt │ ├── webworker │ │ └── .gitignore │ ├── unit_test.ts │ ├── listing.ts │ ├── crc32.spec.ts │ └── basic.spec.ts ├── webgpu │ ├── README.txt │ ├── api │ │ ├── operation │ │ │ ├── buffers │ │ │ │ ├── README.txt │ │ │ │ └── threading.spec.ts │ │ │ ├── render_pass │ │ │ │ └── README.txt │ │ │ ├── README.txt │ │ │ ├── command_buffer │ │ │ │ ├── queries │ │ │ │ │ └── README.txt │ │ │ │ └── render │ │ │ │ │ └── dynamic_state.spec.ts │ │ │ ├── rendering │ │ │ │ └── robust_access_index.spec.ts │ │ │ ├── memory_allocation │ │ │ │ └── README.txt │ │ │ ├── async_ordering │ │ │ │ └── README.txt │ │ │ ├── compute_pipeline │ │ │ │ └── entry_point_name.spec.ts │ │ │ ├── threading │ │ │ │ └── README.txt │ │ │ └── pipeline │ │ │ │ └── default_layout.spec.ts │ │ ├── validation │ │ │ ├── resource_usages │ │ │ │ └── buffer │ │ │ │ │ └── README.txt │ │ │ ├── README.txt │ │ │ ├── render_pass │ │ │ │ └── README.txt │ │ │ ├── state │ │ │ │ └── device_lost │ │ │ │ │ └── README.txt │ │ │ ├── capability_checks │ │ │ │ ├── limits │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── maxBufferSize.spec.ts │ │ │ │ │ ├── maxComputeWorkgroupSizeX.spec.ts │ │ │ │ │ ├── maxComputeWorkgroupSizeY.spec.ts │ │ │ │ │ ├── maxComputeWorkgroupSizeZ.spec.ts │ │ │ │ │ └── maxTextureArrayLayers.spec.ts │ │ │ │ └── features │ │ │ │ │ ├── README.txt │ │ │ │ │ └── texture_component_swizzle_utils.ts │ │ │ ├── queue │ │ │ │ └── README.txt │ │ │ ├── encoding │ │ │ │ ├── cmds │ │ │ │ │ └── render_pass.spec.ts │ │ │ │ └── queries │ │ │ │ │ └── common.ts │ │ │ ├── buffer │ │ │ │ └── threading.spec.ts │ │ │ └── query_set │ │ │ │ ├── create.spec.ts │ │ │ │ └── destroy.spec.ts │ │ ├── README.txt │ │ └── regression │ │ │ └── README.txt │ ├── web_platform │ │ ├── external_texture │ │ │ └── README.txt │ │ ├── canvas │ │ │ ├── README.txt │ │ │ └── getPreferredCanvasFormat.spec.ts │ │ ├── copyToTexture │ │ │ └── README.txt │ │ ├── README.txt │ │ └── reftests │ │ │ ├── .eslintrc.json │ │ │ ├── ref │ │ │ ├── canvas_colorspace-ref.html │ │ │ ├── delay_get_texture-ref.html │ │ │ ├── canvas_clear-ref.html │ │ │ ├── canvas_complex-ref.html │ │ │ ├── canvas_composite_alpha_opaque-ref.html │ │ │ ├── canvas_composite_alpha_premultiplied-ref.html │ │ │ └── canvas_display_after_device_lost-ref.html │ │ │ ├── delay_get_texture.https.html │ │ │ ├── canvas_clear.https.html │ │ │ ├── create-pattern-data-url.ts │ │ │ ├── resize_observer.https.html │ │ │ ├── canvas_colorspace_bgra8unorm.https.html │ │ │ ├── canvas_colorspace_rgba16float.https.html │ │ │ ├── canvas_colorspace_rgba8unorm.https.html │ │ │ ├── canvas_display_after_device_lost.https.html │ │ │ ├── gpu_ref_test.ts │ │ │ ├── canvas_composite_alpha_bgra8unorm_opaque_copy.https.html │ │ │ ├── canvas_composite_alpha_bgra8unorm_opaque_draw.https.html │ │ │ ├── canvas_composite_alpha_rgba8unorm_opaque_copy.https.html │ │ │ ├── canvas_composite_alpha_rgba8unorm_opaque_draw.https.html │ │ │ ├── canvas_composite_alpha_rgba16float_opaque_copy.https.html │ │ │ ├── canvas_composite_alpha_rgba16float_opaque_draw.https.html │ │ │ ├── README.txt │ │ │ ├── canvas_composite_alpha_bgra8unorm_premultiplied_copy.https.html │ │ │ ├── canvas_composite_alpha_bgra8unorm_premultiplied_draw.https.html │ │ │ ├── canvas_composite_alpha_rgba8unorm_premultiplied_copy.https.html │ │ │ ├── canvas_composite_alpha_rgba8unorm_premultiplied_draw.https.html │ │ │ ├── canvas_composite_alpha_rgba16float_premultiplied_copy.https.html │ │ │ ├── canvas_composite_alpha_rgba16float_premultiplied_draw.https.html │ │ │ └── canvas_clear.html.ts │ ├── shader │ │ ├── README.txt │ │ ├── execution │ │ │ ├── README.txt │ │ │ └── expression │ │ │ │ ├── interval_filter.ts │ │ │ │ ├── unary │ │ │ │ ├── i32_arithmetic.cache.ts │ │ │ │ ├── ai_arithmetic.cache.ts │ │ │ │ ├── f16_arithmetic.cache.ts │ │ │ │ ├── f32_arithmetic.cache.ts │ │ │ │ ├── af_arithmetic.cache.ts │ │ │ │ ├── ai_assignment.cache.ts │ │ │ │ ├── unary.ts │ │ │ │ ├── i32_arithmetic.spec.ts │ │ │ │ ├── f32_arithmetic.spec.ts │ │ │ │ ├── i32_complement.spec.ts │ │ │ │ ├── u32_complement.spec.ts │ │ │ │ ├── ai_arithmetic.spec.ts │ │ │ │ └── f16_arithmetic.spec.ts │ │ │ │ ├── call │ │ │ │ └── builtin │ │ │ │ │ ├── derivatives.cache.ts │ │ │ │ │ ├── trunc.cache.ts │ │ │ │ │ ├── max.cache.ts │ │ │ │ │ ├── min.cache.ts │ │ │ │ │ ├── unpack2x16float.cache.ts │ │ │ │ │ ├── unpack2x16snorm.cache.ts │ │ │ │ │ ├── unpack2x16unorm.cache.ts │ │ │ │ │ ├── unpack4x8snorm.cache.ts │ │ │ │ │ ├── unpack4x8unorm.cache.ts │ │ │ │ │ ├── saturate.cache.ts │ │ │ │ │ ├── tanh.cache.ts │ │ │ │ │ ├── asinh.cache.ts │ │ │ │ │ ├── radians.cache.ts │ │ │ │ │ ├── round.cache.ts │ │ │ │ │ ├── tan.cache.ts │ │ │ │ │ ├── ceil.cache.ts │ │ │ │ │ ├── cos.cache.ts │ │ │ │ │ ├── sin.cache.ts │ │ │ │ │ ├── floor.cache.ts │ │ │ │ │ ├── sqrt.cache.ts │ │ │ │ │ ├── cosh.cache.ts │ │ │ │ │ ├── sinh.cache.ts │ │ │ │ │ ├── pow.cache.ts │ │ │ │ │ ├── degrees.cache.ts │ │ │ │ │ ├── fwidth.spec.ts │ │ │ │ │ ├── abs.cache.ts │ │ │ │ │ ├── fwidthCoarse.spec.ts │ │ │ │ │ ├── cross.cache.ts │ │ │ │ │ ├── normalize.cache.ts │ │ │ │ │ ├── smoothstep.cache.ts │ │ │ │ │ ├── atan.cache.ts │ │ │ │ │ ├── acos.cache.ts │ │ │ │ │ ├── asin.cache.ts │ │ │ │ │ ├── acosh.cache.ts │ │ │ │ │ ├── transpose.cache.ts │ │ │ │ │ ├── fma.cache.ts │ │ │ │ │ ├── dpdy.spec.ts │ │ │ │ │ ├── reflect.cache.ts │ │ │ │ │ ├── dpdx.spec.ts │ │ │ │ │ └── fwidthFine.spec.ts │ │ │ │ └── binary │ │ │ │ ├── f16_matrix_addition.cache.ts │ │ │ │ ├── f32_matrix_addition.cache.ts │ │ │ │ ├── f16_matrix_subtraction.cache.ts │ │ │ │ ├── f32_matrix_subtraction.cache.ts │ │ │ │ ├── f16_matrix_matrix_multiplication.cache.ts │ │ │ │ ├── f32_matrix_matrix_multiplication.cache.ts │ │ │ │ └── i32_comparison.cache.ts │ │ ├── validation │ │ │ ├── README.txt │ │ │ └── parse │ │ │ │ └── source.spec.ts │ │ └── regression │ │ │ └── README.txt │ ├── webworker │ │ └── .gitignore │ ├── compat │ │ ├── README.md │ │ ├── api │ │ │ └── validation │ │ │ │ └── texture │ │ │ │ └── cubeArray.spec.ts │ │ └── compatibility_test.ts │ ├── listing.ts │ ├── idl │ │ ├── README.txt │ │ ├── exposed.http.html │ │ └── exposed.https.html │ └── util │ │ └── memory.ts ├── common │ ├── internal │ │ ├── version.ts │ │ ├── query │ │ │ ├── validQueryPart.ts │ │ │ └── separators.ts │ │ ├── util.ts │ │ ├── test_suite_listing.ts │ │ └── logging │ │ │ └── result.ts │ ├── framework │ │ ├── test_group.ts │ │ ├── on_shutdown.ts │ │ └── metadata.ts │ ├── util │ │ ├── timeout.ts │ │ └── wpt_reftest_wait.ts │ └── tools │ │ ├── version.ts │ │ └── .eslintrc.json ├── stress │ ├── queue │ │ └── README.txt │ ├── texture │ │ └── README.txt │ ├── adapter │ │ └── README.txt │ ├── queries │ │ ├── README.txt │ │ ├── occlusion.spec.ts │ │ └── resolve.spec.ts │ ├── shaders │ │ └── README.txt │ ├── compute │ │ └── README.txt │ ├── memory │ │ ├── README.txt │ │ └── churn.spec.ts │ ├── webworker │ │ └── .gitignore │ ├── device │ │ ├── README.txt │ │ ├── sampler_allocation.spec.ts │ │ ├── render_bundle_allocation.spec.ts │ │ ├── shader_module_allocation.spec.ts │ │ ├── command_encoder_allocation.spec.ts │ │ ├── pipeline_layout_allocation.spec.ts │ │ ├── render_pipeline_allocation.spec.ts │ │ ├── bind_group_layout_allocation.spec.ts │ │ ├── compute_pipeline_allocation.spec.ts │ │ ├── buffer_allocation.spec.ts │ │ ├── texture_allocation.spec.ts │ │ └── query_set_allocation.spec.ts │ ├── render │ │ └── README.txt │ ├── README.txt │ └── listing.ts ├── resources │ ├── webgpu.png │ ├── four-colors.avif │ ├── four-colors.bmp │ ├── four-colors.gif │ ├── four-colors.ico │ ├── four-colors.jpg │ ├── four-colors.png │ ├── four-colors.webp │ ├── four-colors-h264-bt601.mp4 │ ├── four-colors-vp8-bt601.webm │ ├── four-colors-vp9-bt601.mp4 │ ├── four-colors-vp9-bt601.webm │ ├── four-colors-vp9-bt709.webm │ ├── four-colors-rotate-180-cw.jpg │ ├── four-colors-rotate-270-cw.jpg │ ├── four-colors-rotate-90-cw.jpg │ ├── four-colors-h264-bt601-hflip.mp4 │ ├── four-colors-h264-bt601-vflip.mp4 │ ├── four-colors-vp9-bt601-hflip.mp4 │ ├── four-colors-vp9-bt601-vflip.mp4 │ ├── cache │ │ └── webgpu │ │ │ └── shader │ │ │ └── execution │ │ │ ├── abs.bin │ │ │ ├── cos.bin │ │ │ ├── dot.bin │ │ │ ├── exp.bin │ │ │ ├── fma.bin │ │ │ ├── log.bin │ │ │ ├── max.bin │ │ │ ├── min.bin │ │ │ ├── mix.bin │ │ │ ├── pow.bin │ │ │ ├── sin.bin │ │ │ ├── tan.bin │ │ │ ├── acos.bin │ │ │ ├── acosh.bin │ │ │ ├── asin.bin │ │ │ ├── asinh.bin │ │ │ ├── atan.bin │ │ │ ├── atan2.bin │ │ │ ├── atanh.bin │ │ │ ├── ceil.bin │ │ │ ├── clamp.bin │ │ │ ├── cosh.bin │ │ │ ├── cross.bin │ │ │ ├── exp2.bin │ │ │ ├── floor.bin │ │ │ ├── fract.bin │ │ │ ├── frexp.bin │ │ │ ├── ldexp.bin │ │ │ ├── log2.bin │ │ │ ├── modf.bin │ │ │ ├── round.bin │ │ │ ├── sign.bin │ │ │ ├── sinh.bin │ │ │ ├── sqrt.bin │ │ │ ├── step.bin │ │ │ ├── tanh.bin │ │ │ ├── trunc.bin │ │ │ ├── bitcast.bin │ │ │ ├── degrees.bin │ │ │ ├── distance.bin │ │ │ ├── fwidth.bin │ │ │ ├── length.bin │ │ │ ├── radians.bin │ │ │ ├── reflect.bin │ │ │ ├── refract.bin │ │ │ ├── saturate.bin │ │ │ ├── normalize.bin │ │ │ ├── smoothstep.bin │ │ │ ├── transpose.bin │ │ │ ├── derivatives.bin │ │ │ ├── determinant.bin │ │ │ ├── faceForward.bin │ │ │ ├── inverseSqrt.bin │ │ │ ├── pack2x16float.bin │ │ │ ├── quantizeToF16.bin │ │ │ ├── unpack2x16float.bin │ │ │ ├── unpack2x16snorm.bin │ │ │ ├── unpack2x16unorm.bin │ │ │ ├── unpack4x8snorm.bin │ │ │ ├── unpack4x8unorm.bin │ │ │ ├── binary │ │ │ ├── af_addition.bin │ │ │ ├── af_division.bin │ │ │ ├── af_logical.bin │ │ │ ├── f16_logical.bin │ │ │ ├── f32_logical.bin │ │ │ ├── af_remainder.bin │ │ │ ├── ai_arithmetic.bin │ │ │ ├── f16_addition.bin │ │ │ ├── f16_division.bin │ │ │ ├── f16_remainder.bin │ │ │ ├── f32_addition.bin │ │ │ ├── f32_division.bin │ │ │ ├── f32_remainder.bin │ │ │ ├── af_subtraction.bin │ │ │ ├── f16_subtraction.bin │ │ │ ├── f32_subtraction.bin │ │ │ ├── i32_arithmetic.bin │ │ │ ├── i32_comparison.bin │ │ │ ├── u32_arithmetic.bin │ │ │ ├── u32_comparison.bin │ │ │ ├── af_matrix_addition.bin │ │ │ ├── af_multiplication.bin │ │ │ ├── f16_multiplication.bin │ │ │ ├── f32_multiplication.bin │ │ │ ├── af_matrix_subtraction.bin │ │ │ ├── f16_matrix_addition.bin │ │ │ ├── f32_matrix_addition.bin │ │ │ ├── f16_matrix_subtraction.bin │ │ │ ├── f32_matrix_subtraction.bin │ │ │ ├── af_matrix_matrix_multiplication.bin │ │ │ ├── af_matrix_scalar_multiplication.bin │ │ │ ├── af_matrix_vector_multiplication.bin │ │ │ ├── f16_matrix_matrix_multiplication.bin │ │ │ ├── f16_matrix_scalar_multiplication.bin │ │ │ ├── f16_matrix_vector_multiplication.bin │ │ │ ├── f32_matrix_matrix_multiplication.bin │ │ │ ├── f32_matrix_scalar_multiplication.bin │ │ │ └── f32_matrix_vector_multiplication.bin │ │ │ └── unary │ │ │ ├── af_arithmetic.bin │ │ │ ├── af_assignment.bin │ │ │ ├── ai_arithmetic.bin │ │ │ ├── ai_assignment.bin │ │ │ ├── f16_arithmetic.bin │ │ │ ├── f16_conversion.bin │ │ │ ├── f32_arithmetic.bin │ │ │ ├── f32_conversion.bin │ │ │ ├── i32_arithmetic.bin │ │ │ ├── i32_conversion.bin │ │ │ ├── u32_conversion.bin │ │ │ └── bool_conversion.bin │ ├── four-colors-h264-bt601-rotate-180.mp4 │ ├── four-colors-h264-bt601-rotate-270.mp4 │ ├── four-colors-h264-bt601-rotate-90.mp4 │ ├── four-colors-vp9-bt601-rotate-180.mp4 │ ├── four-colors-vp9-bt601-rotate-270.mp4 │ ├── four-colors-vp9-bt601-rotate-90.mp4 │ └── four-colors.svg └── manual │ ├── webworker │ └── .gitignore │ └── README.txt ├── tools ├── websocket-logger │ ├── .gitignore │ ├── package.json │ ├── .eslintrc.json │ ├── README.md │ ├── main.js │ └── package-lock.json ├── dev_server ├── gen_cache ├── run_wpt_ref_tests ├── run_deno ├── run_node ├── server ├── eslint-plugin-gpuweb-cts │ ├── index.js │ ├── package.json │ ├── trailing-space-anywhere.js │ └── tabs-anywhere.js ├── validate ├── gen_wpt_cfg_unchunked.json ├── gen_wpt_cfg_chunked2sec.json ├── gen_listings_and_webworkers ├── merge_listing_times ├── checklist └── gen_version ├── deploy_key.enc ├── .gitattributes ├── docs ├── intro │ └── convert_to_issue.png └── deno.md ├── w3c.json ├── prettier.config.js ├── .vscode └── README.md ├── node.tsconfig.json ├── babel.config.js ├── .eslint-resolver.js ├── .github └── workflows │ ├── push.yml │ └── pr.yml ├── README.md └── standalone ├── third_party └── jquery │ └── LICENSE.txt └── webgpu-logo-notext.svg /.eslintignore: -------------------------------------------------------------------------------- 1 | /src/external/* 2 | -------------------------------------------------------------------------------- /src/demo/a/README.txt: -------------------------------------------------------------------------------- 1 | README for a/ 2 | -------------------------------------------------------------------------------- /src/demo/a/b/README.txt: -------------------------------------------------------------------------------- 1 | README for a/b/ 2 | -------------------------------------------------------------------------------- /tools/websocket-logger/.gitignore: -------------------------------------------------------------------------------- 1 | /wslog-*.txt 2 | -------------------------------------------------------------------------------- /src/unittests/README.txt: -------------------------------------------------------------------------------- 1 | Unit tests for CTS framework. 2 | -------------------------------------------------------------------------------- /src/webgpu/README.txt: -------------------------------------------------------------------------------- 1 | WebGPU conformance test suite. 2 | -------------------------------------------------------------------------------- /src/common/internal/version.ts: -------------------------------------------------------------------------------- 1 | export const version = 'unknown'; 2 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/buffers/README.txt: -------------------------------------------------------------------------------- 1 | GPUBuffer tests. 2 | -------------------------------------------------------------------------------- /src/stress/queue/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering GPUQueue usage. 2 | -------------------------------------------------------------------------------- /src/stress/texture/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering texture usage. 2 | -------------------------------------------------------------------------------- /deploy_key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/deploy_key.enc -------------------------------------------------------------------------------- /src/demo/README.txt: -------------------------------------------------------------------------------- 1 | Demo test suite for manually testing test runners. 2 | -------------------------------------------------------------------------------- /src/stress/adapter/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering use of GPUAdapter. 2 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/external_texture/README.txt: -------------------------------------------------------------------------------- 1 | Tests for external textures. -------------------------------------------------------------------------------- /src/webgpu/api/validation/resource_usages/buffer/README.txt: -------------------------------------------------------------------------------- 1 | TODO: look at texture,* 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | src/resources/cache/hashes.json linguist-generated=true 3 | -------------------------------------------------------------------------------- /src/common/framework/test_group.ts: -------------------------------------------------------------------------------- 1 | export { makeTestGroup } from '../internal/test_group.js'; 2 | -------------------------------------------------------------------------------- /src/resources/webgpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/webgpu.png -------------------------------------------------------------------------------- /src/webgpu/api/README.txt: -------------------------------------------------------------------------------- 1 | Tests for full coverage of the Javascript API surface of WebGPU. 2 | -------------------------------------------------------------------------------- /src/webgpu/shader/README.txt: -------------------------------------------------------------------------------- 1 | Tests for full coverage of the shaders that can be passed to WebGPU. -------------------------------------------------------------------------------- /src/webgpu/shader/execution/README.txt: -------------------------------------------------------------------------------- 1 | Tests that check the result of valid shader execution. 2 | -------------------------------------------------------------------------------- /docs/intro/convert_to_issue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/docs/intro/convert_to_issue.png -------------------------------------------------------------------------------- /src/resources/four-colors.avif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.avif -------------------------------------------------------------------------------- /src/resources/four-colors.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.bmp -------------------------------------------------------------------------------- /src/resources/four-colors.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.gif -------------------------------------------------------------------------------- /src/resources/four-colors.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.ico -------------------------------------------------------------------------------- /src/resources/four-colors.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.jpg -------------------------------------------------------------------------------- /src/resources/four-colors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.png -------------------------------------------------------------------------------- /src/resources/four-colors.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors.webp -------------------------------------------------------------------------------- /src/stress/queries/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering use of GPUQuerySet objects and related operations. 2 | -------------------------------------------------------------------------------- /src/stress/shaders/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering very long-running and/or resource-intensive shaders. 2 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/canvas/README.txt: -------------------------------------------------------------------------------- 1 | Tests for WebGPU and OffscreenCanvas presentation. 2 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/README.txt: -------------------------------------------------------------------------------- 1 | Positive and negative tests for all the validation rules of the API. 2 | -------------------------------------------------------------------------------- /src/demo/webworker/.gitignore: -------------------------------------------------------------------------------- 1 | # DIRECTORY RESERVED FOR GENERATED FILES. See gen_listings_and_webworkers. 2 | * 3 | -------------------------------------------------------------------------------- /src/manual/webworker/.gitignore: -------------------------------------------------------------------------------- 1 | # DIRECTORY RESERVED FOR GENERATED FILES. See gen_listings_and_webworkers. 2 | * 3 | -------------------------------------------------------------------------------- /src/stress/compute/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering operations specific to GPUComputePipeline and GPUComputePass. 2 | -------------------------------------------------------------------------------- /src/stress/memory/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering allocation and usage of various types of GPUBuffer objects. 2 | -------------------------------------------------------------------------------- /src/stress/webworker/.gitignore: -------------------------------------------------------------------------------- 1 | # DIRECTORY RESERVED FOR GENERATED FILES. See gen_listings_and_webworkers. 2 | * 3 | -------------------------------------------------------------------------------- /src/webgpu/webworker/.gitignore: -------------------------------------------------------------------------------- 1 | # DIRECTORY RESERVED FOR GENERATED FILES. See gen_listings_and_webworkers. 2 | * 3 | -------------------------------------------------------------------------------- /src/unittests/webworker/.gitignore: -------------------------------------------------------------------------------- 1 | # DIRECTORY RESERVED FOR GENERATED FILES. See gen_listings_and_webworkers. 2 | * 3 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/render_pass/README.txt: -------------------------------------------------------------------------------- 1 | Render pass stuff other than commands (which are in command_buffer/). 2 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/render_pass/README.txt: -------------------------------------------------------------------------------- 1 | Render pass stuff other than commands (which are in encoding/cmds/). 2 | -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp8-bt601.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp8-bt601.webm -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601.webm -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt709.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt709.webm -------------------------------------------------------------------------------- /src/webgpu/shader/validation/README.txt: -------------------------------------------------------------------------------- 1 | Positive and negative tests for all the validation rules of the shading language. 2 | -------------------------------------------------------------------------------- /w3c.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": [96877, 125519], 3 | "contacts": ["tidoust", "Kangz", "grorg"], 4 | "repo-type": ["tests"] 5 | } -------------------------------------------------------------------------------- /src/resources/four-colors-rotate-180-cw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-rotate-180-cw.jpg -------------------------------------------------------------------------------- /src/resources/four-colors-rotate-270-cw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-rotate-270-cw.jpg -------------------------------------------------------------------------------- /src/resources/four-colors-rotate-90-cw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-rotate-90-cw.jpg -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601-hflip.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601-hflip.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601-vflip.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601-vflip.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601-hflip.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601-hflip.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601-vflip.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601-vflip.mp4 -------------------------------------------------------------------------------- /src/unittests/unit_test.ts: -------------------------------------------------------------------------------- 1 | import { Fixture } from '../common/framework/fixture.js'; 2 | 3 | export class UnitTest extends Fixture {} 4 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/copyToTexture/README.txt: -------------------------------------------------------------------------------- 1 | Tests for copyToTexture from all possible sources (video, canvas, ImageBitmap, ...) 2 | -------------------------------------------------------------------------------- /src/stress/device/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering GPUDevice usage, primarily focused on stressing allocation 2 | of various resources. 3 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/abs.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/abs.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/cos.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/cos.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/dot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/dot.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/exp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/exp.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/fma.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/fma.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/log.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/log.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/max.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/max.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/min.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/min.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/mix.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/mix.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/pow.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/pow.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/sin.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/sin.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/tan.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/tan.bin -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601-rotate-180.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601-rotate-180.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601-rotate-270.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601-rotate-270.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-h264-bt601-rotate-90.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-h264-bt601-rotate-90.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601-rotate-180.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601-rotate-180.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601-rotate-270.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601-rotate-270.mp4 -------------------------------------------------------------------------------- /src/resources/four-colors-vp9-bt601-rotate-90.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/four-colors-vp9-bt601-rotate-90.mp4 -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/acos.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/acos.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/acosh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/acosh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/asin.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/asin.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/asinh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/asinh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/atan.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/atan.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/atan2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/atan2.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/atanh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/atanh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/ceil.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/ceil.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/clamp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/clamp.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/cosh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/cosh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/cross.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/cross.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/exp2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/exp2.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/floor.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/floor.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/fract.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/fract.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/frexp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/frexp.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/ldexp.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/ldexp.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/log2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/log2.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/modf.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/modf.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/round.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/round.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/sign.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/sign.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/sinh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/sinh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/sqrt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/sqrt.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/step.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/step.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/tanh.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/tanh.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/trunc.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/trunc.bin -------------------------------------------------------------------------------- /src/webgpu/api/regression/README.txt: -------------------------------------------------------------------------------- 1 | One-off tests that reproduce API bugs found in implementations to prevent the bugs from 2 | appearing again. 3 | -------------------------------------------------------------------------------- /src/webgpu/compat/README.md: -------------------------------------------------------------------------------- 1 | # Compatibility mode tests 2 | 3 | To run these tests in compatibility mode use `q=webgpu:compat,*&compatibility=1`. 4 | -------------------------------------------------------------------------------- /tools/dev_server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../src/common/tools/setup-ts-in-node.js'); 4 | require('../src/common/tools/dev_server.ts'); 5 | -------------------------------------------------------------------------------- /tools/gen_cache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../src/common/tools/setup-ts-in-node.js'); 4 | require('../src/common/tools/gen_cache.ts'); 5 | -------------------------------------------------------------------------------- /src/common/internal/query/validQueryPart.ts: -------------------------------------------------------------------------------- 1 | /** Applies to group parts, test parts, params keys. */ 2 | export const validQueryPart = /^[a-zA-Z0-9_]+$/; 3 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/bitcast.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/bitcast.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/degrees.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/degrees.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/distance.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/distance.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/fwidth.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/fwidth.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/length.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/length.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/radians.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/radians.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/reflect.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/reflect.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/refract.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/refract.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/saturate.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/saturate.bin -------------------------------------------------------------------------------- /src/webgpu/shader/regression/README.txt: -------------------------------------------------------------------------------- 1 | One-off tests that reproduce shader bugs found in implementations to prevent the bugs from 2 | appearing again. 3 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/normalize.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/normalize.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/smoothstep.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/smoothstep.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/transpose.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/transpose.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/derivatives.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/derivatives.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/determinant.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/determinant.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/faceForward.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/faceForward.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/inverseSqrt.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/inverseSqrt.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/pack2x16float.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/pack2x16float.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/quantizeToF16.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/quantizeToF16.bin -------------------------------------------------------------------------------- /src/webgpu/api/validation/state/device_lost/README.txt: -------------------------------------------------------------------------------- 1 | Tests of behavior while the device is lost. 2 | 3 | - x= every method in the API. 4 | 5 | TODO: implement 6 | -------------------------------------------------------------------------------- /tools/run_wpt_ref_tests: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../src/common/tools/setup-ts-in-node.js'); 4 | require('../src/common/tools/run_wpt_ref_tests.ts'); 5 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unpack2x16float.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unpack2x16float.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unpack2x16snorm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unpack2x16snorm.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unpack2x16unorm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unpack2x16unorm.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unpack4x8snorm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unpack4x8snorm.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unpack4x8unorm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unpack4x8unorm.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_division.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_division.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_logical.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_logical.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_logical.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_logical.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_logical.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_logical.bin -------------------------------------------------------------------------------- /tools/run_deno: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run --unstable --allow-read --allow-write --allow-env --allow-net=deno.land --no-check 2 | 3 | import '../out/common/runtime/cmdline.js'; -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_remainder.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_remainder.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/ai_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/ai_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_division.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_division.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_remainder.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_remainder.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_division.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_division.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_remainder.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_remainder.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/af_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/af_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/af_assignment.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/af_assignment.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/ai_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/ai_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/ai_assignment.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/ai_assignment.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/f16_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/f16_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/f16_conversion.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/f16_conversion.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/f32_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/f32_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/f32_conversion.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/f32_conversion.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/i32_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/i32_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/i32_conversion.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/i32_conversion.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/u32_conversion.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/u32_conversion.bin -------------------------------------------------------------------------------- /src/stress/render/README.txt: -------------------------------------------------------------------------------- 1 | Stress tests covering operations specific to GPURenderPipeline, GPURenderPass, and GPURenderBundle. 2 | 3 | - Issuing draw calls with huge counts. 4 | -------------------------------------------------------------------------------- /prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | printWidth: 100, 3 | 4 | arrowParens: 'avoid', 5 | bracketSpacing: true, 6 | singleQuote: true, 7 | trailingComma: 'es5', 8 | }; 9 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_subtraction.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_subtraction.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_subtraction.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/i32_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/i32_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/i32_comparison.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/i32_comparison.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/u32_arithmetic.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/u32_arithmetic.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/u32_comparison.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/u32_comparison.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/unary/bool_conversion.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/unary/bool_conversion.bin -------------------------------------------------------------------------------- /tools/run_node: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Run test suites under node. 4 | 5 | require('../src/common/tools/setup-ts-in-node.js'); 6 | require('../src/common/runtime/cmdline.ts'); 7 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_matrix_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_matrix_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_multiplication.bin -------------------------------------------------------------------------------- /src/webgpu/api/operation/README.txt: -------------------------------------------------------------------------------- 1 | Tests that check the result of performing valid WebGPU operations, taking advantage of 2 | parameterization to exercise interactions between features. 3 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_matrix_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_matrix_subtraction.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_matrix_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_matrix_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_matrix_addition.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_matrix_addition.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_matrix_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_matrix_subtraction.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_matrix_subtraction.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_matrix_subtraction.bin -------------------------------------------------------------------------------- /tools/server: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Launch a server that runs tests server-side on demand. 4 | 5 | require('../src/common/tools/setup-ts-in-node.js'); 6 | require('../src/common/runtime/server.ts'); 7 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_matrix_matrix_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_matrix_scalar_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/af_matrix_vector_multiplication.bin -------------------------------------------------------------------------------- /tools/eslint-plugin-gpuweb-cts/index.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | rules: { 3 | 'string-trailing-space': require('./trailing-space-anywhere'), 4 | 'string-tabs': require('./tabs-anywhere'), 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_matrix_matrix_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_matrix_scalar_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f16_matrix_vector_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_matrix_matrix_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_matrix_scalar_multiplication.bin -------------------------------------------------------------------------------- /src/resources/cache/webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpuweb/cts/HEAD/src/resources/cache/webgpu/shader/execution/binary/f32_matrix_vector_multiplication.bin -------------------------------------------------------------------------------- /tools/validate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Validate several properties of test files and the tests in them. 4 | 5 | require('../src/common/tools/setup-ts-in-node.js'); 6 | require('../src/common/tools/validate.ts'); 7 | -------------------------------------------------------------------------------- /tools/gen_wpt_cfg_unchunked.json: -------------------------------------------------------------------------------- 1 | { 2 | "suite": "webgpu", 3 | "out": "../out-wpt/cts.https.html", 4 | "outVariantList": "../gen/webgpu_variant_list.json", 5 | "template": "../src/common/templates/cts.https.html" 6 | } 7 | -------------------------------------------------------------------------------- /tools/eslint-plugin-gpuweb-cts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "eslint-plugin-gpuweb-cts", 3 | "version": "0.0.0", 4 | "author": "WebGPU CTS Contributors", 5 | "private": true, 6 | "license": "BSD-3-Clause", 7 | "main": "index.js" 8 | } 9 | -------------------------------------------------------------------------------- /src/stress/README.txt: -------------------------------------------------------------------------------- 1 | WebGPU stress tests. 2 | 3 | These tests are separated from conformance tests because they are more likely to 4 | cause browser hangs and crashes. 5 | 6 | TODO: Look at dEQP (OpenGL ES and Vulkan) and WebGL for inspiration here. 7 | -------------------------------------------------------------------------------- /src/demo/a/b.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = 'Description for b.spec.ts'; 2 | 3 | import { makeTestGroup } from '../../common/framework/test_group.js'; 4 | import { UnitTest } from '../../unittests/unit_test.js'; 5 | 6 | export const g = makeTestGroup(UnitTest); 7 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/README.txt: -------------------------------------------------------------------------------- 1 | Tests for Web platform-specific interactions like GPUCanvasContext and canvas, WebXR, 2 | ImageBitmaps, and video APIs. 3 | 4 | TODO(#922): Also hopefully tests for user-initiated readbacks from WebGPU canvases 5 | (printing, save image as, etc.) 6 | -------------------------------------------------------------------------------- /tools/gen_wpt_cfg_chunked2sec.json: -------------------------------------------------------------------------------- 1 | { 2 | "suite": "webgpu", 3 | "out": "../out-wpt/cts-chunked2sec.https.html", 4 | "outVariantList": "../gen/webgpu_variant_list_chunked2sec.json", 5 | "template": "../src/common/templates/cts.https.html", 6 | "maxChunkTimeMS": 2000 7 | } 8 | -------------------------------------------------------------------------------- /src/stress/listing.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-restricted-paths */ 2 | import { TestSuiteListing } from '../common/internal/test_suite_listing.js'; 3 | import { makeListing } from '../common/tools/crawl.js'; 4 | 5 | export const listing: Promise = makeListing(__filename); 6 | -------------------------------------------------------------------------------- /src/webgpu/listing.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-restricted-paths */ 2 | import { TestSuiteListing } from '../common/internal/test_suite_listing.js'; 3 | import { makeListing } from '../common/tools/crawl.js'; 4 | 5 | export const listing: Promise = makeListing(__filename); 6 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | // Overrides for the root eslintrc (all other rules still take effect) 3 | "rules": { 4 | // This rule is only used to enforce trackForCleanup() which we don't use in reftests. 5 | "no-restricted-syntax": "off" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/unittests/listing.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-restricted-paths */ 2 | import { TestSuiteListing } from '../common/internal/test_suite_listing.js'; 3 | import { makeListing } from '../common/tools/crawl.js'; 4 | 5 | export const listing: Promise = makeListing(__filename); 6 | -------------------------------------------------------------------------------- /src/demo/file_depth_2/in_single_child_dir/r.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = 'Description for r.spec.ts'; 2 | 3 | import { makeTestGroup } from '../../../common/framework/test_group.js'; 4 | import { UnitTest } from '../../../unittests/unit_test.js'; 5 | 6 | export const g = makeTestGroup(UnitTest); 7 | -------------------------------------------------------------------------------- /.vscode/README.md: -------------------------------------------------------------------------------- 1 | You can use `settings.json`/`tasks.json` in this directory for personal settings. 2 | 3 | To edit the default settings, modify `cts.code-workspace`, which is checked into the repository. 4 | 5 | Note: VS Code's setting precedence is `.vscode/` > `cts.code-workspace` > global user settings. 6 | -------------------------------------------------------------------------------- /src/demo/a.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = 'Description for a.spec.ts'; 2 | 3 | import { makeTestGroup } from '../common/framework/test_group.js'; 4 | import { UnitTest } from '../unittests/unit_test.js'; 5 | 6 | export const g = makeTestGroup(UnitTest); 7 | 8 | g.test('not_implemented_yet').unimplemented(); 9 | -------------------------------------------------------------------------------- /src/demo/a/b/d.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = 'Description for d.spec.ts'; 2 | 3 | import { makeTestGroup } from '../../../common/framework/test_group.js'; 4 | import { UnitTest } from '../../../unittests/unit_test.js'; 5 | 6 | export const g = makeTestGroup(UnitTest); 7 | 8 | g.test('test_depth_2,in_single_child_file').fn(() => {}); 9 | -------------------------------------------------------------------------------- /src/common/internal/util.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Error without a stack, which can be used to fatally exit from `tool/` scripts with a 3 | * user-friendly message (and no confusing stack). 4 | */ 5 | export class StacklessError extends Error { 6 | constructor(message: string) { 7 | super(message); 8 | this.stack = undefined; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tools/websocket-logger/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket-logger", 3 | "version": "0.0.0", 4 | "author": "WebGPU CTS Contributors", 5 | "private": true, 6 | "license": "BSD-3-Clause", 7 | "type": "module", 8 | "scripts": { 9 | "start": "node main.js" 10 | }, 11 | "dependencies": { 12 | "ws": "^8.13.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/demo/json.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = 'Description for a.spec.ts'; 2 | 3 | import { makeTestGroup } from '../common/framework/test_group.js'; 4 | import { UnitTest } from '../unittests/unit_test.js'; 5 | 6 | export const g = makeTestGroup(UnitTest); 7 | 8 | g.test('json') 9 | .paramsSimple([{ p: { x: 1, y: 'two' } }]) 10 | .fn(() => {}); 11 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/README.txt: -------------------------------------------------------------------------------- 1 | Test everything that shouldn't be valid without a higher-than-specified limit. 2 | 3 | - x= that limit {default, max supported (if different), lower than default (TODO: if allowed)} 4 | 5 | One file for each limit name. 6 | 7 | TODO: implement 8 | TODO: Also test that "alignment" limits require a power of 2. 9 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/command_buffer/queries/README.txt: -------------------------------------------------------------------------------- 1 | TODO: test the behavior of creating/using/resolving queries. 2 | - timestamp 3 | - nested (e.g. timestamp inside occlusion query), if any such cases are valid. Try 4 | writing to the same query set (at same or different indices), if valid. Check results make sense. 5 | - start a query (all types) with no draw calls 6 | -------------------------------------------------------------------------------- /src/common/util/timeout.ts: -------------------------------------------------------------------------------- 1 | /** Defined by WPT. Like `setTimeout`, but applies a timeout multiplier for slow test systems. */ 2 | declare const step_timeout: undefined | typeof setTimeout; 3 | 4 | /** 5 | * Equivalent of `setTimeout`, but redirects to WPT's `step_timeout` when it is defined. 6 | */ 7 | export const timeout = typeof step_timeout !== 'undefined' ? step_timeout : setTimeout; 8 | -------------------------------------------------------------------------------- /tools/gen_listings_and_webworkers: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Crawl a suite directory (e.g. src/webgpu/) to generate a listing.js containing 4 | // the listing of test files in the suite, and some generated test files 5 | // (like suite/serviceworker/**/*.spec.js). 6 | 7 | require('../src/common/tools/setup-ts-in-node.js'); 8 | require('../src/common/tools/gen_listings_and_webworkers.ts'); 9 | -------------------------------------------------------------------------------- /tools/merge_listing_times: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // See `docs/adding_timing_metadata.md` for an explanation of listing times, and 4 | // a walkthrough on adding entries for new tests. 5 | 6 | require('../src/common/tools/setup-ts-in-node.js'); 7 | 8 | // See the help message in this file for info on how to use the tool. 9 | require('../src/common/tools/merge_listing_times.ts'); 10 | -------------------------------------------------------------------------------- /src/common/tools/version.ts: -------------------------------------------------------------------------------- 1 | export const version = (() => { 2 | try { 3 | /* eslint-disable-next-line n/no-restricted-require */ 4 | return require('child_process') 5 | .execSync('git describe --always --abbrev=0 --dirty') 6 | .toString() 7 | .trim(); 8 | } catch { 9 | // Fail gracefully if git is not available. 10 | return 'unknown'; 11 | } 12 | })(); 13 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/rendering/robust_access_index.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | TODO: Test that drawIndexedIndirect accesses the index buffer robustly. 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 7 | 8 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 9 | -------------------------------------------------------------------------------- /src/stress/queries/occlusion.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for occlusion queries. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('many').desc(`Tests a huge number of occlusion queries in a render pass.`).unimplemented(); 11 | -------------------------------------------------------------------------------- /src/webgpu/idl/README.txt: -------------------------------------------------------------------------------- 1 | Tests to check that the WebGPU IDL is correctly implemented, for examples that objects exposed 2 | exactly the correct members, and that methods throw when passed incomplete dictionaries. 3 | 4 | See https://github.com/gpuweb/cts/issues/332 5 | 6 | TODO: exposed.html.ts: Test all WebGPU interfaces instead of just some of them. 7 | TODO: Check prototype chains. (Add a helper in IDLTest for this.) 8 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/interval_filter.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Indicates bounds that acceptance intervals need to be within to avoid inputs 3 | * being filtered out. This is used for const-eval tests, since going OOB will 4 | * cause a validation error not an execution error. 5 | */ 6 | export type IntervalFilter = 7 | | 'finite' // Expected to be finite in the interval numeric space 8 | | 'unfiltered'; // No expectations 9 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/i32_arithmetic.cache.ts: -------------------------------------------------------------------------------- 1 | import { i32 } from '../../../../util/conversion.js'; 2 | import { fullI32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/i32_arithmetic', { 6 | negation: () => { 7 | return fullI32Range().map(e => { 8 | return { input: i32(e), expected: i32(-e) }; 9 | }); 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /tools/websocket-logger/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": "2022", 4 | // Needed because eslint doesn't pick up the subdirectory package.json. 5 | "sourceType": "module" 6 | }, 7 | "rules": { 8 | "no-process-exit": "off", 9 | // Rules needed because eslint doesn't pick up the subdirectory package.json. 10 | "node/no-unsupported-features/es-syntax": "off", 11 | "node/no-missing-import": "off" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/queue/README.txt: -------------------------------------------------------------------------------- 1 | Tests for validation that occurs inside queued operations 2 | (submit, writeBuffer, writeTexture, copyExternalImageToTexture). 3 | 4 | BufferMapStatesToTest = { 5 | mapped -> unmapped, 6 | mapped at creation -> unmapped, 7 | mapping pending -> unmapped, 8 | pending -> mapped (await map), 9 | unmapped -> pending (noawait map), 10 | created mapped-at-creation, 11 | } 12 | 13 | Note writeTexture is tested in image_copy. 14 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/ai_arithmetic.cache.ts: -------------------------------------------------------------------------------- 1 | import { abstractInt } from '../../../../util/conversion.js'; 2 | import { fullI64Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/ai_arithmetic', { 6 | negation: () => { 7 | return fullI64Range().map(e => { 8 | return { input: abstractInt(e), expected: abstractInt(-e) }; 9 | }); 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /src/common/tools/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "@typescript-eslint/parser", 3 | "parserOptions": { "project": "./tsconfig.json" }, 4 | "rules": { 5 | "no-console": "off", 6 | "no-process-exit": "off", 7 | "node/no-unpublished-import": "off", 8 | "node/no-unpublished-require": "off", 9 | "@typescript-eslint/no-var-requires": "off", 10 | "n/no-restricted-requires": "off", 11 | "n/no-restricted-import": "off", 12 | "n/no-process-exit": "off" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/stress/queries/resolve.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for query resolution. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('many_large_sets') 11 | .desc( 12 | `Tests a huge number of resolveQuerySet operations on a huge number of 13 | query sets between render passes.` 14 | ) 15 | .unimplemented(); 16 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/memory_allocation/README.txt: -------------------------------------------------------------------------------- 1 | Try to stress memory allocators in the implementation and driver. 2 | 3 | TODO: plan and implement 4 | - Tests which (pseudo-randomly?) allocate a bunch of memory and then assert things about the memory 5 | (it's not aliased, it's valid to read and write in various ways, accesses read/write the correct data) 6 | - Possibly also with OOB accesses/robust buffer access? 7 | - Tests which are targeted against particular known implementation details 8 | -------------------------------------------------------------------------------- /src/common/internal/query/separators.ts: -------------------------------------------------------------------------------- 1 | /** Separator between big parts: suite:file:test:case */ 2 | export const kBigSeparator = ':'; 3 | 4 | /** Separator between path,to,file or path,to,test */ 5 | export const kPathSeparator = ','; 6 | 7 | /** Separator between k=v;k=v */ 8 | export const kParamSeparator = ';'; 9 | 10 | /** Separator between key and value in k=v */ 11 | export const kParamKVSeparator = '='; 12 | 13 | /** Final wildcard, if query is not single-case */ 14 | export const kWildcard = '*'; 15 | -------------------------------------------------------------------------------- /src/webgpu/idl/exposed.http.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WebGPU exposed items (non-HTTPS) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /tools/websocket-logger/README.md: -------------------------------------------------------------------------------- 1 | This simple utility receives messages via a WebSocket and writes them out to both the command line 2 | and a file called `wslog-TIMESTAMP.txt` in the working directory. 3 | 4 | It can be used to receive logs from CTS in a way that's resistant to test crashes and totally 5 | independent of which runtime is being used (e.g. standalone, WPT, Node). 6 | It's used in particular to capture timing results for predefining "chunking" of the CTS for WPT. 7 | 8 | To set up, use `npm ci`. 9 | To launch, use `npm start`. 10 | -------------------------------------------------------------------------------- /src/resources/four-colors.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/webgpu/idl/exposed.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WebGPU exposed items (HTTPS) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/derivatives.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { sparseScalarF32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('derivatives', { 6 | scalar: () => { 7 | return FP.f32.generateScalarPairToIntervalCases( 8 | sparseScalarF32Range(), 9 | sparseScalarF32Range(), 10 | 'unfiltered', 11 | FP.f32.subtractionInterval 12 | ); 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/f16_arithmetic.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { scalarF16Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/f16_arithmetic', { 6 | negation: () => { 7 | return FP.f16.generateScalarToIntervalCases( 8 | scalarF16Range({ neg_norm: 250, neg_sub: 20, pos_sub: 20, pos_norm: 250 }), 9 | 'unfiltered', 10 | FP.f16.negationInterval 11 | ); 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/f32_arithmetic.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { scalarF32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/f32_arithmetic', { 6 | negation: () => { 7 | return FP.f32.generateScalarToIntervalCases( 8 | scalarF32Range({ neg_norm: 250, neg_sub: 20, pos_sub: 20, pos_norm: 250 }), 9 | 'unfiltered', 10 | FP.f32.negationInterval 11 | ); 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/features/README.txt: -------------------------------------------------------------------------------- 1 | Test every method or option that shouldn't be allowed without a feature enabled. 2 | If the feature is not enabled, any use of an enum value added by a feature must be an 3 | *exception*, per . 4 | 5 | - x= that feature {enabled, disabled} 6 | 7 | Generally one file for each feature name, but some may be grouped (e.g. one file for all optional 8 | query types, one file for all optional texture formats). 9 | 10 | TODO: implement 11 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/af_arithmetic.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { scalarF64Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/af_arithmetic', { 6 | negation: () => { 7 | return FP.abstract.generateScalarToIntervalCases( 8 | scalarF64Range({ neg_norm: 250, neg_sub: 20, pos_sub: 20, pos_norm: 250 }), 9 | 'unfiltered', 10 | FP.abstract.negationInterval 11 | ); 12 | }, 13 | }); 14 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_colorspace-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_colorspace (ref) 4 | 5 | 6 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/checklist: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Takes a list of queries and checks that: 4 | // - Every query matches something in the repository 5 | // - Every case in the repository matches exactly one query 6 | // This is used to ensure that tracking spreadsheet is complete (not missing any tests) 7 | // and every query in it is valid (e.g. renames have been applied, and new tests added 8 | // to the spreadsheet have also been added to the CTS). 9 | 10 | require('../src/common/tools/setup-ts-in-node.js'); 11 | require('../src/common/tools/checklist.ts'); 12 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/async_ordering/README.txt: -------------------------------------------------------------------------------- 1 | Test ordering of async resolutions between promises returned by the following calls (and possibly 2 | between multiple of the same call), where there are constraints on the ordering. 3 | Spec issue: https://github.com/gpuweb/gpuweb/issues/962 4 | 5 | TODO: plan and implement 6 | - createReadyPipeline() (not sure if this actually has any ordering constraints) 7 | - cmdbuf.executionTime 8 | - device.popErrorScope() 9 | - device.lost 10 | - queue.onSubmittedWorkDone() 11 | - buffer.mapAsync() 12 | - shadermodule.getCompilationInfo() 13 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/compute_pipeline/entry_point_name.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | TODO: 3 | - Test some weird but valid values for entry point name (both module and pipeline creation 4 | should succeed). 5 | - Test using each of many entry points in the module (should succeed). 6 | - Test using an entry point with the wrong stage (should fail). 7 | `; 8 | 9 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 10 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 11 | 12 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 13 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/delay_get_texture.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU delay getCurrentTexture 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/threading/README.txt: -------------------------------------------------------------------------------- 1 | Tests for behavior with multiple threads (main thread + workers). 2 | 3 | TODO: plan and implement 4 | - 'postMessage' 5 | Try postMessage'ing an object of every type (to same or different thread) 6 | - {main -> main, main -> worker, worker -> main, worker1 -> worker1, worker1 -> worker2} 7 | - through {global postMessage, MessageChannel} 8 | - {in, not in} transferrable object list, when valid 9 | - 'concurrency' 10 | Short tight loop doing many of an action from two threads at the same time 11 | - e.g. {create {buffer, texture, shader, pipeline}} 12 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/trunc.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarToIntervalCases( 9 | FP[trait].scalarRange(), 10 | 'unfiltered', 11 | FP[trait].truncInterval 12 | ); 13 | }, 14 | })) 15 | .reduce((a, b) => ({ ...a, ...b }), {}); 16 | 17 | export const d = makeCaseCache('trunc', cases); 18 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/delay_get_texture-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU delay getCurrentTexture (ref) 4 | 5 | 6 | 7 | 17 | 18 | -------------------------------------------------------------------------------- /src/common/internal/test_suite_listing.ts: -------------------------------------------------------------------------------- 1 | // A listing of all specs within a single suite. This is the (awaited) type of 2 | // `groups` in '{cts,unittests}/listing.ts' and `listing` in the auto-generated 3 | // 'out/{cts,unittests}/listing.js' files (see tools/gen_listings_and_webworkers). 4 | export type TestSuiteListing = TestSuiteListingEntry[]; 5 | 6 | export type TestSuiteListingEntry = TestSuiteListingEntrySpec | TestSuiteListingEntryReadme; 7 | 8 | interface TestSuiteListingEntrySpec { 9 | readonly file: string[]; 10 | } 11 | 12 | interface TestSuiteListingEntryReadme { 13 | readonly file: string[]; 14 | readonly readme: string; 15 | } 16 | -------------------------------------------------------------------------------- /src/stress/memory/churn.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests covering robustness in the presence of heavy buffer and texture 3 | memory churn. 4 | `; 5 | 6 | import { makeTestGroup } from '../../common/framework/test_group.js'; 7 | import { GPUTest } from '../../webgpu/gpu_test.js'; 8 | 9 | export const g = makeTestGroup(GPUTest); 10 | 11 | g.test('churn') 12 | .desc( 13 | `Allocates and populates a huge number of buffers and textures over time, 14 | retaining some while dropping or explicitly destroying others. When finished, 15 | verifies the expected contents of any remaining buffers and textures.` 16 | ) 17 | .unimplemented(); 18 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/max.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarPairToIntervalCases( 9 | FP[trait].sparseScalarRange(), 10 | FP[trait].sparseScalarRange(), 11 | 'unfiltered', 12 | FP[trait].maxInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('max', cases); 19 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/min.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarPairToIntervalCases( 9 | FP[trait].sparseScalarRange(), 10 | FP[trait].sparseScalarRange(), 11 | 'unfiltered', 12 | FP[trait].minInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('min', cases); 19 | -------------------------------------------------------------------------------- /src/common/framework/on_shutdown.ts: -------------------------------------------------------------------------------- 1 | const shutdownTasks: (() => void)[] = []; 2 | 3 | /** 4 | * Register a callback to be run during program shutdown (triggered, e.g., by the 'beforeunload' 5 | * event when the webpage is being closed). 6 | * 7 | * Note such tasks should be synchronous functions; otherwise, they probably won't complete. 8 | */ 9 | export function registerShutdownTask(task: () => void) { 10 | shutdownTasks.push(task); 11 | } 12 | 13 | /** Run all shutdown tasks. Should only be called during program shutdown. */ 14 | export function runShutdownTasks() { 15 | for (const task of shutdownTasks) { 16 | task(); 17 | } 18 | shutdownTasks.length = 0; 19 | } 20 | -------------------------------------------------------------------------------- /node.tsconfig.json: -------------------------------------------------------------------------------- 1 | // Typescript configuration for compile sources and 2 | // dependent files for usage directly with Node.js. This 3 | // is useful for running scripts in tools/ directly with Node 4 | // without including extra dependencies. 5 | { 6 | "extends": "./tsconfig.json", 7 | "compilerOptions": { 8 | "module": "commonjs", 9 | "incremental": false, 10 | "noEmit": false, 11 | "declaration": false, 12 | }, 13 | 14 | "exclude": [ 15 | "src/common/runtime/wpt.ts", 16 | "src/common/runtime/standalone.ts", 17 | "src/common/runtime/helper/test_worker.ts", 18 | "src/webgpu/web_platform/worker/worker_launcher.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/encoding/cmds/render_pass.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Validation tests for render pass encoding. 3 | Does **not** test usage scopes (resource_usages/), GPUProgrammablePassEncoder (programmable_pass), 4 | dynamic state (dynamic_render_state.spec.ts), or GPURenderEncoderBase (render.spec.ts). 5 | 6 | TODO: 7 | - executeBundles: 8 | - with {zero, one, multiple} bundles where {zero, one} of them are invalid objects 9 | `; 10 | 11 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 12 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 13 | 14 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 15 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/unpack2x16float.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { fullU32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unpack2x16float', { 6 | u32_const: () => { 7 | return FP.f32.generateU32ToIntervalCases( 8 | fullU32Range(), 9 | 'finite', 10 | FP.f32.unpack2x16floatInterval 11 | ); 12 | }, 13 | u32_non_const: () => { 14 | return FP.f32.generateU32ToIntervalCases( 15 | fullU32Range(), 16 | 'unfiltered', 17 | FP.f32.unpack2x16floatInterval 18 | ); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/unpack2x16snorm.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { fullU32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unpack2x16snorm', { 6 | u32_const: () => { 7 | return FP.f32.generateU32ToIntervalCases( 8 | fullU32Range(), 9 | 'finite', 10 | FP.f32.unpack2x16snormInterval 11 | ); 12 | }, 13 | u32_non_const: () => { 14 | return FP.f32.generateU32ToIntervalCases( 15 | fullU32Range(), 16 | 'unfiltered', 17 | FP.f32.unpack2x16snormInterval 18 | ); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/unpack2x16unorm.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { fullU32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unpack2x16unorm', { 6 | u32_const: () => { 7 | return FP.f32.generateU32ToIntervalCases( 8 | fullU32Range(), 9 | 'finite', 10 | FP.f32.unpack2x16unormInterval 11 | ); 12 | }, 13 | u32_non_const: () => { 14 | return FP.f32.generateU32ToIntervalCases( 15 | fullU32Range(), 16 | 'unfiltered', 17 | FP.f32.unpack2x16unormInterval 18 | ); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/unpack4x8snorm.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { fullU32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unpack4x8snorm', { 6 | u32_const: () => { 7 | return FP.f32.generateU32ToIntervalCases( 8 | fullU32Range(), 9 | 'finite', 10 | FP.f32.unpack4x8snormInterval 11 | ); 12 | }, 13 | u32_non_const: () => { 14 | return FP.f32.generateU32ToIntervalCases( 15 | fullU32Range(), 16 | 'unfiltered', 17 | FP.f32.unpack4x8snormInterval 18 | ); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/unpack4x8unorm.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { fullU32Range } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unpack4x8unorm', { 6 | u32_const: () => { 7 | return FP.f32.generateU32ToIntervalCases( 8 | fullU32Range(), 9 | 'finite', 10 | FP.f32.unpack4x8unormInterval 11 | ); 12 | }, 13 | u32_non_const: () => { 14 | return FP.f32.generateU32ToIntervalCases( 15 | fullU32Range(), 16 | 'unfiltered', 17 | FP.f32.unpack4x8unormInterval 18 | ); 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /tools/websocket-logger/main.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs/promises'; 2 | import { WebSocketServer } from 'ws'; 3 | 4 | const wss = new WebSocketServer({ port: 59497 }); 5 | 6 | const timestamp = new Date().toISOString().slice(0, 19).replace(/[:]/g, '-'); 7 | const filename = `wslog-${timestamp}.txt`; 8 | const f = await fs.open(filename, 'w'); 9 | console.log(`Writing to ${filename}`); 10 | console.log('Ctrl-C to stop'); 11 | 12 | process.on('SIGINT', () => { 13 | console.log(`\nWritten to ${filename}`); 14 | process.exit(); 15 | }); 16 | 17 | wss.on('connection', async ws => { 18 | ws.on('message', data => { 19 | const s = data.toString(); 20 | f.write(s + '\n'); 21 | console.log(s); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /src/stress/device/sampler_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUSampler objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUSampler objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUSampler objects over time. Objects 17 | are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true); 3 | return { 4 | presets: ['@babel/preset-typescript'], 5 | plugins: [ 6 | 'const-enum', 7 | [ 8 | 'add-header-comment', 9 | { 10 | header: ['AUTO-GENERATED - DO NOT EDIT. Source: https://github.com/gpuweb/cts'], 11 | }, 12 | ], 13 | ], 14 | compact: false, 15 | // Keeps comments from getting hoisted to the end of the previous line of code. 16 | // (Also keeps lines close to their original line numbers - but for WPT we 17 | // reformat with prettier anyway.) 18 | retainLines: true, 19 | shouldPrintComment: val => !/eslint|prettier-ignore/.test(val), 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/saturate.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract] 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .map(trait => ({ 8 | [`${trait}`]: () => { 9 | return FP[trait].generateScalarToIntervalCases( 10 | [...linearRange(0.0, 1.0, 20), ...FP[trait].scalarRange()], 11 | 'unfiltered', 12 | FP[trait].saturateInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('saturate', cases); 19 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/buffer/threading.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | TODO: 3 | - Try to map on one thread while {pending, mapped, mappedAtCreation, mappedAtCreation+unmap+mapped} 4 | on another thread. 5 | - Invalid to postMessage a mapped range's ArrayBuffer or ArrayBufferView 6 | {with, without} it being in the transfer array. 7 | - Copy GPUBuffer to another thread while {pending, mapped mappedAtCreation} on {same,diff} thread 8 | (valid), then try to map on that thread (invalid) 9 | `; 10 | 11 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 12 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 13 | 14 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 15 | -------------------------------------------------------------------------------- /src/stress/device/render_bundle_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPURenderBundle objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPURenderBundle objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPURenderBundle objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/stress/device/shader_module_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUShaderModule objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUShaderModule objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUShaderModule objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/tanh.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarToIntervalCases( 9 | FP[trait].scalarRange(), 10 | 'unfiltered', 11 | // tanh has an inherited accuracy, so is only expected to be as accurate as f32 12 | FP[trait !== 'abstract' ? trait : 'f32'].tanhInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('tanh', cases); 19 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_clear.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_clear 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/stress/device/command_encoder_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUCommandEncoder objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUCommandEncoder objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUCommandEncoder objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/stress/device/pipeline_layout_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUPipelineLayout objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUPipelineLayout objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUPipelineLayout objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/stress/device/render_pipeline_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPURenderPipeline objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPURenderPipeline objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPURenderPipeline objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/asinh.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarToIntervalCases( 9 | FP[trait].scalarRange(), 10 | 'unfiltered', 11 | // asinh has an inherited accuracy, so is only expected to be as accurate as f32 12 | FP[trait !== 'abstract' ? trait : 'f32'].asinhInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('asinh', cases); 19 | -------------------------------------------------------------------------------- /src/stress/device/bind_group_layout_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUBindGroupLayout objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUBindGroupLayout objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUBindGroupLayout objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/stress/device/compute_pipeline_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUComputePipeline objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUComputePipeline objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous') 15 | .desc( 16 | `Tests allocation and implicit GC of many GPUComputePipeline objects over time. 17 | Objects are sequentially created and dropped for GC over a very large number of 18 | iterations.` 19 | ) 20 | .unimplemented(); 21 | -------------------------------------------------------------------------------- /src/unittests/crc32.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Test for crc32 utility functions. 3 | `; 4 | 5 | import { makeTestGroup } from '../common/framework/test_group.js'; 6 | import { crc32, toHexString } from '../common/util/crc32.js'; 7 | 8 | import { UnitTest } from './unit_test.js'; 9 | 10 | class F extends UnitTest { 11 | test(content: string, expect: string): void { 12 | const got = toHexString(crc32(content)); 13 | this.expect( 14 | expect === got, 15 | ` 16 | expected: ${expect} 17 | got: ${got}` 18 | ); 19 | } 20 | } 21 | 22 | export const g = makeTestGroup(F); 23 | 24 | g.test('strings').fn(t => { 25 | t.test('', '00000000'); 26 | t.test('hello world', '0d4a1185'); 27 | t.test('123456789', 'cbf43926'); 28 | }); 29 | -------------------------------------------------------------------------------- /.eslint-resolver.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const resolve = require('resolve'); // eslint-disable-line node/no-extraneous-require 3 | 4 | // Implements the following resolver spec: 5 | // https://github.com/benmosher/eslint-plugin-import/blob/master/resolvers/README.md 6 | exports.interfaceVersion = 2; 7 | 8 | exports.resolve = function (source, file, config) { 9 | if (resolve.isCore(source)) return { found: true, path: null }; 10 | 11 | source = source.replace(/\.js$/, '.ts'); 12 | try { 13 | return { 14 | found: true, 15 | path: resolve.sync(source, { 16 | extensions: [], 17 | basedir: path.dirname(path.resolve(file)), 18 | ...config, 19 | }), 20 | }; 21 | } catch (err) { 22 | return { found: false }; 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/create-pattern-data-url.ts: -------------------------------------------------------------------------------- 1 | // creates a 4x4 pattern 2 | export default function createPatternDataURL() { 3 | const patternSize = 4; 4 | const ctx = document.createElement('canvas').getContext('2d')!; 5 | ctx.canvas.width = patternSize; 6 | ctx.canvas.height = patternSize; 7 | 8 | const b = [0, 0, 0, 255]; 9 | const t = [0, 0, 0, 0]; 10 | const r = [255, 0, 0, 255]; 11 | const g = [0, 255, 0, 255]; 12 | 13 | const imageData = new ImageData(patternSize, patternSize); 14 | // prettier-ignore 15 | imageData.data.set([ 16 | b, t, t, r, 17 | t, b, g, t, 18 | t, r, b, t, 19 | g, t, t, b, 20 | ].flat()); 21 | ctx.putImageData(imageData, 0, 0); 22 | return { patternSize, imageData, dataURL: ctx.canvas.toDataURL() }; 23 | } 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/radians.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract] 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .map(trait => ({ 7 | [`${trait}`]: () => { 8 | return FP[trait].generateScalarToIntervalCases( 9 | FP[trait].scalarRange(), 10 | trait !== 'abstract' ? 'unfiltered' : 'finite', 11 | // radians has an inherited accuracy, so abstract is only expected to be as accurate as f32 12 | FP[trait !== 'abstract' ? trait : 'f32'].radiansInterval 13 | ); 14 | }, 15 | })) 16 | .reduce((a, b) => ({ ...a, ...b }), {}); 17 | 18 | export const d = makeCaseCache('radians', cases); 19 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/ai_assignment.cache.ts: -------------------------------------------------------------------------------- 1 | import { abstractInt, i32, u32 } from '../../../../util/conversion.js'; 2 | import { fullI32Range, fullI64Range, fullU32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | export const d = makeCaseCache('unary/ai_assignment', { 6 | abstract: () => { 7 | return fullI64Range().map(n => { 8 | return { input: abstractInt(n), expected: abstractInt(n) }; 9 | }); 10 | }, 11 | i32: () => { 12 | return fullI32Range().map(n => { 13 | return { input: abstractInt(BigInt(n)), expected: i32(n) }; 14 | }); 15 | }, 16 | u32: () => { 17 | return fullU32Range().map(n => { 18 | return { input: abstractInt(BigInt(n)), expected: u32(n) }; 19 | }); 20 | }, 21 | }); 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/resize_observer.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU resize_observer 4 | 5 | 6 | 7 | 8 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/common/util/wpt_reftest_wait.ts: -------------------------------------------------------------------------------- 1 | import { timeout } from './timeout.js'; 2 | 3 | // Copied from https://github.com/web-platform-tests/wpt/blob/master/common/reftest-wait.js 4 | 5 | /** 6 | * Remove the `reftest-wait` class on the document element. 7 | * The reftest runner will wait with taking a screenshot while 8 | * this class is present. 9 | * 10 | * See https://web-platform-tests.org/writing-tests/reftests.html#controlling-when-comparison-occurs 11 | */ 12 | export function takeScreenshot() { 13 | document.documentElement.classList.remove('reftest-wait'); 14 | } 15 | 16 | /** 17 | * Call `takeScreenshot()` after a delay of at least `ms` milliseconds. 18 | * @param {number} ms - milliseconds 19 | */ 20 | export function takeScreenshotDelayed(ms: number) { 21 | timeout(() => { 22 | takeScreenshot(); 23 | }, ms); 24 | } 25 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/round.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // See https://github.com/gpuweb/cts/issues/2766 for details 5 | const kIssue2766Value = { 6 | abstract: 0x8000_0000_0000_0000, 7 | f32: 0x8000_0000, 8 | f16: 0x8000, 9 | }; 10 | 11 | // Cases: [f32|f16|abstract] 12 | const cases = (['f32', 'f16', 'abstract'] as const) 13 | .map(trait => ({ 14 | [`${trait}`]: () => { 15 | return FP[trait].generateScalarToIntervalCases( 16 | [kIssue2766Value[trait], ...FP[trait].scalarRange()], 17 | 'unfiltered', 18 | FP[trait].roundInterval 19 | ); 20 | }, 21 | })) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('round', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_clear-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_clear (ref) 4 | 5 | 6 | 7 | 8 | 9 | 22 | 23 | -------------------------------------------------------------------------------- /src/manual/README.txt: -------------------------------------------------------------------------------- 1 | WebGPU tests that require manual intervention. 2 | 3 | Many of these test may be HTML pages rather than using the harness. 4 | 5 | Add informal notes here on possible stress tests. 6 | 7 | - Suspending or hibernating the machine. 8 | - Manually crashing or relaunching the browser's GPU process. 9 | - Triggering a GPU driver reset (TDR). 10 | - Forcibly or gracefully unplugging an external GPU. 11 | - Forcibly switching between GPUs using OS/driver settings. 12 | - Backgrounding the browser (on mobile OSes). 13 | - Moving windows between displays attached to different hardware adapters. 14 | - Moving windows between displays with different color properties (HDR/WCG). 15 | - Unplugging a laptop. 16 | - Switching between canvas and XR device output. 17 | 18 | TODO: look at dEQP (OpenGL ES and Vulkan) and WebGL for inspiration here. 19 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/canvas/getPreferredCanvasFormat.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests for navigator.gpu.getPreferredCanvasFormat. 3 | `; 4 | 5 | import { Fixture, SkipTestCase } from '../../../common/framework/fixture.js'; 6 | import { makeTestGroup } from '../../../common/framework/test_group.js'; 7 | 8 | export const g = makeTestGroup(Fixture); 9 | 10 | g.test('value') 11 | .desc( 12 | ` 13 | Ensure getPreferredCanvasFormat returns one of the valid values. 14 | ` 15 | ) 16 | .beforeAllSubcases(t => { 17 | if (typeof navigator === 'undefined') { 18 | throw new SkipTestCase('navigator does not exist in this environment'); 19 | } 20 | }) 21 | .fn(t => { 22 | const preferredFormat = navigator.gpu.getPreferredCanvasFormat(); 23 | t.expect(preferredFormat === 'bgra8unorm' || preferredFormat === 'rgba8unorm'); 24 | }); 25 | -------------------------------------------------------------------------------- /tools/gen_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Get the current git hash, and save (overwrite) it into gen/.../version.js 4 | // so it can be read when running inside the browser. 5 | 6 | /* eslint-disable no-console */ 7 | 8 | require('../src/common/tools/setup-ts-in-node.js'); 9 | const fs = require('fs'); 10 | 11 | const myself = 'tools/gen_version'; 12 | if (!fs.existsSync(myself)) { 13 | console.error('Must be run from repository root'); 14 | process.exit(1); 15 | } 16 | 17 | const { version } = require('../src/common/tools/version.ts'); 18 | 19 | fs.mkdirSync('./gen/common/internal', { recursive: true }); 20 | // This will be copied into the various other build directories. 21 | fs.writeFileSync( 22 | './gen/common/internal/version.js', 23 | `\ 24 | // AUTO-GENERATED - DO NOT EDIT. See ${myself}. 25 | 26 | export const version = '${version}'; 27 | ` 28 | ); 29 | -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Push CI 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | branches: [main] 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-latest 15 | timeout-minutes: 15 16 | steps: 17 | - uses: actions/checkout@v2.3.1 18 | with: 19 | persist-credentials: false 20 | - uses: actions/setup-node@v2-beta 21 | with: 22 | node-version: "16.x" 23 | - run: npm ci 24 | - run: | 25 | npm test 26 | mkdir deploy-build/ 27 | cp -r README.md src standalone out out-wpt docs tools deploy-build/ 28 | - uses: JamesIves/github-pages-deploy-action@4.1.4 29 | with: 30 | BRANCH: gh-pages 31 | FOLDER: deploy-build 32 | CLEAN: true 33 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/unary.ts: -------------------------------------------------------------------------------- 1 | import { 2 | abstractFloatShaderBuilder, 3 | abstractIntShaderBuilder, 4 | basicExpressionBuilder, 5 | ShaderBuilder, 6 | } from '../expression.js'; 7 | 8 | /* @returns a ShaderBuilder that evaluates a prefix unary operation */ 9 | export function unary(op: string): ShaderBuilder { 10 | return basicExpressionBuilder(value => `${op}(${value})`); 11 | } 12 | 13 | /* @returns a ShaderBuilder that evaluates a prefix unary operation that returns AbstractFloats */ 14 | export function abstractFloatUnary(op: string): ShaderBuilder { 15 | return abstractFloatShaderBuilder(value => `${op}(${value})`); 16 | } 17 | 18 | /* @returns a ShaderBuilder that evaluates a prefix unary operation that returns AbstractInts */ 19 | export function abstractIntUnary(op: string): ShaderBuilder { 20 | return abstractIntShaderBuilder(value => `${op}(${value})`); 21 | } 22 | -------------------------------------------------------------------------------- /src/unittests/basic.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Basic unit tests for test framework. 3 | `; 4 | 5 | import { makeTestGroup } from '../common/framework/test_group.js'; 6 | 7 | import { UnitTest } from './unit_test.js'; 8 | 9 | export const g = makeTestGroup(UnitTest); 10 | 11 | g.test('test,sync').fn(_t => {}); 12 | 13 | g.test('test,async').fn(async _t => {}); 14 | 15 | g.test('test_with_params,sync') 16 | .paramsSimple([{}]) 17 | .fn(t => { 18 | t.debug(JSON.stringify(t.params)); 19 | }); 20 | 21 | g.test('test_with_params,async') 22 | .paramsSimple([{}]) 23 | .fn(t => { 24 | t.debug(JSON.stringify(t.params)); 25 | }); 26 | 27 | g.test('test_with_params,private_params') 28 | .paramsSimple([ 29 | { a: 1, b: 2, _result: 3 }, // 30 | { a: 4, b: -3, _result: 1 }, 31 | ]) 32 | .fn(t => { 33 | const { a, b, _result } = t.params; 34 | t.expect(a + b === _result); 35 | }); 36 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_colorspace_bgra8unorm.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_colorspace_bgra8unorm 4 | 5 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_colorspace_rgba16float.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_colorspace_rgba16float 4 | 5 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_colorspace_rgba8unorm.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_colorspace_rgba8unorm 4 | 5 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/tan.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract] 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .map(trait => ({ 8 | [`${trait}`]: () => { 9 | return FP[trait].generateScalarToIntervalCases( 10 | [ 11 | // Well-defined accuracy range 12 | ...linearRange(-Math.PI, Math.PI, 100), 13 | ...FP[trait].scalarRange(), 14 | ], 15 | 'unfiltered', 16 | // tan has an inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].tanInterval 18 | ); 19 | }, 20 | })) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('tan', cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/ceil.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | const kSmallMagnitudeTestValues = [0.1, 0.9, 1.0, 1.1, 1.9, -0.1, -0.9, -1.0, -1.1, -1.9]; 5 | 6 | // See https://github.com/gpuweb/cts/issues/2766 for details 7 | const kIssue2766Value = { 8 | f32: 0x8000_0000, 9 | f16: 0x8000, 10 | abstract: 0x8000_0000_0000_0000, 11 | }; 12 | 13 | // Cases: [f32|f16] 14 | const cases = (['f32', 'f16', 'abstract'] as const) 15 | .map(trait => ({ 16 | [`${trait}`]: () => { 17 | return FP[trait].generateScalarToIntervalCases( 18 | [...kSmallMagnitudeTestValues, kIssue2766Value[trait], ...FP[trait].scalarRange()], 19 | 'unfiltered', 20 | FP[trait].ceilInterval 21 | ); 22 | }, 23 | })) 24 | .reduce((a, b) => ({ ...a, ...b }), {}); 25 | 26 | export const d = makeCaseCache('ceil', cases); 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/cos.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract] 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .map(trait => ({ 8 | [`${trait}`]: () => { 9 | return FP[trait].generateScalarToIntervalCases( 10 | [ 11 | // Well-defined accuracy range 12 | ...linearRange(-Math.PI, Math.PI, 100), 13 | ...FP[trait].scalarRange(), 14 | ], 15 | trait === 'abstract' ? 'finite' : 'unfiltered', 16 | // cos has an absolute accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].cosInterval 18 | ); 19 | }, 20 | })) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('cos', cases); 24 | -------------------------------------------------------------------------------- /src/stress/device/buffer_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUBuffer objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting').desc(`Tests allocation of many coexisting GPUBuffer objects.`).unimplemented(); 11 | 12 | g.test('continuous,with_destroy') 13 | .desc( 14 | `Tests allocation and destruction of many GPUBuffer objects over time. Objects 15 | are sequentially created and destroyed over a very large number of iterations.` 16 | ) 17 | .unimplemented(); 18 | 19 | g.test('continuous,no_destroy') 20 | .desc( 21 | `Tests allocation and implicit GC of many GPUBuffer objects over time. Objects 22 | are sequentially created and dropped for GC over a very large number of 23 | iterations.` 24 | ) 25 | .unimplemented(); 26 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/sin.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract] 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .map(trait => ({ 8 | [`${trait}`]: () => { 9 | return FP[trait].generateScalarToIntervalCases( 10 | [ 11 | // Well-defined accuracy range 12 | ...linearRange(-Math.PI, Math.PI, 100), 13 | ...FP[trait].scalarRange(), 14 | ], 15 | trait === 'abstract' ? 'finite' : 'unfiltered', 16 | // sin has an inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].sinInterval 18 | ); 19 | }, 20 | })) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('sin', cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/floor.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | const kSmallMagnitudeTestValues = [0.1, 0.9, 1.0, 1.1, 1.9, -0.1, -0.9, -1.0, -1.1, -1.9]; 5 | 6 | // See https://github.com/gpuweb/cts/issues/2766 for details 7 | const kIssue2766Value = { 8 | abstract: 0x8000_0000_0000_0000, 9 | f32: 0x8000_0000, 10 | f16: 0x8000, 11 | }; 12 | 13 | // Cases: [f32|f16|abstract] 14 | const cases = (['f32', 'f16', 'abstract'] as const) 15 | .map(trait => ({ 16 | [`${trait}`]: () => { 17 | return FP[trait].generateScalarToIntervalCases( 18 | [...kSmallMagnitudeTestValues, kIssue2766Value[trait], ...FP[trait].scalarRange()], 19 | 'unfiltered', 20 | FP[trait].floorInterval 21 | ); 22 | }, 23 | })) 24 | .reduce((a, b) => ({ ...a, ...b }), {}); 25 | 26 | export const d = makeCaseCache('floor', cases); 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/sqrt.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16]_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([true, false] as const).map(nonConst => ({ 8 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 9 | if (trait === 'abstract' && nonConst) { 10 | return []; 11 | } 12 | return FP[trait].generateScalarToIntervalCases( 13 | FP[trait].scalarRange(), 14 | nonConst ? 'unfiltered' : 'finite', 15 | // sqrt has an inherited accuracy, so is only expected to be as accurate as f32 16 | FP[trait !== 'abstract' ? trait : 'f32'].sqrtInterval 17 | ); 18 | }, 19 | })) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('sqrt', cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/buffers/threading.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests for valid operations with various client-side thread-shared state of GPUBuffers. 3 | 4 | States to test: 5 | - mapping pending 6 | - mapped 7 | - mapped at creation 8 | - mapped at creation, then unmapped 9 | - mapped at creation, then unmapped, then re-mapped 10 | - destroyed 11 | 12 | TODO: Look for more things to test. 13 | `; 14 | 15 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 16 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 17 | 18 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 19 | 20 | g.test('serialize') 21 | .desc( 22 | `Copy a GPUBuffer to another thread while it is in various states on 23 | {the sending thread, yet another thread}.` 24 | ) 25 | .unimplemented(); 26 | 27 | g.test('destroyed') 28 | .desc(`Destroy on one thread while in various states in another thread.`) 29 | .unimplemented(); 30 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/cosh.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([true, false] as const).map(nonConst => ({ 8 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 9 | if (trait === 'abstract' && nonConst) { 10 | return []; 11 | } 12 | return FP[trait].generateScalarToIntervalCases( 13 | FP[trait].scalarRange(), 14 | nonConst ? 'unfiltered' : 'finite', 15 | // cosh has an inherited accuracy, so is only expected to be as accurate as f32 16 | FP[trait !== 'abstract' ? trait : 'f32'].coshInterval 17 | ); 18 | }, 19 | })) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('cosh', cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/sinh.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([true, false] as const).map(nonConst => ({ 8 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 9 | if (trait === 'abstract' && nonConst) { 10 | return []; 11 | } 12 | return FP[trait].generateScalarToIntervalCases( 13 | FP[trait].scalarRange(), 14 | nonConst ? 'unfiltered' : 'finite', 15 | // sinh has an inherited accuracy, so is only expected to be as accurate as f32 16 | FP[trait !== 'abstract' ? trait : 'f32'].sinhInterval 17 | ); 18 | }, 19 | })) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('sinh', cases); 24 | -------------------------------------------------------------------------------- /tools/eslint-plugin-gpuweb-cts/trailing-space-anywhere.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | meta: { 3 | type: 'suggestion', 4 | docs: { 5 | description: 6 | 'Trailing spaces are not allowed, even in multiline strings, due to WPT lint rules.', 7 | }, 8 | schema: [], 9 | }, 10 | create: context => { 11 | const sourceCode = context.getSourceCode(); 12 | 13 | return { 14 | Program: node => { 15 | for (let lineIdx = 0; lineIdx < sourceCode.lines.length; ++lineIdx) { 16 | const line = sourceCode.lines[lineIdx]; 17 | const match = /\s+$/.exec(line); 18 | if (match) { 19 | context.report({ 20 | node, 21 | loc: { line: lineIdx + 1, column: match.index }, 22 | message: 'Trailing spaces not allowed.', 23 | // fixer is hard to implement, so not implemented. 24 | }); 25 | } 26 | } 27 | }, 28 | }; 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /src/stress/device/texture_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUTexture objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUTexture objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous,with_destroy') 15 | .desc( 16 | `Tests allocation and destruction of many GPUTexture objects over time. Objects 17 | are sequentially created and destroyed over a very large number of iterations.` 18 | ) 19 | .unimplemented(); 20 | 21 | g.test('continuous,no_destroy') 22 | .desc( 23 | `Tests allocation and implicit GC of many GPUTexture objects over time. Objects 24 | are sequentially created and dropped for GC over a very large number of 25 | iterations.` 26 | ) 27 | .unimplemented(); 28 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f16_matrix_addition.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF16Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matCxR_[non_]const 6 | const mat_cases = ([2, 3, 4] as const) 7 | .flatMap(cols => 8 | ([2, 3, 4] as const).flatMap(rows => 9 | ([true, false] as const).map(nonConst => ({ 10 | [`mat${cols}x${rows}_${nonConst ? 'non_const' : 'const'}`]: () => { 11 | return FP.f16.generateMatrixPairToMatrixCases( 12 | sparseMatrixF16Range(cols, rows), 13 | sparseMatrixF16Range(cols, rows), 14 | nonConst ? 'unfiltered' : 'finite', 15 | FP.f16.additionMatrixMatrixInterval 16 | ); 17 | }, 18 | })) 19 | ) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('binary/f16_matrix_addition', mat_cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f32_matrix_addition.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matCxR_[non_]const 6 | const mat_cases = ([2, 3, 4] as const) 7 | .flatMap(cols => 8 | ([2, 3, 4] as const).flatMap(rows => 9 | ([true, false] as const).map(nonConst => ({ 10 | [`mat${cols}x${rows}_${nonConst ? 'non_const' : 'const'}`]: () => { 11 | return FP.f32.generateMatrixPairToMatrixCases( 12 | sparseMatrixF32Range(cols, rows), 13 | sparseMatrixF32Range(cols, rows), 14 | nonConst ? 'unfiltered' : 'finite', 15 | FP.f32.additionMatrixMatrixInterval 16 | ); 17 | }, 18 | })) 19 | ) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('binary/f32_matrix_addition', mat_cases); 24 | -------------------------------------------------------------------------------- /src/stress/device/query_set_allocation.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Stress tests for allocation of GPUQuerySet objects through GPUDevice. 3 | `; 4 | 5 | import { makeTestGroup } from '../../common/framework/test_group.js'; 6 | import { GPUTest } from '../../webgpu/gpu_test.js'; 7 | 8 | export const g = makeTestGroup(GPUTest); 9 | 10 | g.test('coexisting') 11 | .desc(`Tests allocation of many coexisting GPUQuerySet objects.`) 12 | .unimplemented(); 13 | 14 | g.test('continuous,with_destroy') 15 | .desc( 16 | `Tests allocation and destruction of many GPUQuerySet objects over time. Objects 17 | are sequentially created and destroyed over a very large number of iterations.` 18 | ) 19 | .unimplemented(); 20 | 21 | g.test('continuous,no_destroy') 22 | .desc( 23 | `Tests allocation and implicit GC of many GPUQuerySet objects over time. Objects 24 | are sequentially created and dropped for GC over a very large number of 25 | iterations.` 26 | ) 27 | .unimplemented(); 28 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_display_after_device_lost.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_display_after_device_lost 4 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/gpu_ref_test.ts: -------------------------------------------------------------------------------- 1 | import { assert } from '../../../common/util/util.js'; 2 | import { takeScreenshot, takeScreenshotDelayed } from '../../../common/util/wpt_reftest_wait.js'; 3 | 4 | interface GPURefTest { 5 | readonly device: GPUDevice; 6 | readonly queue: GPUQueue; 7 | } 8 | 9 | export function runRefTest(fn: (t: GPURefTest) => Promise | void): void { 10 | void (async () => { 11 | assert( 12 | typeof navigator !== 'undefined' && navigator.gpu !== undefined, 13 | 'No WebGPU implementation found' 14 | ); 15 | 16 | const adapter = await navigator.gpu.requestAdapter(); 17 | assert(adapter !== null); 18 | const device = await adapter.requestDevice(); 19 | assert(device !== null); 20 | const queue = device.queue; 21 | 22 | await fn({ device, queue }); 23 | 24 | takeScreenshotDelayed(50); 25 | })().catch(() => { 26 | // remove reftest-wait to mark end of test 27 | takeScreenshot(); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f16_matrix_subtraction.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF16Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matCxR_[non_]const 6 | const mat_cases = ([2, 3, 4] as const) 7 | .flatMap(cols => 8 | ([2, 3, 4] as const).flatMap(rows => 9 | ([true, false] as const).map(nonConst => ({ 10 | [`mat${cols}x${rows}_${nonConst ? 'non_const' : 'const'}`]: () => { 11 | return FP.f16.generateMatrixPairToMatrixCases( 12 | sparseMatrixF16Range(cols, rows), 13 | sparseMatrixF16Range(cols, rows), 14 | nonConst ? 'unfiltered' : 'finite', 15 | FP.f16.subtractionMatrixMatrixInterval 16 | ); 17 | }, 18 | })) 19 | ) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('binary/f16_matrix_subtraction', mat_cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f32_matrix_subtraction.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matCxR_[non_]const 6 | const mat_cases = ([2, 3, 4] as const) 7 | .flatMap(cols => 8 | ([2, 3, 4] as const).flatMap(rows => 9 | ([true, false] as const).map(nonConst => ({ 10 | [`mat${cols}x${rows}_${nonConst ? 'non_const' : 'const'}`]: () => { 11 | return FP.f32.generateMatrixPairToMatrixCases( 12 | sparseMatrixF32Range(cols, rows), 13 | sparseMatrixF32Range(cols, rows), 14 | nonConst ? 'unfiltered' : 'finite', 15 | FP.f32.subtractionMatrixMatrixInterval 16 | ); 17 | }, 18 | })) 19 | ) 20 | ) 21 | .reduce((a, b) => ({ ...a, ...b }), {}); 22 | 23 | export const d = makeCaseCache('binary/f32_matrix_subtraction', mat_cases); 24 | -------------------------------------------------------------------------------- /src/webgpu/compat/api/validation/texture/cubeArray.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests that you can not create cube array views in compat mode. 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { CompatibilityTest } from '../../../compatibility_test.js'; 7 | 8 | export const g = makeTestGroup(CompatibilityTest); 9 | g.test('cube_array') 10 | .desc('Test you cannot create a cube array texture view.') 11 | .params(u => u.combine('dimension', ['cube', 'cube-array'] as const)) 12 | .fn(t => { 13 | const { dimension } = t.params; 14 | const texture = t.createTextureTracked({ 15 | size: [1, 1, 6], 16 | format: 'rgba8unorm', 17 | usage: GPUTextureUsage.TEXTURE_BINDING, 18 | }); 19 | 20 | const isValid = dimension === 'cube'; 21 | t.expectGPUErrorInCompatibilityMode( 22 | 'validation', 23 | () => texture.createView({ dimension, format: 'rgba8unorm' }), 24 | !isValid 25 | ); 26 | }); 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/validation/parse/source.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = `Validation tests for source parsing`; 2 | 3 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 4 | import { ShaderValidationTest } from '../shader_validation_test.js'; 5 | 6 | export const g = makeTestGroup(ShaderValidationTest); 7 | 8 | g.test('valid_source') 9 | .desc(`Tests that a valid source is consumed successfully.`) 10 | .fn(t => { 11 | const code = ` 12 | @fragment 13 | fn main() -> @location(0) vec4 { 14 | return vec4(.4, .2, .3, .1); 15 | }`; 16 | t.expectCompileResult(true, code); 17 | }); 18 | 19 | g.test('empty') 20 | .desc(`Test that an empty source is consumed successfully.`) 21 | .fn(t => { 22 | t.expectCompileResult(true, ''); 23 | }); 24 | 25 | g.test('invalid_source') 26 | .desc(`Tests that a source which does not match the grammar fails.`) 27 | .fn(t => { 28 | t.expectCompileResult(false, 'invalid_source'); 29 | }); 30 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_bgra8unorm_opaque_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_bgra8unorm_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_bgra8unorm_opaque_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_bgra8unorm_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba8unorm_opaque_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba8unorm_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba8unorm_opaque_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba8unorm_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba16float_opaque_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba16float_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba16float_opaque_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba16float_opaque 4 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_complex-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_complex (ref) 4 | 5 | 6 | 7 | 8 | 9 | 26 | 27 | -------------------------------------------------------------------------------- /docs/deno.md: -------------------------------------------------------------------------------- 1 | # Running the CTS on Deno 2 | 3 | Since version 1.8, Deno experimentally implements the WebGPU API out of the box. 4 | You can use the `./tools/deno` script to run the CTS in Deno. To do this you 5 | will first need to install Deno: [stable](https://deno.land#installation), or 6 | build the main branch from source 7 | (`cargo install --git https://github.com/denoland/deno --bin deno`). 8 | 9 | On macOS and recent Linux, you can just run `./tools/run_deno` as is. On Windows and 10 | older Linux releases you will need to run 11 | `deno run --unstable --allow-read --allow-write --allow-env ./tools/deno`. 12 | 13 | ## Usage 14 | 15 | ``` 16 | Usage: 17 | tools/run_deno [OPTIONS...] QUERIES... 18 | tools/run_deno 'unittests:*' 'webgpu:buffers,*' 19 | Options: 20 | --verbose Print result/log of every test as it runs. 21 | --debug Include debug messages in logging. 22 | --print-json Print the complete result JSON in the output. 23 | --expectations Path to expectations file. 24 | ``` 25 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/maxBufferSize.spec.ts: -------------------------------------------------------------------------------- 1 | import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; 2 | 3 | const limit = 'maxBufferSize'; 4 | export const { g, description } = makeLimitTestGroup(limit); 5 | 6 | g.test('createBuffer,at_over') 7 | .desc(`Test using at and over ${limit} limit`) 8 | .params(kMaximumLimitBaseParams) 9 | .fn(async t => { 10 | const { limitTest, testValueName } = t.params; 11 | await t.testDeviceWithRequestedMaximumLimits( 12 | limitTest, 13 | testValueName, 14 | async ({ testValue, actualLimit, shouldError }) => { 15 | await t.testForValidationErrorWithPossibleOutOfMemoryError( 16 | () => { 17 | t.createBufferTracked({ 18 | usage: GPUBufferUsage.VERTEX, 19 | size: testValue, 20 | }); 21 | }, 22 | shouldError, 23 | `size: ${testValue}, limit: ${actualLimit}` 24 | ); 25 | } 26 | ); 27 | }); 28 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/pow.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([true, false] as const).map(nonConst => ({ 8 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 9 | if (trait === 'abstract' && nonConst) { 10 | return []; 11 | } 12 | return FP[trait].generateScalarPairToIntervalCases( 13 | FP[trait].scalarRange(), 14 | FP[trait].scalarRange(), 15 | nonConst ? 'unfiltered' : 'finite', 16 | // pow has an inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].powInterval 18 | ); 19 | }, 20 | })) 21 | ) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('pow', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/pipeline/default_layout.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests for default pipeline layouts. 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 7 | 8 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 9 | 10 | g.test('getBindGroupLayout_js_object') 11 | .desc( 12 | `Test that getBindGroupLayout returns [TODO: the same or a different, needs spec] object 13 | each time.` 14 | ) 15 | .unimplemented(); 16 | 17 | g.test('incompatible_with_explicit') 18 | .desc(`Test that default bind group layouts are never compatible with explicitly created ones.`) 19 | .unimplemented(); 20 | 21 | g.test('layout') 22 | .desc( 23 | `Test that bind group layouts of the default pipeline layout are correct by passing various 24 | shaders and then checking their computed bind group layouts are compatible with particular bind 25 | groups.` 26 | ) 27 | .unimplemented(); 28 | -------------------------------------------------------------------------------- /tools/eslint-plugin-gpuweb-cts/tabs-anywhere.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | meta: { 3 | type: 'suggestion', 4 | docs: { 5 | description: 6 | 'Indentation tabs are not allowed, even in multiline strings, due to WPT lint rules. This rule simply disallows tabs anywhere.', 7 | }, 8 | schema: [], 9 | }, 10 | create: context => { 11 | const sourceCode = context.getSourceCode(); 12 | 13 | return { 14 | Program: node => { 15 | for (let lineIdx = 0; lineIdx < sourceCode.lines.length; ++lineIdx) { 16 | const line = sourceCode.lines[lineIdx]; 17 | const matches = line.matchAll(/\t/g); 18 | for (const match of matches) { 19 | context.report({ 20 | node, 21 | loc: { line: lineIdx + 1, column: match.index }, 22 | message: 'Tabs not allowed.', 23 | // fixer is hard to implement, so not implemented. 24 | }); 25 | } 26 | } 27 | }, 28 | }; 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/encoding/queries/common.ts: -------------------------------------------------------------------------------- 1 | import { GPUTest } from '../../../../gpu_test.js'; 2 | 3 | export function createQuerySetWithType( 4 | t: GPUTest, 5 | type: GPUQueryType, 6 | count: GPUSize32 7 | ): GPUQuerySet { 8 | return t.createQuerySetTracked({ 9 | type, 10 | count, 11 | }); 12 | } 13 | 14 | export function beginRenderPassWithQuerySet( 15 | t: GPUTest, 16 | encoder: GPUCommandEncoder, 17 | querySet?: GPUQuerySet 18 | ): GPURenderPassEncoder { 19 | const view = t 20 | .createTextureTracked({ 21 | format: 'rgba8unorm' as const, 22 | size: { width: 16, height: 16, depthOrArrayLayers: 1 }, 23 | usage: GPUTextureUsage.RENDER_ATTACHMENT, 24 | }) 25 | .createView(); 26 | return encoder.beginRenderPass({ 27 | colorAttachments: [ 28 | { 29 | view, 30 | clearValue: { r: 1.0, g: 0.0, b: 0.0, a: 1.0 }, 31 | loadOp: 'clear', 32 | storeOp: 'store', 33 | }, 34 | ], 35 | occlusionQuerySet: querySet, 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/degrees.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | // abstract_non_const is empty and not used 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateScalarToIntervalCases( 14 | FP[trait].scalarRange(), 15 | nonConst ? 'unfiltered' : 'finite', 16 | // degrees has an inherited accuracy, so abstract is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].degreesInterval 18 | ); 19 | }, 20 | })) 21 | ) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('degrees', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/fwidth.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution tests for the 'fwidth' builtin function 3 | 4 | T is f32 or vecN 5 | fn fwidth(e:T) ->T 6 | Returns abs(dpdx(e)) + abs(dpdy(e)). 7 | `; 8 | 9 | import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; 10 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../../gpu_test.js'; 11 | 12 | import { d } from './fwidth.cache.js'; 13 | import { runFWidthTest } from './fwidth.js'; 14 | 15 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 16 | 17 | const builtin = 'fwidth'; 18 | 19 | g.test('f32') 20 | .specURL('https://www.w3.org/TR/WGSL/#derivative-builtin-functions') 21 | .params(u => 22 | u 23 | .combine('vectorize', [undefined, 2, 3, 4] as const) 24 | .combine('non_uniform_discard', [false, true]) 25 | ) 26 | .fn(async t => { 27 | const cases = await d.get('scalar'); 28 | runFWidthTest(t, cases, builtin, t.params.non_uniform_discard, t.params.vectorize); 29 | }); 30 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeX.spec.ts: -------------------------------------------------------------------------------- 1 | import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; 2 | 3 | const limit = 'maxComputeWorkgroupSizeX'; 4 | export const { g, description } = makeLimitTestGroup(limit); 5 | 6 | g.test('createComputePipeline,at_over') 7 | .desc(`Test using createComputePipeline(Async) at and over ${limit} limit`) 8 | .params(kMaximumLimitBaseParams.combine('async', [false, true] as const)) 9 | .fn(async t => { 10 | const { limitTest, testValueName, async } = t.params; 11 | await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'X'); 12 | }); 13 | 14 | g.test('validate,maxComputeInvocationsPerWorkgroup') 15 | .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) 16 | .fn(t => { 17 | const { adapter, defaultLimit, adapterLimit } = t; 18 | t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); 19 | t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeY.spec.ts: -------------------------------------------------------------------------------- 1 | import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; 2 | 3 | const limit = 'maxComputeWorkgroupSizeY'; 4 | export const { g, description } = makeLimitTestGroup(limit); 5 | 6 | g.test('createComputePipeline,at_over') 7 | .desc(`Test using createComputePipeline(Async) at and over ${limit} limit`) 8 | .params(kMaximumLimitBaseParams.combine('async', [false, true] as const)) 9 | .fn(async t => { 10 | const { limitTest, testValueName, async } = t.params; 11 | await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Y'); 12 | }); 13 | 14 | g.test('validate,maxComputeInvocationsPerWorkgroup') 15 | .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) 16 | .fn(t => { 17 | const { adapter, defaultLimit, adapterLimit } = t; 18 | t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); 19 | t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/maxComputeWorkgroupSizeZ.spec.ts: -------------------------------------------------------------------------------- 1 | import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; 2 | 3 | const limit = 'maxComputeWorkgroupSizeZ'; 4 | export const { g, description } = makeLimitTestGroup(limit); 5 | 6 | g.test('createComputePipeline,at_over') 7 | .desc(`Test using createComputePipeline(Async) at and over ${limit} limit`) 8 | .params(kMaximumLimitBaseParams.combine('async', [false, true] as const)) 9 | .fn(async t => { 10 | const { limitTest, testValueName, async } = t.params; 11 | await t.testMaxComputeWorkgroupSize(limitTest, testValueName, async, 'Z'); 12 | }); 13 | 14 | g.test('validate,maxComputeInvocationsPerWorkgroup') 15 | .desc(`Test that ${limit} <= maxComputeInvocationsPerWorkgroup`) 16 | .fn(t => { 17 | const { adapter, defaultLimit, adapterLimit } = t; 18 | t.expect(defaultLimit <= t.getDefaultLimit('maxComputeInvocationsPerWorkgroup')); 19 | t.expect(adapterLimit <= adapter.limits.maxComputeInvocationsPerWorkgroup); 20 | }); 21 | -------------------------------------------------------------------------------- /src/webgpu/util/memory.ts: -------------------------------------------------------------------------------- 1 | import { GPUTest } from '../gpu_test.js'; 2 | 3 | /** 4 | * Helper to exhaust VRAM until there is less than 64 MB of capacity. Returns 5 | * an opaque closure which can be called to free the allocated resources later. 6 | */ 7 | export async function exhaustVramUntilUnder64MB(t: GPUTest) { 8 | const allocateUntilOom = async (device: GPUDevice, size: number) => { 9 | const buffers = []; 10 | for (;;) { 11 | device.pushErrorScope('out-of-memory'); 12 | const buffer = t.createBufferTracked({ size, usage: GPUBufferUsage.STORAGE }); 13 | if (await device.popErrorScope()) { 14 | return buffers; 15 | } 16 | buffers.push(buffer); 17 | } 18 | }; 19 | 20 | const kLargeChunkSize = 512 * 1024 * 1024; 21 | const kSmallChunkSize = 64 * 1024 * 1024; 22 | const buffers = await allocateUntilOom(t.device, kLargeChunkSize); 23 | buffers.push(...(await allocateUntilOom(t.device, kSmallChunkSize))); 24 | return () => { 25 | buffers.forEach(buffer => buffer.destroy()); 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/features/texture_component_swizzle_utils.ts: -------------------------------------------------------------------------------- 1 | declare global { 2 | type GPUComponentSwizzle = 'r' | 'g' | 'b' | 'a' | '0' | '1'; 3 | 4 | // Note this is a four-character string that only includes `"r"`, `"g"`, `"b"`, `"a"`, `"0"`, or `"1"`. 5 | type GPUTextureComponentSwizzle = string; 6 | } 7 | 8 | // Note: There are 4 settings with 6 options which is 1296 combinations. So we don't check them all. Just a few below. 9 | export const kSwizzleTests = [ 10 | 'rgba', 11 | '0000', 12 | '1111', 13 | 'rrrr', 14 | 'gggg', 15 | 'bbbb', 16 | 'aaaa', 17 | 'abgr', 18 | 'gbar', 19 | 'barg', 20 | 'argb', 21 | '0gba', 22 | 'r0ba', 23 | 'rg0a', 24 | 'rgb0', 25 | '1gba', 26 | 'r1ba', 27 | 'rg1a', 28 | 'rgb1', 29 | ] as const; 30 | export type SwizzleSpec = (typeof kSwizzleTests)[number]; 31 | 32 | // Returns true if swizzle is identity 33 | export function isIdentitySwizzle(swizzle: GPUTextureComponentSwizzle | undefined): boolean { 34 | return swizzle === undefined || swizzle === 'rgba'; 35 | } 36 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/i32_arithmetic.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the i32 arithmetic unary expression operations 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { Type } from '../../../../util/conversion.js'; 8 | import { allInputSources, run } from '../expression.js'; 9 | 10 | import { d } from './i32_arithmetic.cache.js'; 11 | import { unary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('negation') 16 | .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') 17 | .desc( 18 | ` 19 | Expression: -x 20 | ` 21 | ) 22 | .params(u => 23 | u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) 24 | ) 25 | .fn(async t => { 26 | const cases = await d.get('negation'); 27 | await run(t, unary('-'), [Type.i32], Type.i32, t.params, cases); 28 | }); 29 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/capability_checks/limits/maxTextureArrayLayers.spec.ts: -------------------------------------------------------------------------------- 1 | import { kMaximumLimitBaseParams, makeLimitTestGroup } from './limit_utils.js'; 2 | 3 | const limit = 'maxTextureArrayLayers'; 4 | export const { g, description } = makeLimitTestGroup(limit); 5 | 6 | g.test('createTexture,at_over') 7 | .desc(`Test using at and over ${limit} limit`) 8 | .params(kMaximumLimitBaseParams) 9 | .fn(async t => { 10 | const { limitTest, testValueName } = t.params; 11 | await t.testDeviceWithRequestedMaximumLimits( 12 | limitTest, 13 | testValueName, 14 | async ({ testValue, shouldError }) => { 15 | await t.testForValidationErrorWithPossibleOutOfMemoryError(() => { 16 | const texture = t.createTextureTracked({ 17 | size: [1, 1, testValue], 18 | format: 'rgba8unorm', 19 | usage: GPUTextureUsage.TEXTURE_BINDING, 20 | }); 21 | if (!shouldError) { 22 | texture.destroy(); 23 | } 24 | }, shouldError); 25 | } 26 | ); 27 | }); 28 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/README.txt: -------------------------------------------------------------------------------- 1 | Reference tests (reftests) for WebGPU canvas presentation. 2 | 3 | These render some contents to a canvas using WebGPU, and WPT compares the rendering result with 4 | the "reference" versions (in `ref/`) which render with 2D canvas. 5 | 6 | This tests things like: 7 | - The canvas has the correct orientation. 8 | - The canvas renders with the correct transfer function. 9 | - The canvas blends and interpolates in the correct color encoding. 10 | 11 | TODO(#918): Test all possible color spaces (once we have more than 1) 12 | TODO(#921): Why is there sometimes a difference of 1 (e.g. 3f vs 40) in canvas_size_different_with_back_buffer_size? 13 | And why does chromium's image_diff show diffs on other pixels that don't seem to have diffs? 14 | TODO(#1093): Test rgba16float values which are out of gamut of the canvas but under SDR luminance. 15 | TODO(#1093): Test rgba16float values which are above SDR luminance. 16 | TODO(#1116): Test canvas scaling. 17 | TODO: Test transferControlToOffscreen, used from {the same,another} thread 18 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/query_set/create.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests for validation in createQuerySet. 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 6 | import { kQueryTypes, kMaxQueryCount } from '../../../capability_info.js'; 7 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 8 | 9 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 10 | 11 | g.test('count') 12 | .desc( 13 | ` 14 | Tests that create query set with the count for all query types: 15 | - count {<, =, >} kMaxQueryCount 16 | - x= {occlusion, timestamp} query 17 | ` 18 | ) 19 | .params(u => 20 | u 21 | .combine('type', kQueryTypes) 22 | .beginSubcases() 23 | .combine('count', [0, kMaxQueryCount, kMaxQueryCount + 1]) 24 | ) 25 | .fn(t => { 26 | const { type, count } = t.params; 27 | t.skipIfDeviceDoesNotSupportQueryType(type); 28 | 29 | t.expectValidationError(() => { 30 | t.createQuerySetTracked({ type, count }); 31 | }, count > kMaxQueryCount); 32 | }); 33 | -------------------------------------------------------------------------------- /src/webgpu/compat/compatibility_test.ts: -------------------------------------------------------------------------------- 1 | import { AllFeaturesMaxLimitsGPUTest } from '../gpu_test.js'; 2 | 3 | export class CompatibilityTest extends AllFeaturesMaxLimitsGPUTest { 4 | override async init() { 5 | await super.init(); 6 | } 7 | 8 | /** 9 | * Expect a validation error inside the callback. 10 | * except when not in compat mode. 11 | * 12 | * Tests should always do just one WebGPU call in the callback, to make sure that's what's tested. 13 | */ 14 | expectValidationErrorInCompatibilityMode(fn: () => void, shouldError: boolean = true): void { 15 | this.expectValidationError(fn, this.isCompatibility && shouldError); 16 | } 17 | 18 | /** 19 | * Expect the specified WebGPU error to be generated when running the provided function 20 | * except when not in compat mode. 21 | */ 22 | expectGPUErrorInCompatibilityMode( 23 | filter: GPUErrorFilter, 24 | fn: () => R, 25 | shouldError: boolean = true 26 | ): R { 27 | return this.expectGPUError(filter, fn, this.isCompatibility && shouldError); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_composite_alpha_opaque-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_premultiplied (ref) 4 | 5 | 6 | 10 | 11 | 12 | 26 | 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/abs.cache.ts: -------------------------------------------------------------------------------- 1 | import { abstractInt } from '../../../../../util/conversion.js'; 2 | import { FP } from '../../../../../util/floating_point.js'; 3 | import { absBigInt, fullI64Range } from '../../../../../util/math.js'; 4 | import { CaseListBuilder, makeCaseCache } from '../../case_cache.js'; 5 | 6 | // Cases: [f32|f16|abstract_float|abstract_int] 7 | const cases: Record = { 8 | ...(['f32', 'f16', 'abstract'] as const) 9 | .map(trait => ({ 10 | [`${trait === 'abstract' ? 'abstract_float' : trait}`]: () => { 11 | return FP[trait].generateScalarToIntervalCases( 12 | FP[trait].scalarRange(), 13 | 'unfiltered', 14 | FP[trait].absInterval 15 | ); 16 | }, 17 | })) 18 | .reduce((a, b) => ({ ...a, ...b }), {}), 19 | abstract_int: () => { 20 | return fullI64Range().map(e => { 21 | return { input: abstractInt(e), expected: abstractInt(absBigInt(e)) }; 22 | }); 23 | }, 24 | }; 25 | 26 | export const d = makeCaseCache('abs', cases); 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/fwidthCoarse.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution tests for the 'fwidthCoarse' builtin function 3 | 4 | T is f32 or vecN 5 | fn fwidthCoarse(e:T) ->T 6 | Returns abs(dpdxCoarse(e)) + abs(dpdyCoarse(e)). 7 | `; 8 | 9 | import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; 10 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../../gpu_test.js'; 11 | 12 | import { d } from './fwidth.cache.js'; 13 | import { runFWidthTest } from './fwidth.js'; 14 | 15 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 16 | 17 | const builtin = 'fwidthCoarse'; 18 | 19 | g.test('f32') 20 | .specURL('https://www.w3.org/TR/WGSL/#derivative-builtin-functions') 21 | .params(u => 22 | u 23 | .combine('vectorize', [undefined, 2, 3, 4] as const) 24 | .combine('non_uniform_discard', [false, true]) 25 | ) 26 | .fn(async t => { 27 | const cases = await d.get('scalar'); 28 | runFWidthTest(t, cases, builtin, t.params.non_uniform_discard, t.params.vectorize); 29 | }); 30 | -------------------------------------------------------------------------------- /src/common/framework/metadata.ts: -------------------------------------------------------------------------------- 1 | import { assert } from '../util/util.js'; 2 | 3 | /** Metadata about tests (that can't be derived at runtime). */ 4 | export type TestMetadata = { 5 | /** 6 | * Estimated average time-per-subcase, in milliseconds. 7 | * This is used to determine chunking granularity when exporting to WPT with 8 | * chunking enabled (like out-wpt/cts-chunked2sec.https.html). 9 | */ 10 | subcaseMS: number; 11 | }; 12 | 13 | export type TestMetadataListing = { 14 | [testQuery: string]: TestMetadata; 15 | }; 16 | 17 | export function loadMetadataForSuite(suiteDir: string): TestMetadataListing | null { 18 | assert(typeof require !== 'undefined', 'loadMetadataForSuite is only implemented on Node'); 19 | /* eslint-disable-next-line n/no-restricted-require */ 20 | const fs = require('fs'); 21 | 22 | const metadataFile = `${suiteDir}/listing_meta.json`; 23 | if (!fs.existsSync(metadataFile)) { 24 | return null; 25 | } 26 | 27 | const metadata: TestMetadataListing = JSON.parse(fs.readFileSync(metadataFile, 'utf8')); 28 | return metadata; 29 | } 30 | -------------------------------------------------------------------------------- /src/webgpu/api/operation/command_buffer/render/dynamic_state.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Tests of the behavior of the viewport/scissor/blend/reference states. 3 | 4 | TODO: 5 | - {viewport, scissor rect, blend color, stencil reference}: 6 | Test rendering result with {various values}. 7 | - Set the state in different ways to make sure it gets the correct value in the end: { 8 | - state unset (= default) 9 | - state explicitly set once to {default value, another value} 10 | - persistence: [set, draw, draw] (fn should differentiate from [set, draw] + [draw]) 11 | - overwriting: [set(1), draw, set(2), draw] (fn should differentiate from [set(1), set(2), draw, draw]) 12 | - overwriting: [set(1), set(2), draw] (fn should differentiate from [set(1), draw] but not [set(2), draw]) 13 | - } 14 | `; 15 | 16 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 17 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 18 | 19 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 20 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/cross.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | // abstract_non_const is empty and not used 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateVectorPairToVectorCases( 14 | FP[trait].vectorRange(3), 15 | FP[trait].vectorRange(3), 16 | nonConst ? 'unfiltered' : 'finite', 17 | // cross has an inherited accuracy, so abstract is only expected to be as accurate as f32 18 | FP[trait !== 'abstract' ? trait : 'f32'].crossInterval 19 | ); 20 | }, 21 | })) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('cross', cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_composite_alpha_premultiplied-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_premultiplied (ref) 4 | 5 | 6 | 10 | 11 | 12 | 26 | 27 | -------------------------------------------------------------------------------- /.github/workflows/pr.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request CI 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | timeout-minutes: 15 15 | steps: 16 | - uses: actions/checkout@v3 17 | with: 18 | persist-credentials: false 19 | - uses: actions/setup-node@v3 20 | with: 21 | node-version: '16.x' 22 | - run: npm ci 23 | - name: validating cache 24 | run: npx grunt run:validate-cache 25 | - run: npm test 26 | - name: copy out-wpt to wpt tree 27 | run: | 28 | git clone --depth 2 https://github.com/web-platform-tests/wpt.git 29 | rsync -av out-wpt/ wpt/webgpu 30 | - name: adding wpt lint ignore rule for *.bin 31 | run: 'echo "TRAILING WHITESPACE, INDENT TABS, CR AT EOL: *.bin" >> wpt/lint.ignore' 32 | - name: test wpt lint 33 | run: ./wpt lint 34 | working-directory: ./wpt 35 | -------------------------------------------------------------------------------- /src/common/internal/logging/result.ts: -------------------------------------------------------------------------------- 1 | import { LogMessageWithStack } from './log_message.js'; 2 | 3 | // MAINTENANCE_TODO: Add warn expectations 4 | export type Expectation = 'pass' | 'skip' | 'fail'; 5 | 6 | export type Status = 'notrun' | 'running' | 'warn' | Expectation; 7 | 8 | export interface TestCaseResult { 9 | status: Status; 10 | timems: number; 11 | } 12 | 13 | export interface LiveTestCaseResult extends TestCaseResult { 14 | logs?: LogMessageWithStack[]; 15 | } 16 | 17 | /** 18 | * Raw data for a test log message. 19 | * 20 | * This form is sendable over a message channel, except `extra` may get mangled. 21 | */ 22 | export interface LogMessageRawData { 23 | name: string; 24 | message: string; 25 | stackHiddenMessage: string | undefined; 26 | stack: string | undefined; 27 | extra: unknown; 28 | } 29 | 30 | /** 31 | * Test case results in a form sendable over a message channel. 32 | * 33 | * Note `extra` may get mangled by postMessage. 34 | */ 35 | export interface TransferredTestCaseResult extends TestCaseResult { 36 | logs?: LogMessageRawData[]; 37 | } 38 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/f32_arithmetic.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the f32 arithmetic unary expression operations 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { Type } from '../../../../util/conversion.js'; 8 | import { allInputSources, run } from '../expression.js'; 9 | 10 | import { d } from './f32_arithmetic.cache.js'; 11 | import { unary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('negation') 16 | .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') 17 | .desc( 18 | ` 19 | Expression: -x 20 | Accuracy: Correctly rounded 21 | ` 22 | ) 23 | .params(u => 24 | u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) 25 | ) 26 | .fn(async t => { 27 | const cases = await d.get('negation'); 28 | await run(t, unary('-'), [Type.f32], Type.f32, t.params, cases); 29 | }); 30 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/normalize.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_vecN_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([2, 3, 4] as const).flatMap(dim => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_vec${dim}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateVectorToVectorCases( 14 | FP[trait].vectorRange(dim), 15 | nonConst ? 'unfiltered' : 'finite', 16 | // normalize has an inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].normalizeInterval 18 | ); 19 | }, 20 | })) 21 | ) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('normalize', cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/smoothstep.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16]_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([true, false] as const).map(nonConst => ({ 8 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 9 | if (trait === 'abstract' && nonConst) { 10 | return []; 11 | } 12 | return FP[trait].generateScalarTripleToIntervalCases( 13 | FP[trait].sparseScalarRange(), 14 | FP[trait].sparseScalarRange(), 15 | FP[trait].sparseScalarRange(), 16 | nonConst ? 'unfiltered' : 'finite', 17 | // smoothstep has an inherited accuracy, so is only expected to be as accurate as f32 18 | FP[trait !== 'abstract' ? trait : 'f32'].smoothStepInterval 19 | ); 20 | }, 21 | })) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('smoothstep', cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/atan.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | const known_values = [-Math.sqrt(3), -1, -1 / Math.sqrt(3), 0, 1, 1 / Math.sqrt(3), Math.sqrt(3)]; 5 | 6 | // Cases: [f32|f16|abstract]_[non_]const 7 | const cases = (['f32', 'f16', 'abstract'] as const) 8 | .flatMap(trait => 9 | ([true, false] as const).map(nonConst => ({ 10 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 11 | if (trait === 'abstract' && nonConst) { 12 | return []; 13 | } 14 | return FP[trait].generateScalarToIntervalCases( 15 | [...known_values, ...FP[trait].scalarRange()], 16 | nonConst ? 'unfiltered' : 'finite', 17 | // atan has an ulp accuracy, so is only expected to be as accurate as f32 18 | FP[trait !== 'abstract' ? trait : 'f32'].atanInterval 19 | ); 20 | }, 21 | })) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('atan', cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_bgra8unorm_premultiplied_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_bgra8unorm_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_bgra8unorm_premultiplied_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_bgra8unorm_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba8unorm_premultiplied_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba8unorm_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba8unorm_premultiplied_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba8unorm_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/acos.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract]_[non_]const 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateScalarToIntervalCases( 14 | [...linearRange(-1, 1, 100), ...FP[trait].scalarRange()], // acos is defined on [-1, 1] 15 | nonConst ? 'unfiltered' : 'finite', 16 | // acos has an ulp or inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].acosInterval 18 | ); 19 | }, 20 | })) 21 | ) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('acos', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/asin.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { linearRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract]_[non_]const 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateScalarToIntervalCases( 14 | [...linearRange(-1, 1, 100), ...FP[trait].scalarRange()], // asin is defined on [-1, 1] 15 | nonConst ? 'unfiltered' : 'finite', 16 | // asin has an ulp or inherited accuracy, so is only expected to be as accurate as f32 17 | FP[trait !== 'abstract' ? trait : 'f32'].asinInterval 18 | ); 19 | }, 20 | })) 21 | ) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('asin', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba16float_premultiplied_copy.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba16float_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_composite_alpha_rgba16float_premultiplied_draw.https.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_composite_alpha_rgba16float_premultiplied 4 | 5 | 6 | 10 | 11 | 12 | 16 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/ref/canvas_display_after_device_lost-ref.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebGPU canvas_display_after_device_lost (ref) 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WebGPU Conformance Test Suite 2 | 3 | This is the conformance test suite for WebGPU. 4 | It tests the behaviors defined by the [WebGPU specification](https://gpuweb.github.io/gpuweb/). 5 | 6 | The contents of this test suite are considered **normative**; implementations must pass 7 | them to be WebGPU-conformant. Mismatches between the specification and tests are bugs. 8 | 9 | This test suite can be embedded inside [WPT](https://github.com/web-platform-tests/wpt) or run in standalone. 10 | 11 | ## [Launch the standalone CTS runner / test plan viewer](https://gpuweb.github.io/cts/standalone/) 12 | 13 | ## Contributing 14 | 15 | Please read the [introductory guidelines](docs/intro/README.md) before contributing. 16 | Other documentation may be found in [`docs/`](docs/) and in the [helper index](https://gpuweb.github.io/cts/docs/tsdoc/) ([source](docs/helper_index.txt)). 17 | 18 | Read [CONTRIBUTING.md](CONTRIBUTING.md) on licensing. 19 | 20 | For realtime communication about WebGPU spec and test, join the 21 | [#WebGPU:matrix.org room](https://app.element.io/#/room/#WebGPU:matrix.org) 22 | on Matrix. 23 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f16_matrix_matrix_multiplication.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF16Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matKxR_matCxK_[non_]const 6 | const mat_mat_cases = ([2, 3, 4] as const) 7 | .flatMap(k => 8 | ([2, 3, 4] as const).flatMap(cols => 9 | ([2, 3, 4] as const).flatMap(rows => 10 | ([true, false] as const).map(nonConst => ({ 11 | [`mat${k}x${rows}_mat${cols}x${k}_${nonConst ? 'non_const' : 'const'}`]: () => { 12 | return FP.f16.generateMatrixPairToMatrixCases( 13 | sparseMatrixF16Range(k, rows), 14 | sparseMatrixF16Range(cols, k), 15 | nonConst ? 'unfiltered' : 'finite', 16 | FP.f16.multiplicationMatrixMatrixInterval 17 | ); 18 | }, 19 | })) 20 | ) 21 | ) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('binary/f16_matrix_matrix_multiplication', mat_mat_cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/f32_matrix_matrix_multiplication.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../util/floating_point.js'; 2 | import { sparseMatrixF32Range } from '../../../../util/math.js'; 3 | import { makeCaseCache } from '../case_cache.js'; 4 | 5 | // Cases: matKxR_matCxK_[non_]const 6 | const mat_mat_cases = ([2, 3, 4] as const) 7 | .flatMap(k => 8 | ([2, 3, 4] as const).flatMap(cols => 9 | ([2, 3, 4] as const).flatMap(rows => 10 | ([true, false] as const).map(nonConst => ({ 11 | [`mat${k}x${rows}_mat${cols}x${k}_${nonConst ? 'non_const' : 'const'}`]: () => { 12 | return FP.f32.generateMatrixPairToMatrixCases( 13 | sparseMatrixF32Range(k, rows), 14 | sparseMatrixF32Range(cols, k), 15 | nonConst ? 'unfiltered' : 'finite', 16 | FP.f32.multiplicationMatrixMatrixInterval 17 | ); 18 | }, 19 | })) 20 | ) 21 | ) 22 | ) 23 | .reduce((a, b) => ({ ...a, ...b }), {}); 24 | 25 | export const d = makeCaseCache('binary/f32_matrix_matrix_multiplication', mat_mat_cases); 26 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/i32_complement.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the i32 bitwise complement operation 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { i32, Type } from '../../../../util/conversion.js'; 8 | import { fullI32Range } from '../../../../util/math.js'; 9 | import { allInputSources, run } from '../expression.js'; 10 | 11 | import { unary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('i32_complement') 16 | .specURL('https://www.w3.org/TR/WGSL/#bit-expr') 17 | .desc( 18 | ` 19 | Expression: ~x 20 | ` 21 | ) 22 | .params(u => 23 | u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) 24 | ) 25 | .fn(async t => { 26 | const cases = fullI32Range().map(e => { 27 | return { input: i32(e), expected: i32(~e) }; 28 | }); 29 | await run(t, unary('~'), [Type.i32], Type.i32, t.params, cases); 30 | }); 31 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/u32_complement.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the u32 bitwise complement operation 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { Type, u32 } from '../../../../util/conversion.js'; 8 | import { fullU32Range } from '../../../../util/math.js'; 9 | import { allInputSources, run } from '../expression.js'; 10 | 11 | import { unary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('u32_complement') 16 | .specURL('https://www.w3.org/TR/WGSL/#bit-expr') 17 | .desc( 18 | ` 19 | Expression: ~x 20 | ` 21 | ) 22 | .params(u => 23 | u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) 24 | ) 25 | .fn(async t => { 26 | const cases = fullU32Range().map(e => { 27 | return { input: u32(e), expected: u32(~e) }; 28 | }); 29 | await run(t, unary('~'), [Type.u32], Type.u32, t.params, cases); 30 | }); 31 | -------------------------------------------------------------------------------- /tools/websocket-logger/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "websocket-logger", 3 | "version": "0.0.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "websocket-logger", 9 | "version": "0.0.0", 10 | "license": "BSD-3-Clause", 11 | "dependencies": { 12 | "ws": "^8.13.0" 13 | }, 14 | "bin": { 15 | "websocket-logger": "main.js" 16 | } 17 | }, 18 | "node_modules/ws": { 19 | "version": "8.13.0", 20 | "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", 21 | "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", 22 | "engines": { 23 | "node": ">=10.0.0" 24 | }, 25 | "peerDependencies": { 26 | "bufferutil": "^4.0.1", 27 | "utf-8-validate": ">=5.0.2" 28 | }, 29 | "peerDependenciesMeta": { 30 | "bufferutil": { 31 | "optional": true 32 | }, 33 | "utf-8-validate": { 34 | "optional": true 35 | } 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/webgpu/api/validation/query_set/destroy.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Destroying a query set more than once is allowed. 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../gpu_test.js'; 7 | 8 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 9 | 10 | g.test('twice').fn(t => { 11 | const qset = t.createQuerySetTracked({ type: 'occlusion', count: 1 }); 12 | 13 | qset.destroy(); 14 | qset.destroy(); 15 | }); 16 | 17 | g.test('invalid_queryset') 18 | .desc('Test that invalid querysets may be destroyed without generating validation errors.') 19 | .fn(async t => { 20 | t.device.pushErrorScope('validation'); 21 | 22 | const invalidQuerySet = t.createQuerySetTracked({ 23 | type: 'occlusion', 24 | count: 4097, // 4096 is the limit 25 | }); 26 | 27 | // Expect error because it's invalid. 28 | const error = await t.device.popErrorScope(); 29 | t.expect(!!error); 30 | 31 | // This line should not generate an error 32 | invalidQuerySet.destroy(); 33 | }); 34 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/acosh.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { biasedRange } from '../../../../../util/math.js'; 3 | import { makeCaseCache } from '../../case_cache.js'; 4 | 5 | // Cases: [f32|f16|abstract]_[non_]const 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateScalarToIntervalCases( 14 | [...biasedRange(1, 2, 100), ...FP[trait].scalarRange()], // x near 1 can be problematic to implement 15 | nonConst ? 'unfiltered' : 'finite', 16 | // acosh has an inherited accuracy, so is only expected to be as accurate as f32 17 | ...FP[trait !== 'abstract' ? trait : 'f32'].acoshIntervals 18 | ); 19 | }, 20 | })) 21 | ) 22 | .reduce((a, b) => ({ ...a, ...b }), {}); 23 | 24 | export const d = makeCaseCache('acosh', cases); 25 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/transpose.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_matCxR_[non_]const 5 | // abstract_matCxR_non_const is empty and not used 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([2, 3, 4] as const).flatMap(cols => 9 | ([2, 3, 4] as const).flatMap(rows => 10 | ([true, false] as const).map(nonConst => ({ 11 | [`${trait}_mat${cols}x${rows}_${nonConst ? 'non_const' : 'const'}`]: () => { 12 | if (trait === 'abstract' && nonConst) { 13 | return []; 14 | } 15 | return FP[trait].generateMatrixToMatrixCases( 16 | FP[trait].sparseMatrixRange(cols, rows), 17 | nonConst ? 'unfiltered' : 'finite', 18 | FP[trait].transposeInterval 19 | ); 20 | }, 21 | })) 22 | ) 23 | ) 24 | ) 25 | .reduce((a, b) => ({ ...a, ...b }), {}); 26 | 27 | export const d = makeCaseCache('transpose', cases); 28 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/ai_arithmetic.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the abstract integer arithmetic unary expression operations 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { Type } from '../../../../util/conversion.js'; 8 | import { onlyConstInputSource, run } from '../expression.js'; 9 | 10 | import { d } from './ai_arithmetic.cache.js'; 11 | import { abstractIntUnary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('negation') 16 | .specURL('https://www.w3.org/TR/WGSL/#arithmetic-expr') 17 | .desc( 18 | ` 19 | Expression: -x 20 | ` 21 | ) 22 | .params(u => 23 | u 24 | .combine('inputSource', onlyConstInputSource) 25 | .combine('vectorize', [undefined, 2, 3, 4] as const) 26 | ) 27 | .fn(async t => { 28 | const cases = await d.get('negation'); 29 | await run(t, abstractIntUnary('-'), [Type.abstractInt], Type.abstractInt, t.params, cases); 30 | }); 31 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/fma.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_[non_]const 5 | // abstract_non_const is empty and not used 6 | const cases = (['f32', 'f16', 'abstract'] as const) 7 | .flatMap(trait => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateScalarTripleToIntervalCases( 14 | FP[trait].sparseScalarRange(), 15 | FP[trait].sparseScalarRange(), 16 | FP[trait].sparseScalarRange(), 17 | nonConst ? 'unfiltered' : 'finite', 18 | // fma has an inherited accuracy, so abstract is only expected to be as accurate as f32 19 | FP[trait !== 'abstract' ? trait : 'f32'].fmaInterval 20 | ); 21 | }, 22 | })) 23 | ) 24 | .reduce((a, b) => ({ ...a, ...b }), {}); 25 | 26 | export const d = makeCaseCache('fma', cases); 27 | -------------------------------------------------------------------------------- /standalone/third_party/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /standalone/webgpu-logo-notext.svg: -------------------------------------------------------------------------------- 1 | 35 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/dpdy.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution tests for the 'dpdy' builtin function 3 | 4 | T is f32 or vecN 5 | fn dpdy(e:T) ->T 6 | Partial derivative of e with respect to window y coordinates. 7 | The result is the same as either dpdyFine(e) or dpdyCoarse(e). 8 | `; 9 | 10 | import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; 11 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../../gpu_test.js'; 12 | 13 | import { d } from './derivatives.cache.js'; 14 | import { runDerivativeTest } from './derivatives.js'; 15 | 16 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 17 | 18 | const builtin = 'dpdy'; 19 | 20 | g.test('f32') 21 | .specURL('https://www.w3.org/TR/WGSL/#derivative-builtin-functions') 22 | .params(u => 23 | u 24 | .combine('vectorize', [undefined, 2, 3, 4] as const) 25 | .combine('non_uniform_discard', [false, true]) 26 | ) 27 | .fn(async t => { 28 | const cases = await d.get('scalar'); 29 | runDerivativeTest(t, cases, builtin, t.params.non_uniform_discard, t.params.vectorize); 30 | }); 31 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/reflect.cache.ts: -------------------------------------------------------------------------------- 1 | import { FP } from '../../../../../util/floating_point.js'; 2 | import { makeCaseCache } from '../../case_cache.js'; 3 | 4 | // Cases: [f32|f16|abstract]_vecN_[non_]const 5 | const cases = (['f32', 'f16', 'abstract'] as const) 6 | .flatMap(trait => 7 | ([2, 3, 4] as const).flatMap(dim => 8 | ([true, false] as const).map(nonConst => ({ 9 | [`${trait}_vec${dim}_${nonConst ? 'non_const' : 'const'}`]: () => { 10 | if (trait === 'abstract' && nonConst) { 11 | return []; 12 | } 13 | return FP[trait].generateVectorPairToVectorCases( 14 | FP[trait].sparseVectorRange(dim), 15 | FP[trait].sparseVectorRange(dim), 16 | nonConst ? 'unfiltered' : 'finite', 17 | // reflect has an inherited accuracy, so is only expected to be as accurate as f32 18 | FP[trait !== 'abstract' ? trait : 'f32'].reflectInterval 19 | ); 20 | }, 21 | })) 22 | ) 23 | ) 24 | .reduce((a, b) => ({ ...a, ...b }), {}); 25 | 26 | export const d = makeCaseCache('reflect', cases); 27 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/unary/f16_arithmetic.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution Tests for the f16 arithmetic unary expression operations 3 | `; 4 | 5 | import { makeTestGroup } from '../../../../../common/framework/test_group.js'; 6 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../gpu_test.js'; 7 | import { Type } from '../../../../util/conversion.js'; 8 | import { allInputSources, run } from '../expression.js'; 9 | 10 | import { d } from './f16_arithmetic.cache.js'; 11 | import { unary } from './unary.js'; 12 | 13 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 14 | 15 | g.test('negation') 16 | .specURL('https://www.w3.org/TR/WGSL/#floating-point-evaluation') 17 | .desc( 18 | ` 19 | Expression: -x 20 | Accuracy: Correctly rounded 21 | ` 22 | ) 23 | .params(u => 24 | u.combine('inputSource', allInputSources).combine('vectorize', [undefined, 2, 3, 4] as const) 25 | ) 26 | .fn(async t => { 27 | t.skipIfDeviceDoesNotHaveFeature('shader-f16'); 28 | const cases = await d.get('negation'); 29 | await run(t, unary('-'), [Type.f16], Type.f16, t.params, cases); 30 | }); 31 | -------------------------------------------------------------------------------- /src/webgpu/web_platform/reftests/canvas_clear.html.ts: -------------------------------------------------------------------------------- 1 | import { runRefTest } from './gpu_ref_test.js'; 2 | 3 | runRefTest(t => { 4 | function draw(canvasId: string, format: GPUTextureFormat) { 5 | const canvas = document.getElementById(canvasId) as HTMLCanvasElement; 6 | 7 | const ctx = canvas.getContext('webgpu') as unknown as GPUCanvasContext; 8 | ctx.configure({ 9 | device: t.device, 10 | format, 11 | }); 12 | 13 | const colorAttachment = ctx.getCurrentTexture(); 14 | const colorAttachmentView = colorAttachment.createView(); 15 | 16 | const encoder = t.device.createCommandEncoder({ label: 'runRefTest' }); 17 | const pass = encoder.beginRenderPass({ 18 | colorAttachments: [ 19 | { 20 | view: colorAttachmentView, 21 | clearValue: { r: 0.4, g: 1.0, b: 0.0, a: 1.0 }, 22 | loadOp: 'clear', 23 | storeOp: 'store', 24 | }, 25 | ], 26 | }); 27 | pass.end(); 28 | t.device.queue.submit([encoder.finish()]); 29 | } 30 | 31 | draw('cvs0', 'bgra8unorm'); 32 | draw('cvs1', 'rgba8unorm'); 33 | draw('cvs2', 'rgba16float'); 34 | }); 35 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/dpdx.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution tests for the 'dpdx' builtin function 3 | 4 | T is f32 or vecN 5 | fn dpdx(e:T) -> T 6 | Partial derivative of e with respect to window x coordinates. 7 | The result is the same as either dpdxFine(e) or dpdxCoarse(e). 8 | 9 | `; 10 | 11 | import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; 12 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../../gpu_test.js'; 13 | 14 | import { d } from './derivatives.cache.js'; 15 | import { runDerivativeTest } from './derivatives.js'; 16 | 17 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 18 | 19 | const builtin = 'dpdx'; 20 | 21 | g.test('f32') 22 | .specURL('https://www.w3.org/TR/WGSL/#derivative-builtin-functions') 23 | .params(u => 24 | u 25 | .combine('vectorize', [undefined, 2, 3, 4] as const) 26 | .combine('non_uniform_discard', [false, true]) 27 | ) 28 | .fn(async t => { 29 | const cases = await d.get('scalar'); 30 | runDerivativeTest(t, cases, builtin, t.params.non_uniform_discard, t.params.vectorize); 31 | }); 32 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/call/builtin/fwidthFine.spec.ts: -------------------------------------------------------------------------------- 1 | export const description = ` 2 | Execution tests for the 'fwidthFine' builtin function 3 | 4 | T is f32 or vecN 5 | fn fwidthFine(e:T) ->T 6 | Returns abs(dpdxFine(e)) + abs(dpdyFine(e)). 7 | `; 8 | 9 | import { makeTestGroup } from '../../../../../../common/framework/test_group.js'; 10 | import { AllFeaturesMaxLimitsGPUTest } from '../../../../../gpu_test.js'; 11 | 12 | import { d } from './fwidth.cache.js'; 13 | import { runFWidthTest } from './fwidth.js'; 14 | 15 | export const g = makeTestGroup(AllFeaturesMaxLimitsGPUTest); 16 | 17 | const builtin = 'fwidthFine'; 18 | 19 | g.test('f32') 20 | .specURL('https://www.w3.org/TR/WGSL/#derivative-builtin-functions') 21 | .params(u => 22 | u 23 | .combine('vectorize', [undefined, 2, 3, 4] as const) 24 | .combine('non_uniform_discard', [false, true]) 25 | ) 26 | .fn(async t => { 27 | t.skipIf(t.isCompatibility, `${builtin} not supported in compatibility mode`); 28 | const cases = await d.get('scalar'); 29 | runFWidthTest(t, cases, builtin, t.params.non_uniform_discard, t.params.vectorize); 30 | }); 31 | -------------------------------------------------------------------------------- /src/webgpu/shader/execution/expression/binary/i32_comparison.cache.ts: -------------------------------------------------------------------------------- 1 | import { bool, i32 } from '../../../../util/conversion.js'; 2 | import { vectorI32Range } from '../../../../util/math.js'; 3 | import { Case } from '../case.js'; 4 | import { makeCaseCache } from '../case_cache.js'; 5 | 6 | /** 7 | * @returns a test case for the provided left hand & right hand values and 8 | * expected boolean result. 9 | */ 10 | function makeCase(lhs: number, rhs: number, expected_answer: boolean): Case { 11 | return { input: [i32(lhs), i32(rhs)], expected: bool(expected_answer) }; 12 | } 13 | 14 | export const d = makeCaseCache('binary/i32_comparison', { 15 | equals: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] === v[1])), 16 | not_equals: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] !== v[1])), 17 | less_than: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] < v[1])), 18 | less_equal: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] <= v[1])), 19 | greater_than: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] > v[1])), 20 | greater_equal: () => vectorI32Range(2).map(v => makeCase(v[0], v[1], v[0] >= v[1])), 21 | }); 22 | --------------------------------------------------------------------------------