diff options
author | Marek Olšák <marek.olsak@amd.com> | 2014-09-23 17:17:01 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2014-10-21 22:39:50 +0200 |
commit | 43b243236824ce80daaa5cb4af5db94aaca0855e (patch) | |
tree | a6ef7901dbcf3fb32778802d5797f329205edee8 | |
parent | c5a44cf3f83a9cb81d4ebe41051ca779a89475f6 (diff) | |
download | external_mesa3d-43b243236824ce80daaa5cb4af5db94aaca0855e.zip external_mesa3d-43b243236824ce80daaa5cb4af5db94aaca0855e.tar.gz external_mesa3d-43b243236824ce80daaa5cb4af5db94aaca0855e.tar.bz2 |
r600g,radeonsi: convert TGSI shader type to LLVM shader type
The values are hardcoded in the LLVM backend, but the TGSI definitions are
going to be changed with tessellation, e.g. TGSI_PROCESSOR_COMPUTE will be
increased by 2.
We'll use VS for LS and HS, because there's nothing special about them
from the LLVM backend point of view, even though the hardware side is
different. We do the same for ES.
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-rw-r--r-- | src/gallium/drivers/radeon/radeon_llvm_emit.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c index 53694b7..dc871d7 100644 --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c @@ -41,6 +41,16 @@ #define TRIPLE_STRING_LEN 7 /** + * Shader types for the LLVM backend. + */ +enum radeon_llvm_shader_type { + RADEON_LLVM_SHADER_PS = 0, + RADEON_LLVM_SHADER_VS = 1, + RADEON_LLVM_SHADER_GS = 2, + RADEON_LLVM_SHADER_CS = 3, +}; + +/** * Set the shader type we want to compile * * @param type shader type to set @@ -48,7 +58,26 @@ void radeon_llvm_shader_type(LLVMValueRef F, unsigned type) { char Str[2]; - sprintf(Str, "%1d", type); + enum radeon_llvm_shader_type llvm_type; + + switch (type) { + case TGSI_PROCESSOR_VERTEX: + llvm_type = RADEON_LLVM_SHADER_VS; + break; + case TGSI_PROCESSOR_GEOMETRY: + llvm_type = RADEON_LLVM_SHADER_GS; + break; + case TGSI_PROCESSOR_FRAGMENT: + llvm_type = RADEON_LLVM_SHADER_PS; + break; + case TGSI_PROCESSOR_COMPUTE: + llvm_type = RADEON_LLVM_SHADER_CS; + break; + default: + assert(0); + } + + sprintf(Str, "%1d", llvm_type); LLVMAddTargetDependentFunctionAttr(F, "ShaderType", Str); |