Refactor Context dependency for resolveCompile
The context parameter of Shader::resolveCompile method causes a bad
impact that many methods in Shader, Program etc. have to have a same
context parameter. By removing it, these methods can be decoupled
from Context.
BUG=chromium:849576
Change-Id: Ia5545ee9dce45794550f6086bc0e6c4707e1276e
Reviewed-on: https://chromium-review.googlesource.com/1172202
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/libANGLE/renderer/ShaderImpl.h b/src/libANGLE/renderer/ShaderImpl.h
index 8da34c8..2b5c404 100644
--- a/src/libANGLE/renderer/ShaderImpl.h
+++ b/src/libANGLE/renderer/ShaderImpl.h
@@ -21,18 +21,16 @@
ShaderImpl(const gl::ShaderState &data) : mData(data) {}
virtual ~ShaderImpl() { }
- virtual void destroy(const gl::Context *context) {}
+ virtual void destroy() {}
// Returns additional sh::Compile options.
virtual ShCompileOptions prepareSourceAndReturnOptions(const gl::Context *context,
std::stringstream *sourceStream,
std::string *sourcePath) = 0;
// Returns success for compiling on the driver. Returns success.
- virtual bool postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog) = 0;
+ virtual bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) = 0;
- virtual std::string getDebugInfo(const gl::Context *context) const = 0;
+ virtual std::string getDebugInfo() const = 0;
const gl::ShaderState &getData() const { return mData; }
diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
index 4b48577..0dfea5f 100644
--- a/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
+++ b/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
@@ -457,7 +457,7 @@
hlslStream << "};\n";
}
-void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context,
+void DynamicHLSL::generateShaderLinkHLSL(const gl::Caps &caps,
const gl::ProgramState &programData,
const ProgramD3DMetadata &programMetadata,
const VaryingPacking &varyingPacking,
@@ -468,7 +468,6 @@
ASSERT((*shaderHLSL)[gl::ShaderType::Vertex].empty() &&
(*shaderHLSL)[gl::ShaderType::Fragment].empty());
- const auto &data = context->getContextState();
gl::Shader *vertexShaderGL = programData.getAttachedShader(ShaderType::Vertex);
gl::Shader *fragmentShaderGL = programData.getAttachedShader(ShaderType::Fragment);
const ShaderD3D *fragmentShader = GetImplAs<ShaderD3D>(fragmentShaderGL);
@@ -494,10 +493,10 @@
// GeometryShader HLSL. These include pointsize clamp values.
if (useInstancedPointSpriteEmulation)
{
- vertexStream << "static float minPointSize = "
- << static_cast<int>(data.getCaps().minAliasedPointSize) << ".0f;\n"
- << "static float maxPointSize = "
- << static_cast<int>(data.getCaps().maxAliasedPointSize) << ".0f;\n";
+ vertexStream << "static float minPointSize = " << static_cast<int>(caps.minAliasedPointSize)
+ << ".0f;\n"
+ << "static float maxPointSize = " << static_cast<int>(caps.maxAliasedPointSize)
+ << ".0f;\n";
}
std::ostringstream vertexGenerateOutput;
@@ -664,7 +663,7 @@
<< " return output;\n"
<< "}";
- std::string vertexSource = vertexShaderGL->getTranslatedSource(context);
+ std::string vertexSource = vertexShaderGL->getTranslatedSource();
angle::ReplaceSubstring(&vertexSource, std::string(MAIN_PROLOGUE_STUB_STRING),
" initAttributes(input);\n");
angle::ReplaceSubstring(&vertexSource, std::string(VERTEX_OUTPUT_STUB_STRING),
@@ -833,7 +832,7 @@
pixelPrologue << ";\n";
}
- std::string pixelSource = fragmentShaderGL->getTranslatedSource(context);
+ std::string pixelSource = fragmentShaderGL->getTranslatedSource();
if (fragmentShader->usesFrontFacing())
{
@@ -955,7 +954,7 @@
return preambleStream.str();
}
-std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Context *context,
+std::string DynamicHLSL::generateGeometryShaderHLSL(const gl::Caps &caps,
gl::PrimitiveMode primitiveType,
const gl::ProgramState &programData,
const bool useViewScale,
@@ -1063,10 +1062,10 @@
"};\n"
"\n"
"static float minPointSize = "
- << static_cast<int>(context->getCaps().minAliasedPointSize)
+ << static_cast<int>(caps.minAliasedPointSize)
<< ".0f;\n"
"static float maxPointSize = "
- << static_cast<int>(context->getCaps().maxAliasedPointSize) << ".0f;\n"
+ << static_cast<int>(caps.maxAliasedPointSize) << ".0f;\n"
<< "\n";
}
diff --git a/src/libANGLE/renderer/d3d/DynamicHLSL.h b/src/libANGLE/renderer/d3d/DynamicHLSL.h
index d9c1d61..d138c82 100644
--- a/src/libANGLE/renderer/d3d/DynamicHLSL.h
+++ b/src/libANGLE/renderer/d3d/DynamicHLSL.h
@@ -128,7 +128,7 @@
const std::vector<PixelShaderOutputVariable> &outputVariables,
bool usesFragDepth,
const std::vector<GLenum> &outputLayout) const;
- void generateShaderLinkHLSL(const gl::Context *context,
+ void generateShaderLinkHLSL(const gl::Caps &caps,
const gl::ProgramState &programData,
const ProgramD3DMetadata &programMetadata,
const gl::VaryingPacking &varyingPacking,
@@ -140,7 +140,7 @@
const bool hasANGLEMultiviewEnabled,
const bool selectViewInVS) const;
- std::string generateGeometryShaderHLSL(const gl::Context *context,
+ std::string generateGeometryShaderHLSL(const gl::Caps &caps,
gl::PrimitiveMode primitiveType,
const gl::ProgramState &programData,
const bool useViewScale,
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index ef3264d..0f179ae 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -36,13 +36,11 @@
namespace
{
-void GetDefaultInputLayoutFromShader(const gl::Context *context,
- gl::Shader *vertexShader,
- gl::InputLayout *inputLayoutOut)
+void GetDefaultInputLayoutFromShader(gl::Shader *vertexShader, gl::InputLayout *inputLayoutOut)
{
inputLayoutOut->clear();
- for (const sh::Attribute &shaderAttr : vertexShader->getActiveAttributes(context))
+ for (const sh::Attribute &shaderAttr : vertexShader->getActiveAttributes())
{
if (shaderAttr.type != GL_NONE)
{
@@ -119,29 +117,26 @@
return false;
}
-bool FindFlatInterpolationVaryingPerShader(const gl::Context *context, gl::Shader *shader)
+bool FindFlatInterpolationVaryingPerShader(gl::Shader *shader)
{
- ASSERT(context && shader);
+ ASSERT(shader);
switch (shader->getType())
{
case gl::ShaderType::Vertex:
- return HasFlatInterpolationVarying(shader->getOutputVaryings(context));
+ return HasFlatInterpolationVarying(shader->getOutputVaryings());
case gl::ShaderType::Fragment:
- return HasFlatInterpolationVarying(shader->getInputVaryings(context));
+ return HasFlatInterpolationVarying(shader->getInputVaryings());
case gl::ShaderType::Geometry:
- return HasFlatInterpolationVarying(shader->getInputVaryings(context)) ||
- HasFlatInterpolationVarying(shader->getOutputVaryings(context));
+ return HasFlatInterpolationVarying(shader->getInputVaryings()) ||
+ HasFlatInterpolationVarying(shader->getOutputVaryings());
default:
UNREACHABLE();
return false;
}
}
-bool FindFlatInterpolationVarying(const gl::Context *context,
- const gl::ShaderMap<gl::Shader *> &shaders)
+bool FindFlatInterpolationVarying(const gl::ShaderMap<gl::Shader *> &shaders)
{
- ASSERT(context);
-
for (gl::ShaderType shaderType : gl::kAllGraphicsShaderTypes)
{
gl::Shader *shader = shaders[shaderType];
@@ -150,7 +145,7 @@
continue;
}
- if (FindFlatInterpolationVaryingPerShader(context, shader))
+ if (FindFlatInterpolationVaryingPerShader(shader))
{
return true;
}
@@ -164,7 +159,7 @@
public:
UniformBlockInfo() {}
- void getShaderBlockInfo(const gl::Context *context, gl::Shader *shader);
+ void getShaderBlockInfo(gl::Shader *shader);
bool getBlockSize(const std::string &name, const std::string &mappedName, size_t *sizeOut);
bool getBlockMemberInfo(const std::string &name,
@@ -178,9 +173,9 @@
sh::BlockLayoutMap mBlockLayout;
};
-void UniformBlockInfo::getShaderBlockInfo(const gl::Context *context, gl::Shader *shader)
+void UniformBlockInfo::getShaderBlockInfo(gl::Shader *shader)
{
- for (const sh::InterfaceBlock &interfaceBlock : shader->getUniformBlocks(context))
+ for (const sh::InterfaceBlock &interfaceBlock : shader->getUniformBlocks())
{
if (!interfaceBlock.active && interfaceBlock.layout == sh::BLOCKLAYOUT_PACKED)
continue;
@@ -1306,7 +1301,7 @@
}
std::string geometryHLSL = mDynamicHLSL->generateGeometryShaderHLSL(
- context, geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
+ context->getCaps(), geometryShaderType, mState, mRenderer->presentPathFastEnabled(),
mHasANGLEMultiviewEnabled, mRenderer->canSelectViewInVertexShader(),
usesGeometryShaderForPointSpriteEmulation(), mGeometryShaderPreamble);
@@ -1374,7 +1369,7 @@
}
angle::Result run() override
{
- mProgram->updateCachedInputLayoutFromShader(mContext);
+ mProgram->updateCachedInputLayoutFromShader();
ANGLE_TRY(
mProgram->getVertexExecutableForCachedInputLayout(mContext, &mExecutable, &mInfoLog));
@@ -1383,9 +1378,9 @@
}
};
-void ProgramD3D::updateCachedInputLayoutFromShader(const gl::Context *context)
+void ProgramD3D::updateCachedInputLayoutFromShader()
{
- GetDefaultInputLayoutFromShader(context, mState.getAttachedShader(gl::ShaderType::Vertex),
+ GetDefaultInputLayoutFromShader(mState.getAttachedShader(gl::ShaderType::Vertex),
&mCachedInputLayout);
VertexExecutable::getSignature(mRenderer, mCachedInputLayout, &mCachedVertexSignature);
updateCachedVertexExecutableIndex();
@@ -1586,7 +1581,7 @@
gl::Shader *computeShaderGL = mState.getAttachedShader(gl::ShaderType::Compute);
ASSERT(computeShaderGL);
- std::string computeShader = computeShaderGL->getTranslatedSource(context);
+ std::string computeShader = computeShaderGL->getTranslatedSource();
ShaderExecutableD3D *computeExecutable = nullptr;
ANGLE_TRY(mRenderer->compileToExecutable(
@@ -1626,9 +1621,9 @@
mReadonlyImagesCS.resize(data.getCaps().maxImageUnits);
mShaderUniformsDirty.set(gl::ShaderType::Compute);
- defineUniformsAndAssignRegisters(context);
+ defineUniformsAndAssignRegisters();
- linkResources(context, resources);
+ linkResources(resources);
gl::LinkResult result = compileComputeExecutable(context, infoLog);
if (result.isError())
@@ -1671,8 +1666,8 @@
ProgramD3DMetadata metadata(mRenderer, shadersD3D);
BuiltinVaryingsD3D builtins(metadata, resources.varyingPacking);
- mDynamicHLSL->generateShaderLinkHLSL(context, mState, metadata, resources.varyingPacking,
- builtins, &mShaderHLSL);
+ mDynamicHLSL->generateShaderLinkHLSL(context->getCaps(), mState, metadata,
+ resources.varyingPacking, builtins, &mShaderHLSL);
mUsesPointSize = shadersD3D[gl::ShaderType::Vertex]->usesPointSize();
mDynamicHLSL->getPixelShaderOutputKey(data, mState, metadata, &mPixelShaderKey);
@@ -1681,7 +1676,7 @@
mHasANGLEMultiviewEnabled = metadata.hasANGLEMultiviewEnabled();
// Cache if we use flat shading
- mUsesFlatInterpolation = FindFlatInterpolationVarying(context, mState.getAttachedShaders());
+ mUsesFlatInterpolation = FindFlatInterpolationVarying(mState.getAttachedShaders());
if (mRenderer->getMajorShaderModel() >= 4)
{
@@ -1690,13 +1685,13 @@
metadata.canSelectViewInVertexShader());
}
- initAttribLocationsToD3DSemantic(context);
+ initAttribLocationsToD3DSemantic();
- defineUniformsAndAssignRegisters(context);
+ defineUniformsAndAssignRegisters();
gatherTransformFeedbackVaryings(resources.varyingPacking, builtins[gl::ShaderType::Vertex]);
- linkResources(context, resources);
+ linkResources(resources);
return compileProgramExecutables(context, infoLog);
}
@@ -1994,7 +1989,7 @@
mRenderer->onDirtyUniformBlockBinding(uniformBlockIndex);
}
-void ProgramD3D::defineUniformsAndAssignRegisters(const gl::Context *context)
+void ProgramD3D::defineUniformsAndAssignRegisters()
{
D3DUniformMap uniformMap;
@@ -2004,7 +1999,7 @@
gl::Shader *shader = mState.getAttachedShader(shaderType);
if (shader)
{
- for (const sh::Uniform &uniform : shader->getUniforms(context))
+ for (const sh::Uniform &uniform : shader->getUniforms())
{
if (uniform.active)
{
@@ -2571,14 +2566,14 @@
return mCurrentSerial++;
}
-void ProgramD3D::initAttribLocationsToD3DSemantic(const gl::Context *context)
+void ProgramD3D::initAttribLocationsToD3DSemantic()
{
gl::Shader *vertexShader = mState.getAttachedShader(gl::ShaderType::Vertex);
ASSERT(vertexShader != nullptr);
// Init semantic index
int semanticIndex = 0;
- for (const sh::Attribute &attribute : vertexShader->getActiveAttributes(context))
+ for (const sh::Attribute &attribute : vertexShader->getActiveAttributes())
{
int regCount = gl::VariableRegisterCount(attribute.type);
GLuint location = mState.getAttributeLocation(attribute.name);
@@ -2811,8 +2806,7 @@
}
}
-void ProgramD3D::linkResources(const gl::Context *context,
- const gl::ProgramLinkedResources &resources)
+void ProgramD3D::linkResources(const gl::ProgramLinkedResources &resources)
{
UniformBlockInfo uniformBlockInfo;
for (gl::ShaderType shaderType : gl::AllShaderTypes())
@@ -2820,7 +2814,7 @@
gl::Shader *shader = mState.getAttachedShader(shaderType);
if (shader)
{
- uniformBlockInfo.getShaderBlockInfo(context, shader);
+ uniformBlockInfo.getShaderBlockInfo(shader);
}
}
diff --git a/src/libANGLE/renderer/d3d/ProgramD3D.h b/src/libANGLE/renderer/d3d/ProgramD3D.h
index 7be9d41..326d710 100644
--- a/src/libANGLE/renderer/d3d/ProgramD3D.h
+++ b/src/libANGLE/renderer/d3d/ProgramD3D.h
@@ -387,7 +387,7 @@
void initializeUniformStorage(const gl::ShaderBitSet &availableShaderStages);
- void defineUniformsAndAssignRegisters(const gl::Context *context);
+ void defineUniformsAndAssignRegisters();
void defineUniformBase(const gl::Shader *shader,
const sh::Uniform &uniform,
D3DUniformMap *uniformMap);
@@ -462,17 +462,17 @@
D3DUniform *getD3DUniformFromLocation(GLint location);
const D3DUniform *getD3DUniformFromLocation(GLint location) const;
- void initAttribLocationsToD3DSemantic(const gl::Context *context);
+ void initAttribLocationsToD3DSemantic();
void reset();
void initializeUniformBlocks();
- void updateCachedInputLayoutFromShader(const gl::Context *context);
+ void updateCachedInputLayoutFromShader();
void updateCachedOutputLayoutFromShader();
void updateCachedVertexExecutableIndex();
void updateCachedPixelExecutableIndex();
- void linkResources(const gl::Context *context, const gl::ProgramLinkedResources &resources);
+ void linkResources(const gl::ProgramLinkedResources &resources);
RendererD3D *mRenderer;
DynamicHLSL *mDynamicHLSL;
diff --git a/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/src/libANGLE/renderer/d3d/ShaderD3D.cpp
index 8798cb8..0d27f78 100644
--- a/src/libANGLE/renderer/d3d/ShaderD3D.cpp
+++ b/src/libANGLE/renderer/d3d/ShaderD3D.cpp
@@ -62,7 +62,7 @@
{
}
-std::string ShaderD3D::getDebugInfo(const gl::Context *context) const
+std::string ShaderD3D::getDebugInfo() const
{
if (mDebugInfo.empty())
{
@@ -174,9 +174,7 @@
return *uniformRegisterMap;
}
-bool ShaderD3D::postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog)
+bool ShaderD3D::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog)
{
// TODO(jmadill): We shouldn't need to cache this.
mCompilerOutputType = compiler->getShaderOutputType();
diff --git a/src/libANGLE/renderer/d3d/ShaderD3D.h b/src/libANGLE/renderer/d3d/ShaderD3D.h
index a6a7fb4..9239df7 100644
--- a/src/libANGLE/renderer/d3d/ShaderD3D.h
+++ b/src/libANGLE/renderer/d3d/ShaderD3D.h
@@ -42,10 +42,8 @@
ShCompileOptions prepareSourceAndReturnOptions(const gl::Context *context,
std::stringstream *sourceStream,
std::string *sourcePath) override;
- bool postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog) override;
- std::string getDebugInfo(const gl::Context *context) const override;
+ bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override;
+ std::string getDebugInfo() const override;
// D3D-specific methods
void uncompile();
diff --git a/src/libANGLE/renderer/gl/ContextGL.cpp b/src/libANGLE/renderer/gl/ContextGL.cpp
index c2ec78f..0ffc85f 100644
--- a/src/libANGLE/renderer/gl/ContextGL.cpp
+++ b/src/libANGLE/renderer/gl/ContextGL.cpp
@@ -55,7 +55,7 @@
const FunctionsGL *functions = getFunctions();
GLuint shader = functions->createShader(ToGLenum(data.getShaderType()));
- return new ShaderGL(data, shader, mRenderer->getMultiviewImplementationType());
+ return new ShaderGL(data, shader, mRenderer->getMultiviewImplementationType(), functions);
}
ProgramImpl *ContextGL::createProgram(const gl::ProgramState &data)
diff --git a/src/libANGLE/renderer/gl/ProgramGL.cpp b/src/libANGLE/renderer/gl/ProgramGL.cpp
index 3c6fd40..e3789c3 100644
--- a/src/libANGLE/renderer/gl/ProgramGL.cpp
+++ b/src/libANGLE/renderer/gl/ProgramGL.cpp
@@ -160,7 +160,7 @@
{
std::string tfVaryingMappedName =
mState.getAttachedShader(gl::ShaderType::Vertex)
- ->getTransformFeedbackVaryingMappedName(tfVarying, context);
+ ->getTransformFeedbackVaryingMappedName(tfVarying);
transformFeedbackVaryingMappedNames.push_back(tfVaryingMappedName);
}
diff --git a/src/libANGLE/renderer/gl/ShaderGL.cpp b/src/libANGLE/renderer/gl/ShaderGL.cpp
index dc3fc8d..fa053ab 100644
--- a/src/libANGLE/renderer/gl/ShaderGL.cpp
+++ b/src/libANGLE/renderer/gl/ShaderGL.cpp
@@ -22,10 +22,12 @@
ShaderGL::ShaderGL(const gl::ShaderState &data,
GLuint shaderID,
- MultiviewImplementationTypeGL multiviewImplementationType)
+ MultiviewImplementationTypeGL multiviewImplementationType,
+ const FunctionsGL *functions)
: ShaderImpl(data),
mShaderID(shaderID),
- mMultiviewImplementationType(multiviewImplementationType)
+ mMultiviewImplementationType(multiviewImplementationType),
+ mFunctions(functions)
{
}
@@ -34,10 +36,9 @@
ASSERT(mShaderID == 0);
}
-void ShaderGL::destroy(const gl::Context *context)
+void ShaderGL::destroy()
{
- const FunctionsGL *functions = GetFunctionsGL(context);
- functions->deleteShader(mShaderID);
+ mFunctions->deleteShader(mShaderID);
mShaderID = 0;
}
@@ -141,33 +142,30 @@
return options;
}
-bool ShaderGL::postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog)
+bool ShaderGL::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog)
{
// Translate the ESSL into GLSL
const char *translatedSourceCString = mData.getTranslatedSource().c_str();
// Set the source
- const FunctionsGL *functions = GetFunctionsGL(context);
- functions->shaderSource(mShaderID, 1, &translatedSourceCString, nullptr);
- functions->compileShader(mShaderID);
+ mFunctions->shaderSource(mShaderID, 1, &translatedSourceCString, nullptr);
+ mFunctions->compileShader(mShaderID);
// Check for compile errors from the native driver
GLint compileStatus = GL_FALSE;
- functions->getShaderiv(mShaderID, GL_COMPILE_STATUS, &compileStatus);
+ mFunctions->getShaderiv(mShaderID, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus == GL_FALSE)
{
// Compilation failed, put the error into the info log
GLint infoLogLength = 0;
- functions->getShaderiv(mShaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
+ mFunctions->getShaderiv(mShaderID, GL_INFO_LOG_LENGTH, &infoLogLength);
// Info log length includes the null terminator, so 1 means that the info log is an empty
// string.
if (infoLogLength > 1)
{
std::vector<char> buf(infoLogLength);
- functions->getShaderInfoLog(mShaderID, infoLogLength, nullptr, &buf[0]);
+ mFunctions->getShaderInfoLog(mShaderID, infoLogLength, nullptr, &buf[0]);
*infoLog = &buf[0];
WARN() << std::endl << *infoLog;
@@ -182,7 +180,7 @@
return true;
}
-std::string ShaderGL::getDebugInfo(const gl::Context *context) const
+std::string ShaderGL::getDebugInfo() const
{
return mData.getTranslatedSource();
}
diff --git a/src/libANGLE/renderer/gl/ShaderGL.h b/src/libANGLE/renderer/gl/ShaderGL.h
index 3023fb5..0ba8843 100644
--- a/src/libANGLE/renderer/gl/ShaderGL.h
+++ b/src/libANGLE/renderer/gl/ShaderGL.h
@@ -22,25 +22,25 @@
public:
ShaderGL(const gl::ShaderState &data,
GLuint shaderID,
- MultiviewImplementationTypeGL multiviewImplementationType);
+ MultiviewImplementationTypeGL multiviewImplementationType,
+ const FunctionsGL *functions);
~ShaderGL() override;
- void destroy(const gl::Context *context) override;
+ void destroy() override;
// ShaderImpl implementation
ShCompileOptions prepareSourceAndReturnOptions(const gl::Context *context,
std::stringstream *sourceStream,
std::string *sourcePath) override;
- bool postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog) override;
- std::string getDebugInfo(const gl::Context *context) const override;
+ bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override;
+ std::string getDebugInfo() const override;
GLuint getShaderID() const;
private:
GLuint mShaderID;
MultiviewImplementationTypeGL mMultiviewImplementationType;
+ const FunctionsGL *mFunctions;
};
}
diff --git a/src/libANGLE/renderer/null/ShaderNULL.cpp b/src/libANGLE/renderer/null/ShaderNULL.cpp
index 59ae007..4e3b9e7 100644
--- a/src/libANGLE/renderer/null/ShaderNULL.cpp
+++ b/src/libANGLE/renderer/null/ShaderNULL.cpp
@@ -30,14 +30,12 @@
return 0;
}
-bool ShaderNULL::postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog)
+bool ShaderNULL::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog)
{
return true;
}
-std::string ShaderNULL::getDebugInfo(const gl::Context *context) const
+std::string ShaderNULL::getDebugInfo() const
{
return "";
}
diff --git a/src/libANGLE/renderer/null/ShaderNULL.h b/src/libANGLE/renderer/null/ShaderNULL.h
index 0a415f3..04a58c0 100644
--- a/src/libANGLE/renderer/null/ShaderNULL.h
+++ b/src/libANGLE/renderer/null/ShaderNULL.h
@@ -26,11 +26,9 @@
std::stringstream *sourceStream,
std::string *sourcePath) override;
// Returns success for compiling on the driver. Returns success.
- bool postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog) override;
+ bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override;
- std::string getDebugInfo(const gl::Context *context) const override;
+ std::string getDebugInfo() const override;
};
} // namespace rx
diff --git a/src/libANGLE/renderer/vulkan/GlslangWrapper.cpp b/src/libANGLE/renderer/vulkan/GlslangWrapper.cpp
index 7b6f350..2356a85 100644
--- a/src/libANGLE/renderer/vulkan/GlslangWrapper.cpp
+++ b/src/libANGLE/renderer/vulkan/GlslangWrapper.cpp
@@ -135,8 +135,7 @@
}
// static
-void GlslangWrapper::GetShaderSource(const gl::Context *glContext,
- const gl::ProgramState &programState,
+void GlslangWrapper::GetShaderSource(const gl::ProgramState &programState,
const gl::ProgramLinkedResources &resources,
std::string *vertexSourceOut,
std::string *fragmentSourceOut)
@@ -144,8 +143,8 @@
gl::Shader *glVertexShader = programState.getAttachedShader(gl::ShaderType::Vertex);
gl::Shader *glFragmentShader = programState.getAttachedShader(gl::ShaderType::Fragment);
- std::string vertexSource = glVertexShader->getTranslatedSource(glContext);
- std::string fragmentSource = glFragmentShader->getTranslatedSource(glContext);
+ std::string vertexSource = glVertexShader->getTranslatedSource();
+ std::string fragmentSource = glFragmentShader->getTranslatedSource();
// Parse attribute locations and replace them in the vertex shader.
// See corresponding code in OutputVulkanGLSL.cpp.
@@ -164,7 +163,7 @@
// The attributes in the programState could have been filled with active attributes only
// depending on the shader version. If there is inactive attributes left, we have to remove
// their @@ QUALIFIER and @@ LAYOUT markers.
- for (const sh::Attribute &attribute : glVertexShader->getAllAttributes(glContext))
+ for (const sh::Attribute &attribute : glVertexShader->getAllAttributes())
{
if (attribute.active)
{
diff --git a/src/libANGLE/renderer/vulkan/GlslangWrapper.h b/src/libANGLE/renderer/vulkan/GlslangWrapper.h
index 4db938c..aff6747 100644
--- a/src/libANGLE/renderer/vulkan/GlslangWrapper.h
+++ b/src/libANGLE/renderer/vulkan/GlslangWrapper.h
@@ -22,8 +22,7 @@
static void Initialize();
static void Release();
- static void GetShaderSource(const gl::Context *glContext,
- const gl::ProgramState &programState,
+ static void GetShaderSource(const gl::ProgramState &programState,
const gl::ProgramLinkedResources &resources,
std::string *vertexSourceOut,
std::string *fragmentSourceOut);
diff --git a/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
index 5fdaa8b..f27e92d 100644
--- a/src/libANGLE/renderer/vulkan/ProgramVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ProgramVk.cpp
@@ -268,7 +268,7 @@
ANGLE_TRY(reset(contextVk));
- GlslangWrapper::GetShaderSource(glContext, mState, resources, &mVertexSource, &mFragmentSource);
+ GlslangWrapper::GetShaderSource(mState, resources, &mVertexSource, &mFragmentSource);
ANGLE_TRY(initDefaultUniformBlocks(glContext));
@@ -355,7 +355,7 @@
{
gl::ShaderType glShaderType = static_cast<gl::ShaderType>(shaderType);
gl::Shader *shader = mState.getAttachedShader(glShaderType);
- const std::vector<sh::Uniform> &uniforms = shader->getUniforms(glContext);
+ const std::vector<sh::Uniform> &uniforms = shader->getUniforms();
InitDefaultUniformBlock(uniforms, shader, &layoutMap[shaderType],
&requiredBufferSize[shaderType]);
}
diff --git a/src/libANGLE/renderer/vulkan/ShaderVk.cpp b/src/libANGLE/renderer/vulkan/ShaderVk.cpp
index b840c2d..c1e21b6 100644
--- a/src/libANGLE/renderer/vulkan/ShaderVk.cpp
+++ b/src/libANGLE/renderer/vulkan/ShaderVk.cpp
@@ -30,15 +30,13 @@
return SH_INITIALIZE_UNINITIALIZED_LOCALS;
}
-bool ShaderVk::postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog)
+bool ShaderVk::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog)
{
// No work to do here.
return true;
}
-std::string ShaderVk::getDebugInfo(const gl::Context *context) const
+std::string ShaderVk::getDebugInfo() const
{
return std::string();
}
diff --git a/src/libANGLE/renderer/vulkan/ShaderVk.h b/src/libANGLE/renderer/vulkan/ShaderVk.h
index 202f4d3..5e42907 100644
--- a/src/libANGLE/renderer/vulkan/ShaderVk.h
+++ b/src/libANGLE/renderer/vulkan/ShaderVk.h
@@ -26,11 +26,9 @@
std::stringstream *sourceStream,
std::string *sourcePath) override;
// Returns success for compiling on the driver. Returns success.
- bool postTranslateCompile(const gl::Context *context,
- gl::Compiler *compiler,
- std::string *infoLog) override;
+ bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override;
- std::string getDebugInfo(const gl::Context *context) const override;
+ std::string getDebugInfo() const override;
};
} // namespace rx