summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-04-29 15:38:24 -0700
committerEric Anholt <[email protected]>2019-05-13 12:03:08 -0700
commit0c31fe9ee743f699bcabcb638ccc83e515f0d1bd (patch)
tree7a8e3fba596796d27e75bc40ba110c24a13c0dec /src/mesa
parentf33cb272f0890f115c36fb96173123bc699b7b2c (diff)
gallium: Redefine the max texture 2d cap from _LEVELS to _SIZE.
The _LEVELS assumes that the max is always power of two. For V3D 4.2, we can support up to 7680 non-power-of-two MSAA textures, which will let X11 support dual 4k displays on newer hardware. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_bitmap.c3
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c9
-rw-r--r--src/mesa/state_tracker/st_extensions.c7
3 files changed, 7 insertions, 12 deletions
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index d7e2ccb3815..948b5819300 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -304,8 +304,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
* it up into chunks.
*/
GLuint MAYBE_UNUSED maxSize =
- 1 << (pipe->screen->get_param(pipe->screen,
- PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
assert(width <= (GLsizei) maxSize);
assert(height <= (GLsizei) maxSize);
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 6f6b42596e6..59868d3ff1d 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -758,8 +758,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* XXX if DrawPixels image is larger than max texture size, break
* it up into chunks.
*/
- maxSize = 1 << (pipe->screen->get_param(pipe->screen,
- PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ maxSize = pipe->screen->get_param(pipe->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_SIZE);
assert(width <= maxSize);
assert(height <= maxSize);
@@ -1181,9 +1181,8 @@ static void
clamp_size(struct pipe_context *pipe, GLsizei *width, GLsizei *height,
struct gl_pixelstore_attrib *unpack)
{
- const int maxSize =
- 1 << (pipe->screen->get_param(pipe->screen,
- PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ const int maxSize = pipe->screen->get_param(pipe->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (*width > maxSize) {
if (unpack->RowLength == 0)
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 77cb83d5c57..86b68542e7b 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -84,11 +84,8 @@ void st_init_limits(struct pipe_screen *screen,
bool can_ubo = true;
int temp;
- int max_texture_levels =
- _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
- MAX_TEXTURE_LEVELS);
-
- c->MaxTextureSize = 1 << (max_texture_levels - 1);
+ c->MaxTextureSize = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
+ c->MaxTextureSize = MIN2(c->MaxTextureSize, 1 << (MAX_TEXTURE_LEVELS - 1));
c->Max3DTextureLevels
= _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS),