зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1012407 - Part 1: Reduce amount of data uploaded to GPU (layer quad rect instead of transform) r=Bas
This commit is contained in:
Родитель
dd1958ea97
Коммит
202b439890
|
@ -32,7 +32,7 @@ AddUniforms(ProgramProfileOGL& aProfile)
|
|||
static const char *sKnownUniformNames[] = {
|
||||
"uLayerTransform",
|
||||
"uMaskQuadTransform",
|
||||
"uLayerQuadTransform",
|
||||
"uLayerQuadRect",
|
||||
"uMatrixProj",
|
||||
"uTextureTransform",
|
||||
"uRenderTargetOffset",
|
||||
|
@ -145,7 +145,7 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
|||
AddUniforms(result);
|
||||
|
||||
vs << "uniform mat4 uMatrixProj;" << endl;
|
||||
vs << "uniform mat4 uLayerQuadTransform;" << endl;
|
||||
vs << "uniform vec4 uLayerQuadRect;" << endl;
|
||||
vs << "uniform mat4 uLayerTransform;" << endl;
|
||||
vs << "uniform vec4 uRenderTargetOffset;" << endl;
|
||||
|
||||
|
@ -164,8 +164,7 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
|
|||
}
|
||||
|
||||
vs << "void main() {" << endl;
|
||||
vs << " vec4 finalPosition = aVertexCoord;" << endl;
|
||||
vs << " finalPosition = uLayerQuadTransform * finalPosition;" << endl;
|
||||
vs << " vec4 finalPosition = vec4(aVertexCoord.xy * uLayerQuadRect.zw + uLayerQuadRect.xy, 0.0, 1.0);" << endl;
|
||||
vs << " finalPosition = uLayerTransform * finalPosition;" << endl;
|
||||
vs << " finalPosition.xyz /= finalPosition.w;" << endl;
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
LayerTransform = 0,
|
||||
MaskQuadTransform,
|
||||
LayerQuadTransform,
|
||||
LayerQuadRect,
|
||||
MatrixProj,
|
||||
TextureTransform,
|
||||
RenderTargetOffset,
|
||||
|
@ -322,21 +322,13 @@ public:
|
|||
}
|
||||
|
||||
void SetLayerQuadRect(const nsIntRect& aRect) {
|
||||
gfx3DMatrix m;
|
||||
m._11 = float(aRect.width);
|
||||
m._22 = float(aRect.height);
|
||||
m._41 = float(aRect.x);
|
||||
m._42 = float(aRect.y);
|
||||
SetMatrixUniform(KnownUniform::LayerQuadTransform, m);
|
||||
float vals[4] = { float(aRect.x), float(aRect.y), float(aRect.width), float(aRect.height) };
|
||||
SetUniform(KnownUniform::LayerQuadRect, 4, vals);
|
||||
}
|
||||
|
||||
void SetLayerQuadRect(const gfx::Rect& aRect) {
|
||||
gfx3DMatrix m;
|
||||
m._11 = aRect.width;
|
||||
m._22 = aRect.height;
|
||||
m._41 = aRect.x;
|
||||
m._42 = aRect.y;
|
||||
SetMatrixUniform(KnownUniform::LayerQuadTransform, m);
|
||||
float vals[4] = { float(aRect.x), float(aRect.y), float(aRect.width), float(aRect.height) };
|
||||
SetUniform(KnownUniform::LayerQuadRect, 4, vals);
|
||||
}
|
||||
|
||||
void SetProjectionMatrix(const gfx::Matrix4x4& aMatrix) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче