From cad7bc74d69ee053452aa4bd20740dc79ad6eab6 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 12 Feb 2008 05:35:51 -0500 Subject: [PATCH 01/74] llvm ir code to fetch the elements --- src/mesa/pipe/llvm/storagesoa.cpp | 59 +++++++++++++++++++++++++++++++ src/mesa/pipe/llvm/storagesoa.h | 17 +++++++++ 2 files changed, 76 insertions(+) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index b2aca3557a9..ff94307c85d 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -45,6 +45,11 @@ StorageSoa::StorageSoa(llvm::BasicBlock *block, llvm::Value *input, llvm::Value *output, llvm::Value *consts) + : m_block(block), + m_input(input), + m_output(output), + m_consts(consts), + m_idx(0) { } @@ -62,6 +67,11 @@ std::vector StorageSoa::inputElement(int idx, int swizzle, { std::vector res(4); + res[0] = element(m_input, idx, 0); + res[1] = element(m_input, idx, 0); + res[2] = element(m_input, idx, 0); + res[3] = element(m_input, idx, 0); + return res; } @@ -78,6 +88,11 @@ std::vector StorageSoa::outputElement(int idx, int swizzle, { std::vector res(4); + res[0] = element(m_output, idx, 0); + res[1] = element(m_output, idx, 0); + res[2] = element(m_output, idx, 0); + res[3] = element(m_output, idx, 0); + return res; } @@ -115,3 +130,47 @@ void StorageSoa::storeAddress(int idx, const std::vector &val, int mask) { } + +llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, + int channel) const +{ + std::vector indices; + indices.push_back(constantInt(index)); + indices.push_back(constantInt(0));//first element in the struct + indices.push_back(constantInt(channel)); + indices.push_back(constantInt(0));//f channel + indices.push_back(constantInt(0));//first ptr in the f channel + + GetElementPtrInst *getElem = new GetElementPtrInst(ptr, + indices.begin(), + indices.end(), + name("ptr"), + m_block); + return getElem; +} + +llvm::Value * StorageSoa::element(llvm::Value *ptr, int index, + int channel) const +{ + llvm::Value *res = elementPointer(ptr, index, channel); + LoadInst *load = new LoadInst(res, name("element"), false, m_block); + //load->setAlignment(8); + return load; +} + +const char * StorageSoa::name(const char *prefix) const +{ + ++m_idx; + snprintf(m_name, 32, "%s%d", prefix, m_idx); + return m_name; +} + +llvm::ConstantInt * StorageSoa::constantInt(int idx) const +{ + if (m_constInts.find(idx) != m_constInts.end()) { + return m_constInts[idx]; + } + ConstantInt *constInt = ConstantInt::get(APInt(32, idx)); + m_constInts[idx] = constInt; + return constInt; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 551b0b97342..9d5609f5398 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -29,6 +29,7 @@ #define STORAGESOA_H #include +#include namespace llvm { class BasicBlock; @@ -65,7 +66,23 @@ public: int mask); void storeAddress(int idx, const std::vector &val, int mask); +private: + llvm::Value *elementPointer(llvm::Value *ptr, int index, + int channel) const; + llvm::Value *element(llvm::Value *ptr, int index, + int channel) const; + const char *name(const char *prefix) const; + llvm::ConstantInt *constantInt(int) const; +private: + llvm::BasicBlock *m_block; + llvm::Value *m_input; + llvm::Value *m_output; + llvm::Value *m_consts; + + mutable std::map m_constInts; + mutable char m_name[32]; + mutable int m_idx; }; #endif From 3c3c1ff5cd19af23033e080d8f0b9b5ae8363f2e Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 12 Feb 2008 23:08:42 -0500 Subject: [PATCH 02/74] stop generate llvm entry points entrypoints are useless because we use the same paths as all other code. also simplify llvm swizzling code --- src/mesa/pipe/llvm/gallivm.cpp | 4 +-- src/mesa/pipe/llvm/gallivm_p.h | 54 +++++++++++++++++++++++++++++++ src/mesa/pipe/llvm/storage.cpp | 10 +++--- src/mesa/pipe/llvm/storagesoa.cpp | 14 ++++++++ src/mesa/pipe/llvm/tgsitollvm.cpp | 12 +++---- 5 files changed, 82 insertions(+), 12 deletions(-) diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp index b99dc6db5b8..ab13be09151 100644 --- a/src/mesa/pipe/llvm/gallivm.cpp +++ b/src/mesa/pipe/llvm/gallivm.cpp @@ -289,9 +289,9 @@ void gallivm_ir_fill_from_tgsi(struct gallivm_ir *ir, tgsi_dump(tokens, 0); - llvm::Module *irmod = tgsi_to_llvmir(ir, tokens); + llvm::Module *mod = tgsi_to_llvmir(ir, tokens); - llvm::Module *mod = tgsi_to_llvm(ir, tokens); + //llvm::Module *mod = tgsi_to_llvm(ir, tokens); ir->module = mod; gallivm_ir_dump(ir, 0); } diff --git a/src/mesa/pipe/llvm/gallivm_p.h b/src/mesa/pipe/llvm/gallivm_p.h index 2c6e5e8f5f2..cfe7b1901b3 100644 --- a/src/mesa/pipe/llvm/gallivm_p.h +++ b/src/mesa/pipe/llvm/gallivm_p.h @@ -3,6 +3,10 @@ #ifdef MESA_LLVM +#include "gallivm.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/p_compiler.h" + namespace llvm { class Module; } @@ -47,6 +51,56 @@ struct gallivm_prog { int num_interp; }; +static INLINE void gallivm_swizzle_components(int swizzle, + int *xc, int *yc, + int *zc, int *wc) +{ + int x = swizzle / 1000; swizzle -= x * 1000; + int y = swizzle / 100; swizzle -= y * 100; + int z = swizzle / 10; swizzle -= z * 10; + int w = swizzle; + + if (xc) *xc = x; + if (yc) *yc = y; + if (zc) *zc = z; + if (wc) *wc = w; +} + +static INLINE boolean gallivm_is_swizzle(int swizzle) +{ + const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 + + TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W; + return swizzle != NO_SWIZZLE; +} + +static INLINE int gallivm_x_swizzle(int swizzle) +{ + int x; + gallivm_swizzle_components(swizzle, &x, 0, 0, 0); + return x; +} + +static INLINE int gallivm_y_swizzle(int swizzle) +{ + int y; + gallivm_swizzle_components(swizzle, 0, &y, 0, 0); + return y; +} + +static INLINE int gallivm_z_swizzle(int swizzle) +{ + int z; + gallivm_swizzle_components(swizzle, 0, 0, &z, 0); + return z; +} + +static INLINE int gallivm_w_swizzle(int swizzle) +{ + int w; + gallivm_swizzle_components(swizzle, 0, 0, 0, &w); + return w; +} + #endif /* MESA_LLVM */ #if defined __cplusplus diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index 08b9d29a24a..c4326de8c53 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -33,6 +33,8 @@ #include "storage.h" +#include "gallivm_p.h" + #include "pipe/p_shader_tokens.h" #include #include @@ -82,10 +84,10 @@ llvm::Constant *Storage::shuffleMask(int vec) if (origVec == 0) { const_vec = Constant::getNullValue(m_intVecType); } else { - int x = vec / 1000; vec -= x * 1000; - int y = vec / 100; vec -= y * 100; - int z = vec / 10; vec -= z * 10; - int w = vec; + int x = gallivm_x_swizzle(vec); + int y = gallivm_y_swizzle(vec); + int z = gallivm_z_swizzle(vec); + int w = gallivm_w_swizzle(vec); std::vector elems; elems.push_back(constantInt(x)); elems.push_back(constantInt(y)); diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index ff94307c85d..8f82989cc5d 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -119,6 +119,20 @@ llvm::Value * StorageSoa::extractIndex(llvm::Value *vec) void StorageSoa::storeOutput(int dstIdx, const std::vector &val, int mask) { + if (mask != TGSI_WRITEMASK_XYZW) { + fprintf(stderr, "requires swizzle!!\n"); + assert(0); + } else { + llvm::Value *xChannel = elementPointer(m_output, dstIdx, 0); + llvm::Value *yChannel = elementPointer(m_output, dstIdx, 1); + llvm::Value *zChannel = elementPointer(m_output, dstIdx, 2); + llvm::Value *wChannel = elementPointer(m_output, dstIdx, 3); + + StoreInst *st = new StoreInst(val[0], xChannel, false, m_block); + st = new StoreInst(val[1], yChannel, false, m_block); + st = new StoreInst(val[2], zChannel, false, m_block); + st = new StoreInst(val[3], wChannel, false, m_block); + } } void StorageSoa::storeTemp(int idx, const std::vector &val, diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index bc4df610717..574e340f668 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -178,9 +178,8 @@ swizzleVector(llvm::Value *val, struct tgsi_full_src_register *src, Storage *storage) { int swizzle = swizzleInt(src); - const int NO_SWIZZLE = TGSI_SWIZZLE_X * 1000 + TGSI_SWIZZLE_Y * 100 + - TGSI_SWIZZLE_Z * 10 + TGSI_SWIZZLE_W; - if (swizzle != NO_SWIZZLE) { + + if (gallivm_is_swizzle(swizzle)) { /*fprintf(stderr, "XXXXXXXX swizzle = %d\n", swizzle);*/ val = storage->shuffleVector(val, swizzle); } @@ -1107,12 +1106,11 @@ tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens) llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, const struct tgsi_token *tokens) { - llvm::Module *mod = createBaseShader(); + llvm::Module *mod = new Module("shader"); struct tgsi_parse_context parse; struct tgsi_full_instruction fi; struct tgsi_full_declaration fd; unsigned instno = 0; - Function* shader = mod->getFunction("execute_shader"); std::ostringstream stream; if (ir->type == GALLIVM_VS) { stream << "vs_shader"; @@ -1121,7 +1119,9 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, } stream << ir->id; std::string func_name = stream.str(); - shader->setName(func_name.c_str()); + Function *shader = llvm::cast(mod->getOrInsertFunction( + func_name.c_str(), + (const llvm::FunctionType*)0)); Function::arg_iterator args = shader->arg_begin(); Value *input = args++; From 8b054cd6eb0b64264d9cb8b61ce9df5135664368 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 00:21:03 -0500 Subject: [PATCH 03/74] disable llvm code in fs --- src/mesa/pipe/softpipe/sp_quad_fs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index b5d7dfca1ca..33168584137 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -199,6 +199,7 @@ shade_quad( } } +#if 0 #ifdef MESA_LLVM #define DLLVM 0 static void @@ -297,6 +298,7 @@ shade_quad_llvm(struct quad_stage *qs, } } #endif /*MESA_LLVM*/ +#endif /** * Per-primitive (or per-begin?) setup From 9b6532f01b2e8a3ccc44d67d20a8f94f5de570e3 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 00:21:24 -0500 Subject: [PATCH 04/74] add functiontype for the llvm native vs entry point --- src/mesa/pipe/llvm/tgsitollvm.cpp | 38 ++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 574e340f668..d4e9a21a139 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -46,6 +46,38 @@ using namespace llvm; #include "llvm_base_shader.cpp" +static inline FunctionType *vertexShaderFunctionType() +{ + //Function takes three arguments, + // the calling code has to make sure the types it will + // pass are castable to the following: + // [4 x <4 x float>] inputs, + // [4 x <4 x float>] output, + // [4 x [4 x float]] consts + std::vector funcArgs; + { + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + ArrayType *vectorArray = ArrayType::get(vectorType, 4); + PointerType *vectorArrayPtr = PointerType::get(vectorArray, 0); + + funcArgs.push_back(vectorArrayPtr);//inputs + funcArgs.push_back(vectorArrayPtr);//output + } + { + ArrayType *floatArray = ArrayType::get(Type::FloatTy, 4); + ArrayType *constsArray = ArrayType::get(floatArray, 4); + PointerType *constsArrayPtr = PointerType::get(constsArray, 0); + + funcArgs.push_back(constsArrayPtr);//consts + } + FunctionType *functionType = FunctionType::get( + /*Result=*/Type::VoidTy, + /*Params=*/funcArgs, + /*isVarArg=*/false); + + return functionType; +} + static inline void add_interpolator(struct gallivm_ir *ir, struct gallivm_interpolate *interp) @@ -1121,13 +1153,13 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, std::string func_name = stream.str(); Function *shader = llvm::cast(mod->getOrInsertFunction( func_name.c_str(), - (const llvm::FunctionType*)0)); + vertexShaderFunctionType())); Function::arg_iterator args = shader->arg_begin(); Value *input = args++; - input->setName("input"); + input->setName("inputs"); Value *output = args++; - output->setName("output"); + output->setName("outputs"); Value *consts = args++; consts->setName("consts"); From 53c2963b84f7a8538d2a2c67e3fbb8a22f644c57 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 00:36:31 -0500 Subject: [PATCH 05/74] fix fetching input elements and generate a ret on end --- src/mesa/pipe/llvm/instructionssoa.cpp | 2 ++ src/mesa/pipe/llvm/instructionssoa.h | 4 ++++ src/mesa/pipe/llvm/storagesoa.cpp | 3 --- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 9ac4d8fbc73..0e501ab08d0 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -2,6 +2,7 @@ InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func, llvm::BasicBlock *block, StorageSoa *storage) + : m_builder(block) { } @@ -23,4 +24,5 @@ std::vector InstructionsSoa::mul(const std::vector i void InstructionsSoa::end() { + m_builder.CreateRetVoid(); } diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/mesa/pipe/llvm/instructionssoa.h index 0b6b41cf056..233d363b906 100644 --- a/src/mesa/pipe/llvm/instructionssoa.h +++ b/src/mesa/pipe/llvm/instructionssoa.h @@ -28,6 +28,8 @@ #ifndef INSTRUCTIONSSOA_H #define INSTRUCTIONSSOA_H +#include + #include namespace llvm { @@ -49,6 +51,8 @@ public: std::vector mul(const std::vector in1, const std::vector in2); void end(); +private: + llvm::LLVMFoldingBuilder m_builder; }; diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 8f82989cc5d..786511204a3 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -150,10 +150,7 @@ llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, { std::vector indices; indices.push_back(constantInt(index)); - indices.push_back(constantInt(0));//first element in the struct indices.push_back(constantInt(channel)); - indices.push_back(constantInt(0));//f channel - indices.push_back(constantInt(0));//first ptr in the f channel GetElementPtrInst *getElem = new GetElementPtrInst(ptr, indices.begin(), From 4c8456264ca9c826165c41810b20dfbfbfb322e3 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 00:48:08 -0500 Subject: [PATCH 06/74] get mov working --- src/mesa/pipe/llvm/gallivm.cpp | 3 +++ src/mesa/pipe/llvm/gallivm_cpu.cpp | 4 ++-- src/mesa/pipe/llvm/storagesoa.cpp | 12 ++++++------ src/mesa/pipe/llvm/tgsitollvm.cpp | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp index ab13be09151..da0105c2c98 100644 --- a/src/mesa/pipe/llvm/gallivm.cpp +++ b/src/mesa/pipe/llvm/gallivm.cpp @@ -318,6 +318,9 @@ struct gallivm_prog * gallivm_ir_compile(struct gallivm_ir *ir) passes.run(*mod); prog->module = mod; + std::cout << "After optimizations:"<dump(); + return prog; } diff --git a/src/mesa/pipe/llvm/gallivm_cpu.cpp b/src/mesa/pipe/llvm/gallivm_cpu.cpp index 5f1268bf4f8..011cba55c23 100644 --- a/src/mesa/pipe/llvm/gallivm_cpu.cpp +++ b/src/mesa/pipe/llvm/gallivm_cpu.cpp @@ -105,10 +105,10 @@ static inline llvm::Function *func_for_shader(struct gallivm_prog *prog) switch (prog->type) { case GALLIVM_VS: - func = mod->getFunction("run_vertex_shader"); + func = mod->getFunction("vs_shader"); break; case GALLIVM_FS: - func = mod->getFunction("run_fragment_shader"); + func = mod->getFunction("fs_shader"); break; default: assert(!"Unknown shader type!"); diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 786511204a3..ef14e29bfed 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -68,9 +68,9 @@ std::vector StorageSoa::inputElement(int idx, int swizzle, std::vector res(4); res[0] = element(m_input, idx, 0); - res[1] = element(m_input, idx, 0); - res[2] = element(m_input, idx, 0); - res[3] = element(m_input, idx, 0); + res[1] = element(m_input, idx, 1); + res[2] = element(m_input, idx, 2); + res[3] = element(m_input, idx, 3); return res; } @@ -89,9 +89,9 @@ std::vector StorageSoa::outputElement(int idx, int swizzle, std::vector res(4); res[0] = element(m_output, idx, 0); - res[1] = element(m_output, idx, 0); - res[2] = element(m_output, idx, 0); - res[3] = element(m_output, idx, 0); + res[1] = element(m_output, idx, 1); + res[2] = element(m_output, idx, 2); + res[3] = element(m_output, idx, 3); return res; } diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index d4e9a21a139..070c9a67f3c 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -1149,7 +1149,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, } else { stream << "fs_shader"; } - stream << ir->id; + //stream << ir->id; std::string func_name = stream.str(); Function *shader = llvm::cast(mod->getOrInsertFunction( func_name.c_str(), From 135d2329de7721b2083aa5f38f8d66beb20c1181 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 03:18:37 -0500 Subject: [PATCH 07/74] implement mul --- src/mesa/pipe/llvm/instructionssoa.cpp | 15 ++++++++++++++- src/mesa/pipe/llvm/instructionssoa.h | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 0e501ab08d0..f1c174a26e5 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -2,7 +2,8 @@ InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func, llvm::BasicBlock *block, StorageSoa *storage) - : m_builder(block) + : m_builder(block), + m_idx(0) { } @@ -19,6 +20,11 @@ std::vector InstructionsSoa::mul(const std::vector i { std::vector res(4); + res[0] = m_builder.CreateMul(in1[0], in2[0], name("mul")); + res[1] = m_builder.CreateMul(in1[1], in2[1], name("mul")); + res[2] = m_builder.CreateMul(in1[2], in2[2], name("mul")); + res[3] = m_builder.CreateMul(in1[3], in2[3], name("mul")); + return res; } @@ -26,3 +32,10 @@ void InstructionsSoa::end() { m_builder.CreateRetVoid(); } + +const char * InstructionsSoa::name(const char *prefix) const +{ + ++m_idx; + snprintf(m_name, 32, "%s%d", prefix, m_idx); + return m_name; +} diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/mesa/pipe/llvm/instructionssoa.h index 233d363b906..01955015844 100644 --- a/src/mesa/pipe/llvm/instructionssoa.h +++ b/src/mesa/pipe/llvm/instructionssoa.h @@ -51,8 +51,15 @@ public: std::vector mul(const std::vector in1, const std::vector in2); void end(); + +private: + const char * name(const char *prefix) const; private: llvm::LLVMFoldingBuilder m_builder; + +private: + mutable int m_idx; + mutable char m_name[32]; }; From e179d5bdd199e3747773f5b07efcf9a635c41089 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 04:37:40 -0500 Subject: [PATCH 08/74] implement add --- src/mesa/pipe/llvm/instructionssoa.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index f1c174a26e5..0c2032e56ff 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -12,6 +12,11 @@ std::vector InstructionsSoa::add(const std::vector i { std::vector res(4); + res[0] = m_builder.CreateAdd(in1[0], in2[0], name("addx")); + res[1] = m_builder.CreateAdd(in1[1], in2[1], name("addy")); + res[2] = m_builder.CreateAdd(in1[2], in2[2], name("addz")); + res[3] = m_builder.CreateAdd(in1[3], in2[3], name("addw")); + return res; } @@ -20,10 +25,10 @@ std::vector InstructionsSoa::mul(const std::vector i { std::vector res(4); - res[0] = m_builder.CreateMul(in1[0], in2[0], name("mul")); - res[1] = m_builder.CreateMul(in1[1], in2[1], name("mul")); - res[2] = m_builder.CreateMul(in1[2], in2[2], name("mul")); - res[3] = m_builder.CreateMul(in1[3], in2[3], name("mul")); + res[0] = m_builder.CreateMul(in1[0], in2[0], name("mulx")); + res[1] = m_builder.CreateMul(in1[1], in2[1], name("muly")); + res[2] = m_builder.CreateMul(in1[2], in2[2], name("mulz")); + res[3] = m_builder.CreateMul(in1[3], in2[3], name("mulw")); return res; } From 4bb1a14d901fcddb25efeeff49c4dea8ca872f73 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 04:38:10 -0500 Subject: [PATCH 09/74] handle temporaries in llvm code generated paths --- src/mesa/pipe/draw/draw_vertex_shader.c | 3 ++- src/mesa/pipe/llvm/gallivm.h | 3 ++- src/mesa/pipe/llvm/gallivm_cpu.cpp | 10 ++++---- src/mesa/pipe/llvm/storagesoa.cpp | 23 +++++++++++++++++- src/mesa/pipe/llvm/storagesoa.h | 4 +++- src/mesa/pipe/llvm/tgsitollvm.cpp | 32 +++++++++++++------------ 6 files changed, 50 insertions(+), 25 deletions(-) diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index 9c31df1e3e1..c824c1407e9 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -119,7 +119,8 @@ run_vertex_program(struct draw_context *draw, gallivm_cpu_vs_exec(prog, machine->Inputs, machine->Outputs, - machine->Consts); + machine->Consts, + machine->Temps); } else #elif defined(__i386__) || defined(__386__) if (draw->use_sse) { diff --git a/src/mesa/pipe/llvm/gallivm.h b/src/mesa/pipe/llvm/gallivm.h index b104520cb7f..92da4bca7f4 100644 --- a/src/mesa/pipe/llvm/gallivm.h +++ b/src/mesa/pipe/llvm/gallivm.h @@ -82,7 +82,8 @@ struct gallivm_cpu_engine *gallivm_global_cpu_engine(); int gallivm_cpu_vs_exec(struct gallivm_prog *prog, struct tgsi_exec_vector *inputs, struct tgsi_exec_vector *dests, - float (*consts)[4]); + float (*consts)[4], + struct tgsi_exec_vector *temps); int gallivm_cpu_fs_exec(struct gallivm_prog *prog, float x, float y, float (*dests)[PIPE_MAX_SHADER_INPUTS][4], diff --git a/src/mesa/pipe/llvm/gallivm_cpu.cpp b/src/mesa/pipe/llvm/gallivm_cpu.cpp index 011cba55c23..dc4d92a72a6 100644 --- a/src/mesa/pipe/llvm/gallivm_cpu.cpp +++ b/src/mesa/pipe/llvm/gallivm_cpu.cpp @@ -177,10 +177,7 @@ struct gallivm_cpu_engine * gallivm_global_cpu_engine() typedef void (*vertex_shader_runner)(void *ainputs, void *dests, float (*aconsts)[4], - int num_vertices, - int num_inputs, - int num_attribs, - int num_consts); + void *temps); /*! @@ -191,12 +188,13 @@ typedef void (*vertex_shader_runner)(void *ainputs, int gallivm_cpu_vs_exec(struct gallivm_prog *prog, struct tgsi_exec_vector *inputs, struct tgsi_exec_vector *dests, - float (*consts)[4]) + float (*consts)[4], + struct tgsi_exec_vector *temps) { vertex_shader_runner runner = reinterpret_cast(prog->function); assert(runner); /*FIXME*/ - runner(inputs, dests, consts, 4, 4, 4, prog->num_consts); + runner(inputs, dests, consts, temps); return 0; } diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index ef14e29bfed..e09e9e8fe7d 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -44,11 +44,13 @@ using namespace llvm; StorageSoa::StorageSoa(llvm::BasicBlock *block, llvm::Value *input, llvm::Value *output, - llvm::Value *consts) + llvm::Value *consts, + llvm::Value *temps) : m_block(block), m_input(input), m_output(output), m_consts(consts), + m_temps(temps), m_idx(0) { } @@ -101,6 +103,11 @@ std::vector StorageSoa::tempElement(int idx, int swizzle, { std::vector res(4); + res[0] = element(m_temps, idx, 0); + res[1] = element(m_temps, idx, 1); + res[2] = element(m_temps, idx, 2); + res[3] = element(m_temps, idx, 3); + return res; } @@ -138,6 +145,20 @@ void StorageSoa::storeOutput(int dstIdx, const std::vector &val, void StorageSoa::storeTemp(int idx, const std::vector &val, int mask) { + if (mask != TGSI_WRITEMASK_XYZW) { + fprintf(stderr, "requires swizzle!!\n"); + assert(0); + } else { + llvm::Value *xChannel = elementPointer(m_temps, idx, 0); + llvm::Value *yChannel = elementPointer(m_temps, idx, 1); + llvm::Value *zChannel = elementPointer(m_temps, idx, 2); + llvm::Value *wChannel = elementPointer(m_temps, idx, 3); + + StoreInst *st = new StoreInst(val[0], xChannel, false, m_block); + st = new StoreInst(val[1], yChannel, false, m_block); + st = new StoreInst(val[2], zChannel, false, m_block); + st = new StoreInst(val[3], wChannel, false, m_block); + } } void StorageSoa::storeAddress(int idx, const std::vector &val, diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 9d5609f5398..84db7726a7c 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -46,7 +46,8 @@ public: StorageSoa(llvm::BasicBlock *block, llvm::Value *input, llvm::Value *output, - llvm::Value *consts); + llvm::Value *consts, + llvm::Value *temps); void addImmediate(float *vec); @@ -79,6 +80,7 @@ private: llvm::Value *m_input; llvm::Value *m_output; llvm::Value *m_consts; + llvm::Value *m_temps; mutable std::map m_constInts; mutable char m_name[32]; diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 070c9a67f3c..3497eebcd97 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -53,23 +53,23 @@ static inline FunctionType *vertexShaderFunctionType() // pass are castable to the following: // [4 x <4 x float>] inputs, // [4 x <4 x float>] output, - // [4 x [4 x float]] consts + // [4 x [4 x float]] consts, + // [4 x <4 x float>] temps + std::vector funcArgs; - { - VectorType *vectorType = VectorType::get(Type::FloatTy, 4); - ArrayType *vectorArray = ArrayType::get(vectorType, 4); - PointerType *vectorArrayPtr = PointerType::get(vectorArray, 0); + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + ArrayType *vectorArray = ArrayType::get(vectorType, 4); + PointerType *vectorArrayPtr = PointerType::get(vectorArray, 0); - funcArgs.push_back(vectorArrayPtr);//inputs - funcArgs.push_back(vectorArrayPtr);//output - } - { - ArrayType *floatArray = ArrayType::get(Type::FloatTy, 4); - ArrayType *constsArray = ArrayType::get(floatArray, 4); - PointerType *constsArrayPtr = PointerType::get(constsArray, 0); + ArrayType *floatArray = ArrayType::get(Type::FloatTy, 4); + ArrayType *constsArray = ArrayType::get(floatArray, 4); + PointerType *constsArrayPtr = PointerType::get(constsArray, 0); + + funcArgs.push_back(vectorArrayPtr);//inputs + funcArgs.push_back(vectorArrayPtr);//output + funcArgs.push_back(constsArrayPtr);//consts + funcArgs.push_back(vectorArrayPtr);//temps - funcArgs.push_back(constsArrayPtr);//consts - } FunctionType *functionType = FunctionType::get( /*Result=*/Type::VoidTy, /*Params=*/funcArgs, @@ -1162,6 +1162,8 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, output->setName("outputs"); Value *consts = args++; consts->setName("consts"); + Value *temps = args++; + temps->setName("temps"); BasicBlock *label_entry = new BasicBlock("entry", shader, 0); @@ -1170,7 +1172,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, fi = tgsi_default_full_instruction(); fd = tgsi_default_full_declaration(); - StorageSoa storage(label_entry, input, output, consts); + StorageSoa storage(label_entry, input, output, consts, temps); InstructionsSoa instr(mod, shader, label_entry, &storage); while(!tgsi_parse_end_of_tokens(&parse)) { From e922adbe1d6c1764968377658ea92ae6de0585db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 13 Feb 2008 11:39:58 +0000 Subject: [PATCH 10/74] gallium: pipe->surface_copy can flip the contents vertically when necessary. Fixes gears being upside down on the box in demos/gearbox. --- src/mesa/pipe/cell/ppu/cell_surface.c | 5 +++-- src/mesa/pipe/i915simple/i915_blit.c | 1 + src/mesa/pipe/i915simple/i915_blit.h | 1 + src/mesa/pipe/i915simple/i915_surface.c | 6 ++++-- src/mesa/pipe/i965simple/brw_blit.c | 1 + src/mesa/pipe/i965simple/brw_blit.h | 1 + src/mesa/pipe/i965simple/brw_surface.c | 6 ++++-- src/mesa/pipe/p_context.h | 1 + src/mesa/pipe/p_util.h | 2 +- src/mesa/pipe/softpipe/sp_surface.c | 5 +++-- src/mesa/pipe/util/p_util.c | 4 ++-- src/mesa/pipe/xlib/xm_api.c | 1 + src/mesa/state_tracker/st_cb_drawpixels.c | 1 + src/mesa/state_tracker/st_cb_texture.c | 3 +++ src/mesa/state_tracker/st_texture.c | 1 + 15 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/mesa/pipe/cell/ppu/cell_surface.c b/src/mesa/pipe/cell/ppu/cell_surface.c index 6b7b9181282..fca93e47424 100644 --- a/src/mesa/pipe/cell/ppu/cell_surface.c +++ b/src/mesa/pipe/cell/ppu/cell_surface.c @@ -60,6 +60,7 @@ cell_surface_data(struct pipe_context *pipe, static void cell_surface_copy(struct pipe_context *pipe, + unsigned do_flip, struct pipe_surface *dst, unsigned dstx, unsigned dsty, struct pipe_surface *src, @@ -74,8 +75,8 @@ cell_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src), - src->pitch, - srcx, srcy); + do_flip ? -src->pitch : src->pitch, + srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); pipe_surface_unmap(dst); diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/mesa/pipe/i915simple/i915_blit.c index d49876f9708..db4671ff553 100644 --- a/src/mesa/pipe/i915simple/i915_blit.c +++ b/src/mesa/pipe/i915simple/i915_blit.c @@ -85,6 +85,7 @@ i915_fill_blit(struct i915_context *i915, void i915_copy_blit( struct i915_context *i915, + unsigned do_flip, unsigned cpp, short src_pitch, struct pipe_buffer *src_buffer, diff --git a/src/mesa/pipe/i915simple/i915_blit.h b/src/mesa/pipe/i915simple/i915_blit.h index d7a66be10ae..6e5b44e1247 100644 --- a/src/mesa/pipe/i915simple/i915_blit.h +++ b/src/mesa/pipe/i915simple/i915_blit.h @@ -31,6 +31,7 @@ #include "i915_context.h" extern void i915_copy_blit(struct i915_context *i915, + unsigned do_flip, unsigned cpp, short src_pitch, struct pipe_buffer *src_buffer, diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c index 1bdaba773f1..6d4b8a0aa9f 100644 --- a/src/mesa/pipe/i915simple/i915_surface.c +++ b/src/mesa/pipe/i915simple/i915_surface.c @@ -83,6 +83,7 @@ i915_get_tex_surface(struct pipe_context *pipe, */ static void i915_surface_copy(struct pipe_context *pipe, + unsigned do_flip, struct pipe_surface *dst, unsigned dstx, unsigned dsty, struct pipe_surface *src, @@ -98,14 +99,15 @@ i915_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src), - src->pitch, - srcx, srcy); + do_flip ? -src->pitch : src->pitch, + srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); pipe_surface_unmap(dst); } else { i915_copy_blit( i915_context(pipe), + do_flip, dst->cpp, (short) src->pitch, src->buffer, src->offset, (short) dst->pitch, dst->buffer, dst->offset, diff --git a/src/mesa/pipe/i965simple/brw_blit.c b/src/mesa/pipe/i965simple/brw_blit.c index bbd366294f5..8494f70493c 100644 --- a/src/mesa/pipe/i965simple/brw_blit.c +++ b/src/mesa/pipe/i965simple/brw_blit.c @@ -111,6 +111,7 @@ static unsigned translate_raster_op(unsigned logicop) /* Copy BitBlt */ void brw_copy_blit(struct brw_context *brw, + unsigned do_flip, unsigned cpp, short src_pitch, struct pipe_buffer *src_buffer, diff --git a/src/mesa/pipe/i965simple/brw_blit.h b/src/mesa/pipe/i965simple/brw_blit.h index 7f17a701732..111c5d91d39 100644 --- a/src/mesa/pipe/i965simple/brw_blit.h +++ b/src/mesa/pipe/i965simple/brw_blit.h @@ -16,6 +16,7 @@ void brw_fill_blit(struct brw_context *intel, short w, short h, unsigned color); void brw_copy_blit(struct brw_context *intel, + unsigned do_flip, unsigned cpp, short src_pitch, struct pipe_buffer *src_buffer, diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c index eb7835836ee..518845e4b2e 100644 --- a/src/mesa/pipe/i965simple/brw_surface.c +++ b/src/mesa/pipe/i965simple/brw_surface.c @@ -103,6 +103,7 @@ brw_surface_data(struct pipe_context *pipe, */ static void brw_surface_copy(struct pipe_context *pipe, + unsigned do_flip, struct pipe_surface *dst, unsigned dstx, unsigned dsty, struct pipe_surface *src, @@ -118,14 +119,15 @@ brw_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src) + src->offset, - src->pitch, - srcx, srcy); + do_flip ? -src->pitch : src->pitch, + srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); pipe_surface_unmap(dst); } else { brw_copy_blit(brw_context(pipe), + do_flip, dst->cpp, (short) src->pitch, src->buffer, src->offset, FALSE, (short) dst->pitch, dst->buffer, dst->offset, FALSE, diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h index 92a1cd70c42..39f95695fb6 100644 --- a/src/mesa/pipe/p_context.h +++ b/src/mesa/pipe/p_context.h @@ -178,6 +178,7 @@ struct pipe_context { */ void (*surface_copy)(struct pipe_context *pipe, + unsigned do_flip, /*<< flip surface contents vertically */ struct pipe_surface *dest, unsigned destx, unsigned desty, struct pipe_surface *src, /* don't make this const - diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h index 469920efee3..a8938a7e43b 100644 --- a/src/mesa/pipe/p_util.h +++ b/src/mesa/pipe/p_util.h @@ -402,7 +402,7 @@ static INLINE int align(int value, int alignment) extern void pipe_copy_rect(ubyte * dst, unsigned cpp, unsigned dst_pitch, unsigned dst_x, unsigned dst_y, unsigned width, unsigned height, const ubyte * src, - unsigned src_pitch, unsigned src_x, unsigned src_y); + int src_pitch, unsigned src_x, int src_y); #endif diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 5978ee48bd4..5c6ed3b8d94 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -40,6 +40,7 @@ */ static void sp_surface_copy(struct pipe_context *pipe, + unsigned do_flip, struct pipe_surface *dst, unsigned dstx, unsigned dsty, struct pipe_surface *src, @@ -53,8 +54,8 @@ sp_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src), - src->pitch, - srcx, srcy); + do_flip ? -src->pitch : src->pitch, + srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); pipe_surface_unmap(dst); diff --git a/src/mesa/pipe/util/p_util.c b/src/mesa/pipe/util/p_util.c index c4882b77d2d..2a92f8e408b 100644 --- a/src/mesa/pipe/util/p_util.c +++ b/src/mesa/pipe/util/p_util.c @@ -47,9 +47,9 @@ pipe_copy_rect(ubyte * dst, unsigned width, unsigned height, const ubyte * src, - unsigned src_pitch, + int src_pitch, unsigned src_x, - unsigned src_y) + int src_y) { unsigned i; diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/mesa/pipe/xlib/xm_api.c index 03985eab5a6..e5fef1d7a81 100644 --- a/src/mesa/pipe/xlib/xm_api.c +++ b/src/mesa/pipe/xlib/xm_api.c @@ -1229,6 +1229,7 @@ void XMesaCopySubBuffer( XMesaBuffer b, int x, int y, int width, int height ) return; pipe->surface_copy(pipe, + FALSE, surf_front, x, y, /* dest */ surf_back, x, y, /* src */ width, height); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 3245a7488bc..f13199a3c0f 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1259,6 +1259,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, if (st->haveFramebufferSurfaces) { /* copy source framebuffer surface into mipmap/texture */ pipe->surface_copy(pipe, + FALSE, psTex, /* dest */ 0, 0, /* destx/y */ psRead, diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 0ea367549b8..91a40288cc7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1132,6 +1132,7 @@ do_copy_texsubimage(GLcontext *ctx, struct pipe_context *pipe = ctx->st->pipe; struct pipe_surface *dest_surface; uint dest_format, src_format; + uint do_flip = FALSE; (void) texImage; @@ -1153,6 +1154,7 @@ do_copy_texsubimage(GLcontext *ctx, if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { srcY = strb->Base.Height - srcY - height; + do_flip = TRUE; } src_format = strb->surface->format; @@ -1190,6 +1192,7 @@ do_copy_texsubimage(GLcontext *ctx, #else pipe->surface_copy(pipe, + do_flip, /* dest */ dest_surface, destX, destY, diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 2622d009530..b86f416c9b4 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -300,6 +300,7 @@ st_texture_image_copy(struct pipe_context *pipe, src_surface = pipe->get_tex_surface(pipe, src, face, srcLevel, i); pipe->surface_copy(pipe, + FALSE, dst_surface, 0, 0, /* destX, Y */ src_surface, From 7f342a20d2c7f59b8dd8daed21f3b44f5215a05a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 10:02:59 +0000 Subject: [PATCH 11/74] tgsi: include more of the register info in debug dumps --- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 40bacf85526..7d82a4b19b3 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -44,6 +44,9 @@ static void _print_reg( struct x86_reg reg ) { + if (reg.mod != mod_REG) + debug_printf( "[" ); + switch( reg.file ) { case file_REG32: switch( reg.idx ) { @@ -83,6 +86,13 @@ _print_reg( assert( 0 ); break; } + + if (reg.mod == mod_DISP8 || + reg.mod == mod_DISP32) + debug_printf("+%d", reg.disp); + + if (reg.mod != mod_REG) + debug_printf( "]" ); } static void From 6046c54cc40d32d4c1a47c061494a37fadefd947 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 11:35:54 +0000 Subject: [PATCH 12/74] x86: reallocate exec mem when we run out --- src/mesa/x86/rtasm/x86sse.c | 97 +++++++++++++++++++++++-------------- src/mesa/x86/rtasm/x86sse.h | 1 + 2 files changed, 62 insertions(+), 36 deletions(-) diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index f8da6e405f4..385fb84c01f 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -12,55 +12,75 @@ static unsigned char *cptr( void (*label)() ) } +static void do_realloc( struct x86_function *p ) +{ + _mesa_printf("do_realloc %d %p\n", p->size, p->store); + + if (p->size == 0) { + p->size = 1024; + p->store = _mesa_exec_malloc(p->size); + p->csr = p->store; + } + else { + unsigned used = p->csr - p->store; + unsigned char *tmp = p->store; + p->size *= 2; + p->store = _mesa_exec_malloc(p->size); + memcpy(p->store, tmp, used); + p->csr = p->store + used; + _mesa_exec_free(tmp); + } +} + /* Emit bytes to the instruction stream: */ +static unsigned char *reserve( struct x86_function *p, int bytes ) +{ + if (p->csr + bytes - p->store > p->size) + do_realloc(p); + + { + unsigned char *csr = p->csr; + p->csr += bytes; + return csr; + } +} + + + static void emit_1b( struct x86_function *p, char b0 ) { - *(char *)(p->csr++) = b0; + char *csr = (char *)reserve(p, 1); + *csr = b0; } static void emit_1i( struct x86_function *p, int i0 ) { - *(int *)(p->csr) = i0; - p->csr += 4; + int *icsr = (int *)reserve(p, sizeof(i0)); + *icsr = i0; } -static void disassem( struct x86_function *p, const char *fn ) +static void emit_1ub( struct x86_function *p, unsigned char b0 ) { -#if DISASSEM && 0 - if (fn && fn != p->fn) { - _mesa_printf("0x%x: %s\n", p->csr, fn); - p->fn = fn; - } -#endif + unsigned char *csr = reserve(p, 1); + *csr++ = b0; } -static void emit_1ub_fn( struct x86_function *p, unsigned char b0, const char *fn ) +static void emit_2ub( struct x86_function *p, unsigned char b0, unsigned char b1 ) { - disassem(p, fn); - *(p->csr++) = b0; + unsigned char *csr = reserve(p, 2); + *csr++ = b0; + *csr++ = b1; } -static void emit_2ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, const char *fn ) +static void emit_3ub( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2 ) { - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; + unsigned char *csr = reserve(p, 3); + *csr++ = b0; + *csr++ = b1; + *csr++ = b2; } -static void emit_3ub_fn( struct x86_function *p, unsigned char b0, unsigned char b1, unsigned char b2, const char *fn ) -{ - disassem(p, fn); - *(p->csr++) = b0; - *(p->csr++) = b1; - *(p->csr++) = b2; -} - -#define emit_1ub(p, b0) emit_1ub_fn(p, b0, __FUNCTION__) -#define emit_2ub(p, b0, b1) emit_2ub_fn(p, b0, b1, __FUNCTION__) -#define emit_3ub(p, b0, b1, b2) emit_3ub_fn(p, b0, b1, b2, __FUNCTION__) - - /* Build a modRM byte + possible displacement. No treatment of SIB * indexing. BZZT - no way to encode an absolute address. @@ -77,13 +97,13 @@ static void emit_modrm( struct x86_function *p, val |= reg.idx << 3; /* reg field */ val |= regmem.idx; /* r/m field */ - emit_1ub_fn(p, val, 0); + emit_1ub(p, val); /* Oh-oh we've stumbled into the SIB thing. */ if (regmem.file == file_REG32 && regmem.idx == reg_SP) { - emit_1ub_fn(p, 0x24, 0); /* simplistic! */ + emit_1ub(p, 0x24); /* simplistic! */ } switch (regmem.mod) { @@ -124,14 +144,14 @@ static void emit_op_modrm( struct x86_function *p, { switch (dst.mod) { case mod_REG: - emit_1ub_fn(p, op_dst_is_reg, 0); + emit_1ub(p, op_dst_is_reg); emit_modrm(p, dst, src); break; case mod_INDIRECT: case mod_DISP32: case mod_DISP8: assert(src.mod == mod_REG); - emit_1ub_fn(p, op_dst_is_mem, 0); + emit_1ub(p, op_dst_is_mem); emit_modrm(p, src, dst); break; default: @@ -1125,11 +1145,14 @@ struct x86_reg x86_fn_arg( struct x86_function *p, void x86_init_func( struct x86_function *p ) { - x86_init_func_size(p, 2048); + p->size = 0; + p->store = NULL; + p->csr = p->store; } void x86_init_func_size( struct x86_function *p, unsigned code_size ) { + p->size = code_size; p->store = _mesa_exec_malloc(code_size); p->csr = p->store; } @@ -1138,12 +1161,14 @@ void x86_release_func( struct x86_function *p ) { _mesa_exec_free(p->store); p->store = NULL; + p->csr = NULL; + p->size = 0; } void (*x86_get_func( struct x86_function *p ))(void) { - if (DISASSEM) + if (DISASSEM && p->store) _mesa_printf("disassemble %p %p\n", p->store, p->csr); return (void (*)(void)) (unsigned long) p->store; } diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h index 63b9a36392a..d53b6d71a6b 100644 --- a/src/mesa/x86/rtasm/x86sse.h +++ b/src/mesa/x86/rtasm/x86sse.h @@ -16,6 +16,7 @@ struct x86_reg { }; struct x86_function { + unsigned size; unsigned char *store; unsigned char *csr; unsigned stack_offset; From a3534a27bfc9827a12d83f7b6464af98424cf8d4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 11:39:34 +0000 Subject: [PATCH 13/74] tgsi: fail gracefully when sse code can't emit shader --- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 161 +++++++++++++++------------- 1 file changed, 87 insertions(+), 74 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 7d82a4b19b3..ecf4ca8d21e 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -1436,7 +1436,7 @@ emit_cmp( } } -static void +static int emit_instruction( struct x86_function *func, struct tgsi_full_instruction *inst ) @@ -1547,11 +1547,11 @@ emit_instruction( break; case TGSI_OPCODE_EXP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_LOG: - assert( 0 ); + return 0; break; case TGSI_OPCODE_MUL: @@ -1706,24 +1706,24 @@ emit_instruction( break; case TGSI_OPCODE_CND: - assert( 0 ); + return 0; break; case TGSI_OPCODE_CND0: - assert( 0 ); + return 0; break; case TGSI_OPCODE_DOT2ADD: /* TGSI_OPCODE_DP2A */ - assert( 0 ); + return 0; break; case TGSI_OPCODE_INDEX: - assert( 0 ); + return 0; break; case TGSI_OPCODE_NEGATE: - assert( 0 ); + return 0; break; case TGSI_OPCODE_FRAC: @@ -1736,7 +1736,7 @@ emit_instruction( break; case TGSI_OPCODE_CLAMP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_FLOOR: @@ -1749,7 +1749,7 @@ emit_instruction( break; case TGSI_OPCODE_ROUND: - assert( 0 ); + return 0; break; case TGSI_OPCODE_EXPBASE2: @@ -1824,7 +1824,7 @@ emit_instruction( break; case TGSI_OPCODE_MULTIPLYMATRIX: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ABS: @@ -1837,7 +1837,7 @@ emit_instruction( break; case TGSI_OPCODE_RCC: - assert( 0 ); + return 0; break; case TGSI_OPCODE_DPH: @@ -1868,11 +1868,11 @@ emit_instruction( break; case TGSI_OPCODE_DDX: - assert( 0 ); + return 0; break; case TGSI_OPCODE_DDY: - assert( 0 ); + return 0; break; case TGSI_OPCODE_KIL: @@ -1880,35 +1880,35 @@ emit_instruction( break; case TGSI_OPCODE_PK2H: - assert( 0 ); + return 0; break; case TGSI_OPCODE_PK2US: - assert( 0 ); + return 0; break; case TGSI_OPCODE_PK4B: - assert( 0 ); + return 0; break; case TGSI_OPCODE_PK4UB: - assert( 0 ); + return 0; break; case TGSI_OPCODE_RFL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SEQ: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SFL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SGT: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SIN: @@ -1920,15 +1920,15 @@ emit_instruction( break; case TGSI_OPCODE_SLE: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SNE: - assert( 0 ); + return 0; break; case TGSI_OPCODE_STR: - assert( 0 ); + return 0; break; case TGSI_OPCODE_TEX: @@ -1943,43 +1943,43 @@ emit_instruction( break; case TGSI_OPCODE_TXD: - assert( 0 ); + return 0; break; case TGSI_OPCODE_UP2H: - assert( 0 ); + return 0; break; case TGSI_OPCODE_UP2US: - assert( 0 ); + return 0; break; case TGSI_OPCODE_UP4B: - assert( 0 ); + return 0; break; case TGSI_OPCODE_UP4UB: - assert( 0 ); + return 0; break; case TGSI_OPCODE_X2D: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ARA: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ARR: - assert( 0 ); + return 0; break; case TGSI_OPCODE_BRA: - assert( 0 ); + return 0; break; case TGSI_OPCODE_CAL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_RET: @@ -1992,7 +1992,7 @@ emit_instruction( break; case TGSI_OPCODE_SSG: - assert( 0 ); + return 0; break; case TGSI_OPCODE_CMP: @@ -2021,132 +2021,134 @@ emit_instruction( break; case TGSI_OPCODE_TXB: - assert( 0 ); + return 0; break; case TGSI_OPCODE_NRM: - assert( 0 ); + return 0; break; case TGSI_OPCODE_DIV: - assert( 0 ); + return 0; break; case TGSI_OPCODE_DP2: - assert( 0 ); + return 0; break; case TGSI_OPCODE_TXL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_BRK: - assert( 0 ); + return 0; break; case TGSI_OPCODE_IF: - assert( 0 ); + return 0; break; case TGSI_OPCODE_LOOP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_REP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ELSE: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ENDIF: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ENDLOOP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ENDREP: - assert( 0 ); + return 0; break; case TGSI_OPCODE_PUSHA: - assert( 0 ); + return 0; break; case TGSI_OPCODE_POPA: - assert( 0 ); + return 0; break; case TGSI_OPCODE_CEIL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_I2F: - assert( 0 ); + return 0; break; case TGSI_OPCODE_NOT: - assert( 0 ); + return 0; break; case TGSI_OPCODE_TRUNC: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SHL: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SHR: - assert( 0 ); + return 0; break; case TGSI_OPCODE_AND: - assert( 0 ); + return 0; break; case TGSI_OPCODE_OR: - assert( 0 ); + return 0; break; case TGSI_OPCODE_MOD: - assert( 0 ); + return 0; break; case TGSI_OPCODE_XOR: - assert( 0 ); + return 0; break; case TGSI_OPCODE_SAD: - assert( 0 ); + return 0; break; case TGSI_OPCODE_TXF: - assert( 0 ); + return 0; break; case TGSI_OPCODE_TXQ: - assert( 0 ); + return 0; break; case TGSI_OPCODE_CONT: - assert( 0 ); + return 0; break; case TGSI_OPCODE_EMIT: - assert( 0 ); + return 0; break; case TGSI_OPCODE_ENDPRIM: - assert( 0 ); + return 0; break; default: - assert( 0 ); + return 0; } + + return 1; } static void @@ -2212,6 +2214,7 @@ emit_declaration( default: assert( 0 ); + break; } } } @@ -2225,6 +2228,7 @@ tgsi_emit_sse2( struct x86_function *func ) { struct tgsi_parse_context parse; + unsigned ok = 1; DUMP_START(); @@ -2249,7 +2253,7 @@ tgsi_emit_sse2( tgsi_parse_init( &parse, tokens ); - while( !tgsi_parse_end_of_tokens( &parse ) ) { + while( !tgsi_parse_end_of_tokens( &parse ) && ok ) { tgsi_parse_token( &parse ); switch( parse.FullToken.Token.Type ) { @@ -2257,17 +2261,26 @@ tgsi_emit_sse2( break; case TGSI_TOKEN_TYPE_INSTRUCTION: - emit_instruction( - func, - &parse.FullToken.FullInstruction ); + ok = emit_instruction( + func, + &parse.FullToken.FullInstruction ); + + if (!ok) { + debug_printf("failed to translate tgsi opcode %d\n", + parse.FullToken.FullInstruction.Instruction.Opcode ); + } break; case TGSI_TOKEN_TYPE_IMMEDIATE: /* XXX implement this */ - return 0; + ok = 0; + debug_printf("failed to emit immediate value\n"); + break; default: assert( 0 ); + ok = 0; + break; } } @@ -2275,7 +2288,7 @@ tgsi_emit_sse2( DUMP_END(); - return 1; + return ok; } /** From 8162d317d2f6f2dcc31f31c0c2d663c33dfee053 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 12:35:16 +0000 Subject: [PATCH 14/74] x86: emit absolute calls, as reallocating exec mem breaks relative ones --- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 5 ++++- src/mesa/x86/rtasm/x86sse.c | 13 +++++++++++++ src/mesa/x86/rtasm/x86sse.h | 3 ++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index ecf4ca8d21e..1e56e4afb69 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -328,8 +328,11 @@ emit_call( struct x86_function *func, void (* addr)() ) { + struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX ); + DUMP_I( "CALL", addr ); - x86_call( func, addr ); + x86_mov_reg_imm( func, ecx, (unsigned long) addr ); + x86_call( func, ecx ); } static void diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index 385fb84c01f..e944d00f9e8 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -278,11 +278,24 @@ void x86_jmp( struct x86_function *p, unsigned char *label) emit_1i(p, label - x86_get_label(p) - 4); } +#if 0 +/* This doesn't work once we start reallocating & copying the + * generated code on buffer fills, because the call is relative to the + * current pc. + */ void x86_call( struct x86_function *p, void (*label)()) { emit_1ub(p, 0xe8); emit_1i(p, cptr(label) - x86_get_label(p) - 4); } +#else +void x86_call( struct x86_function *p, struct x86_reg reg) +{ + emit_1ub(p, 0xff); + emit_modrm(p, reg, reg); +} +#endif + /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h index d53b6d71a6b..c2aa416492e 100644 --- a/src/mesa/x86/rtasm/x86sse.h +++ b/src/mesa/x86/rtasm/x86sse.h @@ -119,7 +119,8 @@ void x86_fixup_fwd_jump( struct x86_function *p, void x86_jmp( struct x86_function *p, unsigned char *label ); -void x86_call( struct x86_function *p, void (*label)() ); +/* void x86_call( struct x86_function *p, void (*label)() ); */ +void x86_call( struct x86_function *p, struct x86_reg reg); /* michal: * Temporary. As I need immediate operands, and dont want to mess with the codegen, From 66640c4b589db7b6b5edce7d297ae6623bfda9c1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 12:37:42 +0000 Subject: [PATCH 15/74] x86: remove debug --- src/mesa/x86/rtasm/x86sse.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index e944d00f9e8..1111e8db990 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -14,8 +14,6 @@ static unsigned char *cptr( void (*label)() ) static void do_realloc( struct x86_function *p ) { - _mesa_printf("do_realloc %d %p\n", p->size, p->store); - if (p->size == 0) { p->size = 1024; p->store = _mesa_exec_malloc(p->size); From c107d572104890c83647ad611d303fe1fae70e8f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 07:28:26 -0500 Subject: [PATCH 16/74] try to load the consts correctly --- src/mesa/pipe/llvm/storagesoa.cpp | 20 ++++++++++++++++++++ src/mesa/pipe/llvm/storagesoa.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index e09e9e8fe7d..7292333a803 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -81,6 +81,15 @@ std::vector StorageSoa::constElement(int idx, int swizzle, llvm::Value *indIdx) { std::vector res(4); + llvm::Value *xChannel = elementPointer(m_consts, idx, 0); + llvm::Value *yChannel = elementPointer(m_consts, idx, 1); + llvm::Value *zChannel = elementPointer(m_consts, idx, 2); + llvm::Value *wChannel = elementPointer(m_consts, idx, 3); + + res[0] = alignedArrayLoad(xChannel); + res[1] = alignedArrayLoad(yChannel); + res[2] = alignedArrayLoad(zChannel); + res[3] = alignedArrayLoad(wChannel); return res; } @@ -206,3 +215,14 @@ llvm::ConstantInt * StorageSoa::constantInt(int idx) const m_constInts[idx] = constInt; return constInt; } + +llvm::Value *StorageSoa::alignedArrayLoad(llvm::Value *val) +{ + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + PointerType *vectorPtr = PointerType::get(vectorType, 0); + + CastInst *cast = new BitCastInst(val, vectorPtr, name("toVector"), m_block); + LoadInst *load = new LoadInst(cast, name("alignLoad"), false, m_block); + load->setAlignment(8); + return load; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 84db7726a7c..43b23951deb 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -74,6 +74,8 @@ private: int channel) const; const char *name(const char *prefix) const; llvm::ConstantInt *constantInt(int) const; + llvm::Value *alignedArrayLoad(llvm::Value *val); + private: llvm::BasicBlock *m_block; From 7e51d2a9986231f4ca44a3643628645923e4d468 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 08:31:13 -0500 Subject: [PATCH 17/74] implement immediates and make them work --- src/mesa/pipe/llvm/storagesoa.cpp | 65 +++++++++++++++++++++++++++++++ src/mesa/pipe/llvm/storagesoa.h | 7 +++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 7292333a803..7b758b1665c 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -41,6 +41,7 @@ using namespace llvm; + StorageSoa::StorageSoa(llvm::BasicBlock *block, llvm::Value *input, llvm::Value *output, @@ -57,6 +58,28 @@ StorageSoa::StorageSoa(llvm::BasicBlock *block, void StorageSoa::addImmediate(float *vec) { + float vals[4]; //decompose into soa + + vals[0] = vec[0]; vals[1] = vec[0]; vals[2] = vec[0]; vals[3] = vec[0]; + llvm::Value *xChannel = createConstGlobalVector(vals); + + vals[0] = vec[1]; vals[1] = vec[1]; vals[2] = vec[1]; vals[3] = vec[1]; + llvm::Value *yChannel = createConstGlobalVector(vals); + + + vals[0] = vec[2]; vals[1] = vec[2]; vals[2] = vec[2]; vals[3] = vec[2]; + llvm::Value *zChannel = createConstGlobalVector(vals); + + vals[0] = vec[3]; vals[1] = vec[3]; vals[2] = vec[3]; vals[3] = vec[3]; + llvm::Value *wChannel = createConstGlobalVector(vals); + + std::vector res(4); + res[0] = xChannel; + res[1] = yChannel; + res[2] = zChannel; + res[3] = wChannel; + + m_immediates[m_immediates.size()] = res; } llvm::Value *StorageSoa::addrElement(int idx) const @@ -123,6 +146,12 @@ std::vector StorageSoa::tempElement(int idx, int swizzle, std::vector StorageSoa::immediateElement(int idx, int swizzle) { std::vector res(4); + res = m_immediates[idx]; + + res[0] = new LoadInst(res[0], name("immx"), false, m_block); + res[1] = new LoadInst(res[1], name("immx"), false, m_block); + res[2] = new LoadInst(res[2], name("immx"), false, m_block); + res[3] = new LoadInst(res[3], name("immx"), false, m_block); return res; } @@ -226,3 +255,39 @@ llvm::Value *StorageSoa::alignedArrayLoad(llvm::Value *val) load->setAlignment(8); return load; } + +llvm::Module * StorageSoa::currentModule() const +{ + if (!m_block || !m_block->getParent()) + return 0; + + return m_block->getParent()->getParent(); +} + +llvm::Value * StorageSoa::createConstGlobalVector(float *vec) +{ + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + GlobalVariable *immediate = new GlobalVariable( + /*Type=*/vectorType, + /*isConstant=*/true, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Initializer=*/0, // has initializer, specified below + /*Name=*/name("immediate"), + currentModule()); + + std::vector immValues; + ConstantFP *constx = ConstantFP::get(Type::FloatTy, APFloat(vec[0])); + ConstantFP *consty = ConstantFP::get(Type::FloatTy, APFloat(vec[1])); + ConstantFP *constz = ConstantFP::get(Type::FloatTy, APFloat(vec[2])); + ConstantFP *constw = ConstantFP::get(Type::FloatTy, APFloat(vec[3])); + immValues.push_back(constx); + immValues.push_back(consty); + immValues.push_back(constz); + immValues.push_back(constw); + Constant *constVector = ConstantVector::get(vectorType, immValues); + + // Global Variable Definitions + immediate->setInitializer(constVector); + + return immediate; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 43b23951deb..2d07e836f4b 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -38,6 +38,7 @@ namespace llvm { class LoadInst; class Value; class VectorType; + class Module; } class StorageSoa @@ -74,7 +75,9 @@ private: int channel) const; const char *name(const char *prefix) const; llvm::ConstantInt *constantInt(int) const; - llvm::Value *alignedArrayLoad(llvm::Value *val); + llvm::Value *alignedArrayLoad(llvm::Value *val); + llvm::Module *currentModule() const; + llvm::Value *createConstGlobalVector(float *vec); private: llvm::BasicBlock *m_block; @@ -84,6 +87,8 @@ private: llvm::Value *m_consts; llvm::Value *m_temps; + std::map > m_immediates; + mutable std::map m_constInts; mutable char m_name[32]; mutable int m_idx; From 12d5b078e8390cb2c598def31fd75260a54ace1a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 08:46:05 -0500 Subject: [PATCH 18/74] get rid of the terrible auto-generated entry point it's not used anymore. --- src/mesa/pipe/llvm/Makefile | 6 +- src/mesa/pipe/llvm/llvm_base_shader.cpp | 833 ------------------------ src/mesa/pipe/llvm/llvm_entry.c | 163 ----- src/mesa/pipe/llvm/tgsitollvm.cpp | 3 +- 4 files changed, 3 insertions(+), 1002 deletions(-) delete mode 100644 src/mesa/pipe/llvm/llvm_base_shader.cpp delete mode 100644 src/mesa/pipe/llvm/llvm_entry.c diff --git a/src/mesa/pipe/llvm/Makefile b/src/mesa/pipe/llvm/Makefile index a0494ba966e..9c6e16d86b7 100644 --- a/src/mesa/pipe/llvm/Makefile +++ b/src/mesa/pipe/llvm/Makefile @@ -15,7 +15,7 @@ GALLIVM_SOURCES = \ storagesoa.cpp \ instructionssoa.cpp -INC_SOURCES = gallivm_builtins.cpp llvm_base_shader.cpp +INC_SOURCES = gallivm_builtins.cpp CPP_SOURCES = \ $(GALLIVM_SOURCES) @@ -65,8 +65,6 @@ depend: $(C_SOURCES) $(CPP_SOURCES) $(ASM_SOURCES) $(INC_SOURCES) gallivm_builtins.cpp: llvm_builtins.c clang --emit-llvm $< |llvm-as|opt -std-compile-opts|llvm2cpp -gen-contents -o=$@ -f -for=shader -funcname=createGallivmBuiltins -llvm_base_shader.cpp: llvm_entry.c - clang --emit-llvm $< |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -o=$@ -f -funcname=createBaseShader # Emacs tags tags: @@ -77,7 +75,7 @@ tags: clean: -rm -f *.o */*.o *~ *.so *~ server/*.o -rm -f depend depend.bak - -rm -f gallivm_builtins.cpp llvm_base_shader.cpp + -rm -f gallivm_builtins.cpp symlinks: diff --git a/src/mesa/pipe/llvm/llvm_base_shader.cpp b/src/mesa/pipe/llvm/llvm_base_shader.cpp deleted file mode 100644 index 90a25a440ab..00000000000 --- a/src/mesa/pipe/llvm/llvm_base_shader.cpp +++ /dev/null @@ -1,833 +0,0 @@ -// Generated by llvm2cpp - DO NOT MODIFY! - - -Module* createBaseShader() { - // Module Construction - Module* mod = new Module("Shader"); - mod->setDataLayout("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"); - mod->setTargetTriple("i686-pc-linux-gnu"); - - // Type Definitions - std::vectorStructTy_struct_ShaderInput_fields; - VectorType* VectorTy_1 = VectorType::get(Type::FloatTy, 4); - - PointerType* PointerTy_0 = PointerType::get(VectorTy_1, 0); - - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(PointerTy_0); - StructTy_struct_ShaderInput_fields.push_back(IntegerType::get(32)); - StructType* StructTy_struct_ShaderInput = StructType::get(StructTy_struct_ShaderInput_fields, /*isPacked=*/false); - mod->addTypeName("struct.ShaderInput", StructTy_struct_ShaderInput); - - OpaqueType* OpaqueTy_struct_pipe_sampler_state = OpaqueType::get(); - mod->addTypeName("struct.pipe_sampler_state", OpaqueTy_struct_pipe_sampler_state); - - OpaqueType* OpaqueTy_struct_softpipe_tile_cache = OpaqueType::get(); - mod->addTypeName("struct.softpipe_tile_cache", OpaqueTy_struct_softpipe_tile_cache); - - std::vectorStructTy_struct_tgsi_sampler_fields; - PointerType* PointerTy_2 = PointerType::get(OpaqueTy_struct_pipe_sampler_state, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_2); - std::vectorFuncTy_4_args; - PATypeHolder StructTy_struct_tgsi_sampler_fwd = OpaqueType::get(); - PointerType* PointerTy_5 = PointerType::get(StructTy_struct_tgsi_sampler_fwd, 0); - - FuncTy_4_args.push_back(PointerTy_5); - PointerType* PointerTy_6 = PointerType::get(Type::FloatTy, 0); - - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(PointerTy_6); - FuncTy_4_args.push_back(Type::FloatTy); - ArrayType* ArrayTy_8 = ArrayType::get(Type::FloatTy, 4); - - PointerType* PointerTy_7 = PointerType::get(ArrayTy_8, 0); - - FuncTy_4_args.push_back(PointerTy_7); - FunctionType* FuncTy_4 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_4_args, - /*isVarArg=*/false); - - PointerType* PointerTy_3 = PointerType::get(FuncTy_4, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_3); - PointerType* PointerTy_9 = PointerType::get(IntegerType::get(8), 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_9); - PointerType* PointerTy_10 = PointerType::get(OpaqueTy_struct_softpipe_tile_cache, 0); - - StructTy_struct_tgsi_sampler_fields.push_back(PointerTy_10); - StructType* StructTy_struct_tgsi_sampler = StructType::get(StructTy_struct_tgsi_sampler_fields, /*isPacked=*/false); - mod->addTypeName("struct.tgsi_sampler", StructTy_struct_tgsi_sampler); - cast(StructTy_struct_tgsi_sampler_fwd.get())->refineAbstractTypeTo(StructTy_struct_tgsi_sampler); - StructTy_struct_tgsi_sampler = cast(StructTy_struct_tgsi_sampler_fwd.get()); - - - std::vectorFuncTy_11_args; - ArrayType* ArrayTy_13 = ArrayType::get(VectorTy_1, 16); - - PointerType* PointerTy_12 = PointerType::get(ArrayTy_13, 0); - - FuncTy_11_args.push_back(PointerTy_12); - ArrayType* ArrayTy_15 = ArrayType::get(ArrayTy_8, 16); - - PointerType* PointerTy_14 = PointerType::get(ArrayTy_15, 0); - - FuncTy_11_args.push_back(PointerTy_14); - FuncTy_11_args.push_back(IntegerType::get(32)); - FuncTy_11_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_11 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_11_args, - /*isVarArg=*/false); - - std::vectorFuncTy_16_args; - FuncTy_16_args.push_back(PointerTy_0); - FuncTy_16_args.push_back(PointerTy_7); - FuncTy_16_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_16 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_16_args, - /*isVarArg=*/false); - - std::vectorFuncTy_17_args; - FuncTy_17_args.push_back(PointerTy_7); - FuncTy_17_args.push_back(PointerTy_0); - FuncTy_17_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_17 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_17_args, - /*isVarArg=*/false); - - std::vectorFuncTy_18_args; - FuncTy_18_args.push_back(PointerTy_9); - FuncTy_18_args.push_back(PointerTy_9); - FuncTy_18_args.push_back(PointerTy_7); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FuncTy_18_args.push_back(IntegerType::get(32)); - FunctionType* FuncTy_18 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_18_args, - /*isVarArg=*/false); - - ArrayType* ArrayTy_20 = ArrayType::get(VectorTy_1, 32); - - PointerType* PointerTy_19 = PointerType::get(ArrayTy_20, 0); - - ArrayType* ArrayTy_22 = ArrayType::get(VectorTy_1, 128); - - PointerType* PointerTy_21 = PointerType::get(ArrayTy_22, 0); - - PointerType* PointerTy_23 = PointerType::get(StructTy_struct_ShaderInput, 0); - - PointerType* PointerTy_24 = PointerType::get(PointerTy_0, 0); - - std::vectorFuncTy_26_args; - FuncTy_26_args.push_back(PointerTy_23); - FunctionType* FuncTy_26 = FunctionType::get( - /*Result=*/Type::VoidTy, - /*Params=*/FuncTy_26_args, - /*isVarArg=*/false); - - PointerType* PointerTy_25 = PointerType::get(FuncTy_26, 0); - - std::vectorFuncTy_27_args; - FuncTy_27_args.push_back(Type::FloatTy); - FuncTy_27_args.push_back(Type::FloatTy); - FuncTy_27_args.push_back(PointerTy_12); - FuncTy_27_args.push_back(PointerTy_12); - FuncTy_27_args.push_back(IntegerType::get(32)); - FuncTy_27_args.push_back(PointerTy_7); - FuncTy_27_args.push_back(IntegerType::get(32)); - FuncTy_27_args.push_back(PointerTy_5); - FunctionType* FuncTy_27 = FunctionType::get( - /*Result=*/IntegerType::get(32), - /*Params=*/FuncTy_27_args, - /*isVarArg=*/false); - - PointerType* PointerTy_28 = PointerType::get(IntegerType::get(32), 0); - - - // Function Declarations - - Function* func_from_array = new Function( - /*Type=*/FuncTy_11, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"from_array", mod); - func_from_array->setCallingConv(CallingConv::C); - const ParamAttrsList *func_from_array_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_from_array_PAL = ParamAttrsList::get(Attrs); - - } - func_from_array->setParamAttrs(func_from_array_PAL); - - Function* func_from_consts = new Function( - /*Type=*/FuncTy_16, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"from_consts", mod); - func_from_consts->setCallingConv(CallingConv::C); - const ParamAttrsList *func_from_consts_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_from_consts_PAL = ParamAttrsList::get(Attrs); - - } - func_from_consts->setParamAttrs(func_from_consts_PAL); - - Function* func_to_array = new Function( - /*Type=*/FuncTy_17, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"to_array", mod); - func_to_array->setCallingConv(CallingConv::C); - const ParamAttrsList *func_to_array_PAL = 0; - { - ParamAttrsVector Attrs; - ParamAttrsWithIndex PAWI; - PAWI.index = 0; PAWI.attrs = 0 | ParamAttr::NoUnwind; - Attrs.push_back(PAWI); - func_to_array_PAL = ParamAttrsList::get(Attrs); - - } - func_to_array->setParamAttrs(func_to_array_PAL); - - Function* func_run_vertex_shader = new Function( - /*Type=*/FuncTy_18, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"run_vertex_shader", mod); - func_run_vertex_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_run_vertex_shader_PAL = 0; - func_run_vertex_shader->setParamAttrs(func_run_vertex_shader_PAL); - - Function* func_execute_shader = new Function( - /*Type=*/FuncTy_26, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"execute_shader", mod); // (external, no body) - func_execute_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_execute_shader_PAL = 0; - func_execute_shader->setParamAttrs(func_execute_shader_PAL); - - Function* func_run_fragment_shader = new Function( - /*Type=*/FuncTy_27, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Name=*/"run_fragment_shader", mod); - func_run_fragment_shader->setCallingConv(CallingConv::C); - const ParamAttrsList *func_run_fragment_shader_PAL = 0; - func_run_fragment_shader->setParamAttrs(func_run_fragment_shader_PAL); - - // Global Variable Declarations - - - // Constant Definitions - Constant* const_int32_29 = Constant::getNullValue(IntegerType::get(32)); - ConstantInt* const_int32_30 = ConstantInt::get(APInt(32, "-1", 10)); - ConstantInt* const_int32_31 = ConstantInt::get(APInt(32, "1", 10)); - UndefValue* const_packed_32 = UndefValue::get(VectorTy_1); - ConstantInt* const_int32_33 = ConstantInt::get(APInt(32, "2", 10)); - ConstantInt* const_int32_34 = ConstantInt::get(APInt(32, "3", 10)); - ConstantInt* const_int32_35 = ConstantInt::get(APInt(32, "4", 10)); - - // Global Variable Definitions - - // Function Definitions - - // Function: from_array (func_from_array) - { - Function::arg_iterator args = func_from_array->arg_begin(); - Value* ptr_res = args++; - ptr_res->setName("res"); - Value* ptr_ainputs = args++; - ptr_ainputs->setName("ainputs"); - Value* int32_count = args++; - int32_count->setName("count"); - Value* int32_num_attribs = args++; - int32_num_attribs->setName("num_attribs"); - - BasicBlock* label_entry = new BasicBlock("entry",func_from_array,0); - BasicBlock* label_forcond2_preheader_split = new BasicBlock("forcond2.preheader.split",func_from_array,0); - BasicBlock* label_forcond2 = new BasicBlock("forcond2",func_from_array,0); - BasicBlock* label_forbody6 = new BasicBlock("forbody6",func_from_array,0); - BasicBlock* label_forinc57 = new BasicBlock("forinc57",func_from_array,0); - BasicBlock* label_afterfor60 = new BasicBlock("afterfor60",func_from_array,0); - - // Block entry (label_entry) - ICmpInst* int1_cmp = new ICmpInst(ICmpInst::ICMP_SGT, int32_count, const_int32_29, "cmp", label_entry); - ICmpInst* int1_cmp5 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs, const_int32_29, "cmp5", label_entry); - BinaryOperator* int1_bothcond = BinaryOperator::create(Instruction::And, int1_cmp, int1_cmp5, "bothcond", label_entry); - new BranchInst(label_forcond2_preheader_split, label_afterfor60, int1_bothcond, label_entry); - - // Block forcond2.preheader.split (label_forcond2_preheader_split) - BinaryOperator* int32_tmp21 = BinaryOperator::create(Instruction::Add, int32_count, const_int32_30, "tmp21", label_forcond2_preheader_split); - ICmpInst* int1_tmp22 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp21, const_int32_29, "tmp22", label_forcond2_preheader_split); - SelectInst* int32_tmp25 = new SelectInst(int1_tmp22, const_int32_31, int32_count, "tmp25", label_forcond2_preheader_split); - new BranchInst(label_forcond2, label_forcond2_preheader_split); - - // Block forcond2 (label_forcond2) - Argument* fwdref_38 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forcond2); - int32_i_0_reg2mem_0->reserveOperandSpace(2); - int32_i_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2_preheader_split); - int32_i_0_reg2mem_0->addIncoming(fwdref_38, label_forinc57); - - Argument* fwdref_39 = new Argument(VectorTy_1); - PHINode* packed_vec_1_reg2mem_0 = new PHINode(VectorTy_1, "vec.1.reg2mem.0", label_forcond2); - packed_vec_1_reg2mem_0->reserveOperandSpace(2); - packed_vec_1_reg2mem_0->addIncoming(const_packed_32, label_forcond2_preheader_split); - packed_vec_1_reg2mem_0->addIncoming(fwdref_39, label_forinc57); - - BinaryOperator* int32_tmp = BinaryOperator::create(Instruction::Add, int32_num_attribs, const_int32_30, "tmp", label_forcond2); - ICmpInst* int1_tmp18 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp, const_int32_29, "tmp18", label_forcond2); - SelectInst* int32_tmp19 = new SelectInst(int1_tmp18, const_int32_31, int32_num_attribs, "tmp19", label_forcond2); - new BranchInst(label_forbody6, label_forcond2); - - // Block forbody6 (label_forbody6) - Argument* fwdref_41 = new Argument(IntegerType::get(32)); - PHINode* int32_j_0_reg2mem_0 = new PHINode(IntegerType::get(32), "j.0.reg2mem.0", label_forbody6); - int32_j_0_reg2mem_0->reserveOperandSpace(2); - int32_j_0_reg2mem_0->addIncoming(const_int32_29, label_forcond2); - int32_j_0_reg2mem_0->addIncoming(fwdref_41, label_forbody6); - - PHINode* packed_vec_0_reg2mem_0 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody6); - packed_vec_0_reg2mem_0->reserveOperandSpace(2); - packed_vec_0_reg2mem_0->addIncoming(packed_vec_1_reg2mem_0, label_forcond2); - packed_vec_0_reg2mem_0->addIncoming(fwdref_39, label_forbody6); - - std::vector ptr_arraydecay11_indices; - ptr_arraydecay11_indices.push_back(int32_i_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(int32_j_0_reg2mem_0); - ptr_arraydecay11_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11 = new GetElementPtrInst(ptr_ainputs, ptr_arraydecay11_indices.begin(), ptr_arraydecay11_indices.end(), "arraydecay11", label_forbody6); - LoadInst* float_tmp13 = new LoadInst(ptr_arraydecay11, "tmp13", false, label_forbody6); - InsertElementInst* packed_tmp15 = new InsertElementInst(packed_vec_0_reg2mem_0, float_tmp13, const_int32_29, "tmp15", label_forbody6); - std::vector ptr_arrayidx23_indices; - ptr_arrayidx23_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx23_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx23 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx23_indices.begin(), ptr_arrayidx23_indices.end(), "arrayidx23", label_forbody6); - LoadInst* float_tmp24 = new LoadInst(ptr_arrayidx23, "tmp24", false, label_forbody6); - InsertElementInst* packed_tmp26 = new InsertElementInst(packed_tmp15, float_tmp24, const_int32_31, "tmp26", label_forbody6); - std::vector ptr_arrayidx34_indices; - ptr_arrayidx34_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx34_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx34 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx34_indices.begin(), ptr_arrayidx34_indices.end(), "arrayidx34", label_forbody6); - LoadInst* float_tmp35 = new LoadInst(ptr_arrayidx34, "tmp35", false, label_forbody6); - InsertElementInst* packed_tmp37 = new InsertElementInst(packed_tmp26, float_tmp35, const_int32_33, "tmp37", label_forbody6); - std::vector ptr_arrayidx45_indices; - ptr_arrayidx45_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(int32_j_0_reg2mem_0); - ptr_arrayidx45_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx45 = new GetElementPtrInst(ptr_ainputs, ptr_arrayidx45_indices.begin(), ptr_arrayidx45_indices.end(), "arrayidx45", label_forbody6); - LoadInst* float_tmp46 = new LoadInst(ptr_arrayidx45, "tmp46", false, label_forbody6); - InsertElementInst* packed_tmp48 = new InsertElementInst(packed_tmp37, float_tmp46, const_int32_34, "tmp48", label_forbody6); - std::vector ptr_arrayidx54_indices; - ptr_arrayidx54_indices.push_back(int32_i_0_reg2mem_0); - ptr_arrayidx54_indices.push_back(int32_j_0_reg2mem_0); - Instruction* ptr_arrayidx54 = new GetElementPtrInst(ptr_res, ptr_arrayidx54_indices.begin(), ptr_arrayidx54_indices.end(), "arrayidx54", label_forbody6); - StoreInst* void_42 = new StoreInst(packed_tmp48, ptr_arrayidx54, false, label_forbody6); - BinaryOperator* int32_indvar_next = BinaryOperator::create(Instruction::Add, int32_j_0_reg2mem_0, const_int32_31, "indvar.next", label_forbody6); - ICmpInst* int1_exitcond = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next, int32_tmp19, "exitcond", label_forbody6); - new BranchInst(label_forinc57, label_forbody6, int1_exitcond, label_forbody6); - - // Block forinc57 (label_forinc57) - BinaryOperator* int32_indvar_next20 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0, const_int32_31, "indvar.next20", label_forinc57); - ICmpInst* int1_exitcond26 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next20, int32_tmp25, "exitcond26", label_forinc57); - new BranchInst(label_afterfor60, label_forcond2, int1_exitcond26, label_forinc57); - - // Block afterfor60 (label_afterfor60) - new ReturnInst(label_afterfor60); - - // Resolve Forward References - fwdref_39->replaceAllUsesWith(packed_tmp48); delete fwdref_39; - fwdref_41->replaceAllUsesWith(int32_indvar_next); delete fwdref_41; - fwdref_38->replaceAllUsesWith(int32_indvar_next20); delete fwdref_38; - - } - - // Function: from_consts (func_from_consts) - { - Function::arg_iterator args = func_from_consts->arg_begin(); - Value* ptr_res_46 = args++; - ptr_res_46->setName("res"); - Value* ptr_ainputs_47 = args++; - ptr_ainputs_47->setName("ainputs"); - Value* int32_count_48 = args++; - int32_count_48->setName("count"); - - BasicBlock* label_entry_49 = new BasicBlock("entry",func_from_consts,0); - BasicBlock* label_forbody_preheader = new BasicBlock("forbody.preheader",func_from_consts,0); - BasicBlock* label_forbody = new BasicBlock("forbody",func_from_consts,0); - BasicBlock* label_afterfor = new BasicBlock("afterfor",func_from_consts,0); - - // Block entry (label_entry_49) - ICmpInst* int1_cmp_50 = new ICmpInst(ICmpInst::ICMP_SGT, int32_count_48, const_int32_29, "cmp", label_entry_49); - new BranchInst(label_forbody_preheader, label_afterfor, int1_cmp_50, label_entry_49); - - // Block forbody.preheader (label_forbody_preheader) - BinaryOperator* int32_tmp_52 = BinaryOperator::create(Instruction::Add, int32_count_48, const_int32_30, "tmp", label_forbody_preheader); - ICmpInst* int1_tmp9 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_52, const_int32_29, "tmp9", label_forbody_preheader); - SelectInst* int32_tmp10 = new SelectInst(int1_tmp9, const_int32_31, int32_count_48, "tmp10", label_forbody_preheader); - new BranchInst(label_forbody, label_forbody_preheader); - - // Block forbody (label_forbody) - Argument* fwdref_55 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_54 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody); - int32_i_0_reg2mem_0_54->reserveOperandSpace(2); - int32_i_0_reg2mem_0_54->addIncoming(const_int32_29, label_forbody_preheader); - int32_i_0_reg2mem_0_54->addIncoming(fwdref_55, label_forbody); - - Argument* fwdref_57 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_56 = new PHINode(VectorTy_1, "vec.0.reg2mem.0", label_forbody); - packed_vec_0_reg2mem_0_56->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_56->addIncoming(const_packed_32, label_forbody_preheader); - packed_vec_0_reg2mem_0_56->addIncoming(fwdref_57, label_forbody); - - std::vector ptr_arraydecay_indices; - ptr_arraydecay_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arraydecay_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay = new GetElementPtrInst(ptr_ainputs_47, ptr_arraydecay_indices.begin(), ptr_arraydecay_indices.end(), "arraydecay", label_forbody); - LoadInst* float_tmp5 = new LoadInst(ptr_arraydecay, "tmp5", false, label_forbody); - InsertElementInst* packed_tmp7 = new InsertElementInst(packed_vec_0_reg2mem_0_56, float_tmp5, const_int32_29, "tmp7", label_forbody); - std::vector ptr_arrayidx12_indices; - ptr_arrayidx12_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx12_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx12_indices.begin(), ptr_arrayidx12_indices.end(), "arrayidx12", label_forbody); - LoadInst* float_tmp13_58 = new LoadInst(ptr_arrayidx12, "tmp13", false, label_forbody); - InsertElementInst* packed_tmp15_59 = new InsertElementInst(packed_tmp7, float_tmp13_58, const_int32_31, "tmp15", label_forbody); - std::vector ptr_arrayidx20_indices; - ptr_arrayidx20_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx20_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx20_indices.begin(), ptr_arrayidx20_indices.end(), "arrayidx20", label_forbody); - LoadInst* float_tmp21 = new LoadInst(ptr_arrayidx20, "tmp21", false, label_forbody); - InsertElementInst* packed_tmp23 = new InsertElementInst(packed_tmp15_59, float_tmp21, const_int32_33, "tmp23", label_forbody); - std::vector ptr_arrayidx28_indices; - ptr_arrayidx28_indices.push_back(int32_i_0_reg2mem_0_54); - ptr_arrayidx28_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28 = new GetElementPtrInst(ptr_ainputs_47, ptr_arrayidx28_indices.begin(), ptr_arrayidx28_indices.end(), "arrayidx28", label_forbody); - LoadInst* float_tmp29 = new LoadInst(ptr_arrayidx28, "tmp29", false, label_forbody); - InsertElementInst* packed_tmp31 = new InsertElementInst(packed_tmp23, float_tmp29, const_int32_34, "tmp31", label_forbody); - GetElementPtrInst* ptr_arrayidx34_60 = new GetElementPtrInst(ptr_res_46, int32_i_0_reg2mem_0_54, "arrayidx34", label_forbody); - StoreInst* void_61 = new StoreInst(packed_tmp31, ptr_arrayidx34_60, false, label_forbody); - BinaryOperator* int32_indvar_next_62 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_54, const_int32_31, "indvar.next", label_forbody); - ICmpInst* int1_exitcond_63 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_62, int32_tmp10, "exitcond", label_forbody); - new BranchInst(label_afterfor, label_forbody, int1_exitcond_63, label_forbody); - - // Block afterfor (label_afterfor) - new ReturnInst(label_afterfor); - - // Resolve Forward References - fwdref_57->replaceAllUsesWith(packed_tmp31); delete fwdref_57; - fwdref_55->replaceAllUsesWith(int32_indvar_next_62); delete fwdref_55; - - } - - // Function: to_array (func_to_array) - { - Function::arg_iterator args = func_to_array->arg_begin(); - Value* ptr_dests = args++; - ptr_dests->setName("dests"); - Value* ptr_in = args++; - ptr_in->setName("in"); - Value* int32_num_attribs_66 = args++; - int32_num_attribs_66->setName("num_attribs"); - - BasicBlock* label_entry_67 = new BasicBlock("entry",func_to_array,0); - BasicBlock* label_forbody_preheader_68 = new BasicBlock("forbody.preheader",func_to_array,0); - BasicBlock* label_forbody_69 = new BasicBlock("forbody",func_to_array,0); - BasicBlock* label_afterfor_70 = new BasicBlock("afterfor",func_to_array,0); - - // Block entry (label_entry_67) - ICmpInst* int1_cmp_71 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_attribs_66, const_int32_29, "cmp", label_entry_67); - new BranchInst(label_forbody_preheader_68, label_afterfor_70, int1_cmp_71, label_entry_67); - - // Block forbody.preheader (label_forbody_preheader_68) - BinaryOperator* int32_tmp_73 = BinaryOperator::create(Instruction::Add, int32_num_attribs_66, const_int32_30, "tmp", label_forbody_preheader_68); - ICmpInst* int1_tmp9_74 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_73, const_int32_29, "tmp9", label_forbody_preheader_68); - SelectInst* int32_tmp10_75 = new SelectInst(int1_tmp9_74, const_int32_31, int32_num_attribs_66, "tmp10", label_forbody_preheader_68); - new BranchInst(label_forbody_69, label_forbody_preheader_68); - - // Block forbody (label_forbody_69) - Argument* fwdref_78 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_77 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0", label_forbody_69); - int32_i_0_reg2mem_0_77->reserveOperandSpace(2); - int32_i_0_reg2mem_0_77->addIncoming(const_int32_29, label_forbody_preheader_68); - int32_i_0_reg2mem_0_77->addIncoming(fwdref_78, label_forbody_69); - - std::vector ptr_arraydecay_79_indices; - ptr_arraydecay_79_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arraydecay_79_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_79 = new GetElementPtrInst(ptr_dests, ptr_arraydecay_79_indices.begin(), ptr_arraydecay_79_indices.end(), "arraydecay", label_forbody_69); - GetElementPtrInst* ptr_arrayidx6 = new GetElementPtrInst(ptr_in, int32_i_0_reg2mem_0_77, "arrayidx6", label_forbody_69); - LoadInst* packed_tmp7_80 = new LoadInst(ptr_arrayidx6, "tmp7", false, label_forbody_69); - ExtractElementInst* float_tmp11 = new ExtractElementInst(packed_tmp7_80, const_int32_29, "tmp11", label_forbody_69); - StoreInst* void_81 = new StoreInst(float_tmp11, ptr_arraydecay_79, false, label_forbody_69); - std::vector ptr_arrayidx13_indices; - ptr_arrayidx13_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx13_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx13 = new GetElementPtrInst(ptr_dests, ptr_arrayidx13_indices.begin(), ptr_arrayidx13_indices.end(), "arrayidx13", label_forbody_69); - ExtractElementInst* float_tmp15 = new ExtractElementInst(packed_tmp7_80, const_int32_31, "tmp15", label_forbody_69); - StoreInst* void_82 = new StoreInst(float_tmp15, ptr_arrayidx13, false, label_forbody_69); - std::vector ptr_arrayidx17_indices; - ptr_arrayidx17_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx17_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx17 = new GetElementPtrInst(ptr_dests, ptr_arrayidx17_indices.begin(), ptr_arrayidx17_indices.end(), "arrayidx17", label_forbody_69); - ExtractElementInst* float_tmp19 = new ExtractElementInst(packed_tmp7_80, const_int32_33, "tmp19", label_forbody_69); - StoreInst* void_83 = new StoreInst(float_tmp19, ptr_arrayidx17, false, label_forbody_69); - std::vector ptr_arrayidx21_indices; - ptr_arrayidx21_indices.push_back(int32_i_0_reg2mem_0_77); - ptr_arrayidx21_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx21 = new GetElementPtrInst(ptr_dests, ptr_arrayidx21_indices.begin(), ptr_arrayidx21_indices.end(), "arrayidx21", label_forbody_69); - ExtractElementInst* float_tmp23 = new ExtractElementInst(packed_tmp7_80, const_int32_34, "tmp23", label_forbody_69); - StoreInst* void_84 = new StoreInst(float_tmp23, ptr_arrayidx21, false, label_forbody_69); - BinaryOperator* int32_indvar_next_85 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_77, const_int32_31, "indvar.next", label_forbody_69); - ICmpInst* int1_exitcond_86 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_85, int32_tmp10_75, "exitcond", label_forbody_69); - new BranchInst(label_afterfor_70, label_forbody_69, int1_exitcond_86, label_forbody_69); - - // Block afterfor (label_afterfor_70) - new ReturnInst(label_afterfor_70); - - // Resolve Forward References - fwdref_78->replaceAllUsesWith(int32_indvar_next_85); delete fwdref_78; - - } - - // Function: run_vertex_shader (func_run_vertex_shader) - { - Function::arg_iterator args = func_run_vertex_shader->arg_begin(); - Value* ptr_inputs = args++; - ptr_inputs->setName("inputs"); - Value* ptr_results = args++; - ptr_results->setName("results"); - Value* ptr_aconsts = args++; - ptr_aconsts->setName("aconsts"); - Value* int32_num_vertices = args++; - int32_num_vertices->setName("num_vertices"); - Value* int32_num_inputs = args++; - int32_num_inputs->setName("num_inputs"); - Value* int32_num_attribs_89 = args++; - int32_num_attribs_89->setName("num_attribs"); - Value* int32_num_consts = args++; - int32_num_consts->setName("num_consts"); - - BasicBlock* label_entry_90 = new BasicBlock("entry",func_run_vertex_shader,0); - BasicBlock* label_forbody_preheader_i = new BasicBlock("forbody.preheader.i",func_run_vertex_shader,0); - BasicBlock* label_forbody_i = new BasicBlock("forbody.i",func_run_vertex_shader,0); - BasicBlock* label_from_consts_exit = new BasicBlock("from_consts.exit",func_run_vertex_shader,0); - - // Block entry (label_entry_90) - AllocaInst* ptr_consts = new AllocaInst(ArrayTy_20, "consts", label_entry_90); - AllocaInst* ptr_temps = new AllocaInst(ArrayTy_22, "temps", label_entry_90); - AllocaInst* ptr_args = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_90); - std::vector ptr_tmp_indices; - ptr_tmp_indices.push_back(const_int32_29); - ptr_tmp_indices.push_back(const_int32_29); - Instruction* ptr_tmp = new GetElementPtrInst(ptr_args, ptr_tmp_indices.begin(), ptr_tmp_indices.end(), "tmp", label_entry_90); - CastInst* ptr_conv = new BitCastInst(ptr_results, PointerTy_0, "conv", label_entry_90); - StoreInst* void_91 = new StoreInst(ptr_conv, ptr_tmp, false, label_entry_90); - std::vector ptr_tmp2_indices; - ptr_tmp2_indices.push_back(const_int32_29); - ptr_tmp2_indices.push_back(const_int32_31); - Instruction* ptr_tmp2 = new GetElementPtrInst(ptr_args, ptr_tmp2_indices.begin(), ptr_tmp2_indices.end(), "tmp2", label_entry_90); - CastInst* ptr_conv4 = new BitCastInst(ptr_inputs, PointerTy_0, "conv4", label_entry_90); - StoreInst* void_92 = new StoreInst(ptr_conv4, ptr_tmp2, false, label_entry_90); - ICmpInst* int1_cmp_i = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts, const_int32_29, "cmp.i", label_entry_90); - new BranchInst(label_forbody_preheader_i, label_from_consts_exit, int1_cmp_i, label_entry_90); - - // Block forbody.preheader.i (label_forbody_preheader_i) - BinaryOperator* int32_tmp_i = BinaryOperator::create(Instruction::Add, int32_num_consts, const_int32_30, "tmp.i", label_forbody_preheader_i); - ICmpInst* int1_tmp9_i = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i, const_int32_29, "tmp9.i", label_forbody_preheader_i); - SelectInst* int32_tmp10_i = new SelectInst(int1_tmp9_i, const_int32_31, int32_num_consts, "tmp10.i", label_forbody_preheader_i); - new BranchInst(label_forbody_i, label_forbody_preheader_i); - - // Block forbody.i (label_forbody_i) - Argument* fwdref_95 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i); - int32_i_0_reg2mem_0_i->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i->addIncoming(const_int32_29, label_forbody_preheader_i); - int32_i_0_reg2mem_0_i->addIncoming(fwdref_95, label_forbody_i); - - Argument* fwdref_96 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i); - packed_vec_0_reg2mem_0_i->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i->addIncoming(const_packed_32, label_forbody_preheader_i); - packed_vec_0_reg2mem_0_i->addIncoming(fwdref_96, label_forbody_i); - - std::vector ptr_arraydecay_i_indices; - ptr_arraydecay_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arraydecay_i_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_i = new GetElementPtrInst(ptr_aconsts, ptr_arraydecay_i_indices.begin(), ptr_arraydecay_i_indices.end(), "arraydecay.i", label_forbody_i); - LoadInst* float_tmp5_i = new LoadInst(ptr_arraydecay_i, "tmp5.i", false, label_forbody_i); - InsertElementInst* packed_tmp7_i = new InsertElementInst(packed_vec_0_reg2mem_0_i, float_tmp5_i, const_int32_29, "tmp7.i", label_forbody_i); - std::vector ptr_arrayidx12_i_indices; - ptr_arrayidx12_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx12_i_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx12_i_indices.begin(), ptr_arrayidx12_i_indices.end(), "arrayidx12.i", label_forbody_i); - LoadInst* float_tmp13_i = new LoadInst(ptr_arrayidx12_i, "tmp13.i", false, label_forbody_i); - InsertElementInst* packed_tmp15_i = new InsertElementInst(packed_tmp7_i, float_tmp13_i, const_int32_31, "tmp15.i", label_forbody_i); - std::vector ptr_arrayidx20_i_indices; - ptr_arrayidx20_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx20_i_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx20_i_indices.begin(), ptr_arrayidx20_i_indices.end(), "arrayidx20.i", label_forbody_i); - LoadInst* float_tmp21_i = new LoadInst(ptr_arrayidx20_i, "tmp21.i", false, label_forbody_i); - InsertElementInst* packed_tmp23_i = new InsertElementInst(packed_tmp15_i, float_tmp21_i, const_int32_33, "tmp23.i", label_forbody_i); - std::vector ptr_arrayidx28_i_indices; - ptr_arrayidx28_i_indices.push_back(int32_i_0_reg2mem_0_i); - ptr_arrayidx28_i_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28_i = new GetElementPtrInst(ptr_aconsts, ptr_arrayidx28_i_indices.begin(), ptr_arrayidx28_i_indices.end(), "arrayidx28.i", label_forbody_i); - LoadInst* float_tmp29_i = new LoadInst(ptr_arrayidx28_i, "tmp29.i", false, label_forbody_i); - InsertElementInst* packed_tmp31_i = new InsertElementInst(packed_tmp23_i, float_tmp29_i, const_int32_34, "tmp31.i", label_forbody_i); - std::vector ptr_arrayidx34_i_indices; - ptr_arrayidx34_i_indices.push_back(const_int32_29); - ptr_arrayidx34_i_indices.push_back(int32_i_0_reg2mem_0_i); - Instruction* ptr_arrayidx34_i = new GetElementPtrInst(ptr_consts, ptr_arrayidx34_i_indices.begin(), ptr_arrayidx34_i_indices.end(), "arrayidx34.i", label_forbody_i); - StoreInst* void_97 = new StoreInst(packed_tmp31_i, ptr_arrayidx34_i, false, label_forbody_i); - BinaryOperator* int32_indvar_next_98 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i, const_int32_31, "indvar.next", label_forbody_i); - ICmpInst* int1_exitcond_99 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next_98, int32_tmp10_i, "exitcond", label_forbody_i); - new BranchInst(label_from_consts_exit, label_forbody_i, int1_exitcond_99, label_forbody_i); - - // Block from_consts.exit (label_from_consts_exit) - std::vector ptr_tmp7_indices; - ptr_tmp7_indices.push_back(const_int32_29); - ptr_tmp7_indices.push_back(const_int32_34); - Instruction* ptr_tmp7 = new GetElementPtrInst(ptr_args, ptr_tmp7_indices.begin(), ptr_tmp7_indices.end(), "tmp7", label_from_consts_exit); - std::vector ptr_arraydecay8_indices; - ptr_arraydecay8_indices.push_back(const_int32_29); - ptr_arraydecay8_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay8 = new GetElementPtrInst(ptr_consts, ptr_arraydecay8_indices.begin(), ptr_arraydecay8_indices.end(), "arraydecay8", label_from_consts_exit); - StoreInst* void_101 = new StoreInst(ptr_arraydecay8, ptr_tmp7, false, label_from_consts_exit); - std::vector ptr_tmp9_indices; - ptr_tmp9_indices.push_back(const_int32_29); - ptr_tmp9_indices.push_back(const_int32_33); - Instruction* ptr_tmp9 = new GetElementPtrInst(ptr_args, ptr_tmp9_indices.begin(), ptr_tmp9_indices.end(), "tmp9", label_from_consts_exit); - std::vector ptr_arraydecay10_indices; - ptr_arraydecay10_indices.push_back(const_int32_29); - ptr_arraydecay10_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay10 = new GetElementPtrInst(ptr_temps, ptr_arraydecay10_indices.begin(), ptr_arraydecay10_indices.end(), "arraydecay10", label_from_consts_exit); - StoreInst* void_102 = new StoreInst(ptr_arraydecay10, ptr_tmp9, false, label_from_consts_exit); - CallInst* void_103 = new CallInst(func_execute_shader, ptr_args, "", label_from_consts_exit); - void_103->setCallingConv(CallingConv::C); - void_103->setTailCall(false);const ParamAttrsList *void_103_PAL = 0; - void_103->setParamAttrs(void_103_PAL); - - new ReturnInst(label_from_consts_exit); - - // Resolve Forward References - fwdref_96->replaceAllUsesWith(packed_tmp31_i); delete fwdref_96; - fwdref_95->replaceAllUsesWith(int32_indvar_next_98); delete fwdref_95; - - } - - // Function: run_fragment_shader (func_run_fragment_shader) - { - Function::arg_iterator args = func_run_fragment_shader->arg_begin(); - Value* float_x = args++; - float_x->setName("x"); - Value* float_y = args++; - float_y->setName("y"); - Value* ptr_results_105 = args++; - ptr_results_105->setName("results"); - Value* ptr_inputs_106 = args++; - ptr_inputs_106->setName("inputs"); - Value* int32_num_inputs_107 = args++; - int32_num_inputs_107->setName("num_inputs"); - Value* ptr_aconsts_108 = args++; - ptr_aconsts_108->setName("aconsts"); - Value* int32_num_consts_109 = args++; - int32_num_consts_109->setName("num_consts"); - Value* ptr_samplers = args++; - ptr_samplers->setName("samplers"); - - BasicBlock* label_entry_110 = new BasicBlock("entry",func_run_fragment_shader,0); - BasicBlock* label_forbody_preheader_i_111 = new BasicBlock("forbody.preheader.i",func_run_fragment_shader,0); - BasicBlock* label_forbody_i_112 = new BasicBlock("forbody.i",func_run_fragment_shader,0); - BasicBlock* label_from_consts_exit_113 = new BasicBlock("from_consts.exit",func_run_fragment_shader,0); - - // Block entry (label_entry_110) - AllocaInst* ptr_consts_114 = new AllocaInst(ArrayTy_20, "consts", label_entry_110); - AllocaInst* ptr_temps_115 = new AllocaInst(ArrayTy_22, "temps", label_entry_110); - AllocaInst* ptr_args_116 = new AllocaInst(StructTy_struct_ShaderInput, "args", label_entry_110); - std::vector ptr_tmp_117_indices; - ptr_tmp_117_indices.push_back(const_int32_29); - ptr_tmp_117_indices.push_back(const_int32_35); - Instruction* ptr_tmp_117 = new GetElementPtrInst(ptr_args_116, ptr_tmp_117_indices.begin(), ptr_tmp_117_indices.end(), "tmp", label_entry_110); - StoreInst* void_118 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_entry_110); - ICmpInst* int1_cmp_i_119 = new ICmpInst(ICmpInst::ICMP_SGT, int32_num_consts_109, const_int32_29, "cmp.i", label_entry_110); - new BranchInst(label_forbody_preheader_i_111, label_from_consts_exit_113, int1_cmp_i_119, label_entry_110); - - // Block forbody.preheader.i (label_forbody_preheader_i_111) - BinaryOperator* int32_tmp_i_121 = BinaryOperator::create(Instruction::Add, int32_num_consts_109, const_int32_30, "tmp.i", label_forbody_preheader_i_111); - ICmpInst* int1_tmp9_i_122 = new ICmpInst(ICmpInst::ICMP_SLT, int32_tmp_i_121, const_int32_29, "tmp9.i", label_forbody_preheader_i_111); - SelectInst* int32_tmp10_i_123 = new SelectInst(int1_tmp9_i_122, const_int32_31, int32_num_consts_109, "tmp10.i", label_forbody_preheader_i_111); - new BranchInst(label_forbody_i_112, label_forbody_preheader_i_111); - - // Block forbody.i (label_forbody_i_112) - Argument* fwdref_126 = new Argument(IntegerType::get(32)); - PHINode* int32_i_0_reg2mem_0_i_125 = new PHINode(IntegerType::get(32), "i.0.reg2mem.0.i", label_forbody_i_112); - int32_i_0_reg2mem_0_i_125->reserveOperandSpace(2); - int32_i_0_reg2mem_0_i_125->addIncoming(const_int32_29, label_forbody_preheader_i_111); - int32_i_0_reg2mem_0_i_125->addIncoming(fwdref_126, label_forbody_i_112); - - Argument* fwdref_128 = new Argument(VectorTy_1); - PHINode* packed_vec_0_reg2mem_0_i_127 = new PHINode(VectorTy_1, "vec.0.reg2mem.0.i", label_forbody_i_112); - packed_vec_0_reg2mem_0_i_127->reserveOperandSpace(2); - packed_vec_0_reg2mem_0_i_127->addIncoming(const_packed_32, label_forbody_preheader_i_111); - packed_vec_0_reg2mem_0_i_127->addIncoming(fwdref_128, label_forbody_i_112); - - std::vector ptr_arraydecay_i_129_indices; - ptr_arraydecay_i_129_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arraydecay_i_129_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay_i_129 = new GetElementPtrInst(ptr_aconsts_108, ptr_arraydecay_i_129_indices.begin(), ptr_arraydecay_i_129_indices.end(), "arraydecay.i", label_forbody_i_112); - LoadInst* float_tmp5_i_130 = new LoadInst(ptr_arraydecay_i_129, "tmp5.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp7_i_131 = new InsertElementInst(packed_vec_0_reg2mem_0_i_127, float_tmp5_i_130, const_int32_29, "tmp7.i", label_forbody_i_112); - std::vector ptr_arrayidx12_i_132_indices; - ptr_arrayidx12_i_132_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx12_i_132_indices.push_back(const_int32_31); - Instruction* ptr_arrayidx12_i_132 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx12_i_132_indices.begin(), ptr_arrayidx12_i_132_indices.end(), "arrayidx12.i", label_forbody_i_112); - LoadInst* float_tmp13_i_133 = new LoadInst(ptr_arrayidx12_i_132, "tmp13.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp15_i_134 = new InsertElementInst(packed_tmp7_i_131, float_tmp13_i_133, const_int32_31, "tmp15.i", label_forbody_i_112); - std::vector ptr_arrayidx20_i_135_indices; - ptr_arrayidx20_i_135_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx20_i_135_indices.push_back(const_int32_33); - Instruction* ptr_arrayidx20_i_135 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx20_i_135_indices.begin(), ptr_arrayidx20_i_135_indices.end(), "arrayidx20.i", label_forbody_i_112); - LoadInst* float_tmp21_i_136 = new LoadInst(ptr_arrayidx20_i_135, "tmp21.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp23_i_137 = new InsertElementInst(packed_tmp15_i_134, float_tmp21_i_136, const_int32_33, "tmp23.i", label_forbody_i_112); - std::vector ptr_arrayidx28_i_138_indices; - ptr_arrayidx28_i_138_indices.push_back(int32_i_0_reg2mem_0_i_125); - ptr_arrayidx28_i_138_indices.push_back(const_int32_34); - Instruction* ptr_arrayidx28_i_138 = new GetElementPtrInst(ptr_aconsts_108, ptr_arrayidx28_i_138_indices.begin(), ptr_arrayidx28_i_138_indices.end(), "arrayidx28.i", label_forbody_i_112); - LoadInst* float_tmp29_i_139 = new LoadInst(ptr_arrayidx28_i_138, "tmp29.i", false, label_forbody_i_112); - InsertElementInst* packed_tmp31_i_140 = new InsertElementInst(packed_tmp23_i_137, float_tmp29_i_139, const_int32_34, "tmp31.i", label_forbody_i_112); - std::vector ptr_arrayidx34_i_141_indices; - ptr_arrayidx34_i_141_indices.push_back(const_int32_29); - ptr_arrayidx34_i_141_indices.push_back(int32_i_0_reg2mem_0_i_125); - Instruction* ptr_arrayidx34_i_141 = new GetElementPtrInst(ptr_consts_114, ptr_arrayidx34_i_141_indices.begin(), ptr_arrayidx34_i_141_indices.end(), "arrayidx34.i", label_forbody_i_112); - StoreInst* void_142 = new StoreInst(packed_tmp31_i_140, ptr_arrayidx34_i_141, false, label_forbody_i_112); - BinaryOperator* int32_indvar_next7 = BinaryOperator::create(Instruction::Add, int32_i_0_reg2mem_0_i_125, const_int32_31, "indvar.next7", label_forbody_i_112); - ICmpInst* int1_exitcond8 = new ICmpInst(ICmpInst::ICMP_EQ, int32_indvar_next7, int32_tmp10_i_123, "exitcond8", label_forbody_i_112); - new BranchInst(label_from_consts_exit_113, label_forbody_i_112, int1_exitcond8, label_forbody_i_112); - - // Block from_consts.exit (label_from_consts_exit_113) - std::vector ptr_tmp3_indices; - ptr_tmp3_indices.push_back(const_int32_29); - ptr_tmp3_indices.push_back(const_int32_34); - Instruction* ptr_tmp3 = new GetElementPtrInst(ptr_args_116, ptr_tmp3_indices.begin(), ptr_tmp3_indices.end(), "tmp3", label_from_consts_exit_113); - std::vector ptr_arraydecay4_indices; - ptr_arraydecay4_indices.push_back(const_int32_29); - ptr_arraydecay4_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay4 = new GetElementPtrInst(ptr_consts_114, ptr_arraydecay4_indices.begin(), ptr_arraydecay4_indices.end(), "arraydecay4", label_from_consts_exit_113); - StoreInst* void_144 = new StoreInst(ptr_arraydecay4, ptr_tmp3, false, label_from_consts_exit_113); - std::vector ptr_tmp5_indices; - ptr_tmp5_indices.push_back(const_int32_29); - ptr_tmp5_indices.push_back(const_int32_33); - Instruction* ptr_tmp5 = new GetElementPtrInst(ptr_args_116, ptr_tmp5_indices.begin(), ptr_tmp5_indices.end(), "tmp5", label_from_consts_exit_113); - std::vector ptr_arraydecay6_indices; - ptr_arraydecay6_indices.push_back(const_int32_29); - ptr_arraydecay6_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay6 = new GetElementPtrInst(ptr_temps_115, ptr_arraydecay6_indices.begin(), ptr_arraydecay6_indices.end(), "arraydecay6", label_from_consts_exit_113); - StoreInst* void_145 = new StoreInst(ptr_arraydecay6, ptr_tmp5, false, label_from_consts_exit_113); - std::vector ptr_tmp8_indices; - ptr_tmp8_indices.push_back(const_int32_29); - ptr_tmp8_indices.push_back(const_int32_31); - Instruction* ptr_tmp8 = new GetElementPtrInst(ptr_args_116, ptr_tmp8_indices.begin(), ptr_tmp8_indices.end(), "tmp8", label_from_consts_exit_113); - std::vector ptr_tmp12_indices; - ptr_tmp12_indices.push_back(const_int32_29); - ptr_tmp12_indices.push_back(const_int32_29); - Instruction* ptr_tmp12 = new GetElementPtrInst(ptr_args_116, ptr_tmp12_indices.begin(), ptr_tmp12_indices.end(), "tmp12", label_from_consts_exit_113); - std::vector ptr_arraydecay11_146_indices; - ptr_arraydecay11_146_indices.push_back(const_int32_29); - ptr_arraydecay11_146_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_146 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_146_indices.begin(), ptr_arraydecay11_146_indices.end(), "arraydecay11", label_from_consts_exit_113); - StoreInst* void_147 = new StoreInst(ptr_arraydecay11_146, ptr_tmp8, false, label_from_consts_exit_113); - std::vector ptr_arraydecay16_indices; - ptr_arraydecay16_indices.push_back(const_int32_29); - ptr_arraydecay16_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_indices.begin(), ptr_arraydecay16_indices.end(), "arraydecay16", label_from_consts_exit_113); - StoreInst* void_148 = new StoreInst(ptr_arraydecay16, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_149 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_150 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_150->setCallingConv(CallingConv::C); - void_150->setTailCall(false);const ParamAttrsList *void_150_PAL = 0; - void_150->setParamAttrs(void_150_PAL); - - LoadInst* int32_tmp23 = new LoadInst(ptr_tmp_117, "tmp23", false, label_from_consts_exit_113); - std::vector ptr_arraydecay11_1_indices; - ptr_arraydecay11_1_indices.push_back(const_int32_31); - ptr_arraydecay11_1_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_1 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_1_indices.begin(), ptr_arraydecay11_1_indices.end(), "arraydecay11.1", label_from_consts_exit_113); - StoreInst* void_151 = new StoreInst(ptr_arraydecay11_1, ptr_tmp8, false, label_from_consts_exit_113); - std::vector ptr_arraydecay16_1_indices; - ptr_arraydecay16_1_indices.push_back(const_int32_31); - ptr_arraydecay16_1_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_1 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_1_indices.begin(), ptr_arraydecay16_1_indices.end(), "arraydecay16.1", label_from_consts_exit_113); - StoreInst* void_152 = new StoreInst(ptr_arraydecay16_1, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_153 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_154 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_154->setCallingConv(CallingConv::C); - void_154->setTailCall(false);const ParamAttrsList *void_154_PAL = 0; - void_154->setParamAttrs(void_154_PAL); - - LoadInst* int32_tmp23_1 = new LoadInst(ptr_tmp_117, "tmp23.1", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_1 = BinaryOperator::create(Instruction::Shl, int32_tmp23_1, const_int32_31, "shl.1", label_from_consts_exit_113); - BinaryOperator* int32_or_1 = BinaryOperator::create(Instruction::Or, int32_shl_1, int32_tmp23, "or.1", label_from_consts_exit_113); - std::vector ptr_arraydecay11_2_indices; - ptr_arraydecay11_2_indices.push_back(const_int32_33); - ptr_arraydecay11_2_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_2 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_2_indices.begin(), ptr_arraydecay11_2_indices.end(), "arraydecay11.2", label_from_consts_exit_113); - StoreInst* void_155 = new StoreInst(ptr_arraydecay11_2, ptr_tmp8, false, label_from_consts_exit_113); - std::vector ptr_arraydecay16_2_indices; - ptr_arraydecay16_2_indices.push_back(const_int32_33); - ptr_arraydecay16_2_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_2 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_2_indices.begin(), ptr_arraydecay16_2_indices.end(), "arraydecay16.2", label_from_consts_exit_113); - StoreInst* void_156 = new StoreInst(ptr_arraydecay16_2, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_157 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_158 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_158->setCallingConv(CallingConv::C); - void_158->setTailCall(false);const ParamAttrsList *void_158_PAL = 0; - void_158->setParamAttrs(void_158_PAL); - - LoadInst* int32_tmp23_2 = new LoadInst(ptr_tmp_117, "tmp23.2", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_2 = BinaryOperator::create(Instruction::Shl, int32_tmp23_2, const_int32_33, "shl.2", label_from_consts_exit_113); - BinaryOperator* int32_or_2 = BinaryOperator::create(Instruction::Or, int32_shl_2, int32_or_1, "or.2", label_from_consts_exit_113); - std::vector ptr_arraydecay11_3_indices; - ptr_arraydecay11_3_indices.push_back(const_int32_34); - ptr_arraydecay11_3_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay11_3 = new GetElementPtrInst(ptr_inputs_106, ptr_arraydecay11_3_indices.begin(), ptr_arraydecay11_3_indices.end(), "arraydecay11.3", label_from_consts_exit_113); - StoreInst* void_159 = new StoreInst(ptr_arraydecay11_3, ptr_tmp8, false, label_from_consts_exit_113); - std::vector ptr_arraydecay16_3_indices; - ptr_arraydecay16_3_indices.push_back(const_int32_34); - ptr_arraydecay16_3_indices.push_back(const_int32_29); - Instruction* ptr_arraydecay16_3 = new GetElementPtrInst(ptr_results_105, ptr_arraydecay16_3_indices.begin(), ptr_arraydecay16_3_indices.end(), "arraydecay16.3", label_from_consts_exit_113); - StoreInst* void_160 = new StoreInst(ptr_arraydecay16_3, ptr_tmp12, false, label_from_consts_exit_113); - StoreInst* void_161 = new StoreInst(const_int32_29, ptr_tmp_117, false, label_from_consts_exit_113); - CallInst* void_162 = new CallInst(func_execute_shader, ptr_args_116, "", label_from_consts_exit_113); - void_162->setCallingConv(CallingConv::C); - void_162->setTailCall(false);const ParamAttrsList *void_162_PAL = 0; - void_162->setParamAttrs(void_162_PAL); - - LoadInst* int32_tmp23_3 = new LoadInst(ptr_tmp_117, "tmp23.3", false, label_from_consts_exit_113); - BinaryOperator* int32_shl_3 = BinaryOperator::create(Instruction::Shl, int32_tmp23_3, const_int32_34, "shl.3", label_from_consts_exit_113); - BinaryOperator* int32_or_3 = BinaryOperator::create(Instruction::Or, int32_shl_3, int32_or_2, "or.3", label_from_consts_exit_113); - BinaryOperator* int32_neg = BinaryOperator::create(Instruction::Xor, int32_or_3, const_int32_30, "neg", label_from_consts_exit_113); - new ReturnInst(int32_neg, label_from_consts_exit_113); - - // Resolve Forward References - fwdref_128->replaceAllUsesWith(packed_tmp31_i_140); delete fwdref_128; - fwdref_126->replaceAllUsesWith(int32_indvar_next7); delete fwdref_126; - - } - - return mod; -} diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c deleted file mode 100644 index fa50b60e663..00000000000 --- a/src/mesa/pipe/llvm/llvm_entry.c +++ /dev/null @@ -1,163 +0,0 @@ -/* clang --emit-llvm llvm_entry.c |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -funcname=createBaseShader */ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - /* - * Authors: - * Zack Rusin zack@tungstengraphics.com - */ - -/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm-dis */ -typedef __attribute__(( ocu_vector_type(4) )) float float4; - -void from_array(float4 (*res)[16], float (*ainputs)[16][4], - int count, int num_attribs) -{ - for (int i = 0; i < count; ++i) { - for (int j = 0; j < num_attribs; ++j) { - float4 vec; - vec.x = ainputs[i][j][0]; - vec.y = ainputs[i][j][1]; - vec.z = ainputs[i][j][2]; - vec.w = ainputs[i][j][3]; - res[i][j] = vec; - } - } -} - -void from_consts(float4 *res, float (*ainputs)[4], - int count) -{ - for (int i = 0; i < count; ++i) { - float4 vec; - vec.x = ainputs[i][0]; - vec.y = ainputs[i][1]; - vec.z = ainputs[i][2]; - vec.w = ainputs[i][3]; - res[i] = vec; - } -} - -void to_array(float (*dests)[4], float4 *in, int num_attribs) -{ - for (int i = 0; i < num_attribs; ++i) { - float *rd = dests[i]; - float4 ri = in[i]; - rd[0] = ri.x; - rd[1] = ri.y; - rd[2] = ri.z; - rd[3] = ri.w; - } -} - - -struct ShaderInput -{ - float4 *dests; - float4 *inputs; - float4 *temps; - float4 *consts; - int kilmask; -}; - -extern void execute_shader(struct ShaderInput *input); - -void run_vertex_shader(void *inputs, - void *results, - float (*aconsts)[4], - int num_vertices, - int num_inputs, - int num_attribs, - int num_consts) -{ - float4 consts[32]; - float4 temps[128];//MAX_PROGRAM_TEMPS - - struct ShaderInput args; - args.dests = results; - args.inputs = inputs; - - /*printf("XXX LLVM run_vertex_shader vertices = %d, inputs = %d, attribs = %d, consts = %d\n", - num_vertices, num_inputs, num_attribs, num_consts);*/ - from_consts(consts, aconsts, num_consts); - args.consts = consts; - args.temps = temps; - - execute_shader(&args); -} - - -struct pipe_sampler_state; -struct softpipe_tile_cache; - -#define NUM_CHANNELS 4 /* R,G,B,A */ -#define QUAD_SIZE 4 /* 4 pixel/quad */ - -struct tgsi_sampler -{ - const struct pipe_sampler_state *state; - /** Get samples for four fragments in a quad */ - void (*get_samples)(struct tgsi_sampler *sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]); - void *pipe; /*XXX temporary*/ - struct softpipe_tile_cache *cache; -}; - - -int run_fragment_shader(float x, float y, - float4 (*results)[16], - float4 (*inputs)[16], - int num_inputs, - float (*aconsts)[4], - int num_consts, - struct tgsi_sampler *samplers) -{ - float4 consts[32]; - float4 temps[128];//MAX_PROGRAM_TEMPS - struct ShaderInput args; - int mask = 0; - args.kilmask = 0; - - from_consts(consts, aconsts, num_consts); - args.consts = consts; - args.temps = temps; - //printf("AAAAAAAAAAAAAAAAAAAAAAA FRAGMENT SHADER %f %f\n", x, y); - for (int i = 0; i < 4; ++i) { - args.inputs = inputs[i]; - args.dests = results[i]; - mask = args.kilmask; - args.kilmask = 0; - execute_shader(&args); - args.kilmask = mask | (args.kilmask << i); - } - return ~args.kilmask; -} - diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 3497eebcd97..20fce9c9cc6 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -44,7 +44,6 @@ #include using namespace llvm; -#include "llvm_base_shader.cpp" static inline FunctionType *vertexShaderFunctionType() { @@ -1074,7 +1073,7 @@ translate_instructionir(llvm::Module *module, llvm::Module * tgsi_to_llvm(struct gallivm_ir *ir, const struct tgsi_token *tokens) { - llvm::Module *mod = createBaseShader(); + llvm::Module *mod = new Module("shader"); struct tgsi_parse_context parse; struct tgsi_full_instruction fi; struct tgsi_full_declaration fd; From 2e75f39bc4286cebb7330f54d7acf5b8f1d9777f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 09:26:56 -0500 Subject: [PATCH 19/74] make swizzling on incoming arguments work --- src/mesa/pipe/llvm/storagesoa.cpp | 54 ++++++++++++++++++++++++------- src/mesa/pipe/llvm/storagesoa.h | 21 ++++++++---- src/mesa/pipe/llvm/tgsitollvm.cpp | 15 ++++++--- 3 files changed, 67 insertions(+), 23 deletions(-) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 7b758b1665c..a65b5c14d9f 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -27,6 +27,7 @@ #include "storagesoa.h" +#include "gallivm_p.h" #include "pipe/p_shader_tokens.h" #include @@ -87,8 +88,7 @@ llvm::Value *StorageSoa::addrElement(int idx) const return 0; } -std::vector StorageSoa::inputElement(int idx, int swizzle, - llvm::Value *indIdx) +std::vector StorageSoa::inputElement(int idx, llvm::Value *indIdx) { std::vector res(4); @@ -100,8 +100,7 @@ std::vector StorageSoa::inputElement(int idx, int swizzle, return res; } -std::vector StorageSoa::constElement(int idx, int swizzle, - llvm::Value *indIdx) +std::vector StorageSoa::constElement(int idx, llvm::Value *indIdx) { std::vector res(4); llvm::Value *xChannel = elementPointer(m_consts, idx, 0); @@ -117,8 +116,7 @@ std::vector StorageSoa::constElement(int idx, int swizzle, return res; } -std::vector StorageSoa::outputElement(int idx, int swizzle, - llvm::Value *indIdx) +std::vector StorageSoa::outputElement(int idx, llvm::Value *indIdx) { std::vector res(4); @@ -130,8 +128,7 @@ std::vector StorageSoa::outputElement(int idx, int swizzle, return res; } -std::vector StorageSoa::tempElement(int idx, int swizzle, - llvm::Value *indIdx) +std::vector StorageSoa::tempElement(int idx, llvm::Value *indIdx) { std::vector res(4); @@ -143,15 +140,15 @@ std::vector StorageSoa::tempElement(int idx, int swizzle, return res; } -std::vector StorageSoa::immediateElement(int idx, int swizzle) +std::vector StorageSoa::immediateElement(int idx) { std::vector res(4); res = m_immediates[idx]; res[0] = new LoadInst(res[0], name("immx"), false, m_block); - res[1] = new LoadInst(res[1], name("immx"), false, m_block); - res[2] = new LoadInst(res[2], name("immx"), false, m_block); - res[3] = new LoadInst(res[3], name("immx"), false, m_block); + res[1] = new LoadInst(res[1], name("immy"), false, m_block); + res[2] = new LoadInst(res[2], name("immz"), false, m_block); + res[3] = new LoadInst(res[3], name("immw"), false, m_block); return res; } @@ -291,3 +288,36 @@ llvm::Value * StorageSoa::createConstGlobalVector(float *vec) return immediate; } + +std::vector StorageSoa::argument(Argument type, int idx, int swizzle, + llvm::Value *indIdx ) +{ + std::vector val(4); + switch(type) { + case Input: + val = inputElement(idx, indIdx); + break; + case Output: + val = outputElement(idx, indIdx); + break; + case Temp: + val = tempElement(idx, indIdx); + break; + case Const: + val = constElement(idx, indIdx); + break; + case Immediate: + val = immediateElement(idx); + break; + } + if (!gallivm_is_swizzle(swizzle)) + return val; + + std::vector res(4); + + res[0] = val[gallivm_x_swizzle(swizzle)]; + res[1] = val[gallivm_y_swizzle(swizzle)]; + res[2] = val[gallivm_z_swizzle(swizzle)]; + res[3] = val[gallivm_w_swizzle(swizzle)]; + return res; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 2d07e836f4b..9443234c82f 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -43,6 +43,14 @@ namespace llvm { class StorageSoa { +public: + enum Argument { + Input, + Output, + Temp, + Const, + Immediate + }; public: StorageSoa(llvm::BasicBlock *block, llvm::Value *input, @@ -50,16 +58,12 @@ public: llvm::Value *consts, llvm::Value *temps); + std::vector argument(Argument type, int idx, int swizzle, + llvm::Value *indIdx =0); void addImmediate(float *vec); llvm::Value * addrElement(int idx) const; - std::vector inputElement(int idx, int swizzle, llvm::Value *indIdx =0); - std::vector constElement(int idx, int swizzle, llvm::Value *indIdx =0); - std::vector outputElement(int idx, int swizzle, llvm::Value *indIdx =0); - std::vector tempElement(int idx, int swizzle, llvm::Value *indIdx =0); - std::vector immediateElement(int idx, int swizzle); - llvm::Value *extractIndex(llvm::Value *vec); void storeOutput(int dstIdx, const std::vector &val, @@ -79,6 +83,11 @@ private: llvm::Module *currentModule() const; llvm::Value *createConstGlobalVector(float *vec); + std::vector inputElement(int idx, llvm::Value *indIdx =0); + std::vector constElement(int idx, llvm::Value *indIdx =0); + std::vector outputElement(int idx, llvm::Value *indIdx =0); + std::vector tempElement(int idx, llvm::Value *indIdx =0); + std::vector immediateElement(int idx); private: llvm::BasicBlock *m_block; diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 20fce9c9cc6..10c417996ae 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -706,15 +706,20 @@ translate_instructionir(llvm::Module *module, indIdx = storage->extractIndex(indIdx); } if (src->SrcRegister.File == TGSI_FILE_CONSTANT) { - val = storage->constElement(src->SrcRegister.Index, swizzle, indIdx); + val = storage->argument(StorageSoa::Const, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_INPUT) { - val = storage->inputElement(src->SrcRegister.Index, swizzle, indIdx); + val = storage->argument(StorageSoa::Input, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) { - val = storage->tempElement(src->SrcRegister.Index, swizzle); + val = storage->argument(StorageSoa::Temp, + src->SrcRegister.Index, swizzle); } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) { - val = storage->outputElement(src->SrcRegister.Index, swizzle, indIdx); + val = storage->argument(StorageSoa::Output, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_IMMEDIATE) { - val = storage->immediateElement(src->SrcRegister.Index, swizzle); + val = storage->argument(StorageSoa::Immediate, + src->SrcRegister.Index, swizzle); } else { fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File); return; From a856b399e6a46f2026006402bc6b9125bd23f9a9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 13 Feb 2008 18:29:29 +0000 Subject: [PATCH 20/74] x86: fix assignment in assert typo --- src/mesa/x86/rtasm/x86sse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index 1111e8db990..39c0e9b851a 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -820,7 +820,7 @@ static void x87_arith_op( struct x86_function *p, struct x86_reg dst, struct x86 assert(0); } else if (dst.idx == 0) { - assert(arg.file = file_REG32); + assert(arg.file == file_REG32); emit_1ub(p, 0xd8); emit_modrm_noreg(p, argmem_noreg, arg); } From f3f7ff257370ff72dbc7a0ba05ed0a99ce67ebac Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Feb 2008 12:14:46 +0000 Subject: [PATCH 21/74] tgsi: partially unbreak sse fragment shaders. more to do. --- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 1e56e4afb69..1d9e9a14ce0 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -2169,14 +2169,6 @@ emit_declaration( last = decl->u.DeclarationRange.Last; mask = decl->Declaration.UsageMask; - /* Do not touch WPOS.xy */ - if( first == 0 ) { - mask &= ~TGSI_WRITEMASK_XY; - if( mask == TGSI_WRITEMASK_NONE ) { - first++; - } - } - for( i = first; i <= last; i++ ) { for( j = 0; j < NUM_CHANNELS; j++ ) { if( mask & (1 << j) ) { From 18e94e15c0ca881309ac5784075a04160cc1eeb6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Feb 2008 13:36:21 +0000 Subject: [PATCH 22/74] gallium: Minor cleanups to bitfield sizes, etc. --- src/mesa/pipe/p_state.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h index 4d3a6b2f413..1082343e2f5 100644 --- a/src/mesa/pipe/p_state.h +++ b/src/mesa/pipe/p_state.h @@ -253,7 +253,8 @@ struct pipe_surface unsigned status; /**< PIPE_SURFACE_STATUS_x */ unsigned clear_value; /**< may be temporary */ unsigned cpp; /**< bytes per pixel */ - unsigned width, height; + unsigned width; + unsigned height; unsigned pitch; /**< in pixels */ unsigned offset; /**< offset from start of buffer, in bytes */ unsigned refcount; @@ -272,13 +273,12 @@ struct pipe_texture enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ enum pipe_format format; /**< PIPE_FORMAT_x */ - unsigned last_level; /**< Index of last mipmap level present/defined */ - unsigned width[PIPE_MAX_TEXTURE_LEVELS]; unsigned height[PIPE_MAX_TEXTURE_LEVELS]; unsigned depth[PIPE_MAX_TEXTURE_LEVELS]; - unsigned cpp; + unsigned cpp:8; + unsigned last_level:8; /**< Index of last mipmap level present/defined */ unsigned compressed:1; /* These are also refcounted: @@ -294,7 +294,7 @@ struct pipe_texture */ struct pipe_vertex_buffer { - unsigned pitch:11; /**< stride to same attrib in next vertex, in bytes */ + unsigned pitch; /**< stride to same attrib in next vertex, in bytes */ unsigned max_index; /**< number of vertices in this buffer */ unsigned buffer_offset; /**< offset to start of data in buffer, in bytes */ struct pipe_buffer *buffer; /**< the actual buffer */ @@ -307,13 +307,13 @@ struct pipe_vertex_buffer struct pipe_vertex_element { /** Offset of this attribute, in bytes, from the start of the vertex */ - unsigned src_offset:11; + unsigned src_offset; /** Which vertex_buffer (as given to pipe->set_vertex_buffer()) does * this attribute live in? */ - unsigned vertex_buffer_index:5; - unsigned nr_components:3; + unsigned vertex_buffer_index:8; + unsigned nr_components:8; enum pipe_format src_format; /**< PIPE_FORMAT_* */ }; From cf5ef20f436ac1d3efde2b7bff698decccb029e3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 14 Feb 2008 16:53:51 +0000 Subject: [PATCH 23/74] gallium: Cleanups related to clears. --- src/mesa/state_tracker/st_cb_clear.c | 117 +++++++++++++++++++-------- 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 410062e1e80..78baf772f44 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -272,6 +272,14 @@ clear_with_quad(GLcontext *ctx, const GLfloat x1 = ctx->DrawBuffer->_Xmax; const GLfloat y1 = ctx->DrawBuffer->_Ymax; + /* + printf("%s %s%s%s %f,%f %f,%f\n", __FUNCTION__, + color ? "color, " : "", + depth ? "depth, " : "", + stencil ? "stencil" : "", + x0, y0, + x1, y1); + */ /* blend state: RGBA masking */ { @@ -389,13 +397,44 @@ clear_with_quad(GLcontext *ctx, * Determine if we need to clear the depth buffer by drawing a quad. */ static INLINE GLboolean -check_clear_color_with_quad(GLcontext *ctx) +check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { - return !(ctx->Color.ColorMask[0] && - ctx->Color.ColorMask[1] && - ctx->Color.ColorMask[2] && - ctx->Color.ColorMask[3] && - !ctx->Scissor.Enabled); + const struct st_renderbuffer *strb = st_renderbuffer(rb); + + if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) + return FALSE; + + if (ctx->Scissor.Enabled) + return TRUE; + + if (!ctx->Color.ColorMask[0] || + !ctx->Color.ColorMask[1] || + !ctx->Color.ColorMask[2] || + !ctx->Color.ColorMask[3]) + return TRUE; + + return FALSE; +} + + +static INLINE GLboolean +check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) +{ + const struct st_renderbuffer *strb = st_renderbuffer(rb); + const GLuint stencilMax = (1 << rb->StencilBits) - 1; + GLboolean maskStencil + = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; + + if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) + return FALSE; + + if (ctx->Scissor.Enabled) + return TRUE; + + if (maskStencil) + return TRUE; + + return FALSE; } @@ -407,10 +446,19 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); const GLboolean isDS = is_depth_stencil_format(strb->surface->format); - return ctx->Scissor.Enabled - || (isDS && - strb->surface->status == PIPE_SURFACE_STATUS_DEFINED && - ctx->DrawBuffer->Visual.stencilBits > 0); + + if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) + return FALSE; + + if (ctx->Scissor.Enabled) + return TRUE; + + if (isDS && + strb->surface->status == PIPE_SURFACE_STATUS_DEFINED && + ctx->DrawBuffer->Visual.stencilBits > 0) + return TRUE; + + return FALSE; } @@ -425,9 +473,27 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) const GLuint stencilMax = (1 << rb->StencilBits) - 1; const GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; - return maskStencil - || ctx->Scissor.Enabled - || (isDS && ctx->DrawBuffer->Visual.depthBits > 0); + + if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED) + return FALSE; + + if (maskStencil) + return TRUE; + + if (ctx->Scissor.Enabled) + return TRUE; + + /* This is correct, but it is necessary to look at the depth clear + * value held in the surface when it comes time to issue the clear, + * rather than taking depth and stencil clear values from the + * current state. + */ + if (isDS && + strb->surface->status == PIPE_SURFACE_STATUS_DEFINED && + ctx->DrawBuffer->Visual.depthBits > 0) + return TRUE; + + return FALSE; } @@ -436,14 +502,10 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) static void clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { - struct st_renderbuffer *strb = st_renderbuffer(rb); - - if (ctx->Color.ColorMask[0] && - ctx->Color.ColorMask[1] && - ctx->Color.ColorMask[2] && - ctx->Color.ColorMask[3] && - !ctx->Scissor.Enabled) + if (!check_clear_color_with_quad( ctx, rb )) { + struct st_renderbuffer *strb = st_renderbuffer(rb); + /* clear whole buffer w/out masking */ GLuint clearValue = color_value(strb->surface->format, ctx->Color.ClearColor); @@ -482,14 +544,8 @@ static void clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLboolean isDS = is_depth_stencil_format(strb->surface->format); - const GLuint stencilMax = (1 << rb->StencilBits) - 1; - GLboolean maskStencil - = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; - if (maskStencil || - ctx->Scissor.Enabled || - (isDS && ctx->DrawBuffer->Visual.depthBits > 0)) { + if (check_clear_stencil_with_quad(ctx, rb)) { /* masking or scissoring or combined depth/stencil buffer */ clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE); } @@ -505,13 +561,10 @@ static void clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) { struct st_renderbuffer *strb = st_renderbuffer(rb); - const GLuint stencilMax = (1 << rb->StencilBits) - 1; - GLboolean maskStencil - = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; assert(is_depth_stencil_format(strb->surface->format)); - if (!maskStencil && !ctx->Scissor.Enabled) { + if (check_clear_depth_stencil_with_quad(ctx, rb)) { /* clear whole buffer w/out masking */ GLuint clearValue = depth_value(strb->surface->format, ctx->Depth.Clear); @@ -520,7 +573,7 @@ clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) clearValue |= ctx->Stencil.Clear << 24; break; case PIPE_FORMAT_Z24S8_UNORM: - clearValue |= clearValue | ctx->Stencil.Clear; + clearValue |= ctx->Stencil.Clear; break; default: assert(0); From 0230c56ed0db16f007e4d1881554c7dbfa3ac3de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 14 Feb 2008 17:42:52 +0000 Subject: [PATCH 24/74] intel_winsys: Call st_notify_swapbuffers_complete() after buffer swap. --- src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c index 454cd71f6c0..56b86d6a636 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c @@ -220,6 +220,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) if (back_surf) { st_notify_swapbuffers(intel_fb->stfb); intelDisplaySurface(dPriv, back_surf, NULL); + st_notify_swapbuffers_complete(intel_fb->stfb); } } From c2903679856856e3758ceb744cd7d91af9e2eb45 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 11 Feb 2008 15:27:13 -0800 Subject: [PATCH 25/74] Vectorize a couple fetch functions These C-coded vectorized functions are expected to be short lived. They're basically a proof-of-concept for dynamically generated fetch routines. --- src/mesa/pipe/cell/spu/spu_vertex_fetch.c | 46 +++++++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c index 6e86a919ce4..ec10bb99df0 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c +++ b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c @@ -46,6 +46,48 @@ static const vec_float4 defaults = { 0.0, 0.0, 0.0, 1.0 }; +static INLINE qword +fetch_unaligned_qword(const void *ptr) +{ + const int shift = (unsigned)(ptr) & 0x0f; + const qword x = *(qword *)(ptr); + const qword y = *(qword *)(ptr + 16); + + return si_or((qword) spu_slqwbyte(x, shift), + (qword) spu_rlmaskqwbyte(y, shift - 16)); +} + +static qword +fetch_R32G32B32A32_FLOAT(const void *ptr) +{ + return fetch_unaligned_qword(ptr); +} + + +static qword +fetch_R32G32B32A32_USCALED(const void *ptr) +{ + return si_cuflt(fetch_unaligned_qword(ptr), 0); +} + + +static qword +fetch_R32G32B32A32_UNORM(const void *ptr) +{ + qword x = si_cuflt(fetch_unaligned_qword(ptr), 0); + vec_float4 scale = spu_splats(1.0f / 255.0f); + + return si_fm(x, (qword) scale); +} + + +static qword +fetch_R32G32B32A32_SSCALED(const void *ptr) +{ + return si_csflt(fetch_unaligned_qword(ptr), 0); +} + + /** * Fetch a float[4] vertex attribute from memory, doing format/type * conversion as needed. @@ -90,22 +132,18 @@ FETCH_ATTRIB( R64G64B64_FLOAT, 3, CVT_64_FLOAT ) FETCH_ATTRIB( R64G64_FLOAT, 2, CVT_64_FLOAT ) FETCH_ATTRIB( R64_FLOAT, 1, CVT_64_FLOAT ) -FETCH_ATTRIB( R32G32B32A32_FLOAT, 4, CVT_32_FLOAT ) FETCH_ATTRIB( R32G32B32_FLOAT, 3, CVT_32_FLOAT ) FETCH_ATTRIB( R32G32_FLOAT, 2, CVT_32_FLOAT ) FETCH_ATTRIB( R32_FLOAT, 1, CVT_32_FLOAT ) -FETCH_ATTRIB( R32G32B32A32_USCALED, 4, CVT_32_USCALED ) FETCH_ATTRIB( R32G32B32_USCALED, 3, CVT_32_USCALED ) FETCH_ATTRIB( R32G32_USCALED, 2, CVT_32_USCALED ) FETCH_ATTRIB( R32_USCALED, 1, CVT_32_USCALED ) -FETCH_ATTRIB( R32G32B32A32_SSCALED, 4, CVT_32_SSCALED ) FETCH_ATTRIB( R32G32B32_SSCALED, 3, CVT_32_SSCALED ) FETCH_ATTRIB( R32G32_SSCALED, 2, CVT_32_SSCALED ) FETCH_ATTRIB( R32_SSCALED, 1, CVT_32_SSCALED ) -FETCH_ATTRIB( R32G32B32A32_UNORM, 4, CVT_32_UNORM ) FETCH_ATTRIB( R32G32B32_UNORM, 3, CVT_32_UNORM ) FETCH_ATTRIB( R32G32_UNORM, 2, CVT_32_UNORM ) FETCH_ATTRIB( R32_UNORM, 1, CVT_32_UNORM ) From ca1a2da645bceb4500f1782cdfcb686db24ecba7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 12 Feb 2008 11:16:38 -0800 Subject: [PATCH 26/74] Initial pass at vertex cache, more vertex fetch changes This is just another step towards dynamic generate of vertex fetch code. --- src/mesa/pipe/cell/spu/spu_vertex_fetch.c | 484 ++++++++++++++++----- src/mesa/pipe/cell/spu/spu_vertex_shader.h | 3 +- 2 files changed, 368 insertions(+), 119 deletions(-) diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c index ec10bb99df0..f6ffcae90ec 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c +++ b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c @@ -40,41 +40,83 @@ #include "spu_vertex_shader.h" #include "spu_main.h" +#define CACHE_NAME attribute +#define CACHED_TYPE qword +#define CACHE_TYPE CACHE_TYPE_RO +#define CACHE_SET_TAGID(set) TAG_VERTEX_BUFFER +#define CACHE_LOG2NNWAY 2 +#define CACHE_LOG2NSETS 6 +#include + +/* Yes folks, this is ugly. + */ +#undef CACHE_NWAY +#undef CACHE_NSETS +#define CACHE_NAME attribute +#define CACHE_NWAY 4 +#define CACHE_NSETS (1U << 6) + #define DRAW_DBG 0 static const vec_float4 defaults = { 0.0, 0.0, 0.0, 1.0 }; -static INLINE qword -fetch_unaligned_qword(const void *ptr) +/** + * Fetch between 1 and 32 bytes from an unaligned address + */ +static INLINE void +fetch_unaligned(qword *dst, unsigned ea, unsigned size) { - const int shift = (unsigned)(ptr) & 0x0f; - const qword x = *(qword *)(ptr); - const qword y = *(qword *)(ptr + 16); + qword tmp[4]; + const int shift = ea & 0x0f; + const unsigned aligned_start_ea = ea & ~0x0f; + const unsigned aligned_end_ea = (ea + size) & ~0x0f; + const unsigned num_entries = ((aligned_end_ea - aligned_start_ea) / 16) + 1; + unsigned i; - return si_or((qword) spu_slqwbyte(x, shift), - (qword) spu_rlmaskqwbyte(y, shift - 16)); + + if (shift == 0) { + /* Data is already aligned. Fetch directly into the destination buffer. + */ + for (i = 0; i < num_entries; i++) { + dst[i] = cache_rd(attribute, (ea & ~0x0f) + (i * 16)); + } + } else { + /* Fetch data from the cache to the local buffer. + */ + for (i = 0; i < num_entries; i++) { + tmp[i] = cache_rd(attribute, (ea & ~0x0f) + (i * 16)); + } + + + /* Fix the alignment of the data and write to the destination buffer. + */ + for (i = 0; i < ((size + 15) / 16); i++) { + dst[i] = si_or((qword) spu_slqwbyte(tmp[i], shift), + (qword) spu_rlmaskqwbyte(tmp[i + 1], shift - 16)); + } + } } static qword -fetch_R32G32B32A32_FLOAT(const void *ptr) +fetch_R32G32B32A32_FLOAT(const qword *qw) { - return fetch_unaligned_qword(ptr); + return *qw; } static qword -fetch_R32G32B32A32_USCALED(const void *ptr) +fetch_R32G32B32A32_USCALED(const qword *qw) { - return si_cuflt(fetch_unaligned_qword(ptr), 0); + return si_cuflt(*qw, 0); } static qword -fetch_R32G32B32A32_UNORM(const void *ptr) +fetch_R32G32B32A32_UNORM(const qword *qw) { - qword x = si_cuflt(fetch_unaligned_qword(ptr), 0); + qword x = si_cuflt(*qw, 0); vec_float4 scale = spu_splats(1.0f / 255.0f); return si_fm(x, (qword) scale); @@ -82,12 +124,147 @@ fetch_R32G32B32A32_UNORM(const void *ptr) static qword -fetch_R32G32B32A32_SSCALED(const void *ptr) +fetch_R32G32B32A32_SSCALED(const qword *qw) { - return si_csflt(fetch_unaligned_qword(ptr), 0); + return si_csflt(*qw, 0); } +#define CVT_32_FLOAT(q) (*q) + +static INLINE qword +CVT_64_FLOAT(const qword *qw) +{ + qword shuf_first = (qword) { + 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + }; + + qword a = si_frds(qw[0]); + qword b = si_frds(si_rotqbyi(qw[0], 8)); + qword c = si_frds(qw[1]); + qword d = si_frds(si_rotqbyi(qw[1], 8)); + + qword ab = si_shufb(a, b, shuf_first); + qword cd = si_shufb(c, d, si_rotqbyi(shuf_first, 8)); + + return si_or(ab, cd); +} + + +static INLINE qword +CVT_8_USCALED(const qword *qw) +{ + qword shuffle = (qword) { + 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80, + 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80, + }; + + return si_cuflt(si_shufb(*qw, *qw, shuffle), 0); +} + + +static INLINE qword +CVT_16_USCALED(const qword *qw) +{ + qword shuffle = (qword) { + 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80, + 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80, + }; + + return si_cuflt(si_shufb(*qw, *qw, shuffle), 0); +} + + +static INLINE qword +CVT_32_USCALED(const qword *qw) +{ + return si_cuflt(*qw, 0); +} + +static INLINE qword +CVT_8_SSCALED(const qword *qw) +{ + qword shuffle = (qword) { + 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80, + 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80, + }; + + return si_csflt(si_shufb(*qw, *qw, shuffle), 0); +} + + +static INLINE qword +CVT_16_SSCALED(const qword *qw) +{ + qword shuffle = (qword) { + 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80, + 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80, + }; + + return si_csflt(si_shufb(*qw, *qw, shuffle), 0); +} + + +static INLINE qword +CVT_32_SSCALED(const qword *qw) +{ + return si_csflt(*qw, 0); +} + + +static INLINE qword +CVT_8_UNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 255.0f); + return si_fm(CVT_8_USCALED(qw), scale); +} + + +static INLINE qword +CVT_16_UNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 65535.0f); + return si_fm(CVT_16_USCALED(qw), scale); +} + + +static INLINE qword +CVT_32_UNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 4294967295.0f); + return si_fm(CVT_32_USCALED(qw), scale); +} + + +static INLINE qword +CVT_8_SNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 127.0f); + return si_fm(CVT_8_SSCALED(qw), scale); +} + + +static INLINE qword +CVT_16_SNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 32767.0f); + return si_fm(CVT_16_SSCALED(qw), scale); +} + + +static INLINE qword +CVT_32_SNORM(const qword *qw) +{ + const qword scale = (qword) spu_splats(1.0f / 2147483647.0f); + return si_fm(CVT_32_SSCALED(qw), scale); +} + +#define SZ_4 si_il(0U) +#define SZ_3 si_rotqmbyi(si_il(~0), -12) +#define SZ_2 si_rotqmbyi(si_il(~0), -8) +#define SZ_1 si_rotqmbyi(si_il(~0), -4) + /** * Fetch a float[4] vertex attribute from memory, doing format/type * conversion as needed. @@ -97,117 +274,84 @@ fetch_R32G32B32A32_SSCALED(const void *ptr) */ #define FETCH_ATTRIB( NAME, SZ, CVT ) \ static qword \ -fetch_##NAME(const void *ptr) \ +fetch_##NAME(const qword *qw) \ { \ - vec_float4 attrib = defaults; \ - int i; \ - \ - for (i = 0; i < SZ; i++) { \ - attrib = spu_insert(CVT, attrib, i); \ - } \ - return (qword) attrib; \ + qword expanded = CVT(qw); \ + return si_selb(expanded, (qword) defaults, SZ); \ } -#define CVT_64_FLOAT (float) ((double *) ptr)[i] -#define CVT_32_FLOAT ((float *) ptr)[i] +FETCH_ATTRIB( R64G64B64A64_FLOAT, SZ_4, CVT_64_FLOAT ) +FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT ) +FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT ) +FETCH_ATTRIB( R64_FLOAT, SZ_1, CVT_64_FLOAT ) -#define CVT_8_USCALED (float) ((unsigned char *) ptr)[i] -#define CVT_16_USCALED (float) ((unsigned short *) ptr)[i] -#define CVT_32_USCALED (float) ((unsigned int *) ptr)[i] +FETCH_ATTRIB( R32G32B32_FLOAT, SZ_3, CVT_32_FLOAT ) +FETCH_ATTRIB( R32G32_FLOAT, SZ_2, CVT_32_FLOAT ) +FETCH_ATTRIB( R32_FLOAT, SZ_1, CVT_32_FLOAT ) -#define CVT_8_SSCALED (float) ((char *) ptr)[i] -#define CVT_16_SSCALED (float) ((short *) ptr)[i] -#define CVT_32_SSCALED (float) ((int *) ptr)[i] +FETCH_ATTRIB( R32G32B32_USCALED, SZ_3, CVT_32_USCALED ) +FETCH_ATTRIB( R32G32_USCALED, SZ_2, CVT_32_USCALED ) +FETCH_ATTRIB( R32_USCALED, SZ_1, CVT_32_USCALED ) -#define CVT_8_UNORM (float) ((unsigned char *) ptr)[i] / 255.0f -#define CVT_16_UNORM (float) ((unsigned short *) ptr)[i] / 65535.0f -#define CVT_32_UNORM (float) ((unsigned int *) ptr)[i] / 4294967295.0f +FETCH_ATTRIB( R32G32B32_SSCALED, SZ_3, CVT_32_SSCALED ) +FETCH_ATTRIB( R32G32_SSCALED, SZ_2, CVT_32_SSCALED ) +FETCH_ATTRIB( R32_SSCALED, SZ_1, CVT_32_SSCALED ) -#define CVT_8_SNORM (float) ((char *) ptr)[i] / 127.0f -#define CVT_16_SNORM (float) ((short *) ptr)[i] / 32767.0f -#define CVT_32_SNORM (float) ((int *) ptr)[i] / 2147483647.0f +FETCH_ATTRIB( R32G32B32_UNORM, SZ_3, CVT_32_UNORM ) +FETCH_ATTRIB( R32G32_UNORM, SZ_2, CVT_32_UNORM ) +FETCH_ATTRIB( R32_UNORM, SZ_1, CVT_32_UNORM ) -FETCH_ATTRIB( R64G64B64A64_FLOAT, 4, CVT_64_FLOAT ) -FETCH_ATTRIB( R64G64B64_FLOAT, 3, CVT_64_FLOAT ) -FETCH_ATTRIB( R64G64_FLOAT, 2, CVT_64_FLOAT ) -FETCH_ATTRIB( R64_FLOAT, 1, CVT_64_FLOAT ) +FETCH_ATTRIB( R32G32B32A32_SNORM, SZ_4, CVT_32_SNORM ) +FETCH_ATTRIB( R32G32B32_SNORM, SZ_3, CVT_32_SNORM ) +FETCH_ATTRIB( R32G32_SNORM, SZ_2, CVT_32_SNORM ) +FETCH_ATTRIB( R32_SNORM, SZ_1, CVT_32_SNORM ) -FETCH_ATTRIB( R32G32B32_FLOAT, 3, CVT_32_FLOAT ) -FETCH_ATTRIB( R32G32_FLOAT, 2, CVT_32_FLOAT ) -FETCH_ATTRIB( R32_FLOAT, 1, CVT_32_FLOAT ) +FETCH_ATTRIB( R16G16B16A16_USCALED, SZ_4, CVT_16_USCALED ) +FETCH_ATTRIB( R16G16B16_USCALED, SZ_3, CVT_16_USCALED ) +FETCH_ATTRIB( R16G16_USCALED, SZ_2, CVT_16_USCALED ) +FETCH_ATTRIB( R16_USCALED, SZ_1, CVT_16_USCALED ) -FETCH_ATTRIB( R32G32B32_USCALED, 3, CVT_32_USCALED ) -FETCH_ATTRIB( R32G32_USCALED, 2, CVT_32_USCALED ) -FETCH_ATTRIB( R32_USCALED, 1, CVT_32_USCALED ) +FETCH_ATTRIB( R16G16B16A16_SSCALED, SZ_4, CVT_16_SSCALED ) +FETCH_ATTRIB( R16G16B16_SSCALED, SZ_3, CVT_16_SSCALED ) +FETCH_ATTRIB( R16G16_SSCALED, SZ_2, CVT_16_SSCALED ) +FETCH_ATTRIB( R16_SSCALED, SZ_1, CVT_16_SSCALED ) -FETCH_ATTRIB( R32G32B32_SSCALED, 3, CVT_32_SSCALED ) -FETCH_ATTRIB( R32G32_SSCALED, 2, CVT_32_SSCALED ) -FETCH_ATTRIB( R32_SSCALED, 1, CVT_32_SSCALED ) +FETCH_ATTRIB( R16G16B16A16_UNORM, SZ_4, CVT_16_UNORM ) +FETCH_ATTRIB( R16G16B16_UNORM, SZ_3, CVT_16_UNORM ) +FETCH_ATTRIB( R16G16_UNORM, SZ_2, CVT_16_UNORM ) +FETCH_ATTRIB( R16_UNORM, SZ_1, CVT_16_UNORM ) -FETCH_ATTRIB( R32G32B32_UNORM, 3, CVT_32_UNORM ) -FETCH_ATTRIB( R32G32_UNORM, 2, CVT_32_UNORM ) -FETCH_ATTRIB( R32_UNORM, 1, CVT_32_UNORM ) +FETCH_ATTRIB( R16G16B16A16_SNORM, SZ_4, CVT_16_SNORM ) +FETCH_ATTRIB( R16G16B16_SNORM, SZ_3, CVT_16_SNORM ) +FETCH_ATTRIB( R16G16_SNORM, SZ_2, CVT_16_SNORM ) +FETCH_ATTRIB( R16_SNORM, SZ_1, CVT_16_SNORM ) -FETCH_ATTRIB( R32G32B32A32_SNORM, 4, CVT_32_SNORM ) -FETCH_ATTRIB( R32G32B32_SNORM, 3, CVT_32_SNORM ) -FETCH_ATTRIB( R32G32_SNORM, 2, CVT_32_SNORM ) -FETCH_ATTRIB( R32_SNORM, 1, CVT_32_SNORM ) +FETCH_ATTRIB( R8G8B8A8_USCALED, SZ_4, CVT_8_USCALED ) +FETCH_ATTRIB( R8G8B8_USCALED, SZ_3, CVT_8_USCALED ) +FETCH_ATTRIB( R8G8_USCALED, SZ_2, CVT_8_USCALED ) +FETCH_ATTRIB( R8_USCALED, SZ_1, CVT_8_USCALED ) -FETCH_ATTRIB( R16G16B16A16_USCALED, 4, CVT_16_USCALED ) -FETCH_ATTRIB( R16G16B16_USCALED, 3, CVT_16_USCALED ) -FETCH_ATTRIB( R16G16_USCALED, 2, CVT_16_USCALED ) -FETCH_ATTRIB( R16_USCALED, 1, CVT_16_USCALED ) +FETCH_ATTRIB( R8G8B8A8_SSCALED, SZ_4, CVT_8_SSCALED ) +FETCH_ATTRIB( R8G8B8_SSCALED, SZ_3, CVT_8_SSCALED ) +FETCH_ATTRIB( R8G8_SSCALED, SZ_2, CVT_8_SSCALED ) +FETCH_ATTRIB( R8_SSCALED, SZ_1, CVT_8_SSCALED ) -FETCH_ATTRIB( R16G16B16A16_SSCALED, 4, CVT_16_SSCALED ) -FETCH_ATTRIB( R16G16B16_SSCALED, 3, CVT_16_SSCALED ) -FETCH_ATTRIB( R16G16_SSCALED, 2, CVT_16_SSCALED ) -FETCH_ATTRIB( R16_SSCALED, 1, CVT_16_SSCALED ) +FETCH_ATTRIB( R8G8B8A8_UNORM, SZ_4, CVT_8_UNORM ) +FETCH_ATTRIB( R8G8B8_UNORM, SZ_3, CVT_8_UNORM ) +FETCH_ATTRIB( R8G8_UNORM, SZ_2, CVT_8_UNORM ) +FETCH_ATTRIB( R8_UNORM, SZ_1, CVT_8_UNORM ) -FETCH_ATTRIB( R16G16B16A16_UNORM, 4, CVT_16_UNORM ) -FETCH_ATTRIB( R16G16B16_UNORM, 3, CVT_16_UNORM ) -FETCH_ATTRIB( R16G16_UNORM, 2, CVT_16_UNORM ) -FETCH_ATTRIB( R16_UNORM, 1, CVT_16_UNORM ) +FETCH_ATTRIB( R8G8B8A8_SNORM, SZ_4, CVT_8_SNORM ) +FETCH_ATTRIB( R8G8B8_SNORM, SZ_3, CVT_8_SNORM ) +FETCH_ATTRIB( R8G8_SNORM, SZ_2, CVT_8_SNORM ) +FETCH_ATTRIB( R8_SNORM, SZ_1, CVT_8_SNORM ) -FETCH_ATTRIB( R16G16B16A16_SNORM, 4, CVT_16_SNORM ) -FETCH_ATTRIB( R16G16B16_SNORM, 3, CVT_16_SNORM ) -FETCH_ATTRIB( R16G16_SNORM, 2, CVT_16_SNORM ) -FETCH_ATTRIB( R16_SNORM, 1, CVT_16_SNORM ) - -FETCH_ATTRIB( R8G8B8A8_USCALED, 4, CVT_8_USCALED ) -FETCH_ATTRIB( R8G8B8_USCALED, 3, CVT_8_USCALED ) -FETCH_ATTRIB( R8G8_USCALED, 2, CVT_8_USCALED ) -FETCH_ATTRIB( R8_USCALED, 1, CVT_8_USCALED ) - -FETCH_ATTRIB( R8G8B8A8_SSCALED, 4, CVT_8_SSCALED ) -FETCH_ATTRIB( R8G8B8_SSCALED, 3, CVT_8_SSCALED ) -FETCH_ATTRIB( R8G8_SSCALED, 2, CVT_8_SSCALED ) -FETCH_ATTRIB( R8_SSCALED, 1, CVT_8_SSCALED ) - -FETCH_ATTRIB( R8G8B8A8_UNORM, 4, CVT_8_UNORM ) -FETCH_ATTRIB( R8G8B8_UNORM, 3, CVT_8_UNORM ) -FETCH_ATTRIB( R8G8_UNORM, 2, CVT_8_UNORM ) -FETCH_ATTRIB( R8_UNORM, 1, CVT_8_UNORM ) - -FETCH_ATTRIB( R8G8B8A8_SNORM, 4, CVT_8_SNORM ) -FETCH_ATTRIB( R8G8B8_SNORM, 3, CVT_8_SNORM ) -FETCH_ATTRIB( R8G8_SNORM, 2, CVT_8_SNORM ) -FETCH_ATTRIB( R8_SNORM, 1, CVT_8_SNORM ) - -FETCH_ATTRIB( A8R8G8B8_UNORM, 4, CVT_8_UNORM ) -//FETCH_ATTRIB( R8G8B8A8_UNORM, 4, CVT_8_UNORM ) +FETCH_ATTRIB( A8R8G8B8_UNORM, SZ_4, CVT_8_UNORM ) static spu_fetch_func get_fetch_func( enum pipe_format format ) { -#if 0 - { - char tmp[80]; - pf_sprint_name(tmp, format); - _mesa_printf("%s: %s\n", __FUNCTION__, tmp); - } -#endif - switch (format) { case PIPE_FORMAT_R64_FLOAT: return fetch_R64_FLOAT; @@ -348,6 +492,96 @@ static spu_fetch_func get_fetch_func( enum pipe_format format ) } +static unsigned get_vertex_size( enum pipe_format format ) +{ + switch (format) { + case PIPE_FORMAT_R64_FLOAT: + return 8; + case PIPE_FORMAT_R64G64_FLOAT: + return 2 * 8; + case PIPE_FORMAT_R64G64B64_FLOAT: + return 3 * 8; + case PIPE_FORMAT_R64G64B64A64_FLOAT: + return 4 * 8; + + case PIPE_FORMAT_R32_SSCALED: + case PIPE_FORMAT_R32_SNORM: + case PIPE_FORMAT_R32_USCALED: + case PIPE_FORMAT_R32_UNORM: + case PIPE_FORMAT_R32_FLOAT: + return 4; + case PIPE_FORMAT_R32G32_SSCALED: + case PIPE_FORMAT_R32G32_SNORM: + case PIPE_FORMAT_R32G32_USCALED: + case PIPE_FORMAT_R32G32_UNORM: + case PIPE_FORMAT_R32G32_FLOAT: + return 2 * 4; + case PIPE_FORMAT_R32G32B32_SSCALED: + case PIPE_FORMAT_R32G32B32_SNORM: + case PIPE_FORMAT_R32G32B32_USCALED: + case PIPE_FORMAT_R32G32B32_UNORM: + case PIPE_FORMAT_R32G32B32_FLOAT: + return 3 * 4; + case PIPE_FORMAT_R32G32B32A32_SSCALED: + case PIPE_FORMAT_R32G32B32A32_SNORM: + case PIPE_FORMAT_R32G32B32A32_USCALED: + case PIPE_FORMAT_R32G32B32A32_UNORM: + case PIPE_FORMAT_R32G32B32A32_FLOAT: + return 4 * 4; + + case PIPE_FORMAT_R16_SSCALED: + case PIPE_FORMAT_R16_SNORM: + case PIPE_FORMAT_R16_UNORM: + case PIPE_FORMAT_R16_USCALED: + return 2; + case PIPE_FORMAT_R16G16_SSCALED: + case PIPE_FORMAT_R16G16_SNORM: + case PIPE_FORMAT_R16G16_USCALED: + case PIPE_FORMAT_R16G16_UNORM: + return 2 * 2; + case PIPE_FORMAT_R16G16B16_SSCALED: + case PIPE_FORMAT_R16G16B16_SNORM: + case PIPE_FORMAT_R16G16B16_USCALED: + case PIPE_FORMAT_R16G16B16_UNORM: + return 3 * 2; + case PIPE_FORMAT_R16G16B16A16_SSCALED: + case PIPE_FORMAT_R16G16B16A16_SNORM: + case PIPE_FORMAT_R16G16B16A16_USCALED: + case PIPE_FORMAT_R16G16B16A16_UNORM: + return 4 * 2; + + case PIPE_FORMAT_R8_SSCALED: + case PIPE_FORMAT_R8_SNORM: + case PIPE_FORMAT_R8_USCALED: + case PIPE_FORMAT_R8_UNORM: + return 1; + case PIPE_FORMAT_R8G8_SSCALED: + case PIPE_FORMAT_R8G8_SNORM: + case PIPE_FORMAT_R8G8_USCALED: + case PIPE_FORMAT_R8G8_UNORM: + return 2 * 1; + case PIPE_FORMAT_R8G8B8_SSCALED: + case PIPE_FORMAT_R8G8B8_SNORM: + case PIPE_FORMAT_R8G8B8_USCALED: + case PIPE_FORMAT_R8G8B8_UNORM: + return 3 * 1; + case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_R8G8B8A8_SSCALED: + case PIPE_FORMAT_R8G8B8A8_SNORM: + case PIPE_FORMAT_R8G8B8A8_USCALED: + case PIPE_FORMAT_R8G8B8A8_UNORM: + return 4 * 1; + + case 0: + return 0; /* not sure why this is needed */ + + default: + assert(0); + return 0; + } +} + + /** * Fetch vertex attributes for 'count' vertices. */ @@ -361,8 +595,6 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, assert(count <= 4); - wait_on_mask(1 << TAG_VERTEX_BUFFER); - #if DRAW_DBG printf("SPU: %s count = %u, nr_attrs = %u\n", __FUNCTION__, count, nr_attrs); @@ -375,33 +607,40 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, const uint64_t src = draw->vertex_fetch.src_ptr[attr]; const spu_fetch_func fetch = draw->vertex_fetch.fetch[attr]; unsigned i; + unsigned idx; + const unsigned bytes_per_entry = draw->vertex_fetch.size[attr]; + const unsigned quads_per_entry = (bytes_per_entry + 15) / 16; qword p[4]; + qword in[2 * 4]; /* Fetch four attributes for four vertices. - * - * Could fetch directly into AOS format, but this is meant to be - * a prototype for an sse implementation, which would have - * difficulties doing that. */ + idx = 0; for (i = 0; i < count; i++) { - uint8_t buffer[32] ALIGN16_ATTRIB; const uint64_t addr = src + (elts[i] * pitch); - const unsigned size = ((addr & 0x0f) == 0) ? 16 : 32; #if DRAW_DBG printf("SPU: fetching = 0x%llx\n", addr); #endif - mfc_get(buffer, addr & ~0x0f, size, TAG_VERTEX_BUFFER, 0, 0); - wait_on_mask(1 << TAG_VERTEX_BUFFER); - p[i] = (*fetch)(buffer + (addr & 0x0f)); + fetch_unaligned(& in[idx], addr, bytes_per_entry); + idx += quads_per_entry; } - /* Be nice and zero out any missing vertices: + /* Be nice and zero out any missing vertices. */ - for (/* empty */; i < 4; i++) - p[i] = si_xor(p[i], p[i]); + (void) memset(& in[idx], 0, (8 - idx) * sizeof(qword)); + + + /* Convert all 4 vertices to vectors of float. + */ + idx = 0; + for (i = 0; i < 4; i++) { + p[i] = (*fetch)(in + idx); + idx += quads_per_entry; + } + /* Transpose/swizzle into vector-friendly format. Currently * assuming that all vertex shader inputs are float[4], but this @@ -422,9 +661,18 @@ void spu_update_vertex_fetch( struct spu_vs_context *draw ) unsigned i; + /* Invalidate the vertex cache. + */ + for (i = 0; i < (CACHE_NWAY * CACHE_NSETS); i++) { + CACHELINE_CLEARVALID(i); + } + + for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) { draw->vertex_fetch.fetch[i] = get_fetch_func(draw->vertex_fetch.format[i]); + draw->vertex_fetch.size[i] = + get_vertex_size(draw->vertex_fetch.format[i]); } draw->vertex_fetch.fetch_func = generic_vertex_fetch; diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.h b/src/mesa/pipe/cell/spu/spu_vertex_shader.h index c96b93ff0ac..ea044e841da 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_shader.h +++ b/src/mesa/pipe/cell/spu/spu_vertex_shader.h @@ -6,7 +6,7 @@ struct spu_vs_context; -typedef qword (*spu_fetch_func)(const void *ptr); +typedef qword (*spu_fetch_func)(const qword *qw); typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, @@ -18,6 +18,7 @@ struct spu_vs_context { struct { uint64_t src_ptr[PIPE_ATTRIB_MAX]; unsigned pitch[PIPE_ATTRIB_MAX]; + unsigned size[PIPE_ATTRIB_MAX]; enum pipe_format format[PIPE_ATTRIB_MAX]; unsigned nr_attrs; boolean dirty; From 125451b9f024ea5845eb6c1b3056bc1f1995cc55 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 12 Feb 2008 11:18:53 -0800 Subject: [PATCH 27/74] Remove open-coded fetch functions --- src/mesa/pipe/cell/spu/spu_vertex_fetch.c | 34 +++-------------------- 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c index f6ffcae90ec..cbd389435e6 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c +++ b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c @@ -99,36 +99,6 @@ fetch_unaligned(qword *dst, unsigned ea, unsigned size) } } -static qword -fetch_R32G32B32A32_FLOAT(const qword *qw) -{ - return *qw; -} - - -static qword -fetch_R32G32B32A32_USCALED(const qword *qw) -{ - return si_cuflt(*qw, 0); -} - - -static qword -fetch_R32G32B32A32_UNORM(const qword *qw) -{ - qword x = si_cuflt(*qw, 0); - vec_float4 scale = spu_splats(1.0f / 255.0f); - - return si_fm(x, (qword) scale); -} - - -static qword -fetch_R32G32B32A32_SSCALED(const qword *qw) -{ - return si_csflt(*qw, 0); -} - #define CVT_32_FLOAT(q) (*q) @@ -285,18 +255,22 @@ FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT ) FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT ) FETCH_ATTRIB( R64_FLOAT, SZ_1, CVT_64_FLOAT ) +FETCH_ATTRIB( R32G32B32A32_FLOAT, SZ_4, CVT_32_FLOAT ) FETCH_ATTRIB( R32G32B32_FLOAT, SZ_3, CVT_32_FLOAT ) FETCH_ATTRIB( R32G32_FLOAT, SZ_2, CVT_32_FLOAT ) FETCH_ATTRIB( R32_FLOAT, SZ_1, CVT_32_FLOAT ) +FETCH_ATTRIB( R32G32B32A32_USCALED, SZ_4, CVT_32_USCALED ) FETCH_ATTRIB( R32G32B32_USCALED, SZ_3, CVT_32_USCALED ) FETCH_ATTRIB( R32G32_USCALED, SZ_2, CVT_32_USCALED ) FETCH_ATTRIB( R32_USCALED, SZ_1, CVT_32_USCALED ) +FETCH_ATTRIB( R32G32B32A32_SSCALED, SZ_4, CVT_32_SSCALED ) FETCH_ATTRIB( R32G32B32_SSCALED, SZ_3, CVT_32_SSCALED ) FETCH_ATTRIB( R32G32_SSCALED, SZ_2, CVT_32_SSCALED ) FETCH_ATTRIB( R32_SSCALED, SZ_1, CVT_32_SSCALED ) +FETCH_ATTRIB( R32G32B32A32_UNORM, SZ_4, CVT_32_UNORM ) FETCH_ATTRIB( R32G32B32_UNORM, SZ_3, CVT_32_UNORM ) FETCH_ATTRIB( R32G32_UNORM, SZ_2, CVT_32_UNORM ) FETCH_ATTRIB( R32_UNORM, SZ_1, CVT_32_UNORM ) From dd07e154d26c2c3ec248b7143eb67b6b4410246a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 12 Feb 2008 11:29:34 -0800 Subject: [PATCH 28/74] Fetch routines convert and transpose all 4 vertices at once. --- src/mesa/pipe/cell/spu/spu_vertex_fetch.c | 152 ++++++++++----------- src/mesa/pipe/cell/spu/spu_vertex_shader.h | 2 +- 2 files changed, 71 insertions(+), 83 deletions(-) diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c index cbd389435e6..3bbf9b7be4f 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c +++ b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c @@ -100,7 +100,7 @@ fetch_unaligned(qword *dst, unsigned ea, unsigned size) } -#define CVT_32_FLOAT(q) (*q) +#define CVT_32_FLOAT(q) (*(q)) static INLINE qword CVT_64_FLOAT(const qword *qw) @@ -242,85 +242,90 @@ CVT_32_SNORM(const qword *qw) * This is probably needed/dupliocated elsewhere, eg format * conversion, texture sampling etc. */ -#define FETCH_ATTRIB( NAME, SZ, CVT ) \ -static qword \ -fetch_##NAME(const qword *qw) \ -{ \ - qword expanded = CVT(qw); \ - return si_selb(expanded, (qword) defaults, SZ); \ +#define FETCH_ATTRIB( NAME, SZ, CVT, N ) \ +static void \ +fetch_##NAME(qword *out, const qword *in) \ +{ \ + qword tmp[4]; \ + \ + tmp[0] = si_selb(CVT(in + (0 * N)), (qword) defaults, SZ); \ + tmp[1] = si_selb(CVT(in + (1 * N)), (qword) defaults, SZ); \ + tmp[2] = si_selb(CVT(in + (2 * N)), (qword) defaults, SZ); \ + tmp[3] = si_selb(CVT(in + (3 * N)), (qword) defaults, SZ); \ + _transpose_matrix4x4((vec_float4 *) out, (vec_float4 *) tmp); \ } -FETCH_ATTRIB( R64G64B64A64_FLOAT, SZ_4, CVT_64_FLOAT ) -FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT ) -FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT ) -FETCH_ATTRIB( R64_FLOAT, SZ_1, CVT_64_FLOAT ) +FETCH_ATTRIB( R64G64B64A64_FLOAT, SZ_4, CVT_64_FLOAT, 2 ) +FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT, 2 ) +FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT, 2 ) +FETCH_ATTRIB( R64_FLOAT, SZ_1, CVT_64_FLOAT, 2 ) -FETCH_ATTRIB( R32G32B32A32_FLOAT, SZ_4, CVT_32_FLOAT ) -FETCH_ATTRIB( R32G32B32_FLOAT, SZ_3, CVT_32_FLOAT ) -FETCH_ATTRIB( R32G32_FLOAT, SZ_2, CVT_32_FLOAT ) -FETCH_ATTRIB( R32_FLOAT, SZ_1, CVT_32_FLOAT ) +FETCH_ATTRIB( R32G32B32A32_FLOAT, SZ_4, CVT_32_FLOAT, 1 ) +FETCH_ATTRIB( R32G32B32_FLOAT, SZ_3, CVT_32_FLOAT, 1 ) +FETCH_ATTRIB( R32G32_FLOAT, SZ_2, CVT_32_FLOAT, 1 ) +FETCH_ATTRIB( R32_FLOAT, SZ_1, CVT_32_FLOAT, 1 ) -FETCH_ATTRIB( R32G32B32A32_USCALED, SZ_4, CVT_32_USCALED ) -FETCH_ATTRIB( R32G32B32_USCALED, SZ_3, CVT_32_USCALED ) -FETCH_ATTRIB( R32G32_USCALED, SZ_2, CVT_32_USCALED ) -FETCH_ATTRIB( R32_USCALED, SZ_1, CVT_32_USCALED ) +FETCH_ATTRIB( R32G32B32A32_USCALED, SZ_4, CVT_32_USCALED, 1 ) +FETCH_ATTRIB( R32G32B32_USCALED, SZ_3, CVT_32_USCALED, 1 ) +FETCH_ATTRIB( R32G32_USCALED, SZ_2, CVT_32_USCALED, 1 ) +FETCH_ATTRIB( R32_USCALED, SZ_1, CVT_32_USCALED, 1 ) -FETCH_ATTRIB( R32G32B32A32_SSCALED, SZ_4, CVT_32_SSCALED ) -FETCH_ATTRIB( R32G32B32_SSCALED, SZ_3, CVT_32_SSCALED ) -FETCH_ATTRIB( R32G32_SSCALED, SZ_2, CVT_32_SSCALED ) -FETCH_ATTRIB( R32_SSCALED, SZ_1, CVT_32_SSCALED ) +FETCH_ATTRIB( R32G32B32A32_SSCALED, SZ_4, CVT_32_SSCALED, 1 ) +FETCH_ATTRIB( R32G32B32_SSCALED, SZ_3, CVT_32_SSCALED, 1 ) +FETCH_ATTRIB( R32G32_SSCALED, SZ_2, CVT_32_SSCALED, 1 ) +FETCH_ATTRIB( R32_SSCALED, SZ_1, CVT_32_SSCALED, 1 ) -FETCH_ATTRIB( R32G32B32A32_UNORM, SZ_4, CVT_32_UNORM ) -FETCH_ATTRIB( R32G32B32_UNORM, SZ_3, CVT_32_UNORM ) -FETCH_ATTRIB( R32G32_UNORM, SZ_2, CVT_32_UNORM ) -FETCH_ATTRIB( R32_UNORM, SZ_1, CVT_32_UNORM ) +FETCH_ATTRIB( R32G32B32A32_UNORM, SZ_4, CVT_32_UNORM, 1 ) +FETCH_ATTRIB( R32G32B32_UNORM, SZ_3, CVT_32_UNORM, 1 ) +FETCH_ATTRIB( R32G32_UNORM, SZ_2, CVT_32_UNORM, 1 ) +FETCH_ATTRIB( R32_UNORM, SZ_1, CVT_32_UNORM, 1 ) -FETCH_ATTRIB( R32G32B32A32_SNORM, SZ_4, CVT_32_SNORM ) -FETCH_ATTRIB( R32G32B32_SNORM, SZ_3, CVT_32_SNORM ) -FETCH_ATTRIB( R32G32_SNORM, SZ_2, CVT_32_SNORM ) -FETCH_ATTRIB( R32_SNORM, SZ_1, CVT_32_SNORM ) +FETCH_ATTRIB( R32G32B32A32_SNORM, SZ_4, CVT_32_SNORM, 1 ) +FETCH_ATTRIB( R32G32B32_SNORM, SZ_3, CVT_32_SNORM, 1 ) +FETCH_ATTRIB( R32G32_SNORM, SZ_2, CVT_32_SNORM, 1 ) +FETCH_ATTRIB( R32_SNORM, SZ_1, CVT_32_SNORM, 1 ) -FETCH_ATTRIB( R16G16B16A16_USCALED, SZ_4, CVT_16_USCALED ) -FETCH_ATTRIB( R16G16B16_USCALED, SZ_3, CVT_16_USCALED ) -FETCH_ATTRIB( R16G16_USCALED, SZ_2, CVT_16_USCALED ) -FETCH_ATTRIB( R16_USCALED, SZ_1, CVT_16_USCALED ) +FETCH_ATTRIB( R16G16B16A16_USCALED, SZ_4, CVT_16_USCALED, 1 ) +FETCH_ATTRIB( R16G16B16_USCALED, SZ_3, CVT_16_USCALED, 1 ) +FETCH_ATTRIB( R16G16_USCALED, SZ_2, CVT_16_USCALED, 1 ) +FETCH_ATTRIB( R16_USCALED, SZ_1, CVT_16_USCALED, 1 ) -FETCH_ATTRIB( R16G16B16A16_SSCALED, SZ_4, CVT_16_SSCALED ) -FETCH_ATTRIB( R16G16B16_SSCALED, SZ_3, CVT_16_SSCALED ) -FETCH_ATTRIB( R16G16_SSCALED, SZ_2, CVT_16_SSCALED ) -FETCH_ATTRIB( R16_SSCALED, SZ_1, CVT_16_SSCALED ) +FETCH_ATTRIB( R16G16B16A16_SSCALED, SZ_4, CVT_16_SSCALED, 1 ) +FETCH_ATTRIB( R16G16B16_SSCALED, SZ_3, CVT_16_SSCALED, 1 ) +FETCH_ATTRIB( R16G16_SSCALED, SZ_2, CVT_16_SSCALED, 1 ) +FETCH_ATTRIB( R16_SSCALED, SZ_1, CVT_16_SSCALED, 1 ) -FETCH_ATTRIB( R16G16B16A16_UNORM, SZ_4, CVT_16_UNORM ) -FETCH_ATTRIB( R16G16B16_UNORM, SZ_3, CVT_16_UNORM ) -FETCH_ATTRIB( R16G16_UNORM, SZ_2, CVT_16_UNORM ) -FETCH_ATTRIB( R16_UNORM, SZ_1, CVT_16_UNORM ) +FETCH_ATTRIB( R16G16B16A16_UNORM, SZ_4, CVT_16_UNORM, 1 ) +FETCH_ATTRIB( R16G16B16_UNORM, SZ_3, CVT_16_UNORM, 1 ) +FETCH_ATTRIB( R16G16_UNORM, SZ_2, CVT_16_UNORM, 1 ) +FETCH_ATTRIB( R16_UNORM, SZ_1, CVT_16_UNORM, 1 ) -FETCH_ATTRIB( R16G16B16A16_SNORM, SZ_4, CVT_16_SNORM ) -FETCH_ATTRIB( R16G16B16_SNORM, SZ_3, CVT_16_SNORM ) -FETCH_ATTRIB( R16G16_SNORM, SZ_2, CVT_16_SNORM ) -FETCH_ATTRIB( R16_SNORM, SZ_1, CVT_16_SNORM ) +FETCH_ATTRIB( R16G16B16A16_SNORM, SZ_4, CVT_16_SNORM, 1 ) +FETCH_ATTRIB( R16G16B16_SNORM, SZ_3, CVT_16_SNORM, 1 ) +FETCH_ATTRIB( R16G16_SNORM, SZ_2, CVT_16_SNORM, 1 ) +FETCH_ATTRIB( R16_SNORM, SZ_1, CVT_16_SNORM, 1 ) -FETCH_ATTRIB( R8G8B8A8_USCALED, SZ_4, CVT_8_USCALED ) -FETCH_ATTRIB( R8G8B8_USCALED, SZ_3, CVT_8_USCALED ) -FETCH_ATTRIB( R8G8_USCALED, SZ_2, CVT_8_USCALED ) -FETCH_ATTRIB( R8_USCALED, SZ_1, CVT_8_USCALED ) +FETCH_ATTRIB( R8G8B8A8_USCALED, SZ_4, CVT_8_USCALED, 1 ) +FETCH_ATTRIB( R8G8B8_USCALED, SZ_3, CVT_8_USCALED, 1 ) +FETCH_ATTRIB( R8G8_USCALED, SZ_2, CVT_8_USCALED, 1 ) +FETCH_ATTRIB( R8_USCALED, SZ_1, CVT_8_USCALED, 1 ) -FETCH_ATTRIB( R8G8B8A8_SSCALED, SZ_4, CVT_8_SSCALED ) -FETCH_ATTRIB( R8G8B8_SSCALED, SZ_3, CVT_8_SSCALED ) -FETCH_ATTRIB( R8G8_SSCALED, SZ_2, CVT_8_SSCALED ) -FETCH_ATTRIB( R8_SSCALED, SZ_1, CVT_8_SSCALED ) +FETCH_ATTRIB( R8G8B8A8_SSCALED, SZ_4, CVT_8_SSCALED, 1 ) +FETCH_ATTRIB( R8G8B8_SSCALED, SZ_3, CVT_8_SSCALED, 1 ) +FETCH_ATTRIB( R8G8_SSCALED, SZ_2, CVT_8_SSCALED, 1 ) +FETCH_ATTRIB( R8_SSCALED, SZ_1, CVT_8_SSCALED, 1 ) -FETCH_ATTRIB( R8G8B8A8_UNORM, SZ_4, CVT_8_UNORM ) -FETCH_ATTRIB( R8G8B8_UNORM, SZ_3, CVT_8_UNORM ) -FETCH_ATTRIB( R8G8_UNORM, SZ_2, CVT_8_UNORM ) -FETCH_ATTRIB( R8_UNORM, SZ_1, CVT_8_UNORM ) +FETCH_ATTRIB( R8G8B8A8_UNORM, SZ_4, CVT_8_UNORM, 1 ) +FETCH_ATTRIB( R8G8B8_UNORM, SZ_3, CVT_8_UNORM, 1 ) +FETCH_ATTRIB( R8G8_UNORM, SZ_2, CVT_8_UNORM, 1 ) +FETCH_ATTRIB( R8_UNORM, SZ_1, CVT_8_UNORM, 1 ) -FETCH_ATTRIB( R8G8B8A8_SNORM, SZ_4, CVT_8_SNORM ) -FETCH_ATTRIB( R8G8B8_SNORM, SZ_3, CVT_8_SNORM ) -FETCH_ATTRIB( R8G8_SNORM, SZ_2, CVT_8_SNORM ) -FETCH_ATTRIB( R8_SNORM, SZ_1, CVT_8_SNORM ) +FETCH_ATTRIB( R8G8B8A8_SNORM, SZ_4, CVT_8_SNORM, 1 ) +FETCH_ATTRIB( R8G8B8_SNORM, SZ_3, CVT_8_SNORM, 1 ) +FETCH_ATTRIB( R8G8_SNORM, SZ_2, CVT_8_SNORM, 1 ) +FETCH_ATTRIB( R8_SNORM, SZ_1, CVT_8_SNORM, 1 ) -FETCH_ATTRIB( A8R8G8B8_UNORM, SZ_4, CVT_8_UNORM ) +FETCH_ATTRIB( A8R8G8B8_UNORM, SZ_4, CVT_8_UNORM, 1 ) @@ -584,7 +589,6 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, unsigned idx; const unsigned bytes_per_entry = draw->vertex_fetch.size[attr]; const unsigned quads_per_entry = (bytes_per_entry + 15) / 16; - qword p[4]; qword in[2 * 4]; @@ -609,23 +613,7 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, /* Convert all 4 vertices to vectors of float. */ - idx = 0; - for (i = 0; i < 4; i++) { - p[i] = (*fetch)(in + idx); - idx += quads_per_entry; - } - - - /* Transpose/swizzle into vector-friendly format. Currently - * assuming that all vertex shader inputs are float[4], but this - * isn't true -- if the vertex shader only wants tex0.xy, we - * could optimize for that. - * - * To do so fully without codegen would probably require an - * excessive number of fetch functions, but we could at least - * minimize the transpose step: - */ - _transpose_matrix4x4(&machine->Inputs[attr].xyzw[0].q, p); + (*fetch)(&machine->Inputs[attr].xyzw[0].q, in); } } diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.h b/src/mesa/pipe/cell/spu/spu_vertex_shader.h index ea044e841da..8b37a239a47 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_shader.h +++ b/src/mesa/pipe/cell/spu/spu_vertex_shader.h @@ -6,7 +6,7 @@ struct spu_vs_context; -typedef qword (*spu_fetch_func)(const qword *qw); +typedef void (*spu_fetch_func)(qword *out, const qword *in); typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, From 77a148862036bd6bf01f631ff44e455d50bcb8b9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 10:08:11 -0800 Subject: [PATCH 29/74] Real-time assembler for Cell SPE. --- src/mesa/ppc/rtasm/spe_asm.c | 351 +++++++++++++++++++++++++++++++++++ src/mesa/ppc/rtasm/spe_asm.h | 310 +++++++++++++++++++++++++++++++ src/mesa/sources | 1 + 3 files changed, 662 insertions(+) create mode 100644 src/mesa/ppc/rtasm/spe_asm.c create mode 100644 src/mesa/ppc/rtasm/spe_asm.h diff --git a/src/mesa/ppc/rtasm/spe_asm.c b/src/mesa/ppc/rtasm/spe_asm.c new file mode 100644 index 00000000000..b1851f05e7f --- /dev/null +++ b/src/mesa/ppc/rtasm/spe_asm.c @@ -0,0 +1,351 @@ +/* + * (C) Copyright IBM Corporation 2008 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file spe_asm.c + * Real-time assembly generation interface for Cell B.E. SPEs. + * + * \author Ian Romanick + */ +#ifdef GALLIUM_CELL +#include +#include +#include "spe_asm.h" + +/** + * SPE instruction types + * + * There are 6 primary instruction encodings used on the Cell's SPEs. Each of + * the following unions encodes one type. + * + * \bug + * If, at some point, we start generating SPE code from a little-endian host + * these unions will not work. + */ +/*@{*/ +/** + * Encode one output register with two input registers + */ +union spe_inst_RR { + uint32_t bits; + struct { + unsigned op:11; + unsigned rB:7; + unsigned rA:7; + unsigned rT:7; + } inst; +}; + + +/** + * Encode one output register with three input registers + */ +union spe_inst_RRR { + uint32_t bits; + struct { + unsigned op:4; + unsigned rT:7; + unsigned rB:7; + unsigned rA:7; + unsigned rC:7; + } inst; +}; + + +/** + * Encode one output register with one input reg. and a 7-bit signed immed + */ +union spe_inst_RI7 { + uint32_t bits; + struct { + unsigned op:11; + unsigned i7:7; + unsigned rA:7; + unsigned rT:7; + } inst; +}; + + +/** + * Encode one output register with one input reg. and a 10-bit signed immed + */ +union spe_inst_RI10 { + uint32_t bits; + struct { + unsigned op:8; + unsigned i10:10; + unsigned rA:7; + unsigned rT:7; + } inst; +}; + + +/** + * Encode one output register with a 16-bit signed immediate + */ +union spe_inst_RI16 { + uint32_t bits; + struct { + unsigned op:9; + unsigned i16:16; + unsigned rT:7; + } inst; +}; + + +/** + * Encode one output register with a 18-bit signed immediate + */ +union spe_inst_RI18 { + uint32_t bits; + struct { + unsigned op:7; + unsigned i18:18; + unsigned rT:7; + } inst; +}; +/*@}*/ + + +static void emit_RR(struct spe_function *p, unsigned op, unsigned rT, + unsigned rA, unsigned rB) +{ + union spe_inst_RR inst; + inst.inst.op = op; + inst.inst.rB = rB; + inst.inst.rA = rA; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + +static void emit_RRR(struct spe_function *p, unsigned op, unsigned rT, + unsigned rA, unsigned rB, unsigned rC) +{ + union spe_inst_RRR inst; + inst.inst.op = op; + inst.inst.rT = rT; + inst.inst.rB = rB; + inst.inst.rA = rA; + inst.inst.rC = rC; + *p->csr = inst.bits; + p->csr++; +} + + +static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT, + unsigned rA, int imm) +{ + union spe_inst_RI7 inst; + inst.inst.op = op; + inst.inst.i7 = imm; + inst.inst.rA = rA; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + + +static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT, + unsigned rA, int imm) +{ + union spe_inst_RI10 inst; + inst.inst.op = op; + inst.inst.i10 = imm; + inst.inst.rA = rA; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + +static void emit_RI16(struct spe_function *p, unsigned op, unsigned rT, + int imm) +{ + union spe_inst_RI16 inst; + inst.inst.op = op; + inst.inst.i16 = imm; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + +static void emit_RI18(struct spe_function *p, unsigned op, unsigned rT, + int imm) +{ + union spe_inst_RI18 inst; + inst.inst.op = op; + inst.inst.i18 = imm; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + + + +#define EMIT_(_name, _op) \ +void _name (struct spe_function *p, unsigned rT) \ +{ \ + emit_RR(p, _op, rT, 0, 0); \ +} + +#define EMIT_R(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA) \ +{ \ + emit_RR(p, _op, rT, rA, 0); \ +} + +#define EMIT_RR(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB) \ +{ \ + emit_RR(p, _op, rT, rA, rB); \ +} + +#define EMIT_RRR(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA, unsigned rB, unsigned rC) \ +{ \ + emit_RRR(p, _op, rT, rA, rB, rC); \ +} + +#define EMIT_RI7(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \ +{ \ + emit_RI7(p, _op, rT, rA, imm); \ +} + +#define EMIT_RI10(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \ +{ \ + emit_RI10(p, _op, rT, rA, imm); \ +} + +#define EMIT_RI16(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, int imm) \ +{ \ + emit_RI16(p, _op, rT, imm); \ +} + +#define EMIT_RI18(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, int imm) \ +{ \ + emit_RI18(p, _op, rT, imm); \ +} + +#define EMIT_I16(_name, _op) \ +void _name (struct spe_function *p, int imm) \ +{ \ + emit_RI16(p, _op, 0, imm); \ +} + +#include "spe_asm.h" + + +/* + */ +void spe_init_func(struct spe_function *p, unsigned code_size) +{ + p->store = _mesa_align_malloc(code_size, 16); + p->csr = p->store; +} + + +void spe_release_func(struct spe_function *p) +{ + _mesa_align_free(p->store); + p->store = NULL; + p->csr = NULL; +} + + +void spu_bi(struct spe_function *p, unsigned rA, int d, int e) +{ + emit_RI7(p, 0x1a8, 0, rA, (d << 5) | (e << 4)); +} + +void spu_iret(struct spe_function *p, unsigned rA, int d, int e) +{ + emit_RI7(p, 0x1aa, 0, rA, (d << 5) | (e << 4)); +} + +void spu_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d, + int e) +{ + emit_RI7(p, 0x1ab, rT, rA, (d << 5) | (e << 4)); +} + +void spu_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d, + int e) +{ + emit_RI7(p, 0x1a9, rT, rA, (d << 5) | (e << 4)); +} + +void spu_biz(struct spe_function *p, unsigned rT, unsigned rA, int d, + int e) +{ + emit_RI7(p, 0x128, rT, rA, (d << 5) | (e << 4)); +} + +void spu_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +{ + emit_RI7(p, 0x129, rT, rA, (d << 5) | (e << 4)); +} + +void spu_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +{ + emit_RI7(p, 0x12a, rT, rA, (d << 5) | (e << 4)); +} + +void spu_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +{ + emit_RI7(p, 0x12b, rT, rA, (d << 5) | (e << 4)); +} + + +/* Hint-for-branch instructions + */ +#if 0 +hbr; +hbra; +hbrr; +#endif + + +/* Control instructions + */ +#if 0 +stop; +EMIT_RR (spu_stopd, 0x140); +EMIT_ (spu_lnop, 0x001); +EMIT_ (spu_nop, 0x201); +sync; +EMIT_ (spu_dsync, 0x003); +EMIT_R (spu_mfspr, 0x00c); +EMIT_R (spu_mtspr, 0x10c); +#endif + +#endif /* GALLIUM_CELL */ diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h new file mode 100644 index 00000000000..1c7f145415c --- /dev/null +++ b/src/mesa/ppc/rtasm/spe_asm.h @@ -0,0 +1,310 @@ +/* + * (C) Copyright IBM Corporation 2008 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +/** + * \file spe_asm.h + * Real-time assembly generation interface for Cell B.E. SPEs. + * + * \author Ian Romanick + */ + +#ifndef SPE_ASM_H +#define SPE_ASM_H + +struct spe_function { + /** + * + */ + uint32_t *store; + uint32_t *csr; + const char *fn; +}; + +extern void spe_init_func(struct spe_function *p, unsigned code_size); +extern void spe_release_func(struct spe_function *p); + +#endif /* SPE_ASM_H */ + +#ifndef EMIT_ +#define EMIT_(name, _op) \ + extern void _name (struct spe_function *p, unsigned rT) +#define EMIT_R(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA) +#define EMIT_RR(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ + unsigned rB) +#define EMIT_RRR(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ + unsigned rB, unsigned rC) +#define EMIT_RI7(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ + int imm) +#define EMIT_RI10(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ + int imm) +#define EMIT_RI16(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, int imm) +#define EMIT_RI18(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, int imm) +#define EMIT_I16(_name, _op) \ + extern void _name (struct spe_function *p, int imm) +#define UNDEF_EMIT_MACROS +#endif /* EMIT_ */ + + +/* Memory load / store instructions + */ +EMIT_RI10(spu_ldq, 0x034); +EMIT_RR (spu_lqx, 0x1c4); +EMIT_RI16(spu_lqa, 0x061); +EMIT_RI16(spu_lqr, 0x067); +EMIT_RI10(spu_stqd, 0x024); +EMIT_RR (spu_stqx, 0x144); +EMIT_RI16(spu_stqa, 0x041); +EMIT_RI16(spu_stqr, 0x047); +EMIT_RI7 (spu_cbd, 0x1f4); +EMIT_RR (spu_cbx, 0x1d4); +EMIT_RI7 (spu_chd, 0x1f5); +EMIT_RI7 (spu_chx, 0x1d5); +EMIT_RI7 (spu_cwd, 0x1f6); +EMIT_RI7 (spu_cwx, 0x1d6); +EMIT_RI7 (spu_cdd, 0x1f7); +EMIT_RI7 (spu_cdx, 0x1d7); + + +/* Constant formation instructions + */ +EMIT_RI16(spu_ilh, 0x083); +EMIT_RI16(spu_ilhu, 0x082); +EMIT_RI16(spu_il, 0x081); +EMIT_RI18(spu_ila, 0x021); +EMIT_RI16(spu_iohl, 0x0c1); +EMIT_RI16(spu_fsmbi, 0x0c5); + + +/* Integer and logical instructions + */ +EMIT_RR (spe_ah, 0x0c8); +EMIT_RI10(spe_ahi, 0x01d); +EMIT_RR (spe_a, 0x0c0); +EMIT_RI10(spe_ai, 0x01c); +EMIT_RR (spe_sfh, 0x048); +EMIT_RI10(spe_sfhi, 0x00d); +EMIT_RR (spe_sf, 0x040); +EMIT_RI10(spe_sfi, 0x00c); +EMIT_RR (spe_addx, 0x340); +EMIT_RR (spu_cg, 0x0c2); +EMIT_RR (spu_cgx, 0x342); +EMIT_RR (spe_sfx, 0x341); +EMIT_RR (spu_bg, 0x042); +EMIT_RR (spu_bgx, 0x343); +EMIT_RR (spu_mpy, 0x3c4); +EMIT_RR (spu_mpyu, 0x3cc); +EMIT_RI10(spu_mpyi, 0x074); +EMIT_RI10(spu_mpyui, 0x075); +EMIT_RRR (spy_mpya, 0x00c); +EMIT_RR (spu_mpyh, 0x3c5); +EMIT_RR (spu_mpys, 0x3c7); +EMIT_RR (spu_mpyhh, 0x3c6); +EMIT_RR (spu_mpyhha, 0x346); +EMIT_RR (spu_mpyhhu, 0x3ce); +EMIT_RR (spu_mpyhhau, 0x34e); +EMIT_R (spe_clz, 0x2a5); +EMIT_R (spe_cntb, 0x2b4); +EMIT_R (spe_fsmb, 0x1b6); +EMIT_R (spe_fsmh, 0x1b5); +EMIT_R (spe_fsm, 0x1b4); +EMIT_R (spe_gbb, 0x1b2); +EMIT_R (spe_gbh, 0x1b1); +EMIT_R (spe_gb, 0x1b0); +EMIT_RR (spe_avgb, 0x0d3); +EMIT_RR (spe_absdb, 0x053); +EMIT_RR (spe_sumb, 0x253); +EMIT_R (spe_xsbh, 0x2b6); +EMIT_R (spe_xshw, 0x2ae); +EMIT_R (spe_xswd, 0x2a6); +EMIT_RR (spe_and, 0x0c1); +EMIT_RR (spe_andc, 0x2c1); +EMIT_RI10(spu_andbi, 0x016); +EMIT_RI10(spu_andhi, 0x015); +EMIT_RI10(spu_andi, 0x014); +EMIT_RR (spe_or, 0x041); +EMIT_RR (spe_orc, 0x2c9); +EMIT_RI10(spu_orbi, 0x006); +EMIT_RI10(spu_orhi, 0x005); +EMIT_RI10(spu_ori, 0x004); +EMIT_R (spu_orx, 0x1f0); +EMIT_RR (spu_xor, 0x241); +EMIT_RI10(spu_xorbi, 0x026); +EMIT_RI10(spu_xorhi, 0x025); +EMIT_RI10(spu_xori, 0x024); +EMIT_RR (spe_nand, 0x0c9); +EMIT_RR (spe_nor, 0x049); +EMIT_RR (spe_eqv, 0x249); +EMIT_RRR (spy_selb, 0x008); +EMIT_RRR (spy_shufb, 0x00b); + + +/* Shift and rotate instructions + */ +EMIT_RR (spe_shlh, 0x05f); +EMIT_RI7 (spe_shlhi, 0x07f); +EMIT_RR (spe_shl, 0x05b); +EMIT_RI7 (spe_shli, 0x07b); +EMIT_RR (spe_shlqbi, 0x1db); +EMIT_RI7 (spe_shlqbii, 0x1fb); +EMIT_RR (spe_shlqby, 0x1df); +EMIT_RI7 (spe_shlqbyi, 0x1ff); +EMIT_RR (spe_shlqbybi, 0x1cf); +EMIT_RR (spe_roth, 0x05c); +EMIT_RI7 (spe_rothi, 0x07c); +EMIT_RR (spe_rot, 0x058); +EMIT_RI7 (spe_roti, 0x078); +EMIT_RR (spe_rotqby, 0x1dc); +EMIT_RI7 (spe_rotqbyi, 0x1fc); +EMIT_RR (spe_rotqbybi, 0x1cc); +EMIT_RR (spe_rotqbi, 0x1d8); +EMIT_RI7 (spe_rotqbii, 0x1f8); +EMIT_RR (spe_rothm, 0x05d); +EMIT_RI7 (spe_rothmi, 0x07d); +EMIT_RR (spe_rotm, 0x059); +EMIT_RI7 (spe_rotmi, 0x079); +EMIT_RR (spe_rotqmby, 0x1dd); +EMIT_RI7 (spe_rotqmbyi, 0x1fd); +EMIT_RR (spe_rotqmbybi, 0x1cd); +EMIT_RR (spe_rotqmbi, 0x1c9); +EMIT_RI7 (spe_rotqmbii, 0x1f9); +EMIT_RR (spe_rotmah, 0x05e); +EMIT_RI7 (spe_rotmahi, 0x07e); +EMIT_RR (spe_rotma, 0x05a); +EMIT_RI7 (spe_rotmai, 0x07a); + + +/* Compare, branch, and halt instructions + */ +EMIT_RR (spe_heq, 0x3d8); +EMIT_RI10(spe_heqi, 0x07f); +EMIT_RR (spe_hgt, 0x258); +EMIT_RI10(spe_hgti, 0x04f); +EMIT_RR (spe_hlgt, 0x2d8); +EMIT_RI10(spe_hlgti, 0x05f); +EMIT_RR (spe_ceqb, 0x3d0); +EMIT_RI10(spe_ceqbi, 0x07e); +EMIT_RR (spe_ceqh, 0x3c8); +EMIT_RI10(spe_ceqhi, 0x07d); +EMIT_RR (spe_ceq, 0x3c0); +EMIT_RI10(spe_ceqi, 0x07c); +EMIT_RR (spe_cgtb, 0x250); +EMIT_RI10(spe_cgtbi, 0x04e); +EMIT_RR (spe_cgth, 0x248); +EMIT_RI10(spe_cgthi, 0x04d); +EMIT_RR (spe_cgt, 0x240); +EMIT_RI10(spe_cgti, 0x04c); +EMIT_RR (spe_clgtb, 0x2d0); +EMIT_RI10(spe_clgtbi, 0x05e); +EMIT_RR (spe_clgth, 0x2c8); +EMIT_RI10(spe_clgthi, 0x05d); +EMIT_RR (spe_clgt, 0x2c0); +EMIT_RI10(spe_clgti, 0x05c); +EMIT_I16 (spe_br, 0x064); +EMIT_I16 (spe_bra, 0x060); +EMIT_RI16(spu_brsl, 0x066); +EMIT_RI16(spu_brasl, 0x062); +EMIT_RI16(spu_brnz, 0x042); +EMIT_RI16(spu_brz, 0x040); +EMIT_RI16(spu_brhnz, 0x046); +EMIT_RI16(spu_brhz, 0x044); + +extern void spu_bi(struct spe_function *p, unsigned rA, int d, int e); +extern void spu_iret(struct spe_function *p, unsigned rA, int d, int e); +extern void spu_bisled(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); +extern void spu_bisl(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); +extern void spu_biz(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); +extern void spu_binz(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); +extern void spu_bihz(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); +extern void spu_bihnz(struct spe_function *p, unsigned rT, unsigned rA, + int d, int e); + + +/* Floating-point instructions + */ +EMIT_RR (spu_fa, 0x2c4); +EMIT_RR (spu_dfa, 0x2cc); +EMIT_RR (spu_fs, 0x2c5); +EMIT_RR (spu_dfs, 0x2cd); +EMIT_RR (spu_fm, 0x2c6); +EMIT_RR (spu_dfm, 0x2ce); +EMIT_RRR (spu_fma, 0x00e); +EMIT_RR (spu_dfma, 0x35c); +EMIT_RRR (spu_fnms, 0x00d); +EMIT_RR (spu_dfnms, 0x35e); +EMIT_RRR (spu_fms, 0x00f); +EMIT_RR (spu_dfms, 0x35d); +EMIT_RR (spu_dfnma, 0x35f); +EMIT_R (spu_frest, 0x1b8); +EMIT_R (spu_frsqest, 0x1b9); +EMIT_RR (spu_fi, 0x3d4); +EMIT_RI7 (spu_csflt, 0x3da); +EMIT_RI7 (spu_cflts, 0x3d8); +EMIT_RI7 (spu_cuflt, 0x3db); +EMIT_RI7 (spu_cfltu, 0x3d9); +EMIT_R (spu_frds, 0x3b9); +EMIT_R (spu_fesd, 0x3b8); +EMIT_RR (spu_dfceq, 0x3c3); +EMIT_RR (spu_dfcmeq, 0x3cb); +EMIT_RR (spu_dfcgt, 0x2c3); +EMIT_RR (spu_dfcmgt, 0x2cb); +EMIT_RI7 (spu_dftsv, 0x3bf); +EMIT_RR (spu_fceq, 0x3c2); +EMIT_RR (spu_fcmeq, 0x3ca); +EMIT_RR (spu_fcgt, 0x2c2); +EMIT_RR (spu_fcmgt, 0x2ca); +EMIT_R (spu_fscrwr, 0x3ba); +EMIT_ (spu_fscrrd, 0x398); + + +/* Channel instructions + */ +EMIT_R (spu_rdch, 0x00d); +EMIT_R (spu_rdchcnt, 0x00f); +EMIT_R (spu_wrch, 0x10d); + + +#ifdef UNDEF_EMIT_MACROS +#undef EMIT_ +#undef EMIT_R +#undef EMIT_RR +#undef EMIT_RRR +#undef EMIT_RI7 +#undef EMIT_RI10 +#undef EMIT_RI16 +#undef EMIT_RI18 +#undef EMIT_I16 +#undef UNDEF_EMIT_MACROS +#endif /* EMIT_ */ diff --git a/src/mesa/sources b/src/mesa/sources index 96ae3dbca00..1165425183a 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -288,6 +288,7 @@ ASM_C_SOURCES = \ x86/rtasm/x86sse.c \ sparc/sparc.c \ ppc/common_ppc.c \ + ppc/rtasm/spe_asm.c \ x86-64/x86-64.c X86_SOURCES = \ From f1257fd7944c5b62a07cecf0608e63ec7a947706 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 11:55:19 -0800 Subject: [PATCH 30/74] Cell: Fix unintended breakage from commit 1d62a057bcb3ee4ef6ebedd93f62ed2e0d8061ba --- src/mesa/pipe/cell/ppu/cell_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/pipe/cell/ppu/cell_texture.c b/src/mesa/pipe/cell/ppu/cell_texture.c index df178d9ca24..c8ef36002f7 100644 --- a/src/mesa/pipe/cell/ppu/cell_texture.c +++ b/src/mesa/pipe/cell/ppu/cell_texture.c @@ -61,7 +61,7 @@ cell_texture_layout(struct cell_texture * spt) spt->buffer_size = 0; - for ( level = pt->first_level ; level <= pt->last_level ; level++ ) { + for ( level = 0 ; level <= pt->last_level ; level++ ) { pt->width[level] = width; pt->height[level] = height; pt->depth[level] = depth; From 18fd3b757166c1c63284dc08f6dfd9e2061770be Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 16:53:05 -0800 Subject: [PATCH 31/74] Cell: pass pointers to stored memory values Several routines use shuffle patterns that are stored in memory. For code gen, it is difficult to directly access the data segments. The routines have been modified to be passed a pointer to a global table of shuffle patterns. This *should* be the last change to this file before switching over to code gen. --- src/mesa/pipe/cell/spu/spu_vertex_fetch.c | 160 ++++++++++++--------- src/mesa/pipe/cell/spu/spu_vertex_shader.h | 3 +- 2 files changed, 98 insertions(+), 65 deletions(-) diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c index 3bbf9b7be4f..45e3c26c001 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c +++ b/src/mesa/pipe/cell/spu/spu_vertex_fetch.c @@ -59,8 +59,59 @@ #define DRAW_DBG 0 +static const qword fetch_shuffle_data[] = { + /* Shuffle used by CVT_64_FLOAT + */ + { + 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, + }, + + /* Shuffle used by CVT_8_USCALED and CVT_8_SSCALED + */ + { + 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80, + 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80, + }, + + /* Shuffle used by CVT_16_USCALED and CVT_16_SSCALED + */ + { + 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80, + 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80, + }, + + /* High value shuffle used by trans4x4. + */ + { + 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, + 0x04, 0x05, 0x06, 0x07, 0x14, 0x15, 0x16, 0x17 + }, + + /* Low value shuffle used by trans4x4. + */ + { + 0x08, 0x09, 0x0A, 0x0B, 0x18, 0x19, 0x1A, 0x1B, + 0x0C, 0x0D, 0x0E, 0x0F, 0x1C, 0x1D, 0x1E, 0x1F + } +}; + + +static INLINE void +trans4x4(qword row0, qword row1, qword row2, qword row3, qword *out, + const qword *shuffle) +{ + qword t1 = si_shufb(row0, row2, shuffle[3]); + qword t2 = si_shufb(row0, row2, shuffle[4]); + qword t3 = si_shufb(row1, row3, shuffle[3]); + qword t4 = si_shufb(row1, row3, shuffle[4]); + + out[0] = si_shufb(t1, t3, shuffle[3]); + out[1] = si_shufb(t1, t3, shuffle[4]); + out[2] = si_shufb(t2, t4, shuffle[3]); + out[3] = si_shufb(t2, t4, shuffle[4]); +} -static const vec_float4 defaults = { 0.0, 0.0, 0.0, 1.0 }; /** * Fetch between 1 and 32 bytes from an unaligned address @@ -100,140 +151,117 @@ fetch_unaligned(qword *dst, unsigned ea, unsigned size) } -#define CVT_32_FLOAT(q) (*(q)) +#define CVT_32_FLOAT(q, s) (*(q)) static INLINE qword -CVT_64_FLOAT(const qword *qw) +CVT_64_FLOAT(const qword *qw, const qword *shuffle) { - qword shuf_first = (qword) { - 0x00, 0x01, 0x02, 0x03, 0x10, 0x11, 0x12, 0x13, - 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, - }; - qword a = si_frds(qw[0]); qword b = si_frds(si_rotqbyi(qw[0], 8)); qword c = si_frds(qw[1]); qword d = si_frds(si_rotqbyi(qw[1], 8)); - qword ab = si_shufb(a, b, shuf_first); - qword cd = si_shufb(c, d, si_rotqbyi(shuf_first, 8)); + qword ab = si_shufb(a, b, shuffle[0]); + qword cd = si_shufb(c, d, si_rotqbyi(shuffle[0], 8)); return si_or(ab, cd); } static INLINE qword -CVT_8_USCALED(const qword *qw) +CVT_8_USCALED(const qword *qw, const qword *shuffle) { - qword shuffle = (qword) { - 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80, - 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80, - }; - - return si_cuflt(si_shufb(*qw, *qw, shuffle), 0); + return si_cuflt(si_shufb(*qw, *qw, shuffle[1]), 0); } static INLINE qword -CVT_16_USCALED(const qword *qw) +CVT_16_USCALED(const qword *qw, const qword *shuffle) { - qword shuffle = (qword) { - 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80, - 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80, - }; - - return si_cuflt(si_shufb(*qw, *qw, shuffle), 0); + return si_cuflt(si_shufb(*qw, *qw, shuffle[2]), 0); } static INLINE qword -CVT_32_USCALED(const qword *qw) +CVT_32_USCALED(const qword *qw, const qword *shuffle) { + (void) shuffle; return si_cuflt(*qw, 0); } static INLINE qword -CVT_8_SSCALED(const qword *qw) +CVT_8_SSCALED(const qword *qw, const qword *shuffle) { - qword shuffle = (qword) { - 0x00, 0x80, 0x80, 0x80, 0x01, 0x80, 0x80, 0x80, - 0x02, 0x80, 0x80, 0x80, 0x03, 0x80, 0x80, 0x80, - }; - - return si_csflt(si_shufb(*qw, *qw, shuffle), 0); + return si_csflt(si_shufb(*qw, *qw, shuffle[1]), 0); } static INLINE qword -CVT_16_SSCALED(const qword *qw) +CVT_16_SSCALED(const qword *qw, const qword *shuffle) { - qword shuffle = (qword) { - 0x00, 0x01, 0x80, 0x80, 0x02, 0x03, 0x80, 0x80, - 0x04, 0x05, 0x80, 0x80, 0x06, 0x07, 0x80, 0x80, - }; - - return si_csflt(si_shufb(*qw, *qw, shuffle), 0); + return si_csflt(si_shufb(*qw, *qw, shuffle[2]), 0); } static INLINE qword -CVT_32_SSCALED(const qword *qw) +CVT_32_SSCALED(const qword *qw, const qword *shuffle) { + (void) shuffle; return si_csflt(*qw, 0); } static INLINE qword -CVT_8_UNORM(const qword *qw) +CVT_8_UNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 255.0f); - return si_fm(CVT_8_USCALED(qw), scale); + return si_fm(CVT_8_USCALED(qw, shuffle), scale); } static INLINE qword -CVT_16_UNORM(const qword *qw) +CVT_16_UNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 65535.0f); - return si_fm(CVT_16_USCALED(qw), scale); + return si_fm(CVT_16_USCALED(qw, shuffle), scale); } static INLINE qword -CVT_32_UNORM(const qword *qw) +CVT_32_UNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 4294967295.0f); - return si_fm(CVT_32_USCALED(qw), scale); + return si_fm(CVT_32_USCALED(qw, shuffle), scale); } static INLINE qword -CVT_8_SNORM(const qword *qw) +CVT_8_SNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 127.0f); - return si_fm(CVT_8_SSCALED(qw), scale); + return si_fm(CVT_8_SSCALED(qw, shuffle), scale); } static INLINE qword -CVT_16_SNORM(const qword *qw) +CVT_16_SNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 32767.0f); - return si_fm(CVT_16_SSCALED(qw), scale); + return si_fm(CVT_16_SSCALED(qw, shuffle), scale); } static INLINE qword -CVT_32_SNORM(const qword *qw) +CVT_32_SNORM(const qword *qw, const qword *shuffle) { const qword scale = (qword) spu_splats(1.0f / 2147483647.0f); - return si_fm(CVT_32_SSCALED(qw), scale); + return si_fm(CVT_32_SSCALED(qw, shuffle), scale); } #define SZ_4 si_il(0U) -#define SZ_3 si_rotqmbyi(si_il(~0), -12) -#define SZ_2 si_rotqmbyi(si_il(~0), -8) -#define SZ_1 si_rotqmbyi(si_il(~0), -4) +#define SZ_3 si_fsmbi(0x000f) +#define SZ_2 si_fsmbi(0x00ff) +#define SZ_1 si_fsmbi(0x0fff) /** * Fetch a float[4] vertex attribute from memory, doing format/type @@ -244,17 +272,19 @@ CVT_32_SNORM(const qword *qw) */ #define FETCH_ATTRIB( NAME, SZ, CVT, N ) \ static void \ -fetch_##NAME(qword *out, const qword *in) \ +fetch_##NAME(qword *out, const qword *in, qword defaults, \ + const qword *shuffle) \ { \ qword tmp[4]; \ \ - tmp[0] = si_selb(CVT(in + (0 * N)), (qword) defaults, SZ); \ - tmp[1] = si_selb(CVT(in + (1 * N)), (qword) defaults, SZ); \ - tmp[2] = si_selb(CVT(in + (2 * N)), (qword) defaults, SZ); \ - tmp[3] = si_selb(CVT(in + (3 * N)), (qword) defaults, SZ); \ - _transpose_matrix4x4((vec_float4 *) out, (vec_float4 *) tmp); \ + tmp[0] = si_selb(CVT(in + (0 * N), shuffle), defaults, SZ); \ + tmp[1] = si_selb(CVT(in + (1 * N), shuffle), defaults, SZ); \ + tmp[2] = si_selb(CVT(in + (2 * N), shuffle), defaults, SZ); \ + tmp[3] = si_selb(CVT(in + (3 * N), shuffle), defaults, SZ); \ + trans4x4(tmp[0], tmp[1], tmp[2], tmp[3], out, shuffle); \ } + FETCH_ATTRIB( R64G64B64A64_FLOAT, SZ_4, CVT_64_FLOAT, 2 ) FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT, 2 ) FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT, 2 ) @@ -582,6 +612,7 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, /* loop over vertex attributes (vertex shader inputs) */ for (attr = 0; attr < nr_attrs; attr++) { + const qword default_values = (qword)(vec_float4){ 0.0, 0.0, 0.0, 1.0 }; const unsigned pitch = draw->vertex_fetch.pitch[attr]; const uint64_t src = draw->vertex_fetch.src_ptr[attr]; const spu_fetch_func fetch = draw->vertex_fetch.fetch[attr]; @@ -602,8 +633,8 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, printf("SPU: fetching = 0x%llx\n", addr); #endif - fetch_unaligned(& in[idx], addr, bytes_per_entry); - idx += quads_per_entry; + fetch_unaligned(& in[idx], addr, bytes_per_entry); + idx += quads_per_entry; } /* Be nice and zero out any missing vertices. @@ -613,7 +644,8 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, /* Convert all 4 vertices to vectors of float. */ - (*fetch)(&machine->Inputs[attr].xyzw[0].q, in); + (*fetch)(&machine->Inputs[attr].xyzw[0].q, in, default_values, + fetch_shuffle_data); } } diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.h b/src/mesa/pipe/cell/spu/spu_vertex_shader.h index 8b37a239a47..b5bf31e67db 100644 --- a/src/mesa/pipe/cell/spu/spu_vertex_shader.h +++ b/src/mesa/pipe/cell/spu/spu_vertex_shader.h @@ -6,7 +6,8 @@ struct spu_vs_context; -typedef void (*spu_fetch_func)(qword *out, const qword *in); +typedef void (*spu_fetch_func)(qword *out, const qword *in, qword defaults, + const qword *shuffle_data); typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, From d4d9943b0144062e70372329ea46f5b41c6c270e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 17:06:13 -0800 Subject: [PATCH 32/74] s/spu_/spe_/g Ugh. --- src/mesa/ppc/rtasm/spe_asm.h | 198 +++++++++++++++++------------------ 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h index 1c7f145415c..e6cf1d35ba9 100644 --- a/src/mesa/ppc/rtasm/spe_asm.h +++ b/src/mesa/ppc/rtasm/spe_asm.h @@ -75,32 +75,32 @@ extern void spe_release_func(struct spe_function *p); /* Memory load / store instructions */ -EMIT_RI10(spu_ldq, 0x034); -EMIT_RR (spu_lqx, 0x1c4); -EMIT_RI16(spu_lqa, 0x061); -EMIT_RI16(spu_lqr, 0x067); -EMIT_RI10(spu_stqd, 0x024); -EMIT_RR (spu_stqx, 0x144); -EMIT_RI16(spu_stqa, 0x041); -EMIT_RI16(spu_stqr, 0x047); -EMIT_RI7 (spu_cbd, 0x1f4); -EMIT_RR (spu_cbx, 0x1d4); -EMIT_RI7 (spu_chd, 0x1f5); -EMIT_RI7 (spu_chx, 0x1d5); -EMIT_RI7 (spu_cwd, 0x1f6); -EMIT_RI7 (spu_cwx, 0x1d6); -EMIT_RI7 (spu_cdd, 0x1f7); -EMIT_RI7 (spu_cdx, 0x1d7); +EMIT_RI10(spe_ldq, 0x034); +EMIT_RR (spe_lqx, 0x1c4); +EMIT_RI16(spe_lqa, 0x061); +EMIT_RI16(spe_lqr, 0x067); +EMIT_RI10(spe_stqd, 0x024); +EMIT_RR (spe_stqx, 0x144); +EMIT_RI16(spe_stqa, 0x041); +EMIT_RI16(spe_stqr, 0x047); +EMIT_RI7 (spe_cbd, 0x1f4); +EMIT_RR (spe_cbx, 0x1d4); +EMIT_RI7 (spe_chd, 0x1f5); +EMIT_RI7 (spe_chx, 0x1d5); +EMIT_RI7 (spe_cwd, 0x1f6); +EMIT_RI7 (spe_cwx, 0x1d6); +EMIT_RI7 (spe_cdd, 0x1f7); +EMIT_RI7 (spe_cdx, 0x1d7); /* Constant formation instructions */ -EMIT_RI16(spu_ilh, 0x083); -EMIT_RI16(spu_ilhu, 0x082); -EMIT_RI16(spu_il, 0x081); -EMIT_RI18(spu_ila, 0x021); -EMIT_RI16(spu_iohl, 0x0c1); -EMIT_RI16(spu_fsmbi, 0x0c5); +EMIT_RI16(spe_ilh, 0x083); +EMIT_RI16(spe_ilhu, 0x082); +EMIT_RI16(spe_il, 0x081); +EMIT_RI18(spe_ila, 0x021); +EMIT_RI16(spe_iohl, 0x0c1); +EMIT_RI16(spe_fsmbi, 0x0c5); /* Integer and logical instructions @@ -114,22 +114,22 @@ EMIT_RI10(spe_sfhi, 0x00d); EMIT_RR (spe_sf, 0x040); EMIT_RI10(spe_sfi, 0x00c); EMIT_RR (spe_addx, 0x340); -EMIT_RR (spu_cg, 0x0c2); -EMIT_RR (spu_cgx, 0x342); +EMIT_RR (spe_cg, 0x0c2); +EMIT_RR (spe_cgx, 0x342); EMIT_RR (spe_sfx, 0x341); -EMIT_RR (spu_bg, 0x042); -EMIT_RR (spu_bgx, 0x343); -EMIT_RR (spu_mpy, 0x3c4); -EMIT_RR (spu_mpyu, 0x3cc); -EMIT_RI10(spu_mpyi, 0x074); -EMIT_RI10(spu_mpyui, 0x075); +EMIT_RR (spe_bg, 0x042); +EMIT_RR (spe_bgx, 0x343); +EMIT_RR (spe_mpy, 0x3c4); +EMIT_RR (spe_mpyu, 0x3cc); +EMIT_RI10(spe_mpyi, 0x074); +EMIT_RI10(spe_mpyui, 0x075); EMIT_RRR (spy_mpya, 0x00c); -EMIT_RR (spu_mpyh, 0x3c5); -EMIT_RR (spu_mpys, 0x3c7); -EMIT_RR (spu_mpyhh, 0x3c6); -EMIT_RR (spu_mpyhha, 0x346); -EMIT_RR (spu_mpyhhu, 0x3ce); -EMIT_RR (spu_mpyhhau, 0x34e); +EMIT_RR (spe_mpyh, 0x3c5); +EMIT_RR (spe_mpys, 0x3c7); +EMIT_RR (spe_mpyhh, 0x3c6); +EMIT_RR (spe_mpyhha, 0x346); +EMIT_RR (spe_mpyhhu, 0x3ce); +EMIT_RR (spe_mpyhhau, 0x34e); EMIT_R (spe_clz, 0x2a5); EMIT_R (spe_cntb, 0x2b4); EMIT_R (spe_fsmb, 0x1b6); @@ -146,24 +146,24 @@ EMIT_R (spe_xshw, 0x2ae); EMIT_R (spe_xswd, 0x2a6); EMIT_RR (spe_and, 0x0c1); EMIT_RR (spe_andc, 0x2c1); -EMIT_RI10(spu_andbi, 0x016); -EMIT_RI10(spu_andhi, 0x015); -EMIT_RI10(spu_andi, 0x014); +EMIT_RI10(spe_andbi, 0x016); +EMIT_RI10(spe_andhi, 0x015); +EMIT_RI10(spe_andi, 0x014); EMIT_RR (spe_or, 0x041); EMIT_RR (spe_orc, 0x2c9); -EMIT_RI10(spu_orbi, 0x006); -EMIT_RI10(spu_orhi, 0x005); -EMIT_RI10(spu_ori, 0x004); -EMIT_R (spu_orx, 0x1f0); -EMIT_RR (spu_xor, 0x241); -EMIT_RI10(spu_xorbi, 0x026); -EMIT_RI10(spu_xorhi, 0x025); -EMIT_RI10(spu_xori, 0x024); +EMIT_RI10(spe_orbi, 0x006); +EMIT_RI10(spe_orhi, 0x005); +EMIT_RI10(spe_ori, 0x004); +EMIT_R (spe_orx, 0x1f0); +EMIT_RR (spe_xor, 0x241); +EMIT_RI10(spe_xorbi, 0x026); +EMIT_RI10(spe_xorhi, 0x025); +EMIT_RI10(spe_xori, 0x024); EMIT_RR (spe_nand, 0x0c9); EMIT_RR (spe_nor, 0x049); EMIT_RR (spe_eqv, 0x249); -EMIT_RRR (spy_selb, 0x008); -EMIT_RRR (spy_shufb, 0x00b); +EMIT_RRR (spe_selb, 0x008); +EMIT_RRR (spe_shufb, 0x00b); /* Shift and rotate instructions @@ -229,71 +229,71 @@ EMIT_RR (spe_clgt, 0x2c0); EMIT_RI10(spe_clgti, 0x05c); EMIT_I16 (spe_br, 0x064); EMIT_I16 (spe_bra, 0x060); -EMIT_RI16(spu_brsl, 0x066); -EMIT_RI16(spu_brasl, 0x062); -EMIT_RI16(spu_brnz, 0x042); -EMIT_RI16(spu_brz, 0x040); -EMIT_RI16(spu_brhnz, 0x046); -EMIT_RI16(spu_brhz, 0x044); +EMIT_RI16(spe_brsl, 0x066); +EMIT_RI16(spe_brasl, 0x062); +EMIT_RI16(spe_brnz, 0x042); +EMIT_RI16(spe_brz, 0x040); +EMIT_RI16(spe_brhnz, 0x046); +EMIT_RI16(spe_brhz, 0x044); -extern void spu_bi(struct spe_function *p, unsigned rA, int d, int e); -extern void spu_iret(struct spe_function *p, unsigned rA, int d, int e); -extern void spu_bisled(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_bi(struct spe_function *p, unsigned rA, int d, int e); +extern void spe_iret(struct spe_function *p, unsigned rA, int d, int e); +extern void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); -extern void spu_bisl(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); -extern void spu_biz(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_biz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); -extern void spu_binz(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); -extern void spu_bihz(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); -extern void spu_bihnz(struct spe_function *p, unsigned rT, unsigned rA, +extern void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e); /* Floating-point instructions */ -EMIT_RR (spu_fa, 0x2c4); -EMIT_RR (spu_dfa, 0x2cc); -EMIT_RR (spu_fs, 0x2c5); -EMIT_RR (spu_dfs, 0x2cd); -EMIT_RR (spu_fm, 0x2c6); -EMIT_RR (spu_dfm, 0x2ce); -EMIT_RRR (spu_fma, 0x00e); -EMIT_RR (spu_dfma, 0x35c); -EMIT_RRR (spu_fnms, 0x00d); -EMIT_RR (spu_dfnms, 0x35e); -EMIT_RRR (spu_fms, 0x00f); -EMIT_RR (spu_dfms, 0x35d); -EMIT_RR (spu_dfnma, 0x35f); -EMIT_R (spu_frest, 0x1b8); -EMIT_R (spu_frsqest, 0x1b9); -EMIT_RR (spu_fi, 0x3d4); -EMIT_RI7 (spu_csflt, 0x3da); -EMIT_RI7 (spu_cflts, 0x3d8); -EMIT_RI7 (spu_cuflt, 0x3db); -EMIT_RI7 (spu_cfltu, 0x3d9); -EMIT_R (spu_frds, 0x3b9); -EMIT_R (spu_fesd, 0x3b8); -EMIT_RR (spu_dfceq, 0x3c3); -EMIT_RR (spu_dfcmeq, 0x3cb); -EMIT_RR (spu_dfcgt, 0x2c3); -EMIT_RR (spu_dfcmgt, 0x2cb); -EMIT_RI7 (spu_dftsv, 0x3bf); -EMIT_RR (spu_fceq, 0x3c2); -EMIT_RR (spu_fcmeq, 0x3ca); -EMIT_RR (spu_fcgt, 0x2c2); -EMIT_RR (spu_fcmgt, 0x2ca); -EMIT_R (spu_fscrwr, 0x3ba); -EMIT_ (spu_fscrrd, 0x398); +EMIT_RR (spe_fa, 0x2c4); +EMIT_RR (spe_dfa, 0x2cc); +EMIT_RR (spe_fs, 0x2c5); +EMIT_RR (spe_dfs, 0x2cd); +EMIT_RR (spe_fm, 0x2c6); +EMIT_RR (spe_dfm, 0x2ce); +EMIT_RRR (spe_fma, 0x00e); +EMIT_RR (spe_dfma, 0x35c); +EMIT_RRR (spe_fnms, 0x00d); +EMIT_RR (spe_dfnms, 0x35e); +EMIT_RRR (spe_fms, 0x00f); +EMIT_RR (spe_dfms, 0x35d); +EMIT_RR (spe_dfnma, 0x35f); +EMIT_R (spe_frest, 0x1b8); +EMIT_R (spe_frsqest, 0x1b9); +EMIT_RR (spe_fi, 0x3d4); +EMIT_RI7 (spe_csflt, 0x3da); +EMIT_RI7 (spe_cflts, 0x3d8); +EMIT_RI7 (spe_cuflt, 0x3db); +EMIT_RI7 (spe_cfltu, 0x3d9); +EMIT_R (spe_frds, 0x3b9); +EMIT_R (spe_fesd, 0x3b8); +EMIT_RR (spe_dfceq, 0x3c3); +EMIT_RR (spe_dfcmeq, 0x3cb); +EMIT_RR (spe_dfcgt, 0x2c3); +EMIT_RR (spe_dfcmgt, 0x2cb); +EMIT_RI7 (spe_dftsv, 0x3bf); +EMIT_RR (spe_fceq, 0x3c2); +EMIT_RR (spe_fcmeq, 0x3ca); +EMIT_RR (spe_fcgt, 0x2c2); +EMIT_RR (spe_fcmgt, 0x2ca); +EMIT_R (spe_fscrwr, 0x3ba); +EMIT_ (spe_fscrrd, 0x398); /* Channel instructions */ -EMIT_R (spu_rdch, 0x00d); -EMIT_R (spu_rdchcnt, 0x00f); -EMIT_R (spu_wrch, 0x10d); +EMIT_R (spe_rdch, 0x00d); +EMIT_R (spe_rdchcnt, 0x00f); +EMIT_R (spe_wrch, 0x10d); #ifdef UNDEF_EMIT_MACROS From bbd7aabe2bc5743d11c77dd94665045b09791048 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 17:42:34 -0800 Subject: [PATCH 33/74] More name typeo fixes. --- src/mesa/ppc/rtasm/spe_asm.c | 28 ++++++++++++++-------------- src/mesa/ppc/rtasm/spe_asm.h | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mesa/ppc/rtasm/spe_asm.c b/src/mesa/ppc/rtasm/spe_asm.c index b1851f05e7f..f8aff9050bf 100644 --- a/src/mesa/ppc/rtasm/spe_asm.c +++ b/src/mesa/ppc/rtasm/spe_asm.c @@ -282,45 +282,45 @@ void spe_release_func(struct spe_function *p) } -void spu_bi(struct spe_function *p, unsigned rA, int d, int e) +void spe_bi(struct spe_function *p, unsigned rA, int d, int e) { emit_RI7(p, 0x1a8, 0, rA, (d << 5) | (e << 4)); } -void spu_iret(struct spe_function *p, unsigned rA, int d, int e) +void spe_iret(struct spe_function *p, unsigned rA, int d, int e) { emit_RI7(p, 0x1aa, 0, rA, (d << 5) | (e << 4)); } -void spu_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d, +void spe_bisled(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x1ab, rT, rA, (d << 5) | (e << 4)); } -void spu_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d, +void spe_bisl(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x1a9, rT, rA, (d << 5) | (e << 4)); } -void spu_biz(struct spe_function *p, unsigned rT, unsigned rA, int d, +void spe_biz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x128, rT, rA, (d << 5) | (e << 4)); } -void spu_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +void spe_binz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x129, rT, rA, (d << 5) | (e << 4)); } -void spu_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +void spe_bihz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x12a, rT, rA, (d << 5) | (e << 4)); } -void spu_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) +void spe_bihnz(struct spe_function *p, unsigned rT, unsigned rA, int d, int e) { emit_RI7(p, 0x12b, rT, rA, (d << 5) | (e << 4)); } @@ -339,13 +339,13 @@ hbrr; */ #if 0 stop; -EMIT_RR (spu_stopd, 0x140); -EMIT_ (spu_lnop, 0x001); -EMIT_ (spu_nop, 0x201); +EMIT_RR (spe_stopd, 0x140); +EMIT_ (spe_lnop, 0x001); +EMIT_ (spe_nop, 0x201); sync; -EMIT_ (spu_dsync, 0x003); -EMIT_R (spu_mfspr, 0x00c); -EMIT_R (spu_mtspr, 0x10c); +EMIT_ (spe_dsync, 0x003); +EMIT_R (spe_mfspr, 0x00c); +EMIT_R (spe_mtspr, 0x10c); #endif #endif /* GALLIUM_CELL */ diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h index e6cf1d35ba9..9532669b8c1 100644 --- a/src/mesa/ppc/rtasm/spe_asm.h +++ b/src/mesa/ppc/rtasm/spe_asm.h @@ -75,7 +75,7 @@ extern void spe_release_func(struct spe_function *p); /* Memory load / store instructions */ -EMIT_RI10(spe_ldq, 0x034); +EMIT_RI10(spe_lqd, 0x034); EMIT_RR (spe_lqx, 0x1c4); EMIT_RI16(spe_lqa, 0x061); EMIT_RI16(spe_lqr, 0x067); @@ -123,7 +123,7 @@ EMIT_RR (spe_mpy, 0x3c4); EMIT_RR (spe_mpyu, 0x3cc); EMIT_RI10(spe_mpyi, 0x074); EMIT_RI10(spe_mpyui, 0x075); -EMIT_RRR (spy_mpya, 0x00c); +EMIT_RRR (spe_mpya, 0x00c); EMIT_RR (spe_mpyh, 0x3c5); EMIT_RR (spe_mpys, 0x3c7); EMIT_RR (spe_mpyhh, 0x3c6); From e9c6c31651a0c1884633168adfd3ea6797fbdc60 Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 13 Feb 2008 08:20:51 -0700 Subject: [PATCH 34/74] galllium: comments, minor clean-ups --- src/mesa/pipe/draw/draw_vertex.h | 7 ++++++- src/mesa/pipe/draw/draw_vf.c | 2 +- src/mesa/pipe/draw/draw_vf.h | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/mesa/pipe/draw/draw_vertex.h index dfc637b19b1..267c74203bd 100644 --- a/src/mesa/pipe/draw/draw_vertex.h +++ b/src/mesa/pipe/draw/draw_vertex.h @@ -25,7 +25,12 @@ * **************************************************************************/ -/* Author: +/** + * Post-transform vertex format info. The vertex_info struct is used by + * the draw_vbuf code to emit hardware-specific vertex layouts into hw + * vertex buffers. + * + * Author: * Brian Paul */ diff --git a/src/mesa/pipe/draw/draw_vf.c b/src/mesa/pipe/draw/draw_vf.c index f23d7fcec5c..dc3a5ecd219 100644 --- a/src/mesa/pipe/draw/draw_vf.c +++ b/src/mesa/pipe/draw/draw_vf.c @@ -370,7 +370,7 @@ void draw_vf_emit_vertex( struct draw_vertex_fetch *vf, unsigned j; for (j = 0; j < vf->attr_count; j++) { - if(!a[j].isconst) { + if (!a[j].isconst) { a[j].inputptr = (uint8_t *)&vertex->data[a[j].attrib][0]; a[j].inputstride = 0; /* XXX: one-vertex-max ATM */ } diff --git a/src/mesa/pipe/draw/draw_vf.h b/src/mesa/pipe/draw/draw_vf.h index e694b986754..011c8f0ff1c 100644 --- a/src/mesa/pipe/draw/draw_vf.h +++ b/src/mesa/pipe/draw/draw_vf.h @@ -1,5 +1,5 @@ /* - * Copyright 2003 Tungsten Graphics, inc. + * Copyright 2008 Tungsten Graphics, inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -20,6 +20,17 @@ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * Vertex fetch/store/convert code. This functionality is used in two places: + * 1. Vertex fetch/convert - to grab vertex data from incoming vertex + * arrays and convert to format needed by vertex shaders. + * 2. Vertex store/emit - to convert simple float[][4] vertex attributes + * (which is the organization used throughout the draw/prim pipeline) to + * hardware-specific formats and emit into hardware vertex buffers. + * * * Authors: * Keith Whitwell @@ -33,7 +44,7 @@ #include "pipe/p_state.h" #include "draw_vertex.h" -#include "draw_private.h" // for vertex_header +#include "draw_private.h" /* for vertex_header */ enum draw_vf_attr_format { @@ -181,6 +192,7 @@ struct draw_vf_attr_type { unsigned offset; }; +/** XXX this could be moved into draw_vf.c */ struct draw_vf_fastpath { unsigned vertex_stride; unsigned attr_count; @@ -209,6 +221,7 @@ void draw_vf_generate_sse_emit( struct draw_vertex_fetch *vf ); +/** XXX this type and function could probably be moved into draw_vf.c */ struct draw_vf_format_info { const char *name; draw_vf_insert_func insert[4]; From b08102a8f3ef558743f5f952c726ba2c28b6e82e Mon Sep 17 00:00:00 2001 From: Brian Date: Wed, 13 Feb 2008 10:25:38 -0700 Subject: [PATCH 35/74] gallium: rename draw_free_tmps->draw_free_temp_verts, draw_alloc_tmps->draw_alloc_temp_verts --- src/mesa/pipe/draw/draw_clip.c | 4 ++-- src/mesa/pipe/draw/draw_context.c | 4 ++-- src/mesa/pipe/draw/draw_cull.c | 4 ++-- src/mesa/pipe/draw/draw_flatshade.c | 4 ++-- src/mesa/pipe/draw/draw_offset.c | 4 ++-- src/mesa/pipe/draw/draw_private.h | 6 +++--- src/mesa/pipe/draw/draw_stipple.c | 2 +- src/mesa/pipe/draw/draw_twoside.c | 4 ++-- src/mesa/pipe/draw/draw_unfilled.c | 4 ++-- src/mesa/pipe/draw/draw_wide_prims.c | 4 ++-- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c index 61130c5600a..e3051507eaf 100644 --- a/src/mesa/pipe/draw/draw_clip.c +++ b/src/mesa/pipe/draw/draw_clip.c @@ -459,7 +459,7 @@ static void clip_reset_stipple_counter( struct draw_stage *stage ) static void clip_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -472,7 +472,7 @@ struct draw_stage *draw_clip_stage( struct draw_context *draw ) { struct clipper *clipper = CALLOC_STRUCT(clipper); - draw_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES+1 ); + draw_alloc_temp_verts( &clipper->stage, MAX_CLIPPED_VERTICES+1 ); clipper->stage.draw = draw; clipper->stage.point = clip_point; diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c index b15f57c8248..4be38303169 100644 --- a/src/mesa/pipe/draw/draw_context.c +++ b/src/mesa/pipe/draw/draw_context.c @@ -242,7 +242,7 @@ draw_convert_wide_lines(struct draw_context *draw, boolean enable) /** * Allocate space for temporary post-transform vertices, such as for clipping. */ -void draw_alloc_tmps( struct draw_stage *stage, unsigned nr ) +void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr ) { assert(!stage->tmp); @@ -260,7 +260,7 @@ void draw_alloc_tmps( struct draw_stage *stage, unsigned nr ) } -void draw_free_tmps( struct draw_stage *stage ) +void draw_free_temp_verts( struct draw_stage *stage ) { if (stage->tmp) { FREE( stage->tmp[0] ); diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c index 05c274e4dc2..8177b0ac86e 100644 --- a/src/mesa/pipe/draw/draw_cull.c +++ b/src/mesa/pipe/draw/draw_cull.c @@ -123,7 +123,7 @@ static void cull_reset_stipple_counter( struct draw_stage *stage ) static void cull_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -135,7 +135,7 @@ struct draw_stage *draw_cull_stage( struct draw_context *draw ) { struct cull_stage *cull = CALLOC_STRUCT(cull_stage); - draw_alloc_tmps( &cull->stage, 0 ); + draw_alloc_temp_verts( &cull->stage, 0 ); cull->stage.draw = draw; cull->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c index 1419f287d2c..4398abbc60c 100644 --- a/src/mesa/pipe/draw/draw_flatshade.c +++ b/src/mesa/pipe/draw/draw_flatshade.c @@ -176,7 +176,7 @@ static void flatshade_reset_stipple_counter( struct draw_stage *stage ) static void flatshade_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -188,7 +188,7 @@ struct draw_stage *draw_flatshade_stage( struct draw_context *draw ) { struct flat_stage *flatshade = CALLOC_STRUCT(flat_stage); - draw_alloc_tmps( &flatshade->stage, 2 ); + draw_alloc_temp_verts( &flatshade->stage, 2 ); flatshade->stage.draw = draw; flatshade->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c index a2990ee8a88..dbc676deae4 100644 --- a/src/mesa/pipe/draw/draw_offset.c +++ b/src/mesa/pipe/draw/draw_offset.c @@ -159,7 +159,7 @@ static void offset_reset_stipple_counter( struct draw_stage *stage ) static void offset_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -171,7 +171,7 @@ struct draw_stage *draw_offset_stage( struct draw_context *draw ) { struct offset_stage *offset = CALLOC_STRUCT(offset_stage); - draw_alloc_tmps( &offset->stage, 3 ); + draw_alloc_temp_verts( &offset->stage, 3 ); offset->stage.draw = draw; offset->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h index 7782db04770..b17eaaed65e 100644 --- a/src/mesa/pipe/draw/draw_private.h +++ b/src/mesa/pipe/draw/draw_private.h @@ -276,9 +276,9 @@ extern struct draw_stage *draw_wide_stage( struct draw_context *context ); extern struct draw_stage *draw_validate_stage( struct draw_context *context ); -extern void draw_free_tmps( struct draw_stage *stage ); -extern void draw_reset_tmps( struct draw_stage *stage ); -extern void draw_alloc_tmps( struct draw_stage *stage, unsigned nr ); +extern void draw_free_temp_verts( struct draw_stage *stage ); + +extern void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr ); extern void draw_reset_vertex_ids( struct draw_context *draw ); diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/mesa/pipe/draw/draw_stipple.c index 90291019165..fb8b56e84cc 100644 --- a/src/mesa/pipe/draw/draw_stipple.c +++ b/src/mesa/pipe/draw/draw_stipple.c @@ -223,7 +223,7 @@ struct draw_stage *draw_stipple_stage( struct draw_context *draw ) { struct stipple_stage *stipple = CALLOC_STRUCT(stipple_stage); - draw_alloc_tmps( &stipple->stage, 2 ); + draw_alloc_temp_verts( &stipple->stage, 2 ); stipple->stage.draw = draw; stipple->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c index ad2aaf10bb9..1c389579871 100644 --- a/src/mesa/pipe/draw/draw_twoside.c +++ b/src/mesa/pipe/draw/draw_twoside.c @@ -176,7 +176,7 @@ static void twoside_reset_stipple_counter( struct draw_stage *stage ) static void twoside_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -188,7 +188,7 @@ struct draw_stage *draw_twoside_stage( struct draw_context *draw ) { struct twoside_stage *twoside = CALLOC_STRUCT(twoside_stage); - draw_alloc_tmps( &twoside->stage, 3 ); + draw_alloc_temp_verts( &twoside->stage, 3 ); twoside->stage.draw = draw; twoside->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c index 364bda8b791..8bb9f3b5586 100644 --- a/src/mesa/pipe/draw/draw_unfilled.c +++ b/src/mesa/pipe/draw/draw_unfilled.c @@ -176,7 +176,7 @@ static void unfilled_reset_stipple_counter( struct draw_stage *stage ) static void unfilled_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -188,7 +188,7 @@ struct draw_stage *draw_unfilled_stage( struct draw_context *draw ) { struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage); - draw_alloc_tmps( &unfilled->stage, 0 ); + draw_alloc_temp_verts( &unfilled->stage, 0 ); unfilled->stage.draw = draw; unfilled->stage.next = NULL; diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c index 4c7e279b20f..163282b2268 100644 --- a/src/mesa/pipe/draw/draw_wide_prims.c +++ b/src/mesa/pipe/draw/draw_wide_prims.c @@ -408,7 +408,7 @@ static void draw_reset_stipple_counter( struct draw_stage *stage ) static void wide_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } @@ -417,7 +417,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw ) { struct wide_stage *wide = CALLOC_STRUCT(wide_stage); - draw_alloc_tmps( &wide->stage, 4 ); + draw_alloc_temp_verts( &wide->stage, 4 ); wide->stage.draw = draw; wide->stage.next = NULL; From 4f32c532376bc3394f8fce70f95156b49fcc4fec Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 14:15:52 -0700 Subject: [PATCH 36/74] gallium: changes to polygon mode weren't detected in draw_unfilled stage. Need to reset stage->tri = unfilled_first_try in unfilled_flush() so that the front/back state is picked up. --- src/mesa/pipe/draw/draw_unfilled.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c index 8bb9f3b5586..8777cfdfc86 100644 --- a/src/mesa/pipe/draw/draw_unfilled.c +++ b/src/mesa/pipe/draw/draw_unfilled.c @@ -165,6 +165,8 @@ static void unfilled_flush( struct draw_stage *stage, unsigned flags ) { stage->next->flush( stage->next, flags ); + + stage->tri = unfilled_first_tri; } From 59cc1f4e62268cc73567d3e1cccbc5df9d116311 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 14:20:51 -0700 Subject: [PATCH 37/74] gallium: replace "interpolate" terminology with "eval" to better reflect what's being done. --- src/mesa/pipe/tgsi/exec/tgsi_exec.c | 33 +++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 336ae1c8b6d..7801f959727 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -1346,9 +1346,12 @@ exec_tex(struct tgsi_exec_machine *mach, } - +/** + * Evaluate a constant-valued coefficient at the position of the + * current quad. + */ static void -constant_interpolation( +eval_constant_coef( struct tgsi_exec_machine *mach, unsigned attrib, unsigned chan ) @@ -1360,8 +1363,12 @@ constant_interpolation( } } +/** + * Evaluate a linear-valued coefficient at the position of the + * current quad. + */ static void -linear_interpolation( +eval_linear_coef( struct tgsi_exec_machine *mach, unsigned attrib, unsigned chan ) @@ -1377,8 +1384,12 @@ linear_interpolation( mach->Inputs[attrib].xyzw[chan].f[3] = a0 + dadx + dady; } +/** + * Evaluate a perspective-valued coefficient at the position of the + * current quad. + */ static void -perspective_interpolation( +eval_perspective_coef( struct tgsi_exec_machine *mach, unsigned attrib, unsigned chan ) @@ -1397,7 +1408,7 @@ perspective_interpolation( } -typedef void (* interpolation_func)( +typedef void (* eval_coef_func)( struct tgsi_exec_machine *mach, unsigned attrib, unsigned chan ); @@ -1410,7 +1421,7 @@ exec_declaration( if( mach->Processor == TGSI_PROCESSOR_FRAGMENT ) { if( decl->Declaration.File == TGSI_FILE_INPUT ) { unsigned first, last, mask; - interpolation_func interp; + eval_coef_func eval; assert( decl->Declaration.Declare == TGSI_DECLARE_RANGE ); @@ -1420,15 +1431,15 @@ exec_declaration( switch( decl->Interpolation.Interpolate ) { case TGSI_INTERPOLATE_CONSTANT: - interp = constant_interpolation; + eval = eval_constant_coef; break; case TGSI_INTERPOLATE_LINEAR: - interp = linear_interpolation; + eval = eval_linear_coef; break; case TGSI_INTERPOLATE_PERSPECTIVE: - interp = perspective_interpolation; + eval = eval_perspective_coef; break; default: @@ -1440,7 +1451,7 @@ exec_declaration( for( i = first; i <= last; i++ ) { for( j = 0; j < NUM_CHANNELS; j++ ) { - interp( mach, i, j ); + eval( mach, i, j ); } } } @@ -1450,7 +1461,7 @@ exec_declaration( for( j = 0; j < NUM_CHANNELS; j++ ) { if( mask & (1 << j) ) { for( i = first; i <= last; i++ ) { - interp( mach, i, j ); + eval( mach, i, j ); } } } From 7a3e59d2363cba6dd2c1edc08d1afffd25b53ea3 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 14:22:22 -0700 Subject: [PATCH 38/74] gallium: fix some "instruction"/"declaration" mix-ups in tgsi_exec_prepare(). --- src/mesa/pipe/tgsi/exec/tgsi_exec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 7801f959727..37e60070686 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -158,13 +158,13 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) if (numDeclarations == maxDeclarations) { declarations = REALLOC(declarations, maxDeclarations - * sizeof(struct tgsi_full_instruction), + * sizeof(struct tgsi_full_declaration), (maxDeclarations + 10) - * sizeof(struct tgsi_full_instruction)); + * sizeof(struct tgsi_full_declaration)); maxDeclarations += 10; } memcpy(declarations + numDeclarations, - &parse.FullToken.FullInstruction, + &parse.FullToken.FullDeclaration, sizeof(declarations[0])); numDeclarations++; break; From 5e345a653b0adc59487d786050abd01d4cb8b4ca Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 14:48:35 -0700 Subject: [PATCH 39/74] gallium: call draw_flush() in softpipe_flush() Without this, we might not get any rendering at SwapBuffers time when using the vbuf path. --- src/mesa/pipe/softpipe/sp_flush.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/mesa/pipe/softpipe/sp_flush.c index ec6bb4a0dca..fd3078d870b 100644 --- a/src/mesa/pipe/softpipe/sp_flush.c +++ b/src/mesa/pipe/softpipe/sp_flush.c @@ -50,6 +50,8 @@ softpipe_flush( struct pipe_context *pipe, struct softpipe_context *softpipe = softpipe_context(pipe); uint i; + draw_flush(softpipe->draw); + /* - flush the quad pipeline * - flush the texture cache * - flush the render cache From ca2f2c76641a299e31bf3d0e26049ccc3a375caf Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 14:54:37 -0700 Subject: [PATCH 40/74] gallium: new pgon-mode.c test A two-triangle strip is drawn such that the first tri is front-facing and the second tri is back-facing. Use different front/back polygon modes. --- progs/trivial/Makefile | 1 + progs/trivial/pgon-mode.c | 136 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 progs/trivial/pgon-mode.c diff --git a/progs/trivial/Makefile b/progs/trivial/Makefile index 3a1caf15e71..d19abe7e865 100644 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@ -39,6 +39,7 @@ SOURCES = \ linestrip-stipple-wide.c \ linestrip-stipple.c \ linestrip.c \ + pgon-mode.c \ point-clip.c \ point-param.c \ point-sprite.c \ diff --git a/progs/trivial/pgon-mode.c b/progs/trivial/pgon-mode.c new file mode 100644 index 00000000000..db586386196 --- /dev/null +++ b/progs/trivial/pgon-mode.c @@ -0,0 +1,136 @@ +/** + * Test glPolygonMode. + * A tri-strip w/ two tris is drawn so that the first tri is front-facing + * but the second tri is back-facing. + * Set glPolygonMode differently for the front/back faces + * + */ + + +#include +#include +#include +#include + +static int Win; +static GLfloat Zrot = 0; +static GLboolean FrontFillBackUnfilled = GL_TRUE; +static GLboolean Lines = GL_TRUE; + + +static void +Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + if (FrontFillBackUnfilled) { + if (Lines) { + printf("FrontMode = FILL, BackMode = LINE\n"); + glPolygonMode(GL_BACK, GL_LINE); + } + else { + printf("FrontMode = FILL, BackMode = POINT\n"); + glPolygonMode(GL_BACK, GL_POINT); + } + glPolygonMode(GL_FRONT, GL_FILL); + } + else { + if (Lines) { + printf("FrontMode = LINE, BackMode = FILL\n"); + glPolygonMode(GL_FRONT, GL_LINE); + } + else { + printf("FrontMode = POINT, BackMode = FILL\n"); + glPolygonMode(GL_FRONT, GL_POINT); + } + glPolygonMode(GL_BACK, GL_FILL); + } + + glPushMatrix(); + glRotatef(Zrot, 0, 0, 1); + + glBegin(GL_TRIANGLE_STRIP); + glVertex2f(-1, 0); + glVertex2f( 1, 0); + glVertex2f(0, 1); + glVertex2f(0, -1); + glEnd(); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + const GLfloat step = 3.0; + (void) x; + (void) y; + switch (key) { + case 'p': + FrontFillBackUnfilled = !FrontFillBackUnfilled; + break; + case 'l': + Lines = !Lines; + break; + case 'z': + Zrot -= step; + break; + case 'Z': + Zrot += step; + break; + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + printf("GL_RENDERER = %s\n", (char*) glGetString(GL_RENDERER)); + + glLineWidth(3.0); + glPointSize(3.0); + + glColor4f(1, 1, 1, 0.8); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + printf("Press 'p' to toggle polygon mode\n"); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 400); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutDisplayFunc(Draw); + Init(); + glutMainLoop(); + return 0; +} From 4c1403f667c6047a44ff494364725b3b7da82c68 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 18:02:36 -0700 Subject: [PATCH 41/74] gallium: new tgsi_transform_shader() function Used to apply transformations to TGSI shaders, such as register search and replace. --- src/mesa/pipe/tgsi/util/tgsi_transform.c | 199 +++++++++++++++++++++++ src/mesa/pipe/tgsi/util/tgsi_transform.h | 93 +++++++++++ 2 files changed, 292 insertions(+) create mode 100644 src/mesa/pipe/tgsi/util/tgsi_transform.c create mode 100644 src/mesa/pipe/tgsi/util/tgsi_transform.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_transform.c b/src/mesa/pipe/tgsi/util/tgsi_transform.c new file mode 100644 index 00000000000..357f77b05a6 --- /dev/null +++ b/src/mesa/pipe/tgsi/util/tgsi_transform.c @@ -0,0 +1,199 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * TGSI program transformation utility. + * + * Authors: Brian Paul + */ + + +#include "tgsi_transform.h" + + + +static void +emit_instruction(struct tgsi_transform_context *ctx, + const struct tgsi_full_instruction *inst) +{ + uint ti = ctx->ti; + + ti += tgsi_build_full_instruction(inst, + ctx->tokens_out + ti, + ctx->header, + ctx->max_tokens_out - ti); + ctx->ti = ti; +} + + +static void +emit_declaration(struct tgsi_transform_context *ctx, + const struct tgsi_full_declaration *decl) +{ + uint ti = ctx->ti; + + ti += tgsi_build_full_declaration(decl, + ctx->tokens_out + ti, + ctx->header, + ctx->max_tokens_out - ti); + ctx->ti = ti; +} + + +static void +emit_immediate(struct tgsi_transform_context *ctx, + const struct tgsi_full_immediate *imm) +{ + uint ti = ctx->ti; + + ti += tgsi_build_full_immediate(imm, + ctx->tokens_out + ti, + ctx->header, + ctx->max_tokens_out - ti); + ctx->ti = ti; +} + + + +/** + * Apply user-defined transformations to the input shader to produce + * the output shader. + * For example, a register search-and-replace operation could be applied + * by defining a transform_instruction() callback that examined and changed + * the instruction src/dest regs. + * + * \return number of tokens emitted + */ +int +tgsi_transform_shader(const struct tgsi_token *tokens_in, + struct tgsi_token *tokens_out, + uint max_tokens_out, + struct tgsi_transform_context *ctx) +{ + uint procType; + + /* input shader */ + struct tgsi_parse_context parse; + + /* output shader */ + struct tgsi_processor *processor; + + + /** + ** callback context init + **/ + ctx->emit_instruction = emit_instruction; + ctx->emit_declaration = emit_declaration; + ctx->emit_immediate = emit_immediate; + ctx->tokens_out = tokens_out; + ctx->max_tokens_out = max_tokens_out; + + + /** + ** Setup to begin parsing input shader + **/ + if (tgsi_parse_init( &parse, tokens_in ) != TGSI_PARSE_OK) { + debug_printf("tgsi_parse_init() failed in tgsi_transform_shader()!\n"); + return -1; + } + procType = parse.FullHeader.Processor.Processor; + assert(procType == TGSI_PROCESSOR_FRAGMENT || + procType == TGSI_PROCESSOR_VERTEX || + procType == TGSI_PROCESSOR_GEOMETRY); + + + /** + ** Setup output shader + **/ + *(struct tgsi_version *) &tokens_out[0] = tgsi_build_version(); + + ctx->header = (struct tgsi_header *) (tokens_out + 1); + *ctx->header = tgsi_build_header(); + + processor = (struct tgsi_processor *) (tokens_out + 2); + *processor = tgsi_build_processor( procType, ctx->header ); + + ctx->ti = 3; + + + /** + ** Loop over incoming program tokens/instructions + */ + while( !tgsi_parse_end_of_tokens( &parse ) ) { + + tgsi_parse_token( &parse ); + + switch( parse.FullToken.Token.Type ) { + case TGSI_TOKEN_TYPE_INSTRUCTION: + { + struct tgsi_full_instruction *fullinst + = &parse.FullToken.FullInstruction; + + if (ctx->transform_instruction) + ctx->transform_instruction(ctx, fullinst); + else + ctx->emit_instruction(ctx, fullinst); + } + break; + + case TGSI_TOKEN_TYPE_DECLARATION: + { + struct tgsi_full_declaration *fulldecl + = &parse.FullToken.FullDeclaration; + + if (ctx->transform_declaration) + ctx->transform_declaration(ctx, fulldecl); + else + ctx->emit_declaration(ctx, fulldecl); + } + break; + + case TGSI_TOKEN_TYPE_IMMEDIATE: + { + struct tgsi_full_immediate *fullimm + = &parse.FullToken.FullImmediate; + + if (ctx->transform_immediate) + ctx->transform_immediate(ctx, fullimm); + else + ctx->emit_immediate(ctx, fullimm); + } + break; + + default: + assert( 0 ); + } + } + + if (ctx->epilog) { + ctx->epilog(ctx); + } + + tgsi_parse_free (&parse); + + return ctx->ti; +} diff --git a/src/mesa/pipe/tgsi/util/tgsi_transform.h b/src/mesa/pipe/tgsi/util/tgsi_transform.h new file mode 100644 index 00000000000..365d8c298c7 --- /dev/null +++ b/src/mesa/pipe/tgsi/util/tgsi_transform.h @@ -0,0 +1,93 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef TGSI_TRANSFORM_H +#define TGSI_TRANSFORM_H + + +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/tgsi/util/tgsi_parse.h" +#include "pipe/tgsi/util/tgsi_build.h" + + + +/** + * Subclass this to add caller-specific data + */ +struct tgsi_transform_context +{ +/**** PUBLIC ***/ + + /** + * User-defined callbacks invoked per instruction. + */ + void (*transform_instruction)(struct tgsi_transform_context *ctx, + struct tgsi_full_instruction *inst); + + void (*transform_declaration)(struct tgsi_transform_context *ctx, + struct tgsi_full_declaration *decl); + + void (*transform_immediate)(struct tgsi_transform_context *ctx, + struct tgsi_full_immediate *imm); + + /** + * Called at end of input program to allow caller to append extra + * instructions. Return number of tokens emitted. + */ + void (*epilog)(struct tgsi_transform_context *ctx); + + +/*** PRIVATE ***/ + + /** + * These are setup by tgsi_transform_shader() and cannot be overridden. + * Meant to be called from in the above user callback functions. + */ + void (*emit_instruction)(struct tgsi_transform_context *ctx, + const struct tgsi_full_instruction *inst); + void (*emit_declaration)(struct tgsi_transform_context *ctx, + const struct tgsi_full_declaration *decl); + void (*emit_immediate)(struct tgsi_transform_context *ctx, + const struct tgsi_full_immediate *imm); + + struct tgsi_header *header; + uint max_tokens_out; + struct tgsi_token *tokens_out; + uint ti; +}; + + + +extern int +tgsi_transform_shader(const struct tgsi_token *tokens_in, + struct tgsi_token *tokens_out, + uint max_tokens_out, + struct tgsi_transform_context *ctx); + + +#endif /* TGSI_TRANSFORM_H */ From d2b14311d9da8d94056968173d6d5d11f1885d3b Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 18:03:38 -0700 Subject: [PATCH 42/74] gallium: minor function renaming --- src/mesa/pipe/draw/draw_wide_prims.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c index 163282b2268..37b60a6da19 100644 --- a/src/mesa/pipe/draw/draw_wide_prims.c +++ b/src/mesa/pipe/draw/draw_wide_prims.c @@ -400,7 +400,7 @@ static void wide_flush( struct draw_stage *stage, unsigned flags ) } -static void draw_reset_stipple_counter( struct draw_stage *stage ) +static void wide_reset_stipple_counter( struct draw_stage *stage ) { stage->next->reset_stipple_counter( stage->next ); } @@ -425,7 +425,7 @@ struct draw_stage *draw_wide_stage( struct draw_context *draw ) wide->stage.line = wide_first_line; wide->stage.tri = passthrough_tri; wide->stage.flush = wide_flush; - wide->stage.reset_stipple_counter = draw_reset_stipple_counter; + wide->stage.reset_stipple_counter = wide_reset_stipple_counter; wide->stage.destroy = wide_destroy; return &wide->stage; From 1b6540b4b17969e9838facf5248fce34c9ff5c34 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 18:53:18 -0700 Subject: [PATCH 43/74] gallium: include draw_context.h to silence warning --- src/mesa/pipe/softpipe/sp_flush.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/mesa/pipe/softpipe/sp_flush.c index fd3078d870b..ced0d5d0983 100644 --- a/src/mesa/pipe/softpipe/sp_flush.c +++ b/src/mesa/pipe/softpipe/sp_flush.c @@ -31,6 +31,7 @@ #include "pipe/p_defines.h" +#include "pipe/draw/draw_context.h" #include "sp_flush.h" #include "sp_context.h" #include "sp_surface.h" From 3d81a956b9de709de17a98b93fead4d3307b2b99 Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 18:58:50 -0700 Subject: [PATCH 44/74] gallium: rearrange vertex info/layout validation Delay validation until someone really needs the vertex layout (vbuf alloc vertex buffer or point/line/tri setup/rendering). This will allow the vertex size to change depending on whether we're drawing points, lines or triangles. --- src/mesa/pipe/softpipe/sp_prim_setup.c | 21 +-- src/mesa/pipe/softpipe/sp_prim_vbuf.c | 5 +- src/mesa/pipe/softpipe/sp_state.h | 10 ++ src/mesa/pipe/softpipe/sp_state_derived.c | 178 ++++++++++++++-------- 4 files changed, 136 insertions(+), 78 deletions(-) diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index 7478b2336b6..27720486615 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -499,7 +499,7 @@ setup_fragcoord_coeff(struct setup_stage *setup) setup->coef[0].a0[2] = setup->posCoef.a0[2]; setup->coef[0].dadx[2] = setup->posCoef.dadx[2]; setup->coef[0].dady[2] = setup->posCoef.dady[2]; - /*w*/ + /*W*/ setup->coef[0].a0[3] = setup->posCoef.a0[3]; setup->coef[0].dadx[3] = setup->posCoef.dadx[3]; setup->coef[0].dady[3] = setup->posCoef.dady[3]; @@ -513,8 +513,9 @@ setup_fragcoord_coeff(struct setup_stage *setup) */ static void setup_tri_coefficients( struct setup_stage *setup ) { - const struct softpipe_context *softpipe = setup->softpipe; + struct softpipe_context *softpipe = setup->softpipe; const struct pipe_shader_state *fs = &softpipe->fs->shader; + const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe); uint fragSlot; /* z and w are done by linear interpolation: @@ -525,10 +526,10 @@ static void setup_tri_coefficients( struct setup_stage *setup ) /* setup interpolation for all the remaining attributes: */ for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) { - const uint vertSlot = softpipe->vertex_info.src_index[fragSlot]; + const uint vertSlot = vinfo->src_index[fragSlot]; uint j; - switch (softpipe->vertex_info.interp_mode[fragSlot]) { + switch (vinfo->interp_mode[fragSlot]) { case INTERP_CONSTANT: for (j = 0; j < NUM_CHANNELS; j++) const_coeff(setup, &setup->coef[fragSlot], vertSlot, j); @@ -756,8 +757,9 @@ line_persp_coeff(struct setup_stage *setup, static INLINE void setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim) { - const struct softpipe_context *softpipe = setup->softpipe; + struct softpipe_context *softpipe = setup->softpipe; const struct pipe_shader_state *fs = &setup->softpipe->fs->shader; + const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe); uint fragSlot; /* use setup->vmin, vmax to point to vertices */ @@ -779,10 +781,10 @@ setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim) /* setup interpolation for all the remaining attributes: */ for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) { - const uint vertSlot = softpipe->vertex_info.src_index[fragSlot]; + const uint vertSlot = vinfo->src_index[fragSlot]; uint j; - switch (softpipe->vertex_info.interp_mode[fragSlot]) { + switch (vinfo->interp_mode[fragSlot]) { case INTERP_CONSTANT: for (j = 0; j < NUM_CHANNELS; j++) const_coeff(setup, &setup->coef[fragSlot], vertSlot, j); @@ -978,6 +980,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) const boolean round = (boolean) setup->softpipe->rasterizer->point_smooth; const float x = v0->data[0][0]; /* Note: data[0] is always position */ const float y = v0->data[0][1]; + const struct vertex_info *vinfo = softpipe_get_vertex_info(softpipe); uint fragSlot; /* For points, all interpolants are constant-valued. @@ -1003,10 +1006,10 @@ setup_point(struct draw_stage *stage, struct prim_header *prim) const_coeff(setup, &setup->posCoef, 0, 3); for (fragSlot = 0; fragSlot < fs->num_inputs; fragSlot++) { - const uint vertSlot = softpipe->vertex_info.src_index[fragSlot]; + const uint vertSlot = vinfo->src_index[fragSlot]; uint j; - switch (softpipe->vertex_info.interp_mode[fragSlot]) { + switch (vinfo->interp_mode[fragSlot]) { case INTERP_CONSTANT: /* fall-through */ case INTERP_LINEAR: diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c index c9089e7eb22..7f71fdb6a9a 100644 --- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c +++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c @@ -37,6 +37,7 @@ #include "sp_context.h" +#include "sp_state.h" #include "sp_prim_vbuf.h" #include "pipe/draw/draw_context.h" #include "pipe/draw/draw_private.h" @@ -73,9 +74,7 @@ static const struct vertex_info * sp_vbuf_get_vertex_info(struct vbuf_render *vbr) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - /* XXX check for state changes? */ - assert(!cvbr->softpipe->dirty ); - return &cvbr->softpipe->vertex_info_vbuf; + return softpipe_get_vbuf_vertex_info(cvbr->softpipe); } diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index af955c1e17b..b79db0d1f19 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -59,6 +59,8 @@ struct gallivm_prog; #endif +struct vertex_info; + /** Subclass of pipe_shader_state */ struct sp_fragment_shader_state { @@ -174,4 +176,12 @@ softpipe_map_texture_surfaces(struct softpipe_context *sp); void softpipe_unmap_texture_surfaces(struct softpipe_context *sp); + +struct vertex_info * +softpipe_get_vertex_info(struct softpipe_context *softpipe); + +struct vertex_info * +softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe); + + #endif diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 39c3e1afe10..9e4c35e696f 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -49,82 +49,128 @@ find_vs_output(const struct pipe_shader_state *vs, } +/** + * Mark the current vertex layout as "invalid". + * We'll validate the vertex layout later, when we start to actually + * render a point or line or tri. + */ +static void +invalidate_vertex_layout(struct softpipe_context *softpipe) +{ + softpipe->vertex_info.num_attribs = 0; +} + /** - * Determine how to map vertex program outputs to fragment program inputs. - * Basically, this will be used when computing the triangle interpolation - * coefficients from the post-transform vertex attributes. + * The vertex info describes how to convert the post-transformed vertices + * (simple float[][4]) used by the 'draw' module into vertices for + * rasterization. + * + * This function validates the vertex layout and returns a pointer to a + * vertex_info object. */ -static void calculate_vertex_layout( struct softpipe_context *softpipe ) +struct vertex_info * +softpipe_get_vertex_info(struct softpipe_context *softpipe) { - const struct pipe_shader_state *vs = &softpipe->vs->shader; - const struct pipe_shader_state *fs = &softpipe->fs->shader; - const enum interp_mode colorInterp - = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; struct vertex_info *vinfo = &softpipe->vertex_info; - uint i; - if (softpipe->vbuf) { - /* if using the post-transform vertex buffer, tell draw_vbuf to - * simply emit the whole post-xform vertex as-is: - */ - struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; - vinfo_vbuf->num_attribs = 0; - draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0); - vinfo_vbuf->size = 4 * vs->num_outputs + sizeof(struct vertex_header)/4; - } + if (vinfo->num_attribs == 0) { + /* compute vertex layout now */ + const struct pipe_shader_state *vs = &softpipe->vs->shader; + const struct pipe_shader_state *fs = &softpipe->fs->shader; + const enum interp_mode colorInterp + = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; + uint i; - /* - * Loop over fragment shader inputs, searching for the matching output - * from the vertex shader. - */ - vinfo->num_attribs = 0; - for (i = 0; i < fs->num_inputs; i++) { - int src; - switch (fs->input_semantic_name[i]) { - case TGSI_SEMANTIC_POSITION: - src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0); - assert(src >= 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); - break; - - case TGSI_SEMANTIC_COLOR: - src = find_vs_output(vs, TGSI_SEMANTIC_COLOR, - fs->input_semantic_index[i]); - assert(src >= 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); - break; - - case TGSI_SEMANTIC_FOG: - src = find_vs_output(vs, TGSI_SEMANTIC_FOG, 0); -#if 1 - if (src < 0) /* XXX temp hack, try demos/fogcoord.c with this */ - src = 0; -#endif - assert(src >= 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); - break; - - case TGSI_SEMANTIC_GENERIC: - /* this includes texcoords and varying vars */ - src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC, - fs->input_semantic_index[i]); - assert(src >= 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); - break; - - default: - assert(0); + if (softpipe->vbuf) { + /* if using the post-transform vertex buffer, tell draw_vbuf to + * simply emit the whole post-xform vertex as-is: + */ + struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; + vinfo_vbuf->num_attribs = 0; + draw_emit_vertex_attr(vinfo_vbuf, EMIT_ALL, INTERP_NONE, 0); + vinfo_vbuf->size = 4 * vs->num_outputs + + sizeof(struct vertex_header) / 4; } + + /* + * Loop over fragment shader inputs, searching for the matching output + * from the vertex shader. + */ + vinfo->num_attribs = 0; + for (i = 0; i < fs->num_inputs; i++) { + int src; + switch (fs->input_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0); + assert(src >= 0); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); + break; + + case TGSI_SEMANTIC_COLOR: + src = find_vs_output(vs, TGSI_SEMANTIC_COLOR, + fs->input_semantic_index[i]); + if (src < 0) + src = 0; + assert(src >= 0); + draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); + break; + + case TGSI_SEMANTIC_FOG: + src = find_vs_output(vs, TGSI_SEMANTIC_FOG, 0); +#if 1 + if (src < 0) /* XXX temp hack, try demos/fogcoord.c with this */ + src = 0; +#endif + assert(src >= 0); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + break; + + case TGSI_SEMANTIC_GENERIC: + /* this includes texcoords and varying vars */ + src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC, + fs->input_semantic_index[i]); + assert(src >= 0); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + break; + + default: + assert(0); + } + } + + softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0); + if (softpipe->psize_slot >= 0) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, + softpipe->psize_slot); + } + + draw_compute_vertex_size(vinfo); } - softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0); - if (softpipe->psize_slot >= 0) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, - softpipe->psize_slot); - } + return vinfo; +} - draw_compute_vertex_size(vinfo); + +/** + * Called from vbuf module. + * + * Note that there's actually two different vertex layouts in softpipe. + * + * The normal one is computed in softpipe_get_vertex_info() above and is + * used by the point/line/tri "setup" code. + * + * The other one (this one) is only used by the vbuf module (which is + * not normally used by default but used in testing). For the vbuf module, + * we basically want to pass-through the draw module's vertex layout as-is. + * When the softpipe vbuf code begins drawing, the normal vertex layout + * will come into play again. + */ +struct vertex_info * +softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe) +{ + (void) softpipe_get_vertex_info(softpipe); + return &softpipe->vertex_info_vbuf; } @@ -171,7 +217,7 @@ void softpipe_update_derived( struct softpipe_context *softpipe ) if (softpipe->dirty & (SP_NEW_RASTERIZER | SP_NEW_FS | SP_NEW_VS)) - calculate_vertex_layout( softpipe ); + invalidate_vertex_layout( softpipe ); if (softpipe->dirty & (SP_NEW_SCISSOR | SP_NEW_DEPTH_STENCIL_ALPHA | From 663f4aaae618a8f031fa1a6b5292ddc57698741c Mon Sep 17 00:00:00 2001 From: Brian Date: Thu, 14 Feb 2008 19:18:09 -0700 Subject: [PATCH 45/74] gallium: remove some debug assertions in vertex format validation If a fragment shader references an input for which there's no vertex shader output (ex: texcoord3), use vertex output 0 by default. Basically, the attribute's value will be undefined. The shader writer should never rely on undefined fragment shader inputs anyway. --- src/mesa/pipe/softpipe/sp_state_derived.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c index 9e4c35e696f..372597869f3 100644 --- a/src/mesa/pipe/softpipe/sp_state_derived.c +++ b/src/mesa/pipe/softpipe/sp_state_derived.c @@ -34,6 +34,15 @@ #include "sp_state.h" +/** + * Search vertex program's outputs to find a match for the given + * semantic name/index. Return the index of the output slot. + * + * Return 0 if not found. This will cause the fragment program to use + * vertex attrib 0 (position) in the cases where the fragment program + * attempts to use a missing vertex program output. This is an undefined + * condition that users shouldn't hit anyway. + */ static int find_vs_output(const struct pipe_shader_state *vs, uint semantic_name, @@ -45,7 +54,7 @@ find_vs_output(const struct pipe_shader_state *vs, vs->output_semantic_index[i] == semantic_index) return i; } - return -1; + return 0; } @@ -103,26 +112,17 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) switch (fs->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: src = find_vs_output(vs, TGSI_SEMANTIC_POSITION, 0); - assert(src >= 0); draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); break; case TGSI_SEMANTIC_COLOR: src = find_vs_output(vs, TGSI_SEMANTIC_COLOR, fs->input_semantic_index[i]); - if (src < 0) - src = 0; - assert(src >= 0); draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); break; case TGSI_SEMANTIC_FOG: src = find_vs_output(vs, TGSI_SEMANTIC_FOG, 0); -#if 1 - if (src < 0) /* XXX temp hack, try demos/fogcoord.c with this */ - src = 0; -#endif - assert(src >= 0); draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); break; @@ -130,7 +130,6 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) /* this includes texcoords and varying vars */ src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC, fs->input_semantic_index[i]); - assert(src >= 0); draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); break; @@ -140,7 +139,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) } softpipe->psize_slot = find_vs_output(vs, TGSI_SEMANTIC_PSIZE, 0); - if (softpipe->psize_slot >= 0) { + if (softpipe->psize_slot > 0) { draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_CONSTANT, softpipe->psize_slot); } From d8ae972fd067a2478d1b0b4a35fec47ac2c814f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 12 Feb 2008 15:35:18 +0900 Subject: [PATCH 46/74] gallium: Fix MSVC compiler warnings. --- src/mesa/pipe/softpipe/sp_state_sampler.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c index 6a5a643c89e..ea348c7e958 100644 --- a/src/mesa/pipe/softpipe/sp_state_sampler.c +++ b/src/mesa/pipe/softpipe/sp_state_sampler.c @@ -30,6 +30,10 @@ */ #include "pipe/p_util.h" + +#include "pipe/draw/draw_context.h" + +#include "sp_context.h" #include "sp_context.h" #include "sp_state.h" #include "sp_texture.h" From 3f1b712d0a47b440875e58429debd9a145192724 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 7 Feb 2008 10:26:08 +0100 Subject: [PATCH 47/74] gallium: Use MALLOC(). --- src/mesa/pipe/p_util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h index a8938a7e43b..d7da2801c92 100644 --- a/src/mesa/pipe/p_util.h +++ b/src/mesa/pipe/p_util.h @@ -185,12 +185,12 @@ align_free(void *ptr) /** - * Duplicate of a block of memory + * Duplicate a block of memory. */ static INLINE void * mem_dup(const void *src, uint size) { - void *dup = malloc(size); + void *dup = MALLOC(size); if (dup) memcpy(dup, src, size); return dup; From d3cd39493c1e776c1e21045920744a27de2787f1 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 13 Feb 2008 17:51:41 +0100 Subject: [PATCH 48/74] gallium: Fix build on Windows. --- src/mesa/pipe/draw/draw_wide_prims.c | 2 +- src/mesa/pipe/i915simple/i915_surface.c | 2 +- src/mesa/pipe/softpipe/sp_surface.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c index 37b60a6da19..655774b155f 100644 --- a/src/mesa/pipe/draw/draw_wide_prims.c +++ b/src/mesa/pipe/draw/draw_wide_prims.c @@ -175,7 +175,7 @@ static void wide_line_aa(struct draw_stage *stage, float *pos; float dx = header->v[1]->data[0][0] - header->v[0]->data[0][0]; float dy = header->v[1]->data[0][1] - header->v[0]->data[0][1]; - const float len = sqrt(dx * dx + dy * dy); + const float len = (float) sqrt(dx * dx + dy * dy); uint i; dx = dx * half_width / len; diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c index 6d4b8a0aa9f..de0cc5fe06a 100644 --- a/src/mesa/pipe/i915simple/i915_surface.c +++ b/src/mesa/pipe/i915simple/i915_surface.c @@ -99,7 +99,7 @@ i915_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src), - do_flip ? -src->pitch : src->pitch, + do_flip ? -(int) src->pitch : src->pitch, srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 5c6ed3b8d94..8802ced1874 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -54,7 +54,7 @@ sp_surface_copy(struct pipe_context *pipe, dstx, dsty, width, height, pipe_surface_map(src), - do_flip ? -src->pitch : src->pitch, + do_flip ? -(int) src->pitch : src->pitch, srcx, do_flip ? 1 - srcy - height : srcy); pipe_surface_unmap(src); From 6a7820d31f9b697888ce9f9b193bacc86e646fe1 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 14 Feb 2008 17:36:47 +0100 Subject: [PATCH 49/74] gallium: Use align_free() to free aligned memories. --- src/mesa/pipe/pipebuffer/pb_buffer_malloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c index c1b7759874c..9e8244f909b 100644 --- a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c +++ b/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c @@ -110,7 +110,7 @@ pb_malloc_buffer_create(size_t size, buf = CALLOC_STRUCT(malloc_buffer); if(!buf) return NULL; - + buf->base.base.refcount = 1; buf->base.base.alignment = desc->alignment; buf->base.base.usage = desc->usage; @@ -119,7 +119,7 @@ pb_malloc_buffer_create(size_t size, buf->data = align_malloc(size, desc->alignment < sizeof(void*) ? sizeof(void*) : desc->alignment); if(!buf->data) { - FREE(buf); + align_free(buf); return NULL; } From 742c5d3e1ba1455e6aca8454f4b7e146b27fbbe3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 14 Feb 2008 20:48:40 +0100 Subject: [PATCH 50/74] gallium: Fix memory leak. --- src/mesa/pipe/draw/draw_stipple.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/mesa/pipe/draw/draw_stipple.c index fb8b56e84cc..7e0e2137b76 100644 --- a/src/mesa/pipe/draw/draw_stipple.c +++ b/src/mesa/pipe/draw/draw_stipple.c @@ -212,6 +212,7 @@ passthrough_tri(struct draw_stage *stage, struct prim_header *header) static void stipple_destroy( struct draw_stage *stage ) { + draw_free_tmps( stage ); FREE( stage ); } From 19780237ff0e6a89f31ecb9079781568bc2d3fdc Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 14 Feb 2008 21:03:12 +0100 Subject: [PATCH 51/74] gallium: Fix memory leak. --- src/mesa/pipe/draw/draw_vbuf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/mesa/pipe/draw/draw_vbuf.c index be96c8fdeb1..71ac73912b8 100644 --- a/src/mesa/pipe/draw/draw_vbuf.c +++ b/src/mesa/pipe/draw/draw_vbuf.c @@ -523,6 +523,9 @@ static void vbuf_destroy( struct draw_stage *stage ) if(vbuf->vf) draw_vf_destroy( vbuf->vf ); + if (vbuf->render) + vbuf->render->destroy( vbuf->render ); + FREE( stage ); } From 13d9e616f6ee253ecf99dbb67572c87b5dc9270f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 15 Feb 2008 01:11:15 -0500 Subject: [PATCH 52/74] a call was missed during the last rename --- src/mesa/pipe/draw/draw_stipple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/mesa/pipe/draw/draw_stipple.c index 7e0e2137b76..506f33512c8 100644 --- a/src/mesa/pipe/draw/draw_stipple.c +++ b/src/mesa/pipe/draw/draw_stipple.c @@ -212,7 +212,7 @@ passthrough_tri(struct draw_stage *stage, struct prim_header *header) static void stipple_destroy( struct draw_stage *stage ) { - draw_free_tmps( stage ); + draw_free_temp_verts( stage ); FREE( stage ); } From d0364584bea6c57bb3ac8d616e677fb52b97ea98 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 13 Feb 2008 22:53:00 -0500 Subject: [PATCH 53/74] implement swizzling on writes --- src/mesa/pipe/llvm/storagesoa.cpp | 87 ++++++++++++++++--------------- src/mesa/pipe/llvm/storagesoa.h | 14 +++-- src/mesa/pipe/llvm/tgsitollvm.cpp | 9 ++-- 3 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index a65b5c14d9f..75e7a36bc24 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -30,6 +30,8 @@ #include "gallivm_p.h" #include "pipe/p_shader_tokens.h" +#include "pipe/p_debug.h" + #include #include #include @@ -158,49 +160,6 @@ llvm::Value * StorageSoa::extractIndex(llvm::Value *vec) return 0; } -void StorageSoa::storeOutput(int dstIdx, const std::vector &val, - int mask) -{ - if (mask != TGSI_WRITEMASK_XYZW) { - fprintf(stderr, "requires swizzle!!\n"); - assert(0); - } else { - llvm::Value *xChannel = elementPointer(m_output, dstIdx, 0); - llvm::Value *yChannel = elementPointer(m_output, dstIdx, 1); - llvm::Value *zChannel = elementPointer(m_output, dstIdx, 2); - llvm::Value *wChannel = elementPointer(m_output, dstIdx, 3); - - StoreInst *st = new StoreInst(val[0], xChannel, false, m_block); - st = new StoreInst(val[1], yChannel, false, m_block); - st = new StoreInst(val[2], zChannel, false, m_block); - st = new StoreInst(val[3], wChannel, false, m_block); - } -} - -void StorageSoa::storeTemp(int idx, const std::vector &val, - int mask) -{ - if (mask != TGSI_WRITEMASK_XYZW) { - fprintf(stderr, "requires swizzle!!\n"); - assert(0); - } else { - llvm::Value *xChannel = elementPointer(m_temps, idx, 0); - llvm::Value *yChannel = elementPointer(m_temps, idx, 1); - llvm::Value *zChannel = elementPointer(m_temps, idx, 2); - llvm::Value *wChannel = elementPointer(m_temps, idx, 3); - - StoreInst *st = new StoreInst(val[0], xChannel, false, m_block); - st = new StoreInst(val[1], yChannel, false, m_block); - st = new StoreInst(val[2], zChannel, false, m_block); - st = new StoreInst(val[3], wChannel, false, m_block); - } -} - -void StorageSoa::storeAddress(int idx, const std::vector &val, - int mask) -{ -} - llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, int channel) const { @@ -309,6 +268,10 @@ std::vector StorageSoa::argument(Argument type, int idx, int swizz case Immediate: val = immediateElement(idx); break; + case Address: + debug_printf("Address not handled in the fetch phase!\n"); + assert(0); + break; } if (!gallivm_is_swizzle(swizzle)) return val; @@ -321,3 +284,41 @@ std::vector StorageSoa::argument(Argument type, int idx, int swizz res[3] = val[gallivm_w_swizzle(swizzle)]; return res; } + +void StorageSoa::store(Argument type, int idx, const std::vector &val, + int mask) +{ + llvm::Value *out = 0; + switch(type) { + case Output: + out = m_output; + break; + case Temp: + out = m_temps; + break; + case Input: + out = m_input; + break; + default: + debug_printf("Can't save output of this type: %d !\n", type); + assert(0); + break; + } + + if ((mask & TGSI_WRITEMASK_X)) { + llvm::Value *xChannel = elementPointer(out, idx, 0); + new StoreInst(val[0], xChannel, false, m_block); + } + if ((mask & TGSI_WRITEMASK_Y)) { + llvm::Value *yChannel = elementPointer(out, idx, 1); + new StoreInst(val[1], yChannel, false, m_block); + } + if ((mask & TGSI_WRITEMASK_Z)) { + llvm::Value *zChannel = elementPointer(out, idx, 2); + new StoreInst(val[2], zChannel, false, m_block); + } + if ((mask & TGSI_WRITEMASK_W)) { + llvm::Value *wChannel = elementPointer(out, idx, 3); + new StoreInst(val[3], wChannel, false, m_block); + } +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 9443234c82f..8880bf5ec67 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -49,7 +49,8 @@ public: Output, Temp, Const, - Immediate + Immediate, + Address }; public: StorageSoa(llvm::BasicBlock *block, @@ -58,20 +59,17 @@ public: llvm::Value *consts, llvm::Value *temps); + std::vector argument(Argument type, int idx, int swizzle, llvm::Value *indIdx =0); + void store(Argument type, int idx, const std::vector &val, + int mask); + void addImmediate(float *vec); llvm::Value * addrElement(int idx) const; llvm::Value *extractIndex(llvm::Value *vec); - - void storeOutput(int dstIdx, const std::vector &val, - int mask); - void storeTemp(int idx, const std::vector &val, - int mask); - void storeAddress(int idx, const std::vector &val, - int mask); private: llvm::Value *elementPointer(llvm::Value *ptr, int index, int channel) const; diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 10c417996ae..287a86c60cb 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -1063,11 +1063,14 @@ translate_instructionir(llvm::Module *module, struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - storage->storeOutput(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); + storage->store(StorageSoa::Output, + dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) { - storage->storeTemp(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); + storage->store(StorageSoa::Temp, + dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_ADDRESS) { - storage->storeAddress(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); + storage->store(StorageSoa::Address, + dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else { fprintf(stderr, "ERROR: unsupported LLVM destination!"); assert(!"wrong destination"); From ae3375987fe9968f822442a0ce49b97f5f0a4070 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 14 Feb 2008 03:08:48 -0500 Subject: [PATCH 54/74] rename 'argument' to 'load' because that's what it does --- src/mesa/pipe/llvm/storagesoa.cpp | 4 ++-- src/mesa/pipe/llvm/storagesoa.h | 4 ++-- src/mesa/pipe/llvm/tgsitollvm.cpp | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 75e7a36bc24..408b29417ce 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -248,8 +248,8 @@ llvm::Value * StorageSoa::createConstGlobalVector(float *vec) return immediate; } -std::vector StorageSoa::argument(Argument type, int idx, int swizzle, - llvm::Value *indIdx ) +std::vector StorageSoa::load(Argument type, int idx, int swizzle, + llvm::Value *indIdx ) { std::vector val(4); switch(type) { diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index 8880bf5ec67..d59168f07da 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -60,8 +60,8 @@ public: llvm::Value *temps); - std::vector argument(Argument type, int idx, int swizzle, - llvm::Value *indIdx =0); + std::vector load(Argument type, int idx, int swizzle, + llvm::Value *indIdx =0); void store(Argument type, int idx, const std::vector &val, int mask); diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 287a86c60cb..0c2c3a9a0ac 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -706,20 +706,20 @@ translate_instructionir(llvm::Module *module, indIdx = storage->extractIndex(indIdx); } if (src->SrcRegister.File == TGSI_FILE_CONSTANT) { - val = storage->argument(StorageSoa::Const, - src->SrcRegister.Index, swizzle, indIdx); + val = storage->load(StorageSoa::Const, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_INPUT) { - val = storage->argument(StorageSoa::Input, - src->SrcRegister.Index, swizzle, indIdx); + val = storage->load(StorageSoa::Input, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) { - val = storage->argument(StorageSoa::Temp, - src->SrcRegister.Index, swizzle); + val = storage->load(StorageSoa::Temp, + src->SrcRegister.Index, swizzle); } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) { - val = storage->argument(StorageSoa::Output, - src->SrcRegister.Index, swizzle, indIdx); + val = storage->load(StorageSoa::Output, + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_IMMEDIATE) { - val = storage->argument(StorageSoa::Immediate, - src->SrcRegister.Index, swizzle); + val = storage->load(StorageSoa::Immediate, + src->SrcRegister.Index, swizzle); } else { fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File); return; From f70cc89dbc8c0f3e58d6cf8eca92e2df1677c86e Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 14 Feb 2008 22:42:57 -0500 Subject: [PATCH 55/74] redo the way immediates are handled implement madd start implementing arl --- src/mesa/pipe/llvm/instructionssoa.cpp | 64 +++++++++++- src/mesa/pipe/llvm/instructionssoa.h | 9 +- src/mesa/pipe/llvm/storagesoa.cpp | 138 +++++++++++++++++-------- src/mesa/pipe/llvm/storagesoa.h | 15 ++- src/mesa/pipe/llvm/tgsitollvm.cpp | 17 ++- 5 files changed, 188 insertions(+), 55 deletions(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 0c2032e56ff..1e144393e0f 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -1,12 +1,67 @@ #include "instructionssoa.h" +#include "storagesoa.h" + +#include + +using namespace llvm; + InstructionsSoa::InstructionsSoa(llvm::Module *mod, llvm::Function *func, llvm::BasicBlock *block, StorageSoa *storage) : m_builder(block), + m_storage(storage), m_idx(0) { } +const char * InstructionsSoa::name(const char *prefix) const +{ + ++m_idx; + snprintf(m_name, 32, "%s%d", prefix, m_idx); + return m_name; +} + +llvm::Value * InstructionsSoa::vectorFromVals(llvm::Value *x, llvm::Value *y, + llvm::Value *z, llvm::Value *w) +{ + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + Constant *constVector = Constant::getNullValue(vectorType); + Value *res = m_builder.CreateInsertElement(constVector, x, + m_storage->constantInt(0), + name("vecx")); + res = m_builder.CreateInsertElement(res, y, m_storage->constantInt(1), + name("vecxy")); + res = m_builder.CreateInsertElement(res, z, m_storage->constantInt(2), + name("vecxyz")); + if (w) + res = m_builder.CreateInsertElement(res, w, m_storage->constantInt(3), + name("vecxyzw")); + return res; +} + +std::vector InstructionsSoa::arl(const std::vector in) +{ + std::vector res(4); + + //Extract the first x (all 4 should be the same) + llvm::Value *x = m_builder.CreateExtractElement(in[0], + m_storage->constantInt(0), + name("extractX")); + //cast it to an unsigned int + x = m_builder.CreateFPToUI(x, IntegerType::get(32), name("xIntCast")); + + res[0] = x; + //only x is valid. the others shouldn't be necessary + /* + res[1] = Constant::getNullValue(m_floatVecType); + res[2] = Constant::getNullValue(m_floatVecType); + res[3] = Constant::getNullValue(m_floatVecType); + */ + + return res; +} + + std::vector InstructionsSoa::add(const std::vector in1, const std::vector in2) { @@ -38,9 +93,10 @@ void InstructionsSoa::end() m_builder.CreateRetVoid(); } -const char * InstructionsSoa::name(const char *prefix) const +std::vector InstructionsSoa::madd(const std::vector in1, + const std::vector in2, + const std::vector in3) { - ++m_idx; - snprintf(m_name, 32, "%s%d", prefix, m_idx); - return m_name; + std::vector res = mul(in1, in2); + return add(res, in3); } diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/mesa/pipe/llvm/instructionssoa.h index 01955015844..25ff4ac712a 100644 --- a/src/mesa/pipe/llvm/instructionssoa.h +++ b/src/mesa/pipe/llvm/instructionssoa.h @@ -46,17 +46,24 @@ public: InstructionsSoa(llvm::Module *mod, llvm::Function *func, llvm::BasicBlock *block, StorageSoa *storage); + std::vector arl(const std::vector in); + std::vector add(const std::vector in1, const std::vector in2); + std::vector madd(const std::vector in1, + const std::vector in2, + const std::vector in3); std::vector mul(const std::vector in1, const std::vector in2); void end(); private: const char * name(const char *prefix) const; + llvm::Value *vectorFromVals(llvm::Value *x, llvm::Value *y, + llvm::Value *z, llvm::Value *w); private: llvm::LLVMFoldingBuilder m_builder; - + StorageSoa *m_storage; private: mutable int m_idx; mutable char m_name[32]; diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 408b29417ce..f8f4193fd7f 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -55,39 +55,81 @@ StorageSoa::StorageSoa(llvm::BasicBlock *block, m_output(output), m_consts(consts), m_temps(temps), + m_immediates(0), m_idx(0) { } void StorageSoa::addImmediate(float *vec) { - float vals[4]; //decompose into soa + std::vector vals(4); + vals[0] = vec[0]; + vals[1] = vec[1]; + vals[2] = vec[2]; + vals[3] = vec[3]; + m_immediatesToFlush.push_back(vals); +} - vals[0] = vec[0]; vals[1] = vec[0]; vals[2] = vec[0]; vals[3] = vec[0]; - llvm::Value *xChannel = createConstGlobalVector(vals); +void StorageSoa::declareImmediates() +{ + if (m_immediatesToFlush.empty()) + return; - vals[0] = vec[1]; vals[1] = vec[1]; vals[2] = vec[1]; vals[3] = vec[1]; - llvm::Value *yChannel = createConstGlobalVector(vals); + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); + ArrayType *vectorChannels = ArrayType::get(vectorType, 4); + ArrayType *arrayType = ArrayType::get(vectorChannels, m_immediatesToFlush.size()); + m_immediates = new GlobalVariable( + /*Type=*/arrayType, + /*isConstant=*/false, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Initializer=*/0, // has initializer, specified below + /*Name=*/name("immediates"), + currentModule()); - vals[0] = vec[2]; vals[1] = vec[2]; vals[2] = vec[2]; vals[3] = vec[2]; - llvm::Value *zChannel = createConstGlobalVector(vals); + std::vector arrayVals; + for (unsigned int i = 0; i < m_immediatesToFlush.size(); ++i) { + std::vector vec = m_immediatesToFlush[i]; + std::vector vals(4); + std::vector channelArray; - vals[0] = vec[3]; vals[1] = vec[3]; vals[2] = vec[3]; vals[3] = vec[3]; - llvm::Value *wChannel = createConstGlobalVector(vals); + vals[0] = vec[0]; vals[1] = vec[0]; vals[2] = vec[0]; vals[3] = vec[0]; + llvm::Constant *xChannel = createConstGlobalVector(vals); - std::vector res(4); - res[0] = xChannel; - res[1] = yChannel; - res[2] = zChannel; - res[3] = wChannel; + vals[0] = vec[1]; vals[1] = vec[1]; vals[2] = vec[1]; vals[3] = vec[1]; + llvm::Constant *yChannel = createConstGlobalVector(vals); - m_immediates[m_immediates.size()] = res; + vals[0] = vec[2]; vals[1] = vec[2]; vals[2] = vec[2]; vals[3] = vec[2]; + llvm::Constant *zChannel = createConstGlobalVector(vals); + + vals[0] = vec[3]; vals[1] = vec[3]; vals[2] = vec[3]; vals[3] = vec[3]; + llvm::Constant *wChannel = createConstGlobalVector(vals); + channelArray.push_back(xChannel); + channelArray.push_back(yChannel); + channelArray.push_back(zChannel); + channelArray.push_back(wChannel); + Constant *constChannels = ConstantArray::get(vectorChannels, + channelArray); + arrayVals.push_back(constChannels); + } + Constant *constArray = ConstantArray::get(arrayType, arrayVals); + m_immediates->setInitializer(constArray); + + m_immediatesToFlush.clear(); } llvm::Value *StorageSoa::addrElement(int idx) const { - return 0; + std::map::const_iterator itr = m_addresses.find(idx); + if (itr == m_addresses.end()) { + debug_printf("Trying to access invalid shader 'address'\n"); + return 0; + } + llvm::Value * res = (*itr).second; + + res = new LoadInst(res, name("addr"), false, m_block); + + return res; } std::vector StorageSoa::inputElement(int idx, llvm::Value *indIdx) @@ -145,25 +187,21 @@ std::vector StorageSoa::tempElement(int idx, llvm::Value *indIdx) std::vector StorageSoa::immediateElement(int idx) { std::vector res(4); - res = m_immediates[idx]; - res[0] = new LoadInst(res[0], name("immx"), false, m_block); - res[1] = new LoadInst(res[1], name("immy"), false, m_block); - res[2] = new LoadInst(res[2], name("immz"), false, m_block); - res[3] = new LoadInst(res[3], name("immw"), false, m_block); + res[0] = element(m_immediates, idx, 0); + res[1] = element(m_immediates, idx, 1); + res[2] = element(m_immediates, idx, 2); + res[3] = element(m_immediates, idx, 3); return res; } -llvm::Value * StorageSoa::extractIndex(llvm::Value *vec) -{ - return 0; -} - llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, int channel) const { std::vector indices; + if (m_immediates == ptr) + indices.push_back(constantInt(0)); indices.push_back(constantInt(index)); indices.push_back(constantInt(channel)); @@ -220,17 +258,9 @@ llvm::Module * StorageSoa::currentModule() const return m_block->getParent()->getParent(); } -llvm::Value * StorageSoa::createConstGlobalVector(float *vec) +llvm::Constant * StorageSoa::createConstGlobalVector(const std::vector &vec) { VectorType *vectorType = VectorType::get(Type::FloatTy, 4); - GlobalVariable *immediate = new GlobalVariable( - /*Type=*/vectorType, - /*isConstant=*/true, - /*Linkage=*/GlobalValue::ExternalLinkage, - /*Initializer=*/0, // has initializer, specified below - /*Name=*/name("immediate"), - currentModule()); - std::vector immValues; ConstantFP *constx = ConstantFP::get(Type::FloatTy, APFloat(vec[0])); ConstantFP *consty = ConstantFP::get(Type::FloatTy, APFloat(vec[1])); @@ -242,16 +272,15 @@ llvm::Value * StorageSoa::createConstGlobalVector(float *vec) immValues.push_back(constw); Constant *constVector = ConstantVector::get(vectorType, immValues); - // Global Variable Definitions - immediate->setInitializer(constVector); - - return immediate; + return constVector; } std::vector StorageSoa::load(Argument type, int idx, int swizzle, - llvm::Value *indIdx ) + llvm::Value *indIdx) { std::vector val(4); + debug_printf("XXXXXXXXX indIdx = %p\n", indIdx); + assert(!indIdx); switch(type) { case Input: val = inputElement(idx, indIdx); @@ -269,7 +298,7 @@ std::vector StorageSoa::load(Argument type, int idx, int swizzle, val = immediateElement(idx); break; case Address: - debug_printf("Address not handled in the fetch phase!\n"); + debug_printf("Address not handled in the load phase!\n"); assert(0); break; } @@ -299,6 +328,17 @@ void StorageSoa::store(Argument type, int idx, const std::vector & case Input: out = m_input; break; + case Address: { + llvm::Value *addr = m_addresses[idx]; + if (!addr) { + addAddress(idx); + addr = m_addresses[idx]; + assert(addr); + } + new StoreInst(val[0], addr, false, m_block); + return; + break; + } default: debug_printf("Can't save output of this type: %d !\n", type); assert(0); @@ -322,3 +362,19 @@ void StorageSoa::store(Argument type, int idx, const std::vector & new StoreInst(val[3], wChannel, false, m_block); } } + +void StorageSoa::addAddress(int idx) +{ + GlobalVariable *val = new GlobalVariable( + /*Type=*/IntegerType::get(32), + /*isConstant=*/false, + /*Linkage=*/GlobalValue::ExternalLinkage, + /*Initializer=*/0, // has initializer, specified below + /*Name=*/name("address"), + currentModule()); + //val->setInitializer(Constant::getNullValue(IntegerType::get(32))); + val->setInitializer(constantInt(1)); + + debug_printf("adding to %d\n", idx); + m_addresses[idx] = val; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index d59168f07da..ea5db2b4276 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -29,12 +29,14 @@ #define STORAGESOA_H #include +#include #include namespace llvm { class BasicBlock; class Constant; class ConstantInt; + class GlobalVariable; class LoadInst; class Value; class VectorType; @@ -66,20 +68,22 @@ public: int mask); void addImmediate(float *vec); + void declareImmediates(); + + void addAddress(int idx); llvm::Value * addrElement(int idx) const; - llvm::Value *extractIndex(llvm::Value *vec); + llvm::ConstantInt *constantInt(int) const; private: llvm::Value *elementPointer(llvm::Value *ptr, int index, int channel) const; llvm::Value *element(llvm::Value *ptr, int index, int channel) const; const char *name(const char *prefix) const; - llvm::ConstantInt *constantInt(int) const; llvm::Value *alignedArrayLoad(llvm::Value *val); llvm::Module *currentModule() const; - llvm::Value *createConstGlobalVector(float *vec); + llvm::Constant *createConstGlobalVector(const std::vector &vec); std::vector inputElement(int idx, llvm::Value *indIdx =0); std::vector constElement(int idx, llvm::Value *indIdx =0); @@ -93,8 +97,11 @@ private: llvm::Value *m_output; llvm::Value *m_consts; llvm::Value *m_temps; + llvm::GlobalVariable *m_immediates; - std::map > m_immediates; + std::map m_addresses; + + std::vector > m_immediatesToFlush; mutable std::map m_constInts; mutable char m_name[32]; diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 0c2c3a9a0ac..071b7d112e4 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -148,10 +148,14 @@ translate_declaration(struct gallivm_ir *prog, static void translate_declarationir(struct gallivm_ir *, llvm::Module *, - StorageSoa *, - struct tgsi_full_declaration *, + StorageSoa *storage, + struct tgsi_full_declaration *decl, struct tgsi_full_declaration *) { + if (decl->Declaration.File == TGSI_FILE_ADDRESS) { + int idx = decl->u.DeclarationRange.First; + storage->addAddress(idx); + } } static void @@ -703,7 +707,7 @@ translate_instructionir(llvm::Module *module, if (src->SrcRegister.Indirect) { indIdx = storage->addrElement(src->SrcRegisterInd.Index); - indIdx = storage->extractIndex(indIdx); + debug_printf("AAAAAAAAAAAAAAA INDIRECT %p\n", indIdx); } if (src->SrcRegister.File == TGSI_FILE_CONSTANT) { val = storage->load(StorageSoa::Const, @@ -713,13 +717,13 @@ translate_instructionir(llvm::Module *module, src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) { val = storage->load(StorageSoa::Temp, - src->SrcRegister.Index, swizzle); + src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) { val = storage->load(StorageSoa::Output, src->SrcRegister.Index, swizzle, indIdx); } else if (src->SrcRegister.File == TGSI_FILE_IMMEDIATE) { val = storage->load(StorageSoa::Immediate, - src->SrcRegister.Index, swizzle); + src->SrcRegister.Index, swizzle, indIdx); } else { fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File); return; @@ -731,6 +735,7 @@ translate_instructionir(llvm::Module *module, std::vector out(4); switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ARL: { + out = instr->arl(inputs[0]); } break; case TGSI_OPCODE_MOV: { @@ -780,6 +785,7 @@ translate_instructionir(llvm::Module *module, } break; case TGSI_OPCODE_MAD: { + out = instr->madd(inputs[0], inputs[1], inputs[2]); } break; case TGSI_OPCODE_SUB: { @@ -1198,6 +1204,7 @@ llvm::Module * tgsi_to_llvmir(struct gallivm_ir *ir, break; case TGSI_TOKEN_TYPE_INSTRUCTION: + storage.declareImmediates(); translate_instructionir(mod, &storage, &instr, &parse.FullToken.FullInstruction, &fi, instno); From cf51d5c4210d3301c96947e6e80e71c252bc04d1 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 14 Feb 2008 23:50:39 -0500 Subject: [PATCH 56/74] redo indirection make all load's respect indirection --- src/mesa/pipe/llvm/instructionssoa.cpp | 43 ++++++++-- src/mesa/pipe/llvm/instructionssoa.h | 1 + src/mesa/pipe/llvm/storagesoa.cpp | 111 +++++++++++++++++++------ src/mesa/pipe/llvm/storagesoa.h | 6 +- 4 files changed, 130 insertions(+), 31 deletions(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 1e144393e0f..9c38c64bd10 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -43,14 +43,26 @@ std::vector InstructionsSoa::arl(const std::vector i { std::vector res(4); - //Extract the first x (all 4 should be the same) - llvm::Value *x = m_builder.CreateExtractElement(in[0], - m_storage->constantInt(0), - name("extractX")); + //Extract x's + llvm::Value *x1 = m_builder.CreateExtractElement(in[0], + m_storage->constantInt(0), + name("extractX")); + llvm::Value *x2 = m_builder.CreateExtractElement(in[0], + m_storage->constantInt(1), + name("extractX")); + llvm::Value *x3 = m_builder.CreateExtractElement(in[0], + m_storage->constantInt(2), + name("extractX")); + llvm::Value *x4 = m_builder.CreateExtractElement(in[0], + m_storage->constantInt(3), + name("extractX")); //cast it to an unsigned int - x = m_builder.CreateFPToUI(x, IntegerType::get(32), name("xIntCast")); + x1 = m_builder.CreateFPToUI(x1, IntegerType::get(32), name("x1IntCast")); + x2 = m_builder.CreateFPToUI(x2, IntegerType::get(32), name("x2IntCast")); + x3 = m_builder.CreateFPToUI(x3, IntegerType::get(32), name("x3IntCast")); + x4 = m_builder.CreateFPToUI(x4, IntegerType::get(32), name("x4IntCast")); - res[0] = x; + res[0] = vectorFromVals(x1, x2, x3, x4); //only x is valid. the others shouldn't be necessary /* res[1] = Constant::getNullValue(m_floatVecType); @@ -100,3 +112,22 @@ std::vector InstructionsSoa::madd(const std::vector std::vector res = mul(in1, in2); return add(res, in3); } + +std::vector InstructionsSoa::extractVector(llvm::Value *vector) +{ + std::vector res(4); + res[0] = m_builder.CreateExtractElement(vector, + m_storage->constantInt(0), + name("extract1X")); + res[1] = m_builder.CreateExtractElement(vector, + m_storage->constantInt(1), + name("extract2X")); + res[2] = m_builder.CreateExtractElement(vector, + m_storage->constantInt(2), + name("extract3X")); + res[3] = m_builder.CreateExtractElement(vector, + m_storage->constantInt(3), + name("extract4X")); + + return res; +} diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/mesa/pipe/llvm/instructionssoa.h index 25ff4ac712a..4169dcbb2eb 100644 --- a/src/mesa/pipe/llvm/instructionssoa.h +++ b/src/mesa/pipe/llvm/instructionssoa.h @@ -57,6 +57,7 @@ public: const std::vector in2); void end(); + std::vector extractVector(llvm::Value *vector); private: const char * name(const char *prefix) const; llvm::Value *vectorFromVals(llvm::Value *x, llvm::Value *y, diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index f8f4193fd7f..314ffe62dc3 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -136,10 +136,17 @@ std::vector StorageSoa::inputElement(int idx, llvm::Value *indIdx) { std::vector res(4); - res[0] = element(m_input, idx, 0); - res[1] = element(m_input, idx, 1); - res[2] = element(m_input, idx, 2); - res[3] = element(m_input, idx, 3); + if (!indIdx) { + res[0] = element(m_input, idx, 0); + res[1] = element(m_input, idx, 1); + res[2] = element(m_input, idx, 2); + res[3] = element(m_input, idx, 3); + } else { + res[0] = indirectElement(m_input, indIdx, 0); + res[1] = indirectElement(m_input, indIdx, 1); + res[2] = indirectElement(m_input, indIdx, 2); + res[3] = indirectElement(m_input, indIdx, 3); + } return res; } @@ -147,10 +154,18 @@ std::vector StorageSoa::inputElement(int idx, llvm::Value *indIdx) std::vector StorageSoa::constElement(int idx, llvm::Value *indIdx) { std::vector res(4); - llvm::Value *xChannel = elementPointer(m_consts, idx, 0); - llvm::Value *yChannel = elementPointer(m_consts, idx, 1); - llvm::Value *zChannel = elementPointer(m_consts, idx, 2); - llvm::Value *wChannel = elementPointer(m_consts, idx, 3); + llvm::Value *xChannel, *yChannel, *zChannel, *wChannel; + if (!indIdx) { + xChannel = elementPointer(m_consts, idx, 0); + yChannel = elementPointer(m_consts, idx, 1); + zChannel = elementPointer(m_consts, idx, 2); + wChannel = elementPointer(m_consts, idx, 3); + } else { + xChannel = indirectElementPointer(m_consts, indIdx, 0); + yChannel = indirectElementPointer(m_consts, indIdx, 1); + zChannel = indirectElementPointer(m_consts, indIdx, 2); + wChannel = indirectElementPointer(m_consts, indIdx, 3); + } res[0] = alignedArrayLoad(xChannel); res[1] = alignedArrayLoad(yChannel); @@ -164,10 +179,17 @@ std::vector StorageSoa::outputElement(int idx, llvm::Value *indIdx { std::vector res(4); - res[0] = element(m_output, idx, 0); - res[1] = element(m_output, idx, 1); - res[2] = element(m_output, idx, 2); - res[3] = element(m_output, idx, 3); + if (!indIdx) { + res[0] = element(m_output, idx, 0); + res[1] = element(m_output, idx, 1); + res[2] = element(m_output, idx, 2); + res[3] = element(m_output, idx, 3); + } else { + res[0] = indirectElement(m_output, indIdx, 0); + res[1] = indirectElement(m_output, indIdx, 1); + res[2] = indirectElement(m_output, indIdx, 2); + res[3] = indirectElement(m_output, indIdx, 3); + } return res; } @@ -176,22 +198,36 @@ std::vector StorageSoa::tempElement(int idx, llvm::Value *indIdx) { std::vector res(4); - res[0] = element(m_temps, idx, 0); - res[1] = element(m_temps, idx, 1); - res[2] = element(m_temps, idx, 2); - res[3] = element(m_temps, idx, 3); + if (!indIdx) { + res[0] = element(m_temps, idx, 0); + res[1] = element(m_temps, idx, 1); + res[2] = element(m_temps, idx, 2); + res[3] = element(m_temps, idx, 3); + } else { + res[0] = indirectElement(m_temps, indIdx, 0); + res[1] = indirectElement(m_temps, indIdx, 1); + res[2] = indirectElement(m_temps, indIdx, 2); + res[3] = indirectElement(m_temps, indIdx, 3); + } return res; } -std::vector StorageSoa::immediateElement(int idx) +std::vector StorageSoa::immediateElement(int idx, llvm::Value *indIdx) { std::vector res(4); - res[0] = element(m_immediates, idx, 0); - res[1] = element(m_immediates, idx, 1); - res[2] = element(m_immediates, idx, 2); - res[3] = element(m_immediates, idx, 3); + if (!indIdx) { + res[0] = element(m_immediates, idx, 0); + res[1] = element(m_immediates, idx, 1); + res[2] = element(m_immediates, idx, 2); + res[3] = element(m_immediates, idx, 3); + } else { + res[0] = indirectElement(m_immediates, indIdx, 0); + res[1] = indirectElement(m_immediates, indIdx, 1); + res[2] = indirectElement(m_immediates, indIdx, 2); + res[3] = indirectElement(m_immediates, indIdx, 3); + } return res; } @@ -295,7 +331,7 @@ std::vector StorageSoa::load(Argument type, int idx, int swizzle, val = constElement(idx, indIdx); break; case Immediate: - val = immediateElement(idx); + val = immediateElement(idx, indIdx); break; case Address: debug_printf("Address not handled in the load phase!\n"); @@ -365,16 +401,43 @@ void StorageSoa::store(Argument type, int idx, const std::vector & void StorageSoa::addAddress(int idx) { + VectorType *vectorType = VectorType::get(Type::FloatTy, 4); GlobalVariable *val = new GlobalVariable( - /*Type=*/IntegerType::get(32), + /*Type=*/vectorType, /*isConstant=*/false, /*Linkage=*/GlobalValue::ExternalLinkage, /*Initializer=*/0, // has initializer, specified below /*Name=*/name("address"), currentModule()); //val->setInitializer(Constant::getNullValue(IntegerType::get(32))); - val->setInitializer(constantInt(1)); + //val->setInitializer(constantInt(1)); debug_printf("adding to %d\n", idx); m_addresses[idx] = val; } + +llvm::Value * StorageSoa::indirectElementPointer(llvm::Value *ptr, llvm::Value *indIdx, + int channel) const +{ + std::vector indices; + if (m_immediates == ptr) + indices.push_back(constantInt(0)); + indices.push_back(indIdx); + indices.push_back(constantInt(channel)); + + GetElementPtrInst *getElem = new GetElementPtrInst(ptr, + indices.begin(), + indices.end(), + name("ptr"), + m_block); + return getElem; +} + +llvm::Value * StorageSoa::indirectElement(llvm::Value *ptr, llvm::Value *indIdx, + int channel) const +{ + llvm::Value *res = indirectElementPointer(ptr, indIdx, channel); + LoadInst *load = new LoadInst(res, name("element"), false, m_block); + //load->setAlignment(8); + return load; +} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index ea5db2b4276..ca8fee63407 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -80,6 +80,10 @@ private: int channel) const; llvm::Value *element(llvm::Value *ptr, int index, int channel) const; + llvm::Value *indirectElementPointer(llvm::Value *ptr, llvm::Value *indIdx, + int channel) const; + llvm::Value *indirectElement(llvm::Value *ptr, llvm::Value *indIdx, + int channel) const; const char *name(const char *prefix) const; llvm::Value *alignedArrayLoad(llvm::Value *val); llvm::Module *currentModule() const; @@ -89,7 +93,7 @@ private: std::vector constElement(int idx, llvm::Value *indIdx =0); std::vector outputElement(int idx, llvm::Value *indIdx =0); std::vector tempElement(int idx, llvm::Value *indIdx =0); - std::vector immediateElement(int idx); + std::vector immediateElement(int idx, llvm::Value *indIdx =0); private: llvm::BasicBlock *m_block; From 4593be34b2a6e494f0e476c8aa8e1d2633fffd47 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 15 Feb 2008 00:36:18 -0500 Subject: [PATCH 57/74] vastly simplify indexing --- src/mesa/pipe/llvm/instructionssoa.cpp | 14 +-- src/mesa/pipe/llvm/storagesoa.cpp | 156 ++++++++----------------- src/mesa/pipe/llvm/storagesoa.h | 18 ++- src/mesa/pipe/llvm/tgsitollvm.cpp | 1 - 4 files changed, 59 insertions(+), 130 deletions(-) diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/mesa/pipe/llvm/instructionssoa.cpp index 9c38c64bd10..a4d50466373 100644 --- a/src/mesa/pipe/llvm/instructionssoa.cpp +++ b/src/mesa/pipe/llvm/instructionssoa.cpp @@ -47,22 +47,10 @@ std::vector InstructionsSoa::arl(const std::vector i llvm::Value *x1 = m_builder.CreateExtractElement(in[0], m_storage->constantInt(0), name("extractX")); - llvm::Value *x2 = m_builder.CreateExtractElement(in[0], - m_storage->constantInt(1), - name("extractX")); - llvm::Value *x3 = m_builder.CreateExtractElement(in[0], - m_storage->constantInt(2), - name("extractX")); - llvm::Value *x4 = m_builder.CreateExtractElement(in[0], - m_storage->constantInt(3), - name("extractX")); //cast it to an unsigned int x1 = m_builder.CreateFPToUI(x1, IntegerType::get(32), name("x1IntCast")); - x2 = m_builder.CreateFPToUI(x2, IntegerType::get(32), name("x2IntCast")); - x3 = m_builder.CreateFPToUI(x3, IntegerType::get(32), name("x3IntCast")); - x4 = m_builder.CreateFPToUI(x4, IntegerType::get(32), name("x4IntCast")); - res[0] = vectorFromVals(x1, x2, x3, x4); + res[0] = x1;//vectorFromVals(x1, x2, x3, x4); //only x is valid. the others shouldn't be necessary /* res[1] = Constant::getNullValue(m_floatVecType); diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/mesa/pipe/llvm/storagesoa.cpp index 314ffe62dc3..ed0674a96f0 100644 --- a/src/mesa/pipe/llvm/storagesoa.cpp +++ b/src/mesa/pipe/llvm/storagesoa.cpp @@ -132,40 +132,27 @@ llvm::Value *StorageSoa::addrElement(int idx) const return res; } -std::vector StorageSoa::inputElement(int idx, llvm::Value *indIdx) +std::vector StorageSoa::inputElement(llvm::Value *idx) { std::vector res(4); - if (!indIdx) { - res[0] = element(m_input, idx, 0); - res[1] = element(m_input, idx, 1); - res[2] = element(m_input, idx, 2); - res[3] = element(m_input, idx, 3); - } else { - res[0] = indirectElement(m_input, indIdx, 0); - res[1] = indirectElement(m_input, indIdx, 1); - res[2] = indirectElement(m_input, indIdx, 2); - res[3] = indirectElement(m_input, indIdx, 3); - } + res[0] = element(m_input, idx, 0); + res[1] = element(m_input, idx, 1); + res[2] = element(m_input, idx, 2); + res[3] = element(m_input, idx, 3); return res; } -std::vector StorageSoa::constElement(int idx, llvm::Value *indIdx) +std::vector StorageSoa::constElement(llvm::Value *idx) { std::vector res(4); llvm::Value *xChannel, *yChannel, *zChannel, *wChannel; - if (!indIdx) { - xChannel = elementPointer(m_consts, idx, 0); - yChannel = elementPointer(m_consts, idx, 1); - zChannel = elementPointer(m_consts, idx, 2); - wChannel = elementPointer(m_consts, idx, 3); - } else { - xChannel = indirectElementPointer(m_consts, indIdx, 0); - yChannel = indirectElementPointer(m_consts, indIdx, 1); - zChannel = indirectElementPointer(m_consts, indIdx, 2); - wChannel = indirectElementPointer(m_consts, indIdx, 3); - } + + xChannel = elementPointer(m_consts, idx, 0); + yChannel = elementPointer(m_consts, idx, 1); + zChannel = elementPointer(m_consts, idx, 2); + wChannel = elementPointer(m_consts, idx, 3); res[0] = alignedArrayLoad(xChannel); res[1] = alignedArrayLoad(yChannel); @@ -175,70 +162,49 @@ std::vector StorageSoa::constElement(int idx, llvm::Value *indIdx) return res; } -std::vector StorageSoa::outputElement(int idx, llvm::Value *indIdx) +std::vector StorageSoa::outputElement(llvm::Value *idx) { std::vector res(4); - if (!indIdx) { - res[0] = element(m_output, idx, 0); - res[1] = element(m_output, idx, 1); - res[2] = element(m_output, idx, 2); - res[3] = element(m_output, idx, 3); - } else { - res[0] = indirectElement(m_output, indIdx, 0); - res[1] = indirectElement(m_output, indIdx, 1); - res[2] = indirectElement(m_output, indIdx, 2); - res[3] = indirectElement(m_output, indIdx, 3); - } + res[0] = element(m_output, idx, 0); + res[1] = element(m_output, idx, 1); + res[2] = element(m_output, idx, 2); + res[3] = element(m_output, idx, 3); return res; } -std::vector StorageSoa::tempElement(int idx, llvm::Value *indIdx) +std::vector StorageSoa::tempElement(llvm::Value *idx) { std::vector res(4); - if (!indIdx) { - res[0] = element(m_temps, idx, 0); - res[1] = element(m_temps, idx, 1); - res[2] = element(m_temps, idx, 2); - res[3] = element(m_temps, idx, 3); - } else { - res[0] = indirectElement(m_temps, indIdx, 0); - res[1] = indirectElement(m_temps, indIdx, 1); - res[2] = indirectElement(m_temps, indIdx, 2); - res[3] = indirectElement(m_temps, indIdx, 3); - } + res[0] = element(m_temps, idx, 0); + res[1] = element(m_temps, idx, 1); + res[2] = element(m_temps, idx, 2); + res[3] = element(m_temps, idx, 3); return res; } -std::vector StorageSoa::immediateElement(int idx, llvm::Value *indIdx) +std::vector StorageSoa::immediateElement(llvm::Value *idx) { std::vector res(4); - if (!indIdx) { - res[0] = element(m_immediates, idx, 0); - res[1] = element(m_immediates, idx, 1); - res[2] = element(m_immediates, idx, 2); - res[3] = element(m_immediates, idx, 3); - } else { - res[0] = indirectElement(m_immediates, indIdx, 0); - res[1] = indirectElement(m_immediates, indIdx, 1); - res[2] = indirectElement(m_immediates, indIdx, 2); - res[3] = indirectElement(m_immediates, indIdx, 3); - } + res[0] = element(m_immediates, idx, 0); + res[1] = element(m_immediates, idx, 1); + res[2] = element(m_immediates, idx, 2); + res[3] = element(m_immediates, idx, 3); return res; } -llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, +llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, llvm::Value *index, int channel) const { std::vector indices; if (m_immediates == ptr) indices.push_back(constantInt(0)); - indices.push_back(constantInt(index)); + indices.push_back(index); indices.push_back(constantInt(channel)); GetElementPtrInst *getElem = new GetElementPtrInst(ptr, @@ -249,7 +215,7 @@ llvm::Value * StorageSoa::elementPointer(llvm::Value *ptr, int index, return getElem; } -llvm::Value * StorageSoa::element(llvm::Value *ptr, int index, +llvm::Value * StorageSoa::element(llvm::Value *ptr, llvm::Value *index, int channel) const { llvm::Value *res = elementPointer(ptr, index, channel); @@ -315,23 +281,31 @@ std::vector StorageSoa::load(Argument type, int idx, int swizzle, llvm::Value *indIdx) { std::vector val(4); - debug_printf("XXXXXXXXX indIdx = %p\n", indIdx); - assert(!indIdx); + + //if we have an indirect index, always use that + // if not use the integer offset to create one + llvm::Value *realIndex = 0; + if (indIdx) + realIndex = indIdx; + else + realIndex = constantInt(idx); + debug_printf("XXXXXXXXX realIdx = %p, indIdx = %p\n", realIndex, indIdx); + switch(type) { case Input: - val = inputElement(idx, indIdx); + val = inputElement(realIndex); break; case Output: - val = outputElement(idx, indIdx); + val = outputElement(realIndex); break; case Temp: - val = tempElement(idx, indIdx); + val = tempElement(realIndex); break; case Const: - val = constElement(idx, indIdx); + val = constElement(realIndex); break; case Immediate: - val = immediateElement(idx, indIdx); + val = immediateElement(realIndex); break; case Address: debug_printf("Address not handled in the load phase!\n"); @@ -380,64 +354,36 @@ void StorageSoa::store(Argument type, int idx, const std::vector & assert(0); break; } - + llvm::Value *realIndex = constantInt(idx); if ((mask & TGSI_WRITEMASK_X)) { - llvm::Value *xChannel = elementPointer(out, idx, 0); + llvm::Value *xChannel = elementPointer(out, realIndex, 0); new StoreInst(val[0], xChannel, false, m_block); } if ((mask & TGSI_WRITEMASK_Y)) { - llvm::Value *yChannel = elementPointer(out, idx, 1); + llvm::Value *yChannel = elementPointer(out, realIndex, 1); new StoreInst(val[1], yChannel, false, m_block); } if ((mask & TGSI_WRITEMASK_Z)) { - llvm::Value *zChannel = elementPointer(out, idx, 2); + llvm::Value *zChannel = elementPointer(out, realIndex, 2); new StoreInst(val[2], zChannel, false, m_block); } if ((mask & TGSI_WRITEMASK_W)) { - llvm::Value *wChannel = elementPointer(out, idx, 3); + llvm::Value *wChannel = elementPointer(out, realIndex, 3); new StoreInst(val[3], wChannel, false, m_block); } } void StorageSoa::addAddress(int idx) { - VectorType *vectorType = VectorType::get(Type::FloatTy, 4); GlobalVariable *val = new GlobalVariable( - /*Type=*/vectorType, + /*Type=*/IntegerType::get(32), /*isConstant=*/false, /*Linkage=*/GlobalValue::ExternalLinkage, /*Initializer=*/0, // has initializer, specified below /*Name=*/name("address"), currentModule()); - //val->setInitializer(Constant::getNullValue(IntegerType::get(32))); - //val->setInitializer(constantInt(1)); + val->setInitializer(Constant::getNullValue(IntegerType::get(32))); debug_printf("adding to %d\n", idx); m_addresses[idx] = val; } - -llvm::Value * StorageSoa::indirectElementPointer(llvm::Value *ptr, llvm::Value *indIdx, - int channel) const -{ - std::vector indices; - if (m_immediates == ptr) - indices.push_back(constantInt(0)); - indices.push_back(indIdx); - indices.push_back(constantInt(channel)); - - GetElementPtrInst *getElem = new GetElementPtrInst(ptr, - indices.begin(), - indices.end(), - name("ptr"), - m_block); - return getElem; -} - -llvm::Value * StorageSoa::indirectElement(llvm::Value *ptr, llvm::Value *indIdx, - int channel) const -{ - llvm::Value *res = indirectElementPointer(ptr, indIdx, channel); - LoadInst *load = new LoadInst(res, name("element"), false, m_block); - //load->setAlignment(8); - return load; -} diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/mesa/pipe/llvm/storagesoa.h index ca8fee63407..6443351f270 100644 --- a/src/mesa/pipe/llvm/storagesoa.h +++ b/src/mesa/pipe/llvm/storagesoa.h @@ -76,24 +76,20 @@ public: llvm::ConstantInt *constantInt(int) const; private: - llvm::Value *elementPointer(llvm::Value *ptr, int index, + llvm::Value *elementPointer(llvm::Value *ptr, llvm::Value *indIdx, int channel) const; - llvm::Value *element(llvm::Value *ptr, int index, + llvm::Value *element(llvm::Value *ptr, llvm::Value *idx, int channel) const; - llvm::Value *indirectElementPointer(llvm::Value *ptr, llvm::Value *indIdx, - int channel) const; - llvm::Value *indirectElement(llvm::Value *ptr, llvm::Value *indIdx, - int channel) const; const char *name(const char *prefix) const; llvm::Value *alignedArrayLoad(llvm::Value *val); llvm::Module *currentModule() const; llvm::Constant *createConstGlobalVector(const std::vector &vec); - std::vector inputElement(int idx, llvm::Value *indIdx =0); - std::vector constElement(int idx, llvm::Value *indIdx =0); - std::vector outputElement(int idx, llvm::Value *indIdx =0); - std::vector tempElement(int idx, llvm::Value *indIdx =0); - std::vector immediateElement(int idx, llvm::Value *indIdx =0); + std::vector inputElement(llvm::Value *indIdx); + std::vector constElement(llvm::Value *indIdx); + std::vector outputElement(llvm::Value *indIdx); + std::vector tempElement(llvm::Value *indIdx); + std::vector immediateElement(llvm::Value *indIdx); private: llvm::BasicBlock *m_block; diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/mesa/pipe/llvm/tgsitollvm.cpp index 071b7d112e4..0de595e6789 100644 --- a/src/mesa/pipe/llvm/tgsitollvm.cpp +++ b/src/mesa/pipe/llvm/tgsitollvm.cpp @@ -707,7 +707,6 @@ translate_instructionir(llvm::Module *module, if (src->SrcRegister.Indirect) { indIdx = storage->addrElement(src->SrcRegisterInd.Index); - debug_printf("AAAAAAAAAAAAAAA INDIRECT %p\n", indIdx); } if (src->SrcRegister.File == TGSI_FILE_CONSTANT) { val = storage->load(StorageSoa::Const, From b642730be93149baa7556e5791393168ab396175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Feb 2008 17:35:24 +0900 Subject: [PATCH 58/74] Code reorganization: move files into their places. This is in a separate commit to ensure renames are properly preserved. --- src/{mesa/pipe => gallium}/Makefile | 0 src/{mesa/pipe => gallium}/Makefile.template | 0 src/{mesa/pipe => gallium}/README.portability | 0 src/{mesa/pipe => gallium}/SConscript | 0 src/{mesa/pipe => gallium/aux}/cso_cache/cso_cache.c | 0 src/{mesa/pipe => gallium/aux}/cso_cache/cso_cache.h | 0 src/{mesa/pipe => gallium/aux}/cso_cache/cso_hash.c | 0 src/{mesa/pipe => gallium/aux}/cso_cache/cso_hash.h | 0 src/{mesa/pipe => gallium/aux}/draw/Makefile | 0 src/{mesa/pipe => gallium/aux}/draw/draw_clip.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_context.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_context.h | 0 src/{mesa/pipe => gallium/aux}/draw/draw_cull.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_debug.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_flatshade.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_offset.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_prim.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_private.h | 0 src/{mesa/pipe => gallium/aux}/draw/draw_stipple.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_twoside.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_unfilled.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_validate.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vbuf.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vbuf.h | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vertex.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vertex.h | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vertex_cache.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vertex_fetch.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vertex_shader.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vf.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vf.h | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vf_generic.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_vf_sse.c | 0 src/{mesa/pipe => gallium/aux}/draw/draw_wide_prims.c | 0 src/{mesa/pipe => gallium/aux}/llvm/Makefile | 0 src/{mesa/pipe => gallium/aux}/llvm/gallivm.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/gallivm.h | 0 src/{mesa/pipe => gallium/aux}/llvm/gallivm_builtins.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/gallivm_cpu.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/gallivm_p.h | 0 src/{mesa/pipe => gallium/aux}/llvm/instructions.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/instructions.h | 0 src/{mesa/pipe => gallium/aux}/llvm/instructionssoa.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/instructionssoa.h | 0 src/{mesa/pipe => gallium/aux}/llvm/llvm_builtins.c | 0 src/{mesa/pipe => gallium/aux}/llvm/loweringpass.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/loweringpass.h | 0 src/{mesa/pipe => gallium/aux}/llvm/storage.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/storage.h | 0 src/{mesa/pipe => gallium/aux}/llvm/storagesoa.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/storagesoa.h | 0 src/{mesa/pipe => gallium/aux}/llvm/tgsitollvm.cpp | 0 src/{mesa/pipe => gallium/aux}/llvm/tgsitollvm.h | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/Makefile | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/linked_list.h | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer.h | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_fenced.c | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_fenced.h | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_malloc.c | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr.h | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_fenced.c | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_mm.c | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_pool.c | 0 src/{mesa/pipe => gallium/aux}/pipebuffer/pb_winsys.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/Makefile | 0 src/{mesa/pipe => gallium/aux}/tgsi/exec/Makefile | 0 src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_exec.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_exec.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_sse2.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_sse2.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_build.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_build.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_dump.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_dump.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_parse.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_parse.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_transform.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_transform.h | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_util.c | 0 src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_util.h | 0 src/{mesa/pipe => gallium/aux}/util/p_debug.c | 0 src/{mesa/pipe => gallium/aux}/util/p_tile.c | 0 src/{mesa/pipe => gallium/aux}/util/p_tile.h | 0 src/{mesa/pipe => gallium/aux}/util/p_util.c | 0 src/{mesa/pipe => gallium/drivers}/cell/Makefile | 0 src/{mesa/pipe => gallium/drivers}/cell/common.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/Makefile | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_batch.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_batch.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_clear.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_clear.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_context.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_context.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_draw_arrays.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_draw_arrays.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_flush.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_flush.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_render.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_render.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_spu.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_spu.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_blend.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_clip.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_derived.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_emit.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_emit.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_fs.c | 0 .../pipe => gallium/drivers}/cell/ppu/cell_state_rasterizer.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_sampler.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_surface.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_vertex.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_surface.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_surface.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_texture.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_texture.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vbuf.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vbuf.h | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vertex_shader.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_winsys.c | 0 src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_winsys.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/Makefile | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_blend.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_blend.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_colorpack.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_exec.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_exec.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_main.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_main.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_render.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_render.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_texture.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_texture.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tile.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tile.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tri.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tri.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_util.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_fetch.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_shader.c | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_shader.h | 0 src/{mesa/pipe => gallium/drivers}/cell/spu/spu_ztest.h | 0 src/{mesa/pipe => gallium/drivers}/failover/Makefile | 0 src/{mesa/pipe => gallium/drivers}/failover/fo_context.c | 0 src/{mesa/pipe => gallium/drivers}/failover/fo_context.h | 0 src/{mesa/pipe => gallium/drivers}/failover/fo_state.c | 0 src/{mesa/pipe => gallium/drivers}/failover/fo_state_emit.c | 0 src/{mesa/pipe => gallium/drivers}/failover/fo_winsys.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/Makefile | 0 src/{mesa/pipe => gallium/drivers}/i915simple/SConscript | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_batch.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_blit.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_blit.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_clear.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_context.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_context.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug_fp.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_flush.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_fpc.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_fpc_emit.c | 0 .../pipe => gallium/drivers}/i915simple/i915_fpc_translate.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_prim_emit.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_prim_vbuf.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_reg.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_state.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_state.h | 0 .../pipe => gallium/drivers}/i915simple/i915_state_derived.c | 0 .../pipe => gallium/drivers}/i915simple/i915_state_dynamic.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_emit.c | 0 .../pipe => gallium/drivers}/i915simple/i915_state_immediate.c | 0 .../pipe => gallium/drivers}/i915simple/i915_state_inlines.h | 0 .../pipe => gallium/drivers}/i915simple/i915_state_sampler.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_strings.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_surface.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_texture.c | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_texture.h | 0 src/{mesa/pipe => gallium/drivers}/i915simple/i915_winsys.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/Makefile | 0 src/{mesa/pipe => gallium/drivers}/i965simple/SConscript | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_batch.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_blit.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_blit.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_cc.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_line.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_point.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_tri.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_unfilled.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_util.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_context.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_context.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_curbe.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_defines.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw_upload.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_debug.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_emit.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_util.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_flush.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs_emit.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_misc_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_reg.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf_emit.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_shader_info.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_batch.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_cache.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_pool.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_upload.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_strings.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_structs.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_surface.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_tex_layout.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_tex_layout.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_urb.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_util.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_util.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs_emit.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_winsys.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm.h | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_decl.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_glsl.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_iz.c | 0 .../pipe => gallium/drivers}/i965simple/brw_wm_sampler_state.c | 0 src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_state.c | 0 .../pipe => gallium/drivers}/i965simple/brw_wm_surface_state.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/Makefile | 0 src/{mesa/pipe => gallium/drivers}/softpipe/SConscript | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_clear.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_clear.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_context.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_context.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_draw_arrays.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_flush.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_flush.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_headers.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_setup.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_setup.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_vbuf.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_vbuf.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_alpha_test.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_blend.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_bufloop.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_colormask.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_coverage.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_depth_test.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_earlyz.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_fs.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_occlusion.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_output.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_stencil.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_stipple.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_query.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_query.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_blend.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_clip.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_derived.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_fs.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_rasterizer.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_sampler.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_surface.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_vertex.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_surface.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_surface.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_tex_sample.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_tex_sample.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_texture.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_texture.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_tile_cache.c | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_tile_cache.h | 0 src/{mesa/pipe => gallium/drivers}/softpipe/sp_winsys.h | 0 src/{mesa => gallium/include}/pipe/p_compiler.h | 0 src/{mesa => gallium/include}/pipe/p_context.h | 0 src/{mesa => gallium/include}/pipe/p_debug.h | 0 src/{mesa => gallium/include}/pipe/p_defines.h | 0 src/{mesa => gallium/include}/pipe/p_format.h | 0 src/{mesa => gallium/include}/pipe/p_inlines.h | 0 src/{mesa => gallium/include}/pipe/p_shader_tokens.h | 0 src/{mesa => gallium/include}/pipe/p_state.h | 0 src/{mesa => gallium/include}/pipe/p_thread.h | 0 src/{mesa => gallium/include}/pipe/p_util.h | 0 src/{mesa => gallium/include}/pipe/p_winsys.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/Makefile | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/SConscript | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_batchbuffer.c | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_batchbuffer.h | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_batchpool.c | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_batchpool.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_context.c | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_context.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_lock.c | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_reg.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_screen.c | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_screen.h | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_swapbuffers.c | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_swapbuffers.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/intel_winsys.h | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_winsys_i915.c | 0 .../intel_winsys => gallium/winsys/dri/intel}/intel_winsys_pipe.c | 0 .../winsys/dri/intel}/intel_winsys_softpipe.c | 0 .../winsys/dri/intel}/server/i830_common.h | 0 .../intel_winsys => gallium/winsys/dri/intel}/server/i830_dri.h | 0 .../dri/intel_winsys => gallium/winsys/dri/intel}/server/intel.h | 0 .../intel_winsys => gallium/winsys/dri/intel}/server/intel_dri.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/brw_aub.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/brw_aub.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/fakeglx.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/glxapi.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/glxapi.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/glxheader.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/realglx.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/realglx.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/xfonts.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/xfonts.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_api.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_image.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_image.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys_aub.c | 0 src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys_aub.h | 0 src/{mesa/pipe => gallium/winsys}/xlib/xmesaP.h | 0 342 files changed, 0 insertions(+), 0 deletions(-) rename src/{mesa/pipe => gallium}/Makefile (100%) rename src/{mesa/pipe => gallium}/Makefile.template (100%) rename src/{mesa/pipe => gallium}/README.portability (100%) rename src/{mesa/pipe => gallium}/SConscript (100%) rename src/{mesa/pipe => gallium/aux}/cso_cache/cso_cache.c (100%) rename src/{mesa/pipe => gallium/aux}/cso_cache/cso_cache.h (100%) rename src/{mesa/pipe => gallium/aux}/cso_cache/cso_hash.c (100%) rename src/{mesa/pipe => gallium/aux}/cso_cache/cso_hash.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/Makefile (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_clip.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_context.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_context.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_cull.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_debug.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_flatshade.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_offset.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_prim.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_private.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_stipple.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_twoside.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_unfilled.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_validate.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vbuf.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vbuf.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vertex.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vertex.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vertex_cache.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vertex_fetch.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vertex_shader.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vf.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vf.h (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vf_generic.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_vf_sse.c (100%) rename src/{mesa/pipe => gallium/aux}/draw/draw_wide_prims.c (100%) rename src/{mesa/pipe => gallium/aux}/llvm/Makefile (100%) rename src/{mesa/pipe => gallium/aux}/llvm/gallivm.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/gallivm.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/gallivm_builtins.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/gallivm_cpu.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/gallivm_p.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/instructions.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/instructions.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/instructionssoa.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/instructionssoa.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/llvm_builtins.c (100%) rename src/{mesa/pipe => gallium/aux}/llvm/loweringpass.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/loweringpass.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/storage.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/storage.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/storagesoa.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/storagesoa.h (100%) rename src/{mesa/pipe => gallium/aux}/llvm/tgsitollvm.cpp (100%) rename src/{mesa/pipe => gallium/aux}/llvm/tgsitollvm.h (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/Makefile (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/linked_list.h (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer.h (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_fenced.c (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_fenced.h (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_buffer_malloc.c (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr.h (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_fenced.c (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_mm.c (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_bufmgr_pool.c (100%) rename src/{mesa/pipe => gallium/aux}/pipebuffer/pb_winsys.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/Makefile (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/exec/Makefile (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_exec.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_exec.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_sse2.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/exec/tgsi_sse2.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_build.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_build.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_dump.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_dump.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_parse.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_parse.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_transform.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_transform.h (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_util.c (100%) rename src/{mesa/pipe => gallium/aux}/tgsi/util/tgsi_util.h (100%) rename src/{mesa/pipe => gallium/aux}/util/p_debug.c (100%) rename src/{mesa/pipe => gallium/aux}/util/p_tile.c (100%) rename src/{mesa/pipe => gallium/aux}/util/p_tile.h (100%) rename src/{mesa/pipe => gallium/aux}/util/p_util.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/cell/common.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_batch.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_batch.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_clear.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_clear.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_context.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_context.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_draw_arrays.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_draw_arrays.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_flush.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_flush.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_render.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_render.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_spu.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_spu.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_blend.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_clip.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_derived.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_emit.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_fs.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_rasterizer.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_sampler.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_state_vertex.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_surface.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_texture.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_texture.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vbuf.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vbuf.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vertex_shader.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_winsys.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_winsys.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_blend.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_blend.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_colorpack.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_exec.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_exec.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_main.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_main.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_render.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_render.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_texture.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_texture.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tile.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tile.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tri.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_tri.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_util.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_fetch.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_shader.c (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_vertex_shader.h (100%) rename src/{mesa/pipe => gallium/drivers}/cell/spu/spu_ztest.h (100%) rename src/{mesa/pipe => gallium/drivers}/failover/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/failover/fo_context.c (100%) rename src/{mesa/pipe => gallium/drivers}/failover/fo_context.h (100%) rename src/{mesa/pipe => gallium/drivers}/failover/fo_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/failover/fo_state_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/failover/fo_winsys.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/SConscript (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_batch.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_blit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_blit.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_clear.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_context.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_context.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_debug_fp.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_flush.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_fpc.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_fpc_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_fpc_translate.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_prim_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_prim_vbuf.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_reg.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_derived.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_dynamic.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_immediate.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_inlines.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_state_sampler.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_strings.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_texture.c (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_texture.h (100%) rename src/{mesa/pipe => gallium/drivers}/i915simple/i915_winsys.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/SConscript (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_batch.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_blit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_blit.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_cc.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_line.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_point.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_tri.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_unfilled.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_clip_util.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_context.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_context.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_curbe.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_defines.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_draw_upload.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_debug.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_eu_util.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_flush.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_gs_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_misc_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_reg.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_sf_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_shader_info.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_batch.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_cache.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_pool.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_state_upload.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_strings.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_structs.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_tex_layout.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_tex_layout.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_urb.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_util.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_util.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs_emit.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_vs_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_winsys.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm.h (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_decl.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_glsl.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_iz.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_sampler_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/i965simple/brw_wm_surface_state.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/Makefile (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/SConscript (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_clear.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_clear.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_context.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_context.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_draw_arrays.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_flush.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_flush.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_headers.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_setup.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_setup.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_vbuf.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_prim_vbuf.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_alpha_test.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_blend.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_bufloop.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_colormask.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_coverage.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_depth_test.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_earlyz.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_fs.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_occlusion.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_output.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_stencil.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_quad_stipple.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_query.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_query.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_blend.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_clip.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_derived.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_fs.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_rasterizer.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_sampler.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_state_vertex.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_surface.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_surface.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_tex_sample.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_tex_sample.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_texture.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_texture.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_tile_cache.c (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_tile_cache.h (100%) rename src/{mesa/pipe => gallium/drivers}/softpipe/sp_winsys.h (100%) rename src/{mesa => gallium/include}/pipe/p_compiler.h (100%) rename src/{mesa => gallium/include}/pipe/p_context.h (100%) rename src/{mesa => gallium/include}/pipe/p_debug.h (100%) rename src/{mesa => gallium/include}/pipe/p_defines.h (100%) rename src/{mesa => gallium/include}/pipe/p_format.h (100%) rename src/{mesa => gallium/include}/pipe/p_inlines.h (100%) rename src/{mesa => gallium/include}/pipe/p_shader_tokens.h (100%) rename src/{mesa => gallium/include}/pipe/p_state.h (100%) rename src/{mesa => gallium/include}/pipe/p_thread.h (100%) rename src/{mesa => gallium/include}/pipe/p_util.h (100%) rename src/{mesa => gallium/include}/pipe/p_winsys.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/Makefile (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/SConscript (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_batchbuffer.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_batchbuffer.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_batchpool.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_batchpool.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_context.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_context.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_lock.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_reg.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_screen.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_screen.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_swapbuffers.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_swapbuffers.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_winsys.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_winsys_i915.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_winsys_pipe.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/intel_winsys_softpipe.c (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/server/i830_common.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/server/i830_dri.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/server/intel.h (100%) rename src/{mesa/drivers/dri/intel_winsys => gallium/winsys/dri/intel}/server/intel_dri.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/brw_aub.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/brw_aub.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/fakeglx.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/glxapi.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/glxapi.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/glxheader.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/realglx.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/realglx.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xfonts.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xfonts.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_api.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_image.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_image.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys_aub.c (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xm_winsys_aub.h (100%) rename src/{mesa/pipe => gallium/winsys}/xlib/xmesaP.h (100%) diff --git a/src/mesa/pipe/Makefile b/src/gallium/Makefile similarity index 100% rename from src/mesa/pipe/Makefile rename to src/gallium/Makefile diff --git a/src/mesa/pipe/Makefile.template b/src/gallium/Makefile.template similarity index 100% rename from src/mesa/pipe/Makefile.template rename to src/gallium/Makefile.template diff --git a/src/mesa/pipe/README.portability b/src/gallium/README.portability similarity index 100% rename from src/mesa/pipe/README.portability rename to src/gallium/README.portability diff --git a/src/mesa/pipe/SConscript b/src/gallium/SConscript similarity index 100% rename from src/mesa/pipe/SConscript rename to src/gallium/SConscript diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/gallium/aux/cso_cache/cso_cache.c similarity index 100% rename from src/mesa/pipe/cso_cache/cso_cache.c rename to src/gallium/aux/cso_cache/cso_cache.c diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/gallium/aux/cso_cache/cso_cache.h similarity index 100% rename from src/mesa/pipe/cso_cache/cso_cache.h rename to src/gallium/aux/cso_cache/cso_cache.h diff --git a/src/mesa/pipe/cso_cache/cso_hash.c b/src/gallium/aux/cso_cache/cso_hash.c similarity index 100% rename from src/mesa/pipe/cso_cache/cso_hash.c rename to src/gallium/aux/cso_cache/cso_hash.c diff --git a/src/mesa/pipe/cso_cache/cso_hash.h b/src/gallium/aux/cso_cache/cso_hash.h similarity index 100% rename from src/mesa/pipe/cso_cache/cso_hash.h rename to src/gallium/aux/cso_cache/cso_hash.h diff --git a/src/mesa/pipe/draw/Makefile b/src/gallium/aux/draw/Makefile similarity index 100% rename from src/mesa/pipe/draw/Makefile rename to src/gallium/aux/draw/Makefile diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/gallium/aux/draw/draw_clip.c similarity index 100% rename from src/mesa/pipe/draw/draw_clip.c rename to src/gallium/aux/draw/draw_clip.c diff --git a/src/mesa/pipe/draw/draw_context.c b/src/gallium/aux/draw/draw_context.c similarity index 100% rename from src/mesa/pipe/draw/draw_context.c rename to src/gallium/aux/draw/draw_context.c diff --git a/src/mesa/pipe/draw/draw_context.h b/src/gallium/aux/draw/draw_context.h similarity index 100% rename from src/mesa/pipe/draw/draw_context.h rename to src/gallium/aux/draw/draw_context.h diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/gallium/aux/draw/draw_cull.c similarity index 100% rename from src/mesa/pipe/draw/draw_cull.c rename to src/gallium/aux/draw/draw_cull.c diff --git a/src/mesa/pipe/draw/draw_debug.c b/src/gallium/aux/draw/draw_debug.c similarity index 100% rename from src/mesa/pipe/draw/draw_debug.c rename to src/gallium/aux/draw/draw_debug.c diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/gallium/aux/draw/draw_flatshade.c similarity index 100% rename from src/mesa/pipe/draw/draw_flatshade.c rename to src/gallium/aux/draw/draw_flatshade.c diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/gallium/aux/draw/draw_offset.c similarity index 100% rename from src/mesa/pipe/draw/draw_offset.c rename to src/gallium/aux/draw/draw_offset.c diff --git a/src/mesa/pipe/draw/draw_prim.c b/src/gallium/aux/draw/draw_prim.c similarity index 100% rename from src/mesa/pipe/draw/draw_prim.c rename to src/gallium/aux/draw/draw_prim.c diff --git a/src/mesa/pipe/draw/draw_private.h b/src/gallium/aux/draw/draw_private.h similarity index 100% rename from src/mesa/pipe/draw/draw_private.h rename to src/gallium/aux/draw/draw_private.h diff --git a/src/mesa/pipe/draw/draw_stipple.c b/src/gallium/aux/draw/draw_stipple.c similarity index 100% rename from src/mesa/pipe/draw/draw_stipple.c rename to src/gallium/aux/draw/draw_stipple.c diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/gallium/aux/draw/draw_twoside.c similarity index 100% rename from src/mesa/pipe/draw/draw_twoside.c rename to src/gallium/aux/draw/draw_twoside.c diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/gallium/aux/draw/draw_unfilled.c similarity index 100% rename from src/mesa/pipe/draw/draw_unfilled.c rename to src/gallium/aux/draw/draw_unfilled.c diff --git a/src/mesa/pipe/draw/draw_validate.c b/src/gallium/aux/draw/draw_validate.c similarity index 100% rename from src/mesa/pipe/draw/draw_validate.c rename to src/gallium/aux/draw/draw_validate.c diff --git a/src/mesa/pipe/draw/draw_vbuf.c b/src/gallium/aux/draw/draw_vbuf.c similarity index 100% rename from src/mesa/pipe/draw/draw_vbuf.c rename to src/gallium/aux/draw/draw_vbuf.c diff --git a/src/mesa/pipe/draw/draw_vbuf.h b/src/gallium/aux/draw/draw_vbuf.h similarity index 100% rename from src/mesa/pipe/draw/draw_vbuf.h rename to src/gallium/aux/draw/draw_vbuf.h diff --git a/src/mesa/pipe/draw/draw_vertex.c b/src/gallium/aux/draw/draw_vertex.c similarity index 100% rename from src/mesa/pipe/draw/draw_vertex.c rename to src/gallium/aux/draw/draw_vertex.c diff --git a/src/mesa/pipe/draw/draw_vertex.h b/src/gallium/aux/draw/draw_vertex.h similarity index 100% rename from src/mesa/pipe/draw/draw_vertex.h rename to src/gallium/aux/draw/draw_vertex.h diff --git a/src/mesa/pipe/draw/draw_vertex_cache.c b/src/gallium/aux/draw/draw_vertex_cache.c similarity index 100% rename from src/mesa/pipe/draw/draw_vertex_cache.c rename to src/gallium/aux/draw/draw_vertex_cache.c diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/gallium/aux/draw/draw_vertex_fetch.c similarity index 100% rename from src/mesa/pipe/draw/draw_vertex_fetch.c rename to src/gallium/aux/draw/draw_vertex_fetch.c diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/gallium/aux/draw/draw_vertex_shader.c similarity index 100% rename from src/mesa/pipe/draw/draw_vertex_shader.c rename to src/gallium/aux/draw/draw_vertex_shader.c diff --git a/src/mesa/pipe/draw/draw_vf.c b/src/gallium/aux/draw/draw_vf.c similarity index 100% rename from src/mesa/pipe/draw/draw_vf.c rename to src/gallium/aux/draw/draw_vf.c diff --git a/src/mesa/pipe/draw/draw_vf.h b/src/gallium/aux/draw/draw_vf.h similarity index 100% rename from src/mesa/pipe/draw/draw_vf.h rename to src/gallium/aux/draw/draw_vf.h diff --git a/src/mesa/pipe/draw/draw_vf_generic.c b/src/gallium/aux/draw/draw_vf_generic.c similarity index 100% rename from src/mesa/pipe/draw/draw_vf_generic.c rename to src/gallium/aux/draw/draw_vf_generic.c diff --git a/src/mesa/pipe/draw/draw_vf_sse.c b/src/gallium/aux/draw/draw_vf_sse.c similarity index 100% rename from src/mesa/pipe/draw/draw_vf_sse.c rename to src/gallium/aux/draw/draw_vf_sse.c diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/gallium/aux/draw/draw_wide_prims.c similarity index 100% rename from src/mesa/pipe/draw/draw_wide_prims.c rename to src/gallium/aux/draw/draw_wide_prims.c diff --git a/src/mesa/pipe/llvm/Makefile b/src/gallium/aux/llvm/Makefile similarity index 100% rename from src/mesa/pipe/llvm/Makefile rename to src/gallium/aux/llvm/Makefile diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/gallium/aux/llvm/gallivm.cpp similarity index 100% rename from src/mesa/pipe/llvm/gallivm.cpp rename to src/gallium/aux/llvm/gallivm.cpp diff --git a/src/mesa/pipe/llvm/gallivm.h b/src/gallium/aux/llvm/gallivm.h similarity index 100% rename from src/mesa/pipe/llvm/gallivm.h rename to src/gallium/aux/llvm/gallivm.h diff --git a/src/mesa/pipe/llvm/gallivm_builtins.cpp b/src/gallium/aux/llvm/gallivm_builtins.cpp similarity index 100% rename from src/mesa/pipe/llvm/gallivm_builtins.cpp rename to src/gallium/aux/llvm/gallivm_builtins.cpp diff --git a/src/mesa/pipe/llvm/gallivm_cpu.cpp b/src/gallium/aux/llvm/gallivm_cpu.cpp similarity index 100% rename from src/mesa/pipe/llvm/gallivm_cpu.cpp rename to src/gallium/aux/llvm/gallivm_cpu.cpp diff --git a/src/mesa/pipe/llvm/gallivm_p.h b/src/gallium/aux/llvm/gallivm_p.h similarity index 100% rename from src/mesa/pipe/llvm/gallivm_p.h rename to src/gallium/aux/llvm/gallivm_p.h diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/gallium/aux/llvm/instructions.cpp similarity index 100% rename from src/mesa/pipe/llvm/instructions.cpp rename to src/gallium/aux/llvm/instructions.cpp diff --git a/src/mesa/pipe/llvm/instructions.h b/src/gallium/aux/llvm/instructions.h similarity index 100% rename from src/mesa/pipe/llvm/instructions.h rename to src/gallium/aux/llvm/instructions.h diff --git a/src/mesa/pipe/llvm/instructionssoa.cpp b/src/gallium/aux/llvm/instructionssoa.cpp similarity index 100% rename from src/mesa/pipe/llvm/instructionssoa.cpp rename to src/gallium/aux/llvm/instructionssoa.cpp diff --git a/src/mesa/pipe/llvm/instructionssoa.h b/src/gallium/aux/llvm/instructionssoa.h similarity index 100% rename from src/mesa/pipe/llvm/instructionssoa.h rename to src/gallium/aux/llvm/instructionssoa.h diff --git a/src/mesa/pipe/llvm/llvm_builtins.c b/src/gallium/aux/llvm/llvm_builtins.c similarity index 100% rename from src/mesa/pipe/llvm/llvm_builtins.c rename to src/gallium/aux/llvm/llvm_builtins.c diff --git a/src/mesa/pipe/llvm/loweringpass.cpp b/src/gallium/aux/llvm/loweringpass.cpp similarity index 100% rename from src/mesa/pipe/llvm/loweringpass.cpp rename to src/gallium/aux/llvm/loweringpass.cpp diff --git a/src/mesa/pipe/llvm/loweringpass.h b/src/gallium/aux/llvm/loweringpass.h similarity index 100% rename from src/mesa/pipe/llvm/loweringpass.h rename to src/gallium/aux/llvm/loweringpass.h diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/gallium/aux/llvm/storage.cpp similarity index 100% rename from src/mesa/pipe/llvm/storage.cpp rename to src/gallium/aux/llvm/storage.cpp diff --git a/src/mesa/pipe/llvm/storage.h b/src/gallium/aux/llvm/storage.h similarity index 100% rename from src/mesa/pipe/llvm/storage.h rename to src/gallium/aux/llvm/storage.h diff --git a/src/mesa/pipe/llvm/storagesoa.cpp b/src/gallium/aux/llvm/storagesoa.cpp similarity index 100% rename from src/mesa/pipe/llvm/storagesoa.cpp rename to src/gallium/aux/llvm/storagesoa.cpp diff --git a/src/mesa/pipe/llvm/storagesoa.h b/src/gallium/aux/llvm/storagesoa.h similarity index 100% rename from src/mesa/pipe/llvm/storagesoa.h rename to src/gallium/aux/llvm/storagesoa.h diff --git a/src/mesa/pipe/llvm/tgsitollvm.cpp b/src/gallium/aux/llvm/tgsitollvm.cpp similarity index 100% rename from src/mesa/pipe/llvm/tgsitollvm.cpp rename to src/gallium/aux/llvm/tgsitollvm.cpp diff --git a/src/mesa/pipe/llvm/tgsitollvm.h b/src/gallium/aux/llvm/tgsitollvm.h similarity index 100% rename from src/mesa/pipe/llvm/tgsitollvm.h rename to src/gallium/aux/llvm/tgsitollvm.h diff --git a/src/mesa/pipe/pipebuffer/Makefile b/src/gallium/aux/pipebuffer/Makefile similarity index 100% rename from src/mesa/pipe/pipebuffer/Makefile rename to src/gallium/aux/pipebuffer/Makefile diff --git a/src/mesa/pipe/pipebuffer/linked_list.h b/src/gallium/aux/pipebuffer/linked_list.h similarity index 100% rename from src/mesa/pipe/pipebuffer/linked_list.h rename to src/gallium/aux/pipebuffer/linked_list.h diff --git a/src/mesa/pipe/pipebuffer/pb_buffer.h b/src/gallium/aux/pipebuffer/pb_buffer.h similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_buffer.h rename to src/gallium/aux/pipebuffer/pb_buffer.h diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.c b/src/gallium/aux/pipebuffer/pb_buffer_fenced.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_buffer_fenced.c rename to src/gallium/aux/pipebuffer/pb_buffer_fenced.c diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_fenced.h b/src/gallium/aux/pipebuffer/pb_buffer_fenced.h similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_buffer_fenced.h rename to src/gallium/aux/pipebuffer/pb_buffer_fenced.h diff --git a/src/mesa/pipe/pipebuffer/pb_buffer_malloc.c b/src/gallium/aux/pipebuffer/pb_buffer_malloc.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_buffer_malloc.c rename to src/gallium/aux/pipebuffer/pb_buffer_malloc.c diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr.h b/src/gallium/aux/pipebuffer/pb_bufmgr.h similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_bufmgr.h rename to src/gallium/aux/pipebuffer/pb_bufmgr.h diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/aux/pipebuffer/pb_bufmgr_fenced.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_bufmgr_fenced.c rename to src/gallium/aux/pipebuffer/pb_bufmgr_fenced.c diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c b/src/gallium/aux/pipebuffer/pb_bufmgr_mm.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_bufmgr_mm.c rename to src/gallium/aux/pipebuffer/pb_bufmgr_mm.c diff --git a/src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c b/src/gallium/aux/pipebuffer/pb_bufmgr_pool.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_bufmgr_pool.c rename to src/gallium/aux/pipebuffer/pb_bufmgr_pool.c diff --git a/src/mesa/pipe/pipebuffer/pb_winsys.c b/src/gallium/aux/pipebuffer/pb_winsys.c similarity index 100% rename from src/mesa/pipe/pipebuffer/pb_winsys.c rename to src/gallium/aux/pipebuffer/pb_winsys.c diff --git a/src/mesa/pipe/tgsi/Makefile b/src/gallium/aux/tgsi/Makefile similarity index 100% rename from src/mesa/pipe/tgsi/Makefile rename to src/gallium/aux/tgsi/Makefile diff --git a/src/mesa/pipe/tgsi/exec/Makefile b/src/gallium/aux/tgsi/exec/Makefile similarity index 100% rename from src/mesa/pipe/tgsi/exec/Makefile rename to src/gallium/aux/tgsi/exec/Makefile diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/gallium/aux/tgsi/exec/tgsi_exec.c similarity index 100% rename from src/mesa/pipe/tgsi/exec/tgsi_exec.c rename to src/gallium/aux/tgsi/exec/tgsi_exec.c diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/gallium/aux/tgsi/exec/tgsi_exec.h similarity index 100% rename from src/mesa/pipe/tgsi/exec/tgsi_exec.h rename to src/gallium/aux/tgsi/exec/tgsi_exec.h diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/gallium/aux/tgsi/exec/tgsi_sse2.c similarity index 100% rename from src/mesa/pipe/tgsi/exec/tgsi_sse2.c rename to src/gallium/aux/tgsi/exec/tgsi_sse2.c diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.h b/src/gallium/aux/tgsi/exec/tgsi_sse2.h similarity index 100% rename from src/mesa/pipe/tgsi/exec/tgsi_sse2.h rename to src/gallium/aux/tgsi/exec/tgsi_sse2.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.c b/src/gallium/aux/tgsi/util/tgsi_build.c similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_build.c rename to src/gallium/aux/tgsi/util/tgsi_build.c diff --git a/src/mesa/pipe/tgsi/util/tgsi_build.h b/src/gallium/aux/tgsi/util/tgsi_build.h similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_build.h rename to src/gallium/aux/tgsi/util/tgsi_build.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.c b/src/gallium/aux/tgsi/util/tgsi_dump.c similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_dump.c rename to src/gallium/aux/tgsi/util/tgsi_dump.c diff --git a/src/mesa/pipe/tgsi/util/tgsi_dump.h b/src/gallium/aux/tgsi/util/tgsi_dump.h similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_dump.h rename to src/gallium/aux/tgsi/util/tgsi_dump.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.c b/src/gallium/aux/tgsi/util/tgsi_parse.c similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_parse.c rename to src/gallium/aux/tgsi/util/tgsi_parse.c diff --git a/src/mesa/pipe/tgsi/util/tgsi_parse.h b/src/gallium/aux/tgsi/util/tgsi_parse.h similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_parse.h rename to src/gallium/aux/tgsi/util/tgsi_parse.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_transform.c b/src/gallium/aux/tgsi/util/tgsi_transform.c similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_transform.c rename to src/gallium/aux/tgsi/util/tgsi_transform.c diff --git a/src/mesa/pipe/tgsi/util/tgsi_transform.h b/src/gallium/aux/tgsi/util/tgsi_transform.h similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_transform.h rename to src/gallium/aux/tgsi/util/tgsi_transform.h diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.c b/src/gallium/aux/tgsi/util/tgsi_util.c similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_util.c rename to src/gallium/aux/tgsi/util/tgsi_util.c diff --git a/src/mesa/pipe/tgsi/util/tgsi_util.h b/src/gallium/aux/tgsi/util/tgsi_util.h similarity index 100% rename from src/mesa/pipe/tgsi/util/tgsi_util.h rename to src/gallium/aux/tgsi/util/tgsi_util.h diff --git a/src/mesa/pipe/util/p_debug.c b/src/gallium/aux/util/p_debug.c similarity index 100% rename from src/mesa/pipe/util/p_debug.c rename to src/gallium/aux/util/p_debug.c diff --git a/src/mesa/pipe/util/p_tile.c b/src/gallium/aux/util/p_tile.c similarity index 100% rename from src/mesa/pipe/util/p_tile.c rename to src/gallium/aux/util/p_tile.c diff --git a/src/mesa/pipe/util/p_tile.h b/src/gallium/aux/util/p_tile.h similarity index 100% rename from src/mesa/pipe/util/p_tile.h rename to src/gallium/aux/util/p_tile.h diff --git a/src/mesa/pipe/util/p_util.c b/src/gallium/aux/util/p_util.c similarity index 100% rename from src/mesa/pipe/util/p_util.c rename to src/gallium/aux/util/p_util.c diff --git a/src/mesa/pipe/cell/Makefile b/src/gallium/drivers/cell/Makefile similarity index 100% rename from src/mesa/pipe/cell/Makefile rename to src/gallium/drivers/cell/Makefile diff --git a/src/mesa/pipe/cell/common.h b/src/gallium/drivers/cell/common.h similarity index 100% rename from src/mesa/pipe/cell/common.h rename to src/gallium/drivers/cell/common.h diff --git a/src/mesa/pipe/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile similarity index 100% rename from src/mesa/pipe/cell/ppu/Makefile rename to src/gallium/drivers/cell/ppu/Makefile diff --git a/src/mesa/pipe/cell/ppu/cell_batch.c b/src/gallium/drivers/cell/ppu/cell_batch.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_batch.c rename to src/gallium/drivers/cell/ppu/cell_batch.c diff --git a/src/mesa/pipe/cell/ppu/cell_batch.h b/src/gallium/drivers/cell/ppu/cell_batch.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_batch.h rename to src/gallium/drivers/cell/ppu/cell_batch.h diff --git a/src/mesa/pipe/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_clear.c rename to src/gallium/drivers/cell/ppu/cell_clear.c diff --git a/src/mesa/pipe/cell/ppu/cell_clear.h b/src/gallium/drivers/cell/ppu/cell_clear.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_clear.h rename to src/gallium/drivers/cell/ppu/cell_clear.h diff --git a/src/mesa/pipe/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_context.c rename to src/gallium/drivers/cell/ppu/cell_context.c diff --git a/src/mesa/pipe/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_context.h rename to src/gallium/drivers/cell/ppu/cell_context.h diff --git a/src/mesa/pipe/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_draw_arrays.c rename to src/gallium/drivers/cell/ppu/cell_draw_arrays.c diff --git a/src/mesa/pipe/cell/ppu/cell_draw_arrays.h b/src/gallium/drivers/cell/ppu/cell_draw_arrays.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_draw_arrays.h rename to src/gallium/drivers/cell/ppu/cell_draw_arrays.h diff --git a/src/mesa/pipe/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_flush.c rename to src/gallium/drivers/cell/ppu/cell_flush.c diff --git a/src/mesa/pipe/cell/ppu/cell_flush.h b/src/gallium/drivers/cell/ppu/cell_flush.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_flush.h rename to src/gallium/drivers/cell/ppu/cell_flush.h diff --git a/src/mesa/pipe/cell/ppu/cell_render.c b/src/gallium/drivers/cell/ppu/cell_render.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_render.c rename to src/gallium/drivers/cell/ppu/cell_render.c diff --git a/src/mesa/pipe/cell/ppu/cell_render.h b/src/gallium/drivers/cell/ppu/cell_render.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_render.h rename to src/gallium/drivers/cell/ppu/cell_render.h diff --git a/src/mesa/pipe/cell/ppu/cell_spu.c b/src/gallium/drivers/cell/ppu/cell_spu.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_spu.c rename to src/gallium/drivers/cell/ppu/cell_spu.c diff --git a/src/mesa/pipe/cell/ppu/cell_spu.h b/src/gallium/drivers/cell/ppu/cell_spu.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_spu.h rename to src/gallium/drivers/cell/ppu/cell_spu.h diff --git a/src/mesa/pipe/cell/ppu/cell_state.h b/src/gallium/drivers/cell/ppu/cell_state.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state.h rename to src/gallium/drivers/cell/ppu/cell_state.h diff --git a/src/mesa/pipe/cell/ppu/cell_state_blend.c b/src/gallium/drivers/cell/ppu/cell_state_blend.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_blend.c rename to src/gallium/drivers/cell/ppu/cell_state_blend.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_clip.c b/src/gallium/drivers/cell/ppu/cell_state_clip.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_clip.c rename to src/gallium/drivers/cell/ppu/cell_state_clip.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_derived.c b/src/gallium/drivers/cell/ppu/cell_state_derived.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_derived.c rename to src/gallium/drivers/cell/ppu/cell_state_derived.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_emit.c rename to src/gallium/drivers/cell/ppu/cell_state_emit.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_emit.h b/src/gallium/drivers/cell/ppu/cell_state_emit.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_emit.h rename to src/gallium/drivers/cell/ppu/cell_state_emit.h diff --git a/src/mesa/pipe/cell/ppu/cell_state_fs.c b/src/gallium/drivers/cell/ppu/cell_state_fs.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_fs.c rename to src/gallium/drivers/cell/ppu/cell_state_fs.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_rasterizer.c b/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_rasterizer.c rename to src/gallium/drivers/cell/ppu/cell_state_rasterizer.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_sampler.c b/src/gallium/drivers/cell/ppu/cell_state_sampler.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_sampler.c rename to src/gallium/drivers/cell/ppu/cell_state_sampler.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_surface.c b/src/gallium/drivers/cell/ppu/cell_state_surface.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_surface.c rename to src/gallium/drivers/cell/ppu/cell_state_surface.c diff --git a/src/mesa/pipe/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_state_vertex.c rename to src/gallium/drivers/cell/ppu/cell_state_vertex.c diff --git a/src/mesa/pipe/cell/ppu/cell_surface.c b/src/gallium/drivers/cell/ppu/cell_surface.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_surface.c rename to src/gallium/drivers/cell/ppu/cell_surface.c diff --git a/src/mesa/pipe/cell/ppu/cell_surface.h b/src/gallium/drivers/cell/ppu/cell_surface.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_surface.h rename to src/gallium/drivers/cell/ppu/cell_surface.h diff --git a/src/mesa/pipe/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_texture.c rename to src/gallium/drivers/cell/ppu/cell_texture.c diff --git a/src/mesa/pipe/cell/ppu/cell_texture.h b/src/gallium/drivers/cell/ppu/cell_texture.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_texture.h rename to src/gallium/drivers/cell/ppu/cell_texture.h diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_vbuf.c rename to src/gallium/drivers/cell/ppu/cell_vbuf.c diff --git a/src/mesa/pipe/cell/ppu/cell_vbuf.h b/src/gallium/drivers/cell/ppu/cell_vbuf.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_vbuf.h rename to src/gallium/drivers/cell/ppu/cell_vbuf.h diff --git a/src/mesa/pipe/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_vertex_shader.c rename to src/gallium/drivers/cell/ppu/cell_vertex_shader.c diff --git a/src/mesa/pipe/cell/ppu/cell_winsys.c b/src/gallium/drivers/cell/ppu/cell_winsys.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_winsys.c rename to src/gallium/drivers/cell/ppu/cell_winsys.c diff --git a/src/mesa/pipe/cell/ppu/cell_winsys.h b/src/gallium/drivers/cell/ppu/cell_winsys.h similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_winsys.h rename to src/gallium/drivers/cell/ppu/cell_winsys.h diff --git a/src/mesa/pipe/cell/spu/Makefile b/src/gallium/drivers/cell/spu/Makefile similarity index 100% rename from src/mesa/pipe/cell/spu/Makefile rename to src/gallium/drivers/cell/spu/Makefile diff --git a/src/mesa/pipe/cell/spu/spu_blend.c b/src/gallium/drivers/cell/spu/spu_blend.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_blend.c rename to src/gallium/drivers/cell/spu/spu_blend.c diff --git a/src/mesa/pipe/cell/spu/spu_blend.h b/src/gallium/drivers/cell/spu/spu_blend.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_blend.h rename to src/gallium/drivers/cell/spu/spu_blend.h diff --git a/src/mesa/pipe/cell/spu/spu_colorpack.h b/src/gallium/drivers/cell/spu/spu_colorpack.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_colorpack.h rename to src/gallium/drivers/cell/spu/spu_colorpack.h diff --git a/src/mesa/pipe/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_exec.c rename to src/gallium/drivers/cell/spu/spu_exec.c diff --git a/src/mesa/pipe/cell/spu/spu_exec.h b/src/gallium/drivers/cell/spu/spu_exec.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_exec.h rename to src/gallium/drivers/cell/spu/spu_exec.h diff --git a/src/mesa/pipe/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_main.c rename to src/gallium/drivers/cell/spu/spu_main.c diff --git a/src/mesa/pipe/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_main.h rename to src/gallium/drivers/cell/spu/spu_main.h diff --git a/src/mesa/pipe/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_render.c rename to src/gallium/drivers/cell/spu/spu_render.c diff --git a/src/mesa/pipe/cell/spu/spu_render.h b/src/gallium/drivers/cell/spu/spu_render.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_render.h rename to src/gallium/drivers/cell/spu/spu_render.h diff --git a/src/mesa/pipe/cell/spu/spu_texture.c b/src/gallium/drivers/cell/spu/spu_texture.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_texture.c rename to src/gallium/drivers/cell/spu/spu_texture.c diff --git a/src/mesa/pipe/cell/spu/spu_texture.h b/src/gallium/drivers/cell/spu/spu_texture.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_texture.h rename to src/gallium/drivers/cell/spu/spu_texture.h diff --git a/src/mesa/pipe/cell/spu/spu_tile.c b/src/gallium/drivers/cell/spu/spu_tile.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_tile.c rename to src/gallium/drivers/cell/spu/spu_tile.c diff --git a/src/mesa/pipe/cell/spu/spu_tile.h b/src/gallium/drivers/cell/spu/spu_tile.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_tile.h rename to src/gallium/drivers/cell/spu/spu_tile.h diff --git a/src/mesa/pipe/cell/spu/spu_tri.c b/src/gallium/drivers/cell/spu/spu_tri.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_tri.c rename to src/gallium/drivers/cell/spu/spu_tri.c diff --git a/src/mesa/pipe/cell/spu/spu_tri.h b/src/gallium/drivers/cell/spu/spu_tri.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_tri.h rename to src/gallium/drivers/cell/spu/spu_tri.h diff --git a/src/mesa/pipe/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_util.c rename to src/gallium/drivers/cell/spu/spu_util.c diff --git a/src/mesa/pipe/cell/spu/spu_vertex_fetch.c b/src/gallium/drivers/cell/spu/spu_vertex_fetch.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_vertex_fetch.c rename to src/gallium/drivers/cell/spu/spu_vertex_fetch.c diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.c b/src/gallium/drivers/cell/spu/spu_vertex_shader.c similarity index 100% rename from src/mesa/pipe/cell/spu/spu_vertex_shader.c rename to src/gallium/drivers/cell/spu/spu_vertex_shader.c diff --git a/src/mesa/pipe/cell/spu/spu_vertex_shader.h b/src/gallium/drivers/cell/spu/spu_vertex_shader.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_vertex_shader.h rename to src/gallium/drivers/cell/spu/spu_vertex_shader.h diff --git a/src/mesa/pipe/cell/spu/spu_ztest.h b/src/gallium/drivers/cell/spu/spu_ztest.h similarity index 100% rename from src/mesa/pipe/cell/spu/spu_ztest.h rename to src/gallium/drivers/cell/spu/spu_ztest.h diff --git a/src/mesa/pipe/failover/Makefile b/src/gallium/drivers/failover/Makefile similarity index 100% rename from src/mesa/pipe/failover/Makefile rename to src/gallium/drivers/failover/Makefile diff --git a/src/mesa/pipe/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c similarity index 100% rename from src/mesa/pipe/failover/fo_context.c rename to src/gallium/drivers/failover/fo_context.c diff --git a/src/mesa/pipe/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h similarity index 100% rename from src/mesa/pipe/failover/fo_context.h rename to src/gallium/drivers/failover/fo_context.h diff --git a/src/mesa/pipe/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c similarity index 100% rename from src/mesa/pipe/failover/fo_state.c rename to src/gallium/drivers/failover/fo_state.c diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c similarity index 100% rename from src/mesa/pipe/failover/fo_state_emit.c rename to src/gallium/drivers/failover/fo_state_emit.c diff --git a/src/mesa/pipe/failover/fo_winsys.h b/src/gallium/drivers/failover/fo_winsys.h similarity index 100% rename from src/mesa/pipe/failover/fo_winsys.h rename to src/gallium/drivers/failover/fo_winsys.h diff --git a/src/mesa/pipe/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile similarity index 100% rename from src/mesa/pipe/i915simple/Makefile rename to src/gallium/drivers/i915simple/Makefile diff --git a/src/mesa/pipe/i915simple/SConscript b/src/gallium/drivers/i915simple/SConscript similarity index 100% rename from src/mesa/pipe/i915simple/SConscript rename to src/gallium/drivers/i915simple/SConscript diff --git a/src/mesa/pipe/i915simple/i915_batch.h b/src/gallium/drivers/i915simple/i915_batch.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_batch.h rename to src/gallium/drivers/i915simple/i915_batch.h diff --git a/src/mesa/pipe/i915simple/i915_blit.c b/src/gallium/drivers/i915simple/i915_blit.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_blit.c rename to src/gallium/drivers/i915simple/i915_blit.c diff --git a/src/mesa/pipe/i915simple/i915_blit.h b/src/gallium/drivers/i915simple/i915_blit.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_blit.h rename to src/gallium/drivers/i915simple/i915_blit.h diff --git a/src/mesa/pipe/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_clear.c rename to src/gallium/drivers/i915simple/i915_clear.c diff --git a/src/mesa/pipe/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_context.c rename to src/gallium/drivers/i915simple/i915_context.c diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_context.h rename to src/gallium/drivers/i915simple/i915_context.h diff --git a/src/mesa/pipe/i915simple/i915_debug.c b/src/gallium/drivers/i915simple/i915_debug.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_debug.c rename to src/gallium/drivers/i915simple/i915_debug.c diff --git a/src/mesa/pipe/i915simple/i915_debug.h b/src/gallium/drivers/i915simple/i915_debug.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_debug.h rename to src/gallium/drivers/i915simple/i915_debug.h diff --git a/src/mesa/pipe/i915simple/i915_debug_fp.c b/src/gallium/drivers/i915simple/i915_debug_fp.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_debug_fp.c rename to src/gallium/drivers/i915simple/i915_debug_fp.c diff --git a/src/mesa/pipe/i915simple/i915_flush.c b/src/gallium/drivers/i915simple/i915_flush.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_flush.c rename to src/gallium/drivers/i915simple/i915_flush.c diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/gallium/drivers/i915simple/i915_fpc.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_fpc.h rename to src/gallium/drivers/i915simple/i915_fpc.h diff --git a/src/mesa/pipe/i915simple/i915_fpc_emit.c b/src/gallium/drivers/i915simple/i915_fpc_emit.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_fpc_emit.c rename to src/gallium/drivers/i915simple/i915_fpc_emit.c diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/gallium/drivers/i915simple/i915_fpc_translate.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_fpc_translate.c rename to src/gallium/drivers/i915simple/i915_fpc_translate.c diff --git a/src/mesa/pipe/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_prim_emit.c rename to src/gallium/drivers/i915simple/i915_prim_emit.c diff --git a/src/mesa/pipe/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_prim_vbuf.c rename to src/gallium/drivers/i915simple/i915_prim_vbuf.c diff --git a/src/mesa/pipe/i915simple/i915_reg.h b/src/gallium/drivers/i915simple/i915_reg.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_reg.h rename to src/gallium/drivers/i915simple/i915_reg.h diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state.c rename to src/gallium/drivers/i915simple/i915_state.c diff --git a/src/mesa/pipe/i915simple/i915_state.h b/src/gallium/drivers/i915simple/i915_state.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_state.h rename to src/gallium/drivers/i915simple/i915_state.h diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/gallium/drivers/i915simple/i915_state_derived.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_derived.c rename to src/gallium/drivers/i915simple/i915_state_derived.c diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/gallium/drivers/i915simple/i915_state_dynamic.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_dynamic.c rename to src/gallium/drivers/i915simple/i915_state_dynamic.c diff --git a/src/mesa/pipe/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_emit.c rename to src/gallium/drivers/i915simple/i915_state_emit.c diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/gallium/drivers/i915simple/i915_state_immediate.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_immediate.c rename to src/gallium/drivers/i915simple/i915_state_immediate.c diff --git a/src/mesa/pipe/i915simple/i915_state_inlines.h b/src/gallium/drivers/i915simple/i915_state_inlines.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_inlines.h rename to src/gallium/drivers/i915simple/i915_state_inlines.h diff --git a/src/mesa/pipe/i915simple/i915_state_sampler.c b/src/gallium/drivers/i915simple/i915_state_sampler.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_state_sampler.c rename to src/gallium/drivers/i915simple/i915_state_sampler.c diff --git a/src/mesa/pipe/i915simple/i915_strings.c b/src/gallium/drivers/i915simple/i915_strings.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_strings.c rename to src/gallium/drivers/i915simple/i915_strings.c diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/gallium/drivers/i915simple/i915_surface.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_surface.c rename to src/gallium/drivers/i915simple/i915_surface.c diff --git a/src/mesa/pipe/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c similarity index 100% rename from src/mesa/pipe/i915simple/i915_texture.c rename to src/gallium/drivers/i915simple/i915_texture.c diff --git a/src/mesa/pipe/i915simple/i915_texture.h b/src/gallium/drivers/i915simple/i915_texture.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_texture.h rename to src/gallium/drivers/i915simple/i915_texture.h diff --git a/src/mesa/pipe/i915simple/i915_winsys.h b/src/gallium/drivers/i915simple/i915_winsys.h similarity index 100% rename from src/mesa/pipe/i915simple/i915_winsys.h rename to src/gallium/drivers/i915simple/i915_winsys.h diff --git a/src/mesa/pipe/i965simple/Makefile b/src/gallium/drivers/i965simple/Makefile similarity index 100% rename from src/mesa/pipe/i965simple/Makefile rename to src/gallium/drivers/i965simple/Makefile diff --git a/src/mesa/pipe/i965simple/SConscript b/src/gallium/drivers/i965simple/SConscript similarity index 100% rename from src/mesa/pipe/i965simple/SConscript rename to src/gallium/drivers/i965simple/SConscript diff --git a/src/mesa/pipe/i965simple/brw_batch.h b/src/gallium/drivers/i965simple/brw_batch.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_batch.h rename to src/gallium/drivers/i965simple/brw_batch.h diff --git a/src/mesa/pipe/i965simple/brw_blit.c b/src/gallium/drivers/i965simple/brw_blit.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_blit.c rename to src/gallium/drivers/i965simple/brw_blit.c diff --git a/src/mesa/pipe/i965simple/brw_blit.h b/src/gallium/drivers/i965simple/brw_blit.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_blit.h rename to src/gallium/drivers/i965simple/brw_blit.h diff --git a/src/mesa/pipe/i965simple/brw_cc.c b/src/gallium/drivers/i965simple/brw_cc.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_cc.c rename to src/gallium/drivers/i965simple/brw_cc.c diff --git a/src/mesa/pipe/i965simple/brw_clip.c b/src/gallium/drivers/i965simple/brw_clip.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip.c rename to src/gallium/drivers/i965simple/brw_clip.c diff --git a/src/mesa/pipe/i965simple/brw_clip.h b/src/gallium/drivers/i965simple/brw_clip.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip.h rename to src/gallium/drivers/i965simple/brw_clip.h diff --git a/src/mesa/pipe/i965simple/brw_clip_line.c b/src/gallium/drivers/i965simple/brw_clip_line.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_line.c rename to src/gallium/drivers/i965simple/brw_clip_line.c diff --git a/src/mesa/pipe/i965simple/brw_clip_point.c b/src/gallium/drivers/i965simple/brw_clip_point.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_point.c rename to src/gallium/drivers/i965simple/brw_clip_point.c diff --git a/src/mesa/pipe/i965simple/brw_clip_state.c b/src/gallium/drivers/i965simple/brw_clip_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_state.c rename to src/gallium/drivers/i965simple/brw_clip_state.c diff --git a/src/mesa/pipe/i965simple/brw_clip_tri.c b/src/gallium/drivers/i965simple/brw_clip_tri.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_tri.c rename to src/gallium/drivers/i965simple/brw_clip_tri.c diff --git a/src/mesa/pipe/i965simple/brw_clip_unfilled.c b/src/gallium/drivers/i965simple/brw_clip_unfilled.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_unfilled.c rename to src/gallium/drivers/i965simple/brw_clip_unfilled.c diff --git a/src/mesa/pipe/i965simple/brw_clip_util.c b/src/gallium/drivers/i965simple/brw_clip_util.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_clip_util.c rename to src/gallium/drivers/i965simple/brw_clip_util.c diff --git a/src/mesa/pipe/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_context.c rename to src/gallium/drivers/i965simple/brw_context.c diff --git a/src/mesa/pipe/i965simple/brw_context.h b/src/gallium/drivers/i965simple/brw_context.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_context.h rename to src/gallium/drivers/i965simple/brw_context.h diff --git a/src/mesa/pipe/i965simple/brw_curbe.c b/src/gallium/drivers/i965simple/brw_curbe.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_curbe.c rename to src/gallium/drivers/i965simple/brw_curbe.c diff --git a/src/mesa/pipe/i965simple/brw_defines.h b/src/gallium/drivers/i965simple/brw_defines.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_defines.h rename to src/gallium/drivers/i965simple/brw_defines.h diff --git a/src/mesa/pipe/i965simple/brw_draw.c b/src/gallium/drivers/i965simple/brw_draw.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_draw.c rename to src/gallium/drivers/i965simple/brw_draw.c diff --git a/src/mesa/pipe/i965simple/brw_draw.h b/src/gallium/drivers/i965simple/brw_draw.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_draw.h rename to src/gallium/drivers/i965simple/brw_draw.h diff --git a/src/mesa/pipe/i965simple/brw_draw_upload.c b/src/gallium/drivers/i965simple/brw_draw_upload.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_draw_upload.c rename to src/gallium/drivers/i965simple/brw_draw_upload.c diff --git a/src/mesa/pipe/i965simple/brw_eu.c b/src/gallium/drivers/i965simple/brw_eu.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_eu.c rename to src/gallium/drivers/i965simple/brw_eu.c diff --git a/src/mesa/pipe/i965simple/brw_eu.h b/src/gallium/drivers/i965simple/brw_eu.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_eu.h rename to src/gallium/drivers/i965simple/brw_eu.h diff --git a/src/mesa/pipe/i965simple/brw_eu_debug.c b/src/gallium/drivers/i965simple/brw_eu_debug.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_eu_debug.c rename to src/gallium/drivers/i965simple/brw_eu_debug.c diff --git a/src/mesa/pipe/i965simple/brw_eu_emit.c b/src/gallium/drivers/i965simple/brw_eu_emit.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_eu_emit.c rename to src/gallium/drivers/i965simple/brw_eu_emit.c diff --git a/src/mesa/pipe/i965simple/brw_eu_util.c b/src/gallium/drivers/i965simple/brw_eu_util.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_eu_util.c rename to src/gallium/drivers/i965simple/brw_eu_util.c diff --git a/src/mesa/pipe/i965simple/brw_flush.c b/src/gallium/drivers/i965simple/brw_flush.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_flush.c rename to src/gallium/drivers/i965simple/brw_flush.c diff --git a/src/mesa/pipe/i965simple/brw_gs.c b/src/gallium/drivers/i965simple/brw_gs.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_gs.c rename to src/gallium/drivers/i965simple/brw_gs.c diff --git a/src/mesa/pipe/i965simple/brw_gs.h b/src/gallium/drivers/i965simple/brw_gs.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_gs.h rename to src/gallium/drivers/i965simple/brw_gs.h diff --git a/src/mesa/pipe/i965simple/brw_gs_emit.c b/src/gallium/drivers/i965simple/brw_gs_emit.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_gs_emit.c rename to src/gallium/drivers/i965simple/brw_gs_emit.c diff --git a/src/mesa/pipe/i965simple/brw_gs_state.c b/src/gallium/drivers/i965simple/brw_gs_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_gs_state.c rename to src/gallium/drivers/i965simple/brw_gs_state.c diff --git a/src/mesa/pipe/i965simple/brw_misc_state.c b/src/gallium/drivers/i965simple/brw_misc_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_misc_state.c rename to src/gallium/drivers/i965simple/brw_misc_state.c diff --git a/src/mesa/pipe/i965simple/brw_reg.h b/src/gallium/drivers/i965simple/brw_reg.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_reg.h rename to src/gallium/drivers/i965simple/brw_reg.h diff --git a/src/mesa/pipe/i965simple/brw_sf.c b/src/gallium/drivers/i965simple/brw_sf.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_sf.c rename to src/gallium/drivers/i965simple/brw_sf.c diff --git a/src/mesa/pipe/i965simple/brw_sf.h b/src/gallium/drivers/i965simple/brw_sf.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_sf.h rename to src/gallium/drivers/i965simple/brw_sf.h diff --git a/src/mesa/pipe/i965simple/brw_sf_emit.c b/src/gallium/drivers/i965simple/brw_sf_emit.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_sf_emit.c rename to src/gallium/drivers/i965simple/brw_sf_emit.c diff --git a/src/mesa/pipe/i965simple/brw_sf_state.c b/src/gallium/drivers/i965simple/brw_sf_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_sf_state.c rename to src/gallium/drivers/i965simple/brw_sf_state.c diff --git a/src/mesa/pipe/i965simple/brw_shader_info.c b/src/gallium/drivers/i965simple/brw_shader_info.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_shader_info.c rename to src/gallium/drivers/i965simple/brw_shader_info.c diff --git a/src/mesa/pipe/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_state.c rename to src/gallium/drivers/i965simple/brw_state.c diff --git a/src/mesa/pipe/i965simple/brw_state.h b/src/gallium/drivers/i965simple/brw_state.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_state.h rename to src/gallium/drivers/i965simple/brw_state.h diff --git a/src/mesa/pipe/i965simple/brw_state_batch.c b/src/gallium/drivers/i965simple/brw_state_batch.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_state_batch.c rename to src/gallium/drivers/i965simple/brw_state_batch.c diff --git a/src/mesa/pipe/i965simple/brw_state_cache.c b/src/gallium/drivers/i965simple/brw_state_cache.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_state_cache.c rename to src/gallium/drivers/i965simple/brw_state_cache.c diff --git a/src/mesa/pipe/i965simple/brw_state_pool.c b/src/gallium/drivers/i965simple/brw_state_pool.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_state_pool.c rename to src/gallium/drivers/i965simple/brw_state_pool.c diff --git a/src/mesa/pipe/i965simple/brw_state_upload.c b/src/gallium/drivers/i965simple/brw_state_upload.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_state_upload.c rename to src/gallium/drivers/i965simple/brw_state_upload.c diff --git a/src/mesa/pipe/i965simple/brw_strings.c b/src/gallium/drivers/i965simple/brw_strings.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_strings.c rename to src/gallium/drivers/i965simple/brw_strings.c diff --git a/src/mesa/pipe/i965simple/brw_structs.h b/src/gallium/drivers/i965simple/brw_structs.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_structs.h rename to src/gallium/drivers/i965simple/brw_structs.h diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/gallium/drivers/i965simple/brw_surface.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_surface.c rename to src/gallium/drivers/i965simple/brw_surface.c diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_tex_layout.c rename to src/gallium/drivers/i965simple/brw_tex_layout.c diff --git a/src/mesa/pipe/i965simple/brw_tex_layout.h b/src/gallium/drivers/i965simple/brw_tex_layout.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_tex_layout.h rename to src/gallium/drivers/i965simple/brw_tex_layout.h diff --git a/src/mesa/pipe/i965simple/brw_urb.c b/src/gallium/drivers/i965simple/brw_urb.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_urb.c rename to src/gallium/drivers/i965simple/brw_urb.c diff --git a/src/mesa/pipe/i965simple/brw_util.c b/src/gallium/drivers/i965simple/brw_util.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_util.c rename to src/gallium/drivers/i965simple/brw_util.c diff --git a/src/mesa/pipe/i965simple/brw_util.h b/src/gallium/drivers/i965simple/brw_util.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_util.h rename to src/gallium/drivers/i965simple/brw_util.h diff --git a/src/mesa/pipe/i965simple/brw_vs.c b/src/gallium/drivers/i965simple/brw_vs.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_vs.c rename to src/gallium/drivers/i965simple/brw_vs.c diff --git a/src/mesa/pipe/i965simple/brw_vs.h b/src/gallium/drivers/i965simple/brw_vs.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_vs.h rename to src/gallium/drivers/i965simple/brw_vs.h diff --git a/src/mesa/pipe/i965simple/brw_vs_emit.c b/src/gallium/drivers/i965simple/brw_vs_emit.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_vs_emit.c rename to src/gallium/drivers/i965simple/brw_vs_emit.c diff --git a/src/mesa/pipe/i965simple/brw_vs_state.c b/src/gallium/drivers/i965simple/brw_vs_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_vs_state.c rename to src/gallium/drivers/i965simple/brw_vs_state.c diff --git a/src/mesa/pipe/i965simple/brw_winsys.h b/src/gallium/drivers/i965simple/brw_winsys.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_winsys.h rename to src/gallium/drivers/i965simple/brw_winsys.h diff --git a/src/mesa/pipe/i965simple/brw_wm.c b/src/gallium/drivers/i965simple/brw_wm.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm.c rename to src/gallium/drivers/i965simple/brw_wm.c diff --git a/src/mesa/pipe/i965simple/brw_wm.h b/src/gallium/drivers/i965simple/brw_wm.h similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm.h rename to src/gallium/drivers/i965simple/brw_wm.h diff --git a/src/mesa/pipe/i965simple/brw_wm_decl.c b/src/gallium/drivers/i965simple/brw_wm_decl.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_decl.c rename to src/gallium/drivers/i965simple/brw_wm_decl.c diff --git a/src/mesa/pipe/i965simple/brw_wm_glsl.c b/src/gallium/drivers/i965simple/brw_wm_glsl.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_glsl.c rename to src/gallium/drivers/i965simple/brw_wm_glsl.c diff --git a/src/mesa/pipe/i965simple/brw_wm_iz.c b/src/gallium/drivers/i965simple/brw_wm_iz.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_iz.c rename to src/gallium/drivers/i965simple/brw_wm_iz.c diff --git a/src/mesa/pipe/i965simple/brw_wm_sampler_state.c b/src/gallium/drivers/i965simple/brw_wm_sampler_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_sampler_state.c rename to src/gallium/drivers/i965simple/brw_wm_sampler_state.c diff --git a/src/mesa/pipe/i965simple/brw_wm_state.c b/src/gallium/drivers/i965simple/brw_wm_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_state.c rename to src/gallium/drivers/i965simple/brw_wm_state.c diff --git a/src/mesa/pipe/i965simple/brw_wm_surface_state.c b/src/gallium/drivers/i965simple/brw_wm_surface_state.c similarity index 100% rename from src/mesa/pipe/i965simple/brw_wm_surface_state.c rename to src/gallium/drivers/i965simple/brw_wm_surface_state.c diff --git a/src/mesa/pipe/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile similarity index 100% rename from src/mesa/pipe/softpipe/Makefile rename to src/gallium/drivers/softpipe/Makefile diff --git a/src/mesa/pipe/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript similarity index 100% rename from src/mesa/pipe/softpipe/SConscript rename to src/gallium/drivers/softpipe/SConscript diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_clear.c rename to src/gallium/drivers/softpipe/sp_clear.c diff --git a/src/mesa/pipe/softpipe/sp_clear.h b/src/gallium/drivers/softpipe/sp_clear.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_clear.h rename to src/gallium/drivers/softpipe/sp_clear.h diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_context.c rename to src/gallium/drivers/softpipe/sp_context.c diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_context.h rename to src/gallium/drivers/softpipe/sp_context.h diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_draw_arrays.c rename to src/gallium/drivers/softpipe/sp_draw_arrays.c diff --git a/src/mesa/pipe/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_flush.c rename to src/gallium/drivers/softpipe/sp_flush.c diff --git a/src/mesa/pipe/softpipe/sp_flush.h b/src/gallium/drivers/softpipe/sp_flush.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_flush.h rename to src/gallium/drivers/softpipe/sp_flush.h diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/gallium/drivers/softpipe/sp_headers.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_headers.h rename to src/gallium/drivers/softpipe/sp_headers.h diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/gallium/drivers/softpipe/sp_prim_setup.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_prim_setup.c rename to src/gallium/drivers/softpipe/sp_prim_setup.c diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/gallium/drivers/softpipe/sp_prim_setup.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_prim_setup.h rename to src/gallium/drivers/softpipe/sp_prim_setup.h diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_prim_vbuf.c rename to src/gallium/drivers/softpipe/sp_prim_vbuf.c diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.h b/src/gallium/drivers/softpipe/sp_prim_vbuf.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_prim_vbuf.h rename to src/gallium/drivers/softpipe/sp_prim_vbuf.h diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/gallium/drivers/softpipe/sp_quad.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad.c rename to src/gallium/drivers/softpipe/sp_quad.c diff --git a/src/mesa/pipe/softpipe/sp_quad.h b/src/gallium/drivers/softpipe/sp_quad.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad.h rename to src/gallium/drivers/softpipe/sp_quad.h diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_alpha_test.c rename to src/gallium/drivers/softpipe/sp_quad_alpha_test.c diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_blend.c rename to src/gallium/drivers/softpipe/sp_quad_blend.c diff --git a/src/mesa/pipe/softpipe/sp_quad_bufloop.c b/src/gallium/drivers/softpipe/sp_quad_bufloop.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_bufloop.c rename to src/gallium/drivers/softpipe/sp_quad_bufloop.c diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_colormask.c rename to src/gallium/drivers/softpipe/sp_quad_colormask.c diff --git a/src/mesa/pipe/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_coverage.c rename to src/gallium/drivers/softpipe/sp_quad_coverage.c diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_depth_test.c rename to src/gallium/drivers/softpipe/sp_quad_depth_test.c diff --git a/src/mesa/pipe/softpipe/sp_quad_earlyz.c b/src/gallium/drivers/softpipe/sp_quad_earlyz.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_earlyz.c rename to src/gallium/drivers/softpipe/sp_quad_earlyz.c diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_fs.c rename to src/gallium/drivers/softpipe/sp_quad_fs.c diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/gallium/drivers/softpipe/sp_quad_occlusion.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_occlusion.c rename to src/gallium/drivers/softpipe/sp_quad_occlusion.c diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_output.c rename to src/gallium/drivers/softpipe/sp_quad_output.c diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_stencil.c rename to src/gallium/drivers/softpipe/sp_quad_stencil.c diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/gallium/drivers/softpipe/sp_quad_stipple.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_quad_stipple.c rename to src/gallium/drivers/softpipe/sp_quad_stipple.c diff --git a/src/mesa/pipe/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_query.c rename to src/gallium/drivers/softpipe/sp_query.c diff --git a/src/mesa/pipe/softpipe/sp_query.h b/src/gallium/drivers/softpipe/sp_query.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_query.h rename to src/gallium/drivers/softpipe/sp_query.h diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_state.h rename to src/gallium/drivers/softpipe/sp_state.h diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/gallium/drivers/softpipe/sp_state_blend.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_blend.c rename to src/gallium/drivers/softpipe/sp_state_blend.c diff --git a/src/mesa/pipe/softpipe/sp_state_clip.c b/src/gallium/drivers/softpipe/sp_state_clip.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_clip.c rename to src/gallium/drivers/softpipe/sp_state_clip.c diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_derived.c rename to src/gallium/drivers/softpipe/sp_state_derived.c diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_fs.c rename to src/gallium/drivers/softpipe/sp_state_fs.c diff --git a/src/mesa/pipe/softpipe/sp_state_rasterizer.c b/src/gallium/drivers/softpipe/sp_state_rasterizer.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_rasterizer.c rename to src/gallium/drivers/softpipe/sp_state_rasterizer.c diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_sampler.c rename to src/gallium/drivers/softpipe/sp_state_sampler.c diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_surface.c rename to src/gallium/drivers/softpipe/sp_state_surface.c diff --git a/src/mesa/pipe/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_state_vertex.c rename to src/gallium/drivers/softpipe/sp_state_vertex.c diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_surface.c rename to src/gallium/drivers/softpipe/sp_surface.c diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/gallium/drivers/softpipe/sp_surface.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_surface.h rename to src/gallium/drivers/softpipe/sp_surface.h diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_tex_sample.c rename to src/gallium/drivers/softpipe/sp_tex_sample.c diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_tex_sample.h rename to src/gallium/drivers/softpipe/sp_tex_sample.h diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_texture.c rename to src/gallium/drivers/softpipe/sp_texture.c diff --git a/src/mesa/pipe/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_texture.h rename to src/gallium/drivers/softpipe/sp_texture.h diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c similarity index 100% rename from src/mesa/pipe/softpipe/sp_tile_cache.c rename to src/gallium/drivers/softpipe/sp_tile_cache.c diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_tile_cache.h rename to src/gallium/drivers/softpipe/sp_tile_cache.h diff --git a/src/mesa/pipe/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h similarity index 100% rename from src/mesa/pipe/softpipe/sp_winsys.h rename to src/gallium/drivers/softpipe/sp_winsys.h diff --git a/src/mesa/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h similarity index 100% rename from src/mesa/pipe/p_compiler.h rename to src/gallium/include/pipe/p_compiler.h diff --git a/src/mesa/pipe/p_context.h b/src/gallium/include/pipe/p_context.h similarity index 100% rename from src/mesa/pipe/p_context.h rename to src/gallium/include/pipe/p_context.h diff --git a/src/mesa/pipe/p_debug.h b/src/gallium/include/pipe/p_debug.h similarity index 100% rename from src/mesa/pipe/p_debug.h rename to src/gallium/include/pipe/p_debug.h diff --git a/src/mesa/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h similarity index 100% rename from src/mesa/pipe/p_defines.h rename to src/gallium/include/pipe/p_defines.h diff --git a/src/mesa/pipe/p_format.h b/src/gallium/include/pipe/p_format.h similarity index 100% rename from src/mesa/pipe/p_format.h rename to src/gallium/include/pipe/p_format.h diff --git a/src/mesa/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h similarity index 100% rename from src/mesa/pipe/p_inlines.h rename to src/gallium/include/pipe/p_inlines.h diff --git a/src/mesa/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h similarity index 100% rename from src/mesa/pipe/p_shader_tokens.h rename to src/gallium/include/pipe/p_shader_tokens.h diff --git a/src/mesa/pipe/p_state.h b/src/gallium/include/pipe/p_state.h similarity index 100% rename from src/mesa/pipe/p_state.h rename to src/gallium/include/pipe/p_state.h diff --git a/src/mesa/pipe/p_thread.h b/src/gallium/include/pipe/p_thread.h similarity index 100% rename from src/mesa/pipe/p_thread.h rename to src/gallium/include/pipe/p_thread.h diff --git a/src/mesa/pipe/p_util.h b/src/gallium/include/pipe/p_util.h similarity index 100% rename from src/mesa/pipe/p_util.h rename to src/gallium/include/pipe/p_util.h diff --git a/src/mesa/pipe/p_winsys.h b/src/gallium/include/pipe/p_winsys.h similarity index 100% rename from src/mesa/pipe/p_winsys.h rename to src/gallium/include/pipe/p_winsys.h diff --git a/src/mesa/drivers/dri/intel_winsys/Makefile b/src/gallium/winsys/dri/intel/Makefile similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/Makefile rename to src/gallium/winsys/dri/intel/Makefile diff --git a/src/mesa/drivers/dri/intel_winsys/SConscript b/src/gallium/winsys/dri/intel/SConscript similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/SConscript rename to src/gallium/winsys/dri/intel/SConscript diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c b/src/gallium/winsys/dri/intel/intel_batchbuffer.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.c rename to src/gallium/winsys/dri/intel/intel_batchbuffer.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h b/src/gallium/winsys/dri/intel/intel_batchbuffer.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_batchbuffer.h rename to src/gallium/winsys/dri/intel/intel_batchbuffer.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.c b/src/gallium/winsys/dri/intel/intel_batchpool.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_batchpool.c rename to src/gallium/winsys/dri/intel/intel_batchpool.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_batchpool.h b/src/gallium/winsys/dri/intel/intel_batchpool.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_batchpool.h rename to src/gallium/winsys/dri/intel/intel_batchpool.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/gallium/winsys/dri/intel/intel_context.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_context.c rename to src/gallium/winsys/dri/intel/intel_context.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.h b/src/gallium/winsys/dri/intel/intel_context.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_context.h rename to src/gallium/winsys/dri/intel/intel_context.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_lock.c b/src/gallium/winsys/dri/intel/intel_lock.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_lock.c rename to src/gallium/winsys/dri/intel/intel_lock.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_reg.h b/src/gallium/winsys/dri/intel/intel_reg.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_reg.h rename to src/gallium/winsys/dri/intel/intel_reg.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.c b/src/gallium/winsys/dri/intel/intel_screen.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_screen.c rename to src/gallium/winsys/dri/intel/intel_screen.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.h b/src/gallium/winsys/dri/intel/intel_screen.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_screen.h rename to src/gallium/winsys/dri/intel/intel_screen.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/gallium/winsys/dri/intel/intel_swapbuffers.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c rename to src/gallium/winsys/dri/intel/intel_swapbuffers.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.h b/src/gallium/winsys/dri/intel/intel_swapbuffers.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.h rename to src/gallium/winsys/dri/intel/intel_swapbuffers.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys.h b/src/gallium/winsys/dri/intel/intel_winsys.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_winsys.h rename to src/gallium/winsys/dri/intel/intel_winsys.h diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c b/src/gallium/winsys/dri/intel/intel_winsys_i915.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_winsys_i915.c rename to src/gallium/winsys/dri/intel/intel_winsys_i915.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c b/src/gallium/winsys/dri/intel/intel_winsys_pipe.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_winsys_pipe.c rename to src/gallium/winsys/dri/intel/intel_winsys_pipe.c diff --git a/src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c b/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/intel_winsys_softpipe.c rename to src/gallium/winsys/dri/intel/intel_winsys_softpipe.c diff --git a/src/mesa/drivers/dri/intel_winsys/server/i830_common.h b/src/gallium/winsys/dri/intel/server/i830_common.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/server/i830_common.h rename to src/gallium/winsys/dri/intel/server/i830_common.h diff --git a/src/mesa/drivers/dri/intel_winsys/server/i830_dri.h b/src/gallium/winsys/dri/intel/server/i830_dri.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/server/i830_dri.h rename to src/gallium/winsys/dri/intel/server/i830_dri.h diff --git a/src/mesa/drivers/dri/intel_winsys/server/intel.h b/src/gallium/winsys/dri/intel/server/intel.h similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/server/intel.h rename to src/gallium/winsys/dri/intel/server/intel.h diff --git a/src/mesa/drivers/dri/intel_winsys/server/intel_dri.c b/src/gallium/winsys/dri/intel/server/intel_dri.c similarity index 100% rename from src/mesa/drivers/dri/intel_winsys/server/intel_dri.c rename to src/gallium/winsys/dri/intel/server/intel_dri.c diff --git a/src/mesa/pipe/xlib/brw_aub.c b/src/gallium/winsys/xlib/brw_aub.c similarity index 100% rename from src/mesa/pipe/xlib/brw_aub.c rename to src/gallium/winsys/xlib/brw_aub.c diff --git a/src/mesa/pipe/xlib/brw_aub.h b/src/gallium/winsys/xlib/brw_aub.h similarity index 100% rename from src/mesa/pipe/xlib/brw_aub.h rename to src/gallium/winsys/xlib/brw_aub.h diff --git a/src/mesa/pipe/xlib/fakeglx.c b/src/gallium/winsys/xlib/fakeglx.c similarity index 100% rename from src/mesa/pipe/xlib/fakeglx.c rename to src/gallium/winsys/xlib/fakeglx.c diff --git a/src/mesa/pipe/xlib/glxapi.c b/src/gallium/winsys/xlib/glxapi.c similarity index 100% rename from src/mesa/pipe/xlib/glxapi.c rename to src/gallium/winsys/xlib/glxapi.c diff --git a/src/mesa/pipe/xlib/glxapi.h b/src/gallium/winsys/xlib/glxapi.h similarity index 100% rename from src/mesa/pipe/xlib/glxapi.h rename to src/gallium/winsys/xlib/glxapi.h diff --git a/src/mesa/pipe/xlib/glxheader.h b/src/gallium/winsys/xlib/glxheader.h similarity index 100% rename from src/mesa/pipe/xlib/glxheader.h rename to src/gallium/winsys/xlib/glxheader.h diff --git a/src/mesa/pipe/xlib/realglx.c b/src/gallium/winsys/xlib/realglx.c similarity index 100% rename from src/mesa/pipe/xlib/realglx.c rename to src/gallium/winsys/xlib/realglx.c diff --git a/src/mesa/pipe/xlib/realglx.h b/src/gallium/winsys/xlib/realglx.h similarity index 100% rename from src/mesa/pipe/xlib/realglx.h rename to src/gallium/winsys/xlib/realglx.h diff --git a/src/mesa/pipe/xlib/xfonts.c b/src/gallium/winsys/xlib/xfonts.c similarity index 100% rename from src/mesa/pipe/xlib/xfonts.c rename to src/gallium/winsys/xlib/xfonts.c diff --git a/src/mesa/pipe/xlib/xfonts.h b/src/gallium/winsys/xlib/xfonts.h similarity index 100% rename from src/mesa/pipe/xlib/xfonts.h rename to src/gallium/winsys/xlib/xfonts.h diff --git a/src/mesa/pipe/xlib/xm_api.c b/src/gallium/winsys/xlib/xm_api.c similarity index 100% rename from src/mesa/pipe/xlib/xm_api.c rename to src/gallium/winsys/xlib/xm_api.c diff --git a/src/mesa/pipe/xlib/xm_image.c b/src/gallium/winsys/xlib/xm_image.c similarity index 100% rename from src/mesa/pipe/xlib/xm_image.c rename to src/gallium/winsys/xlib/xm_image.c diff --git a/src/mesa/pipe/xlib/xm_image.h b/src/gallium/winsys/xlib/xm_image.h similarity index 100% rename from src/mesa/pipe/xlib/xm_image.h rename to src/gallium/winsys/xlib/xm_image.h diff --git a/src/mesa/pipe/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c similarity index 100% rename from src/mesa/pipe/xlib/xm_winsys.c rename to src/gallium/winsys/xlib/xm_winsys.c diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.c b/src/gallium/winsys/xlib/xm_winsys_aub.c similarity index 100% rename from src/mesa/pipe/xlib/xm_winsys_aub.c rename to src/gallium/winsys/xlib/xm_winsys_aub.c diff --git a/src/mesa/pipe/xlib/xm_winsys_aub.h b/src/gallium/winsys/xlib/xm_winsys_aub.h similarity index 100% rename from src/mesa/pipe/xlib/xm_winsys_aub.h rename to src/gallium/winsys/xlib/xm_winsys_aub.h diff --git a/src/mesa/pipe/xlib/xmesaP.h b/src/gallium/winsys/xlib/xmesaP.h similarity index 100% rename from src/mesa/pipe/xlib/xmesaP.h rename to src/gallium/winsys/xlib/xmesaP.h From 6acd63a4980951727939c0dd545a0324965b3834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Feb 2008 17:50:12 +0900 Subject: [PATCH 59/74] Code reorganization: update build. Update the Makefiles and includes for the new paths. Note that there hasn't been no separation of the Makefiles yet, and make is jumping all over the place. That will be taken care shortly. But for now, make should work. It was tested with linux and linux-dri. Linux-cell and linux-llvm might require some minor tweaks. --- configs/beos | 2 +- configs/darwin | 2 +- configs/darwin-x86ppc | 2 +- configs/default | 2 +- configs/freebsd-dri | 2 +- configs/linux-cell | 2 +- configs/linux-directfb | 2 +- configs/linux-dri | 6 +- configs/linux-dri-xcb | 4 +- configs/linux-fbdev | 2 +- configs/linux-osmesa | 2 +- configs/linux-osmesa16 | 2 +- configs/linux-osmesa16-static | 2 +- configs/linux-osmesa32 | 2 +- configs/linux-solo | 2 +- src/gallium/Makefile | 12 +- src/gallium/Makefile.template | 7 +- src/gallium/aux/Makefile | 24 ++++ src/gallium/aux/draw/draw_private.h | 2 +- src/gallium/aux/draw/draw_vertex.c | 4 +- src/gallium/aux/draw/draw_vertex_shader.c | 4 +- src/gallium/aux/llvm/Makefile | 4 +- src/gallium/aux/llvm/gallivm.cpp | 4 +- src/gallium/aux/llvm/gallivm_cpu.cpp | 4 +- src/gallium/aux/llvm/tgsitollvm.cpp | 10 +- src/gallium/aux/pipebuffer/Makefile | 2 +- src/gallium/aux/tgsi/exec/tgsi_exec.c | 4 +- src/gallium/aux/tgsi/exec/tgsi_sse2.c | 4 +- src/gallium/aux/tgsi/util/tgsi_transform.h | 4 +- src/gallium/drivers/Makefile | 24 ++++ src/gallium/drivers/cell/ppu/Makefile | 7 +- src/gallium/drivers/cell/ppu/cell_clear.c | 2 +- src/gallium/drivers/cell/ppu/cell_context.c | 6 +- src/gallium/drivers/cell/ppu/cell_context.h | 6 +- .../drivers/cell/ppu/cell_draw_arrays.c | 2 +- src/gallium/drivers/cell/ppu/cell_flush.c | 2 +- src/gallium/drivers/cell/ppu/cell_render.c | 2 +- src/gallium/drivers/cell/ppu/cell_spu.c | 2 +- src/gallium/drivers/cell/ppu/cell_spu.h | 2 +- .../drivers/cell/ppu/cell_state_blend.c | 2 +- .../drivers/cell/ppu/cell_state_clip.c | 2 +- .../drivers/cell/ppu/cell_state_derived.c | 4 +- src/gallium/drivers/cell/ppu/cell_state_fs.c | 8 +- .../drivers/cell/ppu/cell_state_rasterizer.c | 2 +- .../drivers/cell/ppu/cell_state_sampler.c | 2 +- .../drivers/cell/ppu/cell_state_vertex.c | 2 +- src/gallium/drivers/cell/ppu/cell_surface.c | 2 +- src/gallium/drivers/cell/ppu/cell_vbuf.c | 2 +- .../drivers/cell/ppu/cell_vertex_shader.c | 6 +- src/gallium/drivers/cell/spu/Makefile | 6 +- src/gallium/drivers/cell/spu/spu_exec.c | 4 +- src/gallium/drivers/cell/spu/spu_exec.h | 2 +- src/gallium/drivers/cell/spu/spu_main.c | 2 +- src/gallium/drivers/cell/spu/spu_main.h | 4 +- src/gallium/drivers/cell/spu/spu_render.c | 2 +- src/gallium/drivers/cell/spu/spu_render.h | 2 +- src/gallium/drivers/cell/spu/spu_tile.h | 2 +- src/gallium/drivers/cell/spu/spu_util.c | 4 +- .../drivers/cell/spu/spu_vertex_shader.c | 6 +- src/gallium/drivers/failover/Makefile | 2 +- src/gallium/drivers/i915simple/Makefile | 2 +- src/gallium/drivers/i915simple/i915_context.c | 2 +- src/gallium/drivers/i915simple/i915_context.h | 2 +- .../drivers/i915simple/i915_fpc_translate.c | 4 +- .../drivers/i915simple/i915_prim_emit.c | 2 +- .../drivers/i915simple/i915_prim_vbuf.c | 2 +- src/gallium/drivers/i915simple/i915_state.c | 2 +- .../drivers/i915simple/i915_state_derived.c | 4 +- src/gallium/drivers/i915simple/i915_strings.c | 2 +- src/gallium/drivers/i915simple/i915_surface.c | 2 +- src/gallium/drivers/i965simple/Makefile | 2 +- .../drivers/i965simple/brw_shader_info.c | 2 +- src/gallium/drivers/i965simple/brw_state.c | 2 +- src/gallium/drivers/i965simple/brw_strings.c | 2 +- src/gallium/drivers/i965simple/brw_surface.c | 2 +- src/gallium/drivers/i965simple/brw_vs_emit.c | 2 +- src/gallium/drivers/i965simple/brw_wm_decl.c | 2 +- src/gallium/drivers/i965simple/brw_wm_glsl.c | 2 +- src/gallium/drivers/softpipe/Makefile | 2 +- src/gallium/drivers/softpipe/sp_context.c | 2 +- src/gallium/drivers/softpipe/sp_context.h | 2 +- src/gallium/drivers/softpipe/sp_draw_arrays.c | 2 +- src/gallium/drivers/softpipe/sp_flush.c | 2 +- src/gallium/drivers/softpipe/sp_headers.h | 2 +- src/gallium/drivers/softpipe/sp_prim_setup.c | 4 +- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 6 +- src/gallium/drivers/softpipe/sp_quad_fs.c | 2 +- src/gallium/drivers/softpipe/sp_query.c | 2 +- src/gallium/drivers/softpipe/sp_state_clip.c | 2 +- .../drivers/softpipe/sp_state_derived.c | 6 +- src/gallium/drivers/softpipe/sp_state_fs.c | 8 +- .../drivers/softpipe/sp_state_rasterizer.c | 2 +- .../drivers/softpipe/sp_state_sampler.c | 4 +- .../drivers/softpipe/sp_state_vertex.c | 2 +- src/gallium/drivers/softpipe/sp_surface.c | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 2 +- src/gallium/drivers/softpipe/sp_tile_cache.c | 2 +- src/gallium/winsys/dri/Makefile | 38 ++++++ src/gallium/winsys/dri/Makefile.template | 113 ++++++++++++++++++ src/gallium/winsys/dri/intel/Makefile | 8 +- .../winsys/dri/intel/intel_winsys_i915.c | 2 +- .../winsys/dri/intel/intel_winsys_softpipe.c | 2 +- src/gallium/winsys/xlib/xm_winsys.c | 6 +- src/gallium/winsys/xlib/xm_winsys_aub.c | 2 +- src/mesa/Makefile | 16 ++- src/mesa/drivers/x11/xm_api.c | 2 +- src/mesa/drivers/x11/xm_dd.c | 2 +- src/mesa/drivers/x11/xm_surface.c | 8 +- src/mesa/drivers/x11/xm_winsys.c | 2 +- src/mesa/drivers/x11/xmesaP.h | 4 +- src/mesa/sources | 83 ++++++------- src/mesa/state_tracker/st_atom_shader.c | 2 +- src/mesa/state_tracker/st_cache.c | 4 +- src/mesa/state_tracker/st_cache.h | 2 +- src/mesa/state_tracker/st_cb_accum.c | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_feedback.c | 6 +- src/mesa/state_tracker/st_cb_program.c | 4 +- src/mesa/state_tracker/st_cb_rasterpos.c | 4 +- src/mesa/state_tracker/st_cb_readpixels.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 2 +- src/mesa/state_tracker/st_context.c | 4 +- src/mesa/state_tracker/st_debug.c | 4 +- src/mesa/state_tracker/st_draw.c | 4 +- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_mesa_to_tgsi.c | 6 +- src/mesa/state_tracker/st_program.c | 4 +- 127 files changed, 445 insertions(+), 241 deletions(-) create mode 100644 src/gallium/aux/Makefile create mode 100644 src/gallium/drivers/Makefile create mode 100644 src/gallium/winsys/dri/Makefile create mode 100644 src/gallium/winsys/dri/Makefile.template diff --git a/configs/beos b/configs/beos index f07973d0c78..2b74af739d0 100644 --- a/configs/beos +++ b/configs/beos @@ -86,7 +86,7 @@ else endif # Directories -SRC_DIRS = mesa glu glut/beos +SRC_DIRS = gallium mesa glu glut/beos GLU_DIRS = sgi DRIVER_DIRS = beos PROGRAM_DIRS = beos samples redbook demos tests diff --git a/configs/darwin b/configs/darwin index 7826ecc605e..bba78026962 100644 --- a/configs/darwin +++ b/configs/darwin @@ -25,5 +25,5 @@ GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm # omit glw lib for now: -SRC_DIRS = mesa glu glut/glx +SRC_DIRS = gallium mesa glu glut/glx diff --git a/configs/darwin-x86ppc b/configs/darwin-x86ppc index 13172327a76..ebeb25051f1 100644 --- a/configs/darwin-x86ppc +++ b/configs/darwin-x86ppc @@ -29,5 +29,5 @@ GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm # omit glw lib for now: -SRC_DIRS = mesa glu glut/glx +SRC_DIRS = gallium mesa glu glut/glx diff --git a/configs/default b/configs/default index 166205a1d31..25a87e66a1b 100644 --- a/configs/default +++ b/configs/default @@ -60,7 +60,7 @@ GLW_SOURCES = GLwDrawA.c # Directories to build LIB_DIR = lib -SRC_DIRS = mesa glu glut/glx glw +SRC_DIRS = gallium mesa glu glut/glx glw GLU_DIRS = sgi DRIVER_DIRS = x11 osmesa # Which subdirs under $(TOP)/progs/ to enter: diff --git a/configs/freebsd-dri b/configs/freebsd-dri index 402883d1de0..67d253b8695 100644 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@ -36,7 +36,7 @@ GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lGL -lXt -lX11 # Directories -SRC_DIRS = glx/x11 mesa glu glut/glx glw +SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw DRIVER_DIRS = dri PROGRAM_DIRS = WINDOW_SYSTEM=dri diff --git a/configs/linux-cell b/configs/linux-cell index 3d874491e41..fdf20deeeb0 100644 --- a/configs/linux-cell +++ b/configs/linux-cell @@ -21,7 +21,7 @@ CFLAGS = $(OPT_FLAGS) -Wall -Winline -fPIC -m32 -mabi=altivec -maltivec -I. -I$( CXXFLAGS = $(CFLAGS) # Omitting glw here: -SRC_DIRS = mesa glu glut/glx +SRC_DIRS = gallium mesa glu glut/glx MKDEP_OPTIONS = -fdepend -Y diff --git a/configs/linux-directfb b/configs/linux-directfb index 09332f48081..dff27f78503 100644 --- a/configs/linux-directfb +++ b/configs/linux-directfb @@ -22,7 +22,7 @@ ifeq ($(HAVE_X86), yes) endif # Directories -SRC_DIRS = mesa glu glut/directfb +SRC_DIRS = gallium mesa glu glut/directfb GLU_DIRS = sgi DRIVER_DIRS = directfb PROGRAM_DIRS = demos directfb diff --git a/configs/linux-dri b/configs/linux-dri index 936fce99829..e6135856fc1 100644 --- a/configs/linux-dri +++ b/configs/linux-dri @@ -54,10 +54,10 @@ USING_EGL=0 # Directories ifeq ($(USING_EGL), 1) -SRC_DIRS = egl glx/x11 mesa glu glut/glx glw +SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw PROGRAM_DIRS = egl else -SRC_DIRS = glx/x11 mesa glu glut/glx glw +SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw PROGRAM_DIRS = endif @@ -66,4 +66,4 @@ WINDOW_SYSTEM=dri # gamma are missing because they have not been converted to use the new # interface. -DRI_DIRS = intel_winsys +DRI_DIRS = intel diff --git a/configs/linux-dri-xcb b/configs/linux-dri-xcb index aa292a13ec1..ea4bdf1864c 100644 --- a/configs/linux-dri-xcb +++ b/configs/linux-dri-xcb @@ -53,10 +53,10 @@ USING_EGL=0 # Directories ifeq ($(USING_EGL), 1) -SRC_DIRS = egl glx/x11 mesa glu glut/glx glw +SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw PROGRAM_DIRS = egl else -SRC_DIRS = glx/x11 mesa glu glut/glx glw +SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw PROGRAM_DIRS = endif diff --git a/configs/linux-fbdev b/configs/linux-fbdev index e36d20a702c..1ddccb3f52b 100644 --- a/configs/linux-fbdev +++ b/configs/linux-fbdev @@ -6,7 +6,7 @@ CONFIG_NAME = linux-fbdev CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER -SRC_DIRS = mesa glu glut/fbdev +SRC_DIRS = gallium mesa glu glut/fbdev DRIVER_DIRS = fbdev osmesa PROGRAM_DIRS = fbdev demos redbook samples diff --git a/configs/linux-osmesa b/configs/linux-osmesa index cc1fbbd109a..0382a19553a 100644 --- a/configs/linux-osmesa +++ b/configs/linux-osmesa @@ -14,7 +14,7 @@ CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOUR # Directories -SRC_DIRS = mesa glu +SRC_DIRS = gallium mesa glu DRIVER_DIRS = osmesa PROGRAM_DIRS = osdemos diff --git a/configs/linux-osmesa16 b/configs/linux-osmesa16 index 1fb0186d315..9a527592f1d 100644 --- a/configs/linux-osmesa16 +++ b/configs/linux-osmesa16 @@ -17,7 +17,7 @@ OSMESA_LIB_NAME = libOSMesa16.so # Directories -SRC_DIRS = mesa glu +SRC_DIRS = gallium mesa glu DRIVER_DIRS = osmesa PROGRAM_DIRS = diff --git a/configs/linux-osmesa16-static b/configs/linux-osmesa16-static index 6645504478e..1e6380b02e0 100644 --- a/configs/linux-osmesa16-static +++ b/configs/linux-osmesa16-static @@ -18,7 +18,7 @@ OSMESA_LIB_NAME = libOSMesa16.a # Directories -SRC_DIRS = mesa glu +SRC_DIRS = gallium mesa glu DRIVER_DIRS = osmesa PROGRAM_DIRS = diff --git a/configs/linux-osmesa32 b/configs/linux-osmesa32 index a1e5a358d60..f0ef1831b09 100644 --- a/configs/linux-osmesa32 +++ b/configs/linux-osmesa32 @@ -17,7 +17,7 @@ OSMESA_LIB_NAME = libOSMesa32.so # Directories -SRC_DIRS = mesa glu +SRC_DIRS = gallium mesa glu DRIVER_DIRS = osmesa PROGRAM_DIRS = diff --git a/configs/linux-solo b/configs/linux-solo index 220fe58b9a4..d49b9722282 100644 --- a/configs/linux-solo +++ b/configs/linux-solo @@ -43,7 +43,7 @@ GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread # Directories -SRC_DIRS = glx/mini mesa glu glut/mini +SRC_DIRS = glx/mini gallium mesa glu glut/mini DRIVER_DIRS = dri PROGRAM_DIRS = miniglx diff --git a/src/gallium/Makefile b/src/gallium/Makefile index d880d090c15..a13b9a52d36 100644 --- a/src/gallium/Makefile +++ b/src/gallium/Makefile @@ -1,16 +1,8 @@ -TOP = ../../.. +TOP = ../.. include $(TOP)/configs/current -ifeq ($(CONFIG_NAME), linux-cell) -CELL_DIR = cell -endif - -ifeq ($(CONFIG_NAME), linux-llvm) -LLVM_DIR = llvm -endif - -SUBDIRS = softpipe i915simple i965simple failover pipebuffer $(CELL_DIR) $(LLVM_DIR) +SUBDIRS = aux drivers default: subdirs diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template index 8e84f8eb2d7..0717ed8dd24 100644 --- a/src/gallium/Makefile.template +++ b/src/gallium/Makefile.template @@ -15,7 +15,10 @@ OBJECTS = $(C_SOURCES:.c=.o) \ ### Include directories INCLUDES = \ -I. \ - -I$(TOP)/src/mesa/pipe \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/include/pipe \ + -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/drivers \ -I$(TOP)/src/mesa \ -I$(TOP)/include \ $(DRIVER_INCLUDES) @@ -38,7 +41,7 @@ INCLUDES = \ default: depend symlinks $(LIBNAME) -$(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/mesa/pipe/Makefile.template +$(LIBNAME): $(OBJECTS) Makefile $(TOP)/src/gallium/Makefile.template $(TOP)/bin/mklib -o $@ -static $(OBJECTS) $(DRIVER_LIBS) diff --git a/src/gallium/aux/Makefile b/src/gallium/aux/Makefile new file mode 100644 index 00000000000..da68498aa1f --- /dev/null +++ b/src/gallium/aux/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +include $(TOP)/configs/current + + +ifeq ($(CONFIG_NAME), linux-llvm) +LLVM_DIR = llvm +endif + +SUBDIRS = pipebuffer $(LLVM_DIR) + + +default: subdirs + + +subdirs: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + + +clean: + rm -f `find . -name \*.[oa]` diff --git a/src/gallium/aux/draw/draw_private.h b/src/gallium/aux/draw/draw_private.h index b17eaaed65e..3d09aef87c1 100644 --- a/src/gallium/aux/draw/draw_private.h +++ b/src/gallium/aux/draw/draw_private.h @@ -45,7 +45,7 @@ #include "pipe/p_defines.h" #include "x86/rtasm/x86sse.h" -#include "pipe/tgsi/exec/tgsi_exec.h" +#include "tgsi/exec/tgsi_exec.h" struct gallivm_prog; diff --git a/src/gallium/aux/draw/draw_vertex.c b/src/gallium/aux/draw/draw_vertex.c index 2d6592150fc..daf1ef4b80f 100644 --- a/src/gallium/aux/draw/draw_vertex.c +++ b/src/gallium/aux/draw/draw_vertex.c @@ -34,8 +34,8 @@ */ -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_private.h" +#include "draw/draw_vertex.h" /** diff --git a/src/gallium/aux/draw/draw_vertex_shader.c b/src/gallium/aux/draw/draw_vertex_shader.c index c824c1407e9..377ecbb931c 100644 --- a/src/gallium/aux/draw/draw_vertex_shader.c +++ b/src/gallium/aux/draw/draw_vertex_shader.c @@ -34,13 +34,13 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" #if defined(__i386__) || defined(__386__) -#include "pipe/tgsi/exec/tgsi_sse2.h" +#include "tgsi/exec/tgsi_sse2.h" #endif #include "draw_private.h" #include "draw_context.h" #include "x86/rtasm/x86sse.h" -#include "pipe/llvm/gallivm.h" +#include "llvm/gallivm.h" #define DBG_VS 0 diff --git a/src/gallium/aux/llvm/Makefile b/src/gallium/aux/llvm/Makefile index 9c6e16d86b7..e6ac399d088 100644 --- a/src/gallium/aux/llvm/Makefile +++ b/src/gallium/aux/llvm/Makefile @@ -30,7 +30,9 @@ OBJECTS = $(C_SOURCES:.c=.o) \ ### Include directories INCLUDES = \ -I. \ - -I$(TOP)/src/mesa/pipe \ + -I$(TOP)/src/gallium/drivers + -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/include \ -I$(TOP)/src/mesa \ -I$(TOP)/include diff --git a/src/gallium/aux/llvm/gallivm.cpp b/src/gallium/aux/llvm/gallivm.cpp index da0105c2c98..d14bb3b99a8 100644 --- a/src/gallium/aux/llvm/gallivm.cpp +++ b/src/gallium/aux/llvm/gallivm.cpp @@ -42,8 +42,8 @@ #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/exec/tgsi_exec.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "tgsi/exec/tgsi_exec.h" +#include "tgsi/util/tgsi_dump.h" #include #include diff --git a/src/gallium/aux/llvm/gallivm_cpu.cpp b/src/gallium/aux/llvm/gallivm_cpu.cpp index dc4d92a72a6..8f9830d0b1e 100644 --- a/src/gallium/aux/llvm/gallivm_cpu.cpp +++ b/src/gallium/aux/llvm/gallivm_cpu.cpp @@ -42,8 +42,8 @@ #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/exec/tgsi_exec.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "tgsi/exec/tgsi_exec.h" +#include "tgsi/util/tgsi_dump.h" #include #include diff --git a/src/gallium/aux/llvm/tgsitollvm.cpp b/src/gallium/aux/llvm/tgsitollvm.cpp index 0de595e6789..2cb4acce32f 100644 --- a/src/gallium/aux/llvm/tgsitollvm.cpp +++ b/src/gallium/aux/llvm/tgsitollvm.cpp @@ -10,11 +10,11 @@ #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/exec/tgsi_exec.h" -#include "pipe/tgsi/util/tgsi_util.h" -#include "pipe/tgsi/util/tgsi_build.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/exec/tgsi_exec.h" +#include "tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_build.h" +#include "tgsi/util/tgsi_dump.h" #include diff --git a/src/gallium/aux/pipebuffer/Makefile b/src/gallium/aux/pipebuffer/Makefile index 75764a9a188..588629e8701 100644 --- a/src/gallium/aux/pipebuffer/Makefile +++ b/src/gallium/aux/pipebuffer/Makefile @@ -17,7 +17,7 @@ C_SOURCES = \ ASM_SOURCES = -include ../Makefile.template +include ../../Makefile.template symlinks: diff --git a/src/gallium/aux/tgsi/exec/tgsi_exec.c b/src/gallium/aux/tgsi/exec/tgsi_exec.c index 37e60070686..a8f64c2287f 100644 --- a/src/gallium/aux/tgsi/exec/tgsi_exec.c +++ b/src/gallium/aux/tgsi/exec/tgsi_exec.c @@ -54,8 +54,8 @@ #include "pipe/p_state.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_util.h" #include "tgsi_exec.h" #define TILE_TOP_LEFT 0 diff --git a/src/gallium/aux/tgsi/exec/tgsi_sse2.c b/src/gallium/aux/tgsi/exec/tgsi_sse2.c index 1e56e4afb69..593464db3ed 100755 --- a/src/gallium/aux/tgsi/exec/tgsi_sse2.c +++ b/src/gallium/aux/tgsi/exec/tgsi_sse2.c @@ -27,8 +27,8 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_util.h" #include "tgsi_exec.h" #include "tgsi_sse2.h" diff --git a/src/gallium/aux/tgsi/util/tgsi_transform.h b/src/gallium/aux/tgsi/util/tgsi_transform.h index 365d8c298c7..fcf85d603be 100644 --- a/src/gallium/aux/tgsi/util/tgsi_transform.h +++ b/src/gallium/aux/tgsi/util/tgsi_transform.h @@ -31,8 +31,8 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/util/tgsi_build.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_build.h" diff --git a/src/gallium/drivers/Makefile b/src/gallium/drivers/Makefile new file mode 100644 index 00000000000..c0345a9cb54 --- /dev/null +++ b/src/gallium/drivers/Makefile @@ -0,0 +1,24 @@ +TOP = ../../.. +include $(TOP)/configs/current + + +ifeq ($(CONFIG_NAME), linux-cell) +CELL_DIR = cell +endif + +SUBDIRS = softpipe i915simple i965simple failover pipebuffer $(CELL_DIR) + + +default: subdirs + + +subdirs: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + + +clean: + rm -f `find . -name \*.[oa]` diff --git a/src/gallium/drivers/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile index 50060f5cd30..011863c11e1 100644 --- a/src/gallium/drivers/cell/ppu/Makefile +++ b/src/gallium/drivers/cell/ppu/Makefile @@ -40,8 +40,11 @@ SOURCES = \ OBJECTS = $(SOURCES:.c=.o) \ -INCLUDE_DIRS = -I$(TOP)/src/mesa - +INCLUDE_DIRS = \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/drivers .c.o: $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index 07b908eec59..e588a30d5bc 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -35,7 +35,7 @@ #include #include "pipe/p_inlines.h" #include "pipe/p_util.h" -#include "pipe/cell/common.h" +#include "cell/common.h" #include "cell_clear.h" #include "cell_context.h" #include "cell_batch.h" diff --git a/src/gallium/drivers/cell/ppu/cell_context.c b/src/gallium/drivers/cell/ppu/cell_context.c index bbe1fd7a111..e1eb22f4685 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.c +++ b/src/gallium/drivers/cell/ppu/cell_context.c @@ -37,9 +37,9 @@ #include "pipe/p_format.h" #include "pipe/p_util.h" #include "pipe/p_winsys.h" -#include "pipe/cell/common.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" +#include "cell/common.h" +#include "draw/draw_context.h" +#include "draw/draw_private.h" #include "cell_clear.h" #include "cell_context.h" #include "cell_draw_arrays.h" diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h index 3b63419b5eb..6196c0c72f9 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.h +++ b/src/gallium/drivers/cell/ppu/cell_context.h @@ -32,10 +32,10 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/draw/draw_vertex.h" -#include "pipe/draw/draw_vbuf.h" +#include "draw/draw_vertex.h" +#include "draw/draw_vbuf.h" #include "cell_winsys.h" -#include "pipe/cell/common.h" +#include "cell/common.h" struct cell_vbuf_render; diff --git a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c index 717cd8370f9..f12613649b9 100644 --- a/src/gallium/drivers/cell/ppu/cell_draw_arrays.c +++ b/src/gallium/drivers/cell/ppu/cell_draw_arrays.c @@ -39,7 +39,7 @@ #include "cell_draw_arrays.h" #include "cell_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" diff --git a/src/gallium/drivers/cell/ppu/cell_flush.c b/src/gallium/drivers/cell/ppu/cell_flush.c index f62bc4650ce..20f27531fce 100644 --- a/src/gallium/drivers/cell/ppu/cell_flush.c +++ b/src/gallium/drivers/cell/ppu/cell_flush.c @@ -31,7 +31,7 @@ #include "cell_flush.h" #include "cell_spu.h" #include "cell_render.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" void diff --git a/src/gallium/drivers/cell/ppu/cell_render.c b/src/gallium/drivers/cell/ppu/cell_render.c index 4ab277a4b24..b663b376222 100644 --- a/src/gallium/drivers/cell/ppu/cell_render.c +++ b/src/gallium/drivers/cell/ppu/cell_render.c @@ -34,7 +34,7 @@ #include "cell_render.h" #include "cell_spu.h" #include "pipe/p_util.h" -#include "pipe/draw/draw_private.h" +#include "draw/draw_private.h" struct render_stage { diff --git a/src/gallium/drivers/cell/ppu/cell_spu.c b/src/gallium/drivers/cell/ppu/cell_spu.c index 7c83a47e574..419e74dc402 100644 --- a/src/gallium/drivers/cell/ppu/cell_spu.c +++ b/src/gallium/drivers/cell/ppu/cell_spu.c @@ -31,7 +31,7 @@ #include "cell_spu.h" #include "pipe/p_format.h" #include "pipe/p_state.h" -#include "pipe/cell/common.h" +#include "cell/common.h" /* diff --git a/src/gallium/drivers/cell/ppu/cell_spu.h b/src/gallium/drivers/cell/ppu/cell_spu.h index 19eff94f967..137f26612e4 100644 --- a/src/gallium/drivers/cell/ppu/cell_spu.h +++ b/src/gallium/drivers/cell/ppu/cell_spu.h @@ -31,7 +31,7 @@ #include #include -#include "pipe/cell/common.h" +#include "cell/common.h" #include "cell_context.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_blend.c b/src/gallium/drivers/cell/ppu/cell_state_blend.c index 4fc60548c85..b6d6d71f0ce 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_blend.c +++ b/src/gallium/drivers/cell/ppu/cell_state_blend.c @@ -29,7 +29,7 @@ */ #include "pipe/p_util.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "cell_context.h" #include "cell_state.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_clip.c b/src/gallium/drivers/cell/ppu/cell_state_clip.c index 4f43665941d..0482f87e889 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_clip.c +++ b/src/gallium/drivers/cell/ppu/cell_state_clip.c @@ -30,7 +30,7 @@ #include "cell_context.h" #include "cell_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" void cell_set_clip_state( struct pipe_context *pipe, diff --git a/src/gallium/drivers/cell/ppu/cell_state_derived.c b/src/gallium/drivers/cell/ppu/cell_state_derived.c index 56daf5dfde0..0c468292584 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_derived.c +++ b/src/gallium/drivers/cell/ppu/cell_state_derived.c @@ -27,8 +27,8 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_context.h" +#include "draw/draw_vertex.h" #include "cell_context.h" #include "cell_batch.h" #include "cell_state.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_fs.c b/src/gallium/drivers/cell/ppu/cell_state_fs.c index 3f46a87d189..b2ed699a5be 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_fs.c +++ b/src/gallium/drivers/cell/ppu/cell_state_fs.c @@ -29,12 +29,12 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #if 0 #include "pipe/p_shader_tokens.h" -#include "pipe/llvm/gallivm.h" -#include "pipe/tgsi/util/tgsi_dump.h" -#include "pipe/tgsi/exec/tgsi_sse2.h" +#include "llvm/gallivm.h" +#include "tgsi/util/tgsi_dump.h" +#include "tgsi/exec/tgsi_sse2.h" #endif #include "cell_context.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c b/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c index d8128ece54d..7eca5b57656 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c +++ b/src/gallium/drivers/cell/ppu/cell_state_rasterizer.c @@ -27,7 +27,7 @@ #include "pipe/p_defines.h" #include "pipe/p_util.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "cell_context.h" #include "cell_state.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_sampler.c b/src/gallium/drivers/cell/ppu/cell_state_sampler.c index ade6cc8338e..a33421a4ad0 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_sampler.c +++ b/src/gallium/drivers/cell/ppu/cell_state_sampler.c @@ -30,7 +30,7 @@ */ #include "pipe/p_util.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "cell_context.h" #include "cell_state.h" #include "cell_texture.h" diff --git a/src/gallium/drivers/cell/ppu/cell_state_vertex.c b/src/gallium/drivers/cell/ppu/cell_state_vertex.c index 0f01e920f95..563831b62db 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_vertex.c +++ b/src/gallium/drivers/cell/ppu/cell_state_vertex.c @@ -32,7 +32,7 @@ #include "cell_context.h" #include "cell_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" void diff --git a/src/gallium/drivers/cell/ppu/cell_surface.c b/src/gallium/drivers/cell/ppu/cell_surface.c index fca93e47424..a35db0ef991 100644 --- a/src/gallium/drivers/cell/ppu/cell_surface.c +++ b/src/gallium/drivers/cell/ppu/cell_surface.c @@ -29,7 +29,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #include "cell_context.h" #include "cell_surface.h" diff --git a/src/gallium/drivers/cell/ppu/cell_vbuf.c b/src/gallium/drivers/cell/ppu/cell_vbuf.c index e9fafe492ee..cc727ff4edb 100644 --- a/src/gallium/drivers/cell/ppu/cell_vbuf.c +++ b/src/gallium/drivers/cell/ppu/cell_vbuf.c @@ -36,7 +36,7 @@ #include "cell_flush.h" #include "cell_spu.h" #include "cell_vbuf.h" -#include "pipe/draw/draw_vbuf.h" +#include "draw/draw_vbuf.h" /** Allow vertex data to be inlined after RENDER command */ diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c index 80dd500b345..0ba4506505e 100644 --- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c +++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c @@ -38,9 +38,9 @@ #include "cell_spu.h" #include "cell_batch.h" -#include "pipe/cell/common.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" +#include "cell/common.h" +#include "draw/draw_context.h" +#include "draw/draw_private.h" /** * Run the vertex shader on all vertices in the vertex queue. diff --git a/src/gallium/drivers/cell/spu/Makefile b/src/gallium/drivers/cell/spu/Makefile index f202971d738..7aa947299e7 100644 --- a/src/gallium/drivers/cell/spu/Makefile +++ b/src/gallium/drivers/cell/spu/Makefile @@ -31,7 +31,11 @@ SPU_OBJECTS = $(SOURCES:.c=.o) \ SPU_ASM_OUT = $(SOURCES:.c=.s) \ -INCLUDE_DIRS = -I$(TOP)/src/mesa +INCLUDE_DIRS = \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/drivers .c.o: diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index e51008b9b3c..109540b1f7b 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -67,8 +67,8 @@ #include "pipe/p_state.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_util.h" #include "spu_exec.h" #include "spu_main.h" #include "spu_vertex_shader.h" diff --git a/src/gallium/drivers/cell/spu/spu_exec.h b/src/gallium/drivers/cell/spu/spu_exec.h index b4c7661ef67..3e17c490d20 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.h +++ b/src/gallium/drivers/cell/spu/spu_exec.h @@ -29,7 +29,7 @@ #define SPU_EXEC_H #include "pipe/p_compiler.h" -#include "pipe/tgsi/exec/tgsi_exec.h" +#include "tgsi/exec/tgsi_exec.h" #if defined __cplusplus extern "C" { diff --git a/src/gallium/drivers/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c index e375197fe60..1e7243b8639 100644 --- a/src/gallium/drivers/cell/spu/spu_main.c +++ b/src/gallium/drivers/cell/spu/spu_main.c @@ -38,7 +38,7 @@ #include "spu_tile.h" //#include "spu_test.h" #include "spu_vertex_shader.h" -#include "pipe/cell/common.h" +#include "cell/common.h" #include "pipe/p_defines.h" diff --git a/src/gallium/drivers/cell/spu/spu_main.h b/src/gallium/drivers/cell/spu/spu_main.h index 1710a175123..5c95d112ac1 100644 --- a/src/gallium/drivers/cell/spu/spu_main.h +++ b/src/gallium/drivers/cell/spu/spu_main.h @@ -31,8 +31,8 @@ #include -#include "pipe/cell/common.h" -#include "pipe/draw/draw_vertex.h" +#include "cell/common.h" +#include "draw/draw_vertex.h" #include "pipe/p_state.h" diff --git a/src/gallium/drivers/cell/spu/spu_render.c b/src/gallium/drivers/cell/spu/spu_render.c index 932fb500b3f..20e77aa2e63 100644 --- a/src/gallium/drivers/cell/spu/spu_render.c +++ b/src/gallium/drivers/cell/spu/spu_render.c @@ -34,7 +34,7 @@ #include "spu_render.h" #include "spu_tri.h" #include "spu_tile.h" -#include "pipe/cell/common.h" +#include "cell/common.h" diff --git a/src/gallium/drivers/cell/spu/spu_render.h b/src/gallium/drivers/cell/spu/spu_render.h index fbcdc5ec316..493434f0878 100644 --- a/src/gallium/drivers/cell/spu/spu_render.h +++ b/src/gallium/drivers/cell/spu/spu_render.h @@ -29,7 +29,7 @@ #ifndef SPU_RENDER_H #define SPU_RENDER_H -#include "pipe/cell/common.h" +#include "cell/common.h" extern void cmd_render(const struct cell_command_render *render, uint *pos_incr); diff --git a/src/gallium/drivers/cell/spu/spu_tile.h b/src/gallium/drivers/cell/spu/spu_tile.h index e53340a55a4..3105b848fdc 100644 --- a/src/gallium/drivers/cell/spu/spu_tile.h +++ b/src/gallium/drivers/cell/spu/spu_tile.h @@ -32,7 +32,7 @@ #include #include #include "spu_main.h" -#include "pipe/cell/common.h" +#include "cell/common.h" diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index ac373240c1f..ea4274a0a7b 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -1,8 +1,8 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" //#include "tgsi_build.h" -#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_util.h" unsigned tgsi_util_get_src_register_swizzle( diff --git a/src/gallium/drivers/cell/spu/spu_vertex_shader.c b/src/gallium/drivers/cell/spu/spu_vertex_shader.c index c1cbbb6d1e9..3f5bf41aa2f 100644 --- a/src/gallium/drivers/cell/spu/spu_vertex_shader.c +++ b/src/gallium/drivers/cell/spu/spu_vertex_shader.c @@ -39,9 +39,9 @@ #include "pipe/p_shader_tokens.h" #include "spu_vertex_shader.h" #include "spu_exec.h" -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_context.h" -#include "pipe/cell/common.h" +#include "draw/draw_private.h" +#include "draw/draw_context.h" +#include "cell/common.h" #include "spu_main.h" static INLINE unsigned diff --git a/src/gallium/drivers/failover/Makefile b/src/gallium/drivers/failover/Makefile index 72d0895c74d..14389bd0551 100644 --- a/src/gallium/drivers/failover/Makefile +++ b/src/gallium/drivers/failover/Makefile @@ -15,7 +15,7 @@ C_SOURCES = \ ASM_SOURCES = -include ../Makefile.template +include ../../Makefile.template symlinks: diff --git a/src/gallium/drivers/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile index 2f91de3afc6..ee22ba86f9b 100644 --- a/src/gallium/drivers/i915simple/Makefile +++ b/src/gallium/drivers/i915simple/Makefile @@ -32,7 +32,7 @@ C_SOURCES = \ ASM_SOURCES = -include ../Makefile.template +include ../../Makefile.template symlinks: diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c index 497623a7006..7f71f8fd4f5 100644 --- a/src/gallium/drivers/i915simple/i915_context.c +++ b/src/gallium/drivers/i915simple/i915_context.c @@ -32,7 +32,7 @@ #include "i915_texture.h" #include "i915_reg.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "pipe/p_defines.h" #include "pipe/p_winsys.h" #include "pipe/p_util.h" diff --git a/src/gallium/drivers/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h index b4ea63c3e74..2d876925b2c 100644 --- a/src/gallium/drivers/i915simple/i915_context.h +++ b/src/gallium/drivers/i915simple/i915_context.h @@ -33,7 +33,7 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_vertex.h" #define I915_TEX_UNITS 8 diff --git a/src/gallium/drivers/i915simple/i915_fpc_translate.c b/src/gallium/drivers/i915simple/i915_fpc_translate.c index 868f0c7e046..6c1524c768e 100644 --- a/src/gallium/drivers/i915simple/i915_fpc_translate.c +++ b/src/gallium/drivers/i915simple/i915_fpc_translate.c @@ -33,9 +33,9 @@ #include "i915_fpc.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_vertex.h" /** diff --git a/src/gallium/drivers/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c index c4a706c37d8..44c43259369 100644 --- a/src/gallium/drivers/i915simple/i915_prim_emit.c +++ b/src/gallium/drivers/i915simple/i915_prim_emit.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "pipe/draw/draw_private.h" +#include "draw/draw_private.h" #include "pipe/p_util.h" #include "i915_context.h" diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c index e069773fd4e..c5bf6174f68 100644 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c @@ -38,7 +38,7 @@ */ -#include "pipe/draw/draw_vbuf.h" +#include "draw/draw_vbuf.h" #include "pipe/p_debug.h" #include "pipe/p_util.h" #include "pipe/p_inlines.h" diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c index abd5571b885..294e6fad035 100644 --- a/src/gallium/drivers/i915simple/i915_state.c +++ b/src/gallium/drivers/i915simple/i915_state.c @@ -29,7 +29,7 @@ */ -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "pipe/p_winsys.h" #include "pipe/p_util.h" diff --git a/src/gallium/drivers/i915simple/i915_state_derived.c b/src/gallium/drivers/i915simple/i915_state_derived.c index 653983e4a99..4767584fc60 100644 --- a/src/gallium/drivers/i915simple/i915_state_derived.c +++ b/src/gallium/drivers/i915simple/i915_state_derived.c @@ -27,8 +27,8 @@ #include "pipe/p_util.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_context.h" +#include "draw/draw_vertex.h" #include "i915_context.h" #include "i915_state.h" #include "i915_reg.h" diff --git a/src/gallium/drivers/i915simple/i915_strings.c b/src/gallium/drivers/i915simple/i915_strings.c index c713bf72086..301fedea197 100644 --- a/src/gallium/drivers/i915simple/i915_strings.c +++ b/src/gallium/drivers/i915simple/i915_strings.c @@ -70,7 +70,7 @@ static const char *i915_get_name( struct pipe_context *pipe ) break; } - sprintf(buffer, "pipe/i915 (chipset: %s)", chipset); + sprintf(buffer, "i915 (chipset: %s)", chipset); return buffer; } diff --git a/src/gallium/drivers/i915simple/i915_surface.c b/src/gallium/drivers/i915simple/i915_surface.c index de0cc5fe06a..17fd27895a2 100644 --- a/src/gallium/drivers/i915simple/i915_surface.c +++ b/src/gallium/drivers/i915simple/i915_surface.c @@ -33,7 +33,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" /* diff --git a/src/gallium/drivers/i965simple/Makefile b/src/gallium/drivers/i965simple/Makefile index 48c00ab50b8..1dec1f97495 100644 --- a/src/gallium/drivers/i965simple/Makefile +++ b/src/gallium/drivers/i965simple/Makefile @@ -61,6 +61,6 @@ ASM_SOURCES = DRIVER_DEFINES = -I. -include ../Makefile.template +include ../../Makefile.template symlinks: diff --git a/src/gallium/drivers/i965simple/brw_shader_info.c b/src/gallium/drivers/i965simple/brw_shader_info.c index 431b45466a6..a762a870fe9 100644 --- a/src/gallium/drivers/i965simple/brw_shader_info.c +++ b/src/gallium/drivers/i965simple/brw_shader_info.c @@ -3,7 +3,7 @@ #include "brw_state.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" diff --git a/src/gallium/drivers/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c index 95dfce88e4a..f746d1cc57c 100644 --- a/src/gallium/drivers/i965simple/brw_state.c +++ b/src/gallium/drivers/i965simple/brw_state.c @@ -33,7 +33,7 @@ #include "pipe/p_winsys.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "tgsi/util/tgsi_dump.h" #include "brw_context.h" #include "brw_defines.h" diff --git a/src/gallium/drivers/i965simple/brw_strings.c b/src/gallium/drivers/i965simple/brw_strings.c index 29a41ed1e9b..3d9c50961fa 100644 --- a/src/gallium/drivers/i965simple/brw_strings.c +++ b/src/gallium/drivers/i965simple/brw_strings.c @@ -59,7 +59,7 @@ static const char *brw_get_name( struct pipe_context *pipe ) break; } - sprintf(buffer, "pipe/i965 (chipset: %s)", chipset); + sprintf(buffer, "i965 (chipset: %s)", chipset); return buffer; } diff --git a/src/gallium/drivers/i965simple/brw_surface.c b/src/gallium/drivers/i965simple/brw_surface.c index 518845e4b2e..376a42b1a6a 100644 --- a/src/gallium/drivers/i965simple/brw_surface.c +++ b/src/gallium/drivers/i965simple/brw_surface.c @@ -32,7 +32,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" /* diff --git a/src/gallium/drivers/i965simple/brw_vs_emit.c b/src/gallium/drivers/i965simple/brw_vs_emit.c index 98915ba1016..05df4860eda 100644 --- a/src/gallium/drivers/i965simple/brw_vs_emit.c +++ b/src/gallium/drivers/i965simple/brw_vs_emit.c @@ -33,7 +33,7 @@ #include "brw_vs.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" struct brw_prog_info { unsigned num_temps; diff --git a/src/gallium/drivers/i965simple/brw_wm_decl.c b/src/gallium/drivers/i965simple/brw_wm_decl.c index b45a333a2e9..97418a52e7f 100644 --- a/src/gallium/drivers/i965simple/brw_wm_decl.c +++ b/src/gallium/drivers/i965simple/brw_wm_decl.c @@ -4,7 +4,7 @@ #include "brw_wm.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" static struct brw_reg alloc_tmp(struct brw_wm_compile *c) { diff --git a/src/gallium/drivers/i965simple/brw_wm_glsl.c b/src/gallium/drivers/i965simple/brw_wm_glsl.c index d95645d1085..44f946ea748 100644 --- a/src/gallium/drivers/i965simple/brw_wm_glsl.c +++ b/src/gallium/drivers/i965simple/brw_wm_glsl.c @@ -4,7 +4,7 @@ #include "brw_wm.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_parse.h" diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 31438a882e6..2304ea4246a 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -44,7 +44,7 @@ C_SOURCES = \ ASM_SOURCES = -include ../Makefile.template +include ../../Makefile.template symlinks: diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index cea6b90104f..5e98f190bbf 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -29,7 +29,7 @@ * Keith Whitwell */ -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_util.h" diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index aff8c2cc5dc..8c79cb3ce4f 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -34,7 +34,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_vertex.h" #include "sp_quad.h" diff --git a/src/gallium/drivers/softpipe/sp_draw_arrays.c b/src/gallium/drivers/softpipe/sp_draw_arrays.c index 71a303a8b58..2049afda34f 100644 --- a/src/gallium/drivers/softpipe/sp_draw_arrays.c +++ b/src/gallium/drivers/softpipe/sp_draw_arrays.c @@ -38,7 +38,7 @@ #include "sp_context.h" #include "sp_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index ced0d5d0983..2cbd0d7cabe 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -31,7 +31,7 @@ #include "pipe/p_defines.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "sp_flush.h" #include "sp_context.h" #include "sp_surface.h" diff --git a/src/gallium/drivers/softpipe/sp_headers.h b/src/gallium/drivers/softpipe/sp_headers.h index 0ae31d87961..9cf82221333 100644 --- a/src/gallium/drivers/softpipe/sp_headers.h +++ b/src/gallium/drivers/softpipe/sp_headers.h @@ -31,7 +31,7 @@ #ifndef SP_HEADERS_H #define SP_HEADERS_H -#include "pipe/tgsi/exec/tgsi_exec.h" +#include "tgsi/exec/tgsi_exec.h" #define PRIM_POINT 1 #define PRIM_LINE 2 diff --git a/src/gallium/drivers/softpipe/sp_prim_setup.c b/src/gallium/drivers/softpipe/sp_prim_setup.c index 27720486615..d73521ccbe5 100644 --- a/src/gallium/drivers/softpipe/sp_prim_setup.c +++ b/src/gallium/drivers/softpipe/sp_prim_setup.c @@ -38,8 +38,8 @@ #include "sp_quad.h" #include "sp_state.h" #include "sp_prim_setup.h" -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_vertex.h" +#include "draw/draw_private.h" +#include "draw/draw_vertex.h" #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 7f71fdb6a9a..69bea8a8f5c 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -39,9 +39,9 @@ #include "sp_context.h" #include "sp_state.h" #include "sp_prim_vbuf.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_vbuf.h" +#include "draw/draw_context.h" +#include "draw/draw_private.h" +#include "draw/draw_vbuf.h" #define SP_MAX_VBUF_INDEXES 1024 diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index 33168584137..b4c01a7ea8c 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -42,7 +42,7 @@ #include "x86/rtasm/x86sse.h" #ifdef MESA_LLVM -#include "pipe/llvm/gallivm.h" +#include "llvm/gallivm.h" #endif #include "sp_context.h" diff --git a/src/gallium/drivers/softpipe/sp_query.c b/src/gallium/drivers/softpipe/sp_query.c index 6a8a43aedaf..adf9ccf64c6 100644 --- a/src/gallium/drivers/softpipe/sp_query.c +++ b/src/gallium/drivers/softpipe/sp_query.c @@ -29,7 +29,7 @@ * Keith Whitwell */ -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_util.h" diff --git a/src/gallium/drivers/softpipe/sp_state_clip.c b/src/gallium/drivers/softpipe/sp_state_clip.c index 08c5f06d05d..c797c0dd3b1 100644 --- a/src/gallium/drivers/softpipe/sp_state_clip.c +++ b/src/gallium/drivers/softpipe/sp_state_clip.c @@ -29,7 +29,7 @@ */ #include "sp_context.h" #include "sp_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" void softpipe_set_clip_state( struct pipe_context *pipe, diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 372597869f3..9d8fd8b750f 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -27,9 +27,9 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_vertex.h" -#include "pipe/draw/draw_private.h" +#include "draw/draw_context.h" +#include "draw/draw_vertex.h" +#include "draw/draw_private.h" #include "sp_context.h" #include "sp_state.h" diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 0b814fc2847..1e3cadd43d1 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -32,11 +32,11 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "pipe/p_shader_tokens.h" -#include "pipe/llvm/gallivm.h" -#include "pipe/tgsi/util/tgsi_dump.h" -#include "pipe/tgsi/exec/tgsi_sse2.h" +#include "llvm/gallivm.h" +#include "tgsi/util/tgsi_dump.h" +#include "tgsi/exec/tgsi_sse2.h" void * diff --git a/src/gallium/drivers/softpipe/sp_state_rasterizer.c b/src/gallium/drivers/softpipe/sp_state_rasterizer.c index 53755099dde..98e04352dbc 100644 --- a/src/gallium/drivers/softpipe/sp_state_rasterizer.c +++ b/src/gallium/drivers/softpipe/sp_state_rasterizer.c @@ -29,7 +29,7 @@ #include "pipe/p_util.h" #include "sp_context.h" #include "sp_state.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index ea348c7e958..460adccec4f 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -31,14 +31,14 @@ #include "pipe/p_util.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" #include "sp_context.h" #include "sp_context.h" #include "sp_state.h" #include "sp_texture.h" #include "sp_tile_cache.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" diff --git a/src/gallium/drivers/softpipe/sp_state_vertex.c b/src/gallium/drivers/softpipe/sp_state_vertex.c index 09ff540ccfd..f01a10de3b4 100644 --- a/src/gallium/drivers/softpipe/sp_state_vertex.c +++ b/src/gallium/drivers/softpipe/sp_state_vertex.c @@ -33,7 +33,7 @@ #include "sp_state.h" #include "sp_surface.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_context.h" void diff --git a/src/gallium/drivers/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c index 8802ced1874..653449c4f18 100644 --- a/src/gallium/drivers/softpipe/sp_surface.c +++ b/src/gallium/drivers/softpipe/sp_surface.c @@ -29,7 +29,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #include "sp_context.h" #include "sp_surface.h" diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 325bdb86da5..2f82fd6abea 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -40,7 +40,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_util.h" -#include "pipe/tgsi/exec/tgsi_exec.h" +#include "tgsi/exec/tgsi_exec.h" /* diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 1597361b82f..dde3fabc81e 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -34,7 +34,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #include "sp_context.h" #include "sp_surface.h" #include "sp_tile_cache.h" diff --git a/src/gallium/winsys/dri/Makefile b/src/gallium/winsys/dri/Makefile new file mode 100644 index 00000000000..f466ce6c3cc --- /dev/null +++ b/src/gallium/winsys/dri/Makefile @@ -0,0 +1,38 @@ +# src/mesa/drivers/dri/Makefile + +TOP = ../../../.. + +include $(TOP)/configs/current + + + +default: $(TOP)/$(LIB_DIR) subdirs + + +$(TOP)/$(LIB_DIR): + -mkdir $(TOP)/$(LIB_DIR) + + +subdirs: + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + + +install: + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + + +clean: + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done + -rm -f common/*.o diff --git a/src/gallium/winsys/dri/Makefile.template b/src/gallium/winsys/dri/Makefile.template new file mode 100644 index 00000000000..b96305c0940 --- /dev/null +++ b/src/gallium/winsys/dri/Makefile.template @@ -0,0 +1,113 @@ +# -*-makefile-*- + +MESA_MODULES = $(TOP)/src/mesa/libmesa.a + +COMMON_GALLIUM_SOURCES = \ + $(TOP)/src/mesa/drivers/dri/common/utils.c \ + $(TOP)/src/mesa/drivers/dri/common/vblank.c \ + $(TOP)/src/mesa/drivers/dri/common/dri_util.c \ + $(TOP)/src/mesa/drivers/dri/common/xmlconfig.c + +COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ + $(TOP)/src/mesa/drivers/common/driverfuncs.c \ + $(TOP)/src/mesa/drivers/dri/common/texmem.c \ + $(TOP)/src/mesa/drivers/dri/common/drirenderbuffer.c + +COMMON_BM_SOURCES = \ + $(TOP)/src/mesa/drivers/dri/common/dri_bufmgr.c \ + $(TOP)/src/mesa/drivers/dri/common/dri_drmpool.c + + +ifeq ($(WINDOW_SYSTEM),dri) +WINOBJ= +WINLIB= +INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) + +else +# miniglx +WINOBJ= +WINLIB=-L$(MESA)/src/glx/mini +MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini +INCLUDES = $(MINIGLX_INCLUDES) \ + $(SHARED_INCLUDES) \ + $(PCIACCESS_CFLAGS) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(MINIGLX_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) +endif + + +### Include directories +SHARED_INCLUDES = \ + -I. \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -Iserver \ + -I$(TOP)/include \ + -I$(TOP)/include/GL/internal \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/mesa/glapi \ + -I$(TOP)/src/mesa/math \ + -I$(TOP)/src/mesa/transform \ + -I$(TOP)/src/mesa/shader \ + -I$(TOP)/src/mesa/swrast \ + -I$(TOP)/src/mesa/swrast_setup \ + -I$(TOP)/src/egl/main \ + -I$(TOP)/src/egl/drivers/dri \ + $(LIBDRM_CFLAGS) + + +##### RULES ##### + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + + +##### TARGETS ##### + +default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) + + +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template + $(TOP)/bin/mklib -noprefix -o $@ \ + $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + + +$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) + $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) + + +depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) + rm -f depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ + $(ASM_SOURCES) 2> /dev/null + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find ../include` + + +# Remove .o and backup files +clean: + -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS) + -rm -f depend depend.bak + + +install: $(LIBNAME) + $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR) + $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR) + + +include depend diff --git a/src/gallium/winsys/dri/intel/Makefile b/src/gallium/winsys/dri/intel/Makefile index 9ae0f013256..40654bb2ac3 100644 --- a/src/gallium/winsys/dri/intel/Makefile +++ b/src/gallium/winsys/dri/intel/Makefile @@ -7,8 +7,8 @@ LIBNAME = i915tex_dri.so MINIGLX_SOURCES = server/intel_dri.c PIPE_DRIVERS = \ - $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a \ - $(TOP)/src/mesa/pipe/i915simple/libi915simple.a + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/i915simple/libi915simple.a DRIVER_SOURCES = \ intel_winsys_pipe.c \ @@ -28,11 +28,11 @@ C_SOURCES = \ ASM_SOURCES = -DRIVER_DEFINES = -I../intel $(shell pkg-config libdrm --atleast-version=2.3.1 \ +DRIVER_DEFINES = -I$(TOP)/src/mesa/drivers/dri/intel $(shell pkg-config libdrm --atleast-version=2.3.1 \ && echo "-DDRM_VBLANK_FLIP=DRM_VBLANK_FLIP") include ../Makefile.template -intel_tex_layout.o: ../intel/intel_tex_layout.c +intel_tex_layout.o: $(TOP)/src/mesa/drivers/dri/intel/intel_tex_layout.c symlinks: diff --git a/src/gallium/winsys/dri/intel/intel_winsys_i915.c b/src/gallium/winsys/dri/intel/intel_winsys_i915.c index 1ba6a9e1b25..0ed3890e936 100644 --- a/src/gallium/winsys/dri/intel/intel_winsys_i915.c +++ b/src/gallium/winsys/dri/intel/intel_winsys_i915.c @@ -39,7 +39,7 @@ #include "intel_winsys.h" #include "pipe/p_util.h" -#include "pipe/i915simple/i915_winsys.h" +#include "i915simple/i915_winsys.h" struct intel_i915_winsys { diff --git a/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c b/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c index cec3437831c..9e483bdc9f5 100644 --- a/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c +++ b/src/gallium/winsys/dri/intel/intel_winsys_softpipe.c @@ -34,7 +34,7 @@ #include "pipe/p_defines.h" #include "pipe/p_util.h" #include "pipe/p_format.h" -#include "pipe/softpipe/sp_winsys.h" +#include "softpipe/sp_winsys.h" struct intel_softpipe_winsys { diff --git a/src/gallium/winsys/xlib/xm_winsys.c b/src/gallium/winsys/xlib/xm_winsys.c index c3cd22eea3f..8da596d419e 100644 --- a/src/gallium/winsys/xlib/xm_winsys.c +++ b/src/gallium/winsys/xlib/xm_winsys.c @@ -41,11 +41,11 @@ #include "pipe/p_context.h" #include "pipe/p_util.h" #include "pipe/p_inlines.h" -#include "pipe/softpipe/sp_winsys.h" +#include "softpipe/sp_winsys.h" #ifdef GALLIUM_CELL -#include "pipe/cell/ppu/cell_context.h" -#include "pipe/cell/ppu/cell_winsys.h" +#include "cell/ppu/cell_context.h" +#include "cell/ppu/cell_winsys.h" #else #define TILE_SIZE 32 /* avoid compilation errors */ #endif diff --git a/src/gallium/winsys/xlib/xm_winsys_aub.c b/src/gallium/winsys/xlib/xm_winsys_aub.c index bf415702570..dbfd37bda29 100644 --- a/src/gallium/winsys/xlib/xm_winsys_aub.c +++ b/src/gallium/winsys/xlib/xm_winsys_aub.c @@ -39,7 +39,7 @@ #include "pipe/p_winsys.h" #include "pipe/p_util.h" #include "pipe/p_inlines.h" -#include "pipe/i965simple/brw_winsys.h" +#include "i965simple/brw_winsys.h" #include "brw_aub.h" #include "xm_winsys_aub.h" diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 720f1b2e026..561608fedd6 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -12,16 +12,16 @@ GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) PIPE_LIB = \ - $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a \ - $(TOP)/src/mesa/pipe/i965simple/libi965simple.a + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/drivers/i965simple/libi965simple.a ifeq ($(CONFIG_NAME), linux-cell) -CELL_LIB = $(TOP)/src/mesa/pipe/cell/ppu/libcell.a -CELL_LIB_SPU = $(TOP)/src/mesa/pipe/cell/spu/g3d_spu.a +CELL_LIB = $(TOP)/src/gallium/drivers/cell/ppu/libcell.a +CELL_LIB_SPU = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a endif ifeq ($(CONFIG_NAME), linux-llvm) -LLVM_LIB = $(TOP)/src/mesa/pipe/llvm/libgallivm.a +LLVM_LIB = $(TOP)/src/gallium/aux/llvm/libgallivm.a endif .SUFFIXES : .cpp @@ -71,7 +71,7 @@ libmesa.a: $(SOLO_OBJECTS) fi linux-solo: depend subdirs libmesa.a - cd drivers/dri ; $(MAKE) + cd $(TOP)/src/gallium/winsys/dri ; $(MAKE) ##################################################################### @@ -165,7 +165,6 @@ depend: $(ALL_SOURCES) subdirs: @ (cd x86 ; $(MAKE)) @ (cd x86-64 ; $(MAKE)) - (cd pipe ; $(MAKE)) install: default $(INSTALL) -d $(INSTALL_DIR)/include/GL @@ -178,7 +177,7 @@ install: default $(INSTALL) $(TOP)/$(LIB_DIR)/libOSMesa* $(INSTALL_DIR)/$(LIB_DIR); \ fi @if [ "${DRIVER_DIRS}" = "dri" ] ; then \ - cd drivers/dri ; $(MAKE) install ; \ + cd $(TOP)/gallium/winsys/dri ; $(MAKE) install ; \ fi ## NOT INSTALLED YET: @@ -198,7 +197,6 @@ clean: (cd drivers/dri && $(MAKE) clean) (cd x86 && $(MAKE) clean) (cd x86-64 && $(MAKE) clean) - (cd pipe ; $(MAKE) clean ) include depend diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 08c98eab486..18b033666f0 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -85,7 +85,7 @@ #include "state_tracker/st_public.h" #include "state_tracker/st_context.h" -#include "pipe/softpipe/sp_context.h" +#include "softpipe/sp_context.h" #include "pipe/p_defines.h" /** diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 8ae243ae662..34287effe1c 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -53,7 +53,7 @@ #include "tnl/tnl.h" #include "tnl/t_context.h" -#include "pipe/softpipe/sp_context.h" +#include "softpipe/sp_context.h" #include "state_tracker/st_public.h" #include "state_tracker/st_context.h" #include "state_tracker/st_draw.h" diff --git a/src/mesa/drivers/x11/xm_surface.c b/src/mesa/drivers/x11/xm_surface.c index 5533158ece0..81616b92d96 100644 --- a/src/mesa/drivers/x11/xm_surface.c +++ b/src/mesa/drivers/x11/xm_surface.c @@ -45,10 +45,10 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_winsys.h" -#include "pipe/softpipe/sp_context.h" -#include "pipe/softpipe/sp_clear.h" -#include "pipe/softpipe/sp_tile_cache.h" -#include "pipe/softpipe/sp_surface.h" +#include "softpipe/sp_context.h" +#include "softpipe/sp_clear.h" +#include "softpipe/sp_tile_cache.h" +#include "softpipe/sp_surface.h" #include "state_tracker/st_context.h" diff --git a/src/mesa/drivers/x11/xm_winsys.c b/src/mesa/drivers/x11/xm_winsys.c index a690df27727..2edc6976933 100644 --- a/src/mesa/drivers/x11/xm_winsys.c +++ b/src/mesa/drivers/x11/xm_winsys.c @@ -38,7 +38,7 @@ #include "main/macros.h" #include "pipe/p_winsys.h" -#include "pipe/softpipe/sp_winsys.h" +#include "softpipe/sp_winsys.h" /** diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 4709d633942..fd2dfcd79aa 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -37,8 +37,8 @@ #include "xm_image.h" #endif #include "state_tracker/st_cb_fbo.h" -#include "pipe/softpipe/sp_context.h" -#include "pipe/softpipe/sp_surface.h" +#include "softpipe/sp_context.h" +#include "softpipe/sp_surface.h" extern _glthread_Mutex _xmesa_lock; diff --git a/src/mesa/sources b/src/mesa/sources index 1165425183a..2d07738210d 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -158,45 +158,45 @@ VF_SOURCES = \ DRAW_SOURCES = \ - pipe/draw/draw_clip.c \ - pipe/draw/draw_context.c\ - pipe/draw/draw_cull.c \ - pipe/draw/draw_debug.c \ - pipe/draw/draw_flatshade.c \ - pipe/draw/draw_offset.c \ - pipe/draw/draw_prim.c \ - pipe/draw/draw_stipple.c \ - pipe/draw/draw_twoside.c \ - pipe/draw/draw_unfilled.c \ - pipe/draw/draw_validate.c \ - pipe/draw/draw_vbuf.c \ - pipe/draw/draw_vertex.c \ - pipe/draw/draw_vertex_cache.c \ - pipe/draw/draw_vertex_fetch.c \ - pipe/draw/draw_vertex_shader.c \ - pipe/draw/draw_vf.c \ - pipe/draw/draw_vf_generic.c \ - pipe/draw/draw_vf_sse.c \ - pipe/draw/draw_wide_prims.c + $(TOP)/src/gallium/aux/draw/draw_clip.c \ + $(TOP)/src/gallium/aux/draw/draw_context.c\ + $(TOP)/src/gallium/aux/draw/draw_cull.c \ + $(TOP)/src/gallium/aux/draw/draw_debug.c \ + $(TOP)/src/gallium/aux/draw/draw_flatshade.c \ + $(TOP)/src/gallium/aux/draw/draw_offset.c \ + $(TOP)/src/gallium/aux/draw/draw_prim.c \ + $(TOP)/src/gallium/aux/draw/draw_stipple.c \ + $(TOP)/src/gallium/aux/draw/draw_twoside.c \ + $(TOP)/src/gallium/aux/draw/draw_unfilled.c \ + $(TOP)/src/gallium/aux/draw/draw_validate.c \ + $(TOP)/src/gallium/aux/draw/draw_vbuf.c \ + $(TOP)/src/gallium/aux/draw/draw_vertex.c \ + $(TOP)/src/gallium/aux/draw/draw_vertex_cache.c \ + $(TOP)/src/gallium/aux/draw/draw_vertex_fetch.c \ + $(TOP)/src/gallium/aux/draw/draw_vertex_shader.c \ + $(TOP)/src/gallium/aux/draw/draw_vf.c \ + $(TOP)/src/gallium/aux/draw/draw_vf_generic.c \ + $(TOP)/src/gallium/aux/draw/draw_vf_sse.c \ + $(TOP)/src/gallium/aux/draw/draw_wide_prims.c TGSIEXEC_SOURCES = \ - pipe/tgsi/exec/tgsi_exec.c \ - pipe/tgsi/exec/tgsi_sse2.c + $(TOP)/src/gallium/aux/tgsi/exec/tgsi_exec.c \ + $(TOP)/src/gallium/aux/tgsi/exec/tgsi_sse2.c TGSIUTIL_SOURCES = \ - pipe/tgsi/util/tgsi_build.c \ - pipe/tgsi/util/tgsi_dump.c \ - pipe/tgsi/util/tgsi_parse.c \ - pipe/tgsi/util/tgsi_util.c + $(TOP)/src/gallium/aux/tgsi/util/tgsi_build.c \ + $(TOP)/src/gallium/aux/tgsi/util/tgsi_dump.c \ + $(TOP)/src/gallium/aux/tgsi/util/tgsi_parse.c \ + $(TOP)/src/gallium/aux/tgsi/util/tgsi_util.c STATECACHE_SOURCES = \ - pipe/cso_cache/cso_hash.c \ - pipe/cso_cache/cso_cache.c + $(TOP)/src/gallium/aux/cso_cache/cso_hash.c \ + $(TOP)/src/gallium/aux/cso_cache/cso_cache.c PIPEUTIL_SOURCES = \ - pipe/util/p_debug.c \ - pipe/util/p_tile.c \ - pipe/util/p_util.c + $(TOP)/src/gallium/aux/util/p_debug.c \ + $(TOP)/src/gallium/aux/util/p_tile.c \ + $(TOP)/src/gallium/aux/util/p_util.c STATETRACKER_SOURCES = \ state_tracker/st_atom.c \ @@ -331,13 +331,13 @@ __COMMON_DRIVER_SOURCES = \ drivers/common/driverfuncs.c X11_DRIVER_SOURCES = \ - pipe/xlib/glxapi.c \ - pipe/xlib/fakeglx.c \ - pipe/xlib/xfonts.c \ - pipe/xlib/xm_api.c \ - pipe/xlib/xm_winsys.c \ - pipe/xlib/xm_winsys_aub.c \ - pipe/xlib/brw_aub.c + $(TOP)/src/gallium/winsys/xlib/glxapi.c \ + $(TOP)/src/gallium/winsys/xlib/fakeglx.c \ + $(TOP)/src/gallium/winsys/xlib/xfonts.c \ + $(TOP)/src/gallium/winsys/xlib/xm_api.c \ + $(TOP)/src/gallium/winsys/xlib/xm_winsys.c \ + $(TOP)/src/gallium/winsys/xlib/xm_winsys_aub.c \ + $(TOP)/src/gallium/winsys/xlib/brw_aub.c OSMESA_DRIVER_SOURCES = \ drivers/osmesa/osmesa.c @@ -425,7 +425,10 @@ FBDEV_DRIVER_OBJECTS = $(FBDEV_DRIVER_SOURCES:.c=.o) INCLUDE_DIRS = \ -I$(TOP)/include \ -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main + -I$(TOP)/src/mesa/main \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/aux OLD_INCLUDE_DIRS = \ -I$(TOP)/src/mesa/tnl \ @@ -435,4 +438,4 @@ OLD_INCLUDE_DIRS = \ -I$(TOP)/src/mesa/shader \ -I$(TOP)/src/mesa/shader/grammar \ -I$(TOP)/src/mesa/shader/slang \ - -I$(TOP)/src/mesa/pipe/tgsi + -I$(TOP)/s$(TOP)/src/gallium/aux/tgsi diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index 2c6ec8421b0..b67b620eaa5 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -43,7 +43,7 @@ #include "pipe/p_context.h" #include "pipe/p_shader_tokens.h" -#include "pipe/cso_cache/cso_cache.h" +#include "cso_cache/cso_cache.h" #include "st_context.h" #include "st_cache.h" diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c index e0965b217ab..2979e7fae54 100644 --- a/src/mesa/state_tracker/st_cache.c +++ b/src/mesa/state_tracker/st_cache.c @@ -36,8 +36,8 @@ #include "pipe/p_state.h" -#include "pipe/cso_cache/cso_cache.h" -#include "pipe/cso_cache/cso_hash.h" +#include "cso_cache/cso_cache.h" +#include "cso_cache/cso_hash.h" /* Those function will either find the state of the given template diff --git a/src/mesa/state_tracker/st_cache.h b/src/mesa/state_tracker/st_cache.h index e0c176b0ffc..b81de316ec9 100644 --- a/src/mesa/state_tracker/st_cache.h +++ b/src/mesa/state_tracker/st_cache.h @@ -33,7 +33,7 @@ #ifndef ST_CACHE_H #define ST_CACHE_H -#include "pipe/cso_cache/cso_cache.h" +#include "cso_cache/cso_cache.h" struct pipe_blend_state; struct pipe_sampler_state; diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 3a3bf9016dd..663c4f205d8 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -43,7 +43,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #define UNCLAMPED_FLOAT_TO_SHORT(us, f) \ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index f13199a3c0f..e2d4e06da19 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -56,7 +56,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #include "shader/prog_instruction.h" diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 31744151f1d..5315294c07b 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -53,10 +53,10 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_winsys.h" -#include "pipe/cso_cache/cso_cache.h" +#include "cso_cache/cso_cache.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" +#include "draw/draw_context.h" +#include "draw/draw_private.h" /** diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index af3ee655048..61d4f4c41c6 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -39,8 +39,8 @@ #include "shader/programopt.h" #include "shader/shader_api.h" -#include "pipe/cso_cache/cso_cache.h" -#include "pipe/draw/draw_context.h" +#include "cso_cache/cso_cache.h" +#include "draw/draw_context.h" #include "st_context.h" #include "st_program.h" diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 7e347c48938..5b0eb6022be 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -44,8 +44,8 @@ #include "st_draw.h" #include "st_cb_rasterpos.h" #include "st_draw.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" +#include "draw/draw_context.h" +#include "draw/draw_private.h" #include "shader/prog_instruction.h" #include "vbo/vbo.h" diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 868c5f3c5f9..c89c74229e5 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -40,7 +40,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #include "st_context.h" #include "st_cb_readpixels.h" #include "st_cb_fbo.h" diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 91a40288cc7..03dbb30b0fe 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -47,7 +47,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" -#include "pipe/util/p_tile.h" +#include "util/p_tile.h" #define DBG if (0) printf diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index bf4618bed8e..09e389f9dc7 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -54,8 +54,8 @@ #include "pipe/p_context.h" #include "pipe/p_winsys.h" #include "pipe/p_inlines.h" -#include "pipe/draw/draw_context.h" -#include "pipe/cso_cache/cso_cache.h" +#include "draw/draw_context.h" +#include "cso_cache/cso_cache.h" /** diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index 57450e52bf4..5888bcb98a3 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -31,9 +31,9 @@ #include "pipe/p_state.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "tgsi/util/tgsi_dump.h" -#include "pipe/cso_cache/cso_cache.h" +#include "cso_cache/cso_cache.h" #include "st_context.h" #include "st_debug.h" diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index ae9f5c8b117..1c0fa8c6aad 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -47,8 +47,8 @@ #include "pipe/p_winsys.h" #include "pipe/p_inlines.h" -#include "pipe/draw/draw_private.h" -#include "pipe/draw/draw_context.h" +#include "draw/draw_private.h" +#include "draw/draw_context.h" static GLuint double_types[4] = { diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 459941cca87..6c09b86033b 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -37,7 +37,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/cso_cache/cso_cache.h" +#include "cso_cache/cso_cache.h" #include "st_context.h" #include "st_draw.h" diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 325aa201734..97206752af3 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -32,9 +32,9 @@ #include "pipe/p_compiler.h" #include "pipe/p_shader_tokens.h" -#include "pipe/tgsi/util/tgsi_parse.h" -#include "pipe/tgsi/util/tgsi_build.h" -#include "pipe/tgsi/util/tgsi_util.h" +#include "tgsi/util/tgsi_parse.h" +#include "tgsi/util/tgsi_build.h" +#include "tgsi/util/tgsi_util.h" #include "st_mesa_to_tgsi.h" #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index c8297badedd..dc992ee9c24 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -38,8 +38,8 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" -#include "pipe/draw/draw_context.h" -#include "pipe/tgsi/util/tgsi_dump.h" +#include "draw/draw_context.h" +#include "tgsi/util/tgsi_dump.h" #include "st_context.h" #include "st_cache.h" From 6d3831b11d9f5aaba61cc2fb8ade61437ad7c335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Feb 2008 17:52:14 +0900 Subject: [PATCH 60/74] Code reorganization: placeholder for state-trackers. This is meant for temporarily holding state-trackers, until they eventually find their way out of gallium tree. --- src/gallium/state_trackers/README | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/gallium/state_trackers/README diff --git a/src/gallium/state_trackers/README b/src/gallium/state_trackers/README new file mode 100644 index 00000000000..28dd27bbd50 --- /dev/null +++ b/src/gallium/state_trackers/README @@ -0,0 +1,2 @@ +This directory is a placeholder for incubating state-trackers. Mesa's +state-tracker is in src/mesa. From fa9c160389ffc6d7a20773b77c937193f30339d8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Feb 2008 08:56:04 +0000 Subject: [PATCH 61/74] tgsi: disable dummy sse2 texture code --- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 1d9e9a14ce0..6df7588c925 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -1935,13 +1935,20 @@ emit_instruction( break; case TGSI_OPCODE_TEX: - emit_tempf( - func, - 0, - TGSI_EXEC_TEMP_ONE_I, - TGSI_EXEC_TEMP_ONE_C ); - FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { - STORE( func, *inst, 0, 0, chan_index ); + if (0) { + /* Disable dummy texture code: + */ + emit_tempf( + func, + 0, + TGSI_EXEC_TEMP_ONE_I, + TGSI_EXEC_TEMP_ONE_C ); + FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { + STORE( func, *inst, 0, 0, chan_index ); + } + } + else { + return 0; } break; From c04a7f8929d674971a472ffa4d3a31200c22aa5a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Feb 2008 09:31:22 +0000 Subject: [PATCH 62/74] gallium: reorganize fragment shader execution, unbreak sse This is probably going to get further reworked in the near future. Right now there's a new interface wrapped around each shader execution mode - exec, sse2, llvm. The llvm code was disabled already and has just been moved as-is to a new file, whereas the sse2 and exec code is actually enabled. The way the interfaces has turned out suggests to me that the correct approach is to actually have each shader include a pointer to a quad stage which will do a better job of encapsulating the execution environment than what I have here -- that's a second step however. --- src/mesa/pipe/draw/draw_vertex_shader.c | 10 +- src/mesa/pipe/softpipe/Makefile | 3 + src/mesa/pipe/softpipe/sp_context.h | 8 +- src/mesa/pipe/softpipe/sp_fs_exec.c | 112 +++++++++++++ src/mesa/pipe/softpipe/sp_fs_llvm.c | 200 ++++++++++++++++++++++++ src/mesa/pipe/softpipe/sp_fs_sse.c | 192 +++++++++++++++++++++++ src/mesa/pipe/softpipe/sp_quad_fs.c | 200 ++---------------------- src/mesa/pipe/softpipe/sp_state.h | 39 +++-- src/mesa/pipe/softpipe/sp_state_fs.c | 69 +++----- src/mesa/pipe/tgsi/exec/tgsi_exec.c | 71 ++++----- src/mesa/pipe/tgsi/exec/tgsi_exec.h | 8 +- src/mesa/pipe/tgsi/exec/tgsi_sse2.c | 10 +- 12 files changed, 614 insertions(+), 308 deletions(-) create mode 100644 src/mesa/pipe/softpipe/sp_fs_exec.c create mode 100644 src/mesa/pipe/softpipe/sp_fs_llvm.c create mode 100644 src/mesa/pipe/softpipe/sp_fs_sse.c diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index c824c1407e9..bf340ef9b08 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -305,11 +305,13 @@ draw_bind_vertex_shader(struct draw_context *draw, draw->vertex_shader = dvs; draw->num_vs_outputs = dvs->state->num_outputs; + tgsi_exec_machine_init(&draw->machine); + /* specify the vertex program to interpret/execute */ - tgsi_exec_machine_init(&draw->machine, - draw->vertex_shader->state->tokens, - PIPE_MAX_SAMPLERS, - NULL /*samplers*/ ); + tgsi_exec_machine_bind_shader(&draw->machine, + draw->vertex_shader->state->tokens, + PIPE_MAX_SAMPLERS, + NULL /*samplers*/ ); } diff --git a/src/mesa/pipe/softpipe/Makefile b/src/mesa/pipe/softpipe/Makefile index 31438a882e6..304632abb28 100644 --- a/src/mesa/pipe/softpipe/Makefile +++ b/src/mesa/pipe/softpipe/Makefile @@ -5,6 +5,9 @@ include $(TOP)/configs/current LIBNAME = softpipe DRIVER_SOURCES = \ + sp_fs_exec.c \ + sp_fs_sse.c \ + sp_fs_llvm.c \ sp_clear.c \ sp_flush.c \ sp_query.c \ diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h index aff8c2cc5dc..5e24baf9386 100644 --- a/src/mesa/pipe/softpipe/sp_context.h +++ b/src/mesa/pipe/softpipe/sp_context.h @@ -44,8 +44,8 @@ struct softpipe_vbuf_render; struct draw_context; struct draw_stage; struct softpipe_tile_cache; -struct sp_fragment_shader_state; -struct sp_vertex_shader_state; +struct sp_fragment_shader; +struct sp_vertex_shader; struct softpipe_context { @@ -59,8 +59,8 @@ struct softpipe_context { const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; const struct pipe_depth_stencil_alpha_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; - const struct sp_fragment_shader_state *fs; - const struct sp_vertex_shader_state *vs; + const struct sp_fragment_shader *fs; + const struct sp_vertex_shader *vs; struct pipe_blend_color blend_color; struct pipe_clip_state clip; diff --git a/src/mesa/pipe/softpipe/sp_fs_exec.c b/src/mesa/pipe/softpipe/sp_fs_exec.c new file mode 100644 index 00000000000..b949492e090 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_fs_exec.c @@ -0,0 +1,112 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "sp_context.h" +#include "sp_state.h" +#include "sp_fs.h" +#include "sp_headers.h" + + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_util.h" +#include "pipe/p_inlines.h" +#include "pipe/tgsi/exec/tgsi_exec.h" + +struct sp_exec_fragment_shader { + struct sp_fragment_shader base; +}; + + + + +static void +exec_prepare( struct sp_fragment_shader *base, + struct tgsi_exec_machine *machine, + struct tgsi_sampler *samplers ) +{ + tgsi_exec_machine_bind_shader( machine, + base->shader.tokens, + PIPE_MAX_SAMPLERS, + samplers ); +} + + + + +/* TODO: hide the machine struct in here somewhere, remove from this + * interface: + */ +static unsigned +exec_run( struct sp_fragment_shader *base, + struct tgsi_exec_machine *machine, + struct quad_header *quad ) +{ + + /* Compute X, Y, Z, W vals for this quad */ + sp_setup_pos_vector(quad->posCoef, + (float)quad->x0, (float)quad->y0, + &machine->QuadPos); + + return tgsi_exec_machine_run( machine ); +} + + + +static void +exec_delete( struct sp_fragment_shader *base ) +{ + FREE(base); +} + + + + + +struct sp_fragment_shader * +softpipe_create_fs_exec(struct softpipe_context *softpipe, + const struct pipe_shader_state *templ) +{ + struct sp_exec_fragment_shader *shader; + + /* Decide whether we'll be codegenerating this shader and if so do + * that now. + */ + + shader = CALLOC_STRUCT(sp_exec_fragment_shader); + if (!shader) + return NULL; + + shader->base.shader = *templ; + shader->base.prepare = exec_prepare; + shader->base.run = exec_run; + shader->base.delete = exec_delete; + + return &shader->base; +} + diff --git a/src/mesa/pipe/softpipe/sp_fs_llvm.c b/src/mesa/pipe/softpipe/sp_fs_llvm.c new file mode 100644 index 00000000000..9237c1fbda0 --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_fs_llvm.c @@ -0,0 +1,200 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/* Authors: + * Zack Rusin + */ + +#include "sp_context.h" +#include "sp_state.h" +#include "sp_fs.h" + + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_util.h" +#include "pipe/p_inlines.h" +#include "pipe/tgsi/exec/tgsi_sse2.h" + +#if 0 + +struct sp_llvm_fragment_shader { + struct sp_fragment_shader base; + struct gallivm_prog *llvm_prog; +}; + +static void +shade_quad_llvm(struct quad_stage *qs, + struct quad_header *quad) +{ + struct quad_shade_stage *qss = quad_shade_stage(qs); + struct softpipe_context *softpipe = qs->softpipe; + float dests[4][16][4] ALIGN16_ATTRIB; + float inputs[4][16][4] ALIGN16_ATTRIB; + const float fx = (float) quad->x0; + const float fy = (float) quad->y0; + struct gallivm_prog *llvm = qss->llvm_prog; + + inputs[0][0][0] = fx; + inputs[1][0][0] = fx + 1.0f; + inputs[2][0][0] = fx; + inputs[3][0][0] = fx + 1.0f; + + inputs[0][0][1] = fy; + inputs[1][0][1] = fy; + inputs[2][0][1] = fy + 1.0f; + inputs[3][0][1] = fy + 1.0f; + + + gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef); + +#if DLLVM + debug_printf("MASK = %d\n", quad->mask); + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 2; ++j) { + debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j, + inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]); + } + } +#endif + + quad->mask &= + gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs, + softpipe->mapped_constants[PIPE_SHADER_FRAGMENT], + qss->samplers); +#if DLLVM + debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n", + dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3], + dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]); +#endif + + /* store result color */ + if (qss->colorOutSlot >= 0) { + unsigned i; + /* XXX need to handle multiple color outputs someday */ + allvmrt(qss->stage.softpipe->fs->shader.output_semantic_name[qss->colorOutSlot] + == TGSI_SEMANTIC_COLOR); + for (i = 0; i < QUAD_SIZE; ++i) { + quad->outputs.color[0][i] = dests[i][qss->colorOutSlot][0]; + quad->outputs.color[1][i] = dests[i][qss->colorOutSlot][1]; + quad->outputs.color[2][i] = dests[i][qss->colorOutSlot][2]; + quad->outputs.color[3][i] = dests[i][qss->colorOutSlot][3]; + } + } +#if DLLVM + for (int i = 0; i < QUAD_SIZE; ++i) { + debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot, + quad->outputs.color[0][i], + quad->outputs.color[1][i], + quad->outputs.color[2][i], + quad->outputs.color[3][i]); + } +#endif + + /* store result Z */ + if (qss->depthOutSlot >= 0) { + /* output[slot] is new Z */ + uint i; + for (i = 0; i < 4; i++) { + quad->outputs.depth[i] = dests[i][0][2]; + } + } + else { + /* copy input Z (which was interpolated by the executor) to output Z */ + uint i; + for (i = 0; i < 4; i++) { + quad->outputs.depth[i] = inputs[i][0][2]; + } + } +#if DLLVM + debug_printf("D [%f, %f, %f, %f] mask = %d\n", + quad->outputs.depth[0], + quad->outputs.depth[1], + quad->outputs.depth[2], + quad->outputs.depth[3], quad->mask); +#endif + + /* shader may cull fragments */ + if( quad->mask ) { + qs->next->run( qs->next, quad ); + } +} + + +unsigned +run_llvm_fs( struct sp_fragment_shader *base, + struct foo *machine ) +{ +} + + +void +delete_llvm_fs( struct sp_fragment_shader *base ) +{ + FREE(base); +} + + +struct sp_fragment_shader * +softpipe_create_fs_llvm(struct softpipe_context *softpipe, + const struct pipe_shader_state *templ) +{ + struct sp_llvm_fragment_shader *shader = NULL; + + /* LLVM fragment shaders currently disabled: + */ + state = CALLOC_STRUCT(sp_llvm_shader_state); + if (!state) + return NULL; + + state->llvm_prog = 0; + + if (!gallivm_global_cpu_engine()) { + gallivm_cpu_engine_create(state->llvm_prog); + } + else + gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog); + + if (shader) { + shader->base.run = run_llvm_fs; + shader->base.delete = delete_llvm_fs; + } + + return shader; +} + + +#else + +struct sp_fragment_shader * +softpipe_create_fs_llvm(struct softpipe_context *softpipe, + const struct pipe_shader_state *templ) +{ + return NULL; +} + +#endif diff --git a/src/mesa/pipe/softpipe/sp_fs_sse.c b/src/mesa/pipe/softpipe/sp_fs_sse.c new file mode 100644 index 00000000000..713ece369ef --- /dev/null +++ b/src/mesa/pipe/softpipe/sp_fs_sse.c @@ -0,0 +1,192 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "sp_context.h" +#include "sp_state.h" +#include "sp_fs.h" +#include "sp_headers.h" + + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_util.h" +#include "pipe/p_inlines.h" +#include "pipe/tgsi/exec/tgsi_exec.h" +#include "pipe/tgsi/exec/tgsi_sse2.h" + + +#if defined(__i386__) || defined(__386__) + +#include "x86/rtasm/x86sse.h" + +/* Surely this should be defined somewhere in a tgsi header: + */ +typedef void (XSTDCALL *codegen_function)( + const struct tgsi_exec_vector *input, + struct tgsi_exec_vector *output, + float (*constant)[4], + struct tgsi_exec_vector *temporary, + const struct tgsi_interp_coef *coef + //, const struct tgsi_exec_vector *quadPos + ); + + +struct sp_sse_fragment_shader { + struct sp_fragment_shader base; + struct x86_function sse2_program; + codegen_function func; +}; + + +/** + * Compute quad X,Y,Z,W for the four fragments in a quad. + * + * This should really be part of the compiled shader. + */ +void +sp_setup_pos_vector(const struct tgsi_interp_coef *coef, + float x, float y, + struct tgsi_exec_vector *quadpos) +{ + uint chan; + /* do X */ + quadpos->xyzw[0].f[0] = x; + quadpos->xyzw[0].f[1] = x + 1; + quadpos->xyzw[0].f[2] = x; + quadpos->xyzw[0].f[3] = x + 1; + + /* do Y */ + quadpos->xyzw[1].f[0] = y; + quadpos->xyzw[1].f[1] = y; + quadpos->xyzw[1].f[2] = y + 1; + quadpos->xyzw[1].f[3] = y + 1; + + /* do Z and W for all fragments in the quad */ + for (chan = 2; chan < 4; chan++) { + const float dadx = coef->dadx[chan]; + const float dady = coef->dady[chan]; + const float a0 = coef->a0[chan] + dadx * x + dady * y; + quadpos->xyzw[chan].f[0] = a0; + quadpos->xyzw[chan].f[1] = a0 + dadx; + quadpos->xyzw[chan].f[2] = a0 + dady; + quadpos->xyzw[chan].f[3] = a0 + dadx + dady; + } +} + + +static void +sse_prepare( struct sp_fragment_shader *base, + struct tgsi_exec_machine *machine, + struct tgsi_sampler *samplers ) +{ +} + + +/* TODO: codegenerate the whole run function, skip this wrapper. + * TODO: break dependency on tgsi_exec_machine struct + * TODO: push Position calculation into the generated shader + * TODO: process >1 quad at a time + */ +static unsigned +sse_run( struct sp_fragment_shader *base, + struct tgsi_exec_machine *machine, + struct quad_header *quad ) +{ + struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base; + + /* Compute X, Y, Z, W vals for this quad -- place in temp[0] for now */ + sp_setup_pos_vector(quad->posCoef, + (float)quad->x0, (float)quad->y0, + machine->Temps); + + shader->func( machine->Inputs, + machine->Outputs, + machine->Consts, + machine->Temps, + machine->InterpCoefs + // , &machine->QuadPos + ); + + return ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); +} + + +static void +sse_delete( struct sp_fragment_shader *base ) +{ + struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base; + + x86_release_func( &shader->sse2_program ); + FREE(shader); +} + + +struct sp_fragment_shader * +softpipe_create_fs_sse(struct softpipe_context *softpipe, + const struct pipe_shader_state *templ) +{ + struct sp_sse_fragment_shader *shader; + + if (!softpipe->use_sse) + return NULL; + + shader = CALLOC_STRUCT(sp_sse_fragment_shader); + if (!shader) + return NULL; + + x86_init_func( &shader->sse2_program ); + + if (!tgsi_emit_sse2_fs( templ->tokens, &shader->sse2_program )) { + FREE(shader); + return NULL; + } + + shader->func = (codegen_function) x86_get_func( &shader->sse2_program ); + assert(shader->func); + + shader->base.shader = *templ; + shader->base.prepare = sse_prepare; + shader->base.run = sse_run; + shader->base.delete = sse_delete; + + return &shader->base; +} + + +#else + +/* Maybe put this varient in the header file. + */ +struct sp_fragment_shader * +softpipe_create_fs_sse(struct softpipe_context *softpipe, + const struct pipe_shader_state *templ) +{ + return NULL; +} + +#endif diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 33168584137..cf1b1eff75c 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -39,12 +39,6 @@ #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" -#include "x86/rtasm/x86sse.h" - -#ifdef MESA_LLVM -#include "pipe/llvm/gallivm.h" -#endif - #include "sp_context.h" #include "sp_state.h" #include "sp_headers.h" @@ -60,9 +54,6 @@ struct quad_shade_stage struct tgsi_exec_machine machine; struct tgsi_exec_vector *inputs, *outputs; int colorOutSlot, depthOutSlot; -#ifdef MESA_LLVM - struct gallivm_prog *llvm_prog; -#endif }; @@ -74,46 +65,6 @@ quad_shade_stage(struct quad_stage *qs) } -/** - * Compute quad X,Y,Z,W for the four fragments in a quad. - * Note that we only need to "compute" X and Y for the upper-left fragment. - * We could do less work if we're not depth testing, or there's no - * perspective-corrected attributes, but that's seldom. - */ -static void -setup_pos_vector(const struct tgsi_interp_coef *coef, - float x, float y, - struct tgsi_exec_vector *quadpos) -{ - uint chan; - /* do X */ - quadpos->xyzw[0].f[0] = x; - /* do Y */ - quadpos->xyzw[1].f[0] = y; - /* do Z and W for all fragments in the quad */ - for (chan = 2; chan < 4; chan++) { - const float dadx = coef->dadx[chan]; - const float dady = coef->dady[chan]; - const float a0 = coef->a0[chan] + dadx * x + dady * y; - quadpos->xyzw[chan].f[0] = a0; - quadpos->xyzw[chan].f[1] = a0 + dadx; - quadpos->xyzw[chan].f[2] = a0 + dady; - quadpos->xyzw[chan].f[3] = a0 + dadx + dady; - } -} - - -typedef void (XSTDCALL *codegen_function)( - const struct tgsi_exec_vector *input, - struct tgsi_exec_vector *output, - float (*constant)[4], - struct tgsi_exec_vector *temporary, - const struct tgsi_interp_coef *coef -#if 0 - ,const struct tgsi_exec_vector *quadPos -#endif - ); - /** * Execute fragment shader for the four fragments in the quad. @@ -132,30 +83,10 @@ shade_quad( machine->InterpCoefs = quad->coef; - /* Compute X, Y, Z, W vals for this quad */ - setup_pos_vector(quad->posCoef, (float) quad->x0, (float) quad->y0, &machine->QuadPos); - /* run shader */ -#if defined(__i386__) || defined(__386__) - if( softpipe->use_sse ) { - codegen_function func = (codegen_function) x86_get_func( &softpipe->fs->sse2_program ); - func( - machine->Inputs, - machine->Outputs, - machine->Consts, - machine->Temps, - machine->InterpCoefs -#if 0 - ,machine->QuadPos -#endif - ); - quad->mask &= ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); - } - else -#endif - { - quad->mask &= tgsi_exec_machine_run( machine ); - } + quad->mask &= softpipe->fs->run( softpipe->fs, + &qss->machine, + quad ); /* store result color */ if (qss->colorOutSlot >= 0) { @@ -199,107 +130,6 @@ shade_quad( } } -#if 0 -#ifdef MESA_LLVM -#define DLLVM 0 -static void -shade_quad_llvm(struct quad_stage *qs, - struct quad_header *quad) -{ - struct quad_shade_stage *qss = quad_shade_stage(qs); - struct softpipe_context *softpipe = qs->softpipe; - float dests[4][16][4] ALIGN16_ATTRIB; - float inputs[4][16][4] ALIGN16_ATTRIB; - const float fx = (float) quad->x0; - const float fy = (float) quad->y0; - struct gallivm_prog *llvm = qss->llvm_prog; - - inputs[0][0][0] = fx; - inputs[1][0][0] = fx + 1.0f; - inputs[2][0][0] = fx; - inputs[3][0][0] = fx + 1.0f; - - inputs[0][0][1] = fy; - inputs[1][0][1] = fy; - inputs[2][0][1] = fy + 1.0f; - inputs[3][0][1] = fy + 1.0f; -#if DLLVM - debug_printf("MASK = %d\n", quad->mask); -#endif - gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef); -#if DLLVM - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 2; ++j) { - debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j, - inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]); - } - } -#endif - - quad->mask &= - gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs, - softpipe->mapped_constants[PIPE_SHADER_FRAGMENT], - qss->samplers); -#if DLLVM - debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n", - dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3], - dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]); -#endif - - /* store result color */ - if (qss->colorOutSlot >= 0) { - unsigned i; - /* XXX need to handle multiple color outputs someday */ - assert(qss->stage.softpipe->fs->shader.output_semantic_name[qss->colorOutSlot] - == TGSI_SEMANTIC_COLOR); - for (i = 0; i < QUAD_SIZE; ++i) { - quad->outputs.color[0][i] = dests[i][qss->colorOutSlot][0]; - quad->outputs.color[1][i] = dests[i][qss->colorOutSlot][1]; - quad->outputs.color[2][i] = dests[i][qss->colorOutSlot][2]; - quad->outputs.color[3][i] = dests[i][qss->colorOutSlot][3]; - } - } -#if DLLVM - for (int i = 0; i < QUAD_SIZE; ++i) { - debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot, - quad->outputs.color[0][i], - quad->outputs.color[1][i], - quad->outputs.color[2][i], - quad->outputs.color[3][i]); - } -#endif - - /* store result Z */ - if (qss->depthOutSlot >= 0) { - /* output[slot] is new Z */ - uint i; - for (i = 0; i < 4; i++) { - quad->outputs.depth[i] = dests[i][0][2]; - } - } - else { - /* copy input Z (which was interpolated by the executor) to output Z */ - uint i; - for (i = 0; i < 4; i++) { - quad->outputs.depth[i] = inputs[i][0][2]; - } - } -#if DLLVM - debug_printf("D [%f, %f, %f, %f] mask = %d\n", - quad->outputs.depth[0], - quad->outputs.depth[1], - quad->outputs.depth[2], - quad->outputs.depth[3], quad->mask); -#endif - - /* shader may cull fragments */ - if( quad->mask ) { - qs->next->run( qs->next, quad ); - } -} -#endif /*MESA_LLVM*/ -#endif - /** * Per-primitive (or per-begin?) setup */ @@ -315,15 +145,6 @@ static void shade_begin(struct quad_stage *qs) qss->samplers[i].texture = &softpipe->texture[i]->base; } -#ifdef MESA_LLVM - qss->llvm_prog = softpipe->fs->llvm_prog; -#endif - /* XXX only do this if the fragment shader changes... */ - tgsi_exec_machine_init(&qss->machine, - softpipe->fs->shader.tokens, - PIPE_MAX_SAMPLERS, - qss->samplers ); - /* find output slots for depth, color */ qss->colorOutSlot = -1; qss->depthOutSlot = -1; @@ -337,6 +158,10 @@ static void shade_begin(struct quad_stage *qs) break; } } + + softpipe->fs->prepare( softpipe->fs, + &qss->machine, + qss->samplers ); qs->next->begin(qs->next); } @@ -366,16 +191,7 @@ struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ) qss->stage.softpipe = softpipe; qss->stage.begin = shade_begin; -#ifdef MESA_LLVM - /* disable until ported to accept - * x/y and soa layout - qss->stage.run = shade_quad_llvm; - */ - softpipe->use_sse = FALSE; qss->stage.run = shade_quad; -#else - qss->stage.run = shade_quad; -#endif qss->stage.destroy = shade_destroy; /* set TGSI sampler state that's constant */ @@ -386,5 +202,7 @@ struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe ) qss->samplers[i].cache = softpipe->tex_cache[i]; } + tgsi_exec_machine_init( &qss->machine ); + return &qss->stage; } diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h index af955c1e17b..431952f1aac 100644 --- a/src/mesa/pipe/softpipe/sp_state.h +++ b/src/mesa/pipe/softpipe/sp_state.h @@ -33,8 +33,6 @@ #include "pipe/p_state.h" -#include "x86/rtasm/x86sse.h" - #define SP_NEW_VIEWPORT 0x1 #define SP_NEW_RASTERIZER 0x2 @@ -53,27 +51,36 @@ #define SP_NEW_QUERY 0x4000 - -#ifdef MESA_LLVM -struct gallivm_prog; -#endif +struct tgsi_sampler; +struct tgsi_interp_coef; +struct tgsi_exec_machine; - -/** Subclass of pipe_shader_state */ -struct sp_fragment_shader_state { +/** Subclass of pipe_shader_state (though it doesn't really need to be). + * + * This is starting to look an awful lot like a quad pipeline stage... + */ +struct sp_fragment_shader { struct pipe_shader_state shader; -#if defined(__i386__) || defined(__386__) - struct x86_function sse2_program; -#endif -#ifdef MESA_LLVM - struct gallivm_prog *llvm_prog; -#endif + + void (*prepare)( struct sp_fragment_shader *shader, + struct tgsi_exec_machine *machine, + struct tgsi_sampler *samplers); + + /* Run the shader - this interface will get cleaned up in the + * future: + */ + unsigned (*run)( struct sp_fragment_shader *shader, + struct tgsi_exec_machine *machine, + struct quad_header *quad ); + + + void (*delete)( struct sp_fragment_shader * ); }; /** Subclass of pipe_shader_state */ -struct sp_vertex_shader_state { +struct sp_vertex_shader { struct pipe_shader_state shader; struct draw_vertex_shader *draw_data; }; diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c index 0b814fc2847..c43f28583ee 100644 --- a/src/mesa/pipe/softpipe/sp_state_fs.c +++ b/src/mesa/pipe/softpipe/sp_state_fs.c @@ -27,16 +27,15 @@ #include "sp_context.h" #include "sp_state.h" +#include "sp_fs.h" #include "pipe/p_defines.h" #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" -#include "pipe/draw/draw_context.h" #include "pipe/p_shader_tokens.h" -#include "pipe/llvm/gallivm.h" +#include "pipe/draw/draw_context.h" #include "pipe/tgsi/util/tgsi_dump.h" -#include "pipe/tgsi/exec/tgsi_sse2.h" void * @@ -44,40 +43,22 @@ softpipe_create_fs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_fragment_shader_state *state; + struct sp_fragment_shader *state; - /* Decide whether we'll be codegenerating this shader and if so do - * that now. - */ + if (softpipe->dump_fs) + tgsi_dump(templ->tokens, 0); - state = CALLOC_STRUCT(sp_fragment_shader_state); - if (!state) - return NULL; + state = softpipe_create_fs_llvm( softpipe, templ ); + if (state) + return state; + + state = softpipe_create_fs_sse( softpipe, templ ); + if (state) + return state; - state->shader = *templ; - - if (softpipe->dump_fs) { - tgsi_dump(state->shader.tokens, 0); - } - -#ifdef MESA_LLVM - state->llvm_prog = 0; - -#if 0 - if (!gallivm_global_cpu_engine()) { - gallivm_cpu_engine_create(state->llvm_prog); - } - else - gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog); -#endif - -#elif defined(__i386__) || defined(__386__) - if (softpipe->use_sse) { - x86_init_func( &state->sse2_program ); - tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program ); - } -#endif + state = softpipe_create_fs_exec( softpipe, templ ); + assert(state); return state; } @@ -87,7 +68,7 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->fs = (struct sp_fragment_shader_state *) fs; + softpipe->fs = (struct sp_fragment_shader *) fs; softpipe->dirty |= SP_NEW_FS; } @@ -96,13 +77,9 @@ softpipe_bind_fs_state(struct pipe_context *pipe, void *fs) void softpipe_delete_fs_state(struct pipe_context *pipe, void *fs) { - struct sp_fragment_shader_state *state = fs; - -#if defined(__i386__) || defined(__386__) - x86_release_func( &state->sse2_program ); -#endif - - FREE( state ); + struct sp_fragment_shader *state = fs; + + state->delete( state ); } @@ -111,9 +88,9 @@ softpipe_create_vs_state(struct pipe_context *pipe, const struct pipe_shader_state *templ) { struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_vertex_shader_state *state; + struct sp_vertex_shader *state; - state = CALLOC_STRUCT(sp_vertex_shader_state); + state = CALLOC_STRUCT(sp_vertex_shader); if (state == NULL ) { return NULL; } @@ -136,7 +113,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->vs = (const struct sp_vertex_shader_state *)vs; + softpipe->vs = (const struct sp_vertex_shader *)vs; draw_bind_vertex_shader(softpipe->draw, softpipe->vs->draw_data); @@ -149,8 +126,8 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_vertex_shader_state *state = - (struct sp_vertex_shader_state *)vs; + struct sp_vertex_shader *state = + (struct sp_vertex_shader *)vs; draw_delete_vertex_shader(softpipe->draw, state->draw_data); FREE( state ); diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index 336ae1c8b6d..92a6fd4d620 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -120,18 +120,41 @@ -static void -tgsi_exec_prepare( struct tgsi_exec_machine *mach ) +/** + * Initialize machine state by expanding tokens to full instructions, + * allocating temporary storage, setting up constants, etc. + * After this, we can call tgsi_exec_machine_run() many times. + */ +void +tgsi_exec_machine_bind_shader( + struct tgsi_exec_machine *mach, + const struct tgsi_token *tokens, + uint numSamplers, + struct tgsi_sampler *samplers) { - struct tgsi_exec_labels *labels = &mach->Labels; + uint k; struct tgsi_parse_context parse; + struct tgsi_exec_labels *labels = &mach->Labels; struct tgsi_full_instruction *instructions; struct tgsi_full_declaration *declarations; uint maxInstructions = 10, numInstructions = 0; uint maxDeclarations = 10, numDeclarations = 0; - uint k; uint instno = 0; +#if 0 + tgsi_dump(tokens, 0); +#endif + + mach->Tokens = tokens; + mach->Samplers = samplers; + + k = tgsi_parse_init (&parse, mach->Tokens); + if (k != TGSI_PARSE_OK) { + debug_printf( "Problem parsing!\n" ); + return; + } + + mach->Processor = parse.FullHeader.Processor.Processor; mach->ImmLimit = 0; labels->count = 0; @@ -141,11 +164,6 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) instructions = (struct tgsi_full_instruction *) MALLOC( maxInstructions * sizeof(struct tgsi_full_instruction) ); - k = tgsi_parse_init( &parse, mach->Tokens ); - if (k != TGSI_PARSE_OK) { - debug_printf("Problem parsing!\n"); - return; - } while( !tgsi_parse_end_of_tokens( &parse ) ) { uint pointer = parse.Position; @@ -176,7 +194,8 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) assert( mach->ImmLimit + size / 4 <= TGSI_EXEC_NUM_IMMEDIATES ); for( i = 0; i < size; i++ ) { - mach->Imms[mach->ImmLimit + i / 4][i % 4] = parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float; + mach->Imms[mach->ImmLimit + i / 4][i % 4] = + parse.FullToken.FullImmediate.u.ImmediateFloat32[i].Float; } mach->ImmLimit += size / 4; } @@ -224,37 +243,11 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) } -/** - * Initialize machine state by expanding tokens to full instructions, - * allocating temporary storage, setting up constants, etc. - * After this, we can call tgsi_exec_machine_run() many times. - */ void tgsi_exec_machine_init( - struct tgsi_exec_machine *mach, - const struct tgsi_token *tokens, - uint numSamplers, - struct tgsi_sampler *samplers) + struct tgsi_exec_machine *mach ) { - uint i, k; - struct tgsi_parse_context parse; - -#if 0 - tgsi_dump(tokens, 0); -#endif - - mach->Tokens = tokens; - - mach->Samplers = samplers; - - k = tgsi_parse_init (&parse, mach->Tokens); - if (k != TGSI_PARSE_OK) { - debug_printf( "Problem parsing!\n" ); - return; - } - - mach->Processor = parse.FullHeader.Processor.Processor; - tgsi_parse_free (&parse); + uint i; mach->Temps = (struct tgsi_exec_vector *) tgsi_align_128bit( mach->_Temps); mach->Addrs = &mach->Temps[TGSI_EXEC_NUM_TEMPS]; @@ -270,8 +263,6 @@ tgsi_exec_machine_init( mach->Temps[TEMP_128_I].xyzw[TEMP_128_C].f[i] = 128.0f; mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C].f[i] = -128.0f; } - - tgsi_exec_prepare( mach ); } diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.h b/src/mesa/pipe/tgsi/exec/tgsi_exec.h index 1fb66ee960f..45c49dd007c 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.h +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.h @@ -215,12 +215,16 @@ struct tgsi_exec_machine struct tgsi_exec_labels Labels; }; - void tgsi_exec_machine_init( + struct tgsi_exec_machine *mach ); + + +void +tgsi_exec_machine_bind_shader( struct tgsi_exec_machine *mach, const struct tgsi_token *tokens, - unsigned numSamplers, + uint numSamplers, struct tgsi_sampler *samplers); uint diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c index 6df7588c925..9bc9483e3b5 100755 --- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c @@ -2186,9 +2186,9 @@ emit_declaration( break; case TGSI_INTERPOLATE_LINEAR: - emit_inputf( func, 0, 0, TGSI_SWIZZLE_X ); + emit_tempf( func, 0, 0, TGSI_SWIZZLE_X ); emit_coef_dadx( func, 1, i, j ); - emit_inputf( func, 2, 0, TGSI_SWIZZLE_Y ); + emit_tempf( func, 2, 0, TGSI_SWIZZLE_Y ); emit_coef_dady( func, 3, i, j ); emit_mul( func, 0, 1 ); /* x * dadx */ emit_coef_a0( func, 4, i, j ); @@ -2199,12 +2199,12 @@ emit_declaration( break; case TGSI_INTERPOLATE_PERSPECTIVE: - emit_inputf( func, 0, 0, TGSI_SWIZZLE_X ); + emit_tempf( func, 0, 0, TGSI_SWIZZLE_X ); emit_coef_dadx( func, 1, i, j ); - emit_inputf( func, 2, 0, TGSI_SWIZZLE_Y ); + emit_tempf( func, 2, 0, TGSI_SWIZZLE_Y ); emit_coef_dady( func, 3, i, j ); emit_mul( func, 0, 1 ); /* x * dadx */ - emit_inputf( func, 4, 0, TGSI_SWIZZLE_W ); + emit_tempf( func, 4, 0, TGSI_SWIZZLE_W ); emit_coef_a0( func, 5, i, j ); emit_rcp( func, 4, 4 ); /* 1.0 / w */ emit_mul( func, 2, 3 ); /* y * dady */ From 92fcbf6e7bc622dcace226bb70ff6d5cdbdbaecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Feb 2008 20:07:18 +0900 Subject: [PATCH 63/74] Code reorganization: s/aux/auxiliary/. "aux" is a reserved name on Windows (X_X) --- src/gallium/{aux => auxiliary}/Makefile | 0 src/gallium/{aux => auxiliary}/cso_cache/cso_cache.c | 0 src/gallium/{aux => auxiliary}/cso_cache/cso_cache.h | 0 src/gallium/{aux => auxiliary}/cso_cache/cso_hash.c | 0 src/gallium/{aux => auxiliary}/cso_cache/cso_hash.h | 0 src/gallium/{aux => auxiliary}/draw/Makefile | 0 src/gallium/{aux => auxiliary}/draw/draw_clip.c | 0 src/gallium/{aux => auxiliary}/draw/draw_context.c | 0 src/gallium/{aux => auxiliary}/draw/draw_context.h | 0 src/gallium/{aux => auxiliary}/draw/draw_cull.c | 0 src/gallium/{aux => auxiliary}/draw/draw_debug.c | 0 src/gallium/{aux => auxiliary}/draw/draw_flatshade.c | 0 src/gallium/{aux => auxiliary}/draw/draw_offset.c | 0 src/gallium/{aux => auxiliary}/draw/draw_prim.c | 0 src/gallium/{aux => auxiliary}/draw/draw_private.h | 0 src/gallium/{aux => auxiliary}/draw/draw_stipple.c | 0 src/gallium/{aux => auxiliary}/draw/draw_twoside.c | 0 src/gallium/{aux => auxiliary}/draw/draw_unfilled.c | 0 src/gallium/{aux => auxiliary}/draw/draw_validate.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vbuf.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vbuf.h | 0 src/gallium/{aux => auxiliary}/draw/draw_vertex.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vertex.h | 0 src/gallium/{aux => auxiliary}/draw/draw_vertex_cache.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vertex_fetch.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vertex_shader.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vf.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vf.h | 0 src/gallium/{aux => auxiliary}/draw/draw_vf_generic.c | 0 src/gallium/{aux => auxiliary}/draw/draw_vf_sse.c | 0 src/gallium/{aux => auxiliary}/draw/draw_wide_prims.c | 0 src/gallium/{aux => auxiliary}/llvm/Makefile | 0 src/gallium/{aux => auxiliary}/llvm/gallivm.cpp | 0 src/gallium/{aux => auxiliary}/llvm/gallivm.h | 0 src/gallium/{aux => auxiliary}/llvm/gallivm_builtins.cpp | 0 src/gallium/{aux => auxiliary}/llvm/gallivm_cpu.cpp | 0 src/gallium/{aux => auxiliary}/llvm/gallivm_p.h | 0 src/gallium/{aux => auxiliary}/llvm/instructions.cpp | 0 src/gallium/{aux => auxiliary}/llvm/instructions.h | 0 src/gallium/{aux => auxiliary}/llvm/instructionssoa.cpp | 0 src/gallium/{aux => auxiliary}/llvm/instructionssoa.h | 0 src/gallium/{aux => auxiliary}/llvm/llvm_builtins.c | 0 src/gallium/{aux => auxiliary}/llvm/loweringpass.cpp | 0 src/gallium/{aux => auxiliary}/llvm/loweringpass.h | 0 src/gallium/{aux => auxiliary}/llvm/storage.cpp | 0 src/gallium/{aux => auxiliary}/llvm/storage.h | 0 src/gallium/{aux => auxiliary}/llvm/storagesoa.cpp | 0 src/gallium/{aux => auxiliary}/llvm/storagesoa.h | 0 src/gallium/{aux => auxiliary}/llvm/tgsitollvm.cpp | 0 src/gallium/{aux => auxiliary}/llvm/tgsitollvm.h | 0 src/gallium/{aux => auxiliary}/pipebuffer/Makefile | 0 src/gallium/{aux => auxiliary}/pipebuffer/linked_list.h | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer.h | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_fenced.c | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_fenced.h | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_malloc.c | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr.h | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_fenced.c | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_mm.c | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_pool.c | 0 src/gallium/{aux => auxiliary}/pipebuffer/pb_winsys.c | 0 src/gallium/{aux => auxiliary}/tgsi/Makefile | 0 src/gallium/{aux => auxiliary}/tgsi/exec/Makefile | 0 src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_exec.c | 0 src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_exec.h | 0 src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_sse2.c | 0 src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_sse2.h | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_build.c | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_build.h | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_dump.c | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_dump.h | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_parse.c | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_parse.h | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_transform.c | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_transform.h | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_util.c | 0 src/gallium/{aux => auxiliary}/tgsi/util/tgsi_util.h | 0 src/gallium/{aux => auxiliary}/util/p_debug.c | 0 src/gallium/{aux => auxiliary}/util/p_tile.c | 0 src/gallium/{aux => auxiliary}/util/p_tile.h | 0 src/gallium/{aux => auxiliary}/util/p_util.c | 0 81 files changed, 0 insertions(+), 0 deletions(-) rename src/gallium/{aux => auxiliary}/Makefile (100%) rename src/gallium/{aux => auxiliary}/cso_cache/cso_cache.c (100%) rename src/gallium/{aux => auxiliary}/cso_cache/cso_cache.h (100%) rename src/gallium/{aux => auxiliary}/cso_cache/cso_hash.c (100%) rename src/gallium/{aux => auxiliary}/cso_cache/cso_hash.h (100%) rename src/gallium/{aux => auxiliary}/draw/Makefile (100%) rename src/gallium/{aux => auxiliary}/draw/draw_clip.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_context.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_context.h (100%) rename src/gallium/{aux => auxiliary}/draw/draw_cull.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_debug.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_flatshade.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_offset.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_prim.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_private.h (100%) rename src/gallium/{aux => auxiliary}/draw/draw_stipple.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_twoside.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_unfilled.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_validate.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vbuf.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vbuf.h (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vertex.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vertex.h (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vertex_cache.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vertex_fetch.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vertex_shader.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vf.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vf.h (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vf_generic.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_vf_sse.c (100%) rename src/gallium/{aux => auxiliary}/draw/draw_wide_prims.c (100%) rename src/gallium/{aux => auxiliary}/llvm/Makefile (100%) rename src/gallium/{aux => auxiliary}/llvm/gallivm.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/gallivm.h (100%) rename src/gallium/{aux => auxiliary}/llvm/gallivm_builtins.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/gallivm_cpu.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/gallivm_p.h (100%) rename src/gallium/{aux => auxiliary}/llvm/instructions.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/instructions.h (100%) rename src/gallium/{aux => auxiliary}/llvm/instructionssoa.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/instructionssoa.h (100%) rename src/gallium/{aux => auxiliary}/llvm/llvm_builtins.c (100%) rename src/gallium/{aux => auxiliary}/llvm/loweringpass.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/loweringpass.h (100%) rename src/gallium/{aux => auxiliary}/llvm/storage.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/storage.h (100%) rename src/gallium/{aux => auxiliary}/llvm/storagesoa.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/storagesoa.h (100%) rename src/gallium/{aux => auxiliary}/llvm/tgsitollvm.cpp (100%) rename src/gallium/{aux => auxiliary}/llvm/tgsitollvm.h (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/Makefile (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/linked_list.h (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer.h (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_fenced.c (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_fenced.h (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_buffer_malloc.c (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr.h (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_fenced.c (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_mm.c (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_bufmgr_pool.c (100%) rename src/gallium/{aux => auxiliary}/pipebuffer/pb_winsys.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/Makefile (100%) rename src/gallium/{aux => auxiliary}/tgsi/exec/Makefile (100%) rename src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_exec.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_exec.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_sse2.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/exec/tgsi_sse2.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_build.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_build.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_dump.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_dump.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_parse.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_parse.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_transform.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_transform.h (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_util.c (100%) rename src/gallium/{aux => auxiliary}/tgsi/util/tgsi_util.h (100%) rename src/gallium/{aux => auxiliary}/util/p_debug.c (100%) rename src/gallium/{aux => auxiliary}/util/p_tile.c (100%) rename src/gallium/{aux => auxiliary}/util/p_tile.h (100%) rename src/gallium/{aux => auxiliary}/util/p_util.c (100%) diff --git a/src/gallium/aux/Makefile b/src/gallium/auxiliary/Makefile similarity index 100% rename from src/gallium/aux/Makefile rename to src/gallium/auxiliary/Makefile diff --git a/src/gallium/aux/cso_cache/cso_cache.c b/src/gallium/auxiliary/cso_cache/cso_cache.c similarity index 100% rename from src/gallium/aux/cso_cache/cso_cache.c rename to src/gallium/auxiliary/cso_cache/cso_cache.c diff --git a/src/gallium/aux/cso_cache/cso_cache.h b/src/gallium/auxiliary/cso_cache/cso_cache.h similarity index 100% rename from src/gallium/aux/cso_cache/cso_cache.h rename to src/gallium/auxiliary/cso_cache/cso_cache.h diff --git a/src/gallium/aux/cso_cache/cso_hash.c b/src/gallium/auxiliary/cso_cache/cso_hash.c similarity index 100% rename from src/gallium/aux/cso_cache/cso_hash.c rename to src/gallium/auxiliary/cso_cache/cso_hash.c diff --git a/src/gallium/aux/cso_cache/cso_hash.h b/src/gallium/auxiliary/cso_cache/cso_hash.h similarity index 100% rename from src/gallium/aux/cso_cache/cso_hash.h rename to src/gallium/auxiliary/cso_cache/cso_hash.h diff --git a/src/gallium/aux/draw/Makefile b/src/gallium/auxiliary/draw/Makefile similarity index 100% rename from src/gallium/aux/draw/Makefile rename to src/gallium/auxiliary/draw/Makefile diff --git a/src/gallium/aux/draw/draw_clip.c b/src/gallium/auxiliary/draw/draw_clip.c similarity index 100% rename from src/gallium/aux/draw/draw_clip.c rename to src/gallium/auxiliary/draw/draw_clip.c diff --git a/src/gallium/aux/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c similarity index 100% rename from src/gallium/aux/draw/draw_context.c rename to src/gallium/auxiliary/draw/draw_context.c diff --git a/src/gallium/aux/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h similarity index 100% rename from src/gallium/aux/draw/draw_context.h rename to src/gallium/auxiliary/draw/draw_context.h diff --git a/src/gallium/aux/draw/draw_cull.c b/src/gallium/auxiliary/draw/draw_cull.c similarity index 100% rename from src/gallium/aux/draw/draw_cull.c rename to src/gallium/auxiliary/draw/draw_cull.c diff --git a/src/gallium/aux/draw/draw_debug.c b/src/gallium/auxiliary/draw/draw_debug.c similarity index 100% rename from src/gallium/aux/draw/draw_debug.c rename to src/gallium/auxiliary/draw/draw_debug.c diff --git a/src/gallium/aux/draw/draw_flatshade.c b/src/gallium/auxiliary/draw/draw_flatshade.c similarity index 100% rename from src/gallium/aux/draw/draw_flatshade.c rename to src/gallium/auxiliary/draw/draw_flatshade.c diff --git a/src/gallium/aux/draw/draw_offset.c b/src/gallium/auxiliary/draw/draw_offset.c similarity index 100% rename from src/gallium/aux/draw/draw_offset.c rename to src/gallium/auxiliary/draw/draw_offset.c diff --git a/src/gallium/aux/draw/draw_prim.c b/src/gallium/auxiliary/draw/draw_prim.c similarity index 100% rename from src/gallium/aux/draw/draw_prim.c rename to src/gallium/auxiliary/draw/draw_prim.c diff --git a/src/gallium/aux/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h similarity index 100% rename from src/gallium/aux/draw/draw_private.h rename to src/gallium/auxiliary/draw/draw_private.h diff --git a/src/gallium/aux/draw/draw_stipple.c b/src/gallium/auxiliary/draw/draw_stipple.c similarity index 100% rename from src/gallium/aux/draw/draw_stipple.c rename to src/gallium/auxiliary/draw/draw_stipple.c diff --git a/src/gallium/aux/draw/draw_twoside.c b/src/gallium/auxiliary/draw/draw_twoside.c similarity index 100% rename from src/gallium/aux/draw/draw_twoside.c rename to src/gallium/auxiliary/draw/draw_twoside.c diff --git a/src/gallium/aux/draw/draw_unfilled.c b/src/gallium/auxiliary/draw/draw_unfilled.c similarity index 100% rename from src/gallium/aux/draw/draw_unfilled.c rename to src/gallium/auxiliary/draw/draw_unfilled.c diff --git a/src/gallium/aux/draw/draw_validate.c b/src/gallium/auxiliary/draw/draw_validate.c similarity index 100% rename from src/gallium/aux/draw/draw_validate.c rename to src/gallium/auxiliary/draw/draw_validate.c diff --git a/src/gallium/aux/draw/draw_vbuf.c b/src/gallium/auxiliary/draw/draw_vbuf.c similarity index 100% rename from src/gallium/aux/draw/draw_vbuf.c rename to src/gallium/auxiliary/draw/draw_vbuf.c diff --git a/src/gallium/aux/draw/draw_vbuf.h b/src/gallium/auxiliary/draw/draw_vbuf.h similarity index 100% rename from src/gallium/aux/draw/draw_vbuf.h rename to src/gallium/auxiliary/draw/draw_vbuf.h diff --git a/src/gallium/aux/draw/draw_vertex.c b/src/gallium/auxiliary/draw/draw_vertex.c similarity index 100% rename from src/gallium/aux/draw/draw_vertex.c rename to src/gallium/auxiliary/draw/draw_vertex.c diff --git a/src/gallium/aux/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h similarity index 100% rename from src/gallium/aux/draw/draw_vertex.h rename to src/gallium/auxiliary/draw/draw_vertex.h diff --git a/src/gallium/aux/draw/draw_vertex_cache.c b/src/gallium/auxiliary/draw/draw_vertex_cache.c similarity index 100% rename from src/gallium/aux/draw/draw_vertex_cache.c rename to src/gallium/auxiliary/draw/draw_vertex_cache.c diff --git a/src/gallium/aux/draw/draw_vertex_fetch.c b/src/gallium/auxiliary/draw/draw_vertex_fetch.c similarity index 100% rename from src/gallium/aux/draw/draw_vertex_fetch.c rename to src/gallium/auxiliary/draw/draw_vertex_fetch.c diff --git a/src/gallium/aux/draw/draw_vertex_shader.c b/src/gallium/auxiliary/draw/draw_vertex_shader.c similarity index 100% rename from src/gallium/aux/draw/draw_vertex_shader.c rename to src/gallium/auxiliary/draw/draw_vertex_shader.c diff --git a/src/gallium/aux/draw/draw_vf.c b/src/gallium/auxiliary/draw/draw_vf.c similarity index 100% rename from src/gallium/aux/draw/draw_vf.c rename to src/gallium/auxiliary/draw/draw_vf.c diff --git a/src/gallium/aux/draw/draw_vf.h b/src/gallium/auxiliary/draw/draw_vf.h similarity index 100% rename from src/gallium/aux/draw/draw_vf.h rename to src/gallium/auxiliary/draw/draw_vf.h diff --git a/src/gallium/aux/draw/draw_vf_generic.c b/src/gallium/auxiliary/draw/draw_vf_generic.c similarity index 100% rename from src/gallium/aux/draw/draw_vf_generic.c rename to src/gallium/auxiliary/draw/draw_vf_generic.c diff --git a/src/gallium/aux/draw/draw_vf_sse.c b/src/gallium/auxiliary/draw/draw_vf_sse.c similarity index 100% rename from src/gallium/aux/draw/draw_vf_sse.c rename to src/gallium/auxiliary/draw/draw_vf_sse.c diff --git a/src/gallium/aux/draw/draw_wide_prims.c b/src/gallium/auxiliary/draw/draw_wide_prims.c similarity index 100% rename from src/gallium/aux/draw/draw_wide_prims.c rename to src/gallium/auxiliary/draw/draw_wide_prims.c diff --git a/src/gallium/aux/llvm/Makefile b/src/gallium/auxiliary/llvm/Makefile similarity index 100% rename from src/gallium/aux/llvm/Makefile rename to src/gallium/auxiliary/llvm/Makefile diff --git a/src/gallium/aux/llvm/gallivm.cpp b/src/gallium/auxiliary/llvm/gallivm.cpp similarity index 100% rename from src/gallium/aux/llvm/gallivm.cpp rename to src/gallium/auxiliary/llvm/gallivm.cpp diff --git a/src/gallium/aux/llvm/gallivm.h b/src/gallium/auxiliary/llvm/gallivm.h similarity index 100% rename from src/gallium/aux/llvm/gallivm.h rename to src/gallium/auxiliary/llvm/gallivm.h diff --git a/src/gallium/aux/llvm/gallivm_builtins.cpp b/src/gallium/auxiliary/llvm/gallivm_builtins.cpp similarity index 100% rename from src/gallium/aux/llvm/gallivm_builtins.cpp rename to src/gallium/auxiliary/llvm/gallivm_builtins.cpp diff --git a/src/gallium/aux/llvm/gallivm_cpu.cpp b/src/gallium/auxiliary/llvm/gallivm_cpu.cpp similarity index 100% rename from src/gallium/aux/llvm/gallivm_cpu.cpp rename to src/gallium/auxiliary/llvm/gallivm_cpu.cpp diff --git a/src/gallium/aux/llvm/gallivm_p.h b/src/gallium/auxiliary/llvm/gallivm_p.h similarity index 100% rename from src/gallium/aux/llvm/gallivm_p.h rename to src/gallium/auxiliary/llvm/gallivm_p.h diff --git a/src/gallium/aux/llvm/instructions.cpp b/src/gallium/auxiliary/llvm/instructions.cpp similarity index 100% rename from src/gallium/aux/llvm/instructions.cpp rename to src/gallium/auxiliary/llvm/instructions.cpp diff --git a/src/gallium/aux/llvm/instructions.h b/src/gallium/auxiliary/llvm/instructions.h similarity index 100% rename from src/gallium/aux/llvm/instructions.h rename to src/gallium/auxiliary/llvm/instructions.h diff --git a/src/gallium/aux/llvm/instructionssoa.cpp b/src/gallium/auxiliary/llvm/instructionssoa.cpp similarity index 100% rename from src/gallium/aux/llvm/instructionssoa.cpp rename to src/gallium/auxiliary/llvm/instructionssoa.cpp diff --git a/src/gallium/aux/llvm/instructionssoa.h b/src/gallium/auxiliary/llvm/instructionssoa.h similarity index 100% rename from src/gallium/aux/llvm/instructionssoa.h rename to src/gallium/auxiliary/llvm/instructionssoa.h diff --git a/src/gallium/aux/llvm/llvm_builtins.c b/src/gallium/auxiliary/llvm/llvm_builtins.c similarity index 100% rename from src/gallium/aux/llvm/llvm_builtins.c rename to src/gallium/auxiliary/llvm/llvm_builtins.c diff --git a/src/gallium/aux/llvm/loweringpass.cpp b/src/gallium/auxiliary/llvm/loweringpass.cpp similarity index 100% rename from src/gallium/aux/llvm/loweringpass.cpp rename to src/gallium/auxiliary/llvm/loweringpass.cpp diff --git a/src/gallium/aux/llvm/loweringpass.h b/src/gallium/auxiliary/llvm/loweringpass.h similarity index 100% rename from src/gallium/aux/llvm/loweringpass.h rename to src/gallium/auxiliary/llvm/loweringpass.h diff --git a/src/gallium/aux/llvm/storage.cpp b/src/gallium/auxiliary/llvm/storage.cpp similarity index 100% rename from src/gallium/aux/llvm/storage.cpp rename to src/gallium/auxiliary/llvm/storage.cpp diff --git a/src/gallium/aux/llvm/storage.h b/src/gallium/auxiliary/llvm/storage.h similarity index 100% rename from src/gallium/aux/llvm/storage.h rename to src/gallium/auxiliary/llvm/storage.h diff --git a/src/gallium/aux/llvm/storagesoa.cpp b/src/gallium/auxiliary/llvm/storagesoa.cpp similarity index 100% rename from src/gallium/aux/llvm/storagesoa.cpp rename to src/gallium/auxiliary/llvm/storagesoa.cpp diff --git a/src/gallium/aux/llvm/storagesoa.h b/src/gallium/auxiliary/llvm/storagesoa.h similarity index 100% rename from src/gallium/aux/llvm/storagesoa.h rename to src/gallium/auxiliary/llvm/storagesoa.h diff --git a/src/gallium/aux/llvm/tgsitollvm.cpp b/src/gallium/auxiliary/llvm/tgsitollvm.cpp similarity index 100% rename from src/gallium/aux/llvm/tgsitollvm.cpp rename to src/gallium/auxiliary/llvm/tgsitollvm.cpp diff --git a/src/gallium/aux/llvm/tgsitollvm.h b/src/gallium/auxiliary/llvm/tgsitollvm.h similarity index 100% rename from src/gallium/aux/llvm/tgsitollvm.h rename to src/gallium/auxiliary/llvm/tgsitollvm.h diff --git a/src/gallium/aux/pipebuffer/Makefile b/src/gallium/auxiliary/pipebuffer/Makefile similarity index 100% rename from src/gallium/aux/pipebuffer/Makefile rename to src/gallium/auxiliary/pipebuffer/Makefile diff --git a/src/gallium/aux/pipebuffer/linked_list.h b/src/gallium/auxiliary/pipebuffer/linked_list.h similarity index 100% rename from src/gallium/aux/pipebuffer/linked_list.h rename to src/gallium/auxiliary/pipebuffer/linked_list.h diff --git a/src/gallium/aux/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h similarity index 100% rename from src/gallium/aux/pipebuffer/pb_buffer.h rename to src/gallium/auxiliary/pipebuffer/pb_buffer.h diff --git a/src/gallium/aux/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_buffer_fenced.c rename to src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c diff --git a/src/gallium/aux/pipebuffer/pb_buffer_fenced.h b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h similarity index 100% rename from src/gallium/aux/pipebuffer/pb_buffer_fenced.h rename to src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.h diff --git a/src/gallium/aux/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_buffer_malloc.c rename to src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c diff --git a/src/gallium/aux/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h similarity index 100% rename from src/gallium/aux/pipebuffer/pb_bufmgr.h rename to src/gallium/auxiliary/pipebuffer/pb_bufmgr.h diff --git a/src/gallium/aux/pipebuffer/pb_bufmgr_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_bufmgr_fenced.c rename to src/gallium/auxiliary/pipebuffer/pb_bufmgr_fenced.c diff --git a/src/gallium/aux/pipebuffer/pb_bufmgr_mm.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_bufmgr_mm.c rename to src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c diff --git a/src/gallium/aux/pipebuffer/pb_bufmgr_pool.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_bufmgr_pool.c rename to src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c diff --git a/src/gallium/aux/pipebuffer/pb_winsys.c b/src/gallium/auxiliary/pipebuffer/pb_winsys.c similarity index 100% rename from src/gallium/aux/pipebuffer/pb_winsys.c rename to src/gallium/auxiliary/pipebuffer/pb_winsys.c diff --git a/src/gallium/aux/tgsi/Makefile b/src/gallium/auxiliary/tgsi/Makefile similarity index 100% rename from src/gallium/aux/tgsi/Makefile rename to src/gallium/auxiliary/tgsi/Makefile diff --git a/src/gallium/aux/tgsi/exec/Makefile b/src/gallium/auxiliary/tgsi/exec/Makefile similarity index 100% rename from src/gallium/aux/tgsi/exec/Makefile rename to src/gallium/auxiliary/tgsi/exec/Makefile diff --git a/src/gallium/aux/tgsi/exec/tgsi_exec.c b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c similarity index 100% rename from src/gallium/aux/tgsi/exec/tgsi_exec.c rename to src/gallium/auxiliary/tgsi/exec/tgsi_exec.c diff --git a/src/gallium/aux/tgsi/exec/tgsi_exec.h b/src/gallium/auxiliary/tgsi/exec/tgsi_exec.h similarity index 100% rename from src/gallium/aux/tgsi/exec/tgsi_exec.h rename to src/gallium/auxiliary/tgsi/exec/tgsi_exec.h diff --git a/src/gallium/aux/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c similarity index 100% rename from src/gallium/aux/tgsi/exec/tgsi_sse2.c rename to src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c diff --git a/src/gallium/aux/tgsi/exec/tgsi_sse2.h b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h similarity index 100% rename from src/gallium/aux/tgsi/exec/tgsi_sse2.h rename to src/gallium/auxiliary/tgsi/exec/tgsi_sse2.h diff --git a/src/gallium/aux/tgsi/util/tgsi_build.c b/src/gallium/auxiliary/tgsi/util/tgsi_build.c similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_build.c rename to src/gallium/auxiliary/tgsi/util/tgsi_build.c diff --git a/src/gallium/aux/tgsi/util/tgsi_build.h b/src/gallium/auxiliary/tgsi/util/tgsi_build.h similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_build.h rename to src/gallium/auxiliary/tgsi/util/tgsi_build.h diff --git a/src/gallium/aux/tgsi/util/tgsi_dump.c b/src/gallium/auxiliary/tgsi/util/tgsi_dump.c similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_dump.c rename to src/gallium/auxiliary/tgsi/util/tgsi_dump.c diff --git a/src/gallium/aux/tgsi/util/tgsi_dump.h b/src/gallium/auxiliary/tgsi/util/tgsi_dump.h similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_dump.h rename to src/gallium/auxiliary/tgsi/util/tgsi_dump.h diff --git a/src/gallium/aux/tgsi/util/tgsi_parse.c b/src/gallium/auxiliary/tgsi/util/tgsi_parse.c similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_parse.c rename to src/gallium/auxiliary/tgsi/util/tgsi_parse.c diff --git a/src/gallium/aux/tgsi/util/tgsi_parse.h b/src/gallium/auxiliary/tgsi/util/tgsi_parse.h similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_parse.h rename to src/gallium/auxiliary/tgsi/util/tgsi_parse.h diff --git a/src/gallium/aux/tgsi/util/tgsi_transform.c b/src/gallium/auxiliary/tgsi/util/tgsi_transform.c similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_transform.c rename to src/gallium/auxiliary/tgsi/util/tgsi_transform.c diff --git a/src/gallium/aux/tgsi/util/tgsi_transform.h b/src/gallium/auxiliary/tgsi/util/tgsi_transform.h similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_transform.h rename to src/gallium/auxiliary/tgsi/util/tgsi_transform.h diff --git a/src/gallium/aux/tgsi/util/tgsi_util.c b/src/gallium/auxiliary/tgsi/util/tgsi_util.c similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_util.c rename to src/gallium/auxiliary/tgsi/util/tgsi_util.c diff --git a/src/gallium/aux/tgsi/util/tgsi_util.h b/src/gallium/auxiliary/tgsi/util/tgsi_util.h similarity index 100% rename from src/gallium/aux/tgsi/util/tgsi_util.h rename to src/gallium/auxiliary/tgsi/util/tgsi_util.h diff --git a/src/gallium/aux/util/p_debug.c b/src/gallium/auxiliary/util/p_debug.c similarity index 100% rename from src/gallium/aux/util/p_debug.c rename to src/gallium/auxiliary/util/p_debug.c diff --git a/src/gallium/aux/util/p_tile.c b/src/gallium/auxiliary/util/p_tile.c similarity index 100% rename from src/gallium/aux/util/p_tile.c rename to src/gallium/auxiliary/util/p_tile.c diff --git a/src/gallium/aux/util/p_tile.h b/src/gallium/auxiliary/util/p_tile.h similarity index 100% rename from src/gallium/aux/util/p_tile.h rename to src/gallium/auxiliary/util/p_tile.h diff --git a/src/gallium/aux/util/p_util.c b/src/gallium/auxiliary/util/p_util.c similarity index 100% rename from src/gallium/aux/util/p_util.c rename to src/gallium/auxiliary/util/p_util.c From 66f22aa3bf7fa546e946b45156aa578e202982c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Feb 2008 20:11:40 +0900 Subject: [PATCH 64/74] Code reorganization: s/aux/auxiliary/ -- update build. --- src/gallium/Makefile | 2 +- src/gallium/Makefile.template | 2 +- src/gallium/auxiliary/llvm/Makefile | 2 +- src/gallium/drivers/cell/ppu/Makefile | 2 +- src/gallium/drivers/cell/spu/Makefile | 2 +- src/gallium/winsys/dri/Makefile.template | 2 +- src/mesa/Makefile | 2 +- src/mesa/sources | 66 ++++++++++++------------ 8 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/gallium/Makefile b/src/gallium/Makefile index a13b9a52d36..89e068a4492 100644 --- a/src/gallium/Makefile +++ b/src/gallium/Makefile @@ -2,7 +2,7 @@ TOP = ../.. include $(TOP)/configs/current -SUBDIRS = aux drivers +SUBDIRS = auxiliary drivers default: subdirs diff --git a/src/gallium/Makefile.template b/src/gallium/Makefile.template index 0717ed8dd24..83b25f9b47c 100644 --- a/src/gallium/Makefile.template +++ b/src/gallium/Makefile.template @@ -17,7 +17,7 @@ INCLUDES = \ -I. \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/include/pipe \ - -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/drivers \ -I$(TOP)/src/mesa \ -I$(TOP)/include \ diff --git a/src/gallium/auxiliary/llvm/Makefile b/src/gallium/auxiliary/llvm/Makefile index e6ac399d088..e0abf860c17 100644 --- a/src/gallium/auxiliary/llvm/Makefile +++ b/src/gallium/auxiliary/llvm/Makefile @@ -31,7 +31,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \ INCLUDES = \ -I. \ -I$(TOP)/src/gallium/drivers - -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/mesa \ -I$(TOP)/include diff --git a/src/gallium/drivers/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile index 011863c11e1..a4c3f29e8a4 100644 --- a/src/gallium/drivers/cell/ppu/Makefile +++ b/src/gallium/drivers/cell/ppu/Makefile @@ -43,7 +43,7 @@ OBJECTS = $(SOURCES:.c=.o) \ INCLUDE_DIRS = \ -I$(TOP)/src/mesa \ -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/drivers .c.o: diff --git a/src/gallium/drivers/cell/spu/Makefile b/src/gallium/drivers/cell/spu/Makefile index 7aa947299e7..30ef2450ece 100644 --- a/src/gallium/drivers/cell/spu/Makefile +++ b/src/gallium/drivers/cell/spu/Makefile @@ -34,7 +34,7 @@ SPU_ASM_OUT = $(SOURCES:.c=.s) \ INCLUDE_DIRS = \ -I$(TOP)/src/mesa \ -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/drivers diff --git a/src/gallium/winsys/dri/Makefile.template b/src/gallium/winsys/dri/Makefile.template index b96305c0940..2a261ed6694 100644 --- a/src/gallium/winsys/dri/Makefile.template +++ b/src/gallium/winsys/dri/Makefile.template @@ -49,7 +49,7 @@ SHARED_INCLUDES = \ -I$(TOP)/include \ -I$(TOP)/include/GL/internal \ -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/aux \ + -I$(TOP)/src/gallium/auxiliary \ -I$(TOP)/src/gallium/drivers \ -I$(TOP)/src/mesa \ -I$(TOP)/src/mesa/main \ diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 561608fedd6..c8cb2b592fe 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -21,7 +21,7 @@ CELL_LIB_SPU = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a endif ifeq ($(CONFIG_NAME), linux-llvm) -LLVM_LIB = $(TOP)/src/gallium/aux/llvm/libgallivm.a +LLVM_LIB = $(TOP)/src/gallium/auxiliary/llvm/libgallivm.a endif .SUFFIXES : .cpp diff --git a/src/mesa/sources b/src/mesa/sources index 2d07738210d..cecd8a830fe 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -158,45 +158,45 @@ VF_SOURCES = \ DRAW_SOURCES = \ - $(TOP)/src/gallium/aux/draw/draw_clip.c \ - $(TOP)/src/gallium/aux/draw/draw_context.c\ - $(TOP)/src/gallium/aux/draw/draw_cull.c \ - $(TOP)/src/gallium/aux/draw/draw_debug.c \ - $(TOP)/src/gallium/aux/draw/draw_flatshade.c \ - $(TOP)/src/gallium/aux/draw/draw_offset.c \ - $(TOP)/src/gallium/aux/draw/draw_prim.c \ - $(TOP)/src/gallium/aux/draw/draw_stipple.c \ - $(TOP)/src/gallium/aux/draw/draw_twoside.c \ - $(TOP)/src/gallium/aux/draw/draw_unfilled.c \ - $(TOP)/src/gallium/aux/draw/draw_validate.c \ - $(TOP)/src/gallium/aux/draw/draw_vbuf.c \ - $(TOP)/src/gallium/aux/draw/draw_vertex.c \ - $(TOP)/src/gallium/aux/draw/draw_vertex_cache.c \ - $(TOP)/src/gallium/aux/draw/draw_vertex_fetch.c \ - $(TOP)/src/gallium/aux/draw/draw_vertex_shader.c \ - $(TOP)/src/gallium/aux/draw/draw_vf.c \ - $(TOP)/src/gallium/aux/draw/draw_vf_generic.c \ - $(TOP)/src/gallium/aux/draw/draw_vf_sse.c \ - $(TOP)/src/gallium/aux/draw/draw_wide_prims.c + $(TOP)/src/gallium/auxiliary/draw/draw_clip.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_context.c\ + $(TOP)/src/gallium/auxiliary/draw/draw_cull.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_debug.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_flatshade.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_offset.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_prim.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_stipple.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_twoside.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_unfilled.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_validate.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vbuf.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vertex.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vertex_cache.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vertex_fetch.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vertex_shader.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vf.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vf_generic.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vf_sse.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_wide_prims.c TGSIEXEC_SOURCES = \ - $(TOP)/src/gallium/aux/tgsi/exec/tgsi_exec.c \ - $(TOP)/src/gallium/aux/tgsi/exec/tgsi_sse2.c + $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_exec.c \ + $(TOP)/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c TGSIUTIL_SOURCES = \ - $(TOP)/src/gallium/aux/tgsi/util/tgsi_build.c \ - $(TOP)/src/gallium/aux/tgsi/util/tgsi_dump.c \ - $(TOP)/src/gallium/aux/tgsi/util/tgsi_parse.c \ - $(TOP)/src/gallium/aux/tgsi/util/tgsi_util.c + $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_build.c \ + $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_dump.c \ + $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_parse.c \ + $(TOP)/src/gallium/auxiliary/tgsi/util/tgsi_util.c STATECACHE_SOURCES = \ - $(TOP)/src/gallium/aux/cso_cache/cso_hash.c \ - $(TOP)/src/gallium/aux/cso_cache/cso_cache.c + $(TOP)/src/gallium/auxiliary/cso_cache/cso_hash.c \ + $(TOP)/src/gallium/auxiliary/cso_cache/cso_cache.c PIPEUTIL_SOURCES = \ - $(TOP)/src/gallium/aux/util/p_debug.c \ - $(TOP)/src/gallium/aux/util/p_tile.c \ - $(TOP)/src/gallium/aux/util/p_util.c + $(TOP)/src/gallium/auxiliary/util/p_debug.c \ + $(TOP)/src/gallium/auxiliary/util/p_tile.c \ + $(TOP)/src/gallium/auxiliary/util/p_util.c STATETRACKER_SOURCES = \ state_tracker/st_atom.c \ @@ -428,7 +428,7 @@ INCLUDE_DIRS = \ -I$(TOP)/src/mesa/main \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/drivers \ - -I$(TOP)/src/gallium/aux + -I$(TOP)/src/gallium/auxiliary OLD_INCLUDE_DIRS = \ -I$(TOP)/src/mesa/tnl \ @@ -438,4 +438,4 @@ OLD_INCLUDE_DIRS = \ -I$(TOP)/src/mesa/shader \ -I$(TOP)/src/mesa/shader/grammar \ -I$(TOP)/src/mesa/shader/slang \ - -I$(TOP)/s$(TOP)/src/gallium/aux/tgsi + -I$(TOP)/s$(TOP)/src/gallium/auxiliary/tgsi From e822e09b89407d6cb8cd4a79e1c5c1e0955caf64 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Feb 2008 13:35:46 +0000 Subject: [PATCH 65/74] softpipe: rename some functions to disambiguate --- src/gallium/drivers/softpipe/sp_fs_sse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index 28c5d8c556d..d90066e0257 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -100,7 +100,7 @@ sp_setup_pos_vector(const struct tgsi_interp_coef *coef, static void -sse_prepare( struct sp_fragment_shader *base, +fs_sse_prepare( struct sp_fragment_shader *base, struct tgsi_exec_machine *machine, struct tgsi_sampler *samplers ) { @@ -113,7 +113,7 @@ sse_prepare( struct sp_fragment_shader *base, * TODO: process >1 quad at a time */ static unsigned -sse_run( struct sp_fragment_shader *base, +fs_sse_run( struct sp_fragment_shader *base, struct tgsi_exec_machine *machine, struct quad_header *quad ) { @@ -137,7 +137,7 @@ sse_run( struct sp_fragment_shader *base, static void -sse_delete( struct sp_fragment_shader *base ) +fs_sse_delete( struct sp_fragment_shader *base ) { struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base; @@ -170,9 +170,9 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe, assert(shader->func); shader->base.shader = *templ; - shader->base.prepare = sse_prepare; - shader->base.run = sse_run; - shader->base.delete = sse_delete; + shader->base.prepare = fs_sse_prepare; + shader->base.run = fs_sse_run; + shader->base.delete = fs_sse_delete; return &shader->base; } From b29d8d27292c2ad956d3f0a307603f00ee01af28 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Feb 2008 13:37:01 +0000 Subject: [PATCH 66/74] draw: subclass vertex shaders according to execution method Create new files for shaders compiled/executed with llvm, sse, exec respectively --- src/gallium/auxiliary/draw/Makefile | 2 +- src/gallium/auxiliary/draw/draw_private.h | 40 +-- .../auxiliary/draw/draw_vertex_shader.c | 229 +--------------- src/gallium/auxiliary/draw/draw_vs.h | 50 ++++ src/gallium/auxiliary/draw/draw_vs_exec.c | 186 +++++++++++++ src/gallium/auxiliary/draw/draw_vs_llvm.c | 237 +++++++++++++++++ src/gallium/auxiliary/draw/draw_vs_sse.c | 251 ++++++++++++++++++ src/mesa/sources | 3 + 8 files changed, 766 insertions(+), 232 deletions(-) create mode 100644 src/gallium/auxiliary/draw/draw_vs.h create mode 100644 src/gallium/auxiliary/draw/draw_vs_exec.c create mode 100644 src/gallium/auxiliary/draw/draw_vs_llvm.c create mode 100644 src/gallium/auxiliary/draw/draw_vs_sse.c diff --git a/src/gallium/auxiliary/draw/Makefile b/src/gallium/auxiliary/draw/Makefile index 451911a3545..fe9b150f304 100644 --- a/src/gallium/auxiliary/draw/Makefile +++ b/src/gallium/auxiliary/draw/Makefile @@ -1,2 +1,2 @@ default: - cd .. ; make + cd ../../../mesa ; make diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 3d09aef87c1..bc11259cb21 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -128,13 +128,25 @@ struct draw_stage * Private version of the compiled vertex_shader */ struct draw_vertex_shader { + + /* This member will disappear shortly: + */ const struct pipe_shader_state *state; -#if defined(__i386__) || defined(__386__) - struct x86_function sse2_program; -#endif -#ifdef MESA_LLVM - struct gallivm_prog *llvm_prog; -#endif + + void (*prepare)( struct draw_vertex_shader *shader, + struct draw_context *draw ); + + /* Run the shader - this interface will get cleaned up in the + * future: + */ + void (*run)( struct draw_vertex_shader *shader, + struct draw_context *draw, + const unsigned *elts, + unsigned count, + struct vertex_header *vOut[] ); + + + void (*delete)( struct draw_vertex_shader * ); }; @@ -176,7 +188,7 @@ struct draw_context struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX]; struct pipe_vertex_element vertex_element[PIPE_ATTRIB_MAX]; - const struct draw_vertex_shader *vertex_shader; + struct draw_vertex_shader *vertex_shader; uint num_vs_outputs; /**< convenience, from vertex_shader */ @@ -201,6 +213,7 @@ struct draw_context boolean convert_wide_points; /**< convert wide points to tris? */ boolean convert_wide_lines; /**< convert side lines to tris? */ + boolean use_sse; unsigned reduced_prim; @@ -255,11 +268,10 @@ struct draw_context unsigned queue_nr; } pq; - int use_sse : 1; -#ifdef MESA_LLVM - struct gallivm_cpu_engine *engine; -#endif - + + /* This (and the tgsi_exec_machine struct) probably need to be moved somewhere private. + */ + struct gallivm_cpu_engine *engine; void *driver_private; }; @@ -290,11 +302,7 @@ extern void draw_vertex_cache_invalidate( struct draw_context *draw ); extern void draw_vertex_cache_unreference( struct draw_context *draw ); extern void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw ); - extern void draw_vertex_shader_queue_flush( struct draw_context *draw ); -#ifdef MESA_LLVM -extern void draw_vertex_shader_queue_flush_llvm( struct draw_context *draw ); -#endif struct tgsi_exec_machine; diff --git a/src/gallium/auxiliary/draw/draw_vertex_shader.c b/src/gallium/auxiliary/draw/draw_vertex_shader.c index 9413f8b43a4..f68f6e32440 100644 --- a/src/gallium/auxiliary/draw/draw_vertex_shader.c +++ b/src/gallium/auxiliary/draw/draw_vertex_shader.c @@ -33,177 +33,10 @@ #include "pipe/p_util.h" #include "pipe/p_shader_tokens.h" -#if defined(__i386__) || defined(__386__) -#include "tgsi/exec/tgsi_sse2.h" -#endif #include "draw_private.h" #include "draw_context.h" +#include "draw_vs.h" -#include "x86/rtasm/x86sse.h" -#include "llvm/gallivm.h" - - -#define DBG_VS 0 - - -static INLINE unsigned -compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr) -{ - unsigned mask = 0; - unsigned i; - - /* Do the hardwired planes first: - */ - if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT; - if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT; - if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT; - if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT; - if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT; - if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT; - - /* Followed by any remaining ones: - */ - for (i = 6; i < nr; i++) { - if (dot4(clip, plane[i]) < 0) - mask |= (1<machine; - unsigned int j; - - ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX); - ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX); - const float *scale = draw->viewport.scale; - const float *trans = draw->viewport.translate; - - assert(count <= 4); - assert(draw->vertex_shader->state->output_semantic_name[0] - == TGSI_SEMANTIC_POSITION); - - /* Consts does not require 16 byte alignment. */ - machine->Consts = (float (*)[4]) draw->user.constants; - - machine->Inputs = ALIGN16_ASSIGN(inputs); - machine->Outputs = ALIGN16_ASSIGN(outputs); - - draw->vertex_fetch.fetch_func( draw, machine, elts, count ); - - /* run shader */ -#ifdef MESA_LLVM - if (1) { - struct gallivm_prog *prog = draw->vertex_shader->llvm_prog; - gallivm_cpu_vs_exec(prog, - machine->Inputs, - machine->Outputs, - machine->Consts, - machine->Temps); - } else -#elif defined(__i386__) || defined(__386__) - if (draw->use_sse) { - /* SSE */ - /* cast away const */ - struct draw_vertex_shader *shader - = (struct draw_vertex_shader *)draw->vertex_shader; - codegen_function func - = (codegen_function) x86_get_func( &shader->sse2_program ); - - if (func) - func( - machine->Inputs, - machine->Outputs, - machine->Consts, - machine->Temps ); - else - /* interpreter */ - tgsi_exec_machine_run( machine ); - } - else -#endif - { - /* interpreter */ - tgsi_exec_machine_run( machine ); - } - - /* store machine results */ - for (j = 0; j < count; j++) { - unsigned slot; - float x, y, z, w; - - /* Handle attr[0] (position) specially: - * - * XXX: Computing the clipmask should be done in the vertex - * program as a set of DP4 instructions appended to the - * user-provided code. - */ - x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j]; - y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j]; - z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j]; - w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j]; - - vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes); - vOut[j]->edgeflag = 1; - - /* divide by w */ - w = 1.0f / w; - x *= w; - y *= w; - z *= w; - - /* Viewport mapping */ - vOut[j]->data[0][0] = x * scale[0] + trans[0]; - vOut[j]->data[0][1] = y * scale[1] + trans[1]; - vOut[j]->data[0][2] = z * scale[2] + trans[2]; - vOut[j]->data[0][3] = w; - -#if DBG_VS - debug_printf("output[%d]win: %f %f %f %f\n", j, - vOut[j]->data[0][0], - vOut[j]->data[0][1], - vOut[j]->data[0][2], - vOut[j]->data[0][3]); -#endif - /* Remaining attributes are packed into sequential post-transform - * vertex attrib slots. - */ - for (slot = 1; slot < draw->num_vs_outputs; slot++) { - vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; - vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; - vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; - vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j]; -#if DBG_VS - debug_printf("output[%d][%d]: %f %f %f %f\n", j, slot, - vOut[j]->data[slot][0], - vOut[j]->data[slot][1], - vOut[j]->data[slot][2], - vOut[j]->data[slot][3]); -#endif - } - } /* loop over vertices */ -} /** @@ -213,13 +46,14 @@ run_vertex_program(struct draw_context *draw, void draw_vertex_shader_queue_flush(struct draw_context *draw) { + struct draw_vertex_shader *shader = draw->vertex_shader; unsigned i; assert(draw->vs.queue_nr != 0); /* XXX: do this on statechange: */ - draw_update_vertex_fetch( draw ); + shader->prepare( shader, draw ); // fprintf(stderr, " q(%d) ", draw->vs.queue_nr ); @@ -242,7 +76,7 @@ draw_vertex_shader_queue_flush(struct draw_context *draw) assert(n > 0); assert(n <= 4); - run_vertex_program(draw, elts, n, dests); + shader->run(shader, draw, elts, n, dests); } draw->vs.queue_nr = 0; @@ -255,43 +89,16 @@ draw_create_vertex_shader(struct draw_context *draw, { struct draw_vertex_shader *vs; - vs = CALLOC_STRUCT( draw_vertex_shader ); - if (vs == NULL) { - return NULL; - } + vs = draw_create_vs_llvm( draw, shader ); + if (vs) + return vs; - vs->state = shader; - -#ifdef MESA_LLVM - struct gallivm_ir *ir = gallivm_ir_new(GALLIVM_VS); - gallivm_ir_set_layout(ir, GALLIVM_SOA); - gallivm_ir_set_components(ir, 4); - gallivm_ir_fill_from_tgsi(ir, shader->tokens); - vs->llvm_prog = gallivm_ir_compile(ir); - gallivm_ir_delete(ir); - - draw->engine = gallivm_global_cpu_engine(); - if (!draw->engine) { - draw->engine = gallivm_cpu_engine_create(vs->llvm_prog); - } - else { - gallivm_cpu_jit_compile(draw->engine, vs->llvm_prog); - } -#elif defined(__i386__) || defined(__386__) - if (draw->use_sse) { - /* cast-away const */ - struct pipe_shader_state *sh = (struct pipe_shader_state *) shader; - - x86_init_func( &vs->sse2_program ); - if (!tgsi_emit_sse2( (struct tgsi_token *) sh->tokens, - &vs->sse2_program )) { - x86_release_func( (struct x86_function *) &vs->sse2_program ); - fprintf(stdout /*err*/, - "tgsi_emit_sse2() failed, falling back to interpreter\n"); - } - } -#endif + vs = draw_create_vs_sse( draw, shader ); + if (vs) + return vs; + vs = draw_create_vs_exec( draw, shader ); + assert(vs); return vs; } @@ -307,11 +114,7 @@ draw_bind_vertex_shader(struct draw_context *draw, tgsi_exec_machine_init(&draw->machine); - /* specify the vertex program to interpret/execute */ - tgsi_exec_machine_bind_shader(&draw->machine, - draw->vertex_shader->state->tokens, - PIPE_MAX_SAMPLERS, - NULL /*samplers*/ ); + dvs->prepare( dvs, draw ); } @@ -319,9 +122,5 @@ void draw_delete_vertex_shader(struct draw_context *draw, struct draw_vertex_shader *dvs) { -#if defined(__i386__) || defined(__386__) - x86_release_func( (struct x86_function *) &dvs->sse2_program ); -#endif - - FREE( dvs ); + dvs->delete( dvs ); } diff --git a/src/gallium/auxiliary/draw/draw_vs.h b/src/gallium/auxiliary/draw/draw_vs.h new file mode 100644 index 00000000000..4ee7e705e93 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_vs.h @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/* Authors: Keith Whitwell + */ + +#ifndef DRAW_VS_H +#define DRAW_VS_H + +struct draw_vertex_shader; +struct draw_context; +struct pipe_shader_state; + +struct draw_vertex_shader * +draw_create_vs_exec(struct draw_context *draw, + const struct pipe_shader_state *templ); + +struct draw_vertex_shader * +draw_create_vs_sse(struct draw_context *draw, + const struct pipe_shader_state *templ); + +struct draw_vertex_shader * +draw_create_vs_llvm(struct draw_context *draw, + const struct pipe_shader_state *templ); + +#endif diff --git a/src/gallium/auxiliary/draw/draw_vs_exec.c b/src/gallium/auxiliary/draw/draw_vs_exec.c new file mode 100644 index 00000000000..8588879400a --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_vs_exec.c @@ -0,0 +1,186 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" + +#include "draw_private.h" +#include "draw_context.h" +#include "draw_vs.h" + + +static INLINE unsigned +compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr) +{ + unsigned mask = 0; + unsigned i; + + /* Do the hardwired planes first: + */ + if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT; + if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT; + if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT; + if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT; + if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT; + if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT; + + /* Followed by any remaining ones: + */ + for (i = 6; i < nr; i++) { + if (dot4(clip, plane[i]) < 0) + mask |= (1<machine, + shader->state->tokens, + PIPE_MAX_SAMPLERS, + NULL /*samplers*/ ); + + draw_update_vertex_fetch( draw ); +} + + +/** + * Transform vertices with the current vertex program/shader + * Up to four vertices can be shaded at a time. + * \param vbuffer the input vertex data + * \param elts indexes of four input vertices + * \param count number of vertices to shade [1..4] + * \param vOut array of pointers to four output vertices + */ +static void +vs_exec_run( struct draw_vertex_shader *shader, + struct draw_context *draw, + const unsigned *elts, + unsigned count, + struct vertex_header *vOut[] ) +{ + struct tgsi_exec_machine *machine = &draw->machine; + unsigned int j; + + ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX); + ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX); + const float *scale = draw->viewport.scale; + const float *trans = draw->viewport.translate; + + assert(count <= 4); + assert(draw->vertex_shader->state->output_semantic_name[0] + == TGSI_SEMANTIC_POSITION); + + machine->Consts = (float (*)[4]) draw->user.constants; + machine->Inputs = ALIGN16_ASSIGN(inputs); + machine->Outputs = ALIGN16_ASSIGN(outputs); + + draw->vertex_fetch.fetch_func( draw, machine, elts, count ); + + /* run interpreter */ + tgsi_exec_machine_run( machine ); + + + /* store machine results */ + for (j = 0; j < count; j++) { + unsigned slot; + float x, y, z, w; + + /* Handle attr[0] (position) specially: + * + * XXX: Computing the clipmask should be done in the vertex + * program as a set of DP4 instructions appended to the + * user-provided code. + */ + x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j]; + y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j]; + z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j]; + w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j]; + + vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes); + vOut[j]->edgeflag = 1; + + /* divide by w */ + w = 1.0f / w; + x *= w; + y *= w; + z *= w; + + /* Viewport mapping */ + vOut[j]->data[0][0] = x * scale[0] + trans[0]; + vOut[j]->data[0][1] = y * scale[1] + trans[1]; + vOut[j]->data[0][2] = z * scale[2] + trans[2]; + vOut[j]->data[0][3] = w; + + /* Remaining attributes are packed into sequential post-transform + * vertex attrib slots. + */ + for (slot = 1; slot < draw->num_vs_outputs; slot++) { + vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; + vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; + vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; + vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j]; + } + } /* loop over vertices */ +} + + + +static void +vs_exec_delete( struct draw_vertex_shader *dvs ) +{ + FREE( dvs ); +} + + +struct draw_vertex_shader * +draw_create_vs_exec(struct draw_context *draw, + const struct pipe_shader_state *state) +{ + struct draw_vertex_shader *vs = CALLOC_STRUCT( draw_vertex_shader ); + + if (vs == NULL) + return NULL; + + vs->state = state; + vs->prepare = vs_exec_prepare; + vs->run = vs_exec_run; + vs->delete = vs_exec_delete; + + return vs; +} diff --git a/src/gallium/auxiliary/draw/draw_vs_llvm.c b/src/gallium/auxiliary/draw/draw_vs_llvm.c new file mode 100644 index 00000000000..44022b6e077 --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_vs_llvm.c @@ -0,0 +1,237 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Zack Rusin + * Keith Whitwell + * Brian Paul + */ + +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" +#include "draw_private.h" +#include "draw_context.h" +#include "draw_vs.h" + +#ifdef MESA_LLVM + +#include "llvm/gallivm.h" + +struct draw_llvm_vertex_shader { + struct draw_vertex_shader base; + struct gallivm_prog *llvm_prog; +}; + + +static INLINE unsigned +compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr) +{ + unsigned mask = 0; + unsigned i; + + /* Do the hardwired planes first: + */ + if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT; + if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT; + if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT; + if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT; + if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT; + if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT; + + /* Followed by any remaining ones: + */ + for (i = 6; i < nr; i++) { + if (dot4(clip, plane[i]) < 0) + mask |= (1<machine; + unsigned int j; + + ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX); + ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX); + const float *scale = draw->viewport.scale; + const float *trans = draw->viewport.translate; + + + assert(count <= 4); + assert(draw->vertex_shader->state->output_semantic_name[0] + == TGSI_SEMANTIC_POSITION); + + /* Consts does not require 16 byte alignment. */ + machine->Consts = (float (*)[4]) draw->user.constants; + + machine->Inputs = ALIGN16_ASSIGN(inputs); + machine->Outputs = ALIGN16_ASSIGN(outputs); + + draw->vertex_fetch.fetch_func( draw, machine, elts, count ); + + /* run shader */ + gallivm_cpu_vs_exec(shader->llvm_prog, + machine->Inputs, + machine->Outputs, + machine->Consts, + machine->Temps); + + /* store machine results */ + for (j = 0; j < count; j++) { + unsigned slot; + float x, y, z, w; + + x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j]; + y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j]; + z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j]; + w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j]; + + vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes); + vOut[j]->edgeflag = 1; + + /* divide by w */ + w = 1.0f / w; + x *= w; + y *= w; + z *= w; + + /* Viewport mapping */ + vOut[j]->data[0][0] = x * scale[0] + trans[0]; + vOut[j]->data[0][1] = y * scale[1] + trans[1]; + vOut[j]->data[0][2] = z * scale[2] + trans[2]; + vOut[j]->data[0][3] = w; + + /* Remaining attributes are packed into sequential post-transform + * vertex attrib slots. + */ + for (slot = 1; slot < draw->num_vs_outputs; slot++) { + vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; + vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; + vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; + vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j]; + } + } /* loop over vertices */ +} + +static void +vs_llvm_delete( struct draw_vertex_shader *base ) +{ + struct draw_llvm_vertex_shader *shader = + (struct draw_llvm_vertex_shader *)base; + + /* Do something to free compiled shader: + */ + + FREE( shader ); +} + + + + +struct draw_vertex_shader * +draw_create_vs_llvm(struct draw_context *draw, + const struct pipe_shader_state *templ) +{ + struct draw_llvm_vertex_shader *vs; + + vs = CALLOC_STRUCT( draw_llvm_vertex_shader ); + if (vs == NULL) + return NULL; + + vs->base.state = templ; + vs->base.prepare = vs_llvm_prepare; + vs->base.run = vs_llvm_run; + vs->base.delete = vs_llvm_delete; + + { + struct gallivm_ir *ir = gallivm_ir_new(GALLIVM_VS); + gallivm_ir_set_layout(ir, GALLIVM_SOA); + gallivm_ir_set_components(ir, 4); + gallivm_ir_fill_from_tgsi(ir, vs->base.state->tokens); + vs->llvm_prog = gallivm_ir_compile(ir); + gallivm_ir_delete(ir); + } + + draw->engine = gallivm_global_cpu_engine(); + + /* XXX: Why are there two versions of this? Shouldn't creating the + * engine be a separate operation to compiling a shader? + */ + if (!draw->engine) { + draw->engine = gallivm_cpu_engine_create(vs->llvm_prog); + } + else { + gallivm_cpu_jit_compile(draw->engine, vs->llvm_prog); + } + + return &vs->base; +} + + + + + +#else + +struct draw_vertex_shader * +draw_create_vs_llvm(struct draw_context *draw, + const struct pipe_shader_state *shader) +{ + return NULL; +} + +#endif diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c new file mode 100644 index 00000000000..04349cb404c --- /dev/null +++ b/src/gallium/auxiliary/draw/draw_vs_sse.c @@ -0,0 +1,251 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + /* + * Authors: + * Keith Whitwell + * Brian Paul + */ + +#include "draw_vs.h" + +#if defined(__i386__) || defined(__386__) + +#include "pipe/p_util.h" +#include "pipe/p_shader_tokens.h" + +#include "draw_private.h" +#include "draw_context.h" + +#include "x86/rtasm/x86sse.h" +#include "tgsi/exec/tgsi_sse2.h" + + +typedef void (XSTDCALL *codegen_function) ( + const struct tgsi_exec_vector *input, + struct tgsi_exec_vector *output, + float (*constant)[4], + struct tgsi_exec_vector *temporary ); + + +struct draw_sse_vertex_shader { + struct draw_vertex_shader base; + struct x86_function sse2_program; + codegen_function func; +}; + + +/* Should be part of the generated shader: + */ +static INLINE unsigned +compute_clipmask(const float *clip, /*const*/ float plane[][4], unsigned nr) +{ + unsigned mask = 0; + unsigned i; + + /* Do the hardwired planes first: + */ + if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT; + if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT; + if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT; + if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT; + if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT; + if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT; + + /* Followed by any remaining ones: + */ + for (i = 6; i < nr; i++) { + if (dot4(clip, plane[i]) < 0) + mask |= (1<machine; + unsigned int j; + + ALIGN16_DECL(struct tgsi_exec_vector, inputs, PIPE_ATTRIB_MAX); + ALIGN16_DECL(struct tgsi_exec_vector, outputs, PIPE_ATTRIB_MAX); + const float *scale = draw->viewport.scale; + const float *trans = draw->viewport.translate; + + assert(count <= 4); + assert(draw->vertex_shader->state->output_semantic_name[0] + == TGSI_SEMANTIC_POSITION); + + /* Consts does not require 16 byte alignment. */ + machine->Consts = (float (*)[4]) draw->user.constants; + machine->Inputs = ALIGN16_ASSIGN(inputs); + machine->Outputs = ALIGN16_ASSIGN(outputs); + + + /* Fetch vertices. This may at some point be integrated into the + * compiled shader -- that would require a reorganization where + * multiple versions of the compiled shader might exist, + * specialized for each fetch state. + */ + draw->vertex_fetch.fetch_func( draw, machine, elts, count ); + + + /* run compiled shader + */ + shader->func( + machine->Inputs, + machine->Outputs, + machine->Consts, + machine->Temps ); + + + /* XXX: Computing the clipmask and emitting results should be done + * in the vertex program as a set of instructions appended to + * the user-provided code. + */ + for (j = 0; j < count; j++) { + unsigned slot; + float x, y, z, w; + + x = vOut[j]->clip[0] = machine->Outputs[0].xyzw[0].f[j]; + y = vOut[j]->clip[1] = machine->Outputs[0].xyzw[1].f[j]; + z = vOut[j]->clip[2] = machine->Outputs[0].xyzw[2].f[j]; + w = vOut[j]->clip[3] = machine->Outputs[0].xyzw[3].f[j]; + + vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes); + vOut[j]->edgeflag = 1; + + /* divide by w */ + w = 1.0f / w; + x *= w; + y *= w; + z *= w; + + /* Viewport mapping */ + vOut[j]->data[0][0] = x * scale[0] + trans[0]; + vOut[j]->data[0][1] = y * scale[1] + trans[1]; + vOut[j]->data[0][2] = z * scale[2] + trans[2]; + vOut[j]->data[0][3] = w; + + /* Remaining attributes are packed into sequential post-transform + * vertex attrib slots. + */ + for (slot = 1; slot < draw->num_vs_outputs; slot++) { + vOut[j]->data[slot][0] = machine->Outputs[slot].xyzw[0].f[j]; + vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j]; + vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j]; + vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j]; + } + } +} + + + +static void +vs_sse_delete( struct draw_vertex_shader *base ) +{ + struct draw_sse_vertex_shader *shader = (struct draw_sse_vertex_shader *)base; + + x86_release_func( &shader->sse2_program ); + + FREE( shader ); +} + + +struct draw_vertex_shader * +draw_create_vs_sse(struct draw_context *draw, + const struct pipe_shader_state *templ) +{ + struct draw_sse_vertex_shader *vs; + + if (!draw->use_sse) + return NULL; + + vs = CALLOC_STRUCT( draw_sse_vertex_shader ); + if (vs == NULL) + return NULL; + + vs->base.state = templ; + vs->base.prepare = vs_sse_prepare; + vs->base.run = vs_sse_run; + vs->base.delete = vs_sse_delete; + + x86_init_func( &vs->sse2_program ); + + if (!tgsi_emit_sse2( (struct tgsi_token *) vs->base.state->tokens, + &vs->sse2_program )) + goto fail; + + vs->func = (codegen_function) x86_get_func( &vs->sse2_program ); + + return &vs->base; + +fail: + fprintf(stderr, "tgsi_emit_sse2() failed, falling back to interpreter\n"); + + x86_release_func( &vs->sse2_program ); + + FREE(vs); + return NULL; +} + + + +#else + +struct draw_vertex_shader * +draw_create_vs_sse( struct draw_context *draw, + const struct pipe_shader_state *templ ) +{ + return NULL; +} + + +#endif + diff --git a/src/mesa/sources b/src/mesa/sources index cecd8a830fe..f83d247a1e2 100644 --- a/src/mesa/sources +++ b/src/mesa/sources @@ -159,6 +159,9 @@ VF_SOURCES = \ DRAW_SOURCES = \ $(TOP)/src/gallium/auxiliary/draw/draw_clip.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vs_exec.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vs_sse.c \ + $(TOP)/src/gallium/auxiliary/draw/draw_vs_llvm.c \ $(TOP)/src/gallium/auxiliary/draw/draw_context.c\ $(TOP)/src/gallium/auxiliary/draw/draw_cull.c \ $(TOP)/src/gallium/auxiliary/draw/draw_debug.c \ From c179bc990108a8ea691ceab03fd68a12396ab538 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 15 Feb 2008 13:39:24 +0000 Subject: [PATCH 67/74] tgsi: pass through failure to sse-codegenerate for fragment programs too. In particular, will fallback to interpreted execution for shaders with TEX instructions. --- src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c index 79209575bc4..62c6a69c63f 100755 --- a/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/exec/tgsi_sse2.c @@ -2308,6 +2308,7 @@ tgsi_emit_sse2_fs( { struct tgsi_parse_context parse; boolean instruction_phase = FALSE; + unsigned ok = 1; DUMP_START(); @@ -2333,7 +2334,7 @@ tgsi_emit_sse2_fs( tgsi_parse_init( &parse, tokens ); - while( !tgsi_parse_end_of_tokens( &parse ) ) { + while( !tgsi_parse_end_of_tokens( &parse ) && ok ) { tgsi_parse_token( &parse ); switch( parse.FullToken.Token.Type ) { @@ -2352,17 +2353,18 @@ tgsi_emit_sse2_fs( get_output_base(), get_argument( 1 ) ); } - emit_instruction( + ok = emit_instruction( func, &parse.FullToken.FullInstruction ); break; case TGSI_TOKEN_TYPE_IMMEDIATE: /* XXX implement this */ - assert(0); + ok = 0; break; default: + ok = 0; assert( 0 ); } } @@ -2371,7 +2373,7 @@ tgsi_emit_sse2_fs( DUMP_END(); - return 1; + return ok; } #endif /* i386 */ From 2cc0c3b99703bb10e0b320001183acb728e5488e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 18:29:51 -0800 Subject: [PATCH 68/74] Correct the convert to and from float instructions --- src/mesa/ppc/rtasm/spe_asm.c | 34 ++++++++++++++++++++++++++++++++++ src/mesa/ppc/rtasm/spe_asm.h | 12 ++++++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/mesa/ppc/rtasm/spe_asm.c b/src/mesa/ppc/rtasm/spe_asm.c index f8aff9050bf..10376372502 100644 --- a/src/mesa/ppc/rtasm/spe_asm.c +++ b/src/mesa/ppc/rtasm/spe_asm.c @@ -87,6 +87,20 @@ union spe_inst_RI7 { }; +/** + * Encode one output register with one input reg. and an 8-bit signed immed + */ +union spe_inst_RI8 { + uint32_t bits; + struct { + unsigned op:10; + unsigned i8:8; + unsigned rA:7; + unsigned rT:7; + } inst; +}; + + /** * Encode one output register with one input reg. and a 10-bit signed immed */ @@ -169,6 +183,20 @@ static void emit_RI7(struct spe_function *p, unsigned op, unsigned rT, +static void emit_RI8(struct spe_function *p, unsigned op, unsigned rT, + unsigned rA, int imm) +{ + union spe_inst_RI8 inst; + inst.inst.op = op; + inst.inst.i8 = imm; + inst.inst.rA = rA; + inst.inst.rT = rT; + *p->csr = inst.bits; + p->csr++; +} + + + static void emit_RI10(struct spe_function *p, unsigned op, unsigned rT, unsigned rA, int imm) { @@ -238,6 +266,12 @@ void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \ emit_RI7(p, _op, rT, rA, imm); \ } +#define EMIT_RI8(_name, _op) \ +void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \ +{ \ + emit_RI8(p, _op, rT, rA, 155 - imm); \ +} + #define EMIT_RI10(_name, _op) \ void _name (struct spe_function *p, unsigned rT, unsigned rA, int imm) \ { \ diff --git a/src/mesa/ppc/rtasm/spe_asm.h b/src/mesa/ppc/rtasm/spe_asm.h index 9532669b8c1..6d69ae655d1 100644 --- a/src/mesa/ppc/rtasm/spe_asm.h +++ b/src/mesa/ppc/rtasm/spe_asm.h @@ -60,6 +60,9 @@ extern void spe_release_func(struct spe_function *p); #define EMIT_RI7(_name, _op) \ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ int imm) +#define EMIT_RI8(_name, _op) \ + extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ + int imm) #define EMIT_RI10(_name, _op) \ extern void _name (struct spe_function *p, unsigned rT, unsigned rA, \ int imm) @@ -270,10 +273,10 @@ EMIT_RR (spe_dfnma, 0x35f); EMIT_R (spe_frest, 0x1b8); EMIT_R (spe_frsqest, 0x1b9); EMIT_RR (spe_fi, 0x3d4); -EMIT_RI7 (spe_csflt, 0x3da); -EMIT_RI7 (spe_cflts, 0x3d8); -EMIT_RI7 (spe_cuflt, 0x3db); -EMIT_RI7 (spe_cfltu, 0x3d9); +EMIT_RI8 (spe_csflt, 0x1da); +EMIT_RI8 (spe_cflts, 0x1d8); +EMIT_RI8 (spe_cuflt, 0x1db); +EMIT_RI8 (spe_cfltu, 0x1d9); EMIT_R (spe_frds, 0x3b9); EMIT_R (spe_fesd, 0x3b8); EMIT_RR (spe_dfceq, 0x3c3); @@ -302,6 +305,7 @@ EMIT_R (spe_wrch, 0x10d); #undef EMIT_RR #undef EMIT_RRR #undef EMIT_RI7 +#undef EMIT_RI8 #undef EMIT_RI10 #undef EMIT_RI16 #undef EMIT_RI18 From 55e64b63adfca3cba5847601b1a68e885da725a4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 14 Feb 2008 18:30:48 -0800 Subject: [PATCH 69/74] Initial version of code gen for attribute fetch --- src/mesa/pipe/cell/ppu/cell_vertex_fetch.c | 392 +++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 src/mesa/pipe/cell/ppu/cell_vertex_fetch.c diff --git a/src/mesa/pipe/cell/ppu/cell_vertex_fetch.c b/src/mesa/pipe/cell/ppu/cell_vertex_fetch.c new file mode 100644 index 00000000000..f2432f4ff52 --- /dev/null +++ b/src/mesa/pipe/cell/ppu/cell_vertex_fetch.c @@ -0,0 +1,392 @@ +/* + * (C) Copyright IBM Corporation 2008 + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * AUTHORS, COPYRIGHT HOLDERS, AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include "pipe/p_defines.h" +#include "pipe/p_context.h" +#include "pipe/p_format.h" + +#include "pipe/draw/draw_context.h" +#include "pipe/draw/draw_private.h" + +#include "pipe/cell/ppu/cell_context.h" +#include "ppc/rtasm/spe_asm.h" + +typedef uint64_t register_mask; + +int allocate_available_register(register_mask *m) +{ + unsigned i; + for (i = 0; i < 64; i++) { + const uint64_t mask = (1ULL << i); + + if ((m[0] & mask) != 0) { + m[0] &= ~mask; + return i; + } + } + + return -1; +} + + +int allocate_register(register_mask *m, unsigned reg) +{ + assert((m[0] & (1ULL << reg)) != 0); + + m[0] &= ~(1ULL << reg); + return reg; +} + + +void release_register(register_mask *m, unsigned reg) +{ + assert((m[0] & (1ULL << reg)) == 0); + + m[0] |= (1ULL << reg); +} + + +/** + * Emit a 4x4 matrix transpose operation + * + * \param p Function that the transpose operation is to be appended to + * \param m Live register mask + * \param row0 Register containing row 0 of the source matrix + * \param row1 Register containing row 1 of the source matrix + * \param row2 Register containing row 2 of the source matrix + * \param row3 Register containing row 3 of the source matrix + * \param dest_ptr Register containing the address of the destination matrix + * \param shuf_ptr Register containing the address of the shuffled data + * \param count Number of colums to actually be written to the destination + * + * \note + * This function assumes that the registers named by \c row0, \c row1, + * \c row2, and \c row3 are scratch and can be modified by the generated code. + * Furthermore, these registers will be released, via calls to + * \c release_register, by this function. + * + * \note + * This function requires that four temporary are available on entry. + */ +static void +emit_matrix_transpose(struct spe_function *p, register_mask *m, + unsigned row0, unsigned row1, unsigned row2, + unsigned row3, unsigned dest_ptr, + unsigned shuf_ptr, unsigned count) +{ + int shuf_hi = allocate_available_register(m); + int shuf_lo = allocate_available_register(m); + int t1 = allocate_available_register(m); + int t2 = allocate_available_register(m); + int t3; + int t4; + int col0; + int col1; + int col2; + int col3; + + + spe_lqd(p, shuf_hi, shuf_ptr, 3); + spe_lqd(p, shuf_lo, shuf_ptr, 4); + spe_shufb(p, t1, row0, row2, shuf_hi); + spe_shufb(p, t2, row0, row2, shuf_lo); + + + /* row0 and row2 are now no longer needed. Re-use those registers as + * temporaries. + */ + t3 = row0; + t4 = row2; + + spe_shufb(p, t3, row1, row3, shuf_hi); + spe_shufb(p, t4, row1, row3, shuf_lo); + + + /* row1 and row3 are now no longer needed. Re-use those registers as + * temporaries. + */ + col0 = row1; + col1 = row3; + + spe_shufb(p, col0, t1, t3, shuf_hi); + if (count > 1) { + spe_shufb(p, col1, t1, t3, shuf_lo); + } + + /* t1 and t3 are now no longer needed. Re-use those registers as + * temporaries. + */ + col2 = t1; + col3 = t3; + + if (count > 2) { + spe_shufb(p, col2, t2, t4, shuf_hi); + } + + if (count > 3) { + spe_shufb(p, col3, t2, t4, shuf_lo); + } + + + /* Store the results. Remember that the stqd instruction is encoded using + * the qword offset (stand-alone assemblers to the byte-offset to + * qword-offset conversion for you), so the byte-offset needs be divided by + * 16. + */ + switch (count) { + case 4: + spe_stqd(p, col3, dest_ptr, 3); + case 3: + spe_stqd(p, col2, dest_ptr, 2); + case 2: + spe_stqd(p, col1, dest_ptr, 1); + case 1: + spe_stqd(p, col0, dest_ptr, 0); + } + + + /* Release all of the temporary registers used. + */ + release_register(m, col0); + release_register(m, col1); + release_register(m, col2); + release_register(m, col3); + release_register(m, shuf_hi); + release_register(m, shuf_lo); + release_register(m, t2); + release_register(m, t4); +} + + +static void +emit_fetch(struct spe_function *p, register_mask *m, + unsigned in_ptr, unsigned *offset, + unsigned out_ptr, unsigned shuf_ptr, + enum pipe_format format) +{ + const unsigned count = (pf_size_x(format) != 0) + (pf_size_y(format) != 0) + + (pf_size_z(format) != 0) + (pf_size_w(format) != 0); + const unsigned type = pf_type(format); + const unsigned bytes = pf_size_x(format); + + int v0 = allocate_available_register(m); + int v1 = allocate_available_register(m); + int v2 = allocate_available_register(m); + int v3 = allocate_available_register(m); + int tmp = allocate_available_register(m); + int float_zero = -1; + int float_one = -1; + float scale_signed = 0.0; + float scale_unsigned = 0.0; + + spe_lqd(p, v0, in_ptr, 0 + offset[0]); + spe_lqd(p, v1, in_ptr, 1 + offset[0]); + spe_lqd(p, v2, in_ptr, 2 + offset[0]); + spe_lqd(p, v3, in_ptr, 3 + offset[0]); + offset[0] += 4; + + switch (bytes) { + case 1: + scale_signed = 1.0f / 127.0f; + scale_unsigned = 1.0f / 255.0f; + spe_lqd(p, tmp, shuf_ptr, 1); + spe_shufb(p, v0, v0, v0, tmp); + spe_shufb(p, v1, v1, v1, tmp); + spe_shufb(p, v2, v2, v2, tmp); + spe_shufb(p, v3, v3, v3, tmp); + break; + case 2: + scale_signed = 1.0f / 32767.0f; + scale_unsigned = 1.0f / 65535.0f; + spe_lqd(p, tmp, shuf_ptr, 2); + spe_shufb(p, v0, v0, v0, tmp); + spe_shufb(p, v1, v1, v1, tmp); + spe_shufb(p, v2, v2, v2, tmp); + spe_shufb(p, v3, v3, v3, tmp); + break; + case 4: + scale_signed = 1.0f / 2147483647.0f; + scale_unsigned = 1.0f / 4294967295.0f; + break; + default: + assert(0); + break; + } + + switch (type) { + case PIPE_FORMAT_TYPE_FLOAT: + break; + case PIPE_FORMAT_TYPE_UNORM: + spe_ilhu(p, tmp, ((unsigned) scale_unsigned) >> 16); + spe_iohl(p, tmp, ((unsigned) scale_unsigned) & 0x0ffff); + spe_cuflt(p, v0, v0, 0); + spe_fm(p, v0, v0, tmp); + break; + case PIPE_FORMAT_TYPE_SNORM: + spe_ilhu(p, tmp, ((unsigned) scale_signed) >> 16); + spe_iohl(p, tmp, ((unsigned) scale_signed) & 0x0ffff); + spe_csflt(p, v0, v0, 0); + spe_fm(p, v0, v0, tmp); + break; + case PIPE_FORMAT_TYPE_USCALED: + spe_cuflt(p, v0, v0, 0); + break; + case PIPE_FORMAT_TYPE_SSCALED: + spe_csflt(p, v0, v0, 0); + break; + } + + + if (count < 4) { + float_one = allocate_available_register(m); + spe_il(p, float_one, 1); + spe_cuflt(p, float_one, float_one, 0); + + if (count < 3) { + float_zero = allocate_available_register(m); + spe_il(p, float_zero, 0); + } + } + + release_register(m, tmp); + + emit_matrix_transpose(p, m, v0, v1, v2, v3, out_ptr, shuf_ptr, count); + + switch (count) { + case 1: + spe_stqd(p, float_zero, out_ptr, 1); + case 2: + spe_stqd(p, float_zero, out_ptr, 2); + case 3: + spe_stqd(p, float_one, out_ptr, 3); + } + + if (float_zero != -1) { + release_register(m, float_zero); + } + + if (float_one != -1) { + release_register(m, float_one); + } +} + + +void cell_update_vertex_fetch(struct draw_context *draw) +{ + struct cell_context *const cell = + (struct cell_context *) draw->driver_private; + register_mask m = ~0; + struct spe_function *p = &cell->attrib_fetch; + unsigned function_index[PIPE_ATTRIB_MAX]; + unsigned unique_attr_formats; + int out_ptr; + int in_ptr; + int shuf_ptr; + unsigned i; + unsigned j; + + + /* Determine how many unique input attribute formats there are. At the + * same time, store the index of the lowest numbered attribute that has + * the same format as any non-unique format. + */ + unique_attr_formats = 1; + function_index[0] = 0; + for (i = 1; i < draw->vertex_fetch.nr_attrs; i++) { + const enum pipe_format curr_fmt = draw->vertex_element[i].src_format; + + for (j = 0; j < i; j++) { + if (curr_fmt == draw->vertex_element[j].src_format) { + break; + } + } + + if (j == i) { + unique_attr_formats++; + } + + function_index[i] = j; + } + + + /* Each fetch function can be a maximum of 34 instructions (note: this is + * actually a slight over-estimate). That means (34 * 4) = 136 bytes + * each maximum. + */ + spe_init_func(p, 136 * unique_attr_formats); + + + /* Registers 0, 1, and 2 are reserved by the ABI. + */ + allocate_register(&m, 0); + allocate_register(&m, 1); + allocate_register(&m, 2); + + + /* Allocate registers for the function's input parameters. + */ + out_ptr = allocate_register(&m, 3); + in_ptr = allocate_register(&m, 4); + shuf_ptr = allocate_register(&m, 5); + + + /* Generate code for the individual attribute fetch functions. + */ + for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) { + unsigned offset; + + if (function_index[i] == i) { + cell->attrib_fetch_offsets[i] = (unsigned) ((void *) p->csr + - (void *) p->store); + + offset = 0; + emit_fetch(p, & m, in_ptr, &offset, out_ptr, shuf_ptr, + draw->vertex_element[i].src_format); + spe_bi(p, 0, 0, 0); + + /* Round up to the next 16-byte boundary. + */ + if ((((unsigned) p->store) & 0x0f) != 0) { + const unsigned align = ((unsigned) p->store) & 0x0f; + p->store = (uint32_t *) (((void *) p->store) + align); + } + } else { + /* Use the same function entry-point as a previously seen attribute + * with the same format. + */ + cell->attrib_fetch_offsets[i] = + cell->attrib_fetch_offsets[function_index[i]]; + } + } + + static first_time = 1; + if (first_time) { + first_time = 0; + const unsigned instructions = p->csr - p->store; + for (i = 0; i < instructions; i++) { + printf("\t.long\t0x%08x\n", p->store[i]); + } + } +} From 397b81bd1c7984b1667af7ef954e053263a7a661 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 15 Feb 2008 09:43:13 -0800 Subject: [PATCH 70/74] Move cell_vertex_fetch.c for recent code reorg. --- src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vertex_fetch.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{mesa/pipe => gallium/drivers}/cell/ppu/cell_vertex_fetch.c (100%) diff --git a/src/mesa/pipe/cell/ppu/cell_vertex_fetch.c b/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c similarity index 100% rename from src/mesa/pipe/cell/ppu/cell_vertex_fetch.c rename to src/gallium/drivers/cell/ppu/cell_vertex_fetch.c From b08d3fa249c830d274dca362b8f824b75fe26945 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 15 Feb 2008 10:00:31 -0800 Subject: [PATCH 71/74] Make this file build on non-SSE builds (e.g., Cell) --- src/gallium/auxiliary/draw/draw_vs_sse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/draw/draw_vs_sse.c b/src/gallium/auxiliary/draw/draw_vs_sse.c index 04349cb404c..27bc66812c3 100644 --- a/src/gallium/auxiliary/draw/draw_vs_sse.c +++ b/src/gallium/auxiliary/draw/draw_vs_sse.c @@ -243,7 +243,7 @@ struct draw_vertex_shader * draw_create_vs_sse( struct draw_context *draw, const struct pipe_shader_state *templ ) { - return NULL; + return (void *) 0; } From eb3f7aa6f8615a2788714e1535d87b4814ebdda3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 15 Feb 2008 10:33:12 -0800 Subject: [PATCH 72/74] Cell: Add INCLUDE_DIRS to SPU_CFLAGS to fix build. --- configs/linux-cell | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configs/linux-cell b/configs/linux-cell index fdf20deeeb0..fbd6c36a09f 100644 --- a/configs/linux-cell +++ b/configs/linux-cell @@ -36,7 +36,9 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \ SPU_CC = spu-gcc -SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main -I. -I $(SDK)/spu/include -include spu_intrinsics.h -I $(TOP)/src/mesa/ +SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main + -I. -I$(SDK)/spu/include -I$(TOP)/src/mesa/ $(INCLUDE_DIRS) \ + -include spu_intrinsics.h SPU_LFLAGS = -L$(SDK)/spu/lib -Wl,-N -lmisc From 71071b7a9e8e9cdd3ef9648e70bde04507516765 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 15 Feb 2008 10:36:48 -0800 Subject: [PATCH 73/74] Cell: Add missing back-slash in linux-cell config file --- configs/linux-cell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/linux-cell b/configs/linux-cell index fbd6c36a09f..09f62fc1ff0 100644 --- a/configs/linux-cell +++ b/configs/linux-cell @@ -36,7 +36,7 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \ SPU_CC = spu-gcc -SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main +SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main \ -I. -I$(SDK)/spu/include -I$(TOP)/src/mesa/ $(INCLUDE_DIRS) \ -include spu_intrinsics.h From 3320b1874e810583f95b93a89697b2955987b84f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 15 Feb 2008 11:03:54 -0800 Subject: [PATCH 74/74] Cell: Enable code gen for SPE attribute fetch Doubles are still unsupported. --- src/gallium/drivers/cell/common.h | 15 +- src/gallium/drivers/cell/ppu/Makefile | 1 + src/gallium/drivers/cell/ppu/cell_context.h | 4 + .../drivers/cell/ppu/cell_vertex_fetch.c | 15 +- .../drivers/cell/ppu/cell_vertex_shader.c | 21 +- src/gallium/drivers/cell/spu/spu_main.c | 22 +- .../drivers/cell/spu/spu_vertex_fetch.c | 477 +----------------- .../drivers/cell/spu/spu_vertex_shader.h | 6 +- 8 files changed, 71 insertions(+), 490 deletions(-) diff --git a/src/gallium/drivers/cell/common.h b/src/gallium/drivers/cell/common.h index 4de514c3586..74b131fbefc 100644 --- a/src/gallium/drivers/cell/common.h +++ b/src/gallium/drivers/cell/common.h @@ -90,6 +90,7 @@ #define CELL_CMD_STATE_VS_ARRAY_INFO 16 #define CELL_CMD_STATE_BLEND 17 #define CELL_CMD_VS_EXECUTE 18 +#define CELL_CMD_STATE_ATTRIB_FETCH 19 #define CELL_NUM_BUFFERS 4 @@ -128,13 +129,19 @@ struct cell_command_clear_surface */ struct cell_array_info { - uint64_t base; /**< Base address of the 0th element. */ - uint attr; /**< Attribute that this state is for. */ - uint pitch; /**< Byte pitch from one entry to the next. */ - uint format; /**< Pipe format of each entry. */ + uint64_t base; /**< Base address of the 0th element. */ + uint attr; /**< Attribute that this state is for. */ + uint pitch; /**< Byte pitch from one entry to the next. */ + uint size; + uint function_offset; } ALIGN16_ATTRIB; +struct cell_attribute_fetch_code { + uint64_t base; + uint size; +}; + struct cell_shader_info { unsigned num_outputs; diff --git a/src/gallium/drivers/cell/ppu/Makefile b/src/gallium/drivers/cell/ppu/Makefile index a4c3f29e8a4..196ab777f54 100644 --- a/src/gallium/drivers/cell/ppu/Makefile +++ b/src/gallium/drivers/cell/ppu/Makefile @@ -34,6 +34,7 @@ SOURCES = \ cell_surface.c \ cell_texture.c \ cell_vbuf.c \ + cell_vertex_fetch.c \ cell_vertex_shader.c \ cell_winsys.c diff --git a/src/gallium/drivers/cell/ppu/cell_context.h b/src/gallium/drivers/cell/ppu/cell_context.h index 6196c0c72f9..91f8e542a25 100644 --- a/src/gallium/drivers/cell/ppu/cell_context.h +++ b/src/gallium/drivers/cell/ppu/cell_context.h @@ -36,6 +36,7 @@ #include "draw/draw_vbuf.h" #include "cell_winsys.h" #include "cell/common.h" +#include "ppc/rtasm/spe_asm.h" struct cell_vbuf_render; @@ -111,6 +112,9 @@ struct cell_context /** [4] to ensure 16-byte alignment for each status word */ uint buffer_status[CELL_MAX_SPUS][CELL_NUM_BUFFERS][4] ALIGN16_ATTRIB; + + struct spe_function attrib_fetch; + unsigned attrib_fetch_offsets[PIPE_ATTRIB_MAX]; }; diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c b/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c index f2432f4ff52..f10689a959e 100644 --- a/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c +++ b/src/gallium/drivers/cell/ppu/cell_vertex_fetch.c @@ -27,10 +27,10 @@ #include "pipe/p_context.h" #include "pipe/p_format.h" -#include "pipe/draw/draw_context.h" -#include "pipe/draw/draw_private.h" +#include "../auxiliary/draw/draw_context.h" +#include "../auxiliary/draw/draw_private.h" -#include "pipe/cell/ppu/cell_context.h" +#include "cell_context.h" #include "ppc/rtasm/spe_asm.h" typedef uint64_t register_mask; @@ -380,13 +380,4 @@ void cell_update_vertex_fetch(struct draw_context *draw) cell->attrib_fetch_offsets[function_index[i]]; } } - - static first_time = 1; - if (first_time) { - first_time = 0; - const unsigned instructions = p->csr - p->store; - for (i = 0; i < instructions; i++) { - printf("\t.long\t0x%08x\n", p->store[i]); - } - } } diff --git a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c index 0ba4506505e..6a1d3bc20a1 100644 --- a/src/gallium/drivers/cell/ppu/cell_vertex_shader.c +++ b/src/gallium/drivers/cell/ppu/cell_vertex_shader.c @@ -55,14 +55,32 @@ cell_vertex_shader_queue_flush(struct draw_context *draw) uint64_t *batch; struct cell_array_info *array_info; unsigned i, j; + struct cell_attribute_fetch_code *cf; assert(draw->vs.queue_nr != 0); /* XXX: do this on statechange: */ draw_update_vertex_fetch(draw); + cell_update_vertex_fetch(draw); + + + batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*cf)); + batch[0] = CELL_CMD_STATE_ATTRIB_FETCH; + cf = (struct cell_attribute_fetch_code *) (&batch[1]); + cf->base = cell->attrib_fetch.store; + cf->size = ROUNDUP16((unsigned)((void *) cell->attrib_fetch.csr + - (void *) cell->attrib_fetch.store)); + for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) { + const enum pipe_format format = draw->vertex_element[i].src_format; + const unsigned count = ((pf_size_x(format) != 0) + + (pf_size_y(format) != 0) + + (pf_size_z(format) != 0) + + (pf_size_w(format) != 0)); + const unsigned size = pf_size_x(format) * count; + batch = cell_batch_alloc(cell, sizeof(batch[0]) + sizeof(*array_info)); batch[0] = CELL_CMD_STATE_VS_ARRAY_INFO; @@ -72,7 +90,8 @@ cell_vertex_shader_queue_flush(struct draw_context *draw) array_info->base = (uintptr_t) draw->vertex_fetch.src_ptr[i]; array_info->attr = i; array_info->pitch = draw->vertex_fetch.pitch[i]; - array_info->format = draw->vertex_element[i].src_format; + array_info->size = size; + array_info->function_offset = cell->attrib_fetch_offsets[i]; } batch = cell_batch_alloc(cell, sizeof(batch[0]) diff --git a/src/gallium/drivers/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c index 1e7243b8639..fcbf0f841e6 100644 --- a/src/gallium/drivers/cell/spu/spu_main.c +++ b/src/gallium/drivers/cell/spu/spu_main.c @@ -54,6 +54,9 @@ struct spu_global spu; struct spu_vs_context draw; +static unsigned char attribute_fetch_code_buffer[136 * PIPE_ATTRIB_MAX] + ALIGN16_ATTRIB; + /** * Tell the PPU that this SPU has finished copying a buffer to * local store and that it may be reused by the PPU. @@ -306,7 +309,8 @@ cmd_state_vs_array_info(const struct cell_array_info *vs_info) ASSERT(attr < PIPE_ATTRIB_MAX); draw.vertex_fetch.src_ptr[attr] = vs_info->base; draw.vertex_fetch.pitch[attr] = vs_info->pitch; - draw.vertex_fetch.format[attr] = vs_info->format; + draw.vertex_fetch.size[attr] = vs_info->size; + draw.vertex_fetch.code_offset[attr] = vs_info->function_offset; draw.vertex_fetch.dirty = 1; } @@ -433,6 +437,22 @@ cmd_batch(uint opcode) cmd_state_vs_array_info((struct cell_array_info *) &buffer[pos+1]); pos += (1 + ROUNDUP8(sizeof(struct cell_array_info)) / 8); break; + case CELL_CMD_STATE_ATTRIB_FETCH: { + struct cell_attribute_fetch_code *code = + (struct cell_attribute_fetch_code *) &buffer[pos+1]; + + mfc_get(attribute_fetch_code_buffer, + (unsigned int) code->base, /* src */ + code->size, + TAG_BATCH_BUFFER, + 0, /* tid */ + 0 /* rid */); + wait_on_mask(1 << TAG_BATCH_BUFFER); + + draw.vertex_fetch.code = attribute_fetch_code_buffer; + pos += (1 + ROUNDUP8(sizeof(struct cell_attribute_fetch_code)) / 8); + break; + } default: printf("SPU %u: bad opcode: 0x%llx\n", spu.init.id, buffer[pos]); ASSERT(0); diff --git a/src/gallium/drivers/cell/spu/spu_vertex_fetch.c b/src/gallium/drivers/cell/spu/spu_vertex_fetch.c index 45e3c26c001..55c6c287175 100644 --- a/src/gallium/drivers/cell/spu/spu_vertex_fetch.c +++ b/src/gallium/drivers/cell/spu/spu_vertex_fetch.c @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * (C) Copyright IBM Corporation 2008 * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -28,10 +29,10 @@ /* * Authors: * Keith Whitwell + * Ian Romanick */ #include -#include #include "pipe/p_util.h" #include "pipe/p_state.h" @@ -59,6 +60,10 @@ #define DRAW_DBG 0 +typedef void (*spu_fetch_func)(qword *out, const qword *in, + const qword *shuffle_data); + + static const qword fetch_shuffle_data[] = { /* Shuffle used by CVT_64_FLOAT */ @@ -97,22 +102,6 @@ static const qword fetch_shuffle_data[] = { }; -static INLINE void -trans4x4(qword row0, qword row1, qword row2, qword row3, qword *out, - const qword *shuffle) -{ - qword t1 = si_shufb(row0, row2, shuffle[3]); - qword t2 = si_shufb(row0, row2, shuffle[4]); - qword t3 = si_shufb(row1, row3, shuffle[3]); - qword t4 = si_shufb(row1, row3, shuffle[4]); - - out[0] = si_shufb(t1, t3, shuffle[3]); - out[1] = si_shufb(t1, t3, shuffle[4]); - out[2] = si_shufb(t2, t4, shuffle[3]); - out[3] = si_shufb(t2, t4, shuffle[4]); -} - - /** * Fetch between 1 and 32 bytes from an unaligned address */ @@ -151,446 +140,6 @@ fetch_unaligned(qword *dst, unsigned ea, unsigned size) } -#define CVT_32_FLOAT(q, s) (*(q)) - -static INLINE qword -CVT_64_FLOAT(const qword *qw, const qword *shuffle) -{ - qword a = si_frds(qw[0]); - qword b = si_frds(si_rotqbyi(qw[0], 8)); - qword c = si_frds(qw[1]); - qword d = si_frds(si_rotqbyi(qw[1], 8)); - - qword ab = si_shufb(a, b, shuffle[0]); - qword cd = si_shufb(c, d, si_rotqbyi(shuffle[0], 8)); - - return si_or(ab, cd); -} - - -static INLINE qword -CVT_8_USCALED(const qword *qw, const qword *shuffle) -{ - return si_cuflt(si_shufb(*qw, *qw, shuffle[1]), 0); -} - - -static INLINE qword -CVT_16_USCALED(const qword *qw, const qword *shuffle) -{ - return si_cuflt(si_shufb(*qw, *qw, shuffle[2]), 0); -} - - -static INLINE qword -CVT_32_USCALED(const qword *qw, const qword *shuffle) -{ - (void) shuffle; - return si_cuflt(*qw, 0); -} - -static INLINE qword -CVT_8_SSCALED(const qword *qw, const qword *shuffle) -{ - return si_csflt(si_shufb(*qw, *qw, shuffle[1]), 0); -} - - -static INLINE qword -CVT_16_SSCALED(const qword *qw, const qword *shuffle) -{ - return si_csflt(si_shufb(*qw, *qw, shuffle[2]), 0); -} - - -static INLINE qword -CVT_32_SSCALED(const qword *qw, const qword *shuffle) -{ - (void) shuffle; - return si_csflt(*qw, 0); -} - - -static INLINE qword -CVT_8_UNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 255.0f); - return si_fm(CVT_8_USCALED(qw, shuffle), scale); -} - - -static INLINE qword -CVT_16_UNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 65535.0f); - return si_fm(CVT_16_USCALED(qw, shuffle), scale); -} - - -static INLINE qword -CVT_32_UNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 4294967295.0f); - return si_fm(CVT_32_USCALED(qw, shuffle), scale); -} - - -static INLINE qword -CVT_8_SNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 127.0f); - return si_fm(CVT_8_SSCALED(qw, shuffle), scale); -} - - -static INLINE qword -CVT_16_SNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 32767.0f); - return si_fm(CVT_16_SSCALED(qw, shuffle), scale); -} - - -static INLINE qword -CVT_32_SNORM(const qword *qw, const qword *shuffle) -{ - const qword scale = (qword) spu_splats(1.0f / 2147483647.0f); - return si_fm(CVT_32_SSCALED(qw, shuffle), scale); -} - -#define SZ_4 si_il(0U) -#define SZ_3 si_fsmbi(0x000f) -#define SZ_2 si_fsmbi(0x00ff) -#define SZ_1 si_fsmbi(0x0fff) - -/** - * Fetch a float[4] vertex attribute from memory, doing format/type - * conversion as needed. - * - * This is probably needed/dupliocated elsewhere, eg format - * conversion, texture sampling etc. - */ -#define FETCH_ATTRIB( NAME, SZ, CVT, N ) \ -static void \ -fetch_##NAME(qword *out, const qword *in, qword defaults, \ - const qword *shuffle) \ -{ \ - qword tmp[4]; \ - \ - tmp[0] = si_selb(CVT(in + (0 * N), shuffle), defaults, SZ); \ - tmp[1] = si_selb(CVT(in + (1 * N), shuffle), defaults, SZ); \ - tmp[2] = si_selb(CVT(in + (2 * N), shuffle), defaults, SZ); \ - tmp[3] = si_selb(CVT(in + (3 * N), shuffle), defaults, SZ); \ - trans4x4(tmp[0], tmp[1], tmp[2], tmp[3], out, shuffle); \ -} - - -FETCH_ATTRIB( R64G64B64A64_FLOAT, SZ_4, CVT_64_FLOAT, 2 ) -FETCH_ATTRIB( R64G64B64_FLOAT, SZ_3, CVT_64_FLOAT, 2 ) -FETCH_ATTRIB( R64G64_FLOAT, SZ_2, CVT_64_FLOAT, 2 ) -FETCH_ATTRIB( R64_FLOAT, SZ_1, CVT_64_FLOAT, 2 ) - -FETCH_ATTRIB( R32G32B32A32_FLOAT, SZ_4, CVT_32_FLOAT, 1 ) -FETCH_ATTRIB( R32G32B32_FLOAT, SZ_3, CVT_32_FLOAT, 1 ) -FETCH_ATTRIB( R32G32_FLOAT, SZ_2, CVT_32_FLOAT, 1 ) -FETCH_ATTRIB( R32_FLOAT, SZ_1, CVT_32_FLOAT, 1 ) - -FETCH_ATTRIB( R32G32B32A32_USCALED, SZ_4, CVT_32_USCALED, 1 ) -FETCH_ATTRIB( R32G32B32_USCALED, SZ_3, CVT_32_USCALED, 1 ) -FETCH_ATTRIB( R32G32_USCALED, SZ_2, CVT_32_USCALED, 1 ) -FETCH_ATTRIB( R32_USCALED, SZ_1, CVT_32_USCALED, 1 ) - -FETCH_ATTRIB( R32G32B32A32_SSCALED, SZ_4, CVT_32_SSCALED, 1 ) -FETCH_ATTRIB( R32G32B32_SSCALED, SZ_3, CVT_32_SSCALED, 1 ) -FETCH_ATTRIB( R32G32_SSCALED, SZ_2, CVT_32_SSCALED, 1 ) -FETCH_ATTRIB( R32_SSCALED, SZ_1, CVT_32_SSCALED, 1 ) - -FETCH_ATTRIB( R32G32B32A32_UNORM, SZ_4, CVT_32_UNORM, 1 ) -FETCH_ATTRIB( R32G32B32_UNORM, SZ_3, CVT_32_UNORM, 1 ) -FETCH_ATTRIB( R32G32_UNORM, SZ_2, CVT_32_UNORM, 1 ) -FETCH_ATTRIB( R32_UNORM, SZ_1, CVT_32_UNORM, 1 ) - -FETCH_ATTRIB( R32G32B32A32_SNORM, SZ_4, CVT_32_SNORM, 1 ) -FETCH_ATTRIB( R32G32B32_SNORM, SZ_3, CVT_32_SNORM, 1 ) -FETCH_ATTRIB( R32G32_SNORM, SZ_2, CVT_32_SNORM, 1 ) -FETCH_ATTRIB( R32_SNORM, SZ_1, CVT_32_SNORM, 1 ) - -FETCH_ATTRIB( R16G16B16A16_USCALED, SZ_4, CVT_16_USCALED, 1 ) -FETCH_ATTRIB( R16G16B16_USCALED, SZ_3, CVT_16_USCALED, 1 ) -FETCH_ATTRIB( R16G16_USCALED, SZ_2, CVT_16_USCALED, 1 ) -FETCH_ATTRIB( R16_USCALED, SZ_1, CVT_16_USCALED, 1 ) - -FETCH_ATTRIB( R16G16B16A16_SSCALED, SZ_4, CVT_16_SSCALED, 1 ) -FETCH_ATTRIB( R16G16B16_SSCALED, SZ_3, CVT_16_SSCALED, 1 ) -FETCH_ATTRIB( R16G16_SSCALED, SZ_2, CVT_16_SSCALED, 1 ) -FETCH_ATTRIB( R16_SSCALED, SZ_1, CVT_16_SSCALED, 1 ) - -FETCH_ATTRIB( R16G16B16A16_UNORM, SZ_4, CVT_16_UNORM, 1 ) -FETCH_ATTRIB( R16G16B16_UNORM, SZ_3, CVT_16_UNORM, 1 ) -FETCH_ATTRIB( R16G16_UNORM, SZ_2, CVT_16_UNORM, 1 ) -FETCH_ATTRIB( R16_UNORM, SZ_1, CVT_16_UNORM, 1 ) - -FETCH_ATTRIB( R16G16B16A16_SNORM, SZ_4, CVT_16_SNORM, 1 ) -FETCH_ATTRIB( R16G16B16_SNORM, SZ_3, CVT_16_SNORM, 1 ) -FETCH_ATTRIB( R16G16_SNORM, SZ_2, CVT_16_SNORM, 1 ) -FETCH_ATTRIB( R16_SNORM, SZ_1, CVT_16_SNORM, 1 ) - -FETCH_ATTRIB( R8G8B8A8_USCALED, SZ_4, CVT_8_USCALED, 1 ) -FETCH_ATTRIB( R8G8B8_USCALED, SZ_3, CVT_8_USCALED, 1 ) -FETCH_ATTRIB( R8G8_USCALED, SZ_2, CVT_8_USCALED, 1 ) -FETCH_ATTRIB( R8_USCALED, SZ_1, CVT_8_USCALED, 1 ) - -FETCH_ATTRIB( R8G8B8A8_SSCALED, SZ_4, CVT_8_SSCALED, 1 ) -FETCH_ATTRIB( R8G8B8_SSCALED, SZ_3, CVT_8_SSCALED, 1 ) -FETCH_ATTRIB( R8G8_SSCALED, SZ_2, CVT_8_SSCALED, 1 ) -FETCH_ATTRIB( R8_SSCALED, SZ_1, CVT_8_SSCALED, 1 ) - -FETCH_ATTRIB( R8G8B8A8_UNORM, SZ_4, CVT_8_UNORM, 1 ) -FETCH_ATTRIB( R8G8B8_UNORM, SZ_3, CVT_8_UNORM, 1 ) -FETCH_ATTRIB( R8G8_UNORM, SZ_2, CVT_8_UNORM, 1 ) -FETCH_ATTRIB( R8_UNORM, SZ_1, CVT_8_UNORM, 1 ) - -FETCH_ATTRIB( R8G8B8A8_SNORM, SZ_4, CVT_8_SNORM, 1 ) -FETCH_ATTRIB( R8G8B8_SNORM, SZ_3, CVT_8_SNORM, 1 ) -FETCH_ATTRIB( R8G8_SNORM, SZ_2, CVT_8_SNORM, 1 ) -FETCH_ATTRIB( R8_SNORM, SZ_1, CVT_8_SNORM, 1 ) - -FETCH_ATTRIB( A8R8G8B8_UNORM, SZ_4, CVT_8_UNORM, 1 ) - - - -static spu_fetch_func get_fetch_func( enum pipe_format format ) -{ - switch (format) { - case PIPE_FORMAT_R64_FLOAT: - return fetch_R64_FLOAT; - case PIPE_FORMAT_R64G64_FLOAT: - return fetch_R64G64_FLOAT; - case PIPE_FORMAT_R64G64B64_FLOAT: - return fetch_R64G64B64_FLOAT; - case PIPE_FORMAT_R64G64B64A64_FLOAT: - return fetch_R64G64B64A64_FLOAT; - - case PIPE_FORMAT_R32_FLOAT: - return fetch_R32_FLOAT; - case PIPE_FORMAT_R32G32_FLOAT: - return fetch_R32G32_FLOAT; - case PIPE_FORMAT_R32G32B32_FLOAT: - return fetch_R32G32B32_FLOAT; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return fetch_R32G32B32A32_FLOAT; - - case PIPE_FORMAT_R32_UNORM: - return fetch_R32_UNORM; - case PIPE_FORMAT_R32G32_UNORM: - return fetch_R32G32_UNORM; - case PIPE_FORMAT_R32G32B32_UNORM: - return fetch_R32G32B32_UNORM; - case PIPE_FORMAT_R32G32B32A32_UNORM: - return fetch_R32G32B32A32_UNORM; - - case PIPE_FORMAT_R32_USCALED: - return fetch_R32_USCALED; - case PIPE_FORMAT_R32G32_USCALED: - return fetch_R32G32_USCALED; - case PIPE_FORMAT_R32G32B32_USCALED: - return fetch_R32G32B32_USCALED; - case PIPE_FORMAT_R32G32B32A32_USCALED: - return fetch_R32G32B32A32_USCALED; - - case PIPE_FORMAT_R32_SNORM: - return fetch_R32_SNORM; - case PIPE_FORMAT_R32G32_SNORM: - return fetch_R32G32_SNORM; - case PIPE_FORMAT_R32G32B32_SNORM: - return fetch_R32G32B32_SNORM; - case PIPE_FORMAT_R32G32B32A32_SNORM: - return fetch_R32G32B32A32_SNORM; - - case PIPE_FORMAT_R32_SSCALED: - return fetch_R32_SSCALED; - case PIPE_FORMAT_R32G32_SSCALED: - return fetch_R32G32_SSCALED; - case PIPE_FORMAT_R32G32B32_SSCALED: - return fetch_R32G32B32_SSCALED; - case PIPE_FORMAT_R32G32B32A32_SSCALED: - return fetch_R32G32B32A32_SSCALED; - - case PIPE_FORMAT_R16_UNORM: - return fetch_R16_UNORM; - case PIPE_FORMAT_R16G16_UNORM: - return fetch_R16G16_UNORM; - case PIPE_FORMAT_R16G16B16_UNORM: - return fetch_R16G16B16_UNORM; - case PIPE_FORMAT_R16G16B16A16_UNORM: - return fetch_R16G16B16A16_UNORM; - - case PIPE_FORMAT_R16_USCALED: - return fetch_R16_USCALED; - case PIPE_FORMAT_R16G16_USCALED: - return fetch_R16G16_USCALED; - case PIPE_FORMAT_R16G16B16_USCALED: - return fetch_R16G16B16_USCALED; - case PIPE_FORMAT_R16G16B16A16_USCALED: - return fetch_R16G16B16A16_USCALED; - - case PIPE_FORMAT_R16_SNORM: - return fetch_R16_SNORM; - case PIPE_FORMAT_R16G16_SNORM: - return fetch_R16G16_SNORM; - case PIPE_FORMAT_R16G16B16_SNORM: - return fetch_R16G16B16_SNORM; - case PIPE_FORMAT_R16G16B16A16_SNORM: - return fetch_R16G16B16A16_SNORM; - - case PIPE_FORMAT_R16_SSCALED: - return fetch_R16_SSCALED; - case PIPE_FORMAT_R16G16_SSCALED: - return fetch_R16G16_SSCALED; - case PIPE_FORMAT_R16G16B16_SSCALED: - return fetch_R16G16B16_SSCALED; - case PIPE_FORMAT_R16G16B16A16_SSCALED: - return fetch_R16G16B16A16_SSCALED; - - case PIPE_FORMAT_R8_UNORM: - return fetch_R8_UNORM; - case PIPE_FORMAT_R8G8_UNORM: - return fetch_R8G8_UNORM; - case PIPE_FORMAT_R8G8B8_UNORM: - return fetch_R8G8B8_UNORM; - case PIPE_FORMAT_R8G8B8A8_UNORM: - return fetch_R8G8B8A8_UNORM; - - case PIPE_FORMAT_R8_USCALED: - return fetch_R8_USCALED; - case PIPE_FORMAT_R8G8_USCALED: - return fetch_R8G8_USCALED; - case PIPE_FORMAT_R8G8B8_USCALED: - return fetch_R8G8B8_USCALED; - case PIPE_FORMAT_R8G8B8A8_USCALED: - return fetch_R8G8B8A8_USCALED; - - case PIPE_FORMAT_R8_SNORM: - return fetch_R8_SNORM; - case PIPE_FORMAT_R8G8_SNORM: - return fetch_R8G8_SNORM; - case PIPE_FORMAT_R8G8B8_SNORM: - return fetch_R8G8B8_SNORM; - case PIPE_FORMAT_R8G8B8A8_SNORM: - return fetch_R8G8B8A8_SNORM; - - case PIPE_FORMAT_R8_SSCALED: - return fetch_R8_SSCALED; - case PIPE_FORMAT_R8G8_SSCALED: - return fetch_R8G8_SSCALED; - case PIPE_FORMAT_R8G8B8_SSCALED: - return fetch_R8G8B8_SSCALED; - case PIPE_FORMAT_R8G8B8A8_SSCALED: - return fetch_R8G8B8A8_SSCALED; - - case PIPE_FORMAT_A8R8G8B8_UNORM: - return fetch_A8R8G8B8_UNORM; - - case 0: - return NULL; /* not sure why this is needed */ - - default: - assert(0); - return NULL; - } -} - - -static unsigned get_vertex_size( enum pipe_format format ) -{ - switch (format) { - case PIPE_FORMAT_R64_FLOAT: - return 8; - case PIPE_FORMAT_R64G64_FLOAT: - return 2 * 8; - case PIPE_FORMAT_R64G64B64_FLOAT: - return 3 * 8; - case PIPE_FORMAT_R64G64B64A64_FLOAT: - return 4 * 8; - - case PIPE_FORMAT_R32_SSCALED: - case PIPE_FORMAT_R32_SNORM: - case PIPE_FORMAT_R32_USCALED: - case PIPE_FORMAT_R32_UNORM: - case PIPE_FORMAT_R32_FLOAT: - return 4; - case PIPE_FORMAT_R32G32_SSCALED: - case PIPE_FORMAT_R32G32_SNORM: - case PIPE_FORMAT_R32G32_USCALED: - case PIPE_FORMAT_R32G32_UNORM: - case PIPE_FORMAT_R32G32_FLOAT: - return 2 * 4; - case PIPE_FORMAT_R32G32B32_SSCALED: - case PIPE_FORMAT_R32G32B32_SNORM: - case PIPE_FORMAT_R32G32B32_USCALED: - case PIPE_FORMAT_R32G32B32_UNORM: - case PIPE_FORMAT_R32G32B32_FLOAT: - return 3 * 4; - case PIPE_FORMAT_R32G32B32A32_SSCALED: - case PIPE_FORMAT_R32G32B32A32_SNORM: - case PIPE_FORMAT_R32G32B32A32_USCALED: - case PIPE_FORMAT_R32G32B32A32_UNORM: - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return 4 * 4; - - case PIPE_FORMAT_R16_SSCALED: - case PIPE_FORMAT_R16_SNORM: - case PIPE_FORMAT_R16_UNORM: - case PIPE_FORMAT_R16_USCALED: - return 2; - case PIPE_FORMAT_R16G16_SSCALED: - case PIPE_FORMAT_R16G16_SNORM: - case PIPE_FORMAT_R16G16_USCALED: - case PIPE_FORMAT_R16G16_UNORM: - return 2 * 2; - case PIPE_FORMAT_R16G16B16_SSCALED: - case PIPE_FORMAT_R16G16B16_SNORM: - case PIPE_FORMAT_R16G16B16_USCALED: - case PIPE_FORMAT_R16G16B16_UNORM: - return 3 * 2; - case PIPE_FORMAT_R16G16B16A16_SSCALED: - case PIPE_FORMAT_R16G16B16A16_SNORM: - case PIPE_FORMAT_R16G16B16A16_USCALED: - case PIPE_FORMAT_R16G16B16A16_UNORM: - return 4 * 2; - - case PIPE_FORMAT_R8_SSCALED: - case PIPE_FORMAT_R8_SNORM: - case PIPE_FORMAT_R8_USCALED: - case PIPE_FORMAT_R8_UNORM: - return 1; - case PIPE_FORMAT_R8G8_SSCALED: - case PIPE_FORMAT_R8G8_SNORM: - case PIPE_FORMAT_R8G8_USCALED: - case PIPE_FORMAT_R8G8_UNORM: - return 2 * 1; - case PIPE_FORMAT_R8G8B8_SSCALED: - case PIPE_FORMAT_R8G8B8_SNORM: - case PIPE_FORMAT_R8G8B8_USCALED: - case PIPE_FORMAT_R8G8B8_UNORM: - return 3 * 1; - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_R8G8B8A8_SSCALED: - case PIPE_FORMAT_R8G8B8A8_SNORM: - case PIPE_FORMAT_R8G8B8A8_USCALED: - case PIPE_FORMAT_R8G8B8A8_UNORM: - return 4 * 1; - - case 0: - return 0; /* not sure why this is needed */ - - default: - assert(0); - return 0; - } -} - - /** * Fetch vertex attributes for 'count' vertices. */ @@ -612,10 +161,10 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, /* loop over vertex attributes (vertex shader inputs) */ for (attr = 0; attr < nr_attrs; attr++) { - const qword default_values = (qword)(vec_float4){ 0.0, 0.0, 0.0, 1.0 }; const unsigned pitch = draw->vertex_fetch.pitch[attr]; const uint64_t src = draw->vertex_fetch.src_ptr[attr]; - const spu_fetch_func fetch = draw->vertex_fetch.fetch[attr]; + const spu_fetch_func fetch = (spu_fetch_func) + (draw->vertex_fetch.code + draw->vertex_fetch.code_offset[attr]); unsigned i; unsigned idx; const unsigned bytes_per_entry = draw->vertex_fetch.size[attr]; @@ -644,8 +193,7 @@ static void generic_vertex_fetch(struct spu_vs_context *draw, /* Convert all 4 vertices to vectors of float. */ - (*fetch)(&machine->Inputs[attr].xyzw[0].q, in, default_values, - fetch_shuffle_data); + (*fetch)(&machine->Inputs[attr].xyzw[0].q, in, fetch_shuffle_data); } } @@ -662,12 +210,5 @@ void spu_update_vertex_fetch( struct spu_vs_context *draw ) } - for (i = 0; i < draw->vertex_fetch.nr_attrs; i++) { - draw->vertex_fetch.fetch[i] = - get_fetch_func(draw->vertex_fetch.format[i]); - draw->vertex_fetch.size[i] = - get_vertex_size(draw->vertex_fetch.format[i]); - } - draw->vertex_fetch.fetch_func = generic_vertex_fetch; } diff --git a/src/gallium/drivers/cell/spu/spu_vertex_shader.h b/src/gallium/drivers/cell/spu/spu_vertex_shader.h index b5bf31e67db..0fb0bc28d03 100644 --- a/src/gallium/drivers/cell/spu/spu_vertex_shader.h +++ b/src/gallium/drivers/cell/spu/spu_vertex_shader.h @@ -6,8 +6,6 @@ struct spu_vs_context; -typedef void (*spu_fetch_func)(qword *out, const qword *in, qword defaults, - const qword *shuffle_data); typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, @@ -20,12 +18,12 @@ struct spu_vs_context { uint64_t src_ptr[PIPE_ATTRIB_MAX]; unsigned pitch[PIPE_ATTRIB_MAX]; unsigned size[PIPE_ATTRIB_MAX]; - enum pipe_format format[PIPE_ATTRIB_MAX]; + unsigned code_offset[PIPE_ATTRIB_MAX]; unsigned nr_attrs; boolean dirty; - spu_fetch_func fetch[PIPE_ATTRIB_MAX]; spu_full_fetch_func fetch_func; + void *code; } vertex_fetch; /* Clip derived state: