aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon
diff options
context:
space:
mode:
authorChristian König <[email protected]>2013-03-04 15:35:30 +0100
committerChristian König <[email protected]>2013-03-07 10:03:22 +0100
commitb8f4ca3d85b8a192b5c1940f9a4b558f1ce78d8f (patch)
tree019359507cfdd556f67524057d9142a8642f26bc /src/gallium/drivers/radeon
parentde80e560bcdf365845cfdfbfd919e2f91cea2b26 (diff)
radeon/llvm: replace shader type intrinsic with function attribute
Signed-off-by: Christian König <[email protected]> Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.cpp22
-rw-r--r--src/gallium/drivers/radeon/radeon_llvm_emit.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
index 0491e64bb6f..ee82a902872 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
@@ -28,10 +28,12 @@
#if HAVE_LLVM < 0x0303
#include <llvm/LLVMContext.h>
#include <llvm/Module.h>
+#include <llvm/Function.h>
#include <llvm/DataLayout.h>
#else
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/Module.h>
+#include <llvm/IR/Function.h>
#include <llvm/IR/DataLayout.h>
#endif
@@ -69,6 +71,26 @@ static LLVMEnsureMultithreaded lLVMEnsureMultithreaded;
}
/**
+ * Set the shader type we want to compile
+ *
+ * @param type shader type to set
+ */
+extern "C" void
+radeon_llvm_shader_type(LLVMValueRef F, unsigned type)
+{
+ Function *Func = unwrap<Function>(F);
+ int Idx = AttributeSet::FunctionIndex;
+ AttrBuilder B;
+ char Str[2];
+
+ sprintf(Str, "%1d", type);
+ B.addAttribute("ShaderType", Str);
+
+ AttributeSet Set = AttributeSet::get(Func->getContext(), Idx, B);
+ Func->addAttributes(Idx, Set);
+}
+
+/**
* Compile an LLVM module to machine code.
*
* @param bytes This function allocates memory for the byte stream, it is the
diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.h b/src/gallium/drivers/radeon/radeon_llvm_emit.h
index bdb242bfa0e..b68100f372f 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.h
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.h
@@ -33,6 +33,8 @@
extern "C" {
#endif
+void radeon_llvm_shader_type(LLVMValueRef F, unsigned type);
+
unsigned radeon_llvm_bitcode_compile(
unsigned char * bitcode, unsigned bitcode_len,
unsigned char ** bytes, unsigned * byte_count,