Skip to content

Conversation

@Yanrishatum
Copy link
Contributor

Allows writing to array types as it is legal in both GLSL(+WGL) and HLSL.
Feature requested by tee from Discord.

Same as #1127 I tested it on SDL, DX and JS targets, and there are no compatibility issues.

Test shader used:

class WriteShader extends hxsl.Shader {

	static var SRC = {

		var pixelColor: Vec4;

		function fragment()
		{
			var p:Array<Vec2,3> = [vec2(0.0),vec2(0.0),vec2(0.0)];

			var i = 0;
			p[i]=vec2(1.0,1.0);

			var g = vec2(1.0,1.0);
			p[1]=g;

			pixelColor = vec4(p[0].x,p[1].y,p[2].x,1.0);
		}
	}

}

@skial skial mentioned this pull request Feb 15, 2023
1 task
@onehundredfeet
Copy link
Contributor

Are there any edge cases for this? i.e. are there any versions of GL / DX that glitch on it? It looks pretty safe.

@Yanrishatum
Copy link
Contributor Author

Yanrishatum commented Mar 14, 2023

Are there any edge cases for this?

Not that I'm aware of no. Nor do I know of any glitches with array writes in either GL/DX/WGL.

@ncannasse
Copy link
Member

The patch seems too restrictive as it only supports TArray(TVar(v)) and I think that some cases are thus not correctly supported, such as arrays of arrays ?

@Yanrishatum
Copy link
Contributor Author

such as arrays of arrays

Arrays of arrays are GL4+ core feature and requires ARB_arrays_of_arrays on lower version. And its support on WebGL is dubious as well, as WGL2 is ES3.0, while array of arrays extension is supported only since ES3.1, therefore there's no support of nested arrays.

@ncannasse ncannasse merged commit 8bdee02 into HeapsIO:master Mar 16, 2023
@ncannasse
Copy link
Member

Seems good then, thanks !

@Yanrishatum Yanrishatum deleted the hxsl_array_write branch March 16, 2023 08:57
Sunjammer pushed a commit to Sunjammer/heaps that referenced this pull request Apr 5, 2023
lbergman pushed a commit to HacksawStudios/heaps that referenced this pull request Nov 26, 2024
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.

3 participants