mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
softgpu: Save last tc/normal in vertex reading.
Matches PSP behavior, reusing last set values.
This commit is contained in:
parent
59f11df98b
commit
b3c0f177e2
2 changed files with 9 additions and 4 deletions
|
@ -226,7 +226,6 @@ static inline u8 ClampFogDepth(float fogdepth) {
|
|||
static inline void GetTextureCoordinates(const VertexData& v0, const VertexData& v1, const float p, float &s, float &t) {
|
||||
// All UV gen modes, by the time they get here, behave the same.
|
||||
|
||||
// TODO: What happens if vertex has no texture coordinates?
|
||||
// Note that for environment mapping, texture coordinates have been calculated during lighting
|
||||
float q0 = 1.f / v0.clippos.w;
|
||||
float q1 = 1.f / v1.clippos.w;
|
||||
|
@ -241,7 +240,6 @@ static inline void GetTextureCoordinates(const VertexData& v0, const VertexData&
|
|||
static inline void GetTextureCoordinates(const VertexData &v0, const VertexData &v1, const VertexData &v2, const Vec4<int> &w0, const Vec4<int> &w1, const Vec4<int> &w2, const Vec4<float> &wsum_recip, Vec4<float> &s, Vec4<float> &t) {
|
||||
// All UV gen modes, by the time they get here, behave the same.
|
||||
|
||||
// TODO: What happens if vertex has no texture coordinates?
|
||||
// Note that for environment mapping, texture coordinates have been calculated during lighting.
|
||||
float q0 = 1.f / v0.clippos.w;
|
||||
float q1 = 1.f / v1.clippos.w;
|
||||
|
|
|
@ -317,24 +317,31 @@ void ComputeTransformState(TransformState *state, const VertexReader &vreader) {
|
|||
|
||||
VertexData TransformUnit::ReadVertex(VertexReader &vreader, const TransformState &state) {
|
||||
PROFILE_THIS_SCOPE("read_vert");
|
||||
// If we ever thread this, we'll have to change this.
|
||||
VertexData vertex;
|
||||
|
||||
ModelCoords pos;
|
||||
// VertexDecoder normally scales z, but we want it unscaled.
|
||||
vreader.ReadPosThroughZ16(pos.AsArray());
|
||||
|
||||
static Vec2f lastTC;
|
||||
if (state.readUV) {
|
||||
vreader.ReadUV(vertex.texturecoords.AsArray());
|
||||
lastTC = vertex.texturecoords;
|
||||
} else {
|
||||
vertex.texturecoords.SetZero();
|
||||
vertex.texturecoords = lastTC;
|
||||
}
|
||||
|
||||
Vec3<float> normal;
|
||||
Vec3f normal;
|
||||
static Vec3f lastnormal;
|
||||
if (vreader.hasNormal()) {
|
||||
vreader.ReadNrm(normal.AsArray());
|
||||
lastnormal = normal;
|
||||
|
||||
if (state.negateNormals)
|
||||
normal = -normal;
|
||||
} else {
|
||||
normal = lastnormal;
|
||||
}
|
||||
|
||||
if (state.readWeights) {
|
||||
|
|
Loading…
Add table
Reference in a new issue