Bug 1405600 - Part 1: Initialize uniform blocks before detaching shaders; r?jgilbert
ANLGE has resolved this issue at 753521
MozReview-Commit-ID: 4fQ1XuGxWLn
--- a/gfx/angle/src/libANGLE/Program.cpp
+++ b/gfx/angle/src/libANGLE/Program.cpp
@@ -812,16 +812,22 @@ Error Program::link(const gl::Context *c
// Save to the program cache.
if (cache && (mState.mLinkedTransformFeedbackVaryings.empty() ||
!context->getWorkarounds().disableProgramCachingForTransformFeedback))
{
cache->putProgram(programHash, context, this);
}
+ // Because we do lazy init in ensureUniformBlocksInitialized,
+ // we must initialize them when linking shaders,
+ // otherwise, we will have no shaders for getting uniform blocks
+ // information from shaders when doing draw calls.
+ mProgram->ensureUniformBlocksInitialized();
+
double delta = platform->currentTime(platform) - startTime;
int us = static_cast<int>(delta * 1000000.0);
ANGLE_HISTOGRAM_COUNTS("GPU.ANGLE.ProgramCache.ProgramCacheMissTimeUS", us);
return NoError();
}
// Returns the program object to an unlinked state, before re-linking, or at destruction
--- a/gfx/angle/src/libANGLE/renderer/ProgramImpl.h
+++ b/gfx/angle/src/libANGLE/renderer/ProgramImpl.h
@@ -105,15 +105,19 @@ class ProgramImpl : angle::NonCopyable
// Implementation-specific method for ignoring unreferenced uniforms. Some implementations may
// perform more extensive analysis and ignore some locations that ANGLE doesn't detect as
// unreferenced. This method is not required to be overriden by a back-end.
virtual void markUnusedUniformLocations(std::vector<gl::VariableLocation> *uniformLocations,
std::vector<gl::SamplerBinding> *samplerBindings)
{
}
+ virtual void ensureUniformBlocksInitialized()
+ {
+ }
+
protected:
const gl::ProgramState &mState;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_PROGRAMIMPL_H_
--- a/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.h
@@ -265,16 +265,17 @@ class ProgramD3D : public ProgramImpl
GLboolean transpose,
const GLfloat *value);
void getUniformfv(const gl::Context *context, GLint location, GLfloat *params) const override;
void getUniformiv(const gl::Context *context, GLint location, GLint *params) const override;
void getUniformuiv(const gl::Context *context, GLint location, GLuint *params) const override;
void setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) override;
+ void ensureUniformBlocksInitialized() override;
UniformStorageD3D &getVertexUniformStorage() const { return *mVertexUniformStorage.get(); }
UniformStorageD3D &getFragmentUniformStorage() const { return *mFragmentUniformStorage.get(); }
UniformStorageD3D &getComputeUniformStorage() const { return *mComputeUniformStorage.get(); }
unsigned int getSerial() const;
const AttribIndexArray &getAttribLocationToD3DSemantics() const
@@ -423,17 +424,16 @@ class ProgramD3D : public ProgramImpl
const BuiltinInfo &builtins);
D3DUniform *getD3DUniformByName(const std::string &name);
D3DUniform *getD3DUniformFromLocation(GLint location);
const D3DUniform *getD3DUniformFromLocation(GLint location) const;
void initAttribLocationsToD3DSemantic(const gl::Context *context);
void reset();
- void ensureUniformBlocksInitialized();
void initUniformBlockInfo(const gl::Context *context, gl::Shader *shader);
size_t getUniformBlockInfo(const sh::InterfaceBlock &interfaceBlock);
void updateCachedInputLayoutFromShader(const gl::Context *context);
void updateCachedOutputLayoutFromShader();
void updateCachedVertexExecutableIndex();
void updateCachedPixelExecutableIndex();