Skip to content

Commit

Permalink
Explicitly specify precision for all sampler types (mrdoob#27482)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrandedKitty authored and AdaRoseCannon committed Jan 15, 2024
1 parent 7c62b44 commit b2f9887
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/renderers/webgl/WebGLProgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,30 @@ function loopReplacer( match, start, end, snippet ) {

function generatePrecision( parameters ) {

let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
let precisionstring = `precision ${parameters.precision} float;
precision ${parameters.precision} int;
precision ${parameters.precision} sampler2D;
precision ${parameters.precision} samplerCube;
`;

if ( parameters.isWebGL2 ) {

precisionstring += `precision ${parameters.precision} sampler3D;
precision ${parameters.precision} sampler2DArray;
precision ${parameters.precision} sampler2DShadow;
precision ${parameters.precision} samplerCubeShadow;
precision ${parameters.precision} sampler2DArrayShadow;
precision ${parameters.precision} isampler2D;
precision ${parameters.precision} isampler3D;
precision ${parameters.precision} isamplerCube;
precision ${parameters.precision} isampler2DArray;
precision ${parameters.precision} usampler2D;
precision ${parameters.precision} usampler3D;
precision ${parameters.precision} usamplerCube;
precision ${parameters.precision} usampler2DArray;
`;

}

if ( parameters.precision === 'highp' ) {

Expand Down

0 comments on commit b2f9887

Please sign in to comment.