@@ -27,17 +27,18 @@ layout(location = 4) flat out uint drawID; //TODO: override main
27
27
28
28
vec4 nbl_glsl_decodeRGB10A2_UNORM(in uint x)
29
29
{
30
- const uvec3 rgbMask = uvec3(0x3ffu);
31
30
const uvec4 shifted = uvec4(x,uvec3(x)>>uvec3(10,20,30));
32
- return vec4(vec3(shifted.rgb&rgbMask),shifted.a)/vec4(vec3(rgbMask),3.0);
31
+ const uvec4 rgbaMask = uvec4(uvec3(0x3ffu),0x3u);
32
+ return vec4(shifted&rgbaMask)/vec4(rgbaMask);
33
33
}
34
34
35
35
vec4 nbl_glsl_decodeRGB10A2_SNORM(in uint x)
36
36
{
37
- uvec4 shifted = uvec4(x,uvec3(x)>>uvec3(10,20,30));
38
- const uvec3 rgbMask = uvec3(0x3ffu);
39
- const uvec3 rgbBias = uvec3(0x200u);
40
- return max(vec4(vec3(shifted.rgb&rgbMask)-rgbBias,float(shifted.a)-2.0)/vec4(vec3(rgbBias-uvec3(1u)),1.0),vec4(-1.0));
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));
41
42
}
42
43
43
44
//pos
@@ -702,7 +703,16 @@ int main()
702
703
return {};
703
704
704
705
// sort meshbuffers by pipeline
705
- std::sort (meshBuffers.begin (),meshBuffers.end (),[](const auto & lhs, const auto & rhs){return lhs->getPipeline ()<rhs->getPipeline ();});
706
+ std::sort (meshBuffers.begin (),meshBuffers.end (),[](const auto & lhs, const auto & rhs)
707
+ {
708
+ auto lPpln = lhs->getPipeline ();
709
+ auto rPpln = rhs->getPipeline ();
710
+ // render non-transparent things first
711
+ if (lPpln->getBlendParams ().blendParams [0 ].blendEnable <rPpln->getBlendParams ().blendParams [0 ].blendEnable )
712
+ return true ;
713
+ return lPpln<rPpln;
714
+ }
715
+ );
706
716
707
717
core::vector<MbPipelineRange> output;
708
718
core::smart_refctd_ptr<ICPURenderpassIndependentPipeline> mbPipeline = nullptr ;
0 commit comments