OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // HLSL file used by views. | |
6 | |
7 Texture2D textureMap; | |
8 | |
9 // Blender to give source-over for textures. | |
10 BlendState SrcAlphaBlendingAdd { | |
11 BlendEnable[0] = TRUE; | |
12 SrcBlend = ONE; | |
13 DestBlend = INV_SRC_ALPHA; | |
14 BlendOp = ADD; | |
15 SrcBlendAlpha = ONE; | |
16 DestBlendAlpha = INV_SRC_ALPHA; | |
17 BlendOpAlpha = ADD; | |
18 RenderTargetWriteMask[0] = 0x0F; // Enables for all color components. | |
19 }; | |
20 | |
21 // Avoids doing depth detection, which would normally mean only the frontmost | |
22 // texture is drawn. | |
23 DepthStencilState StencilState { | |
24 DepthEnable = false; | |
25 }; | |
26 | |
27 cbuffer cbPerObject { | |
28 float4x4 gWVP; | |
29 }; | |
30 | |
31 struct VS_IN { | |
32 float3 posL : POSITION; | |
33 float2 texC : TEXC; | |
34 }; | |
35 | |
36 struct VS_OUT { | |
37 float4 posW : SV_POSITION; | |
38 float2 texC : TEXC; | |
39 }; | |
40 | |
41 SamplerState Sampler { | |
42 Filter = MIN_MAG_MIP_POINT; | |
43 AddressU = Wrap; | |
44 AddressV = Wrap; | |
45 }; | |
46 | |
47 VS_OUT VS(VS_IN vIn) { | |
48 VS_OUT vOut; | |
49 vOut.posW = mul(float4(vIn.posL, 1.0f), gWVP); | |
50 vOut.texC = vIn.texC; | |
51 return vOut; | |
52 } | |
53 | |
54 float4 PS(VS_OUT pIn) : SV_Target { | |
55 return textureMap.Sample(Sampler, float2(pIn.texC)); | |
56 } | |
57 | |
58 technique10 ViewTech { | |
59 pass P0 { | |
60 SetVertexShader(CompileShader(vs_4_0, VS())); | |
61 SetGeometryShader(NULL); | |
62 SetPixelShader(CompileShader(ps_4_0, PS())); | |
63 SetDepthStencilState(StencilState, 0); | |
64 SetBlendState(SrcAlphaBlendingAdd, float4(0.0f, 0.0f, 0.0f, 0.0f), | |
65 0xFFFFFFFF); | |
Ben Goodger (Google)
2011/05/24 19:46:16
nit: 1-space outdent
| |
66 } | |
67 } | |
OLD | NEW |