diff options
author | Francisco Jerez <[email protected]> | 2014-01-14 21:55:29 +0100 |
---|---|---|
committer | Francisco Jerez <[email protected]> | 2014-01-15 16:48:05 +0100 |
commit | 5662602ba050a43a01c1e06bdfeea83ec792852e (patch) | |
tree | ee17f835ad155e2b6e8b267c58f22d2e97f3952b /src | |
parent | 5195f1d9c666bb6ac5faf39ea0df693ed28adbf0 (diff) |
clover: Don't try to build programs created from a binary again.
According to the spec it's allowed to call clBuildProgram() on a
program created from a user-specified binary. We don't need to do
anything to build the program in that case.
Reported-and-tested-by: "Dorrington, Albert" <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/clover/core/program.cpp | 40 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/core/program.hpp | 1 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp index 6d4a9ba81ff..fb7e8d14a99 100644 --- a/src/gallium/state_trackers/clover/core/program.cpp +++ b/src/gallium/state_trackers/clover/core/program.cpp @@ -26,13 +26,13 @@ using namespace clover; program::program(context &ctx, const std::string &source) : - ctx(ctx), _source(source) { + has_source(true), ctx(ctx), _source(source) { } program::program(context &ctx, const ref_vector<device> &devs, const std::vector<module> &binaries) : - ctx(ctx) { + has_source(false), ctx(ctx) { for_each([&](device &dev, const module &bin) { _binaries.insert({ &dev, bin }); }, @@ -41,23 +41,25 @@ program::program(context &ctx, void program::build(const ref_vector<device> &devs, const char *opts) { - for (auto &dev : devs) { - _binaries.erase(&dev); - _logs.erase(&dev); - _opts.erase(&dev); - - _opts.insert({ &dev, opts }); - - try { - auto module = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? - compile_program_tgsi(_source) : - compile_program_llvm(_source, dev.ir_format(), - dev.ir_target(), build_opts(dev))); - _binaries.insert({ &dev, module }); - - } catch (build_error &e) { - _logs.insert({ &dev, e.what() }); - throw; + if (has_source) { + for (auto &dev : devs) { + _binaries.erase(&dev); + _logs.erase(&dev); + _opts.erase(&dev); + + _opts.insert({ &dev, opts }); + + try { + auto module = (dev.ir_format() == PIPE_SHADER_IR_TGSI ? + compile_program_tgsi(_source) : + compile_program_llvm(_source, dev.ir_format(), + dev.ir_target(), build_opts(dev))); + _binaries.insert({ &dev, module }); + + } catch (build_error &e) { + _logs.insert({ &dev, e.what() }); + throw; + } } } } diff --git a/src/gallium/state_trackers/clover/core/program.hpp b/src/gallium/state_trackers/clover/core/program.hpp index 25ec239507d..d36982cb3ca 100644 --- a/src/gallium/state_trackers/clover/core/program.hpp +++ b/src/gallium/state_trackers/clover/core/program.hpp @@ -49,6 +49,7 @@ namespace clover { void build(const ref_vector<device> &devs, const char *opts); + const bool has_source; const std::string &source() const; device_range devices() const; |