mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 04:46:27 -05:00
maxwell_3d: Partially implement texture buffers as 1D textures
This commit is contained in:
parent
6c81c8f5b7
commit
b8c75a845b
4 changed files with 24 additions and 10 deletions
|
@ -430,14 +430,10 @@ Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {
|
||||||
Texture::TICEntry tic_entry;
|
Texture::TICEntry tic_entry;
|
||||||
memory_manager.ReadBlockUnsafe(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry));
|
memory_manager.ReadBlockUnsafe(tic_address_gpu, &tic_entry, sizeof(Texture::TICEntry));
|
||||||
|
|
||||||
ASSERT_MSG(tic_entry.header_version == Texture::TICHeaderVersion::BlockLinear ||
|
const auto r_type{tic_entry.r_type.Value()};
|
||||||
tic_entry.header_version == Texture::TICHeaderVersion::Pitch,
|
const auto g_type{tic_entry.g_type.Value()};
|
||||||
"TIC versions other than BlockLinear or Pitch are unimplemented");
|
const auto b_type{tic_entry.b_type.Value()};
|
||||||
|
const auto a_type{tic_entry.a_type.Value()};
|
||||||
const auto r_type = tic_entry.r_type.Value();
|
|
||||||
const auto g_type = tic_entry.g_type.Value();
|
|
||||||
const auto b_type = tic_entry.b_type.Value();
|
|
||||||
const auto a_type = tic_entry.a_type.Value();
|
|
||||||
|
|
||||||
// TODO(Subv): Different data types for separate components are not supported
|
// TODO(Subv): Different data types for separate components are not supported
|
||||||
DEBUG_ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
|
DEBUG_ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
|
||||||
|
|
|
@ -140,7 +140,7 @@ std::size_t SurfaceParams::InnerMemorySize(bool force_gl, bool layer_only,
|
||||||
|
|
||||||
params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
|
params.width = Common::AlignUp(config.tic.Width(), GetCompressionFactor(params.pixel_format));
|
||||||
params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
|
params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
|
||||||
if (!params.is_tiled) {
|
if (config.tic.IsLineal()) {
|
||||||
params.pitch = config.tic.Pitch();
|
params.pitch = config.tic.Pitch();
|
||||||
}
|
}
|
||||||
params.unaligned_height = config.tic.Height();
|
params.unaligned_height = config.tic.Height();
|
||||||
|
|
|
@ -12,6 +12,8 @@ SurfaceTarget SurfaceTargetFromTextureType(Tegra::Texture::TextureType texture_t
|
||||||
switch (texture_type) {
|
switch (texture_type) {
|
||||||
case Tegra::Texture::TextureType::Texture1D:
|
case Tegra::Texture::TextureType::Texture1D:
|
||||||
return SurfaceTarget::Texture1D;
|
return SurfaceTarget::Texture1D;
|
||||||
|
case Tegra::Texture::TextureType::Texture1DBuffer:
|
||||||
|
return SurfaceTarget::Texture1D; // Fixme
|
||||||
case Tegra::Texture::TextureType::Texture2D:
|
case Tegra::Texture::TextureType::Texture2D:
|
||||||
case Tegra::Texture::TextureType::Texture2DNoMipmap:
|
case Tegra::Texture::TextureType::Texture2DNoMipmap:
|
||||||
return SurfaceTarget::Texture2D;
|
return SurfaceTarget::Texture2D;
|
||||||
|
|
|
@ -172,12 +172,16 @@ struct TICEntry {
|
||||||
BitField<26, 1, u32> use_header_opt_control;
|
BitField<26, 1, u32> use_header_opt_control;
|
||||||
BitField<27, 1, u32> depth_texture;
|
BitField<27, 1, u32> depth_texture;
|
||||||
BitField<28, 4, u32> max_mip_level;
|
BitField<28, 4, u32> max_mip_level;
|
||||||
|
|
||||||
|
BitField<0, 16, u32> buffer_high_width_minus_one;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
BitField<0, 16, u32> width_minus_1;
|
BitField<0, 16, u32> width_minus_1;
|
||||||
BitField<22, 1, u32> srgb_conversion;
|
BitField<22, 1, u32> srgb_conversion;
|
||||||
BitField<23, 4, TextureType> texture_type;
|
BitField<23, 4, TextureType> texture_type;
|
||||||
BitField<29, 3, u32> border_size;
|
BitField<29, 3, u32> border_size;
|
||||||
|
|
||||||
|
BitField<0, 16, u32> buffer_low_width_minus_one;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
BitField<0, 16, u32> height_minus_1;
|
BitField<0, 16, u32> height_minus_1;
|
||||||
|
@ -206,8 +210,11 @@ struct TICEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 Width() const {
|
u32 Width() const {
|
||||||
|
if (header_version != TICHeaderVersion::OneDBuffer) {
|
||||||
return width_minus_1 + 1;
|
return width_minus_1 + 1;
|
||||||
}
|
}
|
||||||
|
return (buffer_high_width_minus_one << 16) | buffer_low_width_minus_one;
|
||||||
|
}
|
||||||
|
|
||||||
u32 Height() const {
|
u32 Height() const {
|
||||||
return height_minus_1 + 1;
|
return height_minus_1 + 1;
|
||||||
|
@ -237,6 +244,15 @@ struct TICEntry {
|
||||||
header_version == TICHeaderVersion::BlockLinearColorKey;
|
header_version == TICHeaderVersion::BlockLinearColorKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsLineal() const {
|
||||||
|
return header_version == TICHeaderVersion::Pitch ||
|
||||||
|
header_version == TICHeaderVersion::PitchColorKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsBuffer() const {
|
||||||
|
return header_version == TICHeaderVersion::OneDBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsSrgbConversionEnabled() const {
|
bool IsSrgbConversionEnabled() const {
|
||||||
return srgb_conversion != 0;
|
return srgb_conversion != 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue