From: Zack Rusin Date: Thu, 25 Oct 2007 11:52:59 +0000 (-0400) Subject: Fix nested conditionals X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d26e9c447fd9746b2219edbf65b1991521bcfe7;p=mesa.git Fix nested conditionals --- diff --git a/progs/vpglsl/nestedifs.glsl b/progs/vpglsl/nestedifs.glsl new file mode 100644 index 00000000000..abb235cd65b --- /dev/null +++ b/progs/vpglsl/nestedifs.glsl @@ -0,0 +1,13 @@ + +void main() { + gl_Position = gl_Vertex; + if (gl_Position.x < 0.5) { + if (gl_Position.y < 0.20) { + gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0); + } else { + gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0); + } + gl_FrontColor.y = 1.0; + } else + gl_FrontColor = gl_Color; +} diff --git a/progs/vpglsl/nestedswizzle.glsl b/progs/vpglsl/nestedswizzle.glsl new file mode 100644 index 00000000000..a3adb3dfeb2 --- /dev/null +++ b/progs/vpglsl/nestedswizzle.glsl @@ -0,0 +1,9 @@ + +void main() { + gl_Position = gl_Vertex; + gl_FrontColor = gl_Color; + if (gl_Position.x < 0.5) { + gl_FrontColor.y = 1.0; + } + gl_FrontColor.xzw = vec3(0, 0, 1); +} diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c index 1d1b639b561..3c2830773a3 100644 --- a/progs/vpglsl/vp-tris.c +++ b/progs/vpglsl/vp-tris.c @@ -54,7 +54,7 @@ static void read_shader(GLuint shader, const char *filename) } n = fread(buffer, 1, max, f); - printf("fslight: read %d bytes from shader file %s\n", n, filename); + printf("vp-tris: read %d bytes from shader file %s\n", n, filename); if (n > 0) { buffer[n] = 0; load_and_compile_shader(shader, buffer); diff --git a/src/mesa/pipe/llvm/storage.cpp b/src/mesa/pipe/llvm/storage.cpp index 603053c0e8f..10729171989 100644 --- a/src/mesa/pipe/llvm/storage.cpp +++ b/src/mesa/pipe/llvm/storage.cpp @@ -123,9 +123,6 @@ llvm::ConstantInt *Storage::constantInt(int idx) llvm::Value *Storage::inputElement(int idx, llvm::Value *indIdx) { - if (!indIdx && m_inputs.find(idx) != m_inputs.end()) { - return m_inputs[idx]; - } GetElementPtrInst *getElem = 0; if (indIdx) { @@ -147,7 +144,6 @@ llvm::Value *Storage::inputElement(int idx, llvm::Value *indIdx) LoadInst *load = new LoadInst(getElem, name("input"), false, m_block); load->setAlignment(8); - m_inputs[idx] = load; return load; } @@ -155,9 +151,6 @@ llvm::Value *Storage::inputElement(int idx, llvm::Value *indIdx) llvm::Value *Storage::constElement(int idx, llvm::Value *indIdx) { m_numConsts = ((idx + 1) > m_numConsts) ? (idx + 1) : m_numConsts; - if (!indIdx && m_consts.find(idx) != m_consts.end()) { - return m_consts[idx]; - } GetElementPtrInst *getElem = 0; @@ -178,7 +171,6 @@ llvm::Value *Storage::constElement(int idx, llvm::Value *indIdx) LoadInst *load = new LoadInst(getElem, name("const"), false, m_block); load->setAlignment(8); - m_consts[idx] = load; return load; } @@ -334,7 +326,6 @@ llvm::Value * Storage::outputElement(int idx, llvm::Value *indIdx ) LoadInst *load = new LoadInst(getElem, name("output"), false, m_block); load->setAlignment(8); - m_inputs[idx] = load; return load; } diff --git a/src/mesa/pipe/llvm/storage.h b/src/mesa/pipe/llvm/storage.h index dd5de35073c..a844d1c30f6 100644 --- a/src/mesa/pipe/llvm/storage.h +++ b/src/mesa/pipe/llvm/storage.h @@ -47,7 +47,6 @@ namespace llvm { class Storage { - typedef std::map LoadMap; public: Storage(llvm::BasicBlock *block, llvm::Value *out, @@ -75,9 +74,11 @@ public: void store(int dstIdx, llvm::Value *val, int mask); int numConsts() const; + private: llvm::Value *maskWrite(llvm::Value *src, int mask, llvm::Value *templ); const char *name(const char *prefix); + private: llvm::BasicBlock *m_block; llvm::Value *m_OUT; @@ -89,8 +90,6 @@ private: std::vector m_temps; std::vector m_addrs; std::vector m_dstCache; - LoadMap m_inputs; - LoadMap m_consts; llvm::VectorType *m_floatVecType; llvm::VectorType *m_intVecType;