diff options
author | Timothy Arceri <[email protected]> | 2017-11-10 13:47:50 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-12-04 12:52:18 +1100 |
commit | 6fd6cb6616dfb04cb383cace550c2100e54daaa5 (patch) | |
tree | e9cb6bf2a921faa733ca3c6147f2c1da15d3211c | |
parent | 4184e7c417fef08a1a28295d60dbb2d5fee08633 (diff) |
ac: add basic nir -> llvm type helper
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index b58bae90c5d..8610e367158 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -161,6 +161,28 @@ nir_to_llvm_context_from_abi(struct ac_shader_abi *abi) return container_of(abi, ctx, abi); } +static LLVMTypeRef +nir2llvmtype(struct ac_nir_context *ctx, + const struct glsl_type *type) +{ + switch (glsl_get_base_type(glsl_without_array(type))) { + case GLSL_TYPE_UINT: + case GLSL_TYPE_INT: + return ctx->ac.i32; + case GLSL_TYPE_UINT64: + case GLSL_TYPE_INT64: + return ctx->ac.i64; + case GLSL_TYPE_DOUBLE: + return ctx->ac.f64; + case GLSL_TYPE_FLOAT: + return ctx->ac.f32; + default: + assert(!"Unsupported type in nir2llvmtype()"); + break; + } + return 0; +} + static LLVMValueRef get_sampler_desc(struct ac_nir_context *ctx, const nir_deref_var *deref, enum ac_descriptor_type desc_type, |