Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLRenderer: Explicitly specify precision for all sampler types #27482

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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