hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.35k stars 2.18k forks source link

Hatsune Miku Project Diva Extend: Lightning/Reflection issue #8071

Closed GamerzHell9137 closed 9 years ago

GamerzHell9137 commented 9 years ago

For some reason the lightning in the whole game is broken. The build that i'm using right now is v1.1.1-41-g9890460 and the behavior that it has is that the lights are represented as blocks and in some songs the reflection(?) flickers.

https://youtu.be/OHeBoEKhgDA

daniel229 commented 9 years ago

Broke by https://github.com/hrydgard/ppsspp/commit/87f45ed307aab80a10ea91d12e311b4bd9051bdc

hrydgard commented 9 years ago

Thanks, I knew that had to break something, I was surprised how little it broke for such a major change :)

I will take a look soon but might not have time until next week.

GamerzHell9137 commented 9 years ago

@hrydgard Major change? I guess its a good cnange. Mind if you explain what it changed? Im curious lol

hrydgard commented 9 years ago

@GamerzHell9137 It's a new way of keeping track of our generated shaders, which will enable some cool tricks like preloading shaders for games to avoid stutters, etc, in the future.

Anyway, that change should fix it.

daniel229 commented 9 years ago

Still flicker in the latest build v1.1.1-85-gb86394d

unknownbrackets commented 9 years ago

If you replace the shader gen function (but not the shader id) with the one before these changes, does the flicker go away, or is it still there?

-[Unknown]

daniel229 commented 9 years ago

Yes,it's working by reverting GenerateVertexShader(VSID, codeBuffer); to GenerateVertexShader(prim, vertType, codeBuffer, useHWTransform);

unknownbrackets commented 9 years ago

Okay, if you want to try to narrow it down, I'd pass both VSID and prim/vertType/useHWTransform into the func. Then try switching parts to use the VSID (large chunks at a time.) I'd start with the bools at the top.

-[Unknown]

daniel229 commented 9 years ago

Reverting bool hasTexcoord = id.Bit(BIT_HAS_TEXCOORD) || !useHWTransform;,then works fine.

or just revert hasTexcoord in this line https://github.com/hrydgard/ppsspp/commit/87f45ed307aab80a10ea91d12e311b4bd9051bdc#diff-c59d557b8f9c84ed4680bd5a1efa09b8R749

unknownbrackets commented 9 years ago

Hmm. Can you change this:

void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) {

To:

static u32 lastVertType = -1;
void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform) {
   lastVertType = vertType;

And then right before // In GLSL ES 3.0, you use "out" variables instead.:

   if (vertType != lastVertType) {
      NOTICE_LOG(HLE, "Generating shader and vertType changed: %08x != %08x", vertType, lastVertType);
   }

It sounds like hasTexcoord is changing in the first shader gen...

-[Unknown]

daniel229 commented 9 years ago

I don't see any NOTICE_LOG in games.

unknownbrackets commented 9 years ago

Hmm. What if you change:

        if (doTextureProjection && gstate.getUVProjMode() == GE_PROJMAP_UV) {
            id.SetBit(BIT_TEXCOORD_FMTSCALE, (vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT);  // two bits
        } else {
            id.SetBit(BIT_HAS_TEXCOORD, hasTexcoord);
        }

To:

        id.SetBit(BIT_HAS_TEXCOORD, hasTexcoord);
        if (doTextureProjection && gstate.getUVProjMode() == GE_PROJMAP_UV) {
            id.SetBit(BIT_TEXCOORD_FMTSCALE, (vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT);  // two bits
        }

That looks like the problem.

-[Unknown]

daniel229 commented 9 years ago

Yes,it works fine.

unknownbrackets commented 9 years ago

Okay, 06f2c7f1fe69f1764d2e70e0e535275f4f474d09 should fix this then. Will reopen if not.

-[Unknown]