Coder Social home page Coder Social logo

Off screen Target Corruption about citro3d HOT 3 CLOSED

devkitpro avatar devkitpro commented on June 15, 2024
Off screen Target Corruption

from citro3d.

Comments (3)

fincs avatar fincs commented on June 15, 2024

It would be nice if you posted some code that showed this problem (i.e. a minimal test case). I have a suspicion it might be cache-related.

from citro3d.

TurtleP avatar TurtleP commented on June 15, 2024

I apologize, but I wasn't on my desktop when I posted this and had its GPU have an issue to solve this morning. Let me get the code for you real quick:

//canvas.cpp
const char * Canvas::Init(int width, int height)
{
    this->width = width;
    this->height = height;

    this->texture = new love::Image();
    this->texture->BasicInit(width, height);

    this->target = new love::CRenderTarget(this->texture, this->texture->NextPow2(width), this->texture->NextPow2(height));

    return nullptr;
}

//CRendertarget.cpp
CRenderTarget::CRenderTarget(love::Image * texture, int width, int height)
{
    this->target = C3D_RenderTargetCreateFromTex(texture->GetTexture(), GPU_TEXFACE_2D, 0, GPU_RB_DEPTH24_STENCIL8);
    Mtx_Ortho(&this->projection, 0.0, width, 0.0, height, 0.0, 1.0, true);
}

//Image.cpp
void Image::BasicInit(int width, int height)
{
    this->texture = new C3D_Tex();
    this->width = width;
    this->height = height;

    C3D_TexInit(this->texture, this->NextPow2(width), this->NextPow2(height), GPU_RGBA8);

    C3D_TexSetFilter(this->texture, magFilter, minFilter);

    C3D_TexSetWrap(this->texture, GPU_CLAMP_TO_BORDER, GPU_CLAMP_TO_BORDER);
}

//Graphics.cpp
int Graphics::SetCanvas(lua_State * L)
{
    if (!lua_isnoneornil(L, 1))
    {	
        Canvas * self = (Canvas *)luaobj_checkudata(L, 1, LUAOBJ_TYPE_CANVAS);

        if (self->GetTarget()->GetTarget() == nullptr)
            return 0;

        //resetPool();

        C3D_FrameBegin(C3D_FRAME_SYNCDRAW);

        C3D_FrameDrawOn(self->GetTarget()->GetTarget());

        C3D_FVUnifMtx4x4(GPU_VERTEX_SHADER, projection_desc, self->GetProjection());

        lastCanvas = self;
    }
    else
    {
        if (lastCanvas != nullptr)
            C3D_FrameEnd(0);
    }

    return 0;
}

Edit: added the rendertarget creation code and fixed the indentations

from citro3d.

TurtleP avatar TurtleP commented on June 15, 2024

Sorry to bug you, but has there been any progress on finding the cause?

from citro3d.

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.