VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaders/d3d11blitter.hlsl@ 97572

Last change on this file since 97572 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/* $Id: d3d11blitter.hlsl 96407 2022-08-22 17:43:14Z vboxsync $ */
2/*
3 * Blitter for dxgiBlt/SVGA_3D_CMD_DX_PRESENTBLT.
4 *
5 * fxc /nologo /Fhd3d11blitter.hlsl.vs.h /Evs_blitter /Tvs_5_0 d3d11blitter.hlsl
6 * fxc /nologo /Fhd3d11blitter.hlsl.ps.h /Eps_blitter /Tps_5_0 d3d11blitter.hlsl
7 */
8
9/*
10 * Copyright (C) 2022 Oracle and/or its affiliates.
11 *
12 * This file is part of VirtualBox base platform packages, as
13 * available from https://www.virtualbox.org.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation, in version 3 of the
18 * License.
19 *
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <https://www.gnu.org/licenses>.
27 *
28 * SPDX-License-Identifier: GPL-3.0-only
29 */
30
31Texture2D t;
32sampler s;
33
34cbuffer VSParameters
35{
36 float scaleX;
37 float scaleY;
38 float shiftX;
39 float shiftY;
40};
41
42struct VSInput
43{
44 uint VertexID : SV_VertexID;
45};
46
47struct VSOutput
48{
49 float4 position : SV_POSITION;
50 float2 texcoord : TEXCOORD0;
51 float2 alpha : TEXCOORD1;
52};
53
54VSOutput vs_blitter(VSInput input)
55{
56 VSOutput output;
57
58 float x = (input.VertexID & 1) ? 1.0f : -1.0f;
59 float y = (input.VertexID & 2) ? -1.0f : 1.0f;
60 x = x * scaleX + shiftX;
61 y = y * scaleY + shiftY;
62 output.position = float4(x, y, 0.0f, 1.0f);
63
64 output.texcoord.x = (input.VertexID & 1) ? 1.0f : 0.0f;
65 output.texcoord.y = (input.VertexID & 2) ? 1.0f : 0.0f;
66
67 output.alpha = float2(1.0f, 0.0f);
68
69 return output;
70}
71
72float4 ps_blitter(VSOutput input) : SV_TARGET
73{
74 return float4(t.Sample(s, input.texcoord).rgb, input.alpha.x);
75}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette