diff options
Diffstat (limited to 'src/video_core/engines')
| -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/engines/maxwell_3d.h | 34 |
4 files changed, 58 insertions, 47 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/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index ed7fc8fdd..8752a1cfb 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -67,6 +67,7 @@ public: | |||
| 67 | static constexpr std::size_t NumVaryings = 31; | 67 | static constexpr std::size_t NumVaryings = 31; |
| 68 | static constexpr std::size_t NumImages = 8; // TODO(Rodrigo): Investigate this number | 68 | static constexpr std::size_t NumImages = 8; // TODO(Rodrigo): Investigate this number |
| 69 | static constexpr std::size_t NumClipDistances = 8; | 69 | static constexpr std::size_t NumClipDistances = 8; |
| 70 | static constexpr std::size_t NumTransformFeedbackBuffers = 4; | ||
| 70 | static constexpr std::size_t MaxShaderProgram = 6; | 71 | static constexpr std::size_t MaxShaderProgram = 6; |
| 71 | static constexpr std::size_t MaxShaderStage = 5; | 72 | static constexpr std::size_t MaxShaderStage = 5; |
| 72 | // Maximum number of const buffers per shader stage. | 73 | // Maximum number of const buffers per shader stage. |
| @@ -627,6 +628,22 @@ public: | |||
| 627 | float depth_range_far; | 628 | float depth_range_far; |
| 628 | }; | 629 | }; |
| 629 | 630 | ||
| 631 | struct alignas(32) TransformFeedbackBinding { | ||
| 632 | u32 buffer_enable; | ||
| 633 | u32 address_high; | ||
| 634 | u32 address_low; | ||
| 635 | s32 buffer_size; | ||
| 636 | s32 buffer_offset; | ||
| 637 | }; | ||
| 638 | static_assert(sizeof(TransformFeedbackBinding) == 32); | ||
| 639 | |||
| 640 | struct alignas(16) TransformFeedbackLayout { | ||
| 641 | u32 stream; | ||
| 642 | u32 varying_count; | ||
| 643 | u32 stride; | ||
| 644 | }; | ||
| 645 | static_assert(sizeof(TransformFeedbackLayout) == 16); | ||
| 646 | |||
| 630 | bool IsShaderConfigEnabled(std::size_t index) const { | 647 | bool IsShaderConfigEnabled(std::size_t index) const { |
| 631 | // The VertexB is always enabled. | 648 | // The VertexB is always enabled. |
| 632 | if (index == static_cast<std::size_t>(Regs::ShaderProgram::VertexB)) { | 649 | if (index == static_cast<std::size_t>(Regs::ShaderProgram::VertexB)) { |
| @@ -683,7 +700,13 @@ public: | |||
| 683 | 700 | ||
| 684 | u32 rasterize_enable; | 701 | u32 rasterize_enable; |
| 685 | 702 | ||
| 686 | INSERT_UNION_PADDING_WORDS(0xF1); | 703 | std::array<TransformFeedbackBinding, NumTransformFeedbackBuffers> tfb_bindings; |
| 704 | |||
| 705 | INSERT_UNION_PADDING_WORDS(0xC0); | ||
| 706 | |||
| 707 | std::array<TransformFeedbackLayout, NumTransformFeedbackBuffers> tfb_layouts; | ||
| 708 | |||
| 709 | INSERT_UNION_PADDING_WORDS(0x1); | ||
| 687 | 710 | ||
| 688 | u32 tfb_enabled; | 711 | u32 tfb_enabled; |
| 689 | 712 | ||
| @@ -1202,7 +1225,11 @@ public: | |||
| 1202 | 1225 | ||
| 1203 | u32 tex_cb_index; | 1226 | u32 tex_cb_index; |
| 1204 | 1227 | ||
| 1205 | INSERT_UNION_PADDING_WORDS(0x395); | 1228 | INSERT_UNION_PADDING_WORDS(0x7D); |
| 1229 | |||
| 1230 | std::array<std::array<u8, 128>, NumTransformFeedbackBuffers> tfb_varying_locs; | ||
| 1231 | |||
| 1232 | INSERT_UNION_PADDING_WORDS(0x298); | ||
| 1206 | 1233 | ||
| 1207 | struct { | 1234 | struct { |
| 1208 | /// Compressed address of a buffer that holds information about bound SSBOs. | 1235 | /// Compressed address of a buffer that holds information about bound SSBOs. |
| @@ -1428,6 +1455,8 @@ ASSERT_REG_POSITION(tess_mode, 0xC8); | |||
| 1428 | ASSERT_REG_POSITION(tess_level_outer, 0xC9); | 1455 | ASSERT_REG_POSITION(tess_level_outer, 0xC9); |
| 1429 | ASSERT_REG_POSITION(tess_level_inner, 0xCD); | 1456 | ASSERT_REG_POSITION(tess_level_inner, 0xCD); |
| 1430 | ASSERT_REG_POSITION(rasterize_enable, 0xDF); | 1457 | ASSERT_REG_POSITION(rasterize_enable, 0xDF); |
| 1458 | ASSERT_REG_POSITION(tfb_bindings, 0xE0); | ||
| 1459 | ASSERT_REG_POSITION(tfb_layouts, 0x1C0); | ||
| 1431 | ASSERT_REG_POSITION(tfb_enabled, 0x1D1); | 1460 | ASSERT_REG_POSITION(tfb_enabled, 0x1D1); |
| 1432 | ASSERT_REG_POSITION(rt, 0x200); | 1461 | ASSERT_REG_POSITION(rt, 0x200); |
| 1433 | ASSERT_REG_POSITION(viewport_transform, 0x280); | 1462 | ASSERT_REG_POSITION(viewport_transform, 0x280); |
| @@ -1526,6 +1555,7 @@ ASSERT_REG_POSITION(firmware, 0x8C0); | |||
| 1526 | ASSERT_REG_POSITION(const_buffer, 0x8E0); | 1555 | ASSERT_REG_POSITION(const_buffer, 0x8E0); |
| 1527 | ASSERT_REG_POSITION(cb_bind[0], 0x904); | 1556 | ASSERT_REG_POSITION(cb_bind[0], 0x904); |
| 1528 | ASSERT_REG_POSITION(tex_cb_index, 0x982); | 1557 | ASSERT_REG_POSITION(tex_cb_index, 0x982); |
| 1558 | ASSERT_REG_POSITION(tfb_varying_locs, 0xA00); | ||
| 1529 | ASSERT_REG_POSITION(ssbo_info, 0xD18); | 1559 | ASSERT_REG_POSITION(ssbo_info, 0xD18); |
| 1530 | ASSERT_REG_POSITION(tex_info_buffers.address[0], 0xD2A); | 1560 | ASSERT_REG_POSITION(tex_info_buffers.address[0], 0xD2A); |
| 1531 | ASSERT_REG_POSITION(tex_info_buffers.size[0], 0xD2F); | 1561 | ASSERT_REG_POSITION(tex_info_buffers.size[0], 0xD2F); |