OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGLSLProgramBuilder_DEFINED | 8 #ifndef GrGLSLProgramBuilder_DEFINED |
9 #define GrGLSLProgramBuilder_DEFINED | 9 #define GrGLSLProgramBuilder_DEFINED |
10 | 10 |
11 #include "GrGeometryProcessor.h" | 11 #include "GrGeometryProcessor.h" |
12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrPipeline.h" |
13 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 14 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
14 #include "glsl/GrGLSLGeometryShaderBuilder.h" | 15 #include "glsl/GrGLSLGeometryShaderBuilder.h" |
15 #include "glsl/GrGLSLPrimitiveProcessor.h" | 16 #include "glsl/GrGLSLPrimitiveProcessor.h" |
16 #include "glsl/GrGLSLProgramDataManager.h" | 17 #include "glsl/GrGLSLProgramDataManager.h" |
17 #include "glsl/GrGLSLUniformHandler.h" | 18 #include "glsl/GrGLSLUniformHandler.h" |
18 #include "glsl/GrGLSLTextureSampler.h" | 19 #include "glsl/GrGLSLTextureSampler.h" |
19 #include "glsl/GrGLSLVertexShaderBuilder.h" | 20 #include "glsl/GrGLSLVertexShaderBuilder.h" |
20 #include "glsl/GrGLSLXferProcessor.h" | 21 #include "glsl/GrGLSLXferProcessor.h" |
21 | 22 |
22 class GrGLSLCaps; | 23 class GrGLSLCaps; |
23 class GrGLSLShaderVar; | 24 class GrGLSLShaderVar; |
24 class GrGLSLVaryingHandler; | 25 class GrGLSLVaryingHandler; |
25 | 26 |
26 typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs; | 27 typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs; |
27 | 28 |
28 class GrGLSLProgramBuilder { | 29 class GrGLSLProgramBuilder { |
29 public: | 30 public: |
30 typedef GrGpu::DrawArgs DrawArgs; | 31 typedef GrGpu::DrawArgs DrawArgs; |
31 typedef GrGLSLUniformHandler::UniformHandle UniformHandle; | 32 typedef GrGLSLUniformHandler::UniformHandle UniformHandle; |
32 | 33 |
33 virtual ~GrGLSLProgramBuilder() {} | 34 virtual ~GrGLSLProgramBuilder() {} |
34 | 35 |
35 virtual const GrCaps* caps() const = 0; | 36 virtual const GrCaps* caps() const = 0; |
36 virtual const GrGLSLCaps* glslCaps() const = 0; | 37 virtual const GrGLSLCaps* glslCaps() const = 0; |
37 | 38 |
38 const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrim
itiveProcessor; } | 39 const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrim
itiveProcessor; } |
39 const GrPipeline& pipeline() const { return *fArgs.fPipeline; } | 40 const GrPipeline& pipeline() const { return *fArgs.fPipeline; } |
40 const GrProgramDesc& desc() const { return *fArgs.fDesc; } | 41 const GrProgramDesc& desc() const { return *fArgs.fDesc; } |
41 const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(
); } | 42 const GrProgramDesc::KeyHeader& header() const { return fArgs.fDesc->header(
); } |
| 43 bool canReadFragmentPosition() const { return this->header().fFragPosKey; } |
| 44 bool canUseSampleLocations() const { |
| 45 SkASSERT(!this->header().fSamplePatternKey || this->pipeline().isHWAntia
liasState()); |
| 46 return this->header().fSamplePatternKey; |
| 47 } |
42 | 48 |
43 void appendUniformDecls(GrShaderFlags visibility, SkString*) const; | 49 void appendUniformDecls(GrShaderFlags visibility, SkString*) const; |
44 | 50 |
45 // Handles for program uniforms (other than per-effect uniforms) | 51 // Handles for program uniforms (other than per-effect uniforms) |
46 struct BuiltinUniformHandles { | 52 struct BuiltinUniformHandles { |
47 UniformHandle fRTAdjustmentUni; | 53 UniformHandle fRTAdjustmentUni; |
48 | 54 |
49 // We use the render target height to provide a y-down frag coord when s
pecifying | 55 // We use the render target height to provide a y-down frag coord when s
pecifying |
50 // origin_upper_left is not supported. | 56 // origin_upper_left is not supported. |
51 UniformHandle fRTHeightUni; | 57 UniformHandle fRTHeightUni; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 #endif | 154 #endif |
149 | 155 |
150 virtual void emitSamplers(const GrProcessor& processor, | 156 virtual void emitSamplers(const GrProcessor& processor, |
151 GrGLSLTextureSampler::TextureSamplerArray* outSamp
lers) = 0; | 157 GrGLSLTextureSampler::TextureSamplerArray* outSamp
lers) = 0; |
152 | 158 |
153 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms; | 159 GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms; |
154 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords; | 160 GrGLSLPrimitiveProcessor::TransformsOut fOutCoords; |
155 }; | 161 }; |
156 | 162 |
157 #endif | 163 #endif |
OLD | NEW |