Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 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_PixelProgram_hpp |
| 16 | #define sw_PixelProgram_hpp |
| 17 | |
| 18 | #include "PixelRoutine.hpp" |
| 19 | #include "SamplerCore.hpp" |
| 20 | |
| 21 | namespace sw |
| 22 | { |
| 23 | class PixelProgram : public PixelRoutine |
| 24 | { |
| 25 | public: |
Chris Forbes | 1845d5e | 2018-12-27 11:50:15 -0800 | [diff] [blame] | 26 | PixelProgram(const PixelProcessor::State &state, SpirvShader const *spirvShader) : |
| 27 | PixelRoutine(state, spirvShader) |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 28 | { |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | virtual ~PixelProgram() {} |
| 32 | |
| 33 | protected: |
| 34 | virtual void setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w); |
| 35 | virtual void applyShader(Int cMask[4]); |
| 36 | virtual Bool alphaTest(Int cMask[4]); |
Chris Forbes | e757926 | 2019-02-10 19:21:59 +0000 | [diff] [blame] | 37 | virtual void rasterOperation(Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]); |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 38 | |
| 39 | private: |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 40 | // Color outputs |
| 41 | Vector4f c[RENDERTARGETS]; |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 42 | |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 43 | // Per pixel based on conditions reached |
| 44 | Int enableIndex; |
| 45 | Array<Int4, 1 + 24> enableStack; |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 46 | |
| 47 | // Raster operations |
| 48 | void clampColor(Vector4f oC[RENDERTARGETS]); |
| 49 | |
Chris Forbes | 1845d5e | 2018-12-27 11:50:15 -0800 | [diff] [blame] | 50 | Int4 enableMask(); |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 51 | |
| 52 | Float4 linearToSRGB(const Float4 &x); |
Nicolas Capens | 68a8238 | 2018-10-02 13:16:55 -0400 | [diff] [blame] | 53 | }; |
| 54 | } |
| 55 | |
| 56 | #endif |