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

Added support for arrays as shader struct members #36141

Merged
merged 1 commit into from
Feb 12, 2020

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Feb 12, 2020

Allowed complex constructions like

shader_type canvas_item;

struct B {
	vec3 v;
	float k[1];
};

struct A
{
	float t[3];
	B b[2];
};

void fragment()
{
	A a = A( {0.0, 1.0, 0.0}, {B(vec3(1.0, 0.0, 1.0), {0.0}), B(vec3(0.0, 1.0, 0.0), {1.0})} );
	a.b[1].v[0] = 1.0;
	a.b[0] = B(vec3(1, 0, 1), {0.0});
	COLOR.rgb = a.b[0].v;
}

@Chaosus Chaosus requested a review from reduz as a code owner February 12, 2020 12:40
@Chaosus Chaosus added this to the 4.0 milestone Feb 12, 2020
@Chaosus Chaosus force-pushed the shader_struct_member_arrays branch 3 times, most recently from 4d9d978 to 5ddeab9 Compare February 12, 2020 13:57
@Chaosus
Copy link
Member Author

Chaosus commented Feb 12, 2020

I think its working good, I will add fixes if any of bugs happen.

@Chaosus Chaosus merged commit 4aa31a2 into godotengine:master Feb 12, 2020
@Chaosus Chaosus deleted the shader_struct_member_arrays branch February 12, 2020 17:12
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.

1 participant