2019-12-16 03:28:01 +00:00
|
|
|
#include "dxso_util.h"
|
|
|
|
|
|
|
|
#include "dxso_include.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2021-06-28 19:19:29 +02:00
|
|
|
dxvk::mutex g_linkerSlotMutex;
|
2019-12-16 03:28:01 +00:00
|
|
|
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.
|
2021-06-28 19:19:29 +02:00
|
|
|
std::lock_guard<dxvk::mutex> lock(g_linkerSlotMutex);
|
2019-12-16 03:28:01 +00:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|