1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 10:24:10 +01:00

[dxbc] More sophisticated component mask/swizzle classes

This commit is contained in:
Philip Rebohle 2017-11-07 15:11:09 +01:00
parent 4052951542
commit 403ab75aeb

25
src/dxbc/dxbc_type.cpp Normal file
View File

@ -0,0 +1,25 @@
#include "dxbc_type.h"
namespace dxvk {
DxbcComponentSwizzle DxbcComponentSwizzle::extract(DxbcComponentMask mask) const {
DxbcComponentSwizzle result;
uint32_t j = 0;
for (uint32_t i = 0; i < m_components.size(); i++) {
if (mask.test(i))
result[j++] = m_components.at(i);
}
return result;
}
DxbcComponentMask DxbcComponentSwizzle::mask(uint32_t n) const {
DxbcComponentMask mask;
for (uint32_t i = 0; i < n; i++)
mask.set(m_components.at(i));
return mask;
}
}