Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Target::OpenGL (etc) as deprecated (#5475) #5551

Merged
merged 1 commit into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/JITModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,14 @@ enum RuntimeKind {
OpenCL,
Metal,
CUDA,
OpenGL,
OpenGL, // NOTE: this feature is deprecated and will be removed in Halide 12.
OpenGLCompute,
Hexagon,
D3D12Compute,
OpenCLDebug,
MetalDebug,
CUDADebug,
OpenGLDebug,
OpenGLDebug, // NOTE: this feature is deprecated and will be removed in Halide 12.
OpenGLComputeDebug,
HexagonDebug,
D3D12ComputeDebug,
Expand Down
4 changes: 4 additions & 0 deletions src/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,10 @@ std::map<std::string, std::string> Module::get_metadata_name_map() const {
void Module::compile(const std::map<Output, std::string> &output_files) const {
validate_outputs(output_files);

if (target().has_feature(Target::OpenGL)) {
user_warning << "WARNING: OpenGL is deprecated in Halide 11 and will be removed in Halide 12.\n";
}

// output stmt and html prior to resolving submodules. We need to
// clear the output after writing it, otherwise the output will
// be overwritten by recursive calls after submodules are resolved.
Expand Down
4 changes: 4 additions & 0 deletions src/Pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,10 @@ void Pipeline::realize(RealizationArg outputs, const Target &t,
Target target = t;
user_assert(defined()) << "Can't realize an undefined Pipeline\n";

if (t.has_feature(Target::OpenGL)) {
user_warning << "WARNING: OpenGL is deprecated in Halide 11 and will be removed in Halide 12.\n";
}

debug(2) << "Realizing Pipeline for " << target << "\n";

if (target.has_unknowns()) {
Expand Down
2 changes: 1 addition & 1 deletion src/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct Target {
CLDoubles = halide_target_feature_cl_doubles,
CLHalf = halide_target_feature_cl_half,
CLAtomics64 = halide_target_feature_cl_atomic64,
OpenGL = halide_target_feature_opengl,
OpenGL = halide_target_feature_opengl, // NOTE: this feature is deprecated and will be removed in Halide 12.
OpenGLCompute = halide_target_feature_openglcompute,
EGL = halide_target_feature_egl,
UserContext = halide_target_feature_user_context,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/HalideRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ typedef enum halide_target_feature_t {
halide_target_feature_cl_doubles, ///< Enable double support on OpenCL targets
halide_target_feature_cl_atomic64, ///< Enable 64-bit atomics operations on OpenCL targets

halide_target_feature_opengl, ///< Enable the OpenGL runtime.
halide_target_feature_opengl, ///< Enable the OpenGL runtime. NOTE: this feature is deprecated and will be removed in Halide 12.
halide_target_feature_openglcompute, ///< Enable OpenGL Compute runtime.

halide_target_feature_user_context, ///< Generated code takes a user_context pointer as first argument
Expand Down
10 changes: 10 additions & 0 deletions src/runtime/HalideRuntimeOpenGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ extern "C" {

#define HALIDE_RUNTIME_OPENGL

HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern const struct halide_device_interface_t *halide_opengl_device_interface();

/** These are forward declared here to allow clients to override the
* Halide Glsl runtime. Do not call them. */
// @{
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern int halide_opengl_initialize_kernels(void *user_context, void **state_ptr,
const char *src, int size);

HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern int halide_opengl_run(void *user_context,
void *state_ptr,
const char *entry_name,
Expand All @@ -47,6 +50,7 @@ extern int halide_opengl_run(void *user_context,
* must be NULL when this routine is called. This call can fail due to
* being passed an invalid texture. The device and host dirty bits are
* left unmodified. */
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern int halide_opengl_wrap_texture(void *user_context, struct halide_buffer_t *buf, uint64_t texture_id);

/** Set the underlying OpenGL texture for a buffer to refer to the
Expand All @@ -56,6 +60,7 @@ extern int halide_opengl_wrap_texture(void *user_context, struct halide_buffer_t
* the halide_buffer_t must be NULL when this routine is called. This
* call can fail due to running out of memory. The device and host
* dirty bits are left unmodified. */
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern int halide_opengl_wrap_render_target(void *user_context, struct halide_buffer_t *buf);

/** Disconnect this halide_buffer_t from the texture it was previously
Expand All @@ -65,6 +70,7 @@ extern int halide_opengl_wrap_render_target(void *user_context, struct halide_bu
* device pointer, but does not free the texture. The dev field of
* the halide_buffer_t will be NULL on return.
*/
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern int halide_opengl_detach_texture(void *user_context, struct halide_buffer_t *buf);

/** Return the underlying texture for a halide_buffer_t. This buffer
Expand All @@ -73,19 +79,23 @@ extern int halide_opengl_detach_texture(void *user_context, struct halide_buffer
* or if the buffer was wrapped via
* halide_opengl_wrap_render_target(), this returns 0.
*/
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern uintptr_t halide_opengl_get_texture(void *user_context, struct halide_buffer_t *buf);

/** Forget all state associated with the previous OpenGL context. This is
* similar to halide_opengl_release, except that we assume that all OpenGL
* resources have already been reclaimed by the OS. */
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
extern void halide_opengl_context_lost(void *user_context);

/** This functions MUST be provided by the host environment to retrieve pointers
* to OpenGL API functions. */
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
void *halide_opengl_get_proc_address(void *user_context, const char *name);

/** This functions MUST be provided by the host environment to create an OpenGL
* context for use by the OpenGL backend. */
HALIDE_ATTRIBUTE_DEPRECATED("OpenGL is deprecated in Halide 11 and will be removed in Halide 12")
int halide_opengl_create_context(void *user_context);

#ifdef __cplusplus
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/opengl.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Ignore deprecation warnings inside our own runtime
#define HALIDE_ALLOW_DEPRECATED 1

#include "HalideRuntimeOpenGL.h"
#include "device_interface.h"
#include "mini_opengl.h"
Expand Down
3 changes: 3 additions & 0 deletions src/runtime/runtime_api.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Ignore deprecation warnings inside our own runtime
#define HALIDE_ALLOW_DEPRECATED 1

#include "HalideRuntime.h"
#include "HalideRuntimeCuda.h"
#include "HalideRuntimeD3D12Compute.h"
Expand Down