mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
memoryformat: Fix variable types
Use the same types that GL uses.
This commit is contained in:
parent
cf4b0a27f8
commit
4dfc07ef57
@ -151,7 +151,8 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
|||||||
|
|
||||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||||
{
|
{
|
||||||
GLenum q_internal_format, q_format, q_type;
|
GLint q_internal_format;
|
||||||
|
GLenum q_format, q_type;
|
||||||
GLint q_swizzle[4];
|
GLint q_swizzle[4];
|
||||||
|
|
||||||
if (gdk_memory_format_alpha (format) != alpha)
|
if (gdk_memory_format_alpha (format) != alpha)
|
||||||
@ -181,7 +182,8 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
GdkMemoryFormat format;
|
GdkMemoryFormat format;
|
||||||
gsize expected_stride;
|
gsize expected_stride;
|
||||||
Download *download = download_;
|
Download *download = download_;
|
||||||
GLenum gl_internal_format, gl_format, gl_type;
|
GLint gl_internal_format;
|
||||||
|
GLenum gl_format, gl_type;
|
||||||
GLint gl_swizzle[4];
|
GLint gl_swizzle[4];
|
||||||
|
|
||||||
format = gdk_texture_get_format (texture),
|
format = gdk_texture_get_format (texture),
|
||||||
@ -230,7 +232,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GdkMemoryFormat actual_format;
|
GdkMemoryFormat actual_format;
|
||||||
GLint gl_read_format, gl_read_type;
|
GLenum gl_read_format, gl_read_type;
|
||||||
GLuint fbo;
|
GLuint fbo;
|
||||||
|
|
||||||
glGenFramebuffers (1, &fbo);
|
glGenFramebuffers (1, &fbo);
|
||||||
@ -238,9 +240,15 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
|||||||
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, self->id, 0);
|
||||||
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
if (gdk_gl_context_check_version (context, "4.3", "3.1"))
|
||||||
{
|
{
|
||||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &gl_read_format);
|
GLint read_format, read_type;
|
||||||
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &gl_read_type);
|
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_FORMAT, &read_format);
|
||||||
if (!gdk_gl_texture_find_format (context, gdk_memory_format_alpha (format), gl_read_format, gl_read_type, &actual_format))
|
glGetFramebufferParameteriv (GL_FRAMEBUFFER, GL_IMPLEMENTATION_COLOR_READ_TYPE, &read_type);
|
||||||
|
if (gdk_gl_texture_find_format (context, gdk_memory_format_alpha (format), read_format, read_type, &actual_format))
|
||||||
|
{
|
||||||
|
gl_read_format = read_format;
|
||||||
|
gl_read_type = read_type;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format));
|
actual_format = gdk_memory_depth_get_format (gdk_memory_format_get_depth (format));
|
||||||
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
if (gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT)
|
||||||
|
@ -333,9 +333,9 @@ struct _GdkMemoryFormatDescription
|
|||||||
GdkMemoryDepth depth;
|
GdkMemoryDepth depth;
|
||||||
const GdkMemoryFormat *fallbacks;
|
const GdkMemoryFormat *fallbacks;
|
||||||
struct {
|
struct {
|
||||||
guint internal_format;
|
GLint internal_format;
|
||||||
guint format;
|
GLenum format;
|
||||||
guint type;
|
GLenum type;
|
||||||
GLint swizzle[4];
|
GLint swizzle[4];
|
||||||
/* -1 if none exists, ie the format is already RGBA
|
/* -1 if none exists, ie the format is already RGBA
|
||||||
* or the format doesn't have 4 channels */
|
* or the format doesn't have 4 channels */
|
||||||
@ -1255,9 +1255,9 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
|
|||||||
|
|
||||||
void
|
void
|
||||||
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||||
guint *out_internal_format,
|
GLint *out_internal_format,
|
||||||
guint *out_format,
|
GLenum *out_format,
|
||||||
guint *out_type,
|
GLenum *out_type,
|
||||||
GLint out_swizzle[4])
|
GLint out_swizzle[4])
|
||||||
{
|
{
|
||||||
*out_internal_format = memory_formats[format].gl.internal_format;
|
*out_internal_format = memory_formats[format].gl.internal_format;
|
||||||
@ -1287,9 +1287,9 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
|||||||
gboolean
|
gboolean
|
||||||
gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||||
GdkMemoryFormat *out_actual_format,
|
GdkMemoryFormat *out_actual_format,
|
||||||
guint *out_internal_format,
|
GLint *out_internal_format,
|
||||||
guint *out_format,
|
GLenum *out_format,
|
||||||
guint *out_type,
|
GLenum *out_type,
|
||||||
GLint out_swizzle[4])
|
GLint out_swizzle[4])
|
||||||
{
|
{
|
||||||
GdkMemoryFormat actual = memory_formats[format].gl.rgba_format;
|
GdkMemoryFormat actual = memory_formats[format].gl.rgba_format;
|
||||||
|
@ -51,15 +51,15 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth
|
|||||||
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||||
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST;
|
||||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||||
guint *out_internal_format,
|
GLint *out_internal_format,
|
||||||
guint *out_format,
|
GLenum *out_format,
|
||||||
guint *out_type,
|
GLenum *out_type,
|
||||||
GLint out_swizzle[4]);
|
GLint out_swizzle[4]);
|
||||||
gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||||
GdkMemoryFormat *out_actual_format,
|
GdkMemoryFormat *out_actual_format,
|
||||||
guint *out_internal_format,
|
GLint *out_internal_format,
|
||||||
guint *out_format,
|
GLenum *out_format,
|
||||||
guint *out_type,
|
GLenum *out_type,
|
||||||
GLint out_swizzle[4]);
|
GLint out_swizzle[4]);
|
||||||
|
|
||||||
void gdk_memory_convert (guchar *dest_data,
|
void gdk_memory_convert (guchar *dest_data,
|
||||||
|
@ -1477,9 +1477,9 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
|
|||||||
static GdkMemoryFormat
|
static GdkMemoryFormat
|
||||||
memory_format_gl_format (GskGLCommandQueue *self,
|
memory_format_gl_format (GskGLCommandQueue *self,
|
||||||
GdkMemoryFormat data_format,
|
GdkMemoryFormat data_format,
|
||||||
guint *gl_internalformat,
|
GLint *gl_internalformat,
|
||||||
guint *gl_format,
|
GLenum *gl_format,
|
||||||
guint *gl_type,
|
GLenum *gl_type,
|
||||||
GLint gl_swizzle[4])
|
GLint gl_swizzle[4])
|
||||||
{
|
{
|
||||||
GdkGLMemoryFlags flags;
|
GdkGLMemoryFlags flags;
|
||||||
@ -1561,7 +1561,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
|
|||||||
GdkTextureDownloader downloader;
|
GdkTextureDownloader downloader;
|
||||||
GdkMemoryFormat data_format;
|
GdkMemoryFormat data_format;
|
||||||
int width, height;
|
int width, height;
|
||||||
GLenum gl_internalformat;
|
GLint gl_internalformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
GLint gl_swizzle[4];
|
GLint gl_swizzle[4];
|
||||||
@ -1659,7 +1659,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
|
|||||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||||
int width, height;
|
int width, height;
|
||||||
GdkMemoryFormat data_format;
|
GdkMemoryFormat data_format;
|
||||||
GLenum gl_internalformat;
|
GLint gl_internalformat;
|
||||||
GLenum gl_format;
|
GLenum gl_format;
|
||||||
GLenum gl_type;
|
GLenum gl_type;
|
||||||
GLint gl_swizzle[4];
|
GLint gl_swizzle[4];
|
||||||
|
Loading…
Reference in New Issue
Block a user