<p dir="auto"><strong>Edit:</strong> I don't know how to implement this. I would like the feature, but it's not the end of the world.<br>
<br><br><br>
<strong>Is your feature request related to a problem? Please describe.</strong></p>
<p dir="auto">My app uses an 8-bit integer layer ID. Every time I pull a new Three.js release, I have to paste-replace this line or my app will break:<br>
<code class="notranslate">if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 )  ) {</code><br>
<del><code class="notranslate">if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 || ( type === 5121 &amp;&amp; ( ! normalized ) ) )  ) {</code></del><br>
<strong>(On second thought, the above change might actually break someone's code somewhere.)</strong></p>
<p dir="auto"><strong>Describe the solution you'd like</strong></p>
<p dir="auto">Can we change that line in the main branch?<br>
<del>All existing working code will work exactly the same.</del> <strong>(No, stuff really could break.)</strong></p>
<p dir="auto">Explanation:<br>
JS has no 8-bit floats.</p>
<ul dir="auto">
<li><code class="notranslate">normalized=true</code> if and only if <code class="notranslate">float</code> array</li>
<li><del><code class="notranslate">normalized=false</code> if and only if <code class="notranslate">int</code> array.</del>  Or, you could want floats 0.0 -&gt; 255.0</li>
</ul>
<p dir="auto"><del>100% unambiguous.</del>  No.</p>
<p dir="auto">Right now, normalized=false just breaks Three.js's buffer implementation / corrupted data goes to the shader.</p>
<p dir="auto"><strong>Describe alternatives you've considered</strong></p>
<p dir="auto">Even if I make a fork just for that 1 line, it won't be able to merge cleanly, and I'll still have to go in and copy-paste every time.<br>
There's a related FR about improving integer support, but I think it went nowhere.</p>
<p dir="auto">Expanding on the <code class="notranslate">vertexAttribIPointer</code> support added in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="592719141" data-permission-text="Title is private" data-url="https://github.com/mrdoob/three.js/issues/19019" data-hovercard-type="pull_request" data-hovercard-url="/mrdoob/three.js/pull/19019/hovercard" href="https://github.com/mrdoob/three.js/pull/19019">#19019</a>, I would like to propose a new property:</p>
<p dir="auto"><code class="notranslate">BufferAttribute.targetType = FloatType</code> (default)</p>
<p dir="auto">This property would support values of the existing constants <code class="notranslate">FloatType</code> (default) and <code class="notranslate">IntType</code>.</p>
<p dir="auto">This would expand support for integer attributes (beyond the current <code class="notranslate">int32</code> and <code class="notranslate">uint32</code>) without changing any existing behavior.</p>
<p dir="auto">The property would ultimately get passed through to <code class="notranslate">WebGLBindingStates.vertexAttribPointer()</code> where the code impact is minimal:</p>
<div class="highlight highlight-source-diff notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="-function vertexAttribPointer( index, size, type, normalized, stride, offset ) {
+function vertexAttribPointer( index, size, type, normalized, stride, offset, targetType ) {

-    if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 ) ) {
+    if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 || targetType == IntType ) ) {

        gl.vertexAttribIPointer( index, size, type, stride, offset );

    } else {

        gl.vertexAttribPointer( index, size, type, normalized, stride, offset );

    }

}"><pre class="notranslate"><span class="pl-md"><span class="pl-md">-</span>function vertexAttribPointer( index, size, type, normalized, stride, offset ) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>function vertexAttribPointer( index, size, type, normalized, stride, offset, targetType ) {</span>

<span class="pl-md"><span class="pl-md">-</span>    if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 ) ) {</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>    if ( capabilities.isWebGL2 === true &amp;&amp; ( type === 5124 || type === 5125 || targetType == IntType ) ) {</span>

        gl.vertexAttribIPointer( index, size, type, stride, offset );

    } else {

        gl.vertexAttribPointer( index, size, type, normalized, stride, offset );

    }

}</pre></div>
<p dir="auto">Alternatively, this could be a boolean attribute such as <code class="notranslate">BufferAttribute.toIntegers = true</code>, as it looks like WebGL only supports <code class="notranslate">vertexAttribPointer</code> (float) and <code class="notranslate">vertexAttribIPointer</code> (int) – not <code class="notranslate">vertexAttribLPointer</code> (double).</p>
<p dir="auto">Apologies if I'm missing anything obvious. Thank you!</p>