diff --git a/src/materialsystem/stdshaders/screenspace_general.cpp b/src/materialsystem/stdshaders/screenspace_general.cpp index ece1b9d58e1..fd853e5cbc8 100644 --- a/src/materialsystem/stdshaders/screenspace_general.cpp +++ b/src/materialsystem/stdshaders/screenspace_general.cpp @@ -245,7 +245,9 @@ BEGIN_VS_SHADER_FLAGS( screenspace_general_dx9, "Help for screenspace_general", BindTexture( SHADER_SAMPLER0, BASETEXTURE, -1 ); ITexture *pTarget = params[ BASETEXTURE ]->GetTextureValue(); - float vPixelSize[4] = { 1.0f / pTarget->GetActualWidth(), 1.0f / pTarget->GetActualHeight(), 0.0f, 0.0f }; + int nWidth = pTexture->GetActualWidth(); + int nHeight = pTexture->GetActualHeight(); + float vPixelSize[4] = { 1.0f / nWidth, 1.0f / nHeight, nWidth, nHeight }; pShaderAPI->SetPixelShaderConstant( 4, vPixelSize, 1 ); } @@ -254,7 +256,9 @@ BEGIN_VS_SHADER_FLAGS( screenspace_general_dx9, "Help for screenspace_general", BindTexture( SHADER_SAMPLER1, TEXTURE1, -1 ); ITexture *pTarget = params[ TEXTURE1 ]->GetTextureValue(); - float vPixelSize[4] = { 1.0f / pTarget->GetActualWidth(), 1.0f / pTarget->GetActualHeight(), 0.0f, 0.0f }; + int nWidth = pTexture->GetActualWidth(); + int nHeight = pTexture->GetActualHeight(); + float vPixelSize[4] = { 1.0f / nWidth, 1.0f / nHeight, nWidth, nHeight }; pShaderAPI->SetPixelShaderConstant( 5, vPixelSize, 1 ); } @@ -263,7 +267,9 @@ BEGIN_VS_SHADER_FLAGS( screenspace_general_dx9, "Help for screenspace_general", BindTexture( SHADER_SAMPLER2, TEXTURE2, -1 ); ITexture *pTarget = params[ TEXTURE2 ]->GetTextureValue(); - float vPixelSize[4] = { 1.0f / pTarget->GetActualWidth(), 1.0f / pTarget->GetActualHeight(), 0.0f, 0.0f }; + int nWidth = pTexture->GetActualWidth(); + int nHeight = pTexture->GetActualHeight(); + float vPixelSize[4] = { 1.0f / nWidth, 1.0f / nHeight, nWidth, nHeight }; pShaderAPI->SetPixelShaderConstant( 6, vPixelSize, 1 ); } @@ -272,7 +278,9 @@ BEGIN_VS_SHADER_FLAGS( screenspace_general_dx9, "Help for screenspace_general", BindTexture( SHADER_SAMPLER3, TEXTURE3, -1 ); ITexture *pTarget = params[ TEXTURE3 ]->GetTextureValue(); - float vPixelSize[4] = { 1.0f / pTarget->GetActualWidth(), 1.0f / pTarget->GetActualHeight(), 0.0f, 0.0f }; + int nWidth = pTexture->GetActualWidth(); + int nHeight = pTexture->GetActualHeight(); + float vPixelSize[4] = { 1.0f / nWidth, 1.0f / nHeight, nWidth, nHeight }; pShaderAPI->SetPixelShaderConstant( 7, vPixelSize, 1 ); }