OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa
_intel.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa
_intel.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "gpu/command_buffer/service/framebuffer_manager.h" | 8 #include "gpu/command_buffer/service/framebuffer_manager.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 801 |
802 uvec4 UnpackEdge(uint value) { | 802 uvec4 UnpackEdge(uint value) { |
803 uvec4 ret; | 803 uvec4 ret; |
804 ret.x = (value & 0x01u) != 0u ? 1u : 0u; | 804 ret.x = (value & 0x01u) != 0u ? 1u : 0u; |
805 ret.y = (value & 0x02u) != 0u ? 1u : 0u; | 805 ret.y = (value & 0x02u) != 0u ? 1u : 0u; |
806 ret.z = (value & 0x04u) != 0u ? 1u : 0u; | 806 ret.z = (value & 0x04u) != 0u ? 1u : 0u; |
807 ret.w = (value & 0x08u) != 0u ? 1u : 0u; | 807 ret.w = (value & 0x08u) != 0u ? 1u : 0u; |
808 return ret; | 808 return ret; |
809 } | 809 } |
810 | 810 |
811 uint PackZ(const uvec2 screenPos, const bool invertedZShape) { | |
812 uint retVal = screenPos.x | (screenPos.y << 15u); | |
813 if (invertedZShape) | |
814 retVal |= (1u << 30u); | |
815 return retVal; | |
816 } | |
817 | |
818 void UnpackZ(uint packedZ, out uvec2 screenPos, | |
819 out bool invertedZShape) | |
820 { | |
821 screenPos.x = packedZ & 0x7FFFu; | |
822 screenPos.y = (packedZ >> 15u) & 0x7FFFu; | |
823 invertedZShape = (packedZ >> 30u) == 1u; | |
824 } | |
825 | |
826 uint PackZ(const uvec2 screenPos, | |
827 const bool invertedZShape, | |
828 const bool horizontal) { | |
829 uint retVal = screenPos.x | (screenPos.y << 15u); | |
830 if (invertedZShape) | |
831 retVal |= (1u << 30u); | |
832 if (horizontal) | |
833 retVal |= (1u << 31u); | |
834 return retVal; | |
835 } | |
836 | |
837 void UnpackZ(uint packedZ, | |
838 out uvec2 screenPos, | |
839 out bool invertedZShape, | |
840 out bool horizontal) { | |
841 screenPos.x = packedZ & 0x7FFFu; | |
842 screenPos.y = (packedZ >> 15u) & 0x7FFFu; | |
843 invertedZShape = (packedZ & (1u << 30u)) != 0u; | |
844 horizontal = (packedZ & (1u << 31u)) != 0u; | |
845 } | |
846 | |
847 vec4 PackBlurAAInfo(ivec2 pixelPos, uint shapeType) { | 811 vec4 PackBlurAAInfo(ivec2 pixelPos, uint shapeType) { |
848 uint packedEdges = uint( | 812 uint packedEdges = uint( |
849 texelFetch(g_src0TextureFlt, pixelPos, 0).r * 255.5); | 813 texelFetch(g_src0TextureFlt, pixelPos, 0).r * 255.5); |
850 | 814 |
851 float retval = float(packedEdges + (shapeType << 4u)); | 815 float retval = float(packedEdges + (shapeType << 4u)); |
852 | 816 |
853 return vec4(retval / 255.0); | 817 return vec4(retval / 255.0); |
854 } | 818 } |
855 | 819 |
856 void UnpackBlurAAInfo(float packedValue, out uint edges, | 820 void UnpackBlurAAInfo(float packedValue, out uint edges, |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 \n#endif\n | 1833 \n#endif\n |
1870 \n#if defined DISPLAY_EDGES\n | 1834 \n#if defined DISPLAY_EDGES\n |
1871 DisplayEdges(); | 1835 DisplayEdges(); |
1872 \n#endif\n | 1836 \n#endif\n |
1873 } | 1837 } |
1874 ); | 1838 ); |
1875 /* clang-format on */ | 1839 /* clang-format on */ |
1876 | 1840 |
1877 } // namespace gles2 | 1841 } // namespace gles2 |
1878 } // namespace gpu | 1842 } // namespace gpu |
OLD | NEW |