1 | // Copyright 2016 The SwiftShader Authors. All Rights Reserved. |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | // you may not use this file except in compliance with the License. |
5 | // You may obtain a copy of the License at |
6 | // |
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | // |
9 | // Unless required by applicable law or agreed to in writing, software |
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | // See the License for the specific language governing permissions and |
13 | // limitations under the License. |
14 | |
15 | #ifndef sw_QuadRasterizer_hpp |
16 | #define sw_QuadRasterizer_hpp |
17 | |
18 | #include "Rasterizer.hpp" |
19 | #include "Pipeline/ShaderCore.hpp" |
20 | #include "Pipeline/SpirvShader.hpp" |
21 | #include "System/Types.hpp" |
22 | |
23 | namespace sw |
24 | { |
25 | class QuadRasterizer : public Rasterizer |
26 | { |
27 | public: |
28 | QuadRasterizer(const PixelProcessor::State &state, SpirvShader const *spirvShader); |
29 | virtual ~QuadRasterizer(); |
30 | |
31 | void generate(); |
32 | |
33 | protected: |
34 | Pointer<Byte> constants; |
35 | |
36 | Float4 Dz[4]; |
37 | Float4 Dw; |
38 | Float4 Dv[MAX_INTERFACE_COMPONENTS]; |
39 | Float4 Df; |
40 | |
41 | UInt occlusion; |
42 | |
43 | virtual void quad(Pointer<Byte> cBuffer[4], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x, Int &y) = 0; |
44 | |
45 | bool interpolateZ() const; |
46 | bool interpolateW() const; |
47 | Float4 interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp); |
48 | |
49 | const PixelProcessor::State &state; |
50 | const SpirvShader *const spirvShader; |
51 | |
52 | private: |
53 | void rasterize(Int &yMin, Int &yMax); |
54 | }; |
55 | } |
56 | |
57 | #endif // sw_QuadRasterizer_hpp |
58 | |