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
4d39518521
commit
27b9ac71a1
@ -147,7 +147,7 @@ ShaderValidator::Create(GLenum shaderType, ShShaderSpec spec,
|
||||
if (!handle)
|
||||
return nullptr;
|
||||
|
||||
return new ShaderValidator(handle, compileOptions);
|
||||
return new ShaderValidator(handle, compileOptions, resources.MaxVaryingVectors);
|
||||
}
|
||||
|
||||
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>& fragList = *ShGetVaryings(mHandle);
|
||||
|
||||
std::vector<ShVariableInfo> staticUseVaryingList;
|
||||
|
||||
for (auto itrFrag = fragList.begin(); itrFrag != fragList.end(); ++itrFrag) {
|
||||
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;
|
||||
}
|
||||
|
||||
bool definedInVertShader = false;
|
||||
bool staticVertUse = false;
|
||||
|
||||
for (auto itrVert = vertList.begin(); itrVert != vertList.end(); ++itrVert) {
|
||||
if (itrVert->name != itrFrag->name)
|
||||
@ -240,6 +249,7 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
|
||||
}
|
||||
|
||||
definedInVertShader = true;
|
||||
staticVertUse = itrVert->staticUse;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -250,6 +260,17 @@ ShaderValidator::CanLinkTo(const ShaderValidator* prev, nsCString* const out_log
|
||||
*out_log = error;
|
||||
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 int mCompileOptions;
|
||||
const int mMaxVaryingVectors;
|
||||
bool mHasRun;
|
||||
|
||||
public:
|
||||
@ -27,9 +28,10 @@ public:
|
||||
int compileOptions);
|
||||
|
||||
private:
|
||||
ShaderValidator(ShHandle handle, int compileOptions)
|
||||
ShaderValidator(ShHandle handle, int compileOptions, int maxVaryingVectors)
|
||||
: mHandle(handle)
|
||||
, mCompileOptions(compileOptions)
|
||||
, mMaxVaryingVectors(maxVaryingVectors)
|
||||
, mHasRun(false)
|
||||
{ }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user