summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2012-10-03 00:05:34 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2013-01-04 20:29:35 +0000
commit8bd1d603aa8369511f113b97448d51a429782f71 (patch)
tree554204e7ec1940950dfebdc83b9d4e386525afe1
parent41c626ed96e143c6fb0cb6c21cb70c41c02e39c2 (diff)
downloadcogl-8bd1d603aa8369511f113b97448d51a429782f71.tar.gz
cogl-sharp: Start translating CoglBools as well
Bools are a bit special: - They are 1 byte in C# - They are 1 byte in C++ - CoglBool if 4 bytes (Just like the BOOL Windows type) - The default marshalling of a C# bool is to generate a BOOL, thus the default behaviour is compatible with CoglBool. Turns out that it should just work then.
-rw-r--r--cogl-sharp/_FrameBuffer.cs32
-rw-r--r--cogl-sharp/_Pipeline.cs8
-rw-r--r--cogl-sharp/_Texture.cs16
-rwxr-xr-xcogl-sharp/parse-gir.py18
4 files changed, 66 insertions, 8 deletions
diff --git a/cogl-sharp/_FrameBuffer.cs b/cogl-sharp/_FrameBuffer.cs
index dc0c5e9f..241415a2 100644
--- a/cogl-sharp/_FrameBuffer.cs
+++ b/cogl-sharp/_FrameBuffer.cs
@@ -104,6 +104,22 @@ namespace Cogl
}
[DllImport("cogl2.dll")]
+ public static extern bool cogl_framebuffer_get_depth_texture_enabled(IntPtr o);
+
+ public bool GetDepthTextureEnabled()
+ {
+ return cogl_framebuffer_get_depth_texture_enabled(handle);
+ }
+
+ [DllImport("cogl2.dll")]
+ public static extern bool cogl_framebuffer_get_dither_enabled(IntPtr o);
+
+ public bool GetDitherEnabled()
+ {
+ return cogl_framebuffer_get_dither_enabled(handle);
+ }
+
+ [DllImport("cogl2.dll")]
public static extern PixelFormat cogl_framebuffer_get_color_format(IntPtr o);
public PixelFormat GetColorFormat()
@@ -312,6 +328,22 @@ namespace Cogl
}
[DllImport("cogl2.dll")]
+ public static extern void cogl_framebuffer_set_depth_texture_enabled(IntPtr o, bool enabled);
+
+ public void SetDepthTextureEnabled(bool enabled)
+ {
+ cogl_framebuffer_set_depth_texture_enabled(handle, enabled);
+ }
+
+ [DllImport("cogl2.dll")]
+ public static extern void cogl_framebuffer_set_dither_enabled(IntPtr o, bool dither_enabled);
+
+ public void SetDitherEnabled(bool dither_enabled)
+ {
+ cogl_framebuffer_set_dither_enabled(handle, dither_enabled);
+ }
+
+ [DllImport("cogl2.dll")]
public static extern void cogl_framebuffer_set_modelview_matrix(IntPtr o, ref Matrix matrix);
public void SetModelviewMatrix(ref Matrix matrix)
diff --git a/cogl-sharp/_Pipeline.cs b/cogl-sharp/_Pipeline.cs
index 9c98a3da..70dd7cbf 100644
--- a/cogl-sharp/_Pipeline.cs
+++ b/cogl-sharp/_Pipeline.cs
@@ -80,6 +80,14 @@ namespace Cogl
}
[DllImport("cogl2.dll")]
+ public static extern bool cogl_pipeline_get_layer_point_sprite_coords_enabled(IntPtr o, int layer_index);
+
+ public bool GetLayerPointSpriteCoordsEnabled(int layer_index)
+ {
+ return cogl_pipeline_get_layer_point_sprite_coords_enabled(handle, layer_index);
+ }
+
+ [DllImport("cogl2.dll")]
public static extern IntPtr cogl_pipeline_get_layer_texture(IntPtr o, int layer_index);
public Texture GetLayerTexture(int layer_index)
diff --git a/cogl-sharp/_Texture.cs b/cogl-sharp/_Texture.cs
index 4937c38c..0f9b76ba 100644
--- a/cogl-sharp/_Texture.cs
+++ b/cogl-sharp/_Texture.cs
@@ -15,6 +15,14 @@ namespace Cogl
}
[DllImport("cogl2.dll")]
+ public static extern bool cogl_texture_get_gl_texture(IntPtr o);
+
+ public bool GetGlTexture()
+ {
+ return cogl_texture_get_gl_texture(handle);
+ }
+
+ [DllImport("cogl2.dll")]
public static extern int cogl_texture_get_max_waste(IntPtr o);
public int GetMaxWaste()
@@ -22,5 +30,13 @@ namespace Cogl
return cogl_texture_get_max_waste(handle);
}
+ [DllImport("cogl2.dll")]
+ public static extern bool cogl_texture_is_sliced(IntPtr o);
+
+ public bool IsSliced()
+ {
+ return cogl_texture_is_sliced(handle);
+ }
+
}
}
diff --git a/cogl-sharp/parse-gir.py b/cogl-sharp/parse-gir.py
index 07489178..5a8897cb 100755
--- a/cogl-sharp/parse-gir.py
+++ b/cogl-sharp/parse-gir.py
@@ -50,7 +50,7 @@ name_overrides = {
},
'Pipeline': {
'blacklist': (
- 'set_uniform_float', 'set_uniform_int'
+ 'set_uniform_float', 'set_uniform_int', 'set_uniform_matrix'
)
},
'PixelFormat': {
@@ -58,9 +58,11 @@ name_overrides = {
}
}
-glib_types_map = {
+basic_types_map = {
'gfloat': 'float',
- 'gint': 'int'
+ 'gint': 'int',
+ 'Bool': 'bool', # CoglBool is 4 bytes, which the the default marshalling
+ # for C#'s bool (which itself is 1 byte).
}
header_enum="""/* This file has been generated by parse-gir.py, do not hand edit */
@@ -142,7 +144,7 @@ def known_type(gir_name):
return (gir_name in enum_types or
gir_name in object_types or
- gir_name in glib_types_map or
+ gir_name in basic_types_map or
gir_name in struct_types)
def is_pointer_type(c_type):
@@ -161,8 +163,8 @@ def derive_native_type(gir_type, c_type):
if gir_type in enum_types:
return gir_type
- if gir_type in glib_types_map:
- return glib_types_map[gir_type]
+ if gir_type in basic_types_map:
+ return basic_types_map[gir_type]
print("Error: trying to derivate (%s,%s)" % (gir_type, c_type))
assert False
@@ -171,8 +173,8 @@ def derive_cs_type(gir_type, c_type):
if gir_type == 'none':
return 'void'
- if gir_type in glib_types_map:
- return glib_types_map[gir_type]
+ if gir_type in basic_types_map:
+ return basic_types_map[gir_type]
return gir_type