gpu_neon: don't include vector_ops.h in the main header
authornotaz <notasas@gmail.com>
Sun, 17 Jul 2022 22:18:52 +0000 (01:18 +0300)
committernotaz <notasas@gmail.com>
Mon, 8 Aug 2022 22:55:39 +0000 (01:55 +0300)
that stuff is only used in the C-only prototype

plugins/gpu_neon/psx_gpu/common.h
plugins/gpu_neon/psx_gpu/psx_gpu.c
plugins/gpu_neon/psx_gpu/psx_gpu.h
plugins/gpu_neon/psx_gpu/vector_ops.h
plugins/gpu_neon/psx_gpu/vector_types.h [new file with mode: 0644]

index d5cf3e9..820dfbe 100644 (file)
@@ -1,21 +1,12 @@
 #ifndef COMMON_H
 #define COMMON_H
 
-typedef signed char s8;
-typedef unsigned char u8;
-typedef signed short s16;
-typedef unsigned short u16;
-typedef signed int s32;
-typedef unsigned int u32;
-typedef signed long long int s64;
-typedef unsigned long long int u64;
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
 
-#include "vector_ops.h"
+#include "vector_types.h"
 #include "psx_gpu.h"
 
 #define unlikely(x) __builtin_expect((x), 0)
index a5e7aa1..b5aec14 100644 (file)
@@ -17,6 +17,9 @@
 #include <string.h>
 
 #include "common.h"
+#ifndef NEON_BUILD
+#include "vector_ops.h"
+#endif
 
 u32 span_pixels = 0;
 u32 span_pixel_blocks = 0;
@@ -515,9 +518,6 @@ void flush_render_block_buffer(psx_gpu_struct *psx_gpu)
 }
 
 
-void compute_all_gradients(psx_gpu_struct *psx_gpu, vertex_struct *a,
- vertex_struct *b, vertex_struct *c);
-
 #ifndef NEON_BUILD
 
 #define setup_gradient_calculation_input(set, vertex)                          \
index 1fa6b98..55f835b 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef PSX_GPU_H
 #define PSX_GPU_H
 
+#include "vector_types.h"
+
 typedef enum
 {
   PRIMITIVE_TYPE_TRIANGLE = 0,
@@ -223,6 +225,8 @@ typedef struct __attribute__((aligned(16)))
 
   s16 x;
   s16 y;
+
+  u32 padding;
 } vertex_struct;
 
 void render_block_fill(psx_gpu_struct *psx_gpu, u32 color, u32 x, u32 y,
@@ -248,5 +252,9 @@ u32 gpu_parse(psx_gpu_struct *psx_gpu, u32 *list, u32 size, u32 *last_command);
 
 void triangle_benchmark(psx_gpu_struct *psx_gpu);
 
+void compute_all_gradients(psx_gpu_struct * __restrict__ psx_gpu,
+ const vertex_struct * __restrict__ a, const vertex_struct * __restrict__ b,
+ const vertex_struct * __restrict__ c);
+
 #endif
 
index c91e7d9..189eb79 100644 (file)
 #ifndef VECTOR_OPS
 #define VECTOR_OPS
 
-#define build_vector_type_pair(sign, size, count, count_x2)                    \
-typedef struct                                                                 \
-{                                                                              \
-  sign##size e[count];                                                         \
-} vec_##count##x##size##sign;                                                  \
-                                                                               \
-typedef struct                                                                 \
-{                                                                              \
-  union                                                                        \
-  {                                                                            \
-    sign##size e[count_x2];                                                    \
-    struct                                                                     \
-    {                                                                          \
-      vec_##count##x##size##sign low;                                          \
-      vec_##count##x##size##sign high;                                         \
-    };                                                                         \
-  };                                                                           \
-} vec_##count_x2##x##size##sign                                                \
-
-#define build_vector_types(sign)                                               \
-  build_vector_type_pair(sign, 8, 8, 16);                                      \
-  build_vector_type_pair(sign, 16, 4, 8);                                      \
-  build_vector_type_pair(sign, 32, 2, 4);                                      \
-  build_vector_type_pair(sign, 64, 1, 2)                                       \
-
-build_vector_types(u);
-build_vector_types(s);
+#include "vector_types.h"
 
 
 #define foreach_element(iterations, operation)                                 \
diff --git a/plugins/gpu_neon/psx_gpu/vector_types.h b/plugins/gpu_neon/psx_gpu/vector_types.h
new file mode 100644 (file)
index 0000000..4b1213e
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2011 Gilead Kutnick "Exophase" <exophase@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef VECTOR_TYPES
+#define VECTOR_TYPES
+
+#include <stdint.h>
+
+typedef int8_t s8;
+typedef uint8_t u8;
+typedef int16_t s16;
+typedef uint16_t u16;
+typedef int32_t s32;
+typedef uint32_t u32;
+typedef int64_t s64;
+typedef uint64_t u64;
+
+#define build_vector_type_pair(sign, size, count, count_x2)                    \
+typedef struct                                                                 \
+{                                                                              \
+  sign##size e[count];                                                         \
+} vec_##count##x##size##sign;                                                  \
+                                                                               \
+typedef struct                                                                 \
+{                                                                              \
+  union                                                                        \
+  {                                                                            \
+    sign##size e[count_x2];                                                    \
+    struct                                                                     \
+    {                                                                          \
+      vec_##count##x##size##sign low;                                          \
+      vec_##count##x##size##sign high;                                         \
+    };                                                                         \
+  };                                                                           \
+} vec_##count_x2##x##size##sign                                                \
+
+#define build_vector_types(sign)                                               \
+  build_vector_type_pair(sign, 8, 8, 16);                                      \
+  build_vector_type_pair(sign, 16, 4, 8);                                      \
+  build_vector_type_pair(sign, 32, 2, 4);                                      \
+  build_vector_type_pair(sign, 64, 1, 2)                                       \
+
+build_vector_types(u);
+build_vector_types(s);
+
+#endif // VECTOR_TYPES