summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2008-01-24 07:49:36 -0500
committerZack Rusin <zack@tungstengraphics.com>2008-01-24 07:49:36 -0500
commitbac991d6452a12a9c6cb85293a17448540761ca7 (patch)
tree5e4065da16cada4f2020218b69cf130611347975 /src/mesa
parent11349b6a5f648bbad8765bf744a8e42b0f5e5f50 (diff)
change the name of the shaders to reflect what they do.
remove stale code and do some general cleanups.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader_llvm.c2
-rw-r--r--src/mesa/pipe/llvm/Makefile2
-rw-r--r--src/mesa/pipe/llvm/gallivm.cpp11
-rw-r--r--src/mesa/pipe/llvm/gallivm.h4
-rw-r--r--src/mesa/pipe/llvm/llvm_entry.c89
5 files changed, 12 insertions, 96 deletions
diff --git a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
index 08be1b83f8..4228c4f388 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader_llvm.c
@@ -172,7 +172,7 @@ void draw_vertex_shader_queue_flush_llvm(struct draw_context *draw)
/* Remaining attributes are packed into sequential post-transform
* vertex attrib slots.
*/
- for (slot = 1; slot < draw->vs_num_outputs; slot++) {
+ for (slot = 1; slot < draw->num_vs_outputs; slot++) {
vOut->data[slot][0] = dests[slot][0];
vOut->data[slot][1] = dests[slot][1];
vOut->data[slot][2] = dests[slot][2];
diff --git a/src/mesa/pipe/llvm/Makefile b/src/mesa/pipe/llvm/Makefile
index b1463f67cf..f655fb8340 100644
--- a/src/mesa/pipe/llvm/Makefile
+++ b/src/mesa/pipe/llvm/Makefile
@@ -61,7 +61,7 @@ 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=$@ -funcname=createBaseShader
+ clang --emit-llvm $< |llvm-as |opt -std-compile-opts |llvm2cpp -for=Shader -gen-module -o=$@ -f -funcname=createBaseShader
# Emacs tags
tags:
diff --git a/src/mesa/pipe/llvm/gallivm.cpp b/src/mesa/pipe/llvm/gallivm.cpp
index 49bbf753c4..afa1446890 100644
--- a/src/mesa/pipe/llvm/gallivm.cpp
+++ b/src/mesa/pipe/llvm/gallivm.cpp
@@ -733,7 +733,11 @@ tgsi_to_llvm(struct gallivm_prog *prog, const struct tgsi_token *tokens)
unsigned instno = 0;
Function* shader = mod->getFunction("execute_shader");
std::ostringstream stream;
- stream << "execute_shader";
+ if (prog->type == GALLIVM_VS) {
+ stream << "vs_shader";
+ } else {
+ stream << "fs_shader";
+ }
stream << prog->id;
std::string func_name = stream.str();
shader->setName(func_name.c_str());
@@ -799,6 +803,7 @@ gallivm_from_tgsi(const struct tgsi_token *tokens, enum gallivm_shader_type type
struct gallivm_prog *gallivm =
(struct gallivm_prog *)calloc(1, sizeof(struct gallivm_prog));
gallivm->id = GLOBAL_ID;
+ gallivm->type = type;
tgsi_dump(tokens, 0);
llvm::Module *mod = tgsi_to_llvm(gallivm, tokens);
@@ -812,7 +817,6 @@ gallivm_from_tgsi(const struct tgsi_token *tokens, enum gallivm_shader_type type
passes.run(*mod);
gallivm->module = mod;
- gallivm->type = type;
gallivm_prog_dump(gallivm, 0);
@@ -966,7 +970,8 @@ void gallivm_prog_dump(struct gallivm_prog *prog, const char *file_prefix)
const llvm::Function &func = (*itr);
std::string name = func.getName();
const llvm::Function *found = 0;
- if (name.find("execute_shader") != std::string::npos ||
+ if (name.find("vs_shader") != std::string::npos ||
+ name.find("fs_shader") != std::string::npos ||
name.find("function") != std::string::npos)
found = &func;
if (found) {
diff --git a/src/mesa/pipe/llvm/gallivm.h b/src/mesa/pipe/llvm/gallivm.h
index fd9a11e5b6..4695de3127 100644
--- a/src/mesa/pipe/llvm/gallivm.h
+++ b/src/mesa/pipe/llvm/gallivm.h
@@ -30,8 +30,8 @@
* Zack Rusin zack@tungstengraphics.com
*/
-#ifndef LLVMTGSI_H
-#define LLVMTGSI_H
+#ifndef GALLIVM_H
+#define GALLIVM_H
#if defined __cplusplus
extern "C" {
diff --git a/src/mesa/pipe/llvm/llvm_entry.c b/src/mesa/pipe/llvm/llvm_entry.c
index 909bef340a..c3b34584e1 100644
--- a/src/mesa/pipe/llvm/llvm_entry.c
+++ b/src/mesa/pipe/llvm/llvm_entry.c
@@ -34,95 +34,6 @@
/* clang --emit-llvm llvm_builtins.c |llvm-as |opt -std-compile-opts |llvm-dis */
typedef __attribute__(( ocu_vector_type(4) )) float float4;
-#if 0
-//clang doesn't suppoer "struct->member" notation yet
-struct vertex_header {
- unsigned clipmask:12;
- unsigned edgeflag:1;
- unsigned pad:3;
- unsigned vertex_id:16;
-
- float clip[4];
-
- float data[][4];
-};
-
-inline float
-dot4(float4 a, float4 b)
-{
- float4 c = a*b;
- return c.x + c.y + c.z + c.w;
-}
-
-inline unsigned
-compute_clipmask(float4 clip, float4 (*plane), unsigned nr)
-{
- unsigned mask = 0;
- unsigned i;
-
- for (i = 0; i < nr; i++) {
- if (dot4(clip, plane[i]) < 0)
- mask |= (1<<i);
- }
-
- return mask;
-}
-
-
-inline void collect_results(float4 *results, struct vertex_header *vOut,
- float4 *planes, int nr_planes,
- float4 scale, float4 trans,
- int num_attribs)
-{
- /* store results */
- unsigned slot;
- float x, y, z, w;
- /* Handle attr[0] (position) specially:
- */
- float4 res0 = results[0];
- float *clip = vOut->clip;
- x = clip[0] = res0.x;
- y = clip[1] = res0.y;
- z = clip[2] = res0.z;
- w = clip[3] = res0.w;
- vOut->clipmask = compute_clipmask(res0, planes, nr_planes);
- vOut->edgeflag = 1;
-
- /* divide by w */
- w = 1.0f / w;
- x *= w;
- y *= w;
- z *= w;
- res0.x = x; res0.y = y; res0.z = z; res0.w = 1;
-
- /* Viewport mapping */
- res0 = res0 * scale + trans;
- vOut->data[0][0] = res0.x;
- vOut->data[0][1] = res0.y;
- vOut->data[0][2] = res0.z;
- vOut->data[0][3] = w;
-
- /* Remaining attributes are packed into sequential post-transform
- * vertex attrib slots.
- * Skip 0 since we just did it above.
- * Subtract two because of the VERTEX_HEADER, CLIP_POS attribs.
- */
- for (slot = 1; slot < num_attribs - 2; slot++) {
- float4 vec = results[slot];
- vOut->data[slot][0] = vec.x;
- vOut->data[slot][1] = vec.y;
- vOut->data[slot][2] = vec.z;
- vOut->data[slot][3] = vec.w;
-
- printf("output %d: %f %f %f %f\n", slot,
- vOut->data[slot][0],
- vOut->data[slot][1],
- vOut->data[slot][2],
- vOut->data[slot][3]);
- }
-}
-#endif
-
void from_array(float4 (*res)[16], float (*ainputs)[16][4],
int count, int num_attribs)
{