1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-14 09:23:53 +01:00
dxvk/src/dxso/dxso_util.cpp
Joshua Ashton c0c1565cba [d3d9, dxso] Alias color and depth samplers and improve tracking
Takes me from 340 -> 460fps in A Hat in Time's main menu when CPU bound.
2021-08-10 23:46:03 +00:00

34 lines
843 B
C++

#include "dxso_util.h"
#include "dxso_include.h"
namespace dxvk {
dxvk::mutex g_linkerSlotMutex;
uint32_t g_linkerSlotCount = 0;
std::array<DxsoSemantic, 32> g_linkerSlots;
uint32_t RegisterLinkerSlot(DxsoSemantic semantic) {
// Lock, because games could be trying
// to make multiple shaders at a time.
std::lock_guard<dxvk::mutex> lock(g_linkerSlotMutex);
// Need to chose a slot that maps nicely and similarly
// between vertex and pixel shaders
// Find or map a slot.
uint32_t slot = g_linkerSlotCount;
for (uint32_t j = 0; j < g_linkerSlotCount; j++) {
if (g_linkerSlots[j] == semantic) {
slot = j;
break;
}
}
if (slot == g_linkerSlotCount)
g_linkerSlots[g_linkerSlotCount++] = semantic;
return slot;
}
}