Skip to content

Commit be765eb

Browse files
authored
Follow common JavaScript style (#4395)
This is probably my OCD but, JavaScript style is almost universally, constructors are Capitalized and everything else is not. Personally I wish we'd turn on the "new-cap" rule for eslint but unfortunately there are some slightly more difficult usages in the shader tests. So, instead, thought I'd just try to refactor most code using C++ style to use JavaScript style so there are less examples to copy from.
1 parent 905c7cb commit be765eb

23 files changed

Lines changed: 246 additions & 246 deletions

src/webgpu/api/operation/command_buffer/copyTextureToTexture.spec.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import { findFailedPixels } from '../../../util/texture/texture_ok.js';
3737
const dataGenerator = new DataArrayGenerator();
3838

3939
class F extends AllFeaturesMaxLimitsGPUTest {
40-
GetInitialDataPerMipLevel(
40+
getInitialDataPerMipLevel(
4141
dimension: GPUTextureDimension,
4242
textureSize: Required<GPUExtent3DDict>,
4343
format: ColorTextureFormat,
@@ -52,7 +52,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
5252
return dataGenerator.generateView(byteSize);
5353
}
5454

55-
GetInitialStencilDataPerMipLevel(
55+
getInitialStencilDataPerMipLevel(
5656
textureSize: Required<GPUExtent3DDict>,
5757
format: DepthStencilFormat,
5858
mipLevel: number
@@ -67,7 +67,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
6767
return dataGenerator.generateView(byteSize);
6868
}
6969

70-
DoCopyTextureToTextureTest(
70+
doCopyTextureToTextureTest(
7171
dimension: GPUTextureDimension,
7272
srcTextureSize: Required<GPUExtent3DDict>,
7373
dstTextureSize: Required<GPUExtent3DDict>,
@@ -113,7 +113,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
113113
const dstTexture = this.createTextureTracked(dstTextureDesc);
114114

115115
// Fill the whole subresource of srcTexture at srcCopyLevel with initialSrcData.
116-
const initialSrcData = this.GetInitialDataPerMipLevel(
116+
const initialSrcData = this.getInitialDataPerMipLevel(
117117
dimension,
118118
srcTextureSize,
119119
srcFormat,
@@ -397,7 +397,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
397397
});
398398
}
399399

400-
InitializeStencilAspect(
400+
initializeStencilAspect(
401401
sourceTexture: GPUTexture,
402402
initialStencilData: Uint8Array,
403403
srcCopyLevel: number,
@@ -417,7 +417,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
417417
);
418418
}
419419

420-
VerifyStencilAspect(
420+
verifyStencilAspect(
421421
destinationTexture: GPUTexture,
422422
initialStencilData: Uint8Array,
423423
dstCopyLevel: number,
@@ -468,7 +468,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
468468
this.expectGPUBufferValuesEqual(outputBuffer, expectedStencilData);
469469
}
470470

471-
GetRenderPipelineForT2TCopyWithDepthTests(
471+
getRenderPipelineForT2TCopyWithDepthTests(
472472
bindGroupLayout: GPUBindGroupLayout,
473473
hasColorAttachment: boolean,
474474
depthStencil: GPUDepthStencilState
@@ -515,7 +515,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
515515
return this.device.createRenderPipeline(renderPipelineDescriptor);
516516
}
517517

518-
GetBindGroupLayoutForT2TCopyWithDepthTests(): GPUBindGroupLayout {
518+
getBindGroupLayoutForT2TCopyWithDepthTests(): GPUBindGroupLayout {
519519
return this.device.createBindGroupLayout({
520520
entries: [
521521
{
@@ -531,7 +531,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
531531
});
532532
}
533533

534-
GetBindGroupForT2TCopyWithDepthTests(
534+
getBindGroupForT2TCopyWithDepthTests(
535535
bindGroupLayout: GPUBindGroupLayout,
536536
totalCopyArrayLayers: number
537537
): GPUBindGroup {
@@ -562,7 +562,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
562562
}
563563

564564
/** Initialize the depth aspect of sourceTexture with draw calls */
565-
InitializeDepthAspect(
565+
initializeDepthAspect(
566566
sourceTexture: GPUTexture,
567567
depthFormat: GPUTextureFormat,
568568
srcCopyLevel: number,
@@ -571,13 +571,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {
571571
): void {
572572
// Prepare a renderPipeline with depthCompareFunction == 'always' and depthWriteEnabled == true
573573
// for the initializations of the depth attachment.
574-
const bindGroupLayout = this.GetBindGroupLayoutForT2TCopyWithDepthTests();
575-
const renderPipeline = this.GetRenderPipelineForT2TCopyWithDepthTests(bindGroupLayout, false, {
574+
const bindGroupLayout = this.getBindGroupLayoutForT2TCopyWithDepthTests();
575+
const renderPipeline = this.getRenderPipelineForT2TCopyWithDepthTests(bindGroupLayout, false, {
576576
format: depthFormat,
577577
depthWriteEnabled: true,
578578
depthCompare: 'always',
579579
});
580-
const bindGroup = this.GetBindGroupForT2TCopyWithDepthTests(bindGroupLayout, copySize[2]);
580+
const bindGroup = this.getBindGroupForT2TCopyWithDepthTests(bindGroupLayout, copySize[2]);
581581

582582
const hasStencil = isStencilTextureFormat(sourceTexture.format);
583583
const encoder = this.device.createCommandEncoder();
@@ -606,7 +606,7 @@ class F extends AllFeaturesMaxLimitsGPUTest {
606606
this.queue.submit([encoder.finish()]);
607607
}
608608

609-
VerifyDepthAspect(
609+
verifyDepthAspect(
610610
destinationTexture: GPUTexture,
611611
depthFormat: GPUTextureFormat,
612612
dstCopyLevel: number,
@@ -615,13 +615,13 @@ class F extends AllFeaturesMaxLimitsGPUTest {
615615
): void {
616616
// Prepare a renderPipeline with depthCompareFunction == 'equal' and depthWriteEnabled == false
617617
// for the comparison of the depth attachment.
618-
const bindGroupLayout = this.GetBindGroupLayoutForT2TCopyWithDepthTests();
619-
const renderPipeline = this.GetRenderPipelineForT2TCopyWithDepthTests(bindGroupLayout, true, {
618+
const bindGroupLayout = this.getBindGroupLayoutForT2TCopyWithDepthTests();
619+
const renderPipeline = this.getRenderPipelineForT2TCopyWithDepthTests(bindGroupLayout, true, {
620620
format: depthFormat,
621621
depthWriteEnabled: false,
622622
depthCompare: 'equal',
623623
});
624-
const bindGroup = this.GetBindGroupForT2TCopyWithDepthTests(bindGroupLayout, copySize[2]);
624+
const bindGroup = this.getBindGroupForT2TCopyWithDepthTests(bindGroupLayout, copySize[2]);
625625

626626
const outputColorTexture = this.createTextureTracked({
627627
format: 'rgba8unorm',
@@ -861,7 +861,7 @@ g.test('color_textures,non_compressed,non_array')
861861
dstCopyLevel,
862862
} = t.params;
863863

864-
t.DoCopyTextureToTextureTest(
864+
t.doCopyTextureToTextureTest(
865865
dimension,
866866
srcTextureSize,
867867
dstTextureSize,
@@ -937,7 +937,7 @@ g.test('color_textures,compressed,non_array')
937937
const { blockWidth: dstBlockWidth, blockHeight: dstBlockHeight } =
938938
getBlockInfoForColorTextureFormat(dstFormat);
939939

940-
t.DoCopyTextureToTextureTest(
940+
t.doCopyTextureToTextureTest(
941941
dimension,
942942
{
943943
width: textureSizeInBlocks.src.width * srcBlockWidth,
@@ -1016,7 +1016,7 @@ g.test('color_textures,non_compressed,array')
10161016
dstCopyLevel,
10171017
} = t.params;
10181018

1019-
t.DoCopyTextureToTextureTest(
1019+
t.doCopyTextureToTextureTest(
10201020
dimension,
10211021
textureSize.srcTextureSize,
10221022
textureSize.dstTextureSize,
@@ -1079,7 +1079,7 @@ g.test('color_textures,compressed,array')
10791079
const { blockWidth: dstBlockWidth, blockHeight: dstBlockHeight } =
10801080
getBlockInfoForColorTextureFormat(dstFormat);
10811081

1082-
t.DoCopyTextureToTextureTest(
1082+
t.doCopyTextureToTextureTest(
10831083
dimension,
10841084
{
10851085
width: textureSizeInBlocks.src.width * srcBlockWidth,
@@ -1189,7 +1189,7 @@ g.test('zero_sized')
11891189
const srcFormat = 'rgba8unorm';
11901190
const dstFormat = 'rgba8unorm';
11911191

1192-
t.DoCopyTextureToTextureTest(
1192+
t.doCopyTextureToTextureTest(
11931193
dimension,
11941194
textureSize,
11951195
textureSize,
@@ -1277,8 +1277,8 @@ g.test('copy_depth_stencil')
12771277

12781278
let initialStencilData: undefined | Uint8Array = undefined;
12791279
if (isStencilTextureFormat(format)) {
1280-
initialStencilData = t.GetInitialStencilDataPerMipLevel(srcTextureSize, format, srcCopyLevel);
1281-
t.InitializeStencilAspect(
1280+
initialStencilData = t.getInitialStencilDataPerMipLevel(srcTextureSize, format, srcCopyLevel);
1281+
t.initializeStencilAspect(
12821282
sourceTexture,
12831283
initialStencilData,
12841284
srcCopyLevel,
@@ -1287,7 +1287,7 @@ g.test('copy_depth_stencil')
12871287
);
12881288
}
12891289
if (isDepthTextureFormat(format)) {
1290-
t.InitializeDepthAspect(sourceTexture, format, srcCopyLevel, srcCopyBaseArrayLayer, copySize);
1290+
t.initializeDepthAspect(sourceTexture, format, srcCopyLevel, srcCopyBaseArrayLayer, copySize);
12911291
}
12921292

12931293
const encoder = t.device.createCommandEncoder();
@@ -1308,7 +1308,7 @@ g.test('copy_depth_stencil')
13081308

13091309
if (isStencilTextureFormat(format)) {
13101310
assert(initialStencilData !== undefined);
1311-
t.VerifyStencilAspect(
1311+
t.verifyStencilAspect(
13121312
destinationTexture,
13131313
initialStencilData,
13141314
dstCopyLevel,
@@ -1317,7 +1317,7 @@ g.test('copy_depth_stencil')
13171317
);
13181318
}
13191319
if (isDepthTextureFormat(format)) {
1320-
t.VerifyDepthAspect(
1320+
t.verifyDepthAspect(
13211321
destinationTexture,
13221322
format,
13231323
dstCopyLevel,

src/webgpu/api/operation/command_buffer/image_copy.spec.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ class ImageCopyTest extends AllFeaturesMaxLimitsGPUTest {
737737
}
738738
}
739739

740-
DoUploadToStencilTest(
740+
doUploadToStencilTest(
741741
format: DepthStencilFormat,
742742
textureSize: readonly [number, number, number],
743743
uploadMethod: 'WriteTexture' | 'CopyB2T',
@@ -832,7 +832,7 @@ class ImageCopyTest extends AllFeaturesMaxLimitsGPUTest {
832832
this.expectGPUBufferValuesEqual(outputBuffer, expectedData);
833833
}
834834

835-
DoCopyFromStencilTest(
835+
doCopyFromStencilTest(
836836
format: DepthStencilFormat,
837837
textureSize: readonly [number, number, number],
838838
bytesPerRow: number,
@@ -1046,7 +1046,7 @@ class ImageCopyTest extends AllFeaturesMaxLimitsGPUTest {
10461046
};
10471047
}
10481048

1049-
DoCopyTextureToBufferWithDepthAspectTest(
1049+
doCopyTextureToBufferWithDepthAspectTest(
10501050
format: DepthStencilFormat,
10511051
copySize: readonly [number, number, number],
10521052
bytesPerRowPadding: number,
@@ -1765,7 +1765,7 @@ g.test('undefined_params')
17651765
});
17661766
});
17671767

1768-
function CopyMethodSupportedWithDepthStencilFormat(
1768+
function copyMethodSupportedWithDepthStencilFormat(
17691769
aspect: 'depth-only' | 'stencil-only',
17701770
format: DepthStencilFormat,
17711771
copyMethod: 'WriteTexture' | 'CopyB2T' | 'CopyT2B'
@@ -1800,7 +1800,7 @@ aspect and copyTextureToBuffer() with depth aspect.
18001800
.combine('format', kDepthStencilFormats)
18011801
.combine('copyMethod', ['WriteTexture', 'CopyB2T', 'CopyT2B'] as const)
18021802
.combine('aspect', ['depth-only', 'stencil-only'] as const)
1803-
.filter(t => CopyMethodSupportedWithDepthStencilFormat(t.aspect, t.format, t.copyMethod))
1803+
.filter(t => copyMethodSupportedWithDepthStencilFormat(t.aspect, t.format, t.copyMethod))
18041804
.beginSubcases()
18051805
.combineWithParams(kRowsPerImageAndBytesPerRowParams.paddings)
18061806
.combineWithParams(kRowsPerImageAndBytesPerRowParams.copySizes)
@@ -1838,7 +1838,7 @@ aspect and copyTextureToBuffer() with depth aspect.
18381838
] as const;
18391839
if (copyMethod === 'CopyT2B') {
18401840
if (aspect === 'depth-only') {
1841-
t.DoCopyTextureToBufferWithDepthAspectTest(
1841+
t.doCopyTextureToBufferWithDepthAspectTest(
18421842
format,
18431843
copySize,
18441844
bytesPerRowPadding,
@@ -1848,7 +1848,7 @@ aspect and copyTextureToBuffer() with depth aspect.
18481848
mipLevel
18491849
);
18501850
} else {
1851-
t.DoCopyFromStencilTest(format, textureSize, bytesPerRow, rowsPerImage, 0, mipLevel);
1851+
t.doCopyFromStencilTest(format, textureSize, bytesPerRow, rowsPerImage, 0, mipLevel);
18521852
}
18531853
} else {
18541854
assert(
@@ -1861,7 +1861,7 @@ aspect and copyTextureToBuffer() with depth aspect.
18611861
method: copyMethod,
18621862
});
18631863

1864-
t.DoUploadToStencilTest(
1864+
t.doUploadToStencilTest(
18651865
format,
18661866
textureSize,
18671867
copyMethod,
@@ -1890,7 +1890,7 @@ copyTextureToBuffer() with depth aspect.
18901890
.combine('format', kDepthStencilFormats)
18911891
.combine('copyMethod', ['WriteTexture', 'CopyB2T', 'CopyT2B'] as const)
18921892
.combine('aspect', ['depth-only', 'stencil-only'] as const)
1893-
.filter(t => CopyMethodSupportedWithDepthStencilFormat(t.aspect, t.format, t.copyMethod))
1893+
.filter(t => copyMethodSupportedWithDepthStencilFormat(t.aspect, t.format, t.copyMethod))
18941894
.beginSubcases()
18951895
.combineWithParams(kOffsetsAndSizesParams.offsetsAndPaddings)
18961896
.filter(t => t.offsetInBlocks % 4 === 0)
@@ -1910,9 +1910,9 @@ copyTextureToBuffer() with depth aspect.
19101910
const textureSize = [copySize[0] << mipLevel, copySize[1] << mipLevel, copyDepth] as const;
19111911
if (copyMethod === 'CopyT2B') {
19121912
if (aspect === 'depth-only') {
1913-
t.DoCopyTextureToBufferWithDepthAspectTest(format, copySize, 0, 0, 0, 0, mipLevel);
1913+
t.doCopyTextureToBufferWithDepthAspectTest(format, copySize, 0, 0, 0, 0, mipLevel);
19141914
} else {
1915-
t.DoCopyFromStencilTest(
1915+
t.doCopyFromStencilTest(
19161916
format,
19171917
textureSize,
19181918
bytesPerRow,
@@ -1932,7 +1932,7 @@ copyTextureToBuffer() with depth aspect.
19321932
method: copyMethod,
19331933
});
19341934
const initialDataSize = minDataSize + dataPaddingInBytes;
1935-
t.DoUploadToStencilTest(
1935+
t.doUploadToStencilTest(
19361936
format,
19371937
textureSize,
19381938
copyMethod,

src/webgpu/api/operation/command_buffer/render/state_tracking.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as ttu from '../../../../texture_test_utils.js';
1111
import { TexelView } from '../../../../util/texture/texel_view.js';
1212

1313
class VertexAndIndexStateTrackingTest extends AllFeaturesMaxLimitsGPUTest {
14-
GetRenderPipelineForTest(arrayStride: number): GPURenderPipeline {
14+
getRenderPipelineForTest(arrayStride: number): GPURenderPipeline {
1515
return this.device.createRenderPipeline({
1616
layout: 'auto',
1717
vertex: {
@@ -128,7 +128,7 @@ g.test('set_index_buffer_without_changing_buffer')
128128

129129
vertexBuffer.unmap();
130130

131-
const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);
131+
const renderPipeline = t.getRenderPipelineForTest(t.kVertexAttributeSize);
132132

133133
const outputTextureSize = [kPositions.length - 1, 1, 1];
134134
const outputTexture = t.createTextureTracked({
@@ -222,7 +222,7 @@ g.test('set_vertex_buffer_without_changing_buffer')
222222

223223
vertexBuffer.unmap();
224224

225-
const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);
225+
const renderPipeline = t.getRenderPipelineForTest(t.kVertexAttributeSize);
226226

227227
const outputTextureSize = [kPositions.length, 1, 1];
228228
const outputTexture = t.createTextureTracked({
@@ -321,8 +321,8 @@ g.test('change_pipeline_before_and_after_vertex_buffer')
321321
vertexBuffer.unmap();
322322

323323
// Create two render pipelines with different vertex attribute strides
324-
const renderPipeline1 = t.GetRenderPipelineForTest(t.kVertexAttributeSize);
325-
const renderPipeline2 = t.GetRenderPipelineForTest(t.kVertexAttributeSize * 2);
324+
const renderPipeline1 = t.getRenderPipelineForTest(t.kVertexAttributeSize);
325+
const renderPipeline2 = t.getRenderPipelineForTest(t.kVertexAttributeSize * 2);
326326

327327
const kPointsCount = kPositions.length - 1;
328328
const outputTextureSize = [kPointsCount, 1, 1];
@@ -582,7 +582,7 @@ g.test('set_index_buffer_before_non_indexed_draw')
582582
// Initialize the index buffer with 2 uint16 indices (2, 3).
583583
const indexBuffer = t.makeBufferWithContents(new Uint16Array([2, 3]), GPUBufferUsage.INDEX);
584584

585-
const renderPipeline = t.GetRenderPipelineForTest(t.kVertexAttributeSize);
585+
const renderPipeline = t.getRenderPipelineForTest(t.kVertexAttributeSize);
586586

587587
const kPointsCount = 4;
588588
const outputTextureSize = [kPointsCount, 1, 1];

0 commit comments

Comments
 (0)