cai567890 / pcsx2

Automatically exported from code.google.com/p/pcsx2
1 stars 0 forks source link

Ratchet And Clank garbage graphics (cause: unsupported type of mipmapping) #665

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
[The following is a template to help you fill out a more informative
report]

Note:
Many games do not run yet, or have known problems. Please do not report
those games without giving any more information. That means reports like
"Game XYZ crashes" are not helpful. Instead try to include as much debug
information as possible. The last 5 console messages for example, or if the
crashes can be circumvented / fixed by another configuration would help
much more.

--------------------------------------

1) Did the game ever work correctly (i.e. not have this problem) on the
Official PCSX2 build or an earlier version of PCSX2 playground?
(If so, please specify the latest pcsx2-playground or Official revision
that last worked.)

Yes the game works on official PCSX2 0.9.6 build.

2) What steps will reproduce the problem?
1.When The Game goes in-game.
2.
3.

3) What exactly happens when you experience this issue (listing any console
errors or screen output you receive)?
A lot of garbage graphics appear and it slows PCSX2 down.

4) What version of PCSX2 are you using? On what operating system? Plugins?
official PCSX2 0.9.6 build

5) Please provide any additional information below.
There are some places where the garbage graphics do not appear, 
in those places PCSX2 runs game fine.
6) Attachments.  *IMPORTANT!*  We have a limited storage quota on
GoogleCode, so please keep attachments to UNDER 200k!  Do not upload
blockdumps!  Do not upload MP3 dumps.  Use 3rd party image hosts for
screenshots when possible.

Original issue reported on code.google.com by wanzer...@gmail.com on 21 Apr 2010 at 6:51

GoogleCodeExporter commented 9 years ago
1) Did the game ever work correctly (i.e. not have this problem) on the
Official PCSX2 build or an earlier version of PCSX2 playground?
(If so, please specify the latest pcsx2-playground or Official revision
that last worked.)

Yes the game works on official PCSX2 0.9.6 build.

Eh what? Is the bug present on 0.9.6 or not?
Test beta 1888 and then the latest SVN revision.

Original comment by pcsx2gu...@gmail.com on 21 Apr 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Yes the bug is still present on 0.9.6.
Also beta 1888 and PCSX2 SVN r2881 give me the same graphical glitches.

Original comment by wanzer...@gmail.com on 21 Apr 2010 at 11:57

GoogleCodeExporter commented 9 years ago
I have the game, and it's not deadlocking.
The graphics are a bit borken though, seems the game level of detail system 
doesn't
work, or simply a path3 mask thing.
Also spins on VU0, so it's slow and bug prone. But cotton fixed it in mVU 
already.

Original comment by ramapcsx2 on 21 Apr 2010 at 12:10

GoogleCodeExporter commented 9 years ago
ramapcsx2 what do you mean by fixed it in mVU ?
has the issue been fixed? 

Original comment by wanzer...@gmail.com on 22 Apr 2010 at 5:19

GoogleCodeExporter commented 9 years ago
The bad VU0 spin was fixed that caused even more slowness than we have now.
So the graphics are still wrong, but the game does not crash or dead lock.

Original comment by ramapcsx2 on 22 Apr 2010 at 11:04

GoogleCodeExporter commented 9 years ago
Please fix this issue I want to play the game without the graphical glitches.

Original comment by wanzer...@gmail.com on 22 Apr 2010 at 12:01

GoogleCodeExporter commented 9 years ago
Oh, since you want to play now, I'll better hurry it up then!

Lol.

Original comment by ramapcsx2 on 22 Apr 2010 at 2:40

GoogleCodeExporter commented 9 years ago
Just kidding ramapcsx2.... lol.
Take your time, I hope you fix the graphical bug.

Original comment by wanzer...@gmail.com on 23 Apr 2010 at 5:48

GoogleCodeExporter commented 9 years ago
The problem in almost all ratchet games is not the graphics plugins but the EE 
thing,
and as far as i know, and by the time i've been following this emulator, is the 
most
"irritating thing" to put to work correcly. Once someone "gives a shit" to try 
to
make EE more acurate, maybe all ratchets will start working, because all the 
games
haves EE issues, not GSDX issues.

By now, if you want to play ratchet, just stick with the old fashion PS2, maybe 
in
the future the games will start working.

Original comment by paulocon...@gmail.com on 24 Apr 2010 at 1:59

GoogleCodeExporter commented 9 years ago
Lol what?
Yeah, we do "give a shit" to fix the EE. You know, when it's broken.
And yeah, we know it's not GSdx (and not the EE either, just btw).

Original comment by ramapcsx2 on 24 Apr 2010 at 2:43

GoogleCodeExporter commented 9 years ago
I didn't say you guys don't give a shit to EE emulation (dam, am i that bad at
english? -.-) I just said that you guys don't work on it too mutch because it's 
a
paint to work on it (i've read in one of the SVN releases a dev saing that 
lol). It's
not that i don't value your work, indeed i do, playing for example Kingdom 
Hearts 2
on PCSX2 is way better than in the real PS2 because of the higher resolution, 
and AA =p

But then, if it's now EE that is causing the problem, what could it be? Vu's? I 
just
say it's EE because in the GS window the EE counter gets saturated at 100% when 
a lot
of garbage apears, if you go to a corner, the graphics are perfect, and the EE 
% gets
down a to it's "normal values".

Original comment by paulocon...@gmail.com on 24 Apr 2010 at 3:13

GoogleCodeExporter commented 9 years ago
Oh, and by the way, i tested the game with Interpreter mode, it don't even gets 
to
the 3D part, it just hangs before it on R2888.

PS: sorry for my grammatical errors / if i looked too rude ^^"

Original comment by paulocon...@gmail.com on 24 Apr 2010 at 3:31

GoogleCodeExporter commented 9 years ago
you can get ingame and play it, i stick both the EE and VU clamping to full and 
pop
on a couple of speedhacks, it works fine then.

however graphics are still garbled. Its not path3, i tried that ;p but it can be
offputting.

Original comment by refraction on 18 May 2010 at 1:52

GoogleCodeExporter commented 9 years ago
If you open GSDX's source, you may find very long commented out block of code 
there with a comment:
if(dst->m_TEX0.TBW != TEX0.TBW) // && dst->m_TEX0.PSM == TEX0.PSM
{
// This is so broken :p
//Better not do the code below, "fixes" like every game that ever gets here..
//Edit: Ratchet and Clank needs this to show most of it's graphics at all.
//Someone else fix this please, I can't :p

Original comment by eliotfur on 27 Jun 2010 at 4:21

GoogleCodeExporter commented 9 years ago
which source file? 

Original comment by weign...@gmail.com on 27 Jun 2010 at 9:14

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
found it, its in GSTextureCache.cpp

//Fixme: Several issues in here. Not handling depth stencil, pitch conversion 
doesnt work.
GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, 
const GIFRegTEXA& TEXA, Target* dst)
{
    Source* src = new Source(m_renderer);

    src->m_TEX0 = TEX0;
    src->m_TEXA = TEXA;

    int tw = 1 << TEX0.TW;
    int th = 1 << TEX0.TH;
    int tp = TEX0.TBW << 6;

    bool hack = false;

    if(dst == NULL)
    {
        if(m_paltex && GSLocalMemory::m_psm[TEX0.PSM].pal > 0)
        {
            src->m_fmt = FMT_8;

            src->m_texture = m_renderer->m_dev->CreateTexture(tw, th, Get8bitFormat());
            src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
        }
        else
        {
            src->m_fmt = FMT_32;

            src->m_texture = m_renderer->m_dev->CreateTexture(tw, th);
        }
    }
    else
    {
        // TODO: clean up this mess

        src->m_target = true;

        if(dst->m_type != RenderTarget)
        {
            // TODO
            delete src;
            return NULL;
        }

        dst->Update();

        GSTexture* tmp = NULL;

        if(dst->m_texture->IsMSAA())
        {
            tmp = dst->m_texture;

            dst->m_texture = m_renderer->m_dev->Resolve(dst->m_texture);
        }

        // do not round here!!! if edge becomes a black pixel and addressing mode is clamp => everything outside the clamped area turns into black (kh2 shadows)

        int w = (int)(dst->m_texture->GetScale().x * tw);
        int h = (int)(dst->m_texture->GetScale().y * th);

        GSVector2i dstsize = dst->m_texture->GetSize();

        // pitch conversion

        if(dst->m_TEX0.TBW != TEX0.TBW) // && dst->m_TEX0.PSM == TEX0.PSM
        {
            // This is so broken :p
            ////Better not do the code below, "fixes" like every game that ever gets here..
            ////Edit: Ratchet and Clank needs this to show most of it's graphics at all.
            ////Someone else fix this please, I can't :p
            ////delete src; return NULL;

            //// sfex3 uses this trick (bw: 10 -> 5, wraps the right side below the left)

            //ASSERT(dst->m_TEX0.TBW > TEX0.TBW); // otherwise scale.x need to be reduced to make the larger texture fit (TODO)

            //src->m_texture = m_renderer->m_dev->CreateRenderTarget(dstsize.x, dstsize.y, false);

            //GSVector4 size = GSVector4(dstsize).xyxy();
            //GSVector4 scale = GSVector4(dst->m_texture->GetScale()).xyxy();

            //int blockWidth  = 64;
            //int blockHeight = TEX0.PSM == PSM_PSMCT32 || TEX0.PSM == PSM_PSMCT24 ? 32 : 64;

            //GSVector4i br(0, 0, blockWidth, blockHeight);

            //int sw = (int)dst->m_TEX0.TBW << 6;

            //int dw = (int)TEX0.TBW << 6;
            //int dh = 1 << TEX0.TH;

            //if(sw != 0)
            //for(int dy = 0; dy < dh; dy += blockHeight)
            //{
            //  for(int dx = 0; dx < dw; dx += blockWidth)
            //  {
            //      int o = dy * dw / blockHeight + dx;

            //      int sx = o % sw;
            //      int sy = o / sw;

            //      GSVector4 sr = GSVector4(GSVector4i(sx, sy).xyxy() + br) * scale / size;
            //      GSVector4 dr = GSVector4(GSVector4i(dx, dy).xyxy() + br) * scale;

            //      m_renderer->m_dev->StretchRect(dst->m_texture, sr, src->m_texture, dr);

            //      // TODO: this is quite a lot of StretchRect, do it with one Draw
            //  }
            //}
        }
        else if(tw < 1024)
        {
            // FIXME: timesplitters blurs the render target by blending itself over a couple of times
            hack = true;
            if(tw == 256 && th == 128 && (TEX0.TBP0 == 0 || TEX0.TBP0 == 0x00e00))
            {
                delete src;
                return NULL;
            }
        }
        // width/height conversion

        GSVector2 scale = dst->m_texture->GetScale();

        GSVector4 dr(0, 0, w, h);

        if(w > dstsize.x)
        {
            scale.x = (float)dstsize.x / tw;
            dr.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x;
            w = dstsize.x;
        }

        if(h > dstsize.y)
        {
            scale.y = (float)dstsize.y / th;
            dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y;
            h = dstsize.y;
        }

        GSVector4 sr(0, 0, w, h);

        GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture;
        GSTexture* dt = m_renderer->m_dev->CreateRenderTarget(w, h, false);

        if(!src->m_texture)
        {
            src->m_texture = dt;
        }

        if((sr == dr).alltrue())
        {
            m_renderer->m_dev->CopyRect(st, dt, GSVector4i(0, 0, w, h));
        }
        else
        {
            sr.z /= st->GetWidth();
            sr.w /= st->GetHeight();

            m_renderer->m_dev->StretchRect(st, sr, dt, dr);
        }

        if(dt != src->m_texture)
        {
            m_renderer->m_dev->Recycle(src->m_texture);

            src->m_texture = dt;
        }

        src->m_texture->SetScale(scale);

        switch(TEX0.PSM)
        {
        default:
            // Note: this assertion triggers in Xenosaga2 after the first intro scenes, when
            // gameplay first begins (in the city).
            ASSERT(0);
        case PSM_PSMCT32:
            src->m_fmt = FMT_32;
            break;
        case PSM_PSMCT24:
            src->m_fmt = FMT_24;
            break;
        case PSM_PSMCT16:
        case PSM_PSMCT16S:
            src->m_fmt = FMT_16;
            break;
        case PSM_PSMT8H:
            src->m_fmt = FMT_8H;
            src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
            break;
        case PSM_PSMT8:
            //Not sure, this wasn't handled at all.
            //Xenosaga 2 and 3 use it, Tales of Legendia as well.
            //It's always used for fog like effects.
            src->m_fmt = FMT_8;
            src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
            break;
        case PSM_PSMT4HL:
            src->m_fmt = FMT_4HL;
            src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
            break;
        case PSM_PSMT4HH:
            src->m_fmt = FMT_4HH;
            src->m_palette = m_renderer->m_dev->CreateTexture(256, 1);
            break;
        }

        if(tmp != NULL)
        {
            m_renderer->m_dev->Recycle(dst->m_texture);

            dst->m_texture = tmp;
        }

        // Offset hack. Can be enabled via GSdx options.
        // The offset will be used in Draw().
        float modx = 0.0f;
        float mody = 0.0f;
        if (UserHacks_HalfPixelOffset && hack)
        {
            int multiplier = m_renderer->upscale_Multiplier();
            switch (multiplier)
            {
            case 2:  modx = 2.2f; mody = 2.2f; dst->m_texture->LikelyOffset = true;  break;
            case 3:  modx = 3.1f; mody = 3.1f; dst->m_texture->LikelyOffset = true;  break;
            case 4:  modx = 4.2f; mody = 4.2f; dst->m_texture->LikelyOffset = true;  break;
            case 5:  modx = 5.3f; mody = 5.3f; dst->m_texture->LikelyOffset = true;  break;
            case 6:  modx = 6.2f; mody = 6.2f; dst->m_texture->LikelyOffset = true;  break;
            default: modx = 0.0f; mody = 0.0f; dst->m_texture->LikelyOffset = false; break;
            }
        }
        dst->m_texture->OffsetHack_modx = modx;
        dst->m_texture->OffsetHack_mody = mody;

    }

    if(src->m_texture == NULL)
    {
        ASSERT(0);
        delete src;
        return NULL;
    }

    const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM];

    if(psm.pal > 0)
    {
        memcpy(src->m_clut, (const uint32*)m_renderer->m_mem.m_clut, psm.pal * sizeof(uint32));
    }

    m_src.Add(src, TEX0, m_renderer->m_context->offset.tex);

    return src;
}

Original comment by weign...@gmail.com on 27 Jun 2010 at 9:19

GoogleCodeExporter commented 9 years ago
Yeah, outdated information.
The game does a very direct form of mipmapping which no GS plugin supports.
Fixing it requires a ton of new code and will make everything 80% slower, so 
yea :p

Original comment by ramapcsx2 on 27 Jun 2010 at 11:34

GoogleCodeExporter commented 9 years ago
Issue 563 has been merged into this issue.

Original comment by Jake.Stine on 28 Jun 2010 at 10:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago

Original comment by Jake.Stine on 28 Jun 2010 at 10:52

GoogleCodeExporter commented 9 years ago
So, if it makes everything like about 80% slower, there is  no way this will be 
implemented, and those games will be broken to end of time, right?
But, isn't there a way to speed up Texture decoding? like Dolphin using Open CL.

Original comment by paulocon...@gmail.com on 28 Jun 2010 at 11:18

GoogleCodeExporter commented 9 years ago
We eventually want to fix all glitches, don't worry.
It won't have anything to do with Open CL, CUDA or hexa core processing.
Just a few good ideas and a lot of code, as usual.

Original comment by ramapcsx2 on 28 Jun 2010 at 2:43

GoogleCodeExporter commented 9 years ago
Good to see you guys that committed =p
I just mentioned that, because Open CL is actually pretty good for decoding. 
But has you said, nothing that one day that someone wakes up happy and gets a 
brand new idea to fix a problem don't resolve.

Original comment by paulocon...@gmail.com on 28 Jun 2010 at 2:48

GoogleCodeExporter commented 9 years ago
<idiotfanboy>"B-b-but my Hex-core CUDA equipped PC can run Crysis at 800 FPS! 
Why won't it run this game? Your emulator suxx0rz!"</idiotfanboy>

The problem is (as they've stated) PCSX2 really won't benefit from stuff like 
CUDA or OpenCL, I think. What it *MAY* benefit from, possibly, are the AVX 
instructions coming in the Sandy Bridge processors, because that'll increase 
register size from 128 to 256 bits (with expansions for 512 and 1024 bits 
planned) as well as non-destructive instructions, and instructions can have 
more than two operands - all presumably good things for PS2 emulation, for 
those who have processors capable of it.

AMD's Bulldozer processors will also have AVX, and finally have support for 
SSSE3, SSE4.1, SSE4.2, and all that, so pretty soon AMD owners will have parity 
to the current monopoly Intel owners enjoy on performance.

Anyway, I know this isn't really the place for it (and for that I apologize), 
but if a dev wishes to comment on if they'd be able to use stuff like AVX to 
speed up the emulator, I'd love to hear it. :)

Original comment by evolutionrevolution@gmail.com on 28 Jun 2010 at 2:59

GoogleCodeExporter commented 9 years ago
Offtopic:  There's a chance that OpenCL could be used to improve texture 
swizzling speeds on PCSX2, however that would *not* help this issue on hand.  
Additionally many PS2 games upload tons of small textures, and use totally 
wacky non-standard texture formats, instead of fewer larger ones using fairly 
sane formats; for which OpenCL's usefulness would be increasingly diminished.  
I don't think the Wii/Gamecube has that problem.

Original comment by Jake.Stine on 28 Jun 2010 at 3:25

GoogleCodeExporter commented 9 years ago
I see that 80% slowdown...
// TODO: this is quite a lot of StretchRect, do it with one Draw

Maybe it could be solved by caching all MIP levels once (do a lot of 
StretchRect once) and then using them when needed... StretchRect is sooooo 
slooooow...

Yeah... That means TOTAL rewrite of GSTextureCache...

There are many games so close to ideal emulation because of this incomplete 
GSTextureCache only... Hmmm...

Original comment by eliotfur on 28 Jun 2010 at 3:34

GoogleCodeExporter commented 9 years ago
eliotfur: 
I know you keep pointing out that everything would work so much better if the 
texture cache was fixed.
The thing is, the texture cache IS GSdx. It's whole design is centered around 
concepts that don't work well with what games do.

The fix would not be working on the texture cache, but replacing it with a 
whole new concept.
It is planned and a priority, but we need a lot of effort for this one.
So please put the flaw list in GSdx to rest. We know already ;)

Original comment by ramapcsx2 on 28 Jun 2010 at 4:19

GoogleCodeExporter commented 9 years ago
oh, plan for an alternative, Whats it called? or whats the idea like..?

Original comment by weign...@gmail.com on 29 Jun 2010 at 3:29

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Time to close this one. MipMap is supported in software and so far not planned 
for hardware.

Original comment by ramapcsx2 on 4 Aug 2012 at 11:54

GoogleCodeExporter commented 9 years ago
I have a suggestion for Ratchet & Clank garbage graphics problem. Sadly this 
legendary game looks so awful in some places. 
So is it possible instead of rendering problematic texture at distance, to 
replace it with one color texture, a dominated color from its surface? For 
example some rocks have several gray colors. It definitely would look better 
and possible run faster. At larger distance it will look almost like the 
original texture.

Original comment by ghi...@gmail.com on 19 Aug 2013 at 6:17

GoogleCodeExporter commented 9 years ago
or you could just press F9 and it all looks like it did on the ps2.

Original comment by refraction on 19 Aug 2013 at 7:18

GoogleCodeExporter commented 9 years ago
Of course, but with poor resolution. I'm running it on Dx11 Hardware, 6x 
native, Vu cycle stealing level 1, at ~50 FPS without any problems with almost 
fantastic graphics in a closed space.

Original comment by ghi...@gmail.com on 19 Aug 2013 at 9:09

GoogleCodeExporter commented 9 years ago
I'm not sure if we can make educated guesses on the texture properties when 
mipmapping is forced like in this title.

Original comment by ramapcsx2.code on 20 Aug 2013 at 7:09

GoogleCodeExporter commented 9 years ago
Ratchet&Clank: U.Y.A still has graphic problems, i do not know what is wrong, 
When I start the first mission it starts slowing down and flashing all sorts of 
colors and textures and it go's on like that for i don't know how long, i 
haven't gotten that far because its running so slow. Help Anyone?

Original comment by robertra...@gmail.com on 12 Feb 2014 at 7:01