Apply the Apache 2.0 license. Change-Id: I4a7aeefedcd2d891093520d5a10ebefadcddb5be Reviewed-on: https://swiftshader-review.googlesource.com/5320 Reviewed-by: Nicolas Capens <capn@google.com> Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/ShaderCore.cpp b/src/Shader/ShaderCore.cpp index b978d9e..685848a 100644 --- a/src/Shader/ShaderCore.cpp +++ b/src/Shader/ShaderCore.cpp
@@ -1,13 +1,16 @@ -// SwiftShader Software Renderer +// Copyright 2016 The SwiftShader Authors. All Rights Reserved. // -// Copyright(c) 2005-2012 TransGaming Inc. +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at // -// All rights reserved. No part of this software may be copied, distributed, transmitted, -// transcribed, stored in a retrieval system, translated into any human or computer -// language by any means, or disclosed to third parties without the explicit written -// agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express -// or implied, including but not limited to any patent rights, are granted to you. +// http://www.apache.org/licenses/LICENSE-2.0 // +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. #include "ShaderCore.hpp" @@ -200,7 +203,7 @@ Float4 x0; Float4 x1; Int4 x2; - + x0 = x; x0 = Min(x0, As<Float4>(Int4(0x43010000))); // 129.00000e+0f @@ -224,7 +227,7 @@ x1 *= x0; x1 += As<Float4>(Int4(0x3F7FFFFF)); // 9.9999994e-1f x1 *= As<Float4>(x2); - + return x1; } @@ -234,9 +237,9 @@ Float4 x1; Float4 x2; Float4 x3; - + x0 = x; - + x1 = As<Float4>(As<Int4>(x0) & Int4(0x7F800000)); x1 = As<Float4>(As<UInt4>(x1) >> 8); x1 = As<Float4>(As<Int4>(x1) | As<Int4>(Float4(1.0f))); @@ -248,7 +251,7 @@ x2 /= x3; x1 += (x0 - Float4(1.0f)) * x2; - + return x1; } @@ -357,7 +360,7 @@ { // cos(x) = sin(x + pi/2) Float4 y = x + Float4(1.57079632e+0f); - + // Wrap around y -= As<Float4>(CmpNLT(y, Float4(3.14159265e+0f)) & As<Int4>(Float4(6.28318530e+0f))); @@ -418,7 +421,7 @@ // Approximation of atan in [-1..1] Float4 theta = y * (Float4(-0.27f) * Abs(y) + Float4(1.05539816f)); - + // +/-pi/2 depending on sign of x Float4 sgnPi_2 = As<Float4>(As<Int4>(Float4(1.57079632e+0f)) ^ (As<Int4>(x) & Int4(0x80000000))); @@ -1029,7 +1032,7 @@ } void ShaderCore::exp2x(Vector4f &dst, const Vector4f &src, bool pp) - { + { Float4 exp = exponential2(src.x, pp); dst.x = exp; @@ -1132,7 +1135,7 @@ static const uint32_t c_nanbit = 0x200; static const uint32_t c_infty_as_fp16 = 0x7c00; static const uint32_t c_clamp = (31 << 23) - 0x1000; - + UInt4 justsign = UInt4(mask_sign) & As<UInt4>(floatBits); UInt4 absf = As<UInt4>(floatBits) ^ justsign; UInt4 b_isnormal = CmpNLE(UInt4(c_f32infty), absf); @@ -1347,7 +1350,7 @@ dst.z = As<Float4>(flip ^ As<Int4>(N.z)); dst.w = As<Float4>(flip ^ As<Int4>(N.w)); } - + void ShaderCore::reflect1(Vector4f &dst, const Vector4f &I, const Vector4f &N) { Float4 d = N.x * I.x; @@ -1492,7 +1495,7 @@ dst.z = src.z * rsq; dst.w = src.w * rsq; } - + void ShaderCore::sincos(Vector4f &dst, const Vector4f &src, bool pp) { dst.x = cosine_pi(src.x, pp); @@ -1620,7 +1623,7 @@ exp2x(dst, src, true); // FIXME: 10-bit precision suffices } } - + void ShaderCore::logp(Vector4f &dst, const Vector4f &src, unsigned short version) { if(version < 0x0200) @@ -1651,7 +1654,7 @@ log2x(dst, src, true); } } - + void ShaderCore::cmp0(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2) { cmp0(dst.x, src0.x, src1.x, src2.x);