acinclude/ax_check_compiler_flags.m4
author Sam Lantinga
Sun, 05 Apr 2020 08:58:47 -0700
changeset 13689 c3055b205671
parent 5029 5d7d48157be7
permissions -rw-r--r--
Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken

Konrad

It appears that I cannot use SDL_RenderReadPixels on a bound framebuffer (SDL_Texture set as render target) as it simply results in gibberish data. However, drawing that framebuffer into the default target (window surface) does render it correctly. Other backends (OpenGL, software, Direct3D) do work fine.

It looks to me like D3D11_RenderReadPixels just gets the general backbuffer and not the current render target and its backbuffer.

Here is the patch which actually fetches the current render target and its underlying ID3D11Resource which is ID3D11Texture2D.
slouken@5029
     1
# ===========================================================================
slouken@5029
     2
#  http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html
slouken@5029
     3
# ===========================================================================
slouken@5029
     4
#
slouken@5029
     5
# SYNOPSIS
slouken@5029
     6
#
slouken@5029
     7
#   AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
slouken@5029
     8
#
slouken@5029
     9
# DESCRIPTION
slouken@5029
    10
#
slouken@5029
    11
#   Check whether the given compiler FLAGS work with the current language's
slouken@5029
    12
#   compiler, or whether they give an error. (Warnings, however, are
slouken@5029
    13
#   ignored.)
slouken@5029
    14
#
slouken@5029
    15
#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
slouken@5029
    16
#   success/failure.
slouken@5029
    17
#
slouken@5029
    18
# LICENSE
slouken@5029
    19
#
slouken@5029
    20
#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
slouken@5029
    21
#   Copyright (c) 2009 Matteo Frigo
slouken@5029
    22
#
slouken@5029
    23
#   This program is free software: you can redistribute it and/or modify it
slouken@5029
    24
#   under the terms of the GNU General Public License as published by the
slouken@5029
    25
#   Free Software Foundation, either version 3 of the License, or (at your
slouken@5029
    26
#   option) any later version.
slouken@5029
    27
#
slouken@5029
    28
#   This program is distributed in the hope that it will be useful, but
slouken@5029
    29
#   WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@5029
    30
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
slouken@5029
    31
#   Public License for more details.
slouken@5029
    32
#
slouken@5029
    33
#   You should have received a copy of the GNU General Public License along
slouken@5029
    34
#   with this program. If not, see <http://www.gnu.org/licenses/>.
slouken@5029
    35
#
slouken@5029
    36
#   As a special exception, the respective Autoconf Macro's copyright owner
slouken@5029
    37
#   gives unlimited permission to copy, distribute and modify the configure
slouken@5029
    38
#   scripts that are the output of Autoconf when processing the Macro. You
slouken@5029
    39
#   need not follow the terms of the GNU General Public License when using
slouken@5029
    40
#   or distributing such scripts, even though portions of the text of the
slouken@5029
    41
#   Macro appear in them. The GNU General Public License (GPL) does govern
slouken@5029
    42
#   all other use of the material that constitutes the Autoconf Macro.
slouken@5029
    43
#
slouken@5029
    44
#   This special exception to the GPL applies to versions of the Autoconf
slouken@5029
    45
#   Macro released by the Autoconf Archive. When you make and distribute a
slouken@5029
    46
#   modified version of the Autoconf Macro, you may extend this special
slouken@5029
    47
#   exception to the GPL to apply to your modified version as well.
slouken@5029
    48
slouken@5029
    49
#serial 9
slouken@5029
    50
slouken@5029
    51
AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
slouken@5029
    52
[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
slouken@5029
    53
AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
slouken@5029
    54
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
slouken@5029
    55
AS_LITERAL_IF([$1],
slouken@5029
    56
  [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
slouken@5029
    57
      ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
slouken@5029
    58
      _AC_LANG_PREFIX[]FLAGS="$1"
slouken@5029
    59
      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
slouken@5029
    60
        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
slouken@5029
    61
        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
slouken@5029
    62
      _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
slouken@5029
    63
  [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
slouken@5029
    64
   _AC_LANG_PREFIX[]FLAGS="$1"
slouken@5029
    65
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
slouken@5029
    66
     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
slouken@5029
    67
     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
slouken@5029
    68
   _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
slouken@5029
    69
eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
slouken@5029
    70
AC_MSG_RESULT($ax_check_compiler_flags)
slouken@5029
    71
if test "x$ax_check_compiler_flags" = xyes; then
slouken@5029
    72
	m4_default([$2], :)
slouken@5029
    73
else
slouken@5029
    74
	m4_default([$3], :)
slouken@5029
    75
fi
slouken@5029
    76
])dnl AX_CHECK_COMPILER_FLAGS