mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1128044 - Enforce packing restrictions for varyings. - r=kamidphish
This commit is contained in:
parent
24475431d2
commit
358995c577
@ -147,7 +147,7 @@ ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec,
|
|||||||
if (!handle)
|
if (!handle)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return new ShaderValidator(handle, compileOptions);
|
return new ShaderValidator(handle, compileOptions, resources.MaxVaryingVectors);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderValidator::~ShaderValidator()
|
ShaderValidator::~ShaderValidator()
|
||||||
@ -220,12 +220,21 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
|
|||||||
const std::vector<sh::Varying>& vertList = *ShGetVaryings(prev->mHandle);
|
const std::vector<sh::Varying>& vertList = *ShGetVaryings(prev->mHandle);
|
||||||
const std::vector<sh::Varying>& fragList = *ShGetVaryings(mHandle);
|
const std::vector<sh::Varying>& fragList = *ShGetVaryings(mHandle);
|
||||||
|
|
||||||
|
std::vector<ShVariableInfo> staticUseVaryingList;
|
||||||
|
|
||||||
for (auto itrFrag = fragList.begin(); itrFrag != fragList.end(); ++itrFrag) {
|
for (auto itrFrag = fragList.begin(); itrFrag != fragList.end(); ++itrFrag) {
|
||||||
static const char prefix[] = "gl_";
|
static const char prefix[] = "gl_";
|
||||||
if (StartsWith(itrFrag->name, prefix))
|
if (StartsWith(itrFrag->name, prefix)) {
|
||||||
|
if (itrFrag->staticUse) {
|
||||||
|
staticUseVaryingList.push_back({itrFrag->type,
|
||||||
|
(int)itrFrag->elementCount()});
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
bool definedInVertShader = false;
|
bool definedInVertShader = false;
|
||||||
|
bool staticVertUse = false;
|
||||||
|
|
||||||
for (auto itrVert = vertList.begin(); itrVert != vertList.end(); ++itrVert) {
|
for (auto itrVert = vertList.begin(); itrVert != vertList.end(); ++itrVert) {
|
||||||
if (itrVert->name != itrFrag->name)
|
if (itrVert->name != itrFrag->name)
|
||||||
@ -240,6 +249,7 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
|
|||||||
}
|
}
|
||||||
|
|
||||||
definedInVertShader = true;
|
definedInVertShader = true;
|
||||||
|
staticVertUse = itrVert->staticUse;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,6 +260,17 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
|
|||||||
*out_log = error;
|
*out_log = error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
staticUseVaryingList.push_back({itrFrag->type, (int)itrFrag->elementCount()});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ShCheckVariablesWithinPackingLimits(mMaxVaryingVectors,
|
||||||
|
staticUseVaryingList.data(),
|
||||||
|
staticUseVaryingList.size()))
|
||||||
|
{
|
||||||
|
*out_log = "Statically used varyings do not fit within packing limits. (see"
|
||||||
|
" GLSL ES Specification 1.0.17, p111)";
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ class ShaderValidator MOZ_FINAL
|
|||||||
{
|
{
|
||||||
const ShHandle mHandle;
|
const ShHandle mHandle;
|
||||||
const int mCompileOptions;
|
const int mCompileOptions;
|
||||||
|
const int mMaxVaryingVectors;
|
||||||
bool mHasRun;
|
bool mHasRun;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -27,9 +28,10 @@ public:
|
|||||||
int compileOptions);
|
int compileOptions);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ShaderValidator(ShHandle handle, int compileOptions)
|
ShaderValidator(ShHandle handle, int compileOptions, int maxVaryingVectors)
|
||||||
: mHandle(handle)
|
: mHandle(handle)
|
||||||
, mCompileOptions(compileOptions)
|
, mCompileOptions(compileOptions)
|
||||||
|
, mMaxVaryingVectors(maxVaryingVectors)
|
||||||
, mHasRun(false)
|
, mHasRun(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user