GPU: Fixed texel pitch calculation for linear textures.
This commit is contained in:
parent
febe46973f
commit
6d9a56a269
|
@ -124,14 +124,18 @@ void TextureInfo::CalculateTextureSizes1D(uint32_t width) {
|
|||
size_1d.block_width = tile_width * 32;
|
||||
|
||||
uint32_t bytes_per_block = format->block_width * format->bits_per_pixel / 8;
|
||||
|
||||
uint32_t byte_pitch = tile_width * 32 * bytes_per_block;
|
||||
|
||||
uint32_t texel_width;
|
||||
if (!is_tiled) {
|
||||
// Each row must be a multiple of 256 in linear textures.
|
||||
byte_pitch = xe::round_up(byte_pitch, 256);
|
||||
texel_width = (byte_pitch / bytes_per_block) * format->block_width;
|
||||
} else {
|
||||
texel_width = tile_width * 32 * format->block_width;
|
||||
}
|
||||
|
||||
size_1d.input_width = tile_width * 32 * format->block_width;
|
||||
size_1d.input_width = texel_width;
|
||||
size_1d.input_pitch = byte_pitch;
|
||||
input_length = size_1d.input_pitch;
|
||||
}
|
||||
|
@ -164,12 +168,16 @@ void TextureInfo::CalculateTextureSizes2D(uint32_t width, uint32_t height) {
|
|||
format->block_width * format->block_height * format->bits_per_pixel / 8;
|
||||
uint32_t byte_pitch = size_2d.block_width * bytes_per_block;
|
||||
|
||||
uint32_t texel_width;
|
||||
if (!is_tiled) {
|
||||
// Each row must be a multiple of 256 in linear textures.
|
||||
byte_pitch = xe::round_up(byte_pitch, 256);
|
||||
texel_width = (byte_pitch / bytes_per_block) * format->block_width;
|
||||
} else {
|
||||
texel_width = size_2d.block_width * format->block_width;
|
||||
}
|
||||
|
||||
size_2d.input_width = size_2d.block_width * format->block_width;
|
||||
size_2d.input_width = texel_width;
|
||||
size_2d.input_height = size_2d.block_height * format->block_height;
|
||||
size_2d.input_pitch = byte_pitch;
|
||||
|
||||
|
@ -201,12 +209,17 @@ void TextureInfo::CalculateTextureSizesCube(uint32_t width, uint32_t height,
|
|||
uint32_t bytes_per_block =
|
||||
format->block_width * format->block_height * format->bits_per_pixel / 8;
|
||||
uint32_t byte_pitch = size_cube.block_width * bytes_per_block;
|
||||
|
||||
uint32_t texel_width;
|
||||
if (!is_tiled) {
|
||||
// Each row must be a multiple of 256 in linear textures.
|
||||
byte_pitch = xe::round_up(byte_pitch, 256);
|
||||
texel_width = (byte_pitch / bytes_per_block) * format->block_width;
|
||||
} else {
|
||||
texel_width = size_cube.block_width * format->block_width;
|
||||
}
|
||||
|
||||
size_cube.input_width = size_cube.block_width * format->block_width;
|
||||
size_cube.input_width = texel_width;
|
||||
size_cube.input_height = size_cube.block_height * format->block_height;
|
||||
size_cube.input_pitch = byte_pitch;
|
||||
|
||||
|
|
|
@ -269,17 +269,17 @@ struct TextureInfo {
|
|||
struct {
|
||||
uint32_t logical_width;
|
||||
uint32_t block_width; // # of horizontal blocks
|
||||
uint32_t input_width; // pixel pitch
|
||||
uint32_t input_pitch; // pitch in bytes
|
||||
uint32_t input_width; // texel pitch
|
||||
uint32_t input_pitch; // byte pitch
|
||||
} size_1d;
|
||||
struct {
|
||||
uint32_t logical_width;
|
||||
uint32_t logical_height;
|
||||
uint32_t block_width; // # of horizontal blocks
|
||||
uint32_t block_height; // # of vertical blocks
|
||||
uint32_t input_width; // pixel pitch
|
||||
uint32_t input_height; // pixel height
|
||||
uint32_t input_pitch; // pitch in bytes
|
||||
uint32_t input_width; // texel pitch
|
||||
uint32_t input_height; // texel height
|
||||
uint32_t input_pitch; // byte pitch
|
||||
} size_2d;
|
||||
struct {
|
||||
} size_3d;
|
||||
|
@ -288,10 +288,10 @@ struct TextureInfo {
|
|||
uint32_t logical_height;
|
||||
uint32_t block_width; // # of horizontal blocks
|
||||
uint32_t block_height; // # of vertical blocks
|
||||
uint32_t input_width; // pixel pitch
|
||||
uint32_t input_height; // pixel height
|
||||
uint32_t input_pitch; // pitch in bytes
|
||||
uint32_t input_face_length; // pitch of face in bytes
|
||||
uint32_t input_width; // texel pitch
|
||||
uint32_t input_height; // texel height
|
||||
uint32_t input_pitch; // byte pitch
|
||||
uint32_t input_face_length; // byte pitch of face
|
||||
} size_cube;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue