{{newin|[[0.9.0]]|090|type=function|text=It has been renamed from [[PixelEffect:send]]}}
Sends one or more values to a special (''uniform'') variable inside the shader. Uniform variables have to be marked using the ''uniform'' or ''extern'' keyword, e.g.

<source lang="glsl">
uniform float time;  // "float" is the typical number type used in GLSL shaders.
uniform float vars[2];
uniform vec2 light_pos;
uniform vec4 colors[4];
</source>

The corresponding send calls would be

<source lang="lua">
shader:send("time", t)
shader:send("vars",a,b)
shader:send("light_pos", {light_x, light_y})
shader:send("colors", {r1, g1, b1, a1},  {r2, g2, b2, a2},  {r3, g3, b3, a3},  {r4, g4, b4, a4})
</source>


Uniform / extern variables are read-only in the shader code and remain constant until modified by a Shader:send call. Uniform variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each.

{{notice|There is a bug in version [[0.10.2]] which causes Shader:send to ignore the last argument when sending arrays. A simple workaround is to add an extra dummy argument when sending multiple values to a uniform array.}}

== 関数 ==
=== 概要 ===
<source lang="lua">
Shader:send( name, number, ... )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the number to send to the shader.}}
{{param (日本語)|number|number|Number to send to store in the uniform variable.}}
{{param (日本語)|number|...|Additional numbers to send if the uniform variable is an array.}}
=== 返値 ===
ありません。
=== 注釈 ===
Because all numbers in Lua are floating point, in versions prior to [[0.10.2]] you must use the function [[Shader:sendInt]] to send values to <code>uniform int</code> variables in the shader's code.

== 関数 ==
=== 概要 ===
<source lang="lua">
Shader:send( name, vector, ... )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the vector to send to the shader.}}
{{param (日本語)|table|vector|Numbers to send to the uniform variable as a vector. The number of elements in the table determines the type of the vector (e.g. two numbers -> vec2). At least two and at most four numbers can be used.}}
{{param (日本語)|table|...|Additional vectors to send if the uniform variable is an array. All vectors need to be of the same size (e.g. only vec3's).}}

=== 返値 ===
ありません。

== 関数 ==
=== 概要 ===
<source lang="lua">
Shader:send( name, matrix, ... )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the matrix to send to the shader.}}
{{param (日本語)|table|matrix|2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: <code><nowiki>{{a,b,c,d}, {e,f,g,h}, ... }</nowiki></code> or (since version [[0.10.2]]) <code>{a,b,c,d, e,f,g,h, ...}</code>. The order in 0.10.2 is column-major; starting in [[11.0]] it's row-major instead.}}
{{param (日本語)|table|...|Additional matrices of the same type as ''matrix'' to store in a uniform array.}}

=== 返値 ===
ありません。

== 関数 ==
=== 概要 ===
<source lang="lua">
Shader:send( name, texture )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the [[Texture]] to send to the shader.}}
{{param (日本語)|Texture|texture|Texture ([[Image]] or [[Canvas]]) to send to the uniform variable.}}
=== 返値 ===
ありません。

== 関数 ==
=== 概要 ===
<source lang="lua">
Shader:send( name, boolean, ... )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the boolean to send to the shader.}}
{{param (日本語)|boolean|boolean|Boolean to send to store in the uniform variable.}}
{{param (日本語)|boolean|...|Additional booleans to send if the uniform variable is an array.}}
=== 返値 ===
ありません。

== 関数 ==
{{newin (日本語)|[[11.0 (日本語)|11.0]]|110|type=異形}}
=== 概要 ===
<source lang="lua">
Shader:send( name, matrixlayout, matrix, ... )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the matrix to send to the shader.}}
{{param (日本語)|MatrixLayout|matrixlayout|The layout (row- or column-major) of the matrix.}}
{{param (日本語)|table|matrix|2x2, 3x3, or 4x4 matrix to send to the uniform variable. Using table form: <code><nowiki>{{a,b,c,d}, {e,f,g,h}, ... }</nowiki></code> or <code>{a,b,c,d, e,f,g,h, ...}</code>.}}
{{param (日本語)|table|...|Additional matrices of the same type as ''matrix'' to store in a uniform array.}}

== 関数 ==
{{newin (日本語)|[[11.0 (日本語)|11.0]]|110|type=異形}}
Sends uniform values to the Shader sourced from the contents of a [[Data]] object. This directly copies the bytes of the data.
=== 概要 ===
<source lang="lua">
Shader:send( name, data, offset, size )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the uniform to send to the shader.}}
{{param (日本語)|Data|data|Data object containing the values to send.}}
{{param (日本語)|number|offset (0)|Offset in bytes from the start of the Data object.}}
{{param (日本語)|number|size (all)|Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied.}}
=== 返値 ===
ありません。

== 関数 ==
{{newin (日本語)|[[11.0 (日本語)|11.0]]|110|type=異形}}
Sends uniform matrices to the Shader sourced from the contents of a [[Data]] object. This directly copies the bytes of the data.
=== 概要 ===
<source lang="lua">
Shader:send( name, data, matrixlayout, offset, size )
</source>
=== 引数 ===
{{param (日本語)|string|name|Name of the uniform matrix to send to the shader.}}
{{param (日本語)|Data|data|Data object containing the values to send.}}
{{param (日本語)|MatrixLayout|matrixlayout|The layout (row- or column-major) of the matrix in memory.}}
{{param (日本語)|number|offset (0)|Offset in bytes from the start of the Data object.}}
{{param (日本語)|number|size (all)|Size in bytes of the data to send. If nil, as many bytes as the specified uniform uses will be copied.}}
=== 返値 ===
ありません。

== 関連 ==
* [[parent::Shader (日本語)]]
[[Category:Functions (日本語)]]
{{#set:Description=Sends one or more values to the shader.}}

== そのほかの言語 ==
{{i18n (日本語)|Shader:send}}