diff options
69 files changed, 2247 insertions, 2321 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); } diff --git a/xkbcomp/geometry.c b/xkbcomp/geometry.c index 2daa213ac..5d653160e 100644 --- a/xkbcomp/geometry.c +++ b/xkbcomp/geometry.c @@ -2423,7 +2423,6 @@ HandleShapeBody(ShapeDef * def, ShapeInfo * si, unsigned merge, ol->points, info); continue; } - outline = NULL; outline = &si->outlines[nOut++]; outline->num_points = ol->nPoints; outline->corner_radius = si->dfltCornerRadius; diff --git a/xkbcomp/keycodes.c b/xkbcomp/keycodes.c index 4081ea1b5..57c8bc892 100644 --- a/xkbcomp/keycodes.c +++ b/xkbcomp/keycodes.c @@ -261,7 +261,7 @@ AddIndicatorName(KeyNamesInfo * info, IndicatorNameInfo * new) new = NextIndicatorName(info); if (!new) { - WSGO1("Couldn't allocate name for indicator %d\n", new->ndx); + WSGO1("Couldn't allocate name for indicator %d\n", old->ndx); ACTION("Ignored\n"); return False; } diff --git a/xkbcomp/keytypes.c b/xkbcomp/keytypes.c index 375ca3e0d..103d86074 100644 --- a/xkbcomp/keytypes.c +++ b/xkbcomp/keytypes.c @@ -597,7 +597,7 @@ AddPreserve(XkbDescPtr xkb, if (!old) { WSGO1("Couldn't allocate preserve in %s\n", TypeTxt(type)); - ACTION1("Preserve[%s] lost\n", PreserveIndexTxt(type, xkb, old)); + ACTION1("Preserve[%s] lost\n", PreserveIndexTxt(type, xkb, new)); return False; } *old = *new; diff --git a/xkbcomp/listing.c b/xkbcomp/listing.c index 86c1dfb8b..2860ec728 100644 --- a/xkbcomp/listing.c +++ b/xkbcomp/listing.c @@ -302,8 +302,8 @@ AddDirectory(char *head, char *ptrn, char *rest, char *map) #else if ((dirp = opendir((head ? head : "."))) == NULL) return 0; - nMatch = 0; #endif + nMatch = 0; #ifdef WIN32 do #else diff --git a/xkbcomp/parseutils.c b/xkbcomp/parseutils.c index 4b2a3e605..ab50c5710 100644 --- a/xkbcomp/parseutils.c +++ b/xkbcomp/parseutils.c @@ -561,10 +561,8 @@ OverlayKeyCreate(char *under, char *over) key->common.stmtType = StmtOverlayKeyDef; strncpy(key->over, over, XkbKeyNameLength); strncpy(key->under, under, XkbKeyNameLength); - if (over) - uFree(over); - if (under) - uFree(under); + uFree(over); + uFree(under); } return key; } diff --git a/xorg-server/config/config.c b/xorg-server/config/config.c index 732670038..883402bb5 100644 --- a/xorg-server/config/config.c +++ b/xorg-server/config/config.c @@ -159,23 +159,38 @@ config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id) return NULL; } +static struct OdevAttribute * +config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib) +{ + struct OdevAttribute *oa; + + oa = config_odev_find_attribute(attribs, attrib); + if (oa) + return oa; + + oa = calloc(1, sizeof(struct OdevAttribute)); + if (!oa) + return oa; + + oa->attrib_id = attrib; + xorg_list_append(&oa->member, &attribs->list); + + return oa; +} + Bool config_odev_add_attribute(struct OdevAttributes *attribs, int attrib, const char *attrib_name) { struct OdevAttribute *oa; - oa = config_odev_find_attribute(attribs, attrib); - if (!oa) - oa = calloc(1, sizeof(struct OdevAttribute)); + oa = config_odev_find_or_add_attribute(attribs, attrib); if (!oa) return FALSE; - oa->attrib_id = attrib; free(oa->attrib_name); oa->attrib_name = strdup(attrib_name); oa->attrib_type = ODEV_ATTRIB_STRING; - xorg_list_append(&oa->member, &attribs->list); return TRUE; } @@ -185,16 +200,12 @@ config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib, { struct OdevAttribute *oa; - oa = config_odev_find_attribute(attribs, attrib); - if (!oa) - oa = calloc(1, sizeof(struct OdevAttribute)); + oa = config_odev_find_or_add_attribute(attribs, attrib); if (!oa) return FALSE; - oa->attrib_id = attrib; oa->attrib_value = attrib_value; oa->attrib_type = ODEV_ATTRIB_INT; - xorg_list_append(&oa->member, &attribs->list); return TRUE; } @@ -246,7 +257,8 @@ config_odev_free_attributes(struct OdevAttributes *attribs) case ODEV_ATTRIB_FD: fd = iter->attrib_value; break; } xorg_list_del(&iter->member); - free(iter->attrib_name); + if (iter->attrib_type == ODEV_ATTRIB_STRING) + free(iter->attrib_name); free(iter); } diff --git a/xorg-server/config/hal.c b/xorg-server/config/hal.c index 94cb6e7cd..ea574ca52 100644 --- a/xorg-server/config/hal.c +++ b/xorg-server/config/hal.c @@ -185,8 +185,7 @@ device_added(LibHalContext * hal_ctx, const char *udi) parent = get_prop_string(hal_ctx, udi, "info.parent"); if (parent) { int usb_vendor, usb_product; - - attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + char *old_parent; /* construct USB ID in lowercase - "0000:ffff" */ usb_vendor = libhal_device_get_property_int(hal_ctx, parent, @@ -204,7 +203,18 @@ device_added(LibHalContext * hal_ctx, const char *udi) == -1) attrs.usb_id = NULL; - free(parent); + attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + old_parent = parent; + + while (!attrs.pnp_id && + (parent = get_prop_string(hal_ctx, parent, "info.parent"))) { + attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id"); + + free(old_parent); + old_parent = parent; + } + + free(old_parent); } input_options = input_option_new(NULL, "_source", "server/hal"); diff --git a/xorg-server/config/udev.c b/xorg-server/config/udev.c index d70eeb48c..d88abaaa1 100644 --- a/xorg-server/config/udev.c +++ b/xorg-server/config/udev.c @@ -149,10 +149,6 @@ device_added(struct udev_device *udev_device) LOG_PROPERTY(ppath, "NAME", name); } - if (pnp_id) - attrs.pnp_id = strdup(pnp_id); - LOG_SYSATTR(ppath, "id", pnp_id); - /* construct USB ID in lowercase hex - "0000:ffff" */ if (product && sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) { @@ -164,6 +160,17 @@ device_added(struct udev_device *udev_device) LOG_PROPERTY(ppath, "PRODUCT", product); attrs.usb_id = usb_id; } + + while (!pnp_id && (parent = udev_device_get_parent(parent))) { + pnp_id = udev_device_get_sysattr_value(parent, "id"); + if (!pnp_id) + continue; + + attrs.pnp_id = strdup(pnp_id); + ppath = udev_device_get_devnode(parent); + LOG_SYSATTR(ppath, "id", pnp_id); + } + } if (!name) name = "(unnamed)"; diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 4e20b50d4..903417f77 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -417,6 +417,8 @@ EnableDevice(DeviceIntPtr dev, BOOL sendevent) XISendDeviceHierarchyEvent(flags); } + if (!IsMaster(dev)) + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); RecalculateMasterButtons(dev); /* initialise an idle timer for this device*/ @@ -2650,6 +2652,7 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master) dev->spriteInfo->paired = master; dev->spriteInfo->spriteOwner = FALSE; + XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0); RecalculateMasterButtons(master); } diff --git a/xorg-server/glamor/Makefile.am b/xorg-server/glamor/Makefile.am index 77492bcaa..ffc8c23d8 100644 --- a/xorg-server/glamor/Makefile.am +++ b/xorg-server/glamor/Makefile.am @@ -34,6 +34,7 @@ libglamor_la_SOURCES = \ glamor_pixmap.c\ glamor_largepixmap.c\ glamor_picture.c\ + glamor_vbo.c \ glamor_window.c\ glamor_fbo.c\ glamor_compositerects.c\ diff --git a/xorg-server/glamor/glamor.c b/xorg-server/glamor/glamor.c index fa753bb1a..e85617927 100644 --- a/xorg-server/glamor/glamor.c +++ b/xorg-server/glamor/glamor.c @@ -319,6 +319,19 @@ glamor_init(ScreenPtr screen, unsigned int flags) gl_version = glamor_gl_get_version(); + /* We'd like to require GL_ARB_map_buffer_range or + * GL_OES_map_buffer_range, since it offers more information to + * the driver than plain old glMapBuffer() or glBufferSubData(). + * It's been supported on Mesa on the desktop since 2009 and on + * GLES2 since October 2012. It's supported on Apple's iOS + * drivers for SGX535 and A7, but apparently not on most Android + * devices (the OES extension spec wasn't released until June + * 2012). + * + * 82% of 0 A.D. players (desktop GL) submitting hardware reports + * have support for it, with most of the ones lacking it being on + * Windows with Intel 4-series (G45) graphics or older. + */ if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { if (gl_version < GLAMOR_GL_VERSION_ENCODE(1, 3)) { ErrorF("Require OpenGL version 1.3 or later.\n"); @@ -340,6 +353,8 @@ glamor_init(ScreenPtr screen, unsigned int flags) glamor_gl_has_extension("GL_MESA_pack_invert"); glamor_priv->has_fbo_blit = glamor_gl_has_extension("GL_EXT_framebuffer_blit"); + glamor_priv->has_buffer_storage = + glamor_gl_has_extension("GL_ARB_buffer_storage"); glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size); #ifdef MAX_FBO_SIZE glamor_priv->max_fbo_size = MAX_FBO_SIZE; @@ -426,6 +441,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) ps->DestroyPicture = glamor_destroy_picture; glamor_init_composite_shaders(screen); #endif + glamor_init_vbo(screen); glamor_init_pixmap_fbo(screen); glamor_init_solid_shader(screen); glamor_init_tile_shader(screen); @@ -465,6 +481,7 @@ glamor_release_screen_priv(ScreenPtr screen) #ifdef RENDER glamor_fini_composite_shaders(screen); #endif + glamor_fini_vbo(screen); glamor_fini_pixmap_fbo(screen); glamor_fini_solid_shader(screen); glamor_fini_tile_shader(screen); diff --git a/xorg-server/glamor/glamor.h b/xorg-server/glamor/glamor.h index e12f497cb..e25dc735c 100644 --- a/xorg-server/glamor/glamor.h +++ b/xorg-server/glamor/glamor.h @@ -324,6 +324,7 @@ extern _X_EXPORT int glamor_create_gc(GCPtr gc); extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable); + /* Glamor rendering/drawing functions with XXX_nf. * nf means no fallback within glamor internal if possible. If glamor * fail to accelerate the operation, glamor will return a false, and the diff --git a/xorg-server/glamor/glamor_gradient.c b/xorg-server/glamor/glamor_gradient.c index 9f6f1b1cf..6a7b528f9 100644 --- a/xorg-server/glamor/glamor_gradient.c +++ b/xorg-server/glamor/glamor_gradient.c @@ -46,8 +46,6 @@ static const char * _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count, int use_array) { - glamor_screen_private *glamor_priv; - char *gradient_fs = NULL; #define gradient_fs_getcolor\ @@ -174,9 +172,6 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count, " return gradient_color;\n" "}\n"; - glamor_priv = glamor_get_screen_private(screen); - glamor_get_context(glamor_priv); - if (use_array) { XNFasprintf(&gradient_fs, gradient_fs_getcolor, stops_count, stops_count); diff --git a/xorg-server/glamor/glamor_pixmap.c b/xorg-server/glamor/glamor_pixmap.c index 77197b5d1..119e4d9d1 100644 --- a/xorg-server/glamor/glamor_pixmap.c +++ b/xorg-server/glamor/glamor_pixmap.c @@ -697,7 +697,6 @@ glamor_color_convert_to_bits(void *src_bits, void *dst_bits, int w, int h, * Upload pixmap to a specified texture. * This texture may not be the one attached to it. **/ -int in_restore = 0; static void __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex, GLenum format, @@ -1529,7 +1528,7 @@ glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv) drawable = &pixmap_priv->base.pixmap->drawable; - if (!GLAMOR_PIXMAP_FBO_NOT_EAXCT_SIZE(pixmap_priv)) + if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)) return TRUE; old_fbo = pixmap_priv->base.fbo; diff --git a/xorg-server/glamor/glamor_priv.h b/xorg-server/glamor/glamor_priv.h index fe4b42332..d15eabd9e 100644 --- a/xorg-server/glamor/glamor_priv.h +++ b/xorg-server/glamor/glamor_priv.h @@ -208,6 +208,7 @@ typedef struct glamor_screen_private { enum glamor_gl_flavor gl_flavor; int has_pack_invert; int has_fbo_blit; + int has_buffer_storage; int max_fbo_size; struct xorg_list @@ -220,8 +221,15 @@ typedef struct glamor_screen_private { /* vertext/elment_index buffer object for render */ GLuint vbo, ebo; + /** Next offset within the VBO that glamor_get_vbo_space() will use. */ int vbo_offset; int vbo_size; + /** + * Pointer to glamor_get_vbo_space()'s current VBO mapping. + * + * Note that this is not necessarily equal to the pointer returned + * by glamor_get_vbo_space(), so it can't be used in place of that. + */ char *vb; int vb_stride; Bool has_source_coords, has_mask_coords; @@ -702,11 +710,7 @@ void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv, glamor_composite_shader *shader, struct blendinfo *op_info); -void glamor_setup_composite_vbo(ScreenPtr screen, int n_verts); -void glamor_emit_composite_vert(ScreenPtr screen, - const float *src_coords, - const float *mask_coords, - const float *dst_coords, int i); +void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts); /* glamor_trapezoid.c */ void glamor_trapezoids(CARD8 op, @@ -748,6 +752,17 @@ void glamor_triangles(CARD8 op, void glamor_pixmap_init(ScreenPtr screen); void glamor_pixmap_fini(ScreenPtr screen); +/* glamor_vbo.c */ + +void glamor_init_vbo(ScreenPtr screen); +void glamor_fini_vbo(ScreenPtr screen); + +void * +glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset); + +void +glamor_put_vbo_space(ScreenPtr screen); + /** * Download a pixmap's texture to cpu memory. If success, * One copy of current pixmap's texture will be put into diff --git a/xorg-server/glamor/glamor_render.c b/xorg-server/glamor/glamor_render.c index 093a2151d..086526d2e 100644 --- a/xorg-server/glamor/glamor_render.c +++ b/xorg-server/glamor/glamor_render.c @@ -403,12 +403,10 @@ glamor_init_composite_shaders(ScreenPtr screen) { glamor_screen_private *glamor_priv; unsigned short *eb; - float *vb = NULL; int eb_size; glamor_priv = glamor_get_screen_private(screen); glamor_get_context(glamor_priv); - glGenBuffers(1, &glamor_priv->vbo); glGenBuffers(1, &glamor_priv->ebo); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); @@ -419,9 +417,6 @@ glamor_init_composite_shaders(ScreenPtr screen) eb = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); } else { - vb = malloc(GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * 2); - if (vb == NULL) - FatalError("Failed to allocate vb memory.\n"); eb = malloc(eb_size); } @@ -438,14 +433,7 @@ glamor_init_composite_shaders(ScreenPtr screen) glBufferData(GL_ELEMENT_ARRAY_BUFFER, eb_size, eb, GL_STATIC_DRAW); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - glBufferData(GL_ARRAY_BUFFER, - GLAMOR_COMPOSITE_VBO_VERT_CNT * sizeof(float) * - 2, NULL, GL_DYNAMIC_DRAW); - glBindBuffer(GL_ARRAY_BUFFER, 0); - free(eb); - glamor_priv->vb = (char *) vb; } glamor_put_context(glamor_priv); @@ -460,7 +448,6 @@ glamor_fini_composite_shaders(ScreenPtr screen) glamor_priv = glamor_get_screen_private(screen); glamor_get_context(glamor_priv); - glDeleteBuffers(1, &glamor_priv->vbo); glDeleteBuffers(1, &glamor_priv->ebo); for (i = 0; i < SHADER_SOURCE_COUNT; i++) @@ -470,8 +457,6 @@ glamor_fini_composite_shaders(ScreenPtr screen) if (shader->prog) glDeleteProgram(shader->prog); } - if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP && glamor_priv->vb) - free(glamor_priv->vb); glamor_put_context(glamor_priv); } @@ -584,7 +569,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit, else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2 || pixmap_priv->type == GLAMOR_TEXTURE_LARGE) { if (picture->transform - || (GLAMOR_PIXMAP_FBO_NOT_EAXCT_SIZE(pixmap_priv))) + || (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))) repeat_type += RepeatFix; } if (repeat_type >= RepeatFix) { @@ -701,11 +686,13 @@ glamor_composite_with_copy(CARD8 op, return ret; } -void +void * glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); int vert_size; + char *vbo_offset; + float *vb; glamor_priv->render_nr_verts = 0; glamor_priv->vb_stride = 2 * sizeof(float); @@ -717,78 +704,32 @@ glamor_setup_composite_vbo(ScreenPtr screen, int n_verts) vert_size = n_verts * glamor_priv->vb_stride; glamor_get_context(glamor_priv); - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { - if (glamor_priv->vbo_size < (glamor_priv->vbo_offset + vert_size)) { - glamor_priv->vbo_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * - glamor_priv->vb_stride; - glamor_priv->vbo_offset = 0; - glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); - } - - glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - vert_size, - GL_MAP_WRITE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT); - assert(glamor_priv->vb != NULL); - glamor_priv->vb -= glamor_priv->vbo_offset; - } - else - glamor_priv->vbo_offset = 0; + vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, - glamor_priv->vb_stride, - (void *) ((long) - glamor_priv->vbo_offset)); + glamor_priv->vb_stride, vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); if (glamor_priv->has_source_coords) { glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - 2 * sizeof(float))); + vbo_offset + 2 * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); } if (glamor_priv->has_mask_coords) { glVertexAttribPointer(GLAMOR_VERTEX_MASK, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - (glamor_priv->has_source_coords ? - 4 : 2) * sizeof(float))); + vbo_offset + (glamor_priv->has_source_coords ? + 4 : 2) * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_MASK); } glamor_put_context(glamor_priv); -} - -void -glamor_emit_composite_vert(ScreenPtr screen, - const float *src_coords, - const float *mask_coords, - const float *dst_coords, int i) -{ - glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); - float *vb = (float *) (glamor_priv->vb + glamor_priv->vbo_offset); - int j = 0; - vb[j++] = dst_coords[i * 2 + 0]; - vb[j++] = dst_coords[i * 2 + 1]; - if (glamor_priv->has_source_coords) { - vb[j++] = src_coords[i * 2 + 0]; - vb[j++] = src_coords[i * 2 + 1]; - } - if (glamor_priv->has_mask_coords) { - vb[j++] = mask_coords[i * 2 + 0]; - vb[j++] = mask_coords[i * 2 + 1]; - } - - glamor_priv->render_nr_verts++; - glamor_priv->vbo_offset += glamor_priv->vb_stride; + return vb; } static void @@ -797,14 +738,6 @@ glamor_flush_composite_rects(ScreenPtr screen) glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_get_context(glamor_priv); - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - glUnmapBuffer(GL_ARRAY_BUFFER); - else { - - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); - } if (!glamor_priv->render_nr_verts) return; @@ -1250,14 +1183,12 @@ glamor_composite_with_shader(CARD8 op, GLfloat dst_xscale, dst_yscale; GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1; struct shader_key key, key_ca; - float *vertices; int dest_x_off, dest_y_off; int source_x_off, source_y_off; int mask_x_off, mask_y_off; PictFormatShort saved_source_format = 0; float src_matrix[9], mask_matrix[9]; float *psrc_matrix = NULL, *pmask_matrix = NULL; - int vert_stride = 4; int nrect_max; Bool ret = FALSE; glamor_composite_shader *shader = NULL, *shader_ca = NULL; @@ -1306,7 +1237,6 @@ glamor_composite_with_shader(CARD8 op, psrc_matrix = src_matrix; glamor_picture_get_matrixf(source, psrc_matrix); } - vert_stride += 4; } if (glamor_priv->has_mask_coords) { @@ -1318,18 +1248,17 @@ glamor_composite_with_shader(CARD8 op, pmask_matrix = mask_matrix; glamor_picture_get_matrixf(mask, pmask_matrix); } - vert_stride += 4; } - nrect_max = (vert_stride * nrect) > GLAMOR_COMPOSITE_VBO_VERT_CNT ? - (GLAMOR_COMPOSITE_VBO_VERT_CNT / vert_stride) : nrect; + nrect_max = MIN(nrect, GLAMOR_COMPOSITE_VBO_VERT_CNT / 4); while (nrect) { int mrect, rect_processed; int vb_stride; + float *vertices; mrect = nrect > nrect_max ? nrect_max : nrect; - glamor_setup_composite_vbo(screen, mrect * vert_stride); + vertices = glamor_setup_composite_vbo(screen, mrect * 4); rect_processed = mrect; vb_stride = glamor_priv->vb_stride / sizeof(float); while (mrect--) { @@ -1355,9 +1284,7 @@ glamor_composite_with_shader(CARD8 op, ("dest(%d,%d) source(%d %d) mask (%d %d), width %d height %d \n", x_dest, y_dest, x_source, y_source, x_mask, y_mask, width, height); - vertices = (float *) (glamor_priv->vb + glamor_priv->vbo_offset); - assert(glamor_priv->vbo_offset < - glamor_priv->vbo_size - glamor_priv->vb_stride); + glamor_set_normalize_vcoords_ext(dest_pixmap_priv, dst_xscale, dst_yscale, x_dest, y_dest, x_dest + width, y_dest + height, @@ -1385,11 +1312,15 @@ glamor_composite_with_shader(CARD8 op, y_mask + height, glamor_priv->yInverted, vertices, vb_stride); + vertices += 2; } glamor_priv->render_nr_verts += 4; - glamor_priv->vbo_offset += glamor_priv->vb_stride * 4; rects++; + + /* We've incremented by one of our 4 verts, now do the other 3. */ + vertices += 3 * vb_stride; } + glamor_put_vbo_space(screen); glamor_flush_composite_rects(screen); nrect -= rect_processed; if (two_pass_ca) { @@ -1402,7 +1333,6 @@ glamor_composite_with_shader(CARD8 op, } } - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); diff --git a/xorg-server/glamor/glamor_trapezoid.c b/xorg-server/glamor/glamor_trapezoid.c index 7bc925a25..0064f2a24 100644 --- a/xorg-server/glamor/glamor_trapezoid.c +++ b/xorg-server/glamor/glamor_trapezoid.c @@ -190,14 +190,44 @@ point_inside_trapezoid(int point[2], xTrapezoid *trap, xFixed cut_y) } static void +glamor_emit_composite_vert(ScreenPtr screen, + float *vb, + const float *src_coords, + const float *mask_coords, + const float *dst_coords, int i) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + int j = 0; + + vb += i * glamor_priv->vb_stride / sizeof(float); + + vb[j++] = dst_coords[i * 2 + 0]; + vb[j++] = dst_coords[i * 2 + 1]; + if (glamor_priv->has_source_coords) { + vb[j++] = src_coords[i * 2 + 0]; + vb[j++] = src_coords[i * 2 + 1]; + } + if (glamor_priv->has_mask_coords) { + vb[j++] = mask_coords[i * 2 + 0]; + vb[j++] = mask_coords[i * 2 + 1]; + } + + glamor_priv->render_nr_verts++; +} + +static void glamor_emit_composite_triangle(ScreenPtr screen, + float *vb, const float *src_coords, const float *mask_coords, const float *dst_coords) { - glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 0); - glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 1); - glamor_emit_composite_vert(screen, src_coords, mask_coords, dst_coords, 2); + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 0); + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 1); + glamor_emit_composite_vert(screen, vb, + src_coords, mask_coords, dst_coords, 2); } static void @@ -206,14 +236,7 @@ glamor_flush_composite_triangles(ScreenPtr screen) glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); glamor_get_context(glamor_priv); - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - glUnmapBuffer(GL_ARRAY_BUFFER); - else { - - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); - } + glamor_put_vbo_space(screen); if (!glamor_priv->render_nr_verts) return; @@ -576,12 +599,14 @@ _glamor_clip_trapezoid_vertex(xTrapezoid *trap, BoxPtr pbox, return TRUE; } -static void +static void * glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) { glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); int stride; int vert_size; + char *vbo_offset; + void *vb; glamor_priv->render_nr_verts = 0; @@ -610,66 +635,43 @@ glamor_setup_composite_vbo_for_trapezoid(ScreenPtr screen, int n_verts) glDisableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); glDisableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { - if (glamor_priv->vbo_size < (glamor_priv->vbo_offset + vert_size)) { - glamor_priv->vbo_size = GLAMOR_COMPOSITE_VBO_VERT_CNT * - glamor_priv->vb_stride; - glamor_priv->vbo_offset = 0; - glBufferData(GL_ARRAY_BUFFER, - glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); - } - - glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, - glamor_priv->vbo_offset, - vert_size, - GL_MAP_WRITE_BIT | - GL_MAP_UNSYNCHRONIZED_BIT); - - assert(glamor_priv->vb != NULL); - glamor_priv->vb -= glamor_priv->vbo_offset; - } - else { - glamor_priv->vbo_offset = 0; - } + vb = glamor_get_vbo_space(screen, vert_size, &vbo_offset); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, glamor_priv->ebo); /* Set the vertex pointer. */ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset)); + vbo_offset); glEnableVertexAttribArray(GLAMOR_VERTEX_POS); stride = 2; glVertexAttribPointer(GLAMOR_VERTEX_SOURCE, 2, GL_FLOAT, GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - stride * sizeof(float))); + vbo_offset + stride * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); stride += 2; glVertexAttribPointer(GLAMOR_VERTEX_TOP_BOTTOM, 2, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - stride * sizeof(float))); + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_TOP_BOTTOM); stride += 2; glVertexAttribPointer(GLAMOR_VERTEX_LEFT_PARAM, 4, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - stride * sizeof(float))); + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_LEFT_PARAM); stride += 4; glVertexAttribPointer(GLAMOR_VERTEX_RIGHT_PARAM, 4, GL_FLOAT, - GL_FALSE, glamor_priv->vb_stride, - (void *) ((long) glamor_priv->vbo_offset + - stride * sizeof(float))); + GL_FALSE, glamor_priv->vb_stride, + vbo_offset + stride * sizeof(float)); glEnableVertexAttribArray(GLAMOR_VERTEX_RIGHT_PARAM); glamor_put_context(glamor_priv); + + return vb; } static Bool @@ -862,6 +864,8 @@ _glamor_trapezoids_with_shader(CARD8 op, nclip_rect = nbox; while (nclip_rect) { + float *vb; + mclip_rect = (nclip_rect * ntrap * 4) > ntriangle_per_loop ? (ntriangle_per_loop / (4 * ntrap)) : nclip_rect; @@ -879,8 +883,9 @@ _glamor_trapezoids_with_shader(CARD8 op, NTRAPS_LOOP_AGAIN: - glamor_setup_composite_vbo(screen, - mclip_rect * traps_count * 4 * vert_stride); + vb = glamor_setup_composite_vbo(screen, + (mclip_rect * traps_count * + 4 * vert_stride)); clip_processed = mclip_rect; while (mclip_rect--) { @@ -938,8 +943,10 @@ _glamor_trapezoids_with_shader(CARD8 op, source_texcoords[4], source_texcoords[5]); } - glamor_emit_composite_triangle(screen, source_texcoords, + glamor_emit_composite_triangle(screen, vb, + source_texcoords, NULL, vertices); + vb += 3 * glamor_priv->vb_stride / sizeof(float); } } @@ -970,7 +977,6 @@ _glamor_trapezoids_with_shader(CARD8 op, ret = TRUE; TRAPEZOID_RESET_GL: - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDisableVertexAttribArray(GLAMOR_VERTEX_POS); glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE); @@ -1384,7 +1390,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, BoxRec one_trap_bound; int nrect_max; int i, j; - float *vertices; float params[4]; glamor_priv = glamor_get_screen_private(screen); @@ -1413,7 +1418,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, pixmap_priv_get_dest_scale(pixmap_priv, (&xscale), (&yscale)); - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); /* Now draw the Trapezoid mask. */ @@ -1425,11 +1429,12 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, nrect_max = GLAMOR_COMPOSITE_VBO_VERT_CNT / (4 * GLAMOR_VERTEX_RIGHT_PARAM); for (i = 0; i < ntrap;) { + float *vertices; int mrect; int stride; mrect = (ntrap - i) > nrect_max ? nrect_max : (ntrap - i); - glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect); + vertices = glamor_setup_composite_vbo_for_trapezoid(screen, 4 * mrect); stride = glamor_priv->vb_stride / sizeof(float); for (j = 0; j < mrect; j++) { @@ -1452,8 +1457,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, miTrapezoidBounds(1, ptrap, &one_trap_bound); - vertices = - (float *) (glamor_priv->vb + glamor_priv->vbo_offset) + 2; + vertices += 2; glamor_set_tcoords_ext((pixmap_priv->base.pixmap->drawable.width), (pixmap_priv->base.pixmap->drawable.height), (one_trap_bound.x1), (one_trap_bound.y1), @@ -1525,6 +1529,7 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, } params[2] = right_slope; glamor_set_const_ext(params, 4, vertices, 4, stride); + vertices += 4; DEBUGF("trap_top = %f, trap_bottom = %f, " "trap_left_x = %f, trap_left_y = %f, left_slope = %f, " @@ -1537,23 +1542,17 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, ((float) ptrap->right.p1.y) / 65536, right_slope); glamor_priv->render_nr_verts += 4; - glamor_priv->vbo_offset += glamor_priv->vb_stride * 4; + vertices += 3 * stride; } i += mrect; + glamor_put_vbo_space(screen); + /* Now rendering. */ if (!glamor_priv->render_nr_verts) continue; - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) - glUnmapBuffer(GL_ARRAY_BUFFER); - else { - glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); - glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, - glamor_priv->vb, GL_DYNAMIC_DRAW); - } - if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { glDrawRangeElements(GL_TRIANGLES, 0, glamor_priv->render_nr_verts, @@ -1566,7 +1565,6 @@ _glamor_generate_trapezoid_with_shader(ScreenPtr screen, PicturePtr picture, } } - glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBlendFunc(GL_ONE, GL_ZERO); glDisable(GL_BLEND); diff --git a/xorg-server/glamor/glamor_utils.h b/xorg-server/glamor/glamor_utils.h index 9374c9d4d..f9550b73c 100644 --- a/xorg-server/glamor/glamor_utils.h +++ b/xorg-server/glamor/glamor_utils.h @@ -53,7 +53,7 @@ *(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \ } while(0) -#define GLAMOR_PIXMAP_FBO_NOT_EAXCT_SIZE(priv) \ +#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv) \ (priv->base.fbo->width != priv->base.pixmap->drawable.width \ || priv->base.fbo->height != priv->base.pixmap->drawable.height) \ diff --git a/xorg-server/glamor/glamor_vbo.c b/xorg-server/glamor/glamor_vbo.c new file mode 100644 index 000000000..5e98bfe47 --- /dev/null +++ b/xorg-server/glamor/glamor_vbo.c @@ -0,0 +1,186 @@ +/* + * Copyright © 2014 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +/** + * @file glamor_vbo.c + * + * Helpers for managing streamed vertex bufffers used in glamor. + */ + +#include "glamor_priv.h" + +/** Default size of the VBO, in bytes. + * + * If a single request is larger than this size, we'll resize the VBO + * and return an appropriate mapping, but we'll resize back down after + * that to avoid hogging that memory forever. We don't anticipate + * normal usage actually requiring larger VBO sizes. + */ +#define GLAMOR_VBO_SIZE (512 * 1024) + +/** + * Returns a pointer to @size bytes of VBO storage, which should be + * accessed by the GL using vbo_offset within the VBO. + */ +void * +glamor_get_vbo_space(ScreenPtr screen, unsigned size, char **vbo_offset) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + void *data; + + glamor_get_context(glamor_priv); + + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + + if (glamor_priv->has_buffer_storage) { + if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { + if (glamor_priv->vbo_size) + glUnmapBuffer(GL_ARRAY_BUFFER); + + if (size > glamor_priv->vbo_size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + + /* We aren't allowed to resize glBufferStorage() + * buffers, so we need to gen a new one. + */ + glDeleteBuffers(1, &glamor_priv->vbo); + glGenBuffers(1, &glamor_priv->vbo); + glBindBuffer(GL_ARRAY_BUFFER, glamor_priv->vbo); + + assert(glGetError() == GL_NO_ERROR); + glBufferStorage(GL_ARRAY_BUFFER, glamor_priv->vbo_size, NULL, + GL_MAP_WRITE_BIT | + GL_MAP_PERSISTENT_BIT | + GL_MAP_COHERENT_BIT); + + if (glGetError() != GL_NO_ERROR) { + /* If the driver failed our coherent mapping, fall + * back to the ARB_mbr path. + */ + glamor_priv->has_buffer_storage = false; + glamor_priv->vbo_size = 0; + glamor_put_context(glamor_priv); + + return glamor_get_vbo_space(screen, size, vbo_offset); + } + } + + glamor_priv->vbo_offset = 0; + glamor_priv->vb = glMapBufferRange(GL_ARRAY_BUFFER, + 0, glamor_priv->vbo_size, + GL_MAP_WRITE_BIT | + GL_MAP_INVALIDATE_BUFFER_BIT | + GL_MAP_PERSISTENT_BIT | + GL_MAP_COHERENT_BIT); + } + *vbo_offset = (void *)(uintptr_t)glamor_priv->vbo_offset; + data = glamor_priv->vb + glamor_priv->vbo_offset; + glamor_priv->vbo_offset += size; + } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + if (glamor_priv->vbo_size < glamor_priv->vbo_offset + size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + glamor_priv->vbo_offset = 0; + glBufferData(GL_ARRAY_BUFFER, + glamor_priv->vbo_size, NULL, GL_STREAM_DRAW); + } + + data = glMapBufferRange(GL_ARRAY_BUFFER, + glamor_priv->vbo_offset, + size, + GL_MAP_WRITE_BIT | + GL_MAP_UNSYNCHRONIZED_BIT | + GL_MAP_INVALIDATE_RANGE_BIT); + assert(data != NULL); + *vbo_offset = (char *)(uintptr_t)glamor_priv->vbo_offset; + glamor_priv->vbo_offset += size; + } else { + /* Return a pointer to the statically allocated non-VBO + * memory. We'll upload it through glBufferData() later. + */ + if (glamor_priv->vbo_size < size) { + glamor_priv->vbo_size = MAX(GLAMOR_VBO_SIZE, size); + free(glamor_priv->vb); + glamor_priv->vb = XNFalloc(size); + } + *vbo_offset = NULL; + /* We point to the start of glamor_priv->vb every time, and + * the vbo_offset determines the size of the glBufferData(). + */ + glamor_priv->vbo_offset = size; + data = glamor_priv->vb; + } + + glamor_put_context(glamor_priv); + + return data; +} + +void +glamor_put_vbo_space(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_get_context(glamor_priv); + + if (glamor_priv->has_buffer_storage) { + /* If we're in the ARB_buffer_storage path, we have a + * persistent mapping, so we can leave it around until we + * reach the end of the buffer. + */ + } else if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) { + glUnmapBuffer(GL_ARRAY_BUFFER); + } else { + glBufferData(GL_ARRAY_BUFFER, glamor_priv->vbo_offset, + glamor_priv->vb, GL_DYNAMIC_DRAW); + } + + glBindBuffer(GL_ARRAY_BUFFER, 0); + + glamor_put_context(glamor_priv); +} + +void +glamor_init_vbo(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_get_context(glamor_priv); + + glGenBuffers(1, &glamor_priv->vbo); + + glamor_put_context(glamor_priv); +} + +void +glamor_fini_vbo(ScreenPtr screen) +{ + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + + glamor_get_context(glamor_priv); + + glDeleteBuffers(1, &glamor_priv->vbo); + if (glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP) + free(glamor_priv->vb); + + glamor_put_context(glamor_priv); +} diff --git a/xorg-server/glx/glxdricommon.c b/xorg-server/glx/glxdricommon.c index 087169596..777c2d721 100644 --- a/xorg-server/glx/glxdricommon.c +++ b/xorg-server/glx/glxdricommon.c @@ -145,7 +145,7 @@ createModeFromConfig(const __DRIcoreExtension * core, unsigned int attrib, value; int i; - config = malloc(sizeof *config); + config = calloc(1, sizeof *config); config->driConfig = driConfig; diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index 7c3e479e5..36b92a9f7 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -81,6 +81,7 @@ #include <stdarg.h> #include <stdint.h> /* for int64_t */ +#include <sys/stat.h> #include <unistd.h> #include "mi.h" @@ -804,6 +805,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev) return Success; } +static void +xf86stat(const char *path, int *maj, int *min) +{ + struct stat st; + + if (stat(path, &st) == -1) + return; + + *maj = major(st.st_rdev); + *min = minor(st.st_rdev); +} + /** * Create a new input device, activate and enable it. * @@ -828,6 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) DeviceIntPtr dev = NULL; Bool paused; int rval; + const char *path; /* Memory leak for every attached device if we don't * test if the module is already loaded first */ @@ -841,9 +855,13 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) goto unwind; } - if (drv->capabilities & XI86_DRV_CAP_SERVER_FD) { + path = xf86CheckStrOption(pInfo->options, "Device", NULL); + if (path && pInfo->major == 0 && pInfo->minor == 0) + xf86stat(path, &pInfo->major, &pInfo->minor); + + if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){ int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor, - pInfo->attrs->device, &paused); + path, &paused); if (fd != -1) { if (paused) { /* Put on new_input_devices list for delayed probe */ diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c index 4447e19df..4e80f9ee3 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.c +++ b/xorg-server/hw/xfree86/common/xf86platformBus.c @@ -38,6 +38,7 @@ #include <unistd.h> #include "os.h" #include "hotplug.h" +#include "systemd-logind.h" #include "xf86.h" #include "xf86_OSproc.h" @@ -310,15 +311,15 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags, intptr_t match_data) { Bool foundScreen = FALSE; - int entity; + int entity, fd, major, minor; - if (gdev->screen == 0 && !xf86_check_platform_slot(dev)) + if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; entity = xf86ClaimPlatformSlot(dev, drvp, 0, - gdev, gdev->active); + gdev, gdev ? gdev->active : 0); - if ((entity == -1) && (gdev->screen > 0)) { + if ((entity == -1) && gdev && (gdev->screen > 0)) { unsigned nent; for (nent = 0; nent < xf86NumEntities; nent++) { @@ -334,6 +335,17 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, } } if (entity != -1) { + if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc || + !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) { + fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1); + major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0); + minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0); + systemd_logind_release_fd(major, minor); + close(fd); + config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1); + dev->flags &= ~XF86_PDEV_SERVER_FD; + } + if (drvp->platformProbe(drvp, entity, flags, dev, match_data)) foundScreen = TRUE; else @@ -420,7 +432,6 @@ xf86platformAddDevice(int index) { int i, old_screens, scr_index; DriverPtr drvp = NULL; - int entity; screenLayoutPtr layout; static const char *hotplug_driver_name = "modesetting"; @@ -440,11 +451,8 @@ xf86platformAddDevice(int index) return -1; old_screens = xf86NumGPUScreens; - entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index], - drvp, 0, 0, 0); - if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) { - xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); - } + doPlatformProbe(&xf86_platform_devices[index], drvp, NULL, + PLATFORM_PROBE_GPU_SCREEN, 0); if (old_screens == xf86NumGPUScreens) return -1; i = old_screens; diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h index b164b7f21..a81e88614 100644 --- a/xorg-server/hw/xfree86/common/xf86str.h +++ b/xorg-server/hw/xfree86/common/xf86str.h @@ -256,7 +256,8 @@ typedef enum { RR_GET_INFO, RR_SET_CONFIG, RR_GET_MODE_MM, - GET_REQUIRED_HW_INTERFACES = 10 + GET_REQUIRED_HW_INTERFACES = 10, + SUPPORTS_SERVER_FDS = 11, } xorgDriverFuncOp; typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *); diff --git a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c index abb8e44d9..a8406d8be 100644 --- a/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c +++ b/xorg-server/hw/xfree86/os-support/linux/systemd-logind.c @@ -347,7 +347,6 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) if (pdev) { pdev->flags &= ~XF86_PDEV_PAUSED; - systemd_logind_vtenter(); } else { pInfo->fd = fd; @@ -355,6 +354,8 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) if (info->vt_active) xf86EnableInputDeviceForVTSwitch(pInfo); } + /* Always call vtenter(), in case there are only legacy video devs */ + systemd_logind_vtenter(); } return DBUS_HANDLER_RESULT_HANDLED; } diff --git a/xorg-server/include/systemd-logind.h b/xorg-server/include/systemd-logind.h index 8b0908186..06dd03134 100644 --- a/xorg-server/include/systemd-logind.h +++ b/xorg-server/include/systemd-logind.h @@ -36,8 +36,8 @@ void systemd_logind_vtenter(void); #else #define systemd_logind_init() #define systemd_logind_fini() -#define systemd_logind_take_fd(major, minor, path) -1 -#define systemd_logind_release_fd(dev) +#define systemd_logind_take_fd(major, minor, path, paus) -1 +#define systemd_logind_release_fd(major, minor) #define systemd_logind_controls_session() 0 #define systemd_logind_vtenter() #endif diff --git a/xorg-server/include/xkbsrv.h b/xorg-server/include/xkbsrv.h index 7b3db0f86..20d3a9a17 100644 --- a/xorg-server/include/xkbsrv.h +++ b/xorg-server/include/xkbsrv.h @@ -638,6 +638,10 @@ extern _X_EXPORT void XkbHandleActions(DeviceIntPtr /* dev */ , DeviceEvent * /* event */ ); +extern void XkbPushLockedStateToSlaves(DeviceIntPtr /* master */, + int /* evtype */, + int /* key */); + extern _X_EXPORT Bool XkbEnableDisableControls(XkbSrvInfoPtr /* xkbi */ , unsigned long /* change */ , unsigned long /* newValues */ , diff --git a/xorg-server/test/hashtabletest.c b/xorg-server/test/hashtabletest.c index ceadfa7a3..86a0c58c6 100644 --- a/xorg-server/test/hashtabletest.c +++ b/xorg-server/test/hashtabletest.c @@ -12,7 +12,7 @@ static void print_xid(void* ptr, void* v) { XID *x = v; - printf("%ld", *x); + printf("%ld", (long)(*x)); } static void diff --git a/xorg-server/xkb/xkbActions.c b/xorg-server/xkb/xkbActions.c index 3fbf05183..9df42bd6b 100644 --- a/xorg-server/xkb/xkbActions.c +++ b/xorg-server/xkb/xkbActions.c @@ -1127,13 +1127,78 @@ _XkbApplyFilters(XkbSrvInfoPtr xkbi, unsigned kc, XkbAction *pAction) return send; } +static int +_XkbEnsureStateChange(XkbSrvInfoPtr xkbi) +{ + Bool genStateNotify = FALSE; + + /* The state may change, so if we're not in the middle of sending a state + * notify, prepare for it */ + if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) { + xkbi->prev_state = xkbi->state; + xkbi->flags |= _XkbStateNotifyInProgress; + genStateNotify = TRUE; + } + + return genStateNotify; +} + +static void +_XkbApplyState(DeviceIntPtr dev, Bool genStateNotify, int evtype, int key) +{ + XkbSrvInfoPtr xkbi = dev->key->xkbInfo; + int changed; + + XkbComputeDerivedState(xkbi); + + changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state); + if (genStateNotify) { + if (changed) { + xkbStateNotify sn; + + sn.keycode = key; + sn.eventType = evtype; + sn.requestMajor = sn.requestMinor = 0; + sn.changed = changed; + XkbSendStateNotify(dev, &sn); + } + xkbi->flags &= ~_XkbStateNotifyInProgress; + } + + changed = XkbIndicatorsToUpdate(dev, changed, FALSE); + if (changed) { + XkbEventCauseRec cause; + XkbSetCauseKey(&cause, key, evtype); + XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause); + } +} + +void +XkbPushLockedStateToSlaves(DeviceIntPtr master, int evtype, int key) +{ + DeviceIntPtr dev; + Bool genStateNotify; + + nt_list_for_each_entry(dev, inputInfo.devices, next) { + if (!dev->key || GetMaster(dev, MASTER_KEYBOARD) != master) + continue; + + genStateNotify = _XkbEnsureStateChange(dev->key->xkbInfo); + + dev->key->xkbInfo->state.locked_mods = + master->key->xkbInfo->state.locked_mods; + + _XkbApplyState(dev, genStateNotify, evtype, key); + } +} + void XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) { int key, bit, i; XkbSrvInfoPtr xkbi; KeyClassPtr keyc; - int changed, sendEvent; + int sendEvent; Bool genStateNotify; XkbAction act; XkbFilterPtr filter; @@ -1146,15 +1211,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) keyc = kbd->key; xkbi = keyc->xkbInfo; key = event->detail.key; - /* The state may change, so if we're not in the middle of sending a state - * notify, prepare for it */ - if ((xkbi->flags & _XkbStateNotifyInProgress) == 0) { - xkbi->prev_state = xkbi->state; - xkbi->flags |= _XkbStateNotifyInProgress; - genStateNotify = TRUE; - } - else - genStateNotify = FALSE; + + genStateNotify = _XkbEnsureStateChange(xkbi); xkbi->clearMods = xkbi->setMods = 0; xkbi->groupChange = 0; @@ -1287,28 +1345,8 @@ XkbHandleActions(DeviceIntPtr dev, DeviceIntPtr kbd, DeviceEvent *event) FixKeyState(event, dev); } - XkbComputeDerivedState(xkbi); - changed = XkbStateChangedFlags(&xkbi->prev_state, &xkbi->state); - if (genStateNotify) { - if (changed) { - xkbStateNotify sn; - - sn.keycode = key; - sn.eventType = event->type; - sn.requestMajor = sn.requestMinor = 0; - sn.changed = changed; - XkbSendStateNotify(dev, &sn); - } - xkbi->flags &= ~_XkbStateNotifyInProgress; - } - changed = XkbIndicatorsToUpdate(dev, changed, FALSE); - if (changed) { - XkbEventCauseRec cause; - - XkbSetCauseKey(&cause, key, event->type); - XkbUpdateIndicators(dev, changed, FALSE, NULL, &cause); - } - return; + _XkbApplyState(dev, genStateNotify, event->type, key); + XkbPushLockedStateToSlaves(dev, event->type, key); } int |