summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/video_core/engines/const_buffer_engine_interface.h67
-rw-r--r--src/video_core/engines/kepler_compute.cpp2
-rw-r--r--src/video_core/engines/maxwell_3d.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_disk_cache.cpp2
4 files changed, 27 insertions, 46 deletions
diff --git a/src/video_core/engines/const_buffer_engine_interface.h b/src/video_core/engines/const_buffer_engine_interface.h
index d56a47710..724ee0fd6 100644
--- a/src/video_core/engines/const_buffer_engine_interface.h
+++ b/src/video_core/engines/const_buffer_engine_interface.h
@@ -16,11 +16,12 @@ namespace Tegra::Engines {
struct SamplerDescriptor {
union {
- BitField<0, 20, Tegra::Shader::TextureType> texture_type;
- BitField<20, 1, u32> is_array;
- BitField<21, 1, u32> is_buffer;
- BitField<22, 1, u32> is_shadow;
- u32 raw{};
+ u32 raw = 0;
+ BitField<0, 2, Tegra::Shader::TextureType> texture_type;
+ BitField<2, 3, Tegra::Texture::ComponentType> component_type;
+ BitField<5, 1, u32> is_array;
+ BitField<6, 1, u32> is_buffer;
+ BitField<7, 1, u32> is_shadow;
};
bool operator==(const SamplerDescriptor& rhs) const noexcept {
@@ -31,68 +32,48 @@ struct SamplerDescriptor {
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;
- 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:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::Texture1D);
return result;
case Tegra::Texture::TextureType::Texture2D:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::Texture2D);
return result;
case Tegra::Texture::TextureType::Texture3D:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture3D);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::Texture3D);
return result;
case Tegra::Texture::TextureType::TextureCubemap:
- result.texture_type.Assign(Tegra::Shader::TextureType::TextureCube);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::TextureCube);
return result;
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_buffer.Assign(0);
- result.is_shadow.Assign(0);
return result;
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_buffer.Assign(0);
- result.is_shadow.Assign(0);
return result;
case Tegra::Texture::TextureType::Texture1DBuffer:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D);
- result.is_array.Assign(0);
+ result.texture_type.Assign(TextureType::Texture1D);
result.is_buffer.Assign(1);
- result.is_shadow.Assign(0);
return result;
case Tegra::Texture::TextureType::Texture2DNoMipmap:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::Texture2D);
return result;
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_buffer.Assign(0);
- result.is_shadow.Assign(0);
return result;
default:
- result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D);
- result.is_array.Assign(0);
- result.is_buffer.Assign(0);
- result.is_shadow.Assign(0);
+ result.texture_type.Assign(TextureType::Texture2D);
return result;
}
}
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp
index ae52afa79..1ecd65925 100644
--- a/src/video_core/engines/kepler_compute.cpp
+++ b/src/video_core/engines/kepler_compute.cpp
@@ -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::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());
return result;
}
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 89050361e..ce536e29b 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -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::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());
return result;
}
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
index df86c0cc3..3b0db5393 100644
--- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp
@@ -48,7 +48,7 @@ struct BindlessSamplerKey {
Tegra::Engines::SamplerDescriptor sampler;
};
-constexpr u32 NativeVersion = 18;
+constexpr u32 NativeVersion = 19;
ShaderCacheVersionHash GetShaderCacheVersionHash() {
ShaderCacheVersionHash hash{};