mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
[.NET] Use collection expressions
As of C# 12 we can now use collection expressions to reduce some boilerplate when initializing collections.
This commit is contained in:
@@ -220,7 +220,7 @@ So let's initialize an array of floats and create a storage buffer:
|
||||
.. code-tab:: csharp
|
||||
|
||||
// Prepare our data. We use floats in the shader, so we need 32 bit.
|
||||
var input = new float[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
|
||||
float[] input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
var inputBytes = new byte[input.Length * sizeof(float)];
|
||||
Buffer.BlockCopy(input, 0, inputBytes, 0, inputBytes.Length);
|
||||
|
||||
@@ -251,7 +251,7 @@ assign it to a uniform set which we can pass to our shader later.
|
||||
Binding = 0
|
||||
};
|
||||
uniform.AddId(buffer);
|
||||
var uniformSet = rd.UniformSetCreate(new Array<RDUniform> { uniform }, shader, 0);
|
||||
var uniformSet = rd.UniformSetCreate([uniform], shader, 0);
|
||||
|
||||
|
||||
Defining a compute pipeline
|
||||
|
||||
Reference in New Issue
Block a user