# glTexSubImage3D throws GL_INVALID_ENUMERATION on NVIDIA

I'm having problems when using the following statement on different GPUs:

glTexSubImage3D(target, 0, 0, 0, 0, width, height, layers, format, type, NULL);


on NVIDIA cards "format = GL_RGBA" throws a fatal error that causes the program to crash, but it works and throws no errors if I use the sized version "format = GL_RGBA8"

on AMD cards "format = GL_RGBA" works and throws no errors, "format = GL_RGBA8" also works, but throws the error "GL_INVALID_ENUMERATION"

--

I'm currently using GL_RGBA8, so it works on both cards, but I wonder if there is a way to do this that throws no errors on either card.

--

Here's the spec for glTexSubImage3D from Khronos.org

format

Specifies the format of the pixel data. The following symbolic values are accepted: GL_RED, GL_RG, GL_RGB, GL_BGR, GL_RGBA, GL_DEPTH_COMPONENT, and GL_STENCIL_INDEX.

--

I'm using opengl 4.3 core profile, glfw and glew. Here is my texStorage statement called before glTexSubImage3D

internalFormat = GL_RGBA8;
glTexStorage3D(target, 1, internalFormat, width, height, layers);


per the comments, the other values are

target = GL_TEXTURE_2D;
width = 4096;
height = 4096;
layers = 1;
format = GL_RGBA8;
type = GL_UNSIGNED_BYTE;


--

Am I using this incorrectly? Is there a way to satisfy both implementations?

• Passing NULL to TexSubImage functions is not allowed. You need to fix that, regardless of the rest of your parameters. – Nicol Bolas Aug 14 '18 at 13:15
• Yup, that fixed everything. I guess in the case of NVIDIA, 2 wrongs made a right? Add your comment as an answer, and I will accept it as the answer. – Kyy13 Aug 14 '18 at 17:13
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.32749831676483154, "perplexity": 4551.560312781307}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-22/segments/1558232256778.29/warc/CC-MAIN-20190522083227-20190522105227-00202.warc.gz"}