Fix bug in hardware skinning, improve shader viewer

This commit is contained in:
Henrik Rydgard 2015-10-14 20:17:12 +02:00
parent 1308a90fd1
commit 4e26561d78
2 changed files with 17 additions and 17 deletions

View File

@ -342,12 +342,12 @@ std::string FragmentShaderDesc(const ShaderID &id) {
if (id.Bit(BIT_DO_TEXTURE_PROJ)) desc << "TexProj ";
if (id.Bit(BIT_FLIP_TEXTURE)) desc << "Flip ";
if (id.Bit(BIT_TEXALPHA)) desc << "TexAlpha ";
if (id.Bit(BIT_TEXTURE_AT_OFFSET)) desc << "TexOffset ";
if (id.Bit(BIT_TEXTURE_AT_OFFSET)) desc << "TexOffs ";
if (id.Bit(BIT_LMODE)) desc << "LM ";
if (id.Bit(BIT_ENABLE_FOG)) desc << "Fog ";
if (id.Bit(BIT_COLOR_DOUBLE)) desc << "Double ";
if (id.Bit(BIT_COLOR_DOUBLE)) desc << "2x ";
if (id.Bit(BIT_FLATSHADE)) desc << "Flat ";
if (id.Bit(BIT_SHADER_TEX_CLAMP)) desc << "Texclamp ";
if (id.Bit(BIT_SHADER_TEX_CLAMP)) desc << "TClamp ";
if (id.Bit(BIT_CLAMP_S)) desc << "ClampS ";
if (id.Bit(BIT_CLAMP_T)) desc << "ClampT ";
if (id.Bits(BIT_REPLACE_BLEND, 3)) {
@ -356,21 +356,21 @@ std::string FragmentShaderDesc(const ShaderID &id) {
switch (id.Bits(BIT_STENCIL_TO_ALPHA, 2)) {
case REPLACE_ALPHA_NO: break;
case REPLACE_ALPHA_YES: desc << "StencilToAlpha "; break;
case REPLACE_ALPHA_DUALSOURCE: desc << "StencilToAlphaDual "; break;
case REPLACE_ALPHA_YES: desc << "StenToAlpha "; break;
case REPLACE_ALPHA_DUALSOURCE: desc << "StenToAlphaDual "; break;
}
if (id.Bits(BIT_STENCIL_TO_ALPHA, 2) != REPLACE_ALPHA_NO) {
switch (id.Bits(BIT_REPLACE_ALPHA_WITH_STENCIL_TYPE, 4)) {
case STENCIL_VALUE_UNIFORM: desc << "StencilUniform "; break;
case STENCIL_VALUE_ZERO: desc << "StencilZero "; break;
case STENCIL_VALUE_ONE: desc << "StencilOne "; break;
case STENCIL_VALUE_KEEP: desc << "StencilKeep "; break;
case STENCIL_VALUE_INVERT: desc << "StencilInv "; break;
case STENCIL_VALUE_INCR_4: desc << "StencilIncr4 "; break;
case STENCIL_VALUE_INCR_8: desc << "StencilIncr8 "; break;
case STENCIL_VALUE_DECR_4: desc << "StencilDecr4 "; break;
case STENCIL_VALUE_DECR_8: desc << "StencilDecr4 "; break;
default: desc << "StencilUnknown"; break;
case STENCIL_VALUE_UNIFORM: desc << "StenUniform "; break;
case STENCIL_VALUE_ZERO: desc << "Sten0 "; break;
case STENCIL_VALUE_ONE: desc << "Sten1 "; break;
case STENCIL_VALUE_KEEP: desc << "StenKeep "; break;
case STENCIL_VALUE_INVERT: desc << "StenInv "; break;
case STENCIL_VALUE_INCR_4: desc << "StenIncr4 "; break;
case STENCIL_VALUE_INCR_8: desc << "StenIncr8 "; break;
case STENCIL_VALUE_DECR_4: desc << "StenDecr4 "; break;
case STENCIL_VALUE_DECR_8: desc << "StenDecr4 "; break;
default: desc << "StenUnknown"; break;
}
}
if (id.Bit(BIT_DO_TEXTURE)) {

View File

@ -191,7 +191,7 @@ void ComputeVertexShaderID(ShaderID *id_out, u32 vertType, bool useHWTransform)
// 2 bits. We should probably send in the weight scalefactor as a uniform instead,
// or simply preconvert all weights to floats.
id.SetBits(BIT_WEIGHT_FMTSCALE, 2, vertTypeGetWeightMask(vertType));
id.SetBits(BIT_WEIGHT_FMTSCALE, 2, (vertType & GE_VTYPE_WEIGHT_MASK) >> GE_VTYPE_WEIGHT_SHIFT);
id.SetBit(BIT_NORM_REVERSE, gstate.areNormalsReversed());
if (doTextureProjection && gstate.getUVProjMode() == GE_PROJMAP_UV) {
id.SetBits(BIT_TEXCOORD_FMTSCALE, 2, (vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT); // two bits
@ -535,7 +535,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
WRITE(p, " mediump vec3 worldnormal = vec3(0.0, 0.0, 1.0);\n");
} else {
static const char *rescale[4] = {"", " * 1.9921875", " * 1.999969482421875", ""}; // 2*127.5f/128.f, 2*32767.5f/32768.f, 1.0f};
const char *factor = rescale[texFmtScale];
const char *factor = rescale[boneWeightScale];
static const char * const boneWeightAttr[8] = {
"w1.x", "w1.y", "w1.z", "w1.w",