Skip to content

Commit 480ebf0

Browse files
committed
lint fix
1 parent 10a6a75 commit 480ebf0

File tree

6 files changed

+57
-40
lines changed

6 files changed

+57
-40
lines changed

src/gpu_hash/shader.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ export class HashSetShaderManager {
120120
}
121121

122122
defineShader(builder: ShaderBuilder, fragment = true) {
123-
const addCode = fragment ? builder.addFragmentCode.bind(builder) : builder.addVertexCode.bind(builder);
123+
const addCode = fragment
124+
? builder.addFragmentCode.bind(builder)
125+
: builder.addVertexCode.bind(builder);
124126
const { hashSeedsName, samplerName, numAlternatives, hashKeyMask } = this;
125127
builder.addUniform("highp uint", hashSeedsName, numAlternatives);
126128
builder.addUniform("highp uint", hashKeyMask);
@@ -203,7 +205,9 @@ bool ${this.hasFunctionName}(uint64_t x) {
203205

204206
export class HashMapShaderManager extends HashSetShaderManager {
205207
defineShader(builder: ShaderBuilder, fragment = true) {
206-
const addCode = fragment ? builder.addFragmentCode.bind(builder) : builder.addVertexCode.bind(builder);
208+
const addCode = fragment
209+
? builder.addFragmentCode.bind(builder)
210+
: builder.addVertexCode.bind(builder);
207211
super.defineShader(builder, fragment);
208212
const { numAlternatives, hashSeedsName, hashKeyMask } = this;
209213
let s = `

src/layer/segmentation/index.ts

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,16 @@ class SegmentationUserLayerDisplayState implements SegmentationDisplayState {
544544

545545
// so 2d/3d share GL context
546546
// the offscreen canvas is a separate context that doesn't share textures
547-
this.segmentationColorUserShader = new SegmentationColorUserShaderManager(this, this.layer.manager.chunkManager.chunkQueueManager.gl);
548-
547+
this.segmentationColorUserShader = new SegmentationColorUserShaderManager(
548+
this,
549+
this.layer.manager.chunkManager.chunkQueueManager.gl,
550+
);
551+
549552
this.offscreenGL = initializeWebGL(new OffscreenCanvas(1, 1));
550-
this.offscreenSegmentationColorUserShader = new SegmentationColorUserShaderManager(this, this.offscreenGL);
553+
this.offscreenSegmentationColorUserShader =
554+
new SegmentationColorUserShaderManager(this, this.offscreenGL);
551555
this.getSegmentColorShader = this.makeSegmentColorShaderGetter();
552-
553-
};
556+
}
554557

555558
offscreenGL;
556559
offscreenSegmentationColorUserShader;
@@ -597,29 +600,36 @@ class SegmentationUserLayerDisplayState implements SegmentationDisplayState {
597600
segmentProperties: this.segmentationGroupState.value.segmentPropertyMap,
598601
})),
599602
);
600-
return parameterizedEmitterDependentShaderGetter(this.layer, this.offscreenGL, {
601-
memoizeKey: `segmentColorShaderTODO`,
602-
parameters,
603-
encodeParameters: (p) => {
604-
return `${p.shaderBuilderState.parseResult.code}/${p.segmentProperties?.numericalProperties.length}`;
605-
},
606-
shaderError: this.layer.displayState.shaderError, // TODO can I reuse this?
607-
defineShader: (builder, { }) => {
608-
this.offscreenSegmentationColorUserShader.defineShader(builder, /*fragment=*/ false);
609-
builder.addAttribute("highp vec4", "aVertexPosition");
610-
builder.addUniform("highp vec4", "uColor");
611-
builder.addUniform("highp uvec2", "uID");
612-
builder.addVarying("highp vec4", "vColor");
613-
let vertexMain = `
603+
return parameterizedEmitterDependentShaderGetter(
604+
this.layer,
605+
this.offscreenGL,
606+
{
607+
memoizeKey: `segmentColorShaderTODO`,
608+
parameters,
609+
encodeParameters: (p) => {
610+
return `${p.shaderBuilderState.parseResult.code}/${p.segmentProperties?.numericalProperties.length}`;
611+
},
612+
shaderError: this.layer.displayState.shaderError, // TODO can I reuse this?
613+
defineShader: (builder) => {
614+
this.offscreenSegmentationColorUserShader.defineShader(
615+
builder,
616+
/*fragment=*/ false,
617+
);
618+
builder.addAttribute("highp vec4", "aVertexPosition");
619+
builder.addUniform("highp vec4", "uColor");
620+
builder.addUniform("highp uvec2", "uID");
621+
builder.addVarying("highp vec4", "vColor");
622+
const vertexMain = `
614623
gl_Position = aVertexPosition;
615624
loadSegmentProperties(uint64_t(uID));
616625
vColor = segmentColor(uColor);
617626
`;
618-
builder.addVertexMain(vertexMain);
619-
builder.addOutputBuffer("vec4", "out_fragColor", 0);
620-
builder.setFragmentMain("out_fragColor = vColor;");
627+
builder.addVertexMain(vertexMain);
628+
builder.addOutputBuffer("vec4", "out_fragColor", 0);
629+
builder.setFragmentMain("out_fragColor = vColor;");
630+
},
621631
},
622-
});
632+
);
623633
};
624634

625635
context = () => {}; // TEMP how to get rid of this?

src/mesh/frontend.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ import * as matrix from "#src/util/matrix.js";
7373
import { GLBuffer } from "#src/webgl/buffer.js";
7474
import type { GL } from "#src/webgl/context.js";
7575
import type { WatchableShaderError } from "#src/webgl/dynamic_shader.js";
76-
import {
77-
parameterizedEmitterDependentShaderGetter,
78-
} from "#src/webgl/dynamic_shader.js";
76+
import { parameterizedEmitterDependentShaderGetter } from "#src/webgl/dynamic_shader.js";
7977
import type { ShaderBuilder, ShaderProgram } from "#src/webgl/shader.js";
8078
import { glsl_uint64 } from "#src/webgl/shader_lib.js";
8179
import type { ShaderControlState } from "#src/webgl/shader_ui_controls.js";
@@ -398,7 +396,10 @@ export class MeshShaderManager {
398396
) => {
399397
addControlsToBuilder(shaderBuilderState, builder);
400398
this.vertexPositionHandler.defineShader(builder);
401-
layer.displayState.segmentationColorUserShader.defineShader(builder, /*fragment=*/ false);
399+
layer.displayState.segmentationColorUserShader.defineShader(
400+
builder,
401+
/*fragment=*/ false,
402+
);
402403
builder.addAttribute("highp vec2", "aVertexNormal");
403404
builder.addVarying("highp vec4", "vColor");
404405
builder.addUniform("highp vec4", "uLightDirection");

src/segmentation_display_state/property_map.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import type { ChunkManager } from "#src/chunk_manager/frontend.js";
1818
import { ChunkSource } from "#src/chunk_manager/frontend.js";
1919
import { HashMapUint64 } from "#src/gpu_hash/hash_table.js";
2020
import { GPUHashTable, HashMapShaderManager } from "#src/gpu_hash/shader.js";
21+
import { DEFAULT_FRAGMENT_SEGMENT_COLOR } from "#src/layer/segmentation/index.js";
2122
import type { IndexedSegmentProperty } from "#src/segmentation_display_state/base.js";
23+
import type { SegmentationDisplayState } from "#src/segmentation_display_state/frontend.js";
2224
import type { Uint64OrderedSet } from "#src/uint64_ordered_set.js";
2325
import type { Uint64Set } from "#src/uint64_set.js";
2426
import type {
@@ -43,10 +45,8 @@ import {
4345
import { getObjectId } from "#src/util/object_id.js";
4446
import { Signal } from "#src/util/signal.js";
4547
import { defaultStringCompare } from "#src/util/string.js";
46-
import { GL } from "#src/webgl/context.js";
47-
import { ShaderBuilder, ShaderProgram } from "#src/webgl/shader.js";
48-
import { DEFAULT_FRAGMENT_SEGMENT_COLOR } from "#src/layer/segmentation/index.js";
49-
import { SegmentationDisplayState } from "./frontend";
48+
import type { GL } from "#src/webgl/context.js";
49+
import type { ShaderBuilder, ShaderProgram } from "#src/webgl/shader.js";
5050
import { glsl_uint64_as_float } from "#src/webgl/shader_lib.js";
5151

5252
export type InlineSegmentProperty =
@@ -1504,7 +1504,7 @@ export class SegmentationColorUserShaderManager extends RefCounted {
15041504
addCode(`highp ${getShaderOutputType(dataType)} ${identifier};`);
15051505
}
15061506
}
1507-
let loadSegmentPropertiesCode = `
1507+
const loadSegmentPropertiesCode = `
15081508
void loadSegmentProperties(uint64_t id) {
15091509
${Array.from(
15101510
this.segmentPropertyShaderData,
@@ -1518,7 +1518,7 @@ ${manager.getFunctionName}(id, ${identifier}_64);
15181518
${identifier} = asFloat(${identifier}_64);
15191519
`;
15201520
} else {
1521-
// TODO, will
1521+
// TODO, will
15221522
return `
15231523
uint64_t ${identifier}_64;
15241524
${manager.getFunctionName}(id, ${identifier}_64);

src/sliceview/volume/segmentation_renderlayer.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import type {
3030
SegmentationGroupState,
3131
} from "#src/segmentation_display_state/frontend.js";
3232
import { registerRedrawWhenSegmentationDisplayStateChanged } from "#src/segmentation_display_state/frontend.js";
33-
import {
34-
PreprocessedSegmentPropertyMap,
35-
} from "#src/segmentation_display_state/property_map.js";
33+
import type { PreprocessedSegmentPropertyMap } from "#src/segmentation_display_state/property_map.js";
3634
import type { SliceViewSourceOptions } from "#src/sliceview/base.js";
3735
import type {
3836
SliceView,
@@ -221,7 +219,9 @@ export class SegmentationRenderLayer extends SliceViewVolumeRenderLayer<ShaderPa
221219
this.registerDisposer(
222220
displayState.ignoreNullVisibleSet.changed.add(this.redrawNeeded.dispatch),
223221
);
224-
displayState.segmentationColorUserShader.changed.add(this.redrawNeeded.dispatch);
222+
displayState.segmentationColorUserShader.changed.add(
223+
this.redrawNeeded.dispatch,
224+
);
225225
}
226226

227227
disposed() {

src/ui/segmentation_display_options_tab.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ export class DisplayOptionsTab extends Tab {
7878
);
7979
}
8080

81-
const segmentColorCodeWidget = this.registerDisposer(makeShaderCodeWidget(layer));
81+
const segmentColorCodeWidget = this.registerDisposer(
82+
makeShaderCodeWidget(layer),
83+
);
8284
element.appendChild(
8385
makeShaderCodeWidgetTopRow(
8486
this.layer,

0 commit comments

Comments
 (0)