mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 894891 - Move texture transform from the RGBATextureLayerExternal shader into the vertex shader, and combine the two GL_TEXTURE_EXTERNAL shaders. r=jrmuziel
This commit is contained in:
parent
39cbcffa7c
commit
25483332a6
@ -330,6 +330,7 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
|||||||
}
|
}
|
||||||
program->SetLayerQuadRect(drawRect);
|
program->SetLayerQuadRect(drawRect);
|
||||||
program->SetLayerTransform(GetEffectiveTransform());
|
program->SetLayerTransform(GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->SetTextureUnit(0);
|
program->SetTextureUnit(0);
|
||||||
|
@ -37,6 +37,7 @@ RenderColorLayer(ColorLayer* aLayer, LayerManagerOGL *aManager,
|
|||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(aLayer->GetBounds());
|
program->SetLayerQuadRect(aLayer->GetBounds());
|
||||||
program->SetLayerTransform(aLayer->GetEffectiveTransform());
|
program->SetLayerTransform(aLayer->GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->SetRenderColor(color);
|
program->SetRenderColor(color);
|
||||||
program->LoadMask(aLayer->GetMaskLayer());
|
program->LoadMask(aLayer->GetMaskLayer());
|
||||||
|
@ -1038,6 +1038,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
|||||||
}
|
}
|
||||||
program->SetLayerQuadRect(aRect);
|
program->SetLayerQuadRect(aRect);
|
||||||
program->SetLayerTransform(aTransform);
|
program->SetLayerTransform(aTransform);
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetRenderOffset(aOffset.x, aOffset.y);
|
program->SetRenderOffset(aOffset.x, aOffset.y);
|
||||||
|
|
||||||
switch (aEffectChain.mPrimaryEffect->mType) {
|
switch (aEffectChain.mPrimaryEffect->mType) {
|
||||||
@ -1085,9 +1086,8 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
AutoBindTexture bindSource(source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
|
AutoBindTexture bindSource(source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
|
||||||
if (programType == RGBALayerExternalProgramType) {
|
|
||||||
program->SetTextureTransform(source->AsSourceOGL()->GetTextureTransform());
|
program->SetTextureTransform(source->AsSourceOGL()->GetTextureTransform());
|
||||||
}
|
|
||||||
|
|
||||||
mGLContext->ApplyFilterToBoundTexture(source->AsSourceOGL()->GetTextureTarget(),
|
mGLContext->ApplyFilterToBoundTexture(source->AsSourceOGL()->GetTextureTarget(),
|
||||||
ThebesFilter(texturedEffect->mFilter));
|
ThebesFilter(texturedEffect->mFilter));
|
||||||
@ -1216,6 +1216,7 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
|||||||
program->SetWhiteTextureUnit(1);
|
program->SetWhiteTextureUnit(1);
|
||||||
program->SetLayerOpacity(aOpacity);
|
program->SetLayerOpacity(aOpacity);
|
||||||
program->SetLayerTransform(aTransform);
|
program->SetLayerTransform(aTransform);
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetRenderOffset(aOffset.x, aOffset.y);
|
program->SetRenderOffset(aOffset.x, aOffset.y);
|
||||||
program->SetLayerQuadRect(aRect);
|
program->SetLayerQuadRect(aRect);
|
||||||
AutoBindTexture bindMask;
|
AutoBindTexture bindMask;
|
||||||
|
@ -322,6 +322,7 @@ ContainerRender(Container* aContainer,
|
|||||||
rgb->Activate();
|
rgb->Activate();
|
||||||
rgb->SetLayerQuadRect(visibleRect);
|
rgb->SetLayerQuadRect(visibleRect);
|
||||||
rgb->SetLayerTransform(transform);
|
rgb->SetLayerTransform(transform);
|
||||||
|
rgb->SetTextureTransform(gfx3DMatrix());
|
||||||
rgb->SetLayerOpacity(opacity);
|
rgb->SetLayerOpacity(opacity);
|
||||||
rgb->SetRenderOffset(aOffset);
|
rgb->SetRenderOffset(aOffset);
|
||||||
rgb->SetTextureUnit(0);
|
rgb->SetTextureUnit(0);
|
||||||
|
@ -239,6 +239,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||||||
yuvImage->GetSize().width,
|
yuvImage->GetSize().width,
|
||||||
yuvImage->GetSize().height));
|
yuvImage->GetSize().height));
|
||||||
program->SetLayerTransform(GetEffectiveTransform());
|
program->SetLayerTransform(GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->SetYCbCrTextureUnits(0, 1, 2);
|
program->SetYCbCrTextureUnits(0, 1, 2);
|
||||||
@ -297,6 +298,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||||||
cairoImage->GetSize().width,
|
cairoImage->GetSize().width,
|
||||||
cairoImage->GetSize().height));
|
cairoImage->GetSize().height));
|
||||||
program->SetLayerTransform(GetEffectiveTransform());
|
program->SetLayerTransform(GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->SetTextureUnit(0);
|
program->SetTextureUnit(0);
|
||||||
@ -324,6 +326,7 @@ ImageLayerOGL::RenderLayer(int,
|
|||||||
program->SetTexCoordMultiplier(data->mSize.width, data->mSize.height);
|
program->SetTexCoordMultiplier(data->mSize.width, data->mSize.height);
|
||||||
}
|
}
|
||||||
program->SetLayerTransform(GetEffectiveTransform());
|
program->SetLayerTransform(GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->SetTextureUnit(0);
|
program->SetTextureUnit(0);
|
||||||
|
@ -22,6 +22,7 @@ AddCommonArgs(ProgramProfileOGL& aProfile)
|
|||||||
{
|
{
|
||||||
aProfile.mUniforms.AppendElement(Argument("uLayerTransform"));
|
aProfile.mUniforms.AppendElement(Argument("uLayerTransform"));
|
||||||
aProfile.mUniforms.AppendElement(Argument("uLayerQuadTransform"));
|
aProfile.mUniforms.AppendElement(Argument("uLayerQuadTransform"));
|
||||||
|
aProfile.mUniforms.AppendElement(Argument("uTextureTransform"));
|
||||||
aProfile.mUniforms.AppendElement(Argument("uMatrixProj"));
|
aProfile.mUniforms.AppendElement(Argument("uMatrixProj"));
|
||||||
aProfile.mHasMatrixProj = true;
|
aProfile.mHasMatrixProj = true;
|
||||||
aProfile.mUniforms.AppendElement(Argument("uRenderTargetOffset"));
|
aProfile.mUniforms.AppendElement(Argument("uRenderTargetOffset"));
|
||||||
@ -58,23 +59,6 @@ ProgramProfileOGL::GetProfileFor(ShaderProgramType aType,
|
|||||||
AddCommonTextureArgs(result);
|
AddCommonTextureArgs(result);
|
||||||
result.mTextureCount = 1;
|
result.mTextureCount = 1;
|
||||||
break;
|
break;
|
||||||
case RGBALayerExternalProgramType:
|
|
||||||
if (aMask == Mask3d) {
|
|
||||||
result.mVertexShaderString = sLayerMask3DVS;
|
|
||||||
result.mFragmentShaderString = sRGBATextureLayerExternalMask3DFS;
|
|
||||||
} else if (aMask == Mask2d) {
|
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
|
||||||
result.mFragmentShaderString = sRGBATextureLayerExternalMaskFS;
|
|
||||||
} else {
|
|
||||||
result.mVertexShaderString = sLayerVS;
|
|
||||||
result.mFragmentShaderString = sRGBATextureLayerExternalFS;
|
|
||||||
}
|
|
||||||
AddCommonArgs(result);
|
|
||||||
AddCommonTextureArgs(result);
|
|
||||||
result.mUniforms.AppendElement(Argument("uTextureTransform"));
|
|
||||||
result.mHasTextureTransform = true;
|
|
||||||
result.mTextureCount = 1;
|
|
||||||
break;
|
|
||||||
case BGRALayerProgramType:
|
case BGRALayerProgramType:
|
||||||
if (aMask == Mask2d) {
|
if (aMask == Mask2d) {
|
||||||
result.mVertexShaderString = sLayerMaskVS;
|
result.mVertexShaderString = sLayerMaskVS;
|
||||||
|
@ -189,12 +189,10 @@ struct ProgramProfileOGL
|
|||||||
nsTArray<Argument> mAttributes;
|
nsTArray<Argument> mAttributes;
|
||||||
uint32_t mTextureCount;
|
uint32_t mTextureCount;
|
||||||
bool mHasMatrixProj;
|
bool mHasMatrixProj;
|
||||||
bool mHasTextureTransform;
|
|
||||||
private:
|
private:
|
||||||
ProgramProfileOGL() :
|
ProgramProfileOGL() :
|
||||||
mTextureCount(0),
|
mTextureCount(0),
|
||||||
mHasMatrixProj(false),
|
mHasMatrixProj(false) {}
|
||||||
mHasTextureTransform(false) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -315,13 +313,11 @@ public:
|
|||||||
|
|
||||||
// sets this program's texture transform, if it uses one
|
// sets this program's texture transform, if it uses one
|
||||||
void SetTextureTransform(const gfx3DMatrix& aMatrix) {
|
void SetTextureTransform(const gfx3DMatrix& aMatrix) {
|
||||||
if (mProfile.mHasTextureTransform)
|
SetMatrixUniform(mProfile.LookupUniformLocation("uTextureTransform"), aMatrix);
|
||||||
SetMatrixUniform(mProfile.LookupUniformLocation("uTextureTransform"), aMatrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTextureTransform(const gfx::Matrix4x4& aMatrix) {
|
void SetTextureTransform(const gfx::Matrix4x4& aMatrix) {
|
||||||
if (mProfile.mHasTextureTransform)
|
SetMatrixUniform(mProfile.LookupUniformLocation("uTextureTransform"), aMatrix);
|
||||||
SetMatrixUniform(mProfile.LookupUniformLocation("uTextureTransform"), aMatrix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRenderOffset(const nsIntPoint& aOffset) {
|
void SetRenderOffset(const nsIntPoint& aOffset) {
|
||||||
|
@ -6,6 +6,7 @@ static const char sLayerVS[] = "/* sLayerVS */\n\
|
|||||||
uniform mat4 uMatrixProj;\n\
|
uniform mat4 uMatrixProj;\n\
|
||||||
uniform mat4 uLayerQuadTransform;\n\
|
uniform mat4 uLayerQuadTransform;\n\
|
||||||
uniform mat4 uLayerTransform;\n\
|
uniform mat4 uLayerTransform;\n\
|
||||||
|
uniform mat4 uTextureTransform;\n\
|
||||||
uniform vec4 uRenderTargetOffset;\n\
|
uniform vec4 uRenderTargetOffset;\n\
|
||||||
attribute vec4 aVertexCoord;\n\
|
attribute vec4 aVertexCoord;\n\
|
||||||
attribute vec2 aTexCoord;\n\
|
attribute vec2 aTexCoord;\n\
|
||||||
@ -26,7 +27,7 @@ finalPosition.xyz /= finalPosition.w;\n\
|
|||||||
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
||||||
finalPosition.xyz *= finalPosition.w;\n\
|
finalPosition.xyz *= finalPosition.w;\n\
|
||||||
finalPosition = uMatrixProj * finalPosition;\n\
|
finalPosition = uMatrixProj * finalPosition;\n\
|
||||||
vTexCoord = aTexCoord;\n\
|
vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
|
||||||
gl_Position = finalPosition;\n\
|
gl_Position = finalPosition;\n\
|
||||||
}\n\
|
}\n\
|
||||||
";
|
";
|
||||||
@ -36,6 +37,7 @@ static const char sLayerMaskVS[] = "/* sLayerMaskVS */\n\
|
|||||||
uniform mat4 uMatrixProj;\n\
|
uniform mat4 uMatrixProj;\n\
|
||||||
uniform mat4 uLayerQuadTransform;\n\
|
uniform mat4 uLayerQuadTransform;\n\
|
||||||
uniform mat4 uLayerTransform;\n\
|
uniform mat4 uLayerTransform;\n\
|
||||||
|
uniform mat4 uTextureTransform;\n\
|
||||||
uniform vec4 uRenderTargetOffset;\n\
|
uniform vec4 uRenderTargetOffset;\n\
|
||||||
attribute vec4 aVertexCoord;\n\
|
attribute vec4 aVertexCoord;\n\
|
||||||
attribute vec2 aTexCoord;\n\
|
attribute vec2 aTexCoord;\n\
|
||||||
@ -59,7 +61,7 @@ vMaskCoord = (uMaskQuadTransform * finalPosition).xy;\n\
|
|||||||
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
||||||
finalPosition.xyz *= finalPosition.w;\n\
|
finalPosition.xyz *= finalPosition.w;\n\
|
||||||
finalPosition = uMatrixProj * finalPosition;\n\
|
finalPosition = uMatrixProj * finalPosition;\n\
|
||||||
vTexCoord = aTexCoord;\n\
|
vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
|
||||||
gl_Position = finalPosition;\n\
|
gl_Position = finalPosition;\n\
|
||||||
}\n\
|
}\n\
|
||||||
";
|
";
|
||||||
@ -69,6 +71,7 @@ static const char sLayerMask3DVS[] = "/* sLayerMask3DVS */\n\
|
|||||||
uniform mat4 uMatrixProj;\n\
|
uniform mat4 uMatrixProj;\n\
|
||||||
uniform mat4 uLayerQuadTransform;\n\
|
uniform mat4 uLayerQuadTransform;\n\
|
||||||
uniform mat4 uLayerTransform;\n\
|
uniform mat4 uLayerTransform;\n\
|
||||||
|
uniform mat4 uTextureTransform;\n\
|
||||||
uniform vec4 uRenderTargetOffset;\n\
|
uniform vec4 uRenderTargetOffset;\n\
|
||||||
attribute vec4 aVertexCoord;\n\
|
attribute vec4 aVertexCoord;\n\
|
||||||
attribute vec2 aTexCoord;\n\
|
attribute vec2 aTexCoord;\n\
|
||||||
@ -95,7 +98,7 @@ vMaskCoord *= finalPosition.w;\n\
|
|||||||
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
finalPosition = finalPosition - uRenderTargetOffset;\n\
|
||||||
finalPosition.xyz *= finalPosition.w;\n\
|
finalPosition.xyz *= finalPosition.w;\n\
|
||||||
finalPosition = uMatrixProj * finalPosition;\n\
|
finalPosition = uMatrixProj * finalPosition;\n\
|
||||||
vTexCoord = aTexCoord;\n\
|
vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
|
||||||
gl_Position = finalPosition;\n\
|
gl_Position = finalPosition;\n\
|
||||||
}\n\
|
}\n\
|
||||||
";
|
";
|
||||||
@ -252,106 +255,6 @@ gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
|
|||||||
}\n\
|
}\n\
|
||||||
";
|
";
|
||||||
|
|
||||||
static const char sRGBATextureLayerExternalFS[] = "/* sRGBATextureLayerExternalFS */\n\
|
|
||||||
#extension GL_OES_EGL_image_external : require\n\
|
|
||||||
#define MEDIUMP_SHADER 1\n\
|
|
||||||
/* Fragment Shader */\n\
|
|
||||||
#ifdef GL_ES\n\
|
|
||||||
#ifdef MEDIUMP_SHADER\n\
|
|
||||||
precision mediump float;\n\
|
|
||||||
#else\n\
|
|
||||||
precision lowp float;\n\
|
|
||||||
#endif\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
#ifndef NO_LAYER_OPACITY\n\
|
|
||||||
uniform float uLayerOpacity;\n\
|
|
||||||
#endif\n\
|
|
||||||
#ifdef GL_ES // for tiling, texcoord can be greater than the lowfp range\n\
|
|
||||||
varying mediump vec2 vTexCoord;\n\
|
|
||||||
#else\n\
|
|
||||||
varying vec2 vTexCoord;\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
uniform samplerExternalOES uTexture;\n\
|
|
||||||
uniform mat4 uTextureTransform;\n\
|
|
||||||
void main()\n\
|
|
||||||
{\n\
|
|
||||||
float mask = 1.0;\n\
|
|
||||||
\n\
|
|
||||||
gl_FragColor = texture2D(uTexture, (uTextureTransform * vec4(vTexCoord.x, vTexCoord.y, 0.0, 1.0)).xy) * uLayerOpacity * mask;\n\
|
|
||||||
}\n\
|
|
||||||
";
|
|
||||||
|
|
||||||
static const char sRGBATextureLayerExternalMaskFS[] = "/* sRGBATextureLayerExternalMaskFS */\n\
|
|
||||||
#extension GL_OES_EGL_image_external : require\n\
|
|
||||||
#define MEDIUMP_SHADER 1\n\
|
|
||||||
/* Fragment Shader */\n\
|
|
||||||
#ifdef GL_ES\n\
|
|
||||||
#ifdef MEDIUMP_SHADER\n\
|
|
||||||
precision mediump float;\n\
|
|
||||||
#else\n\
|
|
||||||
precision lowp float;\n\
|
|
||||||
#endif\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
#ifndef NO_LAYER_OPACITY\n\
|
|
||||||
uniform float uLayerOpacity;\n\
|
|
||||||
#endif\n\
|
|
||||||
#ifdef GL_ES // for tiling, texcoord can be greater than the lowfp range\n\
|
|
||||||
varying mediump vec2 vTexCoord;\n\
|
|
||||||
#else\n\
|
|
||||||
varying vec2 vTexCoord;\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
varying vec2 vMaskCoord;\n\
|
|
||||||
uniform sampler2D uMaskTexture;\n\
|
|
||||||
\n\
|
|
||||||
uniform samplerExternalOES uTexture;\n\
|
|
||||||
uniform mat4 uTextureTransform;\n\
|
|
||||||
void main()\n\
|
|
||||||
{\n\
|
|
||||||
float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
|
|
||||||
\n\
|
|
||||||
gl_FragColor = texture2D(uTexture, (uTextureTransform * vec4(vTexCoord.x, vTexCoord.y, 0.0, 1.0)).xy) * uLayerOpacity * mask;\n\
|
|
||||||
}\n\
|
|
||||||
";
|
|
||||||
|
|
||||||
static const char sRGBATextureLayerExternalMask3DFS[] = "/* sRGBATextureLayerExternalMask3DFS */\n\
|
|
||||||
#extension GL_OES_EGL_image_external : require\n\
|
|
||||||
#define MEDIUMP_SHADER 1\n\
|
|
||||||
/* Fragment Shader */\n\
|
|
||||||
#ifdef GL_ES\n\
|
|
||||||
#ifdef MEDIUMP_SHADER\n\
|
|
||||||
precision mediump float;\n\
|
|
||||||
#else\n\
|
|
||||||
precision lowp float;\n\
|
|
||||||
#endif\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
#ifndef NO_LAYER_OPACITY\n\
|
|
||||||
uniform float uLayerOpacity;\n\
|
|
||||||
#endif\n\
|
|
||||||
#ifdef GL_ES // for tiling, texcoord can be greater than the lowfp range\n\
|
|
||||||
varying mediump vec2 vTexCoord;\n\
|
|
||||||
#else\n\
|
|
||||||
varying vec2 vTexCoord;\n\
|
|
||||||
#endif\n\
|
|
||||||
\n\
|
|
||||||
varying vec3 vMaskCoord;\n\
|
|
||||||
uniform sampler2D uMaskTexture;\n\
|
|
||||||
\n\
|
|
||||||
uniform samplerExternalOES uTexture;\n\
|
|
||||||
uniform mat4 uTextureTransform;\n\
|
|
||||||
void main()\n\
|
|
||||||
{\n\
|
|
||||||
vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;\n\
|
|
||||||
float mask = texture2D(uMaskTexture, maskCoords).r;\n\
|
|
||||||
\n\
|
|
||||||
gl_FragColor = texture2D(uTexture, (uTextureTransform * vec4(vTexCoord.x, vTexCoord.y, 0.0, 1.0)).xy) * uLayerOpacity * mask;\n\
|
|
||||||
}\n\
|
|
||||||
";
|
|
||||||
|
|
||||||
static const char sRGBARectTextureLayerFS[] = "/* sRGBARectTextureLayerFS */\n\
|
static const char sRGBARectTextureLayerFS[] = "/* sRGBARectTextureLayerFS */\n\
|
||||||
#extension GL_ARB_texture_rectangle : enable\n\
|
#extension GL_ARB_texture_rectangle : enable\n\
|
||||||
/* Fragment Shader */\n\
|
/* Fragment Shader */\n\
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
uniform mat4 uMatrixProj;
|
uniform mat4 uMatrixProj;
|
||||||
uniform mat4 uLayerQuadTransform;
|
uniform mat4 uLayerQuadTransform;
|
||||||
uniform mat4 uLayerTransform;
|
uniform mat4 uLayerTransform;
|
||||||
|
uniform mat4 uTextureTransform;
|
||||||
uniform vec4 uRenderTargetOffset;
|
uniform vec4 uRenderTargetOffset;
|
||||||
|
|
||||||
attribute vec4 aVertexCoord;
|
attribute vec4 aVertexCoord;
|
||||||
@ -123,7 +124,7 @@ $VERTEX_MASK_STUFF<mask>$
|
|||||||
finalPosition.xyz *= finalPosition.w;
|
finalPosition.xyz *= finalPosition.w;
|
||||||
finalPosition = uMatrixProj * finalPosition;
|
finalPosition = uMatrixProj * finalPosition;
|
||||||
|
|
||||||
vTexCoord = aTexCoord;
|
vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;
|
||||||
gl_Position = finalPosition;
|
gl_Position = finalPosition;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
@ -215,24 +216,6 @@ $FRAGMENT_CALC_MASK<mask>$
|
|||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// Single texture in RGBA format for use with GL_TEXTURE_EXTERNAL_OES
|
|
||||||
@shader sRGBATextureLayerExternal<mask:,Mask,Mask3D>FS
|
|
||||||
#extension GL_OES_EGL_image_external : require
|
|
||||||
|
|
||||||
#define MEDIUMP_SHADER 1
|
|
||||||
$LAYER_FRAGMENT<mask>$
|
|
||||||
|
|
||||||
uniform samplerExternalOES uTexture;
|
|
||||||
uniform mat4 uTextureTransform;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
$FRAGMENT_CALC_MASK<mask>$
|
|
||||||
gl_FragColor = texture2D(uTexture, (uTextureTransform * vec4(vTexCoord.x, vTexCoord.y, 0.0, 1.0)).xy) * uLayerOpacity * mask;
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
|
|
||||||
// Single texture in RGBA format, but with a Rect texture.
|
// Single texture in RGBA format, but with a Rect texture.
|
||||||
// Container layer needs this to render a FBO group.
|
// Container layer needs this to render a FBO group.
|
||||||
@shader sRGBARectTextureLayer<mask:,Mask,Mask3D>FS
|
@shader sRGBARectTextureLayer<mask:,Mask,Mask3D>FS
|
||||||
|
@ -181,6 +181,7 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset,
|
|||||||
|
|
||||||
program->SetLayerOpacity(mLayer->GetEffectiveOpacity());
|
program->SetLayerOpacity(mLayer->GetEffectiveOpacity());
|
||||||
program->SetLayerTransform(mLayer->GetEffectiveTransform());
|
program->SetLayerTransform(mLayer->GetEffectiveTransform());
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetRenderOffset(aOffset);
|
program->SetRenderOffset(aOffset);
|
||||||
program->LoadMask(mLayer->GetMaskLayer());
|
program->LoadMask(mLayer->GetMaskLayer());
|
||||||
|
|
||||||
|
@ -2586,6 +2586,7 @@ RectTextureImage::Draw(GLManager* aManager,
|
|||||||
program->Activate();
|
program->Activate();
|
||||||
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0), mUsedSize));
|
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0), mUsedSize));
|
||||||
program->SetLayerTransform(aTransform * gfx3DMatrix::Translation(aLocation.x, aLocation.y, 0));
|
program->SetLayerTransform(aTransform * gfx3DMatrix::Translation(aLocation.x, aLocation.y, 0));
|
||||||
|
program->SetTextureTransform(gfx3DMatrix());
|
||||||
program->SetLayerOpacity(1.0);
|
program->SetLayerOpacity(1.0);
|
||||||
program->SetRenderOffset(nsIntPoint(0, 0));
|
program->SetRenderOffset(nsIntPoint(0, 0));
|
||||||
program->SetTexCoordMultiplier(mUsedSize.width, mUsedSize.height);
|
program->SetTexCoordMultiplier(mUsedSize.width, mUsedSize.height);
|
||||||
|
Loading…
Reference in New Issue
Block a user