From: notaz Date: Sun, 17 Jul 2022 22:18:52 +0000 (+0300) Subject: gpu_neon: don't include vector_ops.h in the main header X-Git-Tag: r24l~436 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07d178b5ed0a9861bd8936aeeb71a6cd2f713eb4;p=pcsx_rearmed.git gpu_neon: don't include vector_ops.h in the main header that stuff is only used in the C-only prototype --- diff --git a/plugins/gpu_neon/psx_gpu/common.h b/plugins/gpu_neon/psx_gpu/common.h index d5cf3e91..820dfbef 100644 --- a/plugins/gpu_neon/psx_gpu/common.h +++ b/plugins/gpu_neon/psx_gpu/common.h @@ -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 #include #include #include -#include "vector_ops.h" +#include "vector_types.h" #include "psx_gpu.h" #define unlikely(x) __builtin_expect((x), 0) diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.c b/plugins/gpu_neon/psx_gpu/psx_gpu.c index a5e7aa18..b5aec146 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.c +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.c @@ -17,6 +17,9 @@ #include #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) \ diff --git a/plugins/gpu_neon/psx_gpu/psx_gpu.h b/plugins/gpu_neon/psx_gpu/psx_gpu.h index 1fa6b981..55f835be 100644 --- a/plugins/gpu_neon/psx_gpu/psx_gpu.h +++ b/plugins/gpu_neon/psx_gpu/psx_gpu.h @@ -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 diff --git a/plugins/gpu_neon/psx_gpu/vector_ops.h b/plugins/gpu_neon/psx_gpu/vector_ops.h index c91e7d95..189eb79d 100644 --- a/plugins/gpu_neon/psx_gpu/vector_ops.h +++ b/plugins/gpu_neon/psx_gpu/vector_ops.h @@ -15,33 +15,7 @@ #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 index 00000000..4b1213eb --- /dev/null +++ b/plugins/gpu_neon/psx_gpu/vector_types.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011 Gilead Kutnick "Exophase" + * + * 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 + +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