MAMEWorld >> EmuChat
View all threads Index   Flat Mode Flat  

OllieDixon
MAME Fan
Reged: 09/26/14
Posts: 4
Send PM
HLSL scale2x not possible anymore?
09/26/14 07:32 AM


I love the look of scale2x and Real_Scanlines.png. In an older version of MAME, I used to be able to just replace the deconverge.fx with one set up to recreate hq2x or scale2x. I just started using MAME 154.. Something has changed i guess as it no longer works.

I know i could just use MAME Plus!... I just dislike it. Need to find random BIOS files and tons of random games don't work from the official mame set.

Any ideas?

EDIT: This is what i used to use.


Code:

//-----------------------------------------------------------------------------
// Scale2x Effect
//-----------------------------------------------------------------------------

texture Diffuse;

sampler DiffuseSampler = sampler_state
{
Texture = ;
MipFilter = POINT;
MinFilter = POINT;
MagFilter = POINT;
AddressU = CLAMP;
AddressV = CLAMP;
AddressW = CLAMP;
};

//-----------------------------------------------------------------------------
// Vertex Definitions
//-----------------------------------------------------------------------------

struct VS_OUTPUT
{
float4 Position : POSITION;
float2 TexCoord : TEXCOORD0;
float2 LeftCoord : TEXCOORD1;
float2 RightCoord : TEXCOORD2;
float2 TopCoord : TEXCOORD3;
float2 BottomCoord : TEXCOORD4;
};

struct VS_INPUT
{
float4 Position : POSITION;
float4 Color : COLOR0;
float2 TexCoord : TEXCOORD0;
};

struct PS_INPUT
{
float2 TexCoord : TEXCOORD0;
float2 LeftCoord : TEXCOORD1;
float2 RightCoord : TEXCOORD2;
float2 TopCoord : TEXCOORD3;
float2 BottomCoord : TEXCOORD4;
};

//-----------------------------------------------------------------------------
// Scale2x Vertex Shader
//-----------------------------------------------------------------------------

float TargetWidth;
float TargetHeight;

float RawWidth;
float RawHeight;

VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;

Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.x /= TargetWidth;
Output.Position.y /= TargetHeight;
Output.Position.y = 1.0f - Output.Position.y;
Output.Position.x -= 0.5f;
Output.Position.y -= 0.5f;
Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);

float2 PixWidth = float2(1.0f / RawWidth, 0.0f);
float2 PixHeight = float2(0.0f, 1.0f / RawHeight);

Output.TexCoord = Input.TexCoord;
Output.LeftCoord = Input.TexCoord - PixWidth;
Output.RightCoord = Input.TexCoord + PixWidth;
Output.TopCoord = Input.TexCoord - PixHeight;
Output.BottomCoord = Input.TexCoord + PixHeight;

return Output;
}

//-----------------------------------------------------------------------------
// Scale2x Pixel Shader
//-----------------------------------------------------------------------------

float4 ps_main(PS_INPUT Input) : COLOR
{
float4 Center = tex2D(DiffuseSampler, Input.TexCoord);
float4 Left = tex2D(DiffuseSampler, Input.LeftCoord);
float4 Right = tex2D(DiffuseSampler, Input.RightCoord);
float4 Up = tex2D(DiffuseSampler, Input.TopCoord);
float4 Bottom = tex2D(DiffuseSampler, Input.BottomCoord);

float2 PixelSize = frac(Input.TexCoord * float2(RawWidth, RawHeight));

// Split along the texel centerpoint
if(PixelSize.y >= 0.5f)
{
float4 swap = Up;
Up = Bottom;
Bottom = swap;
}

if(PixelSize.x >= 0.5f)
{
float4 swap = Left;
Left = Right;
Right = swap;
}

float Match1 = Up == Left;
float Match2 = Up != Right;
float Match3 = Left != Bottom;

if(Match1 && Match2 && Match3)
{
Center = Left;
}

return Center;
}

//-----------------------------------------------------------------------------
// Scale2x Effect
//-----------------------------------------------------------------------------

technique DeconvergeTechnique
{
pass Pass0
{
Lighting = FALSE;

VertexShader = compile vs_3_0 vs_main();
PixelShader = compile ps_3_0 ps_main();
}
}



Edited by OllieDixon (09/26/14 08:12 AM)







Entire thread
Subject Posted by Posted on
* HLSL scale2x not possible anymore? OllieDixon 09/26/14 07:32 AM
. * Re: HLSL scale2x not possible anymore? lamprey  09/26/14 07:59 AM
. * Re: HLSL scale2x not possible anymore? Mamesick  09/26/14 08:58 AM
. * Re: HLSL scale2x not possible anymore? OllieDixon  09/26/14 09:24 AM
. * Re: HLSL scale2x not possible anymore? Outrun2006  09/28/14 02:44 PM
. * Re: HLSL scale2x not possible anymore? OllieDixon  09/28/14 10:20 PM
. * Re: HLSL scale2x not possible anymore? Traso  09/30/14 05:02 AM
. * Re: HLSL scale2x not possible anymore? OllieDixon  10/02/14 03:08 AM

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 136 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 2431