File tree Expand file tree Collapse file tree 2 files changed +10
-16
lines changed
examples_tests/41.VisibilityBuffer
include/nbl/builtin/glsl/format Expand file tree Collapse file tree 2 files changed +10
-16
lines changed Original file line number Diff line number Diff line change 25
25
26
26
layout(location = 4) flat out uint drawID; //TODO: override main
27
27
28
- vec4 nbl_glsl_decodeRGB10A2_UNORM(in uint x)
29
- {
30
- const uvec4 shifted = uvec4(x,uvec3(x)>>uvec3(10,20,30));
31
- const uvec4 rgbaMask = uvec4(uvec3(0x3ffu),0x3u);
32
- return vec4(shifted&rgbaMask)/vec4(rgbaMask);
33
- }
34
-
35
- vec4 nbl_glsl_decodeRGB10A2_SNORM(in uint x)
36
- {
37
- const ivec4 shifted = ivec4(x,uvec3(x)>>uvec3(10u,20u,30u));
38
- const ivec4 rgbaBias = ivec4(ivec3(0x200u),0x2u);
39
- const ivec4 halfMask = rgbaBias-ivec4(1);
40
- const ivec4 signed = (-(shifted&rgbaBias))|(shifted&halfMask);
41
- return max(vec4(signed)/vec4(halfMask),vec4(-1.0));
42
- }
28
+ #include "nbl/builtin/glsl/format/decode.glsl"
43
29
44
30
//pos
45
31
layout(set = 0, binding = 0) uniform samplerBuffer MeshPackedDataFloat[2];
Original file line number Diff line number Diff line change @@ -44,12 +44,20 @@ vec3 nbl_glsl_decodeRGB18E7S3(in uvec2 x)
44
44
return v* scale;
45
45
}
46
46
47
- vec4 nbl_glsl_decodeRGB10A2 (in uint x)
47
+ vec4 nbl_glsl_decodeRGB10A2_UNORM (in uint x)
48
48
{
49
49
const uvec3 rgbMask = uvec3 (0x3ffu);
50
50
const uvec4 shifted = uvec4 (x,uvec3 (x)>> uvec3 (10 ,20 ,30 ));
51
51
return vec4 (vec3 (shifted.rgb& rgbMask),shifted.a)/ vec4 (vec3 (rgbMask),3.0 );
52
52
}
53
+ vec4 nbl_glsl_decodeRGB10A2_SNORM(in uint x)
54
+ {
55
+ const ivec4 shifted = ivec4 (x, uvec3 (x) >> uvec3 (10u, 20u, 30u));
56
+ const ivec4 rgbaBias = ivec4 (ivec3 (0x200u), 0x2u);
57
+ const ivec4 halfMask = rgbaBias - ivec4 (1 );
58
+ const ivec4 signed = (- (shifted & rgbaBias)) | (shifted & halfMask);
59
+ return max (vec4 (signed) / vec4 (halfMask), vec4 (- 1.0 ));
60
+ }
53
61
54
62
55
63
nbl_glsl_quaternion_t nbl_glsl_decode8888Quaternion(in uint x)
You can’t perform that action at this time.
0 commit comments