Closed Bug 590367 Opened 9 years ago Closed 9 years ago

[D3D9] Render RGB/d2d thebes layers using RGBA surface and a shader

Categories

(Core :: Graphics, defect)

x86
Windows 7
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: mattwoodrow, Assigned: mattwoodrow)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

No description provided.
Attached patch mmshaders (obsolete) — Splinter Review
Attachment #468873 - Flags: review?(bas.schouten)
Blocks: 586459
Comment on attachment 468873 [details] [diff] [review]
mmshaders

Looks great! Couple of comments though.

>From: Matt Woodrow <mwoodrow@mozilla.com>
>
>diff --git a/gfx/layers/d3d9/ImageLayerD3D9.cpp b/gfx/layers/d3d9/ImageLayerD3D9.cpp
>--- a/gfx/layers/d3d9/ImageLayerD3D9.cpp
>+++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp
>@@ -227,7 +227,7 @@ ImageLayerD3D9::RenderLayer()
>     opacity[0] = GetOpacity();
>     device()->SetPixelShaderConstantF(0, opacity, 1);
> 
>-    mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBLAYER);
>+    mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER);
> 
>     device()->SetTexture(0, cairoImage->mTexture);
>     device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
This should probably decide based on the ImageLayer content type.

>diff --git a/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl b/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl
>deleted file mode 100644
>--- a/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl
>+++ /dev/null
>@@ -1,61 +0,0 @@
>-float4x4 mLayerQuadTransform;
>-float4x4 mLayerTransform;
>-float4 vRenderTargetOffset;
>-float4x4 mProjection;
>-
>-texture tex0;
>-sampler s2D;
>-sampler s2DY;
>-sampler s2DCb;
>-sampler s2DCr;
>-
>-float fLayerOpacity;
>-float4 fLayerColor;
>-
>-struct VS_INPUT {
>-  float4 vPosition : POSITION;
>-};
>-
>-struct VS_OUTPUT {
>-  float4 vPosition : POSITION;
>-  float2 vTexCoords : TEXCOORD0;
>-};
>-
>-VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex)
>-{
>-  VS_OUTPUT outp;
>-  outp.vPosition = aVertex.vPosition;
>-  outp.vPosition = mul(mLayerQuadTransform, outp.vPosition);
>-  outp.vPosition = mul(mLayerTransform, outp.vPosition);
>-  outp.vPosition = outp.vPosition - vRenderTargetOffset;
>-  outp.vPosition = mul(mProjection, outp.vPosition);
>-  outp.vTexCoords = aVertex.vPosition.xy;
>-  return outp;
>-}
>-
>-float4 RGBShader(const VS_OUTPUT aVertex) : COLOR
>-{
>-  return tex2D(s2D, aVertex.vTexCoords) * fLayerOpacity;
>-}
>-
>-float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR
>-{
>-  float4 yuv;
>-  float4 color;
>-
>-  yuv.r = tex2D(s2DCr, aVertex.vTexCoords).r - 0.5;
>-  yuv.g = tex2D(s2DY, aVertex.vTexCoords).r - 0.0625;
>-  yuv.b = tex2D(s2DCb, aVertex.vTexCoords).r - 0.5;
>-
>-  color.r = yuv.g * 1.164 + yuv.r * 1.596;
>-  color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b;
>-  color.b = yuv.g * 1.164 + yuv.b * 2.018;
>-  color.a = 1.0f;
>- 
>-  return color * fLayerOpacity;
>-}
>-
>-float4 SolidColorShader(const VS_OUTPUT aVertex) : COLOR
>-{
>-  return fLayerColor;
>-}

Why is this being removed??
Attached patch Added back hlsl code. (obsolete) — Splinter Review
No idea where that went.

ImageLayers are always RBGA. They get copied to a RGBA32 cairo image surface and then uploaded to a texture.
Attachment #468873 - Attachment is obsolete: true
Attachment #468988 - Flags: review?(bas.schouten)
Attachment #468873 - Flags: review?(bas.schouten)
Comment on attachment 468988 [details] [diff] [review]
Added back hlsl code.

Hrm, okay, that's not too great I think! We probably should optimize that sometime, but it can definitely wait. Looks good this way!
Attachment #468988 - Flags: review?(bas.schouten) → review+
Attached patch Patch v3Splinter Review
Rebased against tip and updated genshaders.

Someone with the latest fxc might want to run genshaders again, as mine has changed some of the other shaders.
Attachment #468988 - Attachment is obsolete: true
Attachment #471704 - Flags: review?(bas.schouten)
Attachment #471704 - Flags: review?(bas.schouten) → review+
http://hg.mozilla.org/mozilla-central/rev/388e25a30cab
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Assignee: nobody → matt.woodrow+bugzilla
You need to log in before you can comment on or make changes to this bug.