Skip to content

Commit

Permalink
Readability fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
codedpalette committed Apr 15, 2024
1 parent c93b4e9 commit 387ac12
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/rendering/renderers/gl/geometry/GlGeometrySystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export class GlGeometrySystem implements System
{
// Can't use truthiness check to determine if divisor is set,
// since 0 is a valid value for divisor
const divisor = 'divisor' in attribute ? attribute.divisor : 1;
const divisor = attribute.divisor ?? 1;

gl.vertexAttribDivisor(location, divisor);
}
Expand Down
5 changes: 3 additions & 2 deletions src/rendering/renderers/gpu/pipeline/PipelineSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,12 @@ export class PipelineSystem implements System
{
const attribute = geometry.attributes[i];

if ('divisor' in attribute)
if ((attribute.divisor ?? 1) !== 1)
{
// TODO: Maybe emulate divisor with storage_buffers/float_textures?
// For now just issue a warning
warn(`Attribute ${i} has 'divisor' field set, which is currently unsupported in WebGPURenderer.`);
warn(`Attribute ${i} has an invalid divisor value of '${attribute.divisor}'. `
+ 'WebGPU only supports a divisor value of 1');
}

if (attribute.buffer === buffer)
Expand Down

0 comments on commit 387ac12

Please sign in to comment.