{"title":"Efficient Triangle and Quadrilateral Clipping Within Shaders","authors":"M. McGuire","doi":"10.1080/2151237X.2011.619891","DOIUrl":null,"url":null,"abstract":"Abstract Clipping a triangle or a convex quadrilateral to a plane is a common operation in computer graphics. This clipping is implemented by fixed function units within the graphics pipeline under most rasterization application programming interfaces (APIs). It is increasingly interesting to perform clipping in programmable stages as well. For example, to clip bounding volumes generated in the geometry unit to the near plane or to clip an area light source to the tangent plane of a surface in a pixel unit. Although clipping a convex polygon is algorithmically trivial, doing so efficiently on vector architectures such as GPUs can be tricky. This article presents an implementation of Sutherland-Hodgman clipping, designed for vector processors. It has high branch coherence, uses only register storage (i.e., it does not require a move-relative memory operation), leverages both data and instruction parallelism, and has a peak register count of only two 4-vectors (7 scalars). I found it to be approximately five times faster than direct Sutherland-Hodgman and to yield a 45% increase in net throughput when applied to the algorithm from a previous publication on two GPU architectures. The principles of optimization presented for this class of parallel algorithm extend to other algorithms and architectures.","PeriodicalId":354935,"journal":{"name":"Journal of Graphics, GPU, and Game Tools","volume":"174 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2011-11-08","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"4","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Graphics, GPU, and Game Tools","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1080/2151237X.2011.619891","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 4
Abstract
Abstract Clipping a triangle or a convex quadrilateral to a plane is a common operation in computer graphics. This clipping is implemented by fixed function units within the graphics pipeline under most rasterization application programming interfaces (APIs). It is increasingly interesting to perform clipping in programmable stages as well. For example, to clip bounding volumes generated in the geometry unit to the near plane or to clip an area light source to the tangent plane of a surface in a pixel unit. Although clipping a convex polygon is algorithmically trivial, doing so efficiently on vector architectures such as GPUs can be tricky. This article presents an implementation of Sutherland-Hodgman clipping, designed for vector processors. It has high branch coherence, uses only register storage (i.e., it does not require a move-relative memory operation), leverages both data and instruction parallelism, and has a peak register count of only two 4-vectors (7 scalars). I found it to be approximately five times faster than direct Sutherland-Hodgman and to yield a 45% increase in net throughput when applied to the algorithm from a previous publication on two GPU architectures. The principles of optimization presented for this class of parallel algorithm extend to other algorithms and architectures.