[EGIT] [legacy-imlib2] 02/02: Add endbr32/64 instruction at the start of asm functions

2024-04-13 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.


View the commit online.
commit 0f378ef87f8c6b0e7fbd4c8e65bf5ba60356e353
Author: Kim Woelders 
AuthorDate: Sat Apr 13 09:36:22 2024 +0200

Add endbr32/64 instruction at the start of asm functions

Only do so when compiling with -fcf-protection (=> __CET__ is defined).

Inspired by:
https://github.com/openbsd/ports/commit/004ff08738baa98bea634e8b6b49dfd246dd0644

Comment:
  Fixes SIGILL in tests on 11th gen intel (IBT)

https://git.enlightenment.org/old/legacy-imlib2/issues/23
---
 src/lib/amd64_blend.S  |  1 +
 src/lib/amd64_blend_cmod.S |  1 +
 src/lib/asm.h  | 10 ++
 src/lib/asm_blend.S|  1 +
 src/lib/asm_blend_cmod.S   |  1 +
 src/lib/asm_rgba.S |  1 +
 6 files changed, 15 insertions(+)

diff --git a/src/lib/amd64_blend.S b/src/lib/amd64_blend.S
index 5721913..a5b6862 100644
--- a/src/lib/amd64_blend.S
+++ b/src/lib/amd64_blend.S
@@ -97,6 +97,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba)
 
 
 #define ENTER		\
+	ENDBR_		; \
 	pushq %rbp	; \
 	movq %rsp, %rbp	; \
 	pushq %rbx	; \
diff --git a/src/lib/amd64_blend_cmod.S b/src/lib/amd64_blend_cmod.S
index e75b868..8395077 100644
--- a/src/lib/amd64_blend_cmod.S
+++ b/src/lib/amd64_blend_cmod.S
@@ -105,6 +105,7 @@ FN_(imlib_amd64_reshade_copy_rgb_to_rgba_cmod)
 
 
 #define ENTER		\
+	ENDBR_		; \
 	pushq %rbp	; \
 	movq %rsp, %rbp	; \
 	pushq %rbx	; \
diff --git a/src/lib/asm.h b/src/lib/asm.h
index 59cc7c4..773cd8d 100644
--- a/src/lib/asm.h
+++ b/src/lib/asm.h
@@ -17,4 +17,14 @@
 .size PR_(sym),.-PR_(sym); \
 .align 8;
 
+#ifdef __CET__
+#if defined(DO_MMX_ASM)
+#define ENDBR_ endbr32
+#elif defined(DO_AMD64_ASM)
+#define ENDBR_ endbr64
+#endif
+#else
+#define ENDBR_
+#endif
+
 #endif  /* __ASM_H */
diff --git a/src/lib/asm_blend.S b/src/lib/asm_blend.S
index e598fde..6890948 100644
--- a/src/lib/asm_blend.S
+++ b/src/lib/asm_blend.S
@@ -61,6 +61,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba)
 /*\ Common code \*/
 /*\ Set MMX mode, save registers, load common parameters \*/
 #define ENTER\
+	ENDBR_;\
 	pushl %ebp			;\
 	movl  %esp, %ebp		;\
 	pushl %ebx			;\
diff --git a/src/lib/asm_blend_cmod.S b/src/lib/asm_blend_cmod.S
index 9fedb79..73fa9c4 100644
--- a/src/lib/asm_blend_cmod.S
+++ b/src/lib/asm_blend_cmod.S
@@ -79,6 +79,7 @@ FN_(imlib_mmx_reshade_copy_rgb_to_rgba_cmod)
 /*\ Common code \*/
 /*\ Set MMX mode, save registers, load common parameters \*/
 #define ENTER\
+	ENDBR_;\
 	pushl %ebp			;\
 	movl  %esp, %ebp		;\
 	pushl %ebx			;\
diff --git a/src/lib/asm_rgba.S b/src/lib/asm_rgba.S
index 552756d..fd2a44e 100644
--- a/src/lib/asm_rgba.S
+++ b/src/lib/asm_rgba.S
@@ -36,6 +36,7 @@ FN_(imlib_get_cpuid)
 /*\ Common code \*/
 /*\ Save registers, load common parameters \*/
 #define ENTER			\
+	ENDBR_;			\
 	pushl %ebp;		\
 	movl  %esp, %ebp;	\
 	pushl %ebx;		\


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [www-content] 01/01: Wiki page archlinux-start.md changed with summary ['Check' package already mentioned on step 2] by Dmitri Chudinov

2024-04-13 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository www-content.


View the commit online.
commit b87bea3ed42d3da4641992c9743776154b857a90
Author: Dmitri Chudinov 
AuthorDate: Sat Apr 13 00:55:24 2024 -0700

Wiki page archlinux-start.md changed with summary ['Check' package already mentioned on step 2] by Dmitri Chudinov
---
 pages/docs/distros/archlinux-start.md.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pages/docs/distros/archlinux-start.md.txt b/pages/docs/distros/archlinux-start.md.txt
index 7c80a7164..335f5f421 100644
--- a/pages/docs/distros/archlinux-start.md.txt
+++ b/pages/docs/distros/archlinux-start.md.txt
@@ -188,7 +188,7 @@ pacman -S meson ninja pkgconf gcc binutils check python2
 You also must install the dependencies specific to EFL:
 
 ```bash
-pacman -S avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice check
+pacman -S avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice
 ```
 
 ### Step 3: Configuring the Software ###


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [www-content] 01/01: Wiki page archlinux-start.md changed with summary [] by Dmitri Chudinov

2024-04-13 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository www-content.


View the commit online.
commit 25242bd30d15f639dc2e00f2f7fbf06af7b495c3
Author: Dmitri Chudinov 
AuthorDate: Sat Apr 13 00:53:15 2024 -0700

Wiki page archlinux-start.md changed with summary [] by Dmitri Chudinov
---
 pages/docs/distros/archlinux-start.md.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pages/docs/distros/archlinux-start.md.txt b/pages/docs/distros/archlinux-start.md.txt
index 335f5f421..7c80a7164 100644
--- a/pages/docs/distros/archlinux-start.md.txt
+++ b/pages/docs/distros/archlinux-start.md.txt
@@ -188,7 +188,7 @@ pacman -S meson ninja pkgconf gcc binutils check python2
 You also must install the dependencies specific to EFL:
 
 ```bash
-pacman -S avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice
+pacman -S avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice check
 ```
 
 ### Step 3: Configuring the Software ###


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [www-content] 01/01: Wiki page archlinux-start.md changed with summary [] by Dmitri Chudinov

2024-04-13 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository www-content.


View the commit online.
commit f7e6f1320a0d0a1de83f8594cb8820f3d64fd4a0
Author: Dmitri Chudinov 
AuthorDate: Fri Apr 12 23:58:27 2024 -0700

Wiki page archlinux-start.md changed with summary [] by Dmitri Chudinov
---
 pages/docs/distros/archlinux-start.md.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pages/docs/distros/archlinux-start.md.txt b/pages/docs/distros/archlinux-start.md.txt
index 8c8995812..335f5f421 100644
--- a/pages/docs/distros/archlinux-start.md.txt
+++ b/pages/docs/distros/archlinux-start.md.txt
@@ -128,7 +128,7 @@ This will produce a folder named ``efl-X.XX.X``.
 Before you can compile and install EFL you need to install the required software packages and tools:
 
 ```bash 
-pacman -S meson ninja pkgconf gcc binutils python2 avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice
+pacman -S meson ninja pkgconf gcc binutils python2 avahi bullet curl fontconfig harfbuzz fribidi gst-plugins-base-libs luajit libexif libgl libinput libpulse libspectre libraw librsvg libwebp libxcomposite libxcursor libxinerama libxkbcommon libxp libxrandr libxss libunwind mesa openjpeg2 poppler shared-mime-info ttf-font scim libibus glib2 pulseaudio gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav libreoffice check
 ```
 
 ### Step 4: Building and Installing ###


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [direct3d] 04/05: use same filename number for .c and .hlsl

2024-04-13 Thread Enlightenment Git

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 2ebac2c99f4fc84aac5e0e6de9c2c600b4c1374b
Author: Vincent Torri 
AuthorDate: Sat Apr 13 08:10:02 2024 +0200

use same filename number for .c and .hlsl
---
 src/d3d_3.c   |  4 ++--
 src/shader_3.hlsl | 10 +++---
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/d3d_3.c b/src/d3d_3.c
index d9d8bf4..65bba77 100644
--- a/src/d3d_3.c
+++ b/src/d3d_3.c
@@ -294,7 +294,7 @@ D3d *d3d_init(Window *win, int vsync)
 flags |= D3DCOMPILE_DEBUG;
 #endif
 vs_blob = NULL;
-res = D3DCompileFromFile(L"shader_2.hlsl",
+res = D3DCompileFromFile(L"shader_3.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_vs",
@@ -339,7 +339,7 @@ D3d *d3d_init(Window *win, int vsync)
 
 /* Pixel shader */
 ps_blob = NULL;
-res = D3DCompileFromFile(L"shader_2.hlsl",
+res = D3DCompileFromFile(L"shader_3.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_ps",
diff --git a/src/shader_3.hlsl b/src/shader_3.hlsl
index 336ffb5..f085621 100644
--- a/src/shader_3.hlsl
+++ b/src/shader_3.hlsl
@@ -7,13 +7,11 @@ cbuffer cv_viewport : register(b0)
 struct vs_input
 {
 uint2 position : POSITION;
-float4 color : COLOR;
 };
 
 struct ps_input
 {
 float4 position : SV_POSITION;
-float4 color : COLOR;
 };
 
 /*
@@ -21,7 +19,6 @@ struct ps_input
  *
  * @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)
 {
@@ -32,17 +29,16 @@ ps_input main_vs(vs_input input)
 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
+ * @param input the 4D coordinates of a pixel
+ * @return the color of the pixel in RGBA colorspace, here pink
  */
 float4 main_ps(ps_input input) : SV_TARGET
 {
-return input.color;
+return float4(1.0f, 0.0f, 1.0f, 1.0f);
 }


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [direct3d] 02/05: use same filename number for .c and .hlsl

2024-04-13 Thread Enlightenment Git

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 
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.





[EGIT] [direct3d] 03/05: use same filename number for .c and .hlsl

2024-04-13 Thread Enlightenment Git

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 
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 000..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.





[EGIT] [direct3d] 05/05: use same filename number for .c and .hlsl

2024-04-13 Thread Enlightenment Git

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 3d111809dba4ec9ea0a9232c2e6914fa289610fc
Author: Vincent Torri 
AuthorDate: Sat Apr 13 08:11:47 2024 +0200

use same filename number for .c and .hlsl
---
 src/d3d_2.c   |  4 ++--
 src/shader_1.hlsl | 33 -
 src/shader_2.hlsl | 19 ---
 3 files changed, 6 insertions(+), 50 deletions(-)

diff --git a/src/d3d_2.c b/src/d3d_2.c
index 8e85352..48d8aee 100644
--- a/src/d3d_2.c
+++ b/src/d3d_2.c
@@ -289,7 +289,7 @@ D3d *d3d_init(Window *win, int vsync)
 flags |= D3DCOMPILE_DEBUG;
 #endif
 vs_blob = NULL;
-res = D3DCompileFromFile(L"shader_1.hlsl",
+res = D3DCompileFromFile(L"shader_2.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_vs",
@@ -334,7 +334,7 @@ D3d *d3d_init(Window *win, int vsync)
 
 /* Pixel shader */
 ps_blob = NULL;
-res = D3DCompileFromFile(L"shader_1.hlsl",
+res = D3DCompileFromFile(L"shader_2.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_ps",
diff --git a/src/shader_1.hlsl b/src/shader_1.hlsl
deleted file mode 100644
index acaed0f..000
--- a/src/shader_1.hlsl
+++ /dev/null
@@ -1,33 +0,0 @@
-struct vs_input
-{
-float2 position : POSITION;
-};
-
-struct ps_input
-{
-float4 position : SV_POSITION;
-};
-
-/*
- * vertex shater program
- *
- * @param input the 2 coordinates of a vertex, got from CPU
- * @return the 4D position of the pixel corresponding to the vertex in GPU
- */
-ps_input main_vs(vs_input input)
-{
-ps_input output;
-output.position = float4(input.position, 0.0f, 1.0f);
-return output;
-}
-
-/*
- * pixel shater program
- *
- * @param input the 4D coordinates of a pixel
- * @return the color of the pixel in RGBA colorspace, here pink
- */
-float4 main_ps(ps_input input) : SV_TARGET
-{
-return float4(1.0f, 0.0f, 1.0f, 1.0f);
-}
diff --git a/src/shader_2.hlsl b/src/shader_2.hlsl
index f085621..acaed0f 100644
--- a/src/shader_2.hlsl
+++ b/src/shader_2.hlsl
@@ -1,12 +1,6 @@
-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;
+float2 position : POSITION;
 };
 
 struct ps_input
@@ -17,18 +11,13 @@ struct ps_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
+ * @param input the 2 coordinates of a vertex, got from CPU
+ * @return the 4D position of the pixel corresponding to the vertex in GPU
  */
 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.position = float4(input.position, 0.0f, 1.0f);
 return output;
 }
 


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [direct3d] 01/05: use same filename number for .c and .hlsl, change color of the rectangle, add some comments

2024-04-13 Thread Enlightenment Git

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 91a0373d8623902efcb873cb2dcf7fbdec32f870
Author: Vincent Torri 
AuthorDate: Sat Apr 13 08:00:08 2024 +0200

use same filename number for .c and .hlsl, change color of the rectangle, add some comments
---
 src/d3d_6.c   | 32 
 src/shader_6.hlsl | 34 ++
 2 files changed, 62 insertions(+), 4 deletions(-)

diff --git a/src/d3d_6.c b/src/d3d_6.c
index 4a35576..01844e6 100644
--- a/src/d3d_6.c
+++ b/src/d3d_6.c
@@ -166,7 +166,7 @@ D3d *d3d_init(Window *win, int vsync)
 D3D11_INPUT_ELEMENT_DESC desc_ie[] =
 {
 { "POSITION", 0, DXGI_FORMAT_R32G32_UINT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
-{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 2 * sizeof(UINT), D3D11_INPUT_PER_VERTEX_DATA, 0 }
+{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 }
 };
 DXGI_SWAP_CHAIN_DESC1 desc_sw;
 DXGI_SWAP_CHAIN_FULLSCREEN_DESC desc_fs;
@@ -298,7 +298,7 @@ D3d *d3d_init(Window *win, int vsync)
 flags |= D3DCOMPILE_DEBUG;
 #endif
 vs_blob = NULL;
-res = D3DCompileFromFile(L"shader_5.hlsl",
+res = D3DCompileFromFile(L"shader_6.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_vs",
@@ -343,7 +343,7 @@ D3d *d3d_init(Window *win, int vsync)
 
 /* Pixel shader */
 ps_blob = NULL;
-res = D3DCompileFromFile(L"shader_5.hlsl",
+res = D3DCompileFromFile(L"shader_6.hlsl",
  NULL,
  D3D_COMPILE_STANDARD_FILE_INCLUDE,
  "main_ps",
@@ -470,6 +470,12 @@ void d3d_resize(D3d *d3d, int rot, UINT width, UINT height)
 
 switch (rot)
 {
+/*
+ * no rotation
+ *
+ * 1 0 0
+ * 0 1 0
+ */
 case 0:
 ((Const_Buffer *)mapped.pData)->rotation[0][0] = 1;
 ((Const_Buffer *)mapped.pData)->rotation[0][1] = 0;
@@ -478,6 +484,12 @@ void d3d_resize(D3d *d3d, int rot, UINT width, UINT height)
 ((Const_Buffer *)mapped.pData)->rotation[1][1] = 1;
 ((Const_Buffer *)mapped.pData)->rotation[1][2] = 0;
 break;
+/*
+ * rotation 90° clock-wise
+ *
+ * 0 -1 w-1
+ * 1  0 0
+ */
 case 1:
 ((Const_Buffer *)mapped.pData)->rotation[0][0] = 0;
 ((Const_Buffer *)mapped.pData)->rotation[0][1] = -1;
@@ -486,6 +498,12 @@ void d3d_resize(D3d *d3d, int rot, UINT width, UINT height)
 ((Const_Buffer *)mapped.pData)->rotation[1][1] = 0;
 ((Const_Buffer *)mapped.pData)->rotation[1][2] = 0;
 break;
+/*
+ * rotation 180° clock-wise
+ *
+ * -1  0 w-1
+ *  0 -1 h-1
+ */
 case 2:
 ((Const_Buffer *)mapped.pData)->rotation[0][0] = -1;
 ((Const_Buffer *)mapped.pData)->rotation[0][1] = 0;
@@ -494,6 +512,12 @@ void d3d_resize(D3d *d3d, int rot, UINT width, UINT height)
 ((Const_Buffer *)mapped.pData)->rotation[1][1] = -1;
 ((Const_Buffer *)mapped.pData)->rotation[1][2] = height - 1;
 break;
+/*
+ * rotation 270° clock-wise
+ *
+ *  0 1 0
+ * -1 0 h-1
+ */
 case 3:
 ((Const_Buffer *)mapped.pData)->rotation[0][0] = 0;
 ((Const_Buffer *)mapped.pData)->rotation[0][1] = 1;
@@ -705,7 +729,7 @@ void d3d_scene_begin(D3d *d3d)
 o = rectangle_new(d3d,
   220, 20,
   203, 101,
-  0, 0, 255, 255); /* r, g, b, a */
+  255, 255, 255, 255); /* r, g, b, a */
 objects[0] = o;
 
 o = rectangle_new(d3d,
diff --git a/src/shader_6.hlsl b/src/shader_6.hlsl
new file mode 100644
index 000..66b17d5
--- /dev/null
+++ b/src/shader_6.hlsl
@@ -0,0 +1,34 @@
+cbuffer cv_viewport : register(b0)
+{
+row_major int2x3 rotation_matrix;
+float2 ivps;
+}
+
+struct vs_input
+{
+uint2 position : POSITION;
+float4 color : COLOR;
+};
+
+struct ps_input
+{
+float4 position : SV_POSITION;
+float4 color : 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);
+output.color = input.color;
+return output;
+}
+
+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.