[cogl/wip/cogl-sharp: 21/51] cogl-sharp: Start translating CoglBools as well



commit 8bd1d603aa8369511f113b97448d51a429782f71
Author: Damien Lespiau <damien lespiau intel com>
Date:   Wed Oct 3 00:05:34 2012 +0100

    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.

 cogl-sharp/_FrameBuffer.cs |   32 ++++++++++++++++++++++++++++++++
 cogl-sharp/_Pipeline.cs    |    8 ++++++++
 cogl-sharp/_Texture.cs     |   16 ++++++++++++++++
 cogl-sharp/parse-gir.py    |   18 ++++++++++--------
 4 files changed, 66 insertions(+), 8 deletions(-)
---
diff --git a/cogl-sharp/_FrameBuffer.cs b/cogl-sharp/_FrameBuffer.cs
index dc0c5e9..241415a 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 9c98a3d..70dd7cb 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 4937c38..0f9b76b 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 0748917..5a8897c 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
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]