- /* At this point an internalformat is valid if it is valid as a texture or
- * as a renderbuffer format. The checks are different because those methods
- * return different values when passing non supported internalformats */
- if (_mesa_base_tex_format(ctx, internalformat) < 0 &&
- _mesa_base_fbo_format(ctx, internalformat) == 0)
- return false;
+ if (target == GL_RENDERBUFFER) {
+ if (_mesa_base_fbo_format(ctx, internalformat) == 0) {
+ return false;
+ }
+ } else if (target == GL_TEXTURE_BUFFER) {
+ if (_mesa_validate_texbuffer_format(ctx, internalformat) ==
+ MESA_FORMAT_NONE) {
+ return false;
+ }
+ } else {
+ if (_mesa_base_tex_format(ctx, internalformat) < 0) {
+ return false;
+ }
+ }