[Mesa-dev] [PATCH v2 12/22] clover: Refuse to compile source code to SPIR-V

Francisco Jerez currojerez at riseup.net
Tue Jan 23 22:06:31 UTC 2018


Pierre Moreau <pierre.morrow at free.fr> writes:

> Creating a program using clCreateProgramWithSource to SPIR-V requires a
> non-upstreamed version of LLVM and clang, therefore it is currently not
> supported.
>
> Signed-off-by: Pierre Moreau <pierre.morrow at free.fr>
> ---
>  src/gallium/state_trackers/clover/core/program.cpp | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/program.cpp b/src/gallium/state_trackers/clover/core/program.cpp
> index ae4b50a879..15d559cd93 100644
> --- a/src/gallium/state_trackers/clover/core/program.cpp
> +++ b/src/gallium/state_trackers/clover/core/program.cpp
> @@ -51,6 +51,10 @@ program::compile(const ref_vector<device> &devs, const std::string &opts,
>           std::string log;
>  
>           try {
> +            if (dev.ir_format() == PIPE_SHADER_IR_SPIRV) {
> +               log = "Compiling from source to SPIR-V is not supported yet\n";
> +               throw error(CL_INVALID_DEVICE);
> +            }

Since this is a valid condition according to the API spec I'd prefer to
assert that dev.ir_format() is one of the supported values until
upstream LLVM supports SPIRV as target.

>              const module m = (dev.ir_format() == PIPE_SHADER_IR_TGSI ?
>                                tgsi::compile_program(_source, log) :
>                                llvm::compile_program(_source, headers,
> -- 
> 2.16.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180123/430f1dca/attachment.sig>


More information about the mesa-dev mailing list