Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Spellforce #2711

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6790,6 +6790,8 @@ namespace dxvk {
break;
}

stage.TextureBound = m_state.textures[idx] != nullptr ? 1 : 0;

stage.ColorOp = data[DXVK_TSS_COLOROP];
stage.AlphaOp = data[DXVK_TSS_ALPHAOP];

Expand Down
10 changes: 8 additions & 2 deletions src/d3d9/d3d9_fixed_function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,9 +1551,11 @@ namespace dxvk {
uint32_t current = diffuse;
// Temp starts off as equal to vec4(0)
uint32_t temp = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 0.0f);

uint32_t texture = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 1.0f);

uint32_t unboundTextureConstId = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 1.0f);

for (uint32_t i = 0; i < caps::TextureStageCount; i++) {
const auto& stage = m_fsKey.Stages[i].Contents;

Expand Down Expand Up @@ -1712,7 +1714,11 @@ namespace dxvk {
reg = temp;
break;
case D3DTA_TEXTURE:
reg = GetTexture();
if (stage.TextureBound != 0) {
reg = GetTexture();
} else {
reg = unboundTextureConstId;
}
break;
case D3DTA_TFACTOR:
reg = m_ps.constants.textureFactor;
Expand Down
2 changes: 2 additions & 0 deletions src/d3d9/d3d9_fixed_function.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ namespace dxvk {

uint32_t ProjectedCount : 3;

uint32_t TextureBound : 1;

// Included in here, read from Stage 0 for packing reasons
// Affects all stages.
uint32_t GlobalSpecularEnable : 1;
Expand Down
2 changes: 1 addition & 1 deletion src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ namespace dxvk {
D3D9CommonTexture* dstTexInfo = dst->GetCommonTexture();
D3D9CommonTexture* srcTexInfo = m_backBuffers.back()->GetCommonTexture();

if (unlikely(dstTexInfo->Desc()->Pool != D3DPOOL_SYSTEMMEM))
if (unlikely(dstTexInfo->Desc()->Pool != D3DPOOL_SYSTEMMEM && dstTexInfo->Desc()->Pool != D3DPOOL_SCRATCH))
return D3DERR_INVALIDCALL;

Rc<DxvkBuffer> dstBuffer = dstTexInfo->GetBuffer(dst->GetSubresource());
Expand Down