xref: /aosp_15_r20/external/angle/src/libANGLE/renderer/gl/ShaderGL.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker //
2*8975f5c5SAndroid Build Coastguard Worker // Copyright 2015 The ANGLE Project Authors. All rights reserved.
3*8975f5c5SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
4*8975f5c5SAndroid Build Coastguard Worker // found in the LICENSE file.
5*8975f5c5SAndroid Build Coastguard Worker //
6*8975f5c5SAndroid Build Coastguard Worker 
7*8975f5c5SAndroid Build Coastguard Worker // ShaderGL.cpp: Implements the class methods for ShaderGL.
8*8975f5c5SAndroid Build Coastguard Worker 
9*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/gl/ShaderGL.h"
10*8975f5c5SAndroid Build Coastguard Worker 
11*8975f5c5SAndroid Build Coastguard Worker #include "common/debug.h"
12*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Compiler.h"
13*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/Context.h"
14*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/ContextImpl.h"
15*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/gl/ContextGL.h"
16*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/renderer/gl/FunctionsGL.h"
17*8975f5c5SAndroid Build Coastguard Worker #include "libANGLE/trace.h"
18*8975f5c5SAndroid Build Coastguard Worker #include "platform/autogen/FeaturesGL_autogen.h"
19*8975f5c5SAndroid Build Coastguard Worker 
20*8975f5c5SAndroid Build Coastguard Worker #include <iostream>
21*8975f5c5SAndroid Build Coastguard Worker 
22*8975f5c5SAndroid Build Coastguard Worker namespace rx
23*8975f5c5SAndroid Build Coastguard Worker {
24*8975f5c5SAndroid Build Coastguard Worker namespace
25*8975f5c5SAndroid Build Coastguard Worker {
26*8975f5c5SAndroid Build Coastguard Worker class ShaderTranslateTaskGL final : public ShaderTranslateTask
27*8975f5c5SAndroid Build Coastguard Worker {
28*8975f5c5SAndroid Build Coastguard Worker   public:
ShaderTranslateTaskGL(const FunctionsGL * functions,GLuint shaderID,bool hasNativeParallelCompile)29*8975f5c5SAndroid Build Coastguard Worker     ShaderTranslateTaskGL(const FunctionsGL *functions,
30*8975f5c5SAndroid Build Coastguard Worker                           GLuint shaderID,
31*8975f5c5SAndroid Build Coastguard Worker                           bool hasNativeParallelCompile)
32*8975f5c5SAndroid Build Coastguard Worker         : mFunctions(functions),
33*8975f5c5SAndroid Build Coastguard Worker           mShaderID(shaderID),
34*8975f5c5SAndroid Build Coastguard Worker           mHasNativeParallelCompile(hasNativeParallelCompile)
35*8975f5c5SAndroid Build Coastguard Worker     {}
36*8975f5c5SAndroid Build Coastguard Worker     ~ShaderTranslateTaskGL() override = default;
37*8975f5c5SAndroid Build Coastguard Worker 
postTranslate(ShHandle compiler,const gl::CompiledShaderState & compiledState)38*8975f5c5SAndroid Build Coastguard Worker     void postTranslate(ShHandle compiler, const gl::CompiledShaderState &compiledState) override
39*8975f5c5SAndroid Build Coastguard Worker     {
40*8975f5c5SAndroid Build Coastguard Worker         startCompile(compiledState);
41*8975f5c5SAndroid Build Coastguard Worker     }
42*8975f5c5SAndroid Build Coastguard Worker 
load(const gl::CompiledShaderState & compiledState)43*8975f5c5SAndroid Build Coastguard Worker     void load(const gl::CompiledShaderState &compiledState) override
44*8975f5c5SAndroid Build Coastguard Worker     {
45*8975f5c5SAndroid Build Coastguard Worker         startCompile(compiledState);
46*8975f5c5SAndroid Build Coastguard Worker     }
47*8975f5c5SAndroid Build Coastguard Worker 
isCompilingInternally()48*8975f5c5SAndroid Build Coastguard Worker     bool isCompilingInternally() override
49*8975f5c5SAndroid Build Coastguard Worker     {
50*8975f5c5SAndroid Build Coastguard Worker         if (!mHasNativeParallelCompile)
51*8975f5c5SAndroid Build Coastguard Worker         {
52*8975f5c5SAndroid Build Coastguard Worker             return false;
53*8975f5c5SAndroid Build Coastguard Worker         }
54*8975f5c5SAndroid Build Coastguard Worker 
55*8975f5c5SAndroid Build Coastguard Worker         GLint status = GL_FALSE;
56*8975f5c5SAndroid Build Coastguard Worker         mFunctions->getShaderiv(mShaderID, GL_COMPLETION_STATUS, &status);
57*8975f5c5SAndroid Build Coastguard Worker         return status != GL_TRUE;
58*8975f5c5SAndroid Build Coastguard Worker     }
59*8975f5c5SAndroid Build Coastguard Worker 
getResult(std::string & infoLog)60*8975f5c5SAndroid Build Coastguard Worker     angle::Result getResult(std::string &infoLog) override
61*8975f5c5SAndroid Build Coastguard Worker     {
62*8975f5c5SAndroid Build Coastguard Worker         // Check for compile errors from the native driver
63*8975f5c5SAndroid Build Coastguard Worker         GLint compileStatus = GL_FALSE;
64*8975f5c5SAndroid Build Coastguard Worker         mFunctions->getShaderiv(mShaderID, GL_COMPILE_STATUS, &compileStatus);
65*8975f5c5SAndroid Build Coastguard Worker         if (compileStatus != GL_FALSE)
66*8975f5c5SAndroid Build Coastguard Worker         {
67*8975f5c5SAndroid Build Coastguard Worker             return angle::Result::Continue;
68*8975f5c5SAndroid Build Coastguard Worker         }
69*8975f5c5SAndroid Build Coastguard Worker 
70*8975f5c5SAndroid Build Coastguard Worker         // Compilation failed, put the error into the info log
71*8975f5c5SAndroid Build Coastguard Worker         GLint infoLogLength = 0;
72*8975f5c5SAndroid Build Coastguard Worker         mFunctions->getShaderiv(mShaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
73*8975f5c5SAndroid Build Coastguard Worker 
74*8975f5c5SAndroid Build Coastguard Worker         // Info log length includes the null terminator, so 1 means that the info log is an empty
75*8975f5c5SAndroid Build Coastguard Worker         // string.
76*8975f5c5SAndroid Build Coastguard Worker         if (infoLogLength > 1)
77*8975f5c5SAndroid Build Coastguard Worker         {
78*8975f5c5SAndroid Build Coastguard Worker             std::vector<char> buf(infoLogLength);
79*8975f5c5SAndroid Build Coastguard Worker             mFunctions->getShaderInfoLog(mShaderID, infoLogLength, nullptr, &buf[0]);
80*8975f5c5SAndroid Build Coastguard Worker 
81*8975f5c5SAndroid Build Coastguard Worker             infoLog += buf.data();
82*8975f5c5SAndroid Build Coastguard Worker         }
83*8975f5c5SAndroid Build Coastguard Worker         else
84*8975f5c5SAndroid Build Coastguard Worker         {
85*8975f5c5SAndroid Build Coastguard Worker             WARN() << std::endl << "Shader compilation failed with no info log.";
86*8975f5c5SAndroid Build Coastguard Worker         }
87*8975f5c5SAndroid Build Coastguard Worker 
88*8975f5c5SAndroid Build Coastguard Worker         return angle::Result::Stop;
89*8975f5c5SAndroid Build Coastguard Worker     }
90*8975f5c5SAndroid Build Coastguard Worker 
91*8975f5c5SAndroid Build Coastguard Worker   private:
startCompile(const gl::CompiledShaderState & compiledState)92*8975f5c5SAndroid Build Coastguard Worker     void startCompile(const gl::CompiledShaderState &compiledState)
93*8975f5c5SAndroid Build Coastguard Worker     {
94*8975f5c5SAndroid Build Coastguard Worker         const char *source = compiledState.translatedSource.c_str();
95*8975f5c5SAndroid Build Coastguard Worker         mFunctions->shaderSource(mShaderID, 1, &source, nullptr);
96*8975f5c5SAndroid Build Coastguard Worker         mFunctions->compileShader(mShaderID);
97*8975f5c5SAndroid Build Coastguard Worker     }
98*8975f5c5SAndroid Build Coastguard Worker 
99*8975f5c5SAndroid Build Coastguard Worker     const FunctionsGL *mFunctions;
100*8975f5c5SAndroid Build Coastguard Worker     GLuint mShaderID;
101*8975f5c5SAndroid Build Coastguard Worker     bool mHasNativeParallelCompile;
102*8975f5c5SAndroid Build Coastguard Worker };
103*8975f5c5SAndroid Build Coastguard Worker }  // anonymous namespace
104*8975f5c5SAndroid Build Coastguard Worker 
ShaderGL(const gl::ShaderState & data,GLuint shaderID)105*8975f5c5SAndroid Build Coastguard Worker ShaderGL::ShaderGL(const gl::ShaderState &data, GLuint shaderID)
106*8975f5c5SAndroid Build Coastguard Worker     : ShaderImpl(data), mShaderID(shaderID)
107*8975f5c5SAndroid Build Coastguard Worker {}
108*8975f5c5SAndroid Build Coastguard Worker 
~ShaderGL()109*8975f5c5SAndroid Build Coastguard Worker ShaderGL::~ShaderGL()
110*8975f5c5SAndroid Build Coastguard Worker {
111*8975f5c5SAndroid Build Coastguard Worker     ASSERT(mShaderID == 0);
112*8975f5c5SAndroid Build Coastguard Worker }
113*8975f5c5SAndroid Build Coastguard Worker 
onDestroy(const gl::Context * context)114*8975f5c5SAndroid Build Coastguard Worker void ShaderGL::onDestroy(const gl::Context *context)
115*8975f5c5SAndroid Build Coastguard Worker {
116*8975f5c5SAndroid Build Coastguard Worker     const FunctionsGL *functions = GetFunctionsGL(context);
117*8975f5c5SAndroid Build Coastguard Worker 
118*8975f5c5SAndroid Build Coastguard Worker     functions->deleteShader(mShaderID);
119*8975f5c5SAndroid Build Coastguard Worker     mShaderID = 0;
120*8975f5c5SAndroid Build Coastguard Worker }
121*8975f5c5SAndroid Build Coastguard Worker 
compile(const gl::Context * context,ShCompileOptions * options)122*8975f5c5SAndroid Build Coastguard Worker std::shared_ptr<ShaderTranslateTask> ShaderGL::compile(const gl::Context *context,
123*8975f5c5SAndroid Build Coastguard Worker                                                        ShCompileOptions *options)
124*8975f5c5SAndroid Build Coastguard Worker {
125*8975f5c5SAndroid Build Coastguard Worker     ContextGL *contextGL         = GetImplAs<ContextGL>(context);
126*8975f5c5SAndroid Build Coastguard Worker     const FunctionsGL *functions = GetFunctionsGL(context);
127*8975f5c5SAndroid Build Coastguard Worker 
128*8975f5c5SAndroid Build Coastguard Worker     options->initGLPosition = true;
129*8975f5c5SAndroid Build Coastguard Worker 
130*8975f5c5SAndroid Build Coastguard Worker     bool isWebGL = context->isWebGL();
131*8975f5c5SAndroid Build Coastguard Worker     if (isWebGL && mState.getShaderType() != gl::ShaderType::Compute)
132*8975f5c5SAndroid Build Coastguard Worker     {
133*8975f5c5SAndroid Build Coastguard Worker         options->initOutputVariables = true;
134*8975f5c5SAndroid Build Coastguard Worker     }
135*8975f5c5SAndroid Build Coastguard Worker 
136*8975f5c5SAndroid Build Coastguard Worker     if (isWebGL && !context->getState().getEnableFeature(GL_TEXTURE_RECTANGLE_ANGLE))
137*8975f5c5SAndroid Build Coastguard Worker     {
138*8975f5c5SAndroid Build Coastguard Worker         options->disableARBTextureRectangle = true;
139*8975f5c5SAndroid Build Coastguard Worker     }
140*8975f5c5SAndroid Build Coastguard Worker 
141*8975f5c5SAndroid Build Coastguard Worker     const angle::FeaturesGL &features = GetFeaturesGL(context);
142*8975f5c5SAndroid Build Coastguard Worker 
143*8975f5c5SAndroid Build Coastguard Worker     if (features.initFragmentOutputVariables.enabled)
144*8975f5c5SAndroid Build Coastguard Worker     {
145*8975f5c5SAndroid Build Coastguard Worker         options->initFragmentOutputVariables = true;
146*8975f5c5SAndroid Build Coastguard Worker     }
147*8975f5c5SAndroid Build Coastguard Worker 
148*8975f5c5SAndroid Build Coastguard Worker     if (features.doWhileGLSLCausesGPUHang.enabled)
149*8975f5c5SAndroid Build Coastguard Worker     {
150*8975f5c5SAndroid Build Coastguard Worker         options->rewriteDoWhileLoops = true;
151*8975f5c5SAndroid Build Coastguard Worker     }
152*8975f5c5SAndroid Build Coastguard Worker 
153*8975f5c5SAndroid Build Coastguard Worker     if (features.emulateAbsIntFunction.enabled)
154*8975f5c5SAndroid Build Coastguard Worker     {
155*8975f5c5SAndroid Build Coastguard Worker         options->emulateAbsIntFunction = true;
156*8975f5c5SAndroid Build Coastguard Worker     }
157*8975f5c5SAndroid Build Coastguard Worker 
158*8975f5c5SAndroid Build Coastguard Worker     if (features.addAndTrueToLoopCondition.enabled)
159*8975f5c5SAndroid Build Coastguard Worker     {
160*8975f5c5SAndroid Build Coastguard Worker         options->addAndTrueToLoopCondition = true;
161*8975f5c5SAndroid Build Coastguard Worker     }
162*8975f5c5SAndroid Build Coastguard Worker 
163*8975f5c5SAndroid Build Coastguard Worker     if (features.emulateIsnanFloat.enabled)
164*8975f5c5SAndroid Build Coastguard Worker     {
165*8975f5c5SAndroid Build Coastguard Worker         options->emulateIsnanFloatFunction = true;
166*8975f5c5SAndroid Build Coastguard Worker     }
167*8975f5c5SAndroid Build Coastguard Worker 
168*8975f5c5SAndroid Build Coastguard Worker     if (features.emulateAtan2Float.enabled)
169*8975f5c5SAndroid Build Coastguard Worker     {
170*8975f5c5SAndroid Build Coastguard Worker         options->emulateAtan2FloatFunction = true;
171*8975f5c5SAndroid Build Coastguard Worker     }
172*8975f5c5SAndroid Build Coastguard Worker 
173*8975f5c5SAndroid Build Coastguard Worker     if (features.useUnusedBlocksWithStandardOrSharedLayout.enabled)
174*8975f5c5SAndroid Build Coastguard Worker     {
175*8975f5c5SAndroid Build Coastguard Worker         options->useUnusedStandardSharedBlocks = true;
176*8975f5c5SAndroid Build Coastguard Worker     }
177*8975f5c5SAndroid Build Coastguard Worker 
178*8975f5c5SAndroid Build Coastguard Worker     if (features.removeInvariantAndCentroidForESSL3.enabled)
179*8975f5c5SAndroid Build Coastguard Worker     {
180*8975f5c5SAndroid Build Coastguard Worker         options->removeInvariantAndCentroidForESSL3 = true;
181*8975f5c5SAndroid Build Coastguard Worker     }
182*8975f5c5SAndroid Build Coastguard Worker 
183*8975f5c5SAndroid Build Coastguard Worker     if (features.rewriteFloatUnaryMinusOperator.enabled)
184*8975f5c5SAndroid Build Coastguard Worker     {
185*8975f5c5SAndroid Build Coastguard Worker         options->rewriteFloatUnaryMinusOperator = true;
186*8975f5c5SAndroid Build Coastguard Worker     }
187*8975f5c5SAndroid Build Coastguard Worker 
188*8975f5c5SAndroid Build Coastguard Worker     if (!features.dontInitializeUninitializedLocals.enabled)
189*8975f5c5SAndroid Build Coastguard Worker     {
190*8975f5c5SAndroid Build Coastguard Worker         options->initializeUninitializedLocals = true;
191*8975f5c5SAndroid Build Coastguard Worker     }
192*8975f5c5SAndroid Build Coastguard Worker 
193*8975f5c5SAndroid Build Coastguard Worker     if (features.clampPointSize.enabled)
194*8975f5c5SAndroid Build Coastguard Worker     {
195*8975f5c5SAndroid Build Coastguard Worker         options->clampPointSize = true;
196*8975f5c5SAndroid Build Coastguard Worker     }
197*8975f5c5SAndroid Build Coastguard Worker 
198*8975f5c5SAndroid Build Coastguard Worker     if (features.dontUseLoopsToInitializeVariables.enabled)
199*8975f5c5SAndroid Build Coastguard Worker     {
200*8975f5c5SAndroid Build Coastguard Worker         options->dontUseLoopsToInitializeVariables = true;
201*8975f5c5SAndroid Build Coastguard Worker     }
202*8975f5c5SAndroid Build Coastguard Worker 
203*8975f5c5SAndroid Build Coastguard Worker     if (features.clampFragDepth.enabled)
204*8975f5c5SAndroid Build Coastguard Worker     {
205*8975f5c5SAndroid Build Coastguard Worker         options->clampFragDepth = true;
206*8975f5c5SAndroid Build Coastguard Worker     }
207*8975f5c5SAndroid Build Coastguard Worker 
208*8975f5c5SAndroid Build Coastguard Worker     if (features.rewriteRepeatedAssignToSwizzled.enabled)
209*8975f5c5SAndroid Build Coastguard Worker     {
210*8975f5c5SAndroid Build Coastguard Worker         options->rewriteRepeatedAssignToSwizzled = true;
211*8975f5c5SAndroid Build Coastguard Worker     }
212*8975f5c5SAndroid Build Coastguard Worker 
213*8975f5c5SAndroid Build Coastguard Worker     if (features.preTransformTextureCubeGradDerivatives.enabled)
214*8975f5c5SAndroid Build Coastguard Worker     {
215*8975f5c5SAndroid Build Coastguard Worker         options->preTransformTextureCubeGradDerivatives = true;
216*8975f5c5SAndroid Build Coastguard Worker     }
217*8975f5c5SAndroid Build Coastguard Worker 
218*8975f5c5SAndroid Build Coastguard Worker     if (contextGL->getMultiviewImplementationType() ==
219*8975f5c5SAndroid Build Coastguard Worker         MultiviewImplementationTypeGL::NV_VIEWPORT_ARRAY2)
220*8975f5c5SAndroid Build Coastguard Worker     {
221*8975f5c5SAndroid Build Coastguard Worker         options->initializeBuiltinsForInstancedMultiview = true;
222*8975f5c5SAndroid Build Coastguard Worker         options->selectViewInNvGLSLVertexShader          = true;
223*8975f5c5SAndroid Build Coastguard Worker     }
224*8975f5c5SAndroid Build Coastguard Worker 
225*8975f5c5SAndroid Build Coastguard Worker     if (features.clampArrayAccess.enabled || isWebGL)
226*8975f5c5SAndroid Build Coastguard Worker     {
227*8975f5c5SAndroid Build Coastguard Worker         options->clampIndirectArrayBounds = true;
228*8975f5c5SAndroid Build Coastguard Worker     }
229*8975f5c5SAndroid Build Coastguard Worker 
230*8975f5c5SAndroid Build Coastguard Worker     if (features.vertexIDDoesNotIncludeBaseVertex.enabled)
231*8975f5c5SAndroid Build Coastguard Worker     {
232*8975f5c5SAndroid Build Coastguard Worker         options->addBaseVertexToVertexID = true;
233*8975f5c5SAndroid Build Coastguard Worker     }
234*8975f5c5SAndroid Build Coastguard Worker 
235*8975f5c5SAndroid Build Coastguard Worker     if (features.unfoldShortCircuits.enabled)
236*8975f5c5SAndroid Build Coastguard Worker     {
237*8975f5c5SAndroid Build Coastguard Worker         options->unfoldShortCircuit = true;
238*8975f5c5SAndroid Build Coastguard Worker     }
239*8975f5c5SAndroid Build Coastguard Worker 
240*8975f5c5SAndroid Build Coastguard Worker     if (features.removeDynamicIndexingOfSwizzledVector.enabled)
241*8975f5c5SAndroid Build Coastguard Worker     {
242*8975f5c5SAndroid Build Coastguard Worker         options->removeDynamicIndexingOfSwizzledVector = true;
243*8975f5c5SAndroid Build Coastguard Worker     }
244*8975f5c5SAndroid Build Coastguard Worker 
245*8975f5c5SAndroid Build Coastguard Worker     if (features.preAddTexelFetchOffsets.enabled)
246*8975f5c5SAndroid Build Coastguard Worker     {
247*8975f5c5SAndroid Build Coastguard Worker         options->rewriteTexelFetchOffsetToTexelFetch = true;
248*8975f5c5SAndroid Build Coastguard Worker     }
249*8975f5c5SAndroid Build Coastguard Worker 
250*8975f5c5SAndroid Build Coastguard Worker     if (features.regenerateStructNames.enabled)
251*8975f5c5SAndroid Build Coastguard Worker     {
252*8975f5c5SAndroid Build Coastguard Worker         options->regenerateStructNames = true;
253*8975f5c5SAndroid Build Coastguard Worker     }
254*8975f5c5SAndroid Build Coastguard Worker 
255*8975f5c5SAndroid Build Coastguard Worker     if (features.rewriteRowMajorMatrices.enabled)
256*8975f5c5SAndroid Build Coastguard Worker     {
257*8975f5c5SAndroid Build Coastguard Worker         options->rewriteRowMajorMatrices = true;
258*8975f5c5SAndroid Build Coastguard Worker     }
259*8975f5c5SAndroid Build Coastguard Worker 
260*8975f5c5SAndroid Build Coastguard Worker     if (features.passHighpToPackUnormSnormBuiltins.enabled)
261*8975f5c5SAndroid Build Coastguard Worker     {
262*8975f5c5SAndroid Build Coastguard Worker         options->passHighpToPackUnormSnormBuiltins = true;
263*8975f5c5SAndroid Build Coastguard Worker     }
264*8975f5c5SAndroid Build Coastguard Worker 
265*8975f5c5SAndroid Build Coastguard Worker     if (features.emulateClipDistanceState.enabled)
266*8975f5c5SAndroid Build Coastguard Worker     {
267*8975f5c5SAndroid Build Coastguard Worker         options->emulateClipDistanceState = true;
268*8975f5c5SAndroid Build Coastguard Worker     }
269*8975f5c5SAndroid Build Coastguard Worker 
270*8975f5c5SAndroid Build Coastguard Worker     if (features.emulateClipOrigin.enabled)
271*8975f5c5SAndroid Build Coastguard Worker     {
272*8975f5c5SAndroid Build Coastguard Worker         options->emulateClipOrigin = true;
273*8975f5c5SAndroid Build Coastguard Worker     }
274*8975f5c5SAndroid Build Coastguard Worker 
275*8975f5c5SAndroid Build Coastguard Worker     if (features.scalarizeVecAndMatConstructorArgs.enabled)
276*8975f5c5SAndroid Build Coastguard Worker     {
277*8975f5c5SAndroid Build Coastguard Worker         options->scalarizeVecAndMatConstructorArgs = true;
278*8975f5c5SAndroid Build Coastguard Worker     }
279*8975f5c5SAndroid Build Coastguard Worker 
280*8975f5c5SAndroid Build Coastguard Worker     if (features.explicitFragmentLocations.enabled)
281*8975f5c5SAndroid Build Coastguard Worker     {
282*8975f5c5SAndroid Build Coastguard Worker         options->explicitFragmentLocations = true;
283*8975f5c5SAndroid Build Coastguard Worker     }
284*8975f5c5SAndroid Build Coastguard Worker 
285*8975f5c5SAndroid Build Coastguard Worker     if (contextGL->getNativeExtensions().shaderPixelLocalStorageANGLE)
286*8975f5c5SAndroid Build Coastguard Worker     {
287*8975f5c5SAndroid Build Coastguard Worker         options->pls = contextGL->getNativePixelLocalStorageOptions();
288*8975f5c5SAndroid Build Coastguard Worker     }
289*8975f5c5SAndroid Build Coastguard Worker 
290*8975f5c5SAndroid Build Coastguard Worker     return std::shared_ptr<ShaderTranslateTask>(
291*8975f5c5SAndroid Build Coastguard Worker         new ShaderTranslateTaskGL(functions, mShaderID, contextGL->hasNativeParallelCompile()));
292*8975f5c5SAndroid Build Coastguard Worker }
293*8975f5c5SAndroid Build Coastguard Worker 
load(const gl::Context * context,gl::BinaryInputStream * stream)294*8975f5c5SAndroid Build Coastguard Worker std::shared_ptr<ShaderTranslateTask> ShaderGL::load(const gl::Context *context,
295*8975f5c5SAndroid Build Coastguard Worker                                                     gl::BinaryInputStream *stream)
296*8975f5c5SAndroid Build Coastguard Worker {
297*8975f5c5SAndroid Build Coastguard Worker     ContextGL *contextGL         = GetImplAs<ContextGL>(context);
298*8975f5c5SAndroid Build Coastguard Worker     const FunctionsGL *functions = GetFunctionsGL(context);
299*8975f5c5SAndroid Build Coastguard Worker 
300*8975f5c5SAndroid Build Coastguard Worker     return std::shared_ptr<ShaderTranslateTask>(
301*8975f5c5SAndroid Build Coastguard Worker         new ShaderTranslateTaskGL(functions, mShaderID, contextGL->hasNativeParallelCompile()));
302*8975f5c5SAndroid Build Coastguard Worker }
303*8975f5c5SAndroid Build Coastguard Worker 
getDebugInfo() const304*8975f5c5SAndroid Build Coastguard Worker std::string ShaderGL::getDebugInfo() const
305*8975f5c5SAndroid Build Coastguard Worker {
306*8975f5c5SAndroid Build Coastguard Worker     return mState.getCompiledState()->translatedSource;
307*8975f5c5SAndroid Build Coastguard Worker }
308*8975f5c5SAndroid Build Coastguard Worker 
getShaderID() const309*8975f5c5SAndroid Build Coastguard Worker GLuint ShaderGL::getShaderID() const
310*8975f5c5SAndroid Build Coastguard Worker {
311*8975f5c5SAndroid Build Coastguard Worker     return mShaderID;
312*8975f5c5SAndroid Build Coastguard Worker }
313*8975f5c5SAndroid Build Coastguard Worker 
314*8975f5c5SAndroid Build Coastguard Worker }  // namespace rx
315