mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +01:00
[d3d9] FF: Fix a bunch of wine tests with FF texture coordinates
This commit is contained in:
parent
3420cd78ac
commit
dfc3776b24
@ -1106,6 +1106,17 @@ namespace dxvk {
|
|||||||
const uint32_t wIndex = 3;
|
const uint32_t wIndex = 3;
|
||||||
|
|
||||||
uint32_t flags = (m_vsKey.Data.Contents.TransformFlags >> (i * 3)) & 0b111;
|
uint32_t flags = (m_vsKey.Data.Contents.TransformFlags >> (i * 3)) & 0b111;
|
||||||
|
|
||||||
|
if (flags == D3DTTFF_COUNT1) {
|
||||||
|
// D3DTTFF_COUNT1 behaves like D3DTTFF_DISABLE on NV and like D3DTTFF_COUNT2 on AMD.
|
||||||
|
// The Nvidia behavior is easier to implement.
|
||||||
|
flags = D3DTTFF_DISABLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Passing 0xffffffff results in it getting clamped to the dimensions of the texture coords and getting treated as PROJECTED
|
||||||
|
// but D3D9 does not apply the transformation matrix.
|
||||||
|
bool applyTransform = flags >= D3DTTFF_COUNT1 && flags <= D3DTTFF_COUNT4;
|
||||||
|
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
switch (inputFlags) {
|
switch (inputFlags) {
|
||||||
default:
|
default:
|
||||||
@ -1116,11 +1127,14 @@ namespace dxvk {
|
|||||||
count = flags;
|
count = flags;
|
||||||
if (texcoordCount) {
|
if (texcoordCount) {
|
||||||
// Clamp by the number of elements in the texcoord input.
|
// Clamp by the number of elements in the texcoord input.
|
||||||
if (!count || count > texcoordCount)
|
if (!count || count > texcoordCount) {
|
||||||
count = texcoordCount;
|
count = texcoordCount;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
|
count = 0;
|
||||||
flags = D3DTTFF_DISABLE;
|
flags = D3DTTFF_DISABLE;
|
||||||
|
applyTransform = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (DXVK_TSS_TCI_CAMERASPACENORMAL >> TCIOffset):
|
case (DXVK_TSS_TCI_CAMERASPACENORMAL >> TCIOffset):
|
||||||
@ -1174,9 +1188,8 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t type = flags;
|
if (applyTransform || (count != 4 && count != 0)) {
|
||||||
if (type != D3DTTFF_DISABLE) {
|
if (applyTransform && !m_vsKey.Data.Contents.HasPositionT) {
|
||||||
if (!m_vsKey.Data.Contents.HasPositionT) {
|
|
||||||
for (uint32_t j = count; j < 4; j++) {
|
for (uint32_t j = count; j < 4; j++) {
|
||||||
// If we're outside the component count of the vertex decl for this texcoord then we pad with zeroes.
|
// If we're outside the component count of the vertex decl for this texcoord then we pad with zeroes.
|
||||||
// Otherwise, pad with ones.
|
// Otherwise, pad with ones.
|
||||||
@ -1193,8 +1206,8 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Pad the unused section of it with the value for projection.
|
// Pad the unused section of it with the value for projection.
|
||||||
uint32_t lastIdx = count - 1;
|
uint32_t projIdx = std::max(2u, count - 1);
|
||||||
uint32_t projValue = m_module.opCompositeExtract(m_floatType, transformed, 1, &lastIdx);
|
uint32_t projValue = m_module.opCompositeExtract(m_floatType, transformed, 1, &projIdx);
|
||||||
|
|
||||||
for (uint32_t j = count; j < 4; j++)
|
for (uint32_t j = count; j < 4; j++)
|
||||||
transformed = m_module.opCompositeInsert(m_vec4Type, projValue, transformed, 1, &j);
|
transformed = m_module.opCompositeInsert(m_vec4Type, projValue, transformed, 1, &j);
|
||||||
@ -1790,22 +1803,17 @@ namespace dxvk {
|
|||||||
texcoord = m_module.opVectorShuffle(texcoord_t,
|
texcoord = m_module.opVectorShuffle(texcoord_t,
|
||||||
texcoord, texcoord, texcoordCnt, indices.data());
|
texcoord, texcoord, texcoordCnt, indices.data());
|
||||||
|
|
||||||
uint32_t projIdx = m_fsKey.Stages[i].Contents.ProjectedCount;
|
bool shouldProject = m_fsKey.Stages[i].Contents.Projected;
|
||||||
if (projIdx == 0 || projIdx > texcoordCnt) {
|
|
||||||
projIdx = 4; // Always use w if ProjectedCount is 0.
|
|
||||||
}
|
|
||||||
--projIdx;
|
|
||||||
|
|
||||||
uint32_t projValue = 0;
|
uint32_t projValue = 0;
|
||||||
|
|
||||||
if (m_fsKey.Stages[i].Contents.Projected) {
|
if (shouldProject) {
|
||||||
|
// Always use w, the vertex shader puts the correct value there.
|
||||||
|
const uint32_t projIdx = 3;
|
||||||
projValue = m_module.opCompositeExtract(m_floatType, m_ps.in.TEXCOORD[i], 1, &projIdx);
|
projValue = m_module.opCompositeExtract(m_floatType, m_ps.in.TEXCOORD[i], 1, &projIdx);
|
||||||
uint32_t insertIdx = texcoordCnt - 1;
|
uint32_t insertIdx = texcoordCnt - 1;
|
||||||
texcoord = m_module.opCompositeInsert(texcoord_t, projValue, texcoord, 1, &insertIdx);
|
texcoord = m_module.opCompositeInsert(texcoord_t, projValue, texcoord, 1, &insertIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shouldProject = m_fsKey.Stages[i].Contents.Projected;
|
|
||||||
|
|
||||||
if (i != 0 && (
|
if (i != 0 && (
|
||||||
m_fsKey.Stages[i - 1].Contents.ColorOp == D3DTOP_BUMPENVMAP ||
|
m_fsKey.Stages[i - 1].Contents.ColorOp == D3DTOP_BUMPENVMAP ||
|
||||||
m_fsKey.Stages[i - 1].Contents.ColorOp == D3DTOP_BUMPENVMAPLUMINANCE)) {
|
m_fsKey.Stages[i - 1].Contents.ColorOp == D3DTOP_BUMPENVMAPLUMINANCE)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user