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