glsl: format white space + comment

This commit is contained in:
Gregory Hainaut 2015-04-25 12:46:59 +02:00
parent 757726bb91
commit 15ae9996bb
2 changed files with 386 additions and 390 deletions

View File

@ -80,18 +80,14 @@ layout(binding = 3) uniform sampler2D RtSampler; // note 2 already use by the im
#if PS_DATE > 0
// FIXME how to declare memory access
layout(r32i, binding = 2) coherent uniform iimage2D img_prim_min;
layout(early_fragment_tests) in;
// origin_upper_left
layout(pixel_center_integer) in vec4 gl_FragCoord;
#endif
#else
// use basic stencil
#endif
#ifndef DISABLE_GL42_image
#if PS_DATE > 0
// origin_upper_left
layout(pixel_center_integer) in vec4 gl_FragCoord;
//in int gl_PrimitiveID;
#endif
#endif
layout(std140, binding = 21) uniform cb21
{
@ -442,14 +438,16 @@ void ps_main()
// DATM == 0
// Pixel with alpha equal to 1 will failed
float rt_a = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0).a;
if ((127.5f / 255.0f) < rt_a) // < 0x80 pass (== 0x80 should not pass)
if ((127.5f / 255.0f) < rt_a) { // < 0x80 pass (== 0x80 should not pass)
discard;
}
#elif (PS_DATE & 3) == 2 && !defined(DISABLE_GL42_image)
// DATM == 1
// Pixel with alpha equal to 0 will failed
float rt_a = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0).a;
if(rt_a < (127.5f / 255.0f)) // >= 0x80 pass
if(rt_a < (127.5f / 255.0f)) { // >= 0x80 pass
discard;
}
#endif
#if PS_DATE == 3 && !defined(DISABLE_GL42_image)
@ -489,13 +487,13 @@ void ps_main()
// Get first primitive that will write a failling alpha value
#if PS_DATE == 1 && !defined(DISABLE_GL42_image)
// DATM == 0
// Pixel with alpha equal to 1 will failed
// Pixel with alpha equal to 1 will failed (128-255)
if (c.a > 127.5f / 255.0f) {
imageAtomicMin(img_prim_min, ivec2(gl_FragCoord.xy), gl_PrimitiveID);
}
#elif PS_DATE == 2 && !defined(DISABLE_GL42_image)
// DATM == 1
// Pixel with alpha equal to 0 will failed
// Pixel with alpha equal to 0 will failed (0-127)
if (c.a < 127.5f / 255.0f) {
imageAtomicMin(img_prim_min, ivec2(gl_FragCoord.xy), gl_PrimitiveID);
}

View File

@ -829,18 +829,14 @@ static const char* tfx_fs_all_glsl =
"#if PS_DATE > 0\n"
"// FIXME how to declare memory access\n"
"layout(r32i, binding = 2) coherent uniform iimage2D img_prim_min;\n"
"layout(early_fragment_tests) in;\n"
"// origin_upper_left\n"
"layout(pixel_center_integer) in vec4 gl_FragCoord;\n"
"#endif\n"
"#else\n"
"// use basic stencil\n"
"#endif\n"
"\n"
"#ifndef DISABLE_GL42_image\n"
"#if PS_DATE > 0\n"
"// origin_upper_left\n"
"layout(pixel_center_integer) in vec4 gl_FragCoord;\n"
"//in int gl_PrimitiveID;\n"
"#endif\n"
"#endif\n"
"\n"
"layout(std140, binding = 21) uniform cb21\n"
"{\n"
@ -1191,14 +1187,16 @@ static const char* tfx_fs_all_glsl =
" // DATM == 0\n"
" // Pixel with alpha equal to 1 will failed\n"
" float rt_a = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0).a;\n"
" if ((127.5f / 255.0f) < rt_a) // < 0x80 pass (== 0x80 should not pass)\n"
" if ((127.5f / 255.0f) < rt_a) { // < 0x80 pass (== 0x80 should not pass)\n"
" discard;\n"
" }\n"
"#elif (PS_DATE & 3) == 2 && !defined(DISABLE_GL42_image)\n"
" // DATM == 1\n"
" // Pixel with alpha equal to 0 will failed\n"
" float rt_a = texelFetch(RtSampler, ivec2(gl_FragCoord.xy), 0).a;\n"
" if(rt_a < (127.5f / 255.0f)) // >= 0x80 pass\n"
" if(rt_a < (127.5f / 255.0f)) { // >= 0x80 pass\n"
" discard;\n"
" }\n"
"#endif\n"
"\n"
"#if PS_DATE == 3 && !defined(DISABLE_GL42_image)\n"
@ -1238,13 +1236,13 @@ static const char* tfx_fs_all_glsl =
" // Get first primitive that will write a failling alpha value\n"
"#if PS_DATE == 1 && !defined(DISABLE_GL42_image)\n"
" // DATM == 0\n"
" // Pixel with alpha equal to 1 will failed\n"
" // Pixel with alpha equal to 1 will failed (128-255)\n"
" if (c.a > 127.5f / 255.0f) {\n"
" imageAtomicMin(img_prim_min, ivec2(gl_FragCoord.xy), gl_PrimitiveID);\n"
" }\n"
"#elif PS_DATE == 2 && !defined(DISABLE_GL42_image)\n"
" // DATM == 1\n"
" // Pixel with alpha equal to 0 will failed\n"
" // Pixel with alpha equal to 0 will failed (0-127)\n"
" if (c.a < 127.5f / 255.0f) {\n"
" imageAtomicMin(img_prim_min, ivec2(gl_FragCoord.xy), gl_PrimitiveID);\n"
" }\n"