Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(58)

Unified Diff: src/liboslexec/opmatrix.cpp

Issue 206045: Pre-review: run state overhaul (Closed) Base URL: http://openshadinglanguage.googlecode.com/svn/trunk/
Patch Set: Update patch set to sync with trunk Created 14 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/liboslexec/opmatrix.cpp
===================================================================
--- src/liboslexec/opmatrix.cpp (revision 583)
+++ src/liboslexec/opmatrix.cpp (working copy)
@@ -103,34 +103,33 @@
*result = R;
} else {
// Computation uniform, but copy to varying result variable
- for (int i = beginpoint; i < endpoint; ++i)
- if (runflags[i])
- result[i] = R;
+ SHADE_LOOP_BEGIN
+ result[i] = R;
+ SHADE_LOOP_END
}
} else {
// Fully varying case
Matrix44 R, M;
ustring last_space;
- for (int i = beginpoint; i < endpoint; ++i)
- if (runflags[i]) {
- if (nfloats == 1) {
- Float a = f[0][i];
- R = Matrix44 (a, 0, 0, 0, 0, a, 0, 0, 0, 0, a, 0, 0, 0, 0, a);
- } else {
- R = Matrix44 ( f[0][i], f[1][i], f[2][i], f[3][i],
- f[4][i], f[5][i], f[6][i], f[7][i],
- f[8][i], f[9][i], f[10][i], f[11][i],
- f[12][i], f[13][i], f[14][i], f[15][i]);
+ SHADE_LOOP_BEGIN
+ if (nfloats == 1) {
+ Float a = f[0][i];
+ R = Matrix44 (a, 0, 0, 0, 0, a, 0, 0, 0, 0, a, 0, 0, 0, 0, a);
+ } else {
+ R = Matrix44 ( f[0][i], f[1][i], f[2][i], f[3][i],
+ f[4][i], f[5][i], f[6][i], f[7][i],
+ f[8][i], f[9][i], f[10][i], f[11][i],
+ f[12][i], f[13][i], f[14][i], f[15][i]);
+ }
+ if (using_space) {
+ if (space[i] != last_space || globals->time.is_varying()) {
+ exec->get_matrix (M, space[i], i);
+ last_space = space[i];
}
- if (using_space) {
- if (space[i] != last_space || globals->time.is_varying()) {
- exec->get_matrix (M, space[i], i);
- last_space = space[i];
- }
- R = M * R;
- }
- result[i] = R;
+ R = M * R;
}
+ result[i] = R;
+ SHADE_LOOP_END
}
}
@@ -165,15 +164,15 @@
*result = R;
} else {
// Computation uniform, but copy to varying result variable
- for (int i = beginpoint; i < endpoint; ++i)
- if (runflags[i])
- result[i] = R;
+ SHADE_LOOP_BEGIN
+ result[i] = R;
+ SHADE_LOOP_END
}
} else {
// Fully varying case
- for (int i = beginpoint; i < endpoint; ++i)
- if (runflags[i])
- exec->get_matrix (result[i], from[i], to[i], i);
+ SHADE_LOOP_BEGIN
+ exec->get_matrix (result[i], from[i], to[i], i);
+ SHADE_LOOP_END
}
}
@@ -212,7 +211,7 @@
}
if (impl) {
- impl (exec, nargs, args, runflags, beginpoint, endpoint);
+ impl (exec, nargs, args);
// Use the specialized one for next time! Never have to check the
// types or do the other sanity checks again.
// FIXME -- is this thread-safe?
@@ -260,20 +259,18 @@
(*result)[r][c] = (Float) *val;
} else {
// Fully varying case
- for (int i = beginpoint; i < endpoint; ++i) {
- if (runflags[i]) {
- int r = row[i];
- int c = col[i];
- if (r < 0 || r > 3 || c < 0 || c > 3) {
- exec->error ("Index out of range: %s %s[%d][%d]\n",
- Result.typespec().string().c_str(),
- Result.name().c_str(), r, c);
- r = clamp (r, 0, 3);
- c = clamp (c, 0, 3);
- }
- result[i][r][c] = (Float) val[i];
+ SHADE_LOOP_BEGIN
+ int r = row[i];
+ int c = col[i];
+ if (r < 0 || r > 3 || c < 0 || c > 3) {
+ exec->error ("Index out of range: %s %s[%d][%d]\n",
+ Result.typespec().string().c_str(),
+ Result.name().c_str(), r, c);
+ r = clamp (r, 0, 3);
+ c = clamp (c, 0, 3);
}
- }
+ result[i][r][c] = (Float) val[i];
+ SHADE_LOOP_END
}
}
@@ -299,7 +296,7 @@
impl = specialized_mxcompassign<int>;
if (impl) {
- impl (exec, nargs, args, runflags, beginpoint, endpoint);
+ impl (exec, nargs, args);
// Use the specialized one for next time! Never have to check the
// types or do the other sanity checks again.
// FIXME -- is this thread-safe?
@@ -351,20 +348,18 @@
(*result) = (*m)[r][c];
} else {
// Fully varying case
- for (int i = beginpoint; i < endpoint; ++i) {
- if (runflags[i]) {
- int r = row[i];
- int c = col[i];
- if (r < 0 || r > 3 || c < 0 || c > 3) {
- exec->error ("Index out of range: %s %s[%d][%d]\n",
- Result.typespec().string().c_str(),
- Result.name().c_str(), r, c);
- r = clamp (r, 0, 3);
- c = clamp (c, 0, 3);
- }
- result[i] = (m[i])[r][c];
+ SHADE_LOOP_BEGIN
+ int r = row[i];
+ int c = col[i];
+ if (r < 0 || r > 3 || c < 0 || c > 3) {
+ exec->error ("Index out of range: %s %s[%d][%d]\n",
+ Result.typespec().string().c_str(),
+ Result.name().c_str(), r, c);
+ r = clamp (r, 0, 3);
+ c = clamp (c, 0, 3);
}
- }
+ result[i] = (m[i])[r][c];
+ SHADE_LOOP_END
}
}
@@ -439,8 +434,7 @@
DASSERT (! Result.typespec().is_closure() && ! A.typespec().is_closure());
DASSERT (Result.typespec().is_float() && A.typespec().is_matrix());
- unary_op_guts_noderivs<Float, Matrix44, Determinant> (Result, A, exec, runflags,
- beginpoint, endpoint);
+ unary_op_guts_noderivs<Float, Matrix44, Determinant> (Result, A, exec);
}
@@ -453,8 +447,7 @@
DASSERT (! Result.typespec().is_closure() && ! A.typespec().is_closure());
DASSERT (Result.typespec().is_matrix() && A.typespec().is_matrix());
- unary_op_guts_noderivs<Matrix44, Matrix44, Transpose> (Result, A, exec, runflags,
- beginpoint, endpoint);
+ unary_op_guts_noderivs<Matrix44, Matrix44, Transpose> (Result, A, exec);
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b