From 7f1e6cb53850e03af8651c93cb45e6a9e59efd16 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 1 Sep 2024 19:37:08 +0900 Subject: [PATCH] internal/graphicsdriver/playstation5: add ebitengine_SetVertices --- internal/graphicsdriver/playstation5/graphics_playstation5.cpp | 3 +++ internal/graphicsdriver/playstation5/graphics_playstation5.go | 3 +++ internal/graphicsdriver/playstation5/graphics_playstation5.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/internal/graphicsdriver/playstation5/graphics_playstation5.cpp b/internal/graphicsdriver/playstation5/graphics_playstation5.cpp index 1ee8ec269..0ac926e7c 100644 --- a/internal/graphicsdriver/playstation5/graphics_playstation5.cpp +++ b/internal/graphicsdriver/playstation5/graphics_playstation5.cpp @@ -32,6 +32,9 @@ ebitengine_NewScreenFramebufferImage(int *image, int width, int height) { extern "C" void ebitengine_DisposeImage(int id) {} +void ebitengine_SetVertices(float *vertices, int vertexCount, int *indices, + int indexCount) {} + ebitengine_Error ebitengine_DrawTriangles(int dst, int *srcs, int srcCount, int shader, ebitengine_DstRegion *dstRegions, int dstRegionCount, diff --git a/internal/graphicsdriver/playstation5/graphics_playstation5.go b/internal/graphicsdriver/playstation5/graphics_playstation5.go index be1f2bd70..711cd2743 100644 --- a/internal/graphicsdriver/playstation5/graphics_playstation5.go +++ b/internal/graphicsdriver/playstation5/graphics_playstation5.go @@ -72,6 +72,9 @@ func (g *Graphics) SetTransparent(transparent bool) { } func (g *Graphics) SetVertices(vertices []float32, indices []uint32) error { + defer runtime.KeepAlive(vertices) + defer runtime.KeepAlive(indices) + C.ebitengine_SetVertices((*C.float)(&vertices[0]), C.int(len(vertices)), (*C.uint32_t)(&indices[0]), C.int(len(indices))) return nil } diff --git a/internal/graphicsdriver/playstation5/graphics_playstation5.h b/internal/graphicsdriver/playstation5/graphics_playstation5.h index 0fd002963..dd36eba53 100644 --- a/internal/graphicsdriver/playstation5/graphics_playstation5.h +++ b/internal/graphicsdriver/playstation5/graphics_playstation5.h @@ -57,6 +57,9 @@ ebitengine_Error ebitengine_NewScreenFramebufferImage(int *image, int width, int height); void ebitengine_DisposeImage(int id); +void ebitengine_SetVertices(float *vertices, int vertexCount, uint32_t *indices, + int indexCount); + ebitengine_Error ebitengine_DrawTriangles(int dst, int *srcs, int srcCount, int shader, ebitengine_DstRegion *dstRegions, int dstRegionCount,