1Conformance Test 2 3 GL_ARB_post_depth_coverage 4 5Contributors 6 7 Michal Butterweck, Mobica 8 9Contacts 10 11 Michal Butterweck, Mobica (michal.butterweck 'at' mobica.com) 12 13Status 14 15 In review 16 17Version 18 19 August 31, 2016 (version 1) 20 21Dependencies 22 23 This specification is written against: 24 - OpenGL 4.5 Core Profile specification, 25 - ARB_post_depth_coverage extension specification. 26 27Overview 28 29 The test verifies that when ARB_post_depth_coverage is available one can 30 use post_depth_coverage layout and gl_SampleMaskIn is affected according 31 to the extension specification. 32 33Tests 34 35 Shader 36 37 Check that macro construction: 38 #extension GL_ARB_post_depth_coverage : <behavior> 39 is allowed in the shader. 40 41 Check that a new preprocessor #define GL_ARB_post_depth_coverage is 42 available and equal to 1. 43 44 Prepare a proper shader with following layout setup: 45 layout(early_fragment_tests) in; 46 layout(post_depth_coverage) in; 47 Expect it builds without error. 48 49 Prepare a proper shader with following layout setup: 50 layout(post_depth_coverage) in; 51 Expect it builds without error. 52 53 Sample Mask 54 55 Prepare multisample framebuffer with integer color and depth attachments 56 1x1 pixels in size. A color attachment must be a texture. Clear it. 57 58 Prepare framebuffer with integer color attachment 1x(number of samples) 59 pixels in size. Clear it. 60 61 Prepare shader program which passes gl_SampleMaskIn to the output as a 62 color. 63 64 Prepare shader program which passes samples from multisample texture to 65 the output fragment. 66 67 Turn on depth test. 68 69 Enable multisampling. 70 71 Use multisample framebuffer. 72 73 Use first program. 74 75 Draw a figure which partially covers the pixels samples but does not 76 cover the pixel center. The dimensions of the figure may be dependent 77 on the results of GetMultisamplefv called with SAMPLE_POSITION pname. 78 The figure shall be placed at near view (eg. depth equal 0.25). 79 80 Clear the color attachment. 81 82 Draw a figure which fully covers the pixel area but is placed behind the 83 previous polygon (eg. at depth equal to 0.75). Do not use post depth 84 coverage. Output gl_SampleMaskIn to the the fragment. 85 86 Turn off depth test. 87 88 Use second framebuffer. 89 90 Use second program. 91 92 Bind first's frambuffer color attachment texture as an input to the 93 fragment shader. 94 95 Copy data from the multisample framebuffer to the second framebuffer 96 using the second program and draw call. Fetch value of gl_SampleMaskIn 97 from the second framebuffer using ReadPixels. Expect that for all 98 enabled samples corresponding gl_SampleMaskIn bit is set. 99 100 Repeat the test using post depth coverage layout for the second draw 101 call. Expect that bits in the gl_SampleMaskIn are only set for the 102 samples which are not covered by the first primitive. 103 104 Repeat both test cases substituting the depth test with the stencil 105 test. 106 107Revision History 108 109 Revision 1, 31 August, 2016 (Michal Butterweck) 110 - Initial version. 111 112