Skip to content

Commit

Permalink
Remove residue of texcoord replacement
Browse files Browse the repository at this point in the history
Change-Id: I063e3590d4ea79b2d28cc1af3a213ab37b76723d
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31248
Tested-by: Chris Forbes <chrisforbes@google.com>
Presubmit-Ready: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
  • Loading branch information
chrisforbes committed Jun 5, 2019
1 parent 5b424e6 commit 5c9e165
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 36 deletions.
1 change: 0 additions & 1 deletion src/Device/SetupProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ namespace sw
state.cullMode = context->cullMode;
state.twoSidedStencil = context->stencilActive() && context->twoSidedStencil;
state.slopeDepthBias = context->slopeDepthBias != 0.0f;
state.vFace = context->pixelShader && context->pixelShader->hasBuiltinInput(spv::BuiltInFrontFacing);

state.multiSample = context->sampleCount;
state.rasterizerDiscard = context->rasterizerDiscard;
Expand Down
1 change: 0 additions & 1 deletion src/Device/SetupProcessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace sw
VkCullModeFlags cullMode : BITS(VK_CULL_MODE_FLAG_BITS_MAX_ENUM);
bool twoSidedStencil : 1;
bool slopeDepthBias : 1;
bool vFace : 1;
unsigned int multiSample : 3; // 1, 2 or 4
bool rasterizerDiscard : 1;

Expand Down
39 changes: 6 additions & 33 deletions src/Pipeline/SetupRoutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,15 +444,11 @@ namespace sw

for (int interpolant = 0; interpolant < MAX_INTERFACE_COMPONENTS; interpolant++)
{
// Note: `sprite` mode controls whether to replace this interpolant with the point sprite PointCoord value.
// This was an interesting thing to support for old GL because any texture coordinate could be replaced in this way.
// In modern GL and in Vulkan, the [gl_]PointCoord builtin variable to the fragment shader is used instead.
if (state.gradient[interpolant].Type != SpirvShader::ATTRIBTYPE_UNUSED)
setupGradient(primitive, tri, w012, M, v0, v1, v2,
OFFSET(Vertex, v[interpolant]),
OFFSET(Primitive, V[interpolant]),
state.gradient[interpolant].Flat,
false /* is pointcoord */,
!state.gradient[interpolant].NoPerspective, 0);
}

Expand All @@ -462,38 +458,15 @@ namespace sw
routine = function("SetupRoutine");
}

void SetupRoutine::setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flat, bool sprite, bool perspective, int component)
void SetupRoutine::setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flat, bool perspective, int component)
{
Float4 i;

if(!flat)
{
if(!sprite)
{
i.x = *Pointer<Float>(v0 + attribute);
i.y = *Pointer<Float>(v1 + attribute);
i.z = *Pointer<Float>(v2 + attribute);
i.w = 0;
}
else
{
if(component == 0) i.x = 0.5f;
if(component == 1) i.x = 0.5f;
if(component == 2) i.x = 0.0f;
if(component == 3) i.x = 1.0f;

if(component == 0) i.y = 1.0f;
if(component == 1) i.y = 0.5f;
if(component == 2) i.y = 0.0f;
if(component == 3) i.y = 1.0f;

if(component == 0) i.z = 0.5f;
if(component == 1) i.z = 1.0f;
if(component == 2) i.z = 0.0f;
if(component == 3) i.z = 1.0f;

i.w = 0;
}
Float4 i;
i.x = *Pointer<Float>(v0 + attribute);
i.y = *Pointer<Float>(v1 + attribute);
i.z = *Pointer<Float>(v2 + attribute);
i.w = 0;

if(!perspective)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Pipeline/SetupRoutine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace sw
Routine *getRoutine();

private:
void setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flatShading, bool sprite, bool perspective, int component);
void setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flatShading, bool perspective, int component);
void edge(Pointer<Byte> &primitive, Pointer<Byte> &data, const Int &Xa, const Int &Ya, const Int &Xb, const Int &Yb, Int &q);
void conditionalRotate1(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2);
void conditionalRotate2(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2);
Expand Down

0 comments on commit 5c9e165

Please sign in to comment.