gallium: declare pipe_resource::height0 as 32-bit integer for 64K textures

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38587>
This commit is contained in:
Marek Olšák 2025-12-03 14:19:31 -05:00 committed by Marge Bot
parent 3c6477812e
commit 7621b2d56d
7 changed files with 27 additions and 26 deletions

View file

@ -344,7 +344,7 @@ impl GLCtxManager {
#[derive(Clone)]
pub struct GLMemProps {
pub height: u16,
pub height: u32,
pub depth: u16,
pub width: u32,
pub offset: u32,
@ -379,7 +379,7 @@ impl GLExportManager {
.unwrap()
};
let mut height = self.export_out.height as u16;
let mut height = self.export_out.height;
let mut depth = self.export_out.depth as u16;
let mut width = self.export_out.width;
let mut array_size = 1;
@ -388,7 +388,7 @@ impl GLExportManager {
// some fixups
match self.export_in.target {
GL_TEXTURE_1D_ARRAY => {
array_size = height;
array_size = height as u16;
height = 1;
depth = 1;
}

View file

@ -117,7 +117,7 @@ impl PipeResourceOwned {
self.as_ref().width0
}
pub fn height(&self) -> u16 {
pub fn height(&self) -> u32 {
self.as_ref().height0
}

View file

@ -294,7 +294,7 @@ impl PipeScreen {
pub fn resource_create_texture(
&self,
width: u32,
height: u16,
height: u32,
depth: u16,
array_size: u16,
target: pipe_texture_target,
@ -324,7 +324,7 @@ impl PipeScreen {
pub fn resource_create_texture_from_user(
&self,
width: u32,
height: u16,
height: u32,
depth: u16,
array_size: u16,
target: pipe_texture_target,
@ -357,7 +357,7 @@ impl PipeScreen {
format: pipe_format,
stride: u32,
width: u32,
height: u16,
height: u32,
depth: u16,
array_size: u16,
support_image: bool,

View file

@ -473,6 +473,7 @@ struct pipe_sampler_state
};
struct pipe_tex2d_from_buf {
/* Only 32K x 32K textures are supported. */
unsigned offset; /**< offset in pixels */
uint16_t row_stride; /**< size of the image row_stride in pixels */
uint16_t width; /**< width of image provided by application */
@ -553,7 +554,7 @@ struct pipe_resource
EXCLUSIVE_CACHELINE(struct pipe_reference reference);
uint32_t width0; /**< Used by both buffers and textures. */
uint16_t height0; /* Textures: The maximum height/depth/array_size is 16k. */
uint32_t height0; /* textures >= 64K are possible */
uint16_t depth0;
uint16_t array_size;

View file

@ -1070,8 +1070,8 @@ guess_and_alloc_texture(struct st_context *st,
const struct gl_texture_image *firstImage;
GLuint lastLevel, width, height, depth;
GLuint bindings;
unsigned ptWidth;
uint16_t ptHeight, ptDepth, ptLayers;
unsigned ptWidth, ptHeight;
uint16_t ptDepth, ptLayers;
enum pipe_format fmt;
bool guessed_box = false;
@ -1239,8 +1239,8 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
enum pipe_format format =
st_mesa_format_to_pipe_format(st, texImage->TexFormat);
GLuint bindings = default_bindings(st, format);
unsigned ptWidth;
uint16_t ptHeight, ptDepth, ptLayers;
unsigned ptWidth, ptHeight;
uint16_t ptDepth, ptLayers;
st_gl_texture_dims_to_pipe_dims(stObj->Target,
width, height, depth,
@ -3161,8 +3161,8 @@ st_finalize_texture(struct gl_context *ctx,
GLuint face;
const struct gl_texture_image *firstImage;
enum pipe_format firstImageFormat;
unsigned ptWidth;
uint16_t ptHeight, ptDepth, ptLayers, ptNumSamples;
unsigned ptWidth, ptHeight;
uint16_t ptDepth, ptLayers, ptNumSamples;
if (tObj->Immutable)
return GL_TRUE;
@ -3210,8 +3210,8 @@ st_finalize_texture(struct gl_context *ctx,
/* Find size of level=0 Gallium mipmap image, plus number of texture layers */
{
unsigned width;
uint16_t height, depth;
unsigned width, height;
uint16_t depth;
st_gl_texture_dims_to_pipe_dims(tObj->Target,
firstImage->Width2,
@ -3441,8 +3441,8 @@ st_texture_storage(struct gl_context *ctx,
struct gl_texture_image *texImage = texObj->Image[0][0];
struct st_context *st = st_context(ctx);
struct pipe_screen *screen = st->screen;
unsigned ptWidth, bindings;
uint16_t ptHeight, ptDepth, ptLayers;
unsigned ptWidth, ptHeight, bindings;
uint16_t ptDepth, ptLayers;
enum pipe_format fmt;
GLint level;
GLuint num_samples = texImage->NumSamples;
@ -3697,8 +3697,8 @@ find_mipmap_level(const struct gl_texture_image *texImage,
GLint texWidth = texImage->Width;
GLint texHeight = texImage->Height;
GLint texDepth = texImage->Depth;
unsigned level, w;
uint16_t h, d, layers;
unsigned level, w, h;
uint16_t d, layers;
st_gl_texture_dims_to_pipe_dims(target, texWidth, texHeight, texDepth,
&w, &h, &d, &layers);

View file

@ -120,10 +120,10 @@ st_texture_create(struct st_context *st,
void
st_gl_texture_dims_to_pipe_dims(GLenum texture,
unsigned widthIn,
uint16_t heightIn,
unsigned heightIn,
uint16_t depthIn,
unsigned *widthOut,
uint16_t *heightOut,
unsigned *heightOut,
uint16_t *depthOut,
uint16_t *layersOut)
{
@ -209,8 +209,8 @@ st_texture_match_image(struct st_context *st,
const struct pipe_resource *pt,
const struct gl_texture_image *image)
{
unsigned ptWidth;
uint16_t ptHeight, ptDepth, ptLayers;
unsigned ptWidth, ptHeight;
uint16_t ptDepth, ptLayers;
/* Images with borders are never pulled into mipmap textures.
*/

View file

@ -148,10 +148,10 @@ st_texture_create(struct st_context *st,
extern void
st_gl_texture_dims_to_pipe_dims(GLenum texture,
unsigned widthIn,
uint16_t heightIn,
unsigned heightIn,
uint16_t depthIn,
unsigned *widthOut,
uint16_t *heightOut,
unsigned *heightOut,
uint16_t *depthOut,
uint16_t *layersOut);