diff options
-rw-r--r-- | src/mesa/Makefile | 2 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader.c | 5 | ||||
-rw-r--r-- | src/mesa/pipe/draw/draw_vertex_shader_llvm.c | 11 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/instructions.cpp | 21 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/llvmtgsi.cpp | 40 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/storage.cpp | 14 | ||||
-rw-r--r-- | src/mesa/pipe/llvm/storage.h | 1 |
7 files changed, 10 insertions, 84 deletions
diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 5b56f76e0be..e9dfb95e5c5 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -113,7 +113,7 @@ osmesa-only: depend subdirs $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_NAME) # Make the GL library $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(STAND_ALONE_OBJECTS) $(SOFTPIPE_LIB) - $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ + @ $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ -major $(GL_MAJOR) -minor $(GL_MINOR) -patch $(GL_TINY) \ -install $(TOP)/$(LIB_DIR) \ $(MKLIB_OPTIONS) $(STAND_ALONE_OBJECTS) \ diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c index e36ecdc849e..fb20dfa4e1a 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader.c +++ b/src/mesa/pipe/draw/draw_vertex_shader.c @@ -91,8 +91,6 @@ run_vertex_program(struct draw_context *draw, assert(draw->vertex_shader->state->output_semantic_name[0] == TGSI_SEMANTIC_POSITION); - fprintf(stderr, "------ run_vertex\n"); - /* Consts does not require 16 byte alignment. */ machine->Consts = (float (*)[4]) draw->mapped_constants; @@ -132,7 +130,6 @@ run_vertex_program(struct draw_context *draw, 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]; - printf("output %d: %f %f %f %f\n", 0, x, y, z, w); vOut[j]->clipmask = compute_clipmask(vOut[j]->clip, draw->plane, draw->nr_planes); vOut[j]->edgeflag = 1; @@ -178,8 +175,6 @@ void draw_vertex_shader_queue_flush( struct draw_context *draw ) { unsigned i, j; - fprintf(stderr, "XX q(%d) ", draw->vs.queue_nr ); - if (draw->vertex_shader->state->llvm_prog) { draw_vertex_shader_queue_flush_llvm(draw); return; diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c index d658544f306..05c3fe511bf 100644 --- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c +++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c @@ -74,8 +74,6 @@ void vertex_fetch(struct draw_context *draw, { uint attr; - printf("fetch vertex %u: \n", elt); - /* loop over vertex attributes (vertex shader inputs) */ for (attr = 0; attr < draw->vertex_shader->state->num_inputs; attr++) { @@ -89,8 +87,6 @@ void vertex_fetch(struct draw_context *draw, fetch_attrib4(src, draw->vertex_element[attr].src_format, p); - printf("> %u: %f %f %f %f\n", attr, p[0], p[1], p[2], p[3]); - inputs[attr][0] = p[0]; /*X*/ inputs[attr][1] = p[1]; /*Y*/ inputs[attr][2] = p[2]; /*Z*/ @@ -105,7 +101,7 @@ compute_clipmask(const float *clip, const float (*plane)[4], unsigned nr) unsigned i; for (i = 0; i < nr; i++) { - if (dot4(clip, plane[i]) < 0) + if (dot4(clip, plane[i]) < 0) mask |= (1<<i); } @@ -129,8 +125,6 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) const float *scale = draw->viewport.scale; const float *trans = draw->viewport.translate; - fprintf(stderr, "--- XX q(%d) \n", draw->vs.queue_nr); - /* fetch the inputs */ for (i = 0; i < draw->vs.queue_nr; ++i) { unsigned elt = draw->vs.queue[i].elt; @@ -144,9 +138,6 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw) draw->vertex_shader->state->num_inputs, draw->vertex_info.num_attribs); - /* FIXME: finish conversion */ - /* dests = outputs */ - /* store machine results */ for (int i = 0; i < draw->vs.queue_nr; ++i) { unsigned slot; diff --git a/src/mesa/pipe/llvm/instructions.cpp b/src/mesa/pipe/llvm/instructions.cpp index 5a40888696f..037bec653fd 100644 --- a/src/mesa/pipe/llvm/instructions.cpp +++ b/src/mesa/pipe/llvm/instructions.cpp @@ -167,26 +167,6 @@ llvm::Value *Instructions::callFAbs(llvm::Value *val) llvm::Value * Instructions::lit(llvm::Value *in) { -#if 0 - printVector(in); - return in; - - ExtractElementInst *x = new ExtractElementInst(in, unsigned(0), - name("x"), - m_block); - - ExtractElementInst *y = new ExtractElementInst(in, unsigned(1), - name("y"), - m_block); - - ExtractElementInst *w = new ExtractElementInst(in, unsigned(3), - name("w"), - m_block); - return vectorFromVals(ConstantFP::get(Type::FloatTy, APFloat(1.f)), - ConstantFP::get(Type::FloatTy, APFloat(0.f)), - ConstantFP::get(Type::FloatTy, APFloat(0.f)), - ConstantFP::get(Type::FloatTy, APFloat(1.f))); -#else if (!m_llvmLit) { m_llvmLit = makeLitFunction(m_mod); } @@ -194,7 +174,6 @@ llvm::Value * Instructions::lit(llvm::Value *in) call->setCallingConv(CallingConv::C); call->setTailCall(false); return call; -#endif } llvm::Value * Instructions::sub(llvm::Value *in1, llvm::Value *in2) diff --git a/src/mesa/pipe/llvm/llvmtgsi.cpp b/src/mesa/pipe/llvm/llvmtgsi.cpp index 049bf0fa6e7..56b488fb1ae 100644 --- a/src/mesa/pipe/llvm/llvmtgsi.cpp +++ b/src/mesa/pipe/llvm/llvmtgsi.cpp @@ -141,7 +141,6 @@ translate_instruction(llvm::Module *module, val = storage->tempElement(src->SrcRegister.Index); } else { fprintf(stderr, "ERROR: not support llvm source\n"); - printf("translate instr END\n"); return; } @@ -160,9 +159,6 @@ translate_instruction(llvm::Module *module, src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y || src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W) { - fprintf(stderr, "SWIZZLE is %d %d %d %d\n", - src->SrcRegister.SwizzleX, src->SrcRegister.SwizzleY, - src->SrcRegister.SwizzleZ, src->SrcRegister.SwizzleW); int swizzle = src->SrcRegister.SwizzleX * 1000; swizzle += src->SrcRegister.SwizzleY * 100; swizzle += src->SrcRegister.SwizzleZ * 10; @@ -517,7 +513,6 @@ translate_instruction(llvm::Module *module, struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - printf("--- storing to %d %p\n", dst->DstRegister.Index, out); storage->store(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); } else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) { storage->setTempElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); @@ -552,16 +547,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) tgsi_parse_init(&parse, tokens); - Function* func_printf = mod->getFunction("printf"); - //parse.FullHeader.Processor.Processor - - //parse.FullVersion.Version.MajorVersion - //parse.FullVersion.Version.MinorVersion - - //parse.FullHeader.Header.HeaderSize - //parse.FullHeader.Header.BodySize - //parse.FullHeader.Processor.Processor - fi = tgsi_default_full_instruction(); fd = tgsi_default_full_declaration(); Storage storage(label_entry, ptr_OUT, ptr_IN, ptr_CONST); @@ -569,8 +554,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) while(!tgsi_parse_end_of_tokens(&parse)) { tgsi_parse_token(&parse); - fprintf(stderr, "Translating %d\n", parse.FullToken.Token.Type); - switch (parse.FullToken.Token.Type) { case TGSI_TOKEN_TYPE_DECLARATION: translate_declaration(mod, @@ -596,8 +579,6 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) new ReturnInst(label_entry); - //TXT("\ntgsi-dump end -------------------\n"); - tgsi_parse_free(&parse); prog->num_consts = storage.numConsts(); @@ -611,25 +592,21 @@ tgsi_to_llvm(struct ga_llvm_prog *prog, const struct tgsi_token *tokens) struct ga_llvm_prog * ga_llvm_from_tgsi(struct pipe_context *pipe, const struct tgsi_token *tokens) { - std::cout << "Creating llvm " <<std::endl; + std::cout << "Creating llvm from: " <<std::endl; struct ga_llvm_prog *ga_llvm = (struct ga_llvm_prog *)malloc(sizeof(struct ga_llvm_prog)); - fprintf(stderr, "DUMPX \n"); + fprintf(stderr, "----- TGSI Start ---- \n"); tgsi_dump(tokens, 0); - fprintf(stderr, "DUMPEND \n"); + fprintf(stderr, "----- TGSI End ---- \n"); llvm::Module *mod = tgsi_to_llvm(ga_llvm, tokens); /* Run optimization passes over it */ PassManager passes; - // Add an appropriate TargetData instance for this module... passes.add(new TargetData(mod)); AddStandardCompilePasses(passes); - std::cout<<"Running optimization passes..."<<std::endl; - bool b = passes.run(*mod); - std::cout<<"\tModified mod = "<<b<<std::endl; + passes.run(*mod); - llvm::ExistingModuleProvider *mp = - new llvm::ExistingModuleProvider(mod); + llvm::ExistingModuleProvider *mp = new llvm::ExistingModuleProvider(mod); llvm::ExecutionEngine *ee = 0; if (!pipe->llvm_execution_engine) { ee = llvm::ExecutionEngine::create(mp, false); @@ -681,12 +658,5 @@ int ga_llvm_prog_exec(struct ga_llvm_prog *prog, std::cout << "---- END LLVM Execution "<<std::endl; - for (int i = 0; i < num_vertices; ++i) { - for (int j = 0; j < num_attribs; ++j) { - printf("OUT(%d, %d) [%f, %f, %f, %f]\n", i, j, - dests[i][j][0], dests[i][j][1], - dests[i][j][2], dests[i][j][3]); - } - } return 0; } diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index dc7c1f3928c..ba78de8260e 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -26,7 +26,6 @@ Storage::Storage(llvm::BasicBlock *block, llvm::Value *out, m_undefFloatVec = UndefValue::get(m_floatVecType); m_undefIntVec = UndefValue::get(m_intVecType); - m_shuffleId = 0; m_numConsts = 0; } @@ -88,15 +87,11 @@ llvm::Value *Storage::constElement(int idx) if (m_consts.find(idx) != m_consts.end()) { return m_consts[idx]; } - char ptrName[13]; - char name[9]; - snprintf(ptrName, 13, "const_ptr%d", idx); - snprintf(name, 9, "const%d", idx); GetElementPtrInst *getElem = new GetElementPtrInst(m_CONST, constantInt(idx), - ptrName, + name("const_ptr"), m_block); - LoadInst *load = new LoadInst(getElem, name, + LoadInst *load = new LoadInst(getElem, name("const"), false, m_block); m_consts[idx] = load; return load; @@ -105,12 +100,9 @@ llvm::Value *Storage::constElement(int idx) llvm::Value *Storage::shuffleVector(llvm::Value *vec, int shuffle) { Constant *mask = shuffleMask(shuffle); - ++m_shuffleId; - char name[11]; - snprintf(name, 11, "shuffle%d", m_shuffleId); ShuffleVectorInst *res = new ShuffleVectorInst(vec, m_undefFloatVec, mask, - name, m_block); + name("shuffle"), m_block); return res; } diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h index f39d308fdd2..66a33633325 100644 --- a/src/mesa/pipe/llvm/storage.h +++ b/src/mesa/pipe/llvm/storage.h @@ -57,7 +57,6 @@ private: llvm::Value *m_undefFloatVec; llvm::Value *m_undefIntVec; - int m_shuffleId; char m_name[32]; int m_idx; |