mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
Compare commits
2 Commits
960189b051
...
fab511e96b
Author | SHA1 | Date | |
---|---|---|---|
|
fab511e96b | ||
|
2d1e286e87 |
@ -61,8 +61,10 @@ ebitengine_DrawTriangles(int dst, const int *srcs, int src_count, int shader,
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" ebitengine_Error
|
extern "C" ebitengine_Error ebitengine_NewShader(
|
||||||
ebitengine_NewShader(int *shader, const ebitengine_PrecompiledShader *source) {
|
int *shader, const char *vertex_header, int vertex_header_size,
|
||||||
|
const char *vertex_text, int vertex_text_size, const char *pixel_header,
|
||||||
|
int pixel_header_size, const char *pixel_text, int pixel_text_size) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package playstation5
|
package playstation5
|
||||||
|
|
||||||
// #include "graphics_playstation5.h"
|
// #include "graphics_playstation5.h"
|
||||||
|
// #include <stdlib.h>
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -120,19 +121,14 @@ func (g *Graphics) MaxImageSize() int {
|
|||||||
|
|
||||||
func (g *Graphics) NewShader(program *shaderir.Program) (graphicsdriver.Shader, error) {
|
func (g *Graphics) NewShader(program *shaderir.Program) (graphicsdriver.Shader, error) {
|
||||||
s := precompiledShaders[program.SourceHash]
|
s := precompiledShaders[program.SourceHash]
|
||||||
ps := C.ebitengine_PrecompiledShader{
|
defer runtime.KeepAlive(s)
|
||||||
vertex_header: (*C.char)(unsafe.Pointer(unsafe.SliceData(s.vertexHeader))),
|
|
||||||
vertex_header_size: C.int(len(s.vertexHeader)),
|
|
||||||
vertex_text: (*C.char)(unsafe.Pointer(unsafe.SliceData(s.vertexText))),
|
|
||||||
vertex_text_size: C.int(len(s.vertexText)),
|
|
||||||
pixel_header: (*C.char)(unsafe.Pointer(unsafe.SliceData(s.pixelHeader))),
|
|
||||||
pixel_header_size: C.int(len(s.pixelHeader)),
|
|
||||||
pixel_text: (*C.char)(unsafe.Pointer(unsafe.SliceData(s.pixelText))),
|
|
||||||
pixel_text_size: C.int(len(s.pixelText)),
|
|
||||||
}
|
|
||||||
|
|
||||||
var id C.int
|
var id C.int
|
||||||
if err := C.ebitengine_NewShader(&id, &ps); !C.ebitengine_IsErrorNil(&err) {
|
if err := C.ebitengine_NewShader(&id,
|
||||||
|
(*C.char)(unsafe.Pointer(unsafe.SliceData(s.vertexHeader))), C.int(len(s.vertexHeader)),
|
||||||
|
(*C.char)(unsafe.Pointer(unsafe.SliceData(s.vertexText))), C.int(len(s.vertexText)),
|
||||||
|
(*C.char)(unsafe.Pointer(unsafe.SliceData(s.pixelHeader))), C.int(len(s.pixelHeader)),
|
||||||
|
(*C.char)(unsafe.Pointer(unsafe.SliceData(s.pixelText))), C.int(len(s.pixelText))); !C.ebitengine_IsErrorNil(&err) {
|
||||||
return nil, newPlaystation5Error("(*playstation5.Graphics).NewShader", err)
|
return nil, newPlaystation5Error("(*playstation5.Graphics).NewShader", err)
|
||||||
}
|
}
|
||||||
return &Shader{
|
return &Shader{
|
||||||
|
@ -103,20 +103,10 @@ ebitengine_DrawTriangles(int dst, const int *srcs, int src_count, int shader,
|
|||||||
ebitengine_Blend blend, const uint32_t *uniforms,
|
ebitengine_Blend blend, const uint32_t *uniforms,
|
||||||
int uniform_count, int fill_rule);
|
int uniform_count, int fill_rule);
|
||||||
|
|
||||||
typedef struct ebitengine_PrecompiledShader {
|
ebitengine_Error ebitengine_NewShader(
|
||||||
char *vertex_header;
|
int *shader, const char *vertex_header, int vertex_header_size,
|
||||||
int vertex_header_size;
|
const char *vertex_text, int vertex_text_size, const char *pixel_header,
|
||||||
char *vertex_text;
|
int pixel_header_size, const char *pixel_text, int pixel_text_size);
|
||||||
int vertex_text_size;
|
|
||||||
char *pixel_header;
|
|
||||||
int pixel_header_size;
|
|
||||||
char *pixel_text;
|
|
||||||
int pixel_text_size;
|
|
||||||
} ebitengine_PrecompiledShader;
|
|
||||||
|
|
||||||
ebitengine_Error
|
|
||||||
ebitengine_NewShader(int *shader,
|
|
||||||
const ebitengine_PrecompiledShader *precompiled_shader);
|
|
||||||
void ebitengine_DisposeShader(int id);
|
void ebitengine_DisposeShader(int id);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user