Skip to content
This repository has been archived by the owner on Jan 7, 2023. It is now read-only.

Commit

Permalink
gallium: Redefine the max texture 2d cap from _LEVELS to _SIZE.
Browse files Browse the repository at this point in the history
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 <marek.olsak@amd.com>
  • Loading branch information
anholt committed May 13, 2019
1 parent f33cb27 commit 0c31fe9
Show file tree
Hide file tree
Showing 35 changed files with 91 additions and 93 deletions.
2 changes: 1 addition & 1 deletion src/gallium/auxiliary/util/u_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
6 changes: 1 addition & 5 deletions src/gallium/auxiliary/vl/vl_video_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/gallium/docs/source/screen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/etnaviv/etnaviv_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/freedreno/freedreno_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/gallium/drivers/i915/i915_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/iris/iris_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/lima/lima_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/gallium/drivers/llvmpipe/lp_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/gallium/drivers/nouveau/nv30/nv30_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/gallium/drivers/nouveau/nv50/nv50_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/panfrost/pan_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/r300/r300_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 5 additions & 1 deletion src/gallium/drivers/r600/r600_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 2 additions & 3 deletions src/gallium/drivers/r600/r600_test_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/radeonsi/si_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 2 additions & 3 deletions src/gallium/drivers/radeonsi/si_test_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/gallium/drivers/softpipe/sp_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 2 additions & 5 deletions src/gallium/drivers/softpipe/sp_tile_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
16 changes: 8 additions & 8 deletions src/gallium/drivers/svga/svga_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/gallium/drivers/swr/swr_screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion src/gallium/drivers/v3d/v3d_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/drivers/vc4/vc4_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions src/gallium/drivers/virgl/virgl_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/gallium/include/pipe/p_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/gallium/state_trackers/clover/core/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/gallium/state_trackers/nine/adapter9.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions src/gallium/state_trackers/osmesa/osmesa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions src/gallium/state_trackers/vdpau/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 0c31fe9

Please sign in to comment.