From: Tom Stellard Date: Mon, 23 Apr 2012 16:09:08 +0000 (-0400) Subject: clover: Add a function for retrieving a device's preferred ir v3 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=613323b2564babc1ecaac25a6cfd786b8c839315;p=mesa.git clover: Add a function for retrieving a device's preferred ir v3 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() v3: - Remove unnecessary include - Do proper conversion from std::vector to std::string Reviewed-by: Francisco Jerez --- diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 69b1b4a6ac0..2ab735d9a2a 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -160,16 +160,18 @@ _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 target = get_compute_param(pipe, + PIPE_COMPUTE_CAP_IR_TARGET); + return { target.data() }; } 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 d10635275b1..9408083e479 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 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;