]> git.tdb.fi Git - libs/gl.git/commitdiff
Annotate uniforms with descriptor set layout qualifiers
authorMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 11:27:47 +0000 (13:27 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 16 Mar 2022 11:27:47 +0000 (13:27 +0200)
Higher numbered sets are used for data which is expected to change
more often.

13 files changed:
builtin_data/_ambientocclusion.glsl
builtin_data/_bloom.glsl
builtin_data/_colorcurve.glsl
builtin_data/_pbr_prefilter.glsl
builtin_data/_sky.glsl
builtin_data/_sky_backdrop.glsl
shaderlib/common.glsl
shaderlib/cooktorrance.glsl
shaderlib/msp_interface.glsl
shaderlib/occluder.glsl
shaderlib/phong.glsl
shaderlib/shadow.glsl
shaderlib/unlit.glsl

index ecdaed7a46256e1101cc5b332d8ad2001f6b499c..0fca6bb2a4b34c72d5e3efda18ff55e35a08496f 100644 (file)
@@ -1,6 +1,6 @@
 const int max_samples = 128;
 
-uniform CameraTransform
+layout(set=0) uniform CameraTransform
 {
        mat4 eye_world_matrix;
        mat4 world_eye_matrix;
@@ -8,11 +8,11 @@ uniform CameraTransform
        mat4 eye_clip_matrix;
 };
 
-uniform sampler2D source;
-uniform sampler2D depth;
-uniform sampler2D occlusion;
-uniform sampler2D rotate;
-uniform AmbientOcclusionParams
+layout(set=2) uniform sampler2D source;
+layout(set=2) uniform sampler2D depth;
+layout(set=2) uniform sampler2D occlusion;
+layout(set=2) uniform sampler2D rotate;
+layout(set=2) uniform AmbientOcclusionParams
 {
        float darkness;
        vec3 sample_points[max_samples];
index f261cc1dd7bed317b1c9173ed99b6b3021a7c375..21da92355e24690fe316d932201f4053e2c7c195 100644 (file)
@@ -1,12 +1,12 @@
-uniform sampler2D source;
-uniform sampler2D blurred;
-uniform BloomParams
+layout(set=2) uniform sampler2D source;
+layout(set=2) uniform sampler2D blurred;
+layout(set=2) uniform BloomParams
 {
        float factors[19];
        int size;
        float strength;
 };
-uniform BloomPerPassParams
+layout(set=2) uniform BloomPerPassParams
 {
        uniform vec2 delta;
 };
index 9b6ae3627c38a03c724e101783f543ded7b2fd37..afa6ee32c45e4d315d752308b4516e3664a8b133 100644 (file)
@@ -1,13 +1,13 @@
 import flat_effect;
 
-uniform ToneMapping
+layout(set=2) uniform ToneMapping
 {
        float exposure;
        vec3 brightness_response;
 };
 
-uniform sampler2D source;
-uniform sampler1D curve;
+layout(set=2) uniform sampler2D source;
+layout(set=2) uniform sampler1D curve;
 
 #pragma MSP stage(fragment)
 layout(location=0) out vec4 frag_color;
index 50fde16557eeb5038a6259d0b50ad61d3bed2637..2d3b8f59a5290f1d9c7df305f4ee950a324322ea 100644 (file)
@@ -4,7 +4,7 @@ layout(push_constant) uniform PrecalcParams
        float roughness;
 };
 
-uniform samplerCube environment_map;
+layout(set=0) uniform samplerCube environment_map;
 
 vec2 hammersley(int i, int count)
 {
index 1dbda5793f2d838018b1f8558ede2da7f03437da..4ece8e579a3f7ad5e186e21a5793ebdaef3e0263 100644 (file)
@@ -6,7 +6,7 @@ struct AtmosphericEvents
        vec3 ozone_absorb;
 };
 
-uniform Atmosphere
+layout(set=2) uniform Atmosphere
 {
        AtmosphericEvents events;
        float rayleigh_density_decay;
@@ -19,7 +19,7 @@ uniform Atmosphere
        int n_steps;
 };
 
-uniform View
+layout(set=2) uniform View
 {
        float view_height;
        vec4 light_color;
@@ -34,7 +34,7 @@ struct OpticalPathInfo
 
 const float mie_asymmetry = 0.8;
 
-uniform sampler2D transmittance_lookup;
+layout(set=2) uniform sampler2D transmittance_lookup;
 
 vec3 rayleigh_density(vec3 base, float height)
 {
index fa8f1be5b31d32678d287f70a29c37e4cffea509..8e90d91ccb7aeec9c6624421f69b1acd1921c564 100644 (file)
@@ -1,7 +1,7 @@
 import msp_interface;
 import _sky;
 
-uniform sampler2D distant;
+layout(set=2) uniform sampler2D distant;
 
 #pragma MSP stage(vertex)
 void main()
index 557d4d76a17cff24ef538946d8d95e531d5c099d..44ef150acc314c746041ba1c74e5338c287e190f 100644 (file)
@@ -1,14 +1,14 @@
 import msp_interface;
 import shadow;
 
-uniform EnvMap
+layout(set=0) uniform EnvMap
 {
        mat3 env_world_matrix;
 };
 
-uniform sampler2D normal_map;
-uniform samplerCube environment_map;
-uniform samplerCube irradiance_map;
+layout(set=1) uniform sampler2D normal_map;
+layout(set=0) uniform samplerCube environment_map;
+layout(set=0) uniform samplerCube irradiance_map;
 
 layout(constant_id=auto) const bool use_normal_map = false;
 
index ad1a459d2e32932d9cb79a0501fb339b5ad6b7ba..fe6179b783ba27fc50fdb164e5e6ba30f3536832 100644 (file)
@@ -10,18 +10,18 @@ struct PbrMaterialParameters
        float roughness;
 };
 
-uniform PbrMaterial
+layout(set=1) uniform PbrMaterial
 {
        PbrMaterialParameters pbr_material;
        float alpha_cutoff;
 };
 
-uniform sampler2D base_color_map;
-uniform sampler2D metalness_map;
-uniform sampler2D roughness_map;
-uniform sampler2D occlusion_map;
-uniform sampler2D emission_map;
-uniform sampler2D fresnel_lookup;
+layout(set=1) uniform sampler2D base_color_map;
+layout(set=1) uniform sampler2D metalness_map;
+layout(set=1) uniform sampler2D roughness_map;
+layout(set=1) uniform sampler2D occlusion_map;
+layout(set=1) uniform sampler2D emission_map;
+layout(set=1) uniform sampler2D fresnel_lookup;
 
 layout(constant_id=auto) const bool use_base_color_map = false;
 layout(constant_id=auto) const bool use_metalness_map = false;
index 3ad27c43351aff10ad3ad9a8bee164098563b06e..5ecb4f82631c365817fbb1ecd956bcf503e13250 100644 (file)
@@ -11,7 +11,7 @@ layout(push_constant) uniform ObjectTransform
        mat4 world_obj_matrix;
        mat3 world_obj_normal_matrix;
 };
-uniform CameraTransform
+layout(set=0) uniform CameraTransform
 {
        mat4 eye_world_matrix;
        mat4 world_eye_matrix;
@@ -20,7 +20,7 @@ uniform CameraTransform
 };
 
 const int max_lights = 6;
-uniform Lighting
+layout(set=0) uniform Lighting
 {
        LightSourceParameters light_sources[max_lights];
        vec4 ambient_color;
index abd29a0aaa07dde0db265fd95eec33d4464aed9d..6d6cd56074e7c67aa1f3d9fc3eb2e525fd75fef1 100644 (file)
@@ -1,11 +1,11 @@
 import msp_interface;
 
-uniform AlphaCutoff
+layout(set=1) uniform AlphaCutoff
 {
        float alpha_cutoff;
 };
 
-uniform sampler2D alpha_map;
+layout(set=1) uniform sampler2D alpha_map;
 
 layout(constant_id=auto) const bool use_alpha_cutoff = false;
 
index 234897116183a4997c625687447b65172ef8036d..28e9e5007be0af9c7e706353d2a67c16ea965ab2 100644 (file)
@@ -11,17 +11,17 @@ struct BasicMaterialParameters
        float reflectivity;
 };
 
-uniform BasicMaterial
+layout(set=1) uniform BasicMaterial
 {
        BasicMaterialParameters basic_material;
        float alpha_cutoff;
 };
 
-uniform sampler2D diffuse_map;
-uniform sampler2D specular_map;
-uniform sampler2D shininess_map;
-uniform sampler2D emission_map;
-uniform sampler2D reflectivity_map;
+layout(set=1) uniform sampler2D diffuse_map;
+layout(set=1) uniform sampler2D specular_map;
+layout(set=1) uniform sampler2D shininess_map;
+layout(set=1) uniform sampler2D emission_map;
+layout(set=1) uniform sampler2D reflectivity_map;
 
 layout(constant_id=auto) const bool use_diffuse_map = false;
 layout(constant_id=auto) const bool use_specular = false;
index 2e8a05b0889ab77464cc45e4324cc1e231c222d0..049ec188e5a97a67a6e42a6a87e5e3c315e284df 100644 (file)
@@ -9,13 +9,13 @@ struct ShadowParameters
        vec2 bias;
 };
 
-uniform ShadowMap
+layout(set=0) uniform ShadowMap
 {
        ShadowParameters shadows[max_lights];
        mat4 shd_world_matrix[max_lights*4];
 };
 
-uniform sampler2DShadow shadow_map;
+layout(set=0) uniform sampler2DShadow shadow_map;
 
 layout(constant_id=auto) const bool use_shadow_map = false;
 
index f4920a7982db397babd59fcc61e66dc725a55dbf..29cfd3f2cf0257874b40c0a0901e5ca9157bb9da 100644 (file)
@@ -6,13 +6,13 @@ struct UnlitMaterialParameters
        vec4 color;
 };
 
-uniform UnlitMaterial
+layout(set=1) uniform UnlitMaterial
 {
        UnlitMaterialParameters unlit_material;
        float alpha_cutoff;
 };
 
-uniform sampler2D color_tex;
+layout(set=1) uniform sampler2D color_tex;
 
 layout(constant_id=auto) const bool use_texture = false;
 layout(constant_id=auto) const bool use_vertex_color = false;