mesa: Replace MaxTextureLevels with MaxTextureSize.
In most places (glGetInteger, max_legal_texture_dimensions), we wanted the number of pixels, not the number of levels. Number of levels is easily recovered with util_next_power_of_two() and ffs(). More importantly, for V3D we want to be able to expose a non-power-of-two maximum texture size to cover 2x4k displays on HW that can't quite do 8192 wide. Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
@@ -555,7 +555,7 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api)
|
||||
|
||||
/* Constants, may be overriden (usually only reduced) by device drivers */
|
||||
consts->MaxTextureMbytes = MAX_TEXTURE_MBYTES;
|
||||
consts->MaxTextureLevels = MAX_TEXTURE_LEVELS;
|
||||
consts->MaxTextureSize = 1 << (MAX_TEXTURE_LEVELS - 1);
|
||||
consts->Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
|
||||
consts->MaxCubeTextureLevels = MAX_CUBE_TEXTURE_LEVELS;
|
||||
consts->MaxTextureRectSize = MAX_TEXTURE_RECT_SIZE;
|
||||
@@ -782,7 +782,7 @@ check_context_limits(struct gl_context *ctx)
|
||||
|
||||
|
||||
/* Texture size checks */
|
||||
assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
|
||||
assert(ctx->Const.MaxTextureSize <= (1 << (MAX_TEXTURE_LEVELS - 1)));
|
||||
assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
|
||||
assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
|
||||
assert(ctx->Const.MaxTextureRectSize <= MAX_TEXTURE_RECT_SIZE);
|
||||
@@ -792,10 +792,8 @@ check_context_limits(struct gl_context *ctx)
|
||||
assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
|
||||
|
||||
/* Max texture size should be <= max viewport size (render to texture) */
|
||||
assert((1U << (ctx->Const.MaxTextureLevels - 1))
|
||||
<= ctx->Const.MaxViewportWidth);
|
||||
assert((1U << (ctx->Const.MaxTextureLevels - 1))
|
||||
<= ctx->Const.MaxViewportHeight);
|
||||
assert(ctx->Const.MaxTextureSize <= ctx->Const.MaxViewportWidth);
|
||||
assert(ctx->Const.MaxTextureSize <= ctx->Const.MaxViewportHeight);
|
||||
|
||||
assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
|
||||
|
||||
|
Reference in New Issue
Block a user