Skip to content

Conversation

heinezen
Copy link
Member

@heinezen heinezen commented Oct 5, 2024

Fixes a small bug in the storage of the texture to tex unit bindings in the shader program.

auto &tex_value = *this->textures_per_texunits[tex_unit_id];
tex_value = tex;
break;

The current code (see above) assumes that there always exists a binding from tex unit to texture and the std::optional type always contains a value. However, this is not always the case, e.g. when the shader is first initialized and no textures have been bound yet. We also wouldn't need to use std::optional then, don't we?

@heinezen heinezen added area: renderer Concerns our graphics renderer lang: c++ Done in C++ code bugfix Restores intended behavior labels Oct 5, 2024
@heinezen heinezen requested a review from TheJJ October 5, 2024 22:43
@heinezen heinezen force-pushed the fix/texunit_binding branch from dbc1804 to 65af9a8 Compare October 5, 2024 22:43
@heinezen heinezen force-pushed the fix/texunit_binding branch from 65af9a8 to 03c1592 Compare October 5, 2024 22:45
@TheJJ TheJJ merged commit fb88dfc into SFTtech:master Oct 6, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: renderer Concerns our graphics renderer bugfix Restores intended behavior lang: c++ Done in C++ code
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants