GithubHelp home page GithubHelp logo

Comments (10)

elishacloud avatar elishacloud commented on June 7, 2024 2

I believe this one should solve the issue. Can you try it once more?

d3d8.zip

from d3d8to9.

elishacloud avatar elishacloud commented on June 7, 2024 1

I am pretty sure the issue here is with the PixelShader. We are removing a modifier from a constant because modifiers are not allowed in constants in d3d9 (unlike d3d8).

There are several PixelShaders with this issue but in Silent Hill 2 they are all almost identical. Here is an example of one:

Redirecting 'IDirect3DDevice8::CreatePixelShader(09956B50, 008A41E0, 01F802C4)' ...
> Disassembling shader and translating assembly to Direct3D 9 compatible code ...
> Dumping translated shader assembly:

    ps_1_1
    tex t0
    tex t1
    tex t2
    dp3_sat r0, t2_bx2, c1 /* removed modifier _bx2 */
    dp3 r1.xyz, t2_bx2, v1_bx2
  + sub r0.w, r0, c2.w /* changed 'add' to 'sub' removed modifier - */
    mul_sat r1.xyz, r1, t0.w
    mul_sat r0.xyz, r0.w, r1
    mul r1.xyz, t1, t0.w
    mad_sat r0.xyz, r0, c2, v0
    mul r0.xyz, r0, t0
  + mov r0.w, t0.w
    mad r0.xyz, r1, c3, r0

// approximately 11 instruction slots used (3 texture, 8 arithmetic)

Notice that the _bx2 modifier is removed. I believe this is what is causing the issue.

Normally the simple solution is to add a new line and use a temporary register in place of the constant so that the modifier can remain. However adding a new line causes the arithmetic instructions to exceed 8, which is the maximum allowed for PixelShader 1.x (except 1.4).

The only other fix I know of would be to convert the shader into ps_1_4 (version 1.4), which is what the ENBSeries DX8 to DX9 Convertor does to solve this type of issue.

Can you check with the ENBSeries convertor to see if the same issue happens?

from d3d8to9.

elishacloud avatar elishacloud commented on June 7, 2024 1

@Markeron, I am having some trouble reproducing this issue. It seems to be related to 4 specific PixelShaders in the game. All of them are virtually identical to the one I shown above, with only minor differences in the instruction modifier (_sat).

However, I think I have found a generic solution. Below is a quick and dirty patch with the PixelShaders hard coded so we can test it to see if it works. Can you try with this one to see if it fixes the issue?

d3d8.zip

from d3d8to9.

elishacloud avatar elishacloud commented on June 7, 2024 1

@Markeron, I was able to build a fairly simple PixelShader v1.1 to v1.4 translator. I tested with a few games and seems to work. Can you test with this updated one?

d3d8.zip

from d3d8to9.

elishacloud avatar elishacloud commented on June 7, 2024 1

Very good! This was a pretty big change. I added ~250 lines of code so I want to do an in-depth review of the code and full testing before I create a pull request.

from d3d8to9.

elishacloud avatar elishacloud commented on June 7, 2024 1

This should be fixed with the latest release v1.7.0.

from d3d8to9.

CHNSK avatar CHNSK commented on June 7, 2024

Thanks for the explanation. ENB converter has really solved the issue. Since using ASI Loader's d3d8to9 function I completely forgot ENB. Thanks you Elisha.

from d3d8to9.

CHNSK avatar CHNSK commented on June 7, 2024

It works Eli, the dirty patch fixes the issue.

sh25

The issue comes back if return to 1.6.0.0, with or without sweetfx 1.4

from d3d8to9.

CHNSK avatar CHNSK commented on June 7, 2024

It loads the shader but objects get 'rainbow' colours when they are exposed to flashlight.

insta

from d3d8to9.

CHNSK avatar CHNSK commented on June 7, 2024

It did it. It's working perfectly. Now, also I can run the game in the first attempt! It used to always hang on the black screen and take four or five times to start. Thank you.

from d3d8to9.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.