mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Correct prescale issues with render-to-texture.
Still need to apply the scaling of the texture coordinates here (or somewhere, maybe we prescale that as well? Except it's figured later on in the process...)
This commit is contained in:
parent
2e0f9e5603
commit
941988cde4
4 changed files with 4 additions and 11 deletions
|
@ -469,7 +469,6 @@ void ShaderManagerDX9::VSUpdateUniforms(int dirtyUniforms) {
|
|||
// Not sure what GE_TEXMAP_UNKNOWN is, but seen in Riviera. Treating the same as GE_TEXMAP_TEXTURE_COORDS works.
|
||||
case GE_TEXMAP_UNKNOWN:
|
||||
if (g_Config.bPrescaleUV) {
|
||||
// Shouldn't even get here as we won't use the uniform in the shader.
|
||||
// We are here but are prescaling UV in the decoder? Let's do the same as in the other case
|
||||
// except consider *Scale and *Off to be 1 and 0.
|
||||
uvscaleoff[0] = widthFactor;
|
||||
|
|
|
@ -134,7 +134,7 @@ void GenerateVertexShaderDX9(const ShaderID &id, char *buffer) {
|
|||
}
|
||||
#endif
|
||||
}
|
||||
if (doTexture && (!prescale || uvGenMode == GE_TEXMAP_ENVIRONMENT_MAP || uvGenMode == GE_TEXMAP_TEXTURE_MATRIX)) {
|
||||
if (doTexture) {
|
||||
WRITE(p, "float4 u_uvscaleoffset : register(c%i);\n", CONST_VS_UVSCALEOFFSET);
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -506,7 +506,7 @@ void GenerateVertexShaderDX9(const ShaderID &id, char *buffer) {
|
|||
case GE_TEXMAP_UNKNOWN: // Not sure what this is, but Riviera uses it. Treating as coords works.
|
||||
if (prescale) {
|
||||
if (hasTexcoord) {
|
||||
WRITE(p, " Out.v_texcoord = In.texcoord;\n");
|
||||
WRITE(p, " Out.v_texcoord = In.texcoord * u_uvscaleoffset.xy;\n");
|
||||
} else {
|
||||
WRITE(p, " Out.v_texcoord = float2(0.0, 0.0);\n");
|
||||
}
|
||||
|
|
|
@ -544,7 +544,6 @@ void LinkedShader::UpdateUniforms(u32 vertType) {
|
|||
// Not sure what GE_TEXMAP_UNKNOWN is, but seen in Riviera. Treating the same as GE_TEXMAP_TEXTURE_COORDS works.
|
||||
case GE_TEXMAP_UNKNOWN:
|
||||
if (g_Config.bPrescaleUV) {
|
||||
// Shouldn't even get here as we won't use the uniform in the shader.
|
||||
// We are here but are prescaling UV in the decoder? Let's do the same as in the other case
|
||||
// except consider *Scale and *Off to be 1 and 0.
|
||||
uvscaleoff[0] = widthFactor;
|
||||
|
@ -795,11 +794,6 @@ bool ShaderManager::DebugAreShadersCompatibleForLinking(Shader *vs, Shader *fs)
|
|||
}
|
||||
|
||||
Shader *ShaderManager::ApplyVertexShader(int prim, u32 vertType) {
|
||||
// This doesn't work - we miss some events that really do need to dirty the prescale.
|
||||
// like changing the texmapmode.
|
||||
// if (g_Config.bPrescaleUV)
|
||||
// globalDirty_ &= ~DIRTY_UVSCALEOFFSET;
|
||||
|
||||
if (globalDirty_) {
|
||||
if (lastShader_)
|
||||
lastShader_->dirtyUniforms |= globalDirty_;
|
||||
|
|
|
@ -247,7 +247,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
|
|||
}
|
||||
#endif
|
||||
}
|
||||
if (doTexture && (!prescale || uvGenMode == GE_TEXMAP_ENVIRONMENT_MAP || uvGenMode == GE_TEXMAP_TEXTURE_MATRIX)) {
|
||||
if (doTexture) {
|
||||
WRITE(p, "uniform vec4 u_uvscaleoffset;\n");
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
|
@ -595,7 +595,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
|
|||
case GE_TEXMAP_UNKNOWN: // Not sure what this is, but Riviera uses it. Treating as coords works.
|
||||
if (prescale) {
|
||||
if (hasTexcoord) {
|
||||
WRITE(p, " v_texcoord = texcoord;\n");
|
||||
WRITE(p, " v_texcoord = texcoord * u_uvscaleoffset.xy;\n");
|
||||
} else {
|
||||
WRITE(p, " v_texcoord = vec2(0.0);\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue