mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1203135 - Terminate linking if maximum vertex attribute count is exceeded on Mesa. r=jgilbert
This commit is contained in:
parent
097f7f5601
commit
35ea764551
@ -911,18 +911,26 @@ WebGLProgram::LinkProgram()
|
||||
gl::GLContext* gl = mContext->gl;
|
||||
gl->MakeCurrent();
|
||||
|
||||
// Bug 777028: Mesa can't handle more than 16 samplers per program,
|
||||
// counting each array entry.
|
||||
size_t numSamplerUniforms_upperBound = mVertShader->CalcNumSamplerUniforms() +
|
||||
mFragShader->CalcNumSamplerUniforms();
|
||||
if (gl->WorkAroundDriverBugs() &&
|
||||
mContext->mIsMesa &&
|
||||
numSamplerUniforms_upperBound > 16)
|
||||
mContext->mIsMesa)
|
||||
{
|
||||
mLinkLog.AssignLiteral("Programs with more than 16 samplers are disallowed on"
|
||||
" Mesa drivers to avoid crashing.");
|
||||
mContext->GenerateWarning("linkProgram: %s", mLinkLog.BeginReading());
|
||||
return false;
|
||||
// Bug 777028: Mesa can't handle more than 16 samplers per program,
|
||||
// counting each array entry.
|
||||
size_t numSamplerUniforms_upperBound = mVertShader->CalcNumSamplerUniforms() +
|
||||
mFragShader->CalcNumSamplerUniforms();
|
||||
if (numSamplerUniforms_upperBound > 16) {
|
||||
mLinkLog.AssignLiteral("Programs with more than 16 samplers are disallowed on"
|
||||
" Mesa drivers to avoid crashing.");
|
||||
mContext->GenerateWarning("linkProgram: %s", mLinkLog.BeginReading());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Bug 1203135: Mesa crashes internally if we exceed the reported maximum attribute count.
|
||||
if (mVertShader->NumAttributes() > mContext->MaxVertexAttribs()) {
|
||||
mLinkLog.AssignLiteral("Number of attributes exceeds Mesa's reported max attribute count.");
|
||||
mContext->GenerateWarning("linkProgram: %s", mLinkLog.BeginReading());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Bind the attrib locations.
|
||||
|
@ -308,6 +308,16 @@ WebGLShader::CalcNumSamplerUniforms() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
WebGLShader::NumAttributes() const
|
||||
{
|
||||
if (mValidator)
|
||||
return mValidator->NumAttributes();
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
WebGLShader::BindAttribLocation(GLuint prog, const nsCString& userName,
|
||||
GLuint index) const
|
||||
|
@ -50,6 +50,7 @@ public:
|
||||
// Util funcs
|
||||
bool CanLinkTo(const WebGLShader* prev, nsCString* const out_log) const;
|
||||
size_t CalcNumSamplerUniforms() const;
|
||||
size_t NumAttributes() const;
|
||||
void BindAttribLocation(GLuint prog, const nsCString& userName, GLuint index) const;
|
||||
bool FindAttribUserNameByMappedName(const nsACString& mappedName,
|
||||
nsDependentCString* const out_userName) const;
|
||||
|
@ -329,6 +329,12 @@ ShaderValidator::CalcNumSamplerUniforms() const
|
||||
return accum;
|
||||
}
|
||||
|
||||
size_t
|
||||
ShaderValidator::NumAttributes() const
|
||||
{
|
||||
return ShGetAttributes(mHandle)->size();
|
||||
}
|
||||
|
||||
// Attribs cannot be structs or arrays, and neither can vertex inputs in ES3.
|
||||
// Therefore, attrib names are always simple.
|
||||
bool
|
||||
|
@ -43,6 +43,7 @@ public:
|
||||
void GetOutput(nsACString* out) const;
|
||||
bool CanLinkTo(const ShaderValidator* prev, nsCString* const out_log) const;
|
||||
size_t CalcNumSamplerUniforms() const;
|
||||
size_t NumAttributes() const;
|
||||
|
||||
bool FindAttribUserNameByMappedName(const std::string& mappedName,
|
||||
const std::string** const out_userName) const;
|
||||
|
Loading…
Reference in New Issue
Block a user