Commit 18daa81e by Alexis Hetu Committed by Alexis Hétu

Allow 3D filtering in the Blitter

According tot he Vulkan spec, about vkCmdBlitImage: "As the sizes of the source and destination extents can differ in any dimension, texels in the source extent are scaled and filtered to the destination extent." Logic was added to allow filtering in 3 dimensions in the Blitter. Since it requires more instructions, a state member was added in order to only filter in Z whenever we actually to do so (when the number of slices differ between source and destination regions). Fixes all tests mentioned in the issue. Bug: b/150155499 Change-Id: I63da92db94d8d0394a06271cd47d4930cf5f726a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/42208 Presubmit-Ready: Alexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 7454c944
...@@ -99,6 +99,7 @@ class Blitter ...@@ -99,6 +99,7 @@ class Blitter
vk::Format destFormat; vk::Format destFormat;
int srcSamples = 0; int srcSamples = 0;
int destSamples = 0; int destSamples = 0;
bool filter3D = false;
}; };
struct BlitData struct BlitData
...@@ -112,16 +113,23 @@ class Blitter ...@@ -112,16 +113,23 @@ class Blitter
float x0; float x0;
float y0; float y0;
float z0;
float w; float w;
float h; float h;
float d;
int y0d;
int y1d;
int x0d; int x0d;
int x1d; int x1d;
int y0d;
int y1d;
int z0d;
int z1d;
int sWidth; int sWidth;
int sHeight; int sHeight;
int sDepth;
bool filter3D;
}; };
struct CubeBorderData struct CubeBorderData
...@@ -161,6 +169,7 @@ private: ...@@ -161,6 +169,7 @@ private:
void write(Int4 &color, Pointer<Byte> element, const State &state); void write(Int4 &color, Pointer<Byte> element, const State &state);
static void ApplyScaleAndClamp(Float4 &value, const State &state, bool preScaled = false); static void ApplyScaleAndClamp(Float4 &value, const State &state, bool preScaled = false);
static Int ComputeOffset(Int &x, Int &y, Int &pitchB, int bytes); static Int ComputeOffset(Int &x, Int &y, Int &pitchB, int bytes);
static Int ComputeOffset(Int &x, Int &y, Int &z, Int &sliceB, Int &pitchB, int bytes);
static Float4 LinearToSRGB(const Float4 &color); static Float4 LinearToSRGB(const Float4 &color);
static Float4 sRGBtoLinear(const Float4 &color); static Float4 sRGBtoLinear(const Float4 &color);
...@@ -168,6 +177,9 @@ private: ...@@ -168,6 +177,9 @@ private:
using BlitRoutineType = BlitFunction::RoutineType; using BlitRoutineType = BlitFunction::RoutineType;
BlitRoutineType getBlitRoutine(const State &state); BlitRoutineType getBlitRoutine(const State &state);
BlitRoutineType generate(const State &state); BlitRoutineType generate(const State &state);
Float4 sample(Pointer<Byte> &source, Float &x, Float &y, Float &z,
Int &sWidth, Int &sHeight, Int &sDepth,
Int &sSliceB, Int &sPitchB, const State &state);
using CornerUpdateFunction = FunctionT<void(const CubeBorderData *)>; using CornerUpdateFunction = FunctionT<void(const CubeBorderData *)>;
using CornerUpdateRoutineType = CornerUpdateFunction::RoutineType; using CornerUpdateRoutineType = CornerUpdateFunction::RoutineType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment