diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml
index e7d50e4d2891..ec763c9b0935 100644
--- a/.github/workflows/presubmit.yml
+++ b/.github/workflows/presubmit.yml
@@ -49,6 +49,5 @@ jobs:
(cd test/error && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
(cd test/generator && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
(cd test/failing_with_issue && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
- (cd test/opengl && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
(cd test/performance && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
(cd test/warning && comm -23 <(ls *.{c,cpp} | sort) <(grep -P '^\s*#?\s*[A-Za-z0-9_.]+$' CMakeLists.txt | tr -d '# ' | sort) | tee missing_files && [ ! -s missing_files ])
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 9e288dd687d9..f7e1dbea8c97 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -148,12 +148,6 @@ jobs:
libpng-dev \
ninja-build
- # TODO(srj): OpenGL is only needed to build the opengl tests (which we don't even run)...
- sudo apt-get install \
- freeglut3-dev \
- libglu1-mesa-dev \
- mesa-common-dev
-
- name: Configure MacOS Host
if: startsWith(matrix.host_os, 'macos')
shell: bash
@@ -193,12 +187,6 @@ jobs:
libjpeg-dev:i386 \
libpng-dev:i386 \
- # TODO(srj): OpenGL is only needed to build the opengl tests (which we don't even run)...
- sudo apt-get install \
- freeglut3-dev:i386 \
- libglu1-mesa-dev:i386 \
- mesa-common-dev:i386
-
- name: Configure Arm32 Crosscompilation
if: matrix.target_os == 'linux' && matrix.target_arch == 'arm' && matrix.target_bits == 32
shell: bash
@@ -449,9 +437,8 @@ jobs:
TEST_GROUPS_SERIAL="tutorial"
# performance is never going to be reliable on VMs.
- # opengl won't work on the buildbots.
# auto_schedule is just flaky.
- TEST_GROUPS_BROKEN="performance opengl auto_schedule"
+ TEST_GROUPS_BROKEN="performance auto_schedule"
if [[ ${{matrix.target_bits}} == 32 ]]; then
# TODO: Skip testing apps on 32-bit systems for now;
@@ -487,9 +474,8 @@ jobs:
TEST_GROUPS_SERIAL="tutorial"
# performance is never going to be reliable on VMs.
- # opengl won't work on the buildbots.
# auto_schedule is just flaky.
- TEST_GROUPS_BROKEN="performance|opengl|auto_schedule"
+ TEST_GROUPS_BROKEN="performance|auto_schedule"
export TEST_TMPDIR="${HALIDE_TEMP_DIR}"
cd ${HALIDE_BUILD_DIR}
diff --git a/Makefile b/Makefile
index 8ad0a3970a0a..921f8e388e3b 100644
--- a/Makefile
+++ b/Makefile
@@ -466,7 +466,6 @@ SOURCE_FILES = \
ImageParam.cpp \
InferArguments.cpp \
InjectHostDevBufferCopies.cpp \
- InjectOpenGLIntrinsics.cpp \
Inline.cpp \
InlineReductions.cpp \
IntegerDivisionTable.cpp \
@@ -560,7 +559,6 @@ SOURCE_FILES = \
UnsafePromises.cpp \
Util.cpp \
Var.cpp \
- VaryingAttributes.cpp \
VectorizeLoops.cpp \
WasmExecutor.cpp \
WrapCalls.cpp
@@ -645,7 +643,6 @@ HEADER_FILES = \
ImageParam.h \
InferArguments.h \
InjectHostDevBufferCopies.h \
- InjectOpenGLIntrinsics.h \
Inline.h \
InlineReductions.h \
IntegerDivisionTable.h \
@@ -728,7 +725,6 @@ HEADER_FILES = \
UnsafePromises.h \
Util.h \
Var.h \
- VaryingAttributes.h \
VectorizeLoops.h \
WrapCalls.h
@@ -779,7 +775,6 @@ RUNTIME_CPP_COMPONENTS = \
msan \
msan_stubs \
opencl \
- opengl \
openglcompute \
opengl_egl_context \
opengl_glx_context \
@@ -851,7 +846,6 @@ RUNTIME_EXPORTED_INCLUDES = $(INCLUDE_DIR)/HalideRuntime.h \
$(INCLUDE_DIR)/HalideRuntimeHexagonDma.h \
$(INCLUDE_DIR)/HalideRuntimeHexagonHost.h \
$(INCLUDE_DIR)/HalideRuntimeOpenCL.h \
- $(INCLUDE_DIR)/HalideRuntimeOpenGL.h \
$(INCLUDE_DIR)/HalideRuntimeOpenGLCompute.h \
$(INCLUDE_DIR)/HalideRuntimeMetal.h \
$(INCLUDE_DIR)/HalideRuntimeQurt.h \
@@ -1110,14 +1104,11 @@ CORRECTNESS_TESTS = $(shell ls $(ROOT_DIR)/test/correctness/*.cpp) $(shell ls $(
PERFORMANCE_TESTS = $(shell ls $(ROOT_DIR)/test/performance/*.cpp)
ERROR_TESTS = $(shell ls $(ROOT_DIR)/test/error/*.cpp)
WARNING_TESTS = $(shell ls $(ROOT_DIR)/test/warning/*.cpp)
-OPENGL_TESTS := $(shell ls $(ROOT_DIR)/test/opengl/*.cpp)
GENERATOR_EXTERNAL_TESTS := $(shell ls $(ROOT_DIR)/test/generator/*test.cpp)
GENERATOR_EXTERNAL_TEST_GENERATOR := $(shell ls $(ROOT_DIR)/test/generator/*_generator.cpp)
TUTORIALS = $(filter-out %_generate.cpp, $(shell ls $(ROOT_DIR)/tutorial/*.cpp))
AUTO_SCHEDULE_TESTS = $(shell ls $(ROOT_DIR)/test/auto_schedule/*.cpp)
--include $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=$(BUILD_DIR)/test_opengl_%.d)
-
test_correctness: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=quiet_correctness_%) $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.c=quiet_correctness_%)
test_performance: $(PERFORMANCE_TESTS:$(ROOT_DIR)/test/performance/%.cpp=performance_%)
test_error: $(ERROR_TESTS:$(ROOT_DIR)/test/error/%.cpp=error_%)
@@ -1125,7 +1116,6 @@ test_warning: $(WARNING_TESTS:$(ROOT_DIR)/test/warning/%.cpp=warning_%)
test_tutorial: $(TUTORIALS:$(ROOT_DIR)/tutorial/%.cpp=tutorial_%)
test_valgrind: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=valgrind_%)
test_avx512: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=avx512_%)
-test_opengl: $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=opengl_%)
test_auto_schedule: test_mullapudi2016 test_li2018 test_adams2019
.PHONY: test_correctness_multi_gpu
@@ -1230,7 +1220,6 @@ ALL_TESTS = test_internal test_correctness test_error test_tutorial test_warning
# For generator tests they time the compile time only. The times are recorded in CSV files.
time_compilation_correctness: init_time_compilation_correctness $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=time_compilation_test_%)
time_compilation_performance: init_time_compilation_performance $(PERFORMANCE_TESTS:$(ROOT_DIR)/test/performance/%.cpp=time_compilation_performance_%)
-time_compilation_opengl: init_time_compilation_opengl $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=time_compilation_opengl_%)
time_compilation_generator: init_time_compilation_generator $(GENERATOR_TESTS:$(ROOT_DIR)/test/generator/%_aottest.cpp=time_compilation_generator_%)
init_time_compilation_%:
@@ -1250,14 +1239,6 @@ build_tests: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=$(BIN_DIR)/c
$(GENERATOR_EXTERNAL_TESTS:$(ROOT_DIR)/test/generator/%_jittest.cpp=$(BIN_DIR)/generator_jit_%) \
$(AUTO_SCHEDULE_TESTS:$(ROOT_DIR)/test/auto_schedule/%.cpp=$(BIN_DIR)/auto_schedule_%)
-# OpenGL doesn't build on every host platform we support (eg. ARM).
-.PHONY: build_opengl_tests
-build_opengl_tests: $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=$(BIN_DIR)/opengl_%)
-
-ifneq ($(WITH_OPENGL),)
-build_tests: build_opengl_tests
-endif
-
clean_generator:
rm -rf $(BIN_DIR)/*.generator
rm -rf $(BIN_DIR)/*/runtime.a
@@ -1321,9 +1302,6 @@ $(BIN_DIR)/error_%: $(ROOT_DIR)/test/error/%.cpp $(BIN_DIR)/libHalide.$(SHARED_E
$(BIN_DIR)/warning_%: $(ROOT_DIR)/test/warning/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h
$(CXX) $(TEST_CXX_FLAGS) $(OPTIMIZE_FOR_BUILD_TIME) $< -I$(INCLUDE_DIR) $(TEST_LD_FLAGS) -o $@
-$(BIN_DIR)/opengl_%: $(ROOT_DIR)/test/opengl/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h $(INCLUDE_DIR)/HalideRuntime.h $(INCLUDE_DIR)/HalideRuntimeOpenGL.h
- $(CXX) $(TEST_CXX_FLAGS) $(OPTIMIZE_FOR_BUILD_TIME) $< -I$(INCLUDE_DIR) -I$(SRC_DIR) $(TEST_LD_FLAGS) $(OPENGL_LD_FLAGS) -o $@ -MMD -MF $(BUILD_DIR)/test_opengl_$*.d
-
# Auto schedule tests that link against libHalide
$(BIN_DIR)/auto_schedule_%: $(ROOT_DIR)/test/auto_schedule/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h
$(CXX) $(TEST_CXX_FLAGS) $(OPTIMIZE_FOR_BUILD_TIME) $< -I$(INCLUDE_DIR) $(TEST_LD_FLAGS) -o $@
@@ -1874,11 +1852,6 @@ warning_%: $(BIN_DIR)/warning_%
cd $(TMP_DIR) ; $(CURDIR)/$< 2>&1 | egrep --q "^Warning"
@-echo
-opengl_%: $(BIN_DIR)/opengl_%
- @-mkdir -p $(TMP_DIR)
- cd $(TMP_DIR) ; $(CURDIR)/$< 2>&1
- @-echo
-
generator_jit_%: $(BIN_DIR)/generator_jit_%
@-mkdir -p $(TMP_DIR)
cd $(TMP_DIR) ; $(CURDIR)/$<
@@ -1928,9 +1901,6 @@ time_compilation_test_%: $(BIN_DIR)/test_%
time_compilation_performance_%: $(BIN_DIR)/performance_%
$(TIME_COMPILATION) compile_times_performance.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_performance_%=performance_%)
-time_compilation_opengl_%: $(BIN_DIR)/opengl_%
- $(TIME_COMPILATION) compile_times_opengl.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_opengl_%=opengl_%)
-
time_compilation_generator_%: $(BIN_DIR)/%.generator
$(TIME_COMPILATION) compile_times_generator.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_generator_%=$(FILTERS_DIR)/%.a)
diff --git a/README.md b/README.md
index 6fe672968347..b80441df5535 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ currently targets:
- CPU architectures: X86, ARM, MIPS, Hexagon, PowerPC
- Operating systems: Linux, Windows, Mac OS X, Android, iOS, Qualcomm QuRT
-- GPU Compute APIs: CUDA, OpenCL, OpenGL, OpenGL Compute Shaders, Apple Metal,
+- GPU Compute APIs: CUDA, OpenCL, OpenGL Compute Shaders, Apple Metal,
Microsoft Direct X 12
Rather than being a standalone programming language, Halide is embedded in C++.
@@ -336,140 +336,7 @@ an older XCode which does not default to libc++.
# Halide OpenGL/GLSL backend
-Halide's OpenGL backend offloads image processing operations to the GPU by
-generating GLSL-based fragment shaders.
-
-Compared to other GPU-based processing options such as CUDA and OpenCL, OpenGL
-has two main advantages: it is available on basically every desktop computer and
-mobile device, and it is generally well supported across different hardware
-vendors.
-
-The main disadvantage of OpenGL as an image processing framework is that the
-computational capabilities of fragment shaders are quite restricted. In general,
-the processing model provided by OpenGL is most suitable for filters where each
-output pixel can be expressed as a simple function of the input pixels. This
-covers a wide range of interesting operations like point-wise filters and
-convolutions; but a few common image processing operations such as histograms or
-recursive filters are notoriously hard to express in GLSL.
-
-#### Writing OpenGL-Based Filters
-
-To enable code generation for OpenGL, include `opengl` in the target specifier
-passed to Halide. Since OpenGL shaders are limited in their computational power,
-you must also specify a CPU target for those parts of the filter that cannot or
-should not be computed on the GPU. Examples of valid target specifiers are
-
-```
-host-opengl
-x86-opengl-debug
-```
-
-Adding `debug`, as in the second example, adds additional logging output and is
-highly recommended during development.
-
-By default, filters compiled for OpenGL targets run completely on the CPU.
-Execution on the GPU must be enabled for individual Funcs by appropriate
-scheduling calls.
-
-GLSL fragment shaders implicitly iterate over two spatial dimensions x,y and the
-color channel. Due to the way color channels handled in GLSL, only filters for
-which the color index is a compile-time constant can be scheduled. The main
-consequence is that the range of color variables must be explicitly specified
-for both input and output buffers before scheduling:
-
-```
-ImageParam input;
-Func f;
-Var x, y, c;
-f(x, y, c) = ...;
-
-input.set_bounds(2, 0, 3); // specify color range for input
-f.bound(c, 0, 3); // and output
-f.glsl(x, y, c);
-```
-
-#### JIT Compilation
-
-For JIT compilation Halide attempts to load the system libraries for opengl and
-creates a new context to use for each module. Windows is not yet supported.
-
-Examples for JIT execution of OpenGL-based filters can be found in test/opengl.
-
-#### AOT Compilation
-
-When AOT (ahead-of-time) compilation is used, Halide generates OpenGL-enabled
-object files that can be linked to and called from a host application. In
-general, this is fairly straightforward, but a few things must be taken care of.
-
-On Linux, OS X, and Android, Halide creates its own OpenGL context unless the
-current thread already has an active context. On other platforms you have to
-link implementations of the following two functions with your Halide code:
-
-```
-extern "C" int halide_opengl_create_context(void *) {
- return 0; // if successful
-}
-
-extern "C" void *halide_opengl_get_proc_addr(void *, const char *name) {
- ...
-}
-```
-
-Halide allocates and deletes textures as necessary. Applications may manage the
-textures by hand by setting the `halide_buffer_t::device` field; this is most
-useful for reusing image data that is already stored in textures. Some
-rudimentary checks are performed to ensure that externally allocated textures
-have the correct format, but in general that's the responsibility of the
-application.
-
-It is possible to let render directly to the current framebuffer; to do this,
-set the `dev` field of the output buffer to the value returned by
-`halide_opengl_output_client_bound`. The example in apps/HelloAndroidGL
-demonstrates this technique.
-
-Some operating systems can delete the OpenGL context of suspended applications.
-If this happens, Halide needs to re-initialize itself with the new context after
-the application resumes. Call `halide_opengl_context_lost` to reset Halide's
-OpenGL state after this has happened.
-
-#### Limitations
-
-The current implementation of the OpenGL backend targets the common subset of
-OpenGL 2.0 and OpenGL ES 2.0 which is widely available on both mobile devices
-and traditional computers. As a consequence, only a subset of the Halide
-language can be scheduled to run using OpenGL. Some important limitations are:
-
-- Reductions cannot be implemented in GLSL and must be run on the CPU.
-
-- OpenGL ES 2.0 only supports uint8 buffers.
-
- Support for floating point texture is available, but requires OpenGL (ES) 3.0
- or the texture_float extension, which may not work on all mobile devices.
-
-- OpenGL ES 2.0 has very limited support for integer arithmetic. For maximum
- compatibility, consider doing all computations using floating point, even when
- using integer textures.
-
-- Only 2D images with 3 or 4 color channels can be scheduled. Images with one or
- two channels require OpenGL (ES) 3.0 or the texture_rg extension.
-
-- Not all builtin functions provided by Halide are currently supported, for
- example `fast_log`, `fast_exp`, `fast_pow`, `reinterpret`, bit operations,
- `random_float`, `random_int` cannot be used in GLSL code.
-
-The maximum texture size in OpenGL is `GL_MAX_TEXTURE_SIZE`, which is often
-smaller than the image of interest; on mobile devices, for example,
-`GL_MAX_TEXTURE_SIZE` is commonly 2048. Tiling must be used to process larger
-images.
-
-Planned features:
-
-- Support for half-float textures and arithmetic
-
-- Support for integer textures and arithmetic
-
-(Note that OpenGL Compute Shaders are supported with a separate OpenGLCompute
-backend.)
+TODO(https://github.com/halide/Halide/issues/5633): update this for OpenGLCompute, which is staying
# Halide for Hexagon HVX
diff --git a/README_cmake.md b/README_cmake.md
index d078c41775b0..421d93007bee 100644
--- a/README_cmake.md
+++ b/README_cmake.md
@@ -392,7 +392,6 @@ apply when `WITH_TESTS=ON`:
| `WITH_TEST_ERROR` | `ON` | enable the expected-error tests |
| `WITH_TEST_WARNING` | `ON` | enable the expected-warning tests |
| `WITH_TEST_PERFORMANCE` | `ON` | enable performance testing |
-| `WITH_TEST_OPENGL` | `OFF` | enable the OpenGL tests |
| `WITH_TEST_GENERATOR` | `ON` | enable the AOT generator tests |
The following options enable/disable various LLVM backends (they correspond to
@@ -416,7 +415,6 @@ The following options enable/disable various Halide-specific backends:
| Option | Default | Description |
| --------------------- | ------- | -------------------------------------- |
| `TARGET_OPENCL` | `ON` | Enable the OpenCL-C backend |
-| `TARGET_OPENGL` | `ON` | Enable the OpenGL/GLSL backend |
| `TARGET_METAL` | `ON` | Enable the Metal backend |
| `TARGET_D3D12COMPUTE` | `ON` | Enable the Direct3D 12 Compute backend |
@@ -466,6 +464,8 @@ If the CMake version is lower than 3.18, the deprecated [`FindCUDA`][findcuda]
module will be used instead. It reads the variable `CUDA_TOOLKIT_ROOT_DIR`
instead of `CUDAToolkit_ROOT` above.
+TODO(https://github.com/halide/Halide/issues/5633): update this section for OpenGLCompute, which needs some (but maybe not all) of this.
+
When targeting OpenGL, the [`FindOpenGL`][findopengl] and [`FindX11`][findx11]
modules will be used to link AOT generated binaries. These modules can be
overridden by setting the following variables:
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 7e0ed08e4763..3effa0221125 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -9,7 +9,6 @@ enable_testing()
# add_subdirectory(HelloAndroid) # TODO(#5374): missing CMake build
# add_subdirectory(HelloAndroidCamera2) # TODO(#5374): missing CMake build
-# add_subdirectory(HelloAndroidGL) # TODO(#5374): missing CMake build
# add_subdirectory(HelloMatlab) # TODO(#5374): missing CMake build
# add_subdirectory(HelloPyTorch) # TODO(#5374): missing CMake build
# add_subdirectory(HelloWasm) # TODO(#5374): missing CMake build
@@ -24,7 +23,6 @@ add_subdirectory(conv_layer)
add_subdirectory(cuda_mat_mul)
add_subdirectory(depthwise_separable_conv)
add_subdirectory(fft)
-add_subdirectory(glsl)
add_subdirectory(harris)
# add_subdirectory(hexagon_benchmarks) # TODO(#5374): missing CMake build
# add_subdirectory(hexagon_dma) # TODO(#5374): missing CMake build
@@ -39,7 +37,6 @@ add_subdirectory(max_filter)
add_subdirectory(nl_means)
# add_subdirectory(nn_ops) # TODO(#5374): missing CMake build
# add_subdirectory(onnx) # TODO(#5374): missing CMake build
-# add_subdirectory(opengl_demo) # TODO(#5374): missing CMake build
# add_subdirectory(openglcompute) # TODO(#5374): missing CMake build
add_subdirectory(resize)
# add_subdirectory(resnet_50) # TODO(#5374): missing CMake build
diff --git a/apps/HelloAndroidGL/AndroidManifest.xml b/apps/HelloAndroidGL/AndroidManifest.xml
deleted file mode 100644
index de292f319f7f..000000000000
--- a/apps/HelloAndroidGL/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/HelloAndroidGL/ant.properties b/apps/HelloAndroidGL/ant.properties
deleted file mode 100644
index b0971e891efd..000000000000
--- a/apps/HelloAndroidGL/ant.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is used to override default values used by the Ant build system.
-#
-# This file must be checked into Version Control Systems, as it is
-# integral to the build system of your project.
-
-# This file is only used by the Ant script.
-
-# You can use this to override default values such as
-# 'source.dir' for the location of your java source folder and
-# 'out.dir' for the location of your output folder.
-
-# You can also use it define how the release builds are signed by declaring
-# the following properties:
-# 'key.store' for the location of your keystore and
-# 'key.alias' for the name of the key to use.
-# The password will be asked during the build when you use the 'release' target.
-
diff --git a/apps/HelloAndroidGL/build.sh b/apps/HelloAndroidGL/build.sh
deleted file mode 100755
index d9b1f395dc12..000000000000
--- a/apps/HelloAndroidGL/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-set -e
-android update project -p . --target android-17
-cd jni
-c++ -std=c++11 halide_gl_filter.cpp -L ../../../bin -lHalide -I ../../../include -ldl -lpthread -lz
-HL_TARGET=arm-32-android-opengl-debug DYLD_LIBRARY_PATH=../../../bin LD_LIBRARY_PATH=../../../bin ./a.out
-cd ..
-pwd
-ndk-build
-ant debug
-adb install -r bin/HelloAndroidGL-debug.apk
-adb logcat
diff --git a/apps/HelloAndroidGL/build.xml b/apps/HelloAndroidGL/build.xml
deleted file mode 100644
index 1e79c7ee52fa..000000000000
--- a/apps/HelloAndroidGL/build.xml
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apps/HelloAndroidGL/jni/Android.mk b/apps/HelloAndroidGL/jni/Android.mk
deleted file mode 100644
index c30cec7bf54b..000000000000
--- a/apps/HelloAndroidGL/jni/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := android_halide_gl_native
-LOCAL_ARM_MODE := arm
-LOCAL_SRC_FILES := android_halide_gl_native.cpp
-LOCAL_LDFLAGS := -Ljni
-LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 jni/halide_gl_filter.o
-LOCAL_STATIC_LIBRARIES := android_native_app_glue
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../include
-
-include $(BUILD_SHARED_LIBRARY)
-
-$(call import-module,android/native_app_glue)
diff --git a/apps/HelloAndroidGL/jni/Application.mk b/apps/HelloAndroidGL/jni/Application.mk
deleted file mode 100644
index 56005dabf161..000000000000
--- a/apps/HelloAndroidGL/jni/Application.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-# The ARMv7 is significanly faster due to the use of the hardware FPU
-APP_ABI := armeabi-v7a
-APP_PLATFORM := android-17
diff --git a/apps/HelloAndroidGL/jni/android_halide_gl_native.cpp b/apps/HelloAndroidGL/jni/android_halide_gl_native.cpp
deleted file mode 100644
index 20e3de6bfe56..000000000000
--- a/apps/HelloAndroidGL/jni/android_halide_gl_native.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "HalideBuffer.h"
-#include "HalideRuntimeOpenGL.h"
-#include "halide_gl_filter.h"
-
-#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "halide_native", __VA_ARGS__)
-#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "halide_native", __VA_ARGS__)
-
-void *const user_context = NULL;
-
-extern "C" JNIEXPORT void JNICALL Java_org_halide_1lang_hellohalidegl_HalideGLView_processTextureHalide(
- JNIEnv *env, jobject obj, jint dst, jint width, jint height) {
-
- auto dstBuf = Halide::Runtime::Buffer::make_interleaved(NULL, width, height, 4);
- // If dst == 0, let Halide render directly to the current render target.
- if (dst == 0) {
- int result = halide_opengl_wrap_render_target(user_context, dstBuf);
- if (result != 0) {
- halide_error(user_context, "halide_opengl_wrap_render_target failed");
- }
- } else {
- int result = halide_opengl_wrap_texture(user_context, dstBuf, dst);
- if (result != 0) {
- halide_error(user_context, "halide_opengl_wrap_texture failed");
- }
- }
-
- static float time = 0.0f;
- if (int err = halide_gl_filter(time, dstBuf)) {
- LOGD("Halide filter failed with error code %d\n", err);
- }
- time += 1.0f / 16.0f;
-
- uintptr_t detached = halide_opengl_detach_texture(user_context, dstBuf);
- if (detached != dst) {
- halide_error(user_context, "halide_opengl_detach_texture failed");
- }
-}
-
-extern "C" JNIEXPORT void JNICALL Java_org_halide_1lang_hellohalidegl_HalideGLView_halideContextLost(
- JNIEnv *env, jobject obj) {
-
- halide_opengl_context_lost(NULL);
-}
diff --git a/apps/HelloAndroidGL/jni/halide_gl_filter.cpp b/apps/HelloAndroidGL/jni/halide_gl_filter.cpp
deleted file mode 100644
index 15e949312539..000000000000
--- a/apps/HelloAndroidGL/jni/halide_gl_filter.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-#include "Halide.h"
-
-using namespace Halide;
-
-int main(int argc, char **argv) {
- Param time;
-
- const float pi = 3.1415926536;
-
- Var x, y, c;
- Func result;
-
- Expr kx, ky;
- Expr xx, yy;
- kx = x / 150.0f;
- ky = y / 150.0f;
-
- xx = kx + sin(time / 3.0f);
- yy = ky + sin(time / 2.0f);
-
- Expr angle;
- angle = 2 * pi * sin(time / 20.0f);
- kx = kx * cos(angle) - ky * sin(angle);
- ky = kx * sin(angle) + ky * cos(angle);
-
- Expr v = 0.0f;
- v += sin((ky + time) / 2.0f);
- v += sin((kx + ky + time) / 2.0f);
- v += sin(sqrt(xx * xx + yy * yy + 1.0f) + time);
-
- result(x, y, c) = cast(selecy_by_index(c, {32, cos(pi * v), sin(pi * v)}) * 80 + (255 - 80));
-
- result.output_buffer().set_stride(0, 4);
- result.bound(c, 0, 4);
- result.glsl(x, y, c);
-
- result.compile_to_file("halide_gl_filter", {time}, "halide_gl_filter");
-
- return 0;
-}
diff --git a/apps/HelloAndroidGL/project.properties b/apps/HelloAndroidGL/project.properties
deleted file mode 100644
index a3ee5ab64f5e..000000000000
--- a/apps/HelloAndroidGL/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-17
diff --git a/apps/HelloAndroidGL/res/drawable-hdpi/ic_launcher.png b/apps/HelloAndroidGL/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e5b8e9..000000000000
Binary files a/apps/HelloAndroidGL/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/apps/HelloAndroidGL/res/drawable-ldpi/ic_launcher.png b/apps/HelloAndroidGL/res/drawable-ldpi/ic_launcher.png
deleted file mode 100644
index 99238729d875..000000000000
Binary files a/apps/HelloAndroidGL/res/drawable-ldpi/ic_launcher.png and /dev/null differ
diff --git a/apps/HelloAndroidGL/res/drawable-mdpi/ic_launcher.png b/apps/HelloAndroidGL/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047dfa4ed..000000000000
Binary files a/apps/HelloAndroidGL/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/apps/HelloAndroidGL/res/drawable-xhdpi/ic_launcher.png b/apps/HelloAndroidGL/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d760f051..000000000000
Binary files a/apps/HelloAndroidGL/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/apps/HelloAndroidGL/res/layout/main.xml b/apps/HelloAndroidGL/res/layout/main.xml
deleted file mode 100644
index 5a8da6d73556..000000000000
--- a/apps/HelloAndroidGL/res/layout/main.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/apps/HelloAndroidGL/res/values/strings.xml b/apps/HelloAndroidGL/res/values/strings.xml
deleted file mode 100644
index 2673566b97f0..000000000000
--- a/apps/HelloAndroidGL/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Halide GL Demo
-
diff --git a/apps/HelloAndroidGL/src/org/halide_lang/hellohalidegl/HelloHalideGL.java b/apps/HelloAndroidGL/src/org/halide_lang/hellohalidegl/HelloHalideGL.java
deleted file mode 100644
index 78843d3d498f..000000000000
--- a/apps/HelloAndroidGL/src/org/halide_lang/hellohalidegl/HelloHalideGL.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.halide_lang.hellohalidegl;
-
-import android.app.Activity;
-import android.content.Context;
-import android.os.Bundle;
-import android.hardware.Camera;
-import android.util.Log;
-import android.widget.FrameLayout;
-import android.view.SurfaceView;
-import android.view.Surface;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.opengl.GLSurfaceView;
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-import java.nio.ByteBuffer;
-import java.nio.FloatBuffer;
-import java.nio.ByteOrder;
-
-class HalideGLView extends GLSurfaceView {
- static {
- System.loadLibrary("android_halide_gl_native");
- }
- private static native void processTextureHalide(int dst, int width, int height);
- private static native void halideContextLost();
-
- private static final android.opengl.GLES20 gl = new android.opengl.GLES20();
-
- // If set to true, let Halide render directly to the framebuffer.
- // Otherwise, Halide renders to a texture which we then blit to the
- // screen.
- private boolean halideDirectRender = true;
-
- HalideGLView(Context context) {
- super(context);
- setEGLContextClientVersion(2);
- setPreserveEGLContextOnPause(true);
- setDebugFlags(DEBUG_CHECK_GL_ERROR);
- setRenderer(new MyRenderer());
- }
-
- class MyRenderer implements GLSurfaceView.Renderer {
- private int output;
- private int surfaceWidth, surfaceHeight;
- private int program;
-
- private FloatBuffer quad_vertices;
-
- final String vs_source =
- "attribute vec2 position;\n" +
- "varying vec2 texpos;\n" +
- "void main(void) {\n" +
- " gl_Position = vec4(position, 0.0, 1.0);\n" +
- " texpos = position * 0.5 + 0.5;\n" +
- "}\n";
- final String fs_source =
- "uniform sampler2D tex;\n" +
- "varying highp vec2 texpos;\n" +
- "void main(void) {\n" +
- " gl_FragColor = texture2D(tex, texpos.xy);\n" +
- "}\n";
-
- public MyRenderer() {
- final float[] vertices = new float[] {
- -1.0f, -1.0f,
- 1.0f, -1.0f,
- -1.0f, 1.0f,
- 1.0f, 1.0f,
- };
- quad_vertices =
- ByteBuffer.allocateDirect(4 * vertices.length)
- .order(ByteOrder.nativeOrder())
- .asFloatBuffer();
- quad_vertices.put(vertices);
- }
-
- /** Compile a single vertex or fragment shader. */
- private int compileShader(int type, String source) {
- int shader = gl.glCreateShader(type);
- gl.glShaderSource(shader, source);
- gl.glCompileShader(shader);
- int[] status = new int[1];
- gl.glGetShaderiv(shader, gl.GL_COMPILE_STATUS, status, 0);
- if (status[0] == 0) {
- String log = gl.glGetShaderInfoLog(shader);
- Log.e(HelloHalideGL.TAG, log);
- throw new RuntimeException("Compiling shader failed");
- }
- return shader;
- }
-
- /** Compile and link simple vertex and fragment shader for rendering
- * 2D graphics. */
- private void prepareShaders() {
- int vertex_shader = compileShader(gl.GL_VERTEX_SHADER,
- vs_source);
- int fragment_shader = compileShader(gl.GL_FRAGMENT_SHADER,
- fs_source);
-
- program = gl.glCreateProgram();
- if (program == 0) {
- throw new RuntimeException("Invalid GLSL program");
- }
- gl.glAttachShader(program, vertex_shader);
- gl.glAttachShader(program, fragment_shader);
- gl.glBindAttribLocation(program, 0, "position");
- gl.glLinkProgram(program);
-
- int[] status = new int[1];
- gl.glGetProgramiv(program, gl.GL_LINK_STATUS, status, 0);
- if (status[0] == 0) {
- String log = gl.glGetProgramInfoLog(program);
- Log.e(HelloHalideGL.TAG, log);
- throw new RuntimeException("Linking GLSL program failed");
- }
- }
-
- private int createTexture(int w, int h) {
- int[] id = new int[1];
- gl.glGenTextures(1, id, 0);
- gl.glBindTexture(gl.GL_TEXTURE_2D, id[0]);
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_NEAREST);
- gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_NEAREST);
-
- ByteBuffer buf = ByteBuffer.allocate(w * h * 4);
- gl.glTexImage2D(gl.GL_TEXTURE_2D, 0, gl.GL_RGBA, w, h, 0,
- gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, buf);
- return id[0];
- }
-
- @Override
- public void onSurfaceCreated(GL10 unused, EGLConfig config) {
- Log.d("Hello", "onSurfaceCreated");
- prepareShaders();
- }
-
- @Override
- public void onSurfaceChanged(GL10 unused, int w, int h) {
- halideContextLost();
- int[] textures = { output };
- gl.glDeleteTextures(1, textures, 0);
- output = createTexture(w, h);
- surfaceWidth = w;
- surfaceHeight = h;
- }
-
- @Override
- public void onDrawFrame(GL10 unused) {
- Log.d("Hello", "onDrawFrame");
-
- if (halideDirectRender) {
- // Call Halide filter; 0 as the texture ID in this case
- // indicates render to framebuffer.
- processTextureHalide(0, surfaceWidth, surfaceHeight);
- } else {
- // Call Halide filter
- processTextureHalide(output, surfaceWidth, surfaceHeight);
-
- // Draw result to screen
- gl.glViewport(0, 0, surfaceWidth, surfaceHeight);
-
- gl.glUseProgram(program);
-
- int positionLoc = gl.glGetAttribLocation(program, "position");
- quad_vertices.position(0);
- gl.glVertexAttribPointer(positionLoc, 2, gl.GL_FLOAT, false, 0, quad_vertices);
- gl.glEnableVertexAttribArray(positionLoc);
-
- int texLoc = gl.glGetUniformLocation(program, "tex");
- gl.glUniform1i(texLoc, 0);
- gl.glActiveTexture(gl.GL_TEXTURE0);
- gl.glBindTexture(gl.GL_TEXTURE_2D, output);
-
- gl.glDrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4);
-
- gl.glDisableVertexAttribArray(positionLoc);
- gl.glBindTexture(gl.GL_TEXTURE_2D, 0);
- gl.glUseProgram(0);
- gl.glDisableVertexAttribArray(0);
- }
- }
- }
-}
-
-public class HelloHalideGL extends Activity {
- static final String TAG = "HelloHalideGL";
-
- private GLSurfaceView view;
-
- @Override
- public void onCreate(Bundle b) {
- super.onCreate(b);
- view = new HalideGLView(this);
- setContentView(view);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- view.onResume();
- }
-
- @Override
- public void onPause() {
- super.onPause();
- view.onPause();
- }
-}
diff --git a/apps/bgu/Makefile b/apps/bgu/Makefile
index a05070a3039c..ab8f69baaae5 100644
--- a/apps/bgu/Makefile
+++ b/apps/bgu/Makefile
@@ -24,7 +24,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/bgu.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/bgu.a $(BIN)/%/bgu_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgb.png $(BIN)/$*/out.png
diff --git a/apps/glsl/CMakeLists.txt b/apps/glsl/CMakeLists.txt
deleted file mode 100644
index e9a8a5f13765..000000000000
--- a/apps/glsl/CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-if (WIN32)
- # Halide OpenGL is broken on Windows.
- return()
-endif ()
-
-cmake_minimum_required(VERSION 3.16)
-project(glsl)
-
-enable_testing()
-
-# Set up language settings
-set(CMAKE_CXX_STANDARD 11)
-set(CMAKE_CXX_STANDARD_REQUIRED YES)
-set(CMAKE_CXX_EXTENSIONS NO)
-
-# Find Halide
-find_package(Halide REQUIRED)
-
-find_package(OpenGL REQUIRED)
-set(opengl_features opengl)
-if (TARGET OpenGL::OpenGL AND TARGET OpenGL::EGL)
- # EGL requires GLVND (which is found iff ::OpenGL is present)
- list(APPEND opengl_features egl)
-endif ()
-
-# Generators
-add_executable(glsl_blur.generator halide_blur_glsl_generator.cpp)
-target_link_libraries(glsl_blur.generator PRIVATE Halide::Generator)
-
-add_executable(ycc.generator halide_ycc_glsl_generator.cpp)
-target_link_libraries(ycc.generator PRIVATE Halide::Generator)
-
-# Libraries
-add_halide_library(halide_blur_glsl FROM glsl_blur.generator FEATURES ${opengl_features} debug)
-add_halide_library(halide_ycc_glsl FROM ycc.generator FEATURES ${opengl_features} debug)
-
-# Final executable
-add_executable(opengl_test opengl_test.cpp)
-target_link_libraries(opengl_test PRIVATE halide_blur_glsl halide_ycc_glsl)
-
-add_test(NAME opengl_test COMMAND opengl_test)
diff --git a/apps/glsl/Makefile b/apps/glsl/Makefile
deleted file mode 100644
index dc12d94ae504..000000000000
--- a/apps/glsl/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-include ../support/Makefile.inc
-
-# Note: using the -g flag in conjunction with the -debug Feature on OSX may
-# produce "failed to insert symbol" warnings at link time; this is annoying but harmless.
-CXXFLAGS += -g -O0
-
-all: $(BIN)/$(HL_TARGET)/opengl_test
-
-$(GENERATOR_BIN)/halide_blur_glsl.generator: halide_blur_glsl_generator.cpp $(GENERATOR_DEPS)
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
-
-$(BIN)/%/halide_blur_glsl.a: $(GENERATOR_BIN)/halide_blur_glsl.generator
- @mkdir -p $(@D)
- $^ -g halide_blur_glsl -e $(GENERATOR_OUTPUTS) -o $(@D) target=$*-opengl-debug
-
-$(GENERATOR_BIN)/halide_ycc_glsl.generator: halide_ycc_glsl_generator.cpp $(GENERATOR_DEPS)
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
-
-$(BIN)/%/halide_ycc_glsl.a: $(GENERATOR_BIN)/halide_ycc_glsl.generator
- @mkdir -p $(@D)
- $^ -g halide_ycc_glsl -e $(GENERATOR_OUTPUTS) -o $(@D) target=$*-opengl-debug
-
-$(BIN)/%/opengl_test: opengl_test.cpp $(BIN)/%/halide_blur_glsl.a $(BIN)/%/halide_ycc_glsl.a
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* $^ -o $@ $(LDFLAGS) -L$(TOP)/bin $(PLATFORM_OPENGL_LDFLAGS)
-
-run: $(BIN)/$(HL_TARGET)/opengl_test
- LD_LIBRARY_PATH=../../bin $<
-
-test: run
-
-.PHONY: clean
-clean:
- rm -rf $(BIN)
diff --git a/apps/glsl/halide_blur_glsl_generator.cpp b/apps/glsl/halide_blur_glsl_generator.cpp
deleted file mode 100644
index 1d9a2eae47dc..000000000000
--- a/apps/glsl/halide_blur_glsl_generator.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-#include "Halide.h"
-
-namespace {
-
-class HalideBlurGLSL : public Halide::Generator {
-public:
- Input> input8{"input8", 3};
- Output> blur_filter{"blur_filter", 3};
- void generate() {
- assert(get_target().has_feature(Target::OpenGL));
-
- Func blur_x("blur_x"), blur_y("blur_y");
- Var x("x"), y("y"), c("c");
-
- // The algorithm
- Func input;
- input(x, y, c) = cast(input8(clamp(x, input8.dim(0).min(), input8.dim(0).max()),
- clamp(y, input8.dim(1).min(), input8.dim(1).max()), c)) /
- 255.f;
- blur_x(x, y, c) = (input(x, y, c) + input(x + 1, y, c) + input(x + 2, y, c)) / 3;
- blur_y(x, y, c) = (blur_x(x, y, c) + blur_x(x, y + 1, c) + blur_x(x, y + 2, c)) / 3;
- blur_filter(x, y, c) = cast(blur_y(x, y, c) * 255.f);
-
- // Schedule for GLSL
- input8.dim(2).set_bounds(0, 3);
- blur_filter.bound(c, 0, 3);
- blur_filter.glsl(x, y, c);
- }
-};
-
-} // namespace
-
-HALIDE_REGISTER_GENERATOR(HalideBlurGLSL, halide_blur_glsl)
diff --git a/apps/glsl/halide_ycc_glsl_generator.cpp b/apps/glsl/halide_ycc_glsl_generator.cpp
deleted file mode 100644
index 47c05e8f4f3a..000000000000
--- a/apps/glsl/halide_ycc_glsl_generator.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "Halide.h"
-
-namespace {
-
-class RgbToYcc : public Halide::Generator {
-public:
- Input> input8{"input8", 3};
- Output> out{"out", 3};
- void generate() {
- assert(get_target().has_feature(Target::OpenGL));
- Var x("x"), y("y"), c("c");
-
- // The algorithm
- Func input("input");
- input(x, y, c) = cast(input8(x, y, c)) / 255.0f;
-
- Func Y("Y"), Cb("Cb"), Cr("Cr");
- Y(x, y) = 16.f / 255.f + (0.257f * input(x, y, 0) +
- 0.504f * input(x, y, 1) +
- 0.098f * input(x, y, 2));
- Cb(x, y) = 128.f / 255.f + (0.439f * input(x, y, 0) +
- -0.368f * input(x, y, 1) +
- -0.071f * input(x, y, 2));
- Cr(x, y) = 128.f / 255.f + (-0.148f * input(x, y, 0) +
- -0.291f * input(x, y, 1) +
- 0.439f * input(x, y, 2));
- out(x, y, c) = cast(
- mux(c, {Y(x, y), Cb(x, y), Cr(x, y), 0.0f}) * 255.f);
-
- // Schedule for GLSL
- input8.dim(2).set_bounds(0, 3);
- out.bound(c, 0, 3);
- out.glsl(x, y, c);
- }
-};
-
-} // namespace
-
-HALIDE_REGISTER_GENERATOR(RgbToYcc, halide_ycc_glsl)
diff --git a/apps/glsl/opengl_test.cpp b/apps/glsl/opengl_test.cpp
deleted file mode 100644
index 161805887daa..000000000000
--- a/apps/glsl/opengl_test.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include
-#include
-#include
-
-#include "HalideBuffer.h"
-#include "HalideRuntime.h"
-#include "HalideRuntimeOpenGL.h"
-
-using Halide::Runtime::Buffer;
-
-#include "halide_blur_glsl.h"
-#include "halide_ycc_glsl.h"
-
-void test_blur() {
- const int W = 12, H = 32, C = 3;
- Buffer input(W, H, C);
- Buffer output(W, H, C);
-
- fprintf(stderr, "test_blur\n");
- halide_blur_glsl(input, output);
- fprintf(stderr, "test_blur complete\n");
-}
-
-void test_ycc() {
- const int W = 12, H = 32, C = 3;
- Buffer input(W, H, C);
- Buffer output(W, H, C);
-
- fprintf(stderr, "test_ycc\n");
- halide_ycc_glsl(input, output);
- fprintf(stderr, "Ycc complete\n");
-}
-
-void test_device_sync() {
- const int W = 12, H = 32, C = 3;
- Buffer temp(W, H, C);
-
- temp.set_host_dirty();
- int result = temp.copy_to_device(halide_opengl_device_interface());
- if (result != 0) {
- fprintf(stderr, "halide_device_malloc failed with return %d.\n", result);
- abort();
- } else {
- result = temp.device_sync();
- if (result != 0) {
- fprintf(stderr, "halide_device_sync failed with return %d.\n", result);
- abort();
- } else {
- fprintf(stderr, "Test device sync complete.\n");
- }
- }
-}
-
-int main(int argc, char *argv[]) {
- test_blur();
- test_ycc();
- test_device_sync();
-}
diff --git a/apps/harris/Makefile b/apps/harris/Makefile
index 3fef49815a1c..713c11d0c2c7 100644
--- a/apps/harris/Makefile
+++ b/apps/harris/Makefile
@@ -22,7 +22,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/harris.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/harris.a $(BIN)/%/harris_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/apps/hist/Makefile b/apps/hist/Makefile
index 8ab3e5785407..5f4faa1b835a 100644
--- a/apps/hist/Makefile
+++ b/apps/hist/Makefile
@@ -24,7 +24,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/hist.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/hist.a $(BIN)/%/hist_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/apps/iir_blur/Makefile b/apps/iir_blur/Makefile
index d195ffa7caf5..8c9983c8fa14 100644
--- a/apps/iir_blur/Makefile
+++ b/apps/iir_blur/Makefile
@@ -22,7 +22,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/iir_blur.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/iir_blur.a $(BIN)/%/iir_blur_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/apps/interpolate/Makefile b/apps/interpolate/Makefile
index fc5d8d7609f1..9d0d5c41f434 100644
--- a/apps/interpolate/Makefile
+++ b/apps/interpolate/Makefile
@@ -24,7 +24,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/interpolate.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/interpolate.a $(BIN)/%/interpolate_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/apps/lens_blur/Makefile b/apps/lens_blur/Makefile
index ea403c1e5bcf..8ede6b797ffe 100644
--- a/apps/lens_blur/Makefile
+++ b/apps/lens_blur/Makefile
@@ -19,7 +19,7 @@ $(BIN)/%/lens_blur_auto_schedule.a: $(GENERATOR_BIN)/lens_blur.generator
$(BIN)/%/process: process.cpp $(BIN)/%/lens_blur.a $(BIN)/%/lens_blur_auto_schedule.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/process
@mkdir -p $(@D)
diff --git a/apps/local_laplacian/Makefile b/apps/local_laplacian/Makefile
index e9a9b69fe53f..21fa7bf74f6b 100644
--- a/apps/local_laplacian/Makefile
+++ b/apps/local_laplacian/Makefile
@@ -18,7 +18,7 @@ $(BIN)/%/local_laplacian_auto_schedule.a: $(GENERATOR_BIN)/local_laplacian.gener
$(BIN)/%/process: process.cpp $(BIN)/%/local_laplacian.a $(BIN)/%/local_laplacian_auto_schedule.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/process
@mkdir -p $(@D)
@@ -30,7 +30,7 @@ $(BIN)/%/out.tiff: $(BIN)/%/process
$(BIN)/%/process_viz: process.cpp $(BIN)/%-trace_all/local_laplacian.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -DNO_AUTO_SCHEDULE -I$(BIN)/$*-trace_all -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -DNO_AUTO_SCHEDULE -I$(BIN)/$*-trace_all -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
../../bin/HalideTraceViz: ../../util/HalideTraceViz.cpp
$(MAKE) -C ../../ bin/HalideTraceViz
diff --git a/apps/max_filter/Makefile b/apps/max_filter/Makefile
index 6fcd9a59748c..bd755774b2f5 100644
--- a/apps/max_filter/Makefile
+++ b/apps/max_filter/Makefile
@@ -24,7 +24,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/max_filter.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/max_filter.a $(BIN)/%/max_filter_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/apps/nl_means/Makefile b/apps/nl_means/Makefile
index 13c9290cd3a2..2c7fecdccc47 100644
--- a/apps/nl_means/Makefile
+++ b/apps/nl_means/Makefile
@@ -18,7 +18,7 @@ $(BIN)/%/nl_means_auto_schedule.a: $(GENERATOR_BIN)/nl_means.generator
$(BIN)/%/process: process.cpp $(BIN)/%/nl_means.a $(BIN)/%/nl_means_auto_schedule.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/process
@mkdir -p $(@D)
diff --git a/apps/opengl_demo/Makefile b/apps/opengl_demo/Makefile
deleted file mode 100644
index 5d6bc2bb23e7..000000000000
--- a/apps/opengl_demo/Makefile
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# This could be more DRY using some Makefile magic, but for the example
-# app will try to maximize clarity by making most rules explicit
-#
-
-# Where to find Halide.
-#
-# If you are building this demo using Halide installed systemwide (e.g. on
-# OS X installed via homebrew), you can set:
-#
-# HALIDE_TOOLS_DIR = /usr/local/share/halide/tools
-# HALIDE_LIB_PATH =
-# HALIDE_INC_PATH =
-#
-# These settings are for building within the Halide source tree:
-HALIDE_TOOLS_DIR = ../../tools
-HALIDE_LIB_PATH = -L ../../bin
-HALIDE_INC_PATH = -I ../../include
-HL_TARGET ?= host
-
-# Platform-specific settings.
-#
-UNAME = $(shell uname)
-
-ifeq ($(UNAME),Darwin)
-
- # These are for OS X:
- DTX_FONT = /Library/Fonts/Arial.ttf
- OPENGL_LIBS = -lglfw -framework OpenGL -framework GLUT
- GENERATOR_LIBS = -lHalide -lz -lcurses
-
-else
-
- # These are for Ubuntu Linux
- DTX_FONT = /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
- OPENGL_LIBS = `pkg-config glfw3 --libs` -lGL -lglut -lX11 -lpthread -ldl -lXxf86vm -lXinerama -lXcursor -lXrandr
- GENERATOR_LIBS = -lHalide -lz -lcurses -Wl,--rpath=$(HALIDE_LIB_PATH)
-
-endif
-
-#
-# General build settings. Should be good cross-platform.
-#
-MAIN_LIBS = -lpng -ldrawtext $(OPENGL_LIBS)
-GENERATOR_LIBS = -lHalide -lz -lcurses
-CXXFLAGS = -std=c++11 -g -DDTX_FONT=\"$(DTX_FONT)\" $(HALIDE_INC_PATH)
-
-# Output directory.
-BIN ?= bin
-
-.PHONY: run clean
-
-default: run
-
-run: $(BIN)/opengl_demo
- $(BIN)/opengl_demo image.png
-
-clean:
- rm -rf $(BIN)
-
-$(BIN)/opengl_demo: \
- $(BIN)/main.o \
- $(BIN)/layout.o \
- $(BIN)/timer.o \
- $(BIN)/glfw_helpers.o \
- $(BIN)/opengl_helpers.o \
- $(BIN)/png_helpers.o \
- $(BIN)/sample_filter_cpu.o \
- $(BIN)/sample_filter_opengl.o
- $(CXX) $(CXXFLAGS) -o $@ $^ $(MAIN_LIBS)
-
-#
-# Explicitly list the dependency on the generated filter header files,
-# to ensure that they are created first.
-#
-$(BIN)/main.o: \
- $(BIN)/sample_filter_cpu.h \
- $(BIN)/sample_filter_opengl.h
-
-#
-# Rules to AOT-compile the halide filter for both CPU and OpenGL; the
-# compiled filters depend on $(BIN)/sample_filter.generator, which in turn
-# depends on the halide filter source in sample_filter.cpp
-#
-$(BIN)/sample_filter_cpu.o $(BIN)/sample_filter_cpu.h: $(BIN)/sample_filter.generator
- LD_LIBRARY_PATH=../../bin $(BIN)/sample_filter.generator -g sample_filter -e object,c_header,stmt -o $(BIN) -f sample_filter_cpu target=$(HL_TARGET)
-
-$(BIN)/sample_filter_opengl.o $(BIN)/sample_filter_opengl.h: $(BIN)/sample_filter.generator
- LD_LIBRARY_PATH=../../bin $(BIN)/sample_filter.generator -g sample_filter -e object,c_header,stmt -o $(BIN) -f sample_filter_opengl target=host-opengl-debug
-
-$(BIN)/sample_filter.generator: sample_filter_generator.cpp
- @mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -o $@ $^ $(HALIDE_TOOLS_DIR)/GenGen.cpp $(HALIDE_LIB_PATH) $(GENERATOR_LIBS) $(HALIDE_SYSTEM_LIBS)
-
-#
-# Build in subdir using auto-dependency mechanism
-#
-$(BIN)/%.o: %.cpp
- @mkdir -p $(@D)
- $(CXX) -c $(CXXFLAGS) -I$(BIN) -MMD -MF $(patsubst %.o,%.d,$@) -o $@ $<
-
--include $(wildcard $(BIN)/*.d)
diff --git a/apps/opengl_demo/README.md b/apps/opengl_demo/README.md
deleted file mode 100644
index d2e7e8c91b88..000000000000
--- a/apps/opengl_demo/README.md
+++ /dev/null
@@ -1,104 +0,0 @@
-# Halide OpenGL Demo
-
-This demo contains an OpenGL desktop app that displays an input image side by
-side with the result of running a sample halide filter in three different ways:
-
-1. On the CPU, not using OpenGL.
-
-2. In OpenGL, with Halide transfering the input data from the host and
- transferring the result data back to the host.
-
-3. In OpenGL, with Halide accepting input data that's in an OpenGL texture, and
- leaving the result in an OpenGL texture.
-
-The display reports the timing for each. You should expect to see that #3 is
-fastest as it runs entirely on the GPU, while #2 is slowest because of the data
-transfer times.
-
-In this example we use AOT compilation twice: Once with `target=host` to produce
-the filter that runs on the CPU; and once with `target=host-opengl` to produce
-the filter that runs in OpenGL (which we call twice).
-
-The sample filter inverts the RGB channels of the input image.
-
-_This demo is known to work on OS X 10.11 and Ubuntu Linux 14.04 & 16.04.
-Windows has not yet been tested._
-
-### Instructions:
-
-Build and run the app by simply running `make`. It should open a window showing
-the input and the three (identical) filtering results. You can close the window
-and exit by pressing ESCAPE.
-
-The `Makefile` has variables to specify where to find Halide, how to link
-OpenGL, and so forth. You may need to tweak them for your platform.
-
-See the Makefile for details on how the filter gets AOT-compiled for CPU and
-OpenGL. Note that the `Makefile` actually specifies `target=host-opengl-debug`
-when AOT-compiling the opengl filter; that enables tracing of Halide's
-management of its OpenGL pipeline.
-
-#### Dependencies:
-
-This app depends on:
-
-- [GLFW 3](http://www.glfw.org)
-- [libpng](http://www.libpng.org)
-- [libdrawtext](http://nuclear.mutantstargoat.com/sw/libdrawtext/)
-
-On OS X, all three can be installed using [homebrew](http://brew.sh)
-
-```sh
-brew install glfw
-brew install libpng
-brew install libdrawtext
-```
-
-Halide itself can be installed on OS X via
-
-```sh
-brew tap halide/halide
-brew install halide
-```
-
-On Ubuntu Linux, everything but libdrawtext can be installed via system
-packages:
-
-```sh
-sudo apt-get install libglfw3-dev libx11-dev freeglut3-dev libfreetype6-dev libgl-dev libpng-dev
-```
-
-For libdrawtext, try this:
-
-```
-git clone https://github.com/jtsiomb/libdrawtext.git
-cd libdrawtext
-./configure
-make
-sudo make install
-```
-
-### Files:
-
-- `sample_filter.cpp`
-
- The Halide filter generator source.
-
-- `main.cpp`
-
- Contains all the Halide client code.
-
- Note that it `#include`s the generated files `build/sample_filter_cpu.h` and
- `build/sample_filter_opengl.h`.
-
-- `layout.{h,cpp}`
-
- A minimal rendering framework for this example app.
-
-- `timer.{h,cpp}`
-
- A minimal timing & reporting library.
-
-- `{glfw,opengl,png}_helpers.{cpp,h}`
-
- Conveniences that hide the dirty details of the low-level packages.
diff --git a/apps/opengl_demo/glfw_helpers.cpp b/apps/opengl_demo/glfw_helpers.cpp
deleted file mode 100644
index 07752597e42d..000000000000
--- a/apps/opengl_demo/glfw_helpers.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-#include "glfw_helpers.h"
-#include
-#include
-#include
-#include
-
-using namespace GlfwHelpers;
-
-static GLFWwindow *window;
-
-static void die(const char *msg) {
- fprintf(stderr, "%s\n", msg);
- exit(EXIT_FAILURE);
-}
-
-static void error_callback(int error, const char *description) {
- die(description);
-}
-
-static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods) {
- if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
- glfwSetWindowShouldClose(window, GL_TRUE);
-}
-
-static bool first_focus = false;
-static void focus_callback(GLFWwindow *window, int) {
- first_focus = true;
-}
-
-struct info GlfwHelpers::setup(int width, int height) {
- struct info info;
-
- glfwSetErrorCallback(error_callback);
- if (!glfwInit()) die("couldn't init glfw!");
- glfwWindowHint(GLFW_DOUBLEBUFFER, GL_FALSE); // Single buffer mode, to avoid any doublebuffering timing issues
- window = glfwCreateWindow(width, height, "opengl_halide_test", NULL, NULL);
- if (!window) die("couldn't create window!");
- glfwSetKeyCallback(window, key_callback);
- glfwSetWindowFocusCallback(window, focus_callback);
- glfwMakeContextCurrent(window);
-
- while (!first_focus) {
- glfwWaitEvents();
- }
-
- int framebuffer_width, framebuffer_height;
- glfwGetFramebufferSize(window, &framebuffer_width, &framebuffer_height);
- info.dpi_scale = float(framebuffer_width) / float(width);
-
- return info;
-}
-
-void GlfwHelpers::terminate() {
- while (!glfwWindowShouldClose(window)) {
- glfwPollEvents();
- }
- glfwDestroyWindow(window);
- glfwTerminate();
-}
-
-void GlfwHelpers::set_opengl_context() {
- glfwMakeContextCurrent(window);
-}
diff --git a/apps/opengl_demo/glfw_helpers.h b/apps/opengl_demo/glfw_helpers.h
deleted file mode 100644
index cd3a0f05bdcf..000000000000
--- a/apps/opengl_demo/glfw_helpers.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _GLFW_HELPERS_H_
-#define _GLFW_HELPERS_H_
-
-namespace GlfwHelpers {
-
-struct info {
- float dpi_scale;
-};
-
-struct info setup(int width, int height);
-void set_opengl_context();
-void terminate();
-} // namespace GlfwHelpers
-
-#endif
diff --git a/apps/opengl_demo/image.png b/apps/opengl_demo/image.png
deleted file mode 100644
index c73df2103613..000000000000
Binary files a/apps/opengl_demo/image.png and /dev/null differ
diff --git a/apps/opengl_demo/layout.cpp b/apps/opengl_demo/layout.cpp
deleted file mode 100644
index be313c068814..000000000000
--- a/apps/opengl_demo/layout.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include
-
-#include "opengl_helpers.h"
-
-#include "layout.h"
-
-using namespace Layout;
-
-static const int border_sz = 10; // pixels
-static const int header_sz = 20; // pixels
-
-static struct info state;
-
-const struct info &Layout::setup(int image_width, int image_height) {
- state.window_width = 2 * image_width + 3 * border_sz;
- state.window_height = 2 * image_height + border_sz + 2 * header_sz;
- return state;
-}
-
-void Layout::draw_texture(enum location location, GLuint texture_id, int width, int height, const std::string &label) {
- int x0, x1, y0, y1, lx, ly;
- switch (location) { // set X coords
- case LL:
- case UL:
- x0 = border_sz;
- x1 = x0 + width;
- lx = x0 + 2;
- break;
- case LR:
- case UR:
- x1 = state.window_width - border_sz;
- x0 = x1 - width;
- lx = x0 + 2;
- break;
- }
- switch (location) { // set Y coords
- case LL:
- case LR:
- y0 = header_sz;
- y1 = y0 + height;
- ly = 6;
- break;
- case UL:
- case UR:
- y1 = state.window_height - header_sz;
- y0 = y1 - height;
- ly = y1 + 6;
- break;
- }
-
- OpenGLHelpers::display_texture(texture_id, 2.0 * x0 / state.window_width - 1.0, 2.0 * x1 / state.window_width - 1.0, 2.0 * y0 / state.window_height - 1.0, 2.0 * y1 / state.window_height - 1.0);
- OpenGLHelpers::draw_text(label, 2.0 * lx / state.window_width - 1.0, 2.0 * ly / state.window_height - 1.0);
-}
-
-void Layout::draw_image(enum location location, const uint8_t *data, int width, int height, const std::string &label) {
- const auto texture_id = OpenGLHelpers::create_texture(width, height, data);
- draw_texture(location, texture_id, width, height, label);
- OpenGLHelpers::delete_texture(texture_id);
-}
diff --git a/apps/opengl_demo/layout.h b/apps/opengl_demo/layout.h
deleted file mode 100644
index be4947abc122..000000000000
--- a/apps/opengl_demo/layout.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _LAYOUT_HELPERS_H_
-#define _LAYOUT_HELPERS_H_
-
-#if defined(__APPLE__)
-#include
-#else
-#include
-#endif
-
-namespace Layout {
-
-enum location { UL,
- UR,
- LL,
- LR };
-
-struct info {
- int window_width;
- int window_height;
-};
-
-const struct info &setup(int image_width, int image_height);
-
-void draw_image(enum location location, const uint8_t *data, int width, int height, const std::string &label);
-void draw_texture(enum location location, GLuint texture_id, int width, int height, const std::string &label);
-} // namespace Layout
-
-#endif
diff --git a/apps/opengl_demo/main.cpp b/apps/opengl_demo/main.cpp
deleted file mode 100644
index 955f21ac812c..000000000000
--- a/apps/opengl_demo/main.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-#include
-#include
-
-#include "glfw_helpers.h"
-#include "layout.h"
-#include "opengl_helpers.h"
-#include "png_helpers.h"
-#include "timer.h"
-
-#include "sample_filter_cpu.h"
-#include "sample_filter_opengl.h"
-#include
-#include
-
-/*
- * Initializes a halide_buffer_t object for 8-bit RGBA data stored
- * interleaved as rgbargba... in row-major order.
- */
-Halide::Runtime::Buffer create_buffer(uint8_t *data, int width, int height) {
- return Halide::Runtime::Buffer::make_interleaved(data, width, height, 4);
-}
-
-/*
- * Runs the filter on the CPU. Takes a pointer to memory with the image
- * data to filter, and a pointer to memory in which to place the result
- * data.
- */
-std::string run_cpu_filter(const uint8_t *image_data, uint8_t *result_data, int width, int height) {
- const auto time = Timer::start("CPU");
-
- // Create halide input buffer and point it at the passed image data
- auto input_buf = create_buffer((uint8_t *)image_data, width, height);
-
- // Create halide output buffer and point it at the passed result data storage
- auto output_buf = create_buffer(result_data, width, height);
-
- // Run the AOT-compiled OpenGL filter
- sample_filter_cpu(input_buf, output_buf);
-
- return Timer::report(time);
-}
-
-/*
- * Runs the filter on OpenGL. Takes a pointer to memory with the image
- * data to filter, and a pointer to memory in which to place the result
- * data.
- */
-std::string run_opengl_filter_from_host_to_host(const uint8_t *image_data, uint8_t *result_data, int width, int height) {
- const auto time = Timer::start("OpenGL host-to-host");
-
- // Create halide input buffer and point it at the passed image data for
- // the host memory. Halide will automatically allocate a texture to
- // hold the data on the GPU. Mark the host memory as "dirty" so halide
- // will know it needs to transfer the data to the GPU texture.
- auto input_buf = create_buffer((uint8_t *)image_data, width, height);
- input_buf.set_host_dirty();
-
- // Create halide output buffer and point it at the passed result data
- // memory. Halide will automatically allocate a texture to hold the
- // data on the GPU.
- auto output_buf = create_buffer(result_data, width, height);
-
- // Run the AOT-compiled OpenGL filter
- sample_filter_opengl(input_buf, output_buf);
-
- // Ensure that halide copies the data back to the host
- output_buf.copy_to_host();
-
- return Timer::report(time);
-}
-
-/*
- * Runs the filter on OpenGL. Assumes the data is already in a texture,
- * and leaves the output in a texture
- */
-std::string run_opengl_filter_from_texture_to_texture(GLuint input_texture_id, GLuint output_texture_id, int width, int height) {
- const auto time = Timer::start("OpenGL texture-to-texture");
-
- // Create halide input buffer and tell it to use the existing GPU
- // texture. No need to allocate memory on the host since this simple
- // pipeline will run entirely on the GPU.
- auto input_buf = create_buffer(nullptr, width, height);
- halide_opengl_wrap_texture(nullptr, input_buf.raw_buffer(), input_texture_id);
-
- // Create halide output buffer and tell it to use the existing GPU texture.
- // No need to allocate memory on the host since this simple pipeline will run
- // entirely on the GPU.
- auto output_buf = create_buffer(nullptr, width, height);
- halide_opengl_wrap_texture(nullptr, output_buf.raw_buffer(), output_texture_id);
-
- // Run the AOT-compiled OpenGL filter
- sample_filter_opengl(input_buf, output_buf);
-
- // Tell halide we are finished using the textures
- halide_opengl_detach_texture(nullptr, output_buf.raw_buffer());
- halide_opengl_detach_texture(nullptr, input_buf.raw_buffer());
-
- return Timer::report(time);
-}
-
-int main(const int argc, const char *argv[]) {
- if (argc != 2) {
- std::cerr << "Usage: " << argv[0] << " filename\n";
- exit(1);
- }
- const std::string filename = argv[1];
-
- const auto image = PNGHelpers::load(filename);
- const auto width = image.width;
- const auto height = image.height;
-
- const auto layout = Layout::setup(width, height);
- const auto glfw = GlfwHelpers::setup(layout.window_width, layout.window_height);
- OpenGLHelpers::setup(glfw.dpi_scale);
-
- /*
- * Draw the original image
- */
- Layout::draw_image(Layout::UL, image.data, width, height, "Input");
-
- std::string report;
-
- /*
- * Draw the result of running the filter on the CPU
- */
- const auto cpu_result_data = (uint8_t *)calloc(width * height * 4, sizeof(uint8_t));
- report = run_cpu_filter(image.data, cpu_result_data, width, height);
- Layout::draw_image(Layout::UR, cpu_result_data, width, height, report);
- free((void *)cpu_result_data);
-
- /*
- * Draw the result of running the filter on OpenGL, with data starting
- * from and ending up on the host
- */
- const auto opengl_result_data = (uint8_t *)calloc(width * height * 4, sizeof(uint8_t));
- report = run_opengl_filter_from_host_to_host(image.data, opengl_result_data, width, height);
- Layout::draw_image(Layout::LL, opengl_result_data, width, height, report);
- free((void *)opengl_result_data);
-
- /*
- * Draw the result of running the filter on OpenGL, with data starting
- * from and ending up in a texture on the device
- */
- const auto image_texture_id = OpenGLHelpers::create_texture(width, height, image.data);
- const auto result_texture_id = OpenGLHelpers::create_texture(width, height, nullptr);
- report = run_opengl_filter_from_texture_to_texture(image_texture_id, result_texture_id, width, height);
- Layout::draw_texture(Layout::LR, result_texture_id, width, height, report);
- OpenGLHelpers::delete_texture(image_texture_id);
- OpenGLHelpers::delete_texture(result_texture_id);
-
- // Release all Halide internal structures for the OpenGL context
- halide_opengl_context_lost(nullptr);
-
- GlfwHelpers::terminate();
-
- free((void *)image.data);
-
- return 0;
-}
-
-/*
- * Global definition required by halide with OpenGL backend, to prevent
- * Halide from allocating its own OpenGL context.
- *
- * In general, this function needs to set an active OpenGL context
- * and return 0 on success.
- */
-
-int halide_opengl_create_context(void * /*user_context*/) {
- GlfwHelpers::set_opengl_context();
- return 0;
-}
diff --git a/apps/opengl_demo/opengl_helpers.cpp b/apps/opengl_demo/opengl_helpers.cpp
deleted file mode 100644
index 1cf994f19879..000000000000
--- a/apps/opengl_demo/opengl_helpers.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include
-
-#include "opengl_helpers.h"
-
-using namespace OpenGLHelpers;
-
-static const int font_size = 12;
-
-void OpenGLHelpers::setup(float dpi_scale) {
- const int scaled_font_size = font_size * dpi_scale;
- dtx_use_font(dtx_open_font(DTX_FONT, scaled_font_size), scaled_font_size);
- glClear(GL_COLOR_BUFFER_BIT);
-}
-
-GLuint OpenGLHelpers::create_texture(int width, int height, const uint8_t *data) {
- GLuint texture_id;
- glEnable(GL_TEXTURE_2D);
- glGenTextures(1, &texture_id);
- glBindTexture(GL_TEXTURE_2D, texture_id);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
- return texture_id;
-}
-
-void OpenGLHelpers::delete_texture(GLuint texture_id) {
- glDeleteTextures(1, &texture_id);
-}
-
-void OpenGLHelpers::display_texture(GLuint texture_id, float x0, float x1, float y0, float y1) {
- glBindTexture(GL_TEXTURE_2D, texture_id);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_TEXTURE);
- glLoadIdentity();
- glColor3f(1, 1, 1);
- glBegin(GL_QUADS);
- glTexCoord2d(1, 0);
- glVertex2f(x1, y1);
- glTexCoord2d(0, 0);
- glVertex2f(x0, y1);
- glTexCoord2d(0, 1);
- glVertex2f(x0, y0);
- glTexCoord2d(1, 1);
- glVertex2f(x1, y0);
- glEnd();
- glFinish();
-}
-
-void OpenGLHelpers::draw_text(const std::string &text, float x, float y) {
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(-1, 1, -1, 1, -1, 1);
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glTranslatef(x, y, 0);
- glColor3f(1, 1, 1);
- GLint viewport[4];
- glGetIntegerv(GL_VIEWPORT, viewport);
- glScalef(2.0f / viewport[2], 2.0f / viewport[3], 1);
- dtx_string(text.c_str());
- glFinish();
-}
diff --git a/apps/opengl_demo/opengl_helpers.h b/apps/opengl_demo/opengl_helpers.h
deleted file mode 100644
index 962f61989928..000000000000
--- a/apps/opengl_demo/opengl_helpers.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _OPENGL_HELPERS_H_
-#define _OPENGL_HELPERS_H_
-
-#include
-
-#if defined(__APPLE__)
-#include
-#else
-#include
-#endif
-
-namespace OpenGLHelpers {
-void setup(float dpi_scale);
-GLuint create_texture(int width, int height, const uint8_t *data);
-void delete_texture(GLuint texture_id);
-void display_texture(GLuint texture_id, float x0, float x1, float y0, float y1);
-void draw_text(const std::string &text, float x, float y);
-} // namespace OpenGLHelpers
-
-#endif
diff --git a/apps/opengl_demo/png_helpers.cpp b/apps/opengl_demo/png_helpers.cpp
deleted file mode 100644
index c7d48f00949f..000000000000
--- a/apps/opengl_demo/png_helpers.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-#include
-#include
-#include
-
-#include "png_helpers.h"
-
-using namespace PNGHelpers;
-
-struct image_info PNGHelpers::load(const std::string &filepath) {
- const auto fp = fopen(filepath.c_str(), "rb");
- if (fp == 0) {
- perror(filepath.c_str());
- exit(1);
- }
-
- // verify the header
- png_byte header[8];
- fread(header, 1, 8, fp);
- if (png_sig_cmp(header, 0, 8)) {
- std::cerr << "error: " << filepath << " is not a PNG file.\n";
- exit(1);
- }
-
- auto png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- auto png_info = png_create_info_struct(png);
-
- if (setjmp(png_jmpbuf(png))) abort();
-
- png_init_io(png, fp);
- png_set_sig_bytes(png, 8); // already read header
- png_read_info(png, png_info);
-
- const auto width = png_get_image_width(png, png_info);
- const auto height = png_get_image_height(png, png_info);
- const auto color_type = png_get_color_type(png, png_info);
- const auto bit_depth = png_get_bit_depth(png, png_info);
-
- if (bit_depth == 16)
- png_set_strip_16(png);
-
- if (color_type == PNG_COLOR_TYPE_PALETTE)
- png_set_palette_to_rgb(png);
-
- if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
- png_set_expand_gray_1_2_4_to_8(png);
-
- if (png_get_valid(png, png_info, PNG_INFO_tRNS))
- png_set_tRNS_to_alpha(png);
-
- if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_PALETTE)
- png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
-
- if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
- png_set_gray_to_rgb(png);
-
- png_read_update_info(png, png_info);
-
- const auto rowbytes = png_get_rowbytes(png, png_info);
- const auto image_data = (png_byte *)malloc(rowbytes * height * sizeof(png_byte));
-
- const auto row_pointers = (png_byte **)malloc(height * sizeof(png_byte *));
- for (int i = 0; i < height; i++) {
- row_pointers[i] = image_data + i * rowbytes;
- }
-
- png_read_image(png, row_pointers);
-
- png_destroy_read_struct(&png, &png_info, nullptr);
- free(row_pointers);
- fclose(fp);
-
- return {width, height, image_data};
-}
diff --git a/apps/opengl_demo/png_helpers.h b/apps/opengl_demo/png_helpers.h
deleted file mode 100644
index da1791526e00..000000000000
--- a/apps/opengl_demo/png_helpers.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _PNG_HELPERS_
-#define _PNG_HELPERS_
-
-namespace PNGHelpers {
-
-struct image_info {
- unsigned int width;
- unsigned int height;
- const uint8_t *data;
-};
-
-struct image_info load(const std::string &filepath);
-} // namespace PNGHelpers
-
-#endif
diff --git a/apps/opengl_demo/sample_filter_generator.cpp b/apps/opengl_demo/sample_filter_generator.cpp
deleted file mode 100644
index 4bf30eaf641b..000000000000
--- a/apps/opengl_demo/sample_filter_generator.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "Halide.h"
-
-class SampleFilter : public Halide::Generator {
-public:
- Input> input{"input", 3};
- Output> output{"output", 3};
-
- void generate() {
- Var x, y, c;
-
- output(x, y, c) = select(c == 3, input(x, y, c), cast(255.0f - input(x, y, c)));
-
- input.dim(0).set_stride(4).dim(2).set_stride(1).set_bounds(0, 4);
-
- output.dim(0).set_stride(4).dim(2).set_stride(1);
- output.bound(c, 0, 4);
-
- if (get_target().has_feature(Target::OpenGL)) {
- output.glsl(x, y, c);
- }
- }
-};
-
-HALIDE_REGISTER_GENERATOR(SampleFilter, sample_filter)
diff --git a/apps/opengl_demo/timer.cpp b/apps/opengl_demo/timer.cpp
deleted file mode 100644
index 2cd243a323ab..000000000000
--- a/apps/opengl_demo/timer.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include
-#include
-
-#include "timer.h"
-
-using namespace Timer;
-
-struct info Timer::start(const std::string &what) {
- struct info info {
- what
- };
- std::cerr << "\n-------------- Starting " << info.what << "\n";
- info.time = std::chrono::high_resolution_clock::now();
- return info;
-}
-
-std::string Timer::report(const struct info &info) {
- const auto end_time = std::chrono::high_resolution_clock::now();
- const auto ms = std::chrono::duration(end_time - info.time).count();
- std::stringstream report;
- report << info.what << ": " << ms << "ms";
- std::cerr << "-------------- Finished " << report.str() << "\n";
- return report.str();
-}
diff --git a/apps/opengl_demo/timer.h b/apps/opengl_demo/timer.h
deleted file mode 100644
index 596e5c78fe55..000000000000
--- a/apps/opengl_demo/timer.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _TIMER_H_
-#define _TIMER_H_
-
-#include
-
-namespace Timer {
-struct info {
- const std::string what;
- std::chrono::time_point time;
-};
-
-struct info start(const std::string &what);
-std::string report(const struct info &);
-} // namespace Timer
-
-#endif
diff --git a/apps/resnet_50/Makefile b/apps/resnet_50/Makefile
index 188620382940..3d1dd30c9ce8 100644
--- a/apps/resnet_50/Makefile
+++ b/apps/resnet_50/Makefile
@@ -13,7 +13,7 @@ $(BIN)/%/pytorch_weights/ok:
$(GENERATOR_BIN)/resnet50.generator: Resnet50Generator.cpp $(GENERATOR_DEPS)
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -g -fno-rtti $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -g -fno-rtti $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
$(BIN)/%/resnet50.a: $(GENERATOR_BIN)/resnet50.generator
@mkdir -p $(@D)
@@ -21,7 +21,7 @@ $(BIN)/%/resnet50.a: $(GENERATOR_BIN)/resnet50.generator
$(BIN)/%/process: process.cpp $(BIN)/%/resnet50.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
benchmark_and_validate: $(BIN)/$(HL_TARGET)/process $(BIN)/$(HL_TARGET)/pytorch_weights/ok
$< 10 $* $(BIN)/$(HL_TARGET)/pytorch_weights/ $(SEED) $(BIN)/$(HL_TARGET)/res50gen_output.bin
diff --git a/apps/stencil_chain/Makefile b/apps/stencil_chain/Makefile
index 91750f988869..116922d03095 100644
--- a/apps/stencil_chain/Makefile
+++ b/apps/stencil_chain/Makefile
@@ -6,7 +6,7 @@ build: $(BIN)/$(HL_TARGET)/process
$(GENERATOR_BIN)/stencil_chain.generator: stencil_chain_generator.cpp $(GENERATOR_DEPS)
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
+ $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS)
$(BIN)/%/stencil_chain.a: $(GENERATOR_BIN)/stencil_chain.generator
@mkdir -p $(@D)
@@ -18,7 +18,7 @@ $(BIN)/%/stencil_chain_auto_schedule.a: $(GENERATOR_BIN)/stencil_chain.generator
$(BIN)/%/process: process.cpp $(BIN)/%/stencil_chain.a $(BIN)/%/stencil_chain_auto_schedule.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/process
@mkdir -p $(@D)
diff --git a/apps/support/Makefile.inc b/apps/support/Makefile.inc
index c72bf1c36735..8f647457dd9f 100644
--- a/apps/support/Makefile.inc
+++ b/apps/support/Makefile.inc
@@ -98,7 +98,6 @@ ANDROID_API_VERSION ?= 26
CXX-host ?= $(CXX)
CXX-host-opencl ?= $(CXX)
-CXX-host-opengl ?= $(CXX)
CXX-host-cuda ?= $(CXX)
CXX-host-metal ?= $(CXX)
CXX-host-hvx_128 ?= $(CXX)
@@ -111,7 +110,6 @@ CXX-arm-32-profile-android ?= $(CXX-arm-32-android)
CXXFLAGS-host ?= $(CXXFLAGS)
CXXFLAGS-host-opencl ?= $(CXXFLAGS)
-CXXFLAGS-host-opengl ?= $(CXXFLAGS)
CXXFLAGS-host-cuda ?= $(CXXFLAGS)
CXXFLAGS-host-metal ?= $(CXXFLAGS)
CXXFLAGS-host-hvx_128 ?= $(CXXFLAGS)
@@ -121,7 +119,6 @@ CXXFLAGS-arm-32-android ?= $(CXXFLAGS)
LDFLAGS-host ?= $(LDFLAGS)
LDFLAGS-host-opencl ?= $(LDFLAGS)
-LDFLAGS-host-opengl ?= $(LDFLAGS)
LDFLAGS-host-cuda ?= $(LDFLAGS)
LDFLAGS-host-metal ?= $(LDFLAGS)
LDFLAGS-host-hvx_128 ?= $(LDFLAGS)
@@ -185,15 +182,6 @@ IMAGE_IO_CXX_FLAGS = $(LIBPNG_CXX_FLAGS) $(LIBJPEG_CXX_FLAGS)
IMAGE_IO_FLAGS = $(IMAGE_IO_LIBS) $(IMAGE_IO_CXX_FLAGS)
-PLATFORM_OPENGL_LDFLAGS=-lGL -lX11
-ifeq ($(UNAME), Darwin)
-PLATFORM_OPENGL_LDFLAGS=-framework OpenGL
-endif
-
-ifneq (, $(findstring opengl,$(HL_TARGET)))
- OPENGL_LDFLAGS=$(PLATFORM_OPENGL_LDFLAGS)
-endif
-
ifneq (, $(findstring metal,$(HL_TARGET)))
LDFLAGS += -framework Metal -framework Foundation
endif
diff --git a/apps/unsharp/Makefile b/apps/unsharp/Makefile
index 1accb3c498ea..fa912ad172e1 100644
--- a/apps/unsharp/Makefile
+++ b/apps/unsharp/Makefile
@@ -22,7 +22,7 @@ $(BIN)/%/runtime.a: $(GENERATOR_BIN)/unsharp.generator
$(BIN)/%/filter: filter.cpp $(BIN)/%/unsharp.a $(BIN)/%/unsharp_auto_schedule.a $(BIN)/%/runtime.a
@mkdir -p $(@D)
- $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS) $(OPENGL_LDFLAGS)
+ $(CXX) $(CXXFLAGS) -I$(BIN)/$* -Wall -O3 $^ -o $@ $(LDFLAGS) $(IMAGE_IO_FLAGS) $(CUDA_LDFLAGS) $(OPENCL_LDFLAGS)
$(BIN)/%/out.png: $(BIN)/%/filter
$< ../images/rgba.png $(BIN)/$*/out.png
diff --git a/cmake/HalideGeneratorHelpers.cmake b/cmake/HalideGeneratorHelpers.cmake
index 220f1f56ceb8..d48e02778970 100644
--- a/cmake/HalideGeneratorHelpers.cmake
+++ b/cmake/HalideGeneratorHelpers.cmake
@@ -342,7 +342,8 @@ function(_Halide_add_targets_to_runtime TARGET)
endfunction()
function(_Halide_target_link_gpu_libs TARGET VISIBILITY)
- if ("${ARGN}" MATCHES "opengl")
+ # TODO(https://github.com/halide/Halide/issues/5633): verify that this is correct & necessary for OpenGLCompute
+ if ("${ARGN}" MATCHES "openglcompute")
if ("${ARGN}" MATCHES "egl")
find_package(OpenGL REQUIRED COMPONENTS OpenGL EGL)
target_link_libraries(${TARGET} ${VISIBILITY} OpenGL::OpenGL OpenGL::EGL)
diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt
index 3fc8ba95ce6e..002afd0bcd7d 100644
--- a/dependencies/CMakeLists.txt
+++ b/dependencies/CMakeLists.txt
@@ -6,6 +6,7 @@ set(THREADS_PREFER_PTHREAD_FLAG YES)
find_package(Threads REQUIRED)
set_target_properties(Threads::Threads PROPERTIES IMPORTED_GLOBAL TRUE)
+# TODO(https://github.com/halide/Halide/issues/5633): verify this is still correct / necessary for OpenGLCompute
find_package(OpenGL)
if (TARGET OpenGL::GL)
set_target_properties(OpenGL::GL PROPERTIES IMPORTED_GLOBAL TRUE)
@@ -18,7 +19,7 @@ endif ()
##
# Third-party dependencies in their own subdirectories
-##
+##
add_subdirectory(llvm)
diff --git a/python_bindings/correctness/target.py b/python_bindings/correctness/target.py
index b54fb2984969..3f8e8347b23b 100644
--- a/python_bindings/correctness/target.py
+++ b/python_bindings/correctness/target.py
@@ -46,10 +46,10 @@ def test_target():
# Full specification round-trip, crazy features
t1 = hl.Target(hl.TargetOS.Android, hl.TargetArch.ARM, 32,
[hl.TargetFeature.JIT, hl.TargetFeature.SSE41, hl.TargetFeature.AVX, hl.TargetFeature.AVX2,
- hl.TargetFeature.CUDA, hl.TargetFeature.OpenCL, hl.TargetFeature.OpenGL, hl.TargetFeature.OpenGLCompute,
+ hl.TargetFeature.CUDA, hl.TargetFeature.OpenCL, hl.TargetFeature.OpenGLCompute,
hl.TargetFeature.Debug])
ts = t1.to_string()
- assert ts == "arm-32-android-avx-avx2-cuda-debug-jit-opencl-opengl-openglcompute-sse41"
+ assert ts == "arm-32-android-avx-avx2-cuda-debug-jit-opencl-openglcompute-sse41"
assert hl.Target.validate_target_string(ts)
# Expected failures:
diff --git a/python_bindings/src/PyEnums.cpp b/python_bindings/src/PyEnums.cpp
index c64352f73101..b47cd3e761a9 100644
--- a/python_bindings/src/PyEnums.cpp
+++ b/python_bindings/src/PyEnums.cpp
@@ -15,7 +15,6 @@ void define_enums(py::module &m) {
.value("Default_GPU", DeviceAPI::Default_GPU)
.value("CUDA", DeviceAPI::CUDA)
.value("OpenCL", DeviceAPI::OpenCL)
- .value("GLSL", DeviceAPI::GLSL)
.value("OpenGLCompute", DeviceAPI::OpenGLCompute)
.value("Metal", DeviceAPI::Metal)
.value("Hexagon", DeviceAPI::Hexagon);
@@ -106,7 +105,6 @@ void define_enums(py::module &m) {
.value("CLDoubles", Target::Feature::CLDoubles)
.value("CLHalf", Target::Feature::CLHalf)
.value("CLAtomics64", Target::Feature::CLAtomics64)
- .value("OpenGL", Target::Feature::OpenGL)
.value("OpenGLCompute", Target::Feature::OpenGLCompute)
.value("EGL", Target::Feature::EGL)
.value("UserContext", Target::Feature::UserContext)
diff --git a/python_bindings/src/PyFunc.cpp b/python_bindings/src/PyFunc.cpp
index 4cf8eb6736e2..2bb24193a962 100644
--- a/python_bindings/src/PyFunc.cpp
+++ b/python_bindings/src/PyFunc.cpp
@@ -342,10 +342,6 @@ void define_func(py::module &m) {
.def("bound_extent", &Func::bound_extent, py::arg("var"), py::arg("extent"))
- .def("shader", &Func::shader, py::arg("x"), py::arg("y"), py::arg("c"), py::arg("device_api"))
-
- .def("glsl", &Func::glsl, py::arg("x"), py::arg("y"), py::arg("c"))
-
.def("align_storage", &Func::align_storage, py::arg("dim"), py::arg("alignment"))
.def("fold_storage", &Func::fold_storage, py::arg("dim"), py::arg("extent"), py::arg("fold_forward") = true)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 29458c7db0d9..0b45adf43715 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,7 +81,6 @@ set(HEADER_FILES
ImageParam.h
InferArguments.h
InjectHostDevBufferCopies.h
- InjectOpenGLIntrinsics.h
Inline.h
InlineReductions.h
IntegerDivisionTable.h
@@ -163,7 +162,6 @@ set(HEADER_FILES
UnsafePromises.h
Util.h
Var.h
- VaryingAttributes.h
VectorizeLoops.h
WasmExecutor.h
WrapCalls.h
@@ -241,7 +239,6 @@ set(SOURCE_FILES
ImageParam.cpp
InferArguments.cpp
InjectHostDevBufferCopies.cpp
- InjectOpenGLIntrinsics.cpp
Inline.cpp
InlineReductions.cpp
IntegerDivisionTable.cpp
@@ -335,7 +332,6 @@ set(SOURCE_FILES
UnsafePromises.cpp
Util.cpp
Var.cpp
- VaryingAttributes.cpp
VectorizeLoops.cpp
WasmExecutor.cpp
WrapCalls.cpp
@@ -454,11 +450,6 @@ if (TARGET_OPENCL)
target_compile_definitions(Halide PRIVATE WITH_OPENCL)
endif ()
-option(TARGET_OPENGL "Include OpenGL/GLSL target" ON)
-if (TARGET_OPENGL)
- target_compile_definitions(Halide PRIVATE WITH_OPENGL)
-endif ()
-
option(TARGET_METAL "Include Metal target" ON)
if (TARGET_METAL)
target_compile_definitions(Halide PRIVATE WITH_METAL)
diff --git a/src/CodeGen_C.cpp b/src/CodeGen_C.cpp
index 9aac7010eee3..72cc3ef29969 100644
--- a/src/CodeGen_C.cpp
+++ b/src/CodeGen_C.cpp
@@ -29,7 +29,6 @@ extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeHexagonHost
extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeMetal_h[];
extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeOpenCL_h[];
extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeOpenGLCompute_h[];
-extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeOpenGL_h[];
extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeQurt_h[];
extern "C" unsigned char halide_internal_runtime_header_HalideRuntimeD3D12Compute_h[];
@@ -418,9 +417,6 @@ CodeGen_C::~CodeGen_C() {
if (target.has_feature(Target::OpenGLCompute)) {
stream << halide_internal_runtime_header_HalideRuntimeOpenGLCompute_h << "\n";
}
- if (target.has_feature(Target::OpenGL)) {
- stream << halide_internal_runtime_header_HalideRuntimeOpenGL_h << "\n";
- }
if (target.has_feature(Target::D3D12Compute)) {
stream << halide_internal_runtime_header_HalideRuntimeD3D12Compute_h << "\n";
}
diff --git a/src/CodeGen_GPU_Host.cpp b/src/CodeGen_GPU_Host.cpp
index 488a8703bfdc..7f3d3a46fb68 100644
--- a/src/CodeGen_GPU_Host.cpp
+++ b/src/CodeGen_GPU_Host.cpp
@@ -22,7 +22,6 @@
#include "LLVM_Headers.h"
#include "Simplify.h"
#include "Util.h"
-#include "VaryingAttributes.h"
namespace Halide {
namespace Internal {
@@ -104,13 +103,9 @@ template
CodeGen_GPU_Host::CodeGen_GPU_Host(const Target &target)
: CodeGen_CPU(target) {
// For the default GPU, the order of preferences is: Metal,
- // OpenCL, CUDA, OpenGLCompute, and OpenGL last.
+ // OpenCL, CUDA, OpenGLCompute last.
// The code is in reverse order to allow later tests to override
// earlier ones.
- if (target.has_feature(Target::OpenGL)) {
- debug(1) << "Constructing OpenGL device codegen\n";
- cgdev[DeviceAPI::GLSL] = std::make_unique(target);
- }
if (target.has_feature(Target::OpenGLCompute)) {
debug(1) << "Constructing OpenGL Compute device codegen\n";
cgdev[DeviceAPI::OpenGLCompute] = new_CodeGen_OpenGLCompute_Dev(target);
@@ -255,77 +250,31 @@ void CodeGen_GPU_Host::visit(const For *loop) {
Value *gpu_num_coords_dim0 = zero_int32;
Value *gpu_num_coords_dim1 = zero_int32;
- if (loop->device_api == DeviceAPI::GLSL) {
-
- // GL draw calls that invoke the GLSL shader are issued for pairs of
- // for-loops over spatial x and y dimensions. For each for-loop we create
- // one scalar vertex attribute for the spatial dimension corresponding to
- // that loop, plus one scalar attribute for each expression previously
- // labeled as "glsl_varying"
-
- // Pass variables created during setup_gpu_vertex_buffer to the
- // dev run function call.
- gpu_num_padded_attributes = codegen(Variable::make(Int(32), "glsl.num_padded_attributes"));
- gpu_num_coords_dim0 = codegen(Variable::make(Int(32), "glsl.num_coords_dim0"));
- gpu_num_coords_dim1 = codegen(Variable::make(Int(32), "glsl.num_coords_dim1"));
-
- // Look up the allocation for the vertex buffer and cast it to the
- // right type
- gpu_vertex_buffer = codegen(Variable::make(type_of(), "glsl.vertex_buffer"));
- gpu_vertex_buffer = builder->CreatePointerCast(gpu_vertex_buffer,
- CodeGen_LLVM::f32_t->getPointerTo());
- }
-
// compute a closure over the state passed into the kernel
HostClosure c(loop->body, loop->name);
// Determine the arguments that must be passed into the halide function
vector closure_args = c.arguments();
- // Halide allows passing of scalar float and integer arguments. For
- // OpenGL, pack these into vec4 uniforms and varying attributes
- if (loop->device_api == DeviceAPI::GLSL) {
-
- int num_uniform_floats = 0;
-
- // The spatial x and y coordinates are passed in the first two
- // scalar float varying slots
- int num_varying_floats = 2;
- int num_uniform_ints = 0;
-
- // Pack scalar parameters into vec4
- for (size_t i = 0; i < closure_args.size(); i++) {
- if (closure_args[i].is_buffer) {
- continue;
- } else if (ends_with(closure_args[i].name, ".varying")) {
- closure_args[i].packed_index = num_varying_floats++;
- } else if (closure_args[i].type.is_float()) {
- closure_args[i].packed_index = num_uniform_floats++;
- } else if (closure_args[i].type.is_int()) {
- closure_args[i].packed_index = num_uniform_ints++;
- }
- }
- } else {
- // Sort the args by the size of the underlying type. This is
- // helpful for avoiding struct-packing ambiguities in metal,
- // which passes the scalar args as a struct.
- std::sort(closure_args.begin(), closure_args.end(),
- [](const DeviceArgument &a, const DeviceArgument &b) {
- if (a.is_buffer == b.is_buffer) {
- return a.type.bits() > b.type.bits();
- } else {
- // Ensure that buffer arguments come first:
- // for many OpenGL/Compute systems, the
- // legal indices for buffer args are much
- // more restrictive than for scalar args,
- // and scalar args can be 'grown' by
- // LICM. Putting buffers first makes it much
- // more likely we won't fail on some
- // hardware.
- return a.is_buffer > b.is_buffer;
- }
- });
- }
+ // Sort the args by the size of the underlying type. This is
+ // helpful for avoiding struct-packing ambiguities in metal,
+ // which passes the scalar args as a struct.
+ std::sort(closure_args.begin(), closure_args.end(),
+ [](const DeviceArgument &a, const DeviceArgument &b) {
+ if (a.is_buffer == b.is_buffer) {
+ return a.type.bits() > b.type.bits();
+ } else {
+ // Ensure that buffer arguments come first:
+ // for many OpenGL/Compute systems, the
+ // legal indices for buffer args are much
+ // more restrictive than for scalar args,
+ // and scalar args can be 'grown' by
+ // LICM. Putting buffers first makes it much
+ // more likely we won't fail on some
+ // hardware.
+ return a.is_buffer > b.is_buffer;
+ }
+ });
for (size_t i = 0; i < closure_args.size(); i++) {
if (closure_args[i].is_buffer && allocations.contains(closure_args[i].name)) {
diff --git a/src/CodeGen_Internal.cpp b/src/CodeGen_Internal.cpp
index f118ec9b9f2e..86a1baf60bb0 100644
--- a/src/CodeGen_Internal.cpp
+++ b/src/CodeGen_Internal.cpp
@@ -222,7 +222,6 @@ bool function_takes_user_context(const std::string &name) {
"halide_memoization_cache_release",
"halide_cuda_run",
"halide_opencl_run",
- "halide_opengl_run",
"halide_openglcompute_run",
"halide_metal_run",
"halide_d3d12compute_run",
@@ -246,7 +245,6 @@ bool function_takes_user_context(const std::string &name) {
"halide_vtcm_free",
"halide_cuda_initialize_kernels",
"halide_opencl_initialize_kernels",
- "halide_opengl_initialize_kernels",
"halide_openglcompute_initialize_kernels",
"halide_metal_initialize_kernels",
"halide_d3d12compute_initialize_kernels",
diff --git a/src/CodeGen_LLVM.cpp b/src/CodeGen_LLVM.cpp
index ae1bf51bf4fd..e5d86abc753a 100644
--- a/src/CodeGen_LLVM.cpp
+++ b/src/CodeGen_LLVM.cpp
@@ -240,7 +240,6 @@ std::unique_ptr CodeGen_LLVM::new_for_target(const Target &target,
// The awkward mapping from targets to code generators
if (target.features_any_of({Target::CUDA,
Target::OpenCL,
- Target::OpenGL,
Target::OpenGLCompute,
Target::Metal,
Target::D3D12Compute})) {
diff --git a/src/CodeGen_OpenGLCompute_Dev.cpp b/src/CodeGen_OpenGLCompute_Dev.cpp
index 1bc8c7d46cdb..1be9045bb1d1 100644
--- a/src/CodeGen_OpenGLCompute_Dev.cpp
+++ b/src/CodeGen_OpenGLCompute_Dev.cpp
@@ -7,7 +7,6 @@
#include "IRMutator.h"
#include "IROperator.h"
#include "Simplify.h"
-#include "VaryingAttributes.h"
#include
#include
#include