Browse Source

gl: add support for tex sub operations (#443)

trethaller 4 năm trước cách đây
mục cha
commit
0d33885e61
3 tập tin đã thay đổi với 39 bổ sung0 xóa
  1. 3 0
      libs/sdl/GLImports.h
  2. 20 0
      libs/sdl/gl.c
  3. 16 0
      libs/sdl/sdl/GL.hx

+ 3 - 0
libs/sdl/GLImports.h

@@ -82,6 +82,9 @@ GL_IMPORT(glActiveTexture, ACTIVETEXTURE);
 GL_IMPORT(glTexImage3D, TEXIMAGE3D);
 GL_IMPORT(glCompressedTexImage2D, COMPRESSEDTEXIMAGE2D);
 GL_IMPORT(glCompressedTexImage3D, COMPRESSEDTEXIMAGE3D);
+GL_IMPORT(glTexSubImage3D, TEXSUBIMAGE3D);
+GL_IMPORT(glCompressedTexSubImage2D, COMPRESSEDTEXSUBIMAGE2D);
+GL_IMPORT(glCompressedTexSubImage3D, COMPRESSEDTEXSUBIMAGE3D);
 #endif
 
 #if defined(HL_NX)

+ 20 - 0
libs/sdl/gl.c

@@ -334,6 +334,22 @@ HL_PRIM void HL_NAME(gl_compressed_tex_image3d)( int target, int level, int inte
 	glCompressedTexImage3D(target,level,internalFormat,width,height,depth,border,imageSize,image);
 }
 
+HL_PRIM void HL_NAME(gl_tex_sub_image2d)(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, vbyte *image) {
+	glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, image);
+}
+
+HL_PRIM void HL_NAME(gl_tex_sub_image3d)(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, vbyte *image) {
+	glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, image);
+}
+
+HL_PRIM void HL_NAME(gl_compressed_tex_sub_image2d)(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, vbyte *image) {
+	glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, image);
+}
+
+HL_PRIM void HL_NAME(gl_compressed_tex_sub_image3d)(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, vbyte *image) {
+	glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, image);
+}
+
 HL_PRIM void HL_NAME(gl_generate_mipmap)( int t ) {
 	glGenerateMipmap(t);
 }
@@ -672,6 +688,10 @@ DEFINE_PRIM(_VOID,gl_tex_image3d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _B
 DEFINE_PRIM(_VOID,gl_tex_image2d_multisample,_I32 _I32 _I32 _I32 _I32 _BOOL);
 DEFINE_PRIM(_VOID,gl_compressed_tex_image2d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
 DEFINE_PRIM(_VOID,gl_compressed_tex_image3d,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_tex_sub_image2d, _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_tex_sub_image3d, _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_compressed_tex_sub_image2d, _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
+DEFINE_PRIM(_VOID,gl_compressed_tex_sub_image3d, _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _BYTES);
 DEFINE_PRIM(_VOID,gl_generate_mipmap,_I32);
 DEFINE_PRIM(_VOID,gl_delete_texture,_NULL(_I32));
 DEFINE_PRIM(_VOID,gl_blit_framebuffer,_I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32 _I32);

+ 16 - 0
libs/sdl/sdl/GL.hx

@@ -233,6 +233,22 @@ class GL {
 	public static function compressedTexImage3D( target : Int, level : Int, internalFormat : Int, width : Int, height : Int, depth : Int, border : Int, imageSize : Int, image : hl.Bytes ) {
 	}
 
+	@:hlNative("?sdl", "gl_tex_sub_image2d")
+	public static function texSubImage2D( target : Int, level : Int, xoffset : Int, yoffset : Int, width : Int, height : Int, format : Int, type : Int, image : hl.Bytes ) {
+	}
+
+	@:hlNative("?sdl", "gl_tex_sub_image3d")
+	public static function texSubImage3D( target : Int, level : Int, xoffset : Int, yoffset : Int, zoffset : Int, width : Int, height : Int, depth : Int, format : Int, type : Int, image : hl.Bytes ) {
+	}
+
+	@:hlNative("?sdl", "gl_compressed_tex_sub_image2d")
+	public static function compressedTexSubImage2D( target : Int, level : Int, xoffset : Int, yoffset : Int, width : Int, height : Int, format : Int, type : Int, image : hl.Bytes ) {
+	}
+
+	@:hlNative("?sdl", "gl_compressed_tex_sub_image3d")
+	public static function compressedTexSubImage3D( target : Int, level : Int, xoffset : Int, yoffset : Int, zoffset : Int, width : Int, height : Int, depth : Int, format : Int, type : Int, image : hl.Bytes ) {
+	}
+
 	public static function generateMipmap( t : Int ) {
 	}