mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Pack vertex binding divisor into reserved 14-bit field
Technically an illegal optimization since it limits the maximum divisor to 16383, but there are no known applications relying on very large divisors. Reduces state vector size by 128 bytes, or roughly 20%. This also bumps the state cache version to v10.
This commit is contained in:
parent
95740eb78c
commit
a520c5160e
@ -165,8 +165,7 @@ namespace dxvk {
|
||||
: m_binding (uint32_t(binding)),
|
||||
m_stride (uint32_t(stride)),
|
||||
m_inputRate (uint32_t(inputRate)),
|
||||
m_reserved (0),
|
||||
m_divisor (divisor) { }
|
||||
m_divisor (uint32_t(divisor < (1u << 14) ? divisor : 0u)) { }
|
||||
|
||||
uint32_t binding() const {
|
||||
return m_binding;
|
||||
@ -201,8 +200,7 @@ namespace dxvk {
|
||||
uint32_t m_binding : 5;
|
||||
uint32_t m_stride : 12;
|
||||
uint32_t m_inputRate : 1;
|
||||
uint32_t m_reserved : 14;
|
||||
uint32_t m_divisor;
|
||||
uint32_t m_divisor : 14;
|
||||
|
||||
};
|
||||
|
||||
|
@ -58,6 +58,20 @@ namespace dxvk {
|
||||
return read(data);
|
||||
}
|
||||
|
||||
bool read(DxvkIlBinding& data, uint32_t version) {
|
||||
if (version < 10) {
|
||||
DxvkIlBindingV9 v9;
|
||||
|
||||
if (!read(v9))
|
||||
return false;
|
||||
|
||||
data = v9.convert();
|
||||
return true;
|
||||
}
|
||||
|
||||
return read(data);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool write(const T& data) {
|
||||
if (m_size + sizeof(T) > MaxSize)
|
||||
|
@ -52,7 +52,7 @@ namespace dxvk {
|
||||
*/
|
||||
struct DxvkStateCacheHeader {
|
||||
char magic[4] = { 'D', 'X', 'V', 'K' };
|
||||
uint32_t version = 9;
|
||||
uint32_t version = 10;
|
||||
uint32_t entrySize = 0; /* no longer meaningful */
|
||||
};
|
||||
|
||||
@ -72,6 +72,23 @@ namespace dxvk {
|
||||
|
||||
};
|
||||
|
||||
class DxvkIlBindingV9 {
|
||||
|
||||
public:
|
||||
|
||||
uint32_t m_binding : 5;
|
||||
uint32_t m_stride : 12;
|
||||
uint32_t m_inputRate : 1;
|
||||
uint32_t m_reserved : 14;
|
||||
uint32_t m_divisor;
|
||||
|
||||
DxvkIlBinding convert() const {
|
||||
return DxvkIlBinding(m_binding, m_stride,
|
||||
VkVertexInputRate(m_inputRate), m_divisor);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Version 4 graphics pipeline state
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user