Skip to content

Commit cd17f3e

Browse files
add option for parallel texture fetch (#99)
1 parent 08c3e8a commit cd17f3e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/lib/CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,25 @@
99

1010
### acf_shaders ### : for acf lib and tests
1111
if(ACF_BUILD_OGLES_GPGPU)
12+
1213
add_library(acf_shaders ${ACF_GPU_SRCS} ${ACF_GPU_HDRS})
1314
target_link_libraries(acf_shaders PUBLIC ogles_gpgpu::ogles_gpgpu)
1415
set(acf_modules acf_shaders)
16+
17+
# Allow parallel texture fetches on iOS by default, but allow
18+
# the user to disable. This is a hedge as iOS texture cache
19+
# stuff has almost no documentation.
20+
if(IOS)
21+
set(acf_parallel_textures ON)
22+
else()
23+
set(acf_parallel_textures OFF)
24+
endif()
25+
option(ACF_PARALLEL_TEXTURE_FETCH "Fetch textures in parallel" ${acf_parallel_textures})
26+
27+
if(ACF_PARALLEL_TEXTURE_FETCH)
28+
target_compile_definitions(acf_shaders PUBLIC ACF_PARALLEL_TEXTURE_FETCH=1)
29+
endif()
30+
1531
endif()
1632

1733
### acf ###

src/lib/acf/acf/GPUACF.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ cv::Mat ACF::getChannelsImpl()
826826
}
827827
}; // clang-format on
828828

829-
#if OGLES_GPGPU_IOS
830-
// iOS texture cache can be queried in parallel:
829+
#if defined(ACF_PARALLEL_TEXTURE_FETCH)
830+
// iOS texture cache can be queried in parallel (at least):
831831
cv::parallel_for_({ 0, int(planeIndex.size()) }, worker);
832832
#else
833833
worker({ 0, int(planeIndex.size()) });

0 commit comments

Comments
 (0)