author Sam Lantinga
Sun, 05 Apr 2020 08:58:47 -0700
changeset 13689 c3055b205671
parent 12391 ca6e41ade79a
child 13807 e3396aa005df
permissions -rw-r--r--
Fixed bug 5015 - SDL_RenderReadPixels on DirectX 11.1 backend seems to be broken


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.
     1 Linux
     2 ================================================================================
     4 By default SDL will only link against glibc, the rest of the features will be
     5 enabled dynamically at runtime depending on the available features on the target
     6 system. So, for example if you built SDL with Xinerama support and the target
     7 system does not have the Xinerama libraries installed, it will be disabled
     8 at runtime, and you won't get a missing library error, at least with the 
     9 default configuration parameters.
    12 ================================================================================
    13 Build Dependencies
    14 ================================================================================
    16 Ubuntu 13.04, all available features enabled:
    18 sudo apt-get install build-essential mercurial make cmake autoconf automake \
    19 libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
    20 libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
    21 libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
    22 libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
    23 fcitx-libs-dev libsamplerate0-dev libsndio-dev
    25 Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
    26 to that command line for Wayland support.
    28 NOTES:
    29 - This includes all the audio targets except arts, because Ubuntu pulled the 
    30   artsc0-dev package, but in theory SDL still supports it.
    31 - libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
    32   for higher-quality audio resampling. SDL will work without it if the library
    33   is missing, so it's safe to build in support even if the end user doesn't
    34   have this library installed.
    35 - DirectFB isn't included because the configure script (currently) fails to find
    36   it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
    37   configure script to include DirectFB support. Send patches.  :)
    40 ================================================================================
    41 Joystick does not work
    42 ================================================================================
    44 If you compiled or are using a version of SDL with udev support (and you should!)
    45 there's a few issues that may cause SDL to fail to detect your joystick. To
    46 debug this, start by installing the evtest utility. On Ubuntu/Debian:
    48     sudo apt-get install evtest
    50 Then run:
    52     sudo evtest
    54 You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
    55 Now run:
    57     cat /dev/input/event/XX
    59 If you get a permission error, you need to set a udev rule to change the mode of
    60 your device (see below)    
    62 Also, try:
    64     sudo udevadm info --query=all --name=input/eventXX
    66 If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
    67 you need to set up an udev rule to force this variable.
    69 A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks 
    70 like:
    72    SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
    73    SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
    75 You can set up similar rules for your device by changing the values listed in
    76 idProduct and idVendor. To obtain these values, try:
    78     sudo udevadm info -a --name=input/eventXX | grep idVendor
    79     sudo udevadm info -a --name=input/eventXX | grep idProduct
    81 If multiple values come up for each of these, the one you want is the first one of each.    
    83 On other systems which ship with an older udev (such as CentOS), you may need
    84 to set up a rule such as:
    86     SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"