Nugget
Loading...
Searching...
No Matches
shell
gpu.h
Go to the documentation of this file.
1
/*
2
3
MIT License
4
5
Copyright (c) 2021 PCSX-Redux authors
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in all
15
copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
24
25
*/
26
27
#pragma once
28
29
#include <stdint.h>
30
31
#include "
common/hardware/gpu.h
"
32
#include "
common/hardware/hwregs.h
"
33
#include "
shell/math.h
"
34
35
#define WIDTH 640
36
#define HEIGHT 480
37
38
union
GPUPoint
{
39
uint32_t
packed
;
40
struct
{
41
int16_t
x
,
y
;
42
};
43
};
44
45
void
initGPU
(
int
isPAL);
46
void
flip
(
int
doubleBuffer,
const
union
Color
bg);
47
void
waitVSync
(
int
interlaced,
void
(*idle)());
48
49
// we shift by 17 instead of 24 to do a scaling of 128
50
// therefore a typical square of (-1,-1)-(1,1) would
51
// end up as a 256x256 pixels one
52
static
inline
void
sendGPUVertex(
struct
Vertex2D
*v) {
53
union
GPUPoint
p;
54
int32_t
x
= v->
x
>> 17;
55
int32_t
y
= v->
y
>> 17;
56
// adjust ratio for proper 4:3 output view
57
y
=
y
*
HEIGHT
* 4 / (
WIDTH
* 3);
58
p.x =
x
+
WIDTH
/ 2;
59
p.y =
y
+
HEIGHT
/ 2;
60
GPU_DATA
= p.packed;
61
}
gpu.h
hwregs.h
GPU_DATA
#define GPU_DATA
Definition
hwregs.h:65
math.h
waitVSync
void waitVSync(int interlaced, void(*idle)())
Definition
gpu.c:62
flip
void flip(int doubleBuffer, const union Color bg)
Definition
gpu.c:36
WIDTH
#define WIDTH
Definition
gpu.h:35
initGPU
void initGPU(int isPAL)
Definition
gpu.c:85
HEIGHT
#define HEIGHT
Definition
gpu.h:36
Vertex2D
Definition
math.h:43
Vertex2D::y
int32_t y
Definition
math.h:44
Vertex2D::x
int32_t x
Definition
math.h:44
uint32_t
void uint32_t(classId, spec)
Color
Definition
gpu.h:109
GPUPoint
Definition
gpu.h:38
GPUPoint::packed
uint32_t packed
Definition
gpu.h:39
GPUPoint::x
int16_t x
Definition
gpu.h:41
GPUPoint::y
int16_t y
Definition
gpu.h:41
Generated by
1.9.8