const_buffer_engine_interface: Store component types
This is required for Vulkan. Sampling integer textures with float handles is illegal.
This commit is contained in:
parent
120f688272
commit
978172530e
4 changed files with 27 additions and 46 deletions
|
@ -16,11 +16,12 @@ namespace Tegra::Engines {
|
||||||
|
|
||||||
struct SamplerDescriptor {
|
struct SamplerDescriptor {
|
||||||
union {
|
union {
|
||||||
BitField<0, 20, Tegra::Shader::TextureType> texture_type;
|
u32 raw = 0;
|
||||||
BitField<20, 1, u32> is_array;
|
BitField<0, 2, Tegra::Shader::TextureType> texture_type;
|
||||||
BitField<21, 1, u32> is_buffer;
|
BitField<2, 3, Tegra::Texture::ComponentType> component_type;
|
||||||
BitField<22, 1, u32> is_shadow;
|
BitField<5, 1, u32> is_array;
|
||||||
u32 raw{};
|
BitField<6, 1, u32> is_buffer;
|
||||||
|
BitField<7, 1, u32> is_shadow;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(const SamplerDescriptor& rhs) const noexcept {
|
bool operator==(const SamplerDescriptor& rhs) const noexcept {
|
||||||
|
@ -31,68 +32,48 @@ struct SamplerDescriptor {
|
||||||
return !operator==(rhs);
|
return !operator==(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SamplerDescriptor FromTicTexture(Tegra::Texture::TextureType tic_texture_type) {
|
static SamplerDescriptor FromTIC(const Tegra::Texture::TICEntry& tic) {
|
||||||
|
using Tegra::Shader::TextureType;
|
||||||
SamplerDescriptor result;
|
SamplerDescriptor result;
|
||||||
switch (tic_texture_type) {
|
|
||||||
|
// This is going to be used to determine the shading language type.
|
||||||
|
// Because of that we don't care about all component types on color textures.
|
||||||
|
result.component_type.Assign(tic.r_type.Value());
|
||||||
|
|
||||||
|
switch (tic.texture_type.Value()) {
|
||||||
case Tegra::Texture::TextureType::Texture1D:
|
case Tegra::Texture::TextureType::Texture1D:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D);
|
result.texture_type.Assign(TextureType::Texture1D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture2D:
|
case Tegra::Texture::TextureType::Texture2D:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
|
result.texture_type.Assign(TextureType::Texture2D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture3D:
|
case Tegra::Texture::TextureType::Texture3D:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture3D);
|
result.texture_type.Assign(TextureType::Texture3D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::TextureCubemap:
|
case Tegra::Texture::TextureType::TextureCubemap:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::TextureCube);
|
result.texture_type.Assign(TextureType::TextureCube);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture1DArray:
|
case Tegra::Texture::TextureType::Texture1DArray:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D);
|
result.texture_type.Assign(TextureType::Texture1D);
|
||||||
result.is_array.Assign(1);
|
result.is_array.Assign(1);
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture2DArray:
|
case Tegra::Texture::TextureType::Texture2DArray:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
|
result.texture_type.Assign(TextureType::Texture2D);
|
||||||
result.is_array.Assign(1);
|
result.is_array.Assign(1);
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture1DBuffer:
|
case Tegra::Texture::TextureType::Texture1DBuffer:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D);
|
result.texture_type.Assign(TextureType::Texture1D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(1);
|
result.is_buffer.Assign(1);
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::Texture2DNoMipmap:
|
case Tegra::Texture::TextureType::Texture2DNoMipmap:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
|
result.texture_type.Assign(TextureType::Texture2D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
case Tegra::Texture::TextureType::TextureCubeArray:
|
case Tegra::Texture::TextureType::TextureCubeArray:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::TextureCube);
|
result.texture_type.Assign(TextureType::TextureCube);
|
||||||
result.is_array.Assign(1);
|
result.is_array.Assign(1);
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
default:
|
default:
|
||||||
result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
|
result.texture_type.Assign(TextureType::Texture2D);
|
||||||
result.is_array.Assign(0);
|
|
||||||
result.is_buffer.Assign(0);
|
|
||||||
result.is_shadow.Assign(0);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ SamplerDescriptor KeplerCompute::AccessBindlessSampler(ShaderType stage, u64 con
|
||||||
|
|
||||||
const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
|
const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
|
||||||
const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
|
const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
|
||||||
SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value());
|
SamplerDescriptor result = SamplerDescriptor::FromTIC(tex_info.tic);
|
||||||
result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
|
result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -638,7 +638,7 @@ SamplerDescriptor Maxwell3D::AccessBindlessSampler(ShaderType stage, u64 const_b
|
||||||
|
|
||||||
const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
|
const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)};
|
||||||
const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
|
const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle);
|
||||||
SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value());
|
SamplerDescriptor result = SamplerDescriptor::FromTIC(tex_info.tic);
|
||||||
result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
|
result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ struct BindlessSamplerKey {
|
||||||
Tegra::Engines::SamplerDescriptor sampler;
|
Tegra::Engines::SamplerDescriptor sampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr u32 NativeVersion = 18;
|
constexpr u32 NativeVersion = 19;
|
||||||
|
|
||||||
ShaderCacheVersionHash GetShaderCacheVersionHash() {
|
ShaderCacheVersionHash GetShaderCacheVersionHash() {
|
||||||
ShaderCacheVersionHash hash{};
|
ShaderCacheVersionHash hash{};
|
||||||
|
|
Loading…
Reference in a new issue