mirror of https://github.com/libsdl-org/SDL.git
3DS: Fixes to get geometry to display
This commit is contained in:
parent
3a56c10402
commit
87b1c33e03
|
|
@ -352,7 +352,6 @@ N3DS_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
|||
{
|
||||
int i;
|
||||
int count = indices ? num_indices : num_vertices;
|
||||
N3DS_TextureData *N3DS_texture = (N3DS_TextureData *) texture->driverdata;
|
||||
VertVCT *verts;
|
||||
|
||||
cmd->data.draw.count = count;
|
||||
|
|
@ -389,6 +388,7 @@ N3DS_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *
|
|||
verts++;
|
||||
}
|
||||
} else {
|
||||
N3DS_TextureData *N3DS_texture = (N3DS_TextureData *) texture->driverdata;
|
||||
for (i = 0; i < count; i++) {
|
||||
int j;
|
||||
float *xy_;
|
||||
|
|
|
|||
|
|
@ -23,25 +23,25 @@
|
|||
#define SDL_RENDER_N3DS_SHADERS_H
|
||||
|
||||
unsigned char n3ds_shader_v[] = {
|
||||
0x44, 0x56, 0x4c, 0x42, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x44, 0x56, 0x4c, 0x50,
|
||||
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x01, 0xf0, 0x07, 0x4e, 0x02, 0x08, 0x02, 0x08,
|
||||
0x03, 0x18, 0x02, 0x08, 0x04, 0x28, 0x02, 0x08, 0x05, 0x38, 0x02, 0x08, 0x06, 0x20, 0x20, 0x4c,
|
||||
0x07, 0xf0, 0x27, 0x4e, 0x88, 0x18, 0x40, 0x20, 0x00, 0x00, 0x00, 0x88, 0x6c, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xa3, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xc3, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x64, 0xc3, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0xc3, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x61, 0xc3, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x4f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x1c, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x44, 0x56, 0x4c, 0x45, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
|
||||
0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00,
|
||||
0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x01, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x13, 0x00, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x00, 0x00,
|
||||
0x44, 0x56, 0x4c, 0x42, 0x01, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x44, 0x56, 0x4c, 0x50,
|
||||
0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x01, 0xf0, 0x07, 0x4e, 0x02, 0xf0, 0x07, 0x4e,
|
||||
0x03, 0x08, 0x02, 0x08, 0x04, 0x18, 0x02, 0x08, 0x05, 0x28, 0x02, 0x08, 0x06, 0x38, 0x02, 0x08,
|
||||
0x07, 0x20, 0x40, 0x4c, 0x88, 0xf0, 0x27, 0x20, 0x00, 0x00, 0x00, 0x88, 0x6c, 0x03, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xe2, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x0a, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x68, 0xc3, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0xc3, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x62, 0xc3, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x61, 0xc3, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x6f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4f, 0xd5, 0x06, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x44, 0x56, 0x4c, 0x45, 0x02, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
|
||||
0x03, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00,
|
||||
0x0b, 0x00, 0x00, 0x00, 0x02, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00,
|
||||
0x01, 0x01, 0x37, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x02, 0x00, 0x01, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x0f, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x13, 0x00, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x00, 0x00
|
||||
};
|
||||
|
||||
#endif // SDL_RENDER_N3DS_SHADERS_H
|
||||
|
|
|
|||
|
|
@ -17,34 +17,43 @@
|
|||
; misrepresented as being the original software.
|
||||
; 3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
; Uniforms
|
||||
.fvec projection[4]
|
||||
|
||||
.out outpos position
|
||||
.out outtc0 texcoord0
|
||||
.out outclr color
|
||||
; Constants
|
||||
.constf const(0.0, 1.0, 0.00392156862745098, 0.5)
|
||||
.alias ZEROS const.xxxx ; Vector full of zeros
|
||||
.alias ONES const.yyyy ; Vector full of ones
|
||||
.alias HALFS const.wwww ; Vector full of 0.5s
|
||||
|
||||
; Outputs
|
||||
.out outpos position
|
||||
.out outclr color
|
||||
.out outtc0 texcoord0
|
||||
|
||||
; Inputs (defined as aliases for convenience)
|
||||
.alias inpos v0
|
||||
.alias inclr v1
|
||||
.alias intc0 v2
|
||||
|
||||
.constf const(0.0, 1.0, 0.00392156862745098, 1.0)
|
||||
.alias ZEROS const.xxxx
|
||||
.alias ONES const.yyyy
|
||||
.alias RGBS const.zzzz
|
||||
|
||||
.proc main
|
||||
; Force the z and w components of inpos to be 0.5 and 1.0 respectively
|
||||
mov r0.xy, inpos
|
||||
mov r0.zw, ONES
|
||||
mov r0.z, HALFS
|
||||
mov r0.w, ONES
|
||||
|
||||
; outpos = projectionMatrix * inpos
|
||||
dp4 outpos.x, projection[0], r0
|
||||
dp4 outpos.y, projection[1], r0
|
||||
dp4 outpos.z, projection[2], r0
|
||||
dp4 outpos.w, projection[3], r0
|
||||
|
||||
; outtc0 = intc0
|
||||
mov outtc0, intc0
|
||||
|
||||
mov r1, RGBS
|
||||
mul outclr, inclr.wzyx, r1.x
|
||||
; Normalize color by multiplying by 1 / 255
|
||||
mul outclr, const.z, inclr
|
||||
|
||||
; We're finished
|
||||
end
|
||||
.end
|
||||
|
|
|
|||
Loading…
Reference in New Issue