Skip to content

common: Implement ShaderLocation#21

Merged
MonsterDruide1 merged 4 commits into
open-ead:masterfrom
MonsterDruide1:ShaderLocation
May 16, 2026
Merged

common: Implement ShaderLocation#21
MonsterDruide1 merged 4 commits into
open-ead:masterfrom
MonsterDruide1:ShaderLocation

Conversation

@MonsterDruide1
Copy link
Copy Markdown
Contributor

@MonsterDruide1 MonsterDruide1 commented Jan 21, 2026

I felt like decompiling something today. @tetraxile recently posted some headers for these two classes into the discord, so why not take that as inspiration and persist them at the right location in the repo?

The ShaderBinary struct seems to be platform-specific - the Wii-specific repos use GX2 variants there, which have a different layout. More research on the file format would need to be done, followed by properly adding that struct somewhere else - so I've kept it as TODO for now.


This change is Reviewable

@MonsterDruide1 MonsterDruide1 self-assigned this Jan 21, 2026
Copy link
Copy Markdown
Contributor

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 reviewed 2 files and made 5 comments.
Reviewable status: 2 of 5 files reviewed, 5 unresolved discussions (waiting on MonsterDruide1).


src/common/aglShaderLocation.cpp line 23 at r1 (raw file):

}

UniformBlockLocation::~UniformBlockLocation() = default;

lazy. Move it to the header

Code quote:

UniformBlockLocation::~UniformBlockLocation() = default;

src/common/aglShaderLocation.cpp line 31 at r1 (raw file):

    const Shader& shader = program.getShader(type);
    const void* data = shader.getShaderBinary();

Suggestion:

    const void* data = program.getShader(type).getShaderBinary();

src/common/aglShaderLocation.cpp line 52 at r1 (raw file):

        return -1;

    UniformBlock* uniformBlocks = shaderBinary->uniformBlocks;

Generated by the compiler


src/common/aglShaderLocation.cpp line 55 at r1 (raw file):

    // TODO: probably an inlined search function returning UniformBlock*
    for (u32 i = 0; i < numUniformBlocks; i++) {

Suggestion:

    for (u32 i = 0; i < shaderBinary->numUniformBlocks; i++) {
        UniformBlock* uniformBlocks = shaderBinary->uniformBlocks;

src/common/aglShaderLocation.cpp line 59 at r1 (raw file):

            if (&uniformBlocks[i])
                return uniformBlocks[i].location;
            return -1;

Suggestion:

break;

MonsterDruide1 and others added 3 commits May 15, 2026 21:15
Co-authored-by: tetraxile <tetraxile@proton.me>
Copy link
Copy Markdown
Contributor Author

@MonsterDruide1 MonsterDruide1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonsterDruide1 made 5 comments.
Reviewable status: 2 of 5 files reviewed, 5 unresolved discussions (waiting on german77 and MonsterDruide1).


src/common/aglShaderLocation.cpp line 23 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

lazy. Move it to the header

Done.


src/common/aglShaderLocation.cpp line 52 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

Generated by the compiler

Done.


src/common/aglShaderLocation.cpp line 31 at r1 (raw file):

    const Shader& shader = program.getShader(type);
    const void* data = shader.getShaderBinary();

Done.


src/common/aglShaderLocation.cpp line 55 at r1 (raw file):

    // TODO: probably an inlined search function returning UniformBlock*
    for (u32 i = 0; i < numUniformBlocks; i++) {

Done.


src/common/aglShaderLocation.cpp line 59 at r1 (raw file):

            if (&uniformBlocks[i])
                return uniformBlocks[i].location;
            return -1;

Done.

Copy link
Copy Markdown
Contributor

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 made 2 comments and resolved 3 discussions.
Reviewable status: 2 of 5 files reviewed, 2 unresolved discussions (waiting on MonsterDruide1).


src/common/aglShaderLocation.cpp line 52 at r1 (raw file):

Previously, MonsterDruide1 wrote…

Done.

No. The whole block that I selected can be deleted including the early return


src/common/aglShaderLocation.cpp line 55 at r1 (raw file):

Previously, MonsterDruide1 wrote…

Done.

No. See for loop boundary. Is a direct reference from the shaderBinary

Copy link
Copy Markdown
Contributor Author

@MonsterDruide1 MonsterDruide1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonsterDruide1 made 2 comments.
Reviewable status: 2 of 5 files reviewed, 2 unresolved discussions (waiting on german77 and MonsterDruide1).


src/common/aglShaderLocation.cpp line 52 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

No. The whole block that I selected can be deleted including the early return

Ah, I didn't check the diff, just the suggestion view.


src/common/aglShaderLocation.cpp line 55 at r1 (raw file):

Previously, german77 (Narr the Reg) wrote…

No. See for loop boundary. Is a direct reference from the shaderBinary

Done.

Copy link
Copy Markdown
Contributor

@german77 german77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@german77 reviewed 3 files and all commit messages, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on MonsterDruide1).

@MonsterDruide1 MonsterDruide1 merged commit 74a6594 into open-ead:master May 16, 2026
2 checks passed
@MonsterDruide1 MonsterDruide1 deleted the ShaderLocation branch May 16, 2026 10:05
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

Successfully merging this pull request may close these issues.

2 participants