diff options
| author | 2020-02-29 05:02:27 -0300 | |
|---|---|---|
| committer | 2020-03-09 18:40:53 -0300 | |
| commit | 978172530ebdf487529bf5a9a7caf3e9ca9d0810 (patch) | |
| tree | 612d562958862b6eb7879c96ccfeec0e9a21eec1 /src | |
| parent | yuzu/loading_screen: Remove unused shader progress mode (diff) | |
| download | yuzu-978172530ebdf487529bf5a9a7caf3e9ca9d0810.tar.gz yuzu-978172530ebdf487529bf5a9a7caf3e9ca9d0810.tar.xz yuzu-978172530ebdf487529bf5a9a7caf3e9ca9d0810.zip | |
const_buffer_engine_interface: Store component types
This is required for Vulkan. Sampling integer textures with float
handles is illegal.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/engines/const_buffer_engine_interface.h | 67 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | 2 |
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 { | |||
| 16 | 16 | ||
| 17 | struct SamplerDescriptor { | 17 | struct SamplerDescriptor { |
| 18 | union { | 18 | union { |
| 19 | BitField<0, 20, Tegra::Shader::TextureType> texture_type; | 19 | u32 raw = 0; |
| 20 | BitField<20, 1, u32> is_array; | 20 | BitField<0, 2, Tegra::Shader::TextureType> texture_type; |
| 21 | BitField<21, 1, u32> is_buffer; | 21 | BitField<2, 3, Tegra::Texture::ComponentType> component_type; |
| 22 | BitField<22, 1, u32> is_shadow; | 22 | BitField<5, 1, u32> is_array; |
| 23 | u32 raw{}; | 23 | BitField<6, 1, u32> is_buffer; |
| 24 | BitField<7, 1, u32> is_shadow; | ||
| 24 | }; | 25 | }; |
| 25 | 26 | ||
| 26 | bool operator==(const SamplerDescriptor& rhs) const noexcept { | 27 | bool operator==(const SamplerDescriptor& rhs) const noexcept { |
| @@ -31,68 +32,48 @@ struct SamplerDescriptor { | |||
| 31 | return !operator==(rhs); | 32 | return !operator==(rhs); |
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | static SamplerDescriptor FromTicTexture(Tegra::Texture::TextureType tic_texture_type) { | 35 | static SamplerDescriptor FromTIC(const Tegra::Texture::TICEntry& tic) { |
| 36 | using Tegra::Shader::TextureType; | ||
| 35 | SamplerDescriptor result; | 37 | SamplerDescriptor result; |
| 36 | switch (tic_texture_type) { | 38 | |
| 39 | // This is going to be used to determine the shading language type. | ||
| 40 | // Because of that we don't care about all component types on color textures. | ||
| 41 | result.component_type.Assign(tic.r_type.Value()); | ||
| 42 | |||
| 43 | switch (tic.texture_type.Value()) { | ||
| 37 | case Tegra::Texture::TextureType::Texture1D: | 44 | case Tegra::Texture::TextureType::Texture1D: |
| 38 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D); | 45 | result.texture_type.Assign(TextureType::Texture1D); |
| 39 | result.is_array.Assign(0); | ||
| 40 | result.is_buffer.Assign(0); | ||
| 41 | result.is_shadow.Assign(0); | ||
| 42 | return result; | 46 | return result; |
| 43 | case Tegra::Texture::TextureType::Texture2D: | 47 | case Tegra::Texture::TextureType::Texture2D: |
| 44 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D); | 48 | result.texture_type.Assign(TextureType::Texture2D); |
| 45 | result.is_array.Assign(0); | ||
| 46 | result.is_buffer.Assign(0); | ||
| 47 | result.is_shadow.Assign(0); | ||
| 48 | return result; | 49 | return result; |
| 49 | case Tegra::Texture::TextureType::Texture3D: | 50 | case Tegra::Texture::TextureType::Texture3D: |
| 50 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture3D); | 51 | result.texture_type.Assign(TextureType::Texture3D); |
| 51 | result.is_array.Assign(0); | ||
| 52 | result.is_buffer.Assign(0); | ||
| 53 | result.is_shadow.Assign(0); | ||
| 54 | return result; | 52 | return result; |
| 55 | case Tegra::Texture::TextureType::TextureCubemap: | 53 | case Tegra::Texture::TextureType::TextureCubemap: |
| 56 | result.texture_type.Assign(Tegra::Shader::TextureType::TextureCube); | 54 | result.texture_type.Assign(TextureType::TextureCube); |
| 57 | result.is_array.Assign(0); | ||
| 58 | result.is_buffer.Assign(0); | ||
| 59 | result.is_shadow.Assign(0); | ||
| 60 | return result; | 55 | return result; |
| 61 | case Tegra::Texture::TextureType::Texture1DArray: | 56 | case Tegra::Texture::TextureType::Texture1DArray: |
| 62 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D); | 57 | result.texture_type.Assign(TextureType::Texture1D); |
| 63 | result.is_array.Assign(1); | 58 | result.is_array.Assign(1); |
| 64 | result.is_buffer.Assign(0); | ||
| 65 | result.is_shadow.Assign(0); | ||
| 66 | return result; | 59 | return result; |
| 67 | case Tegra::Texture::TextureType::Texture2DArray: | 60 | case Tegra::Texture::TextureType::Texture2DArray: |
| 68 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D); | 61 | result.texture_type.Assign(TextureType::Texture2D); |
| 69 | result.is_array.Assign(1); | 62 | result.is_array.Assign(1); |
| 70 | result.is_buffer.Assign(0); | ||
| 71 | result.is_shadow.Assign(0); | ||
| 72 | return result; | 63 | return result; |
| 73 | case Tegra::Texture::TextureType::Texture1DBuffer: | 64 | case Tegra::Texture::TextureType::Texture1DBuffer: |
| 74 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture1D); | 65 | result.texture_type.Assign(TextureType::Texture1D); |
| 75 | result.is_array.Assign(0); | ||
| 76 | result.is_buffer.Assign(1); | 66 | result.is_buffer.Assign(1); |
| 77 | result.is_shadow.Assign(0); | ||
| 78 | return result; | 67 | return result; |
| 79 | case Tegra::Texture::TextureType::Texture2DNoMipmap: | 68 | case Tegra::Texture::TextureType::Texture2DNoMipmap: |
| 80 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D); | 69 | result.texture_type.Assign(TextureType::Texture2D); |
| 81 | result.is_array.Assign(0); | ||
| 82 | result.is_buffer.Assign(0); | ||
| 83 | result.is_shadow.Assign(0); | ||
| 84 | return result; | 70 | return result; |
| 85 | case Tegra::Texture::TextureType::TextureCubeArray: | 71 | case Tegra::Texture::TextureType::TextureCubeArray: |
| 86 | result.texture_type.Assign(Tegra::Shader::TextureType::TextureCube); | 72 | result.texture_type.Assign(TextureType::TextureCube); |
| 87 | result.is_array.Assign(1); | 73 | result.is_array.Assign(1); |
| 88 | result.is_buffer.Assign(0); | ||
| 89 | result.is_shadow.Assign(0); | ||
| 90 | return result; | 74 | return result; |
| 91 | default: | 75 | default: |
| 92 | result.texture_type.Assign(Tegra::Shader::TextureType::Texture2D); | 76 | result.texture_type.Assign(TextureType::Texture2D); |
| 93 | result.is_array.Assign(0); | ||
| 94 | result.is_buffer.Assign(0); | ||
| 95 | result.is_shadow.Assign(0); | ||
| 96 | return result; | 77 | return result; |
| 97 | } | 78 | } |
| 98 | } | 79 | } |
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 | |||
| 89 | 89 | ||
| 90 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; | 90 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; |
| 91 | const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle); | 91 | const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle); |
| 92 | SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value()); | 92 | SamplerDescriptor result = SamplerDescriptor::FromTIC(tex_info.tic); |
| 93 | result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); | 93 | result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); |
| 94 | return result; | 94 | return result; |
| 95 | } | 95 | } |
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 | |||
| 638 | 638 | ||
| 639 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; | 639 | const Texture::TextureHandle tex_handle{memory_manager.Read<u32>(tex_info_address)}; |
| 640 | const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle); | 640 | const Texture::FullTextureInfo tex_info = GetTextureInfo(tex_handle); |
| 641 | SamplerDescriptor result = SamplerDescriptor::FromTicTexture(tex_info.tic.texture_type.Value()); | 641 | SamplerDescriptor result = SamplerDescriptor::FromTIC(tex_info.tic); |
| 642 | result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); | 642 | result.is_shadow.Assign(tex_info.tsc.depth_compare_enabled.Value()); |
| 643 | return result; | 643 | return result; |
| 644 | } | 644 | } |
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 { | |||
| 48 | Tegra::Engines::SamplerDescriptor sampler; | 48 | Tegra::Engines::SamplerDescriptor sampler; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | constexpr u32 NativeVersion = 18; | 51 | constexpr u32 NativeVersion = 19; |
| 52 | 52 | ||
| 53 | ShaderCacheVersionHash GetShaderCacheVersionHash() { | 53 | ShaderCacheVersionHash GetShaderCacheVersionHash() { |
| 54 | ShaderCacheVersionHash hash{}; | 54 | ShaderCacheVersionHash hash{}; |