[Mesa-dev] [PATCH 04/11] clover: Add a function for retrieving a device's preferred ir v2
Tom Stellard
tstellar at gmail.com
Thu May 24 12:44:00 PDT 2012
A device now has two function for getting information about the IR
it needs to return.
ir_format() => returns the preferred IR
ir_target() => returns the triple for the target that is understood by
clang/llvm.
v2:
- renamed ir_target() to ir_format()
- renamed llvm_triple() to ir_target()
---
src/gallium/state_trackers/clover/core/device.cpp | 20 ++++++++++++--------
src/gallium/state_trackers/clover/core/device.hpp | 1 +
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 69b1b4a..8873ff7 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -23,6 +23,7 @@
#include "core/device.hpp"
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
+#include "util/u_inlines.h"
using namespace clover;
@@ -160,16 +161,19 @@ _cl_device_id::vendor_name() const {
return pipe->get_vendor(pipe);
}
+enum pipe_shader_ir
+_cl_device_id::ir_format() const {
+ return (enum pipe_shader_ir) pipe->get_shader_param(pipe,
+ PIPE_SHADER_COMPUTE,
+ PIPE_SHADER_CAP_PREFERRED_IR);
+}
+
std::string
_cl_device_id::ir_target() const {
- switch (pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
- PIPE_SHADER_CAP_PREFERRED_IR)) {
- case PIPE_SHADER_IR_TGSI:
- return "tgsi";
- default:
- assert(0);
- return "";
- }
+ std::vector<char> target = get_compute_param<char>(pipe,
+ PIPE_COMPUTE_CAP_IR_TARGET);
+ // - 1 here so we don't add the null byte to the string
+ return { target.begin(), target.end() - 1 };
}
device_registry::device_registry() {
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index d106352..9408083 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -60,6 +60,7 @@ public:
std::vector<size_t> max_block_size() const;
std::string device_name() const;
std::string vendor_name() const;
+ enum pipe_shader_ir ir_format() const;
std::string ir_target() const;
friend struct _cl_command_queue;
--
1.7.7.6
More information about the mesa-dev
mailing list