Missed these

This commit is contained in:
Henrik Rydgard 2013-09-21 23:44:11 +02:00
parent 82e5787bbe
commit 01def3b6cc
7 changed files with 12 additions and 13 deletions

View File

@ -123,7 +123,7 @@ LinkedShaderDX9::LinkedShaderDX9(VSShader *vs, PSShader *fs, u32 vertType, bool
u_world = GetConstantByName("u_world");
u_texmtx = GetConstantByName("u_texmtx");
if (gstate.getWeightMask() != 0)
if (vertTypeGetWeightMask(vertType) != 0)
numBones = TranslateNumBonesDX9(vertTypeGetNumBoneWeights(vertType));
else
numBones = 0;

View File

@ -60,7 +60,7 @@ void TransformDrawEngineDX9::DrawBezier(int ucount, int vcount) {
}
}
if (!gstate.getTexCoordMask()) {
if (!vertTypeGetTexCoordMask(gstate.vertType)) {
VertexDecoderDX9 *dec = GetVertexDecoder(gstate.vertType);
dec->SetVertexType(gstate.vertType);
u32 newVertType = dec->InjectUVs(decoded2, Memory::GetPointer(gstate_c.vertexAddr), customUV, 16);

View File

@ -56,7 +56,7 @@ void ComputeVertexShaderIDDX9(VertexShaderIDDX9 *id, int prim, bool useHWTransfo
bool hasColor = (vertType & GE_VTYPE_COL_MASK) != 0;
bool hasNormal = (vertType & GE_VTYPE_NRM_MASK) != 0;
bool hasBones = gstate.getWeightMask() != GE_VTYPE_WEIGHT_NONE;
bool hasBones = vertTypeGetWeightMask(vertType) != GE_VTYPE_WEIGHT_NONE;
bool enableFog = gstate.isFogEnabled() && !gstate.isModeThrough() && !gstate.isModeClear();
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled();
@ -171,7 +171,7 @@ void GenerateVertexShaderDX9(int prim, char *buffer, bool useHWTransform) {
WRITE(p, "float4x4 u_view;\n");
if (gstate.getUVGenMode() == 1)
WRITE(p, "float4x4 u_texmtx;\n");
if (gstate.getWeightMask() != GE_VTYPE_WEIGHT_NONE) {
if (vertTypeGetWeightMask(vertType) != GE_VTYPE_WEIGHT_NONE) {
int numBones = TranslateNumBonesDX9(vertTypeGetNumBoneWeights(vertType));
#ifdef USE_BONE_ARRAY
WRITE(p, "float4x4 u_bone[%i];\n", numBones);
@ -222,7 +222,7 @@ void GenerateVertexShaderDX9(int prim, char *buffer, bool useHWTransform) {
WRITE(p, " struct VS_IN \n");
WRITE(p, " \n");
WRITE(p, " { \n");
if (gstate.getWeightMask() != GE_VTYPE_WEIGHT_NONE) {
if (vertTypeGetWeightMask(vertType) != GE_VTYPE_WEIGHT_NONE) {
WRITE(p, "%s", boneWeightAttrDecl[TranslateNumBonesDX9(vertTypeGetNumBoneWeights(vertType))]);
}
if (doTexture) {
@ -278,7 +278,7 @@ void GenerateVertexShaderDX9(int prim, char *buffer, bool useHWTransform) {
WRITE(p, " VS_OUT Out = (VS_OUT)0; \n");
if (useHWTransform) {
// Step 1: World Transform / Skinning
if (gstate.getWeightMask() == GE_VTYPE_WEIGHT_NONE) {
if (vertTypeGetWeightMask(vertType) == GE_VTYPE_WEIGHT_NONE) {
// No skinning, just standard T&L.
WRITE(p, " float3 worldpos = mul(float4(In.ObjPos.xyz, 1.0), u_world).xyz;\n");
if (hasNormal)
@ -289,7 +289,7 @@ void GenerateVertexShaderDX9(int prim, char *buffer, bool useHWTransform) {
int numWeights = TranslateNumBonesDX9(vertTypeGetNumBoneWeights(vertType));
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[gstate.getWeightMask() >> GE_VTYPE_WEIGHT_SHIFT];
const char *factor = rescale[vertTypeGetWeightMask(vertType) >> GE_VTYPE_WEIGHT_SHIFT];
static const char * const boneWeightAttr[8] = {
"a_w1.x", "a_w1.y", "a_w1.z", "a_w1.w",

View File

@ -343,7 +343,7 @@ void LinkedShader::updateUniforms() {
// Not sure what GE_TEXMAP_UNKNOWN is, but seen in Riviera. Treating the same as GE_TEXMAP_TEXTURE_COORDS works.
if (gstate.getUVGenMode() == GE_TEXMAP_TEXTURE_COORDS || gstate.getUVGenMode() == GE_TEXMAP_UNKNOWN) {
static const float rescale[4] = {1.0f, 2*127.5f/128.f, 2*32767.5f/32768.f, 1.0f};
float factor = rescale[gstate.getTexCoordMask() >> GE_VTYPE_TC_SHIFT];
float factor = rescale[(gstate.vertType & GE_VTYPE_TC_MASK) >> GE_VTYPE_TC_SHIFT];
uvscaleoff[0] = gstate_c.uv.uScale * factor * widthFactor;
uvscaleoff[1] = gstate_c.uv.vScale * factor * heightFactor;
uvscaleoff[2] = gstate_c.uv.uOff * widthFactor;

View File

@ -174,7 +174,7 @@ void TransformDrawEngine::DrawBezier(int ucount, int vcount) {
}
}
if (!gstate.getTexCoordMask()) {
if (!vertTypeGetTexCoordMask(gstate.vertType)) {
VertexDecoder *dec = GetVertexDecoder(gstate.vertType);
dec->SetVertexType(gstate.vertType);
u32 newVertType = dec->InjectUVs(decoded2, Memory::GetPointer(gstate_c.vertexAddr), customUV, 16);

View File

@ -107,7 +107,7 @@ void ComputeVertexShaderID(VertexShaderID *id, u32 vertType, int prim, bool useH
}
}
id->d[1] |= gstate.isLightingEnabled() << 24;
id->d[1] |= (gstate.getWeightMask() >> GE_VTYPE_WEIGHT_SHIFT) << 25;
id->d[1] |= (vertTypeGetWeightMask(vertType) >> GE_VTYPE_WEIGHT_SHIFT) << 25;
}
}
@ -308,7 +308,7 @@ void GenerateVertexShader(int prim, u32 vertType, char *buffer, bool useHWTransf
int numWeights = TranslateNumBones(vertTypeGetNumBoneWeights(vertType));
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[gstate.getWeightMask() >> GE_VTYPE_WEIGHT_SHIFT];
const char *factor = rescale[vertTypeGetWeightMask(vertType) >> GE_VTYPE_WEIGHT_SHIFT];
static const char * const boneWeightAttr[8] = {
"a_w1.x", "a_w1.y", "a_w1.z", "a_w1.w",

View File

@ -368,8 +368,6 @@ struct GPUgstate
// Vertex type
bool isModeThrough() const { return (vertType & GE_VTYPE_THROUGH) != 0; }
int getWeightMask() const { return vertType & GE_VTYPE_WEIGHT_MASK; }
int getTexCoordMask() const { return vertType & GE_VTYPE_TC_MASK; }
bool areNormalsReversed() const { return reversenormals & 1; }
GEPatchPrimType getPatchPrimitiveType() const { return static_cast<GEPatchPrimType>(patchprimitive & 3); }
@ -402,6 +400,7 @@ enum SkipDrawReasonFlags {
inline bool vertTypeIsSkinningEnabled(u32 vertType) { return ((vertType & GE_VTYPE_WEIGHT_MASK) != GE_VTYPE_WEIGHT_NONE); }
inline int vertTypeGetNumBoneWeights(u32 vertType) { return 1 + ((vertType & GE_VTYPE_WEIGHTCOUNT_MASK) >> GE_VTYPE_WEIGHTCOUNT_SHIFT); }
inline int vertTypeGetWeightMask(u32 vertType) { return vertType & GE_VTYPE_WEIGHT_MASK; }
inline int vertTypeGetTexCoordMask(u32 vertType) { return vertType & GE_VTYPE_TC_MASK; }
// The rest is cached simplified/converted data for fast access.