Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibgreen committed Aug 20, 2023
1 parent 747096b commit ccc04cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 1 addition & 5 deletions modules/core/src/adapter/utils/decode-vertex-format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ export function decodeVertexFormat(format: VertexFormat): VertexFormatInfo {
type,
components,
byteLength: decodedType.byteLength * components,
// It is not the vertex memory format that determines if the data will be treated as an integer,
// it is the shader attribute declaration.
// Also note that WebGL supports assigning non-normalized integer data to floating point attributes,
// but as far as we can tell, WebGPU does not.
integer: false, // decodedType.integer,
integer: decodedType.integer,
signed: decodedType.signed,
normalized: decodedType.normalized
};
Expand Down
9 changes: 7 additions & 2 deletions modules/webgl/src/adapter/resources/webgl-render-pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
continue; // eslint-disable-line no-continue
}
const decoded = decodeVertexFormat(attribute.format);
const {type: typeString, components: size, byteLength: stride, normalized, integer} = decoded;
const {type: typeString, components: size, byteLength: stride, normalized /* , integer*/} = decoded;
const divisor = attribute.stepMode === 'instance' ? 1 : 0;
const type = getWebGLDataType(typeString);
this.vertexArrayObject.setBuffer(attribute.location, webglBuffer, {
Expand All @@ -129,7 +129,12 @@ export class WEBGLRenderPipeline extends RenderPipeline {
stride,
offset: 0,
normalized,
integer,
// it is the shader attribute declaration, not the vertex memory format,
// that determines if the data in the buffer will be treated as integers.
// /
// Also note that WebGL supports assigning non-normalized integer data to floating point attributes,
// but as far as we can tell, WebGPU does not.
integer: false,
divisor
});
}
Expand Down

0 comments on commit ccc04cf

Please sign in to comment.