diff options
Diffstat (limited to 'mesalib/src/mesa')
107 files changed, 5045 insertions, 4244 deletions
diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index cb038a5eb..ffe65990d 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -95,6 +95,12 @@ AM_CPPFLAGS = $(DEFINES) $(INCLUDE_DIRS) AM_CFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CFLAGS) AM_CXXFLAGS = $(LLVM_CFLAGS) $(VISIBILITY_CXXFLAGS) +ARCH_LIBS = + +if SSE41_SUPPORTED +ARCH_LIBS += libmesa_sse41.la +endif + MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM @@ -103,12 +109,6 @@ noinst_PROGRAMS = gen_matypes gen_matypes_SOURCES = x86/gen_matypes.c BUILT_SOURCES += matypes.h -ARCH_LIBS = - -if SSE41_SUPPORTED -ARCH_LIBS += libmesa_sse41.la -endif - if HAVE_X86_64_ASM MESA_ASM_FILES_FOR_ARCH += $(X86_64_FILES) AM_CPPFLAGS += -I$(builddir)/x86-64 -I$(srcdir)/x86-64 diff --git a/mesalib/src/mesa/Makefile.sources b/mesalib/src/mesa/Makefile.sources index d14823db9..bd02d3ee8 100644 --- a/mesalib/src/mesa/Makefile.sources +++ b/mesalib/src/mesa/Makefile.sources @@ -18,11 +18,13 @@ MAIN_FILES = \ $(SRCDIR)main/attrib.c \ $(SRCDIR)main/arrayobj.c \ $(SRCDIR)main/blend.c \ + $(SRCDIR)main/blit.c \ $(SRCDIR)main/bufferobj.c \ $(SRCDIR)main/buffers.c \ $(SRCDIR)main/clear.c \ $(SRCDIR)main/clip.c \ $(SRCDIR)main/colortab.c \ + $(SRCDIR)main/compute.c \ $(SRCDIR)main/condrender.c \ $(SRCDIR)main/context.c \ $(SRCDIR)main/convolve.c \ @@ -48,6 +50,7 @@ MAIN_FILES = \ $(SRCDIR)main/format_unpack.c \ $(SRCDIR)main/framebuffer.c \ $(SRCDIR)main/get.c \ + $(SRCDIR)main/genmipmap.c \ $(SRCDIR)main/getstring.c \ $(SRCDIR)main/glformats.c \ $(SRCDIR)main/hash.c \ diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index 77e2aaa7e..b52bbdc23 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -46,11 +46,13 @@ main_sources = [ 'main/attrib.c', 'main/arrayobj.c', 'main/blend.c', + 'main/blit.c', 'main/bufferobj.c', 'main/buffers.c', 'main/clear.c', 'main/clip.c', 'main/colortab.c', + 'main/compute.c', 'main/condrender.c', 'main/context.c', 'main/convolve.c', @@ -77,6 +79,7 @@ main_sources = [ 'main/format_pack.c', 'main/format_unpack.c', 'main/framebuffer.c', + 'main/genmipmap.c', 'main/getstring.c', 'main/glformats.c', 'main/hash.c', diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index 6d56838cd..6ece5d80e 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -180,8 +180,8 @@ _mesa_init_driver_functions(struct dd_function_table *driver) _mesa_init_texture_barrier_functions(driver); /* APPLE_vertex_array_object */ - driver->NewArrayObject = _mesa_new_array_object; - driver->DeleteArrayObject = _mesa_delete_array_object; + driver->NewArrayObject = _mesa_new_vao; + driver->DeleteArrayObject = _mesa_delete_vao; driver->BindArrayObject = NULL; _mesa_init_shader_object_functions(driver); diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 2443a7723..f12bcaab1 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -164,7 +164,7 @@ struct save_state GLuint EnvMode; /* unit[0] only */ /** MESA_META_VERTEX */ - struct gl_array_object *ArrayObj; + struct gl_vertex_array_object *VAO; struct gl_buffer_object *ArrayBufferObj; /** MESA_META_VIEWPORT */ @@ -221,7 +221,7 @@ struct temp_texture */ struct blit_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint DepthFP; GLuint ShaderProg; @@ -235,7 +235,7 @@ struct blit_state */ struct clear_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint ShaderProg; GLint ColorLocation; @@ -252,7 +252,7 @@ struct clear_state */ struct copypix_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; }; @@ -262,7 +262,7 @@ struct copypix_state */ struct drawpix_state { - GLuint ArrayObj; + GLuint VAO; GLuint StencilFP; /**< Fragment program for drawing stencil images */ GLuint DepthFP; /**< Fragment program for drawing depth images */ @@ -274,7 +274,7 @@ struct drawpix_state */ struct bitmap_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; struct temp_texture Tex; /**< separate texture from other meta ops */ }; @@ -295,7 +295,7 @@ struct glsl_sampler { */ struct gen_mipmap_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; GLuint FBO; GLuint Sampler; @@ -313,7 +313,7 @@ struct gen_mipmap_state */ struct decompress_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO, FBO, RBO, Sampler; GLint Width, Height; }; @@ -323,7 +323,7 @@ struct decompress_state */ struct drawtex_state { - GLuint ArrayObj; + GLuint VAO; GLuint VBO; }; @@ -350,11 +350,12 @@ struct gl_meta_state struct drawtex_state DrawTex; /**< For _mesa_meta_DrawTex() */ }; -static void meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit); -static void cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex); -static void meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear); -static void meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx, - struct gen_mipmap_state *mipmap); +static void meta_glsl_blit_cleanup(struct blit_state *blit); +static void cleanup_temp_texture(struct temp_texture *tex); +static void meta_glsl_clear_cleanup(struct clear_state *clear); +static void meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap); +static void meta_decompress_cleanup(struct decompress_state *decompress); +static void meta_drawpix_cleanup(struct drawpix_state *drawpix); static GLuint compile_shader_with_debug(struct gl_context *ctx, GLenum target, const GLcharARB *source) @@ -445,10 +446,12 @@ _mesa_meta_free(struct gl_context *ctx) { GET_CURRENT_CONTEXT(old_context); _mesa_make_current(ctx, NULL, NULL); - meta_glsl_blit_cleanup(ctx, &ctx->Meta->Blit); - meta_glsl_clear_cleanup(ctx, &ctx->Meta->Clear); - meta_glsl_generate_mipmap_cleanup(ctx, &ctx->Meta->Mipmap); - cleanup_temp_texture(ctx, &ctx->Meta->TempTex); + meta_glsl_blit_cleanup(&ctx->Meta->Blit); + meta_glsl_clear_cleanup(&ctx->Meta->Clear); + meta_glsl_generate_mipmap_cleanup(&ctx->Meta->Mipmap); + cleanup_temp_texture(&ctx->Meta->TempTex); + meta_decompress_cleanup(&ctx->Meta->Decompress); + meta_drawpix_cleanup(&ctx->Meta->DrawPix); if (old_context) _mesa_make_current(old_context, old_context->WinSysDrawBuffer, old_context->WinSysReadBuffer); else @@ -726,8 +729,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) if (state & MESA_META_VERTEX) { /* save vertex array object state */ - _mesa_reference_array_object(ctx, &save->ArrayObj, - ctx->Array.ArrayObj); + _mesa_reference_vao(ctx, &save->VAO, + ctx->Array.VAO); _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, ctx->Array.ArrayBufferObj); /* set some default state? */ @@ -1092,8 +1095,8 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL); /* restore vertex array object */ - _mesa_BindVertexArray(save->ArrayObj->Name); - _mesa_reference_array_object(ctx, &save->ArrayObj, NULL); + _mesa_BindVertexArray(save->VAO->Name); + _mesa_reference_vao(ctx, &save->VAO, NULL); } if (state & MESA_META_VIEWPORT) { @@ -1208,7 +1211,7 @@ init_temp_texture(struct gl_context *ctx, struct temp_texture *tex) } static void -cleanup_temp_texture(struct gl_context *ctx, struct temp_texture *tex) +cleanup_temp_texture(struct temp_texture *tex) { if (!tex->TexObj) return; @@ -1453,20 +1456,19 @@ init_blit_depth_pixels(struct gl_context *ctx) } static void -setup_ff_blit_framebuffer(struct gl_context *ctx, - struct blit_state *blit) +setup_ff_blit_framebuffer(struct blit_state *blit) { struct vertex { GLfloat x, y, s, t; }; struct vertex verts[4]; - if (blit->ArrayObj == 0) { + if (blit->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &blit->ArrayObj); - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_GenVertexArrays(1, &blit->VAO); + _mesa_BindVertexArray(blit->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &blit->VBO); @@ -1508,11 +1510,11 @@ setup_glsl_blit_framebuffer(struct gl_context *ctx, assert(_mesa_is_desktop_gl(ctx) || texture_2d); /* Check if already initialized */ - if (blit->ArrayObj == 0) { + if (blit->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &blit->ArrayObj); - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_GenVertexArrays(1, &blit->VAO); + _mesa_BindVertexArray(blit->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &blit->VBO); @@ -1682,10 +1684,10 @@ blitframebuffer_texture(struct gl_context *ctx, _mesa_UseProgram(blit->RectShaderProg); } else { - setup_ff_blit_framebuffer(ctx, &ctx->Meta->Blit); + setup_ff_blit_framebuffer(&ctx->Meta->Blit); } - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindVertexArray(blit->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO); _mesa_GenSamplers(1, &sampler); @@ -1867,10 +1869,10 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, _mesa_UseProgram(blit->RectShaderProg); } else { - setup_ff_blit_framebuffer(ctx, blit); + setup_ff_blit_framebuffer(blit); } - _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindVertexArray(blit->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, blit->VBO); /* Continue with "normal" approach which involves copying the src rect @@ -1998,11 +2000,11 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, } static void -meta_glsl_blit_cleanup(struct gl_context *ctx, struct blit_state *blit) +meta_glsl_blit_cleanup(struct blit_state *blit) { - if (blit->ArrayObj) { - _mesa_DeleteVertexArrays(1, &blit->ArrayObj); - blit->ArrayObj = 0; + if (blit->VAO) { + _mesa_DeleteVertexArrays(1, &blit->VAO); + blit->VAO = 0; _mesa_DeleteBuffers(1, &blit->VBO); blit->VBO = 0; } @@ -2047,12 +2049,12 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) _mesa_meta_begin(ctx, metaSave); - if (clear->ArrayObj == 0) { + if (clear->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, &clear->ArrayObj); - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_GenVertexArrays(1, &clear->VAO); + _mesa_BindVertexArray(clear->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &clear->VBO); @@ -2065,7 +2067,7 @@ _mesa_meta_Clear(struct gl_context *ctx, GLbitfield buffers) _mesa_EnableClientState(GL_COLOR_ARRAY); } else { - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindVertexArray(clear->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO); } @@ -2180,12 +2182,12 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) GLuint vs, gs = 0, fs; bool has_integer_textures; - if (clear->ArrayObj != 0) + if (clear->VAO != 0) return; /* create vertex array object */ - _mesa_GenVertexArrays(1, &clear->ArrayObj); - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_GenVertexArrays(1, &clear->VAO); + _mesa_BindVertexArray(clear->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &clear->VBO); @@ -2287,12 +2289,12 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) } static void -meta_glsl_clear_cleanup(struct gl_context *ctx, struct clear_state *clear) +meta_glsl_clear_cleanup(struct clear_state *clear) { - if (clear->ArrayObj == 0) + if (clear->VAO == 0) return; - _mesa_DeleteVertexArrays(1, &clear->ArrayObj); - clear->ArrayObj = 0; + _mesa_DeleteVertexArrays(1, &clear->VAO); + clear->VAO = 0; _mesa_DeleteBuffers(1, &clear->VBO); clear->VBO = 0; _mesa_DeleteObjectARB(clear->ShaderProg); @@ -2357,7 +2359,7 @@ _mesa_meta_glsl_Clear(struct gl_context *ctx, GLbitfield buffers) ctx->Color.ClearColor.f); } - _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindVertexArray(clear->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, clear->VBO); /* GL_COLOR_BUFFER_BIT */ @@ -2470,12 +2472,12 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (copypix->ArrayObj == 0) { + if (copypix->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArrays(1, ©pix->ArrayObj); - _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_GenVertexArrays(1, ©pix->VAO); + _mesa_BindVertexArray(copypix->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, ©pix->VBO); @@ -2490,7 +2492,7 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } else { - _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_BindVertexArray(copypix->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, copypix->VBO); } @@ -2543,7 +2545,24 @@ _mesa_meta_CopyPixels(struct gl_context *ctx, GLint srcX, GLint srcY, _mesa_meta_end(ctx); } +static void +meta_drawpix_cleanup(struct drawpix_state *drawpix) +{ + if (drawpix->VAO != 0) { + _mesa_DeleteVertexArrays(1, &drawpix->VAO); + drawpix->VAO = 0; + } + if (drawpix->StencilFP != 0) { + _mesa_DeleteProgramsARB(1, &drawpix->StencilFP); + drawpix->StencilFP = 0; + } + + if (drawpix->DepthFP != 0) { + _mesa_DeleteProgramsARB(1, &drawpix->DepthFP); + drawpix->DepthFP = 0; + } +} /** * When the glDrawPixels() image size is greater than the max rectangle @@ -2825,11 +2844,11 @@ _mesa_meta_DrawPixels(struct gl_context *ctx, verts[3].t = tex->Ttop; } - if (drawpix->ArrayObj == 0) { + if (drawpix->VAO == 0) { /* one-time setup: create vertex array object */ - _mesa_GenVertexArrays(1, &drawpix->ArrayObj); + _mesa_GenVertexArrays(1, &drawpix->VAO); } - _mesa_BindVertexArray(drawpix->ArrayObj); + _mesa_BindVertexArray(drawpix->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &vbo); @@ -3001,12 +3020,12 @@ _mesa_meta_Bitmap(struct gl_context *ctx, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (bitmap->ArrayObj == 0) { + if (bitmap->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArraysAPPLE(1, &bitmap->ArrayObj); - _mesa_BindVertexArrayAPPLE(bitmap->ArrayObj); + _mesa_GenVertexArrays(1, &bitmap->VAO); + _mesa_BindVertexArray(bitmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &bitmap->VBO); @@ -3023,7 +3042,7 @@ _mesa_meta_Bitmap(struct gl_context *ctx, _mesa_EnableClientState(GL_COLOR_ARRAY); } else { - _mesa_BindVertexArray(bitmap->ArrayObj); + _mesa_BindVertexArray(bitmap->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, bitmap->VBO); } @@ -3361,18 +3380,17 @@ setup_texture_coords(GLenum faceTarget, static void -setup_ff_generate_mipmap(struct gl_context *ctx, - struct gen_mipmap_state *mipmap) +setup_ff_generate_mipmap(struct gen_mipmap_state *mipmap) { struct vertex { GLfloat x, y, tex[3]; }; - if (mipmap->ArrayObj == 0) { + if (mipmap->VAO == 0) { /* one-time setup */ /* create vertex array object */ - _mesa_GenVertexArraysAPPLE(1, &mipmap->ArrayObj); - _mesa_BindVertexArrayAPPLE(mipmap->ArrayObj); + _mesa_GenVertexArrays(1, &mipmap->VAO); + _mesa_BindVertexArray(mipmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &mipmap->VBO); @@ -3451,11 +3469,11 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, void *mem_ctx; /* Check if already initialized */ - if (mipmap->ArrayObj == 0) { + if (mipmap->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &mipmap->ArrayObj); - _mesa_BindVertexArray(mipmap->ArrayObj); + _mesa_GenVertexArrays(1, &mipmap->VAO); + _mesa_BindVertexArray(mipmap->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &mipmap->VBO); @@ -3552,13 +3570,12 @@ setup_glsl_generate_mipmap(struct gl_context *ctx, static void -meta_glsl_generate_mipmap_cleanup(struct gl_context *ctx, - struct gen_mipmap_state *mipmap) +meta_glsl_generate_mipmap_cleanup(struct gen_mipmap_state *mipmap) { - if (mipmap->ArrayObj == 0) + if (mipmap->VAO == 0) return; - _mesa_DeleteVertexArrays(1, &mipmap->ArrayObj); - mipmap->ArrayObj = 0; + _mesa_DeleteVertexArrays(1, &mipmap->VAO); + mipmap->VAO = 0; _mesa_DeleteBuffers(1, &mipmap->VBO); mipmap->VBO = 0; @@ -3630,11 +3647,11 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_UseProgram(mipmap->ShaderProg); } else { - setup_ff_generate_mipmap(ctx, mipmap); + setup_ff_generate_mipmap(mipmap); _mesa_set_enable(ctx, target, GL_TRUE); } - _mesa_BindVertexArray(mipmap->ArrayObj); + _mesa_BindVertexArray(mipmap->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, mipmap->VBO); samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ? @@ -3814,7 +3831,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, * ReadPixels() and passed to Tex[Sub]Image(). */ static GLenum -get_temp_image_type(struct gl_context *ctx, gl_format format) +get_temp_image_type(struct gl_context *ctx, mesa_format format) { GLenum baseFormat; @@ -3945,6 +3962,25 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, } +static void +meta_decompress_cleanup(struct decompress_state *decompress) +{ + if (decompress->FBO != 0) { + _mesa_DeleteFramebuffers(1, &decompress->FBO); + _mesa_DeleteRenderbuffers(1, &decompress->RBO); + } + + if (decompress->VAO != 0) { + _mesa_DeleteVertexArrays(1, &decompress->VAO); + _mesa_DeleteBuffers(1, &decompress->VBO); + } + + if (decompress->Sampler != 0) + _mesa_DeleteSamplers(1, &decompress->Sampler); + + memset(decompress, 0, sizeof(*decompress)); +} + /** * Decompress a texture image by drawing a quad with the compressed * texture and reading the pixels out of the color buffer. @@ -3981,11 +4017,28 @@ decompress_texture_image(struct gl_context *ctx, target == GL_TEXTURE_2D_ARRAY); } - if (target == GL_TEXTURE_CUBE_MAP) { + switch (target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_1D_ARRAY: + assert(!"No compressed 1D textures."); + return; + + case GL_TEXTURE_3D: + assert(!"No compressed 3D textures."); + return; + + case GL_TEXTURE_2D_ARRAY: + case GL_TEXTURE_CUBE_MAP_ARRAY: + /* These targets are just broken currently. */ + return; + + case GL_TEXTURE_CUBE_MAP: faceTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X + texImage->Face; - } - else { + break; + + default: faceTarget = target; + break; } /* save fbo bindings (not saved by _mesa_meta_begin()) */ @@ -4023,10 +4076,10 @@ decompress_texture_image(struct gl_context *ctx, } /* setup VBO data */ - if (decompress->ArrayObj == 0) { + if (decompress->VAO == 0) { /* create vertex array object */ - _mesa_GenVertexArrays(1, &decompress->ArrayObj); - _mesa_BindVertexArray(decompress->ArrayObj); + _mesa_GenVertexArrays(1, &decompress->VAO); + _mesa_BindVertexArray(decompress->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &decompress->VBO); @@ -4041,7 +4094,7 @@ decompress_texture_image(struct gl_context *ctx, _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); } else { - _mesa_BindVertexArray(decompress->ArrayObj); + _mesa_BindVertexArray(decompress->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, decompress->VBO); } @@ -4068,18 +4121,17 @@ decompress_texture_image(struct gl_context *ctx, verts[3].tex); /* setup vertex positions */ - verts[0].x = 0.0F; - verts[0].y = 0.0F; - verts[1].x = width; - verts[1].y = 0.0F; - verts[2].x = width; - verts[2].y = height; - verts[3].x = 0.0F; - verts[3].y = height; + verts[0].x = -1.0F; + verts[0].y = -1.0F; + verts[1].x = 1.0F; + verts[1].y = -1.0F; + verts[2].x = 1.0F; + verts[2].y = 1.0F; + verts[3].x = -1.0F; + verts[3].y = 1.0F; _mesa_MatrixMode(GL_PROJECTION); _mesa_LoadIdentity(); - _mesa_Ortho(0.0, width, 0.0, height, -1.0, 1.0); _mesa_set_viewport(ctx, 0, 0, 0, width, height); /* upload new vertex data */ @@ -4179,7 +4231,8 @@ _mesa_meta_GetTexImage(struct gl_context *ctx, * unsigned, normalized values. We could handle signed and unnormalized * with floating point renderbuffers... */ - if (_mesa_is_format_compressed(texImage->TexFormat) && + if (texImage->TexObject->Target != GL_TEXTURE_CUBE_MAP_ARRAY + && _mesa_is_format_compressed(texImage->TexFormat) && _mesa_get_format_datatype(texImage->TexFormat) == GL_UNSIGNED_NORMALIZED) { struct gl_texture_object *texObj = texImage->TexObject; @@ -4236,13 +4289,13 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, MESA_META_VERTEX | MESA_META_VIEWPORT)); - if (drawtex->ArrayObj == 0) { + if (drawtex->VAO == 0) { /* one-time setup */ GLint active_texture; /* create vertex array object */ - _mesa_GenVertexArrays(1, &drawtex->ArrayObj); - _mesa_BindVertexArray(drawtex->ArrayObj); + _mesa_GenVertexArrays(1, &drawtex->VAO); + _mesa_BindVertexArray(drawtex->VAO); /* create vertex array buffer */ _mesa_GenBuffers(1, &drawtex->VBO); @@ -4266,7 +4319,7 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, _mesa_ClientActiveTexture(GL_TEXTURE0 + active_texture); } else { - _mesa_BindVertexArray(drawtex->ArrayObj); + _mesa_BindVertexArray(drawtex->VAO); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, drawtex->VBO); } diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c index 652140f6a..22c0848c8 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.c +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -810,60 +810,60 @@ driUpdateFramebufferSize(struct gl_context *ctx, const __DRIdrawable *dPriv) } uint32_t -driGLFormatToImageFormat(gl_format format) +driGLFormatToImageFormat(mesa_format format) { switch (format) { - case MESA_FORMAT_RGB565: + case MESA_FORMAT_B5G6R5_UNORM: return __DRI_IMAGE_FORMAT_RGB565; - case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_B8G8R8X8_UNORM: return __DRI_IMAGE_FORMAT_XRGB8888; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: return __DRI_IMAGE_FORMAT_ARGB2101010; - case MESA_FORMAT_XRGB2101010_UNORM: + case MESA_FORMAT_B10G10R10X2_UNORM: return __DRI_IMAGE_FORMAT_XRGB2101010; - case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_B8G8R8A8_UNORM: return __DRI_IMAGE_FORMAT_ARGB8888; - case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_UNORM: return __DRI_IMAGE_FORMAT_ABGR8888; - case MESA_FORMAT_RGBX8888_REV: + case MESA_FORMAT_R8G8B8X8_UNORM: return __DRI_IMAGE_FORMAT_XBGR8888; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return __DRI_IMAGE_FORMAT_R8; - case MESA_FORMAT_GR88: + case MESA_FORMAT_R8G8_UNORM: return __DRI_IMAGE_FORMAT_GR88; case MESA_FORMAT_NONE: return __DRI_IMAGE_FORMAT_NONE; - case MESA_FORMAT_SARGB8: + case MESA_FORMAT_B8G8R8A8_SRGB: return __DRI_IMAGE_FORMAT_SARGB8; default: return 0; } } -gl_format +mesa_format driImageFormatToGLFormat(uint32_t image_format) { switch (image_format) { case __DRI_IMAGE_FORMAT_RGB565: - return MESA_FORMAT_RGB565; + return MESA_FORMAT_B5G6R5_UNORM; case __DRI_IMAGE_FORMAT_XRGB8888: - return MESA_FORMAT_XRGB8888; + return MESA_FORMAT_B8G8R8X8_UNORM; case __DRI_IMAGE_FORMAT_ARGB2101010: - return MESA_FORMAT_ARGB2101010; + return MESA_FORMAT_B10G10R10A2_UNORM; case __DRI_IMAGE_FORMAT_XRGB2101010: - return MESA_FORMAT_XRGB2101010_UNORM; + return MESA_FORMAT_B10G10R10X2_UNORM; case __DRI_IMAGE_FORMAT_ARGB8888: - return MESA_FORMAT_ARGB8888; + return MESA_FORMAT_B8G8R8A8_UNORM; case __DRI_IMAGE_FORMAT_ABGR8888: - return MESA_FORMAT_RGBA8888_REV; + return MESA_FORMAT_R8G8B8A8_UNORM; case __DRI_IMAGE_FORMAT_XBGR8888: - return MESA_FORMAT_RGBX8888_REV; + return MESA_FORMAT_R8G8B8X8_UNORM; case __DRI_IMAGE_FORMAT_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case __DRI_IMAGE_FORMAT_GR88: - return MESA_FORMAT_GR88; + return MESA_FORMAT_R8G8_UNORM; case __DRI_IMAGE_FORMAT_SARGB8: - return MESA_FORMAT_SARGB8; + return MESA_FORMAT_B8G8R8A8_SRGB; case __DRI_IMAGE_FORMAT_NONE: return MESA_FORMAT_NONE; default: diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h index a79a4ed7a..a37a0bbbc 100644 --- a/mesalib/src/mesa/drivers/dri/common/dri_util.h +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h @@ -281,9 +281,9 @@ struct __DRIdrawableRec { }; extern uint32_t -driGLFormatToImageFormat(gl_format format); +driGLFormatToImageFormat(mesa_format format); -extern gl_format +extern mesa_format driImageFormatToGLFormat(uint32_t image_format); extern void diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c index 3e35fe2d0..1f29e0b08 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.c +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -151,7 +151,7 @@ driGetRendererString( char * buffer, const char * hardware_name, * If the function fails and returns \c GL_FALSE, this * value will be unmodified, but some elements in the * linked list may be modified. - * \param format Mesa gl_format enum describing the pixel format + * \param format Mesa mesa_format enum describing the pixel format * \param depth_bits Array of depth buffer sizes to be exposed. * \param stencil_bits Array of stencil buffer sizes to be exposed. * \param num_depth_stencil_bits Number of entries in both \c depth_bits and @@ -176,7 +176,7 @@ driGetRendererString( char * buffer, const char * hardware_name, * \c format). */ __DRIconfig ** -driCreateConfigs(gl_format format, +driCreateConfigs(mesa_format format, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, @@ -184,15 +184,15 @@ driCreateConfigs(gl_format format, GLboolean enable_accum) { static const uint32_t masks_table[][4] = { - /* MESA_FORMAT_RGB565 */ + /* MESA_FORMAT_B5G6R5_UNORM */ { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, - /* MESA_FORMAT_XRGB8888 */ + /* MESA_FORMAT_B8G8R8X8_UNORM */ { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, - /* MESA_FORMAT_ARGB8888 */ + /* MESA_FORMAT_B8G8R8A8_UNORM */ { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, - /* MESA_FORMAT_XRGB2101010_UNORM */ + /* MESA_FORMAT_B10G10R10X2_UNORM */ { 0x3FF00000, 0x000FFC00, 0x000003FF, 0x00000000 }, - /* MESA_FORMAT_ARGB2101010 */ + /* MESA_FORMAT_B10G10R10A2_UNORM */ { 0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000 }, }; @@ -209,20 +209,20 @@ driCreateConfigs(gl_format format, bool is_srgb; switch (format) { - case MESA_FORMAT_RGB565: + case MESA_FORMAT_B5G6R5_UNORM: masks = masks_table[0]; break; - case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_B8G8R8X8_UNORM: masks = masks_table[1]; break; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_SARGB8: + case MESA_FORMAT_B8G8R8A8_UNORM: + case MESA_FORMAT_B8G8R8A8_SRGB: masks = masks_table[2]; break; - case MESA_FORMAT_XRGB2101010_UNORM: + case MESA_FORMAT_B10G10R10X2_UNORM: masks = masks_table[3]; break; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: masks = masks_table[4]; break; default: diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h index 22af123c3..094143446 100644 --- a/mesalib/src/mesa/drivers/dri/common/utils.h +++ b/mesalib/src/mesa/drivers/dri/common/utils.h @@ -48,7 +48,7 @@ struct __DRIconfigRec { }; extern __DRIconfig ** -driCreateConfigs(gl_format format, +driCreateConfigs(mesa_format format, const uint8_t * depth_bits, const uint8_t * stencil_bits, unsigned num_depth_stencil_bits, const GLenum * db_modes, unsigned num_db_modes, diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c index cddab6526..3d19a52dc 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c @@ -76,19 +76,17 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct dri_context *dri_ctx; int x, y, w, h; __DRIscreen *sPriv = dPriv->driScreenPriv; - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; struct swrast_texture_image *swImage; uint32_t internalFormat; - gl_format texFormat; + mesa_format texFormat; dri_ctx = (struct dri_context *)pDRICtx->driverPrivate; internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4); - texUnit = _mesa_get_current_tex_unit(&dri_ctx->Base); - texObj = _mesa_select_tex_object(&dri_ctx->Base, texUnit, target); + texObj = _mesa_get_current_tex_object(&dri_ctx->Base, target); texImage = _mesa_get_tex_image(&dri_ctx->Base, texObj, target, 0); swImage = swrast_texture_image(texImage); @@ -97,9 +95,9 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, sPriv->swrast_loader->getDrawableInfo(dPriv, &x, &y, &w, &h, dPriv->loaderPrivate); if (texture_format == __DRI_TEXTURE_FORMAT_RGB) - texFormat = MESA_FORMAT_XRGB8888; + texFormat = MESA_FORMAT_B8G8R8X8_UNORM; else - texFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_B8G8R8A8_UNORM; _mesa_init_teximage_fields(&dri_ctx->Base, texImage, w, h, 1, 0, internalFormat, texFormat); @@ -135,7 +133,7 @@ swrastFillInModes(__DRIscreen *psp, __DRIconfig **configs; unsigned depth_buffer_factor; unsigned back_buffer_factor; - gl_format format; + mesa_format format; /* GLX_SWAP_COPY_OML is only supported because the Intel driver doesn't * support pageflipping at all. @@ -171,13 +169,13 @@ swrastFillInModes(__DRIscreen *psp, switch (pixel_bits) { case 16: - format = MESA_FORMAT_RGB565; + format = MESA_FORMAT_B5G6R5_UNORM; break; case 24: - format = MESA_FORMAT_XRGB8888; + format = MESA_FORMAT_B8G8R8X8_UNORM; break; case 32: - format = MESA_FORMAT_ARGB8888; + format = MESA_FORMAT_B8G8R8A8_UNORM; break; default: fprintf(stderr, "[%s:%u] bad depth %d\n", __FUNCTION__, __LINE__, @@ -350,25 +348,25 @@ swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv, switch (pixel_format) { case PF_A8R8G8B8: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = MESA_FORMAT_B8G8R8A8_UNORM; rb->InternalFormat = GL_RGBA; rb->_BaseFormat = GL_RGBA; xrb->bpp = 32; break; case PF_X8R8G8B8: - rb->Format = MESA_FORMAT_ARGB8888; /* XXX */ + rb->Format = MESA_FORMAT_B8G8R8A8_UNORM; /* XXX */ rb->InternalFormat = GL_RGB; rb->_BaseFormat = GL_RGB; xrb->bpp = 32; break; case PF_R5G6B5: - rb->Format = MESA_FORMAT_RGB565; + rb->Format = MESA_FORMAT_B5G6R5_UNORM; rb->InternalFormat = GL_RGB; rb->_BaseFormat = GL_RGB; xrb->bpp = 16; break; case PF_R3G3B2: - rb->Format = MESA_FORMAT_RGB332; + rb->Format = MESA_FORMAT_B2G3R3_UNORM; rb->InternalFormat = GL_RGB; rb->_BaseFormat = GL_RGB; xrb->bpp = 8; @@ -632,14 +630,14 @@ viewport(struct gl_context *ctx) swrast_check_and_update_window_size(ctx, read); } -static gl_format swrastChooseTextureFormat(struct gl_context * ctx, +static mesa_format swrastChooseTextureFormat(struct gl_context * ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type) { if (internalFormat == GL_RGB) - return MESA_FORMAT_XRGB8888; + return MESA_FORMAT_B8G8R8X8_UNORM; return _mesa_choose_tex_format(ctx, target, internalFormat, format, type); } diff --git a/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp b/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp index df697e4a3..813ad1ff2 100644 --- a/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp +++ b/mesalib/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp @@ -593,23 +593,23 @@ MesaSoftwareRast::_SetupRenderBuffer(struct gl_renderbuffer* rb, switch (colorSpace) { case B_RGBA32: rb->_BaseFormat = GL_RGBA; - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = MESA_FORMAT_B8G8R8A8_UNORM; break; case B_RGB32: rb->_BaseFormat = GL_RGB; - rb->Format = MESA_FORMAT_XRGB8888; + rb->Format = MESA_FORMAT_B8G8R8X8_UNORM; break; case B_RGB24: rb->_BaseFormat = GL_RGB; - rb->Format = MESA_FORMAT_RGB888; + rb->Format = MESA_FORMAT_BGR_UNORM8; break; case B_RGB16: rb->_BaseFormat = GL_RGB; - rb->Format = MESA_FORMAT_RGB565; + rb->Format = MESA_FORMAT_B5G6R5_UNORM; break; case B_RGB15: rb->_BaseFormat = GL_RGB; - rb->Format = MESA_FORMAT_ARGB1555; + rb->Format = MESA_FORMAT_B5G5R5A1_UNORM; break; default: fprintf(stderr, "Unsupported screen color space %s\n", diff --git a/mesalib/src/mesa/main/accum.c b/mesalib/src/mesa/main/accum.c index 421fe6cc5..ef74468f4 100644 --- a/mesalib/src/mesa/main/accum.c +++ b/mesalib/src/mesa/main/accum.c @@ -138,7 +138,7 @@ _mesa_clear_accum_buffer(struct gl_context *ctx) return; } - if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) { + if (accRb->Format == MESA_FORMAT_RGBA_SNORM16) { const GLshort clearR = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]); const GLshort clearG = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]); const GLshort clearB = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]); @@ -193,7 +193,7 @@ accum_scale_or_bias(struct gl_context *ctx, GLfloat value, return; } - if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) { + if (accRb->Format == MESA_FORMAT_RGBA_SNORM16) { const GLshort incr = (GLshort) (value * 32767.0f); GLint i, j; if (bias) { @@ -271,7 +271,7 @@ accum_or_load(struct gl_context *ctx, GLfloat value, return; } - if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) { + if (accRb->Format == MESA_FORMAT_RGBA_SNORM16) { const GLfloat scale = value * 32767.0f; GLint i, j; GLfloat (*rgba)[4]; @@ -363,7 +363,7 @@ accum_return(struct gl_context *ctx, GLfloat value, continue; } - if (accRb->Format == MESA_FORMAT_SIGNED_RGBA_16) { + if (accRb->Format == MESA_FORMAT_RGBA_SNORM16) { const GLfloat scale = value / 32767.0f; GLint i, j; GLfloat (*rgba)[4], (*dest)[4]; diff --git a/mesalib/src/mesa/main/api_arrayelt.c b/mesalib/src/mesa/main/api_arrayelt.c index f439b7068..29a57c8e5 100644 --- a/mesalib/src/mesa/main/api_arrayelt.c +++ b/mesalib/src/mesa/main/api_arrayelt.c @@ -1472,11 +1472,11 @@ check_vbo(AEcontext *actx, struct gl_buffer_object *vbo) static inline void update_derived_client_arrays(struct gl_context *ctx) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; - if (arrayObj->NewArrays) { - _mesa_update_array_object_client_arrays(ctx, arrayObj); - arrayObj->NewArrays = 0; + if (vao->NewArrays) { + _mesa_update_vao_client_arrays(ctx, vao); + vao->NewArrays = 0; } } @@ -1494,50 +1494,50 @@ _ae_update_state(struct gl_context *ctx) AEarray *aa = actx->arrays; /* non-indexed arrays (ex: glNormal) */ AEattrib *at = actx->attribs; /* indexed arrays (ex: glMultiTexCoord) */ GLuint i; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; actx->nr_vbos = 0; /* conventional vertex arrays */ - if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX]; + if (vao->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_COLOR_INDEX]; aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->_VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_EDGEFLAG]; + if (vao->_VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_EDGEFLAG]; aa->offset = _gloffset_EdgeFlagv; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL]; + if (vao->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_NORMAL]; aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0]; + if (vao->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_COLOR0]; aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR1]; + if (vao->_VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_COLOR1]; aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - if (arrayObj->_VertexAttrib[VERT_ATTRIB_FOG].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_FOG]; + if (vao->_VertexAttrib[VERT_ATTRIB_FOG].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_FOG]; aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { struct gl_client_array *attribArray = - &arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)]; + &vao->_VertexAttrib[VERT_ATTRIB_TEX(i)]; if (attribArray->Enabled) { /* NOTE: we use generic glVertexAttribNV functions here. * If we ever remove GL_NV_vertex_program this will have to change. @@ -1556,7 +1556,7 @@ _ae_update_state(struct gl_context *ctx) /* generic vertex attribute arrays */ for (i = 1; i < VERT_ATTRIB_GENERIC_MAX; i++) { /* skip zero! */ struct gl_client_array *attribArray = - &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]; + &vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]; if (attribArray->Enabled) { GLint intOrNorm; at->array = attribArray; @@ -1583,24 +1583,24 @@ _ae_update_state(struct gl_context *ctx) } /* finally, vertex position */ - if (arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) { + if (vao->_VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled) { /* Use glVertex(v) instead of glVertexAttrib(0, v) to be sure it's * issued as the last (provoking) attribute). */ - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC0]; + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_GENERIC0]; assert(aa->array->Size >= 2); /* XXX fix someday? */ aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - else if (arrayObj->_VertexAttrib[VERT_ATTRIB_POS].Enabled) { - aa->array = &arrayObj->_VertexAttrib[VERT_ATTRIB_POS]; + else if (vao->_VertexAttrib[VERT_ATTRIB_POS].Enabled) { + aa->array = &vao->_VertexAttrib[VERT_ATTRIB_POS]; aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array->Type)]; check_vbo(actx, aa->array->BufferObj); aa++; } - check_vbo(actx, arrayObj->ElementArrayBufferObj); + check_vbo(actx, vao->IndexBufferObj); ASSERT(at - actx->attribs <= VERT_ATTRIB_MAX); ASSERT(aa - actx->arrays < 32); diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c index 694558443..af469e046 100644 --- a/mesalib/src/mesa/main/api_validate.c +++ b/mesalib/src/mesa/main/api_validate.c @@ -113,14 +113,14 @@ check_valid_to_render(struct gl_context *ctx, const char *function) case API_OPENGLES2: /* For ES2, we can draw if any vertex array is enabled (and we * should always have a vertex program/shader). */ - if (ctx->Array.ArrayObj->_Enabled == 0x0 || !ctx->VertexProgram._Current) + if (ctx->Array.VAO->_Enabled == 0x0 || !ctx->VertexProgram._Current) return GL_FALSE; break; case API_OPENGLES: /* For OpenGL ES, only draw if we have vertex positions */ - if (!ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled) + if (!ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled) return GL_FALSE; break; @@ -141,8 +141,8 @@ check_valid_to_render(struct gl_context *ctx, const char *function) /* Draw if we have vertex positions (GL_VERTEX_ARRAY or generic * array [0]). */ - return (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled || - ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); + return (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled || + ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC0].Enabled); } } break; @@ -180,15 +180,15 @@ check_index_bounds(struct gl_context *ctx, GLsizei count, GLenum type, memset(&ib, 0, sizeof(ib)); ib.type = type; ib.ptr = indices; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; vbo_get_minmax_indices(ctx, &prim, &ib, &min, &max, 1); if ((int)(min + basevertex) < 0 || - max + basevertex >= ctx->Array.ArrayObj->_MaxElement) { + max + basevertex >= ctx->Array.VAO->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDrawElements() index=%u is out of bounds (max=%u)", - max, ctx->Array.ArrayObj->_MaxElement); + max, ctx->Array.VAO->_MaxElement); return GL_FALSE; } @@ -435,10 +435,10 @@ _mesa_validate_DrawElements(struct gl_context *ctx, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } @@ -493,12 +493,12 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ for (i = 0; i < primcount; i++) { if (index_bytes(type, count[i]) > - ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + ctx->Array.VAO->IndexBufferObj->Size) { _mesa_warning(ctx, "glMultiDrawElements index out of buffer bounds"); return GL_FALSE; @@ -570,10 +570,10 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { _mesa_warning(ctx, "glDrawRangeElements index out of buffer bounds"); return GL_FALSE; } @@ -620,7 +620,7 @@ _mesa_validate_DrawArrays(struct gl_context *ctx, return GL_FALSE; if (ctx->Const.CheckArrayBounds) { - if (start + count > (GLint) ctx->Array.ArrayObj->_MaxElement) + if (start + count > (GLint) ctx->Array.VAO->_MaxElement) return GL_FALSE; } @@ -689,7 +689,7 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi return GL_FALSE; if (ctx->Const.CheckArrayBounds) { - if (first + count > (GLint) ctx->Array.ArrayObj->_MaxElement) + if (first + count > (GLint) ctx->Array.VAO->_MaxElement) return GL_FALSE; } @@ -769,10 +769,10 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx, return GL_FALSE; /* Vertex buffer object tests */ - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { /* use indices in the buffer object */ /* make sure count doesn't go outside buffer bounds */ - if (index_bytes(type, count) > ctx->Array.ArrayObj->ElementArrayBufferObj->Size) { + if (index_bytes(type, count) > ctx->Array.VAO->IndexBufferObj->Size) { _mesa_warning(ctx, "glDrawElementsInstanced index out of buffer bounds"); return GL_FALSE; @@ -901,7 +901,7 @@ valid_draw_indirect_elements(struct gl_context *ctx, * If no element array buffer is bound, an INVALID_OPERATION error is * generated. */ - if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no buffer bound to GL_ELEMENT_ARRAY_BUFFER)", name); return GL_FALSE; diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index fdcf172ea..b33ba8016 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -27,7 +27,10 @@ /** * \file arrayobj.c - * Functions for the GL_APPLE_vertex_array_object extension. + * + * Implementation of Vertex Array Objects (VAOs), from OpenGL 3.1+, + * the GL_ARB_vertex_array_object extension, or the older + * GL_APPLE_vertex_array_object extension. * * \todo * The code in this file borrows a lot from bufferobj.c. There's a certain @@ -60,13 +63,13 @@ * non-existent. */ -struct gl_array_object * -_mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id) +struct gl_vertex_array_object * +_mesa_lookup_vao(struct gl_context *ctx, GLuint id) { if (id == 0) return NULL; else - return (struct gl_array_object *) + return (struct gl_vertex_array_object *) _mesa_HashLookup(ctx->Array.Objects, id); } @@ -77,7 +80,7 @@ _mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id) * This is done just prior to array object destruction. */ static void -unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj) +unbind_array_object_vbos(struct gl_context *ctx, struct gl_vertex_array_object *obj) { GLuint i; @@ -95,12 +98,12 @@ unbind_array_object_vbos(struct gl_context *ctx, struct gl_array_object *obj) * This function is intended to be called via * \c dd_function_table::NewArrayObject. */ -struct gl_array_object * -_mesa_new_array_object( struct gl_context *ctx, GLuint name ) +struct gl_vertex_array_object * +_mesa_new_vao(struct gl_context *ctx, GLuint name) { - struct gl_array_object *obj = CALLOC_STRUCT(gl_array_object); + struct gl_vertex_array_object *obj = CALLOC_STRUCT(gl_vertex_array_object); if (obj) - _mesa_initialize_array_object(ctx, obj, name); + _mesa_initialize_vao(ctx, obj, name); return obj; } @@ -112,11 +115,10 @@ _mesa_new_array_object( struct gl_context *ctx, GLuint name ) * \c dd_function_table::DeleteArrayObject. */ void -_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ) +_mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj) { - (void) ctx; unbind_array_object_vbos(ctx, obj); - _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL); + _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, NULL); _glthread_DESTROY_MUTEX(obj->Mutex); free(obj->Label); free(obj); @@ -124,21 +126,21 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ) /** - * Set ptr to arrayObj w/ reference counting. - * Note: this should only be called from the _mesa_reference_array_object() + * Set ptr to vao w/ reference counting. + * Note: this should only be called from the _mesa_reference_vao() * inline function. */ void -_mesa_reference_array_object_(struct gl_context *ctx, - struct gl_array_object **ptr, - struct gl_array_object *arrayObj) +_mesa_reference_vao_(struct gl_context *ctx, + struct gl_vertex_array_object **ptr, + struct gl_vertex_array_object *vao) { - assert(*ptr != arrayObj); + assert(*ptr != vao); if (*ptr) { /* Unreference the old array object */ GLboolean deleteFlag = GL_FALSE; - struct gl_array_object *oldObj = *ptr; + struct gl_vertex_array_object *oldObj = *ptr; _glthread_LOCK_MUTEX(oldObj->Mutex); ASSERT(oldObj->RefCount > 0); @@ -159,24 +161,24 @@ _mesa_reference_array_object_(struct gl_context *ctx, } ASSERT(!*ptr); - if (arrayObj) { + if (vao) { /* reference new array object */ - _glthread_LOCK_MUTEX(arrayObj->Mutex); - if (arrayObj->RefCount == 0) { + _glthread_LOCK_MUTEX(vao->Mutex); + if (vao->RefCount == 0) { /* this array's being deleted (look just above) */ /* Not sure this can every really happen. Warn if it does. */ _mesa_problem(NULL, "referencing deleted array object"); *ptr = NULL; } else { - arrayObj->RefCount++; + vao->RefCount++; #if 0 printf("ArrayObj %p %d INCR to %d\n", - (void *) arrayObj, arrayObj->Name, arrayObj->RefCount); + (void *) vao, vao->Name, vao->RefCount); #endif - *ptr = arrayObj; + *ptr = vao; } - _glthread_UNLOCK_MUTEX(arrayObj->Mutex); + _glthread_UNLOCK_MUTEX(vao->Mutex); } } @@ -184,7 +186,7 @@ _mesa_reference_array_object_(struct gl_context *ctx, static void init_array(struct gl_context *ctx, - struct gl_array_object *obj, GLuint index, GLint size, GLint type) + struct gl_vertex_array_object *obj, GLuint index, GLint size, GLint type) { struct gl_vertex_attrib_array *array = &obj->VertexAttrib[index]; struct gl_vertex_buffer_binding *binding = &obj->VertexBinding[index]; @@ -213,12 +215,12 @@ init_array(struct gl_context *ctx, /** - * Initialize a gl_array_object's arrays. + * Initialize a gl_vertex_array_object's arrays. */ void -_mesa_initialize_array_object( struct gl_context *ctx, - struct gl_array_object *obj, - GLuint name ) +_mesa_initialize_vao(struct gl_context *ctx, + struct gl_vertex_array_object *obj, + GLuint name) { GLuint i; @@ -257,7 +259,7 @@ _mesa_initialize_array_object( struct gl_context *ctx, } } - _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, + _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, ctx->Shared->NullBufferObj); } @@ -266,7 +268,7 @@ _mesa_initialize_array_object( struct gl_context *ctx, * Add the given array object to the array object pool. */ static void -save_array_object( struct gl_context *ctx, struct gl_array_object *obj ) +save_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj ) { if (obj->Name > 0) { /* insert into hash table */ @@ -280,7 +282,7 @@ save_array_object( struct gl_context *ctx, struct gl_array_object *obj ) * Do not deallocate the array object though. */ static void -remove_array_object( struct gl_context *ctx, struct gl_array_object *obj ) +remove_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj ) { if (obj->Name > 0) { /* remove from hash table */ @@ -291,11 +293,11 @@ remove_array_object( struct gl_context *ctx, struct gl_array_object *obj ) /** - * Helper for _mesa_update_array_object_max_element(). - * \return min(arrayObj->_VertexAttrib[*]._MaxElement). + * Helper for _mesa_update_vao_max_element(). + * \return min(vao->_VertexAttrib[*]._MaxElement). */ static GLuint -compute_max_element(struct gl_array_object *arrayObj, GLbitfield64 enabled) +compute_max_element(struct gl_vertex_array_object *vao, GLbitfield64 enabled) { GLuint min = ~((GLuint)0); @@ -304,7 +306,7 @@ compute_max_element(struct gl_array_object *arrayObj, GLbitfield64 enabled) GLint attrib = ffsll(enabled) - 1; enabled ^= BITFIELD64_BIT(attrib); - client_array = &arrayObj->_VertexAttrib[attrib]; + client_array = &vao->_VertexAttrib[attrib]; assert(client_array->Enabled); _mesa_update_array_max_element(client_array); min = MIN2(min, client_array->_MaxElement); @@ -315,23 +317,23 @@ compute_max_element(struct gl_array_object *arrayObj, GLbitfield64 enabled) /** - * Examine vertex arrays to update the gl_array_object::_MaxElement field. + * Examine vertex arrays to update the gl_vertex_array_object::_MaxElement field. */ void -_mesa_update_array_object_max_element(struct gl_context *ctx, - struct gl_array_object *arrayObj) +_mesa_update_vao_max_element(struct gl_context *ctx, + struct gl_vertex_array_object *vao) { GLbitfield64 enabled; if (!ctx->VertexProgram._Current || ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { - enabled = _mesa_array_object_get_enabled_ff(arrayObj); + enabled = _mesa_array_object_get_enabled_ff(vao); } else { - enabled = _mesa_array_object_get_enabled_arb(arrayObj); + enabled = _mesa_array_object_get_enabled_arb(vao); } /* _MaxElement is one past the last legal array element */ - arrayObj->_MaxElement = compute_max_element(arrayObj, enabled); + vao->_MaxElement = compute_max_element(vao, enabled); } @@ -340,10 +342,10 @@ _mesa_update_array_object_max_element(struct gl_context *ctx, * or a gl_vertex_buffer_binding has changed. */ void -_mesa_update_array_object_client_arrays(struct gl_context *ctx, - struct gl_array_object *arrayObj) +_mesa_update_vao_client_arrays(struct gl_context *ctx, + struct gl_vertex_array_object *vao) { - GLbitfield64 arrays = arrayObj->NewArrays; + GLbitfield64 arrays = vao->NewArrays; while (arrays) { struct gl_client_array *client_array; @@ -353,9 +355,9 @@ _mesa_update_array_object_client_arrays(struct gl_context *ctx, GLint attrib = ffsll(arrays) - 1; arrays ^= BITFIELD64_BIT(attrib); - attrib_array = &arrayObj->VertexAttrib[attrib]; - buffer_binding = &arrayObj->VertexBinding[attrib_array->VertexBinding]; - client_array = &arrayObj->_VertexAttrib[attrib]; + attrib_array = &vao->VertexAttrib[attrib]; + buffer_binding = &vao->VertexBinding[attrib_array->VertexBinding]; + client_array = &vao->_VertexAttrib[attrib]; _mesa_update_client_array(ctx, client_array, attrib_array, buffer_binding); @@ -376,8 +378,8 @@ _mesa_update_array_object_client_arrays(struct gl_context *ctx, static void bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) { - struct gl_array_object * const oldObj = ctx->Array.ArrayObj; - struct gl_array_object *newObj = NULL; + struct gl_vertex_array_object * const oldObj = ctx->Array.VAO; + struct gl_vertex_array_object *newObj = NULL; ASSERT(oldObj != NULL); @@ -391,11 +393,11 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) /* The spec says there is no array object named 0, but we use * one internally because it simplifies things. */ - newObj = ctx->Array.DefaultArrayObj; + newObj = ctx->Array.DefaultVAO; } else { /* non-default array object */ - newObj = _mesa_lookup_arrayobj(ctx, id); + newObj = _mesa_lookup_vao(ctx, id); if (!newObj) { if (genRequired) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -426,7 +428,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) } ctx->NewState |= _NEW_ARRAY; - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, newObj); + _mesa_reference_vao(ctx, &ctx->Array.VAO, newObj); /* Pass BindVertexArray call to device driver */ if (ctx->Driver.BindArrayObject && newObj) @@ -477,12 +479,12 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) GLsizei i; if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArrayAPPLE(n)"); + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteVertexArray(n)"); return; } for (i = 0; i < n; i++) { - struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, ids[i]); + struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, ids[i]); if ( obj != NULL ) { ASSERT( obj->Name == ids[i] ); @@ -491,7 +493,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) * for that object reverts to zero and the default vertex array * becomes current." */ - if ( obj == ctx->Array.ArrayObj ) { + if ( obj == ctx->Array.VAO ) { _mesa_BindVertexArray(0); } @@ -501,7 +503,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) /* Unreference the array object. * If refcount hits zero, the object will be deleted. */ - _mesa_reference_array_object(ctx, &obj, NULL); + _mesa_reference_vao(ctx, &obj, NULL); } } } @@ -521,7 +523,7 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays) GLint i; if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArraysAPPLE"); + _mesa_error(ctx, GL_INVALID_VALUE, "glGenVertexArrays"); return; } @@ -533,12 +535,12 @@ gen_vertex_arrays(struct gl_context *ctx, GLsizei n, GLuint *arrays) /* Allocate new, empty array objects and return identifiers */ for (i = 0; i < n; i++) { - struct gl_array_object *obj; + struct gl_vertex_array_object *obj; GLuint name = first + i; obj = (*ctx->Driver.NewArrayObject)( ctx, name ); if (!obj) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArraysAPPLE"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGenVertexArrays"); return; } save_array_object(ctx, obj); @@ -581,14 +583,14 @@ _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *arrays) GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id ) { - struct gl_array_object * obj; + struct gl_vertex_array_object * obj; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE); if (id == 0) return GL_FALSE; - obj = _mesa_lookup_arrayobj(ctx, id); + obj = _mesa_lookup_vao(ctx, id); if (obj == NULL) return GL_FALSE; diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h index 7c3720242..d72761db1 100644 --- a/mesalib/src/mesa/main/arrayobj.h +++ b/mesalib/src/mesa/main/arrayobj.h @@ -45,42 +45,42 @@ struct gl_context; * Internal functions */ -extern struct gl_array_object * -_mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id); +extern struct gl_vertex_array_object * +_mesa_lookup_vao(struct gl_context *ctx, GLuint id); -extern struct gl_array_object * -_mesa_new_array_object( struct gl_context *ctx, GLuint name ); +extern struct gl_vertex_array_object * +_mesa_new_vao(struct gl_context *ctx, GLuint name); extern void -_mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ); +_mesa_delete_vao(struct gl_context *ctx, struct gl_vertex_array_object *obj); extern void -_mesa_reference_array_object_(struct gl_context *ctx, - struct gl_array_object **ptr, - struct gl_array_object *arrayObj); +_mesa_reference_vao_(struct gl_context *ctx, + struct gl_vertex_array_object **ptr, + struct gl_vertex_array_object *vao); static inline void -_mesa_reference_array_object(struct gl_context *ctx, - struct gl_array_object **ptr, - struct gl_array_object *arrayObj) +_mesa_reference_vao(struct gl_context *ctx, + struct gl_vertex_array_object **ptr, + struct gl_vertex_array_object *vao) { - if (*ptr != arrayObj) - _mesa_reference_array_object_(ctx, ptr, arrayObj); + if (*ptr != vao) + _mesa_reference_vao_(ctx, ptr, vao); } extern void -_mesa_initialize_array_object( struct gl_context *ctx, - struct gl_array_object *obj, GLuint name ); +_mesa_initialize_vao(struct gl_context *ctx, + struct gl_vertex_array_object *obj, GLuint name); extern void -_mesa_update_array_object_max_element(struct gl_context *ctx, - struct gl_array_object *arrayObj); +_mesa_update_vao_max_element(struct gl_context *ctx, + struct gl_vertex_array_object *vao); extern void -_mesa_update_array_object_client_arrays(struct gl_context *ctx, - struct gl_array_object *arrayObj); +_mesa_update_vao_client_arrays(struct gl_context *ctx, + struct gl_vertex_array_object *vao); /** Returns the bitmask of all enabled arrays in fixed function mode. @@ -89,9 +89,9 @@ _mesa_update_array_object_client_arrays(struct gl_context *ctx, * are available. */ static inline GLbitfield64 -_mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj) +_mesa_array_object_get_enabled_ff(const struct gl_vertex_array_object *vao) { - return arrayObj->_Enabled & VERT_BIT_FF_ALL; + return vao->_Enabled & VERT_BIT_FF_ALL; } /** Returns the bitmask of all enabled arrays in arb/glsl shader mode. @@ -101,9 +101,9 @@ _mesa_array_object_get_enabled_ff(const struct gl_array_object *arrayObj) * precedence over the legacy position array. */ static inline GLbitfield64 -_mesa_array_object_get_enabled_arb(const struct gl_array_object *arrayObj) +_mesa_array_object_get_enabled_arb(const struct gl_vertex_array_object *vao) { - GLbitfield64 enabled = arrayObj->_Enabled; + GLbitfield64 enabled = vao->_Enabled; return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0)); } diff --git a/mesalib/src/mesa/main/attrib.c b/mesalib/src/mesa/main/attrib.c index 7b7cf0ef3..004528044 100644 --- a/mesalib/src/mesa/main/attrib.c +++ b/mesalib/src/mesa/main/attrib.c @@ -1433,13 +1433,13 @@ copy_pixelstore(struct gl_context *ctx, #define GL_CLIENT_UNPACK_BIT (1<<21) /** - * Copy gl_array_object from src to dest. + * Copy gl_vertex_array_object from src to dest. * 'dest' must be in an initialized state. */ static void copy_array_object(struct gl_context *ctx, - struct gl_array_object *dest, - struct gl_array_object *src) + struct gl_vertex_array_object *dest, + struct gl_vertex_array_object *src) { GLuint i; @@ -1483,10 +1483,10 @@ copy_array_attrib(struct gl_context *ctx, /* skip RebindArrays */ if (!vbo_deleted) - copy_array_object(ctx, dest->ArrayObj, src->ArrayObj); + copy_array_object(ctx, dest->VAO, src->VAO); /* skip ArrayBufferObj */ - /* skip ElementArrayBufferObj */ + /* skip IndexBufferObj */ } /** @@ -1499,15 +1499,15 @@ save_array_attrib(struct gl_context *ctx, { /* Set the Name, needed for restore, but do never overwrite. * Needs to match value in the object hash. */ - dest->ArrayObj->Name = src->ArrayObj->Name; + dest->VAO->Name = src->VAO->Name; /* And copy all of the rest. */ copy_array_attrib(ctx, dest, src, false); /* Just reference them here */ _mesa_reference_buffer_object(ctx, &dest->ArrayBufferObj, src->ArrayBufferObj); - _mesa_reference_buffer_object(ctx, &dest->ArrayObj->ElementArrayBufferObj, - src->ArrayObj->ElementArrayBufferObj); + _mesa_reference_buffer_object(ctx, &dest->VAO->IndexBufferObj, + src->VAO->IndexBufferObj); } /** @@ -1530,13 +1530,13 @@ restore_array_attrib(struct gl_context *ctx, * The semantics of objects created using APPLE_vertex_array_objects behave * differently. These objects expect to be recreated by pop. Alas. */ - const bool arb_vao = (src->ArrayObj->Name != 0 - && src->ArrayObj->ARBsemantics); + const bool arb_vao = (src->VAO->Name != 0 + && src->VAO->ARBsemantics); - if (arb_vao && !_mesa_IsVertexArray(src->ArrayObj->Name)) + if (arb_vao && !_mesa_IsVertexArray(src->VAO->Name)) return; - _mesa_BindVertexArrayAPPLE(src->ArrayObj->Name); + _mesa_BindVertexArrayAPPLE(src->VAO->Name); /* Restore or recreate the buffer objects by the names ... */ if (!arb_vao @@ -1552,10 +1552,10 @@ restore_array_attrib(struct gl_context *ctx, } if (!arb_vao - || src->ArrayObj->ElementArrayBufferObj->Name == 0 - || _mesa_IsBuffer(src->ArrayObj->ElementArrayBufferObj->Name)) + || src->VAO->IndexBufferObj->Name == 0 + || _mesa_IsBuffer(src->VAO->IndexBufferObj->Name)) _mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, - src->ArrayObj->ElementArrayBufferObj->Name); + src->VAO->IndexBufferObj->Name); } /** @@ -1566,15 +1566,15 @@ static bool init_array_attrib_data(struct gl_context *ctx, struct gl_array_attrib *attrib) { - /* Get a non driver gl_array_object. */ - attrib->ArrayObj = CALLOC_STRUCT( gl_array_object ); + /* Get a non driver gl_vertex_array_object. */ + attrib->VAO = CALLOC_STRUCT( gl_vertex_array_object ); - if (attrib->ArrayObj == NULL) { + if (attrib->VAO == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glPushClientAttrib"); return false; } - _mesa_initialize_array_object(ctx, attrib->ArrayObj, 0); + _mesa_initialize_vao(ctx, attrib->VAO, 0); return true; } @@ -1589,8 +1589,8 @@ free_array_attrib_data(struct gl_context *ctx, { /* We use a non driver array object, so don't just unref since we would * end up using the drivers DeleteArrayObject function for deletion. */ - _mesa_delete_array_object(ctx, attrib->ArrayObj); - attrib->ArrayObj = 0; + _mesa_delete_vao(ctx, attrib->VAO); + attrib->VAO = 0; _mesa_reference_buffer_object(ctx, &attrib->ArrayBufferObj, NULL); } diff --git a/mesalib/src/mesa/main/blend.c b/mesalib/src/mesa/main/blend.c index 9e11ca7b8..eb4f1d6be 100644 --- a/mesalib/src/mesa/main/blend.c +++ b/mesalib/src/mesa/main/blend.c @@ -854,7 +854,7 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx) } /** - * Returns an appropriate gl_format for color rendering based on the + * Returns an appropriate mesa_format for color rendering based on the * GL_FRAMEBUFFER_SRGB state. * * Some drivers implement GL_FRAMEBUFFER_SRGB using a flag on the blend state @@ -862,8 +862,8 @@ _mesa_update_clamp_vertex_color(struct gl_context *ctx) * overriding the format of the surface. This is a helper for doing the * surface format override variant. */ -gl_format -_mesa_get_render_format(const struct gl_context *ctx, gl_format format) +mesa_format +_mesa_get_render_format(const struct gl_context *ctx, mesa_format format) { if (ctx->Color.sRGBEnabled) return format; diff --git a/mesalib/src/mesa/main/blend.h b/mesalib/src/mesa/main/blend.h index 7445840cb..fe31a7440 100644 --- a/mesalib/src/mesa/main/blend.h +++ b/mesalib/src/mesa/main/blend.h @@ -115,8 +115,8 @@ _mesa_update_clamp_fragment_color(struct gl_context *ctx); extern void _mesa_update_clamp_vertex_color(struct gl_context *ctx); -extern gl_format -_mesa_get_render_format(const struct gl_context *ctx, gl_format format); +extern mesa_format +_mesa_get_render_format(const struct gl_context *ctx, mesa_format format); extern void _mesa_init_color( struct gl_context * ctx ); diff --git a/mesalib/src/mesa/main/blit.c b/mesalib/src/mesa/main/blit.c new file mode 100644 index 000000000..0b70a3da4 --- /dev/null +++ b/mesalib/src/mesa/main/blit.c @@ -0,0 +1,513 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2013 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* + * glBlitFramebuffer functions. + */ + +#include <stdbool.h> + +#include "context.h" +#include "enums.h" +#include "blit.h" +#include "fbobject.h" +#include "glformats.h" +#include "mtypes.h" +#include "state.h" + + +/** Set this to 1 to debug/log glBlitFramebuffer() calls */ +#define DEBUG_BLIT 0 + + + +static const struct gl_renderbuffer_attachment * +find_attachment(const struct gl_framebuffer *fb, + const struct gl_renderbuffer *rb) +{ + GLuint i; + for (i = 0; i < Elements(fb->Attachment); i++) { + if (fb->Attachment[i].Renderbuffer == rb) + return &fb->Attachment[i]; + } + return NULL; +} + + +/** + * Helper function for checking if the datatypes of color buffers are + * compatible for glBlitFramebuffer. From the 3.1 spec, page 198: + * + * "GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT + * and any of the following conditions hold: + * - The read buffer contains fixed-point or floating-point values and any + * draw buffer contains neither fixed-point nor floating-point values. + * - The read buffer contains unsigned integer values and any draw buffer + * does not contain unsigned integer values. + * - The read buffer contains signed integer values and any draw buffer + * does not contain signed integer values." + */ +static GLboolean +compatible_color_datatypes(mesa_format srcFormat, mesa_format dstFormat) +{ + GLenum srcType = _mesa_get_format_datatype(srcFormat); + GLenum dstType = _mesa_get_format_datatype(dstFormat); + + if (srcType != GL_INT && srcType != GL_UNSIGNED_INT) { + assert(srcType == GL_UNSIGNED_NORMALIZED || + srcType == GL_SIGNED_NORMALIZED || + srcType == GL_FLOAT); + /* Boil any of those types down to GL_FLOAT */ + srcType = GL_FLOAT; + } + + if (dstType != GL_INT && dstType != GL_UNSIGNED_INT) { + assert(dstType == GL_UNSIGNED_NORMALIZED || + dstType == GL_SIGNED_NORMALIZED || + dstType == GL_FLOAT); + /* Boil any of those types down to GL_FLOAT */ + dstType = GL_FLOAT; + } + + return srcType == dstType; +} + + +static GLboolean +compatible_resolve_formats(const struct gl_renderbuffer *readRb, + const struct gl_renderbuffer *drawRb) +{ + GLenum readFormat, drawFormat; + + /* The simple case where we know the backing Mesa formats are the same. + */ + if (_mesa_get_srgb_format_linear(readRb->Format) == + _mesa_get_srgb_format_linear(drawRb->Format)) { + return GL_TRUE; + } + + /* The Mesa formats are different, so we must check whether the internal + * formats are compatible. + * + * Under some circumstances, the user may request e.g. two GL_RGBA8 + * textures and get two entirely different Mesa formats like RGBA8888 and + * ARGB8888. Drivers behaving like that should be able to cope with + * non-matching formats by themselves, because it's not the user's fault. + * + * Blits between linear and sRGB formats are also allowed. + */ + readFormat = _mesa_get_nongeneric_internalformat(readRb->InternalFormat); + drawFormat = _mesa_get_nongeneric_internalformat(drawRb->InternalFormat); + readFormat = _mesa_get_linear_internalformat(readFormat); + drawFormat = _mesa_get_linear_internalformat(drawFormat); + + if (readFormat == drawFormat) { + return GL_TRUE; + } + + return GL_FALSE; +} + + +static GLboolean +is_valid_blit_filter(const struct gl_context *ctx, GLenum filter) +{ + switch (filter) { + case GL_NEAREST: + case GL_LINEAR: + return true; + case GL_SCALED_RESOLVE_FASTEST_EXT: + case GL_SCALED_RESOLVE_NICEST_EXT: + return ctx->Extensions.EXT_framebuffer_multisample_blit_scaled; + default: + return false; + } +} + + +/** + * Blit rectangular region, optionally from one framebuffer to another. + * + * Note, if the src buffer is multisampled and the dest is not, this is + * when the samples must be resolved to a single color. + */ +void GLAPIENTRY +_mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + const GLbitfield legalMaskBits = (GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT); + const struct gl_framebuffer *readFb, *drawFb; + GET_CURRENT_CONTEXT(ctx); + + FLUSH_VERTICES(ctx, 0); + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, + "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, 0x%x, %s)\n", + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, _mesa_lookup_enum_by_nr(filter)); + + if (ctx->NewState) { + _mesa_update_state(ctx); + } + + readFb = ctx->ReadBuffer; + drawFb = ctx->DrawBuffer; + + if (!readFb || !drawFb) { + /* This will normally never happen but someday we may want to + * support MakeCurrent() with no drawables. + */ + return; + } + + /* check for complete framebuffers */ + if (drawFb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT || + readFb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glBlitFramebufferEXT(incomplete draw/read buffers)"); + return; + } + + if (!is_valid_blit_filter(ctx, filter)) { + _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(%s)", + _mesa_lookup_enum_by_nr(filter)); + return; + } + + if ((filter == GL_SCALED_RESOLVE_FASTEST_EXT || + filter == GL_SCALED_RESOLVE_NICEST_EXT) && + (readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(%s)", + _mesa_lookup_enum_by_nr(filter)); + return; + } + + if (mask & ~legalMaskBits) { + _mesa_error( ctx, GL_INVALID_VALUE, "glBlitFramebufferEXT(mask)"); + return; + } + + /* depth/stencil must be blitted with nearest filtering */ + if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) + && filter != GL_NEAREST) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(depth/stencil requires GL_NEAREST filter)"); + return; + } + + /* get color read/draw renderbuffers */ + if (mask & GL_COLOR_BUFFER_BIT) { + const GLuint numColorDrawBuffers = ctx->DrawBuffer->_NumColorDrawBuffers; + const struct gl_renderbuffer *colorReadRb = readFb->_ColorReadBuffer; + const struct gl_renderbuffer *colorDrawRb = NULL; + GLuint i; + + /* From the EXT_framebuffer_object spec: + * + * "If a buffer is specified in <mask> and does not exist in both + * the read and draw framebuffers, the corresponding bit is silently + * ignored." + */ + if (!colorReadRb || numColorDrawBuffers == 0) { + mask &= ~GL_COLOR_BUFFER_BIT; + } + else { + for (i = 0; i < numColorDrawBuffers; i++) { + colorDrawRb = ctx->DrawBuffer->_ColorDrawBuffers[i]; + if (!colorDrawRb) + continue; + + /* Page 193 (page 205 of the PDF) in section 4.3.2 of the OpenGL + * ES 3.0.1 spec says: + * + * "If the source and destination buffers are identical, an + * INVALID_OPERATION error is generated. Different mipmap + * levels of a texture, different layers of a three- + * dimensional texture or two-dimensional array texture, and + * different faces of a cube map texture do not constitute + * identical buffers." + */ + if (_mesa_is_gles3(ctx) && (colorDrawRb == colorReadRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination color " + "buffer cannot be the same)"); + return; + } + + if (!compatible_color_datatypes(colorReadRb->Format, + colorDrawRb->Format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(color buffer datatypes mismatch)"); + return; + } + /* extra checks for multisample copies... */ + if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { + /* color formats must match */ + if (!compatible_resolve_formats(colorReadRb, colorDrawRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(bad src/dst multisample pixel formats)"); + return; + } + } + } + if (filter != GL_NEAREST) { + /* From EXT_framebuffer_multisample_blit_scaled specification: + * "Calling BlitFramebuffer will result in an INVALID_OPERATION error + * if filter is not NEAREST and read buffer contains integer data." + */ + GLenum type = _mesa_get_format_datatype(colorReadRb->Format); + if (type == GL_INT || type == GL_UNSIGNED_INT) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(integer color type)"); + return; + } + } + } + } + + if (mask & GL_STENCIL_BUFFER_BIT) { + struct gl_renderbuffer *readRb = + readFb->Attachment[BUFFER_STENCIL].Renderbuffer; + struct gl_renderbuffer *drawRb = + drawFb->Attachment[BUFFER_STENCIL].Renderbuffer; + + /* From the EXT_framebuffer_object spec: + * + * "If a buffer is specified in <mask> and does not exist in both + * the read and draw framebuffers, the corresponding bit is silently + * ignored." + */ + if ((readRb == NULL) || (drawRb == NULL)) { + mask &= ~GL_STENCIL_BUFFER_BIT; + } + else { + int read_z_bits, draw_z_bits; + + if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination stencil " + "buffer cannot be the same)"); + return; + } + + if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != + _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) { + /* There is no need to check the stencil datatype here, because + * there is only one: GL_UNSIGNED_INT. + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(stencil attachment format mismatch)"); + return; + } + + read_z_bits = _mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS); + draw_z_bits = _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS); + + /* If both buffers also have depth data, the depth formats must match + * as well. If one doesn't have depth, it's not blitted, so we should + * ignore the depth format check. + */ + if (read_z_bits > 0 && draw_z_bits > 0 && + (read_z_bits != draw_z_bits || + _mesa_get_format_datatype(readRb->Format) != + _mesa_get_format_datatype(drawRb->Format))) { + + _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebuffer" + "(stencil attachment depth format mismatch)"); + return; + } + } + } + + if (mask & GL_DEPTH_BUFFER_BIT) { + struct gl_renderbuffer *readRb = + readFb->Attachment[BUFFER_DEPTH].Renderbuffer; + struct gl_renderbuffer *drawRb = + drawFb->Attachment[BUFFER_DEPTH].Renderbuffer; + + /* From the EXT_framebuffer_object spec: + * + * "If a buffer is specified in <mask> and does not exist in both + * the read and draw framebuffers, the corresponding bit is silently + * ignored." + */ + if ((readRb == NULL) || (drawRb == NULL)) { + mask &= ~GL_DEPTH_BUFFER_BIT; + } + else { + int read_s_bit, draw_s_bit; + + if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(source and destination depth " + "buffer cannot be the same)"); + return; + } + + if ((_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != + _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) || + (_mesa_get_format_datatype(readRb->Format) != + _mesa_get_format_datatype(drawRb->Format))) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(depth attachment format mismatch)"); + return; + } + + read_s_bit = _mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS); + draw_s_bit = _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS); + + /* If both buffers also have stencil data, the stencil formats must + * match as well. If one doesn't have stencil, it's not blitted, so + * we should ignore the stencil format check. + */ + if (read_s_bit > 0 && draw_s_bit > 0 && read_s_bit != draw_s_bit) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebuffer" + "(depth attachment stencil bits mismatch)"); + return; + } + } + } + + + if (_mesa_is_gles3(ctx)) { + /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES + * 3.0.1 spec says: + * + * "If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, + * an INVALID_OPERATION error is generated." + */ + if (drawFb->Visual.samples > 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(destination samples must be 0)"); + return; + } + + /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES + * 3.0.1 spec says: + * + * "If SAMPLE_BUFFERS for the read framebuffer is greater than zero, + * no copy is performed and an INVALID_OPERATION error is generated + * if the formats of the read and draw framebuffers are not + * identical or if the source and destination rectangles are not + * defined with the same (X0, Y0) and (X1, Y1) bounds." + * + * The format check was made above because desktop OpenGL has the same + * requirement. + */ + if (readFb->Visual.samples > 0 + && (srcX0 != dstX0 || srcY0 != dstY0 + || srcX1 != dstX1 || srcY1 != dstY1)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebuffer(bad src/dst multisample region)"); + return; + } + } else { + if (readFb->Visual.samples > 0 && + drawFb->Visual.samples > 0 && + readFb->Visual.samples != drawFb->Visual.samples) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(mismatched samples)"); + return; + } + + /* extra checks for multisample copies... */ + if ((readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) && + (filter == GL_NEAREST || filter == GL_LINEAR)) { + /* src and dest region sizes must be the same */ + if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || + abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glBlitFramebufferEXT(bad src/dst multisample region sizes)"); + return; + } + } + } + + /* Debug code */ + if (DEBUG_BLIT) { + const struct gl_renderbuffer *colorReadRb = readFb->_ColorReadBuffer; + const struct gl_renderbuffer *colorDrawRb = NULL; + GLuint i = 0; + + printf("glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d," + " 0x%x, 0x%x)\n", + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); + if (colorReadRb) { + const struct gl_renderbuffer_attachment *att; + + att = find_attachment(readFb, colorReadRb); + printf(" Src FBO %u RB %u (%dx%d) ", + readFb->Name, colorReadRb->Name, + colorReadRb->Width, colorReadRb->Height); + if (att && att->Texture) { + printf("Tex %u tgt 0x%x level %u face %u", + att->Texture->Name, + att->Texture->Target, + att->TextureLevel, + att->CubeMapFace); + } + printf("\n"); + + /* Print all active color render buffers */ + for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { + colorDrawRb = ctx->DrawBuffer->_ColorDrawBuffers[i]; + if (!colorDrawRb) + continue; + + att = find_attachment(drawFb, colorDrawRb); + printf(" Dst FBO %u RB %u (%dx%d) ", + drawFb->Name, colorDrawRb->Name, + colorDrawRb->Width, colorDrawRb->Height); + if (att && att->Texture) { + printf("Tex %u tgt 0x%x level %u face %u", + att->Texture->Name, + att->Texture->Target, + att->TextureLevel, + att->CubeMapFace); + } + printf("\n"); + } + } + } + + if (!mask || + (srcX1 - srcX0) == 0 || (srcY1 - srcY0) == 0 || + (dstX1 - dstX0) == 0 || (dstY1 - dstY0) == 0) { + return; + } + + ASSERT(ctx->Driver.BlitFramebuffer); + ctx->Driver.BlitFramebuffer(ctx, + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); +} diff --git a/mesalib/src/mesa/main/blit.h b/mesalib/src/mesa/main/blit.h new file mode 100644 index 000000000..533d6e5d1 --- /dev/null +++ b/mesalib/src/mesa/main/blit.h @@ -0,0 +1,39 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef BLIT_H +#define BLIT_H + +#include "compiler.h" +#include "glheader.h" + + +extern void GLAPIENTRY +_mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + + +#endif /* BLIT_H */ diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index 83d5eac50..966e61c4c 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -80,7 +80,7 @@ get_buffer_target(struct gl_context *ctx, GLenum target) case GL_ARRAY_BUFFER_ARB: return &ctx->Array.ArrayBufferObj; case GL_ELEMENT_ARRAY_BUFFER_ARB: - return &ctx->Array.ArrayObj->ElementArrayBufferObj; + return &ctx->Array.VAO->IndexBufferObj; case GL_PIXEL_PACK_BUFFER_EXT: return &ctx->Pack.BufferObj; case GL_PIXEL_UNPACK_BUFFER_EXT: @@ -295,18 +295,18 @@ buffer_object_subdata_range_good(struct gl_context * ctx, GLenum target, * \param format Format of the supplied data. * \param type Type of the supplied data. * \param caller Name of calling function for recording errors. - * \return If internalformat, format and type are legal the gl_format + * \return If internalformat, format and type are legal the mesa_format * corresponding to internalformat, otherwise MESA_FORMAT_NONE. * * \sa glClearBufferData and glClearBufferSubData */ -static gl_format +static mesa_format validate_clear_buffer_format(struct gl_context *ctx, GLenum internalformat, GLenum format, GLenum type, const char *caller) { - gl_format mesaFormat; + mesa_format mesaFormat; GLenum errorFormatType; mesaFormat = _mesa_validate_texbuffer_format(ctx, internalformat); @@ -360,7 +360,7 @@ validate_clear_buffer_format(struct gl_context *ctx, */ static bool convert_clear_buffer_data(struct gl_context *ctx, - gl_format internalformat, + mesa_format internalformat, GLubyte *clearValue, GLenum format, GLenum type, const GLvoid *data, const char *caller) { @@ -407,7 +407,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx, { (void) ctx; - free(bufObj->Data); + _mesa_align_free(bufObj->Data); /* assign strange values here to help w/ debugging */ bufObj->RefCount = -1000; @@ -451,8 +451,8 @@ _mesa_reference_buffer_object_(struct gl_context *ctx, #if 0 /* unfortunately, these tests are invalid during context tear-down */ ASSERT(ctx->Array.ArrayBufferObj != bufObj); - ASSERT(ctx->Array.ArrayObj->ElementArrayBufferObj != bufObj); - ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj); + ASSERT(ctx->Array.VAO->IndexBufferObj != bufObj); + ASSERT(ctx->Array.VAO->Vertex.BufferObj != bufObj); #endif ASSERT(ctx->Driver.DeleteBuffer); @@ -560,9 +560,12 @@ _mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, { void * new_data; - (void) ctx; (void) target; + (void) target; + + if (bufObj->Data) + _mesa_align_free( bufObj->Data ); - new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size ); + new_data = _mesa_align_malloc( size, ctx->Const.MinMapBufferAlignment ); if (new_data) { bufObj->Data = (GLubyte *) new_data; bufObj->Size = size; @@ -1079,7 +1082,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) for (i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]); if (bufObj) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; GLuint j; ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject); @@ -1092,14 +1095,14 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) } /* unbind any vertex pointers bound to this buffer */ - for (j = 0; j < Elements(arrayObj->VertexBinding); j++) { - unbind(ctx, &arrayObj->VertexBinding[j].BufferObj, bufObj); + for (j = 0; j < Elements(vao->VertexBinding); j++) { + unbind(ctx, &vao->VertexBinding[j].BufferObj, bufObj); } if (ctx->Array.ArrayBufferObj == bufObj) { _mesa_BindBuffer( GL_ARRAY_BUFFER_ARB, 0 ); } - if (arrayObj->ElementArrayBufferObj == bufObj) { + if (vao->IndexBufferObj == bufObj) { _mesa_BindBuffer( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 ); } @@ -1365,7 +1368,7 @@ _mesa_ClearBufferData(GLenum target, GLenum internalformat, GLenum format, { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object* bufObj; - gl_format mesaFormat; + mesa_format mesaFormat; GLubyte clearValue[MAX_PIXEL_BYTES]; GLsizeiptr clearValueSize; @@ -1420,7 +1423,7 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat, { GET_CURRENT_CONTEXT(ctx); struct gl_buffer_object* bufObj; - gl_format mesaFormat; + mesa_format mesaFormat; GLubyte clearValue[MAX_PIXEL_BYTES]; GLsizeiptr clearValueSize; diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c index 2bdbf41be..6cbce9d5d 100644 --- a/mesalib/src/mesa/main/buffers.c +++ b/mesalib/src/mesa/main/buffers.c @@ -360,16 +360,18 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers) return; } - /* From the OpenGL 3.0 specification, page 259: + /* From the OpenGL 4.0 specification, page 256: * "For both the default framebuffer and framebuffer objects, the * constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not * valid in the bufs array passed to DrawBuffers, and will result in - * the error INVALID_OPERATION. This restriction is because these + * the error INVALID_ENUM. This restriction is because these * constants may themselves refer to multiple buffers, as shown in * table 4.4." + * Previous versions of the OpenGL specification say INVALID_OPERATION, + * but the Khronos conformance tests expect INVALID_ENUM. */ if (_mesa_bitcount(destMask[output]) > 1) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB(buffer)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)"); return; } diff --git a/mesalib/src/mesa/main/compute.c b/mesalib/src/mesa/main/compute.c new file mode 100644 index 000000000..5756666b6 --- /dev/null +++ b/mesalib/src/mesa/main/compute.c @@ -0,0 +1,54 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "glheader.h" +#include "compute.h" +#include "context.h" + +void GLAPIENTRY +_mesa_DispatchCompute(GLuint num_groups_x, + GLuint num_groups_y, + GLuint num_groups_z) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Extensions.ARB_compute_shader) { + assert(!"TODO"); + } else { + _mesa_error(ctx, GL_INVALID_OPERATION, + "unsupported function (glDispatchCompute) called"); + } +} + +extern void GLAPIENTRY +_mesa_DispatchComputeIndirect(GLintptr indirect) +{ + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Extensions.ARB_compute_shader) { + assert(!"TODO"); + } else { + _mesa_error(ctx, GL_INVALID_OPERATION, + "unsupported function (glDispatchComputeIndirect) called"); + } +} diff --git a/mesalib/src/mesa/main/compute.h b/mesalib/src/mesa/main/compute.h new file mode 100644 index 000000000..0cc034fd6 --- /dev/null +++ b/mesalib/src/mesa/main/compute.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef COMPUTE_H +#define COMPUTE_H + + +#include "glheader.h" + +extern void GLAPIENTRY +_mesa_DispatchCompute(GLuint num_groups_x, + GLuint num_groups_y, + GLuint num_groups_z); + +extern void GLAPIENTRY +_mesa_DispatchComputeIndirect(GLintptr indirect); + +#endif diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index d1f4632d4..b2583e6d5 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -276,6 +276,15 @@ #define MAX_DEBUG_GROUP_STACK_DEPTH 64 /*@}*/ +/** For GL_ARB_gpu_shader5 */ +/*@{*/ +#define MAX_GEOMETRY_SHADER_INVOCATIONS 32 +#define MIN_FRAGMENT_INTERPOLATION_OFFSET -0.5 +#define MAX_FRAGMENT_INTERPOLATION_OFFSET 0.5 +#define FRAGMENT_INTERPOLATION_OFFSET_BITS 4 +#define MAX_VERTEX_STREAMS 4 +/*@}*/ + /* * Color channel component order * diff --git a/mesalib/src/mesa/main/context.c b/mesalib/src/mesa/main/context.c index 1f8639108..9372b3bea 100644 --- a/mesalib/src/mesa/main/context.c +++ b/mesalib/src/mesa/main/context.c @@ -498,6 +498,14 @@ init_program_limits(struct gl_context *ctx, gl_shader_stage stage, prog->MaxInputComponents = 16 * 4; /* old limit not to break tnl and swrast */ prog->MaxOutputComponents = 16 * 4; /* old limit not to break tnl and swrast */ break; + case MESA_SHADER_COMPUTE: + prog->MaxParameters = 0; /* not meaningful for compute shaders */ + prog->MaxAttribs = 0; /* not meaningful for compute shaders */ + prog->MaxAddressRegs = 0; /* not meaningful for compute shaders */ + prog->MaxUniformComponents = 4 * MAX_UNIFORMS; + prog->MaxInputComponents = 0; /* not meaningful for compute shaders */ + prog->MaxOutputComponents = 0; /* not meaningful for compute shaders */ + break; default: assert(0 && "Bad shader stage in init_program_limits()"); } @@ -587,7 +595,7 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxSpotExponent = 128.0; ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH; ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT; - ctx->Const.MinMapBufferAlignment = 1; + ctx->Const.MinMapBufferAlignment = 64; /* Driver must override these values if ARB_viewport_array is supported. */ ctx->Const.MaxViewports = 1; @@ -692,6 +700,19 @@ _mesa_init_constants(struct gl_context *ctx) /* GL_ARB_vertex_attrib_binding */ ctx->Const.MaxVertexAttribRelativeOffset = 2047; ctx->Const.MaxVertexAttribBindings = MAX_VERTEX_GENERIC_ATTRIBS; + + /* GL_ARB_compute_shader */ + ctx->Const.MaxComputeWorkGroupCount[0] = 65535; + ctx->Const.MaxComputeWorkGroupCount[1] = 65535; + ctx->Const.MaxComputeWorkGroupCount[2] = 65535; + ctx->Const.MaxComputeWorkGroupSize[0] = 1024; + ctx->Const.MaxComputeWorkGroupSize[1] = 1024; + ctx->Const.MaxComputeWorkGroupSize[2] = 64; + ctx->Const.MaxComputeWorkGroupInvocations = 1024; + + /** GL_ARB_gpu_shader5 */ + ctx->Const.MinFragmentInterpolationOffset = MIN_FRAGMENT_INTERPOLATION_OFFSET; + ctx->Const.MaxFragmentInterpolationOffset = MAX_FRAGMENT_INTERPOLATION_OFFSET; } @@ -1188,8 +1209,8 @@ _mesa_free_context_data( struct gl_context *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, NULL); - _mesa_reference_array_object(ctx, &ctx->Array.DefaultArrayObj, NULL); + _mesa_reference_vao(ctx, &ctx->Array.VAO, NULL); + _mesa_reference_vao(ctx, &ctx->Array.DefaultVAO, NULL); _mesa_free_attrib_data(ctx); _mesa_free_buffer_objects(ctx); diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 6c084afa3..ac317e399 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -182,9 +182,9 @@ struct dd_function_table { * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ]. * Called by glTexImage(), etc. */ - gl_format (*ChooseTextureFormat)( struct gl_context *ctx, - GLenum target, GLint internalFormat, - GLenum srcFormat, GLenum srcType ); + mesa_format (*ChooseTextureFormat)(struct gl_context *ctx, + GLenum target, GLint internalFormat, + GLenum srcFormat, GLenum srcType ); /** * Determine sample counts support for a particular target and format @@ -256,6 +256,10 @@ struct dd_function_table { /** * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. + * Note that if the texture is a cube map, the <target> parameter will + * indicate which cube face to generate (GL_POSITIVE/NEGATIVE_X/Y/Z). + * texObj->BaseLevel is the level from which to generate the remaining + * mipmap levels. */ void (*GenerateMipmap)(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj); @@ -268,7 +272,7 @@ struct dd_function_table { * \return GL_TRUE if the image is OK, GL_FALSE if too large */ GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target, - GLint level, gl_format format, + GLint level, mesa_format format, GLint width, GLint height, GLint depth, GLint border); /*@}*/ @@ -403,9 +407,11 @@ struct dd_function_table { */ /*@{*/ /** Bind a vertex/fragment program */ - void (*BindProgram)(struct gl_context *ctx, GLenum target, struct gl_program *prog); + void (*BindProgram)(struct gl_context *ctx, GLenum target, + struct gl_program *prog); /** Allocate a new program */ - struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, GLuint id); + struct gl_program * (*NewProgram)(struct gl_context *ctx, GLenum target, + GLuint id); /** Delete a program */ void (*DeleteProgram)(struct gl_context *ctx, struct gl_program *prog); /** @@ -439,7 +445,8 @@ struct dd_function_table { * This gives drivers an opportunity to clone the IR and make their * own transformations on it for the purposes of code generation. */ - GLboolean (*LinkShader)(struct gl_context *ctx, struct gl_shader_program *shader); + GLboolean (*LinkShader)(struct gl_context *ctx, + struct gl_shader_program *shader); /*@}*/ /** @@ -457,7 +464,8 @@ struct dd_function_table { /** Set the blend color */ void (*BlendColor)(struct gl_context *ctx, const GLfloat color[4]); /** Set the blend equation */ - void (*BlendEquationSeparate)(struct gl_context *ctx, GLenum modeRGB, GLenum modeA); + void (*BlendEquationSeparate)(struct gl_context *ctx, + GLenum modeRGB, GLenum modeA); void (*BlendEquationSeparatei)(struct gl_context *ctx, GLuint buffer, GLenum modeRGB, GLenum modeA); /** Specify pixel arithmetic */ @@ -468,7 +476,7 @@ struct dd_function_table { GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorA, GLenum dfactorA); /** Specify a plane against which all geometry is clipped */ - void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *equation ); + void (*ClipPlane)(struct gl_context *ctx, GLenum plane, const GLfloat *eq); /** Enable and disable writing of frame buffer color components */ void (*ColorMask)(struct gl_context *ctx, GLboolean rmask, GLboolean gmask, GLboolean bmask, GLboolean amask ); @@ -489,7 +497,7 @@ struct dd_function_table { /** Specify the current buffer for writing */ void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer ); /** Specify the buffers for writing for fragment programs*/ - void (*DrawBuffers)( struct gl_context *ctx, GLsizei n, const GLenum *buffers ); + void (*DrawBuffers)(struct gl_context *ctx, GLsizei n, const GLenum *buffers); /** Enable or disable server-side gl capabilities */ void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state); /** Specify fog parameters */ @@ -503,7 +511,8 @@ struct dd_function_table { void (*Lightfv)(struct gl_context *ctx, GLenum light, GLenum pname, const GLfloat *params ); /** Set the lighting model parameters */ - void (*LightModelfv)(struct gl_context *ctx, GLenum pname, const GLfloat *params); + void (*LightModelfv)(struct gl_context *ctx, GLenum pname, + const GLfloat *params); /** Specify the line stipple pattern */ void (*LineStipple)(struct gl_context *ctx, GLint factor, GLushort pattern ); /** Specify the width of rasterized lines */ @@ -543,7 +552,7 @@ struct dd_function_table { void (*TexEnv)(struct gl_context *ctx, GLenum target, GLenum pname, const GLfloat *param); /** Set texture parameters */ - void (*TexParameter)(struct gl_context *ctx, GLenum target, + void (*TexParameter)(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params); /** Set the viewport */ @@ -558,14 +567,14 @@ struct dd_function_table { void (*BindBuffer)( struct gl_context *ctx, GLenum target, struct gl_buffer_object *obj ); - struct gl_buffer_object * (*NewBufferObject)( struct gl_context *ctx, GLuint buffer, - GLenum target ); + struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx, + GLuint buffer, GLenum target); void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj ); - GLboolean (*BufferData)( struct gl_context *ctx, GLenum target, GLsizeiptrARB size, - const GLvoid *data, GLenum usage, - struct gl_buffer_object *obj ); + GLboolean (*BufferData)(struct gl_context *ctx, GLenum target, + GLsizeiptrARB size, const GLvoid *data, GLenum usage, + struct gl_buffer_object *obj); void (*BufferSubData)( struct gl_context *ctx, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data, @@ -607,22 +616,34 @@ struct dd_function_table { */ /*@{*/ /* variations on ObjectPurgeable */ - GLenum (*BufferObjectPurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectPurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectPurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); + GLenum (*BufferObjectPurgeable)(struct gl_context *ctx, + struct gl_buffer_object *obj, GLenum option); + GLenum (*RenderObjectPurgeable)(struct gl_context *ctx, + struct gl_renderbuffer *obj, GLenum option); + GLenum (*TextureObjectPurgeable)(struct gl_context *ctx, + struct gl_texture_object *obj, + GLenum option); /* variations on ObjectUnpurgeable */ - GLenum (*BufferObjectUnpurgeable)( struct gl_context *ctx, struct gl_buffer_object *obj, GLenum option ); - GLenum (*RenderObjectUnpurgeable)( struct gl_context *ctx, struct gl_renderbuffer *obj, GLenum option ); - GLenum (*TextureObjectUnpurgeable)( struct gl_context *ctx, struct gl_texture_object *obj, GLenum option ); + GLenum (*BufferObjectUnpurgeable)(struct gl_context *ctx, + struct gl_buffer_object *obj, + GLenum option); + GLenum (*RenderObjectUnpurgeable)(struct gl_context *ctx, + struct gl_renderbuffer *obj, + GLenum option); + GLenum (*TextureObjectUnpurgeable)(struct gl_context *ctx, + struct gl_texture_object *obj, + GLenum option); /*@}*/ /** * \name Functions for GL_EXT_framebuffer_{object,blit,discard}. */ /*@{*/ - struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, GLuint name); - struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, GLuint name); + struct gl_framebuffer * (*NewFramebuffer)(struct gl_context *ctx, + GLuint name); + struct gl_renderbuffer * (*NewRenderbuffer)(struct gl_context *ctx, + GLuint name); void (*BindFramebuffer)(struct gl_context *ctx, GLenum target, struct gl_framebuffer *drawFb, struct gl_framebuffer *readFb); @@ -643,7 +664,8 @@ struct dd_function_table { GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); void (*DiscardFramebuffer)(struct gl_context *ctx, - GLenum target, GLsizei numAttachments, const GLenum *attachments); + GLenum target, GLsizei numAttachments, + const GLenum *attachments); /** * \name Query objects @@ -687,18 +709,20 @@ struct dd_function_table { * \name Vertex Array objects */ /*@{*/ - struct gl_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); - void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); - void (*BindArrayObject)(struct gl_context *ctx, struct gl_array_object *obj); + struct gl_vertex_array_object * (*NewArrayObject)(struct gl_context *ctx, GLuint id); + void (*DeleteArrayObject)(struct gl_context *ctx, struct gl_vertex_array_object *); + void (*BindArrayObject)(struct gl_context *ctx, struct gl_vertex_array_object *); /*@}*/ /** * \name GLSL-related functions (ARB extensions and OpenGL 2.x) */ /*@{*/ - struct gl_shader *(*NewShader)(struct gl_context *ctx, GLuint name, GLenum type); + struct gl_shader *(*NewShader)(struct gl_context *ctx, + GLuint name, GLenum type); void (*DeleteShader)(struct gl_context *ctx, struct gl_shader *shader); - struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, GLuint name); + struct gl_shader_program *(*NewShaderProgram)(struct gl_context *ctx, + GLuint name); void (*DeleteShaderProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); void (*UseProgram)(struct gl_context *ctx, struct gl_shader_program *shProg); @@ -805,7 +829,8 @@ struct dd_function_table { */ /*@{*/ struct gl_sync_object * (*NewSyncObject)(struct gl_context *, GLenum); - void (*FenceSync)(struct gl_context *, struct gl_sync_object *, GLenum, GLbitfield); + void (*FenceSync)(struct gl_context *, struct gl_sync_object *, + GLenum, GLbitfield); void (*DeleteSyncObject)(struct gl_context *, struct gl_sync_object *); void (*CheckSync)(struct gl_context *, struct gl_sync_object *); void (*ClientWaitSync)(struct gl_context *, struct gl_sync_object *, @@ -815,9 +840,11 @@ struct dd_function_table { /*@}*/ /** GL_NV_conditional_render */ - void (*BeginConditionalRender)(struct gl_context *ctx, struct gl_query_object *q, + void (*BeginConditionalRender)(struct gl_context *ctx, + struct gl_query_object *q, GLenum mode); - void (*EndConditionalRender)(struct gl_context *ctx, struct gl_query_object *q); + void (*EndConditionalRender)(struct gl_context *ctx, + struct gl_query_object *q); /** * \name GL_OES_draw_texture interface @@ -859,8 +886,8 @@ struct dd_function_table { * Begin/EndTransformFeedback block. */ GLsizei (*GetTransformFeedbackVertexCount)(struct gl_context *ctx, - struct gl_transform_feedback_object *obj, - GLuint stream); + struct gl_transform_feedback_object *obj, + GLuint stream); /** * \name GL_NV_texture_barrier interface diff --git a/mesalib/src/mesa/main/debug.c b/mesalib/src/mesa/main/debug.c index 99b214789..a5b40b4b5 100644 --- a/mesalib/src/mesa/main/debug.c +++ b/mesalib/src/mesa/main/debug.c @@ -615,21 +615,21 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img) else { /* XXX add more formats or make into a new format utility function */ switch (img->TexFormat) { - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: c = 1; break; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: + case MESA_FORMAT_L8A8_UNORM: + case MESA_FORMAT_A8L8_UNORM: c = 2; break; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_RGB_UNORM8: c = 3; break; - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_A8B8G8R8_UNORM: + case MESA_FORMAT_B8G8R8A8_UNORM: c = 4; break; default: diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 640db8490..40508a456 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -63,46 +63,46 @@ update_derived_primitive_restart_state(struct gl_context *ctx) static void client_state(struct gl_context *ctx, GLenum cap, GLboolean state) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; GLbitfield64 flag; GLboolean *var; switch (cap) { case GL_VERTEX_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_POS].Enabled; flag = VERT_BIT_POS; break; case GL_NORMAL_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; flag = VERT_BIT_NORMAL; break; case GL_COLOR_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; flag = VERT_BIT_COLOR0; break; case GL_INDEX_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; flag = VERT_BIT_COLOR_INDEX; break; case GL_TEXTURE_COORD_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled; flag = VERT_BIT_TEX(ctx->Array.ActiveTexture); break; case GL_EDGE_FLAG_ARRAY: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; flag = VERT_BIT_EDGEFLAG; break; case GL_FOG_COORDINATE_ARRAY_EXT: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_FOG].Enabled; flag = VERT_BIT_FOG; break; case GL_SECONDARY_COLOR_ARRAY_EXT: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; flag = VERT_BIT_COLOR1; break; case GL_POINT_SIZE_ARRAY_OES: - var = &arrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; + var = &vao->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; flag = VERT_BIT_POINT_SIZE; break; @@ -131,11 +131,11 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state) update_derived_primitive_restart_state(ctx); if (state) - arrayObj->_Enabled |= flag; + vao->_Enabled |= flag; else - arrayObj->_Enabled &= ~flag; + vao->_Enabled &= ~flag; - arrayObj->NewArrays |= flag; + vao->NewArrays |= flag; if (ctx->Driver.Enable) { ctx->Driver.Enable( ctx, cap, state ); @@ -1423,41 +1423,41 @@ _mesa_IsEnabled( GLenum cap ) case GL_VERTEX_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Enabled; case GL_NORMAL_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled; case GL_COLOR_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled; case GL_INDEX_ARRAY: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj-> + return ctx->Array.VAO-> VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled; case GL_TEXTURE_COORD_ARRAY: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj-> + return ctx->Array.VAO-> VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].Enabled; case GL_EDGE_FLAG_ARRAY: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled; case GL_FOG_COORDINATE_ARRAY_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_FOG].Enabled; case GL_SECONDARY_COLOR_ARRAY_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled; case GL_POINT_SIZE_ARRAY_OES: if (ctx->API != API_OPENGLES) goto invalid_enum_error; - return ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; + return ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled; /* GL_ARB_texture_cube_map */ case GL_TEXTURE_CUBE_MAP_ARB: diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 0676f1e3d..5f741fbd2 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -85,6 +85,7 @@ static const struct extension extension_table[] = { { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, + { "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 }, { "GL_ARB_copy_buffer", o(dummy_true), GL, 2008 }, { "GL_ARB_conservative_depth", o(ARB_conservative_depth), GL, 2011 }, { "GL_ARB_debug_output", o(dummy_true), GL, 2009 }, @@ -110,7 +111,7 @@ static const struct extension extension_table[] = { { "GL_ARB_instanced_arrays", o(ARB_instanced_arrays), GL, 2008 }, { "GL_ARB_internalformat_query", o(ARB_internalformat_query), GL, 2011 }, { "GL_ARB_invalidate_subdata", o(dummy_true), GL, 2012 }, - { "GL_ARB_map_buffer_alignment", o(ARB_map_buffer_alignment), GL, 2011 }, + { "GL_ARB_map_buffer_alignment", o(dummy_true), GL, 2011 }, { "GL_ARB_map_buffer_range", o(ARB_map_buffer_range), GL, 2008 }, { "GL_ARB_multi_draw_indirect", o(ARB_draw_indirect), GLC, 2012 }, { "GL_ARB_multisample", o(dummy_true), GLL, 1994 }, @@ -195,7 +196,7 @@ static const struct extension extension_table[] = { { "GL_EXT_draw_instanced", o(ARB_draw_instanced), GL, 2006 }, { "GL_EXT_draw_range_elements", o(dummy_true), GLL, 1997 }, { "GL_EXT_fog_coord", o(dummy_true), GLL, 1999 }, - { "GL_EXT_framebuffer_blit", o(EXT_framebuffer_blit), GL, 2005 }, + { "GL_EXT_framebuffer_blit", o(dummy_true), GL, 2005 }, { "GL_EXT_framebuffer_multisample", o(EXT_framebuffer_multisample), GL, 2005 }, { "GL_EXT_framebuffer_multisample_blit_scaled", o(EXT_framebuffer_multisample_blit_scaled), GL, 2011 }, { "GL_EXT_framebuffer_object", o(dummy_true), GLL, 2000 }, @@ -436,7 +437,6 @@ _mesa_enable_sw_extensions(struct gl_context *ctx) ctx->Extensions.EXT_blend_minmax = GL_TRUE; ctx->Extensions.EXT_depth_bounds_test = GL_TRUE; ctx->Extensions.EXT_draw_buffers2 = GL_TRUE; - ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; ctx->Extensions.EXT_point_parameters = GL_TRUE; ctx->Extensions.EXT_provoking_vertex = GL_TRUE; diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 943f40bd9..e459e0c63 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -50,10 +50,6 @@ #include "texobj.h" -/** Set this to 1 to debug/log glBlitFramebuffer() calls */ -#define DEBUG_BLIT 0 - - /** * Notes: * @@ -163,8 +159,7 @@ invalidate_framebuffer(struct gl_framebuffer *fb) static struct gl_framebuffer * get_framebuffer_target(struct gl_context *ctx, GLenum target) { - bool have_fb_blit = _mesa_is_gles3(ctx) || - (ctx->Extensions.EXT_framebuffer_blit && _mesa_is_desktop_gl(ctx)); + bool have_fb_blit = _mesa_is_gles3(ctx) || _mesa_is_desktop_gl(ctx); switch (target) { case GL_DRAW_FRAMEBUFFER: return have_fb_blit ? ctx->DrawBuffer : NULL; @@ -186,9 +181,9 @@ get_framebuffer_target(struct gl_context *ctx, GLenum target) * If \p attachment is GL_DEPTH_STENCIL_ATTACHMENT, return a pointer to * the depth buffer attachment point. */ -struct gl_renderbuffer_attachment * -_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, - GLenum attachment) +static struct gl_renderbuffer_attachment * +get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, + GLenum attachment) { GLuint i; @@ -318,9 +313,9 @@ _mesa_get_fb0_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, * Remove any texture or renderbuffer attached to the given attachment * point. Update reference counts, etc. */ -void -_mesa_remove_attachment(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att) +static void +remove_attachment(struct gl_context *ctx, + struct gl_renderbuffer_attachment *att) { struct gl_renderbuffer *rb = att->Renderbuffer; @@ -423,13 +418,13 @@ _mesa_update_texture_renderbuffer(struct gl_context *ctx, * Bind a texture object to an attachment point. * The previous binding, if any, will be removed first. */ -void -_mesa_set_texture_attachment(struct gl_context *ctx, - struct gl_framebuffer *fb, - struct gl_renderbuffer_attachment *att, - struct gl_texture_object *texObj, - GLenum texTarget, GLuint level, GLuint zoffset, - GLboolean layered) +static void +set_texture_attachment(struct gl_context *ctx, + struct gl_framebuffer *fb, + struct gl_renderbuffer_attachment *att, + struct gl_texture_object *texObj, + GLenum texTarget, GLuint level, GLuint zoffset, + GLboolean layered) { struct gl_renderbuffer *rb = att->Renderbuffer; @@ -442,7 +437,7 @@ _mesa_set_texture_attachment(struct gl_context *ctx, } else { /* new attachment */ - _mesa_remove_attachment(ctx, att); + remove_attachment(ctx, att); att->Type = GL_TEXTURE; assert(!att->Texture); _mesa_reference_texobj(&att->Texture, texObj); @@ -464,13 +459,13 @@ _mesa_set_texture_attachment(struct gl_context *ctx, * Bind a renderbuffer to an attachment point. * The previous binding, if any, will be removed first. */ -void -_mesa_set_renderbuffer_attachment(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att, - struct gl_renderbuffer *rb) +static void +set_renderbuffer_attachment(struct gl_context *ctx, + struct gl_renderbuffer_attachment *att, + struct gl_renderbuffer *rb) { /* XXX check if re-doing same attachment, exit early */ - _mesa_remove_attachment(ctx, att); + remove_attachment(ctx, att); att->Type = GL_RENDERBUFFER_EXT; att->Texture = NULL; /* just to be safe */ att->Complete = GL_FALSE; @@ -491,20 +486,20 @@ _mesa_framebuffer_renderbuffer(struct gl_context *ctx, _glthread_LOCK_MUTEX(fb->Mutex); - att = _mesa_get_attachment(ctx, fb, attachment); + att = get_attachment(ctx, fb, attachment); ASSERT(att); if (rb) { - _mesa_set_renderbuffer_attachment(ctx, att, rb); + set_renderbuffer_attachment(ctx, att, rb); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { /* do stencil attachment here (depth already done above) */ - att = _mesa_get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT); + att = get_attachment(ctx, fb, GL_STENCIL_ATTACHMENT_EXT); assert(att); - _mesa_set_renderbuffer_attachment(ctx, att, rb); + set_renderbuffer_attachment(ctx, att, rb); } rb->AttachedAnytime = GL_TRUE; } else { - _mesa_remove_attachment(ctx, att); + remove_attachment(ctx, att); } invalidate_framebuffer(fb); @@ -539,7 +534,7 @@ _mesa_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb) default: switch (rb->Format) { /* XXX This list is likely incomplete. */ - case MESA_FORMAT_RGB9_E5_FLOAT: + case MESA_FORMAT_R9G9B9E5_FLOAT: fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED; return; default:; @@ -637,7 +632,7 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat) * Is the given base format a legal format for a color renderbuffer? */ static GLboolean -is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat) +is_format_color_renderable(const struct gl_context *ctx, mesa_format format, GLenum internalFormat) { const GLenum baseFormat = _mesa_get_format_base_format(format); @@ -669,7 +664,7 @@ is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenu break; } - if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) { + if (format == MESA_FORMAT_B10G10R10A2_UNORM && internalFormat != GL_RGB10_A2) { return GL_FALSE; } @@ -902,7 +897,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, for (i = -2; i < (GLint) ctx->Const.MaxColorAttachments; i++) { struct gl_renderbuffer_attachment *att; GLenum f; - gl_format attFormat; + mesa_format attFormat; GLenum att_tex_target = GL_NONE; /* @@ -1090,7 +1085,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) { if (fb->ColorDrawBuffer[j] != GL_NONE) { const struct gl_renderbuffer_attachment *att - = _mesa_get_attachment(ctx, fb, fb->ColorDrawBuffer[j]); + = get_attachment(ctx, fb, fb->ColorDrawBuffer[j]); assert(att); if (att->Type == GL_NONE) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT; @@ -1103,7 +1098,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx, /* Check that the ReadBuffer is present */ if (fb->ColorReadBuffer != GL_NONE) { const struct gl_renderbuffer_attachment *att - = _mesa_get_attachment(ctx, fb, fb->ColorReadBuffer); + = get_attachment(ctx, fb, fb->ColorReadBuffer); assert(att); if (att->Type == GL_NONE) { fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT; @@ -1251,7 +1246,7 @@ _mesa_detach_renderbuffer(struct gl_context *ctx, for (i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Texture == att || fb->Attachment[i].Renderbuffer == att) { - _mesa_remove_attachment(ctx, &fb->Attachment[i]); + remove_attachment(ctx, &fb->Attachment[i]); progress = true; } } @@ -1859,7 +1854,7 @@ _mesa_EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) * we need to return zero. */ static GLint -get_component_bits(GLenum pname, GLenum baseFormat, gl_format format) +get_component_bits(GLenum pname, GLenum baseFormat, mesa_format format) { if (_mesa_base_format_has_channel(baseFormat, pname)) return _mesa_get_format_bits(format, pname); @@ -2037,26 +2032,12 @@ bind_framebuffer(GLenum target, GLuint framebuffer, bool allow_user_names) GLboolean bindReadBuf, bindDrawBuf; GET_CURRENT_CONTEXT(ctx); -#ifdef DEBUG - if (ctx->Extensions.ARB_framebuffer_object) { - ASSERT(ctx->Extensions.EXT_framebuffer_blit); - } -#endif - switch (target) { case GL_DRAW_FRAMEBUFFER_EXT: - if (!ctx->Extensions.EXT_framebuffer_blit) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)"); - return; - } bindDrawBuf = GL_TRUE; bindReadBuf = GL_FALSE; break; case GL_READ_FRAMEBUFFER_EXT: - if (!ctx->Extensions.EXT_framebuffer_blit) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBindFramebufferEXT(target)"); - return; - } bindDrawBuf = GL_FALSE; bindReadBuf = GL_TRUE; break; @@ -2190,26 +2171,15 @@ _mesa_DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) ASSERT(fb == &DummyFramebuffer || fb->Name == framebuffers[i]); /* check if deleting currently bound framebuffer object */ - if (ctx->Extensions.EXT_framebuffer_blit) { - /* separate draw/read binding points */ - if (fb == ctx->DrawBuffer) { - /* bind default */ - ASSERT(fb->RefCount >= 2); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0); - } - if (fb == ctx->ReadBuffer) { - /* bind default */ - ASSERT(fb->RefCount >= 2); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, 0); - } + if (fb == ctx->DrawBuffer) { + /* bind default */ + ASSERT(fb->RefCount >= 2); + _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); } - else { - /* only one binding point for read/draw buffers */ - if (fb == ctx->DrawBuffer || fb == ctx->ReadBuffer) { - /* bind default */ - ASSERT(fb->RefCount >= 2); - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, 0); - } + if (fb == ctx->ReadBuffer) { + /* bind default */ + ASSERT(fb->RefCount >= 2); + _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, 0); } /* remove from hash table immediately, to free the ID */ @@ -2454,7 +2424,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } } - att = _mesa_get_attachment(ctx, fb, attachment); + att = get_attachment(ctx, fb, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferTexture%sEXT(attachment)", caller); @@ -2488,7 +2458,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, reuse_framebuffer_texture_attachment(fb, BUFFER_STENCIL, BUFFER_DEPTH); } else { - _mesa_set_texture_attachment(ctx, fb, att, texObj, textarget, + set_texture_attachment(ctx, fb, att, texObj, textarget, level, zoffset, layered); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { /* Above we created a new renderbuffer and attached it to the @@ -2512,10 +2482,10 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, texObj->_RenderToTexture = GL_TRUE; } else { - _mesa_remove_attachment(ctx, att); + remove_attachment(ctx, att); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { assert(att == &fb->Attachment[BUFFER_DEPTH]); - _mesa_remove_attachment(ctx, &fb->Attachment[BUFFER_STENCIL]); + remove_attachment(ctx, &fb->Attachment[BUFFER_STENCIL]); } } @@ -2683,7 +2653,7 @@ _mesa_FramebufferRenderbuffer(GLenum target, GLenum attachment, return; } - att = _mesa_get_attachment(ctx, fb, attachment); + att = get_attachment(ctx, fb, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, "glFramebufferRenderbufferEXT(invalid attachment %s)", @@ -2785,7 +2755,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, } else { /* user-created framebuffer FBO */ - att = _mesa_get_attachment(ctx, buffer, attachment); + att = get_attachment(ctx, buffer, attachment); } if (att == NULL) { @@ -2797,8 +2767,8 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { /* the depth and stencil attachments must point to the same buffer */ const struct gl_renderbuffer_attachment *depthAtt, *stencilAtt; - depthAtt = _mesa_get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT); - stencilAtt = _mesa_get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT); + depthAtt = get_attachment(ctx, buffer, GL_DEPTH_ATTACHMENT); + stencilAtt = get_attachment(ctx, buffer, GL_STENCIL_ATTACHMENT); if (depthAtt->Renderbuffer != stencilAtt->Renderbuffer) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetFramebufferAttachmentParameterivEXT(DEPTH/STENCIL" @@ -2908,7 +2878,7 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, "glGetFramebufferAttachmentParameterivEXT(pname)"); } else { - gl_format format = att->Renderbuffer->Format; + mesa_format format = att->Renderbuffer->Format; /* Page 235 (page 247 of the PDF) in section 6.1.13 of the OpenGL ES * 3.0.1 spec says: @@ -2925,11 +2895,11 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, return; } - if (format == MESA_FORMAT_S8) { + if (format == MESA_FORMAT_S_UINT8) { /* special cases */ *params = GL_INDEX; } - else if (format == MESA_FORMAT_Z32_FLOAT_X24S8) { + else if (format == MESA_FORMAT_Z32_FLOAT_S8X24_UINT) { /* depends on the attachment parameter */ if (attachment == GL_STENCIL_ATTACHMENT) { *params = GL_INDEX; @@ -3003,567 +2973,6 @@ invalid_pname_enum: } -void GLAPIENTRY -_mesa_GenerateMipmap(GLenum target) -{ - struct gl_texture_image *srcImage; - struct gl_texture_object *texObj; - GLboolean error; - - GET_CURRENT_CONTEXT(ctx); - - FLUSH_VERTICES(ctx, 0); - - switch (target) { - case GL_TEXTURE_1D: - error = _mesa_is_gles(ctx); - break; - case GL_TEXTURE_2D: - error = GL_FALSE; - break; - case GL_TEXTURE_3D: - error = ctx->API == API_OPENGLES; - break; - case GL_TEXTURE_CUBE_MAP: - error = !ctx->Extensions.ARB_texture_cube_map; - break; - case GL_TEXTURE_1D_ARRAY: - error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array; - break; - case GL_TEXTURE_2D_ARRAY: - error = (_mesa_is_gles(ctx) && ctx->Version < 30) - || !ctx->Extensions.EXT_texture_array; - break; - default: - error = GL_TRUE; - } - - if (error) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target=%s)", - _mesa_lookup_enum_by_nr(target)); - return; - } - - texObj = _mesa_get_current_tex_object(ctx, target); - - if (texObj->BaseLevel >= texObj->MaxLevel) { - /* nothing to do */ - return; - } - - if (texObj->Target == GL_TEXTURE_CUBE_MAP && - !_mesa_cube_complete(texObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGenerateMipmap(incomplete cube map)"); - return; - } - - _mesa_lock_texture(ctx, texObj); - - srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); - if (!srcImage) { - _mesa_unlock_texture(ctx, texObj); - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGenerateMipmap(zero size base image)"); - return; - } - - if (_mesa_is_enum_format_integer(srcImage->InternalFormat) || - _mesa_is_depthstencil_format(srcImage->InternalFormat) || - _mesa_is_stencil_format(srcImage->InternalFormat)) { - _mesa_unlock_texture(ctx, texObj); - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGenerateMipmap(invalid internal format)"); - return; - } - - if (target == GL_TEXTURE_CUBE_MAP) { - GLuint face; - for (face = 0; face < 6; face++) - ctx->Driver.GenerateMipmap(ctx, - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, - texObj); - } - else { - ctx->Driver.GenerateMipmap(ctx, target, texObj); - } - _mesa_unlock_texture(ctx, texObj); -} - - -static const struct gl_renderbuffer_attachment * -find_attachment(const struct gl_framebuffer *fb, - const struct gl_renderbuffer *rb) -{ - GLuint i; - for (i = 0; i < Elements(fb->Attachment); i++) { - if (fb->Attachment[i].Renderbuffer == rb) - return &fb->Attachment[i]; - } - return NULL; -} - - -/** - * Helper function for checking if the datatypes of color buffers are - * compatible for glBlitFramebuffer. From the 3.1 spec, page 198: - * - * "GL_INVALID_OPERATION is generated if mask contains GL_COLOR_BUFFER_BIT - * and any of the following conditions hold: - * - The read buffer contains fixed-point or floating-point values and any - * draw buffer contains neither fixed-point nor floating-point values. - * - The read buffer contains unsigned integer values and any draw buffer - * does not contain unsigned integer values. - * - The read buffer contains signed integer values and any draw buffer - * does not contain signed integer values." - */ -static GLboolean -compatible_color_datatypes(gl_format srcFormat, gl_format dstFormat) -{ - GLenum srcType = _mesa_get_format_datatype(srcFormat); - GLenum dstType = _mesa_get_format_datatype(dstFormat); - - if (srcType != GL_INT && srcType != GL_UNSIGNED_INT) { - assert(srcType == GL_UNSIGNED_NORMALIZED || - srcType == GL_SIGNED_NORMALIZED || - srcType == GL_FLOAT); - /* Boil any of those types down to GL_FLOAT */ - srcType = GL_FLOAT; - } - - if (dstType != GL_INT && dstType != GL_UNSIGNED_INT) { - assert(dstType == GL_UNSIGNED_NORMALIZED || - dstType == GL_SIGNED_NORMALIZED || - dstType == GL_FLOAT); - /* Boil any of those types down to GL_FLOAT */ - dstType = GL_FLOAT; - } - - return srcType == dstType; -} - - -static GLboolean -compatible_resolve_formats(const struct gl_renderbuffer *readRb, - const struct gl_renderbuffer *drawRb) -{ - GLenum readFormat, drawFormat; - - /* The simple case where we know the backing Mesa formats are the same. - */ - if (_mesa_get_srgb_format_linear(readRb->Format) == - _mesa_get_srgb_format_linear(drawRb->Format)) { - return GL_TRUE; - } - - /* The Mesa formats are different, so we must check whether the internal - * formats are compatible. - * - * Under some circumstances, the user may request e.g. two GL_RGBA8 - * textures and get two entirely different Mesa formats like RGBA8888 and - * ARGB8888. Drivers behaving like that should be able to cope with - * non-matching formats by themselves, because it's not the user's fault. - * - * Blits between linear and sRGB formats are also allowed. - */ - readFormat = _mesa_get_nongeneric_internalformat(readRb->InternalFormat); - drawFormat = _mesa_get_nongeneric_internalformat(drawRb->InternalFormat); - readFormat = _mesa_get_linear_internalformat(readFormat); - drawFormat = _mesa_get_linear_internalformat(drawFormat); - - if (readFormat == drawFormat) { - return GL_TRUE; - } - - return GL_FALSE; -} - -static GLboolean -is_valid_blit_filter(const struct gl_context *ctx, GLenum filter) -{ - switch (filter) { - case GL_NEAREST: - case GL_LINEAR: - return true; - case GL_SCALED_RESOLVE_FASTEST_EXT: - case GL_SCALED_RESOLVE_NICEST_EXT: - return ctx->Extensions.EXT_framebuffer_multisample_blit_scaled; - default: - return false; - } -} - -/** - * Blit rectangular region, optionally from one framebuffer to another. - * - * Note, if the src buffer is multisampled and the dest is not, this is - * when the samples must be resolved to a single color. - */ -void GLAPIENTRY -_mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter) -{ - const GLbitfield legalMaskBits = (GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT | - GL_STENCIL_BUFFER_BIT); - const struct gl_framebuffer *readFb, *drawFb; - GET_CURRENT_CONTEXT(ctx); - - FLUSH_VERTICES(ctx, 0); - - if (MESA_VERBOSE & VERBOSE_API) - _mesa_debug(ctx, - "glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d, 0x%x, %s)\n", - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, _mesa_lookup_enum_by_nr(filter)); - - if (ctx->NewState) { - _mesa_update_state(ctx); - } - - readFb = ctx->ReadBuffer; - drawFb = ctx->DrawBuffer; - - if (!readFb || !drawFb) { - /* This will normally never happen but someday we may want to - * support MakeCurrent() with no drawables. - */ - return; - } - - /* check for complete framebuffers */ - if (drawFb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT || - readFb->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, - "glBlitFramebufferEXT(incomplete draw/read buffers)"); - return; - } - - if (!is_valid_blit_filter(ctx, filter)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glBlitFramebufferEXT(%s)", - _mesa_lookup_enum_by_nr(filter)); - return; - } - - if ((filter == GL_SCALED_RESOLVE_FASTEST_EXT || - filter == GL_SCALED_RESOLVE_NICEST_EXT) && - (readFb->Visual.samples == 0 || drawFb->Visual.samples > 0)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(%s)", - _mesa_lookup_enum_by_nr(filter)); - return; - } - - if (mask & ~legalMaskBits) { - _mesa_error( ctx, GL_INVALID_VALUE, "glBlitFramebufferEXT(mask)"); - return; - } - - /* depth/stencil must be blitted with nearest filtering */ - if ((mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) - && filter != GL_NEAREST) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(depth/stencil requires GL_NEAREST filter)"); - return; - } - - /* get color read/draw renderbuffers */ - if (mask & GL_COLOR_BUFFER_BIT) { - const GLuint numColorDrawBuffers = ctx->DrawBuffer->_NumColorDrawBuffers; - const struct gl_renderbuffer *colorReadRb = readFb->_ColorReadBuffer; - const struct gl_renderbuffer *colorDrawRb = NULL; - GLuint i; - - /* From the EXT_framebuffer_object spec: - * - * "If a buffer is specified in <mask> and does not exist in both - * the read and draw framebuffers, the corresponding bit is silently - * ignored." - */ - if (!colorReadRb || numColorDrawBuffers == 0) { - mask &= ~GL_COLOR_BUFFER_BIT; - } - else { - for (i = 0; i < numColorDrawBuffers; i++) { - colorDrawRb = ctx->DrawBuffer->_ColorDrawBuffers[i]; - if (!colorDrawRb) - continue; - - /* Page 193 (page 205 of the PDF) in section 4.3.2 of the OpenGL - * ES 3.0.1 spec says: - * - * "If the source and destination buffers are identical, an - * INVALID_OPERATION error is generated. Different mipmap - * levels of a texture, different layers of a three- - * dimensional texture or two-dimensional array texture, and - * different faces of a cube map texture do not constitute - * identical buffers." - */ - if (_mesa_is_gles3(ctx) && (colorDrawRb == colorReadRb)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(source and destination color " - "buffer cannot be the same)"); - return; - } - - if (!compatible_color_datatypes(colorReadRb->Format, - colorDrawRb->Format)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(color buffer datatypes mismatch)"); - return; - } - /* extra checks for multisample copies... */ - if (readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) { - /* color formats must match */ - if (!compatible_resolve_formats(colorReadRb, colorDrawRb)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(bad src/dst multisample pixel formats)"); - return; - } - } - } - if (filter != GL_NEAREST) { - /* From EXT_framebuffer_multisample_blit_scaled specification: - * "Calling BlitFramebuffer will result in an INVALID_OPERATION error - * if filter is not NEAREST and read buffer contains integer data." - */ - GLenum type = _mesa_get_format_datatype(colorReadRb->Format); - if (type == GL_INT || type == GL_UNSIGNED_INT) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(integer color type)"); - return; - } - } - } - } - - if (mask & GL_STENCIL_BUFFER_BIT) { - struct gl_renderbuffer *readRb = - readFb->Attachment[BUFFER_STENCIL].Renderbuffer; - struct gl_renderbuffer *drawRb = - drawFb->Attachment[BUFFER_STENCIL].Renderbuffer; - - /* From the EXT_framebuffer_object spec: - * - * "If a buffer is specified in <mask> and does not exist in both - * the read and draw framebuffers, the corresponding bit is silently - * ignored." - */ - if ((readRb == NULL) || (drawRb == NULL)) { - mask &= ~GL_STENCIL_BUFFER_BIT; - } - else { - int read_z_bits, draw_z_bits; - - if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(source and destination stencil " - "buffer cannot be the same)"); - return; - } - - if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != - _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) { - /* There is no need to check the stencil datatype here, because - * there is only one: GL_UNSIGNED_INT. - */ - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(stencil attachment format mismatch)"); - return; - } - - read_z_bits = _mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS); - draw_z_bits = _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS); - - /* If both buffers also have depth data, the depth formats must match - * as well. If one doesn't have depth, it's not blitted, so we should - * ignore the depth format check. - */ - if (read_z_bits > 0 && draw_z_bits > 0 && - (read_z_bits != draw_z_bits || - _mesa_get_format_datatype(readRb->Format) != - _mesa_get_format_datatype(drawRb->Format))) { - - _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebuffer" - "(stencil attachment depth format mismatch)"); - return; - } - } - } - - if (mask & GL_DEPTH_BUFFER_BIT) { - struct gl_renderbuffer *readRb = - readFb->Attachment[BUFFER_DEPTH].Renderbuffer; - struct gl_renderbuffer *drawRb = - drawFb->Attachment[BUFFER_DEPTH].Renderbuffer; - - /* From the EXT_framebuffer_object spec: - * - * "If a buffer is specified in <mask> and does not exist in both - * the read and draw framebuffers, the corresponding bit is silently - * ignored." - */ - if ((readRb == NULL) || (drawRb == NULL)) { - mask &= ~GL_DEPTH_BUFFER_BIT; - } - else { - int read_s_bit, draw_s_bit; - - if (_mesa_is_gles3(ctx) && (drawRb == readRb)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(source and destination depth " - "buffer cannot be the same)"); - return; - } - - if ((_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != - _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) || - (_mesa_get_format_datatype(readRb->Format) != - _mesa_get_format_datatype(drawRb->Format))) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(depth attachment format mismatch)"); - return; - } - - read_s_bit = _mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS); - draw_s_bit = _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS); - - /* If both buffers also have stencil data, the stencil formats must - * match as well. If one doesn't have stencil, it's not blitted, so - * we should ignore the stencil format check. - */ - if (read_s_bit > 0 && draw_s_bit > 0 && read_s_bit != draw_s_bit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebuffer" - "(depth attachment stencil bits mismatch)"); - return; - } - } - } - - - if (_mesa_is_gles3(ctx)) { - /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES - * 3.0.1 spec says: - * - * "If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, - * an INVALID_OPERATION error is generated." - */ - if (drawFb->Visual.samples > 0) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(destination samples must be 0)"); - return; - } - - /* Page 194 (page 206 of the PDF) in section 4.3.2 of the OpenGL ES - * 3.0.1 spec says: - * - * "If SAMPLE_BUFFERS for the read framebuffer is greater than zero, - * no copy is performed and an INVALID_OPERATION error is generated - * if the formats of the read and draw framebuffers are not - * identical or if the source and destination rectangles are not - * defined with the same (X0, Y0) and (X1, Y1) bounds." - * - * The format check was made above because desktop OpenGL has the same - * requirement. - */ - if (readFb->Visual.samples > 0 - && (srcX0 != dstX0 || srcY0 != dstY0 - || srcX1 != dstX1 || srcY1 != dstY1)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebuffer(bad src/dst multisample region)"); - return; - } - } else { - if (readFb->Visual.samples > 0 && - drawFb->Visual.samples > 0 && - readFb->Visual.samples != drawFb->Visual.samples) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(mismatched samples)"); - return; - } - - /* extra checks for multisample copies... */ - if ((readFb->Visual.samples > 0 || drawFb->Visual.samples > 0) && - (filter == GL_NEAREST || filter == GL_LINEAR)) { - /* src and dest region sizes must be the same */ - if (abs(srcX1 - srcX0) != abs(dstX1 - dstX0) || - abs(srcY1 - srcY0) != abs(dstY1 - dstY0)) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glBlitFramebufferEXT(bad src/dst multisample region sizes)"); - return; - } - } - } - - if (!ctx->Extensions.EXT_framebuffer_blit) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT"); - return; - } - - /* Debug code */ - if (DEBUG_BLIT) { - const struct gl_renderbuffer *colorReadRb = readFb->_ColorReadBuffer; - const struct gl_renderbuffer *colorDrawRb = NULL; - GLuint i = 0; - - printf("glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d," - " 0x%x, 0x%x)\n", - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); - if (colorReadRb) { - const struct gl_renderbuffer_attachment *att; - - att = find_attachment(readFb, colorReadRb); - printf(" Src FBO %u RB %u (%dx%d) ", - readFb->Name, colorReadRb->Name, - colorReadRb->Width, colorReadRb->Height); - if (att && att->Texture) { - printf("Tex %u tgt 0x%x level %u face %u", - att->Texture->Name, - att->Texture->Target, - att->TextureLevel, - att->CubeMapFace); - } - printf("\n"); - - /* Print all active color render buffers */ - for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { - colorDrawRb = ctx->DrawBuffer->_ColorDrawBuffers[i]; - if (!colorDrawRb) - continue; - - att = find_attachment(drawFb, colorDrawRb); - printf(" Dst FBO %u RB %u (%dx%d) ", - drawFb->Name, colorDrawRb->Name, - colorDrawRb->Width, colorDrawRb->Height); - if (att && att->Texture) { - printf("Tex %u tgt 0x%x level %u face %u", - att->Texture->Name, - att->Texture->Target, - att->TextureLevel, - att->CubeMapFace); - } - printf("\n"); - } - } - } - - if (!mask || - (srcX1 - srcX0) == 0 || (srcY1 - srcY0) == 0 || - (dstX1 - dstX0) == 0 || (dstY1 - dstY0) == 0) { - return; - } - - ASSERT(ctx->Driver.BlitFramebuffer); - ctx->Driver.BlitFramebuffer(ctx, - srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); -} - - static void invalidate_framebuffer_storage(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, diff --git a/mesalib/src/mesa/main/fbobject.h b/mesalib/src/mesa/main/fbobject.h index ab138cfff..77fdef415 100644 --- a/mesalib/src/mesa/main/fbobject.h +++ b/mesalib/src/mesa/main/fbobject.h @@ -67,26 +67,6 @@ _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id); extern struct gl_framebuffer * _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id); -extern struct gl_renderbuffer_attachment * -_mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb, - GLenum attachment); - -extern void -_mesa_remove_attachment(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att); - -extern void -_mesa_set_texture_attachment(struct gl_context *ctx, - struct gl_framebuffer *fb, - struct gl_renderbuffer_attachment *att, - struct gl_texture_object *texObj, - GLenum texTarget, GLuint level, GLuint zoffset, - GLboolean layered); - -extern void -_mesa_set_renderbuffer_attachment(struct gl_context *ctx, - struct gl_renderbuffer_attachment *att, - struct gl_renderbuffer *rb); void _mesa_update_texture_renderbuffer(struct gl_context *ctx, @@ -203,15 +183,6 @@ _mesa_GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params); extern void GLAPIENTRY -_mesa_GenerateMipmap(GLenum target); - - -extern void GLAPIENTRY -_mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter); - -extern void GLAPIENTRY _mesa_InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); diff --git a/mesalib/src/mesa/main/ffvertex_prog.c b/mesalib/src/mesa/main/ffvertex_prog.c index 4d71c55ee..c5583c965 100644 --- a/mesalib/src/mesa/main/ffvertex_prog.c +++ b/mesalib/src/mesa/main/ffvertex_prog.c @@ -228,7 +228,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) if (ctx->Point._Attenuated) key->point_attenuated = 1; - if (ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) + if (ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Enabled) key->point_array = 1; if (ctx->Texture._TexGenEnabled || diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 41f5f99c1..dee253c40 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -43,7 +43,7 @@ #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" -/** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */ +/** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */ struct z32f_x24s8 { float z; @@ -92,7 +92,7 @@ linear_ubyte_to_srgb_ubyte(GLubyte cl) /* - * MESA_FORMAT_RGBA8888 + * MESA_FORMAT_A8B8G8R8_UNORM */ static void @@ -136,7 +136,7 @@ pack_row_float_RGBA8888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_RGBA8888_REV + * MESA_FORMAT_R8G8B8A8_UNORM */ static void @@ -179,7 +179,7 @@ pack_row_float_RGBA8888_REV(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_ARGB8888 + * MESA_FORMAT_B8G8R8A8_UNORM */ static void @@ -222,7 +222,7 @@ pack_row_float_ARGB8888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_ARGB8888_REV + * MESA_FORMAT_A8R8G8B8_UNORM */ static void @@ -265,7 +265,7 @@ pack_row_float_ARGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_XRGB8888 + * MESA_FORMAT_B8G8R8X8_UNORM */ static void @@ -307,7 +307,7 @@ pack_row_float_XRGB8888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_XRGB8888_REV + * MESA_FORMAT_X8R8G8B8_UNORM */ static void @@ -349,7 +349,7 @@ pack_row_float_XRGB8888_REV(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_RGB888 + * MESA_FORMAT_BGR_UNORM8 */ static void @@ -398,7 +398,7 @@ pack_row_float_RGB888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_BGR888 + * MESA_FORMAT_RGB_UNORM8 */ static void @@ -447,7 +447,7 @@ pack_row_float_BGR888(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_RGB565 + * MESA_FORMAT_B5G6R5_UNORM */ static void @@ -491,7 +491,9 @@ pack_row_float_RGB565(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_RGB565_REV + * MESA_FORMAT_R5G6B5_UNORM + * Warning: these functions do not match the current Mesa definition + * of MESA_FORMAT_R5G6B5_UNORM. */ static void @@ -536,7 +538,7 @@ pack_row_float_RGB565_REV(GLuint n, const GLfloat src[][4], void *dst) /* - * MESA_FORMAT_ARGB4444 + * MESA_FORMAT_B4G4R4A4_UNORM */ static void @@ -558,7 +560,7 @@ pack_float_ARGB4444(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_ARGB4444_REV + * MESA_FORMAT_A4R4G4B4_UNORM */ static void @@ -580,7 +582,7 @@ pack_float_ARGB4444_REV(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_RGBA5551 + * MESA_FORMAT_A1B5G5R5_UNORM */ static void @@ -602,7 +604,7 @@ pack_float_RGBA5551(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_ARGB1555 + * MESA_FORMAT_B5G5R5A1_UNORM */ static void @@ -621,7 +623,10 @@ pack_float_ARGB1555(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_ARGB1555_REV */ +/* MESA_FORMAT_A1R5G5B5_UNORM + * Warning: these functions do not match the current Mesa definition + * of MESA_FORMAT_A1R5G5B5_UNORM. + */ static void pack_ubyte_ARGB1555_REV(const GLubyte src[4], void *dst) @@ -640,7 +645,7 @@ pack_float_ARGB1555_REV(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_AL44 */ +/* MESA_FORMAT_L4A4_UNORM */ static void pack_ubyte_AL44(const GLubyte src[4], void *dst) @@ -659,7 +664,7 @@ pack_float_AL44(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_AL88 */ +/* MESA_FORMAT_L8A8_UNORM */ static void pack_ubyte_AL88(const GLubyte src[4], void *dst) @@ -678,7 +683,7 @@ pack_float_AL88(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_AL88_REV */ +/* MESA_FORMAT_A8L8_UNORM */ static void pack_ubyte_AL88_REV(const GLubyte src[4], void *dst) @@ -697,7 +702,7 @@ pack_float_AL88_REV(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_AL1616 */ +/* MESA_FORMAT_L16A16_UNORM */ static void pack_ubyte_AL1616(const GLubyte src[4], void *dst) @@ -719,7 +724,7 @@ pack_float_AL1616(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_AL1616_REV */ +/* MESA_FORMAT_A16L16_UNORM */ static void pack_ubyte_AL1616_REV(const GLubyte src[4], void *dst) @@ -741,7 +746,7 @@ pack_float_AL1616_REV(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RGB332 */ +/* MESA_FORMAT_B2G3R3_UNORM */ static void pack_ubyte_RGB332(const GLubyte src[4], void *dst) @@ -761,7 +766,7 @@ pack_float_RGB332(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_A8 */ +/* MESA_FORMAT_A_UNORM8 */ static void pack_ubyte_A8(const GLubyte src[4], void *dst) @@ -778,7 +783,7 @@ pack_float_A8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_A16 */ +/* MESA_FORMAT_A_UNORM16 */ static void pack_ubyte_A16(const GLubyte src[4], void *dst) @@ -795,7 +800,7 @@ pack_float_A16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_L8 */ +/* MESA_FORMAT_L_UNORM8 */ static void pack_ubyte_L8(const GLubyte src[4], void *dst) @@ -812,7 +817,7 @@ pack_float_L8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_L16 */ +/* MESA_FORMAT_L_UNORM16 */ static void pack_ubyte_L16(const GLubyte src[4], void *dst) @@ -859,7 +864,7 @@ pack_float_YCBCR_REV(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_R8 */ +/* MESA_FORMAT_R_UNORM8 */ static void pack_ubyte_R8(const GLubyte src[4], void *dst) @@ -878,7 +883,7 @@ pack_float_R8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_GR88 */ +/* MESA_FORMAT_R8G8_UNORM */ static void pack_ubyte_GR88(const GLubyte src[4], void *dst) @@ -898,7 +903,7 @@ pack_float_GR88(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RG88 */ +/* MESA_FORMAT_G8R8_UNORM */ static void pack_ubyte_RG88(const GLubyte src[4], void *dst) @@ -918,7 +923,7 @@ pack_float_RG88(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_R16 */ +/* MESA_FORMAT_R_UNORM16 */ static void pack_ubyte_R16(const GLubyte src[4], void *dst) @@ -935,7 +940,7 @@ pack_float_R16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_GR1616 */ +/* MESA_FORMAT_R16G16_UNORM */ static void pack_ubyte_GR1616(const GLubyte src[4], void *dst) @@ -957,7 +962,7 @@ pack_float_GR1616(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RG1616 */ +/* MESA_FORMAT_G16R16_UNORM */ static void pack_ubyte_RG1616(const GLubyte src[4], void *dst) @@ -980,7 +985,7 @@ pack_float_RG1616(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_ARGB2101010 */ +/* MESA_FORMAT_B10G10R10A2_UNORM */ static void pack_ubyte_ARGB2101010(const GLubyte src[4], void *dst) @@ -1006,7 +1011,7 @@ pack_float_ARGB2101010(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_ABGR2101010_UINT */ +/* MESA_FORMAT_R10G10B10A2_UINT */ static void pack_ubyte_ABGR2101010_UINT(const GLubyte src[4], void *dst) @@ -1032,7 +1037,7 @@ pack_float_ABGR2101010_UINT(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SRGB8 */ +/* MESA_FORMAT_BGR_SRGB8 */ static void pack_ubyte_SRGB8(const GLubyte src[4], void *dst) @@ -1053,7 +1058,7 @@ pack_float_SRGB8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SRGBA8 */ +/* MESA_FORMAT_A8B8G8R8_SRGB */ static void pack_ubyte_SRGBA8(const GLubyte src[4], void *dst) @@ -1078,7 +1083,7 @@ pack_float_SRGBA8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SARGB8 */ +/* MESA_FORMAT_B8G8R8A8_SRGB */ static void pack_ubyte_SARGB8(const GLubyte src[4], void *dst) @@ -1103,7 +1108,7 @@ pack_float_SARGB8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SL8 */ +/* MESA_FORMAT_L_SRGB8 */ static void pack_ubyte_SL8(const GLubyte src[4], void *dst) @@ -1121,7 +1126,7 @@ pack_float_SL8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_SLA8 */ +/* MESA_FORMAT_L8A8_SRGB */ static void pack_ubyte_SLA8(const GLubyte src[4], void *dst) @@ -1229,7 +1234,7 @@ pack_float_RGB_FLOAT16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_ALPHA_FLOAT32 */ +/* MESA_FORMAT_A_FLOAT32 */ static void pack_ubyte_ALPHA_FLOAT32(const GLubyte src[4], void *dst) @@ -1246,7 +1251,7 @@ pack_float_ALPHA_FLOAT32(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_ALPHA_FLOAT16 */ +/* MESA_FORMAT_A_FLOAT16 */ static void pack_ubyte_ALPHA_FLOAT16(const GLubyte src[4], void *dst) @@ -1263,7 +1268,7 @@ pack_float_ALPHA_FLOAT16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_LUMINANCE_FLOAT32 (and INTENSITY_FLOAT32, R_FLOAT32) */ +/* MESA_FORMAT_L_FLOAT32 (and INTENSITY_FLOAT32, R_FLOAT32) */ static void pack_ubyte_LUMINANCE_FLOAT32(const GLubyte src[4], void *dst) @@ -1280,7 +1285,7 @@ pack_float_LUMINANCE_FLOAT32(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_LUMINANCE_FLOAT16 (and INTENSITY_FLOAT16, R_FLOAT32) */ +/* MESA_FORMAT_L_FLOAT16 (and INTENSITY_FLOAT16, R_FLOAT32) */ static void pack_ubyte_LUMINANCE_FLOAT16(const GLubyte src[4], void *dst) @@ -1297,7 +1302,7 @@ pack_float_LUMINANCE_FLOAT16(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 */ +/* MESA_FORMAT_LA_FLOAT32 */ static void pack_ubyte_LUMINANCE_ALPHA_FLOAT32(const GLubyte src[4], void *dst) @@ -1316,7 +1321,7 @@ pack_float_LUMINANCE_ALPHA_FLOAT32(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 */ +/* MESA_FORMAT_LA_FLOAT16 */ static void pack_ubyte_LUMINANCE_ALPHA_FLOAT16(const GLubyte src[4], void *dst) @@ -1394,7 +1399,7 @@ pack_float_DUDV8(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_RGBA_16 */ +/* MESA_FORMAT_RGBA_UNORM16 */ static void pack_ubyte_RGBA_16(const GLubyte src[4], void *dst) @@ -1419,7 +1424,7 @@ pack_float_RGBA_16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_R8 + * MESA_FORMAT_R_SNORM8 */ static void @@ -1431,7 +1436,7 @@ pack_float_SIGNED_R8(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RG88_REV + * MESA_FORMAT_R8G8_SNORM */ static void @@ -1445,7 +1450,7 @@ pack_float_SIGNED_RG88_REV(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RGBX8888 + * MESA_FORMAT_X8B8G8R8_SNORM */ static void @@ -1461,7 +1466,7 @@ pack_float_SIGNED_RGBX8888(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RGBA8888 + * MESA_FORMAT_A8B8G8R8_SNORM */ static void @@ -1477,7 +1482,7 @@ pack_float_SIGNED_RGBA8888(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RGBA8888_REV + * MESA_FORMAT_R8G8B8A8_SNORM */ static void @@ -1493,7 +1498,7 @@ pack_float_SIGNED_RGBA8888_REV(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_R16 + * MESA_FORMAT_R_SNORM16 */ static void @@ -1505,7 +1510,7 @@ pack_float_SIGNED_R16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_GR1616 + * MESA_FORMAT_R16G16_SNORM */ static void @@ -1519,7 +1524,7 @@ pack_float_SIGNED_GR1616(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RGB_16 + * MESA_FORMAT_RGB_SNORM16 */ static void @@ -1533,7 +1538,7 @@ pack_float_SIGNED_RGB_16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_RGBA_16 + * MESA_FORMAT_RGBA_SNORM16 */ static void @@ -1548,7 +1553,7 @@ pack_float_SIGNED_RGBA_16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_A8 + * MESA_FORMAT_A_SNORM8 */ static void @@ -1560,7 +1565,7 @@ pack_float_SIGNED_A8(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_L8 + * MESA_FORMAT_L_SNORM8 */ static void @@ -1572,7 +1577,7 @@ pack_float_SIGNED_L8(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_AL88 + * MESA_FORMAT_L8A8_SNORM */ static void @@ -1586,7 +1591,7 @@ pack_float_SIGNED_AL88(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_A16 + * MESA_FORMAT_A_SNORM16 */ static void @@ -1598,7 +1603,7 @@ pack_float_SIGNED_A16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_L16 + * MESA_FORMAT_L_SNORM16 */ static void @@ -1610,7 +1615,7 @@ pack_float_SIGNED_L16(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_SIGNED_AL1616 + * MESA_FORMAT_LA_SNORM16 */ static void @@ -1624,7 +1629,7 @@ pack_float_SIGNED_AL1616(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_RGB9_E5_FLOAT; + * MESA_FORMAT_R9G9B9E5_FLOAT; */ static void @@ -1648,7 +1653,7 @@ pack_ubyte_RGB9_E5_FLOAT(const GLubyte src[4], void *dst) /* - * MESA_FORMAT_R11_G11_B10_FLOAT; + * MESA_FORMAT_R11G11B10_FLOAT; */ static void @@ -1671,7 +1676,7 @@ pack_float_R11_G11_B10_FLOAT(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_XRGB4444_UNORM + * MESA_FORMAT_B4G4R4X4_UNORM */ static void @@ -1691,7 +1696,7 @@ pack_float_XRGB4444_UNORM(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_XRGB1555_UNORM + * MESA_FORMAT_B5G5R5X1_UNORM */ static void @@ -1711,7 +1716,7 @@ pack_float_XRGB1555_UNORM(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_XBGR8888_SNORM + * MESA_FORMAT_R8G8B8X8_SNORM */ static void @@ -1726,7 +1731,7 @@ pack_float_XBGR8888_SNORM(const GLfloat src[4], void *dst) /* - * MESA_FORMAT_XBGR8888_SRGB + * MESA_FORMAT_R8G8B8X8_SRGB */ static void @@ -1740,7 +1745,7 @@ pack_float_XBGR8888_SRGB(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XRGB2101010_UNORM */ +/* MESA_FORMAT_B10G10R10X2_UNORM */ static void pack_ubyte_XRGB2101010_UNORM(const GLubyte src[4], void *dst) @@ -1764,7 +1769,7 @@ pack_float_XRGB2101010_UNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_UNORM */ +/* MESA_FORMAT_RGBX_UNORM16 */ static void pack_ubyte_XBGR16161616_UNORM(const GLubyte src[4], void *dst) @@ -1787,7 +1792,7 @@ pack_float_XBGR16161616_UNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_SNORM */ +/* MESA_FORMAT_RGBX_SNORM16 */ static void pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) @@ -1800,7 +1805,7 @@ pack_float_XBGR16161616_SNORM(const GLfloat src[4], void *dst) } -/* MESA_FORMAT_XBGR16161616_FLOAT */ +/* MESA_FORMAT_RGBX_FLOAT16 */ static void pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) @@ -1812,7 +1817,7 @@ pack_float_XBGR16161616_FLOAT(const GLfloat src[4], void *dst) d[3] = _mesa_float_to_half(1.0); } -/* MESA_FORMAT_XBGR32323232_FLOAT */ +/* MESA_FORMAT_RGBX_FLOAT32 */ static void pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) @@ -1824,7 +1829,7 @@ pack_float_XBGR32323232_FLOAT(const GLfloat src[4], void *dst) d[3] = 1.0; } -/* MESA_FORMAT_ABGR2101010 */ +/* MESA_FORMAT_R10G10B10A2_UNORM */ static void pack_ubyte_ABGR2101010(const GLubyte src[4], void *dst) @@ -1850,7 +1855,7 @@ pack_float_ABGR2101010(const GLfloat src[4], void *dst) } /* - * MESA_FORMAT_SIGNED_RG88 + * MESA_FORMAT_G8R8_SNORM */ static void @@ -1863,7 +1868,7 @@ pack_float_SIGNED_RG88(const GLfloat src[4], void *dst) } /* - * MESA_FORMAT_SIGNED_RG1616 + * MESA_FORMAT_G16R16_SNORM */ static void @@ -1879,7 +1884,7 @@ pack_float_SIGNED_RG1616(const GLfloat src[4], void *dst) * Return a function that can pack a GLubyte rgba[4] color. */ gl_pack_ubyte_rgba_func -_mesa_get_pack_ubyte_rgba_function(gl_format format) +_mesa_get_pack_ubyte_rgba_function(mesa_format format) { static gl_pack_ubyte_rgba_func table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -1889,62 +1894,61 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_RGBA8888] = pack_ubyte_RGBA8888; - table[MESA_FORMAT_RGBA8888_REV] = pack_ubyte_RGBA8888_REV; - table[MESA_FORMAT_ARGB8888] = pack_ubyte_ARGB8888; - table[MESA_FORMAT_ARGB8888_REV] = pack_ubyte_ARGB8888_REV; - table[MESA_FORMAT_RGBX8888] = pack_ubyte_RGBA8888; /* reused */ - table[MESA_FORMAT_RGBX8888_REV] = pack_ubyte_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_XRGB8888] = pack_ubyte_XRGB8888; - table[MESA_FORMAT_XRGB8888_REV] = pack_ubyte_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_ubyte_RGB888; - table[MESA_FORMAT_BGR888] = pack_ubyte_BGR888; - table[MESA_FORMAT_RGB565] = pack_ubyte_RGB565; - table[MESA_FORMAT_RGB565_REV] = pack_ubyte_RGB565_REV; - table[MESA_FORMAT_ARGB4444] = pack_ubyte_ARGB4444; - table[MESA_FORMAT_ARGB4444_REV] = pack_ubyte_ARGB4444_REV; - table[MESA_FORMAT_RGBA5551] = pack_ubyte_RGBA5551; - table[MESA_FORMAT_ARGB1555] = pack_ubyte_ARGB1555; - table[MESA_FORMAT_ARGB1555_REV] = pack_ubyte_ARGB1555_REV; - table[MESA_FORMAT_AL44] = pack_ubyte_AL44; - table[MESA_FORMAT_AL88] = pack_ubyte_AL88; - table[MESA_FORMAT_AL88_REV] = pack_ubyte_AL88_REV; - table[MESA_FORMAT_AL1616] = pack_ubyte_AL1616; - table[MESA_FORMAT_AL1616_REV] = pack_ubyte_AL1616_REV; - table[MESA_FORMAT_RGB332] = pack_ubyte_RGB332; - table[MESA_FORMAT_A8] = pack_ubyte_A8; - table[MESA_FORMAT_A16] = pack_ubyte_A16; - table[MESA_FORMAT_L8] = pack_ubyte_L8; - table[MESA_FORMAT_L16] = pack_ubyte_L16; - table[MESA_FORMAT_I8] = pack_ubyte_L8; /* reuse pack_ubyte_L8 */ - table[MESA_FORMAT_I16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */ + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_ubyte_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_ubyte_RGBA8888_REV; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_ubyte_ARGB8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_ubyte_ARGB8888_REV; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_ubyte_RGBA8888; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_ubyte_RGBA8888_REV; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_ubyte_XRGB8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_ubyte_XRGB8888_REV; + table[MESA_FORMAT_BGR_UNORM8] = pack_ubyte_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_ubyte_BGR888; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_ubyte_RGB565; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_ubyte_RGB565_REV; + table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_ubyte_ARGB4444; + table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_ubyte_ARGB4444_REV; + table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_ubyte_RGBA5551; + table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_ubyte_ARGB1555; + table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_ubyte_ARGB1555_REV; + table[MESA_FORMAT_L4A4_UNORM] = pack_ubyte_AL44; + table[MESA_FORMAT_L8A8_UNORM] = pack_ubyte_AL88; + table[MESA_FORMAT_A8L8_UNORM] = pack_ubyte_AL88_REV; + table[MESA_FORMAT_L16A16_UNORM] = pack_ubyte_AL1616; + table[MESA_FORMAT_A16L16_UNORM] = pack_ubyte_AL1616_REV; + table[MESA_FORMAT_B2G3R3_UNORM] = pack_ubyte_RGB332; + table[MESA_FORMAT_A_UNORM8] = pack_ubyte_A8; + table[MESA_FORMAT_A_UNORM16] = pack_ubyte_A16; + table[MESA_FORMAT_L_UNORM8] = pack_ubyte_L8; + table[MESA_FORMAT_L_UNORM16] = pack_ubyte_L16; + table[MESA_FORMAT_I_UNORM8] = pack_ubyte_L8; /* reuse pack_ubyte_L8 */ + table[MESA_FORMAT_I_UNORM16] = pack_ubyte_L16; /* reuse pack_ubyte_L16 */ table[MESA_FORMAT_YCBCR] = pack_ubyte_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_ubyte_YCBCR_REV; - table[MESA_FORMAT_R8] = pack_ubyte_R8; - table[MESA_FORMAT_GR88] = pack_ubyte_GR88; - table[MESA_FORMAT_RG88] = pack_ubyte_RG88; - table[MESA_FORMAT_R16] = pack_ubyte_R16; - table[MESA_FORMAT_GR1616] = pack_ubyte_GR1616; - table[MESA_FORMAT_RG1616] = pack_ubyte_RG1616; - table[MESA_FORMAT_ARGB2101010] = pack_ubyte_ARGB2101010; - table[MESA_FORMAT_ABGR2101010_UINT] = pack_ubyte_ABGR2101010_UINT; + table[MESA_FORMAT_R_UNORM8] = pack_ubyte_R8; + table[MESA_FORMAT_R8G8_UNORM] = pack_ubyte_GR88; + table[MESA_FORMAT_G8R8_UNORM] = pack_ubyte_RG88; + table[MESA_FORMAT_R_UNORM16] = pack_ubyte_R16; + table[MESA_FORMAT_R16G16_UNORM] = pack_ubyte_GR1616; + table[MESA_FORMAT_G16R16_UNORM] = pack_ubyte_RG1616; + table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_ubyte_ARGB2101010; + table[MESA_FORMAT_R10G10B10A2_UINT] = pack_ubyte_ABGR2101010_UINT; /* should never convert RGBA to these formats */ - table[MESA_FORMAT_Z24_S8] = NULL; - table[MESA_FORMAT_S8_Z24] = NULL; - table[MESA_FORMAT_Z16] = NULL; - table[MESA_FORMAT_X8_Z24] = NULL; - table[MESA_FORMAT_Z24_X8] = NULL; - table[MESA_FORMAT_Z32] = NULL; - table[MESA_FORMAT_S8] = NULL; + table[MESA_FORMAT_S8_UINT_Z24_UNORM] = NULL; + table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; + table[MESA_FORMAT_Z_UNORM16] = NULL; + table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; + table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_Z_UNORM32] = NULL; + table[MESA_FORMAT_S_UINT8] = NULL; /* sRGB */ - table[MESA_FORMAT_SRGB8] = pack_ubyte_SRGB8; - table[MESA_FORMAT_SRGBA8] = pack_ubyte_SRGBA8; - table[MESA_FORMAT_SARGB8] = pack_ubyte_SARGB8; - table[MESA_FORMAT_SL8] = pack_ubyte_SL8; - table[MESA_FORMAT_SLA8] = pack_ubyte_SLA8; - + table[MESA_FORMAT_BGR_SRGB8] = pack_ubyte_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_ubyte_SRGBA8; + table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_ubyte_SARGB8; + table[MESA_FORMAT_L_SRGB8] = pack_ubyte_SL8; + table[MESA_FORMAT_L8A8_SRGB] = pack_ubyte_SLA8; /* n/a */ table[MESA_FORMAT_SRGB_DXT1] = NULL; /* pack_ubyte_SRGB_DXT1; */ table[MESA_FORMAT_SRGBA_DXT1] = NULL; /* pack_ubyte_SRGBA_DXT1; */ @@ -1962,73 +1966,73 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) table[MESA_FORMAT_RGBA_FLOAT16] = pack_ubyte_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = pack_ubyte_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = pack_ubyte_RGB_FLOAT16; - table[MESA_FORMAT_ALPHA_FLOAT32] = pack_ubyte_ALPHA_FLOAT32; - table[MESA_FORMAT_ALPHA_FLOAT16] = pack_ubyte_ALPHA_FLOAT16; - table[MESA_FORMAT_LUMINANCE_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; - table[MESA_FORMAT_LUMINANCE_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = pack_ubyte_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = pack_ubyte_LUMINANCE_ALPHA_FLOAT16; - table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; - table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = pack_ubyte_ALPHA_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = pack_ubyte_ALPHA_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = pack_ubyte_LUMINANCE_ALPHA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = pack_ubyte_LUMINANCE_ALPHA_FLOAT16; + table[MESA_FORMAT_I_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; table[MESA_FORMAT_R_FLOAT32] = pack_ubyte_LUMINANCE_FLOAT32; table[MESA_FORMAT_R_FLOAT16] = pack_ubyte_LUMINANCE_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = pack_ubyte_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = pack_ubyte_RG_FLOAT16; /* n/a */ - table[MESA_FORMAT_RGBA_INT8] = NULL; /* pack_ubyte_RGBA_INT8 */ - table[MESA_FORMAT_RGBA_INT16] = NULL; /* pack_ubyte_RGBA_INT16 */ - table[MESA_FORMAT_RGBA_INT32] = NULL; /* pack_ubyte_RGBA_INT32 */ + table[MESA_FORMAT_RGBA_SINT8] = NULL; /* pack_ubyte_RGBA_INT8 */ + table[MESA_FORMAT_RGBA_SINT16] = NULL; /* pack_ubyte_RGBA_INT16 */ + table[MESA_FORMAT_RGBA_SINT32] = NULL; /* pack_ubyte_RGBA_INT32 */ table[MESA_FORMAT_RGBA_UINT8] = NULL; /* pack_ubyte_RGBA_UINT8 */ table[MESA_FORMAT_RGBA_UINT16] = NULL; /* pack_ubyte_RGBA_UINT16 */ table[MESA_FORMAT_RGBA_UINT32] = NULL; /* pack_ubyte_RGBA_UINT32 */ table[MESA_FORMAT_DUDV8] = pack_ubyte_DUDV8; - table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16; /* n/a */ - table[MESA_FORMAT_SIGNED_R8] = NULL; - table[MESA_FORMAT_SIGNED_RG88_REV] = NULL; - table[MESA_FORMAT_SIGNED_RGBX8888] = NULL; - table[MESA_FORMAT_SIGNED_RGBA8888] = NULL; - table[MESA_FORMAT_SIGNED_RGBA8888_REV] = NULL; - table[MESA_FORMAT_SIGNED_R16] = NULL; - table[MESA_FORMAT_SIGNED_GR1616] = NULL; - table[MESA_FORMAT_SIGNED_RGB_16] = NULL; - table[MESA_FORMAT_SIGNED_RGBA_16] = NULL; - table[MESA_FORMAT_SIGNED_A8] = NULL; - table[MESA_FORMAT_SIGNED_L8] = NULL; - table[MESA_FORMAT_SIGNED_AL88] = NULL; - table[MESA_FORMAT_SIGNED_I8] = NULL; - table[MESA_FORMAT_SIGNED_A16] = NULL; - table[MESA_FORMAT_SIGNED_L16] = NULL; - table[MESA_FORMAT_SIGNED_AL1616] = NULL; - table[MESA_FORMAT_SIGNED_I16] = NULL; - - - table[MESA_FORMAT_RGBA_16] = pack_ubyte_RGBA_16; - - table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT; - - table[MESA_FORMAT_XRGB4444_UNORM] = pack_ubyte_XRGB4444_UNORM; - table[MESA_FORMAT_XRGB1555_UNORM] = pack_ubyte_XRGB1555_UNORM; - table[MESA_FORMAT_XBGR8888_SNORM] = NULL; - table[MESA_FORMAT_XBGR8888_SRGB] = NULL; - table[MESA_FORMAT_XBGR8888_UINT] = NULL; - table[MESA_FORMAT_XBGR8888_SINT] = NULL; - table[MESA_FORMAT_XRGB2101010_UNORM] = pack_ubyte_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = pack_ubyte_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = NULL; - table[MESA_FORMAT_XBGR16161616_FLOAT] = NULL; - table[MESA_FORMAT_XBGR16161616_UINT] = NULL; - table[MESA_FORMAT_XBGR16161616_SINT] = NULL; - table[MESA_FORMAT_XBGR32323232_FLOAT] = NULL; - table[MESA_FORMAT_XBGR32323232_UINT] = NULL; - table[MESA_FORMAT_XBGR32323232_SINT] = NULL; - - table[MESA_FORMAT_ABGR2101010] = pack_ubyte_ABGR2101010; + table[MESA_FORMAT_R_SNORM8] = NULL; + table[MESA_FORMAT_R8G8_SNORM] = NULL; + table[MESA_FORMAT_X8B8G8R8_SNORM] = NULL; + table[MESA_FORMAT_A8B8G8R8_SNORM] = NULL; + table[MESA_FORMAT_R8G8B8A8_SNORM] = NULL; + table[MESA_FORMAT_R_SNORM16] = NULL; + table[MESA_FORMAT_R16G16_SNORM] = NULL; + table[MESA_FORMAT_RGB_SNORM16] = NULL; + table[MESA_FORMAT_RGBA_SNORM16] = NULL; + table[MESA_FORMAT_A_SNORM8] = NULL; + table[MESA_FORMAT_L_SNORM8] = NULL; + table[MESA_FORMAT_L8A8_SNORM] = NULL; + table[MESA_FORMAT_I_SNORM8] = NULL; + table[MESA_FORMAT_A_SNORM16] = NULL; + table[MESA_FORMAT_L_SNORM16] = NULL; + table[MESA_FORMAT_LA_SNORM16] = NULL; + table[MESA_FORMAT_I_SNORM16] = NULL; + + + table[MESA_FORMAT_RGBA_UNORM16] = pack_ubyte_RGBA_16; + + table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_ubyte_RGB9_E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = pack_ubyte_R11_G11_B10_FLOAT; + + table[MESA_FORMAT_B4G4R4X4_UNORM] = pack_ubyte_XRGB4444_UNORM; + table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_ubyte_XRGB1555_UNORM; + table[MESA_FORMAT_R8G8B8X8_SNORM] = NULL; + table[MESA_FORMAT_R8G8B8X8_SRGB] = NULL; + table[MESA_FORMAT_RGBX_UINT8] = NULL; + table[MESA_FORMAT_RGBX_SINT8] = NULL; + table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_ubyte_XRGB2101010_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = pack_ubyte_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT16] = NULL; + table[MESA_FORMAT_RGBX_UINT16] = NULL; + table[MESA_FORMAT_RGBX_SINT16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT32] = NULL; + table[MESA_FORMAT_RGBX_UINT32] = NULL; + table[MESA_FORMAT_RGBX_SINT32] = NULL; + + table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_ubyte_ABGR2101010; initialized = GL_TRUE; } @@ -2042,7 +2046,7 @@ _mesa_get_pack_ubyte_rgba_function(gl_format format) * Return a function that can pack a GLfloat rgba[4] color. */ gl_pack_float_rgba_func -_mesa_get_pack_float_rgba_function(gl_format format) +_mesa_get_pack_float_rgba_function(mesa_format format) { static gl_pack_float_rgba_func table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -2052,61 +2056,61 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_RGBA8888] = pack_float_RGBA8888; - table[MESA_FORMAT_RGBA8888_REV] = pack_float_RGBA8888_REV; - table[MESA_FORMAT_ARGB8888] = pack_float_ARGB8888; - table[MESA_FORMAT_ARGB8888_REV] = pack_float_ARGB8888_REV; - table[MESA_FORMAT_RGBX8888] = pack_float_RGBA8888; /* reused */ - table[MESA_FORMAT_RGBX8888_REV] = pack_float_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_XRGB8888] = pack_float_XRGB8888; - table[MESA_FORMAT_XRGB8888_REV] = pack_float_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_float_RGB888; - table[MESA_FORMAT_BGR888] = pack_float_BGR888; - table[MESA_FORMAT_RGB565] = pack_float_RGB565; - table[MESA_FORMAT_RGB565_REV] = pack_float_RGB565_REV; - table[MESA_FORMAT_ARGB4444] = pack_float_ARGB4444; - table[MESA_FORMAT_ARGB4444_REV] = pack_float_ARGB4444_REV; - table[MESA_FORMAT_RGBA5551] = pack_float_RGBA5551; - table[MESA_FORMAT_ARGB1555] = pack_float_ARGB1555; - table[MESA_FORMAT_ARGB1555_REV] = pack_float_ARGB1555_REV; - - table[MESA_FORMAT_AL44] = pack_float_AL44; - table[MESA_FORMAT_AL88] = pack_float_AL88; - table[MESA_FORMAT_AL88_REV] = pack_float_AL88_REV; - table[MESA_FORMAT_AL1616] = pack_float_AL1616; - table[MESA_FORMAT_AL1616_REV] = pack_float_AL1616_REV; - table[MESA_FORMAT_RGB332] = pack_float_RGB332; - table[MESA_FORMAT_A8] = pack_float_A8; - table[MESA_FORMAT_A16] = pack_float_A16; - table[MESA_FORMAT_L8] = pack_float_L8; - table[MESA_FORMAT_L16] = pack_float_L16; - table[MESA_FORMAT_I8] = pack_float_L8; /* reuse pack_float_L8 */ - table[MESA_FORMAT_I16] = pack_float_L16; /* reuse pack_float_L16 */ + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_float_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_float_RGBA8888_REV; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_float_ARGB8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_float_ARGB8888_REV; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_float_RGBA8888; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_float_RGBA8888_REV; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_float_XRGB8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_float_XRGB8888_REV; + table[MESA_FORMAT_BGR_UNORM8] = pack_float_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_float_BGR888; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_float_RGB565; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_float_RGB565_REV; + table[MESA_FORMAT_B4G4R4A4_UNORM] = pack_float_ARGB4444; + table[MESA_FORMAT_A4R4G4B4_UNORM] = pack_float_ARGB4444_REV; + table[MESA_FORMAT_A1B5G5R5_UNORM] = pack_float_RGBA5551; + table[MESA_FORMAT_B5G5R5A1_UNORM] = pack_float_ARGB1555; + table[MESA_FORMAT_A1R5G5B5_UNORM] = pack_float_ARGB1555_REV; + + table[MESA_FORMAT_L4A4_UNORM] = pack_float_AL44; + table[MESA_FORMAT_L8A8_UNORM] = pack_float_AL88; + table[MESA_FORMAT_A8L8_UNORM] = pack_float_AL88_REV; + table[MESA_FORMAT_L16A16_UNORM] = pack_float_AL1616; + table[MESA_FORMAT_A16L16_UNORM] = pack_float_AL1616_REV; + table[MESA_FORMAT_B2G3R3_UNORM] = pack_float_RGB332; + table[MESA_FORMAT_A_UNORM8] = pack_float_A8; + table[MESA_FORMAT_A_UNORM16] = pack_float_A16; + table[MESA_FORMAT_L_UNORM8] = pack_float_L8; + table[MESA_FORMAT_L_UNORM16] = pack_float_L16; + table[MESA_FORMAT_I_UNORM8] = pack_float_L8; /* reuse pack_float_L8 */ + table[MESA_FORMAT_I_UNORM16] = pack_float_L16; /* reuse pack_float_L16 */ table[MESA_FORMAT_YCBCR] = pack_float_YCBCR; table[MESA_FORMAT_YCBCR_REV] = pack_float_YCBCR_REV; - table[MESA_FORMAT_R8] = pack_float_R8; - table[MESA_FORMAT_GR88] = pack_float_GR88; - table[MESA_FORMAT_RG88] = pack_float_RG88; - table[MESA_FORMAT_R16] = pack_float_R16; - table[MESA_FORMAT_GR1616] = pack_float_GR1616; - table[MESA_FORMAT_RG1616] = pack_float_RG1616; - table[MESA_FORMAT_ARGB2101010] = pack_float_ARGB2101010; - table[MESA_FORMAT_ABGR2101010_UINT] = pack_float_ABGR2101010_UINT; + table[MESA_FORMAT_R_UNORM8] = pack_float_R8; + table[MESA_FORMAT_R8G8_UNORM] = pack_float_GR88; + table[MESA_FORMAT_G8R8_UNORM] = pack_float_RG88; + table[MESA_FORMAT_R_UNORM16] = pack_float_R16; + table[MESA_FORMAT_R16G16_UNORM] = pack_float_GR1616; + table[MESA_FORMAT_G16R16_UNORM] = pack_float_RG1616; + table[MESA_FORMAT_B10G10R10A2_UNORM] = pack_float_ARGB2101010; + table[MESA_FORMAT_R10G10B10A2_UINT] = pack_float_ABGR2101010_UINT; /* should never convert RGBA to these formats */ - table[MESA_FORMAT_Z24_S8] = NULL; - table[MESA_FORMAT_S8_Z24] = NULL; - table[MESA_FORMAT_Z16] = NULL; - table[MESA_FORMAT_X8_Z24] = NULL; - table[MESA_FORMAT_Z24_X8] = NULL; - table[MESA_FORMAT_Z32] = NULL; - table[MESA_FORMAT_S8] = NULL; - - table[MESA_FORMAT_SRGB8] = pack_float_SRGB8; - table[MESA_FORMAT_SRGBA8] = pack_float_SRGBA8; - table[MESA_FORMAT_SARGB8] = pack_float_SARGB8; - table[MESA_FORMAT_SL8] = pack_float_SL8; - table[MESA_FORMAT_SLA8] = pack_float_SLA8; + table[MESA_FORMAT_S8_UINT_Z24_UNORM] = NULL; + table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; + table[MESA_FORMAT_Z_UNORM16] = NULL; + table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; + table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_Z_UNORM32] = NULL; + table[MESA_FORMAT_S_UINT8] = NULL; + + table[MESA_FORMAT_BGR_SRGB8] = pack_float_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = pack_float_SRGBA8; + table[MESA_FORMAT_B8G8R8A8_SRGB] = pack_float_SARGB8; + table[MESA_FORMAT_L_SRGB8] = pack_float_SL8; + table[MESA_FORMAT_L8A8_SRGB] = pack_float_SLA8; /* n/a */ table[MESA_FORMAT_SRGB_DXT1] = NULL; @@ -2125,73 +2129,73 @@ _mesa_get_pack_float_rgba_function(gl_format format) table[MESA_FORMAT_RGBA_FLOAT16] = pack_float_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = pack_float_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = pack_float_RGB_FLOAT16; - table[MESA_FORMAT_ALPHA_FLOAT32] = pack_float_ALPHA_FLOAT32; - table[MESA_FORMAT_ALPHA_FLOAT16] = pack_float_ALPHA_FLOAT16; - table[MESA_FORMAT_LUMINANCE_FLOAT32] = pack_float_LUMINANCE_FLOAT32; - table[MESA_FORMAT_LUMINANCE_FLOAT16] = pack_float_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = pack_float_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = pack_float_LUMINANCE_ALPHA_FLOAT16; - - table[MESA_FORMAT_INTENSITY_FLOAT32] = pack_float_LUMINANCE_FLOAT32; - table[MESA_FORMAT_INTENSITY_FLOAT16] = pack_float_LUMINANCE_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = pack_float_ALPHA_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = pack_float_ALPHA_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = pack_float_LUMINANCE_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = pack_float_LUMINANCE_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = pack_float_LUMINANCE_ALPHA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = pack_float_LUMINANCE_ALPHA_FLOAT16; + + table[MESA_FORMAT_I_FLOAT32] = pack_float_LUMINANCE_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = pack_float_LUMINANCE_FLOAT16; table[MESA_FORMAT_R_FLOAT32] = pack_float_LUMINANCE_FLOAT32; table[MESA_FORMAT_R_FLOAT16] = pack_float_LUMINANCE_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = pack_float_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = pack_float_RG_FLOAT16; /* n/a */ - table[MESA_FORMAT_RGBA_INT8] = NULL; - table[MESA_FORMAT_RGBA_INT16] = NULL; - table[MESA_FORMAT_RGBA_INT32] = NULL; + table[MESA_FORMAT_RGBA_SINT8] = NULL; + table[MESA_FORMAT_RGBA_SINT16] = NULL; + table[MESA_FORMAT_RGBA_SINT32] = NULL; table[MESA_FORMAT_RGBA_UINT8] = NULL; table[MESA_FORMAT_RGBA_UINT16] = NULL; table[MESA_FORMAT_RGBA_UINT32] = NULL; table[MESA_FORMAT_DUDV8] = pack_float_DUDV8; - table[MESA_FORMAT_RGBA_16] = pack_float_RGBA_16; - - table[MESA_FORMAT_SIGNED_R8] = pack_float_SIGNED_R8; - table[MESA_FORMAT_SIGNED_RG88_REV] = pack_float_SIGNED_RG88_REV; - table[MESA_FORMAT_SIGNED_RGBX8888] = pack_float_SIGNED_RGBX8888; - table[MESA_FORMAT_SIGNED_RGBA8888] = pack_float_SIGNED_RGBA8888; - table[MESA_FORMAT_SIGNED_RGBA8888_REV] = pack_float_SIGNED_RGBA8888_REV; - table[MESA_FORMAT_SIGNED_R16] = pack_float_SIGNED_R16; - table[MESA_FORMAT_SIGNED_GR1616] = pack_float_SIGNED_GR1616; - table[MESA_FORMAT_SIGNED_RGB_16] = pack_float_SIGNED_RGB_16; - table[MESA_FORMAT_SIGNED_RGBA_16] = pack_float_SIGNED_RGBA_16; - table[MESA_FORMAT_SIGNED_A8] = pack_float_SIGNED_A8; - table[MESA_FORMAT_SIGNED_L8] = pack_float_SIGNED_L8; - table[MESA_FORMAT_SIGNED_AL88] = pack_float_SIGNED_AL88; - table[MESA_FORMAT_SIGNED_I8] = pack_float_SIGNED_L8; /* reused */ - table[MESA_FORMAT_SIGNED_A16] = pack_float_SIGNED_A16; - table[MESA_FORMAT_SIGNED_L16] = pack_float_SIGNED_L16; - table[MESA_FORMAT_SIGNED_AL1616] = pack_float_SIGNED_AL1616; - table[MESA_FORMAT_SIGNED_I16] = pack_float_SIGNED_L16; /* reused */ - - table[MESA_FORMAT_RGB9_E5_FLOAT] = pack_float_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11_G11_B10_FLOAT] = pack_float_R11_G11_B10_FLOAT; - - table[MESA_FORMAT_XRGB4444_UNORM] = pack_float_XRGB4444_UNORM; - table[MESA_FORMAT_XRGB1555_UNORM] = pack_float_XRGB1555_UNORM; - table[MESA_FORMAT_XBGR8888_SNORM] = pack_float_XBGR8888_SNORM; - table[MESA_FORMAT_XBGR8888_SRGB] = pack_float_XBGR8888_SRGB; - table[MESA_FORMAT_XBGR8888_UINT] = NULL; - table[MESA_FORMAT_XBGR8888_SINT] = NULL; - table[MESA_FORMAT_XRGB2101010_UNORM] = pack_float_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = pack_float_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = pack_float_XBGR16161616_SNORM; - table[MESA_FORMAT_XBGR16161616_FLOAT] = pack_float_XBGR16161616_FLOAT; - table[MESA_FORMAT_XBGR16161616_UINT] = NULL; - table[MESA_FORMAT_XBGR16161616_SINT] = NULL; - table[MESA_FORMAT_XBGR32323232_FLOAT] = pack_float_XBGR32323232_FLOAT; - table[MESA_FORMAT_XBGR32323232_UINT] = NULL; - table[MESA_FORMAT_XBGR32323232_SINT] = NULL; - - table[MESA_FORMAT_ABGR2101010] = pack_float_ABGR2101010; - - table[MESA_FORMAT_SIGNED_RG88] = pack_float_SIGNED_RG88; - table[MESA_FORMAT_SIGNED_RG1616] = pack_float_SIGNED_RG1616; + table[MESA_FORMAT_RGBA_UNORM16] = pack_float_RGBA_16; + + table[MESA_FORMAT_R_SNORM8] = pack_float_SIGNED_R8; + table[MESA_FORMAT_R8G8_SNORM] = pack_float_SIGNED_RG88_REV; + table[MESA_FORMAT_X8B8G8R8_SNORM] = pack_float_SIGNED_RGBX8888; + table[MESA_FORMAT_A8B8G8R8_SNORM] = pack_float_SIGNED_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_SNORM] = pack_float_SIGNED_RGBA8888_REV; + table[MESA_FORMAT_R_SNORM16] = pack_float_SIGNED_R16; + table[MESA_FORMAT_R16G16_SNORM] = pack_float_SIGNED_GR1616; + table[MESA_FORMAT_RGB_SNORM16] = pack_float_SIGNED_RGB_16; + table[MESA_FORMAT_RGBA_SNORM16] = pack_float_SIGNED_RGBA_16; + table[MESA_FORMAT_A_SNORM8] = pack_float_SIGNED_A8; + table[MESA_FORMAT_L_SNORM8] = pack_float_SIGNED_L8; + table[MESA_FORMAT_L8A8_SNORM] = pack_float_SIGNED_AL88; + table[MESA_FORMAT_I_SNORM8] = pack_float_SIGNED_L8; /* reused */ + table[MESA_FORMAT_A_SNORM16] = pack_float_SIGNED_A16; + table[MESA_FORMAT_L_SNORM16] = pack_float_SIGNED_L16; + table[MESA_FORMAT_LA_SNORM16] = pack_float_SIGNED_AL1616; + table[MESA_FORMAT_I_SNORM16] = pack_float_SIGNED_L16; /* reused */ + + table[MESA_FORMAT_R9G9B9E5_FLOAT] = pack_float_RGB9_E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = pack_float_R11_G11_B10_FLOAT; + + table[MESA_FORMAT_B4G4R4X4_UNORM] = pack_float_XRGB4444_UNORM; + table[MESA_FORMAT_B5G5R5X1_UNORM] = pack_float_XRGB1555_UNORM; + table[MESA_FORMAT_R8G8B8X8_SNORM] = pack_float_XBGR8888_SNORM; + table[MESA_FORMAT_R8G8B8X8_SRGB] = pack_float_XBGR8888_SRGB; + table[MESA_FORMAT_RGBX_UINT8] = NULL; + table[MESA_FORMAT_RGBX_SINT8] = NULL; + table[MESA_FORMAT_B10G10R10X2_UNORM] = pack_float_XRGB2101010_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = pack_float_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = pack_float_XBGR16161616_SNORM; + table[MESA_FORMAT_RGBX_FLOAT16] = pack_float_XBGR16161616_FLOAT; + table[MESA_FORMAT_RGBX_UINT16] = NULL; + table[MESA_FORMAT_RGBX_SINT16] = NULL; + table[MESA_FORMAT_RGBX_FLOAT32] = pack_float_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_UINT32] = NULL; + table[MESA_FORMAT_RGBX_SINT32] = NULL; + + table[MESA_FORMAT_R10G10B10A2_UNORM] = pack_float_ABGR2101010; + + table[MESA_FORMAT_G8R8_SNORM] = pack_float_SIGNED_RG88; + table[MESA_FORMAT_G16R16_SNORM] = pack_float_SIGNED_RG1616; initialized = GL_TRUE; } @@ -2202,7 +2206,7 @@ _mesa_get_pack_float_rgba_function(gl_format format) static pack_float_rgba_row_func -get_pack_float_rgba_row_function(gl_format format) +get_pack_float_rgba_row_function(mesa_format format) { static pack_float_rgba_row_func table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -2213,18 +2217,18 @@ get_pack_float_rgba_row_function(gl_format format) */ memset(table, 0, sizeof(table)); - table[MESA_FORMAT_RGBA8888] = pack_row_float_RGBA8888; - table[MESA_FORMAT_RGBA8888_REV] = pack_row_float_RGBA8888_REV; - table[MESA_FORMAT_ARGB8888] = pack_row_float_ARGB8888; - table[MESA_FORMAT_ARGB8888_REV] = pack_row_float_ARGB8888_REV; - table[MESA_FORMAT_RGBX8888] = pack_row_float_RGBA8888; /* reused */ - table[MESA_FORMAT_RGBX8888_REV] = pack_row_float_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_XRGB8888] = pack_row_float_XRGB8888; - table[MESA_FORMAT_XRGB8888_REV] = pack_row_float_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_row_float_RGB888; - table[MESA_FORMAT_BGR888] = pack_row_float_BGR888; - table[MESA_FORMAT_RGB565] = pack_row_float_RGB565; - table[MESA_FORMAT_RGB565_REV] = pack_row_float_RGB565_REV; + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_float_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_float_RGBA8888_REV; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_float_ARGB8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_float_ARGB8888_REV; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_float_RGBA8888; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_float_RGBA8888_REV; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_float_XRGB8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_float_XRGB8888_REV; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_float_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_float_BGR888; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_float_RGB565; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_float_RGB565_REV; initialized = GL_TRUE; } @@ -2235,7 +2239,7 @@ get_pack_float_rgba_row_function(gl_format format) static pack_ubyte_rgba_row_func -get_pack_ubyte_rgba_row_function(gl_format format) +get_pack_ubyte_rgba_row_function(mesa_format format) { static pack_ubyte_rgba_row_func table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -2246,18 +2250,18 @@ get_pack_ubyte_rgba_row_function(gl_format format) */ memset(table, 0, sizeof(table)); - table[MESA_FORMAT_RGBA8888] = pack_row_ubyte_RGBA8888; - table[MESA_FORMAT_RGBA8888_REV] = pack_row_ubyte_RGBA8888_REV; - table[MESA_FORMAT_ARGB8888] = pack_row_ubyte_ARGB8888; - table[MESA_FORMAT_ARGB8888_REV] = pack_row_ubyte_ARGB8888_REV; - table[MESA_FORMAT_RGBX8888] = pack_row_ubyte_RGBA8888; /* reused */ - table[MESA_FORMAT_RGBX8888_REV] = pack_row_ubyte_RGBA8888_REV; /* reused */ - table[MESA_FORMAT_XRGB8888] = pack_row_ubyte_XRGB8888; - table[MESA_FORMAT_XRGB8888_REV] = pack_row_ubyte_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = pack_row_ubyte_RGB888; - table[MESA_FORMAT_BGR888] = pack_row_ubyte_BGR888; - table[MESA_FORMAT_RGB565] = pack_row_ubyte_RGB565; - table[MESA_FORMAT_RGB565_REV] = pack_row_ubyte_RGB565_REV; + table[MESA_FORMAT_A8B8G8R8_UNORM] = pack_row_ubyte_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = pack_row_ubyte_RGBA8888_REV; + table[MESA_FORMAT_B8G8R8A8_UNORM] = pack_row_ubyte_ARGB8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = pack_row_ubyte_ARGB8888_REV; + table[MESA_FORMAT_X8B8G8R8_UNORM] = pack_row_ubyte_RGBA8888; /* reused */ + table[MESA_FORMAT_R8G8B8X8_UNORM] = pack_row_ubyte_RGBA8888_REV; /* reused */ + table[MESA_FORMAT_B8G8R8X8_UNORM] = pack_row_ubyte_XRGB8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = pack_row_ubyte_XRGB8888_REV; + table[MESA_FORMAT_BGR_UNORM8] = pack_row_ubyte_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = pack_row_ubyte_BGR888; + table[MESA_FORMAT_B5G6R5_UNORM] = pack_row_ubyte_RGB565; + table[MESA_FORMAT_R5G6B5_UNORM] = pack_row_ubyte_RGB565_REV; initialized = GL_TRUE; } @@ -2271,7 +2275,7 @@ get_pack_ubyte_rgba_row_function(gl_format format) * Pack a row of GLfloat rgba[4] values to the destination. */ void -_mesa_pack_float_rgba_row(gl_format format, GLuint n, +_mesa_pack_float_rgba_row(mesa_format format, GLuint n, const GLfloat src[][4], void *dst) { pack_float_rgba_row_func packrow = get_pack_float_rgba_row_function(format); @@ -2302,7 +2306,7 @@ _mesa_pack_float_rgba_row(gl_format format, GLuint n, * Pack a row of GLubyte rgba[4] values to the destination. */ void -_mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, +_mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, const GLubyte src[][4], void *dst) { pack_ubyte_rgba_row_func packrow = get_pack_ubyte_rgba_row_function(format); @@ -2335,7 +2339,7 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, * \param dstRowStride destination image row stride in bytes */ void -_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height, +_mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, const GLubyte *src, GLint srcRowStride, void *dst, GLint dstRowStride) { @@ -2423,21 +2427,21 @@ pack_float_z_Z32_FLOAT(const GLfloat *src, void *dst) } gl_pack_float_z_func -_mesa_get_pack_float_z_func(gl_format format) +_mesa_get_pack_float_z_func(mesa_format format) { switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: return pack_float_z_Z24_S8; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: return pack_float_z_S8_Z24; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return pack_float_z_Z16; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return pack_float_z_Z32; - case MESA_FORMAT_Z32_FLOAT: - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z_FLOAT32: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_float_z_Z32_FLOAT; default: _mesa_problem(NULL, @@ -2508,22 +2512,22 @@ pack_uint_z_Z32_FLOAT_X24S8(const GLuint *src, void *dst) } gl_pack_uint_z_func -_mesa_get_pack_uint_z_func(gl_format format) +_mesa_get_pack_uint_z_func(mesa_format format) { switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: return pack_uint_z_Z24_S8; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: return pack_uint_z_S8_Z24; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return pack_uint_z_Z16; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return pack_uint_z_Z32; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return pack_uint_z_Z32_FLOAT; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_uint_z_Z32_FLOAT_X24S8; default: _mesa_problem(NULL, "unexpected format in _mesa_get_pack_uint_z_func()"); @@ -2572,16 +2576,16 @@ pack_ubyte_stencil_Z32_FLOAT_X24S8(const GLubyte *src, void *dst) gl_pack_ubyte_stencil_func -_mesa_get_pack_ubyte_stencil_func(gl_format format) +_mesa_get_pack_ubyte_stencil_func(mesa_format format) { switch (format) { - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: return pack_ubyte_stencil_Z24_S8; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: return pack_ubyte_stencil_S8_Z24; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return pack_ubyte_stencil_S8; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return pack_ubyte_stencil_Z32_FLOAT_X24S8; default: _mesa_problem(NULL, @@ -2593,12 +2597,12 @@ _mesa_get_pack_ubyte_stencil_func(gl_format format) void -_mesa_pack_float_z_row(gl_format format, GLuint n, +_mesa_pack_float_z_row(mesa_format format, GLuint n, const GLfloat *src, void *dst) { switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2612,8 +2616,8 @@ _mesa_pack_float_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2627,7 +2631,7 @@ _mesa_pack_float_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLushort *d = ((GLushort *) dst); const GLfloat scale = (GLfloat) 0xffff; @@ -2637,7 +2641,7 @@ _mesa_pack_float_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: { GLuint *d = ((GLuint *) dst); const GLdouble scale = (GLdouble) 0xffffffff; @@ -2647,10 +2651,10 @@ _mesa_pack_float_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: memcpy(dst, src, n * sizeof(GLfloat)); break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; GLuint i; @@ -2669,12 +2673,12 @@ _mesa_pack_float_z_row(gl_format format, GLuint n, * The incoming Z values are always in the range [0, 0xffffffff]. */ void -_mesa_pack_uint_z_row(gl_format format, GLuint n, +_mesa_pack_uint_z_row(mesa_format format, GLuint n, const GLuint *src, void *dst) { switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2686,8 +2690,8 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2699,7 +2703,7 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLushort *d = ((GLushort *) dst); GLuint i; @@ -2708,10 +2712,10 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: memcpy(dst, src, n * sizeof(GLfloat)); break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: { GLuint *d = ((GLuint *) dst); const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; @@ -2723,7 +2727,7 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; const GLdouble scale = 1.0 / (GLdouble) 0xffffffff; @@ -2742,11 +2746,11 @@ _mesa_pack_uint_z_row(gl_format format, GLuint n, void -_mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, +_mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, const GLubyte *src, void *dst) { switch (format) { - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: { /* don't disturb the Z values */ GLuint *d = ((GLuint *) dst); @@ -2758,7 +2762,7 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: { /* don't disturb the Z values */ GLuint *d = ((GLuint *) dst); @@ -2770,10 +2774,10 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: memcpy(dst, src, n * sizeof(GLubyte)); break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; GLuint i; @@ -2792,14 +2796,14 @@ _mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, * Incoming Z/stencil values are always in uint_24_8 format. */ void -_mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, +_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const GLuint *src, void *dst) { switch (format) { - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: memcpy(dst, src, n * sizeof(GLuint)); break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: { GLuint *d = ((GLuint *) dst); GLuint i; @@ -2810,7 +2814,7 @@ _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, } } break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: { const GLdouble scale = 1.0 / (GLdouble) 0xffffff; struct z32f_x24s8 *d = (struct z32f_x24s8 *) dst; @@ -2836,7 +2840,7 @@ _mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, * the packed value at dst will be 0 or ~0 depending on the colorMask. */ void -_mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst) +_mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst) { GLfloat maskColor[4]; diff --git a/mesalib/src/mesa/main/format_pack.h b/mesalib/src/mesa/main/format_pack.h index ebd103d03..2577def41 100644 --- a/mesalib/src/mesa/main/format_pack.h +++ b/mesalib/src/mesa/main/format_pack.h @@ -49,58 +49,58 @@ typedef void (*gl_pack_ubyte_stencil_func)(const GLubyte *src, void *dst); extern gl_pack_ubyte_rgba_func -_mesa_get_pack_ubyte_rgba_function(gl_format format); +_mesa_get_pack_ubyte_rgba_function(mesa_format format); extern gl_pack_float_rgba_func -_mesa_get_pack_float_rgba_function(gl_format format); +_mesa_get_pack_float_rgba_function(mesa_format format); extern gl_pack_float_z_func -_mesa_get_pack_float_z_func(gl_format format); +_mesa_get_pack_float_z_func(mesa_format format); extern gl_pack_uint_z_func -_mesa_get_pack_uint_z_func(gl_format format); +_mesa_get_pack_uint_z_func(mesa_format format); extern gl_pack_ubyte_stencil_func -_mesa_get_pack_ubyte_stencil_func(gl_format format); +_mesa_get_pack_ubyte_stencil_func(mesa_format format); extern void -_mesa_pack_float_rgba_row(gl_format format, GLuint n, +_mesa_pack_float_rgba_row(mesa_format format, GLuint n, const GLfloat src[][4], void *dst); extern void -_mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, +_mesa_pack_ubyte_rgba_row(mesa_format format, GLuint n, const GLubyte src[][4], void *dst); extern void -_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height, +_mesa_pack_ubyte_rgba_rect(mesa_format format, GLuint width, GLuint height, const GLubyte *src, GLint srcRowStride, void *dst, GLint dstRowStride); extern void -_mesa_pack_float_z_row(gl_format format, GLuint n, +_mesa_pack_float_z_row(mesa_format format, GLuint n, const GLfloat *src, void *dst); extern void -_mesa_pack_uint_z_row(gl_format format, GLuint n, +_mesa_pack_uint_z_row(mesa_format format, GLuint n, const GLuint *src, void *dst); extern void -_mesa_pack_ubyte_stencil_row(gl_format format, GLuint n, +_mesa_pack_ubyte_stencil_row(mesa_format format, GLuint n, const GLubyte *src, void *dst); extern void -_mesa_pack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, +_mesa_pack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const GLuint *src, void *dst); extern void -_mesa_pack_colormask(gl_format format, const GLubyte colorMask[4], void *dst); +_mesa_pack_colormask(mesa_format format, const GLubyte colorMask[4], void *dst); #endif diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 28a50f31e..02ad00a9d 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -30,7 +30,7 @@ #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" -/** Helper struct for MESA_FORMAT_Z32_FLOAT_X24S8 */ +/** Helper struct for MESA_FORMAT_Z32_FLOAT_S8X24_UINT */ struct z32f_x24s8 { float z; @@ -234,6 +234,9 @@ unpack_RGB565(const void *src, GLfloat dst[][4], GLuint n) static void unpack_RGB565_REV(const void *src, GLfloat dst[][4], GLuint n) { + /* Warning: this function does not match the current Mesa definition + * of MESA_FORMAT_R5G6B5_UNORM. + */ const GLushort *s = ((const GLushort *) src); GLuint i; for (i = 0; i < n; i++) { @@ -300,6 +303,9 @@ unpack_ARGB1555(const void *src, GLfloat dst[][4], GLuint n) static void unpack_ARGB1555_REV(const void *src, GLfloat dst[][4], GLuint n) { + /* Warning: this function does not match the current Mesa definition + * of MESA_FORMAT_A1R5G5B5_UNORM. + */ const GLushort *s = ((const GLushort *) src); GLuint i; for (i = 0; i < n; i++) { @@ -2311,7 +2317,7 @@ unpack_SIGNED_RG1616(const void *src, GLfloat dst[][4], GLuint n) * Return the unpacker function for the given format. */ static unpack_rgba_func -get_unpack_rgba_function(gl_format format) +get_unpack_rgba_function(mesa_format format) { static unpack_rgba_func table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -2319,58 +2325,58 @@ get_unpack_rgba_function(gl_format format) if (!initialized) { table[MESA_FORMAT_NONE] = NULL; - table[MESA_FORMAT_RGBA8888] = unpack_RGBA8888; - table[MESA_FORMAT_RGBA8888_REV] = unpack_RGBA8888_REV; - table[MESA_FORMAT_ARGB8888] = unpack_ARGB8888; - table[MESA_FORMAT_ARGB8888_REV] = unpack_ARGB8888_REV; - table[MESA_FORMAT_RGBX8888] = unpack_RGBX8888; - table[MESA_FORMAT_RGBX8888_REV] = unpack_RGBX8888_REV; - table[MESA_FORMAT_XRGB8888] = unpack_XRGB8888; - table[MESA_FORMAT_XRGB8888_REV] = unpack_XRGB8888_REV; - table[MESA_FORMAT_RGB888] = unpack_RGB888; - table[MESA_FORMAT_BGR888] = unpack_BGR888; - table[MESA_FORMAT_RGB565] = unpack_RGB565; - table[MESA_FORMAT_RGB565_REV] = unpack_RGB565_REV; - table[MESA_FORMAT_ARGB4444] = unpack_ARGB4444; - table[MESA_FORMAT_ARGB4444_REV] = unpack_ARGB4444_REV; - table[MESA_FORMAT_RGBA5551] = unpack_RGBA5551; - table[MESA_FORMAT_ARGB1555] = unpack_ARGB1555; - table[MESA_FORMAT_ARGB1555_REV] = unpack_ARGB1555_REV; - table[MESA_FORMAT_AL44] = unpack_AL44; - table[MESA_FORMAT_AL88] = unpack_AL88; - table[MESA_FORMAT_AL88_REV] = unpack_AL88_REV; - table[MESA_FORMAT_AL1616] = unpack_AL1616; - table[MESA_FORMAT_AL1616_REV] = unpack_AL1616_REV; - table[MESA_FORMAT_RGB332] = unpack_RGB332; - table[MESA_FORMAT_A8] = unpack_A8; - table[MESA_FORMAT_A16] = unpack_A16; - table[MESA_FORMAT_L8] = unpack_L8; - table[MESA_FORMAT_L16] = unpack_L16; - table[MESA_FORMAT_I8] = unpack_I8; - table[MESA_FORMAT_I16] = unpack_I16; + table[MESA_FORMAT_A8B8G8R8_UNORM] = unpack_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = unpack_RGBA8888_REV; + table[MESA_FORMAT_B8G8R8A8_UNORM] = unpack_ARGB8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = unpack_ARGB8888_REV; + table[MESA_FORMAT_X8B8G8R8_UNORM] = unpack_RGBX8888; + table[MESA_FORMAT_R8G8B8X8_UNORM] = unpack_RGBX8888_REV; + table[MESA_FORMAT_B8G8R8X8_UNORM] = unpack_XRGB8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = unpack_XRGB8888_REV; + table[MESA_FORMAT_BGR_UNORM8] = unpack_RGB888; + table[MESA_FORMAT_RGB_UNORM8] = unpack_BGR888; + table[MESA_FORMAT_B5G6R5_UNORM] = unpack_RGB565; + table[MESA_FORMAT_R5G6B5_UNORM] = unpack_RGB565_REV; + table[MESA_FORMAT_B4G4R4A4_UNORM] = unpack_ARGB4444; + table[MESA_FORMAT_A4R4G4B4_UNORM] = unpack_ARGB4444_REV; + table[MESA_FORMAT_A1B5G5R5_UNORM] = unpack_RGBA5551; + table[MESA_FORMAT_B5G5R5A1_UNORM] = unpack_ARGB1555; + table[MESA_FORMAT_A1R5G5B5_UNORM] = unpack_ARGB1555_REV; + table[MESA_FORMAT_L4A4_UNORM] = unpack_AL44; + table[MESA_FORMAT_L8A8_UNORM] = unpack_AL88; + table[MESA_FORMAT_A8L8_UNORM] = unpack_AL88_REV; + table[MESA_FORMAT_L16A16_UNORM] = unpack_AL1616; + table[MESA_FORMAT_A16L16_UNORM] = unpack_AL1616_REV; + table[MESA_FORMAT_B2G3R3_UNORM] = unpack_RGB332; + table[MESA_FORMAT_A_UNORM8] = unpack_A8; + table[MESA_FORMAT_A_UNORM16] = unpack_A16; + table[MESA_FORMAT_L_UNORM8] = unpack_L8; + table[MESA_FORMAT_L_UNORM16] = unpack_L16; + table[MESA_FORMAT_I_UNORM8] = unpack_I8; + table[MESA_FORMAT_I_UNORM16] = unpack_I16; table[MESA_FORMAT_YCBCR] = unpack_YCBCR; table[MESA_FORMAT_YCBCR_REV] = unpack_YCBCR_REV; - table[MESA_FORMAT_R8] = unpack_R8; - table[MESA_FORMAT_GR88] = unpack_GR88; - table[MESA_FORMAT_RG88] = unpack_RG88; - table[MESA_FORMAT_R16] = unpack_R16; - table[MESA_FORMAT_GR1616] = unpack_GR1616; - table[MESA_FORMAT_RG1616] = unpack_RG1616; - table[MESA_FORMAT_ARGB2101010] = unpack_ARGB2101010; - table[MESA_FORMAT_ARGB2101010_UINT] = unpack_ARGB2101010_UINT; - table[MESA_FORMAT_ABGR2101010_UINT] = unpack_ABGR2101010_UINT; - table[MESA_FORMAT_Z24_S8] = unpack_Z24_S8; - table[MESA_FORMAT_S8_Z24] = unpack_S8_Z24; - table[MESA_FORMAT_Z16] = unpack_Z16; - table[MESA_FORMAT_X8_Z24] = unpack_X8_Z24; - table[MESA_FORMAT_Z24_X8] = unpack_Z24_X8; - table[MESA_FORMAT_Z32] = unpack_Z32; - table[MESA_FORMAT_S8] = unpack_S8; - table[MESA_FORMAT_SRGB8] = unpack_SRGB8; - table[MESA_FORMAT_SRGBA8] = unpack_SRGBA8; - table[MESA_FORMAT_SARGB8] = unpack_SARGB8; - table[MESA_FORMAT_SL8] = unpack_SL8; - table[MESA_FORMAT_SLA8] = unpack_SLA8; + table[MESA_FORMAT_R_UNORM8] = unpack_R8; + table[MESA_FORMAT_R8G8_UNORM] = unpack_GR88; + table[MESA_FORMAT_G8R8_UNORM] = unpack_RG88; + table[MESA_FORMAT_R_UNORM16] = unpack_R16; + table[MESA_FORMAT_R16G16_UNORM] = unpack_GR1616; + table[MESA_FORMAT_G16R16_UNORM] = unpack_RG1616; + table[MESA_FORMAT_B10G10R10A2_UNORM] = unpack_ARGB2101010; + table[MESA_FORMAT_B10G10R10A2_UINT] = unpack_ARGB2101010_UINT; + table[MESA_FORMAT_R10G10B10A2_UINT] = unpack_ABGR2101010_UINT; + table[MESA_FORMAT_S8_UINT_Z24_UNORM] = unpack_Z24_S8; + table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_S8_Z24; + table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; + table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_X8_Z24; + table[MESA_FORMAT_X8Z24_UNORM] = unpack_Z24_X8; + table[MESA_FORMAT_Z_UNORM32] = unpack_Z32; + table[MESA_FORMAT_S_UINT8] = unpack_S8; + table[MESA_FORMAT_BGR_SRGB8] = unpack_SRGB8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = unpack_SRGBA8; + table[MESA_FORMAT_B8G8R8A8_SRGB] = unpack_SARGB8; + table[MESA_FORMAT_L_SRGB8] = unpack_SL8; + table[MESA_FORMAT_L8A8_SRGB] = unpack_SLA8; table[MESA_FORMAT_SRGB_DXT1] = unpack_SRGB_DXT1; table[MESA_FORMAT_SRGBA_DXT1] = unpack_SRGBA_DXT1; table[MESA_FORMAT_SRGBA_DXT3] = unpack_SRGBA_DXT3; @@ -2387,59 +2393,59 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_RGBA_FLOAT16] = unpack_RGBA_FLOAT16; table[MESA_FORMAT_RGB_FLOAT32] = unpack_RGB_FLOAT32; table[MESA_FORMAT_RGB_FLOAT16] = unpack_RGB_FLOAT16; - table[MESA_FORMAT_ALPHA_FLOAT32] = unpack_ALPHA_FLOAT32; - table[MESA_FORMAT_ALPHA_FLOAT16] = unpack_ALPHA_FLOAT16; - table[MESA_FORMAT_LUMINANCE_FLOAT32] = unpack_LUMINANCE_FLOAT32; - table[MESA_FORMAT_LUMINANCE_FLOAT16] = unpack_LUMINANCE_FLOAT16; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = unpack_LUMINANCE_ALPHA_FLOAT32; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16; - table[MESA_FORMAT_INTENSITY_FLOAT32] = unpack_INTENSITY_FLOAT32; - table[MESA_FORMAT_INTENSITY_FLOAT16] = unpack_INTENSITY_FLOAT16; + table[MESA_FORMAT_A_FLOAT32] = unpack_ALPHA_FLOAT32; + table[MESA_FORMAT_A_FLOAT16] = unpack_ALPHA_FLOAT16; + table[MESA_FORMAT_L_FLOAT32] = unpack_LUMINANCE_FLOAT32; + table[MESA_FORMAT_L_FLOAT16] = unpack_LUMINANCE_FLOAT16; + table[MESA_FORMAT_LA_FLOAT32] = unpack_LUMINANCE_ALPHA_FLOAT32; + table[MESA_FORMAT_LA_FLOAT16] = unpack_LUMINANCE_ALPHA_FLOAT16; + table[MESA_FORMAT_I_FLOAT32] = unpack_INTENSITY_FLOAT32; + table[MESA_FORMAT_I_FLOAT16] = unpack_INTENSITY_FLOAT16; table[MESA_FORMAT_R_FLOAT32] = unpack_R_FLOAT32; table[MESA_FORMAT_R_FLOAT16] = unpack_R_FLOAT16; table[MESA_FORMAT_RG_FLOAT32] = unpack_RG_FLOAT32; table[MESA_FORMAT_RG_FLOAT16] = unpack_RG_FLOAT16; - table[MESA_FORMAT_ALPHA_UINT8] = unpack_ALPHA_UINT8; - table[MESA_FORMAT_ALPHA_UINT16] = unpack_ALPHA_UINT16; - table[MESA_FORMAT_ALPHA_UINT32] = unpack_ALPHA_UINT32; - table[MESA_FORMAT_ALPHA_INT8] = unpack_ALPHA_INT8; - table[MESA_FORMAT_ALPHA_INT16] = unpack_ALPHA_INT16; - table[MESA_FORMAT_ALPHA_INT32] = unpack_ALPHA_INT32; - - table[MESA_FORMAT_INTENSITY_UINT8] = unpack_INTENSITY_UINT8; - table[MESA_FORMAT_INTENSITY_UINT16] = unpack_INTENSITY_UINT16; - table[MESA_FORMAT_INTENSITY_UINT32] = unpack_INTENSITY_UINT32; - table[MESA_FORMAT_INTENSITY_INT8] = unpack_INTENSITY_INT8; - table[MESA_FORMAT_INTENSITY_INT16] = unpack_INTENSITY_INT16; - table[MESA_FORMAT_INTENSITY_INT32] = unpack_INTENSITY_INT32; - - table[MESA_FORMAT_LUMINANCE_UINT8] = unpack_LUMINANCE_UINT8; - table[MESA_FORMAT_LUMINANCE_UINT16] = unpack_LUMINANCE_UINT16; - table[MESA_FORMAT_LUMINANCE_UINT32] = unpack_LUMINANCE_UINT32; - table[MESA_FORMAT_LUMINANCE_INT8] = unpack_LUMINANCE_INT8; - table[MESA_FORMAT_LUMINANCE_INT16] = unpack_LUMINANCE_INT16; - table[MESA_FORMAT_LUMINANCE_INT32] = unpack_LUMINANCE_INT32; - - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = unpack_LUMINANCE_ALPHA_UINT8; - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = unpack_LUMINANCE_ALPHA_UINT16; - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = unpack_LUMINANCE_ALPHA_UINT32; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT8] = unpack_LUMINANCE_ALPHA_INT8; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT16] = unpack_LUMINANCE_ALPHA_INT16; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT32] = unpack_LUMINANCE_ALPHA_INT32; - - table[MESA_FORMAT_R_INT8] = unpack_R_INT8; - table[MESA_FORMAT_RG_INT8] = unpack_RG_INT8; - table[MESA_FORMAT_RGB_INT8] = unpack_RGB_INT8; - table[MESA_FORMAT_RGBA_INT8] = unpack_RGBA_INT8; - table[MESA_FORMAT_R_INT16] = unpack_R_INT16; - table[MESA_FORMAT_RG_INT16] = unpack_RG_INT16; - table[MESA_FORMAT_RGB_INT16] = unpack_RGB_INT16; - table[MESA_FORMAT_RGBA_INT16] = unpack_RGBA_INT16; - table[MESA_FORMAT_R_INT32] = unpack_R_INT32; - table[MESA_FORMAT_RG_INT32] = unpack_RG_INT32; - table[MESA_FORMAT_RGB_INT32] = unpack_RGB_INT32; - table[MESA_FORMAT_RGBA_INT32] = unpack_RGBA_INT32; + table[MESA_FORMAT_A_UINT8] = unpack_ALPHA_UINT8; + table[MESA_FORMAT_A_UINT16] = unpack_ALPHA_UINT16; + table[MESA_FORMAT_A_UINT32] = unpack_ALPHA_UINT32; + table[MESA_FORMAT_A_SINT8] = unpack_ALPHA_INT8; + table[MESA_FORMAT_A_SINT16] = unpack_ALPHA_INT16; + table[MESA_FORMAT_A_SINT32] = unpack_ALPHA_INT32; + + table[MESA_FORMAT_I_UINT8] = unpack_INTENSITY_UINT8; + table[MESA_FORMAT_I_UINT16] = unpack_INTENSITY_UINT16; + table[MESA_FORMAT_I_UINT32] = unpack_INTENSITY_UINT32; + table[MESA_FORMAT_I_SINT8] = unpack_INTENSITY_INT8; + table[MESA_FORMAT_I_SINT16] = unpack_INTENSITY_INT16; + table[MESA_FORMAT_I_SINT32] = unpack_INTENSITY_INT32; + + table[MESA_FORMAT_L_UINT8] = unpack_LUMINANCE_UINT8; + table[MESA_FORMAT_L_UINT16] = unpack_LUMINANCE_UINT16; + table[MESA_FORMAT_L_UINT32] = unpack_LUMINANCE_UINT32; + table[MESA_FORMAT_L_SINT8] = unpack_LUMINANCE_INT8; + table[MESA_FORMAT_L_SINT16] = unpack_LUMINANCE_INT16; + table[MESA_FORMAT_L_SINT32] = unpack_LUMINANCE_INT32; + + table[MESA_FORMAT_LA_UINT8] = unpack_LUMINANCE_ALPHA_UINT8; + table[MESA_FORMAT_LA_UINT16] = unpack_LUMINANCE_ALPHA_UINT16; + table[MESA_FORMAT_LA_UINT32] = unpack_LUMINANCE_ALPHA_UINT32; + table[MESA_FORMAT_LA_SINT8] = unpack_LUMINANCE_ALPHA_INT8; + table[MESA_FORMAT_LA_SINT16] = unpack_LUMINANCE_ALPHA_INT16; + table[MESA_FORMAT_LA_SINT32] = unpack_LUMINANCE_ALPHA_INT32; + + table[MESA_FORMAT_R_SINT8] = unpack_R_INT8; + table[MESA_FORMAT_RG_SINT8] = unpack_RG_INT8; + table[MESA_FORMAT_RGB_SINT8] = unpack_RGB_INT8; + table[MESA_FORMAT_RGBA_SINT8] = unpack_RGBA_INT8; + table[MESA_FORMAT_R_SINT16] = unpack_R_INT16; + table[MESA_FORMAT_RG_SINT16] = unpack_RG_INT16; + table[MESA_FORMAT_RGB_SINT16] = unpack_RGB_INT16; + table[MESA_FORMAT_RGBA_SINT16] = unpack_RGBA_INT16; + table[MESA_FORMAT_R_SINT32] = unpack_R_INT32; + table[MESA_FORMAT_RG_SINT32] = unpack_RG_INT32; + table[MESA_FORMAT_RGB_SINT32] = unpack_RGB_INT32; + table[MESA_FORMAT_RGBA_SINT32] = unpack_RGBA_INT32; table[MESA_FORMAT_R_UINT8] = unpack_R_UINT8; table[MESA_FORMAT_RG_UINT8] = unpack_RG_UINT8; table[MESA_FORMAT_RGB_UINT8] = unpack_RGB_UINT8; @@ -2454,26 +2460,26 @@ get_unpack_rgba_function(gl_format format) table[MESA_FORMAT_RGBA_UINT32] = unpack_RGBA_UINT32; table[MESA_FORMAT_DUDV8] = unpack_DUDV8; - table[MESA_FORMAT_SIGNED_R8] = unpack_SIGNED_R8; - table[MESA_FORMAT_SIGNED_RG88_REV] = unpack_SIGNED_RG88_REV; - table[MESA_FORMAT_SIGNED_RGBX8888] = unpack_SIGNED_RGBX8888; - table[MESA_FORMAT_SIGNED_RGBA8888] = unpack_SIGNED_RGBA8888; - table[MESA_FORMAT_SIGNED_RGBA8888_REV] = unpack_SIGNED_RGBA8888_REV; - table[MESA_FORMAT_SIGNED_R16] = unpack_SIGNED_R16; - table[MESA_FORMAT_SIGNED_GR1616] = unpack_SIGNED_GR1616; - table[MESA_FORMAT_SIGNED_RGB_16] = unpack_SIGNED_RGB_16; - table[MESA_FORMAT_SIGNED_RGBA_16] = unpack_SIGNED_RGBA_16; - table[MESA_FORMAT_RGBA_16] = unpack_RGBA_16; - - table[MESA_FORMAT_RED_RGTC1] = unpack_RED_RGTC1; - table[MESA_FORMAT_SIGNED_RED_RGTC1] = unpack_SIGNED_RED_RGTC1; - table[MESA_FORMAT_RG_RGTC2] = unpack_RG_RGTC2; - table[MESA_FORMAT_SIGNED_RG_RGTC2] = unpack_SIGNED_RG_RGTC2; - - table[MESA_FORMAT_L_LATC1] = unpack_L_LATC1; - table[MESA_FORMAT_SIGNED_L_LATC1] = unpack_SIGNED_L_LATC1; - table[MESA_FORMAT_LA_LATC2] = unpack_LA_LATC2; - table[MESA_FORMAT_SIGNED_LA_LATC2] = unpack_SIGNED_LA_LATC2; + table[MESA_FORMAT_R_SNORM8] = unpack_SIGNED_R8; + table[MESA_FORMAT_R8G8_SNORM] = unpack_SIGNED_RG88_REV; + table[MESA_FORMAT_X8B8G8R8_SNORM] = unpack_SIGNED_RGBX8888; + table[MESA_FORMAT_A8B8G8R8_SNORM] = unpack_SIGNED_RGBA8888; + table[MESA_FORMAT_R8G8B8A8_SNORM] = unpack_SIGNED_RGBA8888_REV; + table[MESA_FORMAT_R_SNORM16] = unpack_SIGNED_R16; + table[MESA_FORMAT_R16G16_SNORM] = unpack_SIGNED_GR1616; + table[MESA_FORMAT_RGB_SNORM16] = unpack_SIGNED_RGB_16; + table[MESA_FORMAT_RGBA_SNORM16] = unpack_SIGNED_RGBA_16; + table[MESA_FORMAT_RGBA_UNORM16] = unpack_RGBA_16; + + table[MESA_FORMAT_R_RGTC1_UNORM] = unpack_RED_RGTC1; + table[MESA_FORMAT_R_RGTC1_SNORM] = unpack_SIGNED_RED_RGTC1; + table[MESA_FORMAT_RG_RGTC2_UNORM] = unpack_RG_RGTC2; + table[MESA_FORMAT_RG_RGTC2_SNORM] = unpack_SIGNED_RG_RGTC2; + + table[MESA_FORMAT_L_LATC1_UNORM] = unpack_L_LATC1; + table[MESA_FORMAT_L_LATC1_SNORM] = unpack_SIGNED_L_LATC1; + table[MESA_FORMAT_LA_LATC2_UNORM] = unpack_LA_LATC2; + table[MESA_FORMAT_LA_LATC2_SNORM] = unpack_SIGNED_LA_LATC2; table[MESA_FORMAT_ETC1_RGB8] = unpack_ETC1_RGB8; table[MESA_FORMAT_ETC2_RGB8] = unpack_ETC2_RGB8; @@ -2488,41 +2494,41 @@ get_unpack_rgba_function(gl_format format) unpack_ETC2_RGB8_PUNCHTHROUGH_ALPHA1; table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] = unpack_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1; - table[MESA_FORMAT_SIGNED_A8] = unpack_SIGNED_A8; - table[MESA_FORMAT_SIGNED_L8] = unpack_SIGNED_L8; - table[MESA_FORMAT_SIGNED_AL88] = unpack_SIGNED_AL88; - table[MESA_FORMAT_SIGNED_I8] = unpack_SIGNED_I8; - table[MESA_FORMAT_SIGNED_A16] = unpack_SIGNED_A16; - table[MESA_FORMAT_SIGNED_L16] = unpack_SIGNED_L16; - table[MESA_FORMAT_SIGNED_AL1616] = unpack_SIGNED_AL1616; - table[MESA_FORMAT_SIGNED_I16] = unpack_SIGNED_I16; - - table[MESA_FORMAT_RGB9_E5_FLOAT] = unpack_RGB9_E5_FLOAT; - table[MESA_FORMAT_R11_G11_B10_FLOAT] = unpack_R11_G11_B10_FLOAT; - - table[MESA_FORMAT_Z32_FLOAT] = unpack_Z32_FLOAT; - table[MESA_FORMAT_Z32_FLOAT_X24S8] = unpack_Z32_FLOAT_X24S8; - - table[MESA_FORMAT_XRGB4444_UNORM] = unpack_XRGB4444_UNORM; - table[MESA_FORMAT_XRGB1555_UNORM] = unpack_XRGB1555_UNORM; - table[MESA_FORMAT_XBGR8888_SNORM] = unpack_XBGR8888_SNORM; - table[MESA_FORMAT_XBGR8888_SRGB] = unpack_XBGR8888_SRGB; - table[MESA_FORMAT_XBGR8888_UINT] = unpack_XBGR8888_UINT; - table[MESA_FORMAT_XBGR8888_SINT] = unpack_XBGR8888_SINT; - table[MESA_FORMAT_XRGB2101010_UNORM] = unpack_XRGB2101010_UNORM; - table[MESA_FORMAT_XBGR16161616_UNORM] = unpack_XBGR16161616_UNORM; - table[MESA_FORMAT_XBGR16161616_SNORM] = unpack_XBGR16161616_SNORM; - table[MESA_FORMAT_XBGR16161616_FLOAT] = unpack_XBGR16161616_FLOAT; - table[MESA_FORMAT_XBGR16161616_UINT] = unpack_XBGR16161616_UINT; - table[MESA_FORMAT_XBGR16161616_SINT] = unpack_XBGR16161616_SINT; - table[MESA_FORMAT_XBGR32323232_FLOAT] = unpack_XBGR32323232_FLOAT; - table[MESA_FORMAT_XBGR32323232_UINT] = unpack_XBGR32323232_UINT; - table[MESA_FORMAT_XBGR32323232_SINT] = unpack_XBGR32323232_SINT; - - table[MESA_FORMAT_ABGR2101010] = unpack_ABGR2101010; - - table[MESA_FORMAT_SIGNED_RG88] = unpack_SIGNED_RG88; - table[MESA_FORMAT_SIGNED_RG1616] = unpack_SIGNED_RG1616; + table[MESA_FORMAT_A_SNORM8] = unpack_SIGNED_A8; + table[MESA_FORMAT_L_SNORM8] = unpack_SIGNED_L8; + table[MESA_FORMAT_L8A8_SNORM] = unpack_SIGNED_AL88; + table[MESA_FORMAT_I_SNORM8] = unpack_SIGNED_I8; + table[MESA_FORMAT_A_SNORM16] = unpack_SIGNED_A16; + table[MESA_FORMAT_L_SNORM16] = unpack_SIGNED_L16; + table[MESA_FORMAT_LA_SNORM16] = unpack_SIGNED_AL1616; + table[MESA_FORMAT_I_SNORM16] = unpack_SIGNED_I16; + + table[MESA_FORMAT_R9G9B9E5_FLOAT] = unpack_RGB9_E5_FLOAT; + table[MESA_FORMAT_R11G11B10_FLOAT] = unpack_R11_G11_B10_FLOAT; + + table[MESA_FORMAT_Z_FLOAT32] = unpack_Z32_FLOAT; + table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = unpack_Z32_FLOAT_X24S8; + + table[MESA_FORMAT_B4G4R4X4_UNORM] = unpack_XRGB4444_UNORM; + table[MESA_FORMAT_B5G5R5X1_UNORM] = unpack_XRGB1555_UNORM; + table[MESA_FORMAT_R8G8B8X8_SNORM] = unpack_XBGR8888_SNORM; + table[MESA_FORMAT_R8G8B8X8_SRGB] = unpack_XBGR8888_SRGB; + table[MESA_FORMAT_RGBX_UINT8] = unpack_XBGR8888_UINT; + table[MESA_FORMAT_RGBX_SINT8] = unpack_XBGR8888_SINT; + table[MESA_FORMAT_B10G10R10X2_UNORM] = unpack_XRGB2101010_UNORM; + table[MESA_FORMAT_RGBX_UNORM16] = unpack_XBGR16161616_UNORM; + table[MESA_FORMAT_RGBX_SNORM16] = unpack_XBGR16161616_SNORM; + table[MESA_FORMAT_RGBX_FLOAT16] = unpack_XBGR16161616_FLOAT; + table[MESA_FORMAT_RGBX_UINT16] = unpack_XBGR16161616_UINT; + table[MESA_FORMAT_RGBX_SINT16] = unpack_XBGR16161616_SINT; + table[MESA_FORMAT_RGBX_FLOAT32] = unpack_XBGR32323232_FLOAT; + table[MESA_FORMAT_RGBX_UINT32] = unpack_XBGR32323232_UINT; + table[MESA_FORMAT_RGBX_SINT32] = unpack_XBGR32323232_SINT; + + table[MESA_FORMAT_R10G10B10A2_UNORM] = unpack_ABGR2101010; + + table[MESA_FORMAT_G8R8_SNORM] = unpack_SIGNED_RG88; + table[MESA_FORMAT_G16R16_SNORM] = unpack_SIGNED_RG1616; initialized = GL_TRUE; } @@ -2540,7 +2546,7 @@ get_unpack_rgba_function(gl_format format) * Unpack rgba colors, returning as GLfloat values. */ void -_mesa_unpack_rgba_row(gl_format format, GLuint n, +_mesa_unpack_rgba_row(mesa_format format, GLuint n, const void *src, GLfloat dst[][4]) { unpack_rgba_func unpack = get_unpack_rgba_function(format); @@ -2699,6 +2705,9 @@ unpack_ubyte_RGB565(const void *src, GLubyte dst[][4], GLuint n) static void unpack_ubyte_RGB565_REV(const void *src, GLubyte dst[][4], GLuint n) { + /* Warning: this function does not match the current Mesa definition + * of MESA_FORMAT_R5G6B5_UNORM. + */ const GLushort *s = ((const GLushort *) src); GLuint i; for (i = 0; i < n; i++) { @@ -2765,6 +2774,9 @@ unpack_ubyte_ARGB1555(const void *src, GLubyte dst[][4], GLuint n) static void unpack_ubyte_ARGB1555_REV(const void *src, GLubyte dst[][4], GLuint n) { + /* Warning: this function does not match the current Mesa definition + * of MESA_FORMAT_A1R5G5B5_UNORM. + */ const GLushort *s = ((const GLushort *) src); GLuint i; for (i = 0; i < n; i++) { @@ -2913,89 +2925,89 @@ unpack_ubyte_RG88(const void *src, GLubyte dst[][4], GLuint n) * only be used for unpacking formats that use 8 bits or less per channel. */ void -_mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n, +_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, const void *src, GLubyte dst[][4]) { switch (format) { - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: unpack_ubyte_RGBA8888(src, dst, n); break; - case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_UNORM: unpack_ubyte_RGBA8888_REV(src, dst, n); break; - case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_B8G8R8A8_UNORM: unpack_ubyte_ARGB8888(src, dst, n); break; - case MESA_FORMAT_ARGB8888_REV: + case MESA_FORMAT_A8R8G8B8_UNORM: unpack_ubyte_ARGB8888_REV(src, dst, n); break; - case MESA_FORMAT_RGBX8888: + case MESA_FORMAT_X8B8G8R8_UNORM: unpack_ubyte_RGBX8888(src, dst, n); break; - case MESA_FORMAT_RGBX8888_REV: + case MESA_FORMAT_R8G8B8X8_UNORM: unpack_ubyte_RGBX8888_REV(src, dst, n); break; - case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_B8G8R8X8_UNORM: unpack_ubyte_XRGB8888(src, dst, n); break; - case MESA_FORMAT_XRGB8888_REV: + case MESA_FORMAT_X8R8G8B8_UNORM: unpack_ubyte_XRGB8888_REV(src, dst, n); break; - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: unpack_ubyte_RGB888(src, dst, n); break; - case MESA_FORMAT_BGR888: + case MESA_FORMAT_RGB_UNORM8: unpack_ubyte_BGR888(src, dst, n); break; - case MESA_FORMAT_RGB565: + case MESA_FORMAT_B5G6R5_UNORM: unpack_ubyte_RGB565(src, dst, n); break; - case MESA_FORMAT_RGB565_REV: + case MESA_FORMAT_R5G6B5_UNORM: unpack_ubyte_RGB565_REV(src, dst, n); break; - case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_B4G4R4A4_UNORM: unpack_ubyte_ARGB4444(src, dst, n); break; - case MESA_FORMAT_ARGB4444_REV: + case MESA_FORMAT_A4R4G4B4_UNORM: unpack_ubyte_ARGB4444_REV(src, dst, n); break; - case MESA_FORMAT_RGBA5551: + case MESA_FORMAT_A1B5G5R5_UNORM: unpack_ubyte_RGBA5551(src, dst, n); break; - case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_B5G5R5A1_UNORM: unpack_ubyte_ARGB1555(src, dst, n); break; - case MESA_FORMAT_ARGB1555_REV: + case MESA_FORMAT_A1R5G5B5_UNORM: unpack_ubyte_ARGB1555_REV(src, dst, n); break; - case MESA_FORMAT_AL44: + case MESA_FORMAT_L4A4_UNORM: unpack_ubyte_AL44(src, dst, n); break; - case MESA_FORMAT_AL88: + case MESA_FORMAT_L8A8_UNORM: unpack_ubyte_AL88(src, dst, n); break; - case MESA_FORMAT_AL88_REV: + case MESA_FORMAT_A8L8_UNORM: unpack_ubyte_AL88_REV(src, dst, n); break; - case MESA_FORMAT_RGB332: + case MESA_FORMAT_B2G3R3_UNORM: unpack_ubyte_RGB332(src, dst, n); break; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: unpack_ubyte_A8(src, dst, n); break; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: unpack_ubyte_L8(src, dst, n); break; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: unpack_ubyte_I8(src, dst, n); break; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: unpack_ubyte_R8(src, dst, n); break; - case MESA_FORMAT_GR88: + case MESA_FORMAT_R8G8_UNORM: unpack_ubyte_GR88(src, dst, n); break; - case MESA_FORMAT_RG88: + case MESA_FORMAT_G8R8_UNORM: unpack_ubyte_RG88(src, dst, n); break; default: @@ -3640,7 +3652,7 @@ unpack_int_rgba_ABGR2101010(const GLuint *src, GLuint dst[][4], GLuint n) } void -_mesa_unpack_uint_rgba_row(gl_format format, GLuint n, +_mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, const void *src, GLuint dst[][4]) { switch (format) { @@ -3648,198 +3660,198 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, * make separate paths for 32-bit-to-32-bit integer unpack. */ case MESA_FORMAT_RGBA_UINT32: - case MESA_FORMAT_RGBA_INT32: + case MESA_FORMAT_RGBA_SINT32: unpack_int_rgba_RGBA_UINT32(src, dst, n); break; case MESA_FORMAT_RGBA_UINT16: unpack_int_rgba_RGBA_UINT16(src, dst, n); break; - case MESA_FORMAT_RGBA_INT16: + case MESA_FORMAT_RGBA_SINT16: unpack_int_rgba_RGBA_INT16(src, dst, n); break; case MESA_FORMAT_RGBA_UINT8: unpack_int_rgba_RGBA_UINT8(src, dst, n); break; - case MESA_FORMAT_RGBA_INT8: + case MESA_FORMAT_RGBA_SINT8: unpack_int_rgba_RGBA_INT8(src, dst, n); break; - case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_B8G8R8A8_UNORM: unpack_int_rgba_ARGB8888(src, dst, n); break; - case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_B8G8R8X8_UNORM: unpack_int_rgba_XRGB8888(src, dst, n); break; case MESA_FORMAT_RGB_UINT32: - case MESA_FORMAT_RGB_INT32: + case MESA_FORMAT_RGB_SINT32: unpack_int_rgba_RGB_UINT32(src, dst, n); break; case MESA_FORMAT_RGB_UINT16: unpack_int_rgba_RGB_UINT16(src, dst, n); break; - case MESA_FORMAT_RGB_INT16: + case MESA_FORMAT_RGB_SINT16: unpack_int_rgba_RGB_INT16(src, dst, n); break; case MESA_FORMAT_RGB_UINT8: unpack_int_rgba_RGB_UINT8(src, dst, n); break; - case MESA_FORMAT_RGB_INT8: + case MESA_FORMAT_RGB_SINT8: unpack_int_rgba_RGB_INT8(src, dst, n); break; case MESA_FORMAT_RG_UINT32: - case MESA_FORMAT_RG_INT32: + case MESA_FORMAT_RG_SINT32: unpack_int_rgba_RG_UINT32(src, dst, n); break; case MESA_FORMAT_RG_UINT16: unpack_int_rgba_RG_UINT16(src, dst, n); break; - case MESA_FORMAT_RG_INT16: + case MESA_FORMAT_RG_SINT16: unpack_int_rgba_RG_INT16(src, dst, n); break; case MESA_FORMAT_RG_UINT8: unpack_int_rgba_RG_UINT8(src, dst, n); break; - case MESA_FORMAT_RG_INT8: + case MESA_FORMAT_RG_SINT8: unpack_int_rgba_RG_INT8(src, dst, n); break; case MESA_FORMAT_R_UINT32: - case MESA_FORMAT_R_INT32: + case MESA_FORMAT_R_SINT32: unpack_int_rgba_R_UINT32(src, dst, n); break; case MESA_FORMAT_R_UINT16: unpack_int_rgba_R_UINT16(src, dst, n); break; - case MESA_FORMAT_R_INT16: + case MESA_FORMAT_R_SINT16: unpack_int_rgba_R_INT16(src, dst, n); break; case MESA_FORMAT_R_UINT8: unpack_int_rgba_R_UINT8(src, dst, n); break; - case MESA_FORMAT_R_INT8: + case MESA_FORMAT_R_SINT8: unpack_int_rgba_R_INT8(src, dst, n); break; - case MESA_FORMAT_ALPHA_UINT32: - case MESA_FORMAT_ALPHA_INT32: + case MESA_FORMAT_A_UINT32: + case MESA_FORMAT_A_SINT32: unpack_int_rgba_ALPHA_UINT32(src, dst, n); break; - case MESA_FORMAT_ALPHA_UINT16: + case MESA_FORMAT_A_UINT16: unpack_int_rgba_ALPHA_UINT16(src, dst, n); break; - case MESA_FORMAT_ALPHA_INT16: + case MESA_FORMAT_A_SINT16: unpack_int_rgba_ALPHA_INT16(src, dst, n); break; - case MESA_FORMAT_ALPHA_UINT8: + case MESA_FORMAT_A_UINT8: unpack_int_rgba_ALPHA_UINT8(src, dst, n); break; - case MESA_FORMAT_ALPHA_INT8: + case MESA_FORMAT_A_SINT8: unpack_int_rgba_ALPHA_INT8(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_UINT32: - case MESA_FORMAT_LUMINANCE_INT32: + case MESA_FORMAT_L_UINT32: + case MESA_FORMAT_L_SINT32: unpack_int_rgba_LUMINANCE_UINT32(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_UINT16: + case MESA_FORMAT_L_UINT16: unpack_int_rgba_LUMINANCE_UINT16(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_INT16: + case MESA_FORMAT_L_SINT16: unpack_int_rgba_LUMINANCE_INT16(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_UINT8: + case MESA_FORMAT_L_UINT8: unpack_int_rgba_LUMINANCE_UINT8(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_INT8: + case MESA_FORMAT_L_SINT8: unpack_int_rgba_LUMINANCE_INT8(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT32: - case MESA_FORMAT_LUMINANCE_ALPHA_INT32: + case MESA_FORMAT_LA_UINT32: + case MESA_FORMAT_LA_SINT32: unpack_int_rgba_LUMINANCE_ALPHA_UINT32(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT16: + case MESA_FORMAT_LA_UINT16: unpack_int_rgba_LUMINANCE_ALPHA_UINT16(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_ALPHA_INT16: + case MESA_FORMAT_LA_SINT16: unpack_int_rgba_LUMINANCE_ALPHA_INT16(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT8: + case MESA_FORMAT_LA_UINT8: unpack_int_rgba_LUMINANCE_ALPHA_UINT8(src, dst, n); break; - case MESA_FORMAT_LUMINANCE_ALPHA_INT8: + case MESA_FORMAT_LA_SINT8: unpack_int_rgba_LUMINANCE_ALPHA_INT8(src, dst, n); break; - case MESA_FORMAT_INTENSITY_UINT32: - case MESA_FORMAT_INTENSITY_INT32: + case MESA_FORMAT_I_UINT32: + case MESA_FORMAT_I_SINT32: unpack_int_rgba_INTENSITY_UINT32(src, dst, n); break; - case MESA_FORMAT_INTENSITY_UINT16: + case MESA_FORMAT_I_UINT16: unpack_int_rgba_INTENSITY_UINT16(src, dst, n); break; - case MESA_FORMAT_INTENSITY_INT16: + case MESA_FORMAT_I_SINT16: unpack_int_rgba_INTENSITY_INT16(src, dst, n); break; - case MESA_FORMAT_INTENSITY_UINT8: + case MESA_FORMAT_I_UINT8: unpack_int_rgba_INTENSITY_UINT8(src, dst, n); break; - case MESA_FORMAT_INTENSITY_INT8: + case MESA_FORMAT_I_SINT8: unpack_int_rgba_INTENSITY_INT8(src, dst, n); break; - case MESA_FORMAT_ARGB2101010_UINT: + case MESA_FORMAT_B10G10R10A2_UINT: unpack_int_rgba_ARGB2101010_UINT(src, dst, n); break; - case MESA_FORMAT_ABGR2101010_UINT: + case MESA_FORMAT_R10G10B10A2_UINT: unpack_int_rgba_ABGR2101010_UINT(src, dst, n); break; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: unpack_int_rgba_ARGB2101010(src, dst, n); break; - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_RGBX_UINT8: unpack_int_rgba_XBGR8888_UINT(src, dst, n); break; - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_SINT8: unpack_int_rgba_XBGR8888_SINT(src, dst, n); break; - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UINT16: unpack_int_rgba_XBGR16161616_UINT(src, dst, n); break; - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SINT16: unpack_int_rgba_XBGR16161616_SINT(src, dst, n); break; - case MESA_FORMAT_XBGR32323232_UINT: - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_UINT32: + case MESA_FORMAT_RGBX_SINT32: unpack_int_rgba_XBGR32323232_UINT(src, dst, n); break; - case MESA_FORMAT_ABGR2101010: + case MESA_FORMAT_R10G10B10A2_UNORM: unpack_int_rgba_ABGR2101010(src, dst, n); break; @@ -3863,7 +3875,7 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, * \param height height of rect region to convert */ void -_mesa_unpack_rgba_block(gl_format format, +_mesa_unpack_rgba_block(mesa_format format, const void *src, GLint srcRowStride, GLfloat dst[][4], GLint dstRowStride, GLuint x, GLuint y, GLuint width, GLuint height) @@ -3964,30 +3976,30 @@ unpack_float_z_Z32X24S8(GLuint n, const void *src, GLfloat *dst) * The returned values will always be in the range [0.0, 1.0]. */ void -_mesa_unpack_float_z_row(gl_format format, GLuint n, +_mesa_unpack_float_z_row(mesa_format format, GLuint n, const void *src, GLfloat *dst) { unpack_float_z_func unpack; switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: unpack = unpack_float_z_Z24_X8; break; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: unpack = unpack_float_z_X8_Z24; break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: unpack = unpack_float_z_Z16; break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: unpack = unpack_float_z_Z32; break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: unpack = unpack_float_z_Z32F; break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: unpack = unpack_float_z_Z32X24S8; break; default: @@ -4068,31 +4080,31 @@ unpack_uint_z_Z32_FLOAT_X24S8(const void *src, GLuint *dst, GLuint n) * The returned values will always be in the range [0, 0xffffffff]. */ void -_mesa_unpack_uint_z_row(gl_format format, GLuint n, +_mesa_unpack_uint_z_row(mesa_format format, GLuint n, const void *src, GLuint *dst) { unpack_uint_z_func unpack; const GLubyte *srcPtr = (GLubyte *) src; switch (format) { - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: unpack = unpack_uint_z_Z24_X8; break; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: unpack = unpack_uint_z_X8_Z24; break; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: unpack = unpack_uint_z_Z16; break; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: unpack = unpack_uint_z_Z32; break; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: unpack = unpack_uint_z_Z32_FLOAT; break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: unpack = unpack_uint_z_Z32_FLOAT_X24S8; break; default: @@ -4142,20 +4154,20 @@ unpack_ubyte_s_Z32_FLOAT_X24S8(const void *src, GLubyte *dst, GLuint n) } void -_mesa_unpack_ubyte_stencil_row(gl_format format, GLuint n, +_mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, const void *src, GLubyte *dst) { switch (format) { - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: unpack_ubyte_s_S8(src, dst, n); break; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: unpack_ubyte_s_Z24_S8(src, dst, n); break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: unpack_ubyte_s_S8_Z24(src, dst, n); break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: unpack_ubyte_s_Z32_FLOAT_X24S8(src, dst, n); break; default: @@ -4183,14 +4195,14 @@ unpack_uint_24_8_depth_stencil_Z24_S8(const GLuint *src, GLuint *dst, GLuint n) } void -_mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, +_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLuint *dst) { switch (format) { - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: unpack_uint_24_8_depth_stencil_Z24_S8(src, dst, n); break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: unpack_uint_24_8_depth_stencil_S8_Z24(src, dst, n); break; default: diff --git a/mesalib/src/mesa/main/format_unpack.h b/mesalib/src/mesa/main/format_unpack.h index 1da03caa8..1fcfc04b3 100644 --- a/mesalib/src/mesa/main/format_unpack.h +++ b/mesalib/src/mesa/main/format_unpack.h @@ -29,38 +29,38 @@ extern GLfloat _mesa_nonlinear_to_linear(GLubyte cs8); extern void -_mesa_unpack_rgba_row(gl_format format, GLuint n, +_mesa_unpack_rgba_row(mesa_format format, GLuint n, const void *src, GLfloat dst[][4]); extern void -_mesa_unpack_ubyte_rgba_row(gl_format format, GLuint n, +_mesa_unpack_ubyte_rgba_row(mesa_format format, GLuint n, const void *src, GLubyte dst[][4]); void -_mesa_unpack_uint_rgba_row(gl_format format, GLuint n, +_mesa_unpack_uint_rgba_row(mesa_format format, GLuint n, const void *src, GLuint dst[][4]); extern void -_mesa_unpack_rgba_block(gl_format format, +_mesa_unpack_rgba_block(mesa_format format, const void *src, GLint srcRowStride, GLfloat dst[][4], GLint dstRowStride, GLuint x, GLuint y, GLuint width, GLuint height); extern void -_mesa_unpack_float_z_row(gl_format format, GLuint n, +_mesa_unpack_float_z_row(mesa_format format, GLuint n, const void *src, GLfloat *dst); void -_mesa_unpack_uint_z_row(gl_format format, GLuint n, +_mesa_unpack_uint_z_row(mesa_format format, GLuint n, const void *src, GLuint *dst); void -_mesa_unpack_ubyte_stencil_row(gl_format format, GLuint n, +_mesa_unpack_ubyte_stencil_row(mesa_format format, GLuint n, const void *src, GLubyte *dst); void -_mesa_unpack_uint_24_8_depth_stencil_row(gl_format format, GLuint n, +_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, GLuint n, const void *src, GLuint *dst); diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 7bde1f1a8..10731d5a4 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -35,7 +35,7 @@ */ struct gl_format_info { - gl_format Name; + mesa_format Name; /** text name for debugging */ const char *StrName; @@ -88,8 +88,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGBA8888, /* Name */ - "MESA_FORMAT_RGBA8888", /* StrName */ + MESA_FORMAT_A8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_A8B8G8R8_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -97,8 +97,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGBA8888_REV, /* Name */ - "MESA_FORMAT_RGBA8888_REV", /* StrName */ + MESA_FORMAT_R8G8B8A8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8A8_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -106,8 +106,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB8888, /* Name */ - "MESA_FORMAT_ARGB8888", /* StrName */ + MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8A8_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -115,8 +115,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB8888_REV, /* Name */ - "MESA_FORMAT_ARGB8888_REV", /* StrName */ + MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_A8R8G8B8_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -124,8 +124,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGBX8888, /* Name */ - "MESA_FORMAT_RGBX8888", /* StrName */ + MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_X8B8G8R8_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -133,8 +133,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGBX8888_REV, /* Name */ - "MESA_FORMAT_RGBX8888_REV", /* StrName */ + MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8X8_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -142,8 +142,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_XRGB8888, /* Name */ - "MESA_FORMAT_XRGB8888", /* StrName */ + MESA_FORMAT_B8G8R8X8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8X8_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -151,8 +151,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_XRGB8888_REV, /* Name */ - "MESA_FORMAT_XRGB8888_REV", /* StrName */ + MESA_FORMAT_X8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_X8R8G8B8_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -160,8 +160,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB888, /* Name */ - "MESA_FORMAT_RGB888", /* StrName */ + MESA_FORMAT_BGR_UNORM8, /* Name */ + "MESA_FORMAT_BGR_UNORM8", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -169,8 +169,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_BGR888, /* Name */ - "MESA_FORMAT_BGR888", /* StrName */ + MESA_FORMAT_RGB_UNORM8, /* Name */ + "MESA_FORMAT_RGB_UNORM8", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -178,8 +178,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB565, /* Name */ - "MESA_FORMAT_RGB565", /* StrName */ + MESA_FORMAT_B5G6R5_UNORM, /* Name */ + "MESA_FORMAT_B5G6R5_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -187,8 +187,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB565_REV, /* Name */ - "MESA_FORMAT_RGB565_REV", /* StrName */ + MESA_FORMAT_R5G6B5_UNORM, /* Name */ + "MESA_FORMAT_R5G6B5_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -196,8 +196,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB4444, /* Name */ - "MESA_FORMAT_ARGB4444", /* StrName */ + MESA_FORMAT_B4G4R4A4_UNORM, /* Name */ + "MESA_FORMAT_B4G4R4A4_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -205,8 +205,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB4444_REV, /* Name */ - "MESA_FORMAT_ARGB4444_REV", /* StrName */ + MESA_FORMAT_A4R4G4B4_UNORM, /* Name */ + "MESA_FORMAT_A4R4G4B4_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -214,8 +214,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGBA5551, /* Name */ - "MESA_FORMAT_RGBA5551", /* StrName */ + MESA_FORMAT_A1B5G5R5_UNORM, /* Name */ + "MESA_FORMAT_A1B5G5R5_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -223,8 +223,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB1555, /* Name */ - "MESA_FORMAT_ARGB1555", /* StrName */ + MESA_FORMAT_B5G5R5A1_UNORM, /* Name */ + "MESA_FORMAT_B5G5R5A1_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -232,8 +232,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB1555_REV, /* Name */ - "MESA_FORMAT_ARGB1555_REV", /* StrName */ + MESA_FORMAT_A1R5G5B5_UNORM, /* Name */ + "MESA_FORMAT_A1R5G5B5_UNORM", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -241,8 +241,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_AL44, /* Name */ - "MESA_FORMAT_AL44", /* StrName */ + MESA_FORMAT_L4A4_UNORM, /* Name */ + "MESA_FORMAT_L4A4_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */ @@ -250,8 +250,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_AL88, /* Name */ - "MESA_FORMAT_AL88", /* StrName */ + MESA_FORMAT_L8A8_UNORM, /* Name */ + "MESA_FORMAT_L8A8_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -259,8 +259,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_AL88_REV, /* Name */ - "MESA_FORMAT_AL88_REV", /* StrName */ + MESA_FORMAT_A8L8_UNORM, /* Name */ + "MESA_FORMAT_A8L8_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -268,8 +268,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_AL1616, /* Name */ - "MESA_FORMAT_AL1616", /* StrName */ + MESA_FORMAT_L16A16_UNORM, /* Name */ + "MESA_FORMAT_L16A16_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ @@ -277,8 +277,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_AL1616_REV, /* Name */ - "MESA_FORMAT_AL1616_REV", /* StrName */ + MESA_FORMAT_A16L16_UNORM, /* Name */ + "MESA_FORMAT_A16L16_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ @@ -286,8 +286,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB332, /* Name */ - "MESA_FORMAT_RGB332", /* StrName */ + MESA_FORMAT_B2G3R3_UNORM, /* Name */ + "MESA_FORMAT_B2G3R3_UNORM", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */ @@ -295,8 +295,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8, /* Name */ - "MESA_FORMAT_A8", /* StrName */ + MESA_FORMAT_A_UNORM8, /* Name */ + "MESA_FORMAT_A_UNORM8", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -304,8 +304,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A16, /* Name */ - "MESA_FORMAT_A16", /* StrName */ + MESA_FORMAT_A_UNORM16, /* Name */ + "MESA_FORMAT_A_UNORM16", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ @@ -313,8 +313,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L8, /* Name */ - "MESA_FORMAT_L8", /* StrName */ + MESA_FORMAT_L_UNORM8, /* Name */ + "MESA_FORMAT_L_UNORM8", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -322,8 +322,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L16, /* Name */ - "MESA_FORMAT_L16", /* StrName */ + MESA_FORMAT_L_UNORM16, /* Name */ + "MESA_FORMAT_L_UNORM16", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -331,8 +331,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I8, /* Name */ - "MESA_FORMAT_I8", /* StrName */ + MESA_FORMAT_I_UNORM8, /* Name */ + "MESA_FORMAT_I_UNORM8", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -340,8 +340,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I16, /* Name */ - "MESA_FORMAT_I16", /* StrName */ + MESA_FORMAT_I_UNORM16, /* Name */ + "MESA_FORMAT_I_UNORM16", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -367,8 +367,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8, - "MESA_FORMAT_R8", + MESA_FORMAT_R_UNORM8, + "MESA_FORMAT_R_UNORM8", GL_RED, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, @@ -376,8 +376,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_GR88, - "MESA_FORMAT_GR88", + MESA_FORMAT_R8G8_UNORM, + "MESA_FORMAT_R8G8_UNORM", GL_RG, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, @@ -385,8 +385,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RG88, - "MESA_FORMAT_RG88", + MESA_FORMAT_G8R8_UNORM, + "MESA_FORMAT_G8R8_UNORM", GL_RG, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, @@ -394,8 +394,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_R16, - "MESA_FORMAT_R16", + MESA_FORMAT_R_UNORM16, + "MESA_FORMAT_R_UNORM16", GL_RED, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, @@ -403,8 +403,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_GR1616, - "MESA_FORMAT_GR1616", + MESA_FORMAT_R16G16_UNORM, + "MESA_FORMAT_R16G16_UNORM", GL_RG, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, @@ -412,8 +412,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_RG1616, - "MESA_FORMAT_RG1616", + MESA_FORMAT_G16R16_UNORM, + "MESA_FORMAT_G16R16_UNORM", GL_RG, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, @@ -421,8 +421,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_ARGB2101010, - "MESA_FORMAT_ARGB2101010", + MESA_FORMAT_B10G10R10A2_UNORM, + "MESA_FORMAT_B10G10R10A2_UNORM", GL_RGBA, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, @@ -430,8 +430,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_Z24_S8, /* Name */ - "MESA_FORMAT_Z24_S8", /* StrName */ + MESA_FORMAT_S8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_S8_UINT_Z24_UNORM", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -439,8 +439,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_S8_Z24, /* Name */ - "MESA_FORMAT_S8_Z24", /* StrName */ + MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -448,8 +448,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z16, /* Name */ - "MESA_FORMAT_Z16", /* StrName */ + MESA_FORMAT_Z_UNORM16, /* Name */ + "MESA_FORMAT_Z_UNORM16", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -457,8 +457,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_X8_Z24, /* Name */ - "MESA_FORMAT_X8_Z24", /* StrName */ + MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -466,8 +466,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z24_X8, /* Name */ - "MESA_FORMAT_Z24_X8", /* StrName */ + MESA_FORMAT_X8Z24_UNORM, /* Name */ + "MESA_FORMAT_X8Z24_UNORM", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -475,8 +475,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z32, /* Name */ - "MESA_FORMAT_Z32", /* StrName */ + MESA_FORMAT_Z_UNORM32, /* Name */ + "MESA_FORMAT_Z_UNORM32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -484,8 +484,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_S8, /* Name */ - "MESA_FORMAT_S8", /* StrName */ + MESA_FORMAT_S_UINT8, /* Name */ + "MESA_FORMAT_S_UINT8", /* StrName */ GL_STENCIL_INDEX, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -493,8 +493,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_SRGB8, - "MESA_FORMAT_SRGB8", + MESA_FORMAT_BGR_SRGB8, + "MESA_FORMAT_BGR_SRGB8", GL_RGB, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, @@ -502,8 +502,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 3 }, { - MESA_FORMAT_SRGBA8, - "MESA_FORMAT_SRGBA8", + MESA_FORMAT_A8B8G8R8_SRGB, + "MESA_FORMAT_A8B8G8R8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, @@ -511,8 +511,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SARGB8, - "MESA_FORMAT_SARGB8", + MESA_FORMAT_B8G8R8A8_SRGB, + "MESA_FORMAT_B8G8R8A8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, @@ -520,8 +520,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SL8, - "MESA_FORMAT_SL8", + MESA_FORMAT_L_SRGB8, + "MESA_FORMAT_L_SRGB8", GL_LUMINANCE, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, @@ -529,8 +529,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_SLA8, - "MESA_FORMAT_SLA8", + MESA_FORMAT_L8A8_SRGB, + "MESA_FORMAT_L8A8_SRGB", GL_LUMINANCE_ALPHA, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, @@ -666,8 +666,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 6 }, { - MESA_FORMAT_ALPHA_FLOAT32, - "MESA_FORMAT_ALPHA_FLOAT32", + MESA_FORMAT_A_FLOAT32, + "MESA_FORMAT_A_FLOAT32", GL_ALPHA, GL_FLOAT, 0, 0, 0, 32, @@ -675,8 +675,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_ALPHA_FLOAT16, - "MESA_FORMAT_ALPHA_FLOAT16", + MESA_FORMAT_A_FLOAT16, + "MESA_FORMAT_A_FLOAT16", GL_ALPHA, GL_FLOAT, 0, 0, 0, 16, @@ -684,8 +684,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_FLOAT32, - "MESA_FORMAT_LUMINANCE_FLOAT32", + MESA_FORMAT_L_FLOAT32, + "MESA_FORMAT_L_FLOAT32", GL_LUMINANCE, GL_FLOAT, 0, 0, 0, 0, @@ -693,8 +693,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_FLOAT16, - "MESA_FORMAT_LUMINANCE_FLOAT16", + MESA_FORMAT_L_FLOAT16, + "MESA_FORMAT_L_FLOAT16", GL_LUMINANCE, GL_FLOAT, 0, 0, 0, 0, @@ -702,8 +702,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32", + MESA_FORMAT_LA_FLOAT32, + "MESA_FORMAT_LA_FLOAT32", GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, 0, 32, @@ -711,8 +711,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16", + MESA_FORMAT_LA_FLOAT16, + "MESA_FORMAT_LA_FLOAT16", GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, 0, 16, @@ -720,8 +720,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_INTENSITY_FLOAT32, - "MESA_FORMAT_INTENSITY_FLOAT32", + MESA_FORMAT_I_FLOAT32, + "MESA_FORMAT_I_FLOAT32", GL_INTENSITY, GL_FLOAT, 0, 0, 0, 0, @@ -729,8 +729,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_INTENSITY_FLOAT16, - "MESA_FORMAT_INTENSITY_FLOAT16", + MESA_FORMAT_I_FLOAT16, + "MESA_FORMAT_I_FLOAT16", GL_INTENSITY, GL_FLOAT, 0, 0, 0, 0, @@ -777,8 +777,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = /* unnormalized signed int formats */ /* unnormalized unsigned int formats */ { - MESA_FORMAT_ALPHA_UINT8, - "MESA_FORMAT_ALPHA_UINT8", + MESA_FORMAT_A_UINT8, + "MESA_FORMAT_A_UINT8", GL_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 8, @@ -786,8 +786,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_ALPHA_UINT16, - "MESA_FORMAT_ALPHA_UINT16", + MESA_FORMAT_A_UINT16, + "MESA_FORMAT_A_UINT16", GL_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 16, @@ -795,8 +795,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_ALPHA_UINT32, - "MESA_FORMAT_ALPHA_UINT32", + MESA_FORMAT_A_UINT32, + "MESA_FORMAT_A_UINT32", GL_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 32, @@ -804,8 +804,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_ALPHA_INT8, - "MESA_FORMAT_ALPHA_INT8", + MESA_FORMAT_A_SINT8, + "MESA_FORMAT_A_SINT8", GL_ALPHA, GL_INT, 0, 0, 0, 8, @@ -813,8 +813,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_ALPHA_INT16, - "MESA_FORMAT_ALPHA_INT16", + MESA_FORMAT_A_SINT16, + "MESA_FORMAT_A_SINT16", GL_ALPHA, GL_INT, 0, 0, 0, 16, @@ -822,8 +822,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_ALPHA_INT32, - "MESA_FORMAT_ALPHA_INT32", + MESA_FORMAT_A_SINT32, + "MESA_FORMAT_A_SINT32", GL_ALPHA, GL_INT, 0, 0, 0, 32, @@ -831,8 +831,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_INTENSITY_UINT8, - "MESA_FORMAT_INTENSITY_UINT8", + MESA_FORMAT_I_UINT8, + "MESA_FORMAT_I_UINT8", GL_INTENSITY, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -840,8 +840,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_INTENSITY_UINT16, - "MESA_FORMAT_INTENSITY_UINT16", + MESA_FORMAT_I_UINT16, + "MESA_FORMAT_I_UINT16", GL_INTENSITY, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -849,8 +849,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_INTENSITY_UINT32, - "MESA_FORMAT_INTENSITY_UINT32", + MESA_FORMAT_I_UINT32, + "MESA_FORMAT_I_UINT32", GL_INTENSITY, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -858,8 +858,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_INTENSITY_INT8, - "MESA_FORMAT_INTENSITY_INT8", + MESA_FORMAT_I_SINT8, + "MESA_FORMAT_I_SINT8", GL_INTENSITY, GL_INT, 0, 0, 0, 0, @@ -867,8 +867,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_INTENSITY_INT16, - "MESA_FORMAT_INTENSITY_INT16", + MESA_FORMAT_I_SINT16, + "MESA_FORMAT_I_SINT16", GL_INTENSITY, GL_INT, 0, 0, 0, 0, @@ -876,8 +876,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_INTENSITY_INT32, - "MESA_FORMAT_INTENSITY_INT32", + MESA_FORMAT_I_SINT32, + "MESA_FORMAT_I_SINT32", GL_INTENSITY, GL_INT, 0, 0, 0, 0, @@ -885,8 +885,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_UINT8, - "MESA_FORMAT_LUMINANCE_UINT8", + MESA_FORMAT_L_UINT8, + "MESA_FORMAT_L_UINT8", GL_LUMINANCE, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -894,8 +894,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_LUMINANCE_UINT16, - "MESA_FORMAT_LUMINANCE_UINT16", + MESA_FORMAT_L_UINT16, + "MESA_FORMAT_L_UINT16", GL_LUMINANCE, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -903,8 +903,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_UINT32, - "MESA_FORMAT_LUMINANCE_UINT32", + MESA_FORMAT_L_UINT32, + "MESA_FORMAT_L_UINT32", GL_LUMINANCE, GL_UNSIGNED_INT, 0, 0, 0, 0, @@ -912,8 +912,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_INT8, - "MESA_FORMAT_LUMINANCE_INT8", + MESA_FORMAT_L_SINT8, + "MESA_FORMAT_L_SINT8", GL_LUMINANCE, GL_INT, 0, 0, 0, 0, @@ -921,8 +921,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_LUMINANCE_INT16, - "MESA_FORMAT_LUMINANCE_INT16", + MESA_FORMAT_L_SINT16, + "MESA_FORMAT_L_SINT16", GL_LUMINANCE, GL_INT, 0, 0, 0, 0, @@ -930,8 +930,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_INT32, - "MESA_FORMAT_LUMINANCE_INT32", + MESA_FORMAT_L_SINT32, + "MESA_FORMAT_L_SINT32", GL_LUMINANCE, GL_INT, 0, 0, 0, 0, @@ -939,8 +939,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_ALPHA_UINT8, - "MESA_FORMAT_LUMINANCE_ALPHA_UINT8", + MESA_FORMAT_LA_UINT8, + "MESA_FORMAT_LA_UINT8", GL_LUMINANCE_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 8, @@ -948,8 +948,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_ALPHA_UINT16, - "MESA_FORMAT_LUMINANCE_ALPHA_UINT16", + MESA_FORMAT_LA_UINT16, + "MESA_FORMAT_LA_UINT16", GL_LUMINANCE_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 16, @@ -957,8 +957,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_ALPHA_UINT32, - "MESA_FORMAT_LUMINANCE_ALPHA_UINT32", + MESA_FORMAT_LA_UINT32, + "MESA_FORMAT_LA_UINT32", GL_LUMINANCE_ALPHA, GL_UNSIGNED_INT, 0, 0, 0, 32, @@ -966,8 +966,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT8, - "MESA_FORMAT_LUMINANCE_ALPHA_INT8", + MESA_FORMAT_LA_SINT8, + "MESA_FORMAT_LA_SINT8", GL_LUMINANCE_ALPHA, GL_INT, 0, 0, 0, 8, @@ -975,8 +975,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT16, - "MESA_FORMAT_LUMINANCE_ALPHA_INT16", + MESA_FORMAT_LA_SINT16, + "MESA_FORMAT_LA_SINT16", GL_LUMINANCE_ALPHA, GL_INT, 0, 0, 0, 16, @@ -984,8 +984,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT32, - "MESA_FORMAT_LUMINANCE_ALPHA_INT32", + MESA_FORMAT_LA_SINT32, + "MESA_FORMAT_LA_SINT32", GL_LUMINANCE_ALPHA, GL_INT, 0, 0, 0, 32, @@ -994,8 +994,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { - MESA_FORMAT_R_INT8, - "MESA_FORMAT_R_INT8", + MESA_FORMAT_R_SINT8, + "MESA_FORMAT_R_SINT8", GL_RED, GL_INT, 8, 0, 0, 0, @@ -1003,8 +1003,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_RG_INT8, - "MESA_FORMAT_RG_INT8", + MESA_FORMAT_RG_SINT8, + "MESA_FORMAT_RG_SINT8", GL_RG, GL_INT, 8, 8, 0, 0, @@ -1012,8 +1012,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RGB_INT8, - "MESA_FORMAT_RGB_INT8", + MESA_FORMAT_RGB_SINT8, + "MESA_FORMAT_RGB_SINT8", GL_RGB, GL_INT, 8, 8, 8, 0, @@ -1021,8 +1021,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 3 }, { - MESA_FORMAT_RGBA_INT8, - "MESA_FORMAT_RGBA_INT8", + MESA_FORMAT_RGBA_SINT8, + "MESA_FORMAT_RGBA_SINT8", GL_RGBA, GL_INT, 8, 8, 8, 8, @@ -1030,8 +1030,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R_INT16, - "MESA_FORMAT_R_INT16", + MESA_FORMAT_R_SINT16, + "MESA_FORMAT_R_SINT16", GL_RED, GL_INT, 16, 0, 0, 0, @@ -1039,8 +1039,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RG_INT16, - "MESA_FORMAT_RG_INT16", + MESA_FORMAT_RG_SINT16, + "MESA_FORMAT_RG_SINT16", GL_RG, GL_INT, 16, 16, 0, 0, @@ -1048,8 +1048,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_RGB_INT16, - "MESA_FORMAT_RGB_INT16", + MESA_FORMAT_RGB_SINT16, + "MESA_FORMAT_RGB_SINT16", GL_RGB, GL_INT, 16, 16, 16, 0, @@ -1057,8 +1057,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 6 }, { - MESA_FORMAT_RGBA_INT16, - "MESA_FORMAT_RGBA_INT16", + MESA_FORMAT_RGBA_SINT16, + "MESA_FORMAT_RGBA_SINT16", GL_RGBA, GL_INT, 16, 16, 16, 16, @@ -1066,8 +1066,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_R_INT32, - "MESA_FORMAT_R_INT32", + MESA_FORMAT_R_SINT32, + "MESA_FORMAT_R_SINT32", GL_RED, GL_INT, 32, 0, 0, 0, @@ -1075,8 +1075,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_RG_INT32, - "MESA_FORMAT_RG_INT32", + MESA_FORMAT_RG_SINT32, + "MESA_FORMAT_RG_SINT32", GL_RG, GL_INT, 32, 32, 0, 0, @@ -1084,8 +1084,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RGB_INT32, - "MESA_FORMAT_RGB_INT32", + MESA_FORMAT_RGB_SINT32, + "MESA_FORMAT_RGB_SINT32", GL_RGB, GL_INT, 32, 32, 32, 0, @@ -1093,8 +1093,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 12 }, { - MESA_FORMAT_RGBA_INT32, - "MESA_FORMAT_RGBA_INT32", + MESA_FORMAT_RGBA_SINT32, + "MESA_FORMAT_RGBA_SINT32", GL_RGBA, GL_INT, 32, 32, 32, 32, @@ -1223,8 +1223,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = /* Signed 8 bits / channel */ { - MESA_FORMAT_SIGNED_R8, /* Name */ - "MESA_FORMAT_SIGNED_R8", /* StrName */ + MESA_FORMAT_R_SNORM8, /* Name */ + "MESA_FORMAT_R_SNORM8", /* StrName */ GL_RED, /* BaseFormat */ GL_SIGNED_NORMALIZED, /* DataType */ 8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -1232,8 +1232,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_SIGNED_RG88_REV, - "MESA_FORMAT_SIGNED_RG88_REV", + MESA_FORMAT_R8G8_SNORM, + "MESA_FORMAT_R8G8_SNORM", GL_RG, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, @@ -1241,8 +1241,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_RGBX8888, - "MESA_FORMAT_SIGNED_RGBX8888", + MESA_FORMAT_X8B8G8R8_SNORM, + "MESA_FORMAT_X8B8G8R8_SNORM", GL_RGB, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, @@ -1250,8 +1250,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* 4 bpp, but no alpha */ }, { - MESA_FORMAT_SIGNED_RGBA8888, - "MESA_FORMAT_SIGNED_RGBA8888", + MESA_FORMAT_A8B8G8R8_SNORM, + "MESA_FORMAT_A8B8G8R8_SNORM", GL_RGBA, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, @@ -1259,8 +1259,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SIGNED_RGBA8888_REV, - "MESA_FORMAT_SIGNED_RGBA8888_REV", + MESA_FORMAT_R8G8B8A8_SNORM, + "MESA_FORMAT_R8G8B8A8_SNORM", GL_RGBA, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, @@ -1270,8 +1270,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = /* Signed 16 bits / channel */ { - MESA_FORMAT_SIGNED_R16, - "MESA_FORMAT_SIGNED_R16", + MESA_FORMAT_R_SNORM16, + "MESA_FORMAT_R_SNORM16", GL_RED, GL_SIGNED_NORMALIZED, 16, 0, 0, 0, @@ -1279,8 +1279,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_GR1616, - "MESA_FORMAT_SIGNED_GR1616", + MESA_FORMAT_R16G16_SNORM, + "MESA_FORMAT_R16G16_SNORM", GL_RG, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, @@ -1288,8 +1288,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SIGNED_RGB_16, - "MESA_FORMAT_SIGNED_RGB_16", + MESA_FORMAT_RGB_SNORM16, + "MESA_FORMAT_RGB_SNORM16", GL_RGB, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, @@ -1297,8 +1297,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 6 }, { - MESA_FORMAT_SIGNED_RGBA_16, - "MESA_FORMAT_SIGNED_RGBA_16", + MESA_FORMAT_RGBA_SNORM16, + "MESA_FORMAT_RGBA_SNORM16", GL_RGBA, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, @@ -1306,8 +1306,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RGBA_16, - "MESA_FORMAT_RGBA_16", + MESA_FORMAT_RGBA_UNORM16, + "MESA_FORMAT_RGBA_UNORM16", GL_RGBA, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, @@ -1315,8 +1315,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RED_RGTC1, - "MESA_FORMAT_RED_RGTC1", + MESA_FORMAT_R_RGTC1_UNORM, + "MESA_FORMAT_R_RGTC1_UNORM", GL_RED, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, @@ -1324,8 +1324,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_SIGNED_RED_RGTC1, - "MESA_FORMAT_SIGNED_RED_RGTC1", + MESA_FORMAT_R_RGTC1_SNORM, + "MESA_FORMAT_R_RGTC1_SNORM", GL_RED, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, @@ -1333,8 +1333,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_RG_RGTC2, - "MESA_FORMAT_RG_RGTC2", + MESA_FORMAT_RG_RGTC2_UNORM, + "MESA_FORMAT_RG_RGTC2_UNORM", GL_RG, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, @@ -1342,8 +1342,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_SIGNED_RG_RGTC2, - "MESA_FORMAT_SIGNED_RG_RGTC2", + MESA_FORMAT_RG_RGTC2_SNORM, + "MESA_FORMAT_RG_RGTC2_SNORM", GL_RG, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, @@ -1351,8 +1351,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_L_LATC1, - "MESA_FORMAT_L_LATC1", + MESA_FORMAT_L_LATC1_UNORM, + "MESA_FORMAT_L_LATC1_UNORM", GL_LUMINANCE, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1360,8 +1360,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_SIGNED_L_LATC1, - "MESA_FORMAT_SIGNED_L_LATC1", + MESA_FORMAT_L_LATC1_SNORM, + "MESA_FORMAT_L_LATC1_SNORM", GL_LUMINANCE, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1369,8 +1369,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_LA_LATC2, - "MESA_FORMAT_LA_LATC2", + MESA_FORMAT_LA_LATC2_UNORM, + "MESA_FORMAT_LA_LATC2_UNORM", GL_LUMINANCE_ALPHA, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 4, @@ -1378,8 +1378,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_SIGNED_LA_LATC2, - "MESA_FORMAT_SIGNED_LA_LATC2", + MESA_FORMAT_LA_LATC2_SNORM, + "MESA_FORMAT_LA_LATC2_SNORM", GL_LUMINANCE_ALPHA, GL_SIGNED_NORMALIZED, 0, 0, 0, 4, @@ -1499,8 +1499,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = /* Signed formats from EXT_texture_snorm that are not in GL3.1 */ { - MESA_FORMAT_SIGNED_A8, - "MESA_FORMAT_SIGNED_A8", + MESA_FORMAT_A_SNORM8, + "MESA_FORMAT_A_SNORM8", GL_ALPHA, GL_SIGNED_NORMALIZED, 0, 0, 0, 8, @@ -1508,8 +1508,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_SIGNED_L8, - "MESA_FORMAT_SIGNED_L8", + MESA_FORMAT_L_SNORM8, + "MESA_FORMAT_L_SNORM8", GL_LUMINANCE, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1517,8 +1517,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_SIGNED_AL88, - "MESA_FORMAT_SIGNED_AL88", + MESA_FORMAT_L8A8_SNORM, + "MESA_FORMAT_L8A8_SNORM", GL_LUMINANCE_ALPHA, GL_SIGNED_NORMALIZED, 0, 0, 0, 8, @@ -1526,8 +1526,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_I8, - "MESA_FORMAT_SIGNED_I8", + MESA_FORMAT_I_SNORM8, + "MESA_FORMAT_I_SNORM8", GL_INTENSITY, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1535,8 +1535,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_SIGNED_A16, - "MESA_FORMAT_SIGNED_A16", + MESA_FORMAT_A_SNORM16, + "MESA_FORMAT_A_SNORM16", GL_ALPHA, GL_SIGNED_NORMALIZED, 0, 0, 0, 16, @@ -1544,8 +1544,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_L16, - "MESA_FORMAT_SIGNED_L16", + MESA_FORMAT_L_SNORM16, + "MESA_FORMAT_L_SNORM16", GL_LUMINANCE, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1553,8 +1553,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_AL1616, - "MESA_FORMAT_SIGNED_AL1616", + MESA_FORMAT_LA_SNORM16, + "MESA_FORMAT_LA_SNORM16", GL_LUMINANCE_ALPHA, GL_SIGNED_NORMALIZED, 0, 0, 0, 16, @@ -1562,8 +1562,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SIGNED_I16, - "MESA_FORMAT_SIGNED_I16", + MESA_FORMAT_I_SNORM16, + "MESA_FORMAT_I_SNORM16", GL_INTENSITY, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -1571,7 +1571,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RGB9_E5_FLOAT, + MESA_FORMAT_R9G9B9E5_FLOAT, "MESA_FORMAT_RGB9_E5", GL_RGB, GL_FLOAT, @@ -1580,8 +1580,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R11_G11_B10_FLOAT, - "MESA_FORMAT_R11_G11_B10_FLOAT", + MESA_FORMAT_R11G11B10_FLOAT, + "MESA_FORMAT_R11G11B10_FLOAT", GL_RGB, GL_FLOAT, 11, 11, 10, 0, @@ -1590,8 +1590,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, /* ARB_depth_buffer_float */ { - MESA_FORMAT_Z32_FLOAT, /* Name */ - "MESA_FORMAT_Z32_FLOAT", /* StrName */ + MESA_FORMAT_Z_FLOAT32, /* Name */ + "MESA_FORMAT_Z_FLOAT32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_FLOAT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -1599,8 +1599,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z32_FLOAT_X24S8, /* Name */ - "MESA_FORMAT_Z32_FLOAT_X24S8", /* StrName */ + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* Name */ + "MESA_FORMAT_Z32_FLOAT_S8X24_UINT", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ /* DataType here is used to answer GL_TEXTURE_DEPTH_TYPE queries, and is * never used for stencil because stencil is always GL_UNSIGNED_INT. @@ -1611,8 +1611,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_ARGB2101010_UINT, - "MESA_FORMAT_ARGB2101010_UINT", + MESA_FORMAT_B10G10R10A2_UINT, + "MESA_FORMAT_B10G10R10A2_UINT", GL_RGBA, GL_UNSIGNED_INT, 10, 10, 10, 2, @@ -1620,8 +1620,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_ABGR2101010_UINT, - "MESA_FORMAT_ABGR2101010_UINT", + MESA_FORMAT_R10G10B10A2_UINT, + "MESA_FORMAT_R10G10B10A2_UINT", GL_RGBA, GL_UNSIGNED_INT, 10, 10, 10, 2, @@ -1629,8 +1629,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XRGB4444_UNORM, - "MESA_FORMAT_XRGB4444_UNORM", + MESA_FORMAT_B4G4R4X4_UNORM, + "MESA_FORMAT_B4G4R4X4_UNORM", GL_RGB, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 0, @@ -1638,8 +1638,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_XRGB1555_UNORM, - "MESA_FORMAT_XRGB1555_UNORM", + MESA_FORMAT_B5G5R5X1_UNORM, + "MESA_FORMAT_B5G5R5X1_UNORM", GL_RGB, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 0, @@ -1647,8 +1647,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_XBGR8888_SNORM, - "MESA_FORMAT_XBGR8888_SNORM", + MESA_FORMAT_R8G8B8X8_SNORM, + "MESA_FORMAT_R8G8B8X8_SNORM", GL_RGB, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, @@ -1656,8 +1656,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR8888_SRGB, - "MESA_FORMAT_XBGR8888_SRGB", + MESA_FORMAT_R8G8B8X8_SRGB, + "MESA_FORMAT_R8G8B8X8_SRGB", GL_RGB, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, @@ -1665,8 +1665,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR8888_UINT, - "MESA_FORMAT_XBGR8888_UINT", + MESA_FORMAT_RGBX_UINT8, + "MESA_FORMAT_RGBX_UINT8", GL_RGB, GL_UNSIGNED_INT, 8, 8, 8, 0, @@ -1674,8 +1674,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR8888_SINT, - "MESA_FORMAT_XBGR8888_SINT", + MESA_FORMAT_RGBX_SINT8, + "MESA_FORMAT_RGBX_SINT8", GL_RGB, GL_INT, 8, 8, 8, 0, @@ -1683,8 +1683,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XRGB2101010_UNORM, - "MESA_FORMAT_XRGB2101010_UNORM", + MESA_FORMAT_B10G10R10X2_UNORM, + "MESA_FORMAT_B10G10R10X2_UNORM", GL_RGB, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 0, @@ -1692,8 +1692,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_XBGR16161616_UNORM, - "MESA_FORMAT_XBGR16161616_UNORM", + MESA_FORMAT_RGBX_UNORM16, + "MESA_FORMAT_RGBX_UNORM16", GL_RGB, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, @@ -1701,8 +1701,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_SNORM, - "MESA_FORMAT_XBGR16161616_SNORM", + MESA_FORMAT_RGBX_SNORM16, + "MESA_FORMAT_RGBX_SNORM16", GL_RGB, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, @@ -1710,8 +1710,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_FLOAT, - "MESA_FORMAT_XBGR16161616_FLOAT", + MESA_FORMAT_RGBX_FLOAT16, + "MESA_FORMAT_RGBX_FLOAT16", GL_RGB, GL_FLOAT, 16, 16, 16, 0, @@ -1719,8 +1719,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_UINT, - "MESA_FORMAT_XBGR16161616_UINT", + MESA_FORMAT_RGBX_UINT16, + "MESA_FORMAT_RGBX_UINT16", GL_RGB, GL_UNSIGNED_INT, 16, 16, 16, 0, @@ -1728,8 +1728,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR16161616_SINT, - "MESA_FORMAT_XBGR16161616_SINT", + MESA_FORMAT_RGBX_SINT16, + "MESA_FORMAT_RGBX_SINT16", GL_RGB, GL_INT, 16, 16, 16, 0, @@ -1737,8 +1737,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_XBGR32323232_FLOAT, - "MESA_FORMAT_XBGR32323232_FLOAT", + MESA_FORMAT_RGBX_FLOAT32, + "MESA_FORMAT_RGBX_FLOAT32", GL_RGB, GL_FLOAT, 32, 32, 32, 0, @@ -1746,8 +1746,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 16 }, { - MESA_FORMAT_XBGR32323232_UINT, - "MESA_FORMAT_XBGR32323232_UINT", + MESA_FORMAT_RGBX_UINT32, + "MESA_FORMAT_RGBX_UINT32", GL_RGB, GL_UNSIGNED_INT, 32, 32, 32, 0, @@ -1755,8 +1755,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 16 }, { - MESA_FORMAT_XBGR32323232_SINT, - "MESA_FORMAT_XBGR32323232_SINT", + MESA_FORMAT_RGBX_SINT32, + "MESA_FORMAT_RGBX_SINT32", GL_RGB, GL_INT, 32, 32, 32, 0, @@ -1764,8 +1764,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 16 }, { - MESA_FORMAT_ABGR2101010, - "MESA_FORMAT_ABGR2101010", + MESA_FORMAT_R10G10B10A2_UNORM, + "MESA_FORMAT_R10G10B10A2_UNORM", GL_RGBA, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, @@ -1773,8 +1773,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_SIGNED_RG88, - "MESA_FORMAT_SIGNED_RG88", + MESA_FORMAT_G8R8_SNORM, + "MESA_FORMAT_G8R8_SNORM", GL_RG, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, @@ -1782,8 +1782,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_SIGNED_RG1616, - "MESA_FORMAT_SIGNED_RG1616", + MESA_FORMAT_G16R16_SNORM, + "MESA_FORMAT_G16R16_SNORM", GL_RG, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, @@ -1795,7 +1795,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = static const struct gl_format_info * -_mesa_get_format_info(gl_format format) +_mesa_get_format_info(mesa_format format) { const struct gl_format_info *info = &format_info[format]; assert(info->Name == format); @@ -1805,7 +1805,7 @@ _mesa_get_format_info(gl_format format) /** Return string name of format (for debugging) */ const char * -_mesa_get_format_name(gl_format format) +_mesa_get_format_name(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return info->StrName; @@ -1821,7 +1821,7 @@ _mesa_get_format_name(gl_format format) * Note: not GLuint, so as not to coerce math to unsigned. cf. fdo #37351 */ GLint -_mesa_get_format_bytes(gl_format format) +_mesa_get_format_bytes(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); ASSERT(info->BytesPerBlock); @@ -1837,7 +1837,7 @@ _mesa_get_format_bytes(gl_format format) * \param pname the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc. */ GLint -_mesa_get_format_bits(gl_format format, GLenum pname) +_mesa_get_format_bits(mesa_format format, GLenum pname) { const struct gl_format_info *info = _mesa_get_format_info(format); @@ -1886,7 +1886,7 @@ _mesa_get_format_bits(gl_format format, GLenum pname) GLuint -_mesa_get_format_max_bits(gl_format format) +_mesa_get_format_max_bits(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); GLuint max = MAX2(info->RedBits, info->GreenBits); @@ -1911,7 +1911,7 @@ _mesa_get_format_max_bits(gl_format format) * GL_FLOAT = an ordinary float */ GLenum -_mesa_get_format_datatype(gl_format format) +_mesa_get_format_datatype(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return info->DataType; @@ -1924,7 +1924,7 @@ _mesa_get_format_datatype(gl_format format) * GL_YCBCR_MESA, GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL. */ GLenum -_mesa_get_format_base_format(gl_format format) +_mesa_get_format_base_format(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return info->BaseFormat; @@ -1939,7 +1939,7 @@ _mesa_get_format_base_format(gl_format format) * \param bh returns block height in pixels */ void -_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh) +_mesa_get_format_block_size(mesa_format format, GLuint *bw, GLuint *bh) { const struct gl_format_info *info = _mesa_get_format_info(format); *bw = info->BlockWidth; @@ -1949,7 +1949,7 @@ _mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh) /** Is the given format a compressed format? */ GLboolean -_mesa_is_format_compressed(gl_format format) +_mesa_is_format_compressed(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return info->BlockWidth > 1 || info->BlockHeight > 1; @@ -1960,7 +1960,7 @@ _mesa_is_format_compressed(gl_format format) * Determine if the given format represents a packed depth/stencil buffer. */ GLboolean -_mesa_is_format_packed_depth_stencil(gl_format format) +_mesa_is_format_packed_depth_stencil(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); @@ -1972,7 +1972,7 @@ _mesa_is_format_packed_depth_stencil(gl_format format) * Is the given format a signed/unsigned integer color format? */ GLboolean -_mesa_is_format_integer_color(gl_format format) +_mesa_is_format_integer_color(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return (info->DataType == GL_INT || info->DataType == GL_UNSIGNED_INT) && @@ -1986,7 +1986,7 @@ _mesa_is_format_integer_color(gl_format format) * Is the given format an unsigned integer format? */ GLboolean -_mesa_is_format_unsigned(gl_format format) +_mesa_is_format_unsigned(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return _mesa_is_type_unsigned(info->DataType); @@ -1997,10 +1997,10 @@ _mesa_is_format_unsigned(gl_format format) * Does the given format store signed values? */ GLboolean -_mesa_is_format_signed(gl_format format) +_mesa_is_format_signed(mesa_format format) { - if (format == MESA_FORMAT_R11_G11_B10_FLOAT || - format == MESA_FORMAT_RGB9_E5_FLOAT) { + if (format == MESA_FORMAT_R11G11B10_FLOAT || + format == MESA_FORMAT_R9G9B9E5_FLOAT) { /* these packed float formats only store unsigned values */ return GL_FALSE; } @@ -2018,20 +2018,20 @@ _mesa_is_format_signed(gl_format format) * \return GL_LINEAR or GL_SRGB */ GLenum -_mesa_get_format_color_encoding(gl_format format) +_mesa_get_format_color_encoding(mesa_format format) { /* XXX this info should be encoded in gl_format_info */ switch (format) { - case MESA_FORMAT_SRGB8: - case MESA_FORMAT_SRGBA8: - case MESA_FORMAT_SARGB8: - case MESA_FORMAT_SL8: - case MESA_FORMAT_SLA8: + case MESA_FORMAT_BGR_SRGB8: + case MESA_FORMAT_A8B8G8R8_SRGB: + case MESA_FORMAT_B8G8R8A8_SRGB: + case MESA_FORMAT_L_SRGB8: + case MESA_FORMAT_L8A8_SRGB: case MESA_FORMAT_SRGB_DXT1: case MESA_FORMAT_SRGBA_DXT1: case MESA_FORMAT_SRGBA_DXT3: case MESA_FORMAT_SRGBA_DXT5: - case MESA_FORMAT_XBGR8888_SRGB: + case MESA_FORMAT_R8G8B8X8_SRGB: case MESA_FORMAT_ETC2_SRGB8: case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: @@ -2046,24 +2046,24 @@ _mesa_get_format_color_encoding(gl_format format) * For an sRGB format, return the corresponding linear color space format. * For non-sRGB formats, return the format as-is. */ -gl_format -_mesa_get_srgb_format_linear(gl_format format) +mesa_format +_mesa_get_srgb_format_linear(mesa_format format) { switch (format) { - case MESA_FORMAT_SRGB8: - format = MESA_FORMAT_RGB888; + case MESA_FORMAT_BGR_SRGB8: + format = MESA_FORMAT_BGR_UNORM8; break; - case MESA_FORMAT_SRGBA8: - format = MESA_FORMAT_RGBA8888; + case MESA_FORMAT_A8B8G8R8_SRGB: + format = MESA_FORMAT_A8B8G8R8_UNORM; break; - case MESA_FORMAT_SARGB8: - format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_B8G8R8A8_SRGB: + format = MESA_FORMAT_B8G8R8A8_UNORM; break; - case MESA_FORMAT_SL8: - format = MESA_FORMAT_L8; + case MESA_FORMAT_L_SRGB8: + format = MESA_FORMAT_L_UNORM8; break; - case MESA_FORMAT_SLA8: - format = MESA_FORMAT_AL88; + case MESA_FORMAT_L8A8_SRGB: + format = MESA_FORMAT_L8A8_UNORM; break; case MESA_FORMAT_SRGB_DXT1: format = MESA_FORMAT_RGB_DXT1; @@ -2077,8 +2077,8 @@ _mesa_get_srgb_format_linear(gl_format format) case MESA_FORMAT_SRGBA_DXT5: format = MESA_FORMAT_RGBA_DXT5; break; - case MESA_FORMAT_XBGR8888_SRGB: - format = MESA_FORMAT_RGBX8888_REV; + case MESA_FORMAT_R8G8B8X8_SRGB: + format = MESA_FORMAT_R8G8B8X8_UNORM; break; case MESA_FORMAT_ETC2_SRGB8: format = MESA_FORMAT_ETC2_RGB8; @@ -2100,57 +2100,57 @@ _mesa_get_srgb_format_linear(gl_format format) * If the given format is a compressed format, return a corresponding * uncompressed format. */ -gl_format -_mesa_get_uncompressed_format(gl_format format) +mesa_format +_mesa_get_uncompressed_format(mesa_format format) { switch (format) { case MESA_FORMAT_RGB_FXT1: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_RGBA_FXT1: - return MESA_FORMAT_RGBA8888; + return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_SRGB_DXT1: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_SRGBA_DXT1: - return MESA_FORMAT_RGBA8888; + return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_RGBA_DXT3: case MESA_FORMAT_SRGBA_DXT3: - return MESA_FORMAT_RGBA8888; + return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_RGBA_DXT5: case MESA_FORMAT_SRGBA_DXT5: - return MESA_FORMAT_RGBA8888; - case MESA_FORMAT_RED_RGTC1: - return MESA_FORMAT_R8; - case MESA_FORMAT_SIGNED_RED_RGTC1: - return MESA_FORMAT_SIGNED_R8; - case MESA_FORMAT_RG_RGTC2: - return MESA_FORMAT_GR88; - case MESA_FORMAT_SIGNED_RG_RGTC2: - return MESA_FORMAT_SIGNED_RG88_REV; - case MESA_FORMAT_L_LATC1: - return MESA_FORMAT_L8; - case MESA_FORMAT_SIGNED_L_LATC1: - return MESA_FORMAT_SIGNED_L8; - case MESA_FORMAT_LA_LATC2: - return MESA_FORMAT_AL88; - case MESA_FORMAT_SIGNED_LA_LATC2: - return MESA_FORMAT_SIGNED_AL88; + return MESA_FORMAT_A8B8G8R8_UNORM; + case MESA_FORMAT_R_RGTC1_UNORM: + return MESA_FORMAT_R_UNORM8; + case MESA_FORMAT_R_RGTC1_SNORM: + return MESA_FORMAT_R_SNORM8; + case MESA_FORMAT_RG_RGTC2_UNORM: + return MESA_FORMAT_R8G8_UNORM; + case MESA_FORMAT_RG_RGTC2_SNORM: + return MESA_FORMAT_R8G8_SNORM; + case MESA_FORMAT_L_LATC1_UNORM: + return MESA_FORMAT_L_UNORM8; + case MESA_FORMAT_L_LATC1_SNORM: + return MESA_FORMAT_L_SNORM8; + case MESA_FORMAT_LA_LATC2_UNORM: + return MESA_FORMAT_L8A8_UNORM; + case MESA_FORMAT_LA_LATC2_SNORM: + return MESA_FORMAT_L8A8_SNORM; case MESA_FORMAT_ETC1_RGB8: case MESA_FORMAT_ETC2_RGB8: case MESA_FORMAT_ETC2_SRGB8: - return MESA_FORMAT_RGB888; + return MESA_FORMAT_BGR_UNORM8; case MESA_FORMAT_ETC2_RGBA8_EAC: case MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC: case MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1: case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: - return MESA_FORMAT_RGBA8888; + return MESA_FORMAT_A8B8G8R8_UNORM; case MESA_FORMAT_ETC2_R11_EAC: case MESA_FORMAT_ETC2_SIGNED_R11_EAC: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case MESA_FORMAT_ETC2_RG11_EAC: case MESA_FORMAT_ETC2_SIGNED_RG11_EAC: - return MESA_FORMAT_GR1616; + return MESA_FORMAT_R16G16_UNORM; default: #ifdef DEBUG assert(!_mesa_is_format_compressed(format)); @@ -2161,7 +2161,7 @@ _mesa_get_uncompressed_format(gl_format format) GLuint -_mesa_format_num_components(gl_format format) +_mesa_format_num_components(mesa_format format) { const struct gl_format_info *info = _mesa_get_format_info(format); return ((info->RedBits > 0) + @@ -2180,7 +2180,7 @@ _mesa_format_num_components(gl_format format) * in the given format. */ GLuint -_mesa_format_image_size(gl_format format, GLsizei width, +_mesa_format_image_size(mesa_format format, GLsizei width, GLsizei height, GLsizei depth) { const struct gl_format_info *info = _mesa_get_format_info(format); @@ -2206,7 +2206,7 @@ _mesa_format_image_size(gl_format format, GLsizei width, * accomodate very large textures. */ uint64_t -_mesa_format_image_size64(gl_format format, GLsizei width, +_mesa_format_image_size64(mesa_format format, GLsizei width, GLsizei height, GLsizei depth) { const struct gl_format_info *info = _mesa_get_format_info(format); @@ -2232,7 +2232,7 @@ _mesa_format_image_size64(gl_format format, GLsizei width, GLint -_mesa_format_row_stride(gl_format format, GLsizei width) +_mesa_format_row_stride(mesa_format format, GLsizei width) { const struct gl_format_info *info = _mesa_get_format_info(format); /* Strictly speaking, a conditional isn't needed here */ @@ -2259,7 +2259,7 @@ _mesa_format_row_stride(gl_format format, GLsizei width) static void check_format_to_type_and_comps(void) { - gl_format f; + mesa_format f; for (f = MESA_FORMAT_NONE + 1; f < MESA_FORMAT_COUNT; f++) { GLenum datatype = 0; @@ -2364,99 +2364,99 @@ _mesa_test_formats(void) /** - * Return datatype and number of components per texel for the given gl_format. + * Return datatype and number of components per texel for the given mesa_format. * Only used for mipmap generation code. */ void -_mesa_format_to_type_and_comps(gl_format format, +_mesa_format_to_type_and_comps(mesa_format format, GLenum *datatype, GLuint *comps) { switch (format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: - case MESA_FORMAT_RGBX8888: - case MESA_FORMAT_RGBX8888_REV: - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_XRGB8888_REV: + case MESA_FORMAT_A8B8G8R8_UNORM: + case MESA_FORMAT_R8G8B8A8_UNORM: + case MESA_FORMAT_B8G8R8A8_UNORM: + case MESA_FORMAT_A8R8G8B8_UNORM: + case MESA_FORMAT_X8B8G8R8_UNORM: + case MESA_FORMAT_R8G8B8X8_UNORM: + case MESA_FORMAT_B8G8R8X8_UNORM: + case MESA_FORMAT_X8R8G8B8_UNORM: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_RGB_UNORM8: *datatype = GL_UNSIGNED_BYTE; *comps = 3; return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: + case MESA_FORMAT_B5G6R5_UNORM: + case MESA_FORMAT_R5G6B5_UNORM: *datatype = GL_UNSIGNED_SHORT_5_6_5; *comps = 3; return; - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - case MESA_FORMAT_XRGB4444_UNORM: + case MESA_FORMAT_B4G4R4A4_UNORM: + case MESA_FORMAT_A4R4G4B4_UNORM: + case MESA_FORMAT_B4G4R4X4_UNORM: *datatype = GL_UNSIGNED_SHORT_4_4_4_4; *comps = 4; return; - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - case MESA_FORMAT_XRGB1555_UNORM: + case MESA_FORMAT_B5G5R5A1_UNORM: + case MESA_FORMAT_A1R5G5B5_UNORM: + case MESA_FORMAT_B5G5R5X1_UNORM: *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; *comps = 4; return; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: *datatype = GL_UNSIGNED_INT_2_10_10_10_REV; *comps = 4; return; - case MESA_FORMAT_RGBA5551: + case MESA_FORMAT_A1B5G5R5_UNORM: *datatype = GL_UNSIGNED_SHORT_5_5_5_1; *comps = 4; return; - case MESA_FORMAT_AL44: + case MESA_FORMAT_L4A4_UNORM: *datatype = MESA_UNSIGNED_BYTE_4_4; *comps = 2; return; - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - case MESA_FORMAT_GR88: - case MESA_FORMAT_RG88: + case MESA_FORMAT_L8A8_UNORM: + case MESA_FORMAT_A8L8_UNORM: + case MESA_FORMAT_R8G8_UNORM: + case MESA_FORMAT_G8R8_UNORM: *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; - case MESA_FORMAT_AL1616: - case MESA_FORMAT_AL1616_REV: - case MESA_FORMAT_GR1616: - case MESA_FORMAT_RG1616: + case MESA_FORMAT_L16A16_UNORM: + case MESA_FORMAT_A16L16_UNORM: + case MESA_FORMAT_R16G16_UNORM: + case MESA_FORMAT_G16R16_UNORM: *datatype = GL_UNSIGNED_SHORT; *comps = 2; return; - case MESA_FORMAT_R16: - case MESA_FORMAT_A16: - case MESA_FORMAT_L16: - case MESA_FORMAT_I16: + case MESA_FORMAT_R_UNORM16: + case MESA_FORMAT_A_UNORM16: + case MESA_FORMAT_L_UNORM16: + case MESA_FORMAT_I_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; return; - case MESA_FORMAT_RGB332: + case MESA_FORMAT_B2G3R3_UNORM: *datatype = GL_UNSIGNED_BYTE_3_3_2; *comps = 3; return; - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_R8: - case MESA_FORMAT_S8: + case MESA_FORMAT_A_UNORM8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_I_UNORM8: + case MESA_FORMAT_R_UNORM8: + case MESA_FORMAT_S_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; @@ -2467,42 +2467,42 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 2; return; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: *datatype = GL_UNSIGNED_INT_24_8_MESA; *comps = 2; return; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: *datatype = GL_UNSIGNED_INT_8_24_REV_MESA; *comps = 2; return; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; return; - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_S8_UINT: *datatype = GL_UNSIGNED_INT; *comps = 1; return; - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_X8Z24_UNORM: *datatype = GL_UNSIGNED_INT; *comps = 1; return; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: *datatype = GL_UNSIGNED_INT; *comps = 1; return; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: *datatype = GL_FLOAT; *comps = 1; return; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: *datatype = GL_FLOAT_32_UNSIGNED_INT_24_8_REV; *comps = 1; return; @@ -2512,65 +2512,65 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 2; return; - case MESA_FORMAT_SIGNED_R8: - case MESA_FORMAT_SIGNED_A8: - case MESA_FORMAT_SIGNED_L8: - case MESA_FORMAT_SIGNED_I8: + case MESA_FORMAT_R_SNORM8: + case MESA_FORMAT_A_SNORM8: + case MESA_FORMAT_L_SNORM8: + case MESA_FORMAT_I_SNORM8: *datatype = GL_BYTE; *comps = 1; return; - case MESA_FORMAT_SIGNED_RG88_REV: - case MESA_FORMAT_SIGNED_AL88: + case MESA_FORMAT_R8G8_SNORM: + case MESA_FORMAT_L8A8_SNORM: *datatype = GL_BYTE; *comps = 2; return; - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - case MESA_FORMAT_SIGNED_RGBX8888: + case MESA_FORMAT_A8B8G8R8_SNORM: + case MESA_FORMAT_R8G8B8A8_SNORM: + case MESA_FORMAT_X8B8G8R8_SNORM: *datatype = GL_BYTE; *comps = 4; return; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: *datatype = GL_UNSIGNED_SHORT; *comps = 4; return; - case MESA_FORMAT_SIGNED_R16: - case MESA_FORMAT_SIGNED_A16: - case MESA_FORMAT_SIGNED_L16: - case MESA_FORMAT_SIGNED_I16: + case MESA_FORMAT_R_SNORM16: + case MESA_FORMAT_A_SNORM16: + case MESA_FORMAT_L_SNORM16: + case MESA_FORMAT_I_SNORM16: *datatype = GL_SHORT; *comps = 1; return; - case MESA_FORMAT_SIGNED_GR1616: - case MESA_FORMAT_SIGNED_AL1616: + case MESA_FORMAT_R16G16_SNORM: + case MESA_FORMAT_LA_SNORM16: *datatype = GL_SHORT; *comps = 2; return; - case MESA_FORMAT_SIGNED_RGB_16: + case MESA_FORMAT_RGB_SNORM16: *datatype = GL_SHORT; *comps = 3; return; - case MESA_FORMAT_SIGNED_RGBA_16: + case MESA_FORMAT_RGBA_SNORM16: *datatype = GL_SHORT; *comps = 4; return; - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_SRGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 3; return; - case MESA_FORMAT_SRGBA8: - case MESA_FORMAT_SARGB8: + case MESA_FORMAT_A8B8G8R8_SRGB: + case MESA_FORMAT_B8G8R8A8_SRGB: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_SRGB8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; - case MESA_FORMAT_SLA8: + case MESA_FORMAT_L8A8_SRGB: *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; @@ -2585,14 +2585,14 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_SRGBA_DXT1: case MESA_FORMAT_SRGBA_DXT3: case MESA_FORMAT_SRGBA_DXT5: - case MESA_FORMAT_RED_RGTC1: - case MESA_FORMAT_SIGNED_RED_RGTC1: - case MESA_FORMAT_RG_RGTC2: - case MESA_FORMAT_SIGNED_RG_RGTC2: - case MESA_FORMAT_L_LATC1: - case MESA_FORMAT_SIGNED_L_LATC1: - case MESA_FORMAT_LA_LATC2: - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_R_RGTC1_UNORM: + case MESA_FORMAT_R_RGTC1_SNORM: + case MESA_FORMAT_RG_RGTC2_UNORM: + case MESA_FORMAT_RG_RGTC2_SNORM: + case MESA_FORMAT_L_LATC1_UNORM: + case MESA_FORMAT_L_LATC1_SNORM: + case MESA_FORMAT_LA_LATC2_UNORM: + case MESA_FORMAT_LA_LATC2_SNORM: case MESA_FORMAT_ETC1_RGB8: case MESA_FORMAT_ETC2_RGB8: case MESA_FORMAT_ETC2_SRGB8: @@ -2625,140 +2625,140 @@ _mesa_format_to_type_and_comps(gl_format format, *datatype = GL_HALF_FLOAT_ARB; *comps = 3; return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + case MESA_FORMAT_LA_FLOAT32: case MESA_FORMAT_RG_FLOAT32: *datatype = GL_FLOAT; *comps = 2; return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + case MESA_FORMAT_LA_FLOAT16: case MESA_FORMAT_RG_FLOAT16: *datatype = GL_HALF_FLOAT_ARB; *comps = 2; return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: + case MESA_FORMAT_A_FLOAT32: + case MESA_FORMAT_L_FLOAT32: + case MESA_FORMAT_I_FLOAT32: case MESA_FORMAT_R_FLOAT32: *datatype = GL_FLOAT; *comps = 1; return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: + case MESA_FORMAT_A_FLOAT16: + case MESA_FORMAT_L_FLOAT16: + case MESA_FORMAT_I_FLOAT16: case MESA_FORMAT_R_FLOAT16: *datatype = GL_HALF_FLOAT_ARB; *comps = 1; return; - case MESA_FORMAT_ALPHA_UINT8: - case MESA_FORMAT_LUMINANCE_UINT8: - case MESA_FORMAT_INTENSITY_UINT8: + case MESA_FORMAT_A_UINT8: + case MESA_FORMAT_L_UINT8: + case MESA_FORMAT_I_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT8: + case MESA_FORMAT_LA_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; - case MESA_FORMAT_ALPHA_UINT16: - case MESA_FORMAT_LUMINANCE_UINT16: - case MESA_FORMAT_INTENSITY_UINT16: + case MESA_FORMAT_A_UINT16: + case MESA_FORMAT_L_UINT16: + case MESA_FORMAT_I_UINT16: *datatype = GL_UNSIGNED_SHORT; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT16: + case MESA_FORMAT_LA_UINT16: *datatype = GL_UNSIGNED_SHORT; *comps = 2; return; - case MESA_FORMAT_ALPHA_UINT32: - case MESA_FORMAT_LUMINANCE_UINT32: - case MESA_FORMAT_INTENSITY_UINT32: + case MESA_FORMAT_A_UINT32: + case MESA_FORMAT_L_UINT32: + case MESA_FORMAT_I_UINT32: *datatype = GL_UNSIGNED_INT; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT32: + case MESA_FORMAT_LA_UINT32: *datatype = GL_UNSIGNED_INT; *comps = 2; return; - case MESA_FORMAT_ALPHA_INT8: - case MESA_FORMAT_LUMINANCE_INT8: - case MESA_FORMAT_INTENSITY_INT8: + case MESA_FORMAT_A_SINT8: + case MESA_FORMAT_L_SINT8: + case MESA_FORMAT_I_SINT8: *datatype = GL_BYTE; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_INT8: + case MESA_FORMAT_LA_SINT8: *datatype = GL_BYTE; *comps = 2; return; - case MESA_FORMAT_ALPHA_INT16: - case MESA_FORMAT_LUMINANCE_INT16: - case MESA_FORMAT_INTENSITY_INT16: + case MESA_FORMAT_A_SINT16: + case MESA_FORMAT_L_SINT16: + case MESA_FORMAT_I_SINT16: *datatype = GL_SHORT; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_INT16: + case MESA_FORMAT_LA_SINT16: *datatype = GL_SHORT; *comps = 2; return; - case MESA_FORMAT_ALPHA_INT32: - case MESA_FORMAT_LUMINANCE_INT32: - case MESA_FORMAT_INTENSITY_INT32: + case MESA_FORMAT_A_SINT32: + case MESA_FORMAT_L_SINT32: + case MESA_FORMAT_I_SINT32: *datatype = GL_INT; *comps = 1; return; - case MESA_FORMAT_LUMINANCE_ALPHA_INT32: + case MESA_FORMAT_LA_SINT32: *datatype = GL_INT; *comps = 2; return; - case MESA_FORMAT_R_INT8: + case MESA_FORMAT_R_SINT8: *datatype = GL_BYTE; *comps = 1; return; - case MESA_FORMAT_RG_INT8: + case MESA_FORMAT_RG_SINT8: *datatype = GL_BYTE; *comps = 2; return; - case MESA_FORMAT_RGB_INT8: + case MESA_FORMAT_RGB_SINT8: *datatype = GL_BYTE; *comps = 3; return; - case MESA_FORMAT_RGBA_INT8: + case MESA_FORMAT_RGBA_SINT8: *datatype = GL_BYTE; *comps = 4; return; - case MESA_FORMAT_R_INT16: + case MESA_FORMAT_R_SINT16: *datatype = GL_SHORT; *comps = 1; return; - case MESA_FORMAT_RG_INT16: + case MESA_FORMAT_RG_SINT16: *datatype = GL_SHORT; *comps = 2; return; - case MESA_FORMAT_RGB_INT16: + case MESA_FORMAT_RGB_SINT16: *datatype = GL_SHORT; *comps = 3; return; - case MESA_FORMAT_RGBA_INT16: + case MESA_FORMAT_RGBA_SINT16: *datatype = GL_SHORT; *comps = 4; return; - case MESA_FORMAT_R_INT32: + case MESA_FORMAT_R_SINT32: *datatype = GL_INT; *comps = 1; return; - case MESA_FORMAT_RG_INT32: + case MESA_FORMAT_RG_SINT32: *datatype = GL_INT; *comps = 2; return; - case MESA_FORMAT_RGB_INT32: + case MESA_FORMAT_RGB_SINT32: *datatype = GL_INT; *comps = 3; return; - case MESA_FORMAT_RGBA_INT32: + case MESA_FORMAT_RGBA_SINT32: *datatype = GL_INT; *comps = 4; return; @@ -2815,82 +2815,82 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 4; return; - case MESA_FORMAT_RGB9_E5_FLOAT: + case MESA_FORMAT_R9G9B9E5_FLOAT: *datatype = GL_UNSIGNED_INT_5_9_9_9_REV; *comps = 3; return; - case MESA_FORMAT_R11_G11_B10_FLOAT: + case MESA_FORMAT_R11G11B10_FLOAT: *datatype = GL_UNSIGNED_INT_10F_11F_11F_REV; *comps = 3; return; - case MESA_FORMAT_ARGB2101010_UINT: - case MESA_FORMAT_ABGR2101010_UINT: + case MESA_FORMAT_B10G10R10A2_UINT: + case MESA_FORMAT_R10G10B10A2_UINT: *datatype = GL_UNSIGNED_INT_2_10_10_10_REV; *comps = 4; return; - case MESA_FORMAT_XBGR8888_SRGB: - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_R8G8B8X8_SRGB: + case MESA_FORMAT_RGBX_UINT8: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; - case MESA_FORMAT_XBGR8888_SNORM: - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_R8G8B8X8_SNORM: + case MESA_FORMAT_RGBX_SINT8: *datatype = GL_BYTE; *comps = 4; return; - case MESA_FORMAT_XRGB2101010_UNORM: + case MESA_FORMAT_B10G10R10X2_UNORM: *datatype = GL_UNSIGNED_INT_2_10_10_10_REV; *comps = 4; return; - case MESA_FORMAT_XBGR16161616_UNORM: - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UNORM16: + case MESA_FORMAT_RGBX_UINT16: *datatype = GL_UNSIGNED_SHORT; *comps = 4; return; - case MESA_FORMAT_XBGR16161616_SNORM: - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SNORM16: + case MESA_FORMAT_RGBX_SINT16: *datatype = GL_SHORT; *comps = 4; return; - case MESA_FORMAT_XBGR16161616_FLOAT: + case MESA_FORMAT_RGBX_FLOAT16: *datatype = GL_HALF_FLOAT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_FLOAT: + case MESA_FORMAT_RGBX_FLOAT32: *datatype = GL_FLOAT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_RGBX_UINT32: *datatype = GL_UNSIGNED_INT; *comps = 4; return; - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_SINT32: *datatype = GL_INT; *comps = 4; return; - case MESA_FORMAT_ABGR2101010: + case MESA_FORMAT_R10G10B10A2_UNORM: *datatype = GL_UNSIGNED_INT_2_10_10_10_REV; *comps = 4; return; - case MESA_FORMAT_SIGNED_RG88: + case MESA_FORMAT_G8R8_SNORM: *datatype = GL_BYTE; *comps = 2; return; - case MESA_FORMAT_SIGNED_RG1616: + case MESA_FORMAT_G16R16_SNORM: *datatype = GL_SHORT; *comps = 2; return; @@ -2912,16 +2912,16 @@ _mesa_format_to_type_and_comps(gl_format format, } /** - * Check if a gl_format exactly matches a GL format/type combination + * Check if a mesa_format exactly matches a GL format/type combination * such that we can use memcpy() from one to the other. - * \param gl_format a MESA_FORMAT_x value + * \param mesa_format a MESA_FORMAT_x value * \param format the user-specified image format * \param type the user-specified image datatype * \param swapBytes typically the current pixel pack/unpack byteswap state * \return GL_TRUE if the formats match, GL_FALSE otherwise. */ GLboolean -_mesa_format_matches_format_and_type(gl_format gl_format, +_mesa_format_matches_format_and_type(mesa_format mesa_format, GLenum format, GLenum type, GLboolean swapBytes) { @@ -2936,14 +2936,14 @@ _mesa_format_matches_format_and_type(gl_format gl_format, * enums in formats.h. */ - switch (gl_format) { + switch (mesa_format) { case MESA_FORMAT_NONE: case MESA_FORMAT_COUNT: return GL_FALSE; - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_A8B8G8R8_UNORM: + case MESA_FORMAT_A8B8G8R8_SRGB: if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes) return GL_TRUE; @@ -2966,7 +2966,7 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_UNORM: if (format == GL_RGBA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !swapBytes) return GL_TRUE; @@ -2990,8 +2990,8 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_SARGB8: + case MESA_FORMAT_B8G8R8A8_UNORM: + case MESA_FORMAT_B8G8R8A8_SRGB: if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !swapBytes) return GL_TRUE; @@ -3004,7 +3004,7 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_ARGB8888_REV: + case MESA_FORMAT_A8R8G8B8_UNORM: if (format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8 && !swapBytes) return GL_TRUE; @@ -3017,77 +3017,77 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_RGBX8888: - case MESA_FORMAT_RGBX8888_REV: + case MESA_FORMAT_X8B8G8R8_UNORM: + case MESA_FORMAT_R8G8B8X8_UNORM: return GL_FALSE; - case MESA_FORMAT_XRGB8888: - case MESA_FORMAT_XRGB8888_REV: + case MESA_FORMAT_B8G8R8X8_UNORM: + case MESA_FORMAT_X8R8G8B8_UNORM: return GL_FALSE; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_UNORM8: + case MESA_FORMAT_BGR_SRGB8: return format == GL_BGR && type == GL_UNSIGNED_BYTE && littleEndian; - case MESA_FORMAT_BGR888: + case MESA_FORMAT_RGB_UNORM8: return format == GL_RGB && type == GL_UNSIGNED_BYTE && littleEndian; - case MESA_FORMAT_RGB565: + case MESA_FORMAT_B5G6R5_UNORM: return format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && !swapBytes; - case MESA_FORMAT_RGB565_REV: + case MESA_FORMAT_R5G6B5_UNORM: /* Some of the 16-bit MESA_FORMATs that would seem to correspond to * GL_UNSIGNED_SHORT_* are byte-swapped instead of channel-reversed, * according to formats.h, so they can't be matched. */ return GL_FALSE; - case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_B4G4R4A4_UNORM: return format == GL_BGRA && type == GL_UNSIGNED_SHORT_4_4_4_4_REV && !swapBytes; - case MESA_FORMAT_ARGB4444_REV: + case MESA_FORMAT_A4R4G4B4_UNORM: return GL_FALSE; - case MESA_FORMAT_RGBA5551: + case MESA_FORMAT_A1B5G5R5_UNORM: return format == GL_RGBA && type == GL_UNSIGNED_SHORT_5_5_5_1 && !swapBytes; - case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_B5G5R5A1_UNORM: return format == GL_BGRA && type == GL_UNSIGNED_SHORT_1_5_5_5_REV && !swapBytes; - case MESA_FORMAT_ARGB1555_REV: + case MESA_FORMAT_A1R5G5B5_UNORM: return GL_FALSE; - case MESA_FORMAT_AL44: + case MESA_FORMAT_L4A4_UNORM: return GL_FALSE; - case MESA_FORMAT_AL88: - case MESA_FORMAT_SLA8: + case MESA_FORMAT_L8A8_UNORM: + case MESA_FORMAT_L8A8_SRGB: return format == GL_LUMINANCE_ALPHA && type == GL_UNSIGNED_BYTE && littleEndian; - case MESA_FORMAT_AL88_REV: + case MESA_FORMAT_A8L8_UNORM: return GL_FALSE; - case MESA_FORMAT_AL1616: + case MESA_FORMAT_L16A16_UNORM: return format == GL_LUMINANCE_ALPHA && type == GL_UNSIGNED_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_AL1616_REV: + case MESA_FORMAT_A16L16_UNORM: return GL_FALSE; - case MESA_FORMAT_RGB332: + case MESA_FORMAT_B2G3R3_UNORM: return format == GL_RGB && type == GL_UNSIGNED_BYTE_3_3_2; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return format == GL_ALPHA && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_A16: + case MESA_FORMAT_A_UNORM16: return format == GL_ALPHA && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_L8: - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_UNORM8: + case MESA_FORMAT_L_SRGB8: return format == GL_LUMINANCE && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_L16: + case MESA_FORMAT_L_UNORM16: return format == GL_LUMINANCE && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return format == GL_INTENSITY && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_I16: + case MESA_FORMAT_I_UNORM16: return format == GL_INTENSITY && type == GL_UNSIGNED_SHORT && !swapBytes; case MESA_FORMAT_YCBCR: @@ -3099,45 +3099,45 @@ _mesa_format_matches_format_and_type(gl_format gl_format, ((type == GL_UNSIGNED_SHORT_8_8_MESA && littleEndian == swapBytes) || (type == GL_UNSIGNED_SHORT_8_8_REV_MESA && littleEndian != swapBytes)); - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return format == GL_RED && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_GR88: + case MESA_FORMAT_R8G8_UNORM: return format == GL_RG && type == GL_UNSIGNED_BYTE && littleEndian; - case MESA_FORMAT_RG88: + case MESA_FORMAT_G8R8_UNORM: return GL_FALSE; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return format == GL_RED && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_GR1616: + case MESA_FORMAT_R16G16_UNORM: return format == GL_RG && type == GL_UNSIGNED_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_RG1616: + case MESA_FORMAT_G16R16_UNORM: return GL_FALSE; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: return format == GL_BGRA && type == GL_UNSIGNED_INT_2_10_10_10_REV && !swapBytes; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: return format == GL_DEPTH_STENCIL && type == GL_UNSIGNED_INT_24_8 && !swapBytes; - case MESA_FORMAT_Z24_X8: - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_Z24_UNORM_X8_UINT: return GL_FALSE; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return format == GL_DEPTH_COMPONENT && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_S8_UINT: return GL_FALSE; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return format == GL_DEPTH_COMPONENT && type == GL_UNSIGNED_INT && !swapBytes; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return format == GL_STENCIL_INDEX && type == GL_UNSIGNED_BYTE; case MESA_FORMAT_SRGB_DXT1: @@ -3164,24 +3164,24 @@ _mesa_format_matches_format_and_type(gl_format gl_format, case MESA_FORMAT_RGB_FLOAT16: return format == GL_RGB && type == GL_HALF_FLOAT && !swapBytes; - case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_A_FLOAT32: return format == GL_ALPHA && type == GL_FLOAT && !swapBytes; - case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_A_FLOAT16: return format == GL_ALPHA && type == GL_HALF_FLOAT && !swapBytes; - case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_L_FLOAT32: return format == GL_LUMINANCE && type == GL_FLOAT && !swapBytes; - case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_L_FLOAT16: return format == GL_LUMINANCE && type == GL_HALF_FLOAT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + case MESA_FORMAT_LA_FLOAT32: return format == GL_LUMINANCE_ALPHA && type == GL_FLOAT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + case MESA_FORMAT_LA_FLOAT16: return format == GL_LUMINANCE_ALPHA && type == GL_HALF_FLOAT && !swapBytes; - case MESA_FORMAT_INTENSITY_FLOAT32: + case MESA_FORMAT_I_FLOAT32: return format == GL_INTENSITY && type == GL_FLOAT && !swapBytes; - case MESA_FORMAT_INTENSITY_FLOAT16: + case MESA_FORMAT_I_FLOAT16: return format == GL_INTENSITY && type == GL_HALF_FLOAT && !swapBytes; case MESA_FORMAT_R_FLOAT32: @@ -3194,88 +3194,88 @@ _mesa_format_matches_format_and_type(gl_format gl_format, case MESA_FORMAT_RG_FLOAT16: return format == GL_RG && type == GL_HALF_FLOAT && !swapBytes; - case MESA_FORMAT_ALPHA_UINT8: + case MESA_FORMAT_A_UINT8: return format == GL_ALPHA_INTEGER && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_ALPHA_UINT16: + case MESA_FORMAT_A_UINT16: return format == GL_ALPHA_INTEGER && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_ALPHA_UINT32: + case MESA_FORMAT_A_UINT32: return format == GL_ALPHA_INTEGER && type == GL_UNSIGNED_INT && !swapBytes; - case MESA_FORMAT_ALPHA_INT8: + case MESA_FORMAT_A_SINT8: return format == GL_ALPHA_INTEGER && type == GL_BYTE; - case MESA_FORMAT_ALPHA_INT16: + case MESA_FORMAT_A_SINT16: return format == GL_ALPHA_INTEGER && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_ALPHA_INT32: + case MESA_FORMAT_A_SINT32: return format == GL_ALPHA_INTEGER && type == GL_INT && !swapBytes; - case MESA_FORMAT_INTENSITY_UINT8: - case MESA_FORMAT_INTENSITY_UINT16: - case MESA_FORMAT_INTENSITY_UINT32: - case MESA_FORMAT_INTENSITY_INT8: - case MESA_FORMAT_INTENSITY_INT16: - case MESA_FORMAT_INTENSITY_INT32: + case MESA_FORMAT_I_UINT8: + case MESA_FORMAT_I_UINT16: + case MESA_FORMAT_I_UINT32: + case MESA_FORMAT_I_SINT8: + case MESA_FORMAT_I_SINT16: + case MESA_FORMAT_I_SINT32: /* GL_INTENSITY_INTEGER_EXT doesn't exist. */ return GL_FALSE; - case MESA_FORMAT_LUMINANCE_UINT8: + case MESA_FORMAT_L_UINT8: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_BYTE; - case MESA_FORMAT_LUMINANCE_UINT16: + case MESA_FORMAT_L_UINT16: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_LUMINANCE_UINT32: + case MESA_FORMAT_L_UINT32: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_UNSIGNED_INT && !swapBytes; - case MESA_FORMAT_LUMINANCE_INT8: + case MESA_FORMAT_L_SINT8: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_BYTE; - case MESA_FORMAT_LUMINANCE_INT16: + case MESA_FORMAT_L_SINT16: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_LUMINANCE_INT32: + case MESA_FORMAT_L_SINT32: return format == GL_LUMINANCE_INTEGER_EXT && type == GL_INT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT8: + case MESA_FORMAT_LA_UINT8: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_UNSIGNED_BYTE && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT16: + case MESA_FORMAT_LA_UINT16: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT32: + case MESA_FORMAT_LA_UINT32: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_UNSIGNED_INT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_INT8: + case MESA_FORMAT_LA_SINT8: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_BYTE && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_INT16: + case MESA_FORMAT_LA_SINT16: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_LUMINANCE_ALPHA_INT32: + case MESA_FORMAT_LA_SINT32: return format == GL_LUMINANCE_ALPHA_INTEGER_EXT && type == GL_INT && !swapBytes; - case MESA_FORMAT_R_INT8: + case MESA_FORMAT_R_SINT8: return format == GL_RED_INTEGER && type == GL_BYTE; - case MESA_FORMAT_RG_INT8: + case MESA_FORMAT_RG_SINT8: return format == GL_RG_INTEGER && type == GL_BYTE && !swapBytes; - case MESA_FORMAT_RGB_INT8: + case MESA_FORMAT_RGB_SINT8: return format == GL_RGB_INTEGER && type == GL_BYTE && !swapBytes; - case MESA_FORMAT_RGBA_INT8: + case MESA_FORMAT_RGBA_SINT8: return format == GL_RGBA_INTEGER && type == GL_BYTE && !swapBytes; - case MESA_FORMAT_R_INT16: + case MESA_FORMAT_R_SINT16: return format == GL_RED_INTEGER && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_RG_INT16: + case MESA_FORMAT_RG_SINT16: return format == GL_RG_INTEGER && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_RGB_INT16: + case MESA_FORMAT_RGB_SINT16: return format == GL_RGB_INTEGER && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_RGBA_INT16: + case MESA_FORMAT_RGBA_SINT16: return format == GL_RGBA_INTEGER && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_R_INT32: + case MESA_FORMAT_R_SINT32: return format == GL_RED_INTEGER && type == GL_INT && !swapBytes; - case MESA_FORMAT_RG_INT32: + case MESA_FORMAT_RG_SINT32: return format == GL_RG_INTEGER && type == GL_INT && !swapBytes; - case MESA_FORMAT_RGB_INT32: + case MESA_FORMAT_RGB_SINT32: return format == GL_RGB_INTEGER && type == GL_INT && !swapBytes; - case MESA_FORMAT_RGBA_INT32: + case MESA_FORMAT_RGBA_SINT32: return format == GL_RGBA_INTEGER && type == GL_INT && !swapBytes; case MESA_FORMAT_R_UINT8: @@ -3311,15 +3311,15 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return (format == GL_DU8DV8_ATI || format == GL_DUDV_ATI) && type == GL_BYTE && littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_R8: + case MESA_FORMAT_R_SNORM8: return format == GL_RED && type == GL_BYTE; - case MESA_FORMAT_SIGNED_RG88_REV: + case MESA_FORMAT_R8G8_SNORM: return format == GL_RG && type == GL_BYTE && littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_RGBX8888: + case MESA_FORMAT_X8B8G8R8_SNORM: return GL_FALSE; - case MESA_FORMAT_SIGNED_RGBA8888: + case MESA_FORMAT_A8B8G8R8_SNORM: if (format == GL_RGBA && type == GL_BYTE && !littleEndian) return GL_TRUE; @@ -3328,7 +3328,7 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_SIGNED_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_SNORM: if (format == GL_RGBA && type == GL_BYTE && littleEndian) return GL_TRUE; @@ -3337,29 +3337,29 @@ _mesa_format_matches_format_and_type(gl_format gl_format, return GL_FALSE; - case MESA_FORMAT_SIGNED_R16: + case MESA_FORMAT_R_SNORM16: return format == GL_RED && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_SIGNED_GR1616: + case MESA_FORMAT_R16G16_SNORM: return format == GL_RG && type == GL_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_RGB_16: + case MESA_FORMAT_RGB_SNORM16: return format == GL_RGB && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_SIGNED_RGBA_16: + case MESA_FORMAT_RGBA_SNORM16: return format == GL_RGBA && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return format == GL_RGBA && type == GL_UNSIGNED_SHORT && !swapBytes; - case MESA_FORMAT_RED_RGTC1: - case MESA_FORMAT_SIGNED_RED_RGTC1: - case MESA_FORMAT_RG_RGTC2: - case MESA_FORMAT_SIGNED_RG_RGTC2: + case MESA_FORMAT_R_RGTC1_UNORM: + case MESA_FORMAT_R_RGTC1_SNORM: + case MESA_FORMAT_RG_RGTC2_UNORM: + case MESA_FORMAT_RG_RGTC2_SNORM: return GL_FALSE; - case MESA_FORMAT_L_LATC1: - case MESA_FORMAT_SIGNED_L_LATC1: - case MESA_FORMAT_LA_LATC2: - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_L_LATC1_UNORM: + case MESA_FORMAT_L_LATC1_SNORM: + case MESA_FORMAT_LA_LATC2_UNORM: + case MESA_FORMAT_LA_LATC2_SNORM: return GL_FALSE; case MESA_FORMAT_ETC1_RGB8: @@ -3375,77 +3375,77 @@ _mesa_format_matches_format_and_type(gl_format gl_format, case MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1: return GL_FALSE; - case MESA_FORMAT_SIGNED_A8: + case MESA_FORMAT_A_SNORM8: return format == GL_ALPHA && type == GL_BYTE; - case MESA_FORMAT_SIGNED_L8: + case MESA_FORMAT_L_SNORM8: return format == GL_LUMINANCE && type == GL_BYTE; - case MESA_FORMAT_SIGNED_AL88: + case MESA_FORMAT_L8A8_SNORM: return format == GL_LUMINANCE_ALPHA && type == GL_BYTE && littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_I8: + case MESA_FORMAT_I_SNORM8: return format == GL_INTENSITY && type == GL_BYTE; - case MESA_FORMAT_SIGNED_A16: + case MESA_FORMAT_A_SNORM16: return format == GL_ALPHA && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_SIGNED_L16: + case MESA_FORMAT_L_SNORM16: return format == GL_LUMINANCE && type == GL_SHORT && !swapBytes; - case MESA_FORMAT_SIGNED_AL1616: + case MESA_FORMAT_LA_SNORM16: return format == GL_LUMINANCE_ALPHA && type == GL_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_I16: + case MESA_FORMAT_I_SNORM16: return format == GL_INTENSITY && type == GL_SHORT && littleEndian && !swapBytes; - case MESA_FORMAT_ARGB2101010_UINT: + case MESA_FORMAT_B10G10R10A2_UINT: return (format == GL_BGRA_INTEGER_EXT && type == GL_UNSIGNED_INT_2_10_10_10_REV && !swapBytes); - case MESA_FORMAT_ABGR2101010_UINT: + case MESA_FORMAT_R10G10B10A2_UINT: return (format == GL_RGBA_INTEGER_EXT && type == GL_UNSIGNED_INT_2_10_10_10_REV && !swapBytes); - case MESA_FORMAT_RGB9_E5_FLOAT: + case MESA_FORMAT_R9G9B9E5_FLOAT: return format == GL_RGB && type == GL_UNSIGNED_INT_5_9_9_9_REV && !swapBytes; - case MESA_FORMAT_R11_G11_B10_FLOAT: + case MESA_FORMAT_R11G11B10_FLOAT: return format == GL_RGB && type == GL_UNSIGNED_INT_10F_11F_11F_REV && !swapBytes; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return format == GL_DEPTH_COMPONENT && type == GL_FLOAT && !swapBytes; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return format == GL_DEPTH_STENCIL && type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV && !swapBytes; - case MESA_FORMAT_XRGB4444_UNORM: - case MESA_FORMAT_XRGB1555_UNORM: - case MESA_FORMAT_XBGR8888_SNORM: - case MESA_FORMAT_XBGR8888_SRGB: - case MESA_FORMAT_XBGR8888_UINT: - case MESA_FORMAT_XBGR8888_SINT: - case MESA_FORMAT_XRGB2101010_UNORM: - case MESA_FORMAT_XBGR16161616_UNORM: - case MESA_FORMAT_XBGR16161616_SNORM: - case MESA_FORMAT_XBGR16161616_FLOAT: - case MESA_FORMAT_XBGR16161616_UINT: - case MESA_FORMAT_XBGR16161616_SINT: - case MESA_FORMAT_XBGR32323232_FLOAT: - case MESA_FORMAT_XBGR32323232_UINT: - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_B4G4R4X4_UNORM: + case MESA_FORMAT_B5G5R5X1_UNORM: + case MESA_FORMAT_R8G8B8X8_SNORM: + case MESA_FORMAT_R8G8B8X8_SRGB: + case MESA_FORMAT_RGBX_UINT8: + case MESA_FORMAT_RGBX_SINT8: + case MESA_FORMAT_B10G10R10X2_UNORM: + case MESA_FORMAT_RGBX_UNORM16: + case MESA_FORMAT_RGBX_SNORM16: + case MESA_FORMAT_RGBX_FLOAT16: + case MESA_FORMAT_RGBX_UINT16: + case MESA_FORMAT_RGBX_SINT16: + case MESA_FORMAT_RGBX_FLOAT32: + case MESA_FORMAT_RGBX_UINT32: + case MESA_FORMAT_RGBX_SINT32: return GL_FALSE; - case MESA_FORMAT_ABGR2101010: + case MESA_FORMAT_R10G10B10A2_UNORM: return format == GL_RGBA && type == GL_UNSIGNED_INT_2_10_10_10_REV && !swapBytes; - case MESA_FORMAT_SIGNED_RG88: + case MESA_FORMAT_G8R8_SNORM: return format == GL_RG && type == GL_BYTE && !littleEndian && !swapBytes; - case MESA_FORMAT_SIGNED_RG1616: + case MESA_FORMAT_G16R16_SNORM: return format == GL_RG && type == GL_SHORT && !littleEndian && !swapBytes; } diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index a1f0d226a..63d9565e3 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -41,8 +41,10 @@ extern "C" { #endif -/* OpenGL doesn't have GL_UNSIGNED_BYTE_4_4, so we must define our own type - * for GL_LUMINANCE4_ALPHA4. */ +/** + * OpenGL doesn't have GL_UNSIGNED_BYTE_4_4, so we must define our own type + * for GL_LUMINANCE4_ALPHA4. + */ #define MESA_UNSIGNED_BYTE_4_4 (GL_UNSIGNED_BYTE<<1) @@ -61,68 +63,369 @@ typedef enum { MESA_FORMAT_NONE = 0, - /** + /** * \name Basic hardware formats + * + * The mesa format name specification is as follows: + * + * There shall be 3 naming format base types: those for component array + * formats (type A); those for compressed formats (type C); and those for + * packed component formats (type P). With type A formats, color component + * order does not change with endianess. Each format name shall begin with + * MESA_FORMAT_, followed by a component label (from the Component Label + * list below) for each component in the order that the component(s) occur + * in the format, except for non-linear color formats where the first + * letter shall be 'S'. For type P formats, each component label is + * followed by the number of bits that represent it in the fundamental + * data type used by the format. + * + * Following the listing of the component labels shall be an underscore; a + * compression type followed by an underscore for Type C formats only; a + * storage type from the list below; and a bit with for type A formats, + * which is the bit width for each array element. + * + * + * ---------- Format Base Type A: Array ---------- + * MESA_FORMAT_[component list]_[storage type][array element bit width] + * + * examples: + * MESA_FORMAT_A_SNORM8 - uchar[i] = A + * MESA_FORMAT_RGBA_16 - ushort[i * 4 + 0] = R, ushort[i * 4 + 1] = G, + * ushort[i * 4 + 2] = B, ushort[i * 4 + 3] = A + * MESA_FORMAT_Z_UNORM32 - float[i] = Z + * + * + * + * ---------- Format Base Type C: Compressed ---------- + * MESA_FORMAT_[component list*][_*][compression type][storage type*] + * * where required + * + * examples: + * MESA_FORMAT_RGB_ETC1 + * MESA_FORMAT_RGBA_ETC2 + * MESA_FORMAT_LATC1_UNORM + * MESA_FORMAT_RGBA_FXT1 + * + * + * + * ---------- Format Base Type P: Packed ---------- + * MESA_FORMAT_[[component list,bit width][storage type*][_]][_][storage type**] + * * when type differs between component + * ** when type applies to all components + * + * examples: msb <------ TEXEL BITS -----------> lsb + * MESA_FORMAT_A8B8G8R8_UNORM, AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR + * MESA_FORMAT_R5G6B5_UNORM RRRR RGGG GGGB BBBB + * MESA_FORMAT_B4G4R4X4_UNORM BBBB GGGG RRRR XXXX + * MESA_FORMAT_Z32_FLOAT_S8X24_UINT + * MESA_FORMAT_R10G10B10A2_UINT + * MESA_FORMAT_R9G9B9E5_FLOAT + * + * + * + * ---------- Component Labels: ---------- + * A - Alpha + * B - Blue + * DU - Delta U + * DV - Delta V + * E - Shared Exponent + * G - Green + * I - Intensity + * L - Luminance + * R - Red + * S - Stencil (when not followed by RGB or RGBA) + * U - Chrominance + * V - Chrominance + * Y - Luma + * X - Packing bits + * Z - Depth + * + * + * + * ---------- Type C Compression Types: ---------- + * DXT1 - Color component labels shall be given + * DXT3 - Color component labels shall be given + * DXT5 - Color component labels shall be given + * ETC1 - No other information required + * ETC2 - No other information required + * FXT1 - Color component labels shall be given + * FXT3 - Color component labels shall be given + * LATC1 - Fundamental data type shall be given + * LATC2 - Fundamental data type shall be given + * RGTC1 - Color component labels and data type shall be given + * RGTC2 - Color component labels and data type shall be given + * + * + * + * ---------- Storage Types: ---------- + * FLOAT + * SINT + * UINT + * SNORM + * UNORM + * SRGB - RGB components, or L are UNORMs in sRGB color space. + * Alpha, if present is linear. + * + * + * ---------- Type A Format List (based on format_unpack.c): + * BGR_UNORM8 + * RGB_UNORM8 + * A_UNORM8 + * A_UNORM16 + * L_UNORM8 + * L_UNORM16 + * I_UNORM8 + * I_UNOMR16 + * R_UNORM8 + * R_UNORM16 + * Z_UNORM16 + * Z_UNORM32 + * Z_FLOAT32 + * S_UINT8 + * BGR_SRGB8 + * L_SRGB8 + * RGBA_FLOAT32 + * RGBA_FLOAT16 + * RGB_FLOAT32 + * RGB_FLOAT16 + * A_FLOAT32 + * A_FLOAT16 + * L_FLOAT32 + * L_FLOAT16 + * LA_FLOAT32 + * LA_FLOAT16 + * I_FLOAT32 + * I_FLOAT16 + * R_FLOAT32 + * R_FLOAT16 + * RG_FLOAT32 + * RG_FLOAT16 + * A_UINT8 + * A_UINT16 + * A_UINT32 + * A_SINT8 + * A_SINT16 + * A_SINT32 + * I_UINT8 + * I_UINT16 + * I_UINT32 + * I_SINT8 + * I_SINT16 + * I_SINT32 + * L_UINT8 + * L_UINT16 + * L_UINT32 + * L_SINT8 + * L_SINT16 + * L_SINT32 + * LA_UINT8 + * LA_UINT16 + * LA_UINT32 + * LA_SINT8 + * LA_SINT16 + * LA_SINT32 + * R_SINT8 + * RG_SINT8 + * RGB_SINT8 + * RGBA_SINT8 + * R_SINT16 + * RG_SINT16 + * RGB_SINT16 + * RGBA_SINT16 + * R_SINT32 + * RG_SINT32 + * RGB_SINT32 + * RGBA_SINT32 + * R_SINT16 + * R_SINT32 + * R_UINT8 + * RG_UINT8 + * RGB_UINT8 + * RGBA_UINT8 + * R_UINT16 + * RG_UINT16 + * RGB_UINT16 + * RGBA_UINT16 + * R_UINT32 + * RG_UINT32 + * RGB_UINT32 + * RGBA_UINT32 + * R_UINT16 + * R_UINT32 + * R_SNORM8 + * R_SNORM16 + * RGB_SNORM16 + * RGBA_SNORM16 + * RGBA_UNORM16 + * A_SNORM8 + * L_SNORM8 + * I_SNORM8 + * A_SNORM16 + * L_SNORM16 + * LA_SNORM16 + * I_SNORM16 + * RGBX_UINT8 + * RGBX_SINT8 + * RGBX_UNORM16 + * RGBX_SNORM16 + * RGBX_FLOAT16 + * RGBX_UINT16 + * RGBX_SINT16 + * RGBX_FLOAT32 + * RGBX_UINT32 + * RGBX_SINT32 + * + * + * + * ---------- Type P Format List (based on format_unpack.c): + * A8B8G8R8_UNORM + * R8G8B8A8_UNORM + * B8G8R8A8_UNORM + * A8R8G8B8_UNORM + * X8B8G8R8_UNORM + * R8G8B8X8_UNORM + * B8G8R8X8_UNORM + * X8R8G8B8_UNORM + * B5G6R5_UNORM + * R5G6B5_UNORM + * B4G4R4A4_UNORM + * A4R4G4B4_UNORM + * A1B5G5R5_UNORM + * B5G5R5A1_UNORM + * A1R5G5B5_UNORM + * L4A4_UNORM + * L8A8_UNORM + * A8L8_UNORM + * L16A16_UNORM + * A16L16_UNORM + * B2G3R3_UNORM + * YCBCR + * YCBCR_REV + * R8G8_UNORM + * G8R8_UNORM + * R16G16_UNORM + * G16R16_UNORM + * B10G10R10A2_UNORM + * B10G10R10A2_UINT + * R10G10B10A2_UINT + * S8_UINT_Z24_UNORM + * Z24_UNORM_S8_UINT + * Z24_UNORM_X8_UINT + * X8_UINT_Z24_UNORM + * Z32_FLOAT_S8X24_UINT + * A8R8G8B8_SRGB + * B8G8R8A8_SRGB + * L8A8_SRGB + * R8G8_SNORM + * X8B8G8R8_SNORM + * A8B8G8R8_SNORM + * R8G8B8A8_SNORM + * R16G16_SNORM + * L8A8_SNORM + * R9G9B9E5_FLOAT + * R11G11B10_FLOAT + * B4G4R4X4_UNORM + * B5G5R5X1_UNORM + * R8G8_SNORM + * R8G8B8X8_SNORM + * R8G8B8X8_SRGB + * B10G10R10X2_UNORM + * R10G10B10A2_UNORM + * G8R8_SINT + * G16R16_SINT + * */ /*@{*/ - /* msb <------ TEXEL BITS -----------> lsb */ - /* ---- ---- ---- ---- ---- ---- ---- ---- */ - MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ - MESA_FORMAT_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB XXXX XXXX */ - MESA_FORMAT_RGBX8888_REV, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ - MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ - MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ - MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ - MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ - MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */ - MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ - MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ - MESA_FORMAT_AL44, /* AAAA LLLL */ - MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ - MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ - MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ - MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ - MESA_FORMAT_RGB332, /* RRRG GGBB */ - MESA_FORMAT_A8, /* AAAA AAAA */ - MESA_FORMAT_A16, /* AAAA AAAA AAAA AAAA */ - MESA_FORMAT_L8, /* LLLL LLLL */ - MESA_FORMAT_L16, /* LLLL LLLL LLLL LLLL */ - MESA_FORMAT_I8, /* IIII IIII */ - MESA_FORMAT_I16, /* IIII IIII IIII IIII */ - MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ - MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - MESA_FORMAT_R8, /* RRRR RRRR */ - MESA_FORMAT_GR88, /* GGGG GGGG RRRR RRRR */ - MESA_FORMAT_RG88, /* RRRR RRRR GGGG GGGG */ - MESA_FORMAT_R16, /* RRRR RRRR RRRR RRRR */ - MESA_FORMAT_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ - MESA_FORMAT_RG1616, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ - MESA_FORMAT_ARGB2101010, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ - MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ - MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_S8, /* SSSS SSSS */ + + /* Type P formats */ /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_A8B8G8R8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8A8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_B8G8R8A8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_A8R8G8B8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_X8B8G8R8_UNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_B8G8R8X8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ + MESA_FORMAT_X8R8G8B8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + + /* Type A formats */ + MESA_FORMAT_BGR_UNORM8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + MESA_FORMAT_RGB_UNORM8, /* uchar[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */ + + /* Type P formats */ + MESA_FORMAT_B5G6R5_UNORM, /* BBBB BGGG GGGR RRRR */ + MESA_FORMAT_R5G6B5_UNORM, /* RRRR RGGG GGGB BBBB */ + MESA_FORMAT_B4G4R4A4_UNORM, /* BBBB GGGG RRRR AAAA */ + MESA_FORMAT_A4R4G4B4_UNORM, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_A1B5G5R5_UNORM, /* ABBB BBGG GGGR RRRR */ + MESA_FORMAT_B5G5R5A1_UNORM, /* BBBB BGGG GGRR RRRA */ + MESA_FORMAT_A1R5G5B5_UNORM, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_L4A4_UNORM, /* LLLL AAAA */ + MESA_FORMAT_L8A8_UNORM, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_A8L8_UNORM, /* AAAA AAAA LLLL LLLL */ + MESA_FORMAT_L16A16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ + MESA_FORMAT_A16L16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ + MESA_FORMAT_B2G3R3_UNORM, /* BBGG GRRR */ + + /* Type A formats */ + MESA_FORMAT_A_UNORM8, /* uchar[i] = A */ + MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ + MESA_FORMAT_L_UNORM8, /* uchar[i] = L */ + MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ + MESA_FORMAT_I_UNORM8, /* uchar[i] = I */ + MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ + + /* Type P formats */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ + + /* Type A format(s) */ + MESA_FORMAT_R_UNORM8, /* uchar[i] = R */ + + /* Type P formats */ + MESA_FORMAT_R8G8_UNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_G8R8_UNORM, /* GGGG GGGG RRRR RRRR */ + + /* Type A format(s) */ + MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ + + /* Type P formats */ + MESA_FORMAT_R16G16_UNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_G16R16_UNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_B10G10R10A2_UNORM,/* BBBB BBBB BBGG GGGG GGGG RRRR RRRR RRAA */ + MESA_FORMAT_S8_UINT_Z24_UNORM,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z24_UNORM_X8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ + + /* Type A format(s) */ + MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ + + /* Type P formats */ + MESA_FORMAT_Z24_UNORM_S8_UINT,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_X8Z24_UNORM, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + + /* Type A formats */ + MESA_FORMAT_Z_UNORM32, /* uint[i] = Z */ + MESA_FORMAT_S_UINT8, /* uchar[i] = S */ /*@}*/ /** * \name 8-bit/channel sRGB formats */ /*@{*/ - MESA_FORMAT_SRGB8, /* RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_SRGBA8, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_SARGB8, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_SL8, /* LLLL LLLL */ - MESA_FORMAT_SLA8, /* AAAA AAAA LLLL LLLL */ + /* Type A format(s) */ + MESA_FORMAT_BGR_SRGB8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + + /* Type P formats */ + MESA_FORMAT_A8B8G8R8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR*/ + MESA_FORMAT_B8G8R8A8_SRGB, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + + /* Type A format(s) */ + MESA_FORMAT_L_SRGB8, /* uchar[i] = L */ + + /* Type P formats */ + MESA_FORMAT_L8A8_SRGB, /* LLLL LLLL AAAA AAAA */ + + /* Type C formats */ MESA_FORMAT_SRGB_DXT1, MESA_FORMAT_SRGBA_DXT1, MESA_FORMAT_SRGBA_DXT3, @@ -133,6 +436,7 @@ typedef enum * \name Compressed texture formats. */ /*@{*/ + /* Type C formats */ MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, MESA_FORMAT_RGB_DXT1, @@ -145,18 +449,20 @@ typedef enum * \name Floating point texture formats. */ /*@{*/ - MESA_FORMAT_RGBA_FLOAT32, + + /* Type A formats */ + MESA_FORMAT_RGBA_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = A */ MESA_FORMAT_RGBA_FLOAT16, MESA_FORMAT_RGB_FLOAT32, MESA_FORMAT_RGB_FLOAT16, - MESA_FORMAT_ALPHA_FLOAT32, - MESA_FORMAT_ALPHA_FLOAT16, - MESA_FORMAT_LUMINANCE_FLOAT32, - MESA_FORMAT_LUMINANCE_FLOAT16, - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - MESA_FORMAT_INTENSITY_FLOAT32, - MESA_FORMAT_INTENSITY_FLOAT16, + MESA_FORMAT_A_FLOAT32, + MESA_FORMAT_A_FLOAT16, + MESA_FORMAT_L_FLOAT32, + MESA_FORMAT_L_FLOAT16, + MESA_FORMAT_LA_FLOAT32, + MESA_FORMAT_LA_FLOAT16, + MESA_FORMAT_I_FLOAT32, + MESA_FORMAT_I_FLOAT16, MESA_FORMAT_R_FLOAT32, MESA_FORMAT_R_FLOAT16, MESA_FORMAT_RG_FLOAT32, @@ -168,94 +474,110 @@ typedef enum * XXX Note: these are just stand-ins for some better hardware * formats TBD such as BGRA or ARGB. */ - MESA_FORMAT_ALPHA_UINT8, - MESA_FORMAT_ALPHA_UINT16, - MESA_FORMAT_ALPHA_UINT32, - MESA_FORMAT_ALPHA_INT8, - MESA_FORMAT_ALPHA_INT16, - MESA_FORMAT_ALPHA_INT32, - - MESA_FORMAT_INTENSITY_UINT8, - MESA_FORMAT_INTENSITY_UINT16, - MESA_FORMAT_INTENSITY_UINT32, - MESA_FORMAT_INTENSITY_INT8, - MESA_FORMAT_INTENSITY_INT16, - MESA_FORMAT_INTENSITY_INT32, - - MESA_FORMAT_LUMINANCE_UINT8, - MESA_FORMAT_LUMINANCE_UINT16, - MESA_FORMAT_LUMINANCE_UINT32, - MESA_FORMAT_LUMINANCE_INT8, - MESA_FORMAT_LUMINANCE_INT16, - MESA_FORMAT_LUMINANCE_INT32, - - MESA_FORMAT_LUMINANCE_ALPHA_UINT8, - MESA_FORMAT_LUMINANCE_ALPHA_UINT16, - MESA_FORMAT_LUMINANCE_ALPHA_UINT32, - MESA_FORMAT_LUMINANCE_ALPHA_INT8, - MESA_FORMAT_LUMINANCE_ALPHA_INT16, - MESA_FORMAT_LUMINANCE_ALPHA_INT32, - - MESA_FORMAT_R_INT8, - MESA_FORMAT_RG_INT8, - MESA_FORMAT_RGB_INT8, - MESA_FORMAT_RGBA_INT8, - MESA_FORMAT_R_INT16, - MESA_FORMAT_RG_INT16, - MESA_FORMAT_RGB_INT16, - MESA_FORMAT_RGBA_INT16, - MESA_FORMAT_R_INT32, - MESA_FORMAT_RG_INT32, - MESA_FORMAT_RGB_INT32, - MESA_FORMAT_RGBA_INT32, + + /* Type A formats */ + MESA_FORMAT_A_UINT8, + MESA_FORMAT_A_UINT16, + MESA_FORMAT_A_UINT32, + MESA_FORMAT_A_SINT8, + MESA_FORMAT_A_SINT16, + MESA_FORMAT_A_SINT32, + + MESA_FORMAT_I_UINT8, + MESA_FORMAT_I_UINT16, + MESA_FORMAT_I_UINT32, + MESA_FORMAT_I_SINT8, + MESA_FORMAT_I_SINT16, + MESA_FORMAT_I_SINT32, + + MESA_FORMAT_L_UINT8, + MESA_FORMAT_L_UINT16, + MESA_FORMAT_L_UINT32, + MESA_FORMAT_L_SINT8, + MESA_FORMAT_L_SINT16, + MESA_FORMAT_L_SINT32, + MESA_FORMAT_LA_UINT8, + MESA_FORMAT_LA_UINT16, + MESA_FORMAT_LA_UINT32, + MESA_FORMAT_LA_SINT8, + MESA_FORMAT_LA_SINT16, + MESA_FORMAT_LA_SINT32, + + MESA_FORMAT_R_SINT8, + MESA_FORMAT_RG_SINT8, + MESA_FORMAT_RGB_SINT8, + MESA_FORMAT_RGBA_SINT8, + MESA_FORMAT_R_SINT16, + MESA_FORMAT_RG_SINT16, + MESA_FORMAT_RGB_SINT16, + MESA_FORMAT_RGBA_SINT16, + + MESA_FORMAT_R_SINT32, + MESA_FORMAT_RG_SINT32, + MESA_FORMAT_RGB_SINT32, + MESA_FORMAT_RGBA_SINT32, /** * \name Non-normalized unsigned integer formats. */ + /* Type A format(s) */ MESA_FORMAT_R_UINT8, MESA_FORMAT_RG_UINT8, MESA_FORMAT_RGB_UINT8, MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_R_UINT16, MESA_FORMAT_RG_UINT16, MESA_FORMAT_RGB_UINT16, MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_R_UINT32, MESA_FORMAT_RG_UINT32, MESA_FORMAT_RGB_UINT32, MESA_FORMAT_RGBA_UINT32, - /* msb <------ TEXEL BITS -----------> lsb */ - /* ---- ---- ---- ---- ---- ---- ---- ---- */ + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ /** * \name Signed fixed point texture formats. */ /*@{*/ MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ - MESA_FORMAT_SIGNED_R8, /* RRRR RRRR */ - MESA_FORMAT_SIGNED_RG88_REV, /* GGGG GGGG RRRR RRRR */ - MESA_FORMAT_SIGNED_RGBX8888, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ - MESA_FORMAT_SIGNED_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_SIGNED_RGBA8888_REV,/*AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_SIGNED_R16, /* RRRR RRRR RRRR RRRR */ - MESA_FORMAT_SIGNED_GR1616, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ - MESA_FORMAT_SIGNED_RGB_16, /* ushort[0]=R, ushort[1]=G, ushort[2]=B */ - MESA_FORMAT_SIGNED_RGBA_16, /* ... */ - MESA_FORMAT_RGBA_16, /* ... */ + + /* Type A format(s) */ + MESA_FORMAT_R_SNORM8, /* char[i] = R */ + + /* Type P formats */ + MESA_FORMAT_R8G8_SNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_X8B8G8R8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_A8B8G8R8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8A8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + + /* Type A format(s) */ + MESA_FORMAT_R_SNORM16, /* short[i] = R */ + + /* Type P format(s) */ + MESA_FORMAT_R16G16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + + /* Type A format(s) */ + MESA_FORMAT_RGB_SNORM16, /* short[i * 3] = R, [i * 3 + 1] = G, [i *3 + 2] = B */ + MESA_FORMAT_RGBA_SNORM16, /* ... */ + MESA_FORMAT_RGBA_UNORM16, /* ... */ /*@}*/ /*@{*/ - MESA_FORMAT_RED_RGTC1, - MESA_FORMAT_SIGNED_RED_RGTC1, - MESA_FORMAT_RG_RGTC2, - MESA_FORMAT_SIGNED_RG_RGTC2, + /* Type C formats */ + MESA_FORMAT_R_RGTC1_UNORM, + MESA_FORMAT_R_RGTC1_SNORM, + MESA_FORMAT_RG_RGTC2_UNORM, + MESA_FORMAT_RG_RGTC2_SNORM, /*@}*/ /*@{*/ - MESA_FORMAT_L_LATC1, - MESA_FORMAT_SIGNED_L_LATC1, - MESA_FORMAT_LA_LATC2, - MESA_FORMAT_SIGNED_LA_LATC2, + MESA_FORMAT_L_LATC1_UNORM, + MESA_FORMAT_L_LATC1_SNORM, + MESA_FORMAT_LA_LATC2_UNORM, + MESA_FORMAT_LA_LATC2_SNORM, /*@}*/ MESA_FORMAT_ETC1_RGB8, @@ -270,117 +592,133 @@ typedef enum MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, - MESA_FORMAT_SIGNED_A8, /* AAAA AAAA */ - MESA_FORMAT_SIGNED_L8, /* LLLL LLLL */ - MESA_FORMAT_SIGNED_AL88, /* AAAA AAAA LLLL LLLL */ - MESA_FORMAT_SIGNED_I8, /* IIII IIII */ - MESA_FORMAT_SIGNED_A16, /* AAAA AAAA AAAA AAAA */ - MESA_FORMAT_SIGNED_L16, /* LLLL LLLL LLLL LLLL */ - MESA_FORMAT_SIGNED_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ - MESA_FORMAT_SIGNED_I16, /* IIII IIII IIII IIII */ - - MESA_FORMAT_RGB9_E5_FLOAT, - MESA_FORMAT_R11_G11_B10_FLOAT, - - MESA_FORMAT_Z32_FLOAT, - MESA_FORMAT_Z32_FLOAT_X24S8, - - MESA_FORMAT_ARGB2101010_UINT, - MESA_FORMAT_ABGR2101010_UINT, - - MESA_FORMAT_XRGB4444_UNORM, /* xxxx RRRR GGGG BBBB */ - MESA_FORMAT_XRGB1555_UNORM, /* xRRR RRGG GGGB BBBB */ - MESA_FORMAT_XBGR8888_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XBGR8888_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XBGR8888_UINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XBGR8888_SINT, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_XRGB2101010_UNORM, /* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - MESA_FORMAT_XBGR16161616_UNORM,/* ushort[3]=x, [2]=B, [1]=G, [0]=R */ - MESA_FORMAT_XBGR16161616_SNORM,/* ... */ - MESA_FORMAT_XBGR16161616_FLOAT,/* ... */ - MESA_FORMAT_XBGR16161616_UINT, /* ... */ - MESA_FORMAT_XBGR16161616_SINT, /* ... */ - MESA_FORMAT_XBGR32323232_FLOAT,/* float[3]=x, [2]=B, [1]=G, [0]=R */ - MESA_FORMAT_XBGR32323232_UINT, /* ... */ - MESA_FORMAT_XBGR32323232_SINT, /* ... */ - - MESA_FORMAT_ABGR2101010, - - MESA_FORMAT_SIGNED_RG88, - MESA_FORMAT_SIGNED_RG1616, + /* Type A format(s) */ + MESA_FORMAT_A_SNORM8, /* char[i] = A */ + MESA_FORMAT_L_SNORM8, /* char[i] = L */ + + /* Type P format(s) */ + MESA_FORMAT_L8A8_SNORM, /* LLLL LLLL AAAA AAAA */ + + /* Type A format(s) */ + MESA_FORMAT_I_SNORM8, /* char[i] = I */ + MESA_FORMAT_A_SNORM16, /* short[i] = A */ + MESA_FORMAT_L_SNORM16, /* short[i] = L */ + MESA_FORMAT_LA_SNORM16, /* short[i * 2] = L, [i * 2 + 1] = A */ + MESA_FORMAT_I_SNORM16, /* short[i] = I */ + + /* Type P format(s) */ + MESA_FORMAT_R9G9B9E5_FLOAT, + MESA_FORMAT_R11G11B10_FLOAT, + + /* Type A format(s) */ + MESA_FORMAT_Z_FLOAT32, + + /* Type P formats */ + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, + + MESA_FORMAT_B10G10R10A2_UINT, + MESA_FORMAT_R10G10B10A2_UINT, + + MESA_FORMAT_B4G4R4X4_UNORM, /* BBBB GGGG RRRR xxxx */ + MESA_FORMAT_B5G5R5X1_UNORM, /* BBBB BGGG GGRR RRRx */ + MESA_FORMAT_R8G8B8X8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8X8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + + /* Type A formats */ + MESA_FORMAT_RGBX_UINT8, /* uchar[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_SINT8, /* char[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + + /* Type P format(s) */ + MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + + /* Type A formats */ + MESA_FORMAT_RGBX_UNORM16, /* ushort[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_SNORM16, /* ... */ + MESA_FORMAT_RGBX_FLOAT16, /* ... */ + MESA_FORMAT_RGBX_UINT16, /* ... */ + MESA_FORMAT_RGBX_SINT16, /* ... */ + + MESA_FORMAT_RGBX_FLOAT32, /* float[i * 4] = R, [i * 4 + 1] = G, [i * 4 + 2] = B, [i * 4 + 3] = x */ + MESA_FORMAT_RGBX_UINT32, /* ... */ + MESA_FORMAT_RGBX_SINT32, /* ... */ + + /* Type P formats */ + MESA_FORMAT_R10G10B10A2_UNORM, + MESA_FORMAT_G8R8_SNORM, + MESA_FORMAT_G16R16_SNORM, MESA_FORMAT_COUNT -} gl_format; +} mesa_format; extern const char * -_mesa_get_format_name(gl_format format); +_mesa_get_format_name(mesa_format format); extern GLint -_mesa_get_format_bytes(gl_format format); +_mesa_get_format_bytes(mesa_format format); extern GLint -_mesa_get_format_bits(gl_format format, GLenum pname); +_mesa_get_format_bits(mesa_format format, GLenum pname); extern GLuint -_mesa_get_format_max_bits(gl_format format); +_mesa_get_format_max_bits(mesa_format format); extern GLenum -_mesa_get_format_datatype(gl_format format); +_mesa_get_format_datatype(mesa_format format); extern GLenum -_mesa_get_format_base_format(gl_format format); +_mesa_get_format_base_format(mesa_format format); extern void -_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh); +_mesa_get_format_block_size(mesa_format format, GLuint *bw, GLuint *bh); extern GLboolean -_mesa_is_format_compressed(gl_format format); +_mesa_is_format_compressed(mesa_format format); extern GLboolean -_mesa_is_format_packed_depth_stencil(gl_format format); +_mesa_is_format_packed_depth_stencil(mesa_format format); extern GLboolean -_mesa_is_format_integer_color(gl_format format); +_mesa_is_format_integer_color(mesa_format format); extern GLboolean -_mesa_is_format_unsigned(gl_format format); +_mesa_is_format_unsigned(mesa_format format); extern GLboolean -_mesa_is_format_signed(gl_format format); +_mesa_is_format_signed(mesa_format format); extern GLenum -_mesa_get_format_color_encoding(gl_format format); +_mesa_get_format_color_encoding(mesa_format format); extern GLuint -_mesa_format_image_size(gl_format format, GLsizei width, +_mesa_format_image_size(mesa_format format, GLsizei width, GLsizei height, GLsizei depth); extern uint64_t -_mesa_format_image_size64(gl_format format, GLsizei width, +_mesa_format_image_size64(mesa_format format, GLsizei width, GLsizei height, GLsizei depth); extern GLint -_mesa_format_row_stride(gl_format format, GLsizei width); +_mesa_format_row_stride(mesa_format format, GLsizei width); extern void -_mesa_format_to_type_and_comps(gl_format format, +_mesa_format_to_type_and_comps(mesa_format format, GLenum *datatype, GLuint *comps); extern void _mesa_test_formats(void); -extern gl_format -_mesa_get_srgb_format_linear(gl_format format); +extern mesa_format +_mesa_get_srgb_format_linear(mesa_format format); -extern gl_format -_mesa_get_uncompressed_format(gl_format format); +extern mesa_format +_mesa_get_uncompressed_format(mesa_format format); extern GLuint -_mesa_format_num_components(gl_format format); +_mesa_format_num_components(mesa_format format); GLboolean -_mesa_format_matches_format_and_type(gl_format gl_format, +_mesa_format_matches_format_and_type(mesa_format mesa_format, GLenum format, GLenum type, GLboolean swapBytes); diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index bd8f4933f..54eeda2b2 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -469,7 +469,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); - const gl_format fmt = rb->Format; + const mesa_format fmt = rb->Format; /* Grab samples and sampleBuffers from any attachment point (assuming * the framebuffer is complete, we'll get the same answer from all @@ -496,7 +496,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, for (i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; - const gl_format fmt = rb->Format; + const mesa_format fmt = rb->Format; if (_mesa_get_format_datatype(fmt) == GL_FLOAT) { fb->Visual.floatMode = GL_TRUE; @@ -508,7 +508,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[BUFFER_DEPTH].Renderbuffer; - const gl_format fmt = rb->Format; + const mesa_format fmt = rb->Format; fb->Visual.haveDepthBuffer = GL_TRUE; fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS); } @@ -516,7 +516,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[BUFFER_STENCIL].Renderbuffer; - const gl_format fmt = rb->Format; + const mesa_format fmt = rb->Format; fb->Visual.haveStencilBuffer = GL_TRUE; fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS); } @@ -524,7 +524,7 @@ _mesa_update_framebuffer_visual(struct gl_context *ctx, if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[BUFFER_ACCUM].Renderbuffer; - const gl_format fmt = rb->Format; + const mesa_format fmt = rb->Format; fb->Visual.haveAccumBuffer = GL_TRUE; fb->Visual.accumRedBits = _mesa_get_format_bits(fmt, GL_RED_BITS); fb->Visual.accumGreenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS); @@ -840,9 +840,9 @@ _mesa_get_color_read_format(struct gl_context *ctx) const GLenum format = ctx->ReadBuffer->_ColorReadBuffer->Format; const GLenum data_type = _mesa_get_format_datatype(format); - if (format == MESA_FORMAT_ARGB8888) + if (format == MESA_FORMAT_B8G8R8A8_UNORM) return GL_BGRA; - else if (format == MESA_FORMAT_RGB565) + else if (format == MESA_FORMAT_B5G6R5_UNORM) return GL_BGR; switch (data_type) { @@ -875,7 +875,7 @@ _mesa_get_color_read_type(struct gl_context *ctx) const GLenum format = ctx->ReadBuffer->_ColorReadBuffer->Format; const GLenum data_type = _mesa_get_format_datatype(format); - if (format == MESA_FORMAT_RGB565) + if (format == MESA_FORMAT_B5G6R5_UNORM) return GL_UNSIGNED_SHORT_5_6_5_REV; switch (data_type) { diff --git a/mesalib/src/mesa/main/genmipmap.c b/mesalib/src/mesa/main/genmipmap.c new file mode 100644 index 000000000..dcd482da2 --- /dev/null +++ b/mesalib/src/mesa/main/genmipmap.c @@ -0,0 +1,131 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2013 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * glGenerateMipmap function + */ + +#include "context.h" +#include "enums.h" +#include "genmipmap.h" +#include "glformats.h" +#include "macros.h" +#include "mtypes.h" +#include "teximage.h" +#include "texobj.h" + + +/** + * Generate all the mipmap levels below the base level. + * Note: this GL function would be more useful if one could specify a + * cube face, a set of array slices, etc. + */ +void GLAPIENTRY +_mesa_GenerateMipmap(GLenum target) +{ + struct gl_texture_image *srcImage; + struct gl_texture_object *texObj; + GLboolean error; + + GET_CURRENT_CONTEXT(ctx); + + FLUSH_VERTICES(ctx, 0); + + switch (target) { + case GL_TEXTURE_1D: + error = _mesa_is_gles(ctx); + break; + case GL_TEXTURE_2D: + error = GL_FALSE; + break; + case GL_TEXTURE_3D: + error = ctx->API == API_OPENGLES; + break; + case GL_TEXTURE_CUBE_MAP: + error = !ctx->Extensions.ARB_texture_cube_map; + break; + case GL_TEXTURE_1D_ARRAY: + error = _mesa_is_gles(ctx) || !ctx->Extensions.EXT_texture_array; + break; + case GL_TEXTURE_2D_ARRAY: + error = (_mesa_is_gles(ctx) && ctx->Version < 30) + || !ctx->Extensions.EXT_texture_array; + break; + default: + error = GL_TRUE; + } + + if (error) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGenerateMipmapEXT(target=%s)", + _mesa_lookup_enum_by_nr(target)); + return; + } + + texObj = _mesa_get_current_tex_object(ctx, target); + + if (texObj->BaseLevel >= texObj->MaxLevel) { + /* nothing to do */ + return; + } + + if (texObj->Target == GL_TEXTURE_CUBE_MAP && + !_mesa_cube_complete(texObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGenerateMipmap(incomplete cube map)"); + return; + } + + _mesa_lock_texture(ctx, texObj); + + srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); + if (!srcImage) { + _mesa_unlock_texture(ctx, texObj); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGenerateMipmap(zero size base image)"); + return; + } + + if (_mesa_is_enum_format_integer(srcImage->InternalFormat) || + _mesa_is_depthstencil_format(srcImage->InternalFormat) || + _mesa_is_stencil_format(srcImage->InternalFormat)) { + _mesa_unlock_texture(ctx, texObj); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGenerateMipmap(invalid internal format)"); + return; + } + + if (target == GL_TEXTURE_CUBE_MAP) { + GLuint face; + for (face = 0; face < 6; face++) + ctx->Driver.GenerateMipmap(ctx, + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB + face, + texObj); + } + else { + ctx->Driver.GenerateMipmap(ctx, target, texObj); + } + _mesa_unlock_texture(ctx, texObj); +} diff --git a/mesalib/src/mesa/main/genmipmap.h b/mesalib/src/mesa/main/genmipmap.h new file mode 100644 index 000000000..d546a8d7b --- /dev/null +++ b/mesalib/src/mesa/main/genmipmap.h @@ -0,0 +1,36 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef GENMIPMAP_H +#define GENMIPMAP_H + +#include "glheader.h" + + +extern void GLAPIENTRY +_mesa_GenerateMipmap(GLenum target); + + +#endif /* GENMIPMAP_H */ diff --git a/mesalib/src/mesa/main/get.c b/mesalib/src/mesa/main/get.c index 16dce5b65..54f7d7745 100644 --- a/mesalib/src/mesa/main/get.c +++ b/mesalib/src/mesa/main/get.c @@ -182,7 +182,7 @@ union value { #define CONTEXT_FIELD(field, type) \ LOC_CONTEXT, type, offsetof(struct gl_context, field) #define ARRAY_FIELD(field, type) \ - LOC_ARRAY, type, offsetof(struct gl_array_object, field) + LOC_ARRAY, type, offsetof(struct gl_vertex_array_object, field) #undef CONST /* already defined through windows.h */ #define CONST(value) \ LOC_CONTEXT, TYPE_CONST, value @@ -362,7 +362,6 @@ EXTRA_EXT(EXT_stencil_two_side); EXTRA_EXT(EXT_depth_bounds_test); EXTRA_EXT(ARB_depth_clamp); EXTRA_EXT(ATI_fragment_shader); -EXTRA_EXT(EXT_framebuffer_blit); EXTRA_EXT(EXT_provoking_vertex); EXTRA_EXT(ARB_fragment_shader); EXTRA_EXT(ARB_fragment_program); @@ -383,7 +382,6 @@ EXTRA_EXT(OES_EGL_image_external); EXTRA_EXT(ARB_blend_func_extended); EXTRA_EXT(ARB_uniform_buffer_object); EXTRA_EXT(ARB_timer_query); -EXTRA_EXT(ARB_map_buffer_alignment); EXTRA_EXT(ARB_texture_cube_map_array); EXTRA_EXT(ARB_texture_buffer_range); EXTRA_EXT(ARB_texture_multisample); @@ -392,6 +390,9 @@ EXTRA_EXT(ARB_shader_atomic_counters); EXTRA_EXT(ARB_draw_indirect); EXTRA_EXT(ARB_shader_image_load_store); EXTRA_EXT(ARB_viewport_array); +EXTRA_EXT(ARB_compute_shader); +EXTRA_EXT(ARB_gpu_shader5); +EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5); static const int extra_ARB_color_buffer_float_or_glcore[] = { @@ -644,7 +645,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_TEXTURE_COORD_ARRAY_SIZE: case GL_TEXTURE_COORD_ARRAY_TYPE: case GL_TEXTURE_COORD_ARRAY_STRIDE: - array = &ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; + array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)]; v->value_int = *(GLuint *) ((char *) array + d->offset); break; @@ -830,7 +831,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: buffer_obj = (struct gl_buffer_object **) - ((char *) ctx->Array.ArrayObj + d->offset); + ((char *) ctx->Array.VAO + d->offset); v->value_int = (*buffer_obj)->Name; break; case GL_ARRAY_BUFFER_BINDING_ARB: @@ -838,10 +839,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: v->value_int = - ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name; + ctx->Array.VAO->VertexBinding[VERT_ATTRIB_TEX(ctx->Array.ActiveTexture)].BufferObj->Name; break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - v->value_int = ctx->Array.ArrayObj->ElementArrayBufferObj->Name; + v->value_int = ctx->Array.VAO->IndexBufferObj->Name; break; /* ARB_copy_buffer */ @@ -882,7 +883,7 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; break; case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_POINT_SIZE].BufferObj->Name; break; case GL_FOG_COLOR: @@ -1190,7 +1191,7 @@ find_value(const char *func, GLenum pname, void **p, union value *v) *p = ((char *) ctx + d->offset); return d; case LOC_ARRAY: - *p = ((char *) ctx->Array.ArrayObj + d->offset); + *p = ((char *) ctx->Array.VAO + d->offset); return d; case LOC_TEXUNIT: unit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1853,7 +1854,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].InstanceDivisor; return TYPE_INT; case GL_VERTEX_BINDING_OFFSET: @@ -1861,7 +1862,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Offset; return TYPE_INT; case GL_VERTEX_BINDING_STRIDE: @@ -1869,7 +1870,7 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) goto invalid_enum; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) goto invalid_value; - v->value_int = ctx->Array.ArrayObj->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; + v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride; /* ARB_shader_image_load_store */ case GL_IMAGE_BINDING_NAME: { @@ -1929,6 +1930,22 @@ find_value_indexed(const char *func, GLenum pname, GLuint index, union value *v) v->value_int = ctx->ImageUnits[index].Format; return TYPE_INT; + + case GL_MAX_COMPUTE_WORK_GROUP_COUNT: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader) + goto invalid_enum; + if (index >= 3) + goto invalid_value; + v->value_int = ctx->Const.MaxComputeWorkGroupCount[index]; + return TYPE_INT; + + case GL_MAX_COMPUTE_WORK_GROUP_SIZE: + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader) + goto invalid_enum; + if (index >= 3) + goto invalid_value; + v->value_int = ctx->Const.MaxComputeWorkGroupSize[index]; + return TYPE_INT; } invalid_enum: diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index b45e1430b..f47cbd881 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -221,9 +221,9 @@ descriptor=[ [ "SAMPLE_ALPHA_TO_ONE_ARB", "CONTEXT_BOOL(Multisample.SampleAlphaToOne), NO_EXTRA" ], # GL_ARB_vertex_buffer_object - [ "VERTEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_POS].BufferObj), NO_EXTRA" ], - [ "NORMAL_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA" ], - [ "COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA" ], + [ "VERTEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_POS].BufferObj), NO_EXTRA" ], + [ "NORMAL_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_NORMAL].BufferObj), NO_EXTRA" ], + [ "COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR0].BufferObj), NO_EXTRA" ], [ "TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, NO_OFFSET, NO_EXTRA" ], # GL_OES_point_sprite @@ -365,7 +365,7 @@ descriptor=[ # GL_EXT_framebuffer_blit # NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT - [ "READ_FRAMEBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_framebuffer_blit" ], + [ "READ_FRAMEBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], # GL_EXT_gpu_shader4 / GLSL 1.30 [ "MIN_PROGRAM_TEXEL_OFFSET", "CONTEXT_INT(Const.MinProgramTexelOffset), extra_GLSL_130_es3" ], @@ -583,10 +583,10 @@ descriptor=[ [ "PRIMITIVE_RESTART_INDEX_NV", "CONTEXT_INT(Array.RestartIndex), extra_NV_primitive_restart" ], # GL_ARB_vertex_buffer_object - [ "INDEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA" ], - [ "EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA" ], - [ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ], - [ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexBinding[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ], + [ "INDEX_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR_INDEX].BufferObj), NO_EXTRA" ], + [ "EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_EDGEFLAG].BufferObj), NO_EXTRA" ], + [ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ], + [ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_vertex_array_object, VertexBinding[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ], # GL_ARB_vertex_program # == GL_VERTEX_PROGRAM_NV @@ -643,7 +643,7 @@ descriptor=[ # GL_ARB_transform_feedback3 [ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ], - [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ], + [ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3_ARB_gpu_shader5" ], # GL_ARB_geometry_shader4 [ "MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits), extra_gl32_ARB_geometry_shader4" ], @@ -716,7 +716,7 @@ descriptor=[ [ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ], # GL_ARB_map_buffer_alignment - [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), extra_ARB_map_buffer_alignment" ], + [ "MIN_MAP_BUFFER_ALIGNMENT", "CONTEXT_INT(Const.MinMapBufferAlignment), NO_EXTRA" ], # GL_ARB_texture_cube_map_array [ "TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_array" ], @@ -751,6 +751,15 @@ descriptor=[ [ "MAX_GEOMETRY_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms), extra_ARB_shader_image_load_store_and_geometry_shader"], [ "MAX_FRAGMENT_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), extra_ARB_shader_image_load_store"], [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), extra_ARB_shader_image_load_store"], + +# GL_ARB_compute_shader + [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "CONTEXT_INT(Const.MaxComputeWorkGroupInvocations), extra_ARB_compute_shader" ], + +# GL_ARB_gpu_shader5 + [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5" ], + [ "MIN_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MinFragmentInterpolationOffset), extra_ARB_gpu_shader5" ], + [ "MAX_FRAGMENT_INTERPOLATION_OFFSET", "CONTEXT_FLOAT(Const.MaxFragmentInterpolationOffset), extra_ARB_gpu_shader5" ], + [ "FRAGMENT_INTERPOLATION_OFFSET_BITS", "CONST(FRAGMENT_INTERPOLATION_OFFSET_BITS), extra_ARB_gpu_shader5" ], ]}, # Enums restricted to OpenGL Core profile diff --git a/mesalib/src/mesa/main/getstring.c b/mesalib/src/mesa/main/getstring.c index b66e24788..674126702 100644 --- a/mesalib/src/mesa/main/getstring.c +++ b/mesalib/src/mesa/main/getstring.c @@ -200,42 +200,42 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_VERTEX_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POS].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POS].Ptr; break; case GL_NORMAL_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_NORMAL].Ptr; break; case GL_COLOR_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0].Ptr; break; case GL_SECONDARY_COLOR_ARRAY_POINTER_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1].Ptr; break; case GL_FOG_COORDINATE_ARRAY_POINTER_EXT: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_FOG].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_FOG].Ptr; break; case GL_INDEX_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Ptr; break; case GL_TEXTURE_COORD_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT && ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_TEX(clientUnit)].Ptr; break; case GL_EDGE_FLAG_ARRAY_POINTER: if (ctx->API != API_OPENGL_COMPAT) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Ptr; break; case GL_FEEDBACK_BUFFER_POINTER: if (ctx->API != API_OPENGL_COMPAT) @@ -250,7 +250,7 @@ _mesa_GetPointerv( GLenum pname, GLvoid **params ) case GL_POINT_SIZE_ARRAY_POINTER_OES: if (ctx->API != API_OPENGLES) goto invalid_pname; - *params = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr; + *params = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_POINT_SIZE].Ptr; break; case GL_DEBUG_CALLBACK_FUNCTION_ARB: if (!_mesa_is_desktop_gl(ctx)) diff --git a/mesalib/src/mesa/main/matrix.c b/mesalib/src/mesa/main/matrix.c index b2130221f..99a501321 100644 --- a/mesalib/src/mesa/main/matrix.c +++ b/mesalib/src/mesa/main/matrix.c @@ -606,16 +606,8 @@ calculate_model_project_matrix( struct gl_context *ctx ) */ void _mesa_update_modelview_project( struct gl_context *ctx, GLuint new_state ) { - if (new_state & _NEW_MODELVIEW) { + if (new_state & _NEW_MODELVIEW) _math_matrix_analyse( ctx->ModelviewMatrixStack.Top ); - - /* Bring cull position up to date. - */ - TRANSFORM_POINT3( ctx->Transform.CullObjPos, - ctx->ModelviewMatrixStack.Top->inv, - ctx->Transform.CullEyePos ); - } - if (new_state & _NEW_PROJECTION) update_projection( ctx ); @@ -762,9 +754,6 @@ void _mesa_init_transform( struct gl_context *ctx ) ASSIGN_4V( ctx->Transform.EyeUserPlane[i], 0.0, 0.0, 0.0, 0.0 ); } ctx->Transform.ClipPlanesEnabled = 0; - - ASSIGN_4V( ctx->Transform.CullObjPos, 0.0, 0.0, 1.0, 0.0 ); - ASSIGN_4V( ctx->Transform.CullEyePos, 0.0, 0.0, 1.0, 0.0 ); } diff --git a/mesalib/src/mesa/main/mipmap.c b/mesalib/src/mesa/main/mipmap.c index 033015780..521b2d8eb 100644 --- a/mesalib/src/mesa/main/mipmap.c +++ b/mesalib/src/mesa/main/mipmap.c @@ -1816,7 +1816,7 @@ GLboolean _mesa_prepare_mipmap_level(struct gl_context *ctx, struct gl_texture_object *texObj, GLuint level, GLsizei width, GLsizei height, GLsizei depth, - GLsizei border, GLenum intFormat, gl_format format) + GLsizei border, GLenum intFormat, mesa_format format) { const GLuint numFaces = _mesa_num_tex_faces(texObj->Target); GLuint face; @@ -2018,7 +2018,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, GLuint maxLevel) { GLuint level; - gl_format temp_format; + mesa_format temp_format; GLint components; GLuint temp_src_row_stride, temp_src_img_stride; /* in bytes */ GLubyte *temp_src = NULL, *temp_dst = NULL; diff --git a/mesalib/src/mesa/main/mipmap.h b/mesalib/src/mesa/main/mipmap.h index ee91df006..c0366d329 100644 --- a/mesalib/src/mesa/main/mipmap.h +++ b/mesalib/src/mesa/main/mipmap.h @@ -45,7 +45,7 @@ extern GLboolean _mesa_prepare_mipmap_level(struct gl_context *ctx, struct gl_texture_object *texObj, GLuint level, GLsizei width, GLsizei height, GLsizei depth, - GLsizei border, GLenum intFormat, gl_format format); + GLsizei border, GLenum intFormat, mesa_format format); extern void _mesa_generate_mipmap(struct gl_context *ctx, GLenum target, diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 9ab2de026..ceabd9df7 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -406,9 +406,10 @@ typedef enum MESA_SHADER_VERTEX = 0, MESA_SHADER_GEOMETRY = 1, MESA_SHADER_FRAGMENT = 2, + MESA_SHADER_COMPUTE = 3, } gl_shader_stage; -#define MESA_SHADER_STAGES (MESA_SHADER_FRAGMENT + 1) +#define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1) /** @@ -1115,7 +1116,7 @@ struct gl_texture_image * GL_DEPTH_STENCIL_EXT only. Used for * choosing TexEnv arithmetic. */ - gl_format TexFormat; /**< The actual texture memory format */ + mesa_format TexFormat; /**< The actual texture memory format */ GLuint Border; /**< 0 or 1 */ GLuint Width; /**< = 2^WidthLog2 + 2*Border */ @@ -1229,7 +1230,7 @@ struct gl_texture_object struct gl_buffer_object *BufferObject; GLenum BufferObjectFormat; /** Equivalent Mesa format for BufferObjectFormat. */ - gl_format _BufferObjectFormat; + mesa_format _BufferObjectFormat; /** GL_ARB_texture_buffer_range */ GLintptr BufferOffset; GLsizeiptr BufferSize; /**< if this is -1, use BufferObject->Size instead */ @@ -1423,9 +1424,6 @@ struct gl_transform_attrib GLboolean RescaleNormals; /**< GL_EXT_rescale_normal */ GLboolean RasterPositionUnclipped; /**< GL_IBM_rasterpos_clip */ GLboolean DepthClamp; /**< GL_ARB_depth_clamp */ - - GLfloat CullEyePos[4]; - GLfloat CullObjPos[4]; }; @@ -1551,12 +1549,13 @@ struct gl_vertex_buffer_binding /** - * Collection of vertex arrays. Defined by the GL_APPLE_vertex_array_object - * extension, but a nice encapsulation in any case. + * A representation of "Vertex Array Objects" (VAOs) from OpenGL 3.1+, + * GL_ARB_vertex_array_object, or the original GL_APPLE_vertex_array_object + * extension. */ -struct gl_array_object +struct gl_vertex_array_object { - /** Name of the array object as received from glGenVertexArrayAPPLE. */ + /** Name of the VAO as received from glGenVertexArray. */ GLuint Name; GLchar *Label; /**< GL_KHR_debug */ @@ -1584,7 +1583,12 @@ struct gl_array_object */ GLboolean EverBound; - /** Derived vertex attribute arrays */ + /** + * Derived vertex attribute arrays + * + * This is a legacy data structure created from gl_vertex_attrib_array and + * gl_vertex_buffer_binding, for compatibility with existing driver code. + */ struct gl_client_array _VertexAttrib[VERT_ATTRIB_MAX]; /** Vertex attribute arrays */ @@ -1605,7 +1609,8 @@ struct gl_array_object */ GLuint _MaxElement; - struct gl_buffer_object *ElementArrayBufferObj; + /** The index buffer (also known as the element array buffer in OpenGL). */ + struct gl_buffer_object *IndexBufferObj; }; @@ -1615,10 +1620,10 @@ struct gl_array_object struct gl_array_attrib { /** Currently bound array object. See _mesa_BindVertexArrayAPPLE() */ - struct gl_array_object *ArrayObj; + struct gl_vertex_array_object *VAO; /** The default vertex array object */ - struct gl_array_object *DefaultArrayObj; + struct gl_vertex_array_object *DefaultVAO; /** Array objects (GL_ARB/APPLE_vertex_array_object) */ struct _mesa_HashTable *Objects; @@ -2176,6 +2181,18 @@ struct gl_fragment_program }; +/** Compute program object */ +struct gl_compute_program +{ + struct gl_program Base; /**< base class */ + + /** + * Size specified using local_size_{x,y,z}. + */ + unsigned LocalSize[3]; +}; + + /** * State common to vertex and fragment programs. */ @@ -2439,6 +2456,17 @@ struct gl_shader * ImageAccess arrays above. */ GLuint NumImages; + + /** + * Compute shader state from ARB_compute_shader layout qualifiers. + */ + struct { + /** + * Size specified using local_size_{x,y,z}, or all 0's to indicate that + * it's not set in this shader. + */ + unsigned LocalSize[3]; + } Comp; }; @@ -2623,6 +2651,18 @@ struct gl_shader_program 0 if not present. */ } Vert; + /** + * Compute shader state - copied into gl_compute_program by + * _mesa_copy_linked_program_data(). + */ + struct { + /** + * If this shader contains a compute stage, size specified using + * local_size_{x,y,z}. Otherwise undefined. + */ + unsigned LocalSize[3]; + } Comp; + /* post-link info: */ unsigned NumUserUniformStorage; struct gl_uniform_storage *UniformStorage; @@ -2928,7 +2968,7 @@ struct gl_renderbuffer GLenum InternalFormat; /**< The user-specified format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ - gl_format Format; /**< The actual renderbuffer memory format */ + mesa_format Format; /**< The actual renderbuffer memory format */ /** * Pointer to the texture image if this renderbuffer wraps a texture, * otherwise NULL. @@ -3366,6 +3406,15 @@ struct gl_constants GLuint MaxCombinedImageUnitsAndFragmentOutputs; GLuint MaxImageSamples; GLuint MaxCombinedImageUniforms; + + /** GL_ARB_compute_shader */ + GLuint MaxComputeWorkGroupCount[3]; /* Array of x, y, z dimensions */ + GLuint MaxComputeWorkGroupSize[3]; /* Array of x, y, z dimensions */ + GLuint MaxComputeWorkGroupInvocations; + + /** GL_ARB_gpu_shader5 */ + GLfloat MinFragmentInterpolationOffset; + GLfloat MaxFragmentInterpolationOffset; }; @@ -3385,6 +3434,7 @@ struct gl_extensions GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; GLboolean ARB_color_buffer_float; + GLboolean ARB_compute_shader; GLboolean ARB_conservative_depth; GLboolean ARB_depth_buffer_float; GLboolean ARB_depth_clamp; @@ -3405,7 +3455,6 @@ struct gl_extensions GLboolean ARB_half_float_vertex; GLboolean ARB_instanced_arrays; GLboolean ARB_internalformat_query; - GLboolean ARB_map_buffer_alignment; GLboolean ARB_map_buffer_range; GLboolean ARB_occlusion_query; GLboolean ARB_occlusion_query2; @@ -3457,7 +3506,6 @@ struct gl_extensions GLboolean EXT_blend_minmax; GLboolean EXT_depth_bounds_test; GLboolean EXT_draw_buffers2; - GLboolean EXT_framebuffer_blit; GLboolean EXT_framebuffer_multisample; GLboolean EXT_framebuffer_multisample_blit_scaled; GLboolean EXT_framebuffer_sRGB; @@ -3490,7 +3538,6 @@ struct gl_extensions /* vendor extensions */ GLboolean AMD_performance_monitor; GLboolean AMD_seamless_cubemap_per_texture; - GLboolean AMD_shader_trinary_minmax; GLboolean AMD_vertex_shader_layer; GLboolean APPLE_object_purgeable; GLboolean ATI_envmap_bumpmap; @@ -3862,7 +3909,7 @@ struct gl_image_unit /** * Mesa format corresponding to \c Format. */ - gl_format _ActualFormat; + mesa_format _ActualFormat; /** * GL_TRUE if the state of this image unit is valid and access from diff --git a/mesalib/src/mesa/main/objectlabel.c b/mesalib/src/mesa/main/objectlabel.c index e75fe3be2..8efc33e0d 100644 --- a/mesalib/src/mesa/main/objectlabel.c +++ b/mesalib/src/mesa/main/objectlabel.c @@ -158,7 +158,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name, break; case GL_VERTEX_ARRAY: { - struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, name); + struct gl_vertex_array_object *obj = _mesa_lookup_vao(ctx, name); if (obj) labelPtr = &obj->Label; } diff --git a/mesalib/src/mesa/main/readpix.c b/mesalib/src/mesa/main/readpix.c index 51a0b1553..e16346896 100644 --- a/mesalib/src/mesa/main/readpix.c +++ b/mesalib/src/mesa/main/readpix.c @@ -45,7 +45,7 @@ * Return true if the conversion L=R+G+B is needed. */ static GLboolean -need_rgb_to_luminance_conversion(gl_format texFormat, GLenum format) +need_rgb_to_luminance_conversion(mesa_format texFormat, GLenum format) { GLenum baseTexFormat = _mesa_get_format_base_format(texFormat); @@ -60,7 +60,7 @@ need_rgb_to_luminance_conversion(gl_format texFormat, GLenum format) * Return transfer op flags for this ReadPixels operation. */ static GLbitfield -get_readpixels_transfer_ops(const struct gl_context *ctx, gl_format texFormat, +get_readpixels_transfer_ops(const struct gl_context *ctx, mesa_format texFormat, GLenum format, GLenum type, GLboolean uses_blit) { GLbitfield transferOps = ctx->_ImageTransferState; @@ -424,13 +424,13 @@ read_rgba_pixels_swizzle(struct gl_context *ctx, GLboolean swizzle_rb = GL_FALSE, copy_xrgb = GL_FALSE; /* XXX we could check for other swizzle/special cases here as needed */ - if (rb->Format == MESA_FORMAT_RGBA8888_REV && + if (rb->Format == MESA_FORMAT_R8G8B8A8_UNORM && format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !ctx->Pack.SwapBytes) { swizzle_rb = GL_TRUE; } - else if (rb->Format == MESA_FORMAT_XRGB8888 && + else if (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM && format == GL_BGRA && type == GL_UNSIGNED_INT_8_8_8_8_REV && !ctx->Pack.SwapBytes) { @@ -493,7 +493,7 @@ slow_read_rgba_pixels( struct gl_context *ctx, GLbitfield transferOps ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - const gl_format rbFormat = _mesa_get_srgb_format_linear(rb->Format); + const mesa_format rbFormat = _mesa_get_srgb_format_linear(rb->Format); void *rgba; GLubyte *dst, *map; int dstStride, stride, j; @@ -594,8 +594,8 @@ fast_read_depth_stencil_pixels(struct gl_context *ctx, if (rb != stencilRb) return GL_FALSE; - if (rb->Format != MESA_FORMAT_Z24_S8 && - rb->Format != MESA_FORMAT_S8_Z24) + if (rb->Format != MESA_FORMAT_S8_UINT_Z24_UNORM && + rb->Format != MESA_FORMAT_Z24_UNORM_X8_UINT) return GL_FALSE; ctx->Driver.MapRenderbuffer(ctx, rb, x, y, width, height, GL_MAP_READ_BIT, diff --git a/mesalib/src/mesa/main/scissor.c b/mesalib/src/mesa/main/scissor.c index 14c8e8a6c..83f39e2a0 100644 --- a/mesalib/src/mesa/main/scissor.c +++ b/mesalib/src/mesa/main/scissor.c @@ -145,6 +145,7 @@ _mesa_ScissorArrayv(GLuint first, GLsizei count, const GLint *v) _mesa_error(ctx, GL_INVALID_VALUE, "glScissorArrayv: index (%d) width or height < 0 (%d, %d)", i, p[i].Width, p[i].Height); + return; } } @@ -187,6 +188,7 @@ ScissorIndexed(GLuint index, GLint left, GLint bottom, _mesa_error(ctx, GL_INVALID_VALUE, "%s: index (%d) width or height < 0 (%d, %d)", function, index, width, height); + return; } set_scissor_no_notify(ctx, index, left, bottom, width, height); diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index 61ac0e35a..65b6b16bb 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -188,6 +188,8 @@ _mesa_validate_shader_target(const struct gl_context *ctx, GLenum type) return ctx == NULL || ctx->Extensions.ARB_vertex_shader; case GL_GEOMETRY_SHADER_ARB: return ctx == NULL || _mesa_has_geometry_shaders(ctx); + case GL_COMPUTE_SHADER: + return ctx == NULL || ctx->Extensions.ARB_compute_shader; default: return false; } @@ -661,6 +663,24 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param *params = shProg->NumAtomicBuffers; return; + case GL_COMPUTE_WORK_GROUP_SIZE: { + int i; + if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_compute_shader) + break; + if (!shProg->LinkStatus) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramiv(program not " + "linked)"); + return; + } + if (shProg->_LinkedShaders[MESA_SHADER_COMPUTE] == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glGetProgramiv(no compute " + "shaders)"); + return; + } + for (i = 0; i < 3; i++) + params[i] = shProg->Comp.LocalSize[i]; + return; + } default: break; } @@ -966,6 +986,9 @@ use_shader_program(struct gl_context *ctx, GLenum type, case GL_GEOMETRY_SHADER_ARB: /* Empty for now. */ break; + case GL_COMPUTE_SHADER: + /* Empty for now. */ + break; case GL_FRAGMENT_SHADER: if (*target == ctx->Shader._CurrentFragmentProgram) { _mesa_reference_shader_program(ctx, @@ -989,6 +1012,7 @@ _mesa_use_program(struct gl_context *ctx, struct gl_shader_program *shProg) use_shader_program(ctx, GL_VERTEX_SHADER, shProg); use_shader_program(ctx, GL_GEOMETRY_SHADER_ARB, shProg); use_shader_program(ctx, GL_FRAGMENT_SHADER, shProg); + use_shader_program(ctx, GL_COMPUTE_SHADER, shProg); _mesa_active_program(ctx, shProg, "glUseProgram"); if (ctx->Driver.UseProgram) @@ -1840,6 +1864,13 @@ _mesa_copy_linked_program_data(gl_shader_stage type, dst_gp->UsesEndPrimitive = src->Geom.UsesEndPrimitive; } break; + case MESA_SHADER_COMPUTE: { + struct gl_compute_program *dst_cp = (struct gl_compute_program *) dst; + int i; + for (i = 0; i < 3; i++) + dst_cp->LocalSize[i] = src->Comp.LocalSize[i]; + } + break; default: break; } diff --git a/mesalib/src/mesa/main/shaderimage.c b/mesalib/src/mesa/main/shaderimage.c index 80c469366..d1e752d3d 100644 --- a/mesalib/src/mesa/main/shaderimage.c +++ b/mesalib/src/mesa/main/shaderimage.c @@ -42,22 +42,22 @@ * results. */ #ifdef MESA_BIG_ENDIAN -# define MESA_FORMAT_RGBA_8 MESA_FORMAT_RGBA8888 -# define MESA_FORMAT_RG_16 MESA_FORMAT_RG1616 -# define MESA_FORMAT_RG_8 MESA_FORMAT_RG88 -# define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_SIGNED_RGBA8888 -# define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_SIGNED_RG1616 -# define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_SIGNED_RG88 +# define MESA_FORMAT_RGBA_8 MESA_FORMAT_A8B8G8R8_UNORM +# define MESA_FORMAT_RG_16 MESA_FORMAT_G16R16_UNORM +# define MESA_FORMAT_RG_8 MESA_FORMAT_G8R8_UNORM +# define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_A8B8G8R8_SNORM +# define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_G16R16_SNORM +# define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_G8R8_SNORM #else -# define MESA_FORMAT_RGBA_8 MESA_FORMAT_RGBA8888_REV -# define MESA_FORMAT_RG_16 MESA_FORMAT_GR1616 -# define MESA_FORMAT_RG_8 MESA_FORMAT_GR88 -# define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_SIGNED_RGBA8888_REV -# define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_SIGNED_GR1616 -# define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_SIGNED_RG88_REV +# define MESA_FORMAT_RGBA_8 MESA_FORMAT_R8G8B8A8_UNORM +# define MESA_FORMAT_RG_16 MESA_FORMAT_R16G16_UNORM +# define MESA_FORMAT_RG_8 MESA_FORMAT_R8G8_UNORM +# define MESA_FORMAT_SIGNED_RGBA_8 MESA_FORMAT_R8G8B8A8_SNORM +# define MESA_FORMAT_SIGNED_RG_16 MESA_FORMAT_R16G16_SNORM +# define MESA_FORMAT_SIGNED_RG_8 MESA_FORMAT_R8G8_SNORM #endif -static gl_format +static mesa_format get_image_format(GLenum format) { switch (format) { @@ -74,7 +74,7 @@ get_image_format(GLenum format) return MESA_FORMAT_RG_FLOAT16; case GL_R11F_G11F_B10F: - return MESA_FORMAT_R11_G11_B10_FLOAT; + return MESA_FORMAT_R11G11B10_FLOAT; case GL_R32F: return MESA_FORMAT_R_FLOAT32; @@ -89,7 +89,7 @@ get_image_format(GLenum format) return MESA_FORMAT_RGBA_UINT16; case GL_RGB10_A2UI: - return MESA_FORMAT_ABGR2101010_UINT; + return MESA_FORMAT_R10G10B10A2_UINT; case GL_RGBA8UI: return MESA_FORMAT_RGBA_UINT8; @@ -113,37 +113,37 @@ get_image_format(GLenum format) return MESA_FORMAT_R_UINT8; case GL_RGBA32I: - return MESA_FORMAT_RGBA_INT32; + return MESA_FORMAT_RGBA_SINT32; case GL_RGBA16I: - return MESA_FORMAT_RGBA_INT16; + return MESA_FORMAT_RGBA_SINT16; case GL_RGBA8I: - return MESA_FORMAT_RGBA_INT8; + return MESA_FORMAT_RGBA_SINT8; case GL_RG32I: - return MESA_FORMAT_RG_INT32; + return MESA_FORMAT_RG_SINT32; case GL_RG16I: - return MESA_FORMAT_RG_INT16; + return MESA_FORMAT_RG_SINT16; case GL_RG8I: - return MESA_FORMAT_RG_INT8; + return MESA_FORMAT_RG_SINT8; case GL_R32I: - return MESA_FORMAT_R_INT32; + return MESA_FORMAT_R_SINT32; case GL_R16I: - return MESA_FORMAT_R_INT16; + return MESA_FORMAT_R_SINT16; case GL_R8I: - return MESA_FORMAT_R_INT8; + return MESA_FORMAT_R_SINT8; case GL_RGBA16: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case GL_RGB10_A2: - return MESA_FORMAT_ABGR2101010; + return MESA_FORMAT_R10G10B10A2_UNORM; case GL_RGBA8: return MESA_FORMAT_RGBA_8; @@ -155,13 +155,13 @@ get_image_format(GLenum format) return MESA_FORMAT_RG_8; case GL_R16: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case GL_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case GL_RGBA16_SNORM: - return MESA_FORMAT_SIGNED_RGBA_16; + return MESA_FORMAT_RGBA_SNORM16; case GL_RGBA8_SNORM: return MESA_FORMAT_SIGNED_RGBA_8; @@ -173,10 +173,10 @@ get_image_format(GLenum format) return MESA_FORMAT_SIGNED_RG_8; case GL_R16_SNORM: - return MESA_FORMAT_SIGNED_R16; + return MESA_FORMAT_R_SNORM16; case GL_R8_SNORM: - return MESA_FORMAT_SIGNED_R8; + return MESA_FORMAT_R_SNORM8; default: return MESA_FORMAT_NONE; @@ -205,7 +205,7 @@ enum image_format_class }; static enum image_format_class -get_image_format_class(gl_format format) +get_image_format_class(mesa_format format) { switch (format) { case MESA_FORMAT_RGBA_FLOAT32: @@ -220,7 +220,7 @@ get_image_format_class(gl_format format) case MESA_FORMAT_RG_FLOAT16: return IMAGE_FORMAT_CLASS_2X16; - case MESA_FORMAT_R11_G11_B10_FLOAT: + case MESA_FORMAT_R11G11B10_FLOAT: return IMAGE_FORMAT_CLASS_10_11_11; case MESA_FORMAT_R_FLOAT32: @@ -235,7 +235,7 @@ get_image_format_class(gl_format format) case MESA_FORMAT_RGBA_UINT16: return IMAGE_FORMAT_CLASS_4X16; - case MESA_FORMAT_ABGR2101010_UINT: + case MESA_FORMAT_R10G10B10A2_UINT: return IMAGE_FORMAT_CLASS_2_10_10_10; case MESA_FORMAT_RGBA_UINT8: @@ -259,37 +259,37 @@ get_image_format_class(gl_format format) case MESA_FORMAT_R_UINT8: return IMAGE_FORMAT_CLASS_1X8; - case MESA_FORMAT_RGBA_INT32: + case MESA_FORMAT_RGBA_SINT32: return IMAGE_FORMAT_CLASS_4X32; - case MESA_FORMAT_RGBA_INT16: + case MESA_FORMAT_RGBA_SINT16: return IMAGE_FORMAT_CLASS_4X16; - case MESA_FORMAT_RGBA_INT8: + case MESA_FORMAT_RGBA_SINT8: return IMAGE_FORMAT_CLASS_4X8; - case MESA_FORMAT_RG_INT32: + case MESA_FORMAT_RG_SINT32: return IMAGE_FORMAT_CLASS_2X32; - case MESA_FORMAT_RG_INT16: + case MESA_FORMAT_RG_SINT16: return IMAGE_FORMAT_CLASS_2X16; - case MESA_FORMAT_RG_INT8: + case MESA_FORMAT_RG_SINT8: return IMAGE_FORMAT_CLASS_2X8; - case MESA_FORMAT_R_INT32: + case MESA_FORMAT_R_SINT32: return IMAGE_FORMAT_CLASS_1X32; - case MESA_FORMAT_R_INT16: + case MESA_FORMAT_R_SINT16: return IMAGE_FORMAT_CLASS_1X16; - case MESA_FORMAT_R_INT8: + case MESA_FORMAT_R_SINT8: return IMAGE_FORMAT_CLASS_1X8; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return IMAGE_FORMAT_CLASS_4X16; - case MESA_FORMAT_ABGR2101010: + case MESA_FORMAT_R10G10B10A2_UNORM: return IMAGE_FORMAT_CLASS_2_10_10_10; case MESA_FORMAT_RGBA_8: @@ -301,13 +301,13 @@ get_image_format_class(gl_format format) case MESA_FORMAT_RG_8: return IMAGE_FORMAT_CLASS_2X8; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return IMAGE_FORMAT_CLASS_1X16; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return IMAGE_FORMAT_CLASS_1X8; - case MESA_FORMAT_SIGNED_RGBA_16: + case MESA_FORMAT_RGBA_SNORM16: return IMAGE_FORMAT_CLASS_4X16; case MESA_FORMAT_SIGNED_RGBA_8: @@ -319,10 +319,10 @@ get_image_format_class(gl_format format) case MESA_FORMAT_SIGNED_RG_8: return IMAGE_FORMAT_CLASS_2X8; - case MESA_FORMAT_SIGNED_R16: + case MESA_FORMAT_R_SNORM16: return IMAGE_FORMAT_CLASS_1X16; - case MESA_FORMAT_SIGNED_R8: + case MESA_FORMAT_R_SNORM8: return IMAGE_FORMAT_CLASS_1X8; default: diff --git a/mesalib/src/mesa/main/shaderobj.h b/mesalib/src/mesa/main/shaderobj.h index 517557088..fae8be827 100644 --- a/mesalib/src/mesa/main/shaderobj.h +++ b/mesalib/src/mesa/main/shaderobj.h @@ -111,6 +111,8 @@ _mesa_shader_enum_to_shader_stage(GLenum v) return MESA_SHADER_FRAGMENT; case GL_GEOMETRY_SHADER: return MESA_SHADER_GEOMETRY; + case GL_COMPUTE_SHADER: + return MESA_SHADER_COMPUTE; default: ASSERT(0 && "bad value in _mesa_shader_enum_to_shader_stage()"); return MESA_SHADER_VERTEX; diff --git a/mesalib/src/mesa/main/state.c b/mesalib/src/mesa/main/state.c index bdebbc141..0866a140f 100644 --- a/mesalib/src/mesa/main/state.c +++ b/mesalib/src/mesa/main/state.c @@ -417,11 +417,11 @@ _mesa_update_state_locked( struct gl_context *ctx ) } if (new_state & _NEW_ARRAY) - _mesa_update_array_object_client_arrays(ctx, ctx->Array.ArrayObj); + _mesa_update_vao_client_arrays(ctx, ctx->Array.VAO); if (ctx->Const.CheckArrayBounds && new_state & (_NEW_ARRAY | _NEW_PROGRAM | _NEW_BUFFER_OBJECT)) { - _mesa_update_array_object_max_element(ctx, ctx->Array.ArrayObj); + _mesa_update_vao_max_element(ctx, ctx->Array.VAO); } out: @@ -439,7 +439,7 @@ _mesa_update_state_locked( struct gl_context *ctx ) new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); - ctx->Array.ArrayObj->NewArrays = 0x0; + ctx->Array.VAO->NewArrays = 0x0; } diff --git a/mesalib/src/mesa/main/texcompress.c b/mesalib/src/mesa/main/texcompress.c index 47ad30605..9dbfe9ffe 100644 --- a/mesalib/src/mesa/main/texcompress.c +++ b/mesalib/src/mesa/main/texcompress.c @@ -361,7 +361,7 @@ _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats) /** * Convert a compressed MESA_FORMAT_x to a GLenum. */ -gl_format +mesa_format _mesa_glenum_to_compressed_format(GLenum format) { switch (format) { @@ -393,23 +393,23 @@ _mesa_glenum_to_compressed_format(GLenum format) return MESA_FORMAT_SRGBA_DXT5; case GL_COMPRESSED_RED_RGTC1: - return MESA_FORMAT_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_UNORM; case GL_COMPRESSED_SIGNED_RED_RGTC1: - return MESA_FORMAT_SIGNED_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_SNORM; case GL_COMPRESSED_RG_RGTC2: - return MESA_FORMAT_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_UNORM; case GL_COMPRESSED_SIGNED_RG_RGTC2: - return MESA_FORMAT_SIGNED_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_SNORM; case GL_COMPRESSED_LUMINANCE_LATC1_EXT: - return MESA_FORMAT_L_LATC1; + return MESA_FORMAT_L_LATC1_UNORM; case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: - return MESA_FORMAT_SIGNED_L_LATC1; + return MESA_FORMAT_L_LATC1_SNORM; case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: - return MESA_FORMAT_LA_LATC2; + return MESA_FORMAT_LA_LATC2_UNORM; case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: - return MESA_FORMAT_SIGNED_LA_LATC2; + return MESA_FORMAT_LA_LATC2_SNORM; case GL_ETC1_RGB8_OES: return MESA_FORMAT_ETC1_RGB8; @@ -451,7 +451,7 @@ _mesa_glenum_to_compressed_format(GLenum format) * internal format unchanged. */ GLenum -_mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat) +_mesa_compressed_format_to_glenum(struct gl_context *ctx, mesa_format mesaFormat) { switch (mesaFormat) { case MESA_FORMAT_RGB_FXT1: @@ -474,22 +474,22 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat) return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; case MESA_FORMAT_SRGBA_DXT5: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - case MESA_FORMAT_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_UNORM: return GL_COMPRESSED_RED_RGTC1; - case MESA_FORMAT_SIGNED_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_SNORM: return GL_COMPRESSED_SIGNED_RED_RGTC1; - case MESA_FORMAT_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_UNORM: return GL_COMPRESSED_RG_RGTC2; - case MESA_FORMAT_SIGNED_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_SNORM: return GL_COMPRESSED_SIGNED_RG_RGTC2; - case MESA_FORMAT_L_LATC1: + case MESA_FORMAT_L_LATC1_UNORM: return GL_COMPRESSED_LUMINANCE_LATC1_EXT; - case MESA_FORMAT_SIGNED_L_LATC1: + case MESA_FORMAT_L_LATC1_SNORM: return GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT; - case MESA_FORMAT_LA_LATC2: + case MESA_FORMAT_LA_LATC2_UNORM: return GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT; - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_LA_LATC2_SNORM: return GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT; case MESA_FORMAT_ETC1_RGB8: @@ -535,7 +535,7 @@ _mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat) */ GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, - gl_format mesaFormat, + mesa_format mesaFormat, GLsizei width, const GLubyte *image) { /* XXX only 2D images implemented, not 3D */ @@ -560,7 +560,7 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, * invalid format. */ compressed_fetch_func -_mesa_get_compressed_fetch_func(gl_format format) +_mesa_get_compressed_fetch_func(mesa_format format) { switch (format) { case MESA_FORMAT_RGB_DXT1: @@ -575,14 +575,14 @@ _mesa_get_compressed_fetch_func(gl_format format) case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: return _mesa_get_fxt_fetch_func(format); - case MESA_FORMAT_RED_RGTC1: - case MESA_FORMAT_L_LATC1: - case MESA_FORMAT_SIGNED_RED_RGTC1: - case MESA_FORMAT_SIGNED_L_LATC1: - case MESA_FORMAT_RG_RGTC2: - case MESA_FORMAT_LA_LATC2: - case MESA_FORMAT_SIGNED_RG_RGTC2: - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_R_RGTC1_UNORM: + case MESA_FORMAT_L_LATC1_UNORM: + case MESA_FORMAT_R_RGTC1_SNORM: + case MESA_FORMAT_L_LATC1_SNORM: + case MESA_FORMAT_RG_RGTC2_UNORM: + case MESA_FORMAT_LA_LATC2_UNORM: + case MESA_FORMAT_RG_RGTC2_SNORM: + case MESA_FORMAT_LA_LATC2_SNORM: return _mesa_get_compressed_rgtc_func(format); case MESA_FORMAT_ETC1_RGB8: return _mesa_get_etc_fetch_func(format); @@ -598,7 +598,7 @@ _mesa_get_compressed_fetch_func(gl_format format) * compressed source image. */ void -_mesa_decompress_image(gl_format format, GLuint width, GLuint height, +_mesa_decompress_image(mesa_format format, GLuint width, GLuint height, const GLubyte *src, GLint srcRowStride, GLfloat *dest) { diff --git a/mesalib/src/mesa/main/texcompress.h b/mesalib/src/mesa/main/texcompress.h index c6a6e873e..b00924d02 100644 --- a/mesalib/src/mesa/main/texcompress.h +++ b/mesalib/src/mesa/main/texcompress.h @@ -36,15 +36,15 @@ _mesa_gl_compressed_format_base_format(GLenum format); extern GLuint _mesa_get_compressed_formats(struct gl_context *ctx, GLint *formats); -extern gl_format +extern mesa_format _mesa_glenum_to_compressed_format(GLenum format); extern GLenum -_mesa_compressed_format_to_glenum(struct gl_context *ctx, gl_format mesaFormat); +_mesa_compressed_format_to_glenum(struct gl_context *ctx, mesa_format mesaFormat); extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, - gl_format mesaFormat, + mesa_format mesaFormat, GLsizei width, const GLubyte *image); @@ -55,11 +55,11 @@ typedef void (*compressed_fetch_func)(const GLubyte *map, GLfloat *texel); extern compressed_fetch_func -_mesa_get_compressed_fetch_func(gl_format format); +_mesa_get_compressed_fetch_func(mesa_format format); extern void -_mesa_decompress_image(gl_format format, GLuint width, GLuint height, +_mesa_decompress_image(mesa_format format, GLuint width, GLuint height, const GLubyte *src, GLint srcRowStride, GLfloat *dest); diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c index a06d29f19..e3862be45 100644 --- a/mesalib/src/mesa/main/texcompress_etc.c +++ b/mesalib/src/mesa/main/texcompress_etc.c @@ -726,7 +726,7 @@ etc2_unpack_srgb8(uint8_t *dst_row, for (i = 0; i < bw; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, false /* punchthrough_alpha */); - /* Convert to MESA_FORMAT_SARGB8 */ + /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ tmp = dst[0]; dst[0] = dst[2]; dst[2] = tmp; @@ -806,7 +806,7 @@ etc2_unpack_srgb8_alpha8(uint8_t *dst_row, for (i = 0; i < bw; i++) { etc2_rgba8_fetch_texel(&block, i, j, dst); - /* Convert to MESA_FORMAT_SARGB8 */ + /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ tmp = dst[0]; dst[0] = dst[2]; dst[2] = tmp; @@ -1047,7 +1047,7 @@ etc2_unpack_srgb8_punchthrough_alpha1(uint8_t *dst_row, for (i = 0; i < bw; i++) { etc2_rgb8_fetch_texel(&block, i, j, dst, true /* punchthrough_alpha */); - /* Convert to MESA_FORMAT_SARGB8 */ + /* Convert to MESA_FORMAT_B8G8R8A8_SRGB */ tmp = dst[0]; dst[0] = dst[2]; dst[2] = tmp; @@ -1175,7 +1175,7 @@ _mesa_unpack_etc2_format(uint8_t *dst_row, unsigned src_stride, unsigned src_width, unsigned src_height, - gl_format format) + mesa_format format) { if (format == MESA_FORMAT_ETC2_RGB8) etc2_unpack_rgb8(dst_row, dst_stride, @@ -1452,7 +1452,7 @@ fetch_etc2_srgb8_punchthrough_alpha1(const GLubyte *map, compressed_fetch_func -_mesa_get_etc_fetch_func(gl_format format) +_mesa_get_etc_fetch_func(mesa_format format) { switch (format) { case MESA_FORMAT_ETC1_RGB8: diff --git a/mesalib/src/mesa/main/texcompress_etc.h b/mesalib/src/mesa/main/texcompress_etc.h index 9da0fb337..319b7bea7 100644 --- a/mesalib/src/mesa/main/texcompress_etc.h +++ b/mesalib/src/mesa/main/texcompress_etc.h @@ -77,9 +77,9 @@ _mesa_unpack_etc2_format(uint8_t *dst_row, unsigned src_stride, unsigned src_width, unsigned src_height, - gl_format format); + mesa_format format); compressed_fetch_func -_mesa_get_etc_fetch_func(gl_format format); +_mesa_get_etc_fetch_func(mesa_format format); #endif diff --git a/mesalib/src/mesa/main/texcompress_fxt1.c b/mesalib/src/mesa/main/texcompress_fxt1.c index 8d37d813f..61b01c6b4 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.c +++ b/mesalib/src/mesa/main/texcompress_fxt1.c @@ -1641,7 +1641,7 @@ fetch_rgba_fxt1(const GLubyte *map, compressed_fetch_func -_mesa_get_fxt_fetch_func(gl_format format) +_mesa_get_fxt_fetch_func(mesa_format format) { switch (format) { case MESA_FORMAT_RGB_FXT1: diff --git a/mesalib/src/mesa/main/texcompress_fxt1.h b/mesalib/src/mesa/main/texcompress_fxt1.h index 4f46d7765..21032eea5 100644 --- a/mesalib/src/mesa/main/texcompress_fxt1.h +++ b/mesalib/src/mesa/main/texcompress_fxt1.h @@ -37,6 +37,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS); compressed_fetch_func -_mesa_get_fxt_fetch_func(gl_format format); +_mesa_get_fxt_fetch_func(mesa_format format); #endif /* TEXCOMPRESS_FXT1_H */ diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c index 7afd8ffa7..1012699f5 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -97,8 +97,8 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS) GLubyte srcpixels[4][4]; GLubyte *blkaddr; GLint dstRowDiff; - ASSERT(dstFormat == MESA_FORMAT_RED_RGTC1 || - dstFormat == MESA_FORMAT_L_LATC1); + ASSERT(dstFormat == MESA_FORMAT_R_RGTC1_UNORM || + dstFormat == MESA_FORMAT_L_LATC1_UNORM); tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, @@ -144,8 +144,8 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS) GLbyte srcpixels[4][4]; GLbyte *blkaddr; GLint dstRowDiff; - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RED_RGTC1 || - dstFormat == MESA_FORMAT_SIGNED_L_LATC1); + ASSERT(dstFormat == MESA_FORMAT_R_RGTC1_SNORM || + dstFormat == MESA_FORMAT_L_LATC1_SNORM); tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -192,8 +192,8 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS) GLubyte *blkaddr; GLint dstRowDiff; - ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2 || - dstFormat == MESA_FORMAT_LA_LATC2); + ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2_UNORM || + dstFormat == MESA_FORMAT_LA_LATC2_UNORM); tempImage = _mesa_make_temp_ubyte_image(ctx, dims, baseInternalFormat, @@ -246,8 +246,8 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) GLbyte *blkaddr; GLint dstRowDiff; - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RG_RGTC2 || - dstFormat == MESA_FORMAT_SIGNED_LA_LATC2); + ASSERT(dstFormat == MESA_FORMAT_RG_RGTC2_SNORM || + dstFormat == MESA_FORMAT_LA_LATC2_SNORM); tempImage = _mesa_make_temp_float_image(ctx, dims, baseInternalFormat, @@ -439,24 +439,24 @@ fetch_signed_la_latc2(const GLubyte *map, compressed_fetch_func -_mesa_get_compressed_rgtc_func(gl_format format) +_mesa_get_compressed_rgtc_func(mesa_format format) { switch (format) { - case MESA_FORMAT_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_UNORM: return fetch_red_rgtc1; - case MESA_FORMAT_L_LATC1: + case MESA_FORMAT_L_LATC1_UNORM: return fetch_l_latc1; - case MESA_FORMAT_SIGNED_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_SNORM: return fetch_signed_red_rgtc1; - case MESA_FORMAT_SIGNED_L_LATC1: + case MESA_FORMAT_L_LATC1_SNORM: return fetch_signed_l_latc1; - case MESA_FORMAT_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_UNORM: return fetch_rg_rgtc2; - case MESA_FORMAT_LA_LATC2: + case MESA_FORMAT_LA_LATC2_UNORM: return fetch_la_latc2; - case MESA_FORMAT_SIGNED_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_SNORM: return fetch_signed_rg_rgtc2; - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_LA_LATC2_SNORM: return fetch_signed_la_latc2; default: return NULL; diff --git a/mesalib/src/mesa/main/texcompress_rgtc.h b/mesalib/src/mesa/main/texcompress_rgtc.h index 98638f022..e9e24950a 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.h +++ b/mesalib/src/mesa/main/texcompress_rgtc.h @@ -41,7 +41,7 @@ extern GLboolean _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS); extern compressed_fetch_func -_mesa_get_compressed_rgtc_func(gl_format format); +_mesa_get_compressed_rgtc_func(mesa_format format); #endif diff --git a/mesalib/src/mesa/main/texcompress_s3tc.c b/mesalib/src/mesa/main/texcompress_s3tc.c index a815193b7..894c46de1 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.c +++ b/mesalib/src/mesa/main/texcompress_s3tc.c @@ -483,7 +483,7 @@ fetch_srgba_dxt5(const GLubyte *map, compressed_fetch_func -_mesa_get_dxt_fetch_func(gl_format format) +_mesa_get_dxt_fetch_func(mesa_format format) { switch (format) { case MESA_FORMAT_RGB_DXT1: diff --git a/mesalib/src/mesa/main/texcompress_s3tc.h b/mesalib/src/mesa/main/texcompress_s3tc.h index d8d8fbfc1..2734210a5 100644 --- a/mesalib/src/mesa/main/texcompress_s3tc.h +++ b/mesalib/src/mesa/main/texcompress_s3tc.h @@ -49,7 +49,7 @@ extern void _mesa_init_texture_s3tc(struct gl_context *ctx); extern compressed_fetch_func -_mesa_get_dxt_fetch_func(gl_format format); +_mesa_get_dxt_fetch_func(mesa_format format); #endif /* TEXCOMPRESS_S3TC_H */ diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c index d3aa47736..bda2d8e17 100644 --- a/mesalib/src/mesa/main/texformat.c +++ b/mesalib/src/mesa/main/texformat.c @@ -54,12 +54,12 @@ * \param format incoming image pixel format. * \param type incoming image data type. * - * \return the closest gl_format for the given format/type arguments + * \return the closest mesa_format for the given format/type arguments * * This is called via dd_function_table::ChooseTextureFormat. Hardware * drivers may override this function with a specialized version. */ -gl_format +mesa_format _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type) { @@ -70,93 +70,93 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case 4: case GL_RGBA: if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + RETURN_IF_SUPPORTED(MESA_FORMAT_B4G4R4A4_UNORM); } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G5R5A1_UNORM); } else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM); } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_RGBA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_RGB5_A1: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555); + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G5R5A1_UNORM); break; case GL_RGBA2: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/ - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + RETURN_IF_SUPPORTED(MESA_FORMAT_A4R4G4B4_UNORM); /* just to test another format*/ + RETURN_IF_SUPPORTED(MESA_FORMAT_B4G4R4A4_UNORM); break; case GL_RGBA4: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444); + RETURN_IF_SUPPORTED(MESA_FORMAT_B4G4R4A4_UNORM); break; /* deep RGBA formats */ case GL_RGB10_A2: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_RGBA12: case GL_RGBA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; /* shallow RGB formats */ case 3: case GL_RGB: if (type == GL_UNSIGNED_INT_2_10_10_10_REV) { - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010); + RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UNORM); } /* fallthrough */ case GL_RGB8: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_R3_G3_B2: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_B2G3R3_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G6R5_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R5G6B5_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_RGB4: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */ - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + RETURN_IF_SUPPORTED(MESA_FORMAT_R5G6B5_UNORM); /* just to test another format */ + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G6R5_UNORM); break; case GL_RGB5: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G6R5_UNORM); break; /* deep RGB formats */ case GL_RGB10: case GL_RGB12: case GL_RGB16: - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UNORM); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; /* Alpha formats */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; case GL_ALPHA12: case GL_ALPHA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_A16); - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; /* Luminance formats */ @@ -164,71 +164,71 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; case GL_LUMINANCE12: case GL_LUMINANCE16: - RETURN_IF_SUPPORTED(MESA_FORMAT_L16); - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; /* Luminance/Alpha formats */ case GL_LUMINANCE4_ALPHA4: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL44); - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + RETURN_IF_SUPPORTED(MESA_FORMAT_L4A4_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616); - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + RETURN_IF_SUPPORTED(MESA_FORMAT_L16A16_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_INTENSITY12: case GL_INTENSITY16: - RETURN_IF_SUPPORTED(MESA_FORMAT_I16); - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z32); - RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z_UNORM32); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_UNORM_S8_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_UNORM_X8_UINT); break; case GL_DEPTH_COMPONENT16: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z16); - RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z_UNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_UNORM_S8_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_UNORM_X8_UINT); break; case GL_COMPRESSED_ALPHA_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_A8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UNORM8); break; case GL_COMPRESSED_LUMINANCE_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_L8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UNORM8); break; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_AL88); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_UNORM); break; case GL_COMPRESSED_INTENSITY_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_I8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UNORM8); break; case GL_COMPRESSED_RGB_ARB: /* We don't use texture compression for 1D and 1D array textures. @@ -243,9 +243,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1); } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888); - RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_UNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8X8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_COMPRESSED_RGBA_ARB: /* We don't use texture compression for 1D and 1D array textures. */ @@ -254,12 +254,12 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1); } - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; case GL_RGB565: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565); + RETURN_IF_SUPPORTED(MESA_FORMAT_B5G6R5_UNORM); break; case GL_YCBCR_MESA: @@ -294,23 +294,23 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: return MESA_FORMAT_RGBA_DXT5; case GL_COMPRESSED_RED_RGTC1: - return MESA_FORMAT_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_UNORM; case GL_COMPRESSED_SIGNED_RED_RGTC1: - return MESA_FORMAT_SIGNED_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_SNORM; case GL_COMPRESSED_RG_RGTC2: - return MESA_FORMAT_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_UNORM; case GL_COMPRESSED_SIGNED_RG_RGTC2: - return MESA_FORMAT_SIGNED_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_SNORM; case GL_COMPRESSED_LUMINANCE_LATC1_EXT: - return MESA_FORMAT_L_LATC1; + return MESA_FORMAT_L_LATC1_UNORM; case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT: - return MESA_FORMAT_SIGNED_L_LATC1; + return MESA_FORMAT_L_LATC1_SNORM; case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT: - return MESA_FORMAT_LA_LATC2; + return MESA_FORMAT_LA_LATC2_UNORM; case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT: - return MESA_FORMAT_SIGNED_LA_LATC2; + return MESA_FORMAT_LA_LATC2_SNORM; case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI: - return MESA_FORMAT_LA_LATC2; + return MESA_FORMAT_LA_LATC2_UNORM; case GL_ETC1_RGB8_OES: return MESA_FORMAT_ETC1_RGB8; case GL_COMPRESSED_RGB8_ETC2: @@ -343,63 +343,63 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, return MESA_FORMAT_SRGBA_DXT5; case GL_ALPHA16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_ALPHA32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_LUMINANCE16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_LUMINANCE_ALPHA16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_LUMINANCE_ALPHA32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_INTENSITY16F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_INTENSITY32F_ARB: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); break; case GL_RGB16F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); break; case GL_RGB32F_ARB: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_FLOAT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16); @@ -415,26 +415,26 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_RGB9_E5: /* GL_EXT_texture_shared_exponent -- just one format to support */ - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]); - return MESA_FORMAT_RGB9_E5_FLOAT; + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R9G9B9E5_FLOAT]); + return MESA_FORMAT_R9G9B9E5_FLOAT; case GL_R11F_G11F_B10F: /* GL_EXT_texture_packed_float -- just one format to support */ - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]); - return MESA_FORMAT_R11_G11_B10_FLOAT; + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11G11B10_FLOAT]); + return MESA_FORMAT_R11G11B10_FLOAT; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8); - RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24); + RETURN_IF_SUPPORTED(MESA_FORMAT_S8_UINT_Z24_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_UNORM_X8_UINT); break; case GL_DEPTH_COMPONENT32F: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT]); - return MESA_FORMAT_Z32_FLOAT; + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32]); + return MESA_FORMAT_Z_FLOAT32; case GL_DEPTH32F_STENCIL8: - ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_X24S8]); - return MESA_FORMAT_Z32_FLOAT_X24S8; + ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT]); + return MESA_FORMAT_Z32_FLOAT_S8X24_UINT; case GL_DUDV_ATI: case GL_DU8DV8_ATI: @@ -443,250 +443,250 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, case GL_RED_SNORM: case GL_R8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SNORM8); break; case GL_RG_SNORM: case GL_RG8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8_SNORM); break; case GL_RGB_SNORM: case GL_RGB8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SNORM); /* FALLTHROUGH */ case GL_RGBA_SNORM: case GL_RGBA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_ALPHA_SNORM: case GL_ALPHA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_SNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_LUMINANCE_SNORM: case GL_LUMINANCE8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_X8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_LUMINANCE_ALPHA_SNORM: case GL_LUMINANCE8_ALPHA8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_INTENSITY_SNORM: case GL_INTENSITY8_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_SNORM8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_R16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SNORM16); break; case GL_RG16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616); + RETURN_IF_SUPPORTED(MESA_FORMAT_R16G16_SNORM); break; case GL_RGB16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SNORM16); /* FALLTHROUGH */ case GL_RGBA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_ALPHA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_LUMINANCE16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SNORM16); /* FALLTHROUGH */ case GL_LUMINANCE16_ALPHA16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_INTENSITY16_SNORM: - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888); - RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SNORM16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8B8A8_SNORM); break; case GL_SRGB_EXT: case GL_SRGB8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_COMPRESSED_SLUMINANCE_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SL8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L8A8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_COMPRESSED_SRGB_EXT: if (ctx->Mesa_DXTn) RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1); - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_BGR_SRGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_COMPRESSED_SRGB_ALPHA_EXT: if (ctx->Mesa_DXTn) RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */ - RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8); - RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A8B8G8R8_SRGB); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_SRGB); break; case GL_ALPHA8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_ALPHA16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_ALPHA32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_ALPHA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_ALPHA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_ALPHA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_A_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_LUMINANCE8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_LUMINANCE16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_LUMINANCE32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_LUMINANCE8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_LUMINANCE16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_LUMINANCE32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_L_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_LUMINANCE_ALPHA8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_LUMINANCE_ALPHA16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_LUMINANCE_ALPHA32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_LUMINANCE_ALPHA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_LUMINANCE_ALPHA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_LUMINANCE_ALPHA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_LA_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_INTENSITY8UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_INTENSITY16UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_INTENSITY32UI_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_UINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_INTENSITY8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_INTENSITY16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_INTENSITY32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_I_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_RGB8UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT8); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); break; case GL_RGB16UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT16); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16); break; case GL_RGB32UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_UINT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_UINT32); RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_RGB8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT8); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR8888_SINT); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_RGB16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT16); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR16161616_SINT); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_RGB32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_INT32); - RETURN_IF_SUPPORTED(MESA_FORMAT_XBGR32323232_SINT); - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBX_SINT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_RGBA8UI_EXT: RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8); @@ -698,43 +698,43 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32); break; case GL_RGBA8I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT8); break; case GL_RGBA16I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT16); break; case GL_RGBA32I_EXT: - RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_SINT32); break; case GL_R8: case GL_RED: - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM8); break; case GL_COMPRESSED_RED: if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) - RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1); - RETURN_IF_SUPPORTED(MESA_FORMAT_R8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_RGTC1_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM8); break; case GL_R16: - RETURN_IF_SUPPORTED(MESA_FORMAT_R16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_UNORM16); break; case GL_RG: case GL_RG8: - RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8_UNORM); break; case GL_COMPRESSED_RG: if (target != GL_TEXTURE_1D && target != GL_TEXTURE_1D_ARRAY) - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2); - RETURN_IF_SUPPORTED(MESA_FORMAT_GR88); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2_UNORM); + RETURN_IF_SUPPORTED(MESA_FORMAT_R8G8_UNORM); break; case GL_RG16: - RETURN_IF_SUPPORTED(MESA_FORMAT_GR1616); + RETURN_IF_SUPPORTED(MESA_FORMAT_R16G16_UNORM); break; case GL_R16F: @@ -785,31 +785,31 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_RG_UINT32); break; case GL_R8I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SINT8); break; case GL_RG8I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT8); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_SINT8); break; case GL_R16I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SINT16); break; case GL_RG16I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT16); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_SINT16); break; case GL_R32I: - RETURN_IF_SUPPORTED(MESA_FORMAT_R_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_R_SINT32); break; case GL_RG32I: - RETURN_IF_SUPPORTED(MESA_FORMAT_RG_INT32); + RETURN_IF_SUPPORTED(MESA_FORMAT_RG_SINT32); break; case GL_RGB10_A2UI: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010_UINT); - RETURN_IF_SUPPORTED(MESA_FORMAT_ABGR2101010_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_B10G10R10A2_UINT); + RETURN_IF_SUPPORTED(MESA_FORMAT_R10G10B10A2_UINT); break; case GL_BGRA: - RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888); + RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; } diff --git a/mesalib/src/mesa/main/texformat.h b/mesalib/src/mesa/main/texformat.h index 88ad4d1a7..32e209997 100644 --- a/mesalib/src/mesa/main/texformat.h +++ b/mesalib/src/mesa/main/texformat.h @@ -31,7 +31,7 @@ struct gl_context; -extern gl_format +extern mesa_format _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type); diff --git a/mesalib/src/mesa/main/texgetimage.c b/mesalib/src/mesa/main/texgetimage.c index 200d29c2f..133fa5376 100644 --- a/mesalib/src/mesa/main/texgetimage.c +++ b/mesalib/src/mesa/main/texgetimage.c @@ -225,7 +225,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions, GLbitfield transferOps) { /* don't want to apply sRGB -> RGB conversion here so override the format */ - const gl_format texFormat = + const mesa_format texFormat = _mesa_get_srgb_format_linear(texImage->TexFormat); const GLenum baseFormat = _mesa_get_format_base_format(texFormat); const GLenum destBaseFormat = _mesa_base_tex_format(ctx, format); @@ -360,7 +360,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, GLbitfield transferOps) { /* don't want to apply sRGB -> RGB conversion here so override the format */ - const gl_format texFormat = + const mesa_format texFormat = _mesa_get_srgb_format_linear(texImage->TexFormat); const GLuint width = texImage->Width; GLenum destBaseFormat = _mesa_base_pack_format(format); diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 8aac54e9d..4d635fe7f 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -689,8 +689,8 @@ _mesa_is_proxy_texture(GLenum target) /** * Return the proxy target which corresponds to the given texture target */ -GLenum -_mesa_get_proxy_target(GLenum target) +static GLenum +proxy_target(GLenum target) { switch (target) { case GL_TEXTURE_1D: @@ -730,27 +730,21 @@ _mesa_get_proxy_target(GLenum target) case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY: return GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY; default: - _mesa_problem(NULL, "unexpected target in _mesa_get_proxy_target()"); + _mesa_problem(NULL, "unexpected target in proxy_target()"); return 0; } } /** - * Get the texture object that corresponds to the target of the given - * texture unit. The target should have already been checked for validity. - * - * \param ctx GL context. - * \param texUnit texture unit. - * \param target texture target. - * - * \return pointer to the texture object on success, or NULL on failure. + * Return a pointer to the current texture object for the given target + * on the current texture unit. + * Note: all <target> error checking should have been done by this point. */ struct gl_texture_object * -_mesa_select_tex_object(struct gl_context *ctx, - const struct gl_texture_unit *texUnit, - GLenum target) +_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target) { + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); const GLboolean arrayTex = ctx->Extensions.EXT_texture_array; switch (target) { @@ -818,22 +812,12 @@ _mesa_select_tex_object(struct gl_context *ctx, return ctx->Extensions.ARB_texture_multisample ? ctx->Texture.ProxyTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX] : NULL; default: - _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); + _mesa_problem(NULL, "bad target in _mesa_get_current_tex_object()"); return NULL; } } -/** - * Return pointer to texture object for given target on current texture unit. - */ -struct gl_texture_object * -_mesa_get_current_tex_object(struct gl_context *ctx, GLenum target) -{ - struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); - return _mesa_select_tex_object(ctx, texUnit, target); -} - /** * Get a texture image pointer from a texture object, given a texture @@ -1325,7 +1309,7 @@ _mesa_init_teximage_fields(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, - gl_format format) + mesa_format format) { GLenum target; ASSERT(img); @@ -1568,7 +1552,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, return GL_FALSE; if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; - if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers) + if (depth < 0 || depth > ctx->Const.MaxArrayTextureLayers) return GL_FALSE; if (!ctx->Extensions.ARB_texture_non_power_of_two) { if (width > 0 && !_mesa_is_pow_two(width - 2 * border)) @@ -1585,7 +1569,7 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, return GL_FALSE; if (height < 2 * border || height > 2 * border + maxSize) return GL_FALSE; - if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers || depth % 6) + if (depth < 0 || depth > ctx->Const.MaxArrayTextureLayers || depth % 6) return GL_FALSE; if (width != height) return GL_FALSE; @@ -1748,7 +1732,7 @@ error_check_subtexture_dimensions(struct gl_context *ctx, */ GLboolean _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, - gl_format format, + mesa_format format, GLint width, GLint height, GLint depth, GLint border) { /* We just check if the image size is less than MaxTextureMbytes. @@ -1957,10 +1941,79 @@ static GLuint compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, GLenum glformat) { - gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat); + mesa_format mesaFormat = _mesa_glenum_to_compressed_format(glformat); return _mesa_format_image_size(mesaFormat, width, height, depth); } +/** + * Verify that a texture format is valid with a particular target + * + * In particular, textures with base format of \c GL_DEPTH_COMPONENT or + * \c GL_DEPTH_STENCIL are only valid with certain, context dependent texture + * targets. + * + * \param ctx GL context + * \param target Texture target + * \param internalFormat Internal format of the texture image + * \param dimensions Dimensionality at the caller. This is \b not used + * in the validation. It is only used when logging + * error messages. + * \param caller Base name of the calling function (e.g., + * "glTexImage" or "glTexStorage"). + * + * \returns true if the combination is legal, false otherwise. + */ +bool +_mesa_legal_texture_base_format_for_target(struct gl_context *ctx, + GLenum target, GLenum internalFormat, + unsigned dimensions, + const char *caller) +{ + if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT + || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) { + /* Section 3.8.3 (Texture Image Specification) of the OpenGL 3.3 Core + * Profile spec says: + * + * "Textures with a base internal format of DEPTH_COMPONENT or + * DEPTH_STENCIL are supported by texture image specification + * commands only if target is TEXTURE_1D, TEXTURE_2D, + * TEXTURE_1D_ARRAY, TEXTURE_2D_ARRAY, TEXTURE_RECTANGLE, + * TEXTURE_CUBE_MAP, PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, + * PROXY_TEXTURE_1D_ARRAY, PROXY_TEXTURE_2D_ARRAY, + * PROXY_TEXTURE_RECTANGLE, or PROXY_TEXTURE_CUBE_MAP. Using these + * formats in conjunction with any other target will result in an + * INVALID_OPERATION error." + * + * Cubemaps are only supported with desktop OpenGL version >= 3.0, + * EXT_gpu_shader4, or, on OpenGL ES 2.0+, OES_depth_texture_cube_map. + */ + if (target != GL_TEXTURE_1D && + target != GL_PROXY_TEXTURE_1D && + target != GL_TEXTURE_2D && + target != GL_PROXY_TEXTURE_2D && + target != GL_TEXTURE_1D_ARRAY && + target != GL_PROXY_TEXTURE_1D_ARRAY && + target != GL_TEXTURE_2D_ARRAY && + target != GL_PROXY_TEXTURE_2D_ARRAY && + target != GL_TEXTURE_RECTANGLE_ARB && + target != GL_PROXY_TEXTURE_RECTANGLE_ARB && + !((_mesa_is_cube_face(target) || + target == GL_TEXTURE_CUBE_MAP || + target == GL_PROXY_TEXTURE_CUBE_MAP) && + (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4 + || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) && + !((target == GL_TEXTURE_CUBE_MAP_ARRAY || + target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) && + ctx->Extensions.ARB_texture_cube_map_array)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s%dD(bad target for depth texture)", + caller, dimensions); + return false; + } + } + + return true; +} /** * Test the glTexImage[123]D() parameters for errors. @@ -2131,32 +2184,9 @@ texture_error_check( struct gl_context *ctx, } /* additional checks for depth textures */ - if (_mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_COMPONENT - || _mesa_base_tex_format(ctx, internalFormat) == GL_DEPTH_STENCIL) { - /* Only 1D, 2D, rect, array and cube textures supported, not 3D - * Cubemaps are only supported for GL version > 3.0 or with EXT_gpu_shader4 */ - if (target != GL_TEXTURE_1D && - target != GL_PROXY_TEXTURE_1D && - target != GL_TEXTURE_2D && - target != GL_PROXY_TEXTURE_2D && - target != GL_TEXTURE_1D_ARRAY && - target != GL_PROXY_TEXTURE_1D_ARRAY && - target != GL_TEXTURE_2D_ARRAY && - target != GL_PROXY_TEXTURE_2D_ARRAY && - target != GL_TEXTURE_RECTANGLE_ARB && - target != GL_PROXY_TEXTURE_RECTANGLE_ARB && - !((_mesa_is_cube_face(target) || target == GL_PROXY_TEXTURE_CUBE_MAP) && - (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4 - || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) && - !((target == GL_TEXTURE_CUBE_MAP_ARRAY || - target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) && - ctx->Extensions.ARB_texture_cube_map_array)) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glTexImage%dD(bad target for depth texture)", - dimensions); - return GL_TRUE; - } - } + if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalFormat, + dimensions, "glTexImage")) + return GL_TRUE; /* additional checks for compressed textures */ if (_mesa_is_compressed_format(ctx, internalFormat)) { @@ -2918,13 +2948,13 @@ override_internal_format(GLenum internalFormat, GLint width, GLint height) * for efficient texture memory layout/allocation. In particular, this * comes up during automatic mipmap generation. */ -gl_format +mesa_format _mesa_choose_texture_format(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, GLint level, GLenum internalFormat, GLenum format, GLenum type) { - gl_format f; + mesa_format f; /* see if we've already chosen a format for the previous level */ if (level > 0) { @@ -3046,7 +3076,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, struct gl_pixelstore_attrib unpack_no_border; const struct gl_pixelstore_attrib *unpack = &ctx->Unpack; struct gl_texture_object *texObj; - gl_format texFormat; + mesa_format texFormat; GLboolean dimensionsOK, sizeOK; FLUSH_VERTICES(ctx, 0); @@ -3137,7 +3167,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, height, depth, border); /* check that the texture won't take too much memory, etc */ - sizeOK = ctx->Driver.TestProxyTexImage(ctx, _mesa_get_proxy_target(target), + sizeOK = ctx->Driver.TestProxyTexImage(ctx, proxy_target(target), level, texFormat, width, height, depth, border); @@ -3412,7 +3442,9 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, check_gen_mipmap(ctx, target, texObj, level); - ctx->NewState |= _NEW_TEXTURE; + /* NOTE: Don't signal _NEW_TEXTURE since we've only changed + * the texel data, not the texture format, size, etc. + */ } } _mesa_unlock_texture(ctx, texObj); @@ -3470,7 +3502,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, * from. This depends on whether the texture contains color or depth values. */ static struct gl_renderbuffer * -get_copy_tex_image_source(struct gl_context *ctx, gl_format texFormat) +get_copy_tex_image_source(struct gl_context *ctx, mesa_format texFormat) { if (_mesa_get_format_bits(texFormat, GL_DEPTH_BITS) > 0) { /* reading from depth/stencil buffer */ @@ -3524,7 +3556,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint face = _mesa_tex_target_to_face(target); - gl_format texFormat; + mesa_format texFormat; FLUSH_VERTICES(ctx, 0); @@ -3556,7 +3588,7 @@ copyteximage(struct gl_context *ctx, GLuint dims, internalFormat, GL_NONE, GL_NONE); assert(texFormat != MESA_FORMAT_NONE); - if (!ctx->Driver.TestProxyTexImage(ctx, _mesa_get_proxy_target(target), + if (!ctx->Driver.TestProxyTexImage(ctx, proxy_target(target), level, texFormat, width, height, 1, border)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, @@ -3699,7 +3731,9 @@ copytexsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level, check_gen_mipmap(ctx, target, texObj, level); - ctx->NewState |= _NEW_TEXTURE; + /* NOTE: Don't signal _NEW_TEXTURE since we've only changed + * the texel data, not the texture format, size, etc. + */ } } _mesa_unlock_texture(ctx, texObj); @@ -3924,7 +3958,9 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, check_gen_mipmap(ctx, target, texObj, level); - ctx->NewState |= _NEW_TEXTURE; + /* NOTE: Don't signal _NEW_TEXTURE since we've only changed + * the texel data, not the texture format, size, etc. + */ } } _mesa_unlock_texture(ctx, texObj); @@ -3962,91 +3998,91 @@ _mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, width, height, depth, format, imageSize, data); } -static gl_format +static mesa_format get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) { if (ctx->API != API_OPENGL_CORE) { switch (internalFormat) { case GL_ALPHA8: - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; case GL_ALPHA16: - return MESA_FORMAT_A16; + return MESA_FORMAT_A_UNORM16; case GL_ALPHA16F_ARB: - return MESA_FORMAT_ALPHA_FLOAT16; + return MESA_FORMAT_A_FLOAT16; case GL_ALPHA32F_ARB: - return MESA_FORMAT_ALPHA_FLOAT32; + return MESA_FORMAT_A_FLOAT32; case GL_ALPHA8I_EXT: - return MESA_FORMAT_ALPHA_INT8; + return MESA_FORMAT_A_SINT8; case GL_ALPHA16I_EXT: - return MESA_FORMAT_ALPHA_INT16; + return MESA_FORMAT_A_SINT16; case GL_ALPHA32I_EXT: - return MESA_FORMAT_ALPHA_INT32; + return MESA_FORMAT_A_SINT32; case GL_ALPHA8UI_EXT: - return MESA_FORMAT_ALPHA_UINT8; + return MESA_FORMAT_A_UINT8; case GL_ALPHA16UI_EXT: - return MESA_FORMAT_ALPHA_UINT16; + return MESA_FORMAT_A_UINT16; case GL_ALPHA32UI_EXT: - return MESA_FORMAT_ALPHA_UINT32; + return MESA_FORMAT_A_UINT32; case GL_LUMINANCE8: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case GL_LUMINANCE16: - return MESA_FORMAT_L16; + return MESA_FORMAT_L_UNORM16; case GL_LUMINANCE16F_ARB: - return MESA_FORMAT_LUMINANCE_FLOAT16; + return MESA_FORMAT_L_FLOAT16; case GL_LUMINANCE32F_ARB: - return MESA_FORMAT_LUMINANCE_FLOAT32; + return MESA_FORMAT_L_FLOAT32; case GL_LUMINANCE8I_EXT: - return MESA_FORMAT_LUMINANCE_INT8; + return MESA_FORMAT_L_SINT8; case GL_LUMINANCE16I_EXT: - return MESA_FORMAT_LUMINANCE_INT16; + return MESA_FORMAT_L_SINT16; case GL_LUMINANCE32I_EXT: - return MESA_FORMAT_LUMINANCE_INT32; + return MESA_FORMAT_L_SINT32; case GL_LUMINANCE8UI_EXT: - return MESA_FORMAT_LUMINANCE_UINT8; + return MESA_FORMAT_L_UINT8; case GL_LUMINANCE16UI_EXT: - return MESA_FORMAT_LUMINANCE_UINT16; + return MESA_FORMAT_L_UINT16; case GL_LUMINANCE32UI_EXT: - return MESA_FORMAT_LUMINANCE_UINT32; + return MESA_FORMAT_L_UINT32; case GL_LUMINANCE8_ALPHA8: - return MESA_FORMAT_AL88; + return MESA_FORMAT_L8A8_UNORM; case GL_LUMINANCE16_ALPHA16: - return MESA_FORMAT_AL1616; + return MESA_FORMAT_L16A16_UNORM; case GL_LUMINANCE_ALPHA16F_ARB: - return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; + return MESA_FORMAT_LA_FLOAT16; case GL_LUMINANCE_ALPHA32F_ARB: - return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; + return MESA_FORMAT_LA_FLOAT32; case GL_LUMINANCE_ALPHA8I_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT8; + return MESA_FORMAT_LA_SINT8; case GL_LUMINANCE_ALPHA16I_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT8; + return MESA_FORMAT_LA_SINT8; case GL_LUMINANCE_ALPHA32I_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT16; + return MESA_FORMAT_LA_SINT16; case GL_LUMINANCE_ALPHA8UI_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT8; + return MESA_FORMAT_LA_UINT8; case GL_LUMINANCE_ALPHA16UI_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT16; + return MESA_FORMAT_LA_UINT16; case GL_LUMINANCE_ALPHA32UI_EXT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT32; + return MESA_FORMAT_LA_UINT32; case GL_INTENSITY8: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case GL_INTENSITY16: - return MESA_FORMAT_I16; + return MESA_FORMAT_I_UNORM16; case GL_INTENSITY16F_ARB: - return MESA_FORMAT_INTENSITY_FLOAT16; + return MESA_FORMAT_I_FLOAT16; case GL_INTENSITY32F_ARB: - return MESA_FORMAT_INTENSITY_FLOAT32; + return MESA_FORMAT_I_FLOAT32; case GL_INTENSITY8I_EXT: - return MESA_FORMAT_INTENSITY_INT8; + return MESA_FORMAT_I_SINT8; case GL_INTENSITY16I_EXT: - return MESA_FORMAT_INTENSITY_INT16; + return MESA_FORMAT_I_SINT16; case GL_INTENSITY32I_EXT: - return MESA_FORMAT_INTENSITY_INT32; + return MESA_FORMAT_I_SINT32; case GL_INTENSITY8UI_EXT: - return MESA_FORMAT_INTENSITY_UINT8; + return MESA_FORMAT_I_UINT8; case GL_INTENSITY16UI_EXT: - return MESA_FORMAT_INTENSITY_UINT16; + return MESA_FORMAT_I_UINT16; case GL_INTENSITY32UI_EXT: - return MESA_FORMAT_INTENSITY_UINT32; + return MESA_FORMAT_I_UINT32; default: break; } @@ -4060,7 +4096,7 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) case GL_RGB32UI: return MESA_FORMAT_RGB_UINT32; case GL_RGB32I: - return MESA_FORMAT_RGB_INT32; + return MESA_FORMAT_RGB_SINT32; default: break; } @@ -4068,19 +4104,19 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) switch (internalFormat) { case GL_RGBA8: - return MESA_FORMAT_RGBA8888_REV; + return MESA_FORMAT_R8G8B8A8_UNORM; case GL_RGBA16: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case GL_RGBA16F_ARB: return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: return MESA_FORMAT_RGBA_FLOAT32; case GL_RGBA8I_EXT: - return MESA_FORMAT_RGBA_INT8; + return MESA_FORMAT_RGBA_SINT8; case GL_RGBA16I_EXT: - return MESA_FORMAT_RGBA_INT16; + return MESA_FORMAT_RGBA_SINT16; case GL_RGBA32I_EXT: - return MESA_FORMAT_RGBA_INT32; + return MESA_FORMAT_RGBA_SINT32; case GL_RGBA8UI_EXT: return MESA_FORMAT_RGBA_UINT8; case GL_RGBA16UI_EXT: @@ -4089,19 +4125,19 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) return MESA_FORMAT_RGBA_UINT32; case GL_RG8: - return MESA_FORMAT_GR88; + return MESA_FORMAT_R8G8_UNORM; case GL_RG16: - return MESA_FORMAT_GR1616; + return MESA_FORMAT_R16G16_UNORM; case GL_RG16F: return MESA_FORMAT_RG_FLOAT16; case GL_RG32F: return MESA_FORMAT_RG_FLOAT32; case GL_RG8I: - return MESA_FORMAT_RG_INT8; + return MESA_FORMAT_RG_SINT8; case GL_RG16I: - return MESA_FORMAT_RG_INT16; + return MESA_FORMAT_RG_SINT16; case GL_RG32I: - return MESA_FORMAT_RG_INT32; + return MESA_FORMAT_RG_SINT32; case GL_RG8UI: return MESA_FORMAT_RG_UINT8; case GL_RG16UI: @@ -4110,19 +4146,19 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) return MESA_FORMAT_RG_UINT32; case GL_R8: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case GL_R16: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case GL_R16F: return MESA_FORMAT_R_FLOAT16; case GL_R32F: return MESA_FORMAT_R_FLOAT32; case GL_R8I: - return MESA_FORMAT_R_INT8; + return MESA_FORMAT_R_SINT8; case GL_R16I: - return MESA_FORMAT_R_INT16; + return MESA_FORMAT_R_SINT16; case GL_R32I: - return MESA_FORMAT_R_INT32; + return MESA_FORMAT_R_SINT32; case GL_R8UI: return MESA_FORMAT_R_UINT8; case GL_R16UI: @@ -4136,11 +4172,11 @@ get_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) } -gl_format +mesa_format _mesa_validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat) { - gl_format format = get_texbuffer_format(ctx, internalFormat); + mesa_format format = get_texbuffer_format(ctx, internalFormat); GLenum datatype; if (format == MESA_FORMAT_NONE) @@ -4174,7 +4210,7 @@ texbufferrange(struct gl_context *ctx, GLenum target, GLenum internalFormat, GLintptr offset, GLsizeiptr size) { struct gl_texture_object *texObj; - gl_format format; + mesa_format format; FLUSH_VERTICES(ctx, 0); @@ -4311,7 +4347,7 @@ teximagemultisample(GLuint dims, GLenum target, GLsizei samples, struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLboolean sizeOK, dimensionsOK; - gl_format texFormat; + mesa_format texFormat; GLenum sample_count_error; GET_CURRENT_CONTEXT(ctx); diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index 80a0a57b5..5f8a47776 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -66,9 +66,6 @@ _mesa_base_tex_format( struct gl_context *ctx, GLint internalFormat ); extern GLboolean _mesa_is_proxy_texture(GLenum target); -extern GLenum -_mesa_get_proxy_target(GLenum target); - extern struct gl_texture_image * _mesa_new_texture_image( struct gl_context *ctx ); @@ -83,10 +80,10 @@ _mesa_init_teximage_fields(struct gl_context *ctx, struct gl_texture_image *img, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum internalFormat, - gl_format format); + mesa_format format); -extern gl_format +extern mesa_format _mesa_choose_texture_format(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, GLint level, @@ -103,11 +100,6 @@ _mesa_clear_texture_image(struct gl_context *ctx, extern struct gl_texture_object * -_mesa_select_tex_object(struct gl_context *ctx, - const struct gl_texture_unit *texUnit, - GLenum target); - -extern struct gl_texture_object * _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target); @@ -128,7 +120,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target); extern GLboolean _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level, - gl_format format, + mesa_format format, GLint width, GLint height, GLint depth, GLint border); @@ -153,10 +145,18 @@ _mesa_legal_texture_dimensions(struct gl_context *ctx, GLenum target, GLint level, GLint width, GLint height, GLint depth, GLint border); -extern gl_format +extern mesa_format _mesa_validate_texbuffer_format(const struct gl_context *ctx, GLenum internalFormat); + +bool +_mesa_legal_texture_base_format_for_target(struct gl_context *ctx, + GLenum target, + GLenum internalFormat, + unsigned dimensions, + const char *caller); + /** * Lock a texture for updating. See also _mesa_lock_context_textures(). */ diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 5d516c55f..6adc0ae84 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -156,7 +156,7 @@ _mesa_initialize_texture_object( struct gl_context *ctx, obj->_Swizzle = SWIZZLE_NOOP; obj->Sampler.sRGBDecode = GL_DECODE_EXT; obj->BufferObjectFormat = GL_R8; - obj->_BufferObjectFormat = MESA_FORMAT_R8; + obj->_BufferObjectFormat = MESA_FORMAT_R_UNORM8; obj->ImageFormatCompatibilityType = GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE; } @@ -189,12 +189,12 @@ finish_texture_init(struct gl_context *ctx, GLenum target, if (ctx->Driver.TexParameter) { static const GLfloat fparam_wrap[1] = {(GLfloat) GL_CLAMP_TO_EDGE}; const GLfloat fparam_filter[1] = {(GLfloat) filter}; - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_S, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_T, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, GL_TEXTURE_WRAP_R, fparam_wrap); - ctx->Driver.TexParameter(ctx, target, obj, + ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_S, fparam_wrap); + ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_T, fparam_wrap); + ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_R, fparam_wrap); + ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MIN_FILTER, fparam_filter); - ctx->Driver.TexParameter(ctx, target, obj, + ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MAG_FILTER, fparam_filter); } break; @@ -745,7 +745,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) GLubyte texel[4]; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - gl_format texFormat; + mesa_format texFormat; GLuint dims, face, numFaces = 1; GLenum target; @@ -1198,8 +1198,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) * Note that proxy targets are not valid here. * \return TEXTURE_x_INDEX or -1 if target is invalid */ -static GLint -target_enum_to_index(const struct gl_context *ctx, GLenum target) +int +_mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target) { switch (target) { case GL_TEXTURE_1D: @@ -1270,7 +1270,7 @@ _mesa_BindTexture( GLenum target, GLuint texName ) _mesa_debug(ctx, "glBindTexture %s %d\n", _mesa_lookup_enum_by_nr(target), (GLint) texName); - targetIndex = target_enum_to_index(ctx, target); + targetIndex = _mesa_tex_target_to_index(ctx, target); if (targetIndex < 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindTexture(target)"); return; diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h index 55091a642..a4573b399 100644 --- a/mesalib/src/mesa/main/texobj.h +++ b/mesalib/src/mesa/main/texobj.h @@ -54,6 +54,9 @@ _mesa_initialize_texture_object( struct gl_context *ctx, struct gl_texture_object *obj, GLuint name, GLenum target ); +extern int +_mesa_tex_target_to_index(const struct gl_context *ctx, GLenum target); + extern void _mesa_delete_texture_object( struct gl_context *ctx, struct gl_texture_object *obj ); diff --git a/mesalib/src/mesa/main/texparam.c b/mesalib/src/mesa/main/texparam.c index 7c59d119f..b7ed50dd5 100644 --- a/mesalib/src/mesa/main/texparam.c +++ b/mesalib/src/mesa/main/texparam.c @@ -118,14 +118,15 @@ validate_texture_wrap_mode(struct gl_context * ctx, GLenum target, GLenum wrap) /** * Get current texture object for given target. * Return NULL if any error (and record the error). - * Note that this is different from _mesa_select_tex_object() in that proxy - * targets are not accepted. + * Note that this is different from _mesa_get_current_tex_object() in that + * proxy targets are not accepted. * Only the glGetTexLevelParameter() functions accept proxy targets. */ static struct gl_texture_object * get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) { struct gl_texture_unit *texUnit; + int targetIndex; if (ctx->Texture.CurrentUnit >= ctx->Const.MaxCombinedTextureImageUnits) { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -135,66 +136,15 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) texUnit = _mesa_get_current_tex_unit(ctx); - switch (target) { - case GL_TEXTURE_1D: - if (_mesa_is_desktop_gl(ctx)) - return texUnit->CurrentTex[TEXTURE_1D_INDEX]; - break; - case GL_TEXTURE_2D: - return texUnit->CurrentTex[TEXTURE_2D_INDEX]; - case GL_TEXTURE_3D: - if (ctx->API != API_OPENGLES) - return texUnit->CurrentTex[TEXTURE_3D_INDEX]; - break; - case GL_TEXTURE_CUBE_MAP: - if (ctx->Extensions.ARB_texture_cube_map) { - return texUnit->CurrentTex[TEXTURE_CUBE_INDEX]; - } - break; - case GL_TEXTURE_RECTANGLE_NV: - if (_mesa_is_desktop_gl(ctx) - && ctx->Extensions.NV_texture_rectangle) { - return texUnit->CurrentTex[TEXTURE_RECT_INDEX]; - } - break; - case GL_TEXTURE_1D_ARRAY_EXT: - if (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array) { - return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_2D_ARRAY_EXT: - if ((_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) - && ctx->Extensions.EXT_texture_array) { - return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_EXTERNAL_OES: - if (_mesa_is_gles(ctx) && ctx->Extensions.OES_EGL_image_external) { - return texUnit->CurrentTex[TEXTURE_EXTERNAL_INDEX]; - } - break; - case GL_TEXTURE_CUBE_MAP_ARRAY: - if (ctx->Extensions.ARB_texture_cube_map_array) { - return texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX]; - } - break; - case GL_TEXTURE_2D_MULTISAMPLE: - if (ctx->Extensions.ARB_texture_multisample) { - return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_INDEX]; - } - break; - case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: - if (ctx->Extensions.ARB_texture_multisample) { - return texUnit->CurrentTex[TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX]; - } - break; - default: - ; + targetIndex = _mesa_tex_target_to_index(ctx, target); + if (targetIndex < 0 || targetIndex == TEXTURE_BUFFER_INDEX) { + _mesa_error(ctx, GL_INVALID_ENUM, + "gl%sTexParameter(target)", get ? "Get" : ""); + return NULL; } + assert(targetIndex < NUM_TEXTURE_TARGETS); - _mesa_error(ctx, GL_INVALID_ENUM, - "gl%sTexParameter(target)", get ? "Get" : ""); - return NULL; + return texUnit->CurrentTex[targetIndex]; } @@ -784,7 +734,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) } if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, target, texObj, pname, ¶m); + ctx->Driver.TexParameter(ctx, texObj, pname, ¶m); } } @@ -855,7 +805,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) } if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, target, texObj, pname, params); + ctx->Driver.TexParameter(ctx, texObj, pname, params); } } @@ -898,7 +848,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) if (ctx->Driver.TexParameter && need_update) { GLfloat fparam = (GLfloat) param; - ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam); + ctx->Driver.TexParameter(ctx, texObj, pname, &fparam); } } @@ -954,7 +904,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) fparams[2] = INT_TO_FLOAT(params[2]); fparams[3] = INT_TO_FLOAT(params[3]); } - ctx->Driver.TexParameter(ctx, target, texObj, pname, fparams); + ctx->Driver.TexParameter(ctx, texObj, pname, fparams); } } @@ -1081,7 +1031,7 @@ get_tex_level_parameter_image(struct gl_context *ctx, GLenum pname, GLint *params) { const struct gl_texture_image *img = NULL; - gl_format texFormat; + mesa_format texFormat; img = _mesa_select_tex_image(ctx, texObj, target, level); if (!img || img->TexFormat == MESA_FORMAT_NONE) { @@ -1169,7 +1119,7 @@ get_tex_level_parameter_image(struct gl_context *ctx, if (ctx->Version < 30 && !ctx->Extensions.EXT_texture_shared_exponent) goto invalid_pname; - *params = texFormat == MESA_FORMAT_RGB9_E5_FLOAT ? 5 : 0; + *params = texFormat == MESA_FORMAT_R9G9B9E5_FLOAT ? 5 : 0; break; /* GL_ARB_texture_compression */ @@ -1237,7 +1187,7 @@ get_tex_level_parameter_buffer(struct gl_context *ctx, GLenum pname, GLint *params) { const struct gl_buffer_object *bo = texObj->BufferObject; - gl_format texFormat = texObj->_BufferObjectFormat; + mesa_format texFormat = texObj->_BufferObjectFormat; GLenum internalFormat = texObj->BufferObjectFormat; GLenum baseFormat = _mesa_get_format_base_format(texFormat); @@ -1356,7 +1306,6 @@ void GLAPIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level, GLenum pname, GLint *params ) { - const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; GLint maxLevels; GET_CURRENT_CONTEXT(ctx); @@ -1367,8 +1316,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - if (!legal_get_tex_level_parameter_target(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target=0x%x)", target); @@ -1383,7 +1330,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); if (target == GL_TEXTURE_BUFFER) get_tex_level_parameter_buffer(ctx, texObj, pname, params); diff --git a/mesalib/src/mesa/main/texstorage.c b/mesalib/src/mesa/main/texstorage.c index 22208572f..86c8f3c92 100644 --- a/mesalib/src/mesa/main/texstorage.c +++ b/mesalib/src/mesa/main/texstorage.c @@ -120,7 +120,7 @@ initialize_texture_fields(struct gl_context *ctx, struct gl_texture_object *texObj, GLint levels, GLsizei width, GLsizei height, GLsizei depth, - GLenum internalFormat, gl_format texFormat) + GLenum internalFormat, mesa_format texFormat) { const GLenum target = texObj->Target; const GLuint numFaces = _mesa_num_tex_faces(target); @@ -151,9 +151,8 @@ initialize_texture_fields(struct gl_context *ctx, /** - * Clear all fields of texture object to zeros. Used for proxy texture tests. - * Used for proxy texture tests (and to clean up when a texture memory - * allocation fails). + * Clear all fields of texture object to zeros. Used for proxy texture tests + * and to clean up when a texture memory allocation fails. */ static void clear_texture_fields(struct gl_context *ctx, @@ -332,6 +331,11 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, return GL_TRUE; } + /* additional checks for depth textures */ + if (!_mesa_legal_texture_base_format_for_target(ctx, target, internalformat, + dims, "glTexStorage")) + return GL_TRUE; + return GL_FALSE; } @@ -345,7 +349,7 @@ texstorage(GLuint dims, GLenum target, GLsizei levels, GLenum internalformat, { struct gl_texture_object *texObj; GLboolean sizeOK, dimensionsOK; - gl_format texFormat; + mesa_format texFormat; GET_CURRENT_CONTEXT(ctx); diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 8eaf43a6a..1e4308a04 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -923,7 +923,7 @@ _mesa_swizzle_ubyte_image(struct gl_context *ctx, static void memcpy_texture(struct gl_context *ctx, GLuint dimensions, - gl_format dstFormat, + mesa_format dstFormat, GLint dstRowStride, GLubyte **dstSlices, GLint srcWidth, GLint srcHeight, GLint srcDepth, @@ -1012,11 +1012,11 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffffff; GLenum dstType; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z32 || - dstFormat == MESA_FORMAT_Z32_FLOAT); + ASSERT(dstFormat == MESA_FORMAT_Z_UNORM32 || + dstFormat == MESA_FORMAT_Z_FLOAT32); ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLuint)); - if (dstFormat == MESA_FORMAT_Z32) + if (dstFormat == MESA_FORMAT_Z_UNORM32) dstType = GL_UNSIGNED_INT; else dstType = GL_FLOAT; @@ -1049,7 +1049,7 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_X8_Z24); + ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_S8_UINT); { /* general path */ @@ -1079,7 +1079,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z24_X8); + ASSERT(dstFormat == MESA_FORMAT_X8Z24_UNORM); { /* general path */ @@ -1112,7 +1112,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_Z16); + ASSERT(dstFormat == MESA_FORMAT_Z_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == sizeof(GLushort)); { @@ -1141,8 +1141,8 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_RGB565 || - dstFormat == MESA_FORMAT_RGB565_REV); + ASSERT(dstFormat == MESA_FORMAT_B5G6R5_UNORM || + dstFormat == MESA_FORMAT_R5G6B5_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && @@ -1163,7 +1163,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) const GLubyte *srcUB = (const GLubyte *) src; GLushort *dstUS = (GLushort *) dst; /* check for byteswapped format */ - if (dstFormat == MESA_FORMAT_RGB565) { + if (dstFormat == MESA_FORMAT_B5G6R5_UNORM) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] ); srcUB += 3; @@ -1190,17 +1190,17 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) /** - * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV. + * Store a texture in MESA_FORMAT_A8B8G8R8_UNORM or MESA_FORMAT_R8G8B8A8_UNORM. */ static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - ASSERT(dstFormat == MESA_FORMAT_RGBA8888 || - dstFormat == MESA_FORMAT_RGBA8888_REV || - dstFormat == MESA_FORMAT_RGBX8888 || - dstFormat == MESA_FORMAT_RGBX8888_REV); + ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_UNORM || + dstFormat == MESA_FORMAT_R8G8B8A8_UNORM || + dstFormat == MESA_FORMAT_X8B8G8R8_UNORM || + dstFormat == MESA_FORMAT_R8G8B8X8_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && @@ -1214,10 +1214,10 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && (dstFormat == MESA_FORMAT_RGBA8888 || - dstFormat == MESA_FORMAT_RGBX8888)) || - (!littleEndian && (dstFormat == MESA_FORMAT_RGBA8888_REV || - dstFormat == MESA_FORMAT_RGBX8888_REV))) { + if ((littleEndian && (dstFormat == MESA_FORMAT_A8B8G8R8_UNORM || + dstFormat == MESA_FORMAT_X8B8G8R8_UNORM)) || + (!littleEndian && (dstFormat == MESA_FORMAT_R8G8B8A8_UNORM || + dstFormat == MESA_FORMAT_R8G8B8X8_UNORM))) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -1254,16 +1254,16 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || - dstFormat == MESA_FORMAT_ARGB8888_REV || - dstFormat == MESA_FORMAT_XRGB8888 || - dstFormat == MESA_FORMAT_XRGB8888_REV ); + ASSERT(dstFormat == MESA_FORMAT_B8G8R8A8_UNORM || + dstFormat == MESA_FORMAT_A8R8G8B8_UNORM || + dstFormat == MESA_FORMAT_B8G8R8X8_UNORM || + dstFormat == MESA_FORMAT_X8R8G8B8_UNORM ); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - (dstFormat == MESA_FORMAT_ARGB8888 || - dstFormat == MESA_FORMAT_XRGB8888) && + (dstFormat == MESA_FORMAT_B8G8R8A8_UNORM || + dstFormat == MESA_FORMAT_B8G8R8X8_UNORM) && srcFormat == GL_RGB && (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) && @@ -1290,7 +1290,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_ARGB8888 && + dstFormat == MESA_FORMAT_B8G8R8A8_UNORM && srcFormat == GL_LUMINANCE_ALPHA && baseInternalFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { @@ -1316,7 +1316,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_ARGB8888 && + dstFormat == MESA_FORMAT_B8G8R8A8_UNORM && srcFormat == GL_RGBA && baseInternalFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { @@ -1358,20 +1358,20 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || - (littleEndian && dstFormat == MESA_FORMAT_XRGB8888) || - (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || - (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV)) { + if ((littleEndian && dstFormat == MESA_FORMAT_B8G8R8A8_UNORM) || + (littleEndian && dstFormat == MESA_FORMAT_B8G8R8X8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_A8R8G8B8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_X8R8G8B8_UNORM)) { dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ dstmap[1] = 1; /* green */ dstmap[0] = 2; /* blue */ } else { - assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || - (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || - (littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV) || - (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888)); + assert((littleEndian && dstFormat == MESA_FORMAT_A8R8G8B8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_B8G8R8A8_UNORM) || + (littleEndian && dstFormat == MESA_FORMAT_X8R8G8B8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_B8G8R8X8_UNORM)); dstmap[3] = 2; dstmap[2] = 1; dstmap[1] = 0; @@ -1401,7 +1401,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_RGB888); + ASSERT(dstFormat == MESA_FORMAT_BGR_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && @@ -1463,7 +1463,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_BGR888); + ASSERT(dstFormat == MESA_FORMAT_RGB_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); if (!ctx->_ImageTransferState && @@ -1525,8 +1525,8 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb2101010(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_ARGB2101010 || - dstFormat == MESA_FORMAT_XRGB2101010_UNORM); + ASSERT(dstFormat == MESA_FORMAT_B10G10R10A2_UNORM || + dstFormat == MESA_FORMAT_B10G10R10X2_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -1579,7 +1579,7 @@ _mesa_texstore_unorm44(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_AL44); + ASSERT(dstFormat == MESA_FORMAT_L4A4_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 1); { @@ -1622,10 +1622,10 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) const GLboolean littleEndian = _mesa_little_endian(); const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_AL88 || - dstFormat == MESA_FORMAT_AL88_REV || - dstFormat == MESA_FORMAT_GR88 || - dstFormat == MESA_FORMAT_RG88); + ASSERT(dstFormat == MESA_FORMAT_L8A8_UNORM || + dstFormat == MESA_FORMAT_A8L8_UNORM || + dstFormat == MESA_FORMAT_R8G8_UNORM || + dstFormat == MESA_FORMAT_G8R8_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); if (!ctx->_ImageTransferState && @@ -1637,9 +1637,9 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == MESA_FORMAT_AL88 || dstFormat == MESA_FORMAT_AL88_REV) { - if ((littleEndian && dstFormat == MESA_FORMAT_AL88) || - (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) { + if (dstFormat == MESA_FORMAT_L8A8_UNORM || dstFormat == MESA_FORMAT_A8L8_UNORM) { + if ((littleEndian && dstFormat == MESA_FORMAT_L8A8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_A8L8_UNORM)) { dstmap[0] = 0; dstmap[1] = 3; } @@ -1649,8 +1649,8 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) } } else { - if ((littleEndian && dstFormat == MESA_FORMAT_GR88) || - (!littleEndian && dstFormat == MESA_FORMAT_RG88)) { + if ((littleEndian && dstFormat == MESA_FORMAT_R8G8_UNORM) || + (!littleEndian && dstFormat == MESA_FORMAT_G8R8_UNORM)) { dstmap[0] = 0; dstmap[1] = 1; } @@ -1687,8 +1687,8 @@ _mesa_texstore_unorm88(TEXSTORE_PARAMS) GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == MESA_FORMAT_AL88 || - dstFormat == MESA_FORMAT_GR88) { + if (dstFormat == MESA_FORMAT_L8A8_UNORM || + dstFormat == MESA_FORMAT_R8G8_UNORM) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance (or R), src[1] is alpha (or G) */ dstUS[col] = PACK_COLOR_88( src[1], @@ -1721,10 +1721,10 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_AL1616 || - dstFormat == MESA_FORMAT_AL1616_REV || - dstFormat == MESA_FORMAT_GR1616 || - dstFormat == MESA_FORMAT_RG1616); + ASSERT(dstFormat == MESA_FORMAT_L16A16_UNORM || + dstFormat == MESA_FORMAT_A16L16_UNORM || + dstFormat == MESA_FORMAT_R16G16_UNORM || + dstFormat == MESA_FORMAT_G16R16_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -1744,8 +1744,8 @@ _mesa_texstore_unorm1616(TEXSTORE_PARAMS) GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == MESA_FORMAT_AL1616 || - dstFormat == MESA_FORMAT_GR1616) { + if (dstFormat == MESA_FORMAT_L16A16_UNORM || + dstFormat == MESA_FORMAT_R16G16_UNORM) { for (col = 0; col < srcWidth; col++) { GLushort l, a; @@ -1780,10 +1780,10 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_R16 || - dstFormat == MESA_FORMAT_A16 || - dstFormat == MESA_FORMAT_L16 || - dstFormat == MESA_FORMAT_I16); + ASSERT(dstFormat == MESA_FORMAT_R_UNORM16 || + dstFormat == MESA_FORMAT_A_UNORM16 || + dstFormat == MESA_FORMAT_L_UNORM16 || + dstFormat == MESA_FORMAT_I_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); { @@ -1822,8 +1822,8 @@ _mesa_texstore_unorm16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_16(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_RGBA_16 || - dstFormat == MESA_FORMAT_XBGR16161616_UNORM); + ASSERT(dstFormat == MESA_FORMAT_RGBA_UNORM16 || + dstFormat == MESA_FORMAT_RGBX_UNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == 8); { @@ -1874,9 +1874,9 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGB_16 || - dstFormat == MESA_FORMAT_SIGNED_RGBA_16 || - dstFormat == MESA_FORMAT_XBGR16161616_SNORM); + ASSERT(dstFormat == MESA_FORMAT_RGB_SNORM16 || + dstFormat == MESA_FORMAT_RGBA_SNORM16 || + dstFormat == MESA_FORMAT_RGBX_SNORM16); { /* general path */ @@ -1901,7 +1901,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) GLubyte *dstRow = dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLshort *dstRowS = (GLshort *) dstRow; - if (dstFormat == MESA_FORMAT_SIGNED_RGBA_16) { + if (dstFormat == MESA_FORMAT_RGBA_SNORM16) { for (col = 0; col < srcWidth; col++) { GLuint c; for (c = 0; c < comps; c++) { @@ -1913,7 +1913,7 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) dstRow += dstRowStride; src += 4 * srcWidth; } - else if (dstFormat == MESA_FORMAT_XBGR16161616_SNORM) { + else if (dstFormat == MESA_FORMAT_RGBX_SNORM16) { for (col = 0; col < srcWidth; col++) { GLuint c; @@ -1955,10 +1955,10 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_A8 || - dstFormat == MESA_FORMAT_L8 || - dstFormat == MESA_FORMAT_I8 || - dstFormat == MESA_FORMAT_R8); + ASSERT(dstFormat == MESA_FORMAT_A_UNORM8 || + dstFormat == MESA_FORMAT_L_UNORM8 || + dstFormat == MESA_FORMAT_I_UNORM8 || + dstFormat == MESA_FORMAT_R_UNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 1); if (!ctx->_ImageTransferState && @@ -1969,7 +1969,7 @@ _mesa_texstore_unorm8(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == MESA_FORMAT_A8) { + if (dstFormat == MESA_FORMAT_A_UNORM8) { dstmap[0] = 3; } else { @@ -2147,10 +2147,10 @@ _mesa_texstore_snorm8(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_A8 || - dstFormat == MESA_FORMAT_SIGNED_L8 || - dstFormat == MESA_FORMAT_SIGNED_I8 || - dstFormat == MESA_FORMAT_SIGNED_R8); + ASSERT(dstFormat == MESA_FORMAT_A_SNORM8 || + dstFormat == MESA_FORMAT_L_SNORM8 || + dstFormat == MESA_FORMAT_I_SNORM8 || + dstFormat == MESA_FORMAT_R_SNORM8); ASSERT(_mesa_get_format_bytes(dstFormat) == 1); { @@ -2190,9 +2190,9 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL88 || - dstFormat == MESA_FORMAT_SIGNED_RG88 || - dstFormat == MESA_FORMAT_SIGNED_RG88_REV); + ASSERT(dstFormat == MESA_FORMAT_L8A8_SNORM || + dstFormat == MESA_FORMAT_G8R8_SNORM || + dstFormat == MESA_FORMAT_R8G8_SNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); { @@ -2213,8 +2213,8 @@ _mesa_texstore_snorm88(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLushort *dst = (GLushort *) dstRow; - if (dstFormat == MESA_FORMAT_SIGNED_AL88 || - dstFormat == MESA_FORMAT_SIGNED_RG88_REV) { + if (dstFormat == MESA_FORMAT_L8A8_SNORM || + dstFormat == MESA_FORMAT_R8G8_SNORM) { for (col = 0; col < srcWidth; col++) { GLubyte l = FLOAT_TO_BYTE_TEX(src[0]); GLubyte a = FLOAT_TO_BYTE_TEX(src[1]); @@ -2246,10 +2246,10 @@ _mesa_texstore_snorm16(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_R16 || - dstFormat == MESA_FORMAT_SIGNED_A16 || - dstFormat == MESA_FORMAT_SIGNED_L16 || - dstFormat == MESA_FORMAT_SIGNED_I16); + ASSERT(dstFormat == MESA_FORMAT_R_SNORM16 || + dstFormat == MESA_FORMAT_A_SNORM16 || + dstFormat == MESA_FORMAT_L_SNORM16 || + dstFormat == MESA_FORMAT_I_SNORM16); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); { @@ -2292,9 +2292,9 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_AL1616 || - dstFormat == MESA_FORMAT_SIGNED_RG1616 || - dstFormat == MESA_FORMAT_SIGNED_GR1616); + ASSERT(dstFormat == MESA_FORMAT_LA_SNORM16 || + dstFormat == MESA_FORMAT_G16R16_SNORM || + dstFormat == MESA_FORMAT_R16G16_SNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -2315,8 +2315,8 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLuint *dst = (GLuint *) dstRow; - if (dstFormat == MESA_FORMAT_SIGNED_AL1616 || - dstFormat == MESA_FORMAT_SIGNED_GR1616) { + if (dstFormat == MESA_FORMAT_LA_SNORM16 || + dstFormat == MESA_FORMAT_R16G16_SNORM) { for (col = 0; col < srcWidth; col++) { GLushort l, a; @@ -2345,16 +2345,16 @@ _mesa_texstore_snorm1616(TEXSTORE_PARAMS) } /** - * Store a texture in MESA_FORMAT_SIGNED_RGBX8888 or - * MESA_FORMAT_XBGR8888_SNORM. + * Store a texture in MESA_FORMAT_X8B8G8R8_SNORM or + * MESA_FORMAT_R8G8B8X8_SNORM. */ static GLboolean _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBX8888 || - dstFormat == MESA_FORMAT_XBGR8888_SNORM); + ASSERT(dstFormat == MESA_FORMAT_X8B8G8R8_SNORM || + dstFormat == MESA_FORMAT_R8G8B8X8_SNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -2374,7 +2374,7 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; - if (dstFormat == MESA_FORMAT_SIGNED_RGBX8888) { + if (dstFormat == MESA_FORMAT_X8B8G8R8_SNORM) { for (col = 0; col < srcWidth; col++) { dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]); @@ -2405,16 +2405,16 @@ _mesa_texstore_signed_rgbx8888(TEXSTORE_PARAMS) /** - * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or - * MESA_FORMAT_SIGNED_RGBA8888_REV + * Store a texture in MESA_FORMAT_A8B8G8R8_SNORM or + * MESA_FORMAT_R8G8B8A8_SNORM */ static GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 || - dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV); + ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SNORM || + dstFormat == MESA_FORMAT_R8G8B8A8_SNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -2434,7 +2434,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) GLbyte *dstRow = (GLbyte *) dstSlices[img]; for (row = 0; row < srcHeight; row++) { GLbyte *dst = dstRow; - if (dstFormat == MESA_FORMAT_SIGNED_RGBA8888) { + if (dstFormat == MESA_FORMAT_A8B8G8R8_SNORM) { for (col = 0; col < srcWidth; col++) { dst[3] = FLOAT_TO_BYTE_TEX(srcRow[RCOMP]); dst[2] = FLOAT_TO_BYTE_TEX(srcRow[GCOMP]); @@ -2474,7 +2474,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLint img, row; - ASSERT(dstFormat == MESA_FORMAT_Z24_S8); + ASSERT(dstFormat == MESA_FORMAT_S8_UINT_Z24_UNORM); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); @@ -2558,7 +2558,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) GLuint *depth; GLubyte *stencil; - ASSERT(dstFormat == MESA_FORMAT_S8_Z24); + ASSERT(dstFormat == MESA_FORMAT_Z24_UNORM_X8_UINT); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); @@ -2634,7 +2634,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_s8(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_S8); + ASSERT(dstFormat == MESA_FORMAT_S_UINT8); ASSERT(srcFormat == GL_STENCIL_INDEX); { @@ -2694,20 +2694,20 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in _mesa_make_temp_float_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_FLOAT) { + if (dstFormat == MESA_FORMAT_RGBX_FLOAT32) { baseFormat = GL_RGBA; components = 4; } ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 || dstFormat == MESA_FORMAT_RGB_FLOAT32 || - dstFormat == MESA_FORMAT_ALPHA_FLOAT32 || - dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 || - dstFormat == MESA_FORMAT_INTENSITY_FLOAT32 || + dstFormat == MESA_FORMAT_A_FLOAT32 || + dstFormat == MESA_FORMAT_L_FLOAT32 || + dstFormat == MESA_FORMAT_LA_FLOAT32 || + dstFormat == MESA_FORMAT_I_FLOAT32 || dstFormat == MESA_FORMAT_R_FLOAT32 || dstFormat == MESA_FORMAT_RG_FLOAT32 || - dstFormat == MESA_FORMAT_XBGR32323232_FLOAT); + dstFormat == MESA_FORMAT_RGBX_FLOAT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2759,20 +2759,20 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in _mesa_make_temp_float_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_FLOAT) { + if (dstFormat == MESA_FORMAT_RGBX_FLOAT16) { baseFormat = GL_RGBA; components = 4; } ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 || dstFormat == MESA_FORMAT_RGB_FLOAT16 || - dstFormat == MESA_FORMAT_ALPHA_FLOAT16 || - dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 || - dstFormat == MESA_FORMAT_INTENSITY_FLOAT16 || + dstFormat == MESA_FORMAT_A_FLOAT16 || + dstFormat == MESA_FORMAT_L_FLOAT16 || + dstFormat == MESA_FORMAT_LA_FLOAT16 || + dstFormat == MESA_FORMAT_I_FLOAT16 || dstFormat == MESA_FORMAT_R_FLOAT16 || dstFormat == MESA_FORMAT_RG_FLOAT16 || - dstFormat == MESA_FORMAT_XBGR16161616_FLOAT); + dstFormat == MESA_FORMAT_RGBX_FLOAT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2823,20 +2823,20 @@ _mesa_texstore_rgba_int8(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR8888_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT8) { baseFormat = GL_RGBA; components = 4; } - ASSERT(dstFormat == MESA_FORMAT_R_INT8 || - dstFormat == MESA_FORMAT_RG_INT8 || - dstFormat == MESA_FORMAT_RGB_INT8 || - dstFormat == MESA_FORMAT_RGBA_INT8 || - dstFormat == MESA_FORMAT_ALPHA_INT8 || - dstFormat == MESA_FORMAT_INTENSITY_INT8 || - dstFormat == MESA_FORMAT_LUMINANCE_INT8 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT8 || - dstFormat == MESA_FORMAT_XBGR8888_SINT); + ASSERT(dstFormat == MESA_FORMAT_R_SINT8 || + dstFormat == MESA_FORMAT_RG_SINT8 || + dstFormat == MESA_FORMAT_RGB_SINT8 || + dstFormat == MESA_FORMAT_RGBA_SINT8 || + dstFormat == MESA_FORMAT_A_SINT8 || + dstFormat == MESA_FORMAT_I_SINT8 || + dstFormat == MESA_FORMAT_L_SINT8 || + dstFormat == MESA_FORMAT_LA_SINT8 || + dstFormat == MESA_FORMAT_RGBX_SINT8); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -2894,20 +2894,20 @@ _mesa_texstore_rgba_int16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT16) { baseFormat = GL_RGBA; components = 4; } - ASSERT(dstFormat == MESA_FORMAT_R_INT16 || - dstFormat == MESA_FORMAT_RG_INT16 || - dstFormat == MESA_FORMAT_RGB_INT16 || - dstFormat == MESA_FORMAT_RGBA_INT16 || - dstFormat == MESA_FORMAT_ALPHA_INT16 || - dstFormat == MESA_FORMAT_LUMINANCE_INT16 || - dstFormat == MESA_FORMAT_INTENSITY_INT16 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT16 || - dstFormat == MESA_FORMAT_XBGR16161616_SINT); + ASSERT(dstFormat == MESA_FORMAT_R_SINT16 || + dstFormat == MESA_FORMAT_RG_SINT16 || + dstFormat == MESA_FORMAT_RGB_SINT16 || + dstFormat == MESA_FORMAT_RGBA_SINT16 || + dstFormat == MESA_FORMAT_A_SINT16 || + dstFormat == MESA_FORMAT_L_SINT16 || + dstFormat == MESA_FORMAT_I_SINT16 || + dstFormat == MESA_FORMAT_LA_SINT16 || + dstFormat == MESA_FORMAT_RGBX_SINT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -2965,20 +2965,20 @@ _mesa_texstore_rgba_int32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_SINT) { + if (dstFormat == MESA_FORMAT_RGBX_SINT32) { baseFormat = GL_RGBA; components = 4; } - ASSERT(dstFormat == MESA_FORMAT_R_INT32 || - dstFormat == MESA_FORMAT_RG_INT32 || - dstFormat == MESA_FORMAT_RGB_INT32 || - dstFormat == MESA_FORMAT_RGBA_INT32 || - dstFormat == MESA_FORMAT_ALPHA_INT32 || - dstFormat == MESA_FORMAT_INTENSITY_INT32 || - dstFormat == MESA_FORMAT_LUMINANCE_INT32 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_INT32 || - dstFormat == MESA_FORMAT_XBGR32323232_SINT); + ASSERT(dstFormat == MESA_FORMAT_R_SINT32 || + dstFormat == MESA_FORMAT_RG_SINT32 || + dstFormat == MESA_FORMAT_RGB_SINT32 || + dstFormat == MESA_FORMAT_RGBA_SINT32 || + dstFormat == MESA_FORMAT_A_SINT32 || + dstFormat == MESA_FORMAT_I_SINT32 || + dstFormat == MESA_FORMAT_L_SINT32 || + dstFormat == MESA_FORMAT_LA_SINT32 || + dstFormat == MESA_FORMAT_RGBX_SINT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3036,7 +3036,7 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR8888_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT8) { baseFormat = GL_RGBA; components = 4; } @@ -3045,11 +3045,11 @@ _mesa_texstore_rgba_uint8(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_RG_UINT8 || dstFormat == MESA_FORMAT_RGB_UINT8 || dstFormat == MESA_FORMAT_RGBA_UINT8 || - dstFormat == MESA_FORMAT_ALPHA_UINT8 || - dstFormat == MESA_FORMAT_INTENSITY_UINT8 || - dstFormat == MESA_FORMAT_LUMINANCE_UINT8 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT8 || - dstFormat == MESA_FORMAT_XBGR8888_UINT); + dstFormat == MESA_FORMAT_A_UINT8 || + dstFormat == MESA_FORMAT_I_UINT8 || + dstFormat == MESA_FORMAT_L_UINT8 || + dstFormat == MESA_FORMAT_LA_UINT8 || + dstFormat == MESA_FORMAT_RGBX_UINT8); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3104,7 +3104,7 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR16161616_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT16) { baseFormat = GL_RGBA; components = 4; } @@ -3113,11 +3113,11 @@ _mesa_texstore_rgba_uint16(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_RG_UINT16 || dstFormat == MESA_FORMAT_RGB_UINT16 || dstFormat == MESA_FORMAT_RGBA_UINT16 || - dstFormat == MESA_FORMAT_ALPHA_UINT16 || - dstFormat == MESA_FORMAT_INTENSITY_UINT16 || - dstFormat == MESA_FORMAT_LUMINANCE_UINT16 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT16 || - dstFormat == MESA_FORMAT_XBGR16161616_UINT); + dstFormat == MESA_FORMAT_A_UINT16 || + dstFormat == MESA_FORMAT_I_UINT16 || + dstFormat == MESA_FORMAT_L_UINT16 || + dstFormat == MESA_FORMAT_LA_UINT16 || + dstFormat == MESA_FORMAT_RGBX_UINT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3172,7 +3172,7 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) GLint components = _mesa_components_in_format(baseFormat); /* this forces alpha to 1 in make_temp_uint_image */ - if (dstFormat == MESA_FORMAT_XBGR32323232_UINT) { + if (dstFormat == MESA_FORMAT_RGBX_UINT32) { baseFormat = GL_RGBA; components = 4; } @@ -3181,11 +3181,11 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) dstFormat == MESA_FORMAT_RG_UINT32 || dstFormat == MESA_FORMAT_RGB_UINT32 || dstFormat == MESA_FORMAT_RGBA_UINT32 || - dstFormat == MESA_FORMAT_ALPHA_UINT32 || - dstFormat == MESA_FORMAT_INTENSITY_UINT32 || - dstFormat == MESA_FORMAT_LUMINANCE_UINT32 || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_UINT32 || - dstFormat == MESA_FORMAT_XBGR32323232_UINT); + dstFormat == MESA_FORMAT_A_UINT32 || + dstFormat == MESA_FORMAT_I_UINT32 || + dstFormat == MESA_FORMAT_L_UINT32 || + dstFormat == MESA_FORMAT_LA_UINT32 || + dstFormat == MESA_FORMAT_RGBX_UINT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_RG || @@ -3235,13 +3235,13 @@ _mesa_texstore_rgba_uint32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { - gl_format newDstFormat; + mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SRGB8); + ASSERT(dstFormat == MESA_FORMAT_BGR_SRGB8); /* reuse normal rgb texstore code */ - newDstFormat = MESA_FORMAT_RGB888; + newDstFormat = MESA_FORMAT_BGR_UNORM8; k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, @@ -3256,18 +3256,18 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { - gl_format newDstFormat; + mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SRGBA8 || - dstFormat == MESA_FORMAT_XBGR8888_SRGB); + ASSERT(dstFormat == MESA_FORMAT_A8B8G8R8_SRGB || + dstFormat == MESA_FORMAT_R8G8B8X8_SRGB); /* reuse normal rgba texstore code */ - if (dstFormat == MESA_FORMAT_SRGBA8) { - newDstFormat = MESA_FORMAT_RGBA8888; + if (dstFormat == MESA_FORMAT_A8B8G8R8_SRGB) { + newDstFormat = MESA_FORMAT_A8B8G8R8_UNORM; } - else if (dstFormat == MESA_FORMAT_XBGR8888_SRGB) { - newDstFormat = MESA_FORMAT_RGBX8888_REV; + else if (dstFormat == MESA_FORMAT_R8G8B8X8_SRGB) { + newDstFormat = MESA_FORMAT_R8G8B8X8_UNORM; } else { ASSERT(0); @@ -3287,13 +3287,13 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS) { - gl_format newDstFormat; + mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SARGB8); + ASSERT(dstFormat == MESA_FORMAT_B8G8R8A8_SRGB); /* reuse normal rgba texstore code */ - newDstFormat = MESA_FORMAT_ARGB8888; + newDstFormat = MESA_FORMAT_B8G8R8A8_UNORM; k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, newDstFormat, @@ -3308,12 +3308,12 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS) { - gl_format newDstFormat; + mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SL8); + ASSERT(dstFormat == MESA_FORMAT_L_SRGB8); - newDstFormat = MESA_FORMAT_L8; + newDstFormat = MESA_FORMAT_L_UNORM8; /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_unorm8(ctx, dims, baseInternalFormat, @@ -3329,13 +3329,13 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { - gl_format newDstFormat; + mesa_format newDstFormat; GLboolean k; - ASSERT(dstFormat == MESA_FORMAT_SLA8); + ASSERT(dstFormat == MESA_FORMAT_L8A8_SRGB); /* reuse normal luminance/alpha texstore code */ - newDstFormat = MESA_FORMAT_AL88; + newDstFormat = MESA_FORMAT_L8A8_UNORM; k = _mesa_texstore_unorm88(ctx, dims, baseInternalFormat, newDstFormat, @@ -3351,7 +3351,7 @@ _mesa_texstore_rgb9_e5(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_RGB9_E5_FLOAT); + ASSERT(dstFormat == MESA_FORMAT_R9G9B9E5_FLOAT); ASSERT(baseInternalFormat == GL_RGB); { @@ -3389,7 +3389,7 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_R11_G11_B10_FLOAT); + ASSERT(dstFormat == MESA_FORMAT_R11G11B10_FLOAT); ASSERT(baseInternalFormat == GL_RGB); { @@ -3426,7 +3426,7 @@ _mesa_texstore_r11_g11_b10f(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_z32f_x24s8(TEXSTORE_PARAMS) { - ASSERT(dstFormat == MESA_FORMAT_Z32_FLOAT_X24S8); + ASSERT(dstFormat == MESA_FORMAT_Z32_FLOAT_S8X24_UINT); ASSERT(srcFormat == GL_DEPTH_STENCIL || srcFormat == GL_DEPTH_COMPONENT || srcFormat == GL_STENCIL_INDEX); @@ -3479,7 +3479,7 @@ _mesa_texstore_argb2101010_uint(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_ARGB2101010_UINT); + ASSERT(dstFormat == MESA_FORMAT_B10G10R10A2_UINT); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -3535,7 +3535,7 @@ _mesa_texstore_abgr2101010_uint(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_ABGR2101010_UINT); + ASSERT(dstFormat == MESA_FORMAT_R10G10B10A2_UINT); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -3591,7 +3591,7 @@ _mesa_texstore_abgr2101010(TEXSTORE_PARAMS) { const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_ABGR2101010); + ASSERT(dstFormat == MESA_FORMAT_R10G10B10A2_UNORM); ASSERT(_mesa_get_format_bytes(dstFormat) == 4); { @@ -3652,7 +3652,7 @@ _mesa_texstore_null(TEXSTORE_PARAMS) * Return the StoreTexImageFunc pointer to store an image in the given format. */ static StoreTexImageFunc -_mesa_get_texstore_func(gl_format format) +_mesa_get_texstore_func(mesa_format format) { static StoreTexImageFunc table[MESA_FORMAT_COUNT]; static GLboolean initialized = GL_FALSE; @@ -3660,56 +3660,56 @@ _mesa_get_texstore_func(gl_format format) if (!initialized) { table[MESA_FORMAT_NONE] = _mesa_texstore_null; - table[MESA_FORMAT_RGBA8888] = _mesa_texstore_rgba8888; - table[MESA_FORMAT_RGBA8888_REV] = _mesa_texstore_rgba8888; - table[MESA_FORMAT_ARGB8888] = _mesa_texstore_argb8888; - table[MESA_FORMAT_ARGB8888_REV] = _mesa_texstore_argb8888; - table[MESA_FORMAT_RGBX8888] = _mesa_texstore_rgba8888; - table[MESA_FORMAT_RGBX8888_REV] = _mesa_texstore_rgba8888; - table[MESA_FORMAT_XRGB8888] = _mesa_texstore_argb8888; - table[MESA_FORMAT_XRGB8888_REV] = _mesa_texstore_argb8888; - table[MESA_FORMAT_RGB888] = _mesa_texstore_rgb888; - table[MESA_FORMAT_BGR888] = _mesa_texstore_bgr888; - table[MESA_FORMAT_RGB565] = _mesa_texstore_rgb565; - table[MESA_FORMAT_RGB565_REV] = _mesa_texstore_rgb565; - table[MESA_FORMAT_ARGB4444] = store_ubyte_texture; - table[MESA_FORMAT_ARGB4444_REV] = store_ubyte_texture; - table[MESA_FORMAT_RGBA5551] = store_ubyte_texture; - table[MESA_FORMAT_ARGB1555] = store_ubyte_texture; - table[MESA_FORMAT_ARGB1555_REV] = store_ubyte_texture; - table[MESA_FORMAT_AL44] = _mesa_texstore_unorm44; - table[MESA_FORMAT_AL88] = _mesa_texstore_unorm88; - table[MESA_FORMAT_AL88_REV] = _mesa_texstore_unorm88; - table[MESA_FORMAT_AL1616] = _mesa_texstore_unorm1616; - table[MESA_FORMAT_AL1616_REV] = _mesa_texstore_unorm1616; - table[MESA_FORMAT_RGB332] = store_ubyte_texture; - table[MESA_FORMAT_A8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_A16] = _mesa_texstore_unorm16; - table[MESA_FORMAT_L8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_L16] = _mesa_texstore_unorm16; - table[MESA_FORMAT_I8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_I16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_A8B8G8R8_UNORM] = _mesa_texstore_rgba8888; + table[MESA_FORMAT_R8G8B8A8_UNORM] = _mesa_texstore_rgba8888; + table[MESA_FORMAT_B8G8R8A8_UNORM] = _mesa_texstore_argb8888; + table[MESA_FORMAT_A8R8G8B8_UNORM] = _mesa_texstore_argb8888; + table[MESA_FORMAT_X8B8G8R8_UNORM] = _mesa_texstore_rgba8888; + table[MESA_FORMAT_R8G8B8X8_UNORM] = _mesa_texstore_rgba8888; + table[MESA_FORMAT_B8G8R8X8_UNORM] = _mesa_texstore_argb8888; + table[MESA_FORMAT_X8R8G8B8_UNORM] = _mesa_texstore_argb8888; + table[MESA_FORMAT_BGR_UNORM8] = _mesa_texstore_rgb888; + table[MESA_FORMAT_RGB_UNORM8] = _mesa_texstore_bgr888; + table[MESA_FORMAT_B5G6R5_UNORM] = _mesa_texstore_rgb565; + table[MESA_FORMAT_R5G6B5_UNORM] = _mesa_texstore_rgb565; + table[MESA_FORMAT_B4G4R4A4_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_A4R4G4B4_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_A1B5G5R5_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_B5G5R5A1_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_A1R5G5B5_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_L4A4_UNORM] = _mesa_texstore_unorm44; + table[MESA_FORMAT_L8A8_UNORM] = _mesa_texstore_unorm88; + table[MESA_FORMAT_A8L8_UNORM] = _mesa_texstore_unorm88; + table[MESA_FORMAT_L16A16_UNORM] = _mesa_texstore_unorm1616; + table[MESA_FORMAT_A16L16_UNORM] = _mesa_texstore_unorm1616; + table[MESA_FORMAT_B2G3R3_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_A_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_A_UNORM16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_L_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_L_UNORM16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_I_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_I_UNORM16] = _mesa_texstore_unorm16; table[MESA_FORMAT_YCBCR] = _mesa_texstore_ycbcr; table[MESA_FORMAT_YCBCR_REV] = _mesa_texstore_ycbcr; - table[MESA_FORMAT_R8] = _mesa_texstore_unorm8; - table[MESA_FORMAT_GR88] = _mesa_texstore_unorm88; - table[MESA_FORMAT_RG88] = _mesa_texstore_unorm88; - table[MESA_FORMAT_R16] = _mesa_texstore_unorm16; - table[MESA_FORMAT_GR1616] = _mesa_texstore_unorm1616; - table[MESA_FORMAT_RG1616] = _mesa_texstore_unorm1616; - table[MESA_FORMAT_ARGB2101010] = _mesa_texstore_argb2101010; - table[MESA_FORMAT_Z24_S8] = _mesa_texstore_z24_s8; - table[MESA_FORMAT_S8_Z24] = _mesa_texstore_s8_z24; - table[MESA_FORMAT_Z16] = _mesa_texstore_z16; - table[MESA_FORMAT_X8_Z24] = _mesa_texstore_x8_z24; - table[MESA_FORMAT_Z24_X8] = _mesa_texstore_z24_x8; - table[MESA_FORMAT_Z32] = _mesa_texstore_z32; - table[MESA_FORMAT_S8] = _mesa_texstore_s8; - table[MESA_FORMAT_SRGB8] = _mesa_texstore_srgb8; - table[MESA_FORMAT_SRGBA8] = _mesa_texstore_srgba8; - table[MESA_FORMAT_SARGB8] = _mesa_texstore_sargb8; - table[MESA_FORMAT_SL8] = _mesa_texstore_sl8; - table[MESA_FORMAT_SLA8] = _mesa_texstore_sla8; + table[MESA_FORMAT_R_UNORM8] = _mesa_texstore_unorm8; + table[MESA_FORMAT_R8G8_UNORM] = _mesa_texstore_unorm88; + table[MESA_FORMAT_G8R8_UNORM] = _mesa_texstore_unorm88; + table[MESA_FORMAT_R_UNORM16] = _mesa_texstore_unorm16; + table[MESA_FORMAT_R16G16_UNORM] = _mesa_texstore_unorm1616; + table[MESA_FORMAT_G16R16_UNORM] = _mesa_texstore_unorm1616; + table[MESA_FORMAT_B10G10R10A2_UNORM] = _mesa_texstore_argb2101010; + table[MESA_FORMAT_S8_UINT_Z24_UNORM] = _mesa_texstore_z24_s8; + table[MESA_FORMAT_Z24_UNORM_X8_UINT] = _mesa_texstore_s8_z24; + table[MESA_FORMAT_Z_UNORM16] = _mesa_texstore_z16; + table[MESA_FORMAT_Z24_UNORM_S8_UINT] = _mesa_texstore_x8_z24; + table[MESA_FORMAT_X8Z24_UNORM] = _mesa_texstore_z24_x8; + table[MESA_FORMAT_Z_UNORM32] = _mesa_texstore_z32; + table[MESA_FORMAT_S_UINT8] = _mesa_texstore_s8; + table[MESA_FORMAT_BGR_SRGB8] = _mesa_texstore_srgb8; + table[MESA_FORMAT_A8B8G8R8_SRGB] = _mesa_texstore_srgba8; + table[MESA_FORMAT_B8G8R8A8_SRGB] = _mesa_texstore_sargb8; + table[MESA_FORMAT_L_SRGB8] = _mesa_texstore_sl8; + table[MESA_FORMAT_L8A8_SRGB] = _mesa_texstore_sla8; table[MESA_FORMAT_SRGB_DXT1] = _mesa_texstore_rgb_dxt1; table[MESA_FORMAT_SRGBA_DXT1] = _mesa_texstore_rgba_dxt1; table[MESA_FORMAT_SRGBA_DXT3] = _mesa_texstore_rgba_dxt3; @@ -3724,37 +3724,37 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_RGBA_FLOAT16] = _mesa_texstore_rgba_float16; table[MESA_FORMAT_RGB_FLOAT32] = _mesa_texstore_rgba_float32; table[MESA_FORMAT_RGB_FLOAT16] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_ALPHA_FLOAT32] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_ALPHA_FLOAT16] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_LUMINANCE_FLOAT32] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_LUMINANCE_FLOAT16] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_INTENSITY_FLOAT32] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_INTENSITY_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_A_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_A_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_L_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_L_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_LA_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_LA_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_I_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_I_FLOAT16] = _mesa_texstore_rgba_float16; table[MESA_FORMAT_R_FLOAT32] = _mesa_texstore_rgba_float32; table[MESA_FORMAT_R_FLOAT16] = _mesa_texstore_rgba_float16; table[MESA_FORMAT_RG_FLOAT32] = _mesa_texstore_rgba_float32; table[MESA_FORMAT_RG_FLOAT16] = _mesa_texstore_rgba_float16; table[MESA_FORMAT_DUDV8] = _mesa_texstore_dudv8; - table[MESA_FORMAT_SIGNED_R8] = _mesa_texstore_snorm8; - table[MESA_FORMAT_SIGNED_RG88_REV] = _mesa_texstore_snorm88; - table[MESA_FORMAT_SIGNED_RGBX8888] = _mesa_texstore_signed_rgbx8888; - table[MESA_FORMAT_SIGNED_RGBA8888] = _mesa_texstore_signed_rgba8888; - table[MESA_FORMAT_SIGNED_RGBA8888_REV] = _mesa_texstore_signed_rgba8888; - table[MESA_FORMAT_SIGNED_R16] = _mesa_texstore_snorm16; - table[MESA_FORMAT_SIGNED_GR1616] = _mesa_texstore_snorm1616; - table[MESA_FORMAT_SIGNED_RGB_16] = _mesa_texstore_signed_rgba_16; - table[MESA_FORMAT_SIGNED_RGBA_16] = _mesa_texstore_signed_rgba_16; - table[MESA_FORMAT_RGBA_16] = _mesa_texstore_rgba_16; - table[MESA_FORMAT_RED_RGTC1] = _mesa_texstore_red_rgtc1; - table[MESA_FORMAT_SIGNED_RED_RGTC1] = _mesa_texstore_signed_red_rgtc1; - table[MESA_FORMAT_RG_RGTC2] = _mesa_texstore_rg_rgtc2; - table[MESA_FORMAT_SIGNED_RG_RGTC2] = _mesa_texstore_signed_rg_rgtc2; - table[MESA_FORMAT_L_LATC1] = _mesa_texstore_red_rgtc1; - table[MESA_FORMAT_SIGNED_L_LATC1] = _mesa_texstore_signed_red_rgtc1; - table[MESA_FORMAT_LA_LATC2] = _mesa_texstore_rg_rgtc2; - table[MESA_FORMAT_SIGNED_LA_LATC2] = _mesa_texstore_signed_rg_rgtc2; + table[MESA_FORMAT_R_SNORM8] = _mesa_texstore_snorm8; + table[MESA_FORMAT_R8G8_SNORM] = _mesa_texstore_snorm88; + table[MESA_FORMAT_X8B8G8R8_SNORM] = _mesa_texstore_signed_rgbx8888; + table[MESA_FORMAT_A8B8G8R8_SNORM] = _mesa_texstore_signed_rgba8888; + table[MESA_FORMAT_R8G8B8A8_SNORM] = _mesa_texstore_signed_rgba8888; + table[MESA_FORMAT_R_SNORM16] = _mesa_texstore_snorm16; + table[MESA_FORMAT_R16G16_SNORM] = _mesa_texstore_snorm1616; + table[MESA_FORMAT_RGB_SNORM16] = _mesa_texstore_signed_rgba_16; + table[MESA_FORMAT_RGBA_SNORM16] = _mesa_texstore_signed_rgba_16; + table[MESA_FORMAT_RGBA_UNORM16] = _mesa_texstore_rgba_16; + table[MESA_FORMAT_R_RGTC1_UNORM] = _mesa_texstore_red_rgtc1; + table[MESA_FORMAT_R_RGTC1_SNORM] = _mesa_texstore_signed_red_rgtc1; + table[MESA_FORMAT_RG_RGTC2_UNORM] = _mesa_texstore_rg_rgtc2; + table[MESA_FORMAT_RG_RGTC2_SNORM] = _mesa_texstore_signed_rg_rgtc2; + table[MESA_FORMAT_L_LATC1_UNORM] = _mesa_texstore_red_rgtc1; + table[MESA_FORMAT_L_LATC1_SNORM] = _mesa_texstore_signed_red_rgtc1; + table[MESA_FORMAT_LA_LATC2_UNORM] = _mesa_texstore_rg_rgtc2; + table[MESA_FORMAT_LA_LATC2_SNORM] = _mesa_texstore_signed_rg_rgtc2; table[MESA_FORMAT_ETC1_RGB8] = _mesa_texstore_etc1_rgb8; table[MESA_FORMAT_ETC2_RGB8] = _mesa_texstore_etc2_rgb8; table[MESA_FORMAT_ETC2_SRGB8] = _mesa_texstore_etc2_srgb8; @@ -3768,59 +3768,59 @@ _mesa_get_texstore_func(gl_format format) _mesa_texstore_etc2_rgb8_punchthrough_alpha1; table[MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1] = _mesa_texstore_etc2_srgb8_punchthrough_alpha1; - table[MESA_FORMAT_SIGNED_A8] = _mesa_texstore_snorm8; - table[MESA_FORMAT_SIGNED_L8] = _mesa_texstore_snorm8; - table[MESA_FORMAT_SIGNED_AL88] = _mesa_texstore_snorm88; - table[MESA_FORMAT_SIGNED_I8] = _mesa_texstore_snorm8; - table[MESA_FORMAT_SIGNED_A16] = _mesa_texstore_snorm16; - table[MESA_FORMAT_SIGNED_L16] = _mesa_texstore_snorm16; - table[MESA_FORMAT_SIGNED_AL1616] = _mesa_texstore_snorm1616; - table[MESA_FORMAT_SIGNED_I16] = _mesa_texstore_snorm16; - table[MESA_FORMAT_RGB9_E5_FLOAT] = _mesa_texstore_rgb9_e5; - table[MESA_FORMAT_R11_G11_B10_FLOAT] = _mesa_texstore_r11_g11_b10f; - table[MESA_FORMAT_Z32_FLOAT] = _mesa_texstore_z32; - table[MESA_FORMAT_Z32_FLOAT_X24S8] = _mesa_texstore_z32f_x24s8; - - table[MESA_FORMAT_ALPHA_UINT8] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_ALPHA_UINT16] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_ALPHA_UINT32] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_ALPHA_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_ALPHA_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_ALPHA_INT32] = _mesa_texstore_rgba_int32; - - table[MESA_FORMAT_INTENSITY_UINT8] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_INTENSITY_UINT16] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_INTENSITY_UINT32] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_INTENSITY_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_INTENSITY_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_INTENSITY_INT32] = _mesa_texstore_rgba_int32; - - table[MESA_FORMAT_LUMINANCE_UINT8] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_LUMINANCE_UINT16] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_LUMINANCE_UINT32] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_LUMINANCE_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_LUMINANCE_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_LUMINANCE_INT32] = _mesa_texstore_rgba_int32; - - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT8] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT16] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_LUMINANCE_ALPHA_UINT32] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_LUMINANCE_ALPHA_INT32] = _mesa_texstore_rgba_int32; - - table[MESA_FORMAT_R_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_RG_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_RGB_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_RGBA_INT8] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_R_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_RG_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_RGB_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_RGBA_INT16] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_R_INT32] = _mesa_texstore_rgba_int32; - table[MESA_FORMAT_RG_INT32] = _mesa_texstore_rgba_int32; - table[MESA_FORMAT_RGB_INT32] = _mesa_texstore_rgba_int32; - table[MESA_FORMAT_RGBA_INT32] = _mesa_texstore_rgba_int32; + table[MESA_FORMAT_A_SNORM8] = _mesa_texstore_snorm8; + table[MESA_FORMAT_L_SNORM8] = _mesa_texstore_snorm8; + table[MESA_FORMAT_L8A8_SNORM] = _mesa_texstore_snorm88; + table[MESA_FORMAT_I_SNORM8] = _mesa_texstore_snorm8; + table[MESA_FORMAT_A_SNORM16] = _mesa_texstore_snorm16; + table[MESA_FORMAT_L_SNORM16] = _mesa_texstore_snorm16; + table[MESA_FORMAT_LA_SNORM16] = _mesa_texstore_snorm1616; + table[MESA_FORMAT_I_SNORM16] = _mesa_texstore_snorm16; + table[MESA_FORMAT_R9G9B9E5_FLOAT] = _mesa_texstore_rgb9_e5; + table[MESA_FORMAT_R11G11B10_FLOAT] = _mesa_texstore_r11_g11_b10f; + table[MESA_FORMAT_Z_FLOAT32] = _mesa_texstore_z32; + table[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = _mesa_texstore_z32f_x24s8; + + table[MESA_FORMAT_A_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_A_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_A_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_A_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_A_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_A_SINT32] = _mesa_texstore_rgba_int32; + + table[MESA_FORMAT_I_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_I_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_I_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_I_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_I_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_I_SINT32] = _mesa_texstore_rgba_int32; + + table[MESA_FORMAT_L_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_L_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_L_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_L_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_L_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_L_SINT32] = _mesa_texstore_rgba_int32; + + table[MESA_FORMAT_LA_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_LA_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_LA_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_LA_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_LA_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_LA_SINT32] = _mesa_texstore_rgba_int32; + + table[MESA_FORMAT_R_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_RG_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_RGB_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_RGBA_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_R_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_RG_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_RGB_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_RGBA_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_R_SINT32] = _mesa_texstore_rgba_int32; + table[MESA_FORMAT_RG_SINT32] = _mesa_texstore_rgba_int32; + table[MESA_FORMAT_RGB_SINT32] = _mesa_texstore_rgba_int32; + table[MESA_FORMAT_RGBA_SINT32] = _mesa_texstore_rgba_int32; table[MESA_FORMAT_R_UINT8] = _mesa_texstore_rgba_uint8; table[MESA_FORMAT_RG_UINT8] = _mesa_texstore_rgba_uint8; @@ -3835,29 +3835,29 @@ _mesa_get_texstore_func(gl_format format) table[MESA_FORMAT_RGB_UINT32] = _mesa_texstore_rgba_uint32; table[MESA_FORMAT_RGBA_UINT32] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_ARGB2101010_UINT] = _mesa_texstore_argb2101010_uint; - table[MESA_FORMAT_ABGR2101010_UINT] = _mesa_texstore_abgr2101010_uint; - - table[MESA_FORMAT_XRGB4444_UNORM] = store_ubyte_texture; - table[MESA_FORMAT_XRGB1555_UNORM] = store_ubyte_texture; - table[MESA_FORMAT_XBGR8888_SNORM] = _mesa_texstore_signed_rgbx8888; - table[MESA_FORMAT_XBGR8888_SRGB] = _mesa_texstore_srgba8; - table[MESA_FORMAT_XBGR8888_UINT] = _mesa_texstore_rgba_uint8; - table[MESA_FORMAT_XBGR8888_SINT] = _mesa_texstore_rgba_int8; - table[MESA_FORMAT_XRGB2101010_UNORM] = _mesa_texstore_argb2101010; - table[MESA_FORMAT_XBGR16161616_UNORM] = _mesa_texstore_rgba_16; - table[MESA_FORMAT_XBGR16161616_SNORM] = _mesa_texstore_signed_rgba_16; - table[MESA_FORMAT_XBGR16161616_FLOAT] = _mesa_texstore_rgba_float16; - table[MESA_FORMAT_XBGR16161616_UINT] = _mesa_texstore_rgba_uint16; - table[MESA_FORMAT_XBGR16161616_SINT] = _mesa_texstore_rgba_int16; - table[MESA_FORMAT_XBGR32323232_FLOAT] = _mesa_texstore_rgba_float32; - table[MESA_FORMAT_XBGR32323232_UINT] = _mesa_texstore_rgba_uint32; - table[MESA_FORMAT_XBGR32323232_SINT] = _mesa_texstore_rgba_int32; - - table[MESA_FORMAT_ABGR2101010] = _mesa_texstore_abgr2101010; - - table[MESA_FORMAT_SIGNED_RG88] = _mesa_texstore_snorm88; - table[MESA_FORMAT_SIGNED_RG1616] = _mesa_texstore_snorm1616; + table[MESA_FORMAT_B10G10R10A2_UINT] = _mesa_texstore_argb2101010_uint; + table[MESA_FORMAT_R10G10B10A2_UINT] = _mesa_texstore_abgr2101010_uint; + + table[MESA_FORMAT_B4G4R4X4_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_B5G5R5X1_UNORM] = store_ubyte_texture; + table[MESA_FORMAT_R8G8B8X8_SNORM] = _mesa_texstore_signed_rgbx8888; + table[MESA_FORMAT_R8G8B8X8_SRGB] = _mesa_texstore_srgba8; + table[MESA_FORMAT_RGBX_UINT8] = _mesa_texstore_rgba_uint8; + table[MESA_FORMAT_RGBX_SINT8] = _mesa_texstore_rgba_int8; + table[MESA_FORMAT_B10G10R10X2_UNORM] = _mesa_texstore_argb2101010; + table[MESA_FORMAT_RGBX_UNORM16] = _mesa_texstore_rgba_16; + table[MESA_FORMAT_RGBX_SNORM16] = _mesa_texstore_signed_rgba_16; + table[MESA_FORMAT_RGBX_FLOAT16] = _mesa_texstore_rgba_float16; + table[MESA_FORMAT_RGBX_UINT16] = _mesa_texstore_rgba_uint16; + table[MESA_FORMAT_RGBX_SINT16] = _mesa_texstore_rgba_int16; + table[MESA_FORMAT_RGBX_FLOAT32] = _mesa_texstore_rgba_float32; + table[MESA_FORMAT_RGBX_UINT32] = _mesa_texstore_rgba_uint32; + table[MESA_FORMAT_RGBX_SINT32] = _mesa_texstore_rgba_int32; + + table[MESA_FORMAT_R10G10B10A2_UNORM] = _mesa_texstore_abgr2101010; + + table[MESA_FORMAT_G8R8_SNORM] = _mesa_texstore_snorm88; + table[MESA_FORMAT_G16R16_SNORM] = _mesa_texstore_snorm1616; initialized = GL_TRUE; } @@ -3870,7 +3870,7 @@ _mesa_get_texstore_func(gl_format format) GLboolean _mesa_texstore_needs_transfer_ops(struct gl_context *ctx, GLenum baseInternalFormat, - gl_format dstFormat) + mesa_format dstFormat) { GLenum dstType; @@ -3899,7 +3899,7 @@ _mesa_texstore_needs_transfer_ops(struct gl_context *ctx, GLboolean _mesa_texstore_can_use_memcpy(struct gl_context *ctx, - GLenum baseInternalFormat, gl_format dstFormat, + GLenum baseInternalFormat, mesa_format dstFormat, GLenum srcFormat, GLenum srcType, const struct gl_pixelstore_attrib *srcPacking) { @@ -3977,7 +3977,7 @@ _mesa_texstore(TEXSTORE_PARAMS) * \param texFormat the destination texture format */ static GLbitfield -get_read_write_mode(GLenum userFormat, gl_format texFormat) +get_read_write_mode(GLenum userFormat, mesa_format texFormat) { if ((userFormat == GL_STENCIL_INDEX || userFormat == GL_DEPTH_COMPONENT) && _mesa_get_format_base_format(texFormat) == GL_DEPTH_STENCIL) @@ -4220,7 +4220,7 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, GLint i, rows; GLubyte *dstMap; const GLubyte *src; - const gl_format texFormat = texImage->TexFormat; + const mesa_format texFormat = texImage->TexFormat; GLuint bw, bh; GLint slice; diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index fbb3b2668..490f9f5e0 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -57,7 +57,7 @@ #define TEXSTORE_PARAMS \ struct gl_context *ctx, GLuint dims, \ GLenum baseInternalFormat, \ - gl_format dstFormat, \ + mesa_format dstFormat, \ GLint dstRowStride, \ GLubyte **dstSlices, \ GLint srcWidth, GLint srcHeight, GLint srcDepth, \ @@ -72,11 +72,11 @@ _mesa_texstore(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_needs_transfer_ops(struct gl_context *ctx, GLenum baseInternalFormat, - gl_format dstFormat); + mesa_format dstFormat); extern GLboolean _mesa_texstore_can_use_memcpy(struct gl_context *ctx, - GLenum baseInternalFormat, gl_format dstFormat, + GLenum baseInternalFormat, mesa_format dstFormat, GLenum srcFormat, GLenum srcType, const struct gl_pixelstore_attrib *srcPacking); diff --git a/mesalib/src/mesa/main/textureview.c b/mesalib/src/mesa/main/textureview.c index 5f88a4171..77a3b782b 100644 --- a/mesalib/src/mesa/main/textureview.c +++ b/mesalib/src/mesa/main/textureview.c @@ -196,7 +196,7 @@ initialize_texture_fields(struct gl_context *ctx, struct gl_texture_object *texObj, GLint levels, GLsizei width, GLsizei height, GLsizei depth, - GLenum internalFormat, gl_format texFormat) + GLenum internalFormat, mesa_format texFormat) { const GLuint numFaces = _mesa_num_tex_faces(target); GLint level, levelWidth = width, levelHeight = height, levelDepth = depth; @@ -430,7 +430,7 @@ _mesa_TextureView(GLuint texture, GLenum target, GLuint origtexture, GLuint newViewMinLevel, newViewMinLayer; GLuint newViewNumLevels, newViewNumLayers; GLsizei width, height, depth; - gl_format texFormat; + mesa_format texFormat; GLboolean sizeOK, dimensionsOK; GLenum faceTarget; diff --git a/mesalib/src/mesa/main/varray.c b/mesalib/src/mesa/main/varray.c index b73a396e2..44db2cbcd 100644 --- a/mesalib/src/mesa/main/varray.c +++ b/mesalib/src/mesa/main/varray.c @@ -112,20 +112,20 @@ static void vertex_attrib_binding(struct gl_context *ctx, GLuint attribIndex, GLuint bindingIndex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; - struct gl_vertex_attrib_array *array = &arrayObj->VertexAttrib[attribIndex]; + struct gl_vertex_array_object *vao = ctx->Array.VAO; + struct gl_vertex_attrib_array *array = &vao->VertexAttrib[attribIndex]; if (array->VertexBinding != bindingIndex) { const GLbitfield64 array_bit = VERT_BIT(attribIndex); FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexBinding[array->VertexBinding]._BoundArrays &= ~array_bit; - arrayObj->VertexBinding[bindingIndex]._BoundArrays |= array_bit; + vao->VertexBinding[array->VertexBinding]._BoundArrays &= ~array_bit; + vao->VertexBinding[bindingIndex]._BoundArrays |= array_bit; array->VertexBinding = bindingIndex; - arrayObj->NewArrays |= array_bit; + vao->NewArrays |= array_bit; } } @@ -139,8 +139,8 @@ bind_vertex_buffer(struct gl_context *ctx, GLuint index, struct gl_buffer_object *vbo, GLintptr offset, GLsizei stride) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; - struct gl_vertex_buffer_binding *binding = &arrayObj->VertexBinding[index]; + struct gl_vertex_array_object *vao = ctx->Array.VAO; + struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index]; if (binding->BufferObj != vbo || binding->Offset != offset || @@ -153,7 +153,7 @@ bind_vertex_buffer(struct gl_context *ctx, GLuint index, binding->Offset = offset; binding->Stride = stride; - arrayObj->NewArrays |= binding->_BoundArrays; + vao->NewArrays |= binding->_BoundArrays; } } @@ -166,14 +166,14 @@ static void vertex_binding_divisor(struct gl_context *ctx, GLuint bindingIndex, GLuint divisor) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; struct gl_vertex_buffer_binding *binding = - &arrayObj->VertexBinding[bindingIndex]; + &vao->VertexBinding[bindingIndex]; if (binding->InstanceDivisor != divisor) { FLUSH_VERTICES(ctx, _NEW_ARRAY); binding->InstanceDivisor = divisor; - arrayObj->NewArrays |= binding->_BoundArrays; + vao->NewArrays |= binding->_BoundArrays; } } @@ -329,7 +329,7 @@ update_array_format(struct gl_context *ctx, elementSize = _mesa_bytes_per_vertex_attrib(size, type); assert(elementSize != -1); - array = &ctx->Array.ArrayObj->VertexAttrib[attrib]; + array = &ctx->Array.VAO->VertexAttrib[attrib]; array->Size = size; array->Type = type; array->Format = format; @@ -338,7 +338,7 @@ update_array_format(struct gl_context *ctx, array->RelativeOffset = relativeOffset; array->_ElementSize = elementSize; - ctx->Array.ArrayObj->NewArrays |= VERT_BIT(attrib); + ctx->Array.VAO->NewArrays |= VERT_BIT(attrib); ctx->NewState |= _NEW_ARRAY; return true; @@ -384,7 +384,7 @@ update_array(struct gl_context *ctx, * The check for VBOs is handled below. */ if (ctx->API == API_OPENGL_CORE - && (ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj)) { + && (ctx->Array.VAO == ctx->Array.DefaultVAO)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(no array object bound)", func); return; @@ -407,7 +407,7 @@ update_array(struct gl_context *ctx, * to the ARRAY_BUFFER buffer object binding point (see section * 2.9.6), and the pointer argument is not NULL." */ - if (ptr != NULL && ctx->Array.ArrayObj->ARBsemantics && + if (ptr != NULL && ctx->Array.VAO->ARBsemantics && !_mesa_is_bufferobj(ctx->Array.ArrayBufferObj)) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-VBO array)", func); return; @@ -422,7 +422,7 @@ update_array(struct gl_context *ctx, vertex_attrib_binding(ctx, attrib, attrib); /* The Stride and Ptr fields are not set by update_array_format() */ - array = &ctx->Array.ArrayObj->VertexAttrib[attrib]; + array = &ctx->Array.VAO->VertexAttrib[attrib]; array->Stride = stride; array->Ptr = (const GLvoid *) ptr; @@ -664,7 +664,7 @@ _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type, void GLAPIENTRY _mesa_EnableVertexAttribArray(GLuint index) { - struct gl_array_object *arrayObj; + struct gl_vertex_array_object *vao; GET_CURRENT_CONTEXT(ctx); if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -673,16 +673,16 @@ _mesa_EnableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); - if (!arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { + if (!vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was disabled, now being enabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; - arrayObj->_Enabled |= VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); + vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_TRUE; + vao->_Enabled |= VERT_BIT_GENERIC(index); + vao->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -690,7 +690,7 @@ _mesa_EnableVertexAttribArray(GLuint index) void GLAPIENTRY _mesa_DisableVertexAttribArray(GLuint index) { - struct gl_array_object *arrayObj; + struct gl_vertex_array_object *vao; GET_CURRENT_CONTEXT(ctx); if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -699,16 +699,16 @@ _mesa_DisableVertexAttribArray(GLuint index) return; } - arrayObj = ctx->Array.ArrayObj; + vao = ctx->Array.VAO; - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->_VertexAttrib)); - if (arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { + if (vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled) { /* was enabled, now being disabled */ FLUSH_VERTICES(ctx, _NEW_ARRAY); - arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; - arrayObj->_Enabled &= ~VERT_BIT_GENERIC(index); - arrayObj->NewArrays |= VERT_BIT_GENERIC(index); + vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Enabled = GL_FALSE; + vao->_Enabled &= ~VERT_BIT_GENERIC(index); + vao->NewArrays |= VERT_BIT_GENERIC(index); } } @@ -722,7 +722,7 @@ static GLuint get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, const char *caller) { - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + const struct gl_vertex_array_object *vao = ctx->Array.VAO; const struct gl_vertex_attrib_array *array; if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs) { @@ -730,9 +730,9 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, return 0; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(arrayObj->VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(vao->VertexAttrib)); - array = &arrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; + array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC(index)]; switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB: @@ -746,7 +746,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB: return array->Normalized; case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB: - return arrayObj->VertexBinding[array->VertexBinding].BufferObj->Name; + return vao->VertexBinding[array->VertexBinding].BufferObj->Name; case GL_VERTEX_ATTRIB_ARRAY_INTEGER: if ((_mesa_is_desktop_gl(ctx) && (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4)) @@ -757,7 +757,7 @@ get_vertex_array_attrib(struct gl_context *ctx, GLuint index, GLenum pname, case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB: if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_instanced_arrays) || _mesa_is_gles3(ctx)) { - return arrayObj->VertexBinding[array->VertexBinding].InstanceDivisor; + return vao->VertexBinding[array->VertexBinding].InstanceDivisor; } goto error; case GL_VERTEX_ATTRIB_BINDING: @@ -801,7 +801,7 @@ get_current_attrib(struct gl_context *ctx, GLuint index, const char *function) return NULL; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); FLUSH_CURRENT(ctx, 0); return ctx->Current.Attrib[VERT_ATTRIB_GENERIC(index)]; @@ -923,9 +923,9 @@ _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer) return; } - ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.ArrayObj->_VertexAttrib)); + ASSERT(VERT_ATTRIB_GENERIC(index) < Elements(ctx->Array.VAO->_VertexAttrib)); - *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; + *pointer = (GLvoid *) ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_GENERIC(index)].Ptr; } @@ -1314,7 +1314,7 @@ _mesa_VertexAttribDivisor(GLuint index, GLuint divisor) return; } - ASSERT(genericIndex < Elements(ctx->Array.ArrayObj->VertexAttrib)); + ASSERT(genericIndex < Elements(ctx->Array.VAO->VertexAttrib)); /* The ARB_vertex_attrib_binding spec says: * @@ -1365,7 +1365,7 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, GLsizei stride) { GET_CURRENT_CONTEXT(ctx); - const struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + const struct gl_vertex_array_object *vao = ctx->Array.VAO; struct gl_buffer_object *vbo; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -1376,7 +1376,7 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexBuffer(No array object bound)"); return; @@ -1412,8 +1412,8 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset, return; } - if (buffer == arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) { - vbo = arrayObj->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj; + if (buffer == vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj->Name) { + vbo = vao->VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].BufferObj; } else if (buffer != 0) { vbo = _mesa_lookup_bufferobj(ctx, buffer); @@ -1468,7 +1468,7 @@ _mesa_VertexAttribFormat(GLuint attribIndex, GLint size, GLenum type, * - ..." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribFormat(No array object bound)"); return; @@ -1515,7 +1515,7 @@ _mesa_VertexAttribIFormat(GLuint attribIndex, GLint size, GLenum type, * - ..." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribIFormat(No array object bound)"); return; @@ -1563,7 +1563,7 @@ _mesa_VertexAttribLFormat(GLuint attribIndex, GLint size, GLenum type, * that this is an oversight. */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribLFormat(No array object bound)"); return; @@ -1603,7 +1603,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexAttribBinding(No array object bound)"); return; @@ -1633,7 +1633,7 @@ _mesa_VertexAttribBinding(GLuint attribIndex, GLuint bindingIndex) } ASSERT(VERT_ATTRIB_GENERIC(attribIndex) < - Elements(ctx->Array.ArrayObj->VertexAttrib)); + Elements(ctx->Array.VAO->VertexAttrib)); vertex_attrib_binding(ctx, VERT_ATTRIB_GENERIC(attribIndex), VERT_ATTRIB_GENERIC(bindingIndex)); @@ -1657,7 +1657,7 @@ _mesa_VertexBindingDivisor(GLuint bindingIndex, GLuint divisor) * is bound." */ if (ctx->API == API_OPENGL_CORE && - ctx->Array.ArrayObj == ctx->Array.DefaultArrayObj) { + ctx->Array.VAO == ctx->Array.DefaultVAO) { _mesa_error(ctx, GL_INVALID_OPERATION, "glVertexBindingDivisor(No array object bound)"); return; @@ -1758,25 +1758,25 @@ print_array(const char *name, GLint index, const struct gl_client_array *array) void _mesa_print_arrays(struct gl_context *ctx) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; GLuint i; - _mesa_update_array_object_max_element(ctx, arrayObj); + _mesa_update_vao_max_element(ctx, vao); - printf("Array Object %u\n", arrayObj->Name); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_POS].Enabled) - print_array("Vertex", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_POS]); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) - print_array("Normal", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_NORMAL]); - if (arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) - print_array("Color", -1, &arrayObj->_VertexAttrib[VERT_ATTRIB_COLOR0]); + printf("Array Object %u\n", vao->Name); + if (vao->_VertexAttrib[VERT_ATTRIB_POS].Enabled) + print_array("Vertex", -1, &vao->_VertexAttrib[VERT_ATTRIB_POS]); + if (vao->_VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) + print_array("Normal", -1, &vao->_VertexAttrib[VERT_ATTRIB_NORMAL]); + if (vao->_VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) + print_array("Color", -1, &vao->_VertexAttrib[VERT_ATTRIB_COLOR0]); for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) - if (arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) - print_array("TexCoord", i, &arrayObj->_VertexAttrib[VERT_ATTRIB_TEX(i)]); + if (vao->_VertexAttrib[VERT_ATTRIB_TEX(i)].Enabled) + print_array("TexCoord", i, &vao->_VertexAttrib[VERT_ATTRIB_TEX(i)]); for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) - if (arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) - print_array("Attrib", i, &arrayObj->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]); - printf(" _MaxElement = %u\n", arrayObj->_MaxElement); + if (vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)].Enabled) + print_array("Attrib", i, &vao->_VertexAttrib[VERT_ATTRIB_GENERIC(i)]); + printf(" _MaxElement = %u\n", vao->_MaxElement); } @@ -1786,9 +1786,8 @@ _mesa_print_arrays(struct gl_context *ctx) void _mesa_init_varray(struct gl_context *ctx) { - ctx->Array.DefaultArrayObj = ctx->Driver.NewArrayObject(ctx, 0); - _mesa_reference_array_object(ctx, &ctx->Array.ArrayObj, - ctx->Array.DefaultArrayObj); + ctx->Array.DefaultVAO = ctx->Driver.NewArrayObject(ctx, 0); + _mesa_reference_vao(ctx, &ctx->Array.VAO, ctx->Array.DefaultVAO); ctx->Array.ActiveTexture = 0; /* GL_ARB_multitexture */ ctx->Array.Objects = _mesa_NewHashTable(); @@ -1801,9 +1800,9 @@ _mesa_init_varray(struct gl_context *ctx) static void delete_arrayobj_cb(GLuint id, void *data, void *userData) { - struct gl_array_object *arrayObj = (struct gl_array_object *) data; + struct gl_vertex_array_object *vao = (struct gl_vertex_array_object *) data; struct gl_context *ctx = (struct gl_context *) userData; - _mesa_delete_array_object(ctx, arrayObj); + _mesa_delete_vao(ctx, vao); } diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index 02ba01eca..4a5c1c1fb 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -1021,6 +1021,9 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) case MESA_SHADER_GEOMETRY: type = "geom"; break; + case MESA_SHADER_COMPUTE: + type = "comp"; + break; } _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index ea8eb0d3a..fa80bc58c 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -279,6 +279,21 @@ _mesa_init_vertex_program( struct gl_context *ctx, struct gl_vertex_program *pro /** + * Initialize a new compute program object. + */ +struct gl_program * +_mesa_init_compute_program(struct gl_context *ctx, + struct gl_compute_program *prog, GLenum target, + GLuint id) +{ + if (prog) + return _mesa_init_program_struct( ctx, &prog->Base, target, id ); + else + return NULL; +} + + +/** * Initialize a new geometry program object. */ struct gl_program * @@ -324,6 +339,11 @@ _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id) CALLOC_STRUCT(gl_geometry_program), target, id); break; + case GL_COMPUTE_PROGRAM_NV: + prog = _mesa_init_compute_program(ctx, + CALLOC_STRUCT(gl_compute_program), + target, id); + break; default: _mesa_problem(ctx, "bad target in _mesa_new_program"); prog = NULL; diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h index 71b0a4af2..ef698242f 100644 --- a/mesalib/src/mesa/program/program.h +++ b/mesalib/src/mesa/program/program.h @@ -84,6 +84,11 @@ _mesa_init_geometry_program(struct gl_context *ctx, GLenum target, GLuint id); extern struct gl_program * +_mesa_init_compute_program(struct gl_context *ctx, + struct gl_compute_program *prog, + GLenum target, GLuint id); + +extern struct gl_program * _mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id); extern void @@ -202,6 +207,8 @@ _mesa_program_enum_to_shader_stage(GLenum v) return MESA_SHADER_FRAGMENT; case GL_GEOMETRY_PROGRAM_NV: return MESA_SHADER_GEOMETRY; + case GL_COMPUTE_PROGRAM_NV: + return MESA_SHADER_COMPUTE; default: ASSERT(0); return ~0; @@ -219,6 +226,8 @@ _mesa_shader_stage_to_program(unsigned stage) return GL_FRAGMENT_PROGRAM_ARB; case MESA_SHADER_GEOMETRY: return GL_GEOMETRY_PROGRAM_NV; + case MESA_SHADER_COMPUTE: + return GL_COMPUTE_PROGRAM_NV; } assert(!"Unexpected shader stage in _mesa_shader_stage_to_program"); diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c index ac8d0798a..c8f088dc8 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -229,7 +229,8 @@ st_bufferobj_data(struct gl_context *ctx, case GL_STATIC_DRAW: case GL_STATIC_READ: case GL_STATIC_COPY: - pipe_usage = PIPE_USAGE_STATIC; + default: + pipe_usage = PIPE_USAGE_DEFAULT; break; case GL_DYNAMIC_DRAW: case GL_DYNAMIC_READ: @@ -241,8 +242,6 @@ st_bufferobj_data(struct gl_context *ctx, case GL_STREAM_COPY: pipe_usage = PIPE_USAGE_STREAM; break; - default: - pipe_usage = PIPE_USAGE_DEFAULT; } pipe_resource_reference( &st_obj->buffer, NULL ); @@ -436,6 +435,6 @@ st_init_bufferobject_functions(struct dd_function_table *functions) functions->CopyBufferSubData = st_copy_buffer_subdata; /* For GL_APPLE_vertex_array_object */ - functions->NewArrayObject = _mesa_new_array_object; - functions->DeleteArrayObject = _mesa_delete_array_object; + functions->NewArrayObject = _mesa_new_vao; + functions->DeleteArrayObject = _mesa_delete_vao; } diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 97f213077..90f34e39e 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -483,7 +483,7 @@ make_texture(struct st_context *st, { struct gl_context *ctx = st->ctx; struct pipe_context *pipe = st->pipe; - gl_format mformat; + mesa_format mformat; struct pipe_resource *pt; enum pipe_format pipeFormat; GLenum baseInternalFormat; @@ -542,7 +542,7 @@ make_texture(struct st_context *st, */ success = _mesa_texstore(ctx, 2, /* dims */ baseInternalFormat, /* baseInternalFormat */ - mformat, /* gl_format */ + mformat, /* mesa_format */ transfer->stride, /* dstRowStride, bytes */ &dest, /* destSlices */ width, height, 1, /* size */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c index 7484cb4f1..561967d6c 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_eglimage.c +++ b/mesalib/src/mesa/state_tracker/st_cb_eglimage.c @@ -99,7 +99,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target, struct st_texture_object *stObj; struct st_texture_image *stImage; GLenum internalFormat; - gl_format texFormat; + mesa_format texFormat; /* map pipe format to base format */ if (util_format_get_component_bits(ps->format, UTIL_FORMAT_COLORSPACE_RGB, 3) > 0) diff --git a/mesalib/src/mesa/state_tracker/st_cb_fbo.c b/mesalib/src/mesa/state_tracker/st_cb_fbo.c index 780148487..6449c62a8 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_fbo.c +++ b/mesalib/src/mesa/state_tracker/st_cb_fbo.c @@ -541,7 +541,7 @@ st_validate_attachment(struct gl_context *ctx, { const struct st_texture_object *stObj = st_texture_object(att->Texture); enum pipe_format format; - gl_format texFormat; + mesa_format texFormat; GLboolean valid; /* Sanity check: we must be binding the surface as a (color) render target @@ -568,7 +568,7 @@ st_validate_attachment(struct gl_context *ctx, * Later when we create a surface, we change the format to a linear one. */ if (!ctx->Extensions.EXT_framebuffer_sRGB && _mesa_get_format_color_encoding(texFormat) == GL_SRGB) { - const gl_format linearFormat = _mesa_get_srgb_format_linear(texFormat); + const mesa_format linearFormat = _mesa_get_srgb_format_linear(texFormat); format = st_mesa_format_to_pipe_format(linearFormat); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index aa0862867..f0bf3745b 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -519,7 +519,7 @@ prep_teximage(struct gl_context *ctx, struct gl_texture_image *texImage, if (stObj->surface_based) { const GLenum target = texObj->Target; const GLuint level = texImage->Level; - gl_format texFormat; + mesa_format texFormat; _mesa_clear_texture_object(ctx, texObj); pipe_resource_reference(&stObj->pt, NULL); @@ -604,7 +604,7 @@ st_TexSubImage(struct gl_context *ctx, GLuint dims, struct pipe_transfer *transfer; struct pipe_blit_info blit; enum pipe_format src_format, dst_format; - gl_format mesa_src_format; + mesa_format mesa_src_format; GLenum gl_target = texImage->TexObject->Target; unsigned bind; GLubyte *map; @@ -856,7 +856,7 @@ st_GetTexImage(struct gl_context * ctx, struct pipe_resource *dst = NULL; struct pipe_resource dst_templ; enum pipe_format dst_format, src_format; - gl_format mesa_format; + mesa_format mesa_format; GLenum gl_target = texImage->TexObject->Target; enum pipe_texture_target pipe_target; struct pipe_blit_info blit; @@ -865,7 +865,9 @@ st_GetTexImage(struct gl_context * ctx, ubyte *map = NULL; boolean done = FALSE; - if (!st->prefer_blit_based_texture_transfer) { + if (!st->prefer_blit_based_texture_transfer && + !_mesa_is_format_compressed(texImage->TexFormat)) { + /* Try to avoid the fallback if we're doing texture decompression here */ goto fallback; } @@ -1483,6 +1485,12 @@ st_finalize_texture(struct gl_context *ctx, if (tObj->Target == GL_TEXTURE_BUFFER) { struct st_buffer_object *st_obj = st_buffer_object(tObj->BufferObject); + if (!st_obj) { + pipe_resource_reference(&stObj->pt, NULL); + pipe_sampler_view_reference(&stObj->sampler_view, NULL); + return GL_TRUE; + } + if (st_obj->buffer != stObj->pt) { pipe_resource_reference(&stObj->pt, st_obj->buffer); pipe_sampler_view_release(st->pipe, &stObj->sampler_view); @@ -1689,7 +1697,7 @@ st_AllocTextureStorage(struct gl_context *ctx, static GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, - GLint level, gl_format format, + GLint level, mesa_format format, GLint width, GLint height, GLint depth, GLint border) { diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index e7d5d7413..9829eb596 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -89,10 +89,6 @@ void st_init_limits(struct st_context *st) c->MaxArrayTextureLayers = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS); - c->MaxCombinedTextureImageUnits - = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS), - MAX_COMBINED_TEXTURE_IMAGE_UNITS); - /* Define max viewport size and max renderbuffer size in terms of * max texture size (note: max tex RECT size = max tex 2D size). * If this isn't true for some hardware we'll need new PIPE_CAP_ queries. @@ -243,6 +239,12 @@ void st_init_limits(struct st_context *st) options->LowerClipDistance = true; } + c->MaxCombinedTextureImageUnits = + _min(c->Program[MESA_SHADER_VERTEX].MaxTextureImageUnits + + c->Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits + + c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits, + MAX_COMBINED_TEXTURE_IMAGE_UNITS); + /* This depends on program constants. */ c->MaxTextureCoordUnits = _min(c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); @@ -419,7 +421,9 @@ void st_init_extensions(struct st_context *st) PIPE_FORMAT_R16G16B16A16_FLOAT } }, { { o(ARB_texture_rgb10_a2ui) }, - { PIPE_FORMAT_B10G10R10A2_UINT } }, + { PIPE_FORMAT_R10G10B10A2_UINT, + PIPE_FORMAT_B10G10R10A2_UINT }, + GL_TRUE }, /* at least one format must be supported */ { { o(EXT_framebuffer_sRGB) }, { PIPE_FORMAT_A8B8G8R8_SRGB, @@ -537,7 +541,6 @@ void st_init_extensions(struct st_context *st) ctx->Extensions.EXT_blend_color = GL_TRUE; ctx->Extensions.EXT_blend_func_separate = GL_TRUE; ctx->Extensions.EXT_blend_minmax = GL_TRUE; - ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; ctx->Extensions.EXT_gpu_program_parameters = GL_TRUE; ctx->Extensions.EXT_pixel_buffer_object = GL_TRUE; ctx->Extensions.EXT_point_parameters = GL_TRUE; @@ -740,9 +743,7 @@ void st_init_extensions(struct st_context *st) ctx->Const.MinMapBufferAlignment = screen->get_param(screen, PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT); - if (ctx->Const.MinMapBufferAlignment >= 64) { - ctx->Extensions.ARB_map_buffer_alignment = GL_TRUE; - } + if (screen->get_param(screen, PIPE_CAP_TEXTURE_BUFFER_OBJECTS)) { ctx->Extensions.ARB_texture_buffer_object = GL_TRUE; diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index b0158f300..90e9f2f78 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -54,70 +54,70 @@ * Translate Mesa format to Gallium format. */ enum pipe_format -st_mesa_format_to_pipe_format(gl_format mesaFormat) +st_mesa_format_to_pipe_format(mesa_format mesaFormat) { switch (mesaFormat) { - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: return PIPE_FORMAT_ABGR8888_UNORM; - case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_UNORM: return PIPE_FORMAT_RGBA8888_UNORM; - case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_B8G8R8A8_UNORM: return PIPE_FORMAT_BGRA8888_UNORM; - case MESA_FORMAT_ARGB8888_REV: + case MESA_FORMAT_A8R8G8B8_UNORM: return PIPE_FORMAT_ARGB8888_UNORM; - case MESA_FORMAT_RGBX8888: + case MESA_FORMAT_X8B8G8R8_UNORM: return PIPE_FORMAT_XBGR8888_UNORM; - case MESA_FORMAT_RGBX8888_REV: + case MESA_FORMAT_R8G8B8X8_UNORM: return PIPE_FORMAT_RGBX8888_UNORM; - case MESA_FORMAT_XRGB8888: + case MESA_FORMAT_B8G8R8X8_UNORM: return PIPE_FORMAT_BGRX8888_UNORM; - case MESA_FORMAT_XRGB8888_REV: + case MESA_FORMAT_X8R8G8B8_UNORM: return PIPE_FORMAT_XRGB8888_UNORM; - case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_B5G5R5A1_UNORM: return PIPE_FORMAT_B5G5R5A1_UNORM; - case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_B4G4R4A4_UNORM: return PIPE_FORMAT_B4G4R4A4_UNORM; - case MESA_FORMAT_RGB565: + case MESA_FORMAT_B5G6R5_UNORM: return PIPE_FORMAT_B5G6R5_UNORM; - case MESA_FORMAT_RGB332: + case MESA_FORMAT_B2G3R3_UNORM: return PIPE_FORMAT_B2G3R3_UNORM; - case MESA_FORMAT_ARGB2101010: + case MESA_FORMAT_B10G10R10A2_UNORM: return PIPE_FORMAT_B10G10R10A2_UNORM; - case MESA_FORMAT_AL44: + case MESA_FORMAT_L4A4_UNORM: return PIPE_FORMAT_L4A4_UNORM; - case MESA_FORMAT_AL88: + case MESA_FORMAT_L8A8_UNORM: return PIPE_FORMAT_L8A8_UNORM; - case MESA_FORMAT_AL1616: + case MESA_FORMAT_L16A16_UNORM: return PIPE_FORMAT_L16A16_UNORM; - case MESA_FORMAT_A8: + case MESA_FORMAT_A_UNORM8: return PIPE_FORMAT_A8_UNORM; - case MESA_FORMAT_A16: + case MESA_FORMAT_A_UNORM16: return PIPE_FORMAT_A16_UNORM; - case MESA_FORMAT_L8: + case MESA_FORMAT_L_UNORM8: return PIPE_FORMAT_L8_UNORM; - case MESA_FORMAT_L16: + case MESA_FORMAT_L_UNORM16: return PIPE_FORMAT_L16_UNORM; - case MESA_FORMAT_I8: + case MESA_FORMAT_I_UNORM8: return PIPE_FORMAT_I8_UNORM; - case MESA_FORMAT_I16: + case MESA_FORMAT_I_UNORM16: return PIPE_FORMAT_I16_UNORM; - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: return PIPE_FORMAT_Z16_UNORM; - case MESA_FORMAT_Z32: + case MESA_FORMAT_Z_UNORM32: return PIPE_FORMAT_Z32_UNORM; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: return PIPE_FORMAT_S8_UINT_Z24_UNORM; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: return PIPE_FORMAT_Z24_UNORM_S8_UINT; - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_X8Z24_UNORM: return PIPE_FORMAT_X8Z24_UNORM; - case MESA_FORMAT_X8_Z24: + case MESA_FORMAT_Z24_UNORM_S8_UINT: return PIPE_FORMAT_Z24X8_UNORM; - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: return PIPE_FORMAT_S8_UINT; - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_FLOAT32: return PIPE_FORMAT_Z32_FLOAT; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: return PIPE_FORMAT_Z32_FLOAT_S8X24_UINT; case MESA_FORMAT_YCBCR: return PIPE_FORMAT_UYVY; @@ -137,15 +137,15 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) return PIPE_FORMAT_DXT3_SRGBA; case MESA_FORMAT_SRGBA_DXT5: return PIPE_FORMAT_DXT5_SRGBA; - case MESA_FORMAT_SLA8: + case MESA_FORMAT_L8A8_SRGB: return PIPE_FORMAT_L8A8_SRGB; - case MESA_FORMAT_SL8: + case MESA_FORMAT_L_SRGB8: return PIPE_FORMAT_L8_SRGB; - case MESA_FORMAT_SRGB8: + case MESA_FORMAT_BGR_SRGB8: return PIPE_FORMAT_R8G8B8_SRGB; - case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_A8B8G8R8_SRGB: return PIPE_FORMAT_A8B8G8R8_SRGB; - case MESA_FORMAT_SARGB8: + case MESA_FORMAT_B8G8R8A8_SRGB: return PIPE_FORMAT_B8G8R8A8_SRGB; case MESA_FORMAT_RGBA_FLOAT32: return PIPE_FORMAT_R32G32B32A32_FLOAT; @@ -155,21 +155,21 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) return PIPE_FORMAT_R32G32B32_FLOAT; case MESA_FORMAT_RGB_FLOAT16: return PIPE_FORMAT_R16G16B16_FLOAT; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + case MESA_FORMAT_LA_FLOAT32: return PIPE_FORMAT_L32A32_FLOAT; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + case MESA_FORMAT_LA_FLOAT16: return PIPE_FORMAT_L16A16_FLOAT; - case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_L_FLOAT32: return PIPE_FORMAT_L32_FLOAT; - case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_L_FLOAT16: return PIPE_FORMAT_L16_FLOAT; - case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_A_FLOAT32: return PIPE_FORMAT_A32_FLOAT; - case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_A_FLOAT16: return PIPE_FORMAT_A16_FLOAT; - case MESA_FORMAT_INTENSITY_FLOAT32: + case MESA_FORMAT_I_FLOAT32: return PIPE_FORMAT_I32_FLOAT; - case MESA_FORMAT_INTENSITY_FLOAT16: + case MESA_FORMAT_I_FLOAT16: return PIPE_FORMAT_I16_FLOAT; case MESA_FORMAT_R_FLOAT32: return PIPE_FORMAT_R32_FLOAT; @@ -180,97 +180,97 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) case MESA_FORMAT_RG_FLOAT16: return PIPE_FORMAT_R16G16_FLOAT; - case MESA_FORMAT_R8: + case MESA_FORMAT_R_UNORM8: return PIPE_FORMAT_R8_UNORM; - case MESA_FORMAT_R16: + case MESA_FORMAT_R_UNORM16: return PIPE_FORMAT_R16_UNORM; - case MESA_FORMAT_GR88: + case MESA_FORMAT_R8G8_UNORM: return PIPE_FORMAT_R8G8_UNORM; - case MESA_FORMAT_GR1616: + case MESA_FORMAT_R16G16_UNORM: return PIPE_FORMAT_R16G16_UNORM; - case MESA_FORMAT_RGBA_16: + case MESA_FORMAT_RGBA_UNORM16: return PIPE_FORMAT_R16G16B16A16_UNORM; /* signed int formats */ - case MESA_FORMAT_ALPHA_UINT8: + case MESA_FORMAT_A_UINT8: return PIPE_FORMAT_A8_UINT; - case MESA_FORMAT_ALPHA_UINT16: + case MESA_FORMAT_A_UINT16: return PIPE_FORMAT_A16_UINT; - case MESA_FORMAT_ALPHA_UINT32: + case MESA_FORMAT_A_UINT32: return PIPE_FORMAT_A32_UINT; - case MESA_FORMAT_ALPHA_INT8: + case MESA_FORMAT_A_SINT8: return PIPE_FORMAT_A8_SINT; - case MESA_FORMAT_ALPHA_INT16: + case MESA_FORMAT_A_SINT16: return PIPE_FORMAT_A16_SINT; - case MESA_FORMAT_ALPHA_INT32: + case MESA_FORMAT_A_SINT32: return PIPE_FORMAT_A32_SINT; - case MESA_FORMAT_INTENSITY_UINT8: + case MESA_FORMAT_I_UINT8: return PIPE_FORMAT_I8_UINT; - case MESA_FORMAT_INTENSITY_UINT16: + case MESA_FORMAT_I_UINT16: return PIPE_FORMAT_I16_UINT; - case MESA_FORMAT_INTENSITY_UINT32: + case MESA_FORMAT_I_UINT32: return PIPE_FORMAT_I32_UINT; - case MESA_FORMAT_INTENSITY_INT8: + case MESA_FORMAT_I_SINT8: return PIPE_FORMAT_I8_SINT; - case MESA_FORMAT_INTENSITY_INT16: + case MESA_FORMAT_I_SINT16: return PIPE_FORMAT_I16_SINT; - case MESA_FORMAT_INTENSITY_INT32: + case MESA_FORMAT_I_SINT32: return PIPE_FORMAT_I32_SINT; - case MESA_FORMAT_LUMINANCE_UINT8: + case MESA_FORMAT_L_UINT8: return PIPE_FORMAT_L8_UINT; - case MESA_FORMAT_LUMINANCE_UINT16: + case MESA_FORMAT_L_UINT16: return PIPE_FORMAT_L16_UINT; - case MESA_FORMAT_LUMINANCE_UINT32: + case MESA_FORMAT_L_UINT32: return PIPE_FORMAT_L32_UINT; - case MESA_FORMAT_LUMINANCE_INT8: + case MESA_FORMAT_L_SINT8: return PIPE_FORMAT_L8_SINT; - case MESA_FORMAT_LUMINANCE_INT16: + case MESA_FORMAT_L_SINT16: return PIPE_FORMAT_L16_SINT; - case MESA_FORMAT_LUMINANCE_INT32: + case MESA_FORMAT_L_SINT32: return PIPE_FORMAT_L32_SINT; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT8: + case MESA_FORMAT_LA_UINT8: return PIPE_FORMAT_L8A8_UINT; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT16: + case MESA_FORMAT_LA_UINT16: return PIPE_FORMAT_L16A16_UINT; - case MESA_FORMAT_LUMINANCE_ALPHA_UINT32: + case MESA_FORMAT_LA_UINT32: return PIPE_FORMAT_L32A32_UINT; - case MESA_FORMAT_LUMINANCE_ALPHA_INT8: + case MESA_FORMAT_LA_SINT8: return PIPE_FORMAT_L8A8_SINT; - case MESA_FORMAT_LUMINANCE_ALPHA_INT16: + case MESA_FORMAT_LA_SINT16: return PIPE_FORMAT_L16A16_SINT; - case MESA_FORMAT_LUMINANCE_ALPHA_INT32: + case MESA_FORMAT_LA_SINT32: return PIPE_FORMAT_L32A32_SINT; - case MESA_FORMAT_R_INT8: + case MESA_FORMAT_R_SINT8: return PIPE_FORMAT_R8_SINT; - case MESA_FORMAT_RG_INT8: + case MESA_FORMAT_RG_SINT8: return PIPE_FORMAT_R8G8_SINT; - case MESA_FORMAT_RGB_INT8: + case MESA_FORMAT_RGB_SINT8: return PIPE_FORMAT_R8G8B8_SINT; - case MESA_FORMAT_RGBA_INT8: + case MESA_FORMAT_RGBA_SINT8: return PIPE_FORMAT_R8G8B8A8_SINT; - case MESA_FORMAT_R_INT16: + case MESA_FORMAT_R_SINT16: return PIPE_FORMAT_R16_SINT; - case MESA_FORMAT_RG_INT16: + case MESA_FORMAT_RG_SINT16: return PIPE_FORMAT_R16G16_SINT; - case MESA_FORMAT_RGB_INT16: + case MESA_FORMAT_RGB_SINT16: return PIPE_FORMAT_R16G16B16_SINT; - case MESA_FORMAT_RGBA_INT16: + case MESA_FORMAT_RGBA_SINT16: return PIPE_FORMAT_R16G16B16A16_SINT; - case MESA_FORMAT_R_INT32: + case MESA_FORMAT_R_SINT32: return PIPE_FORMAT_R32_SINT; - case MESA_FORMAT_RG_INT32: + case MESA_FORMAT_RG_SINT32: return PIPE_FORMAT_R32G32_SINT; - case MESA_FORMAT_RGB_INT32: + case MESA_FORMAT_RGB_SINT32: return PIPE_FORMAT_R32G32B32_SINT; - case MESA_FORMAT_RGBA_INT32: + case MESA_FORMAT_RGBA_SINT32: return PIPE_FORMAT_R32G32B32A32_SINT; /* unsigned int formats */ @@ -299,96 +299,98 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) case MESA_FORMAT_RGBA_UINT32: return PIPE_FORMAT_R32G32B32A32_UINT; - case MESA_FORMAT_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_UNORM: return PIPE_FORMAT_RGTC1_UNORM; - case MESA_FORMAT_SIGNED_RED_RGTC1: + case MESA_FORMAT_R_RGTC1_SNORM: return PIPE_FORMAT_RGTC1_SNORM; - case MESA_FORMAT_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_UNORM: return PIPE_FORMAT_RGTC2_UNORM; - case MESA_FORMAT_SIGNED_RG_RGTC2: + case MESA_FORMAT_RG_RGTC2_SNORM: return PIPE_FORMAT_RGTC2_SNORM; - case MESA_FORMAT_L_LATC1: + case MESA_FORMAT_L_LATC1_UNORM: return PIPE_FORMAT_LATC1_UNORM; - case MESA_FORMAT_SIGNED_L_LATC1: + case MESA_FORMAT_L_LATC1_SNORM: return PIPE_FORMAT_LATC1_SNORM; - case MESA_FORMAT_LA_LATC2: + case MESA_FORMAT_LA_LATC2_UNORM: return PIPE_FORMAT_LATC2_UNORM; - case MESA_FORMAT_SIGNED_LA_LATC2: + case MESA_FORMAT_LA_LATC2_SNORM: return PIPE_FORMAT_LATC2_SNORM; case MESA_FORMAT_ETC1_RGB8: return PIPE_FORMAT_ETC1_RGB8; /* signed normalized formats */ - case MESA_FORMAT_SIGNED_R8: + case MESA_FORMAT_R_SNORM8: return PIPE_FORMAT_R8_SNORM; - case MESA_FORMAT_SIGNED_RG88_REV: + case MESA_FORMAT_R8G8_SNORM: return PIPE_FORMAT_R8G8_SNORM; - case MESA_FORMAT_SIGNED_RGBA8888_REV: + case MESA_FORMAT_R8G8B8A8_SNORM: return PIPE_FORMAT_R8G8B8A8_SNORM; - case MESA_FORMAT_SIGNED_A8: + case MESA_FORMAT_A_SNORM8: return PIPE_FORMAT_A8_SNORM; - case MESA_FORMAT_SIGNED_L8: + case MESA_FORMAT_L_SNORM8: return PIPE_FORMAT_L8_SNORM; - case MESA_FORMAT_SIGNED_AL88: + case MESA_FORMAT_L8A8_SNORM: return PIPE_FORMAT_L8A8_SNORM; - case MESA_FORMAT_SIGNED_I8: + case MESA_FORMAT_I_SNORM8: return PIPE_FORMAT_I8_SNORM; - case MESA_FORMAT_SIGNED_R16: + case MESA_FORMAT_R_SNORM16: return PIPE_FORMAT_R16_SNORM; - case MESA_FORMAT_SIGNED_GR1616: + case MESA_FORMAT_R16G16_SNORM: return PIPE_FORMAT_R16G16_SNORM; - case MESA_FORMAT_SIGNED_RGBA_16: + case MESA_FORMAT_RGBA_SNORM16: return PIPE_FORMAT_R16G16B16A16_SNORM; - case MESA_FORMAT_SIGNED_A16: + case MESA_FORMAT_A_SNORM16: return PIPE_FORMAT_A16_SNORM; - case MESA_FORMAT_SIGNED_L16: + case MESA_FORMAT_L_SNORM16: return PIPE_FORMAT_L16_SNORM; - case MESA_FORMAT_SIGNED_AL1616: + case MESA_FORMAT_LA_SNORM16: return PIPE_FORMAT_L16A16_SNORM; - case MESA_FORMAT_SIGNED_I16: + case MESA_FORMAT_I_SNORM16: return PIPE_FORMAT_I16_SNORM; - case MESA_FORMAT_RGB9_E5_FLOAT: + case MESA_FORMAT_R9G9B9E5_FLOAT: return PIPE_FORMAT_R9G9B9E5_FLOAT; - case MESA_FORMAT_R11_G11_B10_FLOAT: + case MESA_FORMAT_R11G11B10_FLOAT: return PIPE_FORMAT_R11G11B10_FLOAT; - case MESA_FORMAT_ARGB2101010_UINT: + case MESA_FORMAT_B10G10R10A2_UINT: return PIPE_FORMAT_B10G10R10A2_UINT; + case MESA_FORMAT_R10G10B10A2_UINT: + return PIPE_FORMAT_R10G10B10A2_UINT; - case MESA_FORMAT_XRGB4444_UNORM: + case MESA_FORMAT_B4G4R4X4_UNORM: return PIPE_FORMAT_B4G4R4X4_UNORM; - case MESA_FORMAT_XRGB1555_UNORM: + case MESA_FORMAT_B5G5R5X1_UNORM: return PIPE_FORMAT_B5G5R5X1_UNORM; - case MESA_FORMAT_XBGR8888_SNORM: + case MESA_FORMAT_R8G8B8X8_SNORM: return PIPE_FORMAT_R8G8B8X8_SNORM; - case MESA_FORMAT_XBGR8888_SRGB: + case MESA_FORMAT_R8G8B8X8_SRGB: return PIPE_FORMAT_R8G8B8X8_SRGB; - case MESA_FORMAT_XBGR8888_UINT: + case MESA_FORMAT_RGBX_UINT8: return PIPE_FORMAT_R8G8B8X8_UINT; - case MESA_FORMAT_XBGR8888_SINT: + case MESA_FORMAT_RGBX_SINT8: return PIPE_FORMAT_R8G8B8X8_SINT; - case MESA_FORMAT_XRGB2101010_UNORM: + case MESA_FORMAT_B10G10R10X2_UNORM: return PIPE_FORMAT_B10G10R10X2_UNORM; - case MESA_FORMAT_XBGR16161616_UNORM: + case MESA_FORMAT_RGBX_UNORM16: return PIPE_FORMAT_R16G16B16X16_UNORM; - case MESA_FORMAT_XBGR16161616_SNORM: + case MESA_FORMAT_RGBX_SNORM16: return PIPE_FORMAT_R16G16B16X16_SNORM; - case MESA_FORMAT_XBGR16161616_FLOAT: + case MESA_FORMAT_RGBX_FLOAT16: return PIPE_FORMAT_R16G16B16X16_FLOAT; - case MESA_FORMAT_XBGR16161616_UINT: + case MESA_FORMAT_RGBX_UINT16: return PIPE_FORMAT_R16G16B16X16_UINT; - case MESA_FORMAT_XBGR16161616_SINT: + case MESA_FORMAT_RGBX_SINT16: return PIPE_FORMAT_R16G16B16X16_SINT; - case MESA_FORMAT_XBGR32323232_FLOAT: + case MESA_FORMAT_RGBX_FLOAT32: return PIPE_FORMAT_R32G32B32X32_FLOAT; - case MESA_FORMAT_XBGR32323232_UINT: + case MESA_FORMAT_RGBX_UINT32: return PIPE_FORMAT_R32G32B32X32_UINT; - case MESA_FORMAT_XBGR32323232_SINT: + case MESA_FORMAT_RGBX_SINT32: return PIPE_FORMAT_R32G32B32X32_SINT; default: @@ -400,76 +402,76 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) /** * Translate Gallium format to Mesa format. */ -gl_format +mesa_format st_pipe_format_to_mesa_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_ABGR8888_UNORM: - return MESA_FORMAT_RGBA8888; + return MESA_FORMAT_A8B8G8R8_UNORM; case PIPE_FORMAT_RGBA8888_UNORM: - return MESA_FORMAT_RGBA8888_REV; + return MESA_FORMAT_R8G8B8A8_UNORM; case PIPE_FORMAT_BGRA8888_UNORM: - return MESA_FORMAT_ARGB8888; + return MESA_FORMAT_B8G8R8A8_UNORM; case PIPE_FORMAT_ARGB8888_UNORM: - return MESA_FORMAT_ARGB8888_REV; + return MESA_FORMAT_A8R8G8B8_UNORM; case PIPE_FORMAT_XBGR8888_UNORM: - return MESA_FORMAT_RGBX8888; + return MESA_FORMAT_X8B8G8R8_UNORM; case PIPE_FORMAT_RGBX8888_UNORM: - return MESA_FORMAT_RGBX8888_REV; + return MESA_FORMAT_R8G8B8X8_UNORM; case PIPE_FORMAT_BGRX8888_UNORM: - return MESA_FORMAT_XRGB8888; + return MESA_FORMAT_B8G8R8X8_UNORM; case PIPE_FORMAT_XRGB8888_UNORM: - return MESA_FORMAT_XRGB8888_REV; + return MESA_FORMAT_X8R8G8B8_UNORM; case PIPE_FORMAT_B5G5R5A1_UNORM: - return MESA_FORMAT_ARGB1555; + return MESA_FORMAT_B5G5R5A1_UNORM; case PIPE_FORMAT_B4G4R4A4_UNORM: - return MESA_FORMAT_ARGB4444; + return MESA_FORMAT_B4G4R4A4_UNORM; case PIPE_FORMAT_B5G6R5_UNORM: - return MESA_FORMAT_RGB565; + return MESA_FORMAT_B5G6R5_UNORM; case PIPE_FORMAT_B2G3R3_UNORM: - return MESA_FORMAT_RGB332; + return MESA_FORMAT_B2G3R3_UNORM; case PIPE_FORMAT_B10G10R10A2_UNORM: - return MESA_FORMAT_ARGB2101010; + return MESA_FORMAT_B10G10R10A2_UNORM; case PIPE_FORMAT_L4A4_UNORM: - return MESA_FORMAT_AL44; + return MESA_FORMAT_L4A4_UNORM; case PIPE_FORMAT_L8A8_UNORM: - return MESA_FORMAT_AL88; + return MESA_FORMAT_L8A8_UNORM; case PIPE_FORMAT_L16A16_UNORM: - return MESA_FORMAT_AL1616; + return MESA_FORMAT_L16A16_UNORM; case PIPE_FORMAT_A8_UNORM: - return MESA_FORMAT_A8; + return MESA_FORMAT_A_UNORM8; case PIPE_FORMAT_A16_UNORM: - return MESA_FORMAT_A16; + return MESA_FORMAT_A_UNORM16; case PIPE_FORMAT_L8_UNORM: - return MESA_FORMAT_L8; + return MESA_FORMAT_L_UNORM8; case PIPE_FORMAT_L16_UNORM: - return MESA_FORMAT_L16; + return MESA_FORMAT_L_UNORM16; case PIPE_FORMAT_I8_UNORM: - return MESA_FORMAT_I8; + return MESA_FORMAT_I_UNORM8; case PIPE_FORMAT_I16_UNORM: - return MESA_FORMAT_I16; + return MESA_FORMAT_I_UNORM16; case PIPE_FORMAT_S8_UINT: - return MESA_FORMAT_S8; + return MESA_FORMAT_S_UINT8; case PIPE_FORMAT_R16G16B16A16_UNORM: - return MESA_FORMAT_RGBA_16; + return MESA_FORMAT_RGBA_UNORM16; case PIPE_FORMAT_Z16_UNORM: - return MESA_FORMAT_Z16; + return MESA_FORMAT_Z_UNORM16; case PIPE_FORMAT_Z32_UNORM: - return MESA_FORMAT_Z32; + return MESA_FORMAT_Z_UNORM32; case PIPE_FORMAT_S8_UINT_Z24_UNORM: - return MESA_FORMAT_Z24_S8; + return MESA_FORMAT_S8_UINT_Z24_UNORM; case PIPE_FORMAT_X8Z24_UNORM: - return MESA_FORMAT_Z24_X8; + return MESA_FORMAT_X8Z24_UNORM; case PIPE_FORMAT_Z24X8_UNORM: - return MESA_FORMAT_X8_Z24; + return MESA_FORMAT_Z24_UNORM_S8_UINT; case PIPE_FORMAT_Z24_UNORM_S8_UINT: - return MESA_FORMAT_S8_Z24; + return MESA_FORMAT_Z24_UNORM_X8_UINT; case PIPE_FORMAT_Z32_FLOAT: - return MESA_FORMAT_Z32_FLOAT; + return MESA_FORMAT_Z_FLOAT32; case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT: - return MESA_FORMAT_Z32_FLOAT_X24S8; + return MESA_FORMAT_Z32_FLOAT_S8X24_UINT; case PIPE_FORMAT_UYVY: return MESA_FORMAT_YCBCR; @@ -493,15 +495,15 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_DXT5_SRGBA: return MESA_FORMAT_SRGBA_DXT5; case PIPE_FORMAT_L8A8_SRGB: - return MESA_FORMAT_SLA8; + return MESA_FORMAT_L8A8_SRGB; case PIPE_FORMAT_L8_SRGB: - return MESA_FORMAT_SL8; + return MESA_FORMAT_L_SRGB8; case PIPE_FORMAT_R8G8B8_SRGB: - return MESA_FORMAT_SRGB8; + return MESA_FORMAT_BGR_SRGB8; case PIPE_FORMAT_A8B8G8R8_SRGB: - return MESA_FORMAT_SRGBA8; + return MESA_FORMAT_A8B8G8R8_SRGB; case PIPE_FORMAT_B8G8R8A8_SRGB: - return MESA_FORMAT_SARGB8; + return MESA_FORMAT_B8G8R8A8_SRGB; case PIPE_FORMAT_R32G32B32A32_FLOAT: return MESA_FORMAT_RGBA_FLOAT32; case PIPE_FORMAT_R16G16B16A16_FLOAT: @@ -511,21 +513,21 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_R16G16B16_FLOAT: return MESA_FORMAT_RGB_FLOAT16; case PIPE_FORMAT_L32A32_FLOAT: - return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; + return MESA_FORMAT_LA_FLOAT32; case PIPE_FORMAT_L16A16_FLOAT: - return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; + return MESA_FORMAT_LA_FLOAT16; case PIPE_FORMAT_L32_FLOAT: - return MESA_FORMAT_LUMINANCE_FLOAT32; + return MESA_FORMAT_L_FLOAT32; case PIPE_FORMAT_L16_FLOAT: - return MESA_FORMAT_LUMINANCE_FLOAT16; + return MESA_FORMAT_L_FLOAT16; case PIPE_FORMAT_A32_FLOAT: - return MESA_FORMAT_ALPHA_FLOAT32; + return MESA_FORMAT_A_FLOAT32; case PIPE_FORMAT_A16_FLOAT: - return MESA_FORMAT_ALPHA_FLOAT16; + return MESA_FORMAT_A_FLOAT16; case PIPE_FORMAT_I32_FLOAT: - return MESA_FORMAT_INTENSITY_FLOAT32; + return MESA_FORMAT_I_FLOAT32; case PIPE_FORMAT_I16_FLOAT: - return MESA_FORMAT_INTENSITY_FLOAT16; + return MESA_FORMAT_I_FLOAT16; case PIPE_FORMAT_R32_FLOAT: return MESA_FORMAT_R_FLOAT32; case PIPE_FORMAT_R16_FLOAT: @@ -536,92 +538,92 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_RG_FLOAT16; case PIPE_FORMAT_R8_UNORM: - return MESA_FORMAT_R8; + return MESA_FORMAT_R_UNORM8; case PIPE_FORMAT_R16_UNORM: - return MESA_FORMAT_R16; + return MESA_FORMAT_R_UNORM16; case PIPE_FORMAT_R8G8_UNORM: - return MESA_FORMAT_GR88; + return MESA_FORMAT_R8G8_UNORM; case PIPE_FORMAT_R16G16_UNORM: - return MESA_FORMAT_GR1616; + return MESA_FORMAT_R16G16_UNORM; case PIPE_FORMAT_A8_UINT: - return MESA_FORMAT_ALPHA_UINT8; + return MESA_FORMAT_A_UINT8; case PIPE_FORMAT_A16_UINT: - return MESA_FORMAT_ALPHA_UINT16; + return MESA_FORMAT_A_UINT16; case PIPE_FORMAT_A32_UINT: - return MESA_FORMAT_ALPHA_UINT32; + return MESA_FORMAT_A_UINT32; case PIPE_FORMAT_A8_SINT: - return MESA_FORMAT_ALPHA_INT8; + return MESA_FORMAT_A_SINT8; case PIPE_FORMAT_A16_SINT: - return MESA_FORMAT_ALPHA_INT16; + return MESA_FORMAT_A_SINT16; case PIPE_FORMAT_A32_SINT: - return MESA_FORMAT_ALPHA_INT32; + return MESA_FORMAT_A_SINT32; case PIPE_FORMAT_I8_UINT: - return MESA_FORMAT_INTENSITY_UINT8; + return MESA_FORMAT_I_UINT8; case PIPE_FORMAT_I16_UINT: - return MESA_FORMAT_INTENSITY_UINT16; + return MESA_FORMAT_I_UINT16; case PIPE_FORMAT_I32_UINT: - return MESA_FORMAT_INTENSITY_UINT32; + return MESA_FORMAT_I_UINT32; case PIPE_FORMAT_I8_SINT: - return MESA_FORMAT_INTENSITY_INT8; + return MESA_FORMAT_I_SINT8; case PIPE_FORMAT_I16_SINT: - return MESA_FORMAT_INTENSITY_INT16; + return MESA_FORMAT_I_SINT16; case PIPE_FORMAT_I32_SINT: - return MESA_FORMAT_INTENSITY_INT32; + return MESA_FORMAT_I_SINT32; case PIPE_FORMAT_L8_UINT: - return MESA_FORMAT_LUMINANCE_UINT8; + return MESA_FORMAT_L_UINT8; case PIPE_FORMAT_L16_UINT: - return MESA_FORMAT_LUMINANCE_UINT16; + return MESA_FORMAT_L_UINT16; case PIPE_FORMAT_L32_UINT: - return MESA_FORMAT_LUMINANCE_UINT32; + return MESA_FORMAT_L_UINT32; case PIPE_FORMAT_L8_SINT: - return MESA_FORMAT_LUMINANCE_INT8; + return MESA_FORMAT_L_SINT8; case PIPE_FORMAT_L16_SINT: - return MESA_FORMAT_LUMINANCE_INT16; + return MESA_FORMAT_L_SINT16; case PIPE_FORMAT_L32_SINT: - return MESA_FORMAT_LUMINANCE_INT32; + return MESA_FORMAT_L_SINT32; case PIPE_FORMAT_L8A8_UINT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT8; + return MESA_FORMAT_LA_UINT8; case PIPE_FORMAT_L16A16_UINT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT16; + return MESA_FORMAT_LA_UINT16; case PIPE_FORMAT_L32A32_UINT: - return MESA_FORMAT_LUMINANCE_ALPHA_UINT32; + return MESA_FORMAT_LA_UINT32; case PIPE_FORMAT_L8A8_SINT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT8; + return MESA_FORMAT_LA_SINT8; case PIPE_FORMAT_L16A16_SINT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT16; + return MESA_FORMAT_LA_SINT16; case PIPE_FORMAT_L32A32_SINT: - return MESA_FORMAT_LUMINANCE_ALPHA_INT32; + return MESA_FORMAT_LA_SINT32; case PIPE_FORMAT_R8_SINT: - return MESA_FORMAT_R_INT8; + return MESA_FORMAT_R_SINT8; case PIPE_FORMAT_R8G8_SINT: - return MESA_FORMAT_RG_INT8; + return MESA_FORMAT_RG_SINT8; case PIPE_FORMAT_R8G8B8_SINT: - return MESA_FORMAT_RGB_INT8; + return MESA_FORMAT_RGB_SINT8; case PIPE_FORMAT_R8G8B8A8_SINT: - return MESA_FORMAT_RGBA_INT8; + return MESA_FORMAT_RGBA_SINT8; case PIPE_FORMAT_R16_SINT: - return MESA_FORMAT_R_INT16; + return MESA_FORMAT_R_SINT16; case PIPE_FORMAT_R16G16_SINT: - return MESA_FORMAT_RG_INT16; + return MESA_FORMAT_RG_SINT16; case PIPE_FORMAT_R16G16B16_SINT: - return MESA_FORMAT_RGB_INT16; + return MESA_FORMAT_RGB_SINT16; case PIPE_FORMAT_R16G16B16A16_SINT: - return MESA_FORMAT_RGBA_INT16; + return MESA_FORMAT_RGBA_SINT16; case PIPE_FORMAT_R32_SINT: - return MESA_FORMAT_R_INT32; + return MESA_FORMAT_R_SINT32; case PIPE_FORMAT_R32G32_SINT: - return MESA_FORMAT_RG_INT32; + return MESA_FORMAT_RG_SINT32; case PIPE_FORMAT_R32G32B32_SINT: - return MESA_FORMAT_RGB_INT32; + return MESA_FORMAT_RGB_SINT32; case PIPE_FORMAT_R32G32B32A32_SINT: - return MESA_FORMAT_RGBA_INT32; + return MESA_FORMAT_RGBA_SINT32; /* unsigned int formats */ case PIPE_FORMAT_R8_UINT: @@ -652,97 +654,99 @@ st_pipe_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_RGBA_UINT32; case PIPE_FORMAT_RGTC1_UNORM: - return MESA_FORMAT_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_UNORM; case PIPE_FORMAT_RGTC1_SNORM: - return MESA_FORMAT_SIGNED_RED_RGTC1; + return MESA_FORMAT_R_RGTC1_SNORM; case PIPE_FORMAT_RGTC2_UNORM: - return MESA_FORMAT_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_UNORM; case PIPE_FORMAT_RGTC2_SNORM: - return MESA_FORMAT_SIGNED_RG_RGTC2; + return MESA_FORMAT_RG_RGTC2_SNORM; case PIPE_FORMAT_LATC1_UNORM: - return MESA_FORMAT_L_LATC1; + return MESA_FORMAT_L_LATC1_UNORM; case PIPE_FORMAT_LATC1_SNORM: - return MESA_FORMAT_SIGNED_L_LATC1; + return MESA_FORMAT_L_LATC1_SNORM; case PIPE_FORMAT_LATC2_UNORM: - return MESA_FORMAT_LA_LATC2; + return MESA_FORMAT_LA_LATC2_UNORM; case PIPE_FORMAT_LATC2_SNORM: - return MESA_FORMAT_SIGNED_LA_LATC2; + return MESA_FORMAT_LA_LATC2_SNORM; case PIPE_FORMAT_ETC1_RGB8: return MESA_FORMAT_ETC1_RGB8; /* signed normalized formats */ case PIPE_FORMAT_R8_SNORM: - return MESA_FORMAT_SIGNED_R8; + return MESA_FORMAT_R_SNORM8; case PIPE_FORMAT_R8G8_SNORM: - return MESA_FORMAT_SIGNED_RG88_REV; + return MESA_FORMAT_R8G8_SNORM; case PIPE_FORMAT_R8G8B8A8_SNORM: - return MESA_FORMAT_SIGNED_RGBA8888_REV; + return MESA_FORMAT_R8G8B8A8_SNORM; case PIPE_FORMAT_A8_SNORM: - return MESA_FORMAT_SIGNED_A8; + return MESA_FORMAT_A_SNORM8; case PIPE_FORMAT_L8_SNORM: - return MESA_FORMAT_SIGNED_L8; + return MESA_FORMAT_L_SNORM8; case PIPE_FORMAT_L8A8_SNORM: - return MESA_FORMAT_SIGNED_AL88; + return MESA_FORMAT_L8A8_SNORM; case PIPE_FORMAT_I8_SNORM: - return MESA_FORMAT_SIGNED_I8; + return MESA_FORMAT_I_SNORM8; case PIPE_FORMAT_R16_SNORM: - return MESA_FORMAT_SIGNED_R16; + return MESA_FORMAT_R_SNORM16; case PIPE_FORMAT_R16G16_SNORM: - return MESA_FORMAT_SIGNED_GR1616; + return MESA_FORMAT_R16G16_SNORM; case PIPE_FORMAT_R16G16B16A16_SNORM: - return MESA_FORMAT_SIGNED_RGBA_16; + return MESA_FORMAT_RGBA_SNORM16; case PIPE_FORMAT_A16_SNORM: - return MESA_FORMAT_SIGNED_A16; + return MESA_FORMAT_A_SNORM16; case PIPE_FORMAT_L16_SNORM: - return MESA_FORMAT_SIGNED_L16; + return MESA_FORMAT_L_SNORM16; case PIPE_FORMAT_L16A16_SNORM: - return MESA_FORMAT_SIGNED_AL1616; + return MESA_FORMAT_LA_SNORM16; case PIPE_FORMAT_I16_SNORM: - return MESA_FORMAT_SIGNED_I16; + return MESA_FORMAT_I_SNORM16; case PIPE_FORMAT_R9G9B9E5_FLOAT: - return MESA_FORMAT_RGB9_E5_FLOAT; + return MESA_FORMAT_R9G9B9E5_FLOAT; case PIPE_FORMAT_R11G11B10_FLOAT: - return MESA_FORMAT_R11_G11_B10_FLOAT; + return MESA_FORMAT_R11G11B10_FLOAT; case PIPE_FORMAT_B10G10R10A2_UINT: - return MESA_FORMAT_ARGB2101010_UINT; + return MESA_FORMAT_B10G10R10A2_UINT; + case PIPE_FORMAT_R10G10B10A2_UINT: + return MESA_FORMAT_R10G10B10A2_UINT; case PIPE_FORMAT_B4G4R4X4_UNORM: - return MESA_FORMAT_XRGB4444_UNORM; + return MESA_FORMAT_B4G4R4X4_UNORM; case PIPE_FORMAT_B5G5R5X1_UNORM: - return MESA_FORMAT_XRGB1555_UNORM; + return MESA_FORMAT_B5G5R5X1_UNORM; case PIPE_FORMAT_R8G8B8X8_SNORM: - return MESA_FORMAT_XBGR8888_SNORM; + return MESA_FORMAT_R8G8B8X8_SNORM; case PIPE_FORMAT_R8G8B8X8_SRGB: - return MESA_FORMAT_XBGR8888_SRGB; + return MESA_FORMAT_R8G8B8X8_SRGB; case PIPE_FORMAT_R8G8B8X8_UINT: - return MESA_FORMAT_XBGR8888_UINT; + return MESA_FORMAT_RGBX_UINT8; case PIPE_FORMAT_R8G8B8X8_SINT: - return MESA_FORMAT_XBGR8888_SINT; + return MESA_FORMAT_RGBX_SINT8; case PIPE_FORMAT_B10G10R10X2_UNORM: - return MESA_FORMAT_XRGB2101010_UNORM; + return MESA_FORMAT_B10G10R10X2_UNORM; case PIPE_FORMAT_R16G16B16X16_UNORM: - return MESA_FORMAT_XBGR16161616_UNORM; + return MESA_FORMAT_RGBX_UNORM16; case PIPE_FORMAT_R16G16B16X16_SNORM: - return MESA_FORMAT_XBGR16161616_SNORM; + return MESA_FORMAT_RGBX_SNORM16; case PIPE_FORMAT_R16G16B16X16_FLOAT: - return MESA_FORMAT_XBGR16161616_FLOAT; + return MESA_FORMAT_RGBX_FLOAT16; case PIPE_FORMAT_R16G16B16X16_UINT: - return MESA_FORMAT_XBGR16161616_UINT; + return MESA_FORMAT_RGBX_UINT16; case PIPE_FORMAT_R16G16B16X16_SINT: - return MESA_FORMAT_XBGR16161616_SINT; + return MESA_FORMAT_RGBX_SINT16; case PIPE_FORMAT_R32G32B32X32_FLOAT: - return MESA_FORMAT_XBGR32323232_FLOAT; + return MESA_FORMAT_RGBX_FLOAT32; case PIPE_FORMAT_R32G32B32X32_UINT: - return MESA_FORMAT_XBGR32323232_UINT; + return MESA_FORMAT_RGBX_UINT32; case PIPE_FORMAT_R32G32B32X32_SINT: - return MESA_FORMAT_XBGR32323232_SINT; + return MESA_FORMAT_RGBX_SINT32; default: assert(0); @@ -1483,7 +1487,7 @@ static const struct format_mapping format_map[] = { }, { { GL_RGB10_A2UI, 0 }, - { PIPE_FORMAT_B10G10R10A2_UINT, 0 } + { PIPE_FORMAT_R10G10B10A2_UINT, PIPE_FORMAT_B10G10R10A2_UINT, 0 } }, }; @@ -1687,7 +1691,7 @@ enum pipe_format st_choose_matching_format(struct pipe_screen *screen, unsigned bind, GLenum format, GLenum type, GLboolean swapBytes) { - gl_format mesa_format; + mesa_format mesa_format; for (mesa_format = 1; mesa_format < MESA_FORMAT_COUNT; mesa_format++) { if (_mesa_get_format_color_encoding(mesa_format) == GL_SRGB) { @@ -1714,7 +1718,7 @@ st_choose_matching_format(struct pipe_screen *screen, unsigned bind, /** * Called via ctx->Driver.ChooseTextureFormat(). */ -gl_format +mesa_format st_ChooseTextureFormat(struct gl_context *ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type) diff --git a/mesalib/src/mesa/state_tracker/st_format.h b/mesalib/src/mesa/state_tracker/st_format.h index bf042ede1..ce1e2306d 100644 --- a/mesalib/src/mesa/state_tracker/st_format.h +++ b/mesalib/src/mesa/state_tracker/st_format.h @@ -41,9 +41,9 @@ struct pipe_screen; extern enum pipe_format -st_mesa_format_to_pipe_format(gl_format mesaFormat); +st_mesa_format_to_pipe_format(mesa_format mesaFormat); -extern gl_format +extern mesa_format st_pipe_format_to_mesa_format(enum pipe_format pipeFormat); @@ -61,7 +61,7 @@ extern enum pipe_format st_choose_matching_format(struct pipe_screen *screen, unsigned bind, GLenum format, GLenum type, GLboolean swapBytes); -extern gl_format +extern mesa_format st_ChooseTextureFormat(struct gl_context * ctx, GLenum target, GLint internalFormat, GLenum format, GLenum type); diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 0871dd064..610fc68a8 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5027,6 +5027,8 @@ shader_stage_to_ptarget(gl_shader_stage stage) return PIPE_SHADER_FRAGMENT; case MESA_SHADER_GEOMETRY: return PIPE_SHADER_GEOMETRY; + case MESA_SHADER_COMPUTE: + return PIPE_SHADER_COMPUTE; } assert(!"should not be reached"); diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 8158450dc..215b27634 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -469,7 +469,6 @@ st_context_teximage(struct st_context_iface *stctxi, { struct st_context *st = (struct st_context *) stctxi; struct gl_context *ctx = st->ctx; - struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj; struct gl_texture_image *texImage; struct st_texture_object *stObj; @@ -495,7 +494,8 @@ st_context_teximage(struct st_context_iface *stctxi, return FALSE; } - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); + _mesa_lock_texture(ctx, texObj); stObj = st_texture_object(texObj); @@ -508,7 +508,7 @@ st_context_teximage(struct st_context_iface *stctxi, texImage = _mesa_get_tex_image(ctx, texObj, target, level); stImage = st_texture_image(texImage); if (tex) { - gl_format texFormat = st_pipe_format_to_mesa_format(pipe_format); + mesa_format texFormat = st_pipe_format_to_mesa_format(pipe_format); if (util_format_has_alpha(tex->format)) internalFormat = GL_RGBA; diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 7a15b23fa..cadbe1705 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -944,17 +944,16 @@ st_translate_geometry_program(struct st_context *st, case VARYING_SLOT_TEX5: case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: - stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + stgp->input_semantic_name[slot] = st->needs_texcoord_semantic ? + TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; stgp->input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); break; case VARYING_SLOT_VAR0: default: assert(attr >= VARYING_SLOT_VAR0 && attr < VARYING_SLOT_MAX); stgp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stgp->input_semantic_index[slot] = (VARYING_SLOT_VAR0 - - VARYING_SLOT_TEX0 + - attr - - VARYING_SLOT_VAR0); + stgp->input_semantic_index[slot] = st->needs_texcoord_semantic ? + (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); break; } } @@ -1036,7 +1035,8 @@ st_translate_geometry_program(struct st_context *st, case VARYING_SLOT_TEX5: case VARYING_SLOT_TEX6: case VARYING_SLOT_TEX7: - gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + gs_output_semantic_name[slot] = st->needs_texcoord_semantic ? + TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; gs_output_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); break; case VARYING_SLOT_VAR0: @@ -1044,10 +1044,9 @@ st_translate_geometry_program(struct st_context *st, assert(slot < Elements(gs_output_semantic_name)); assert(attr >= VARYING_SLOT_VAR0); gs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - gs_output_semantic_index[slot] = (VARYING_SLOT_VAR0 - - VARYING_SLOT_TEX0 + - attr - - VARYING_SLOT_VAR0); + gs_output_semantic_index[slot] = st->needs_texcoord_semantic ? + (attr - VARYING_SLOT_VAR0) : (attr - VARYING_SLOT_TEX0); + break; } } } diff --git a/mesalib/src/mesa/state_tracker/st_vdpau.c b/mesalib/src/mesa/state_tracker/st_vdpau.c index 9b165ee39..c5b4780ce 100644 --- a/mesalib/src/mesa/state_tracker/st_vdpau.c +++ b/mesalib/src/mesa/state_tracker/st_vdpau.c @@ -47,6 +47,7 @@ #include "st_context.h" #include "st_texture.h" #include "st_format.h" +#include "st_cb_flush.h" static void st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, @@ -63,7 +64,7 @@ st_vdpau_map_surface(struct gl_context *ctx, GLenum target, GLenum access, struct pipe_resource *res; struct pipe_sampler_view *sv, templ; - gl_format texFormat; + mesa_format texFormat; getProcAddr = ctx->vdpGetProcAddress; if (output) { @@ -163,6 +164,7 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access, struct gl_texture_image *texImage, const GLvoid *vdpSurface, GLuint index) { + struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(texObj); struct st_texture_image *stImage = st_texture_image(texImage); @@ -171,6 +173,8 @@ st_vdpau_unmap_surface(struct gl_context *ctx, GLenum target, GLenum access, pipe_resource_reference(&stImage->pt, NULL); _mesa_dirty_texobj(ctx, texObj); + + st_flush(st, NULL, 0); } void diff --git a/mesalib/src/mesa/swrast/s_blit.c b/mesalib/src/mesa/swrast/s_blit.c index bbb0013e6..1ba188c5f 100644 --- a/mesalib/src/mesa/swrast/s_blit.c +++ b/mesalib/src/mesa/swrast/s_blit.c @@ -166,8 +166,8 @@ blit_nearest(struct gl_context *ctx, * using the core helpers for pack/unpack, we avoid needing to handle * masking for things like DEPTH copies of Z24S8. */ - if (readRb->Format == MESA_FORMAT_Z32_FLOAT || - readRb->Format == MESA_FORMAT_Z32_FLOAT_X24S8) { + if (readRb->Format == MESA_FORMAT_Z_FLOAT32 || + readRb->Format == MESA_FORMAT_Z32_FLOAT_S8X24_UINT) { mode = UNPACK_Z_FLOAT; } else { mode = UNPACK_Z_INT; @@ -536,7 +536,7 @@ blit_linear(struct gl_context *ctx, GLint srcBufferY0 = -1, srcBufferY1 = -1; GLvoid *dstBuffer; - gl_format readFormat = _mesa_get_srgb_format_linear(readRb->Format); + mesa_format readFormat = _mesa_get_srgb_format_linear(readRb->Format); GLuint bpp = _mesa_get_format_bytes(readFormat); GLenum pixelType; @@ -571,7 +571,7 @@ blit_linear(struct gl_context *ctx, GLint idx = drawFb->_ColorDrawBufferIndexes[i]; struct gl_renderbuffer_attachment *drawAtt; struct gl_renderbuffer *drawRb; - gl_format drawFormat; + mesa_format drawFormat; if (idx == -1) continue; diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index 7f3c76de4..93aaffc57 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -217,7 +217,7 @@ get_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_Z32) { + if (rb->Format == MESA_FORMAT_Z_UNORM32) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -252,7 +252,7 @@ put_z32_values(struct gl_context *ctx, struct gl_renderbuffer *rb, GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_Z32) { + if (rb->Format == MESA_FORMAT_Z_UNORM32) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (mask[i] && x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -300,12 +300,12 @@ _swrast_depth_test_span(struct gl_context *ctx, SWspan *span) else zStart = _swrast_pixel_address(rb, span->x, span->y); - if (rb->Format == MESA_FORMAT_Z16 && !(span->arrayMask & SPAN_XY)) { + if (rb->Format == MESA_FORMAT_Z_UNORM16 && !(span->arrayMask & SPAN_XY)) { /* directly read/write row of 16-bit Z values */ zBufferVals = zStart; ztest16 = GL_TRUE; } - else if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) { + else if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) { /* directly read/write row of 32-bit Z values */ zBufferVals = zStart; } @@ -439,7 +439,7 @@ _swrast_depth_bounds_test( struct gl_context *ctx, SWspan *span ) else zStart = _swrast_pixel_address(rb, span->x, span->y); - if (rb->Format == MESA_FORMAT_Z32 && !(span->arrayMask & SPAN_XY)) { + if (rb->Format == MESA_FORMAT_Z_UNORM32 && !(span->arrayMask & SPAN_XY)) { /* directly access 32-bit values in the depth buffer */ zBufferVals = (const GLuint *) zStart; } @@ -552,10 +552,10 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) height = ctx->DrawBuffer->_Ymax - ctx->DrawBuffer->_Ymin; mapMode = GL_MAP_WRITE_BIT; - if (rb->Format == MESA_FORMAT_S8_Z24 || - rb->Format == MESA_FORMAT_X8_Z24 || - rb->Format == MESA_FORMAT_Z24_S8 || - rb->Format == MESA_FORMAT_Z24_X8) { + if (rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT || + rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT || + rb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM || + rb->Format == MESA_FORMAT_X8Z24_UNORM) { mapMode |= GL_MAP_READ_BIT; } @@ -567,7 +567,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } switch (rb->Format) { - case MESA_FORMAT_Z16: + case MESA_FORMAT_Z_UNORM16: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLushort clearVal = 0; @@ -587,8 +587,8 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_Z32: - case MESA_FORMAT_Z32_FLOAT: + case MESA_FORMAT_Z_UNORM32: + case MESA_FORMAT_Z_FLOAT32: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLuint clearVal = 0; @@ -602,17 +602,17 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_X8_Z24: - case MESA_FORMAT_Z24_S8: - case MESA_FORMAT_Z24_X8: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_Z24_UNORM_S8_UINT: + case MESA_FORMAT_S8_UINT_Z24_UNORM: + case MESA_FORMAT_X8Z24_UNORM: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLuint clearVal = 0; GLuint mask; - if (rb->Format == MESA_FORMAT_S8_Z24 || - rb->Format == MESA_FORMAT_X8_Z24) + if (rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT || + rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT) mask = 0xff000000; else mask = 0xff; @@ -628,7 +628,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) } break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: /* XXX untested */ { GLfloat clearVal = (GLfloat) ctx->Depth.Clear; @@ -692,15 +692,15 @@ _swrast_clear_depth_stencil_buffer(struct gl_context *ctx) } switch (rb->Format) { - case MESA_FORMAT_S8_Z24: - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_Z24_UNORM_X8_UINT: + case MESA_FORMAT_S8_UINT_Z24_UNORM: { GLfloat zClear = (GLfloat) ctx->Depth.Clear; GLuint clear = 0, mask; _mesa_pack_float_z_row(rb->Format, 1, &zClear, &clear); - if (rb->Format == MESA_FORMAT_S8_Z24) { + if (rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT) { mask = ((~writeMask) & 0xff) << 24; clear |= (ctx->Stencil.Clear & writeMask & 0xff) << 24; } @@ -725,7 +725,7 @@ _swrast_clear_depth_stencil_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_Z32_FLOAT_X24S8: + case MESA_FORMAT_Z32_FLOAT_S8X24_UINT: /* XXX untested */ { const GLfloat zClear = (GLfloat) ctx->Depth.Clear; diff --git a/mesalib/src/mesa/swrast/s_drawpix.c b/mesalib/src/mesa/swrast/s_drawpix.c index 1786de1a3..ed4487f3e 100644 --- a/mesalib/src/mesa/swrast/s_drawpix.c +++ b/mesalib/src/mesa/swrast/s_drawpix.c @@ -223,8 +223,8 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, if (format == GL_RGB && type == GL_UNSIGNED_BYTE && - (rb->Format == MESA_FORMAT_XRGB8888 || - rb->Format == MESA_FORMAT_ARGB8888)) { + (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM || + rb->Format == MESA_FORMAT_B8G8R8A8_UNORM)) { fast_draw_rgb_ubyte_pixels(ctx, rb, x, y, width, height, &unpack, pixels); return GL_TRUE; @@ -232,8 +232,8 @@ fast_draw_rgba_pixels(struct gl_context *ctx, GLint x, GLint y, if (format == GL_RGBA && type == GL_UNSIGNED_BYTE && - (rb->Format == MESA_FORMAT_XRGB8888 || - rb->Format == MESA_FORMAT_ARGB8888)) { + (rb->Format == MESA_FORMAT_B8G8R8X8_UNORM || + rb->Format == MESA_FORMAT_B8G8R8A8_UNORM)) { fast_draw_rgba_ubyte_pixels(ctx, rb, x, y, width, height, &unpack, pixels); return GL_TRUE; @@ -500,7 +500,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, /** - * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_S8_Z24 + * Draw depth+stencil values into a MESA_FORAMT_Z24_S8 or MESA_FORMAT_Z24_UNORM_X8_UINT * renderbuffer. No masking, zooming, scaling, etc. */ static void @@ -572,8 +572,8 @@ draw_depth_stencil_pixels(struct gl_context *ctx, GLint x, GLint y, ASSERT(stencilRb); if (depthRb == stencilRb && - (depthRb->Format == MESA_FORMAT_Z24_S8 || - depthRb->Format == MESA_FORMAT_S8_Z24) && + (depthRb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM || + depthRb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT) && type == GL_UNSIGNED_INT_24_8 && !scaleOrBias && !zoom && diff --git a/mesalib/src/mesa/swrast/s_renderbuffer.c b/mesalib/src/mesa/swrast/s_renderbuffer.c index a19d02ac0..cf5e2230d 100644 --- a/mesalib/src/mesa/swrast/s_renderbuffer.c +++ b/mesalib/src/mesa/swrast/s_renderbuffer.c @@ -69,7 +69,7 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_RGB888; + rb->Format = MESA_FORMAT_BGR_UNORM8; break; case GL_RGBA: case GL_RGBA2: @@ -81,35 +81,35 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, case GL_RGBA12: #endif if (_mesa_little_endian()) - rb->Format = MESA_FORMAT_RGBA8888_REV; + rb->Format = MESA_FORMAT_R8G8B8A8_UNORM; else - rb->Format = MESA_FORMAT_RGBA8888; + rb->Format = MESA_FORMAT_A8B8G8R8_UNORM; break; case GL_RGBA16: case GL_RGBA16_SNORM: /* for accum buffer */ - rb->Format = MESA_FORMAT_SIGNED_RGBA_16; + rb->Format = MESA_FORMAT_RGBA_SNORM16; break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: - rb->Format = MESA_FORMAT_S8; + rb->Format = MESA_FORMAT_S_UINT8; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: - rb->Format = MESA_FORMAT_Z16; + rb->Format = MESA_FORMAT_Z_UNORM16; break; case GL_DEPTH_COMPONENT24: - rb->Format = MESA_FORMAT_X8_Z24; + rb->Format = MESA_FORMAT_Z24_UNORM_S8_UINT; break; case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_Z32; + rb->Format = MESA_FORMAT_Z_UNORM32; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_UINT_Z24_UNORM; break; default: /* unsupported format */ diff --git a/mesalib/src/mesa/swrast/s_stencil.c b/mesalib/src/mesa/swrast/s_stencil.c index 3eeeb24b2..e7c35ff69 100644 --- a/mesalib/src/mesa/swrast/s_stencil.c +++ b/mesalib/src/mesa/swrast/s_stencil.c @@ -61,7 +61,7 @@ ENDIF * within the 4-byte pixel will be either 0 or 3. */ static GLint -get_stencil_offset(gl_format format) +get_stencil_offset(mesa_format format) { const GLubyte one = 1; GLubyte pixel[MAX_PIXEL_BYTES]; @@ -300,7 +300,7 @@ get_s8_values(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLubyte *map = _swrast_pixel_address(rb, 0, 0); GLuint i; - if (rb->Format == MESA_FORMAT_S8) { + if (rb->Format == MESA_FORMAT_S_UINT8) { const GLint rowStride = srb->RowStride; for (i = 0; i < count; i++) { if (x[i] >= 0 && y[i] >= 0 && x[i] < w && y[i] < h) { @@ -587,7 +587,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx) } switch (rb->Format) { - case MESA_FORMAT_S8: + case MESA_FORMAT_S_UINT8: { GLubyte clear = ctx->Stencil.Clear & writeMask & 0xff; GLubyte mask = (~writeMask) & 0xff; @@ -614,7 +614,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_UNORM_X8_UINT: { GLuint clear = (ctx->Stencil.Clear & writeMask & 0xff) << 24; GLuint mask = (((~writeMask) & 0xff) << 24) | 0xffffff; @@ -627,7 +627,7 @@ _swrast_clear_stencil_buffer(struct gl_context *ctx) } } break; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_UINT_Z24_UNORM: { GLuint clear = ctx->Stencil.Clear & writeMask & 0xff; GLuint mask = 0xffffff00 | ((~writeMask) & 0xff); diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c index b886e6586..7a3e76f85 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.c +++ b/mesalib/src/mesa/swrast/s_texfetch.c @@ -134,7 +134,7 @@ static void fetch_null_texelf( const struct swrast_texture_image *texImage, * XXX this is somewhat temporary. */ static struct { - gl_format Name; + mesa_format Name; FetchTexelFunc Fetch1D; FetchTexelFunc Fetch2D; FetchTexelFunc Fetch3D; @@ -149,175 +149,175 @@ texfetch_funcs[] = }, { - MESA_FORMAT_RGBA8888, + MESA_FORMAT_A8B8G8R8_UNORM, fetch_texel_1d_f_rgba8888, fetch_texel_2d_f_rgba8888, fetch_texel_3d_f_rgba8888 }, { - MESA_FORMAT_RGBA8888_REV, + MESA_FORMAT_R8G8B8A8_UNORM, fetch_texel_1d_f_rgba8888_rev, fetch_texel_2d_f_rgba8888_rev, fetch_texel_3d_f_rgba8888_rev }, { - MESA_FORMAT_ARGB8888, + MESA_FORMAT_B8G8R8A8_UNORM, fetch_texel_1d_f_argb8888, fetch_texel_2d_f_argb8888, fetch_texel_3d_f_argb8888 }, { - MESA_FORMAT_ARGB8888_REV, + MESA_FORMAT_A8R8G8B8_UNORM, fetch_texel_1d_f_argb8888_rev, fetch_texel_2d_f_argb8888_rev, fetch_texel_3d_f_argb8888_rev }, { - MESA_FORMAT_RGBX8888, + MESA_FORMAT_X8B8G8R8_UNORM, fetch_texel_1d_f_rgbx8888, fetch_texel_2d_f_rgbx8888, fetch_texel_3d_f_rgbx8888 }, { - MESA_FORMAT_RGBX8888_REV, + MESA_FORMAT_R8G8B8X8_UNORM, fetch_texel_1d_f_rgbx8888_rev, fetch_texel_2d_f_rgbx8888_rev, fetch_texel_3d_f_rgbx8888_rev }, { - MESA_FORMAT_XRGB8888, + MESA_FORMAT_B8G8R8X8_UNORM, fetch_texel_1d_f_xrgb8888, fetch_texel_2d_f_xrgb8888, fetch_texel_3d_f_xrgb8888 }, { - MESA_FORMAT_XRGB8888_REV, + MESA_FORMAT_X8R8G8B8_UNORM, fetch_texel_1d_f_xrgb8888_rev, fetch_texel_2d_f_xrgb8888_rev, fetch_texel_3d_f_xrgb8888_rev }, { - MESA_FORMAT_RGB888, + MESA_FORMAT_BGR_UNORM8, fetch_texel_1d_f_rgb888, fetch_texel_2d_f_rgb888, fetch_texel_3d_f_rgb888 }, { - MESA_FORMAT_BGR888, + MESA_FORMAT_RGB_UNORM8, fetch_texel_1d_f_bgr888, fetch_texel_2d_f_bgr888, fetch_texel_3d_f_bgr888 }, { - MESA_FORMAT_RGB565, + MESA_FORMAT_B5G6R5_UNORM, fetch_texel_1d_f_rgb565, fetch_texel_2d_f_rgb565, fetch_texel_3d_f_rgb565 }, { - MESA_FORMAT_RGB565_REV, + MESA_FORMAT_R5G6B5_UNORM, fetch_texel_1d_f_rgb565_rev, fetch_texel_2d_f_rgb565_rev, fetch_texel_3d_f_rgb565_rev }, { - MESA_FORMAT_ARGB4444, + MESA_FORMAT_B4G4R4A4_UNORM, fetch_texel_1d_f_argb4444, fetch_texel_2d_f_argb4444, fetch_texel_3d_f_argb4444 }, { - MESA_FORMAT_ARGB4444_REV, + MESA_FORMAT_A4R4G4B4_UNORM, fetch_texel_1d_f_argb4444_rev, fetch_texel_2d_f_argb4444_rev, fetch_texel_3d_f_argb4444_rev }, { - MESA_FORMAT_RGBA5551, + MESA_FORMAT_A1B5G5R5_UNORM, fetch_texel_1d_f_rgba5551, fetch_texel_2d_f_rgba5551, fetch_texel_3d_f_rgba5551 }, { - MESA_FORMAT_ARGB1555, + MESA_FORMAT_B5G5R5A1_UNORM, fetch_texel_1d_f_argb1555, fetch_texel_2d_f_argb1555, fetch_texel_3d_f_argb1555 }, { - MESA_FORMAT_ARGB1555_REV, + MESA_FORMAT_A1R5G5B5_UNORM, fetch_texel_1d_f_argb1555_rev, fetch_texel_2d_f_argb1555_rev, fetch_texel_3d_f_argb1555_rev }, { - MESA_FORMAT_AL44, + MESA_FORMAT_L4A4_UNORM, fetch_texel_1d_f_al44, fetch_texel_2d_f_al44, fetch_texel_3d_f_al44 }, { - MESA_FORMAT_AL88, + MESA_FORMAT_L8A8_UNORM, fetch_texel_1d_f_al88, fetch_texel_2d_f_al88, fetch_texel_3d_f_al88 }, { - MESA_FORMAT_AL88_REV, + MESA_FORMAT_A8L8_UNORM, fetch_texel_1d_f_al88_rev, fetch_texel_2d_f_al88_rev, fetch_texel_3d_f_al88_rev }, { - MESA_FORMAT_AL1616, + MESA_FORMAT_L16A16_UNORM, fetch_texel_1d_f_al1616, fetch_texel_2d_f_al1616, fetch_texel_3d_f_al1616 }, { - MESA_FORMAT_AL1616_REV, + MESA_FORMAT_A16L16_UNORM, fetch_texel_1d_f_al1616_rev, fetch_texel_2d_f_al1616_rev, fetch_texel_3d_f_al1616_rev }, { - MESA_FORMAT_RGB332, + MESA_FORMAT_B2G3R3_UNORM, fetch_texel_1d_f_rgb332, fetch_texel_2d_f_rgb332, fetch_texel_3d_f_rgb332 }, { - MESA_FORMAT_A8, + MESA_FORMAT_A_UNORM8, fetch_texel_1d_f_a8, fetch_texel_2d_f_a8, fetch_texel_3d_f_a8 }, { - MESA_FORMAT_A16, + MESA_FORMAT_A_UNORM16, fetch_texel_1d_f_a16, fetch_texel_2d_f_a16, fetch_texel_3d_f_a16 }, { - MESA_FORMAT_L8, + MESA_FORMAT_L_UNORM8, fetch_texel_1d_f_l8, fetch_texel_2d_f_l8, fetch_texel_3d_f_l8 }, { - MESA_FORMAT_L16, + MESA_FORMAT_L_UNORM16, fetch_texel_1d_f_l16, fetch_texel_2d_f_l16, fetch_texel_3d_f_l16 }, { - MESA_FORMAT_I8, + MESA_FORMAT_I_UNORM8, fetch_texel_1d_f_i8, fetch_texel_2d_f_i8, fetch_texel_3d_f_i8 }, { - MESA_FORMAT_I16, + MESA_FORMAT_I_UNORM16, fetch_texel_1d_f_i16, fetch_texel_2d_f_i16, fetch_texel_3d_f_i16 @@ -335,115 +335,115 @@ texfetch_funcs[] = fetch_texel_3d_f_ycbcr_rev }, { - MESA_FORMAT_R8, + MESA_FORMAT_R_UNORM8, fetch_texel_1d_f_r8, fetch_texel_2d_f_r8, fetch_texel_3d_f_r8 }, { - MESA_FORMAT_GR88, + MESA_FORMAT_R8G8_UNORM, fetch_texel_1d_f_gr88, fetch_texel_2d_f_gr88, fetch_texel_3d_f_gr88 }, { - MESA_FORMAT_RG88, + MESA_FORMAT_G8R8_UNORM, fetch_texel_1d_f_rg88, fetch_texel_2d_f_rg88, fetch_texel_3d_f_rg88 }, { - MESA_FORMAT_R16, + MESA_FORMAT_R_UNORM16, fetch_texel_1d_f_r16, fetch_texel_2d_f_r16, fetch_texel_3d_f_r16 }, { - MESA_FORMAT_GR1616, + MESA_FORMAT_R16G16_UNORM, fetch_texel_1d_f_rg1616, fetch_texel_2d_f_rg1616, fetch_texel_3d_f_rg1616 }, { - MESA_FORMAT_RG1616, + MESA_FORMAT_G16R16_UNORM, fetch_texel_1d_f_rg1616_rev, fetch_texel_2d_f_rg1616_rev, fetch_texel_3d_f_rg1616_rev }, { - MESA_FORMAT_ARGB2101010, + MESA_FORMAT_B10G10R10A2_UNORM, fetch_texel_1d_f_argb2101010, fetch_texel_2d_f_argb2101010, fetch_texel_3d_f_argb2101010 }, { - MESA_FORMAT_Z24_S8, + MESA_FORMAT_S8_UINT_Z24_UNORM, fetch_texel_1d_f_z24_s8, fetch_texel_2d_f_z24_s8, fetch_texel_3d_f_z24_s8 }, { - MESA_FORMAT_S8_Z24, + MESA_FORMAT_Z24_UNORM_X8_UINT, fetch_texel_1d_f_s8_z24, fetch_texel_2d_f_s8_z24, fetch_texel_3d_f_s8_z24 }, { - MESA_FORMAT_Z16, + MESA_FORMAT_Z_UNORM16, fetch_texel_1d_f_z16, fetch_texel_2d_f_z16, fetch_texel_3d_f_z16 }, { - MESA_FORMAT_X8_Z24, + MESA_FORMAT_Z24_UNORM_S8_UINT, fetch_texel_1d_f_s8_z24, fetch_texel_2d_f_s8_z24, fetch_texel_3d_f_s8_z24 }, { - MESA_FORMAT_Z24_X8, + MESA_FORMAT_X8Z24_UNORM, fetch_texel_1d_f_z24_s8, fetch_texel_2d_f_z24_s8, fetch_texel_3d_f_z24_s8 }, { - MESA_FORMAT_Z32, + MESA_FORMAT_Z_UNORM32, fetch_texel_1d_f_z32, fetch_texel_2d_f_z32, fetch_texel_3d_f_z32 }, { - MESA_FORMAT_S8, + MESA_FORMAT_S_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_SRGB8, + MESA_FORMAT_BGR_SRGB8, fetch_texel_1d_srgb8, fetch_texel_2d_srgb8, fetch_texel_3d_srgb8 }, { - MESA_FORMAT_SRGBA8, + MESA_FORMAT_A8B8G8R8_SRGB, fetch_texel_1d_srgba8, fetch_texel_2d_srgba8, fetch_texel_3d_srgba8 }, { - MESA_FORMAT_SARGB8, + MESA_FORMAT_B8G8R8A8_SRGB, fetch_texel_1d_sargb8, fetch_texel_2d_sargb8, fetch_texel_3d_sargb8 }, { - MESA_FORMAT_SL8, + MESA_FORMAT_L_SRGB8, fetch_texel_1d_sl8, fetch_texel_2d_sl8, fetch_texel_3d_sl8 }, { - MESA_FORMAT_SLA8, + MESA_FORMAT_L8A8_SRGB, fetch_texel_1d_sla8, fetch_texel_2d_sla8, fetch_texel_3d_sla8 @@ -534,49 +534,49 @@ texfetch_funcs[] = fetch_texel_3d_f_rgb_f16 }, { - MESA_FORMAT_ALPHA_FLOAT32, + MESA_FORMAT_A_FLOAT32, fetch_texel_1d_f_alpha_f32, fetch_texel_2d_f_alpha_f32, fetch_texel_3d_f_alpha_f32 }, { - MESA_FORMAT_ALPHA_FLOAT16, + MESA_FORMAT_A_FLOAT16, fetch_texel_1d_f_alpha_f16, fetch_texel_2d_f_alpha_f16, fetch_texel_3d_f_alpha_f16 }, { - MESA_FORMAT_LUMINANCE_FLOAT32, + MESA_FORMAT_L_FLOAT32, fetch_texel_1d_f_luminance_f32, fetch_texel_2d_f_luminance_f32, fetch_texel_3d_f_luminance_f32 }, { - MESA_FORMAT_LUMINANCE_FLOAT16, + MESA_FORMAT_L_FLOAT16, fetch_texel_1d_f_luminance_f16, fetch_texel_2d_f_luminance_f16, fetch_texel_3d_f_luminance_f16 }, { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + MESA_FORMAT_LA_FLOAT32, fetch_texel_1d_f_luminance_alpha_f32, fetch_texel_2d_f_luminance_alpha_f32, fetch_texel_3d_f_luminance_alpha_f32 }, { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + MESA_FORMAT_LA_FLOAT16, fetch_texel_1d_f_luminance_alpha_f16, fetch_texel_2d_f_luminance_alpha_f16, fetch_texel_3d_f_luminance_alpha_f16 }, { - MESA_FORMAT_INTENSITY_FLOAT32, + MESA_FORMAT_I_FLOAT32, fetch_texel_1d_f_intensity_f32, fetch_texel_2d_f_intensity_f32, fetch_texel_3d_f_intensity_f32 }, { - MESA_FORMAT_INTENSITY_FLOAT16, + MESA_FORMAT_I_FLOAT16, fetch_texel_1d_f_intensity_f16, fetch_texel_2d_f_intensity_f16, fetch_texel_3d_f_intensity_f16 @@ -607,42 +607,42 @@ texfetch_funcs[] = }, { - MESA_FORMAT_ALPHA_UINT8, + MESA_FORMAT_A_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_ALPHA_UINT16, + MESA_FORMAT_A_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_ALPHA_UINT32, + MESA_FORMAT_A_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_ALPHA_INT8, + MESA_FORMAT_A_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_ALPHA_INT16, + MESA_FORMAT_A_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_ALPHA_INT32, + MESA_FORMAT_A_SINT32, NULL, NULL, NULL @@ -650,42 +650,42 @@ texfetch_funcs[] = { - MESA_FORMAT_INTENSITY_UINT8, + MESA_FORMAT_I_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_INTENSITY_UINT16, + MESA_FORMAT_I_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_INTENSITY_UINT32, + MESA_FORMAT_I_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_INTENSITY_INT8, + MESA_FORMAT_I_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_INTENSITY_INT16, + MESA_FORMAT_I_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_INTENSITY_INT32, + MESA_FORMAT_I_SINT32, NULL, NULL, NULL @@ -693,42 +693,42 @@ texfetch_funcs[] = { - MESA_FORMAT_LUMINANCE_UINT8, + MESA_FORMAT_L_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_UINT16, + MESA_FORMAT_L_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_UINT32, + MESA_FORMAT_L_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_INT8, + MESA_FORMAT_L_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_INT16, + MESA_FORMAT_L_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_INT32, + MESA_FORMAT_L_SINT32, NULL, NULL, NULL @@ -736,42 +736,42 @@ texfetch_funcs[] = { - MESA_FORMAT_LUMINANCE_ALPHA_UINT8, + MESA_FORMAT_LA_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_ALPHA_UINT16, + MESA_FORMAT_LA_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_ALPHA_UINT32, + MESA_FORMAT_LA_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT8, + MESA_FORMAT_LA_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT16, + MESA_FORMAT_LA_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_LUMINANCE_ALPHA_INT32, + MESA_FORMAT_LA_SINT32, NULL, NULL, NULL @@ -779,21 +779,21 @@ texfetch_funcs[] = { - MESA_FORMAT_R_INT8, + MESA_FORMAT_R_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RG_INT8, + MESA_FORMAT_RG_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_INT8, + MESA_FORMAT_RGB_SINT8, NULL, NULL, NULL @@ -801,55 +801,55 @@ texfetch_funcs[] = /* non-normalized, signed int */ { - MESA_FORMAT_RGBA_INT8, + MESA_FORMAT_RGBA_SINT8, fetch_texel_1d_rgba_int8, fetch_texel_2d_rgba_int8, fetch_texel_3d_rgba_int8 }, { - MESA_FORMAT_R_INT16, + MESA_FORMAT_R_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RG_INT16, + MESA_FORMAT_RG_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_INT16, + MESA_FORMAT_RGB_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_INT16, + MESA_FORMAT_RGBA_SINT16, fetch_texel_1d_rgba_int16, fetch_texel_2d_rgba_int16, fetch_texel_3d_rgba_int16 }, { - MESA_FORMAT_R_INT32, + MESA_FORMAT_R_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RG_INT32, + MESA_FORMAT_RG_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_INT32, + MESA_FORMAT_RGB_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_INT32, + MESA_FORMAT_RGBA_SINT32, fetch_texel_1d_rgba_int32, fetch_texel_2d_rgba_int32, fetch_texel_3d_rgba_int32 @@ -939,109 +939,109 @@ texfetch_funcs[] = /* signed, normalized */ { - MESA_FORMAT_SIGNED_R8, + MESA_FORMAT_R_SNORM8, fetch_texel_1d_signed_r8, fetch_texel_2d_signed_r8, fetch_texel_3d_signed_r8 }, { - MESA_FORMAT_SIGNED_RG88_REV, + MESA_FORMAT_R8G8_SNORM, fetch_texel_1d_signed_rg88_rev, fetch_texel_2d_signed_rg88_rev, fetch_texel_3d_signed_rg88_rev }, { - MESA_FORMAT_SIGNED_RGBX8888, + MESA_FORMAT_X8B8G8R8_SNORM, fetch_texel_1d_signed_rgbx8888, fetch_texel_2d_signed_rgbx8888, fetch_texel_3d_signed_rgbx8888 }, { - MESA_FORMAT_SIGNED_RGBA8888, + MESA_FORMAT_A8B8G8R8_SNORM, fetch_texel_1d_signed_rgba8888, fetch_texel_2d_signed_rgba8888, fetch_texel_3d_signed_rgba8888 }, { - MESA_FORMAT_SIGNED_RGBA8888_REV, + MESA_FORMAT_R8G8B8A8_SNORM, fetch_texel_1d_signed_rgba8888_rev, fetch_texel_2d_signed_rgba8888_rev, fetch_texel_3d_signed_rgba8888_rev }, { - MESA_FORMAT_SIGNED_R16, + MESA_FORMAT_R_SNORM16, fetch_texel_1d_signed_r16, fetch_texel_2d_signed_r16, fetch_texel_3d_signed_r16 }, { - MESA_FORMAT_SIGNED_GR1616, + MESA_FORMAT_R16G16_SNORM, fetch_texel_1d_signed_rg1616, fetch_texel_2d_signed_rg1616, fetch_texel_3d_signed_rg1616 }, { - MESA_FORMAT_SIGNED_RGB_16, + MESA_FORMAT_RGB_SNORM16, fetch_texel_1d_signed_rgb_16, fetch_texel_2d_signed_rgb_16, fetch_texel_3d_signed_rgb_16 }, { - MESA_FORMAT_SIGNED_RGBA_16, + MESA_FORMAT_RGBA_SNORM16, fetch_texel_1d_signed_rgba_16, fetch_texel_2d_signed_rgba_16, fetch_texel_3d_signed_rgba_16 }, { - MESA_FORMAT_RGBA_16, + MESA_FORMAT_RGBA_UNORM16, fetch_texel_1d_rgba_16, fetch_texel_2d_rgba_16, fetch_texel_3d_rgba_16 }, { - MESA_FORMAT_RED_RGTC1, + MESA_FORMAT_R_RGTC1_UNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_SIGNED_RED_RGTC1, + MESA_FORMAT_R_RGTC1_SNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_RG_RGTC2, + MESA_FORMAT_RG_RGTC2_UNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_SIGNED_RG_RGTC2, + MESA_FORMAT_RG_RGTC2_SNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_L_LATC1, + MESA_FORMAT_L_LATC1_UNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_SIGNED_L_LATC1, + MESA_FORMAT_L_LATC1_SNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_LA_LATC2, + MESA_FORMAT_LA_LATC2_UNORM, fetch_compressed, fetch_compressed, fetch_compressed }, { - MESA_FORMAT_SIGNED_LA_LATC2, + MESA_FORMAT_LA_LATC2_SNORM, fetch_compressed, fetch_compressed, fetch_compressed @@ -1113,193 +1113,193 @@ texfetch_funcs[] = fetch_compressed }, { - MESA_FORMAT_SIGNED_A8, + MESA_FORMAT_A_SNORM8, fetch_texel_1d_signed_a8, fetch_texel_2d_signed_a8, fetch_texel_3d_signed_a8 }, { - MESA_FORMAT_SIGNED_L8, + MESA_FORMAT_L_SNORM8, fetch_texel_1d_signed_l8, fetch_texel_2d_signed_l8, fetch_texel_3d_signed_l8 }, { - MESA_FORMAT_SIGNED_AL88, + MESA_FORMAT_L8A8_SNORM, fetch_texel_1d_signed_al88, fetch_texel_2d_signed_al88, fetch_texel_3d_signed_al88 }, { - MESA_FORMAT_SIGNED_I8, + MESA_FORMAT_I_SNORM8, fetch_texel_1d_signed_i8, fetch_texel_2d_signed_i8, fetch_texel_3d_signed_i8 }, { - MESA_FORMAT_SIGNED_A16, + MESA_FORMAT_A_SNORM16, fetch_texel_1d_signed_a16, fetch_texel_2d_signed_a16, fetch_texel_3d_signed_a16 }, { - MESA_FORMAT_SIGNED_L16, + MESA_FORMAT_L_SNORM16, fetch_texel_1d_signed_l16, fetch_texel_2d_signed_l16, fetch_texel_3d_signed_l16 }, { - MESA_FORMAT_SIGNED_AL1616, + MESA_FORMAT_LA_SNORM16, fetch_texel_1d_signed_al1616, fetch_texel_2d_signed_al1616, fetch_texel_3d_signed_al1616 }, { - MESA_FORMAT_SIGNED_I16, + MESA_FORMAT_I_SNORM16, fetch_texel_1d_signed_i16, fetch_texel_2d_signed_i16, fetch_texel_3d_signed_i16 }, { - MESA_FORMAT_RGB9_E5_FLOAT, + MESA_FORMAT_R9G9B9E5_FLOAT, fetch_texel_1d_rgb9_e5, fetch_texel_2d_rgb9_e5, fetch_texel_3d_rgb9_e5 }, { - MESA_FORMAT_R11_G11_B10_FLOAT, + MESA_FORMAT_R11G11B10_FLOAT, fetch_texel_1d_r11_g11_b10f, fetch_texel_2d_r11_g11_b10f, fetch_texel_3d_r11_g11_b10f }, { - MESA_FORMAT_Z32_FLOAT, + MESA_FORMAT_Z_FLOAT32, fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */ fetch_texel_2d_f_r_f32, fetch_texel_3d_f_r_f32 }, { - MESA_FORMAT_Z32_FLOAT_X24S8, + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, fetch_texel_1d_z32f_x24s8, fetch_texel_2d_z32f_x24s8, fetch_texel_3d_z32f_x24s8 }, { - MESA_FORMAT_ARGB2101010_UINT, + MESA_FORMAT_B10G10R10A2_UINT, NULL, NULL, NULL }, { - MESA_FORMAT_ABGR2101010_UINT, + MESA_FORMAT_R10G10B10A2_UINT, NULL, NULL, NULL }, { - MESA_FORMAT_XRGB4444_UNORM, + MESA_FORMAT_B4G4R4X4_UNORM, NULL, NULL, NULL }, { - MESA_FORMAT_XRGB1555_UNORM, + MESA_FORMAT_B5G5R5X1_UNORM, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR8888_SNORM, + MESA_FORMAT_R8G8B8X8_SNORM, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR8888_SRGB, + MESA_FORMAT_R8G8B8X8_SRGB, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR8888_UINT, + MESA_FORMAT_RGBX_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR8888_SINT, + MESA_FORMAT_RGBX_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_XRGB2101010_UNORM, + MESA_FORMAT_B10G10R10X2_UNORM, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR16161616_UNORM, + MESA_FORMAT_RGBX_UNORM16, fetch_texel_1d_xbgr16161616_unorm, fetch_texel_2d_xbgr16161616_unorm, fetch_texel_3d_xbgr16161616_unorm }, { - MESA_FORMAT_XBGR16161616_SNORM, + MESA_FORMAT_RGBX_SNORM16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR16161616_FLOAT, + MESA_FORMAT_RGBX_FLOAT16, fetch_texel_1d_xbgr16161616_float, fetch_texel_2d_xbgr16161616_float, fetch_texel_3d_xbgr16161616_float }, { - MESA_FORMAT_XBGR16161616_UINT, + MESA_FORMAT_RGBX_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR16161616_SINT, + MESA_FORMAT_RGBX_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR32323232_FLOAT, + MESA_FORMAT_RGBX_FLOAT32, fetch_texel_1d_xbgr32323232_float, fetch_texel_2d_xbgr32323232_float, fetch_texel_3d_xbgr32323232_float }, { - MESA_FORMAT_XBGR32323232_UINT, + MESA_FORMAT_RGBX_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_XBGR32323232_SINT, + MESA_FORMAT_RGBX_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_ABGR2101010, + MESA_FORMAT_R10G10B10A2_UNORM, NULL, NULL, NULL }, { - MESA_FORMAT_SIGNED_RG88, + MESA_FORMAT_G8R8_SNORM, NULL, NULL, NULL }, { - MESA_FORMAT_SIGNED_RG1616, + MESA_FORMAT_G16R16_SNORM, NULL, NULL, NULL @@ -1314,11 +1314,11 @@ static void set_fetch_functions(const struct gl_sampler_object *samp, struct swrast_texture_image *texImage, GLuint dims) { - gl_format format = texImage->Base.TexFormat; + mesa_format format = texImage->Base.TexFormat; #ifdef DEBUG /* check that the table entries are sorted by format name */ - gl_format fmt; + mesa_format fmt; for (fmt = 0; fmt < MESA_FORMAT_COUNT; fmt++) { assert(texfetch_funcs[fmt].Name == fmt); } diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h index e2521b50c..f3048894e 100644 --- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h +++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h @@ -69,7 +69,7 @@ #endif -/* MESA_FORMAT_Z32 ***********************************************************/ +/* MESA_FORMAT_Z_UNORM32 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, * returning 1 GLfloat. @@ -83,7 +83,7 @@ static void FETCH(f_z32)( const struct swrast_texture_image *texImage, } -/* MESA_FORMAT_Z16 ***********************************************************/ +/* MESA_FORMAT_Z_UNORM16 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture, * returning 1 GLfloat. @@ -388,7 +388,7 @@ static void FETCH(f_rg_f16)( const struct swrast_texture_image *texImage, * Begin Hardware formats */ -/* MESA_FORMAT_RGBA8888 ******************************************************/ +/* MESA_FORMAT_A8B8G8R8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */ static void FETCH(f_rgba8888)( const struct swrast_texture_image *texImage, @@ -422,7 +422,7 @@ static void FETCH(f_rgba8888_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB8888 ******************************************************/ +/* MESA_FORMAT_B8G8R8A8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage, @@ -438,7 +438,7 @@ static void FETCH(f_argb8888)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB8888_REV **************************************************/ +/* MESA_FORMAT_A8R8G8B8_UNORM **************************************************/ /* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage, @@ -454,7 +454,7 @@ static void FETCH(f_argb8888_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBX8888 ******************************************************/ +/* MESA_FORMAT_X8B8G8R8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D rgbx8888 texture, return 4 GLfloats */ static void FETCH(f_rgbx8888)( const struct swrast_texture_image *texImage, @@ -486,7 +486,7 @@ static void FETCH(f_rgbx8888_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_XRGB8888 ******************************************************/ +/* MESA_FORMAT_B8G8R8X8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage, @@ -502,7 +502,7 @@ static void FETCH(f_xrgb8888)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_XRGB8888_REV **************************************************/ +/* MESA_FORMAT_X8R8G8B8_UNORM **************************************************/ /* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage, @@ -518,7 +518,7 @@ static void FETCH(f_xrgb8888_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGB888 ********************************************************/ +/* MESA_FORMAT_BGR_UNORM8 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, @@ -534,7 +534,7 @@ static void FETCH(f_rgb888)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_BGR888 ********************************************************/ +/* MESA_FORMAT_RGB_UNORM8 ********************************************************/ /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage, @@ -553,7 +553,7 @@ static void FETCH(f_bgr888)( const struct swrast_texture_image *texImage, /* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding) instead of slow (g << 2) * 255 / 252 (always rounds down) */ -/* MESA_FORMAT_RGB565 ********************************************************/ +/* MESA_FORMAT_B5G6R5_UNORM ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage, @@ -570,7 +570,7 @@ static void FETCH(f_rgb565)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGB565_REV ****************************************************/ +/* MESA_FORMAT_R5G6B5_UNORM ****************************************************/ /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage, @@ -587,7 +587,7 @@ static void FETCH(f_rgb565_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB4444 ******************************************************/ +/* MESA_FORMAT_B4G4R4A4_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage, @@ -604,7 +604,7 @@ static void FETCH(f_argb4444)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB4444_REV **************************************************/ +/* MESA_FORMAT_A4R4G4B4_UNORM **************************************************/ /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage, @@ -619,7 +619,7 @@ static void FETCH(f_argb4444_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA5551 ******************************************************/ +/* MESA_FORMAT_A1B5G5R5_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage, @@ -635,7 +635,7 @@ static void FETCH(f_rgba5551)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB1555 ******************************************************/ +/* MESA_FORMAT_B5G5R5A1_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage, @@ -652,7 +652,7 @@ static void FETCH(f_argb1555)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB1555_REV **************************************************/ +/* MESA_FORMAT_A1R5G5B5_UNORM **************************************************/ /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage, @@ -669,7 +669,7 @@ static void FETCH(f_argb1555_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_ARGB2101010 ***************************************************/ +/* MESA_FORMAT_B10G10R10A2_UNORM ***************************************************/ /* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage, @@ -686,7 +686,7 @@ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_GR88 **********************************************************/ +/* MESA_FORMAT_R8G8_UNORM **********************************************************/ /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ static void FETCH(f_gr88)( const struct swrast_texture_image *texImage, @@ -702,7 +702,7 @@ static void FETCH(f_gr88)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RG88 ******************************************************/ +/* MESA_FORMAT_G8R8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D rg88_rev texture, return 4 GLchans */ static void FETCH(f_rg88)( const struct swrast_texture_image *texImage, @@ -718,7 +718,7 @@ static void FETCH(f_rg88)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_AL44 **********************************************************/ +/* MESA_FORMAT_L4A4_UNORM **********************************************************/ /* Fetch texel from 1D, 2D or 3D al44 texture, return 4 GLchans */ static void FETCH(f_al44)( const struct swrast_texture_image *texImage, @@ -734,7 +734,7 @@ static void FETCH(f_al44)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_AL88 **********************************************************/ +/* MESA_FORMAT_L8A8_UNORM **********************************************************/ /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ static void FETCH(f_al88)( const struct swrast_texture_image *texImage, @@ -750,7 +750,7 @@ static void FETCH(f_al88)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_R8 ************************************************************/ +/* MESA_FORMAT_R_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ static void FETCH(f_r8)(const struct swrast_texture_image *texImage, @@ -766,7 +766,7 @@ static void FETCH(f_r8)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_R16 ***********************************************************/ +/* MESA_FORMAT_R_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D r16 texture, return 4 GLchans */ static void FETCH(f_r16)(const struct swrast_texture_image *texImage, @@ -782,7 +782,7 @@ static void FETCH(f_r16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_AL88_REV ******************************************************/ +/* MESA_FORMAT_A8L8_UNORM ******************************************************/ /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage, @@ -798,7 +798,7 @@ static void FETCH(f_al88_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_GR1616 ********************************************************/ +/* MESA_FORMAT_R16G16_UNORM ********************************************************/ /* Fetch texel from 1D, 2D or 3D rg1616 texture, return 4 GLchans */ static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage, @@ -814,7 +814,7 @@ static void FETCH(f_rg1616)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RG1616 ****************************************************/ +/* MESA_FORMAT_G16R16_UNORM ****************************************************/ /* Fetch texel from 1D, 2D or 3D rg1616_rev texture, return 4 GLchans */ static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage, @@ -830,7 +830,7 @@ static void FETCH(f_rg1616_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_AL1616 ********************************************************/ +/* MESA_FORMAT_L16A16_UNORM ********************************************************/ /* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */ static void FETCH(f_al1616)( const struct swrast_texture_image *texImage, @@ -846,7 +846,7 @@ static void FETCH(f_al1616)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_AL1616_REV ****************************************************/ +/* MESA_FORMAT_A16L16_UNORM ****************************************************/ /* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */ static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage, @@ -862,7 +862,7 @@ static void FETCH(f_al1616_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGB332 ********************************************************/ +/* MESA_FORMAT_B2G3R3_UNORM ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage, @@ -879,7 +879,7 @@ static void FETCH(f_rgb332)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_A8 ************************************************************/ +/* MESA_FORMAT_A_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ static void FETCH(f_a8)( const struct swrast_texture_image *texImage, @@ -895,7 +895,7 @@ static void FETCH(f_a8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_A16 ************************************************************/ +/* MESA_FORMAT_A_UNORM16 ************************************************************/ /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ static void FETCH(f_a16)( const struct swrast_texture_image *texImage, @@ -911,7 +911,7 @@ static void FETCH(f_a16)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_L8 ************************************************************/ +/* MESA_FORMAT_L_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ static void FETCH(f_l8)( const struct swrast_texture_image *texImage, @@ -927,7 +927,7 @@ static void FETCH(f_l8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_L16 ***********************************************************/ +/* MESA_FORMAT_L_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */ static void FETCH(f_l16)( const struct swrast_texture_image *texImage, @@ -943,7 +943,7 @@ static void FETCH(f_l16)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_I8 ************************************************************/ +/* MESA_FORMAT_I_UNORM8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ static void FETCH(f_i8)( const struct swrast_texture_image *texImage, @@ -959,7 +959,7 @@ static void FETCH(f_i8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_I16 ***********************************************************/ +/* MESA_FORMAT_I_UNORM16 ***********************************************************/ /* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */ static void FETCH(f_i16)( const struct swrast_texture_image *texImage, @@ -976,7 +976,7 @@ static void FETCH(f_i16)( const struct swrast_texture_image *texImage, /* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ -/* Note: component order is same as for MESA_FORMAT_RGB888 */ +/* Note: component order is same as for MESA_FORMAT_BGR_UNORM8 */ static void FETCH(srgb8)(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1042,7 +1042,7 @@ static void FETCH(sla8)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA_INT8 **************************************************/ +/* MESA_FORMAT_RGBA_SINT8 **************************************************/ static void FETCH(rgba_int8)(const struct swrast_texture_image *texImage, @@ -1058,7 +1058,7 @@ FETCH(rgba_int8)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA_INT16 **************************************************/ +/* MESA_FORMAT_RGBA_SINT16 **************************************************/ static void FETCH(rgba_int16)(const struct swrast_texture_image *texImage, @@ -1074,7 +1074,7 @@ FETCH(rgba_int16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA_INT32 **************************************************/ +/* MESA_FORMAT_RGBA_SINT32 **************************************************/ static void FETCH(rgba_int32)(const struct swrast_texture_image *texImage, @@ -1153,7 +1153,7 @@ static void FETCH(dudv8)(const struct swrast_texture_image *texImage, } -/* MESA_FORMAT_SIGNED_R8 ***********************************************/ +/* MESA_FORMAT_R_SNORM8 ***********************************************/ static void FETCH(signed_r8)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1168,7 +1168,7 @@ static void FETCH(signed_r8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_A8 ***********************************************/ +/* MESA_FORMAT_A_SNORM8 ***********************************************/ static void FETCH(signed_a8)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1183,7 +1183,7 @@ static void FETCH(signed_a8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_L8 ***********************************************/ +/* MESA_FORMAT_L_SNORM8 ***********************************************/ static void FETCH(signed_l8)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1198,7 +1198,7 @@ static void FETCH(signed_l8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_I8 ***********************************************/ +/* MESA_FORMAT_I_SNORM8 ***********************************************/ static void FETCH(signed_i8)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1213,7 +1213,7 @@ static void FETCH(signed_i8)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RG88_REV ***********************************************/ +/* MESA_FORMAT_R8G8_SNORM ***********************************************/ static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1228,7 +1228,7 @@ static void FETCH(signed_rg88_rev)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_AL88 ***********************************************/ +/* MESA_FORMAT_L8A8_SNORM ***********************************************/ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1243,7 +1243,7 @@ static void FETCH(signed_al88)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RGBX8888 ***********************************************/ +/* MESA_FORMAT_X8B8G8R8_SNORM ***********************************************/ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1258,7 +1258,7 @@ static void FETCH(signed_rgbx8888)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/ +/* MESA_FORMAT_A8B8G8R8_SNORM ***********************************************/ static void FETCH(signed_rgba8888)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1286,7 +1286,7 @@ static void FETCH(signed_rgba8888_rev)( const struct swrast_texture_image *texIm -/* MESA_FORMAT_SIGNED_R16 ***********************************************/ +/* MESA_FORMAT_R_SNORM16 ***********************************************/ static void FETCH(signed_r16)(const struct swrast_texture_image *texImage, @@ -1302,7 +1302,7 @@ FETCH(signed_r16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_A16 ***********************************************/ +/* MESA_FORMAT_A_SNORM16 ***********************************************/ static void FETCH(signed_a16)(const struct swrast_texture_image *texImage, @@ -1318,7 +1318,7 @@ FETCH(signed_a16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_L16 ***********************************************/ +/* MESA_FORMAT_L_SNORM16 ***********************************************/ static void FETCH(signed_l16)(const struct swrast_texture_image *texImage, @@ -1334,7 +1334,7 @@ FETCH(signed_l16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_I16 ***********************************************/ +/* MESA_FORMAT_I_SNORM16 ***********************************************/ static void FETCH(signed_i16)(const struct swrast_texture_image *texImage, @@ -1350,7 +1350,7 @@ FETCH(signed_i16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RG1616 ***********************************************/ +/* MESA_FORMAT_G16R16_SNORM ***********************************************/ static void FETCH(signed_rg1616)(const struct swrast_texture_image *texImage, @@ -1366,7 +1366,7 @@ FETCH(signed_rg1616)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_AL1616 ***********************************************/ +/* MESA_FORMAT_LA_SNORM16 ***********************************************/ static void FETCH(signed_al1616)(const struct swrast_texture_image *texImage, @@ -1382,7 +1382,7 @@ FETCH(signed_al1616)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RGB_16 ***********************************************/ +/* MESA_FORMAT_RGB_SNORM16 ***********************************************/ static void FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage, @@ -1398,7 +1398,7 @@ FETCH(signed_rgb_16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_SIGNED_RGBA_16 ***********************************************/ +/* MESA_FORMAT_RGBA_SNORM16 ***********************************************/ static void FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage, @@ -1415,7 +1415,7 @@ FETCH(signed_rgba_16)(const struct swrast_texture_image *texImage, -/* MESA_FORMAT_RGBA_16 ***********************************************/ +/* MESA_FORMAT_RGBA_UNORM16 ***********************************************/ static void FETCH(rgba_16)(const struct swrast_texture_image *texImage, @@ -1538,8 +1538,8 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLdouble scale = 1.0 / (GLdouble) 0xffffff; texel[0] = (GLfloat) (((*src) >> 8) * scale); - ASSERT(texImage->Base.TexFormat == MESA_FORMAT_Z24_S8 || - texImage->Base.TexFormat == MESA_FORMAT_Z24_X8); + ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_UINT_Z24_UNORM || + texImage->Base.TexFormat == MESA_FORMAT_X8Z24_UNORM); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } @@ -1556,8 +1556,8 @@ static void FETCH(f_s8_z24)( const struct swrast_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLdouble scale = 1.0 / (GLdouble) 0xffffff; texel[0] = (GLfloat) (((*src) & 0x00ffffff) * scale); - ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_Z24 || - texImage->Base.TexFormat == MESA_FORMAT_X8_Z24); + ASSERT(texImage->Base.TexFormat == MESA_FORMAT_Z24_UNORM_X8_UINT || + texImage->Base.TexFormat == MESA_FORMAT_Z24_UNORM_S8_UINT); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } @@ -1578,7 +1578,7 @@ static void FETCH(rgb9_e5)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_R11_G11_B10_FLOAT *********************************************/ +/* MESA_FORMAT_R11G11B10_FLOAT *********************************************/ static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1591,7 +1591,7 @@ static void FETCH(r11_g11_b10f)( const struct swrast_texture_image *texImage, -/* MESA_FORMAT_Z32_FLOAT_X24S8 ***********************************************/ +/* MESA_FORMAT_Z32_FLOAT_S8X24_UINT ***********************************************/ static void FETCH(z32f_x24s8)(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) diff --git a/mesalib/src/mesa/swrast/s_texfilter.c b/mesalib/src/mesa/swrast/s_texfilter.c index 312b9ce9b..c3fd900b4 100644 --- a/mesalib/src/mesa/swrast/s_texfilter.c +++ b/mesalib/src/mesa/swrast/s_texfilter.c @@ -1428,7 +1428,7 @@ opt_sample_rgb_2d(struct gl_context *ctx, ASSERT(samp->WrapS==GL_REPEAT); ASSERT(samp->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGB888); + ASSERT(img->TexFormat == MESA_FORMAT_BGR_UNORM8); ASSERT(swImg->_IsPowerOfTwo); (void) swImg; @@ -1473,7 +1473,7 @@ opt_sample_rgba_2d(struct gl_context *ctx, ASSERT(samp->WrapS==GL_REPEAT); ASSERT(samp->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888); + ASSERT(img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM); ASSERT(swImg->_IsPowerOfTwo); (void) swImg; @@ -1521,11 +1521,11 @@ sample_lambda_2d(struct gl_context *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: opt_sample_rgba_2d(ctx, samp, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1578,11 +1578,11 @@ sample_lambda_2d(struct gl_context *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: opt_sample_rgb_2d(ctx, samp, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: opt_sample_rgba_2d(ctx, samp, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -3760,9 +3760,9 @@ _swrast_choose_texture_sample_func( struct gl_context *ctx, sampler->WrapT == GL_REPEAT && swImg->_IsPowerOfTwo && img->Border == 0) { - if (img->TexFormat == MESA_FORMAT_RGB888) + if (img->TexFormat == MESA_FORMAT_BGR_UNORM8) func = &opt_sample_rgb_2d; - else if (img->TexFormat == MESA_FORMAT_RGBA8888) + else if (img->TexFormat == MESA_FORMAT_A8B8G8R8_UNORM) func = &opt_sample_rgba_2d; } diff --git a/mesalib/src/mesa/swrast/s_texrender.c b/mesalib/src/mesa/swrast/s_texrender.c index 751d7767b..d67e48ad3 100644 --- a/mesalib/src/mesa/swrast/s_texrender.c +++ b/mesalib/src/mesa/swrast/s_texrender.c @@ -33,7 +33,7 @@ update_wrapper(struct gl_context *ctx, struct gl_renderbuffer_attachment *att) struct gl_renderbuffer *rb = att->Renderbuffer; struct swrast_renderbuffer *srb = swrast_renderbuffer(rb); struct swrast_texture_image *swImage; - gl_format format; + mesa_format format; GLuint zOffset; (void) ctx; diff --git a/mesalib/src/mesa/swrast/s_triangle.c b/mesalib/src/mesa/swrast/s_triangle.c index 085021b58..00383fb84 100644 --- a/mesalib/src/mesa/swrast/s_triangle.c +++ b/mesalib/src/mesa/swrast/s_triangle.c @@ -136,7 +136,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ - ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ + ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \ if (!rb || !texture) { \ return; \ } @@ -194,7 +194,7 @@ _swrast_culltriangle( struct gl_context *ctx, const GLubyte *texture = (const GLubyte *) swImg->ImageSlices[0]; \ const GLint smask = texImg->Width - 1; \ const GLint tmask = texImg->Height - 1; \ - ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ + ASSERT(texImg->TexFormat == MESA_FORMAT_BGR_UNORM8); \ if (!rb || !texture) { \ return; \ } @@ -417,7 +417,7 @@ affine_span(struct gl_context *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -437,7 +437,7 @@ affine_span(struct gl_context *ctx, SWspan *span, return; } break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); @@ -466,7 +466,7 @@ affine_span(struct gl_context *ctx, SWspan *span, span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -486,7 +486,7 @@ affine_span(struct gl_context *ctx, SWspan *span, return; } break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); @@ -572,10 +572,10 @@ affine_span(struct gl_context *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_RGB888: \ + case MESA_FORMAT_BGR_UNORM8: \ info.tbytesline = texImg->Width * 3; \ break; \ - case MESA_FORMAT_RGBA8888: \ + case MESA_FORMAT_A8B8G8R8_UNORM: \ info.tbytesline = texImg->Width * 4; \ break; \ default: \ @@ -689,7 +689,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -709,7 +709,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, return; } break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); @@ -736,7 +736,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, case GL_LINEAR: switch (info->format) { - case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR_UNORM8: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -756,7 +756,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, return; } break; - case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_A8B8G8R8_UNORM: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); @@ -838,10 +838,10 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_RGB888: \ + case MESA_FORMAT_BGR_UNORM8: \ info.tbytesline = texImg->Width * 3; \ break; \ - case MESA_FORMAT_RGBA8888: \ + case MESA_FORMAT_A8B8G8R8_UNORM: \ info.tbytesline = texImg->Width * 4; \ break; \ default: \ @@ -887,7 +887,7 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, ASSERT(ctx->Depth.Test); \ ASSERT(!ctx->Depth.Mask); \ ASSERT(ctx->Depth.Func == GL_LESS); \ - assert(rb->Format == MESA_FORMAT_Z16); \ + assert(rb->Format == MESA_FORMAT_Z_UNORM16); \ if (!q) { \ return; \ } @@ -1025,7 +1025,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) ctx->Depth.Func == GL_LESS && !ctx->Stencil._Enabled && depthRb && - depthRb->Format == MESA_FORMAT_Z16) { + depthRb->Format == MESA_FORMAT_Z_UNORM16) { if (ctx->Color.ColorMask[0][0] == 0 && ctx->Color.ColorMask[0][1] == 0 && ctx->Color.ColorMask[0][2] == 0 && @@ -1050,7 +1050,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) const struct gl_texture_image *texImg; const struct swrast_texture_image *swImg; GLenum minFilter, magFilter, envMode; - gl_format format; + mesa_format format; texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; if (ctx->Texture.Unit[0].Sampler) samp = ctx->Texture.Unit[0].Sampler; @@ -1080,7 +1080,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) && texImg->Border == 0 && (_mesa_format_row_stride(format, texImg->Width) == swImg->RowStride) - && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888) + && (format == MESA_FORMAT_BGR_UNORM8 || format == MESA_FORMAT_A8B8G8R8_UNORM) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR && !swrast->_FogEnabled @@ -1088,7 +1088,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) && ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) { if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { if (minFilter == GL_NEAREST - && format == MESA_FORMAT_RGB888 + && format == MESA_FORMAT_BGR_UNORM8 && (envMode == GL_REPLACE || envMode == GL_DECAL) && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) && ctx->Depth.Func == GL_LESS @@ -1107,7 +1107,7 @@ _swrast_choose_triangle( struct gl_context *ctx ) #if CHAN_BITS != 8 USE(general_triangle); #else - if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) { + if (format == MESA_FORMAT_A8B8G8R8_UNORM && !_mesa_little_endian()) { /* We only handle RGBA8888 correctly on little endian * in the optimized code above. */ diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c index 16aee3be7..b316f097d 100644 --- a/mesalib/src/mesa/vbo/vbo_exec_array.c +++ b/mesalib/src/mesa/vbo/vbo_exec_array.c @@ -287,15 +287,15 @@ static void check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, const void *elements, GLint basevertex) { - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; const void *elemMap; GLint i, k; - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) { + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) { elemMap = ctx->Driver.MapBufferRange(ctx, 0, - ctx->Array.ArrayObj->ElementArrayBufferObj->Size, + ctx->Array.VAO->IndexBufferObj->Size, GL_MAP_READ_BIT, - ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Array.VAO->IndexBufferObj); elements = ADD_POINTERS(elements, elemMap); } @@ -318,17 +318,17 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType, } /* check element j of each enabled array */ - for (k = 0; k < Elements(arrayObj->_VertexAttrib); k++) { - check_array_data(ctx, &arrayObj->_VertexAttrib[k], k, j); + for (k = 0; k < Elements(vao->_VertexAttrib); k++) { + check_array_data(ctx, &vao->_VertexAttrib[k], k, j); } } - if (_mesa_is_bufferobj(arrayObj->ElementArrayBufferObj)) { - ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); + if (_mesa_is_bufferobj(vao->IndexBufferObj)) { + ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj); } - for (k = 0; k < Elements(arrayObj->_VertexAttrib); k++) { - unmap_array_buffer(ctx, &arrayObj->_VertexAttrib[k]); + for (k = 0; k < Elements(vao->_VertexAttrib); k++) { + unmap_array_buffer(ctx, &vao->_VertexAttrib[k]); } } @@ -352,7 +352,7 @@ print_draw_arrays(struct gl_context *ctx, { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_array_object *arrayObj = ctx->Array.ArrayObj; + struct gl_vertex_array_object *vao = ctx->Array.VAO; int i; printf("vbo_exec_DrawArrays(mode 0x%x, start %d, count %d):\n", @@ -368,7 +368,7 @@ print_draw_arrays(struct gl_context *ctx, exec->array.inputs[i]->Size, stride, /*exec->array.inputs[i]->Enabled,*/ - arrayObj->_VertexAttrib[VERT_ATTRIB_FF(i)].Enabled, + vao->_VertexAttrib[VERT_ATTRIB_FF(i)].Enabled, exec->array.inputs[i]->Ptr, bufName); @@ -405,7 +405,7 @@ recalculate_input_bindings(struct gl_context *ctx) { struct vbo_context *vbo = vbo_context(ctx); struct vbo_exec_context *exec = &vbo->exec; - struct gl_client_array *vertexAttrib = ctx->Array.ArrayObj->_VertexAttrib; + struct gl_client_array *vertexAttrib = ctx->Array.VAO->_VertexAttrib; const struct gl_client_array **inputs = &exec->array.inputs[0]; GLbitfield64 const_inputs = 0x0; GLuint i; @@ -883,15 +883,15 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLvoid *map = ctx->Driver.MapBufferRange(ctx, 0, - ctx->Array.ArrayObj->ElementArrayBufferObj->Size, + ctx->Array.VAO->IndexBufferObj->Size, GL_MAP_READ_BIT, - ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Array.VAO->IndexBufferObj); switch (type) { case GL_UNSIGNED_BYTE: { const GLubyte *us = (const GLubyte *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size; i++) { + for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size; i++) { printf("%02x ", us[i]); if (i % 32 == 31) printf("\n"); @@ -903,7 +903,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLushort *us = (const GLushort *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 2; i++) { + for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 2; i++) { printf("%04x ", us[i]); if (i % 16 == 15) printf("\n"); @@ -915,7 +915,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) { const GLuint *us = (const GLuint *) map; GLint i; - for (i = 0; i < ctx->Array.ArrayObj->ElementArrayBufferObj->Size / 4; i++) { + for (i = 0; i < ctx->Array.VAO->IndexBufferObj->Size / 4; i++) { printf("%08x ", us[i]); if (i % 8 == 7) printf("\n"); @@ -927,7 +927,7 @@ dump_element_buffer(struct gl_context *ctx, GLenum type) ; } - ctx->Driver.UnmapBuffer(ctx, ctx->Array.ArrayObj->ElementArrayBufferObj); + ctx->Driver.UnmapBuffer(ctx, ctx->Array.VAO->IndexBufferObj); } #endif @@ -955,7 +955,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, ib.count = count; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = indices; prim[0].begin = 1; @@ -1041,7 +1041,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, /* _MaxElement was computed, so we can use it. * This path is used for drivers which need strict bounds checking. */ - max_element = ctx->Array.ArrayObj->_MaxElement; + max_element = ctx->Array.VAO->_MaxElement; } else { /* Generally, hardware drivers don't need to know the buffer bounds @@ -1097,7 +1097,7 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, "(start %u, end %u, type 0x%x, count %d) ElemBuf %u, " "base %d\n", start, end, type, count, - ctx->Array.ArrayObj->ElementArrayBufferObj->Name, + ctx->Array.VAO->IndexBufferObj->Name, basevertex); } @@ -1350,13 +1350,13 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, * subranges of the index buffer as one large index buffer may lead to * us reading unmapped memory. */ - if (!_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) + if (!_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) fallback = GL_TRUE; if (!fallback) { ib.count = (max_index_ptr - min_index_ptr) / index_type_size; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = (void *)min_index_ptr; for (i = 0; i < primcount; i++) { @@ -1387,7 +1387,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, continue; ib.count = count[i]; ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = indices[i]; prim[0].begin = 1; @@ -1657,7 +1657,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx, ib.count = 0; /* unknown */ ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = NULL; memset(prim, 0, sizeof(prim)); @@ -1701,11 +1701,11 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx, vbo_bind_arrays(ctx); - /* NOTE: ElementArrayBufferObj is guaranteed to be a VBO. */ + /* NOTE: IndexBufferObj is guaranteed to be a VBO. */ ib.count = 0; /* unknown */ ib.type = type; - ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj; + ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = NULL; prim[0].begin = 1; diff --git a/mesalib/src/mesa/vbo/vbo_save_api.c b/mesalib/src/mesa/vbo/vbo_save_api.c index 43243e606..98ab68623 100644 --- a/mesalib/src/mesa/vbo/vbo_save_api.c +++ b/mesalib/src/mesa/vbo/vbo_save_api.c @@ -1138,9 +1138,9 @@ _save_OBE_DrawElements(GLenum mode, GLsizei count, GLenum type, _ae_map_vbos(ctx); - if (_mesa_is_bufferobj(ctx->Array.ArrayObj->ElementArrayBufferObj)) + if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) indices = - ADD_POINTERS(ctx->Array.ArrayObj->ElementArrayBufferObj->Pointer, indices); + ADD_POINTERS(ctx->Array.VAO->IndexBufferObj->Pointer, indices); vbo_save_NotifyBegin(ctx, (mode | VBO_SAVE_PRIM_WEAK | VBO_SAVE_PRIM_NO_CURRENT_UPDATE)); |