[gtk/gamma-shenanigans] Add a 32bit float format as well



commit 9d8511918196a727195df1a6f488f8d33f0f860e
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 6 13:37:42 2021 -0400

    Add a 32bit float format as well

 gdk/gdkglcontext.c     | 7 +++++++
 gdk/gdkmemorytexture.c | 3 +++
 gdk/gdkmemorytexture.h | 1 +
 3 files changed, 11 insertions(+)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 774d33780c..267b0303cc 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -292,6 +292,13 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
           gl_type = GL_HALF_FLOAT;
           bpp = 6;
         }
+      else if (data_format == GDK_MEMORY_R32G32B32_FLOAT)
+        {
+          gl_internalformat = GL_RGB32F;
+          gl_format = GL_RGB;
+          gl_type = GL_FLOAT;
+          bpp = 12;
+        }
       else /* Fall-back, convert to cairo-surface-format */
         {
           copy = g_malloc (width * height * 4);
diff --git a/gdk/gdkmemorytexture.c b/gdk/gdkmemorytexture.c
index 6bb6d6069b..b2bdd1d50e 100644
--- a/gdk/gdkmemorytexture.c
+++ b/gdk/gdkmemorytexture.c
@@ -69,6 +69,9 @@ gdk_memory_format_bytes_per_pixel (GdkMemoryFormat format)
     case GDK_MEMORY_R16G16B16_FLOAT:
       return 6;
 
+    case GDK_MEMORY_R32G32B32_FLOAT:
+      return 12;
+
     case GDK_MEMORY_N_FORMATS:
     default:
       g_assert_not_reached ();
diff --git a/gdk/gdkmemorytexture.h b/gdk/gdkmemorytexture.h
index 83ac29462b..3eea5fff86 100644
--- a/gdk/gdkmemorytexture.h
+++ b/gdk/gdkmemorytexture.h
@@ -72,6 +72,7 @@ typedef enum {
   GDK_MEMORY_B8G8R8,
   GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
   GDK_MEMORY_R16G16B16_FLOAT,
+  GDK_MEMORY_R32G32B32_FLOAT,
 
   GDK_MEMORY_N_FORMATS
 } GdkMemoryFormat;


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