GithubHelp home page GithubHelp logo

Comments (3)

elishacloud avatar elishacloud commented on June 1, 2024 1

As I thought, simply removing the swizzle caused issues with True Crime New York City. However I forgot that you can use a rear modifier with a swizzle as long as the swizzle comes last. So it should look like this:

d3d8to9 output :

mov r0.xyz, c0 /* added line */
dp3 r0.xyz, r0_bx2.xyz /* changed c0 to r0.xyz */, t0_bx2

Try with this file and see if it works.

BTW: here is the check-in if you want to test with the source code instead.

from d3d8to9.

elishacloud avatar elishacloud commented on June 1, 2024

The issue is with this line and this line. I purposely kept the swizzle to try and preserve the original pixel shader functionality. Removing the swizzle has a possibility of changing the final register value, which could cause an issue.

It is pretty easy to remove the swizzle here, but I would need to test many games to ensure that it does not cause any issues. It might be better if I remove the swizzle only in the case where there is a rear modifier, like _bx2 or _bias. However that would require duplicating those lines, which I really don't want to do.

Note: you cannot have both a rear modifier and a swizzle.

from d3d8to9.

PatrickvL avatar PatrickvL commented on June 1, 2024

This still fails to compile - I had to change the input shader to use an intermediate register to avoid the swizzle;

This problematic input :

dp3 r0.rgb, c0_bx2, t0_bx2

Gets converted to this, which doesn't work :

mov r0.xyz, c0 /* added line */
dp3 r0.xyz, r0_bx2.xyz /* changed c0 to r0.xyz */, t0_bx2

The error is still:

> Failed to reassemble shader :

error X5027 : Invalid src swizzle for first source param.

But when I use this (manually altered) input :

mov r0.rgb, c0
dp3 r0.rgb, r0_bx2, t0_bx2

... d3d8to9 doesn't even need to replace anything for this, as, the result is :

mov r0.xyz, c0
dp3 r0.xyz, r0_bx2, t0_bx2

... which works as intended.

PS: The DirectX 8 doc states that source register modifiers shouldn't be used on constants (because it will cause undefined results), which can be interpreted as : "it may be done, but it's just not advised". So, it's just bad luck I've encountered such a shader here.

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.