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

[d3d9] Clamp stage and type in [G,S]etTextureStageState #3272

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

K0bin
Copy link
Collaborator

@K0bin K0bin commented Mar 2, 2023

Fixes #3271

This is what happens on the Nvidia D3D9 driver.
Dawn of Magic 2 calls SetTextureStageState with a
stage > 7 and expects that to succeed.

    HRESULT test = device->SetTextureStageState(13000, (D3DTEXTURESTAGESTATETYPE)99, D3DTTFF_COUNT1); // S_OK
    test = device->SetTextureStageState(13000, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2); // S_OK
    test = device->SetTextureStageState(6, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3); // S_OK
    test = device->SetTextureStageState(13001, (D3DTEXTURESTAGESTATETYPE)100, D3DTTFF_COUNT4); // S_OK
    DWORD val = 0xdeadbeef;
    test = device->GetTextureStageState(13000, D3DTSS_TEXTURETRANSFORMFLAGS, &val); // S_OK, val = D3DTTFF_COUNT2
    val = 0xdeadbeef;
    test = device->GetTextureStageState(13000, (D3DTEXTURESTAGESTATETYPE)99, &val); // S_OK, val = D3DTTFF_COUNT4
    val = 0xdeadbeef;
    test = device->GetTextureStageState(13001, (D3DTEXTURESTAGESTATETYPE)98, &val); // S_OK, val = D3DTTFF_COUNT4
    val = 0xdeadbeef;
    test = device->GetTextureStageState(8, (D3DTEXTURESTAGESTATETYPE)33, &val); // S_OK, val = D3DTTFF_COUNT4
    test = device->GetTextureStageState(7, (D3DTEXTURESTAGESTATETYPE)33, &val); // S_OK, val = D3DTTFF_COUNT4
    test = device->GetTextureStageState(7, D3DTSS_TEXTURETRANSFORMFLAGS, &val); // S_OK, val = D3DTTFF_COUNT2
    test = device->GetTextureStageState(6, D3DTSS_TEXTURETRANSFORMFLAGS, &val); // S_OK, val = D3DTTFF_COUNT3
    test = device->GetTextureStageState(3, (D3DTEXTURESTAGESTATETYPE)33, &val); // S_OK, val = D3DTTFF_DISABLE
    test = device->GetTextureStageState(3, D3DTSS_TEXTURETRANSFORMFLAGS, &val); // S_OK, val = D3DTTFF_DISABLE

@K0bin K0bin requested a review from misyltoad March 2, 2023 01:10
@K0bin K0bin added the d3d9 label Mar 2, 2023
This is what happens on the Nvidia D3D9 driver.
Dawn of Magic 2 calls SetTextureStageState with a
stage > 7 and expects that to succeed.
@misyltoad misyltoad merged commit 1c6fc7b into doitsujin:master Mar 2, 2023
@K0bin K0bin deleted the dawnofmagic branch March 2, 2023 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dawn of Magic 2 - Crash upon starting a new game.
2 participants