Commit 0c31fe9e authored by Eric Anholt's avatar Eric Anholt

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: default avatarMarek Olšák <marek.olsak@amd.com>
parent f33cb272
......@@ -51,7 +51,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
case PIPE_CAP_TEXTURE_SWIZZLE:
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
unreachable("driver must implement these.");
......
......@@ -206,11 +206,7 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
unsigned
vl_video_buffer_max_size(struct pipe_screen *screen)
{
uint32_t max_2d_texture_level;
max_2d_texture_level = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
return 1 << (max_2d_texture_level-1);
return screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
}
void
......
......@@ -34,8 +34,7 @@ The integer capabilities:
* ``PIPE_CAP_QUERY_TIME_ELAPSED``: Whether PIPE_QUERY_TIME_ELAPSED queries are available.
* ``PIPE_CAP_TEXTURE_SWIZZLE``: Whether swizzling through sampler views is
supported.
* ``PIPE_CAP_MAX_TEXTURE_2D_LEVELS``: The maximum number of mipmap levels available
for a 2D texture.
* ``PIPE_CAP_MAX_TEXTURE_2D_SIZE``: The maximum size of 2D (and 1D) textures.
* ``PIPE_CAP_MAX_TEXTURE_3D_LEVELS``: The maximum number of mipmap levels available
for a 3D texture.
* ``PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS``: The maximum number of mipmap levels available
......
......@@ -318,7 +318,8 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 255;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return screen->specs.max_texture_size;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
{
int log2_max_tex_size = util_last_bit(screen->specs.max_texture_size);
......
......@@ -371,7 +371,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 0;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 1 << (MAX_MIP_LEVELS - 1);
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return MAX_MIP_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......
......@@ -365,12 +365,12 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
return is->debug.lie ? 1 : 0;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return I915_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 1 << (I915_MAX_TEXTURE_2D_LEVELS - 1);
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return I915_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return I915_MAX_TEXTURE_2D_LEVELS;
return 1 << (I915_MAX_TEXTURE_2D_LEVELS - 1);
case PIPE_CAP_MIN_TEXEL_OFFSET:
case PIPE_CAP_MAX_TEXEL_OFFSET:
case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET:
......
......@@ -202,7 +202,8 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
case PIPE_CAP_MAX_RENDER_TARGETS:
return BRW_MAX_DRAW_BUFFERS;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 16384;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return IRIS_MAX_MIPLEVELS; /* 16384x16384 */
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......
......@@ -119,7 +119,8 @@ lima_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 1 << (LIMA_MAX_MIP_LEVELS - 1);
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return LIMA_MAX_MIP_LEVELS;
......
......@@ -140,8 +140,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET:
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return LP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 1 << (LP_MAX_TEXTURE_2D_LEVELS - 1);
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return LP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
......
......@@ -58,8 +58,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
/* non-boolean capabilities */
case PIPE_CAP_MAX_RENDER_TARGETS:
return (eng3d->oclass >= NV40_3D_CLASS) ? 4 : 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 13;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 4096;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 10;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
......
......@@ -94,8 +94,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
switch (param) {
/* non-boolean caps */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return 14;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 8192;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return 12;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
......
......@@ -112,7 +112,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
switch (param) {
/* non-boolean caps */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 16384;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 15;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......
......@@ -117,7 +117,8 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 4096;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 13;
......
......@@ -286,7 +286,8 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
return 0;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return is_r500 ? 4096 : 2048;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
/* 13 == 4096, 12 == 2048 */
......
......@@ -497,7 +497,11 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
return 2048;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
if (family >= CHIP_CEDAR)
return 16384;
else
return 8192;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
if (family >= CHIP_CEDAR)
return 15;
......
......@@ -177,11 +177,10 @@ void r600_test_dma(struct r600_common_screen *rscreen)
struct pipe_context *ctx = screen->context_create(screen, NULL, 0);
struct r600_common_context *rctx = (struct r600_common_context*)ctx;
uint64_t max_alloc_size;
unsigned i, iterations, num_partial_copies, max_levels, max_tex_side;
unsigned i, iterations, num_partial_copies, max_tex_side;
unsigned num_pass = 0, num_fail = 0;
max_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
max_tex_side = 1 << (max_levels - 1);
max_tex_side = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
/* Max 128 MB allowed for both textures. */
max_alloc_size = 128 * 1024 * 1024;
......
......@@ -276,7 +276,8 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 2048;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 16384;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return 15; /* 16384 */
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......
......@@ -192,11 +192,10 @@ void si_test_dma(struct si_screen *sscreen)
struct pipe_context *ctx = screen->context_create(screen, NULL, 0);
struct si_context *sctx = (struct si_context*)ctx;
uint64_t max_alloc_size;
unsigned i, iterations, num_partial_copies, max_levels, max_tex_side;
unsigned i, iterations, num_partial_copies, max_tex_side;
unsigned num_pass = 0, num_fail = 0;
max_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
max_tex_side = 1 << (max_levels - 1);
max_tex_side = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
/* Max 128 MB allowed for both textures. */
max_alloc_size = 128 * 1024 * 1024;
......
......@@ -95,8 +95,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET:
return 0;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return SP_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 1 << (SP_MAX_TEXTURE_2D_LEVELS - 1);
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return SP_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
......
......@@ -92,13 +92,10 @@ sp_create_tile_cache( struct pipe_context *pipe )
{
struct softpipe_tile_cache *tc;
uint pos;
MAYBE_UNUSED int maxTexSize;
int maxLevels;
/* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */
maxLevels = pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
maxTexSize = 1 << (maxLevels - 1);
assert(MAX_WIDTH >= maxTexSize);
assert(MAX_WIDTH >= pipe->screen->get_param(pipe->screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE));
STATIC_ASSERT(sizeof(union tile_address) == 4);
......
......@@ -221,18 +221,18 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
return 256;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
{
unsigned levels = SVGA_MAX_TEXTURE_LEVELS;
unsigned size = 1 << (SVGA_MAX_TEXTURE_LEVELS - 1);
if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH, &result))
levels = MIN2(util_logbase2(result.u) + 1, levels);
size = MIN2(result.u, size);
else
levels = 12 /* 2048x2048 */;
size = 2048;
if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT, &result))
levels = MIN2(util_logbase2(result.u) + 1, levels);
size = MIN2(result.u, size);
else
levels = 12 /* 2048x2048 */;
return levels;
size = 2048;
return size;
}
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......@@ -245,7 +245,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
* No mechanism to query the host, and at least limited to 2048x2048 on
* certain hardware.
*/
return MIN2(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS),
return MIN2(util_last_bit(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE)),
12 /* 2048x2048 */);
case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS:
......
......@@ -52,7 +52,7 @@
* XXX Check max texture size values against core and sampler.
*/
#define SWR_MAX_TEXTURE_SIZE (2 * 1024 * 1024 * 1024ULL) /* 2GB */
#define SWR_MAX_TEXTURE_2D_LEVELS 14 /* 8K x 8K for now */
#define SWR_MAX_TEXTURE_2D_SIZE 8192
#define SWR_MAX_TEXTURE_3D_LEVELS 12 /* 2K x 2K x 2K for now */
#define SWR_MAX_TEXTURE_CUBE_LEVELS 14 /* 8K x 8K for now */
#define SWR_MAX_TEXTURE_ARRAY_LAYERS 512 /* 8K x 512 / 8K x 8K x 512 */
......@@ -162,8 +162,8 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
/* limits */
case PIPE_CAP_MAX_RENDER_TARGETS:
return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
return SWR_MAX_TEXTURE_2D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return SWR_MAX_TEXTURE_2D_SIZE;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
return SWR_MAX_TEXTURE_3D_LEVELS;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
......
......@@ -205,7 +205,11 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return V3D_MAX_FS_INPUTS / 4;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
if (screen->devinfo.ver < 40)
return 2048;
else
return 4096;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
if (screen->devinfo.ver < 40)
......
......@@ -171,7 +171,8 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
return 1;
/* Texturing. */
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
return 2048;
case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
return VC4_MAX_MIP_LEVELS;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
......
......@@ -82,10 +82,10 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
return vscreen->caps.caps.v1.bset.mirror_clamp;
case PIPE_CAP_TEXTURE_SWIZZLE:
return 1;
case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
case PIPE_CAP_MAX_TEXTURE_2D_SIZE:
if (vscreen->caps.caps.v2.max_texture_2d_size)
return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_2d_size);
return 15; /* 16K x 16K */
return vscreen->caps.caps.v2.max_texture_2d_size;
return 16384;
case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
if (vscreen->caps.caps.v2.max_texture_3d_size)
return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_3d_size);
......
......@@ -691,7 +691,7 @@ enum pipe_cap
PIPE_CAP_OCCLUSION_QUERY,
PIPE_CAP_QUERY_TIME_ELAPSED,
PIPE_CAP_TEXTURE_SWIZZLE,
PIPE_CAP_MAX_TEXTURE_2D_LEVELS,
PIPE_CAP_MAX_TEXTURE_2D_SIZE,
PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS,
PIPE_CAP_TEXTURE_MIRROR_CLAMP,
......
......@@ -25,6 +25,7 @@
#include "core/platform.hpp"
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
#include "util/bitscan.h"
#include "util/u_debug.h"
using namespace clover;
......@@ -108,7 +109,7 @@ device::max_image_buffer_size() const {
cl_uint
device::max_image_levels_2d() const {
return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
return util_last_bit(pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_SIZE));
}
cl_uint
......
......@@ -685,7 +685,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_NONPOW2CONDITIONAL) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_CUBEMAP_POW2) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_VOLUMEMAP_POW2) |
D3DPIPECAP(MAX_TEXTURE_2D_LEVELS, D3DPTEXTURECAPS_MIPMAP) |
D3DPIPECAP(MAX_TEXTURE_2D_SIZE, D3DPTEXTURECAPS_MIPMAP) |
D3DPIPECAP(MAX_TEXTURE_3D_LEVELS, D3DPTEXTURECAPS_MIPVOLUMEMAP) |
D3DPIPECAP(MAX_TEXTURE_CUBE_LEVELS, D3DPTEXTURECAPS_MIPCUBEMAP);
......@@ -726,8 +726,8 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
pCaps->LineCaps |= D3DLINECAPS_ANTIALIAS;
}
pCaps->MaxTextureWidth =
1 << (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
pCaps->MaxTextureWidth =screen->get_param(screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE);
pCaps->MaxTextureHeight = pCaps->MaxTextureWidth;
pCaps->MaxVolumeExtent =
1 << (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS) - 1);
......
......@@ -885,9 +885,7 @@ OSMesaGetIntegerv(GLint pname, GLint *value)
case OSMESA_MAX_HEIGHT:
{
struct pipe_screen *screen = get_st_manager()->screen;
int maxLevels = screen->get_param(screen,
PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
*value = 1 << (maxLevels - 1);
*value = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
}
return;
default:
......
......@@ -49,7 +49,6 @@ vlVdpVideoMixerCreate(VdpDevice device,
vlVdpVideoMixer *vmixer = NULL;
VdpStatus ret;
struct pipe_screen *screen;
uint32_t max_2d_texture_level;
unsigned max_size, i;
vlVdpDevice *dev = vlGetDataHTAB(device);
......@@ -148,8 +147,7 @@ vlVdpVideoMixerCreate(VdpDevice device,
goto no_params;
}
max_2d_texture_level = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
max_size = pow(2, max_2d_texture_level-1);
max_size = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (vmixer->video_width < 48 || vmixer->video_width > max_size) {
VDPAU_MSG(VDPAU_WARN, "[VDPAU] 48 < %u < %u not valid for width\n",
vmixer->video_width, max_size);
......
......@@ -69,7 +69,7 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
{
vlVdpDevice *dev;
struct pipe_screen *pscreen;
uint32_t max_2d_texture_level;
uint32_t max_2d_texture_size;
if (!(is_supported && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
......@@ -86,13 +86,12 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
/* XXX: Current limits */
*is_supported = true;
max_2d_texture_level = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
max_2d_texture_size = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
mtx_unlock(&dev->mutex);
if (!max_2d_texture_level)
if (!max_2d_texture_size)
return VDP_STATUS_RESOURCES;
/* I am not quite sure if it is max_2d_texture_level-1 or just max_2d_texture_level */
*max_width = *max_height = pow(2,max_2d_texture_level-1);
*max_width = *max_height = max_2d_texture_size;
return VDP_STATUS_OK;
}
......@@ -251,15 +250,15 @@ vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET
);
if (*is_supported) {
uint32_t max_2d_texture_level = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
uint32_t max_2d_texture_size = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (!max_2d_texture_level) {
if (!max_2d_texture_size) {
mtx_unlock(&dev->mutex);
return VDP_STATUS_ERROR;
}
*max_width = *max_height = pow(2, max_2d_texture_level - 1);
*max_width = *max_height = max_2d_texture_size;
} else {
*max_width = 0;
*max_height = 0;
......@@ -451,15 +450,15 @@ vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET
);
if (*is_supported) {
uint32_t max_2d_texture_level = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
uint32_t max_2d_texture_size = pscreen->get_param(
pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (!max_2d_texture_level) {
if (!max_2d_texture_size) {
mtx_unlock(&dev->mutex);
return VDP_STATUS_ERROR;
}
*max_width = *max_height = pow(2, max_2d_texture_level - 1);
*max_width = *max_height = max_2d_texture_size;
} else {
*max_width = 0;
*max_height = 0;
......
......@@ -121,8 +121,8 @@ stw_init(const struct stw_winsys *stw_winsys)
stw_dev->smapi->get_param = stw_get_param;
stw_dev->screen = screen;
stw_dev->max_2d_levels =
screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
stw_dev->max_2d_levels = util_last_bit(screen->get_param(screen,
PIPE_CAP_MAX_TEXTURE_2D_SIZE));
stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1);
InitializeCriticalSection(&stw_dev->ctx_mutex);
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment