Commit 44ffb65e by Nicolas Capens

Implement OpenGL single-color specular lighting.

Change-Id: I40f9ad720bdbd93c44be8fb991dfbf055a3eceba Reviewed-on: https://swiftshader-review.googlesource.com/3803Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 6aea1b27
......@@ -47,7 +47,8 @@ namespace es1
setAlphaCompare(ALPHA_ALWAYS);
setAlphaBlendEnable(false);
setFogEnable(false);
setSpecularEnable(false);
setSpecularEnable(true);
setLocalViewer(false);
setFogColor(0);
setPixelFogMode(FOG_NONE);
setFogStart(0.0f);
......
......@@ -31,6 +31,7 @@ namespace sw
bool booleanFaceRegister = false;
bool fullPixelPositionRegister = false;
bool leadingVertexFirst = false; // Flat shading uses first vertex, else last
bool secondaryColor = false; // Specular lighting is applied after texturing
bool forceWindowed = false;
bool quadLayoutEnabled = false;
......
......@@ -45,12 +45,13 @@ namespace sw
extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
extern bool booleanFaceRegister;
extern bool fullPixelPositionRegister;
extern bool leadingVertexFirst; // Flat shading uses first vertex, else last
extern bool secondaryColor; // Specular lighting is applied after texturing
extern bool forceWindowed;
extern bool complementaryDepthBuffer;
extern bool postBlendSRGB;
extern bool exactColorRounding;
extern bool leadingVertexFirst;
extern TransparencyAntialiasing transparencyAntialiasing;
extern bool forceClearRegisters;
......@@ -107,6 +108,7 @@ namespace sw
sw::booleanFaceRegister = conventions.booleanFaceRegister;
sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
sw::leadingVertexFirst = conventions.leadingVertexFirst;
sw::secondaryColor = conventions.secondaryColor;
sw::exactColorRounding = exactColorRounding;
setRenderTarget(0, 0);
......
......@@ -61,15 +61,17 @@ namespace sw
bool booleanFaceRegister;
bool fullPixelPositionRegister;
bool leadingVertexFirst;
bool secondaryColor;
};
static const Conventions OpenGL =
{
true, // halfIntegerCoordinates
true, // symmetricNormalizedDepth
true, // booleanFaceRegister
true, // fullPixelPositionRegister
false // leadingVertexFirst
true, // halfIntegerCoordinates
true, // symmetricNormalizedDepth
true, // booleanFaceRegister
true, // fullPixelPositionRegister
false, // leadingVertexFirst
false // secondaryColor
};
static const Conventions Direct3D =
......@@ -78,7 +80,8 @@ namespace sw
false, // symmetricNormalizedDepth
false, // booleanFaceRegister
false, // fullPixelPositionRegister
true // leadingVertexFirst
true, // leadingVertexFirst
true, // secondardyColor
};
struct Query
......
......@@ -24,6 +24,8 @@
namespace sw
{
extern bool secondaryColor;
VertexPipeline::VertexPipeline(const VertexProcessor::State &state) : VertexRoutine(state, 0)
{
}
......@@ -379,9 +381,18 @@ namespace sw
spec.y = Max(spec.y, Float4(0.0f));
spec.z = Max(spec.z, Float4(0.0f));
r.o[D1].x = r.o[D1].x + spec.x;
r.o[D1].y = r.o[D1].y + spec.y;
r.o[D1].z = r.o[D1].z + spec.z;
if(secondaryColor)
{
r.o[D1].x = r.o[D1].x + spec.x;
r.o[D1].y = r.o[D1].y + spec.y;
r.o[D1].z = r.o[D1].z + spec.z;
}
else
{
r.o[D0].x = r.o[D0].x + spec.x;
r.o[D0].y = r.o[D0].y + spec.y;
r.o[D0].z = r.o[D0].z + spec.z;
}
}
}
......
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