Skip to content

Commit

Permalink
Export fp64-arithmetic shader module (#1309)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress authored Dec 6, 2019
1 parent 2f2a17d commit 3247ef4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion modules/shadertools/src/lib/shader-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default class ShaderModule {
}

return `\
#define MODULE_${this.name.toUpperCase()}
#define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_')}
${moduleSource}\
// END MODULE_${this.name}
Expand Down
34 changes: 15 additions & 19 deletions modules/shadertools/src/modules/fp64/fp64.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,33 @@ import {fp64ify, fp64LowPart, fp64ifyMatrix4} from './fp64-utils';
import fp64arithmeticShader from './fp64-arithmetic.glsl';
import fp64functionShader from './fp64-functions.glsl';

const fp64shader = `${fp64arithmeticShader}\n${fp64functionShader}`;
const CONST_UNIFORMS = {
// Used in LUMA_FP64_CODE_ELIMINATION_WORKAROUND
ONE: 1.0
};
export {fp64ify, fp64LowPart, fp64ifyMatrix4};

function getUniforms() {
return Object.assign({}, CONST_UNIFORMS);
return CONST_UNIFORMS;
}

export default {
name: 'fp64',
vs: fp64shader,
fs: null,
fp64ify,
fp64LowPart,
fp64ifyMatrix4,
getUniforms
};

// Arithmetic only
export const fp64arithmetic = {
name: 'fp64-arithmetic',
vs: `${fp64arithmeticShader}`,
fs: null
vs: fp64arithmeticShader,
fs: null,
getUniforms,
fp64ify,
fp64LowPart
};

// Fragment shader fp64
export const fp64fs = {
name: 'fp64-fs',
vs: null,
fs: fp64shader
// Full fp64 shader
export default {
name: 'fp64',
vs: fp64functionShader,
fs: null,
dependencies: [fp64arithmetic],
fp64ify,
fp64LowPart,
fp64ifyMatrix4
};
2 changes: 1 addition & 1 deletion modules/shadertools/src/modules/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export {default as fp32} from './fp32/fp32';
export {default as fp64} from './fp64/fp64';
export {default as fp64, fp64arithmetic} from './fp64/fp64';
export {default as project} from './project/project';
export {default as lights} from './lights/lights';
export {default as dirlight} from './dirlight/dirlight';
Expand Down

0 comments on commit 3247ef4

Please sign in to comment.