diff options
Diffstat (limited to 'mesalib')
41 files changed, 1763 insertions, 2078 deletions
diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 3f752664b..c5042f93e 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -285,18 +285,15 @@ dnl Can't have static and shared libraries, default to static if user dnl explicitly requested. If both disabled, set to static since shared dnl was explicitly requested. case "x$enable_static$enable_shared" in -xyesyes ) - AC_MSG_WARN([Cannot build static and shared libraries, disabling shared]) - enable_shared=no +xnoyes ) ;; -xnono ) - AC_MSG_WARN([Cannot disable both static and shared libraries, enabling static]) - enable_static=yes +* ) + AC_MSG_WARN([Messa build supports only shared libraries, enabling shared]) + enable_shared=yes + enable_static=no ;; esac -AM_CONDITIONAL(BUILD_SHARED, test "x$enable_shared" = xyes) - dnl dnl other compiler options dnl @@ -317,27 +314,33 @@ if test "x$enable_debug" = xyes; then fi dnl +dnl compatibility symlinks +dnl +case "$host_os" in +linux* ) + HAVE_COMPAT_SYMLINKS=yes ;; +* ) + HAVE_COMPAT_SYMLINKS=no ;; +esac + +AM_CONDITIONAL(HAVE_COMPAT_SYMLINKS, test "x$HAVE_COMPAT_SYMLINKS" = xyes) + +dnl dnl library names dnl -LIB_PREFIX_GLOB='lib' -LIB_VERSION_SEPARATOR='.' -if test "$enable_static" = yes; then - LIB_EXTENSION='a' -else - case "$host_os" in - darwin* ) - LIB_EXTENSION='dylib' ;; - cygwin* ) - dnl prefix can be 'cyg' or 'lib' - LIB_PREFIX_GLOB='???' - LIB_VERSION_SEPARATOR='-' - LIB_EXTENSION='dll' ;; - aix* ) - LIB_EXTENSION='a' ;; - * ) - LIB_EXTENSION='so' ;; - esac -fi +case "$host_os" in +darwin* ) + LIB_EXT='dylib' ;; +cygwin* ) + LIB_EXT='dll' ;; +aix* ) + LIB_EXT='a' ;; +* ) + LIB_EXT='so' ;; +esac + +AC_SUBST([LIB_EXT]) + AC_ARG_WITH([gl-lib-name], [AS_HELP_STRING([--with-gl-lib-name@<:@=NAME@:>@], [specify GL library name @<:@default=GL@:>@])], @@ -383,37 +386,6 @@ if test "x$enable_texture_float" = xyes; then DEFINES="$DEFINES -DTEXTURE_FLOAT_ENABLED" fi -GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION} -OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} -EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION} -GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION} -GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION} -VG_LIB_NAME='lib$(VG_LIB).'${LIB_EXTENSION} -GLAPI_LIB_NAME='lib$(GLAPI_LIB).'${LIB_EXTENSION} - -GL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -EGL_LIB_GLOB=${LIB_PREFIX_GLOB}'$(EGL_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLESv1_CM_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv1_CM_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLESv2_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLESv2_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -VG_LIB_GLOB=${LIB_PREFIX_GLOB}'$(VG_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' -GLAPI_LIB_GLOB=${LIB_PREFIX_GLOB}'$(GLAPI_LIB)'${LIB_VERSION_SEPARATOR}'*'${LIB_EXTENSION}'*' - -AC_SUBST([GL_LIB_NAME]) -AC_SUBST([OSMESA_LIB_NAME]) -AC_SUBST([EGL_LIB_NAME]) -AC_SUBST([GLESv1_CM_LIB_NAME]) -AC_SUBST([GLESv2_LIB_NAME]) -AC_SUBST([VG_LIB_NAME]) -AC_SUBST([GLAPI_LIB_NAME]) - -AC_SUBST([GL_LIB_GLOB]) -AC_SUBST([EGL_LIB_GLOB]) -AC_SUBST([GLESv1_CM_LIB_GLOB]) -AC_SUBST([GLESv2_LIB_GLOB]) -AC_SUBST([VG_LIB_GLOB]) -AC_SUBST([GLAPI_LIB_GLOB]) - dnl dnl Arch/platform-specific settings dnl @@ -610,10 +582,8 @@ AC_ARG_ENABLE([omx], [enable_omx=no]) AC_ARG_ENABLE([opencl], [AS_HELP_STRING([--enable-opencl], - [enable OpenCL library NOTE: Enabling this option will also enable - --enable-llvm-shared-libs - @<:@default=no@:>@])], - [], + [enable OpenCL library @<:@default=no@:>@])], + [enable_opencl="$enableval"], [enable_opencl=no]) AC_ARG_ENABLE([opencl_icd], [AS_HELP_STRING([--enable-opencl-icd], @@ -804,11 +774,6 @@ PKG_CHECK_MODULES([LIBUDEV], [libudev >= $LIBUDEV_REQUIRED], have_libudev=yes, have_libudev=no) if test "x$enable_dri" = xyes; then - # DRI must be shared, I think - if test "$enable_static" = yes; then - AC_MSG_ERROR([Cannot use static libraries for DRI drivers]) - fi - # not a hard requirement as swrast does not depend on it if test "x$have_libdrm" = xyes; then DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" @@ -1140,12 +1105,7 @@ x16|x32) esac if test "x$enable_osmesa" = xyes -o "x$enable_gallium_osmesa" = xyes; then - # only link libraries with osmesa if shared - if test "$enable_static" = no; then - OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" - else - OSMESA_LIB_DEPS="" - fi + OSMESA_LIB_DEPS="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" OSMESA_MESA_DEPS="" OSMESA_PC_LIB_PRIV="-lm $PTHREAD_LIBS $SELINUX_LIBS $DLOPEN_LIBS" fi @@ -1194,11 +1154,8 @@ if test "x$enable_egl" = xyes; then AC_CHECK_FUNC(mincore, [DEFINES="$DEFINES -DHAVE_MINCORE"]) - if test "$enable_static" != yes; then - if test "x$enable_dri" = xyes; then - HAVE_EGL_DRIVER_DRI2=1 - fi - + if test "x$enable_dri" = xyes; then + HAVE_EGL_DRIVER_DRI2=1 fi fi AM_CONDITIONAL(HAVE_EGL, test "x$enable_egl" = xyes) @@ -1535,8 +1492,8 @@ AC_ARG_ENABLE([gallium-llvm], AC_ARG_ENABLE([llvm-shared-libs], [AS_HELP_STRING([--enable-llvm-shared-libs], [link with LLVM shared libraries @<:@default=enabled@:>@])], - [], - [with_llvm_shared_libs=yes]) + [enable_llvm_shared_libs="$enableval"], + [enable_llvm_shared_libs=yes]) AC_ARG_WITH([llvm-prefix], [AS_HELP_STRING([--with-llvm-prefix], @@ -1671,11 +1628,16 @@ AC_ARG_WITH([vdpau-libdir], [VDPAU_LIB_INSTALL_DIR='${libdir}/vdpau']) AC_SUBST([VDPAU_LIB_INSTALL_DIR]) +OMX_LIB_INSTALL_DIR_DEFAULT='' +if test "x$enable_omx" = xyes; then + OMX_LIB_INSTALL_DIR_DEFAULT=`$PKG_CONFIG --variable=pluginsdir libomxil-bellagio` +fi + AC_ARG_WITH([omx-libdir], [AS_HELP_STRING([--with-omx-libdir=DIR], [directory for the OMX libraries])], [OMX_LIB_INSTALL_DIR="$withval"], - [OMX_LIB_INSTALL_DIR=`$PKG_CONFIG --variable=pluginsdir libomxil-bellagio`]) + [OMX_LIB_INSTALL_DIR="$OMX_LIB_INSTALL_DIR_DEFAULT"]) AC_SUBST([OMX_LIB_INSTALL_DIR]) dnl Directory for OpenCL libs @@ -1873,7 +1835,7 @@ if test "x$MESA_LLVM" != x0; then LLVM_LIBS="`$LLVM_CONFIG --libs ${LLVM_COMPONENTS}`" - if test "x$with_llvm_shared_libs" = xyes; then + if test "x$enable_llvm_shared_libs" = xyes; then dnl We can't use $LLVM_VERSION because it has 'svn' stripped out, LLVM_SO_NAME=LLVM-`$LLVM_CONFIG --version` AS_IF([test -f "$LLVM_LIBDIR/lib$LLVM_SO_NAME.so"], [llvm_have_one_so=yes]) @@ -1890,18 +1852,17 @@ if test "x$MESA_LLVM" != x0; then and that your llvm libraries are installed in $LLVM_LIBDIR If you have installed your llvm libraries to a different directory you can use the --with-llvm-prefix= configure flag to specify this directory. - NOTE: Mesa is attempting to use llvm shared libraries because you have - passed one of the following options to configure: - --enable-llvm-shared-libs - --enable-opencl + NOTE: Mesa is attempting to use llvm shared libraries by default. If you do not want to build with llvm shared libraries and instead want to - use llvm static libraries then remove these options from your configure - invocation and reconfigure.])]) + use llvm static libraries then add --disable-llvm-shared-libs to your configure + invocation and rebuild.])]) dnl We don't need to update LLVM_LIBS in this case because the LLVM dnl install uses a shared object for each compoenent and we have dnl already added all of these objects to LLVM_LIBS. fi + else + AC_MSG_WARN([Building mesa with staticly linked LLVM may cause compilation issues]) fi fi diff --git a/mesalib/install-gallium-links.mk b/mesalib/install-gallium-links.mk new file mode 100644 index 000000000..5ee923b25 --- /dev/null +++ b/mesalib/install-gallium-links.mk @@ -0,0 +1,25 @@ +# Provide compatibility with scripts for the old Mesa build system for +# a while by putting a link to the driver into /lib of the build tree. + +if HAVE_COMPAT_SYMLINKS +all-local : .libs/install-gallium-links + +.libs/install-gallium-links : $(dri_LTLIBRARIES) $(vdpau_LTLIBRARIES) $(egl_LTLIBRARIES) $(lib_LTLIBRARIES) + $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ + link_dir=$(top_builddir)/$(LIB_DIR)/gallium; \ + if test x$(egl_LTLIBRARIES) != x; then \ + link_dir=$(top_builddir)/$(LIB_DIR)/egl; \ + fi; \ + $(MKDIR_P) $$link_dir; \ + file_list=$(dri_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ + file_list+=$(vdpau_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ + file_list+=$(egl_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ + file_list+=$(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); \ + for f in $$file_list; do \ + if test -h .libs/$$f; then \ + cp -d $$f $$link_dir; \ + else \ + ln -f $$f $$link_dir; \ + fi; \ + done && touch $@ +endif diff --git a/mesalib/install-lib-links.mk b/mesalib/install-lib-links.mk index 73d9e14e6..0e1371987 100644 --- a/mesalib/install-lib-links.mk +++ b/mesalib/install-lib-links.mk @@ -1,14 +1,16 @@ # Provide compatibility with scripts for the old Mesa build system for # a while by putting a link to the driver into /lib of the build tree. +if HAVE_COMPAT_SYMLINKS all-local : .libs/install-mesa-links .libs/install-mesa-links : $(lib_LTLIBRARIES) - $(MKDIR_P) $(top_builddir)/$(LIB_DIR) - for f in $(lib_LTLIBRARIES:%.la=.libs/%.so*); do \ + $(AM_V_GEN)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); \ + for f in $(lib_LTLIBRARIES:%.la=.libs/%.$(LIB_EXT)*); do \ if test -h .libs/$$f; then \ cp -d $$f $(top_builddir)/$(LIB_DIR); \ else \ ln -f $$f $(top_builddir)/$(LIB_DIR); \ fi; \ done && touch $@ +endif diff --git a/mesalib/src/gallium/auxiliary/Makefile.am b/mesalib/src/gallium/auxiliary/Makefile.am index 2d2d8d484..727ed1f98 100644 --- a/mesalib/src/gallium/auxiliary/Makefile.am +++ b/mesalib/src/gallium/auxiliary/Makefile.am @@ -32,17 +32,17 @@ libgallium_la_SOURCES += \ endif indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py - $(MKDIR_P) indices + $(AM_V_at)$(MKDIR_P) indices $(AM_V_GEN) $(PYTHON2) $< > $@ indices/u_unfilled_gen.c: $(srcdir)/indices/u_unfilled_gen.py - $(MKDIR_P) indices + $(AM_V_at)$(MKDIR_P) indices $(AM_V_GEN) $(PYTHON2) $< > $@ util/u_format_srgb.c: $(srcdir)/util/u_format_srgb.py - $(MKDIR_P) util + $(AM_V_at)$(MKDIR_P) util $(AM_V_GEN) $(PYTHON2) $< > $@ util/u_format_table.c: $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format_pack.py $(srcdir)/util/u_format_parse.py $(srcdir)/util/u_format.csv - $(MKDIR_P) util + $(AM_V_at)$(MKDIR_P) util $(AM_V_GEN) $(PYTHON2) $(srcdir)/util/u_format_table.py $(srcdir)/util/u_format.csv > $@ diff --git a/mesalib/src/gallium/auxiliary/hud/hud_context.c b/mesalib/src/gallium/auxiliary/hud/hud_context.c index 465013cb8..ccf020bed 100644 --- a/mesalib/src/gallium/auxiliary/hud/hud_context.c +++ b/mesalib/src/gallium/auxiliary/hud/hud_context.c @@ -454,7 +454,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex) cso_set_depth_stencil_alpha(cso, &hud->dsa); cso_set_rasterizer(cso, &hud->rasterizer); cso_set_viewport(cso, &viewport); - cso_set_stream_outputs(cso, 0, NULL, 0); + cso_set_stream_outputs(cso, 0, NULL, NULL); cso_set_geometry_shader_handle(cso, NULL); cso_set_vertex_shader_handle(cso, hud->vs); cso_set_vertex_elements(cso, 2, hud->velems); diff --git a/mesalib/src/gallium/auxiliary/util/u_blit.c b/mesalib/src/gallium/auxiliary/util/u_blit.c index dd33eb083..4b25b93dd 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blit.c +++ b/mesalib/src/gallium/auxiliary/util/u_blit.c @@ -537,7 +537,7 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_set_sample_mask(ctx->cso, ~0); cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); - cso_set_stream_outputs(ctx->cso, 0, NULL, 0); + cso_set_stream_outputs(ctx->cso, 0, NULL, NULL); /* sampler */ ctx->sampler.normalized_coords = normalized; diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index 66b511eb5..1e7f374ab 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -472,9 +472,12 @@ static void blitter_restore_vertex_states(struct blitter_context_priv *ctx) /* Stream outputs. */ if (ctx->has_stream_out) { + unsigned offsets[PIPE_MAX_SO_BUFFERS]; + for (i = 0; i < ctx->base.saved_num_so_targets; i++) + offsets[i] = (unsigned)-1; pipe->set_stream_output_targets(pipe, ctx->base.saved_num_so_targets, - ctx->base.saved_so_targets, ~0); + ctx->base.saved_so_targets, offsets); for (i = 0; i < ctx->base.saved_num_so_targets; i++) pipe_so_target_reference(&ctx->base.saved_so_targets[i], NULL); @@ -1013,7 +1016,7 @@ static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx, if (ctx->has_geometry_shader) pipe->bind_gs_state(pipe, NULL); if (ctx->has_stream_out) - pipe->set_stream_output_targets(pipe, 0, NULL, 0); + pipe->set_stream_output_targets(pipe, 0, NULL, NULL); } static void blitter_draw(struct blitter_context_priv *ctx, @@ -1806,6 +1809,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, struct pipe_context *pipe = ctx->base.pipe; struct pipe_vertex_buffer vb; struct pipe_stream_output_target *so_target; + unsigned offsets[PIPE_MAX_SO_BUFFERS] = {0}; if (srcx >= src->width0 || dstx >= dst->width0) { @@ -1847,7 +1851,7 @@ void util_blitter_copy_buffer(struct blitter_context *blitter, pipe->bind_rasterizer_state(pipe, ctx->rs_discard_state); so_target = pipe->create_stream_output_target(pipe, dst, dstx, size); - pipe->set_stream_output_targets(pipe, 1, &so_target, 0); + pipe->set_stream_output_targets(pipe, 1, &so_target, offsets); util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4); @@ -1867,6 +1871,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter, struct pipe_context *pipe = ctx->base.pipe; struct pipe_vertex_buffer vb = {0}; struct pipe_stream_output_target *so_target; + unsigned offsets[PIPE_MAX_SO_BUFFERS] = {0}; assert(num_channels >= 1); assert(num_channels <= 4); @@ -1906,7 +1911,7 @@ void util_blitter_clear_buffer(struct blitter_context *blitter, pipe->bind_rasterizer_state(pipe, ctx->rs_discard_state); so_target = pipe->create_stream_output_target(pipe, dst, offset, size); - pipe->set_stream_output_targets(pipe, 1, &so_target, 0); + pipe->set_stream_output_targets(pipe, 1, &so_target, offsets); util_draw_arrays(pipe, PIPE_PRIM_POINTS, 0, size / 4); diff --git a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c index d3401a6cd..dad3ad2ec 100644 --- a/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/mesalib/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1578,7 +1578,7 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, cso_set_rasterizer(ctx->cso, &ctx->rasterizer); cso_set_sample_mask(ctx->cso, ~0); cso_set_vertex_elements(ctx->cso, 2, ctx->velem); - cso_set_stream_outputs(ctx->cso, 0, NULL, 0); + cso_set_stream_outputs(ctx->cso, 0, NULL, NULL); cso_set_render_condition(ctx->cso, NULL, FALSE, 0); set_fragment_shader(ctx, type, is_depth); diff --git a/mesalib/src/glsl/Makefile.am b/mesalib/src/glsl/Makefile.am index 27e180e0a..534eaa385 100644 --- a/mesalib/src/glsl/Makefile.am +++ b/mesalib/src/glsl/Makefile.am @@ -128,7 +128,9 @@ glsl_compiler_SOURCES = \ $(top_srcdir)/src/mesa/program/symbol_table.c \ $(GLSL_COMPILER_CXX_FILES) -glsl_compiler_LDADD = libglsl.la +glsl_compiler_LDADD = \ + libglsl.la \ + $(PTHREAD_LIBS) glsl_test_SOURCES = \ $(top_srcdir)/src/mesa/main/hash_table.c \ @@ -178,11 +180,11 @@ glsl_lexer.cpp: glsl_lexer.ll $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $< glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y - $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp + $(AM_V_at)$(MKDIR_P) glcpp $(AM_V_YACC) $(YACC) $(YFLAGS) -o $@ -p "glcpp_parser_" --defines=$(GLSL_BUILDDIR)/glcpp/glcpp-parse.h $< glcpp/glcpp-lex.c: glcpp/glcpp-lex.l - $(MKDIR_P) $(GLSL_BUILDDIR)/glcpp + $(AM_V_at)$(MKDIR_P) glcpp $(AM_V_LEX) $(LEX) $(LFLAGS) -o $@ $< # Only the parsers (specifically the header files generated at the same time) diff --git a/mesalib/src/glsl/ir_uniform.h b/mesalib/src/glsl/ir_uniform.h index 7508f795d..3508509d4 100644 --- a/mesalib/src/glsl/ir_uniform.h +++ b/mesalib/src/glsl/ir_uniform.h @@ -178,6 +178,12 @@ struct gl_uniform_storage { * an atomic counter. */ int atomic_buffer_index; + + /** + * The 'base location' for this uniform in the uniform remap table. For + * arrays this is the first element in the array. + */ + unsigned remap_location; }; #ifdef __cplusplus diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index 5114a0a65..b0daeab0b 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -799,6 +799,10 @@ link_assign_uniform_locations(struct gl_shader_program *prog) prog->UniformStorage = NULL; prog->NumUserUniformStorage = 0; + ralloc_free(prog->UniformRemapTable); + prog->UniformRemapTable = NULL; + prog->NumUniformRemapTable = 0; + if (prog->UniformHash != NULL) { prog->UniformHash->clear(); } else { @@ -911,19 +915,28 @@ link_assign_uniform_locations(struct gl_shader_program *prog) sizeof(prog->_LinkedShaders[i]->SamplerTargets)); } - /* Determine the size of the largest uniform array queryable via - * glGetUniformLocation. Using this as the location scale guarantees that - * there is enough "room" for the array index to be stored in the low order - * part of the uniform location. It also makes the locations be more - * tightly packed. - */ - unsigned max_array_size = 1; + /* Build the uniform remap table that is used to set/get uniform locations */ for (unsigned i = 0; i < num_user_uniforms; i++) { - if (uniforms[i].array_elements > max_array_size) - max_array_size = uniforms[i].array_elements; - } - prog->UniformLocationBaseScale = max_array_size; + /* how many new entries for this uniform? */ + const unsigned entries = MAX2(1, uniforms[i].array_elements); + + /* resize remap table to fit new entries */ + prog->UniformRemapTable = + reralloc(prog, + prog->UniformRemapTable, + gl_uniform_storage *, + prog->NumUniformRemapTable + entries); + + /* set pointers for this uniform */ + for (unsigned j = 0; j < entries; j++) + prog->UniformRemapTable[prog->NumUniformRemapTable+j] = &uniforms[i]; + + /* set the base location in remap table for the uniform */ + uniforms[i].remap_location = prog->NumUniformRemapTable; + + prog->NumUniformRemapTable += entries; + } #ifndef NDEBUG for (unsigned i = 0; i < num_user_uniforms; i++) { diff --git a/mesalib/src/mapi/glapi/gen/ARB_robustness.xml b/mesalib/src/mapi/glapi/gen/ARB_robustness.xml index 14048bf49..65843149c 100644 --- a/mesalib/src/mapi/glapi/gen/ARB_robustness.xml +++ b/mesalib/src/mapi/glapi/gen/ARB_robustness.xml @@ -152,28 +152,28 @@ <!-- OpenGL 2.0 sized buffer queries --> <function name="GetnUniformfvARB" offset="assign"> - <param name="program" type="GLhandleARB"/> + <param name="program" type="GLuint"/> <param name="location" type="GLint"/> <param name="bufSize" type="GLsizei"/> <param name="params" type="GLfloat *" output="true"/> </function> <function name="GetnUniformivARB" offset="assign"> - <param name="program" type="GLhandleARB"/> + <param name="program" type="GLuint"/> <param name="location" type="GLint"/> <param name="bufSize" type="GLsizei"/> <param name="params" type="GLint *" output="true"/> </function> <function name="GetnUniformuivARB" offset="assign"> - <param name="program" type="GLhandleARB"/> + <param name="program" type="GLuint"/> <param name="location" type="GLint"/> <param name="bufSize" type="GLsizei"/> <param name="params" type="GLuint *" output="true"/> </function> <function name="GetnUniformdvARB" offset="assign"> - <param name="program" type="GLhandleARB"/> + <param name="program" type="GLuint"/> <param name="location" type="GLint"/> <param name="bufSize" type="GLsizei"/> <param name="params" type="GLdouble *" output="true"/> diff --git a/mesalib/src/mapi/glapi/gen/glapi_gen.mk b/mesalib/src/mapi/glapi/gen/glapi_gen.mk index 242ae5fd9..b8bb2f465 100644 --- a/mesalib/src/mapi/glapi/gen/glapi_gen.mk +++ b/mesalib/src/mapi/glapi/gen/glapi_gen.mk @@ -12,7 +12,7 @@ glapi_gen_mapi_deps := \ # $(1): path to an XML file # $(2): name of the printer define glapi_gen_mapi -@mkdir -p $(dir $@) +@$(MKDIR_P) $(dir $@) $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_mapi_script) \ --mode lib --printer $(2) $(1) > $@ endef @@ -23,7 +23,7 @@ glapi_gen_dispatch_deps := $(glapi_gen_common_deps) # $(1): path to an XML file # $(2): empty, es1, or es2 for entry point filtering define glapi_gen_dispatch -@mkdir -p $(dir $@) +@$(MKDIR_P) $(dir $@) $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_dispatch_script) \ -f $(1) -m remap_table $(if $(2),-c $(2),) > $@ endef @@ -34,7 +34,7 @@ glapi_gen_remap_deps := $(glapi_gen_common_deps) # $(1): path to an XML file # $(2): empty, es1, or es2 for entry point filtering define glapi_gen_remap -@mkdir -p $(dir $@) +@$(MKDIR_P) $(dir $@) $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS) $(glapi_gen_remap_script) \ -f $(1) $(if $(2),-c $(2),) > $@ endef diff --git a/mesalib/src/mesa/Makefile.am b/mesalib/src/mesa/Makefile.am index 16ac148af..0fdc8f315 100644 --- a/mesalib/src/mesa/Makefile.am +++ b/mesalib/src/mesa/Makefile.am @@ -150,11 +150,11 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc $(BUILDDIR)program/lex.yy.c: program/program_lexer.l - $(MKDIR_P) $(builddir)/program + $(AM_V_at)$(MKDIR_P) program $(AM_V_GEN) $(LEX) --never-interactive --outfile=$@ $< $(BUILDDIR)program/program_parse.tab.c $(BUILDDIR)program/program_parse.tab.h: program/program_parse.y - $(MKDIR_P) $(builddir)/program + $(AM_V_at)$(MKDIR_P) program $(AM_V_GEN) $(YACC) -p "_mesa_program_" -v -d --output=$(BUILDDIR)program/program_parse.tab.c $< if GEN_ASM_OFFSETS diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 030e1116e..76cbb41a9 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -100,7 +100,7 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, GLint ok, size; GLchar *info; - shader = _mesa_CreateShaderObjectARB(target); + shader = _mesa_CreateShader(target); _mesa_ShaderSource(shader, 1, &source, NULL); _mesa_CompileShader(shader); @@ -110,13 +110,13 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, _mesa_GetShaderiv(shader, GL_INFO_LOG_LENGTH, &size); if (size == 0) { - _mesa_DeleteObjectARB(shader); + _mesa_DeleteShader(shader); return 0; } info = malloc(size); if (!info) { - _mesa_DeleteObjectARB(shader); + _mesa_DeleteShader(shader); return 0; } @@ -127,7 +127,7 @@ _mesa_meta_compile_shader_with_debug(struct gl_context *ctx, GLenum target, info, source); free(info); - _mesa_DeleteObjectARB(shader); + _mesa_DeleteShader(shader); return 0; } @@ -241,11 +241,11 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx, vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source); fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source); - shader->shader_prog = _mesa_CreateProgramObjectARB(); + shader->shader_prog = _mesa_CreateProgram(); _mesa_AttachShader(shader->shader_prog, fs); - _mesa_DeleteObjectARB(fs); + _mesa_DeleteShader(fs); _mesa_AttachShader(shader->shader_prog, vs); - _mesa_DeleteObjectARB(vs); + _mesa_DeleteShader(vs); _mesa_BindAttribLocation(shader->shader_prog, 0, "position"); _mesa_BindAttribLocation(shader->shader_prog, 1, "texcoords"); _mesa_meta_link_program_with_debug(ctx, shader->shader_prog); @@ -733,6 +733,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) save->RasterDiscard = ctx->RasterDiscard; if (ctx->RasterDiscard) _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_FALSE); + + save->DrawBufferName = ctx->DrawBuffer->Name; + save->ReadBufferName = ctx->ReadBuffer->Name; + save->RenderbufferName = (ctx->CurrentRenderbuffer ? + ctx->CurrentRenderbuffer->Name : 0); } } @@ -1079,6 +1084,16 @@ _mesa_meta_end(struct gl_context *ctx) if (save->TransformFeedbackNeedsResume) _mesa_ResumeTransformFeedback(); + if (ctx->DrawBuffer->Name != save->DrawBufferName) + _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, save->DrawBufferName); + + if (ctx->ReadBuffer->Name != save->ReadBufferName) + _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, save->ReadBufferName); + + if (!ctx->CurrentRenderbuffer || + ctx->CurrentRenderbuffer->Name != save->RenderbufferName) + _mesa_BindRenderbuffer(GL_RENDERBUFFER, save->RenderbufferName); + ctx->Meta->SaveStackDepth--; ctx->API = save->API; @@ -1497,27 +1512,27 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) if (clear->ShaderProg != 0) return; - vs = _mesa_CreateShaderObjectARB(GL_VERTEX_SHADER); + vs = _mesa_CreateShader(GL_VERTEX_SHADER); _mesa_ShaderSource(vs, 1, &vs_source, NULL); _mesa_CompileShader(vs); if (_mesa_has_geometry_shaders(ctx)) { - gs = _mesa_CreateShaderObjectARB(GL_GEOMETRY_SHADER); + gs = _mesa_CreateShader(GL_GEOMETRY_SHADER); _mesa_ShaderSource(gs, 1, &gs_source, NULL); _mesa_CompileShader(gs); } - fs = _mesa_CreateShaderObjectARB(GL_FRAGMENT_SHADER); + fs = _mesa_CreateShader(GL_FRAGMENT_SHADER); _mesa_ShaderSource(fs, 1, &fs_source, NULL); _mesa_CompileShader(fs); - clear->ShaderProg = _mesa_CreateProgramObjectARB(); + clear->ShaderProg = _mesa_CreateProgram(); _mesa_AttachShader(clear->ShaderProg, fs); - _mesa_DeleteObjectARB(fs); + _mesa_DeleteShader(fs); if (gs != 0) _mesa_AttachShader(clear->ShaderProg, gs); _mesa_AttachShader(clear->ShaderProg, vs); - _mesa_DeleteObjectARB(vs); + _mesa_DeleteShader(vs); _mesa_BindAttribLocation(clear->ShaderProg, 0, "position"); _mesa_LinkProgram(clear->ShaderProg); @@ -1558,13 +1573,13 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) fs_int_source); ralloc_free(shader_source_mem_ctx); - clear->IntegerShaderProg = _mesa_CreateProgramObjectARB(); + clear->IntegerShaderProg = _mesa_CreateProgram(); _mesa_AttachShader(clear->IntegerShaderProg, fs); - _mesa_DeleteObjectARB(fs); + _mesa_DeleteShader(fs); if (gs != 0) _mesa_AttachShader(clear->IntegerShaderProg, gs); _mesa_AttachShader(clear->IntegerShaderProg, vs); - _mesa_DeleteObjectARB(vs); + _mesa_DeleteShader(vs); _mesa_BindAttribLocation(clear->IntegerShaderProg, 0, "position"); /* Note that user-defined out attributes get automatically assigned @@ -1584,7 +1599,7 @@ meta_glsl_clear_init(struct gl_context *ctx, struct clear_state *clear) } } if (gs != 0) - _mesa_DeleteObjectARB(gs); + _mesa_DeleteShader(gs); } static void @@ -1596,11 +1611,11 @@ meta_glsl_clear_cleanup(struct clear_state *clear) clear->VAO = 0; _mesa_DeleteBuffers(1, &clear->VBO); clear->VBO = 0; - _mesa_DeleteObjectARB(clear->ShaderProg); + _mesa_DeleteProgram(clear->ShaderProg); clear->ShaderProg = 0; if (clear->IntegerShaderProg) { - _mesa_DeleteObjectARB(clear->IntegerShaderProg); + _mesa_DeleteProgram(clear->IntegerShaderProg); clear->IntegerShaderProg = 0; } } @@ -2582,14 +2597,14 @@ choose_blit_shader(GLenum target, struct blit_shader_table *table) void _mesa_meta_blit_shader_table_cleanup(struct blit_shader_table *table) { - _mesa_DeleteObjectARB(table->sampler_1d.shader_prog); - _mesa_DeleteObjectARB(table->sampler_2d.shader_prog); - _mesa_DeleteObjectARB(table->sampler_3d.shader_prog); - _mesa_DeleteObjectARB(table->sampler_rect.shader_prog); - _mesa_DeleteObjectARB(table->sampler_cubemap.shader_prog); - _mesa_DeleteObjectARB(table->sampler_1d_array.shader_prog); - _mesa_DeleteObjectARB(table->sampler_2d_array.shader_prog); - _mesa_DeleteObjectARB(table->sampler_cubemap_array.shader_prog); + _mesa_DeleteProgram(table->sampler_1d.shader_prog); + _mesa_DeleteProgram(table->sampler_2d.shader_prog); + _mesa_DeleteProgram(table->sampler_3d.shader_prog); + _mesa_DeleteProgram(table->sampler_rect.shader_prog); + _mesa_DeleteProgram(table->sampler_cubemap.shader_prog); + _mesa_DeleteProgram(table->sampler_1d_array.shader_prog); + _mesa_DeleteProgram(table->sampler_2d_array.shader_prog); + _mesa_DeleteProgram(table->sampler_cubemap_array.shader_prog); table->sampler_1d.shader_prog = 0; table->sampler_2d.shader_prog = 0; @@ -2652,7 +2667,6 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format) } } - /** * Helper for _mesa_meta_CopyTexSubImage1/2/3D() functions. * Have to be careful with locking and meta state for pixel transfer. @@ -2786,8 +2800,6 @@ decompress_texture_image(struct gl_context *ctx, const GLenum target = texObj->Target; GLenum faceTarget; struct vertex verts[4]; - GLuint fboDrawSave, fboReadSave; - GLuint rbSave; GLuint samplerSave; const bool use_glsl_version = ctx->Extensions.ARB_vertex_shader && ctx->Extensions.ARB_fragment_shader; @@ -2821,11 +2833,6 @@ decompress_texture_image(struct gl_context *ctx, break; } - /* save fbo bindings (not saved by _mesa_meta_begin()) */ - fboDrawSave = ctx->DrawBuffer->Name; - fboReadSave = ctx->ReadBuffer->Name; - rbSave = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; - _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_PIXEL_STORE); samplerSave = ctx->Texture.Unit[ctx->Texture.CurrentUnit].Sampler ? @@ -2974,16 +2981,6 @@ decompress_texture_image(struct gl_context *ctx, _mesa_BindSampler(ctx->Texture.CurrentUnit, samplerSave); _mesa_meta_end(ctx); - - /* restore fbo bindings */ - if (fboDrawSave == fboReadSave) { - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboDrawSave); - } - else { - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, fboDrawSave); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER_EXT, fboReadSave); - } - _mesa_BindRenderbuffer(GL_RENDERBUFFER_EXT, rbSave); } diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index 6029a775c..e2ccb939e 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -177,6 +177,8 @@ struct save_state GLboolean Lighting; GLboolean RasterDiscard; GLboolean TransformFeedbackNeedsResume; + + GLuint DrawBufferName, ReadBufferName, RenderbufferName; }; /** diff --git a/mesalib/src/mesa/drivers/common/meta_blit.c b/mesalib/src/mesa/drivers/common/meta_blit.c index 907c2cdf3..31e494fb8 100644 --- a/mesalib/src/mesa/drivers/common/meta_blit.c +++ b/mesalib/src/mesa/drivers/common/meta_blit.c @@ -325,11 +325,11 @@ setup_glsl_msaa_blit_shader(struct gl_context *ctx, vs = _mesa_meta_compile_shader_with_debug(ctx, GL_VERTEX_SHADER, vs_source); fs = _mesa_meta_compile_shader_with_debug(ctx, GL_FRAGMENT_SHADER, fs_source); - blit->msaa_shaders[shader_index] = _mesa_CreateProgramObjectARB(); + blit->msaa_shaders[shader_index] = _mesa_CreateProgram(); _mesa_AttachShader(blit->msaa_shaders[shader_index], fs); - _mesa_DeleteObjectARB(fs); + _mesa_DeleteShader(fs); _mesa_AttachShader(blit->msaa_shaders[shader_index], vs); - _mesa_DeleteObjectARB(vs); + _mesa_DeleteShader(vs); _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 0, "position"); _mesa_BindAttribLocation(blit->msaa_shaders[shader_index], 1, "texcoords"); _mesa_meta_link_program_with_debug(ctx, blit->msaa_shaders[shader_index]); diff --git a/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c b/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c index 3db073ab1..d62819c4c 100644 --- a/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c +++ b/mesalib/src/mesa/drivers/common/meta_generate_mipmap.c @@ -194,7 +194,6 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, const GLuint maxLevel = texObj->MaxLevel; const GLint maxLevelSave = texObj->MaxLevel; const GLboolean genMipmapSave = texObj->GenerateMipmap; - const GLuint fboSave = ctx->DrawBuffer->Name; const GLuint currentTexUnitSave = ctx->Texture.CurrentUnit; const GLboolean use_glsl_version = ctx->Extensions.ARB_vertex_shader && ctx->Extensions.ARB_fragment_shader; @@ -378,6 +377,4 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); if (genMipmapSave) _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave); - - _mesa_BindFramebuffer(GL_FRAMEBUFFER_EXT, fboSave); } diff --git a/mesalib/src/mesa/drivers/dri/Makefile.am b/mesalib/src/mesa/drivers/dri/Makefile.am index a85a5aa91..17ac76be1 100644 --- a/mesalib/src/mesa/drivers/dri/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/Makefile.am @@ -9,37 +9,37 @@ SUBDIRS+=common if HAVE_I915_DRI SUBDIRS += i915 MEGADRIVERS_DEPS += i915/libi915_dri.la -MEGADRIVERS += i915_dri.so +MEGADRIVERS += i915_dri.@LIB_EXT@ endif if HAVE_I965_DRI SUBDIRS += i965 MEGADRIVERS_DEPS += i965/libi965_dri.la -MEGADRIVERS += i965_dri.so +MEGADRIVERS += i965_dri.@LIB_EXT@ endif if HAVE_NOUVEAU_DRI SUBDIRS += nouveau MEGADRIVERS_DEPS += nouveau/libnouveau_dri.la -MEGADRIVERS += nouveau_vieux_dri.so +MEGADRIVERS += nouveau_vieux_dri.@LIB_EXT@ endif if HAVE_R200_DRI SUBDIRS += r200 MEGADRIVERS_DEPS += r200/libr200_dri.la -MEGADRIVERS += r200_dri.so +MEGADRIVERS += r200_dri.@LIB_EXT@ endif if HAVE_RADEON_DRI SUBDIRS += radeon MEGADRIVERS_DEPS += radeon/libradeon_dri.la -MEGADRIVERS += radeon_dri.so +MEGADRIVERS += radeon_dri.@LIB_EXT@ endif if HAVE_SWRAST_DRI SUBDIRS += swrast MEGADRIVERS_DEPS += swrast/libswrast_dri.la -MEGADRIVERS += swrast_dri.so +MEGADRIVERS += swrast_dri.@LIB_EXT@ endif pkgconfigdir = $(libdir)/pkgconfig @@ -65,24 +65,26 @@ mesa_dri_drivers_la_LIBADD = \ if NEED_MEGADRIVER dri_LTLIBRARIES = mesa_dri_drivers.la +if HAVE_COMPAT_SYMLINKS # Add a link to allow setting LD_LIBRARY_PATH/LIBGL_DRIVERS_PATH to /lib of the build tree. all-local: mesa_dri_drivers.la - $(MKDIR_P) $(top_builddir)/$(LIB_DIR); - $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.so \ - $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so; + $(AM_V_at)$(MKDIR_P) $(top_builddir)/$(LIB_DIR); + $(AM_V_GEN)ln -f .libs/mesa_dri_drivers.@LIB_EXT@ \ + $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@; $(AM_V_GEN)for i in $(MEGADRIVERS); do \ - ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.so \ + ln -f $(top_builddir)/$(LIB_DIR)/mesa_dri_drivers.@LIB_EXT@ \ $(top_builddir)/$(LIB_DIR)/$$i; \ done; +endif # hardlink each megadriver instance, but don't actually have -# mesa_dri_drivers.so in the set of final installed files. +# mesa_dri_drivers.@LIB_EXT@ in the set of final installed files. install-data-hook: for i in $(MEGADRIVERS); do \ - ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so \ + ln -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ \ $(DESTDIR)$(dridir)/$$i; \ done; - $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.so + $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.@LIB_EXT@ $(RM) -f $(DESTDIR)$(dridir)/mesa_dri_drivers.la endif diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am index 0908c8264..57e604845 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile.am @@ -69,7 +69,7 @@ options.h: t_options.h $(MOS) @mo="$@"; \ lang=$${mo%%/*}; \ echo "Updating ($$lang) $@ from $?."; \ - mkdir -p $$lang/LC_MESSAGES; \ + $(MKDIR_P) $$lang/LC_MESSAGES; \ msgfmt -o $@ $? # Use this target to create or update .po files with new messages in diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index acab6cb8d..9fbd41746 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -1978,7 +1978,7 @@ _mesa_get_pack_ubyte_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; - table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = NULL; table[MESA_FORMAT_Z_UNORM32] = NULL; table[MESA_FORMAT_S_UINT8] = NULL; @@ -2144,7 +2144,7 @@ _mesa_get_pack_float_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = NULL; table[MESA_FORMAT_Z_UNORM16] = NULL; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = NULL; - table[MESA_FORMAT_X8Z24_UNORM] = NULL; + table[MESA_FORMAT_X8_UINT_Z24_UNORM] = NULL; table[MESA_FORMAT_Z_UNORM32] = NULL; table[MESA_FORMAT_S_UINT8] = NULL; @@ -2476,7 +2476,7 @@ _mesa_get_pack_float_z_func(mesa_format format) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: return pack_float_z_Z24_S8; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: @@ -2561,7 +2561,7 @@ _mesa_get_pack_uint_z_func(mesa_format format) { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: return pack_uint_z_Z24_S8; case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: @@ -2647,7 +2647,7 @@ _mesa_pack_float_z_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); @@ -2723,7 +2723,7 @@ _mesa_pack_uint_z_row(mesa_format format, GLuint n, { switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: { /* don't disturb the stencil values */ GLuint *d = ((GLuint *) dst); diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index 2348ef605..f85c875e4 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -2395,7 +2395,7 @@ get_unpack_rgba_function(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = unpack_S8_Z24; table[MESA_FORMAT_Z_UNORM16] = unpack_Z16; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = unpack_X8_Z24; - table[MESA_FORMAT_X8Z24_UNORM] = unpack_Z24_X8; + table[MESA_FORMAT_X8_UINT_Z24_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; @@ -4012,7 +4012,7 @@ _mesa_unpack_float_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: unpack = unpack_float_z_Z24_X8; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: @@ -4117,7 +4117,7 @@ _mesa_unpack_uint_z_row(mesa_format format, GLuint n, switch (format) { case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: unpack = unpack_uint_z_Z24_X8; break; case MESA_FORMAT_Z24_UNORM_S8_UINT: diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c index 0cf97fa31..c3e80491d 100644 --- a/mesalib/src/mesa/main/formats.c +++ b/mesalib/src/mesa/main/formats.c @@ -78,6 +78,7 @@ struct gl_format_info */ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { + /* Packed unorm formats */ { MESA_FORMAT_NONE, /* Name */ "MESA_FORMAT_NONE", /* StrName */ @@ -88,8 +89,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8B8G8R8_UNORM, /* Name */ - "MESA_FORMAT_A8B8G8R8_UNORM", /* 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,17 +98,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8G8B8A8_UNORM, /* Name */ - "MESA_FORMAT_R8G8B8A8_UNORM", /* StrName */ - GL_RGBA, /* BaseFormat */ + MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ + "MESA_FORMAT_X8B8G8R8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ - "MESA_FORMAT_B8G8R8A8_UNORM", /* 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 */ @@ -115,26 +116,26 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ - "MESA_FORMAT_A8R8G8B8_UNORM", /* StrName */ - GL_RGBA, /* BaseFormat */ + MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ + "MESA_FORMAT_R8G8B8X8_UNORM",/* StrName */ + GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_X8B8G8R8_UNORM, /* Name */ - "MESA_FORMAT_X8B8G8R8_UNORM", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_B8G8R8A8_UNORM, /* Name */ + "MESA_FORMAT_B8G8R8A8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R8G8B8X8_UNORM, /* Name */ - "MESA_FORMAT_R8G8B8X8_UNORM", /* 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 */ @@ -142,17 +143,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B8G8R8X8_UNORM, /* Name */ - "MESA_FORMAT_B8G8R8X8_UNORM", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_A8R8G8B8_UNORM, /* Name */ + "MESA_FORMAT_A8R8G8B8_UNORM",/* StrName */ + GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_X8R8G8B8_UNORM, /* Name */ - "MESA_FORMAT_X8R8G8B8_UNORM", /* 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,26 +161,26 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_BGR_UNORM8, /* Name */ - "MESA_FORMAT_BGR_UNORM8", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_L16A16_UNORM, /* Name */ + "MESA_FORMAT_L16A16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 3 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_RGB_UNORM8, /* Name */ - "MESA_FORMAT_RGB_UNORM8", /* StrName */ - GL_RGB, /* BaseFormat */ + MESA_FORMAT_A16L16_UNORM, /* Name */ + "MESA_FORMAT_A16L16_UNORM", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 3 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B5G6R5_UNORM, /* Name */ - "MESA_FORMAT_B5G6R5_UNORM", /* 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 +188,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_R5G6B5_UNORM, /* Name */ - "MESA_FORMAT_R5G6B5_UNORM", /* 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 +197,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B4G4R4A4_UNORM, /* Name */ - "MESA_FORMAT_B4G4R4A4_UNORM", /* 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 +206,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A4R4G4B4_UNORM, /* Name */ - "MESA_FORMAT_A4R4G4B4_UNORM", /* StrName */ + MESA_FORMAT_B4G4R4X4_UNORM, + "MESA_FORMAT_B4G4R4X4_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + 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 +224,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A1B5G5R5_UNORM, /* Name */ - "MESA_FORMAT_A1B5G5R5_UNORM", /* 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 +233,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B5G5R5A1_UNORM, /* Name */ - "MESA_FORMAT_B5G5R5A1_UNORM", /* 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 +242,17 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A1R5G5B5_UNORM, /* Name */ - "MESA_FORMAT_A1R5G5B5_UNORM", /* StrName */ + MESA_FORMAT_B5G5R5X1_UNORM, + "MESA_FORMAT_B5G5R5X1_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 5, 5, 5, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + 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,17 +260,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - 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 */ - 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 1 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_L8A8_UNORM, /* Name */ - "MESA_FORMAT_L8A8_UNORM", /* 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 +269,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A8L8_UNORM, /* Name */ - "MESA_FORMAT_A8L8_UNORM", /* 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,26 +278,35 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - 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 */ - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_R8G8_UNORM, + "MESA_FORMAT_R8G8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_UNORM, + "MESA_FORMAT_G8R8_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 }, { - MESA_FORMAT_A16L16_UNORM, /* Name */ - "MESA_FORMAT_A16L16_UNORM", /* StrName */ + MESA_FORMAT_L4A4_UNORM, /* Name */ + "MESA_FORMAT_L4A4_UNORM", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ - 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + 0, 0, 0, 4, /* Red/Green/Blue/AlphaBits */ + 4, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B2G3R3_UNORM, /* Name */ - "MESA_FORMAT_B2G3R3_UNORM", /* 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 +314,118 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A_UNORM8, /* Name */ - "MESA_FORMAT_A_UNORM8", /* StrName */ + MESA_FORMAT_R16G16_UNORM, + "MESA_FORMAT_R16G16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_G16R16_UNORM, + "MESA_FORMAT_G16R16_UNORM", + GL_RG, + GL_UNSIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10A2_UNORM, + "MESA_FORMAT_B10G10R10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_B10G10R10X2_UNORM, + "MESA_FORMAT_B10G10R10X2_UNORM", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UNORM, + "MESA_FORMAT_R10G10B10A2_UNORM", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + 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 */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_X8_UINT_Z24_UNORM, /* Name */ + "MESA_FORMAT_X8_UINT_Z24_UNORM", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ + "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR, /* Name */ + "MESA_FORMAT_YCBCR", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR_REV, /* Name */ + "MESA_FORMAT_YCBCR_REV", /* StrName */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + + /* Array unorm formats */ + { + MESA_FORMAT_DUDV8, + "MESA_FORMAT_DUDV8", + GL_DUDV_ATI, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + 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 +433,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_A_UNORM16, /* Name */ - "MESA_FORMAT_A_UNORM16", /* 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 +442,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L_UNORM8, /* Name */ - "MESA_FORMAT_L_UNORM8", /* 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 +451,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_L_UNORM16, /* Name */ - "MESA_FORMAT_L_UNORM16", /* 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 +460,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I_UNORM8, /* Name */ - "MESA_FORMAT_I_UNORM8", /* 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 +469,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_I_UNORM16, /* Name */ - "MESA_FORMAT_I_UNORM16", /* 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 */ @@ -349,24 +478,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_YCBCR, /* Name */ - "MESA_FORMAT_YCBCR", /* StrName */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 2 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_YCBCR_REV, /* Name */ - "MESA_FORMAT_YCBCR_REV", /* StrName */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 2 /* BlockWidth/Height,Bytes */ - }, - { MESA_FORMAT_R_UNORM8, "MESA_FORMAT_R_UNORM8", GL_RED, @@ -376,24 +487,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 1 }, { - MESA_FORMAT_R8G8_UNORM, - "MESA_FORMAT_R8G8_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_G8R8_UNORM, - "MESA_FORMAT_G8R8_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { MESA_FORMAT_R_UNORM16, "MESA_FORMAT_R_UNORM16", GL_RED, @@ -403,53 +496,44 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_R16G16_UNORM, - "MESA_FORMAT_R16G16_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 + 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 */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_G16R16_UNORM, - "MESA_FORMAT_G16R16_UNORM", - GL_RG, - GL_UNSIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 + 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 */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_B10G10R10A2_UNORM, - "MESA_FORMAT_B10G10R10A2_UNORM", + MESA_FORMAT_RGBA_UNORM16, + "MESA_FORMAT_RGBA_UNORM16", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 2, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - 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 */ - 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + 1, 1, 8 }, { - MESA_FORMAT_Z24_UNORM_S8_UINT, /* Name */ - "MESA_FORMAT_Z24_UNORM_S8_UINT", /* StrName */ - GL_DEPTH_STENCIL, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_RGBX_UNORM16, + "MESA_FORMAT_RGBX_UNORM16", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 }, { - MESA_FORMAT_Z_UNORM16, /* Name */ - "MESA_FORMAT_Z_UNORM16", /* 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,26 +541,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_Z24_UNORM_X8_UINT, /* Name */ - "MESA_FORMAT_Z24_UNORM_X8_UINT", /* StrName */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - 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 */ - 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_Z_UNORM32, /* Name */ - "MESA_FORMAT_Z_UNORM32", /* 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,206 +550,318 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 /* BlockWidth/Height,Bytes */ }, { - MESA_FORMAT_S_UINT8, /* Name */ - "MESA_FORMAT_S_UINT8", /* 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 */ 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 1 /* BlockWidth/Height,Bytes */ }, + + /* Packed signed/normalized formats */ { - MESA_FORMAT_BGR_SRGB8, - "MESA_FORMAT_BGR_SRGB8", + MESA_FORMAT_A8B8G8R8_SNORM, + "MESA_FORMAT_A8B8G8R8_SNORM", + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_X8B8G8R8_SNORM, + "MESA_FORMAT_X8B8G8R8_SNORM", GL_RGB, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 3 + 1, 1, 4 /* 4 bpp, but no alpha */ }, { - MESA_FORMAT_A8B8G8R8_SRGB, - "MESA_FORMAT_A8B8G8R8_SRGB", + MESA_FORMAT_R8G8B8A8_SNORM, + "MESA_FORMAT_R8G8B8A8_SNORM", GL_RGBA, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_B8G8R8A8_SRGB, - "MESA_FORMAT_B8G8R8A8_SRGB", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 8, + MESA_FORMAT_R8G8B8X8_SNORM, + "MESA_FORMAT_R8G8B8X8_SNORM", + GL_RGB, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_R8G8B8A8_SRGB, - "MESA_FORMAT_R8G8B8A8_SRGB", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 8, + MESA_FORMAT_R16G16_SNORM, + "MESA_FORMAT_R16G16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_L_SRGB8, - "MESA_FORMAT_L_SRGB8", - GL_LUMINANCE, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - 8, 0, 0, 0, 0, - 1, 1, 1 + MESA_FORMAT_G16R16_SNORM, + "MESA_FORMAT_G16R16_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 16, 16, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 }, { - MESA_FORMAT_L8A8_SRGB, - "MESA_FORMAT_L8A8_SRGB", + MESA_FORMAT_R8G8_SNORM, + "MESA_FORMAT_R8G8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_G8R8_SNORM, + "MESA_FORMAT_G8R8_SNORM", + GL_RG, + GL_SIGNED_NORMALIZED, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_L8A8_SNORM, + "MESA_FORMAT_L8A8_SNORM", GL_LUMINANCE_ALPHA, - GL_UNSIGNED_NORMALIZED, + GL_SIGNED_NORMALIZED, 0, 0, 0, 8, 8, 0, 0, 0, 0, 1, 1, 2 }, + + /* Array signed/normalized formats */ { - MESA_FORMAT_SRGB_DXT1, /* Name */ - "MESA_FORMAT_SRGB_DXT1", /* StrName */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 4, 4, 8 /* 8 bytes per 4x4 block */ + MESA_FORMAT_A_SNORM8, + "MESA_FORMAT_A_SNORM8", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 8, + 0, 0, 0, 0, 0, + 1, 1, 1 }, { - MESA_FORMAT_SRGBA_DXT1, - "MESA_FORMAT_SRGBA_DXT1", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_A_SNORM16, + "MESA_FORMAT_A_SNORM16", + GL_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, 0, 0, 0, 0, 0, - 4, 4, 8 /* 8 bytes per 4x4 block */ + 1, 1, 2 }, { - MESA_FORMAT_SRGBA_DXT3, - "MESA_FORMAT_SRGBA_DXT3", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, - 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + MESA_FORMAT_L_SNORM8, + "MESA_FORMAT_L_SNORM8", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 }, { - MESA_FORMAT_SRGBA_DXT5, - "MESA_FORMAT_SRGBA_DXT5", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_L_SNORM16, + "MESA_FORMAT_L_SNORM16", + GL_LUMINANCE, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_I_SNORM8, + "MESA_FORMAT_I_SNORM8", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 8, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_I_SNORM16, + "MESA_FORMAT_I_SNORM16", + GL_INTENSITY, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { + 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 */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_R_SNORM16, + "MESA_FORMAT_R_SNORM16", + GL_RED, + GL_SIGNED_NORMALIZED, + 16, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 2 }, - { - MESA_FORMAT_RGB_FXT1, - "MESA_FORMAT_RGB_FXT1", + MESA_FORMAT_LA_SNORM16, + "MESA_FORMAT_LA_SNORM16", + GL_LUMINANCE_ALPHA, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGB_SNORM16, + "MESA_FORMAT_RGB_SNORM16", GL_RGB, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 0, /* approx Red/Green/BlueBits */ + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 8, 4, 16 /* 16 bytes per 8x4 block */ + 1, 1, 6 }, { - MESA_FORMAT_RGBA_FXT1, - "MESA_FORMAT_RGBA_FXT1", + MESA_FORMAT_RGBA_SNORM16, + "MESA_FORMAT_RGBA_SNORM16", GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ + GL_SIGNED_NORMALIZED, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 8, 4, 16 /* 16 bytes per 8x4 block */ + 1, 1, 8 }, - { - MESA_FORMAT_RGB_DXT1, /* Name */ - "MESA_FORMAT_RGB_DXT1", /* StrName */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 4, 4, 8 /* 8 bytes per 4x4 block */ + MESA_FORMAT_RGBX_SNORM16, + "MESA_FORMAT_RGBX_SNORM16", + GL_RGB, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 }, + + /* Packed sRGB formats */ { - MESA_FORMAT_RGBA_DXT1, - "MESA_FORMAT_RGBA_DXT1", + MESA_FORMAT_A8B8G8R8_SRGB, + "MESA_FORMAT_A8B8G8R8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 4, 4, 8 /* 8 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_DXT3, - "MESA_FORMAT_RGBA_DXT3", + MESA_FORMAT_B8G8R8A8_SRGB, + "MESA_FORMAT_B8G8R8A8_SRGB", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_DXT5, - "MESA_FORMAT_RGBA_DXT5", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 4, + MESA_FORMAT_B8G8R8X8_SRGB, + "MESA_FORMAT_B8G8R8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 4, 4, 16 /* 16 bytes per 4x4 block */ + 1, 1, 4 }, { - MESA_FORMAT_RGBA_FLOAT32, - "MESA_FORMAT_RGBA_FLOAT32", + MESA_FORMAT_R8G8B8A8_SRGB, + "MESA_FORMAT_R8G8B8A8_SRGB", GL_RGBA, - GL_FLOAT, - 32, 32, 32, 32, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_FLOAT16, - "MESA_FORMAT_RGBA_FLOAT16", - GL_RGBA, - GL_FLOAT, - 16, 16, 16, 16, + MESA_FORMAT_R8G8B8X8_SRGB, + "MESA_FORMAT_R8G8B8X8_SRGB", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 4 }, { - MESA_FORMAT_RGB_FLOAT32, - "MESA_FORMAT_RGB_FLOAT32", + MESA_FORMAT_L8A8_SRGB, + "MESA_FORMAT_L8A8_SRGB", + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + + /* Array sRGB formats */ + { + MESA_FORMAT_L_SRGB8, + "MESA_FORMAT_L_SRGB8", + GL_LUMINANCE, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + 8, 0, 0, 0, 0, + 1, 1, 1 + }, + { + MESA_FORMAT_BGR_SRGB8, + "MESA_FORMAT_BGR_SRGB8", GL_RGB, - GL_FLOAT, - 32, 32, 32, 0, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 12 + 1, 1, 3 }, + + /* Packed float formats */ { - MESA_FORMAT_RGB_FLOAT16, - "MESA_FORMAT_RGB_FLOAT16", + MESA_FORMAT_R9G9B9E5_FLOAT, + "MESA_FORMAT_RGB9_E5", GL_RGB, GL_FLOAT, - 16, 16, 16, 0, + 9, 9, 9, 0, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 4 }, { - MESA_FORMAT_A_FLOAT32, - "MESA_FORMAT_A_FLOAT32", - GL_ALPHA, + MESA_FORMAT_R11G11B10_FLOAT, + "MESA_FORMAT_R11G11B10_FLOAT", + GL_RGB, GL_FLOAT, - 0, 0, 0, 32, + 11, 11, 10, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { + 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. + */ + GL_FLOAT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 8 /* BlockWidth/Height,Bytes */ + }, + + /* Array float formats */ + { MESA_FORMAT_A_FLOAT16, "MESA_FORMAT_A_FLOAT16", GL_ALPHA, @@ -693,12 +871,12 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_L_FLOAT32, - "MESA_FORMAT_L_FLOAT32", - GL_LUMINANCE, + MESA_FORMAT_A_FLOAT32, + "MESA_FORMAT_A_FLOAT32", + GL_ALPHA, GL_FLOAT, - 0, 0, 0, 0, - 32, 0, 0, 0, 0, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, 1, 1, 4 }, { @@ -711,13 +889,13 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_LA_FLOAT32, - "MESA_FORMAT_LA_FLOAT32", - GL_LUMINANCE_ALPHA, + MESA_FORMAT_L_FLOAT32, + "MESA_FORMAT_L_FLOAT32", + GL_LUMINANCE, GL_FLOAT, - 0, 0, 0, 32, + 0, 0, 0, 0, 32, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 4 }, { MESA_FORMAT_LA_FLOAT16, @@ -729,6 +907,24 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { + MESA_FORMAT_LA_FLOAT32, + "MESA_FORMAT_LA_FLOAT32", + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_I_FLOAT16, + "MESA_FORMAT_I_FLOAT16", + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + { MESA_FORMAT_I_FLOAT32, "MESA_FORMAT_I_FLOAT32", GL_INTENSITY, @@ -738,12 +934,12 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_I_FLOAT16, - "MESA_FORMAT_I_FLOAT16", - GL_INTENSITY, + MESA_FORMAT_R_FLOAT16, + "MESA_FORMAT_R_FLOAT16", + GL_RED, GL_FLOAT, - 0, 0, 0, 0, - 0, 16, 0, 0, 0, + 16, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 2 }, { @@ -756,13 +952,13 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R_FLOAT16, - "MESA_FORMAT_R_FLOAT16", - GL_RED, + MESA_FORMAT_RG_FLOAT16, + "MESA_FORMAT_RG_FLOAT16", + GL_RG, GL_FLOAT, - 16, 0, 0, 0, + 16, 16, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 4 }, { MESA_FORMAT_RG_FLOAT32, @@ -774,17 +970,90 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RG_FLOAT16, - "MESA_FORMAT_RG_FLOAT16", - GL_RG, + MESA_FORMAT_RGB_FLOAT16, + "MESA_FORMAT_RGB_FLOAT16", + GL_RGB, GL_FLOAT, - 16, 16, 0, 0, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_FLOAT32, + "MESA_FORMAT_RGB_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + "MESA_FORMAT_RGBA_FLOAT16", + GL_RGBA, + GL_FLOAT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_FLOAT32, + "MESA_FORMAT_RGBA_FLOAT32", + GL_RGBA, + GL_FLOAT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_FLOAT16, + "MESA_FORMAT_RGBX_FLOAT16", + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBX_FLOAT32, + "MESA_FORMAT_RGBX_FLOAT32", + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + 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 */ + 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + + /* Packed signed/unsigned non-normalized integer formats */ + { + MESA_FORMAT_B10G10R10A2_UINT, + "MESA_FORMAT_B10G10R10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_R10G10B10A2_UINT, + "MESA_FORMAT_R10G10B10A2_UINT", + GL_RGBA, + GL_UNSIGNED_INT, + 10, 10, 10, 2, 0, 0, 0, 0, 0, 1, 1, 4 }, - /* unnormalized signed int formats */ - /* unnormalized unsigned int formats */ + /* Array signed/unsigned non-normalized integer formats */ { MESA_FORMAT_A_UINT8, "MESA_FORMAT_A_UINT8", @@ -1001,42 +1270,41 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 32, 0, 0, 0, 0, 1, 1, 8 }, - { - MESA_FORMAT_R_SINT8, - "MESA_FORMAT_R_SINT8", + MESA_FORMAT_R_UINT8, + "MESA_FORMAT_R_UINT8", GL_RED, - GL_INT, + GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1 }, { - MESA_FORMAT_RG_SINT8, - "MESA_FORMAT_RG_SINT8", - GL_RG, - GL_INT, - 8, 8, 0, 0, + MESA_FORMAT_R_UINT16, + "MESA_FORMAT_R_UINT16", + GL_RED, + GL_UNSIGNED_INT, + 16, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2 }, { - MESA_FORMAT_RGB_SINT8, - "MESA_FORMAT_RGB_SINT8", - GL_RGB, - GL_INT, - 8, 8, 8, 0, + MESA_FORMAT_R_UINT32, + "MESA_FORMAT_R_UINT32", + GL_RED, + GL_UNSIGNED_INT, + 32, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 3 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_SINT8, - "MESA_FORMAT_RGBA_SINT8", - GL_RGBA, + MESA_FORMAT_R_SINT8, + "MESA_FORMAT_R_SINT8", + GL_RED, GL_INT, - 8, 8, 8, 8, + 8, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 4 + 1, 1, 1 }, { MESA_FORMAT_R_SINT16, @@ -1048,38 +1316,56 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 2 }, { - MESA_FORMAT_RG_SINT16, - "MESA_FORMAT_RG_SINT16", - GL_RG, + MESA_FORMAT_R_SINT32, + "MESA_FORMAT_R_SINT32", + GL_RED, GL_INT, + 32, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RG_UINT8, + "MESA_FORMAT_RG_UINT8", + GL_RG, + GL_UNSIGNED_INT, + 8, 8, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_RG_UINT16, + "MESA_FORMAT_RG_UINT16", + GL_RG, + GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_RGB_SINT16, - "MESA_FORMAT_RGB_SINT16", - GL_RGB, - GL_INT, - 16, 16, 16, 0, + MESA_FORMAT_RG_UINT32, + "MESA_FORMAT_RG_UINT32", + GL_RG, + GL_UNSIGNED_INT, + 32, 32, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 8 }, { - MESA_FORMAT_RGBA_SINT16, - "MESA_FORMAT_RGBA_SINT16", - GL_RGBA, + MESA_FORMAT_RG_SINT8, + "MESA_FORMAT_RG_SINT8", + GL_RG, GL_INT, - 16, 16, 16, 16, + 8, 8, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 8 + 1, 1, 2 }, { - MESA_FORMAT_R_SINT32, - "MESA_FORMAT_R_SINT32", - GL_RED, + MESA_FORMAT_RG_SINT16, + "MESA_FORMAT_RG_SINT16", + GL_RG, GL_INT, - 32, 0, 0, 0, + 16, 16, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, @@ -1093,51 +1379,60 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 8 }, { - MESA_FORMAT_RGB_SINT32, - "MESA_FORMAT_RGB_SINT32", + MESA_FORMAT_RGB_UINT8, + "MESA_FORMAT_RGB_UINT8", GL_RGB, - GL_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 12 - }, - { - MESA_FORMAT_RGBA_SINT32, - "MESA_FORMAT_RGBA_SINT32", - GL_RGBA, - GL_INT, - 32, 32, 32, 32, + GL_UNSIGNED_INT, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 3 }, { - MESA_FORMAT_R_UINT8, - "MESA_FORMAT_R_UINT8", - GL_RED, + MESA_FORMAT_RGB_UINT16, + "MESA_FORMAT_RGB_UINT16", + GL_RGB, GL_UNSIGNED_INT, - 8, 0, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 1, 1, 1 + 1, 1, 6 }, { - MESA_FORMAT_RG_UINT8, - "MESA_FORMAT_RG_UINT8", - GL_RG, + MESA_FORMAT_RGB_UINT32, + "MESA_FORMAT_RGB_UINT32", + GL_RGB, GL_UNSIGNED_INT, - 8, 8, 0, 0, + 32, 32, 32, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 12 }, { - MESA_FORMAT_RGB_UINT8, - "MESA_FORMAT_RGB_UINT8", + MESA_FORMAT_RGB_SINT8, + "MESA_FORMAT_RGB_SINT8", GL_RGB, - GL_UNSIGNED_INT, + GL_INT, 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 3 }, { + MESA_FORMAT_RGB_SINT16, + "MESA_FORMAT_RGB_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_RGB_SINT32, + "MESA_FORMAT_RGB_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { MESA_FORMAT_RGBA_UINT8, "MESA_FORMAT_RGBA_UINT8", GL_RGBA, @@ -1147,182 +1442,202 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 1, 1, 4 }, { - MESA_FORMAT_R_UINT16, - "MESA_FORMAT_R_UINT16", - GL_RED, + MESA_FORMAT_RGBA_UINT16, + "MESA_FORMAT_RGBA_UINT16", + GL_RGBA, GL_UNSIGNED_INT, - 16, 0, 0, 0, + 16, 16, 16, 16, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 8 }, { - MESA_FORMAT_RG_UINT16, - "MESA_FORMAT_RG_UINT16", - GL_RG, + MESA_FORMAT_RGBA_UINT32, + "MESA_FORMAT_RGBA_UINT32", + GL_RGBA, GL_UNSIGNED_INT, - 16, 16, 0, 0, + 32, 32, 32, 32, 0, 0, 0, 0, 0, - 1, 1, 4 + 1, 1, 16 }, { - MESA_FORMAT_RGB_UINT16, - "MESA_FORMAT_RGB_UINT16", - GL_RGB, - GL_UNSIGNED_INT, - 16, 16, 16, 0, + MESA_FORMAT_RGBA_SINT8, + "MESA_FORMAT_RGBA_SINT8", + GL_RGBA, + GL_INT, + 8, 8, 8, 8, 0, 0, 0, 0, 0, - 1, 1, 6 + 1, 1, 4 }, { - MESA_FORMAT_RGBA_UINT16, - "MESA_FORMAT_RGBA_UINT16", + MESA_FORMAT_RGBA_SINT16, + "MESA_FORMAT_RGBA_SINT16", GL_RGBA, - GL_UNSIGNED_INT, + GL_INT, 16, 16, 16, 16, 0, 0, 0, 0, 0, 1, 1, 8 }, { - MESA_FORMAT_R_UINT32, - "MESA_FORMAT_R_UINT32", - GL_RED, + MESA_FORMAT_RGBA_SINT32, + "MESA_FORMAT_RGBA_SINT32", + GL_RGBA, + GL_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBX_UINT8, + "MESA_FORMAT_RGBX_UINT8", + GL_RGB, GL_UNSIGNED_INT, - 32, 0, 0, 0, + 8, 8, 8, 0, 0, 0, 0, 0, 0, 1, 1, 4 }, { - MESA_FORMAT_RG_UINT32, - "MESA_FORMAT_RG_UINT32", - GL_RG, + MESA_FORMAT_RGBX_UINT16, + "MESA_FORMAT_RGBX_UINT16", + GL_RGB, GL_UNSIGNED_INT, - 32, 32, 0, 0, + 16, 16, 16, 0, 0, 0, 0, 0, 0, 1, 1, 8 }, { - MESA_FORMAT_RGB_UINT32, - "MESA_FORMAT_RGB_UINT32", + MESA_FORMAT_RGBX_UINT32, + "MESA_FORMAT_RGBX_UINT32", GL_RGB, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0, 0, 0, 0, - 1, 1, 12 + 1, 1, 16 }, { - MESA_FORMAT_RGBA_UINT32, - "MESA_FORMAT_RGBA_UINT32", - GL_RGBA, - GL_UNSIGNED_INT, - 32, 32, 32, 32, + MESA_FORMAT_RGBX_SINT8, + "MESA_FORMAT_RGBX_SINT8", + GL_RGB, + GL_INT, + 8, 8, 8, 0, 0, 0, 0, 0, 0, - 1, 1, 16 + 1, 1, 4 }, - - { - MESA_FORMAT_DUDV8, - "MESA_FORMAT_DUDV8", - GL_DUDV_ATI, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, + MESA_FORMAT_RGBX_SINT16, + "MESA_FORMAT_RGBX_SINT16", + GL_RGB, + GL_INT, + 16, 16, 16, 0, 0, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 8 }, - - /* Signed 8 bits / channel */ { - 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 */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 1 /* BlockWidth/Height,Bytes */ + MESA_FORMAT_RGBX_SINT32, + "MESA_FORMAT_RGBX_SINT32", + GL_RGB, + GL_INT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 16 }, + + /* DXT compressed formats */ { - MESA_FORMAT_R8G8_SNORM, - "MESA_FORMAT_R8G8_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 + MESA_FORMAT_RGB_DXT1, /* Name */ + "MESA_FORMAT_RGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_X8B8G8R8_SNORM, - "MESA_FORMAT_X8B8G8R8_SNORM", - GL_RGB, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 0, + MESA_FORMAT_RGBA_DXT1, + "MESA_FORMAT_RGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 /* 4 bpp, but no alpha */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_A8B8G8R8_SNORM, - "MESA_FORMAT_A8B8G8R8_SNORM", + MESA_FORMAT_RGBA_DXT3, + "MESA_FORMAT_RGBA_DXT3", GL_RGBA, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 8, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_R8G8B8A8_SNORM, - "MESA_FORMAT_R8G8B8A8_SNORM", + MESA_FORMAT_RGBA_DXT5, + "MESA_FORMAT_RGBA_DXT5", GL_RGBA, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 8, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, - /* Signed 16 bits / channel */ + /* DXT sRGB compressed formats */ { - MESA_FORMAT_R_SNORM16, - "MESA_FORMAT_R_SNORM16", - GL_RED, - GL_SIGNED_NORMALIZED, - 16, 0, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 + MESA_FORMAT_SRGB_DXT1, /* Name */ + "MESA_FORMAT_SRGB_DXT1", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_R16G16_SNORM, - "MESA_FORMAT_R16G16_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 16, 16, 0, 0, + MESA_FORMAT_SRGBA_DXT1, + "MESA_FORMAT_SRGBA_DXT1", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 4 + 4, 4, 8 /* 8 bytes per 4x4 block */ }, { - MESA_FORMAT_RGB_SNORM16, - "MESA_FORMAT_RGB_SNORM16", - GL_RGB, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 0, + MESA_FORMAT_SRGBA_DXT3, + "MESA_FORMAT_SRGBA_DXT3", + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 6 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, { - MESA_FORMAT_RGBA_SNORM16, - "MESA_FORMAT_RGBA_SNORM16", + MESA_FORMAT_SRGBA_DXT5, + "MESA_FORMAT_SRGBA_DXT5", GL_RGBA, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 16, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, 0, 0, 0, 0, 0, - 1, 1, 8 + 4, 4, 16 /* 16 bytes per 4x4 block */ }, + + /* FXT1 compressed formats */ { - MESA_FORMAT_RGBA_UNORM16, - "MESA_FORMAT_RGBA_UNORM16", + MESA_FORMAT_RGB_FXT1, + "MESA_FORMAT_RGB_FXT1", + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 0, /* approx Red/Green/BlueBits */ + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, + { + MESA_FORMAT_RGBA_FXT1, + "MESA_FORMAT_RGBA_FXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 16, 16, 16, 16, + 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, - 1, 1, 8 + 8, 4, 16 /* 16 bytes per 8x4 block */ }, + + /* RGTC compressed formats */ { MESA_FORMAT_R_RGTC1_UNORM, "MESA_FORMAT_R_RGTC1_UNORM", @@ -1359,6 +1674,8 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, + + /* LATC1/2 compressed formats */ { MESA_FORMAT_L_LATC1_UNORM, "MESA_FORMAT_L_LATC1_UNORM", @@ -1396,6 +1713,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 4, 4, 16 /* 16 bytes per 4x4 block */ }, + /* ETC1/2 compressed formats */ { MESA_FORMAT_ETC1_RGB8, "MESA_FORMAT_ETC1_RGB8", @@ -1405,7 +1723,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGB8, "MESA_FORMAT_ETC2_RGB8", @@ -1415,7 +1732,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8, "MESA_FORMAT_ETC2_SRGB8", @@ -1425,7 +1741,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGBA8_EAC, "MESA_FORMAT_ETC2_RGBA8_EAC", @@ -1435,7 +1750,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC, "MESA_FORMAT_ETC2_SRGB8_ALPHA8_EAC", @@ -1445,7 +1759,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_R11_EAC, "MESA_FORMAT_ETC2_R11_EAC", @@ -1455,7 +1768,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RG11_EAC, "MESA_FORMAT_ETC2_RG11_EAC", @@ -1465,7 +1777,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SIGNED_R11_EAC, "MESA_FORMAT_ETC2_SIGNED_R11_EAC", @@ -1475,7 +1786,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SIGNED_RG11_EAC, "MESA_FORMAT_ETC2_SIGNED_RG11_EAC", @@ -1485,7 +1795,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, "MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1", @@ -1495,7 +1804,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - { MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, "MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1", @@ -1505,309 +1813,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 8 /* 8 bytes per 4x4 block */ }, - - /* Signed formats from EXT_texture_snorm that are not in GL3.1 */ - { - MESA_FORMAT_A_SNORM8, - "MESA_FORMAT_A_SNORM8", - GL_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 8, - 0, 0, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_L_SNORM8, - "MESA_FORMAT_L_SNORM8", - GL_LUMINANCE, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 8, 0, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_L8A8_SNORM, - "MESA_FORMAT_L8A8_SNORM", - GL_LUMINANCE_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 8, - 8, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_I_SNORM8, - "MESA_FORMAT_I_SNORM8", - GL_INTENSITY, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, 8, 0, 0, 0, - 1, 1, 1 - }, - { - MESA_FORMAT_A_SNORM16, - "MESA_FORMAT_A_SNORM16", - GL_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 16, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_L_SNORM16, - "MESA_FORMAT_L_SNORM16", - GL_LUMINANCE, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 16, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_LA_SNORM16, - "MESA_FORMAT_LA_SNORM16", - GL_LUMINANCE_ALPHA, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 16, - 16, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_I_SNORM16, - "MESA_FORMAT_I_SNORM16", - GL_INTENSITY, - GL_SIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, 16, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_R9G9B9E5_FLOAT, - "MESA_FORMAT_RGB9_E5", - GL_RGB, - GL_FLOAT, - 9, 9, 9, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R11G11B10_FLOAT, - "MESA_FORMAT_R11G11B10_FLOAT", - GL_RGB, - GL_FLOAT, - 11, 11, 10, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - /* ARB_depth_buffer_float */ - { - 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 */ - 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 4 /* BlockWidth/Height,Bytes */ - }, - { - 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. - */ - GL_FLOAT, /* DataType */ - 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 32, 8, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 8 /* BlockWidth/Height,Bytes */ - }, - { - MESA_FORMAT_B10G10R10A2_UINT, - "MESA_FORMAT_B10G10R10A2_UINT", - GL_RGBA, - GL_UNSIGNED_INT, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R10G10B10A2_UINT, - "MESA_FORMAT_R10G10B10A2_UINT", - GL_RGBA, - GL_UNSIGNED_INT, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B4G4R4X4_UNORM, - "MESA_FORMAT_B4G4R4X4_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 4, 4, 4, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_B5G5R5X1_UNORM, - "MESA_FORMAT_B5G5R5X1_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 5, 5, 5, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_R8G8B8X8_SNORM, - "MESA_FORMAT_R8G8B8X8_SNORM", - GL_RGB, - GL_SIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_R8G8B8X8_SRGB, - "MESA_FORMAT_R8G8B8X8_SRGB", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_UINT8, - "MESA_FORMAT_RGBX_UINT8", - GL_RGB, - GL_UNSIGNED_INT, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_SINT8, - "MESA_FORMAT_RGBX_SINT8", - GL_RGB, - GL_INT, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B10G10R10X2_UNORM, - "MESA_FORMAT_B10G10R10X2_UNORM", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_RGBX_UNORM16, - "MESA_FORMAT_RGBX_UNORM16", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_SNORM16, - "MESA_FORMAT_RGBX_SNORM16", - GL_RGB, - GL_SIGNED_NORMALIZED, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_FLOAT16, - "MESA_FORMAT_RGBX_FLOAT16", - GL_RGB, - GL_FLOAT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_UINT16, - "MESA_FORMAT_RGBX_UINT16", - GL_RGB, - GL_UNSIGNED_INT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_SINT16, - "MESA_FORMAT_RGBX_SINT16", - GL_RGB, - GL_INT, - 16, 16, 16, 0, - 0, 0, 0, 0, 0, - 1, 1, 8 - }, - { - MESA_FORMAT_RGBX_FLOAT32, - "MESA_FORMAT_RGBX_FLOAT32", - GL_RGB, - GL_FLOAT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_RGBX_UINT32, - "MESA_FORMAT_RGBX_UINT32", - GL_RGB, - GL_UNSIGNED_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_RGBX_SINT32, - "MESA_FORMAT_RGBX_SINT32", - GL_RGB, - GL_INT, - 32, 32, 32, 0, - 0, 0, 0, 0, 0, - 1, 1, 16 - }, - { - MESA_FORMAT_R10G10B10A2_UNORM, - "MESA_FORMAT_R10G10B10A2_UNORM", - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - 10, 10, 10, 2, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_G8R8_SNORM, - "MESA_FORMAT_G8R8_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 8, 8, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 2 - }, - { - MESA_FORMAT_G16R16_SNORM, - "MESA_FORMAT_G16R16_SNORM", - GL_RG, - GL_SIGNED_NORMALIZED, - 16, 16, 0, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, - { - MESA_FORMAT_B8G8R8X8_SRGB, - "MESA_FORMAT_B8G8R8X8_SRGB", - GL_RGB, - GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 0, - 0, 0, 0, 0, 0, - 1, 1, 4 - }, }; @@ -2513,7 +2518,7 @@ _mesa_format_to_type_and_comps(mesa_format format, *comps = 1; return; - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: *datatype = GL_UNSIGNED_INT; *comps = 1; return; @@ -3155,7 +3160,7 @@ _mesa_format_matches_format_and_type(mesa_format mesa_format, case MESA_FORMAT_S8_UINT_Z24_UNORM: return format == GL_DEPTH_STENCIL && type == GL_UNSIGNED_INT_24_8 && !swapBytes; - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: case MESA_FORMAT_Z24_UNORM_S8_UINT: return GL_FALSE; diff --git a/mesalib/src/mesa/main/formats.h b/mesalib/src/mesa/main/formats.h index a12fe4f08..3079f0356 100644 --- a/mesalib/src/mesa/main/formats.h +++ b/mesalib/src/mesa/main/formats.h @@ -166,318 +166,140 @@ typedef enum * 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 - * B8G8R8X8_SRGB - * */ - /*@{*/ - /* Type P formats */ /* msb <------ TEXEL BITS -----------> lsb */ + /* Packed unorm formats */ /* msb <------ TEXEL BITS -----------> lsb */ /* ---- ---- ---- ---- ---- ---- ---- ---- */ MESA_FORMAT_A8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_R8G8B8A8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_B8G8R8A8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_X8B8G8R8_UNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_UNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_R8G8B8X8_UNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_B8G8R8A8_UNORM, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_B8G8R8X8_UNORM, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_A8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_X8R8G8B8_UNORM, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ - - /* 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_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ + MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ MESA_FORMAT_B5G6R5_UNORM, /* RRRR RGGG GGGB BBBB */ MESA_FORMAT_R5G6B5_UNORM, /* BBBB BGGG GGGR RRRR */ MESA_FORMAT_B4G4R4A4_UNORM, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */ MESA_FORMAT_A4R4G4B4_UNORM, /* BBBB GGGG RRRR AAAA */ MESA_FORMAT_A1B5G5R5_UNORM, /* RRRR RGGG GGBB BBBA */ MESA_FORMAT_B5G5R5A1_UNORM, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */ MESA_FORMAT_A1R5G5B5_UNORM, /* BBBB BGGG GGRR RRRA */ - MESA_FORMAT_L4A4_UNORM, /* AAAA LLLL */ MESA_FORMAT_L8A8_UNORM, /* AAAA AAAA LLLL LLLL */ MESA_FORMAT_A8L8_UNORM, /* LLLL LLLL AAAA AAAA */ - MESA_FORMAT_L16A16_UNORM, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ - MESA_FORMAT_A16L16_UNORM, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ - MESA_FORMAT_B2G3R3_UNORM, /* RRRG GGBB */ - - /* 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, /* GGGG GGGG RRRR RRRR */ MESA_FORMAT_G8R8_UNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L4A4_UNORM, /* AAAA LLLL */ + MESA_FORMAT_B2G3R3_UNORM, /* RRRG GGBB */ - /* Type A format(s) */ - MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ - - /* Type P formats */ MESA_FORMAT_R16G16_UNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ MESA_FORMAT_G16R16_UNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ MESA_FORMAT_B10G10R10A2_UNORM,/* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_B10G10R10X2_UNORM,/* xxRR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UNORM,/* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ + MESA_FORMAT_S8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_X8_UINT_Z24_UNORM,/* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ MESA_FORMAT_Z24_UNORM_S8_UINT,/* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - /* Type A format(s) */ - MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - /* Type P formats */ - MESA_FORMAT_Z24_UNORM_X8_UINT,/* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_X8Z24_UNORM, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ + MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + + /* Array unorm formats */ + MESA_FORMAT_A_UNORM8, /* ubyte[i] = A */ + MESA_FORMAT_A_UNORM16, /* ushort[i] = A */ + MESA_FORMAT_L_UNORM8, /* ubyte[i] = L */ + MESA_FORMAT_L_UNORM16, /* ushort[i] = L */ + MESA_FORMAT_I_UNORM8, /* ubyte[i] = I */ + MESA_FORMAT_I_UNORM16, /* ushort[i] = I */ + MESA_FORMAT_R_UNORM8, /* ubyte[i] = R */ + MESA_FORMAT_R_UNORM16, /* ushort[i] = R */ + MESA_FORMAT_BGR_UNORM8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ + MESA_FORMAT_RGB_UNORM8, /* ubyte[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_UNORM16, /* ushort[i] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_UNORM16, - /* Type A formats */ + MESA_FORMAT_Z_UNORM16, /* ushort[i] = Z */ MESA_FORMAT_Z_UNORM32, /* uint[i] = Z */ - MESA_FORMAT_S_UINT8, /* uchar[i] = S */ - /*@}*/ + MESA_FORMAT_S_UINT8, /* ubyte[i] = S */ - /** - * \name 8-bit/channel sRGB formats - */ - /*@{*/ - /* Type A format(s) */ - MESA_FORMAT_BGR_SRGB8, /* uchar[i * 3] = B, [i * 3 + 1] = G, [i *3 + 2] = R */ + /* Packed signed/normalized formats */ + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_A8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_X8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ + MESA_FORMAT_R8G8B8A8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R8G8B8X8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_R16G16_SNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ + MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */ + MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */ + MESA_FORMAT_L8A8_SNORM, /* AAAA AAAA LLLL LLLL */ - /* Type P formats */ + /* Array signed/normalized formats */ + MESA_FORMAT_A_SNORM8, /* byte[i] = A */ + MESA_FORMAT_A_SNORM16, /* short[i] = A */ + MESA_FORMAT_L_SNORM8, /* byte[i] = L */ + MESA_FORMAT_L_SNORM16, /* short[i] = L */ + MESA_FORMAT_I_SNORM8, /* byte[i] = I */ + MESA_FORMAT_I_SNORM16, /* short[i] = I */ + MESA_FORMAT_R_SNORM8, /* byte[i] = R */ + MESA_FORMAT_R_SNORM16, /* short[i] = R */ + MESA_FORMAT_LA_SNORM16, /* short[i * 2] = L, [i * 2 + 1] = A */ + MESA_FORMAT_RGB_SNORM16, /* short[i*3] = R, [i*3+1] = G, [i*3+2] = B */ + MESA_FORMAT_RGBA_SNORM16, /* ... */ + MESA_FORMAT_RGBX_SNORM16, /* ... */ + + /* Packed sRGB formats */ MESA_FORMAT_A8B8G8R8_SRGB, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ MESA_FORMAT_B8G8R8A8_SRGB, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_R8G8B8A8_SRGB, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - - /* Type A format(s) */ - MESA_FORMAT_L_SRGB8, /* uchar[i] = L */ - - /* Type P formats */ + MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_L8A8_SRGB, /* AAAA AAAA LLLL LLLL */ - /* Type C formats */ - MESA_FORMAT_SRGB_DXT1, - MESA_FORMAT_SRGBA_DXT1, - MESA_FORMAT_SRGBA_DXT3, - MESA_FORMAT_SRGBA_DXT5, - /*@}*/ - - /** - * \name Compressed texture formats. - */ - /*@{*/ - /* Type C formats */ - MESA_FORMAT_RGB_FXT1, - MESA_FORMAT_RGBA_FXT1, - MESA_FORMAT_RGB_DXT1, - MESA_FORMAT_RGBA_DXT1, - MESA_FORMAT_RGBA_DXT3, - MESA_FORMAT_RGBA_DXT5, - /*@}*/ + /* Array sRGB formats */ + MESA_FORMAT_L_SRGB8, /* ubyte[i] = L */ + MESA_FORMAT_BGR_SRGB8, /* ubyte[i*3] = B, [i*3+1] = G, [i*3+2] = R */ - /** - * \name Floating point texture formats. - */ - /*@{*/ + /* Packed float formats */ + MESA_FORMAT_R9G9B9E5_FLOAT, + MESA_FORMAT_R11G11B10_FLOAT, /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */ + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */ - /* 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_A_FLOAT32, + /* Array float formats */ MESA_FORMAT_A_FLOAT16, - MESA_FORMAT_L_FLOAT32, + MESA_FORMAT_A_FLOAT32, MESA_FORMAT_L_FLOAT16, - MESA_FORMAT_LA_FLOAT32, + MESA_FORMAT_L_FLOAT32, MESA_FORMAT_LA_FLOAT16, - MESA_FORMAT_I_FLOAT32, + MESA_FORMAT_LA_FLOAT32, MESA_FORMAT_I_FLOAT16, - MESA_FORMAT_R_FLOAT32, + MESA_FORMAT_I_FLOAT32, MESA_FORMAT_R_FLOAT16, - MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_R_FLOAT32, MESA_FORMAT_RG_FLOAT16, - /*@}*/ + MESA_FORMAT_RG_FLOAT32, + MESA_FORMAT_RGB_FLOAT16, + MESA_FORMAT_RGB_FLOAT32, + MESA_FORMAT_RGBA_FLOAT16, + MESA_FORMAT_RGBA_FLOAT32, /* float[0] = R, [1] = G, [2] = B, [3] = A */ + MESA_FORMAT_RGBX_FLOAT16, + MESA_FORMAT_RGBX_FLOAT32, + MESA_FORMAT_Z_FLOAT32, - /** - * \name Non-normalized signed integer formats. - * XXX Note: these are just stand-ins for some better hardware - * formats TBD such as BGRA or ARGB. - */ + /* Packed signed/unsigned non-normalized integer formats */ + MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ + MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - /* Type A formats */ + /* Array signed/unsigned non-normalized integer formats */ MESA_FORMAT_A_UINT8, MESA_FORMAT_A_UINT16, MESA_FORMAT_A_UINT32, @@ -498,6 +320,7 @@ typedef enum MESA_FORMAT_L_SINT8, MESA_FORMAT_L_SINT16, MESA_FORMAT_L_SINT32, + MESA_FORMAT_LA_UINT8, MESA_FORMAT_LA_UINT16, MESA_FORMAT_LA_UINT32, @@ -505,83 +328,70 @@ typedef enum MESA_FORMAT_LA_SINT16, MESA_FORMAT_LA_SINT32, + MESA_FORMAT_R_UINT8, + MESA_FORMAT_R_UINT16, + MESA_FORMAT_R_UINT32, 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, + MESA_FORMAT_RG_SINT8, + MESA_FORMAT_RG_SINT16, + MESA_FORMAT_RG_SINT32, - /* msb <------ TEXEL BITS -----------> lsb */ - /* ---- ---- ---- ---- ---- ---- ---- ---- */ - /** - * \name Signed fixed point texture formats. - */ - /*@{*/ - MESA_FORMAT_DUDV8, /* DUDU DUDU DVDV DVDV */ + MESA_FORMAT_RGB_UINT8, + MESA_FORMAT_RGB_UINT16, + MESA_FORMAT_RGB_UINT32, + MESA_FORMAT_RGB_SINT8, + MESA_FORMAT_RGB_SINT16, + MESA_FORMAT_RGB_SINT32, - /* Type A format(s) */ - MESA_FORMAT_R_SNORM8, /* char[i] = R */ + MESA_FORMAT_RGBA_UINT8, + MESA_FORMAT_RGBA_UINT16, + MESA_FORMAT_RGBA_UINT32, + MESA_FORMAT_RGBA_SINT8, + MESA_FORMAT_RGBA_SINT16, + MESA_FORMAT_RGBA_SINT32, - /* Type P formats */ - MESA_FORMAT_R8G8_SNORM, /* GGGG GGGG RRRR RRRR */ - MESA_FORMAT_X8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB xxxx xxxx */ - MESA_FORMAT_A8B8G8R8_SNORM, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_R8G8B8A8_SNORM, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_RGBX_UINT8, + MESA_FORMAT_RGBX_UINT16, + MESA_FORMAT_RGBX_UINT32, + MESA_FORMAT_RGBX_SINT8, + MESA_FORMAT_RGBX_SINT16, + MESA_FORMAT_RGBX_SINT32, - /* Type A format(s) */ - MESA_FORMAT_R_SNORM16, /* short[i] = R */ + /* DXT compressed formats */ + MESA_FORMAT_RGB_DXT1, + MESA_FORMAT_RGBA_DXT1, + MESA_FORMAT_RGBA_DXT3, + MESA_FORMAT_RGBA_DXT5, - /* Type P format(s) */ - MESA_FORMAT_R16G16_SNORM, /* GGGG GGGG GGGG GGGG RRRR RRRR RRRR RRRR */ + /* DXT sRGB compressed formats */ + MESA_FORMAT_SRGB_DXT1, + MESA_FORMAT_SRGBA_DXT1, + MESA_FORMAT_SRGBA_DXT3, + MESA_FORMAT_SRGBA_DXT5, - /* 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, /* ... */ - /*@}*/ + /* FXT1 compressed formats */ + MESA_FORMAT_RGB_FXT1, + MESA_FORMAT_RGBA_FXT1, - /*@{*/ - /* Type C formats */ + /* RGTC compressed formats */ MESA_FORMAT_R_RGTC1_UNORM, MESA_FORMAT_R_RGTC1_SNORM, MESA_FORMAT_RG_RGTC2_UNORM, MESA_FORMAT_RG_RGTC2_SNORM, - /*@}*/ - /*@{*/ + /* LATC1/2 compressed formats */ MESA_FORMAT_L_LATC1_UNORM, MESA_FORMAT_L_LATC1_SNORM, MESA_FORMAT_LA_LATC2_UNORM, MESA_FORMAT_LA_LATC2_SNORM, - /*@}*/ + /* ETC1/2 compressed formats */ MESA_FORMAT_ETC1_RGB8, MESA_FORMAT_ETC2_RGB8, MESA_FORMAT_ETC2_SRGB8, @@ -594,63 +404,6 @@ typedef enum MESA_FORMAT_ETC2_RGB8_PUNCHTHROUGH_ALPHA1, MESA_FORMAT_ETC2_SRGB8_PUNCHTHROUGH_ALPHA1, - /* 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, /* AAAA AAAA LLLL LLLL */ - - /* 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, /* BBBB BBBB BBGG GGGG GGGG GRRR RRRR RRRR */ - - /* Type A format(s) */ - MESA_FORMAT_Z_FLOAT32, - - /* Type P formats */ - MESA_FORMAT_Z32_FLOAT_S8X24_UINT, /* (float, x24s8) */ - - MESA_FORMAT_B10G10R10A2_UINT, /* AARR RRRR RRRR GGGG GGGG GGBB BBBB BBBB */ - MESA_FORMAT_R10G10B10A2_UINT, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - - MESA_FORMAT_B4G4R4X4_UNORM, /* xxxx RRRR GGGG BBBB */ - MESA_FORMAT_B5G5R5X1_UNORM, /* xRRR RRGG GGGB BBBB */ - MESA_FORMAT_R8G8B8X8_SNORM, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_R8G8B8X8_SRGB, /* xxxx xxxx BBBB BBBB GGGG GGGG RRRR RRRR */ - - /* 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, /* AABB BBBB BBBB GGGG GGGG GGRR RRRR RRRR */ - MESA_FORMAT_G8R8_SNORM, /* RRRR RRRR GGGG GGGG */ - MESA_FORMAT_G16R16_SNORM, /* RRRR RRRR RRRR RRRR GGGG GGGG GGGG GGGG */ - - MESA_FORMAT_B8G8R8X8_SRGB, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_COUNT } mesa_format; diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index e5f10baab..7c83d664f 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2702,6 +2702,14 @@ struct gl_shader_program struct gl_uniform_storage *UniformStorage; /** + * Mapping from GL uniform locations returned by \c glUniformLocation to + * UniformStorage entries. Arrays will have multiple contiguous slots + * in the UniformRemapTable, all pointing to the same UniformStorage entry. + */ + unsigned NumUniformRemapTable; + struct gl_uniform_storage **UniformRemapTable; + + /** * Size of the gl_ClipDistance array that is output from the last pipeline * stage before the fragment shader. */ @@ -2711,21 +2719,6 @@ struct gl_shader_program unsigned NumUniformBlocks; /** - * Scale factor for the uniform base location - * - * This is used to generate locations (returned by \c glGetUniformLocation) - * of uniforms. The base location of the uniform is multiplied by this - * value, and the array index is added. - * - * \note - * Must be >= 1. - * - * \sa - * _mesa_uniform_merge_location_offset, _mesa_uniform_split_location_offset - */ - unsigned UniformLocationBaseScale; - - /** * Indices into the _LinkedShaders's UniformBlocks[] array for each stage * they're used in, or -1. * diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index d5c3d8099..b0f0bfa91 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -285,7 +285,12 @@ _mesa_clear_shader_program_data(struct gl_context *ctx, ralloc_free(shProg->UniformStorage); shProg->NumUserUniformStorage = 0; shProg->UniformStorage = NULL; - shProg->UniformLocationBaseScale = 0; + } + + if (shProg->UniformRemapTable) { + ralloc_free(shProg->UniformRemapTable); + shProg->NumUniformRemapTable = 0; + shProg->UniformRemapTable = NULL; } if (shProg->UniformHash) { diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 557703d01..b68ba603e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -1079,7 +1079,7 @@ _mesa_texstore_z24_x8(TEXSTORE_PARAMS) const GLuint depthScale = 0xffffff; (void) dims; - ASSERT(dstFormat == MESA_FORMAT_X8Z24_UNORM); + ASSERT(dstFormat == MESA_FORMAT_X8_UINT_Z24_UNORM); { /* general path */ @@ -3712,7 +3712,7 @@ _mesa_get_texstore_func(mesa_format format) table[MESA_FORMAT_Z24_UNORM_S8_UINT] = _mesa_texstore_s8_z24; table[MESA_FORMAT_Z_UNORM16] = _mesa_texstore_z16; table[MESA_FORMAT_Z24_UNORM_X8_UINT] = _mesa_texstore_x8_z24; - table[MESA_FORMAT_X8Z24_UNORM] = _mesa_texstore_z24_x8; + table[MESA_FORMAT_X8_UINT_Z24_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; diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index 8cc5da752..fa13ef9fe 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -40,9 +40,9 @@ extern "C" void GLAPIENTRY -_mesa_GetActiveUniform(GLhandleARB program, GLuint index, - GLsizei maxLength, GLsizei *length, GLint *size, - GLenum *type, GLcharARB *nameOut) +_mesa_GetActiveUniform(GLuint program, GLuint index, + GLsizei maxLength, GLsizei *length, GLint *size, + GLenum *type, GLcharARB *nameOut) { GET_CURRENT_CONTEXT(ctx); struct gl_shader_program *shProg = @@ -246,14 +246,15 @@ validate_uniform_parameters(struct gl_context *ctx, return false; } - _mesa_uniform_split_location_offset(shProg, location, loc, array_index); - - if (*loc >= shProg->NumUserUniformStorage) { + /* Check that the given location is in bounds of uniform remap table. */ + if (location >= (GLint) shProg->NumUniformRemapTable) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", caller, location); return false; } + _mesa_uniform_split_location_offset(shProg, location, loc, array_index); + if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(count > 1 for non-array, location=%d)", diff --git a/mesalib/src/mesa/main/uniforms.c b/mesalib/src/mesa/main/uniforms.c index c25c2df7e..e9b374b0d 100644 --- a/mesalib/src/mesa/main/uniforms.c +++ b/mesalib/src/mesa/main/uniforms.c @@ -822,7 +822,7 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, void GLAPIENTRY -_mesa_GetnUniformfvARB(GLhandleARB program, GLint location, +_mesa_GetnUniformfvARB(GLuint program, GLint location, GLsizei bufSize, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -830,14 +830,14 @@ _mesa_GetnUniformfvARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformfv(GLhandleARB program, GLint location, GLfloat *params) +_mesa_GetUniformfv(GLuint program, GLint location, GLfloat *params) { _mesa_GetnUniformfvARB(program, location, INT_MAX, params); } void GLAPIENTRY -_mesa_GetnUniformivARB(GLhandleARB program, GLint location, +_mesa_GetnUniformivARB(GLuint program, GLint location, GLsizei bufSize, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -845,7 +845,7 @@ _mesa_GetnUniformivARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformiv(GLhandleARB program, GLint location, GLint *params) +_mesa_GetUniformiv(GLuint program, GLint location, GLint *params) { _mesa_GetnUniformivARB(program, location, INT_MAX, params); } @@ -853,7 +853,7 @@ _mesa_GetUniformiv(GLhandleARB program, GLint location, GLint *params) /* GL3 */ void GLAPIENTRY -_mesa_GetnUniformuivARB(GLhandleARB program, GLint location, +_mesa_GetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint *params) { GET_CURRENT_CONTEXT(ctx); @@ -861,7 +861,7 @@ _mesa_GetnUniformuivARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params) +_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params) { _mesa_GetnUniformuivARB(program, location, INT_MAX, params); } @@ -869,8 +869,8 @@ _mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params) /* GL4 */ void GLAPIENTRY -_mesa_GetnUniformdvARB(GLhandleARB program, GLint location, - GLsizei bufSize, GLdouble *params) +_mesa_GetnUniformdvARB(GLuint program, GLint location, + GLsizei bufSize, GLdouble *params) { GET_CURRENT_CONTEXT(ctx); @@ -887,14 +887,14 @@ _mesa_GetnUniformdvARB(GLhandleARB program, GLint location, } void GLAPIENTRY -_mesa_GetUniformdv(GLhandleARB program, GLint location, GLdouble *params) +_mesa_GetUniformdv(GLuint program, GLint location, GLdouble *params) { _mesa_GetnUniformdvARB(program, location, INT_MAX, params); } GLint GLAPIENTRY -_mesa_GetUniformLocation(GLhandleARB programObj, const GLcharARB *name) +_mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name) { struct gl_shader_program *shProg; GLuint index, offset; diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h index bd50fd9b8..d7afdc106 100644 --- a/mesalib/src/mesa/main/uniforms.h +++ b/mesalib/src/mesa/main/uniforms.h @@ -195,23 +195,23 @@ _mesa_ProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); void GLAPIENTRY -_mesa_GetnUniformfvARB(GLhandleARB, GLint, GLsizei, GLfloat *); +_mesa_GetnUniformfvARB(GLuint, GLint, GLsizei, GLfloat *); void GLAPIENTRY -_mesa_GetUniformfv(GLhandleARB, GLint, GLfloat *); +_mesa_GetUniformfv(GLuint, GLint, GLfloat *); void GLAPIENTRY -_mesa_GetnUniformivARB(GLhandleARB, GLint, GLsizei, GLint *); +_mesa_GetnUniformivARB(GLuint, GLint, GLsizei, GLint *); void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB, GLint, GLuint *); +_mesa_GetUniformuiv(GLuint, GLint, GLuint *); void GLAPIENTRY -_mesa_GetnUniformuivARB(GLhandleARB, GLint, GLsizei, GLuint *); +_mesa_GetnUniformuivARB(GLuint, GLint, GLsizei, GLuint *); void GLAPIENTRY -_mesa_GetUniformuiv(GLhandleARB program, GLint location, GLuint *params); +_mesa_GetUniformuiv(GLuint program, GLint location, GLuint *params); void GLAPIENTRY -_mesa_GetnUniformdvARB(GLhandleARB, GLint, GLsizei, GLdouble *); +_mesa_GetnUniformdvARB(GLuint, GLint, GLsizei, GLdouble *); void GLAPIENTRY -_mesa_GetUniformdv(GLhandleARB, GLint, GLdouble *); +_mesa_GetUniformdv(GLuint, GLint, GLdouble *); GLint GLAPIENTRY -_mesa_GetUniformLocation(GLhandleARB, const GLcharARB *); +_mesa_GetUniformLocation(GLuint, const GLcharARB *); GLuint GLAPIENTRY _mesa_GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName); @@ -243,8 +243,8 @@ _mesa_GetActiveUniformName(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); void GLAPIENTRY -_mesa_GetActiveUniform(GLhandleARB, GLuint, GLsizei, GLsizei *, - GLint *, GLenum *, GLcharARB *); +_mesa_GetActiveUniform(GLuint, GLuint, GLsizei, GLsizei *, + GLint *, GLenum *, GLcharARB *); void GLAPIENTRY _mesa_GetActiveUniformsiv(GLuint program, GLsizei uniformCount, @@ -252,7 +252,7 @@ _mesa_GetActiveUniformsiv(GLuint program, GLenum pname, GLint *params); void GLAPIENTRY -_mesa_GetUniformiv(GLhandleARB, GLint, GLint *); +_mesa_GetUniformiv(GLuint, GLint, GLint *); long _mesa_parse_program_resource_name(const GLchar *name, @@ -340,39 +340,46 @@ struct gl_builtin_uniform_desc { * element. We could insert dummy entries in the list for each array * element after [0] but that causes complications elsewhere. * - * We solve this problem by encoding two values in the location that's - * returned by glGetUniformLocation(): - * a) index into gl_uniform_list::Uniforms[] for the uniform - * b) an array/field offset (0 for simple types) + * We solve this problem by creating multiple entries for uniform arrays + * in the UniformRemapTable so that their elements get sequential locations. + * + * Utility functions below offer functionality to split UniformRemapTable + * location in to location of the uniform in UniformStorage + offset to the + * array element (0 if not an array) and also merge it back again as the + * UniformRemapTable location. * - * These two values are encoded in the high and low halves of a GLint. - * By putting the uniform number in the high part and the offset in the - * low part, we can support the unofficial ability to index into arrays - * by adding offsets to the location value. */ /*@{*/ /** - * Combine the uniform's base location and the offset + * Combine the uniform's storage index and the array index */ static inline GLint _mesa_uniform_merge_location_offset(const struct gl_shader_program *prog, - unsigned base_location, unsigned offset) + unsigned storage_index, + unsigned uniform_array_index) { - assert(prog->UniformLocationBaseScale >= 1); - assert(offset < prog->UniformLocationBaseScale); - return (base_location * prog->UniformLocationBaseScale) + offset; + /* location in remap table + array element offset */ + return prog->UniformStorage[storage_index].remap_location + + uniform_array_index; } /** - * Separate the uniform base location and parameter offset + * Separate the uniform storage index and array index */ static inline void _mesa_uniform_split_location_offset(const struct gl_shader_program *prog, - GLint location, unsigned *base_location, - unsigned *offset) + GLint location, unsigned *storage_index, + unsigned *uniform_array_index) { - *offset = location % prog->UniformLocationBaseScale; - *base_location = location / prog->UniformLocationBaseScale; + *storage_index = prog->UniformRemapTable[location] - prog->UniformStorage; + *uniform_array_index = location - + prog->UniformRemapTable[location]->remap_location; + + /*gl_uniform_storage in UniformStorage with the calculated base_location + * must match with the entry in remap table + */ + assert(&prog->UniformStorage[*storage_index] == + prog->UniformRemapTable[location]); } /*@}*/ diff --git a/mesalib/src/mesa/program/symbol_table.c b/mesalib/src/mesa/program/symbol_table.c index 4f6f31f31..2f41322f6 100644 --- a/mesalib/src/mesa/program/symbol_table.c +++ b/mesalib/src/mesa/program/symbol_table.c @@ -112,24 +112,6 @@ struct _mesa_symbol_table { }; -struct _mesa_symbol_table_iterator { - /** - * Name space of symbols returned by this iterator. - */ - int name_space; - - - /** - * Currently iterated symbol - * - * The next call to \c _mesa_symbol_table_iterator_get will return this - * value. It will also update this value to the value that should be - * returned by the next call. - */ - struct symbol *curr; -}; - - static void check_symbol_table(struct _mesa_symbol_table *table) { @@ -201,74 +183,6 @@ find_symbol(struct _mesa_symbol_table *table, const char *name) } -struct _mesa_symbol_table_iterator * -_mesa_symbol_table_iterator_ctor(struct _mesa_symbol_table *table, - int name_space, const char *name) -{ - struct _mesa_symbol_table_iterator *iter = calloc(1, sizeof(*iter)); - struct symbol_header *const hdr = find_symbol(table, name); - - iter->name_space = name_space; - - if (hdr != NULL) { - struct symbol *sym; - - for (sym = hdr->symbols; sym != NULL; sym = sym->next_with_same_name) { - assert(sym->hdr == hdr); - - if ((name_space == -1) || (sym->name_space == name_space)) { - iter->curr = sym; - break; - } - } - } - - return iter; -} - - -void -_mesa_symbol_table_iterator_dtor(struct _mesa_symbol_table_iterator *iter) -{ - free(iter); -} - - -void * -_mesa_symbol_table_iterator_get(struct _mesa_symbol_table_iterator *iter) -{ - return (iter->curr == NULL) ? NULL : iter->curr->data; -} - - -int -_mesa_symbol_table_iterator_next(struct _mesa_symbol_table_iterator *iter) -{ - struct symbol_header *hdr; - - if (iter->curr == NULL) { - return 0; - } - - hdr = iter->curr->hdr; - iter->curr = iter->curr->next_with_same_name; - - while (iter->curr != NULL) { - assert(iter->curr->hdr == hdr); - (void)hdr; - - if ((iter->name_space == -1) - || (iter->curr->name_space == iter->name_space)) { - return 1; - } - - iter->curr = iter->curr->next_with_same_name; - } - - return 0; -} - - /** * Determine the scope "distance" of a symbol from the current scope * diff --git a/mesalib/src/mesa/program/symbol_table.h b/mesalib/src/mesa/program/symbol_table.h index f9d91649b..1027f4761 100644 --- a/mesalib/src/mesa/program/symbol_table.h +++ b/mesalib/src/mesa/program/symbol_table.h @@ -24,7 +24,6 @@ #define MESA_SYMBOL_TABLE_H struct _mesa_symbol_table; -struct _mesa_symbol_table_iterator; extern void _mesa_symbol_table_push_scope(struct _mesa_symbol_table *table); @@ -47,16 +46,4 @@ extern struct _mesa_symbol_table *_mesa_symbol_table_ctor(void); extern void _mesa_symbol_table_dtor(struct _mesa_symbol_table *); -extern struct _mesa_symbol_table_iterator *_mesa_symbol_table_iterator_ctor( - struct _mesa_symbol_table *table, int name_space, const char *name); - -extern void _mesa_symbol_table_iterator_dtor( - struct _mesa_symbol_table_iterator *); - -extern void *_mesa_symbol_table_iterator_get( - struct _mesa_symbol_table_iterator *iter); - -extern int _mesa_symbol_table_iterator_next( - struct _mesa_symbol_table_iterator *iter); - #endif /* MESA_SYMBOL_TABLE_H */ diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index 874ff77b5..e3ba5a88f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -513,7 +513,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } cso_set_vertex_elements(cso, 3, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* convert Z from [0,1] to [-1,-1] to match viewport Z scale/bias */ z = z * 2.0f - 1.0f; diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index 97cc5a232..fcd7e1382 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -307,7 +307,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) } cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); cso_set_sample_mask(st->cso_context, ~0); cso_set_rasterizer(st->cso_context, &st->clear.raster); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c index 90f34e39e..2b3636151 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c @@ -788,7 +788,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, } cso_set_vertex_elements(cso, 3, st->velems_util_draw); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* texture state: */ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index 047cf47b0..b0a44fd90 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -244,7 +244,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, velements[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } cso_set_vertex_elements(cso, numAttribs, velements); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); /* viewport state: viewport matching window dims */ { diff --git a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c index e824fe9b3..8f75eda8a 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_xformfb.c +++ b/mesalib/src/mesa/state_tracker/st_cb_xformfb.c @@ -113,6 +113,7 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode, struct st_transform_feedback_object *sobj = st_transform_feedback_object(obj); unsigned i, max_num_targets; + unsigned offsets[PIPE_MAX_SO_BUFFERS] = {0}; max_num_targets = MIN2(Elements(sobj->base.Buffers), Elements(sobj->targets)); @@ -145,8 +146,8 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode, } /* Start writing at the beginning of each target. */ - cso_set_stream_outputs(st->cso_context, sobj->num_targets, sobj->targets, - 0); + cso_set_stream_outputs(st->cso_context, sobj->num_targets, + sobj->targets, offsets); } @@ -155,7 +156,7 @@ st_pause_transform_feedback(struct gl_context *ctx, struct gl_transform_feedback_object *obj) { struct st_context *st = st_context(ctx); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); } @@ -165,10 +166,15 @@ st_resume_transform_feedback(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct st_transform_feedback_object *sobj = - st_transform_feedback_object(obj); + st_transform_feedback_object(obj); + unsigned offsets[PIPE_MAX_SO_BUFFERS]; + unsigned i; + + for (i = 0; i < PIPE_MAX_SO_BUFFERS; i++) + offsets[i] = (unsigned)-1; - cso_set_stream_outputs(st->cso_context, sobj->num_targets, sobj->targets, - ~0); + cso_set_stream_outputs(st->cso_context, sobj->num_targets, + sobj->targets, offsets); } @@ -198,7 +204,7 @@ st_end_transform_feedback(struct gl_context *ctx, struct st_transform_feedback_object *sobj = st_transform_feedback_object(obj); - cso_set_stream_outputs(st->cso_context, 0, NULL, 0); + cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); pipe_so_target_reference(&sobj->draw_count, st_transform_feedback_get_draw_target(obj)); diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c index a55ee3079..cd6b46681 100644 --- a/mesalib/src/mesa/state_tracker/st_format.c +++ b/mesalib/src/mesa/state_tracker/st_format.c @@ -109,7 +109,7 @@ st_mesa_format_to_pipe_format(mesa_format mesaFormat) return PIPE_FORMAT_S8_UINT_Z24_UNORM; case MESA_FORMAT_Z24_UNORM_S8_UINT: return PIPE_FORMAT_Z24_UNORM_S8_UINT; - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: return PIPE_FORMAT_X8Z24_UNORM; case MESA_FORMAT_Z24_UNORM_X8_UINT: return PIPE_FORMAT_Z24X8_UNORM; @@ -470,7 +470,7 @@ st_pipe_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_S8_UINT_Z24_UNORM: return MESA_FORMAT_S8_UINT_Z24_UNORM; case PIPE_FORMAT_X8Z24_UNORM: - return MESA_FORMAT_X8Z24_UNORM; + return MESA_FORMAT_X8_UINT_Z24_UNORM; case PIPE_FORMAT_Z24X8_UNORM: return MESA_FORMAT_Z24_UNORM_X8_UINT; case PIPE_FORMAT_Z24_UNORM_S8_UINT: diff --git a/mesalib/src/mesa/swrast/s_depth.c b/mesalib/src/mesa/swrast/s_depth.c index 8c225e111..134f897c0 100644 --- a/mesalib/src/mesa/swrast/s_depth.c +++ b/mesalib/src/mesa/swrast/s_depth.c @@ -555,7 +555,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) if (rb->Format == MESA_FORMAT_Z24_UNORM_S8_UINT || rb->Format == MESA_FORMAT_Z24_UNORM_X8_UINT || rb->Format == MESA_FORMAT_S8_UINT_Z24_UNORM || - rb->Format == MESA_FORMAT_X8Z24_UNORM) { + rb->Format == MESA_FORMAT_X8_UINT_Z24_UNORM) { mapMode |= GL_MAP_READ_BIT; } @@ -605,7 +605,7 @@ _swrast_clear_depth_buffer(struct gl_context *ctx) case MESA_FORMAT_Z24_UNORM_S8_UINT: case MESA_FORMAT_Z24_UNORM_X8_UINT: case MESA_FORMAT_S8_UINT_Z24_UNORM: - case MESA_FORMAT_X8Z24_UNORM: + case MESA_FORMAT_X8_UINT_Z24_UNORM: { GLfloat clear = (GLfloat) ctx->Depth.Clear; GLuint clearVal = 0; diff --git a/mesalib/src/mesa/swrast/s_texfetch.c b/mesalib/src/mesa/swrast/s_texfetch.c index 8ba75348f..cd0982705 100644 --- a/mesalib/src/mesa/swrast/s_texfetch.c +++ b/mesalib/src/mesa/swrast/s_texfetch.c @@ -148,6 +148,7 @@ texfetch_funcs[] = fetch_null_texelf }, + /* Packed unorm formats */ { MESA_FORMAT_A8B8G8R8_UNORM, fetch_texel_1d_f_rgba8888, @@ -155,58 +156,58 @@ texfetch_funcs[] = fetch_texel_3d_f_rgba8888 }, { - MESA_FORMAT_R8G8B8A8_UNORM, - fetch_texel_1d_f_rgba8888_rev, - fetch_texel_2d_f_rgba8888_rev, - fetch_texel_3d_f_rgba8888_rev - }, - { - MESA_FORMAT_B8G8R8A8_UNORM, - fetch_texel_1d_f_argb8888, - fetch_texel_2d_f_argb8888, - fetch_texel_3d_f_argb8888 - }, - { - MESA_FORMAT_A8R8G8B8_UNORM, - fetch_texel_1d_f_argb8888_rev, - fetch_texel_2d_f_argb8888_rev, - fetch_texel_3d_f_argb8888_rev - }, - { MESA_FORMAT_X8B8G8R8_UNORM, fetch_texel_1d_f_rgbx8888, fetch_texel_2d_f_rgbx8888, fetch_texel_3d_f_rgbx8888 }, { + MESA_FORMAT_R8G8B8A8_UNORM, + fetch_texel_1d_f_rgba8888_rev, + fetch_texel_2d_f_rgba8888_rev, + fetch_texel_3d_f_rgba8888_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_B8G8R8A8_UNORM, + fetch_texel_1d_f_argb8888, + fetch_texel_2d_f_argb8888, + fetch_texel_3d_f_argb8888 + }, + { MESA_FORMAT_B8G8R8X8_UNORM, fetch_texel_1d_f_xrgb8888, fetch_texel_2d_f_xrgb8888, fetch_texel_3d_f_xrgb8888 }, { + MESA_FORMAT_A8R8G8B8_UNORM, + fetch_texel_1d_f_argb8888_rev, + fetch_texel_2d_f_argb8888_rev, + fetch_texel_3d_f_argb8888_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_BGR_UNORM8, - fetch_texel_1d_f_rgb888, - fetch_texel_2d_f_rgb888, - fetch_texel_3d_f_rgb888 + MESA_FORMAT_L16A16_UNORM, + fetch_texel_1d_f_al1616, + fetch_texel_2d_f_al1616, + fetch_texel_3d_f_al1616 }, { - MESA_FORMAT_RGB_UNORM8, - fetch_texel_1d_f_bgr888, - fetch_texel_2d_f_bgr888, - fetch_texel_3d_f_bgr888 + MESA_FORMAT_A16L16_UNORM, + fetch_texel_1d_f_al1616_rev, + fetch_texel_2d_f_al1616_rev, + fetch_texel_3d_f_al1616_rev }, { MESA_FORMAT_B5G6R5_UNORM, @@ -227,6 +228,12 @@ texfetch_funcs[] = fetch_texel_3d_f_argb4444 }, { + MESA_FORMAT_B4G4R4X4_UNORM, + NULL, + NULL, + NULL + }, + { MESA_FORMAT_A4R4G4B4_UNORM, fetch_texel_1d_f_argb4444_rev, fetch_texel_2d_f_argb4444_rev, @@ -245,18 +252,18 @@ texfetch_funcs[] = fetch_texel_3d_f_argb1555 }, { + MESA_FORMAT_B5G5R5X1_UNORM, + NULL, + NULL, + NULL + }, + { MESA_FORMAT_A1R5G5B5_UNORM, fetch_texel_1d_f_argb1555_rev, fetch_texel_2d_f_argb1555_rev, fetch_texel_3d_f_argb1555_rev }, { - MESA_FORMAT_L4A4_UNORM, - fetch_texel_1d_f_al44, - fetch_texel_2d_f_al44, - fetch_texel_3d_f_al44 - }, - { MESA_FORMAT_L8A8_UNORM, fetch_texel_1d_f_al88, fetch_texel_2d_f_al88, @@ -269,16 +276,22 @@ texfetch_funcs[] = fetch_texel_3d_f_al88_rev }, { - MESA_FORMAT_L16A16_UNORM, - fetch_texel_1d_f_al1616, - fetch_texel_2d_f_al1616, - fetch_texel_3d_f_al1616 + MESA_FORMAT_R8G8_UNORM, + fetch_texel_1d_f_gr88, + fetch_texel_2d_f_gr88, + fetch_texel_3d_f_gr88 }, { - MESA_FORMAT_A16L16_UNORM, - fetch_texel_1d_f_al1616_rev, - fetch_texel_2d_f_al1616_rev, - fetch_texel_3d_f_al1616_rev + MESA_FORMAT_G8R8_UNORM, + fetch_texel_1d_f_rg88, + fetch_texel_2d_f_rg88, + fetch_texel_3d_f_rg88 + }, + { + MESA_FORMAT_L4A4_UNORM, + fetch_texel_1d_f_al44, + fetch_texel_2d_f_al44, + fetch_texel_3d_f_al44 }, { MESA_FORMAT_B2G3R3_UNORM, @@ -287,6 +300,80 @@ texfetch_funcs[] = fetch_texel_3d_f_rgb332 }, { + MESA_FORMAT_R16G16_UNORM, + fetch_texel_1d_f_rg1616, + fetch_texel_2d_f_rg1616, + fetch_texel_3d_f_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_B10G10R10A2_UNORM, + fetch_texel_1d_f_argb2101010, + fetch_texel_2d_f_argb2101010, + fetch_texel_3d_f_argb2101010 + }, + { + MESA_FORMAT_B10G10R10X2_UNORM, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_R10G10B10A2_UNORM, + NULL, + NULL, + NULL + }, + { + 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_X8_UINT_Z24_UNORM, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8 + }, + { + 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_UNORM_X8_UINT, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24 + }, + { + MESA_FORMAT_YCBCR, + fetch_texel_1d_f_ycbcr, + fetch_texel_2d_f_ycbcr, + fetch_texel_3d_f_ycbcr + }, + { + MESA_FORMAT_YCBCR_REV, + fetch_texel_1d_f_ycbcr_rev, + fetch_texel_2d_f_ycbcr_rev, + fetch_texel_3d_f_ycbcr_rev + }, + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8 + }, + + /* Array unorm formats */ + { MESA_FORMAT_A_UNORM8, fetch_texel_1d_f_a8, fetch_texel_2d_f_a8, @@ -323,70 +410,40 @@ texfetch_funcs[] = fetch_texel_3d_f_i16 }, { - MESA_FORMAT_YCBCR, - fetch_texel_1d_f_ycbcr, - fetch_texel_2d_f_ycbcr, - fetch_texel_3d_f_ycbcr - }, - { - MESA_FORMAT_YCBCR_REV, - fetch_texel_1d_f_ycbcr_rev, - fetch_texel_2d_f_ycbcr_rev, - fetch_texel_3d_f_ycbcr_rev - }, - { MESA_FORMAT_R_UNORM8, fetch_texel_1d_f_r8, fetch_texel_2d_f_r8, fetch_texel_3d_f_r8 }, { - MESA_FORMAT_R8G8_UNORM, - fetch_texel_1d_f_gr88, - fetch_texel_2d_f_gr88, - fetch_texel_3d_f_gr88 - }, - { - MESA_FORMAT_G8R8_UNORM, - fetch_texel_1d_f_rg88, - fetch_texel_2d_f_rg88, - fetch_texel_3d_f_rg88 - }, - { MESA_FORMAT_R_UNORM16, fetch_texel_1d_f_r16, fetch_texel_2d_f_r16, fetch_texel_3d_f_r16 }, { - MESA_FORMAT_R16G16_UNORM, - fetch_texel_1d_f_rg1616, - fetch_texel_2d_f_rg1616, - fetch_texel_3d_f_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_BGR_UNORM8, + fetch_texel_1d_f_rgb888, + fetch_texel_2d_f_rgb888, + fetch_texel_3d_f_rgb888 }, { - MESA_FORMAT_B10G10R10A2_UNORM, - fetch_texel_1d_f_argb2101010, - fetch_texel_2d_f_argb2101010, - fetch_texel_3d_f_argb2101010 + MESA_FORMAT_RGB_UNORM8, + fetch_texel_1d_f_bgr888, + fetch_texel_2d_f_bgr888, + fetch_texel_3d_f_bgr888 }, { - 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_RGBA_UNORM16, + fetch_texel_1d_rgba_16, + fetch_texel_2d_rgba_16, + fetch_texel_3d_rgba_16 }, { - 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_RGBX_UNORM16, + fetch_texel_1d_xbgr16161616_unorm, + fetch_texel_2d_xbgr16161616_unorm, + fetch_texel_3d_xbgr16161616_unorm }, { MESA_FORMAT_Z_UNORM16, @@ -395,18 +452,6 @@ texfetch_funcs[] = fetch_texel_3d_f_z16 }, { - 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_X8Z24_UNORM, - fetch_texel_1d_f_z24_s8, - fetch_texel_2d_f_z24_s8, - fetch_texel_3d_f_z24_s8 - }, - { MESA_FORMAT_Z_UNORM32, fetch_texel_1d_f_z32, fetch_texel_2d_f_z32, @@ -418,133 +463,210 @@ texfetch_funcs[] = NULL, NULL }, + + /* Packed signed/normalized formats */ { - MESA_FORMAT_BGR_SRGB8, - fetch_texel_1d_srgb8, - fetch_texel_2d_srgb8, - fetch_texel_3d_srgb8 + MESA_FORMAT_A8B8G8R8_SNORM, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888 }, { - MESA_FORMAT_A8B8G8R8_SRGB, - fetch_texel_1d_srgba8, - fetch_texel_2d_srgba8, - fetch_texel_3d_srgba8 + MESA_FORMAT_X8B8G8R8_SNORM, + fetch_texel_1d_signed_rgbx8888, + fetch_texel_2d_signed_rgbx8888, + fetch_texel_3d_signed_rgbx8888 }, { - MESA_FORMAT_B8G8R8A8_SRGB, - fetch_texel_1d_sargb8, - fetch_texel_2d_sargb8, - fetch_texel_3d_sargb8 + MESA_FORMAT_R8G8B8A8_SNORM, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev }, { - MESA_FORMAT_R8G8B8A8_SRGB, - fetch_texel_1d_sabgr8, - fetch_texel_2d_sabgr8, - fetch_texel_3d_sabgr8 + MESA_FORMAT_R8G8B8X8_SNORM, + NULL, + NULL, + NULL }, { - MESA_FORMAT_L_SRGB8, - fetch_texel_1d_sl8, - fetch_texel_2d_sl8, - fetch_texel_3d_sl8 + MESA_FORMAT_R16G16_SNORM, + fetch_texel_1d_signed_rg1616, + fetch_texel_2d_signed_rg1616, + fetch_texel_3d_signed_rg1616 }, { - MESA_FORMAT_L8A8_SRGB, - fetch_texel_1d_sla8, - fetch_texel_2d_sla8, - fetch_texel_3d_sla8 + MESA_FORMAT_G16R16_SNORM, + NULL, + NULL, + NULL }, { - MESA_FORMAT_SRGB_DXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_R8G8_SNORM, + fetch_texel_1d_signed_rg88_rev, + fetch_texel_2d_signed_rg88_rev, + fetch_texel_3d_signed_rg88_rev }, { - MESA_FORMAT_SRGBA_DXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_G8R8_SNORM, + NULL, + NULL, + NULL }, { - MESA_FORMAT_SRGBA_DXT3, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_L8A8_SNORM, + fetch_texel_1d_signed_al88, + fetch_texel_2d_signed_al88, + fetch_texel_3d_signed_al88 }, + + /* Array signed/normalized formats */ { - MESA_FORMAT_SRGBA_DXT5, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_A_SNORM8, + fetch_texel_1d_signed_a8, + fetch_texel_2d_signed_a8, + fetch_texel_3d_signed_a8 + }, + { + MESA_FORMAT_A_SNORM16, + fetch_texel_1d_signed_a16, + fetch_texel_2d_signed_a16, + fetch_texel_3d_signed_a16 + }, + { + MESA_FORMAT_L_SNORM8, + fetch_texel_1d_signed_l8, + fetch_texel_2d_signed_l8, + fetch_texel_3d_signed_l8 + }, + { + MESA_FORMAT_L_SNORM16, + fetch_texel_1d_signed_l16, + fetch_texel_2d_signed_l16, + fetch_texel_3d_signed_l16 + }, + { + MESA_FORMAT_I_SNORM8, + fetch_texel_1d_signed_i8, + fetch_texel_2d_signed_i8, + fetch_texel_3d_signed_i8 + }, + { + MESA_FORMAT_I_SNORM16, + fetch_texel_1d_signed_i16, + fetch_texel_2d_signed_i16, + fetch_texel_3d_signed_i16 + }, + { + MESA_FORMAT_R_SNORM8, + fetch_texel_1d_signed_r8, + fetch_texel_2d_signed_r8, + fetch_texel_3d_signed_r8 + }, + { + MESA_FORMAT_R_SNORM16, + fetch_texel_1d_signed_r16, + fetch_texel_2d_signed_r16, + fetch_texel_3d_signed_r16 + }, + { + MESA_FORMAT_LA_SNORM16, + fetch_texel_1d_signed_al1616, + fetch_texel_2d_signed_al1616, + fetch_texel_3d_signed_al1616 + }, + { + MESA_FORMAT_RGB_SNORM16, + fetch_texel_1d_signed_rgb_16, + fetch_texel_2d_signed_rgb_16, + fetch_texel_3d_signed_rgb_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_RGBX_SNORM16, + NULL, + NULL, + NULL }, + /* Packed sRGB formats */ { - MESA_FORMAT_RGB_FXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_A8B8G8R8_SRGB, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8 }, { - MESA_FORMAT_RGBA_FXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_B8G8R8A8_SRGB, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8 }, { - MESA_FORMAT_RGB_DXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_B8G8R8X8_SRGB, + NULL, + NULL, + NULL }, { - MESA_FORMAT_RGBA_DXT1, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_R8G8B8A8_SRGB, + fetch_texel_1d_sabgr8, + fetch_texel_2d_sabgr8, + fetch_texel_3d_sabgr8 }, { - MESA_FORMAT_RGBA_DXT3, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_R8G8B8X8_SRGB, + fetch_texel_1d_sxbgr8, + fetch_texel_2d_sxbgr8, + fetch_texel_3d_sxbgr8 }, { - MESA_FORMAT_RGBA_DXT5, - fetch_compressed, - fetch_compressed, - fetch_compressed + MESA_FORMAT_L8A8_SRGB, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8 }, + + /* Array sRGB formats */ { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_f_rgba_f32, - fetch_texel_2d_f_rgba_f32, - fetch_texel_3d_f_rgba_f32 + MESA_FORMAT_L_SRGB8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8 }, { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_f_rgba_f16, - fetch_texel_2d_f_rgba_f16, - fetch_texel_3d_f_rgba_f16 + MESA_FORMAT_BGR_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8 }, + + /* Packed float formats */ { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_f_rgb_f32, - fetch_texel_2d_f_rgb_f32, - fetch_texel_3d_f_rgb_f32 + MESA_FORMAT_R9G9B9E5_FLOAT, + fetch_texel_1d_rgb9_e5, + fetch_texel_2d_rgb9_e5, + fetch_texel_3d_rgb9_e5 }, { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_f_rgb_f16, - fetch_texel_2d_f_rgb_f16, - fetch_texel_3d_f_rgb_f16 + MESA_FORMAT_R11G11B10_FLOAT, + fetch_texel_1d_r11_g11_b10f, + fetch_texel_2d_r11_g11_b10f, + fetch_texel_3d_r11_g11_b10f }, { - MESA_FORMAT_A_FLOAT32, - fetch_texel_1d_f_alpha_f32, - fetch_texel_2d_f_alpha_f32, - fetch_texel_3d_f_alpha_f32 + MESA_FORMAT_Z32_FLOAT_S8X24_UINT, + fetch_texel_1d_z32f_x24s8, + fetch_texel_2d_z32f_x24s8, + fetch_texel_3d_z32f_x24s8 }, + + /* Array float formats */ { MESA_FORMAT_A_FLOAT16, fetch_texel_1d_f_alpha_f16, @@ -552,10 +674,10 @@ texfetch_funcs[] = fetch_texel_3d_f_alpha_f16 }, { - MESA_FORMAT_L_FLOAT32, - fetch_texel_1d_f_luminance_f32, - fetch_texel_2d_f_luminance_f32, - fetch_texel_3d_f_luminance_f32 + MESA_FORMAT_A_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32 }, { MESA_FORMAT_L_FLOAT16, @@ -564,10 +686,10 @@ texfetch_funcs[] = fetch_texel_3d_f_luminance_f16 }, { - 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_L_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32 }, { MESA_FORMAT_LA_FLOAT16, @@ -576,10 +698,10 @@ texfetch_funcs[] = fetch_texel_3d_f_luminance_alpha_f16 }, { - MESA_FORMAT_I_FLOAT32, - fetch_texel_1d_f_intensity_f32, - fetch_texel_2d_f_intensity_f32, - fetch_texel_3d_f_intensity_f32 + 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_I_FLOAT16, @@ -588,10 +710,10 @@ texfetch_funcs[] = fetch_texel_3d_f_intensity_f16 }, { - MESA_FORMAT_R_FLOAT32, - fetch_texel_1d_f_r_f32, - fetch_texel_2d_f_r_f32, - fetch_texel_3d_f_r_f32 + MESA_FORMAT_I_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32 }, { MESA_FORMAT_R_FLOAT16, @@ -600,10 +722,10 @@ texfetch_funcs[] = fetch_texel_3d_f_r_f16 }, { - MESA_FORMAT_RG_FLOAT32, - fetch_texel_1d_f_rg_f32, - fetch_texel_2d_f_rg_f32, - fetch_texel_3d_f_rg_f32 + MESA_FORMAT_R_FLOAT32, + fetch_texel_1d_f_r_f32, + fetch_texel_2d_f_r_f32, + fetch_texel_3d_f_r_f32 }, { MESA_FORMAT_RG_FLOAT16, @@ -611,206 +733,237 @@ texfetch_funcs[] = fetch_texel_2d_f_rg_f16, fetch_texel_3d_f_rg_f16 }, + { + MESA_FORMAT_RG_FLOAT32, + fetch_texel_1d_f_rg_f32, + fetch_texel_2d_f_rg_f32, + fetch_texel_3d_f_rg_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16 + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32 + }, + { + MESA_FORMAT_RGBX_FLOAT16, + fetch_texel_1d_xbgr16161616_float, + fetch_texel_2d_xbgr16161616_float, + fetch_texel_3d_xbgr16161616_float + }, + { + MESA_FORMAT_RGBX_FLOAT32, + fetch_texel_1d_xbgr32323232_float, + fetch_texel_2d_xbgr32323232_float, + fetch_texel_3d_xbgr32323232_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 + }, + /* Packed signed/unsigned non-normalized integer formats */ { - MESA_FORMAT_A_UINT8, + MESA_FORMAT_B10G10R10A2_UINT, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_R10G10B10A2_UINT, NULL, NULL, NULL }, + /* Array signed/unsigned non-normalized integer formats */ + { + MESA_FORMAT_A_UINT8, + NULL, + NULL, + NULL + }, { MESA_FORMAT_A_UINT16, NULL, NULL, NULL }, - { MESA_FORMAT_A_UINT32, NULL, NULL, NULL }, - { MESA_FORMAT_A_SINT8, NULL, NULL, NULL }, - { MESA_FORMAT_A_SINT16, NULL, NULL, NULL }, - { MESA_FORMAT_A_SINT32, NULL, NULL, NULL }, - - { MESA_FORMAT_I_UINT8, NULL, NULL, NULL }, - { MESA_FORMAT_I_UINT16, NULL, NULL, NULL }, - { MESA_FORMAT_I_UINT32, NULL, NULL, NULL }, - { MESA_FORMAT_I_SINT8, NULL, NULL, NULL }, - { MESA_FORMAT_I_SINT16, NULL, NULL, NULL }, - { MESA_FORMAT_I_SINT32, NULL, NULL, NULL }, - - { MESA_FORMAT_L_UINT8, NULL, NULL, NULL }, - { MESA_FORMAT_L_UINT16, NULL, NULL, NULL }, - { MESA_FORMAT_L_UINT32, NULL, NULL, NULL }, - { MESA_FORMAT_L_SINT8, NULL, NULL, NULL }, - { MESA_FORMAT_L_SINT16, NULL, NULL, NULL }, - { MESA_FORMAT_L_SINT32, NULL, NULL, NULL }, - - { MESA_FORMAT_LA_UINT8, NULL, NULL, NULL }, - { MESA_FORMAT_LA_UINT16, NULL, NULL, NULL }, - { MESA_FORMAT_LA_UINT32, NULL, NULL, NULL }, - { MESA_FORMAT_LA_SINT8, NULL, NULL, NULL }, - { MESA_FORMAT_LA_SINT16, NULL, NULL, NULL }, - { MESA_FORMAT_LA_SINT32, NULL, NULL, NULL }, - - { - MESA_FORMAT_R_SINT8, + MESA_FORMAT_R_UINT8, NULL, NULL, NULL }, - { - MESA_FORMAT_RG_SINT8, + MESA_FORMAT_R_UINT16, NULL, NULL, NULL }, - { - MESA_FORMAT_RGB_SINT8, + MESA_FORMAT_R_UINT32, NULL, NULL, NULL }, - - /* non-normalized, signed int */ { - MESA_FORMAT_RGBA_SINT8, - fetch_texel_1d_rgba_int8, - fetch_texel_2d_rgba_int8, - fetch_texel_3d_rgba_int8 + MESA_FORMAT_R_SINT8, + NULL, + NULL, + NULL }, { MESA_FORMAT_R_SINT16, @@ -819,191 +972,223 @@ texfetch_funcs[] = NULL }, { - MESA_FORMAT_RG_SINT16, + MESA_FORMAT_R_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_SINT16, + MESA_FORMAT_RG_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_SINT16, - fetch_texel_1d_rgba_int16, - fetch_texel_2d_rgba_int16, - fetch_texel_3d_rgba_int16 - }, - { - MESA_FORMAT_R_SINT32, + MESA_FORMAT_RG_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RG_SINT32, + MESA_FORMAT_RG_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_SINT32, + MESA_FORMAT_RG_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_SINT32, - fetch_texel_1d_rgba_int32, - fetch_texel_2d_rgba_int32, - fetch_texel_3d_rgba_int32 + MESA_FORMAT_RG_SINT16, + NULL, + NULL, + NULL }, - - /* non-normalized, unsigned int */ { - MESA_FORMAT_R_UINT8, + MESA_FORMAT_RG_SINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RG_UINT8, + MESA_FORMAT_RGB_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_UINT8, + MESA_FORMAT_RGB_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_UINT8, - fetch_texel_1d_rgba_uint8, - fetch_texel_2d_rgba_uint8, - fetch_texel_3d_rgba_uint8 + MESA_FORMAT_RGB_UINT32, + NULL, + NULL, + NULL }, { - MESA_FORMAT_R_UINT16, + MESA_FORMAT_RGB_SINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RG_UINT16, + MESA_FORMAT_RGB_SINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_UINT16, + MESA_FORMAT_RGB_SINT32, NULL, NULL, NULL }, { + MESA_FORMAT_RGBA_UINT8, + fetch_texel_1d_rgba_uint8, + fetch_texel_2d_rgba_uint8, + fetch_texel_3d_rgba_uint8 + }, + { MESA_FORMAT_RGBA_UINT16, fetch_texel_1d_rgba_uint16, fetch_texel_2d_rgba_uint16, fetch_texel_3d_rgba_uint16 }, { - MESA_FORMAT_R_UINT32, + MESA_FORMAT_RGBA_UINT32, + fetch_texel_1d_rgba_uint32, + fetch_texel_2d_rgba_uint32, + fetch_texel_3d_rgba_uint32 + }, + { + MESA_FORMAT_RGBA_SINT8, + fetch_texel_1d_rgba_int8, + fetch_texel_2d_rgba_int8, + fetch_texel_3d_rgba_int8 + }, + { + MESA_FORMAT_RGBA_SINT16, + fetch_texel_1d_rgba_int16, + fetch_texel_2d_rgba_int16, + fetch_texel_3d_rgba_int16 + }, + { + MESA_FORMAT_RGBA_SINT32, + fetch_texel_1d_rgba_int32, + fetch_texel_2d_rgba_int32, + fetch_texel_3d_rgba_int32 + }, + { + MESA_FORMAT_RGBX_UINT8, NULL, NULL, NULL }, { - MESA_FORMAT_RG_UINT32, + MESA_FORMAT_RGBX_UINT16, NULL, NULL, NULL }, { - MESA_FORMAT_RGB_UINT32, + MESA_FORMAT_RGBX_UINT32, NULL, NULL, NULL }, { - MESA_FORMAT_RGBA_UINT32, - fetch_texel_1d_rgba_uint32, - fetch_texel_2d_rgba_uint32, - fetch_texel_3d_rgba_uint32 + MESA_FORMAT_RGBX_SINT8, + NULL, + NULL, + NULL }, - - /* dudv */ { - MESA_FORMAT_DUDV8, - fetch_texel_1d_dudv8, - fetch_texel_2d_dudv8, - fetch_texel_3d_dudv8 + MESA_FORMAT_RGBX_SINT16, + NULL, + NULL, + NULL + }, + { + MESA_FORMAT_RGBX_SINT32, + NULL, + NULL, + NULL }, - /* signed, normalized */ + /* DXT compressed formats */ { - MESA_FORMAT_R_SNORM8, - fetch_texel_1d_signed_r8, - fetch_texel_2d_signed_r8, - fetch_texel_3d_signed_r8 + MESA_FORMAT_RGB_DXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_R8G8_SNORM, - fetch_texel_1d_signed_rg88_rev, - fetch_texel_2d_signed_rg88_rev, - fetch_texel_3d_signed_rg88_rev + MESA_FORMAT_RGBA_DXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_X8B8G8R8_SNORM, - fetch_texel_1d_signed_rgbx8888, - fetch_texel_2d_signed_rgbx8888, - fetch_texel_3d_signed_rgbx8888 + MESA_FORMAT_RGBA_DXT3, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_A8B8G8R8_SNORM, - fetch_texel_1d_signed_rgba8888, - fetch_texel_2d_signed_rgba8888, - fetch_texel_3d_signed_rgba8888 + MESA_FORMAT_RGBA_DXT5, + fetch_compressed, + fetch_compressed, + fetch_compressed }, + + /* DXT sRGB compressed formats */ { - MESA_FORMAT_R8G8B8A8_SNORM, - fetch_texel_1d_signed_rgba8888_rev, - fetch_texel_2d_signed_rgba8888_rev, - fetch_texel_3d_signed_rgba8888_rev + MESA_FORMAT_SRGB_DXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_R_SNORM16, - fetch_texel_1d_signed_r16, - fetch_texel_2d_signed_r16, - fetch_texel_3d_signed_r16 + MESA_FORMAT_SRGBA_DXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_R16G16_SNORM, - fetch_texel_1d_signed_rg1616, - fetch_texel_2d_signed_rg1616, - fetch_texel_3d_signed_rg1616 + MESA_FORMAT_SRGBA_DXT3, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_RGB_SNORM16, - fetch_texel_1d_signed_rgb_16, - fetch_texel_2d_signed_rgb_16, - fetch_texel_3d_signed_rgb_16 + MESA_FORMAT_SRGBA_DXT5, + fetch_compressed, + fetch_compressed, + fetch_compressed }, + + /* FXT1 compressed formats */ { - MESA_FORMAT_RGBA_SNORM16, - fetch_texel_1d_signed_rgba_16, - fetch_texel_2d_signed_rgba_16, - fetch_texel_3d_signed_rgba_16 + MESA_FORMAT_RGB_FXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, { - MESA_FORMAT_RGBA_UNORM16, - fetch_texel_1d_rgba_16, - fetch_texel_2d_rgba_16, - fetch_texel_3d_rgba_16 + MESA_FORMAT_RGBA_FXT1, + fetch_compressed, + fetch_compressed, + fetch_compressed }, + + /* RGTC compressed formats */ { MESA_FORMAT_R_RGTC1_UNORM, fetch_compressed, @@ -1028,6 +1213,8 @@ texfetch_funcs[] = fetch_compressed, fetch_compressed }, + + /* LATC1/2 compressed formats */ { MESA_FORMAT_L_LATC1_UNORM, fetch_compressed, @@ -1052,6 +1239,8 @@ texfetch_funcs[] = fetch_compressed, fetch_compressed }, + + /* ETC1/2 compressed formats */ { MESA_FORMAT_ETC1_RGB8, fetch_compressed, @@ -1117,205 +1306,7 @@ texfetch_funcs[] = fetch_compressed, fetch_compressed, fetch_compressed - }, - { - MESA_FORMAT_A_SNORM8, - fetch_texel_1d_signed_a8, - fetch_texel_2d_signed_a8, - fetch_texel_3d_signed_a8 - }, - { - MESA_FORMAT_L_SNORM8, - fetch_texel_1d_signed_l8, - fetch_texel_2d_signed_l8, - fetch_texel_3d_signed_l8 - }, - { - MESA_FORMAT_L8A8_SNORM, - fetch_texel_1d_signed_al88, - fetch_texel_2d_signed_al88, - fetch_texel_3d_signed_al88 - }, - { - MESA_FORMAT_I_SNORM8, - fetch_texel_1d_signed_i8, - fetch_texel_2d_signed_i8, - fetch_texel_3d_signed_i8 - }, - { - MESA_FORMAT_A_SNORM16, - fetch_texel_1d_signed_a16, - fetch_texel_2d_signed_a16, - fetch_texel_3d_signed_a16 - }, - { - MESA_FORMAT_L_SNORM16, - fetch_texel_1d_signed_l16, - fetch_texel_2d_signed_l16, - fetch_texel_3d_signed_l16 - }, - { - MESA_FORMAT_LA_SNORM16, - fetch_texel_1d_signed_al1616, - fetch_texel_2d_signed_al1616, - fetch_texel_3d_signed_al1616 - }, - { - MESA_FORMAT_I_SNORM16, - fetch_texel_1d_signed_i16, - fetch_texel_2d_signed_i16, - fetch_texel_3d_signed_i16 - }, - { - MESA_FORMAT_R9G9B9E5_FLOAT, - fetch_texel_1d_rgb9_e5, - fetch_texel_2d_rgb9_e5, - fetch_texel_3d_rgb9_e5 - }, - { - MESA_FORMAT_R11G11B10_FLOAT, - fetch_texel_1d_r11_g11_b10f, - fetch_texel_2d_r11_g11_b10f, - fetch_texel_3d_r11_g11_b10f - }, - { - 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_S8X24_UINT, - fetch_texel_1d_z32f_x24s8, - fetch_texel_2d_z32f_x24s8, - fetch_texel_3d_z32f_x24s8 - }, - { - MESA_FORMAT_B10G10R10A2_UINT, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UINT, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_B4G4R4X4_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_B5G5R5X1_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8B8X8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R8G8B8X8_SRGB, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT8, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_B10G10R10X2_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_UNORM16, - fetch_texel_1d_xbgr16161616_unorm, - fetch_texel_2d_xbgr16161616_unorm, - fetch_texel_3d_xbgr16161616_unorm - }, - { - MESA_FORMAT_RGBX_SNORM16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_FLOAT16, - fetch_texel_1d_xbgr16161616_float, - fetch_texel_2d_xbgr16161616_float, - fetch_texel_3d_xbgr16161616_float - }, - { - MESA_FORMAT_RGBX_UINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT16, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_FLOAT32, - fetch_texel_1d_xbgr32323232_float, - fetch_texel_2d_xbgr32323232_float, - fetch_texel_3d_xbgr32323232_float - }, - { - MESA_FORMAT_RGBX_UINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_RGBX_SINT32, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_R10G10B10A2_UNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_G8R8_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_G16R16_SNORM, - NULL, - NULL, - NULL - }, - { - MESA_FORMAT_B8G8R8X8_SRGB, - NULL, - NULL, - NULL - }, + } }; diff --git a/mesalib/src/mesa/swrast/s_texfetch_tmp.h b/mesalib/src/mesa/swrast/s_texfetch_tmp.h index 8821125a0..f749b491f 100644 --- a/mesalib/src/mesa/swrast/s_texfetch_tmp.h +++ b/mesalib/src/mesa/swrast/s_texfetch_tmp.h @@ -1027,6 +1027,17 @@ static void FETCH(sabgr8)(const struct swrast_texture_image *texImage, } +/* Fetch texel from 1D, 2D or 3D sabgr8 texture, return 4 GLfloats */ +static void FETCH(sxbgr8)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[RCOMP] = nonlinear_to_linear( (s ) & 0xff ); + texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); + texel[BCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); + texel[ACOMP] = 1.0f; +} + /* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */ static void FETCH(sl8)(const struct swrast_texture_image *texImage, @@ -1552,7 +1563,7 @@ static void FETCH(f_z24_s8)( const struct swrast_texture_image *texImage, const GLdouble scale = 1.0 / (GLdouble) 0xffffff; texel[0] = (GLfloat) (((*src) >> 8) * scale); ASSERT(texImage->Base.TexFormat == MESA_FORMAT_S8_UINT_Z24_UNORM || - texImage->Base.TexFormat == MESA_FORMAT_X8Z24_UNORM); + texImage->Base.TexFormat == MESA_FORMAT_X8_UINT_Z24_UNORM); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } |