This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository direct3d.
View the commit online.
commit 95e9d85e41e84f24bfbabde3fcde9095b1ba153d
Author: Vincent Torri <vto...@outlook.fr>
AuthorDate: Sat Apr 13 08:08:28 2024 +0200
use same filename number for .c and .hlsl
---
src/d3d_4.c | 4 ++--
src/shader_4.hlsl | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/src/d3d_4.c b/src/d3d_4.c
index b4dd011..3e7a6fd 100644
--- a/src/d3d_4.c
+++ b/src/d3d_4.c
@@ -297,7 +297,7 @@ D3d *d3d_init(Window *win, int vsync)
flags |= D3DCOMPILE_DEBUG;
#endif
vs_blob = NULL;
- res = D3DCompileFromFile(L"shader_3.hlsl",
+ res = D3DCompileFromFile(L"shader_4.hlsl",
NULL,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
"main_vs",
@@ -342,7 +342,7 @@ D3d *d3d_init(Window *win, int vsync)
/* Pixel shader */
ps_blob = NULL;
- res = D3DCompileFromFile(L"shader_3.hlsl",
+ res = D3DCompileFromFile(L"shader_4.hlsl",
NULL,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
"main_ps",
diff --git a/src/shader_4.hlsl b/src/shader_4.hlsl
new file mode 100644
index 0000000..336ffb5
--- /dev/null
+++ b/src/shader_4.hlsl
@@ -0,0 +1,48 @@
+cbuffer cv_viewport : register(b0)
+{
+ float2 viewport_inv_size;
+ float2 dummy; /* unused, to have a multiple of 16 bytes */
+}
+
+struct vs_input
+{
+ uint2 position : POSITION;
+ float4 color : COLOR;
+};
+
+struct ps_input
+{
+ float4 position : SV_POSITION;
+ float4 color : COLOR;
+};
+
+/*
+ * vertex shater program
+ *
+ * @param input the 2 coordinates of a pixel, got from CPU
+ * @return the 4D position of the normalized coordinates of the vertex in GPU
+ * as well as the color
+ */
+ps_input main_vs(vs_input input)
+{
+ ps_input output;
+ float2 p = input.position;
+ p *= viewport_inv_size;
+ p *= 2.0f;
+ p -= 1.0f;
+ p.y *= -1.0f;
+ output.position = float4(p, 0.0f, 1.0f);
+ output.color = input.color;
+ return output;
+}
+
+/*
+ * pixel shater program
+ *
+ * @param input the 4D coordinates of a pixel and the color
+ * @return the color of the pixel in RGBA colorspace passed as input
+ */
+float4 main_ps(ps_input input) : SV_TARGET
+{
+ return input.color;
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.