mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 14:53:18 +00:00
video_core: Account of runtime state changes when compiling shaders (#575)
* video_core: Compile shader permutations * spirv: Only specific storage image format for atomics * ir: Avoid cube coord patching for storage image * spirv: Fix default attributes * data_share: Add more instructions * video_core: Query storage flag with runtime state * kernel: Use std::list for semaphore * video_core: Use texture buffers for untyped format load/store * buffer_cache: Limit view usage * vk_pipeline_cache: Fix invalid iterator * image_view: Reduce log spam when alpha=1 in storage swizzle * video_core: More features and proper spirv feature detection * video_core: Attempt no2 for specialization * spirv: Remove conflict * vk_shader_cache: Small cleanup
This commit is contained in:
parent
790d19e59b
commit
66e96dd944
43 changed files with 1058 additions and 976 deletions
|
@ -325,4 +325,4 @@ void RegisterlibSceAvPlayer(Core::Loader::SymbolsResolver* sym) {
|
|||
LIB_FUNCTION("yN7Jhuv8g24", "libSceAvPlayer", 1, "libSceAvPlayer", 1, 0, sceAvPlayerVprintf);
|
||||
};
|
||||
|
||||
} // namespace Libraries::AvPlayer
|
||||
} // namespace Libraries::AvPlayer
|
||||
|
|
|
@ -2,9 +2,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <condition_variable>
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <utility>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <pthread.h>
|
||||
#include "common/assert.h"
|
||||
#include "common/logging/log.h"
|
||||
|
@ -13,9 +12,6 @@
|
|||
|
||||
namespace Libraries::Kernel {
|
||||
|
||||
using ListBaseHook =
|
||||
boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>;
|
||||
|
||||
class Semaphore {
|
||||
public:
|
||||
Semaphore(s32 init_count, s32 max_count, std::string_view name, bool is_fifo)
|
||||
|
@ -37,7 +33,7 @@ public:
|
|||
|
||||
// Create waiting thread object and add it into the list of waiters.
|
||||
WaitingThread waiter{need_count, is_fifo};
|
||||
AddWaiter(waiter);
|
||||
AddWaiter(&waiter);
|
||||
|
||||
// Perform the wait.
|
||||
return waiter.Wait(lk, timeout);
|
||||
|
@ -52,14 +48,14 @@ public:
|
|||
|
||||
// Wake up threads in order of priority.
|
||||
for (auto it = wait_list.begin(); it != wait_list.end();) {
|
||||
auto& waiter = *it;
|
||||
if (waiter.need_count > token_count) {
|
||||
auto* waiter = *it;
|
||||
if (waiter->need_count > token_count) {
|
||||
it++;
|
||||
continue;
|
||||
}
|
||||
it = wait_list.erase(it);
|
||||
token_count -= waiter.need_count;
|
||||
waiter.cv.notify_one();
|
||||
token_count -= waiter->need_count;
|
||||
waiter->cv.notify_one();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -70,9 +66,9 @@ public:
|
|||
if (num_waiters) {
|
||||
*num_waiters = wait_list.size();
|
||||
}
|
||||
for (auto& waiter : wait_list) {
|
||||
waiter.was_cancled = true;
|
||||
waiter.cv.notify_one();
|
||||
for (auto* waiter : wait_list) {
|
||||
waiter->was_cancled = true;
|
||||
waiter->cv.notify_one();
|
||||
}
|
||||
wait_list.clear();
|
||||
token_count = set_count < 0 ? init_count : set_count;
|
||||
|
@ -80,7 +76,7 @@ public:
|
|||
}
|
||||
|
||||
public:
|
||||
struct WaitingThread : public ListBaseHook {
|
||||
struct WaitingThread {
|
||||
std::condition_variable cv;
|
||||
u32 priority;
|
||||
s32 need_count;
|
||||
|
@ -132,7 +128,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void AddWaiter(WaitingThread& waiter) {
|
||||
void AddWaiter(WaitingThread* waiter) {
|
||||
// Insert at the end of the list for FIFO order.
|
||||
if (is_fifo) {
|
||||
wait_list.push_back(waiter);
|
||||
|
@ -140,16 +136,13 @@ public:
|
|||
}
|
||||
// Find the first with priority less then us and insert right before it.
|
||||
auto it = wait_list.begin();
|
||||
while (it != wait_list.end() && it->priority > waiter.priority) {
|
||||
while (it != wait_list.end() && (*it)->priority > waiter->priority) {
|
||||
it++;
|
||||
}
|
||||
wait_list.insert(it, waiter);
|
||||
}
|
||||
|
||||
using WaitingThreads =
|
||||
boost::intrusive::list<WaitingThread, boost::intrusive::base_hook<ListBaseHook>,
|
||||
boost::intrusive::constant_time_size<false>>;
|
||||
WaitingThreads wait_list;
|
||||
std::list<WaitingThread*> wait_list;
|
||||
std::string name;
|
||||
std::atomic<s32> token_count;
|
||||
std::mutex mutex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue