Commit 234c9a9e by Meng-Lin Wu

texgrad implementation

Related deqp tests: texturegrad, textureprojgrad Change-Id: I17529ed426c29bc1dec48fb7ac939c29caeeaf07 Reviewed-on: https://swiftshader-review.googlesource.com/5420Tested-by: 's avatarMeng-Lin Wu <marleymoo@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 6d27c880
...@@ -23,3 +23,4 @@ Google Inc. ...@@ -23,3 +23,4 @@ Google Inc.
John Sheu <sheu@google.com> John Sheu <sheu@google.com>
Philippe Hamel <hamelphi@google.com> Philippe Hamel <hamelphi@google.com>
Daniel Toyama <kenjitoyama@google.com> Daniel Toyama <kenjitoyama@google.com>
Meng-Lin Wu <marleymoo@google.com>
\ No newline at end of file
...@@ -1120,7 +1120,7 @@ namespace sw ...@@ -1120,7 +1120,7 @@ namespace sw
void PixelProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3) void PixelProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3)
{ {
UNIMPLEMENTED(); sampleTexture(dst, src1, src0.x, src0.y, src0.z, src0.w, src2, src3, false, Grad);
} }
void PixelProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3, Vector4f &offset) void PixelProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3, Vector4f &offset)
......
...@@ -1533,13 +1533,13 @@ namespace sw ...@@ -1533,13 +1533,13 @@ namespace sw
void VertexProgram::TEXLDL(Vector4f &dst, Vector4f &src0, const Src &src1) void VertexProgram::TEXLDL(Vector4f &dst, Vector4f &src0, const Src &src1)
{ {
sampleTexture(dst, src1, src0.x, src0.y, src0.z, src0.w, Lod); sampleTexture(dst, src1, src0.x, src0.y, src0.z, src0.w, a0, a0, Lod);
} }
void VertexProgram::TEX(Vector4f &dst, Vector4f &src0, const Src &src1) void VertexProgram::TEX(Vector4f &dst, Vector4f &src0, const Src &src1)
{ {
Float4 lod0 = Float4(0.0f); Float4 lod0 = Float4(0.0f);
sampleTexture(dst, src1, src0.x, src0.y, src0.z, lod0, Lod); sampleTexture(dst, src1, src0.x, src0.y, src0.z, lod0, a0, a0, Lod);
} }
void VertexProgram::TEXOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3) void VertexProgram::TEXOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3)
...@@ -1564,7 +1564,8 @@ namespace sw ...@@ -1564,7 +1564,8 @@ namespace sw
void VertexProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3) void VertexProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3)
{ {
UNIMPLEMENTED(); Float4 lod0 = Float4(0.0f);
sampleTexture(dst, src1, src0.x, src0.y, src0.z, lod0, src2, src3, Grad);
} }
void VertexProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3, Vector4f &offset) void VertexProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &src2, Vector4f &src3, Vector4f &offset)
...@@ -1584,14 +1585,14 @@ namespace sw ...@@ -1584,14 +1585,14 @@ namespace sw
} }
} }
void VertexProgram::sampleTexture(Vector4f &c, const Src &s, Float4 &u, Float4 &v, Float4 &w, Float4 &q, SamplerMethod method) void VertexProgram::sampleTexture(Vector4f &c, const Src &s, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &dsx, Vector4f &dsy, SamplerMethod method)
{ {
Vector4f tmp; Vector4f tmp;
if(s.type == Shader::PARAMETER_SAMPLER && s.rel.type == Shader::PARAMETER_VOID) if(s.type == Shader::PARAMETER_SAMPLER && s.rel.type == Shader::PARAMETER_VOID)
{ {
Pointer<Byte> texture = data + OFFSET(DrawData,mipmap[TEXTURE_IMAGE_UNITS]) + s.index * sizeof(Texture); Pointer<Byte> texture = data + OFFSET(DrawData, mipmap[TEXTURE_IMAGE_UNITS]) + s.index * sizeof(Texture);
sampler[s.index]->sampleTexture(texture, tmp, u, v, w, q, a0, a0, method); sampler[s.index]->sampleTexture(texture, tmp, u, v, w, q, dsx, dsy, method);
} }
else else
{ {
...@@ -1603,8 +1604,8 @@ namespace sw ...@@ -1603,8 +1604,8 @@ namespace sw
{ {
If(index == i) If(index == i)
{ {
Pointer<Byte> texture = data + OFFSET(DrawData,mipmap[TEXTURE_IMAGE_UNITS]) + i * sizeof(Texture); Pointer<Byte> texture = data + OFFSET(DrawData, mipmap[TEXTURE_IMAGE_UNITS]) + i * sizeof(Texture);
sampler[i]->sampleTexture(texture, tmp, u, v, w, q, a0, a0, method); sampler[i]->sampleTexture(texture, tmp, u, v, w, q, dsx, dsy, method);
// FIXME: When the sampler states are the same, we could use one sampler and just index the texture // FIXME: When the sampler states are the same, we could use one sampler and just index the texture
} }
} }
......
...@@ -116,7 +116,7 @@ namespace sw ...@@ -116,7 +116,7 @@ namespace sw
void TEXGRAD(Vector4f &dst, Vector4f &src, const Src&, Vector4f &src2, Vector4f &src3, Vector4f &src4); void TEXGRAD(Vector4f &dst, Vector4f &src, const Src&, Vector4f &src2, Vector4f &src3, Vector4f &src4);
void TEXSIZE(Vector4f &dst, Float4 &lod, const Src&); void TEXSIZE(Vector4f &dst, Float4 &lod, const Src&);
void sampleTexture(Vector4f &c, const Src &s, Float4 &u, Float4 &v, Float4 &w, Float4 &q, SamplerMethod method); void sampleTexture(Vector4f &c, const Src &s, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &dsx, Vector4f &dsy, SamplerMethod method);
SamplerCore *sampler[VERTEX_TEXTURE_IMAGE_UNITS]; SamplerCore *sampler[VERTEX_TEXTURE_IMAGE_UNITS];
......
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