Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: ui/gfx/resources/compositor.fx

Issue 7067029: Prototype compositor to render views to a texture using d3d 10. This (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix gyp Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/gfx_resources.grd ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/resources/compositor.fx
diff --git a/ui/gfx/resources/compositor.fx b/ui/gfx/resources/compositor.fx
new file mode 100644
index 0000000000000000000000000000000000000000..fa00d4f267a4c04c53377c01bdfc46e85fe25ab3
--- /dev/null
+++ b/ui/gfx/resources/compositor.fx
@@ -0,0 +1,67 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// HLSL file used by views.
+
+Texture2D textureMap;
+
+// Blender to give source-over for textures.
+BlendState SrcAlphaBlendingAdd {
+ BlendEnable[0] = TRUE;
+ SrcBlend = ONE;
+ DestBlend = INV_SRC_ALPHA;
+ BlendOp = ADD;
+ SrcBlendAlpha = ONE;
+ DestBlendAlpha = INV_SRC_ALPHA;
+ BlendOpAlpha = ADD;
+ RenderTargetWriteMask[0] = 0x0F; // Enables for all color components.
+};
+
+// Avoids doing depth detection, which would normally mean only the frontmost
+// texture is drawn.
+DepthStencilState StencilState {
+ DepthEnable = false;
+};
+
+cbuffer cbPerObject {
+ float4x4 gWVP;
+};
+
+struct VS_IN {
+ float3 posL : POSITION;
+ float2 texC : TEXC;
+};
+
+struct VS_OUT {
+ float4 posW : SV_POSITION;
+ float2 texC : TEXC;
+};
+
+SamplerState Sampler {
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = Wrap;
+ AddressV = Wrap;
+};
+
+VS_OUT VS(VS_IN vIn) {
+ VS_OUT vOut;
+ vOut.posW = mul(float4(vIn.posL, 1.0f), gWVP);
+ vOut.texC = vIn.texC;
+ return vOut;
+}
+
+float4 PS(VS_OUT pIn) : SV_Target {
+ return textureMap.Sample(Sampler, float2(pIn.texC));
+}
+
+technique10 ViewTech {
+ pass P0 {
+ SetVertexShader(CompileShader(vs_4_0, VS()));
+ SetGeometryShader(NULL);
+ SetPixelShader(CompileShader(ps_4_0, PS()));
+ SetDepthStencilState(StencilState, 0);
+ SetBlendState(SrcAlphaBlendingAdd, float4(0.0f, 0.0f, 0.0f, 0.0f),
+ 0xFFFFFFFF);
Ben Goodger (Google) 2011/05/24 19:46:16 nit: 1-space outdent
+ }
+}
« no previous file with comments | « ui/gfx/gfx_resources.grd ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698