зеркало из https://github.com/mozilla/gecko-dev.git
Bug 589395. d3d9: adjust vertex locations in the vertex shader. r=bas,a=blocking
Previously we adjusted the vertex locations directly, now they have an implicit adjustment that happens in the vertex shader. This should let us ignore the pixel center differences between opengl/d3d9/d3d10.
This commit is contained in:
Родитель
981b6640f0
Коммит
49feffb4b6
|
@ -218,13 +218,13 @@ CanvasLayerD3D9::RenderLayer()
|
||||||
quadTransform[0][0] = (float)mBounds.width;
|
quadTransform[0][0] = (float)mBounds.width;
|
||||||
if (mNeedsYFlip) {
|
if (mNeedsYFlip) {
|
||||||
quadTransform[1][1] = (float)-mBounds.height;
|
quadTransform[1][1] = (float)-mBounds.height;
|
||||||
quadTransform[3][1] = (float)mBounds.height - 0.5f;
|
quadTransform[3][1] = (float)mBounds.height;
|
||||||
} else {
|
} else {
|
||||||
quadTransform[1][1] = (float)mBounds.height;
|
quadTransform[1][1] = (float)mBounds.height;
|
||||||
quadTransform[3][1] = -0.5f;
|
quadTransform[3][1] = 0.0f;
|
||||||
}
|
}
|
||||||
quadTransform[2][2] = 1.0f;
|
quadTransform[2][2] = 1.0f;
|
||||||
quadTransform[3][0] = -0.5f;
|
quadTransform[3][0] = 0.0f;
|
||||||
quadTransform[3][3] = 1.0f;
|
quadTransform[3][3] = 1.0f;
|
||||||
|
|
||||||
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
||||||
|
|
|
@ -239,8 +239,8 @@ ContainerLayerD3D9::RenderLayer()
|
||||||
quadTransform[0][0] = (float)visibleRect.width;
|
quadTransform[0][0] = (float)visibleRect.width;
|
||||||
quadTransform[1][1] = (float)visibleRect.height;
|
quadTransform[1][1] = (float)visibleRect.height;
|
||||||
quadTransform[2][2] = 1.0f;
|
quadTransform[2][2] = 1.0f;
|
||||||
quadTransform[3][0] = (float)visibleRect.x - 0.5f;
|
quadTransform[3][0] = (float)visibleRect.x;
|
||||||
quadTransform[3][1] = (float)visibleRect.y - 0.5f;
|
quadTransform[3][1] = (float)visibleRect.y;
|
||||||
quadTransform[3][3] = 1.0f;
|
quadTransform[3][3] = 1.0f;
|
||||||
|
|
||||||
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
||||||
|
|
|
@ -172,8 +172,8 @@ ImageLayerD3D9::RenderLayer()
|
||||||
* beyond all edges.
|
* beyond all edges.
|
||||||
*/
|
*/
|
||||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||||
quadTransform[0][0] = (float)yuvImage->mSize.width + 0.5f;
|
quadTransform[0][0] = (float)yuvImage->mSize.width;
|
||||||
quadTransform[1][1] = (float)yuvImage->mSize.height + 0.5f;
|
quadTransform[1][1] = (float)yuvImage->mSize.height;
|
||||||
quadTransform[2][2] = 1.0f;
|
quadTransform[2][2] = 1.0f;
|
||||||
quadTransform[3][3] = 1.0f;
|
quadTransform[3][3] = 1.0f;
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@ ImageLayerD3D9::RenderLayer()
|
||||||
* beyond all edges.
|
* beyond all edges.
|
||||||
*/
|
*/
|
||||||
memset(&quadTransform, 0, sizeof(quadTransform));
|
memset(&quadTransform, 0, sizeof(quadTransform));
|
||||||
quadTransform[0][0] = (float)cairoImage->mSize.width + 0.5f;
|
quadTransform[0][0] = (float)cairoImage->mSize.width;
|
||||||
quadTransform[1][1] = (float)cairoImage->mSize.height + 0.5f;
|
quadTransform[1][1] = (float)cairoImage->mSize.height;
|
||||||
quadTransform[2][2] = 1.0f;
|
quadTransform[2][2] = 1.0f;
|
||||||
quadTransform[3][3] = 1.0f;
|
quadTransform[3][3] = 1.0f;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
vs_2_0
|
vs_2_0
|
||||||
|
def c13, -0.5, 0, 0, 0
|
||||||
dcl_position v0
|
dcl_position v0
|
||||||
mul r0, v0.y, c1
|
mul r0, v0.y, c1
|
||||||
mad r0, c0, v0.x, r0
|
mad r0, c0, v0.x, r0
|
||||||
|
@ -35,13 +36,14 @@
|
||||||
mad r1, c6, r0.z, r1
|
mad r1, c6, r0.z, r1
|
||||||
mad r0, c7, r0.w, r1
|
mad r0, c7, r0.w, r1
|
||||||
add r0, r0, -c12
|
add r0, r0, -c12
|
||||||
|
add r0.xy, r0, c13.x
|
||||||
mul r1, r0.y, c9
|
mul r1, r0.y, c9
|
||||||
mad r1, c8, r0.x, r1
|
mad r1, c8, r0.x, r1
|
||||||
mad r1, c10, r0.z, r1
|
mad r1, c10, r0.z, r1
|
||||||
mad oPos, c11, r0.w, r1
|
mad oPos, c11, r0.w, r1
|
||||||
mov oT0.xy, v0
|
mov oT0.xy, v0
|
||||||
|
|
||||||
// approximately 14 instruction slots used
|
// approximately 15 instruction slots used
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const BYTE LayerQuadVS[] =
|
const BYTE LayerQuadVS[] =
|
||||||
|
@ -92,6 +94,10 @@ const BYTE LayerQuadVS[] =
|
||||||
108, 101, 114, 32, 57, 46,
|
108, 101, 114, 32, 57, 46,
|
||||||
50, 57, 46, 57, 53, 50,
|
50, 57, 46, 57, 53, 50,
|
||||||
46, 51, 49, 49, 49, 0,
|
46, 51, 49, 49, 49, 0,
|
||||||
|
81, 0, 0, 5, 13, 0,
|
||||||
|
15, 160, 0, 0, 0, 191,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
31, 0, 0, 2, 0, 0,
|
31, 0, 0, 2, 0, 0,
|
||||||
0, 128, 0, 0, 15, 144,
|
0, 128, 0, 0, 15, 144,
|
||||||
5, 0, 0, 3, 0, 0,
|
5, 0, 0, 3, 0, 0,
|
||||||
|
@ -122,22 +128,24 @@ const BYTE LayerQuadVS[] =
|
||||||
228, 128, 2, 0, 0, 3,
|
228, 128, 2, 0, 0, 3,
|
||||||
0, 0, 15, 128, 0, 0,
|
0, 0, 15, 128, 0, 0,
|
||||||
228, 128, 12, 0, 228, 161,
|
228, 128, 12, 0, 228, 161,
|
||||||
5, 0, 0, 3, 1, 0,
|
2, 0, 0, 3, 0, 0,
|
||||||
15, 128, 0, 0, 85, 128,
|
3, 128, 0, 0, 228, 128,
|
||||||
9, 0, 228, 160, 4, 0,
|
13, 0, 0, 160, 5, 0,
|
||||||
|
0, 3, 1, 0, 15, 128,
|
||||||
|
0, 0, 85, 128, 9, 0,
|
||||||
|
228, 160, 4, 0, 0, 4,
|
||||||
|
1, 0, 15, 128, 8, 0,
|
||||||
|
228, 160, 0, 0, 0, 128,
|
||||||
|
1, 0, 228, 128, 4, 0,
|
||||||
0, 4, 1, 0, 15, 128,
|
0, 4, 1, 0, 15, 128,
|
||||||
8, 0, 228, 160, 0, 0,
|
10, 0, 228, 160, 0, 0,
|
||||||
0, 128, 1, 0, 228, 128,
|
170, 128, 1, 0, 228, 128,
|
||||||
4, 0, 0, 4, 1, 0,
|
4, 0, 0, 4, 0, 0,
|
||||||
15, 128, 10, 0, 228, 160,
|
15, 192, 11, 0, 228, 160,
|
||||||
0, 0, 170, 128, 1, 0,
|
0, 0, 255, 128, 1, 0,
|
||||||
228, 128, 4, 0, 0, 4,
|
228, 128, 1, 0, 0, 2,
|
||||||
0, 0, 15, 192, 11, 0,
|
0, 0, 3, 224, 0, 0,
|
||||||
228, 160, 0, 0, 255, 128,
|
228, 144, 255, 255, 0, 0
|
||||||
1, 0, 228, 128, 1, 0,
|
|
||||||
0, 2, 0, 0, 3, 224,
|
|
||||||
0, 0, 228, 144, 255, 255,
|
|
||||||
0, 0
|
|
||||||
};
|
};
|
||||||
#if 0
|
#if 0
|
||||||
//
|
//
|
||||||
|
|
|
@ -28,7 +28,13 @@ VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex)
|
||||||
outp.vPosition = mul(mLayerQuadTransform, outp.vPosition);
|
outp.vPosition = mul(mLayerQuadTransform, outp.vPosition);
|
||||||
outp.vPosition = mul(mLayerTransform, outp.vPosition);
|
outp.vPosition = mul(mLayerTransform, outp.vPosition);
|
||||||
outp.vPosition = outp.vPosition - vRenderTargetOffset;
|
outp.vPosition = outp.vPosition - vRenderTargetOffset;
|
||||||
|
|
||||||
|
// adjust our vertices to match d3d9's pixel coordinate system
|
||||||
|
// which has pixel centers at integer locations
|
||||||
|
outp.vPosition.xy -= 0.5;
|
||||||
|
|
||||||
outp.vPosition = mul(mProjection, outp.vPosition);
|
outp.vPosition = mul(mProjection, outp.vPosition);
|
||||||
|
|
||||||
outp.vTexCoords = aVertex.vPosition.xy;
|
outp.vTexCoords = aVertex.vPosition.xy;
|
||||||
return outp;
|
return outp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,8 +239,8 @@ ThebesLayerD3D9::RenderLayer()
|
||||||
quadTransform[0][0] = (float)visibleRect.width;
|
quadTransform[0][0] = (float)visibleRect.width;
|
||||||
quadTransform[1][1] = (float)visibleRect.height;
|
quadTransform[1][1] = (float)visibleRect.height;
|
||||||
quadTransform[2][2] = 1.0f;
|
quadTransform[2][2] = 1.0f;
|
||||||
quadTransform[3][0] = (float)visibleRect.x - 0.5f;
|
quadTransform[3][0] = (float)visibleRect.x;
|
||||||
quadTransform[3][1] = (float)visibleRect.y - 0.5f;
|
quadTransform[3][1] = (float)visibleRect.y;
|
||||||
quadTransform[3][3] = 1.0f;
|
quadTransform[3][3] = 1.0f;
|
||||||
|
|
||||||
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
device()->SetVertexShaderConstantF(0, &quadTransform[0][0], 4);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче