summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-01-08 16:46:36 +0100
committerFernandoS27 <fsahmkow27@gmail.com>2020-01-24 21:43:30 +0100
commit64496f24569ecc23ebbb816725f27142867b1468 (patch)
treee7dd660d9bdf3afc7a90a35314c18b29792e119a /src/video_core/shader
parentShader_IR: Allow constant access of guest driver. (diff)
downloadyuzu-64496f24569ecc23ebbb816725f27142867b1468.tar
yuzu-64496f24569ecc23ebbb816725f27142867b1468.tar.gz
yuzu-64496f24569ecc23ebbb816725f27142867b1468.tar.bz2
yuzu-64496f24569ecc23ebbb816725f27142867b1468.tar.lz
yuzu-64496f24569ecc23ebbb816725f27142867b1468.tar.xz
yuzu-64496f24569ecc23ebbb816725f27142867b1468.tar.zst
yuzu-64496f24569ecc23ebbb816725f27142867b1468.zip
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/const_buffer_locker.h2
-rw-r--r--src/video_core/shader/decode.cpp48
2 files changed, 25 insertions, 25 deletions
diff --git a/src/video_core/shader/const_buffer_locker.h b/src/video_core/shader/const_buffer_locker.h
index f5655ac64..fd1bb476a 100644
--- a/src/video_core/shader/const_buffer_locker.h
+++ b/src/video_core/shader/const_buffer_locker.h
@@ -83,7 +83,7 @@ public:
VideoCore::GuestDriverProfile* AccessGuestDriverProfile() const {
if (engine) {
- return &(engine->AccessGuestDriverProfile());
+ return &engine->AccessGuestDriverProfile();
}
return nullptr;
}
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp
index c702c7629..507614d59 100644
--- a/src/video_core/shader/decode.cpp
+++ b/src/video_core/shader/decode.cpp
@@ -33,6 +33,29 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) {
return (absolute_offset % SchedPeriod) == 0;
}
+void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver,
+ std::list<Sampler>& used_samplers) {
+ if (gpu_driver == nullptr) {
+ LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet");
+ return;
+ }
+ if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) {
+ return;
+ }
+ u32 count{};
+ std::vector<u32> bound_offsets;
+ for (const auto& sampler : used_samplers) {
+ if (sampler.IsBindless()) {
+ continue;
+ }
+ ++count;
+ bound_offsets.emplace_back(sampler.GetOffset());
+ }
+ if (count > 1) {
+ gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets));
+ }
+}
+
} // Anonymous namespace
class ASTDecoder {
@@ -315,32 +338,9 @@ u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) {
return pc + 1;
}
-void DeduceTextureHandlerSize(VideoCore::GuestDriverProfile* gpu_driver,
- std::list<Sampler>& used_samplers) {
- if (gpu_driver == nullptr) {
- LOG_CRITICAL(HW_GPU, "GPU Driver profile has not been created yet");
- return;
- }
- if (gpu_driver->TextureHandlerSizeKnown() || used_samplers.size() <= 1) {
- return;
- }
- u32 count{};
- std::vector<u32> bound_offsets;
- for (const auto& sampler : used_samplers) {
- if (sampler.IsBindless()) {
- continue;
- }
- count++;
- bound_offsets.emplace_back(sampler.GetOffset());
- }
- if (count > 1) {
- gpu_driver->DeduceTextureHandlerSize(std::move(bound_offsets));
- }
-}
-
void ShaderIR::PostDecode() {
// Deduce texture handler size if needed
- auto* gpu_driver = locker.AccessGuestDriverProfile();
+ auto gpu_driver = locker.AccessGuestDriverProfile();
DeduceTextureHandlerSize(gpu_driver, used_samplers);
}