* Helper that does the storage allocation for _mesa_TexStorage1/2/3D()
* and _mesa_TextureStorage1/2/3D().
*/
-static void
+static ALWAYS_INLINE void
texture_storage(struct gl_context *ctx, GLuint dims,
struct gl_texture_object *texObj,
GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width,
- GLsizei height, GLsizei depth, bool dsa)
+ GLsizei height, GLsizei depth, bool dsa, bool no_error)
{
- GLboolean sizeOK, dimensionsOK;
+ GLboolean sizeOK = GL_TRUE, dimensionsOK = GL_TRUE;
mesa_format texFormat;
const char* suffix = dsa ? "ture" : "";
assert(texObj);
- if (tex_storage_error_check(ctx, texObj, dims, target, levels,
- internalformat, width, height, depth, dsa)) {
- return; /* error was recorded */
+ if (!no_error) {
+ if (tex_storage_error_check(ctx, texObj, dims, target, levels,
+ internalformat, width, height, depth, dsa)) {
+ return; /* error was recorded */
+ }
}
texFormat = _mesa_choose_texture_format(ctx, texObj, target, 0,
internalformat, GL_NONE, GL_NONE);
- /* check that width, height, depth are legal for the mipmap level */
- dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0,
- width, height, depth, 0);
+ if (!no_error) {
+ /* check that width, height, depth are legal for the mipmap level */
+ dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0,
+ width, height, depth, 0);
- sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, levels, 0, texFormat,
- 1, width, height, depth);
+ sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, levels, 0, texFormat,
+ 1, width, height, depth);
+ }
if (_mesa_is_proxy_texture(target)) {
if (dimensionsOK && sizeOK) {
}
}
else {
- if (!dimensionsOK) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glTex%sStorage%uD(invalid width, height or depth)",
- suffix, dims);
- return;
- }
+ if (!no_error) {
+ if (!dimensionsOK) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glTex%sStorage%uD(invalid width, height or depth)",
+ suffix, dims);
+ return;
+ }
- if (!sizeOK) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY,
- "glTex%sStorage%uD(texture too large)",
- suffix, dims);
+ if (!sizeOK) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY,
+ "glTex%sStorage%uD(texture too large)",
+ suffix, dims);
+ }
}
assert(levels > 0);
}
+static void
+texture_storage_error(struct gl_context *ctx, GLuint dims,
+ struct gl_texture_object *texObj,
+ GLenum target, GLsizei levels,
+ GLenum internalformat, GLsizei width,
+ GLsizei height, GLsizei depth, bool dsa)
+{
+ texture_storage(ctx, dims, texObj, target, levels, internalformat, width,
+ height, depth, dsa, false);
+}
+
+
/**
* Helper used by _mesa_TexStorage1/2/3D().
*/
if (!texObj)
return;
- texture_storage(ctx, dims, texObj, target, levels,
- internalformat, width, height, depth, false);
+ texture_storage_error(ctx, dims, texObj, target, levels,
+ internalformat, width, height, depth, false);
}
return;
}
- texture_storage(ctx, dims, texObj, texObj->Target,
- levels, internalformat, width, height, depth, true);
+ texture_storage_error(ctx, dims, texObj, texObj->Target,
+ levels, internalformat, width, height, depth, true);
}