ir_constant_expression: Add support for builtins dFdx, dFdy, and fwidth.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 21 Jul 2010 23:57:10 +0000 (16:57 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 28 Jul 2010 22:46:26 +0000 (15:46 -0700)
These always return zero (the derivative of a constant).

src/glsl/ir_constant_expression.cpp

index aa53d8d1867237ac0f4b2010e237885ffa72250c..641589ed077d22c6a785af34bcb45c0bc2a10d83 100644 (file)
@@ -812,7 +812,7 @@ ir_call::constant_expression_value()
    } else if (strcmp(callee, "atan") == 0) {
       return NULL; /* FINISHME: implement this */
    } else if (strcmp(callee, "dFdx") == 0 || strcmp(callee, "dFdy") == 0) {
-      return NULL; /* FINISHME: implement this */
+      return ir_constant::zero(mem_ctx, this->type);
    } else if (strcmp(callee, "ceil") == 0) {
       return NULL; /* FINISHME: implement this */
    } else if (strcmp(callee, "clamp") == 0) {
@@ -842,7 +842,7 @@ ir_call::constant_expression_value()
    } else if (strcmp(callee, "fract") == 0) {
       return NULL; /* FINISHME: implement this */
    } else if (strcmp(callee, "fwidth") == 0) {
-      return NULL; /* FINISHME: implement this */
+      return ir_constant::zero(mem_ctx, this->type);
    } else if (strcmp(callee, "greaterThan") == 0) {
       return NULL; /* FINISHME: implement this */
    } else if (strcmp(callee, "greaterThanEqual") == 0) {