diff options
| author | 2020-02-01 20:41:40 -0500 | |
|---|---|---|
| committer | 2020-02-01 20:41:40 -0500 | |
| commit | b5bbe7e752d5d36839a86638bfaa4b4c348497cd (patch) | |
| tree | b16b3f8ce5ec6233f9f822ad56418d74f0cd47ae /src/video_core/renderer_vulkan | |
| parent | Merge pull request #3268 from CJBok/deadzone (diff) | |
| parent | Shader_IR: Address feedback. (diff) | |
| download | yuzu-b5bbe7e752d5d36839a86638bfaa4b4c348497cd.tar.gz yuzu-b5bbe7e752d5d36839a86638bfaa4b4c348497cd.tar.xz yuzu-b5bbe7e752d5d36839a86638bfaa4b4c348497cd.zip | |
Merge pull request #3282 from FernandoS27/indexed-samplers
Partially implement Indexed samplers in general and specific code in GLSL
Diffstat (limited to 'src/video_core/renderer_vulkan')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp index 1ab22251e..24a658dce 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -353,6 +353,7 @@ private: | |||
| 353 | DeclareFragment(); | 353 | DeclareFragment(); |
| 354 | DeclareCompute(); | 354 | DeclareCompute(); |
| 355 | DeclareRegisters(); | 355 | DeclareRegisters(); |
| 356 | DeclareCustomVariables(); | ||
| 356 | DeclarePredicates(); | 357 | DeclarePredicates(); |
| 357 | DeclareLocalMemory(); | 358 | DeclareLocalMemory(); |
| 358 | DeclareSharedMemory(); | 359 | DeclareSharedMemory(); |
| @@ -586,6 +587,15 @@ private: | |||
| 586 | } | 587 | } |
| 587 | } | 588 | } |
| 588 | 589 | ||
| 590 | void DeclareCustomVariables() { | ||
| 591 | const u32 num_custom_variables = ir.GetNumCustomVariables(); | ||
| 592 | for (u32 i = 0; i < num_custom_variables; ++i) { | ||
| 593 | const Id id = OpVariable(t_prv_float, spv::StorageClass::Private, v_float_zero); | ||
| 594 | Name(id, fmt::format("custom_var_{}", i)); | ||
| 595 | custom_variables.emplace(i, AddGlobalVariable(id)); | ||
| 596 | } | ||
| 597 | } | ||
| 598 | |||
| 589 | void DeclarePredicates() { | 599 | void DeclarePredicates() { |
| 590 | for (const auto pred : ir.GetPredicates()) { | 600 | for (const auto pred : ir.GetPredicates()) { |
| 591 | const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false); | 601 | const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false); |
| @@ -982,6 +992,11 @@ private: | |||
| 982 | return {OpLoad(t_float, registers.at(index)), Type::Float}; | 992 | return {OpLoad(t_float, registers.at(index)), Type::Float}; |
| 983 | } | 993 | } |
| 984 | 994 | ||
| 995 | if (const auto cv = std::get_if<CustomVarNode>(&*node)) { | ||
| 996 | const u32 index = cv->GetIndex(); | ||
| 997 | return {OpLoad(t_float, custom_variables.at(index)), Type::Float}; | ||
| 998 | } | ||
| 999 | |||
| 985 | if (const auto immediate = std::get_if<ImmediateNode>(&*node)) { | 1000 | if (const auto immediate = std::get_if<ImmediateNode>(&*node)) { |
| 986 | return {Constant(t_uint, immediate->GetValue()), Type::Uint}; | 1001 | return {Constant(t_uint, immediate->GetValue()), Type::Uint}; |
| 987 | } | 1002 | } |
| @@ -1333,6 +1348,9 @@ private: | |||
| 1333 | } else if (const auto gmem = std::get_if<GmemNode>(&*dest)) { | 1348 | } else if (const auto gmem = std::get_if<GmemNode>(&*dest)) { |
| 1334 | target = {GetGlobalMemoryPointer(*gmem), Type::Uint}; | 1349 | target = {GetGlobalMemoryPointer(*gmem), Type::Uint}; |
| 1335 | 1350 | ||
| 1351 | } else if (const auto cv = std::get_if<CustomVarNode>(&*dest)) { | ||
| 1352 | target = {custom_variables.at(cv->GetIndex()), Type::Float}; | ||
| 1353 | |||
| 1336 | } else { | 1354 | } else { |
| 1337 | UNIMPLEMENTED(); | 1355 | UNIMPLEMENTED(); |
| 1338 | } | 1356 | } |
| @@ -2508,6 +2526,7 @@ private: | |||
| 2508 | Id out_vertex{}; | 2526 | Id out_vertex{}; |
| 2509 | Id in_vertex{}; | 2527 | Id in_vertex{}; |
| 2510 | std::map<u32, Id> registers; | 2528 | std::map<u32, Id> registers; |
| 2529 | std::map<u32, Id> custom_variables; | ||
| 2511 | std::map<Tegra::Shader::Pred, Id> predicates; | 2530 | std::map<Tegra::Shader::Pred, Id> predicates; |
| 2512 | std::map<u32, Id> flow_variables; | 2531 | std::map<u32, Id> flow_variables; |
| 2513 | Id local_memory{}; | 2532 | Id local_memory{}; |