...
 
Commits (3)
......@@ -5529,27 +5529,9 @@ namespace dxvk {
uint32_t attrMask = 0;
uint32_t bindMask = 0;
// TODO we should make fixed-function isgn global
DxsoIsgn ffIsgn;
if (cVertexShader == nullptr) {
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Position, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Normal, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Position, 1 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Normal, 1 };
for (uint32_t i = 0; i < 8; i++)
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Texcoord, i };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Color, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Color, 1 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Fog, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::PointSize, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::BlendWeight, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::BlendIndices, 0 };
}
const auto& isgn = cVertexShader != nullptr
? GetCommonShader(cVertexShader.ptr())->GetIsgn()
: ffIsgn;
: GetFixedFunctionIsgn();
for (uint32_t i = 0; i < isgn.elemCount; i++) {
const auto& decl = isgn.elems[i];
......
......@@ -454,51 +454,51 @@ namespace dxvk {
};
struct D3D9FFVertexData {
uint32_t constantBuffer = 0;
uint32_t vertexBlendData = 0;
uint32_t lightType = 0;
uint32_t constantBuffer;
uint32_t vertexBlendData;
uint32_t lightType;
struct {
uint32_t worldview = { 0 };
uint32_t normal = { 0 };
uint32_t proj = { 0 };
uint32_t worldview;
uint32_t normal;
uint32_t proj;
uint32_t texcoord[8] = { 0 };
uint32_t texcoord[8];
uint32_t invOffset = { 0 };
uint32_t invExtent = { 0 };
uint32_t invOffset;
uint32_t invExtent;
uint32_t globalAmbient = { 0 };
uint32_t globalAmbient;
uint32_t materialDiffuse = { 0 };
uint32_t materialSpecular = { 0 };
uint32_t materialAmbient = { 0 };
uint32_t materialEmissive = { 0 };
uint32_t materialPower = { 0 };
uint32_t tweenFactor = { 0 };
uint32_t materialDiffuse;
uint32_t materialSpecular;
uint32_t materialAmbient;
uint32_t materialEmissive;
uint32_t materialPower;
uint32_t tweenFactor;
} constants;
struct {
uint32_t POSITION = { 0 };
uint32_t POSITION1 = { 0 };
uint32_t POINTSIZE = { 0 };
uint32_t NORMAL = { 0 };
uint32_t NORMAL1 = { 0 };
uint32_t TEXCOORD[8] = { 0 };
uint32_t COLOR[2] = { 0 };
uint32_t FOG = { 0 };
uint32_t BLENDWEIGHT = { 0 };
uint32_t BLENDINDICES = { 0 };
uint32_t POSITION;
uint32_t POSITION1;
uint32_t POINTSIZE;
uint32_t NORMAL;
uint32_t NORMAL1;
uint32_t TEXCOORD[8];
uint32_t COLOR[2];
uint32_t FOG;
uint32_t BLENDWEIGHT;
uint32_t BLENDINDICES;
} in;
struct {
uint32_t POSITION = { 0 };
uint32_t POINTSIZE = { 0 };
uint32_t NORMAL = { 0 };
uint32_t TEXCOORD[8] = { 0 };
uint32_t COLOR[2] = { 0 };
uint32_t FOG = { 0 };
uint32_t POSITION;
uint32_t POINTSIZE;
uint32_t NORMAL;
uint32_t TEXCOORD[8];
uint32_t COLOR[2];
uint32_t FOG;
} out;
};
......@@ -509,29 +509,29 @@ namespace dxvk {
};
struct D3D9FFPixelData {
uint32_t constantBuffer = 0;
uint32_t sharedState = 0;
uint32_t constantBuffer;
uint32_t sharedState;
struct {
uint32_t textureFactor = { 0 };
uint32_t textureFactor;
} constants;
struct {
uint32_t TEXCOORD[8] = { 0 };
uint32_t COLOR[2] = { 0 };
uint32_t FOG = { 0 };
uint32_t POS = { 0 };
uint32_t TEXCOORD[8];
uint32_t COLOR[2];
uint32_t FOG;
uint32_t POS;
} in;
struct {
uint32_t texcoordCnt = 0;
uint32_t typeId = { 0 };
uint32_t varId = { 0 };
uint32_t bound = { 0 };
uint32_t texcoordCnt;
uint32_t typeId;
uint32_t varId;
uint32_t bound;
} samplers[8];
struct {
uint32_t COLOR = { 0 };
uint32_t COLOR;
} out;
};
......@@ -596,8 +596,8 @@ namespace dxvk {
D3D9FFShaderKeyVS m_vsKey;
D3D9FFShaderKeyFS m_fsKey;
D3D9FFVertexData m_vs;
D3D9FFPixelData m_ps;
D3D9FFVertexData m_vs = { };
D3D9FFPixelData m_ps = { };
DxsoIsgn m_isgn;
DxsoIsgn m_osgn;
......@@ -2285,4 +2285,27 @@ namespace dxvk {
return a == b;
}
static inline DxsoIsgn CreateFixedFunctionIsgn() {
DxsoIsgn ffIsgn;
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Position, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Normal, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Position, 1 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Normal, 1 };
for (uint32_t i = 0; i < 8; i++)
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Texcoord, i };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Color, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Color, 1 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::Fog, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::PointSize, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::BlendWeight, 0 };
ffIsgn.elems[ffIsgn.elemCount++].semantic = DxsoSemantic{ DxsoUsage::BlendIndices, 0 };
return ffIsgn;
}
DxsoIsgn g_ffIsgn = CreateFixedFunctionIsgn();
}
\ No newline at end of file
......@@ -127,19 +127,19 @@ namespace dxvk {
struct D3D9FFShaderStage {
union {
struct {
uint32_t ColorOp : 5;
uint32_t ColorOp : 5;
uint32_t ColorArg0 : 6;
uint32_t ColorArg1 : 6;
uint32_t ColorArg2 : 6;
uint32_t AlphaOp : 5;
uint32_t AlphaOp : 5;
uint32_t AlphaArg0 : 6;
uint32_t AlphaArg1 : 6;
uint32_t AlphaArg2 : 6;
uint32_t Type : 2;
uint32_t Type : 2;
uint32_t ResultIsTemp : 1;
uint32_t Projected : 1;
uint32_t Projected : 1;
uint32_t ProjectedCount : 3;
......@@ -237,4 +237,11 @@ namespace dxvk {
};
inline const DxsoIsgn& GetFixedFunctionIsgn() {
extern DxsoIsgn g_ffIsgn;
return g_ffIsgn;
}
}
\ No newline at end of file
......@@ -205,6 +205,7 @@ namespace dxvk {
std::copy(elements.begin(), elements.begin() + elemCount, m_elements.data());
}
void D3D9VertexDecl::Classify() {
for (const auto& element : m_elements) {
if (element.Usage == D3DDECLUSAGE_COLOR && element.UsageIndex == 0)
......