From 8a83ca4e9afc9e3c08b4e8c33a74392f9b3154d7 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 12 Feb 2018 14:32:17 -0500 Subject: Add "sharpen" option to SkSL, to LOD bias all textures This adds a fixed bias (-0.5) to the computed LOD of all mip-mapped texture fetches. (Technically, to all texture fetches, but that only matters for mip-mapped ones). Clients can opt-in with a new GrContextOption. Bug: skia:7541 Bug: chromium:562162 Change-Id: Ie3cd0679c4ab66f62d2dc32e7e68e5c99355115e Reviewed-on: https://skia-review.googlesource.com/106322 Reviewed-by: Brian Salomon Reviewed-by: Ethan Nicholas Commit-Queue: Brian Osman --- src/sksl/SkSLSPIRVCodeGenerator.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/sksl/SkSLSPIRVCodeGenerator.cpp') diff --git a/src/sksl/SkSLSPIRVCodeGenerator.cpp b/src/sksl/SkSLSPIRVCodeGenerator.cpp index cb8b388521..d01a82dae2 100644 --- a/src/sksl/SkSLSPIRVCodeGenerator.cpp +++ b/src/sksl/SkSLSPIRVCodeGenerator.cpp @@ -824,8 +824,16 @@ SpvId SPIRVCodeGenerator::writeSpecialIntrinsic(const FunctionCall& c, SpecialIn out); } else { ASSERT(c.fArguments.size() == 2); - this->writeInstruction(op, type, result, sampler, uv, - out); + if (fProgram.fSettings.fSharpenTextures) { + FloatLiteral lodBias(fContext, -1, -0.5); + this->writeInstruction(op, type, result, sampler, uv, + SpvImageOperandsBiasMask, + this->writeFloatLiteral(lodBias), + out); + } else { + this->writeInstruction(op, type, result, sampler, uv, + out); + } } break; } -- cgit v1.2.3