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 8ead3e3d57737cd57e117b5ff63705c145e5f98e
Author: Vincent Torri <vto...@outlook.fr>
AuthorDate: Sat Apr 13 08:04:29 2024 +0200

    use same filename number for .c and .hlsl
---
 src/d3d_5.c       |  4 ++--
 src/shader_5.hlsl | 30 ++++++++++++++++++++++--------
 2 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/src/d3d_5.c b/src/d3d_5.c
index 71651e6..94338af 100644
--- a/src/d3d_5.c
+++ b/src/d3d_5.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_5.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_5.hlsl",
                              NULL,
                              D3D_COMPILE_STANDARD_FILE_INCLUDE,
                              "main_ps",
diff --git a/src/shader_5.hlsl b/src/shader_5.hlsl
index 66b17d5..336ffb5 100644
--- a/src/shader_5.hlsl
+++ b/src/shader_5.hlsl
@@ -1,7 +1,7 @@
 cbuffer cv_viewport : register(b0)
 {
-    row_major int2x3 rotation_matrix;
-    float2 ivps;
+    float2 viewport_inv_size;
+    float2 dummy;             /* unused, to have a multiple of 16 bytes */
 }
 
 struct vs_input
@@ -16,18 +16,32 @@ struct ps_input
     float4 color : COLOR;
 };
 
-ps_input main_vs(vs_input input )
+/*
+ * 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 o = float2(mul(rotation_matrix, int3(input.position, 1))) * ivps;
-    o *= 2.0f;
-    o -= 1.0f;
-    o.y *= -1.0f;
-    output.position = float4(o, 0.0f, 1.0f);
+    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.

Reply via email to