Skip to content

TexImage3D implementation not working with Emscripten #318

Description

@yosoymin

I'm using headless-gl with an Emscripten application over Node.js. When creating 3d textures, I can see an exception with the message "Invalid data type for TexImage3D". I think I've found the problem.

Emscripten calls to texImage3D like this:

GLctx.texImage3D(target, level, internalFormat, width, height, depth, border, format, type, null);

But the internal implementation of TexImage3D in headless-gl checks that the last argument is undefined, but it doesn't consider null a possibility.

if (info[9]->IsUndefined()) { glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, nullptr); } else if (info[9]->IsArrayBufferView()) { auto buffer = info[9].As<v8::ArrayBufferView>(); void *bufferPtr = buffer->Buffer()->GetBackingStore()->Data(); glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, bufferPtr); } else { Nan::ThrowTypeError("Invalid data type for TexImage3D"); }

If possible, it would be nice if null is also considered in the first branch condition.
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions