| 16 | { |
| 17 | |
| 18 | void AddLogShader(GpuShaderCreatorRcPtr & shaderCreator, ConstLogOpDataRcPtr & /* logData */, float base) |
| 19 | { |
| 20 | const float minValue = std::numeric_limits<float>::min(); |
| 21 | |
| 22 | GpuShaderText st(shaderCreator->getLanguage()); |
| 23 | |
| 24 | st.indent(); |
| 25 | st.newLine() << ""; |
| 26 | st.newLine() << "// Add Log processing"; |
| 27 | st.newLine() << ""; |
| 28 | st.newLine() << "{"; |
| 29 | st.indent(); |
| 30 | |
| 31 | const std::string pix(shaderCreator->getPixelName()); |
| 32 | const std::string pixrgb = pix + std::string(".rgb"); |
| 33 | |
| 34 | st.newLine() << pixrgb << " = max( " << st.float3Const(minValue) << ", " << pixrgb << ");"; |
| 35 | |
| 36 | if (base == 2.0f) |
| 37 | { |
| 38 | st.newLine() << pixrgb << " = log2(" << pixrgb << ");"; |
| 39 | } |
| 40 | else // base 10 |
| 41 | { |
| 42 | const float oneOverLog10 = 1.0f / logf(base); |
| 43 | st.newLine() << pixrgb << " = log(" << pixrgb << ") * " << st.float3Const(oneOverLog10) << ";"; |
| 44 | } |
| 45 | |
| 46 | st.dedent(); |
| 47 | st.newLine() << "}"; |
| 48 | |
| 49 | shaderCreator->addToFunctionShaderCode(st.string().c_str()); |
| 50 | } |
| 51 | |
| 52 | void AddAntiLogShader(GpuShaderCreatorRcPtr & shaderCreator, ConstLogOpDataRcPtr & /* logData */, float base) |
| 53 | { |
no test coverage detected