1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Implement global and per instance shader uniforms.

Adds two keywords to shader language for uniforms:
-'global'
-'instance'

This allows them to reference values outside the material.
This commit is contained in:
Juan Linietsky
2020-04-16 23:52:00 -03:00
parent 30ab5c9baa
commit 0e1c66d9fc
49 changed files with 3124 additions and 69 deletions

View File

@@ -132,6 +132,11 @@ layout(set = 2, binding = 6) uniform sampler shadow_sampler;
#endif
layout(set = 2, binding = 7, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
global_variables;
/* SET3: Render Target Data */
#ifdef SCREEN_TEXTURE_USED

View File

@@ -134,7 +134,7 @@ struct InstanceData {
mat4 transform;
mat4 normal_transform;
uint flags;
uint instance_ofs; //instance_offset in instancing/skeleton buffer
uint instance_uniforms_ofs; //base offset in global buffer for instance variables
uint gi_offset; //GI information when using lightmapping (VCT or lightmap)
uint layer_mask;
};
@@ -287,6 +287,11 @@ cluster_data;
layout(set = 0, binding = 15) uniform texture2D directional_shadow_atlas;
layout(set = 0, binding = 16, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
global_variables;
// decal atlas
/* Set 1, Radiance */

View File

@@ -58,6 +58,11 @@ params;
layout(set = 0, binding = 0) uniform sampler material_samplers[12];
layout(set = 0, binding = 1, std430) restrict readonly buffer GlobalVariableData {
vec4 data[];
}
global_variables;
#ifdef USE_MATERIAL_UNIFORMS
layout(set = 1, binding = 0, std140) uniform MaterialUniforms{
/* clang-format off */