diff options
Diffstat (limited to 'src/gallium/state_trackers/clover/core/device.cpp')
-rw-r--r-- | src/gallium/state_trackers/clover/core/device.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index c7aea827938..298cde278b4 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -46,12 +46,17 @@ namespace { device::device(clover::platform &platform, pipe_loader_device *ldev) : platform(platform), ldev(ldev) { pipe = pipe_loader_create_screen(ldev); - if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE) || - !supports_ir(PIPE_SHADER_IR_NATIVE)) { - if (pipe) - pipe->destroy(pipe); - throw error(CL_INVALID_DEVICE); + if (pipe && pipe->get_param(pipe, PIPE_CAP_COMPUTE)) { + if (supports_ir(PIPE_SHADER_IR_NATIVE)) + return; +#ifdef HAVE_CLOVER_SPIRV + if (supports_ir(PIPE_SHADER_IR_NIR_SERIALIZED)) + return; +#endif } + if (pipe) + pipe->destroy(pipe); + throw error(CL_INVALID_DEVICE); } device::~device() { @@ -246,7 +251,11 @@ device::vendor_name() const { enum pipe_shader_ir device::ir_format() const { - return PIPE_SHADER_IR_NATIVE; + if (supports_ir(PIPE_SHADER_IR_NATIVE)) + return PIPE_SHADER_IR_NATIVE; + + assert(supports_ir(PIPE_SHADER_IR_NIR_SERIALIZED)); + return PIPE_SHADER_IR_NIR_SERIALIZED; } std::string @@ -294,3 +303,8 @@ device::supported_extensions() const { + std::string(has_doubles() ? " cl_khr_fp64" : "") + std::string(has_halves() ? " cl_khr_fp16" : ""); } + +const void * +device::get_compiler_options(enum pipe_shader_ir ir) const { + return pipe->get_compiler_options(pipe, ir, PIPE_SHADER_COMPUTE); +} |