diff options
| -rw-r--r-- | src/video_core/shader/registry.cpp | 50 | ||||
| -rw-r--r-- | src/video_core/shader/registry.h | 2 |
2 files changed, 26 insertions, 26 deletions
diff --git a/src/video_core/shader/registry.cpp b/src/video_core/shader/registry.cpp index cdf274e54..148d91fcb 100644 --- a/src/video_core/shader/registry.cpp +++ b/src/video_core/shader/registry.cpp | |||
| @@ -24,44 +24,45 @@ GraphicsInfo MakeGraphicsInfo(ShaderType shader_stage, ConstBufferEngineInterfac | |||
| 24 | if (shader_stage == ShaderType::Compute) { | 24 | if (shader_stage == ShaderType::Compute) { |
| 25 | return {}; | 25 | return {}; |
| 26 | } | 26 | } |
| 27 | auto& graphics = static_cast<Tegra::Engines::Maxwell3D&>(engine); | 27 | |
| 28 | 28 | auto& graphics = dynamic_cast<Tegra::Engines::Maxwell3D&>(engine); | |
| 29 | GraphicsInfo info; | 29 | |
| 30 | info.tfb_layouts = graphics.regs.tfb_layouts; | 30 | return { |
| 31 | info.tfb_varying_locs = graphics.regs.tfb_varying_locs; | 31 | .tfb_layouts = graphics.regs.tfb_layouts, |
| 32 | info.primitive_topology = graphics.regs.draw.topology; | 32 | .tfb_varying_locs = graphics.regs.tfb_varying_locs, |
| 33 | info.tessellation_primitive = graphics.regs.tess_mode.prim; | 33 | .primitive_topology = graphics.regs.draw.topology, |
| 34 | info.tessellation_spacing = graphics.regs.tess_mode.spacing; | 34 | .tessellation_primitive = graphics.regs.tess_mode.prim, |
| 35 | info.tfb_enabled = graphics.regs.tfb_enabled; | 35 | .tessellation_spacing = graphics.regs.tess_mode.spacing, |
| 36 | info.tessellation_clockwise = graphics.regs.tess_mode.cw; | 36 | .tfb_enabled = graphics.regs.tfb_enabled != 0, |
| 37 | return info; | 37 | .tessellation_clockwise = graphics.regs.tess_mode.cw.Value() != 0, |
| 38 | }; | ||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | ComputeInfo MakeComputeInfo(ShaderType shader_stage, ConstBufferEngineInterface& engine) { | 41 | ComputeInfo MakeComputeInfo(ShaderType shader_stage, ConstBufferEngineInterface& engine) { |
| 41 | if (shader_stage != ShaderType::Compute) { | 42 | if (shader_stage != ShaderType::Compute) { |
| 42 | return {}; | 43 | return {}; |
| 43 | } | 44 | } |
| 44 | auto& compute = static_cast<Tegra::Engines::KeplerCompute&>(engine); | 45 | |
| 46 | auto& compute = dynamic_cast<Tegra::Engines::KeplerCompute&>(engine); | ||
| 45 | const auto& launch = compute.launch_description; | 47 | const auto& launch = compute.launch_description; |
| 46 | 48 | ||
| 47 | ComputeInfo info; | 49 | return { |
| 48 | info.workgroup_size = {launch.block_dim_x, launch.block_dim_y, launch.block_dim_z}; | 50 | .workgroup_size = {launch.block_dim_x, launch.block_dim_y, launch.block_dim_z}, |
| 49 | info.local_memory_size_in_words = launch.local_pos_alloc; | 51 | .shared_memory_size_in_words = launch.shared_alloc, |
| 50 | info.shared_memory_size_in_words = launch.shared_alloc; | 52 | .local_memory_size_in_words = launch.local_pos_alloc, |
| 51 | return info; | 53 | }; |
| 52 | } | 54 | } |
| 53 | 55 | ||
| 54 | } // Anonymous namespace | 56 | } // Anonymous namespace |
| 55 | 57 | ||
| 56 | Registry::Registry(Tegra::Engines::ShaderType shader_stage, const SerializedRegistryInfo& info) | 58 | Registry::Registry(ShaderType shader_stage, const SerializedRegistryInfo& info) |
| 57 | : stage{shader_stage}, stored_guest_driver_profile{info.guest_driver_profile}, | 59 | : stage{shader_stage}, stored_guest_driver_profile{info.guest_driver_profile}, |
| 58 | bound_buffer{info.bound_buffer}, graphics_info{info.graphics}, compute_info{info.compute} {} | 60 | bound_buffer{info.bound_buffer}, graphics_info{info.graphics}, compute_info{info.compute} {} |
| 59 | 61 | ||
| 60 | Registry::Registry(Tegra::Engines::ShaderType shader_stage, | 62 | Registry::Registry(ShaderType shader_stage, ConstBufferEngineInterface& engine_) |
| 61 | Tegra::Engines::ConstBufferEngineInterface& engine) | 63 | : stage{shader_stage}, engine{&engine_}, bound_buffer{engine_.GetBoundBuffer()}, |
| 62 | : stage{shader_stage}, engine{&engine}, bound_buffer{engine.GetBoundBuffer()}, | 64 | graphics_info{MakeGraphicsInfo(shader_stage, engine_)}, compute_info{MakeComputeInfo( |
| 63 | graphics_info{MakeGraphicsInfo(shader_stage, engine)}, compute_info{MakeComputeInfo( | 65 | shader_stage, engine_)} {} |
| 64 | shader_stage, engine)} {} | ||
| 65 | 66 | ||
| 66 | Registry::~Registry() = default; | 67 | Registry::~Registry() = default; |
| 67 | 68 | ||
| @@ -113,8 +114,7 @@ std::optional<Tegra::Engines::SamplerDescriptor> Registry::ObtainSeparateSampler | |||
| 113 | return value; | 114 | return value; |
| 114 | } | 115 | } |
| 115 | 116 | ||
| 116 | std::optional<Tegra::Engines::SamplerDescriptor> Registry::ObtainBindlessSampler(u32 buffer, | 117 | std::optional<SamplerDescriptor> Registry::ObtainBindlessSampler(u32 buffer, u32 offset) { |
| 117 | u32 offset) { | ||
| 118 | const std::pair key = {buffer, offset}; | 118 | const std::pair key = {buffer, offset}; |
| 119 | const auto iter = bindless_samplers.find(key); | 119 | const auto iter = bindless_samplers.find(key); |
| 120 | if (iter != bindless_samplers.end()) { | 120 | if (iter != bindless_samplers.end()) { |
diff --git a/src/video_core/shader/registry.h b/src/video_core/shader/registry.h index 231206765..4bebefdde 100644 --- a/src/video_core/shader/registry.h +++ b/src/video_core/shader/registry.h | |||
| @@ -94,7 +94,7 @@ public: | |||
| 94 | explicit Registry(Tegra::Engines::ShaderType shader_stage, const SerializedRegistryInfo& info); | 94 | explicit Registry(Tegra::Engines::ShaderType shader_stage, const SerializedRegistryInfo& info); |
| 95 | 95 | ||
| 96 | explicit Registry(Tegra::Engines::ShaderType shader_stage, | 96 | explicit Registry(Tegra::Engines::ShaderType shader_stage, |
| 97 | Tegra::Engines::ConstBufferEngineInterface& engine); | 97 | Tegra::Engines::ConstBufferEngineInterface& engine_); |
| 98 | 98 | ||
| 99 | ~Registry(); | 99 | ~Registry(); |
| 100 | 100 | ||