diff --git a/internal/graphics/vertex.go b/internal/graphics/vertex.go index 6efa85e2e..133653f03 100644 --- a/internal/graphics/vertex.go +++ b/internal/graphics/vertex.go @@ -36,6 +36,13 @@ const ( 2*ShaderSrcImageCount + // the source image region origins array 2*ShaderSrcImageCount + // the source image region sizes array 16 // the projection matrix + + ProjectionMatrixUniformDwordIndex = 2 + + 2*ShaderSrcImageCount + + 2 + + 2 + + 2*ShaderSrcImageCount + + 2*ShaderSrcImageCount ) const ( diff --git a/internal/graphicsdriver/playstation5/graphics_playstation5.go b/internal/graphicsdriver/playstation5/graphics_playstation5.go index fa56df3f1..918f007a2 100644 --- a/internal/graphicsdriver/playstation5/graphics_playstation5.go +++ b/internal/graphicsdriver/playstation5/graphics_playstation5.go @@ -30,6 +30,11 @@ import ( "github.com/hajimehoshi/ebiten/v2/internal/shaderir" ) +//export ebitengine_ProjectionMatrixUniformDwordIndex +func ebitengine_ProjectionMatrixUniformDwordIndex() C.int { + return C.int(graphics.ProjectionMatrixUniformDwordIndex) +} + type playstation5Error struct { name string code int diff --git a/internal/graphicsdriver/playstation5/graphics_playstation5.h b/internal/graphicsdriver/playstation5/graphics_playstation5.h index 8df55e831..7e77f7b7a 100644 --- a/internal/graphicsdriver/playstation5/graphics_playstation5.h +++ b/internal/graphicsdriver/playstation5/graphics_playstation5.h @@ -25,6 +25,8 @@ extern "C" { #endif +int ebitengine_ProjectionMatrixUniformDwordIndex(); + typedef struct ebitengine_Error { const char *message; int code; @@ -52,23 +54,27 @@ typedef struct ebitengine_DstRegion { // kBlendFactor* and kBlendOperation* must be synced with // internal/graphicsdriver/blend.go. -const uint8_t kBlendFactorZero = 0; -const uint8_t kBlendFactorOne = 1; -const uint8_t kBlendFactorSourceColor = 2; -const uint8_t kBlendFactorOneMinusSourceColor = 3; -const uint8_t kBlendFactorSourceAlpha = 4; -const uint8_t kBlendFactorOneMinusSourceAlpha = 5; -const uint8_t kBlendFactorDestinationColor = 6; -const uint8_t kBlendFactorOneMinusDestinationColor = 7; -const uint8_t kBlendFactorDestinationAlpha = 8; -const uint8_t kBlendFactorOneMinusDestinationAlpha = 9; -const uint8_t kBlendFactorSourceAlphaSaturated = 10; +enum { + kBlendFactorZero = 0, + kBlendFactorOne = 1, + kBlendFactorSourceColor = 2, + kBlendFactorOneMinusSourceColor = 3, + kBlendFactorSourceAlpha = 4, + kBlendFactorOneMinusSourceAlpha = 5, + kBlendFactorDestinationColor = 6, + kBlendFactorOneMinusDestinationColor = 7, + kBlendFactorDestinationAlpha = 8, + kBlendFactorOneMinusDestinationAlpha = 9, + kBlendFactorSourceAlphaSaturated = 10, +}; -const uint8_t kBlendOperationAdd = 0; -const uint8_t kBlendOperationSubtract = 1; -const uint8_t kBlendOperationReverseSubtract = 2; -const uint8_t kBlendOperationMin = 3; -const uint8_t kBlendOperationMax = 4; +enum { + kBlendOperationAdd = 0, + kBlendOperationSubtract = 1, + kBlendOperationReverseSubtract = 2, + kBlendOperationMin = 3, + kBlendOperationMax = 4, +}; typedef struct ebitengine_Blend { uint8_t factor_src_rgb;