From ccc04cf4f0a69beb9ee6077027c32adea34f1087 Mon Sep 17 00:00:00 2001 From: Ib Green Date: Sun, 20 Aug 2023 09:12:06 -0400 Subject: [PATCH] fixes --- modules/core/src/adapter/utils/decode-vertex-format.ts | 6 +----- .../webgl/src/adapter/resources/webgl-render-pipeline.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/core/src/adapter/utils/decode-vertex-format.ts b/modules/core/src/adapter/utils/decode-vertex-format.ts index 9072af85a3..7bc2d9b39c 100644 --- a/modules/core/src/adapter/utils/decode-vertex-format.ts +++ b/modules/core/src/adapter/utils/decode-vertex-format.ts @@ -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 }; diff --git a/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts b/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts index 29ca2bc1ef..fd64c4b8ba 100644 --- a/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts +++ b/modules/webgl/src/adapter/resources/webgl-render-pipeline.ts @@ -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, { @@ -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 }); }