Fix uncleared uniforms bug
This commit is contained in:
parent
374796f398
commit
81eb0220d2
5 changed files with 20 additions and 2 deletions
|
|
@ -52,6 +52,8 @@ export interface DrawableDescriptor {
|
|||
*
|
||||
* For each step, a shader will be generated. And at runtime the closes matching
|
||||
* shader will be used to render a given part of the scene.
|
||||
*
|
||||
* Must contain 0 as a value.
|
||||
*/
|
||||
shaderCombinationSteps: Array<number>;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ export abstract class Drawable {
|
|||
*/
|
||||
protected abstract getObjectToSerialize(transform2d: mat2d, transform1d: number): any;
|
||||
|
||||
/** @internal */
|
||||
public serializeToUniforms(
|
||||
uniforms: any,
|
||||
transform2d: mat2d,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ export class UniformArrayAutoScalingProgram implements IProgram {
|
|||
|
||||
const promises: Array<Promise<void>> = [];
|
||||
|
||||
this.checkDescriptorValidity(descriptors);
|
||||
|
||||
for (const combination of getCombinations(
|
||||
descriptors.map((o) => o.shaderCombinationSteps)
|
||||
)) {
|
||||
|
|
@ -48,6 +50,19 @@ export class UniformArrayAutoScalingProgram implements IProgram {
|
|||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
private checkDescriptorValidity(descriptors: Array<DrawableDescriptor>) {
|
||||
const descriptorsWithoutZero = descriptors.filter(
|
||||
(d) => !d.shaderCombinationSteps.includes(0)
|
||||
);
|
||||
if (descriptorsWithoutZero.length > 0) {
|
||||
throw new Error(
|
||||
`Descriptors must contain a '0' step. Count macros for the offending descriptors: ${descriptorsWithoutZero.map(
|
||||
(d) => d.uniformCountMacroName
|
||||
)}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public setDrawingRectangleUV(bottomLeft: vec2, size: vec2) {
|
||||
this.drawingRectangleBottomLeft = bottomLeft;
|
||||
this.drawingRectangleSize = size;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { RuntimeSettings } from './runtime-settings';
|
|||
* Contains the default values used for [[RuntimeSettings]].
|
||||
*/
|
||||
export const defaultRuntimeSettings: RuntimeSettings = {
|
||||
enableHighDpiRendering: true,
|
||||
enableHighDpiRendering: false,
|
||||
tileMultiplier: 8,
|
||||
isWorldInverted: false,
|
||||
lightCutoffDistance: 400,
|
||||
|
|
|
|||
|
|
@ -7,5 +7,5 @@ export const defaultStartupSettings: StartupSettings = {
|
|||
shadowTraceCount: 16,
|
||||
paletteSize: 256,
|
||||
ignoreWebGL2: false,
|
||||
enableStopwatch: true,
|
||||
enableStopwatch: false,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue