Android.mk
author Sam Lantinga
Sun, 05 Apr 2020 08:58:47 -0700
changeset 13689 c3055b205671
parent 13458 c6fd2bd1320f
child 13747 5e676d4c9949
permissions -rwxr-xr-x
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.
     1 LOCAL_PATH := $(call my-dir)
     2 
     3 ###########################
     4 #
     5 # SDL shared library
     6 #
     7 ###########################
     8 
     9 include $(CLEAR_VARS)
    10 
    11 LOCAL_MODULE := SDL2
    12 
    13 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
    14 
    15 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
    16 
    17 LOCAL_SRC_FILES := \
    18 	$(subst $(LOCAL_PATH)/,, \
    19 	$(wildcard $(LOCAL_PATH)/src/*.c) \
    20 	$(wildcard $(LOCAL_PATH)/src/audio/*.c) \
    21 	$(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \
    22 	$(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \
    23 	$(wildcard $(LOCAL_PATH)/src/audio/openslES/*.c) \
    24 	$(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \
    25 	$(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \
    26 	$(wildcard $(LOCAL_PATH)/src/core/android/*.c) \
    27 	$(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \
    28 	$(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \
    29 	$(wildcard $(LOCAL_PATH)/src/events/*.c) \
    30 	$(wildcard $(LOCAL_PATH)/src/file/*.c) \
    31 	$(wildcard $(LOCAL_PATH)/src/haptic/*.c) \
    32 	$(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \
    33 	$(wildcard $(LOCAL_PATH)/src/joystick/*.c) \
    34 	$(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \
    35 	$(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \
    36 	$(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \
    37 	$(wildcard $(LOCAL_PATH)/src/power/*.c) \
    38 	$(wildcard $(LOCAL_PATH)/src/power/android/*.c) \
    39 	$(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \
    40 	$(wildcard $(LOCAL_PATH)/src/sensor/*.c) \
    41 	$(wildcard $(LOCAL_PATH)/src/sensor/android/*.c) \
    42 	$(wildcard $(LOCAL_PATH)/src/render/*.c) \
    43 	$(wildcard $(LOCAL_PATH)/src/render/*/*.c) \
    44 	$(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \
    45 	$(wildcard $(LOCAL_PATH)/src/thread/*.c) \
    46 	$(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \
    47 	$(wildcard $(LOCAL_PATH)/src/timer/*.c) \
    48 	$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
    49 	$(wildcard $(LOCAL_PATH)/src/video/*.c) \
    50 	$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
    51 	$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
    52 	$(wildcard $(LOCAL_PATH)/src/test/*.c))
    53 
    54 LOCAL_SHARED_LIBRARIES := hidapi
    55 
    56 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
    57 LOCAL_CFLAGS += \
    58 	-Wall -Wextra \
    59 	-Wdocumentation \
    60 	-Wdocumentation-unknown-command \
    61 	-Wmissing-prototypes \
    62 	-Wunreachable-code-break \
    63 	-Wunneeded-internal-declaration \
    64 	-Wmissing-variable-declarations \
    65 	-Wfloat-conversion \
    66 	-Wshorten-64-to-32 \
    67 	-Wunreachable-code-return \
    68 	-Wshift-sign-overflow \
    69 	-Wstrict-prototypes \
    70 	-Wkeyword-macro \
    71 
    72 
    73 # Warnings we haven't fixed (yet)
    74 LOCAL_CFLAGS += -Wno-unused-parameter -Wno-sign-compare
    75  
    76 
    77 LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid
    78 
    79 ifeq ($(NDK_DEBUG),1)
    80     cmd-strip :=
    81 endif
    82 
    83 LOCAL_STATIC_LIBRARIES := cpufeatures
    84 
    85 include $(BUILD_SHARED_LIBRARY)
    86 
    87 ###########################
    88 #
    89 # SDL static library
    90 #
    91 ###########################
    92 
    93 LOCAL_MODULE := SDL2_static
    94 
    95 LOCAL_MODULE_FILENAME := libSDL2
    96 
    97 LOCAL_LDLIBS := 
    98 LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid
    99 
   100 include $(BUILD_STATIC_LIBRARY)
   101 
   102 ###########################
   103 #
   104 # SDL main static library
   105 #
   106 ###########################
   107 
   108 include $(CLEAR_VARS)
   109 
   110 LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
   111 
   112 LOCAL_MODULE := SDL2_main
   113 
   114 LOCAL_MODULE_FILENAME := libSDL2main
   115 
   116 include $(BUILD_STATIC_LIBRARY)
   117 
   118 ###########################
   119 #
   120 # hidapi library
   121 #
   122 ###########################
   123 
   124 include $(CLEAR_VARS)
   125 
   126 LOCAL_CPPFLAGS += -std=c++11
   127 
   128 LOCAL_SRC_FILES := src/hidapi/android/hid.cpp
   129 
   130 LOCAL_MODULE := libhidapi
   131 LOCAL_LDLIBS := -llog
   132 
   133 include $(BUILD_SHARED_LIBRARY)
   134 
   135 $(call import-module,android/cpufeatures)
   136