On 10/16/2011 04:37 PM, vlj wrote:
v2 :
- Fix format issue thank to Brian Paul comments.
- UBOs are now sent to program correctly.
I only have whitespace suggestions for this file. The new code should
be formatted the same as the existing code. Some examples below.
---
src/glsl/linker.cpp | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 191 insertions(+), 1 deletions(-)
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index ba81c59..7d85d4e 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -65,6 +65,7 @@
*/
#include "main/core.h"
+#include "main/hash.h"
#include "glsl_symbol_table.h"
#include "ir.h"
#include "program.h"
@@ -784,6 +785,61 @@ get_main_function_signature(gl_shader *sh)
return NULL;
}
+/**
+ * TODO : write the function
+ * This function should check consistency between 2 UBO having same name
+ * from different shaders :
+ * - Same layout
+ * - Same variables (name and type) in same order
+ * - Same matrix layout (ie row/column major)
+ */
+static bool validate_separate_ubo(const ubo& first, const ubo& second)
+{
+ return true;
+}
The function should look like:
static bool
validate_separate_ubo(const ubo &first, const ubo &second)
{
return true;
}
+
+/**
+ * At intrastage, when several shaders of same type are merged in a single one,
+ * this function generates UBOs of the newly created shader from them and
+ * performs necessary check.
+ */
+static void merge_intrastage_ubo ( gl_shader_program* prog, struct gl_shader&
merged_shader,
+ struct gl_shader **shader_list, unsigned
num_shaders)
+{
+ hash_table *ht = hash_table_ctor(0, hash_table_string_hash,
+ hash_table_string_compare);
+ merged_shader.UBOCount = 0;
+ unsigned& index = merged_shader.UBOCount;
+ if(!merged_shader.UniformBufferObjects)
+ merged_shader.UniformBufferObjects = (struct ubo*)
malloc(MAX_UBO_IN_SHADER * sizeof(struct ubo));
+ for (unsigned shad_id=0; shad_id< num_shaders; shad_id++)
+ {
The opening brace should be on the same line as the for (). See other
loops in the file.
+ for(unsigned ubo_id=0; ubo_id< shader_list[shad_id]->UBOCount; ubo_id++)
+ {
+ ubo* current_ubo
=&(shader_list[shad_id]->UniformBufferObjects[ubo_id]);
+ ubo* sh = (ubo*) hash_table_find(ht,current_ubo->Name);
+ if(!sh)
+ {
if (!sh) {
[...more examples omitted...]
-Brian
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev