MCPcopy
hub / github.com/processing/p5.js / _shaderOptions

Method _shaderOptions

src/webgpu/p5.RendererWebGPU.js:856–885  ·  view source on GitHub ↗
({ mode, compute, workgroupSize })

Source from the content-addressed store, hash-verified

854 }
855
856 _shaderOptions({ mode, compute, workgroupSize }) {
857 if (compute) return { compute: true, workgroupSize };
858 const activeFramebuffer = this.activeFramebuffer();
859 const format = activeFramebuffer ?
860 this._getWebGPUColorFormat(activeFramebuffer) :
861 this.presentationFormat;
862
863 const requestedSampleCount = activeFramebuffer ?
864 (activeFramebuffer.antialias ? activeFramebuffer.antialiasSamples : 1) :
865 1; // No MSAA needed when blitting already-antialiased textures to canvas
866 const sampleCount = this._getValidSampleCount(requestedSampleCount);
867
868 const depthFormat = activeFramebuffer
869 ? (activeFramebuffer.useDepth ? this._getWebGPUDepthFormat(activeFramebuffer) : undefined)
870 : this.depthFormat;
871
872 const drawTarget = this.drawTarget();
873 const clipping = this._clipping;
874 const clipApplied = drawTarget._isClipApplied;
875
876 return {
877 topology: mode === constants.TRIANGLE_STRIP ? 'triangle-strip' : 'triangle-list',
878 blendMode: this.states.curBlendMode,
879 sampleCount,
880 format,
881 depthFormat,
882 clipping,
883 clipApplied,
884 }
885 }
886
887 _shaderOptionsDifferent(newOptions) {
888 if (!this.activeShaderOptions) return true;

Callers 1

setupShaderBindGroupsMethod · 0.95

Calls 5

_getWebGPUColorFormatMethod · 0.95
_getValidSampleCountMethod · 0.95
_getWebGPUDepthFormatMethod · 0.95
activeFramebufferMethod · 0.80
drawTargetMethod · 0.80

Tested by

no test coverage detected