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

Ensure members are initialized in compatibility renderer SceneShaderData #84599

Closed
wants to merge 1 commit into from

Conversation

RoyBerube
Copy link
Contributor

Fixes issue #84418

Boolean variables that were uninitialized in the struct SceneShaderData could cause an error message if never set to a value.

This fixes the problem by initializing all boolean variables of SceneShaderData to false in the constructor. This avoids the errors caused by using undefined values.

@RoyBerube RoyBerube requested a review from a team as a code owner November 8, 2023 02:35
@Chaosus Chaosus added this to the 4.3 milestone Nov 8, 2023
@AThousandShips AThousandShips changed the title Fix for error messages in compatibility renderer Ensure values are initialized in compatibility renderer SceneShaderData Nov 8, 2023
@AThousandShips AThousandShips changed the title Ensure values are initialized in compatibility renderer SceneShaderData Ensure members are initialized in compatibility renderer SceneShaderData Nov 8, 2023
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

These variable need to be initialized every time that set_code() is called. It isn't enough to initialize them when the class is created for the first time since set_code() can be called multiple times.

You can see that most properties are correctly initialized at the top of set_code():

unshaded = false;
uses_vertex = false;
uses_position = false;
uses_sss = false;
uses_transmittance = false;
uses_screen_texture = false;
uses_depth_texture = false;
uses_normal_texture = false;
uses_time = false;
writes_modelview_or_projection = false;
uses_world_coordinates = false;
uses_particle_trails = false;

We just need to initialize the rest in the same place

@akien-mga
Copy link
Member

Superseded by #84752, which takes the approach recommended by @clayjohn, and applies the same treatment to all other ShaderData classes.

@akien-mga akien-mga closed this Nov 11, 2023
@akien-mga akien-mga modified the milestones: 4.3, 4.2 Nov 11, 2023
@AThousandShips AThousandShips removed this from the 4.2 milestone Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants