Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too many temp register is used in Geometry shader, it may cause slow execution. #2

Open
Libaier opened this issue Jun 12, 2013 · 2 comments

Comments

@Libaier
Copy link

Libaier commented Jun 12, 2013

When I run the program , I got the warning "Too many temp register is used in Geometry shader , it may cause slow execution." in the file "KoRE_log.txt".I think maybe I can solve the problem by modify some parameters.But I can't find the right one to modify,can you give me some advice?

I am a beginner in the GPU programming area. Is there any tools can implement "shader debugging" in vs2012?

By the way,you really did an awesome job on this project!
Libaier

@domme
Copy link
Owner

domme commented Jun 12, 2013

Hi!
This warning comes from the geometry shader that handles voxelization (voxelizeGeom.shader). In the most recent version, we fixed that issue by moving some matrix- and vector- calculations out of the shader to the CPU which are then passed to the shader as Uniforms. (Basically, we moved everything in the "init()"-function to the CPU).
I recommend to check out the latest versions of the project from this git-repo (and also the latest KoRE-version from my repo). To compile, you have to copy your "ext"-folder from your current project directory. And you should also copy the two .dlls in the "bin" folder in order to get it running ;)

We'll also provide the ext-folder as separate download soon.

To your other question: There are some debugging tools for GPU programming. Unfortunately, most of them crash when you use brand-new OpenGL functions (like we do). If you want to try it anyway, check out "AMD CodeXL" or "NVIDIA Parallel Nsight".

@Libaier
Copy link
Author

Libaier commented Jun 13, 2013

Thank you for answering my questions!

Well I have got a better result by check out your latest code.
When I load the scene "monkey.dae"
I can got the right result.
Well I changed the code to load the scene "sibenik.dae".
It crashed.
I debugged the program and found when the program came into the function

_backbufferStage->addProgramPass(new VoxelizePass(params.voxel_grid_sidelengths, &_vctScene, kore::EXECUTE_ONCE));

and run this code

    for (uint i = 0; i < vRenderNdoes.size(); ++i) {
        NodePass* nodePass = new NodePass(vRenderNdoes[i]);
        this->addNodePass(nodePass);


        MeshComponent* meshComp =
            static_cast<MeshComponent*>(vRenderNdoes[i]->getComponent(COMPONENT_MESH));

        nodePass
            ->addOperation(OperationFactory::create(OP_BINDATTRIBUTE, "v_position",
            meshComp, "v_position",
            voxelizeShader));
        nodePass
            ->addOperation(OperationFactory::create(OP_BINDATTRIBUTE, "v_normal",
            meshComp, "v_normal",
            voxelizeShader));
        nodePass
            ->addOperation(OperationFactory::create(OP_BINDATTRIBUTE, "v_uv0",
            meshComp, "v_uvw", voxelizeShader));
        nodePass
            ->addOperation(OperationFactory::create(OP_BINDUNIFORM, "model Matrix",
            vRenderNdoes[i]->getTransform(),
            "modelWorld",
            voxelizeShader));
        nodePass
            ->addOperation(OperationFactory::create(OP_BINDUNIFORM, "normal Matrix",
            vRenderNdoes[i]->getTransform(),
            "modelWorldNormal",
            voxelizeShader));

        const TexturesComponent* texComp =
            static_cast<TexturesComponent*>(
            vRenderNdoes[i]->getComponent(COMPONENT_TEXTURES));

        const Texture* tex = texComp->getTexture(0);

        nodePass
                ->addOperation(OperationFactory::create(OP_BINDTEXTURE, tex->getName(),
                texComp, "diffuseTex", voxelizeShader));
        nodePass
            ->addOperation(new RenderMesh(meshComp));
    }

when the parameter "i">=9
the parameter "texComp" was NULL,so it crashed.
I changed the code like this

    if(NULL!=texComp){
        const Texture* tex = texComp->getTexture(0);
        nodePass
            ->addOperation(OperationFactory::create(OP_BINDTEXTURE, tex->getName(),
            texComp, "diffuseTex", voxelizeShader));
    }

The program didn't crash but I got the massage "Dislay driver stopped responding and has recovered" from windows taskbar.
Have you ever got the same problem on your computer?Do you have an idea to solve the problem?

Greetings!
Libaier from China.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants