Commit 2fba7204 authored by Vedran Miletić's avatar Vedran Miletić Committed by Francisco Jerez
Browse files

clover: Introduce CLOVER_EXTRA_*_OPTIONS environment variables



The options specified in the CLOVER_EXTRA_BUILD_OPTIONS shell
variable are appended to the options specified by the OpenCL program
in the clBuildProgram function call, if any.
Analogously, the options specified in the CLOVER_EXTRA_COMPILE_OPTIONS
and CLOVER_EXTRA_LINK_OPTIONS variables are appended to the options
specified in clCompileProgram and clLinkProgram function calls,
respectively.

v2:
 * rename to CLOVER_EXTRA_COMPILER_OPTIONS
 * use debug_get_option
 * append to linker options as well

v3: code cleanups

v4: separate CLOVER_EXTRA_LINKER_OPTIONS options

v5:
 * fix documentation typo
 * use CLOVER_EXTRA_COMPILER_OPTIONS in link stage

v6:
 * separate in CLOVER_EXTRA_{BUILD,COMPILE,LINK}_OPTIONS
 * append options in cl{Build,Compile,Link}Program
Signed-off-by: default avatarVedran Miletić <vedran@miletic.net>
Reviewed-by[v1]: Edward O'Callaghan <funfunctor@folklore1984.net>

v7 [Francisco Jerez]: Slight simplification.
Reviewed-by: Francisco Jerez's avatarFrancisco Jerez <currojerez@riseup.net>
parent e3272865
...@@ -235,6 +235,21 @@ Setting to "tgsi", for example, will print all the TGSI shaders. ...@@ -235,6 +235,21 @@ Setting to "tgsi", for example, will print all the TGSI shaders.
See src/mesa/state_tracker/st_debug.c for other options. See src/mesa/state_tracker/st_debug.c for other options.
</ul> </ul>
<h3>Clover state tracker environment variables</h3>
<ul>
<li>CLOVER_EXTRA_BUILD_OPTIONS - allows specifying additional compiler and linker
options. Specified options are appended after the options set by the OpenCL
program in clBuildProgram.
<li>CLOVER_EXTRA_COMPILE_OPTIONS - allows specifying additional compiler
options. Specified options are appended after the options set by the OpenCL
program in clCompileProgram.
<li>CLOVER_EXTRA_LINK_OPTIONS - allows specifying additional linker
options. Specified options are appended after the options set by the OpenCL
program in clLinkProgram.
</ul>
<h3>Softpipe driver environment variables</h3> <h3>Softpipe driver environment variables</h3>
<ul> <ul>
<li>SOFTPIPE_DUMP_FS - if set, the softpipe driver will print fragment shaders <li>SOFTPIPE_DUMP_FS - if set, the softpipe driver will print fragment shaders
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "api/util.hpp" #include "api/util.hpp"
#include "core/program.hpp" #include "core/program.hpp"
#include "util/u_debug.h"
#include <sstream> #include <sstream>
...@@ -177,7 +178,8 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs, ...@@ -177,7 +178,8 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
auto &prog = obj(d_prog); auto &prog = obj(d_prog);
auto devs = (d_devs ? objs(d_devs, num_devs) : auto devs = (d_devs ? objs(d_devs, num_devs) :
ref_vector<device>(prog.context().devices())); ref_vector<device>(prog.context().devices()));
auto opts = (p_opts ? p_opts : ""); const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_BUILD_OPTIONS", "");
validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
...@@ -202,7 +204,8 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs, ...@@ -202,7 +204,8 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
auto &prog = obj(d_prog); auto &prog = obj(d_prog);
auto devs = (d_devs ? objs(d_devs, num_devs) : auto devs = (d_devs ? objs(d_devs, num_devs) :
ref_vector<device>(prog.context().devices())); ref_vector<device>(prog.context().devices()));
auto opts = (p_opts ? p_opts : ""); const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_COMPILE_OPTIONS", "");
header_map headers; header_map headers;
validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data); validate_build_common(prog, num_devs, d_devs, pfn_notify, user_data);
...@@ -271,7 +274,8 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs, ...@@ -271,7 +274,8 @@ clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
void (*pfn_notify) (cl_program, void *), void *user_data, void (*pfn_notify) (cl_program, void *), void *user_data,
cl_int *r_errcode) try { cl_int *r_errcode) try {
auto &ctx = obj(d_ctx); auto &ctx = obj(d_ctx);
auto opts = (p_opts ? p_opts : ""); const auto opts = std::string(p_opts ? p_opts : "") + " " +
debug_get_option("CLOVER_EXTRA_LINK_OPTIONS", "");
auto progs = objs(d_progs, num_progs); auto progs = objs(d_progs, num_progs);
auto prog = create<program>(ctx); auto prog = create<program>(ctx);
auto devs = validate_link_devices(progs, auto devs = validate_link_devices(progs,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment