Hack: Incomplete impl. for Dot3RGBA combiner operation.
This commit is contained in:
		| @@ -261,7 +261,8 @@ struct Regs { | |||||||
|             AddSigned       = 3, |             AddSigned       = 3, | ||||||
|             Lerp            = 4, |             Lerp            = 4, | ||||||
|             Subtract        = 5, |             Subtract        = 5, | ||||||
|  |             Dot3RGB         = 6, | ||||||
|  |             Dot3RGBA        = 7, | ||||||
|             MultiplyThenAdd = 8, |             MultiplyThenAdd = 8, | ||||||
|             AddThenMultiply = 9, |             AddThenMultiply = 9, | ||||||
|         }; |         }; | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| // Refer to the license.txt file included. | // Refer to the license.txt file included. | ||||||
|  |  | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
|  | #include <numeric> | ||||||
|  |  | ||||||
| #include "common/common_types.h" | #include "common/common_types.h" | ||||||
| #include "common/math_util.h" | #include "common/math_util.h" | ||||||
| @@ -439,6 +440,16 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||||||
|                         return result.Cast<u8>(); |                         return result.Cast<u8>(); | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|  |                     case Operation::Dot3RGBA: | ||||||
|  |                     { | ||||||
|  |                         //return std::inner_product(begin(a), end(a), begin(b), 0.0); | ||||||
|  |                         int a[] = { input[0].r(), input[0].g(), input[0].b() }; //int a[] = { 1, 3, -5 }; | ||||||
|  |                         int b[] = { input[1].r(), input[1].g(), input[1].b() }; | ||||||
|  |  | ||||||
|  |                         auto res = std::inner_product(a, a + sizeof(a) / sizeof(a[0]), b, 0); | ||||||
|  |                         return{ res, res, res }; | ||||||
|  |                     } | ||||||
|  |  | ||||||
|                     case Operation::MultiplyThenAdd: |                     case Operation::MultiplyThenAdd: | ||||||
|                     { |                     { | ||||||
|                         auto result = (input[0] * input[1] + 255 * input[2].Cast<int>()) / 255; |                         auto result = (input[0] * input[1] + 255 * input[2].Cast<int>()) / 255; | ||||||
| @@ -482,6 +493,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0, | |||||||
|                     case Operation::Subtract: |                     case Operation::Subtract: | ||||||
|                         return std::max(0, (int)input[0] - (int)input[1]); |                         return std::max(0, (int)input[0] - (int)input[1]); | ||||||
|  |  | ||||||
|  |                     case Operation::Dot3RGBA: | ||||||
|  |                         return 255; | ||||||
|  |  | ||||||
|                     case Operation::MultiplyThenAdd: |                     case Operation::MultiplyThenAdd: | ||||||
|                         return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255); |                         return std::min(255, (input[0] * input[1] + 255 * input[2]) / 255); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 bunnei
					bunnei