Commit 75a6185a by Alexis Hetu Committed by Alexis Hétu

Compute texture coordinates using floating point operations

Modified the texture coordinate computation to use floating point operations when sampling floating point textures to increase accuracy and remove useless type conversions. Bug swiftshader:76 Change-Id: I76e5fd9a68aa6ba5eb21524edb8c6c6183e5430e Reviewed-on: https://swiftshader-review.googlesource.com/10628Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 6e744267
...@@ -207,8 +207,15 @@ namespace sw ...@@ -207,8 +207,15 @@ namespace sw
mipmap.onePitchP[2] = 1; mipmap.onePitchP[2] = 1;
mipmap.onePitchP[3] = pitchP; mipmap.onePitchP[3] = pitchP;
mipmap.pitchP[0] = pitchP;
mipmap.pitchP[1] = pitchP;
mipmap.pitchP[2] = pitchP;
mipmap.pitchP[3] = pitchP;
mipmap.sliceP[0] = sliceP; mipmap.sliceP[0] = sliceP;
mipmap.sliceP[1] = sliceP; mipmap.sliceP[1] = sliceP;
mipmap.sliceP[2] = sliceP;
mipmap.sliceP[3] = sliceP;
if(internalTextureFormat == FORMAT_YV12_BT601 || if(internalTextureFormat == FORMAT_YV12_BT601 ||
internalTextureFormat == FORMAT_YV12_BT709 || internalTextureFormat == FORMAT_YV12_BT709 ||
......
...@@ -36,7 +36,8 @@ namespace sw ...@@ -36,7 +36,8 @@ namespace sw
short height[4]; short height[4];
short depth[4]; short depth[4];
short onePitchP[4]; short onePitchP[4];
int sliceP[2]; int4 pitchP;
int4 sliceP;
}; };
struct Texture struct Texture
......
...@@ -76,11 +76,15 @@ namespace sw ...@@ -76,11 +76,15 @@ namespace sw
void cubeFace(Int face[4], Float4 &U, Float4 &V, Float4 &lodX, Float4 &lodY, Float4 &lodZ, Float4 &x, Float4 &y, Float4 &z); void cubeFace(Int face[4], Float4 &U, Float4 &V, Float4 &lodX, Float4 &lodY, Float4 &lodZ, Float4 &x, Float4 &y, Float4 &z);
Short4 applyOffset(Short4 &uvw, Float4 &offset, const Int4 &whd, AddressingMode mode); Short4 applyOffset(Short4 &uvw, Float4 &offset, const Int4 &whd, AddressingMode mode);
void computeIndices(UInt index[4], Short4 uuuu, Short4 vvvv, Short4 wwww, Vector4f &offset, const Pointer<Byte> &mipmap, SamplerFunction function); void computeIndices(UInt index[4], Short4 uuuu, Short4 vvvv, Short4 wwww, Vector4f &offset, const Pointer<Byte> &mipmap, SamplerFunction function);
void computeIndices(UInt index[4], Int4& uuuu, Int4& vvvv, Int4& wwww, const Pointer<Byte> &mipmap, SamplerFunction function);
void sampleTexel(Vector4s &c, Short4 &u, Short4 &v, Short4 &s, Vector4f &offset, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function); void sampleTexel(Vector4s &c, Short4 &u, Short4 &v, Short4 &s, Vector4f &offset, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function);
void sampleTexel(Vector4s &c, UInt index[4], Pointer<Byte> buffer[4]);
void sampleTexel(Vector4f &c, Short4 &u, Short4 &v, Short4 &s, Vector4f &offset, Float4 &z, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function); void sampleTexel(Vector4f &c, Short4 &u, Short4 &v, Short4 &s, Vector4f &offset, Float4 &z, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function);
void sampleTexel(Vector4s &c, UInt index[4], Pointer<Byte> buffer[4]);
void sampleTexel(Vector4f &c, Int4 &u, Int4 &v, Int4 &s, Float4 &z, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function);
void selectMipmap(Pointer<Byte> &texture, Pointer<Byte> buffer[4], Pointer<Byte> &mipmap, Float &lod, Int face[4], bool secondLOD); void selectMipmap(Pointer<Byte> &texture, Pointer<Byte> buffer[4], Pointer<Byte> &mipmap, Float &lod, Int face[4], bool secondLOD);
Short4 address(Float4 &uw, AddressingMode addressingMode, Pointer<Byte>& mipmap); Short4 address(Float4 &uw, AddressingMode addressingMode, Pointer<Byte>& mipmap);
void address(Float4 &uw, Int4& xyz0, Int4& xyz1, Float4& f, Pointer<Byte>& mipmap, Float4 &texOffset, Int4 &filter, int whd, AddressingMode addressingMode, SamplerFunction function);
Int4 computeFilterOffset(Float &lod);
void convertFixed12(Short4 &ci, Float4 &cf); void convertFixed12(Short4 &ci, Float4 &cf);
void convertFixed12(Vector4s &cs, Vector4f &cf); void convertFixed12(Vector4s &cs, Vector4f &cf);
...@@ -94,6 +98,7 @@ namespace sw ...@@ -94,6 +98,7 @@ namespace sw
bool hasFloatTexture() const; bool hasFloatTexture() const;
bool hasUnsignedTextureComponent(int component) const; bool hasUnsignedTextureComponent(int component) const;
int textureComponentCount() const; int textureComponentCount() const;
bool hasThirdCoordinate() const;
bool has16bitTextureFormat() const; bool has16bitTextureFormat() const;
bool has8bitTextureComponents() const; bool has8bitTextureComponents() const;
bool has16bitTextureComponents() const; bool has16bitTextureComponents() const;
......
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