Skip to content

Commit

Permalink
add STENCIL_INDEX8
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Dec 21, 2024
1 parent b699345 commit 3e29548
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/texture-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ const DEPTH_COMPONENT24 = 0x81A6;
const DEPTH_COMPONENT32F = 0x8CAC;
const DEPTH32F_STENCIL8 = 0x8CAD;
const DEPTH24_STENCIL8 = 0x88F0;
const STENCIL_INDEX8 = 0x8d48;

/* DataType */
// const BYTE = 0x1400;
Expand Down Expand Up @@ -196,6 +197,7 @@ function getTextureInternalFormatInfo(internalFormat) {
t[DEPTH_COMPONENT32F] = { bytesPerElement: [4], };
t[DEPTH24_STENCIL8] = { bytesPerElement: [4], };
t[DEPTH32F_STENCIL8] = { bytesPerElement: [4], };
t[STENCIL_INDEX8] = { bytesPerElement: [1], };

s_textureInternalFormatInfo = t;
}
Expand Down
22 changes: 22 additions & 0 deletions test/tests/renderbuffer-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,28 @@ describe('renderbuffer tests', () => {
tracker.deleteObjectAndMemory(size2);
});

it('test renderbufferStorage STENCIL_INDEX8', () => {
const {gl} = createContext();
const tracker = new MemInfoTracker(gl, 'renderbuffer');

const rb1 = gl.createRenderbuffer();
tracker.addObjects(1);

gl.bindRenderbuffer(gl.RENDERBUFFER, rb1);
let size1a;
{
const width = 17;
const height = 49;
gl.renderbufferStorage(gl.RENDERBUFFER, gl.STENCIL_INDEX8, width, height);
size1a = width * height;
tracker.addMemory(size1a);
}

gl.deleteRenderbuffer(rb1);
tracker.deleteObjectAndMemory(size1a);
});


it('test renderbufferStorageMultisample', () => {
const {gl} = createContext2();
if (!gl) {
Expand Down

0 comments on commit 3e29548

Please sign in to comment.