Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update file and symbol names to reflect the new technique name (SMAA).

  • Loading branch information...
commit 2805917d23805cc4780d74dc19a0bf244ee75601 1 parent 696cab2
@iryoku authored
View
46 Demo/DX10/Code/Demo.cpp
@@ -42,7 +42,7 @@
#include "Timer.h"
#include "RenderTarget.h"
#include "Copy.h"
-#include "MLAA.h"
+#include "SMAA.h"
using namespace std;
@@ -58,7 +58,7 @@ ID3DX10Font *font = NULL;
ID3DX10Sprite *sprite = NULL;
CDXUTTextHelper *txtHelper = NULL;
-MLAA *mlaa = NULL;
+SMAA *smaa = NULL;
DepthStencil *depthStencil = NULL;
RenderTarget *depthBufferRenderTarget = NULL;
BackbufferRenderTarget *backbufferRenderTarget = NULL;
@@ -216,19 +216,19 @@ void CALLBACK onDestroyDevice(void *context) {
}
-void initMLAA() {
+void initSMAA() {
int min, max;
float scale;
CDXUTSlider *slider = hud.GetSlider(IDC_MAXSEARCHSTEPS);
slider->GetRange(min, max);
scale = float(slider->GetValue()) / (max - min);
- mlaa->setMaxSearchSteps(int(round(scale * 98.0f)));
+ smaa->setMaxSearchSteps(int(round(scale * 98.0f)));
slider = hud.GetSlider(IDC_THRESHOLD);
slider->GetRange(min, max);
scale = float(slider->GetValue()) / (max - min);
- mlaa->setThreshold(scale * 0.5f);
+ smaa->setThreshold(scale * 0.5f);
}
@@ -239,8 +239,8 @@ HRESULT CALLBACK onResizedSwapChain(ID3D10Device *device, IDXGISwapChain *swapCh
hud.SetLocation(desc->Width - (45 + HUD_WIDTH), 0);
- mlaa = new MLAA(device, desc->Width, desc->Height);
- initMLAA();
+ smaa = new SMAA(device, desc->Width, desc->Height);
+ initSMAA();
depthStencil = new DepthStencil(device, desc->Width, desc->Height, DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT, DXGI_FORMAT_R24_UNORM_X8_TYPELESS);
depthBufferRenderTarget = new RenderTarget(device, desc->Width, desc->Height, DXGI_FORMAT_R32_FLOAT);
backbufferRenderTarget = new BackbufferRenderTarget(device, DXUTGetDXGISwapChain());
@@ -254,7 +254,7 @@ HRESULT CALLBACK onResizedSwapChain(ID3D10Device *device, IDXGISwapChain *swapCh
void CALLBACK onReleasingSwapChain(void *context) {
dialogResourceManager.OnD3D10ReleasingSwapChain();
- SAFE_DELETE(mlaa);
+ SAFE_DELETE(smaa);
SAFE_DELETE(depthStencil);
SAFE_DELETE(depthBufferRenderTarget);
SAFE_DELETE(backbufferRenderTarget);
@@ -297,7 +297,7 @@ void saveBackbuffer(ID3D10Device *device) {
void doBenchmark() {
- benchmarkFile << timer->getSection(L"MLAA") << endl;
+ benchmarkFile << timer->getSection(L"SMAA") << endl;
int next = hud.GetComboBox(IDC_INPUT)->GetSelectedIndex() + 1;
int n = hud.GetComboBox(IDC_INPUT)->GetNumItems();
@@ -316,10 +316,10 @@ void doBenchmark() {
void drawTextures(ID3D10Device *device) {
switch (int(hud.GetComboBox(IDC_VIEWMODE)->GetSelectedData())) {
case 1:
- Copy::go(*mlaa->getEdgeRenderTarget(), *backbufferRenderTarget);
+ Copy::go(*smaa->getEdgeRenderTarget(), *backbufferRenderTarget);
break;
case 2:
- Copy::go(*mlaa->getBlendRenderTarget(), *backbufferRenderTarget);
+ Copy::go(*smaa->getBlendRenderTarget(), *backbufferRenderTarget);
break;
default:
break;
@@ -342,24 +342,24 @@ void CALLBACK onFrameRender(ID3D10Device *device, double time, float elapsedTime
Copy::go(testColorSRV, *finalRenderTargetSRGB, &viewport);
Copy::go(testDepthSRV, *depthBufferRenderTarget, &viewport);
- // Run MLAA
+ // Run SMAA
if (hud.GetCheckBox(IDC_ANTIALIASING)->GetChecked()) {
- MLAA::Input input = MLAA::Input(int(hud.GetComboBox(IDC_DETECTIONMODE)->GetSelectedData()));
+ SMAA::Input input = SMAA::Input(int(hud.GetComboBox(IDC_DETECTIONMODE)->GetSelectedData()));
int n = hud.GetCheckBox(IDC_PROFILE)->GetChecked()? timer->getRepetitionsCount() : 1;
timer->start();
for (int i = 0; i < n; i++) { // This loop is just for profiling.
switch (input) {
- case MLAA::INPUT_LUMA:
- case MLAA::INPUT_COLOR:
- mlaa->go(*finalRenderTarget, *finalRenderTargetSRGB, *backbufferRenderTarget, *depthStencil, input);
+ case SMAA::INPUT_LUMA:
+ case SMAA::INPUT_COLOR:
+ smaa->go(*finalRenderTarget, *finalRenderTargetSRGB, *backbufferRenderTarget, *depthStencil, input);
break;
- case MLAA::INPUT_DEPTH:
- mlaa->go(*depthBufferRenderTarget, *finalRenderTargetSRGB, *backbufferRenderTarget, *depthStencil, input);
+ case SMAA::INPUT_DEPTH:
+ smaa->go(*depthBufferRenderTarget, *finalRenderTargetSRGB, *backbufferRenderTarget, *depthStencil, input);
break;
}
}
- timer->clock(L"MLAA");
+ timer->clock(L"SMAA");
} else {
Copy::go(*finalRenderTargetSRGB, *backbufferRenderTarget);
}
@@ -579,7 +579,7 @@ void CALLBACK onGUIEvent(UINT event, int id, CDXUTControl *control, void *contex
slider->GetRange(min, max);
float scale = float(slider->GetValue()) / (max - min);
- mlaa->setMaxSearchSteps(int(round(scale * 98.0f)));
+ smaa->setMaxSearchSteps(int(round(scale * 98.0f)));
wstringstream s;
s << L"Max Search Steps: " << int(round(scale * 98.0f));
@@ -593,7 +593,7 @@ void CALLBACK onGUIEvent(UINT event, int id, CDXUTControl *control, void *contex
slider->GetRange(min, max);
float scale = float(slider->GetValue()) / (max - min);
- mlaa->setThreshold(scale * 0.5f);
+ smaa->setThreshold(scale * 0.5f);
wstringstream s;
s << L"Threshold: " << scale * 0.5f;
@@ -634,7 +634,7 @@ void initApp() {
hud.GetComboBox(IDC_INPUT)->SetSelectedByData((LPVOID) -1);
}
- hud.AddCheckBox(IDC_ANTIALIASING, L"MLAA Anti-Aliasing", 35, iY += 24, HUD_WIDTH, 22, true);
+ hud.AddCheckBox(IDC_ANTIALIASING, L"SMAA Anti-Aliasing", 35, iY += 24, HUD_WIDTH, 22, true);
hud.AddCheckBox(IDC_PROFILE, L"Profile", 35, iY += 24, HUD_WIDTH, 22, false);
wstringstream s;
@@ -693,7 +693,7 @@ INT WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) {
return -1;
DXUTSetCursorSettings(true, true);
- if (FAILED(DXUTCreateWindow(L"Practical Morphological Anti-Aliasing Demo (Jimenez's MLAA)")))
+ if (FAILED(DXUTCreateWindow(L"SMAA: Subpixel Morphological Antialiasing")))
return -1;
if (FAILED(DXUTCreateDevice(true, 1280, 720)))
View
28 Demo/DX10/Code/MLAA.cpp → Demo/DX10/Code/SMAA.cpp
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -38,7 +38,7 @@
#include <sstream>
-#include "MLAA.h"
+#include "SMAA.h"
#include "SearchTex.h"
#include "AreaTex.h"
using namespace std;
@@ -94,7 +94,7 @@ class ID3D10IncludeResource : public ID3D10Include {
#pragma endregion
-MLAA::MLAA(ID3D10Device *device, int width, int height, const ExternalStorage &storage)
+SMAA::SMAA(ID3D10Device *device, int width, int height, const ExternalStorage &storage)
: device(device),
maxSearchSteps(8),
threshold(0.1f) {
@@ -106,17 +106,17 @@ MLAA::MLAA(ID3D10Device *device, int width, int height, const ExternalStorage &s
string pixelSizeText = s.str();
D3D10_SHADER_MACRO defines[3] = {
- {"MLAA_PIXEL_SIZE", pixelSizeText.c_str()},
+ {"SMAA_PIXEL_SIZE", pixelSizeText.c_str()},
{NULL, NULL}
};
/**
- * IMPORTANT! Here we load and compile the MLAA effect from a *RESOURCE*
+ * IMPORTANT! Here we load and compile the SMAA effect from a *RESOURCE*
* (Yeah, we like all-in-one executables for demos =)
* In case you want it to be loaded from other place change this line accordingly.
*/
ID3D10IncludeResource includeResource;
- V(D3DX10CreateEffectFromResource(GetModuleHandle(NULL), L"MLAA.fx", NULL, defines, &includeResource, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, device, NULL, NULL, &effect, NULL, NULL));
+ V(D3DX10CreateEffectFromResource(GetModuleHandle(NULL), L"SMAA.fx", NULL, defines, &includeResource, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, device, NULL, NULL, &effect, NULL, NULL));
// This is for rendering the typical fullscreen quad later on.
D3D10_PASS_DESC desc;
@@ -157,7 +157,7 @@ MLAA::MLAA(ID3D10Device *device, int width, int height, const ExternalStorage &s
}
-MLAA::~MLAA() {
+SMAA::~SMAA() {
SAFE_RELEASE(effect);
SAFE_DELETE(quad);
SAFE_DELETE(edgeRenderTarget);
@@ -169,7 +169,7 @@ MLAA::~MLAA() {
}
-void MLAA::go(ID3D10ShaderResourceView *edgesSRV,
+void SMAA::go(ID3D10ShaderResourceView *edgesSRV,
ID3D10ShaderResourceView *srcSRV,
ID3D10RenderTargetView *dstRTV,
ID3D10DepthStencilView *dsv,
@@ -214,7 +214,7 @@ void MLAA::go(ID3D10ShaderResourceView *edgesSRV,
}
-void MLAA::loadAreaTex() {
+void SMAA::loadAreaTex() {
HRESULT hr;
D3D10_SUBRESOURCE_DATA data;
@@ -243,7 +243,7 @@ void MLAA::loadAreaTex() {
V(device->CreateShaderResourceView(areaTex, &descSRV, &areaTexSRV));
}
-void MLAA::loadSearchTex() {
+void SMAA::loadSearchTex() {
HRESULT hr;
D3D10_SUBRESOURCE_DATA data;
@@ -273,7 +273,7 @@ void MLAA::loadSearchTex() {
}
-void MLAA::edgesDetectionPass(ID3D10DepthStencilView *dsv, Input input) {
+void SMAA::edgesDetectionPass(ID3D10DepthStencilView *dsv, Input input) {
HRESULT hr;
// Select the technique accordingly.
@@ -296,7 +296,7 @@ void MLAA::edgesDetectionPass(ID3D10DepthStencilView *dsv, Input input) {
}
-void MLAA::blendingWeightsCalculationPass(ID3D10DepthStencilView *dsv) {
+void SMAA::blendingWeightsCalculationPass(ID3D10DepthStencilView *dsv) {
HRESULT hr;
// Setup the technique (again).
@@ -309,7 +309,7 @@ void MLAA::blendingWeightsCalculationPass(ID3D10DepthStencilView *dsv) {
}
-void MLAA::neighborhoodBlendingPass(ID3D10RenderTargetView *dstRTV, ID3D10DepthStencilView *dsv) {
+void SMAA::neighborhoodBlendingPass(ID3D10RenderTargetView *dstRTV, ID3D10DepthStencilView *dsv) {
HRESULT hr;
// Setup the technique (once again).
View
16 Demo/DX10/Code/MLAA.h → Demo/DX10/Code/SMAA.h
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -37,15 +37,15 @@
*/
-#ifndef MLAA_H
-#define MLAA_H
+#ifndef SMAA_H
+#define SMAA_H
#include <dxgi.h>
#include <d3d10.h>
#include "RenderTarget.h"
-class MLAA {
+class SMAA {
public:
class ExternalStorage;
@@ -62,8 +62,8 @@ class MLAA {
* By default, two render targets will be created for storing
* intermediate calculations.
*/
- MLAA(ID3D10Device *device, int width, int height, const ExternalStorage &storage=ExternalStorage());
- ~MLAA();
+ SMAA(ID3D10Device *device, int width, int height, const ExternalStorage &storage=ExternalStorage());
+ ~SMAA();
/**
* 'edgesSRV' should be the input for using for edge detection:
@@ -105,7 +105,7 @@ class MLAA {
RenderTarget *getBlendRenderTarget() { return blendRenderTarget; }
/**
- * This class allows to pass spare storage buffers to the MLAA class.
+ * This class allows to pass spare storage buffers to the SMAA class.
*/
class ExternalStorage {
public:
View
5 Demo/DX10/Demo.rc
@@ -1,8 +1,7 @@
1 ICON "Icon.ico"
-MLAA.fx RCDATA Shaders\MLAA.fx
-
-MLAA.h RCDATA "..\\..\\MLAA.h"
+SMAA.fx RCDATA Shaders\SMAA.fx
+SMAA.h RCDATA "..\\..\\SMAA.h"
Unigine01.png RCDATA Media\Images\Unigine01.png
Unigine02.png RCDATA Media\Images\Unigine02.png
View
16 Demo/DX10/Demo.vcxproj
@@ -48,10 +48,10 @@
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EmbedManifest>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Include;../../../Textures;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Include;../../Textures;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Include;../../../Textures;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Include;../../Textures;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -122,14 +122,14 @@
<ClCompile Include="DXUT\Optional\DXUTsettingsdlg.cpp" />
<ClCompile Include="DXUT\Optional\SDKmesh.cpp" />
<ClCompile Include="DXUT\Optional\SDKmisc.cpp" />
- <ClCompile Include="Code\MLAA.cpp" />
+ <ClCompile Include="Code\SMAA.cpp" />
<ClCompile Include="Code\Demo.cpp" />
<ClCompile Include="Code\RenderTarget.cpp" />
<ClCompile Include="Code\Timer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\AreaTex.h" />
- <ClInclude Include="..\..\MLAA.h" />
+ <ClInclude Include="..\..\SMAA.h" />
<ClInclude Include="..\..\SearchTex.h" />
<ClInclude Include="Code\Copy.h" />
<ClInclude Include="DXUT\Core\DXUT.h" />
@@ -141,20 +141,20 @@
<ClInclude Include="DXUT\Optional\DXUTsettingsdlg.h" />
<ClInclude Include="DXUT\Optional\SDKmesh.h" />
<ClInclude Include="DXUT\Optional\SDKmisc.h" />
- <ClInclude Include="Code\MLAA.h" />
+ <ClInclude Include="Code\SMAA.h" />
<ClInclude Include="Code\RenderTarget.h" />
<ClInclude Include="Code\Timer.h" />
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="Shaders\MLAA.fx">
+ <CustomBuild Include="Shaders\SMAA.fx">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxc /Od /Zi /Tfx_4_0 /nologo /I ../.. /Fo"$(IntDir)%(Filename).fxo" /Fc"$(IntDir)%(Filename).asm" "%(FullPath)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).fxo</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxc /Tfx_4_0 /nologo /I ../.. /Fo"$(IntDir)%(Filename).fxo" /Fc"$(IntDir)%(Filename).asm" "%(FullPath)"
</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).fxo</Outputs>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\MLAA.h</AdditionalInputs>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\MLAA.h</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\SMAA.h</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\SMAA.h</AdditionalInputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
View
22 Demo/DX10/Demo.vcxproj.filters
@@ -54,7 +54,7 @@
<ClCompile Include="Code\Copy.cpp">
<Filter>Source</Filter>
</ClCompile>
- <ClCompile Include="Code\MLAA.cpp">
+ <ClCompile Include="Code\SMAA.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
@@ -95,25 +95,25 @@
<ClInclude Include="Code\Copy.h">
<Filter>Headers</Filter>
</ClInclude>
- <ClInclude Include="Code\MLAA.h">
- <Filter>Headers</Filter>
- </ClInclude>
- <ClInclude Include="..\..\MLAA.h">
- <Filter>Shaders</Filter>
- </ClInclude>
<ClInclude Include="..\..\SearchTex.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\AreaTex.h">
<Filter>Headers</Filter>
</ClInclude>
- </ItemGroup>
- <ItemGroup>
- <CustomBuild Include="Shaders\MLAA.fx">
+ <ClInclude Include="..\..\SMAA.h">
<Filter>Shaders</Filter>
- </CustomBuild>
+ </ClInclude>
+ <ClInclude Include="Code\SMAA.h">
+ <Filter>Headers</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Demo.rc" />
</ItemGroup>
+ <ItemGroup>
+ <CustomBuild Include="Shaders\SMAA.fx">
+ <Filter>Shaders</Filter>
+ </CustomBuild>
+ </ItemGroup>
</Project>
View
84 Demo/DX10/Shaders/MLAA.fx → Demo/DX10/Shaders/SMAA.fx
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -44,21 +44,21 @@ float maxSearchSteps;
/**
* Setup mandatory defines. Use a real macro here for maximum performance!
*/
-#ifndef MLAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
-#define MLAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
+#ifndef SMAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
+#define SMAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
#endif
/**
* Setup optional defines.
*/
-#define MLAA_THRESHOLD threshold
-#define MLAA_MAX_SEARCH_STEPS maxSearchSteps
+#define SMAA_THRESHOLD threshold
+#define SMAA_MAX_SEARCH_STEPS maxSearchSteps
// Set the HLSL version:
-#define MLAA_HLSL_4 1
+#define SMAA_HLSL_4 1
// And include our header!
-#include "MLAA.h"
+#include "SMAA.h"
/**
@@ -102,66 +102,66 @@ Texture2D searchTex;
/**
* Function wrappers
*/
-void DX10_MLAAEdgeDetectionVS(float4 position : POSITION,
+void DX10_SMAAEdgeDetectionVS(float4 position : POSITION,
out float4 svPosition : SV_POSITION,
inout float2 texcoord : TEXCOORD0,
out float4 offset[2] : TEXCOORD1) {
- MLAAEdgeDetectionVS(position, svPosition, texcoord, offset);
+ SMAAEdgeDetectionVS(position, svPosition, texcoord, offset);
}
-void DX10_MLAABlendWeightCalculationVS(float4 position : POSITION,
+void DX10_SMAABlendWeightCalculationVS(float4 position : POSITION,
out float4 svPosition : SV_POSITION,
inout float2 texcoord : TEXCOORD0,
out float2 pixcoord : TEXCOORD1,
out float4 offset[3] : TEXCOORD2) {
- MLAABlendWeightCalculationVS(position, svPosition, texcoord, pixcoord, offset);
+ SMAABlendWeightCalculationVS(position, svPosition, texcoord, pixcoord, offset);
}
-void DX10_MLAANeighborhoodBlendingVS(float4 position : POSITION,
+void DX10_SMAANeighborhoodBlendingVS(float4 position : POSITION,
out float4 svPosition : SV_POSITION,
inout float2 texcoord : TEXCOORD0,
out float4 offset[2] : TEXCOORD1) {
- MLAANeighborhoodBlendingVS(position, svPosition, texcoord, offset);
+ SMAANeighborhoodBlendingVS(position, svPosition, texcoord, offset);
}
-float4 DX10_MLAALumaEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX10_SMAALumaEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorGammaTex) : SV_TARGET {
- return MLAALumaEdgeDetectionPS(texcoord, offset, colorGammaTex);
+ uniform SMAATexture2D colorGammaTex) : SV_TARGET {
+ return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaTex);
}
-float4 DX10_MLAAColorEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX10_SMAAColorEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorGammaTex) : SV_TARGET {
- return MLAAColorEdgeDetectionPS(texcoord, offset, colorGammaTex);
+ uniform SMAATexture2D colorGammaTex) : SV_TARGET {
+ return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaTex);
}
-float4 DX10_MLAADepthEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX10_SMAADepthEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D depthTex) : SV_TARGET {
- return MLAADepthEdgeDetectionPS(texcoord, offset, depthTex);
+ uniform SMAATexture2D depthTex) : SV_TARGET {
+ return SMAADepthEdgeDetectionPS(texcoord, offset, depthTex);
}
-float4 DX10_MLAABlendingWeightCalculationPS(float4 position : SV_POSITION,
+float4 DX10_SMAABlendingWeightCalculationPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float2 pixcoord : TEXCOORD1,
float4 offset[3] : TEXCOORD2,
- uniform MLAATexture2D edgesTex,
- uniform MLAATexture2D areaTex,
- uniform MLAATexture2D searchTex) : SV_TARGET {
- return MLAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex);
+ uniform SMAATexture2D edgesTex,
+ uniform SMAATexture2D areaTex,
+ uniform SMAATexture2D searchTex) : SV_TARGET {
+ return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex);
}
-float4 DX10_MLAANeighborhoodBlendingPS(float4 position : SV_POSITION,
+float4 DX10_SMAANeighborhoodBlendingPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorTex,
- uniform MLAATexture2D blendTex) : SV_TARGET {
- return MLAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
+ uniform SMAATexture2D colorTex,
+ uniform SMAATexture2D blendTex) : SV_TARGET {
+ return SMAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
}
@@ -170,9 +170,9 @@ float4 DX10_MLAANeighborhoodBlendingPS(float4 position : SV_POSITION,
*/
technique10 LumaEdgeDetection {
pass LumaEdgeDetection {
- SetVertexShader(CompileShader(vs_4_0, DX10_MLAAEdgeDetectionVS()));
+ SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, DX10_MLAALumaEdgeDetectionPS(colorGammaTex)));
+ SetPixelShader(CompileShader(ps_4_0, DX10_SMAALumaEdgeDetectionPS(colorGammaTex)));
SetDepthStencilState(DisableDepthReplaceStencil, 1);
SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
@@ -181,9 +181,9 @@ technique10 LumaEdgeDetection {
technique10 ColorEdgeDetection {
pass ColorEdgeDetection {
- SetVertexShader(CompileShader(vs_4_0, DX10_MLAAEdgeDetectionVS()));
+ SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, DX10_MLAAColorEdgeDetectionPS(colorGammaTex)));
+ SetPixelShader(CompileShader(ps_4_0, DX10_SMAAColorEdgeDetectionPS(colorGammaTex)));
SetDepthStencilState(DisableDepthReplaceStencil, 1);
SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
@@ -192,9 +192,9 @@ technique10 ColorEdgeDetection {
technique10 DepthEdgeDetection {
pass DepthEdgeDetection {
- SetVertexShader(CompileShader(vs_4_0, DX10_MLAAEdgeDetectionVS()));
+ SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, DX10_MLAADepthEdgeDetectionPS(depthTex)));
+ SetPixelShader(CompileShader(ps_4_0, DX10_SMAADepthEdgeDetectionPS(depthTex)));
SetDepthStencilState(DisableDepthReplaceStencil, 1);
SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
@@ -203,9 +203,9 @@ technique10 DepthEdgeDetection {
technique10 BlendingWeightCalculation {
pass BlendingWeightCalculation {
- SetVertexShader(CompileShader(vs_4_0, DX10_MLAABlendWeightCalculationVS()));
+ SetVertexShader(CompileShader(vs_4_0, DX10_SMAABlendWeightCalculationVS()));
SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, DX10_MLAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex)));
+ SetPixelShader(CompileShader(ps_4_0, DX10_SMAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex)));
SetDepthStencilState(DisableDepthUseStencil, 1);
SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
@@ -214,9 +214,9 @@ technique10 BlendingWeightCalculation {
technique10 NeighborhoodBlending {
pass NeighborhoodBlending {
- SetVertexShader(CompileShader(vs_4_0, DX10_MLAANeighborhoodBlendingVS()));
+ SetVertexShader(CompileShader(vs_4_0, DX10_SMAANeighborhoodBlendingVS()));
SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, DX10_MLAANeighborhoodBlendingPS(colorTex, blendTex)));
+ SetPixelShader(CompileShader(ps_4_0, DX10_SMAANeighborhoodBlendingPS(colorTex, blendTex)));
SetDepthStencilState(DisableDepthStencil, 0);
SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
View
28 Demo/DX9/Code/Demo.cpp
@@ -38,7 +38,7 @@
#include "DXUTSettingsDlg.h"
#include "SDKmisc.h"
-#include "MLAA.h"
+#include "SMAA.h"
#include "Timer.h"
using namespace std;
@@ -50,7 +50,7 @@ CDXUTDialog hud;
ID3DXFont *font = NULL;
Timer *timer = NULL;
-MLAA *mlaa = NULL;
+SMAA *smaa = NULL;
IDirect3DSurface9 *backbufferSurface = NULL;
IDirect3DTexture9 *finalbufferColorTex = NULL;
IDirect3DSurface9 *finalbufferColorSurface = NULL;
@@ -106,7 +106,7 @@ HRESULT CALLBACK onResetDevice(IDirect3DDevice9 *device, const D3DSURFACE_DESC *
timer->setEnabled(hud.GetCheckBox(IDC_PROFILE)->GetChecked());
timer->setRepetitionsCount(100);
- mlaa = new MLAA(device, desc->Width, desc->Height);
+ smaa = new SMAA(device, desc->Width, desc->Height);
V(device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbufferSurface));
@@ -136,7 +136,7 @@ void CALLBACK onLostDevice(void *userContext) {
dialogResourceManager.OnD3D9LostDevice();
if (font) font->OnLostDevice();
SAFE_DELETE(timer);
- SAFE_DELETE(mlaa);
+ SAFE_DELETE(smaa);
SAFE_RELEASE(backbufferSurface);
SAFE_RELEASE(finalbufferColorTex);
SAFE_RELEASE(finalbufferColorSurface);
@@ -192,30 +192,30 @@ void mainPass(IDirect3DDevice9 *device) {
void CALLBACK onFrameRender(IDirect3DDevice9 *device, double time, float elapsedTime, void *userContext) {
HRESULT hr;
- // IMPORTANT: stencil must be cleared to zero before executing 'mlaa->go'
+ // IMPORTANT: stencil must be cleared to zero before executing 'smaa->go'
V(device->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, D3DCOLOR_ARGB(0, 0, 0, 0), 1.0f, 0));
V(device->BeginScene());
// This emulates main pass.
mainPass(device);
- // Run MLAA
- MLAA::Input input = MLAA::Input(int(hud.GetComboBox(IDC_DETECTIONMODE)->GetSelectedData()));
+ // Run SMAA
+ SMAA::Input input = SMAA::Input(int(hud.GetComboBox(IDC_DETECTIONMODE)->GetSelectedData()));
int n = hud.GetCheckBox(IDC_PROFILE)->GetChecked()? timer->getRepetitionsCount() : 1;
timer->start();
for (int i = 0; i < n; i++) { // This loop is just for profiling.
switch (input) {
- case MLAA::INPUT_LUMA:
- case MLAA::INPUT_COLOR:
- mlaa->go(finalbufferColorTex, finalbufferColorTex, backbufferSurface, input);
+ case SMAA::INPUT_LUMA:
+ case SMAA::INPUT_COLOR:
+ smaa->go(finalbufferColorTex, finalbufferColorTex, backbufferSurface, input);
break;
- case MLAA::INPUT_DEPTH:
- mlaa->go(finalbufferDepthTex, finalbufferColorTex, backbufferSurface, input);
+ case SMAA::INPUT_DEPTH:
+ smaa->go(finalbufferDepthTex, finalbufferColorTex, backbufferSurface, input);
break;
}
}
- timer->clock(L"MLAA");
+ timer->clock(L"SMAA");
// Draw the HUD
DXUT_BeginPerfEvent(DXUT_PERFEVENTCOLOR, L"HUD / Stats"); // These events are to help PIX identify what the code is doing
@@ -350,7 +350,7 @@ int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int) {
return -1;
DXUTSetCursorSettings( true, true );
- if (FAILED(DXUTCreateWindow(L"Practical Morphological Anti-Aliasing Demo (Jimenez's MLAA)")))
+ if (FAILED(DXUTCreateWindow(L"SMAA: Subpixel Morphological Antialiasing")))
return -1;
if (FAILED(DXUTCreateDevice(true, 1280, 720)))
View
30 Demo/DX9/Code/MLAA.cpp → Demo/DX9/Code/SMAA.cpp
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -38,7 +38,7 @@
#include <sstream>
-#include "MLAA.h"
+#include "SMAA.h"
#include "SearchTex.h"
#include "AreaTex.h"
using namespace std;
@@ -94,7 +94,7 @@ class ID3D10IncludeResource : public ID3DXInclude {
#pragma endregion
-MLAA::MLAA(IDirect3DDevice9 *device, int width, int height, const ExternalStorage &storage)
+SMAA::SMAA(IDirect3DDevice9 *device, int width, int height, const ExternalStorage &storage)
: device(device),
threshold(0.1f),
maxSearchSteps(8),
@@ -107,7 +107,7 @@ MLAA::MLAA(IDirect3DDevice9 *device, int width, int height, const ExternalStorag
string pixelSizeText = s.str();
D3DXMACRO defines[4] = {
- {"MLAA_PIXEL_SIZE", pixelSizeText.c_str()},
+ {"SMAA_PIXEL_SIZE", pixelSizeText.c_str()},
{NULL, NULL}
};
@@ -118,12 +118,12 @@ MLAA::MLAA(IDirect3DDevice9 *device, int width, int height, const ExternalStorag
#endif
/**
- * IMPORTANT! Here we load and compile the MLAA effect from a *RESOURCE*
+ * IMPORTANT! Here we load and compile the SMAA effect from a *RESOURCE*
* (Yeah, we like all-in-one executables for demos =)
* In case you want it to be loaded from other place change this line accordingly.
*/
ID3D10IncludeResource includeResource;
- V(D3DXCreateEffectFromResource(device, NULL, L"MLAA.fx", defines, &includeResource, flags, NULL, &effect, NULL));
+ V(D3DXCreateEffectFromResource(device, NULL, L"SMAA.fx", defines, &includeResource, flags, NULL, &effect, NULL));
// Vertex declaration for rendering the typical fullscreen quad later on.
const D3DVERTEXELEMENT9 vertexElements[3] = {
@@ -176,7 +176,7 @@ MLAA::MLAA(IDirect3DDevice9 *device, int width, int height, const ExternalStorag
}
-MLAA::~MLAA() {
+SMAA::~SMAA() {
SAFE_RELEASE(effect);
SAFE_RELEASE(vertexDeclaration);
@@ -195,7 +195,7 @@ MLAA::~MLAA() {
}
-void MLAA::go(IDirect3DTexture9 *edges,
+void SMAA::go(IDirect3DTexture9 *edges,
IDirect3DTexture9 *src,
IDirect3DSurface9 *dst,
Input input) {
@@ -211,7 +211,7 @@ void MLAA::go(IDirect3DTexture9 *edges,
}
-void MLAA::loadAreaTex() {
+void SMAA::loadAreaTex() {
HRESULT hr;
V(device->CreateTexture(AREATEX_WIDTH, AREATEX_HEIGHT, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8L8, D3DPOOL_DEFAULT, &areaTex, NULL));
D3DLOCKED_RECT rect;
@@ -222,7 +222,7 @@ void MLAA::loadAreaTex() {
}
-void MLAA::loadSearchTex() {
+void SMAA::loadSearchTex() {
HRESULT hr;
V(device->CreateTexture(SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 1, D3DUSAGE_DYNAMIC, D3DFMT_L8, D3DPOOL_DEFAULT, &searchTex, NULL));
D3DLOCKED_RECT rect;
@@ -233,7 +233,7 @@ void MLAA::loadSearchTex() {
}
-void MLAA::edgesDetectionPass(IDirect3DTexture9 *edges, Input input) {
+void SMAA::edgesDetectionPass(IDirect3DTexture9 *edges, Input input) {
HRESULT hr;
// Set the render target and clear both the color and the stencil buffers.
@@ -272,7 +272,7 @@ void MLAA::edgesDetectionPass(IDirect3DTexture9 *edges, Input input) {
}
-void MLAA::blendingWeightsCalculationPass() {
+void SMAA::blendingWeightsCalculationPass() {
HRESULT hr;
// Set the render target and clear it.
@@ -295,7 +295,7 @@ void MLAA::blendingWeightsCalculationPass() {
}
-void MLAA::neighborhoodBlendingPass(IDirect3DTexture9 *src, IDirect3DSurface9 *dst) {
+void SMAA::neighborhoodBlendingPass(IDirect3DTexture9 *src, IDirect3DSurface9 *dst) {
HRESULT hr;
// Blah blah blah
@@ -314,7 +314,7 @@ void MLAA::neighborhoodBlendingPass(IDirect3DTexture9 *src, IDirect3DSurface9 *d
}
-void MLAA::quad(int width, int height) {
+void SMAA::quad(int width, int height) {
// Typical aligned fullscreen quad.
HRESULT hr;
D3DXVECTOR2 pixelSize = D3DXVECTOR2(1.0f / float(width), 1.0f / float(height));
View
16 Demo/DX9/Code/MLAA.h → Demo/DX9/Code/SMAA.h
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -37,8 +37,8 @@
*/
-#ifndef MLAA_H
-#define MLAA_H
+#ifndef SMAA_H
+#define SMAA_H
#include <dxgi.h>
#include <d3d9.h>
@@ -46,7 +46,7 @@
#include <dxerr.h>
-class MLAA {
+class SMAA {
public:
class ExternalStorage;
@@ -63,9 +63,9 @@ class MLAA {
* By default, two render targets will be created for storing
* intermediate calculations.
*/
- MLAA(IDirect3DDevice9 *device, int width, int height,
+ SMAA(IDirect3DDevice9 *device, int width, int height,
const ExternalStorage &storage=ExternalStorage());
- ~MLAA();
+ ~SMAA();
/**
* Processes input texture 'src', storing the antialiased image into
@@ -103,7 +103,7 @@ class MLAA {
void setThreshold(float threshold) { this->threshold = threshold; }
/**
- * This class allows to pass spare storage buffers to the MLAA class.
+ * This class allows to pass spare storage buffers to the SMAA class.
*/
class ExternalStorage {
public:
View
5 Demo/DX9/Demo.rc
@@ -1,8 +1,7 @@
1 ICON "Icon.ico"
-MLAA.fx RCDATA Shaders\MLAA.fx
-
-MLAA.h RCDATA "..\\..\\MLAA.h"
+SMAA.fx RCDATA Shaders\SMAA.fx
+SMAA.h RCDATA "..\\..\\SMAA.h"
Unigine01.png RCDATA Media\Images\Unigine01.png
Unigine01.dds RCDATA Media\Images\Unigine01.dds
View
18 Demo/DX9/Demo.vcxproj
@@ -38,13 +38,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
- <IncludePath>$(DXSDK_DIR)Include;../../../Textures;$(IncludePath)</IncludePath>
+ <IncludePath>$(DXSDK_DIR)Include;../../Textures;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
- <IncludePath>$(DXSDK_DIR)Include;../../../Textures;$(IncludePath)</IncludePath>
+ <IncludePath>$(DXSDK_DIR)Include;../../Textures;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
@@ -131,14 +131,16 @@
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
- <ClInclude Include="..\..\MLAA.h" />
- <ClInclude Include="Code\MLAA.h" />
+ <ClInclude Include="..\..\SMAA.h" />
+ <ClInclude Include="..\..\Textures\AreaTex.h" />
+ <ClInclude Include="..\..\Textures\SearchTex.h" />
+ <ClInclude Include="Code\SMAA.h" />
<ClInclude Include="Code\Timer.h" />
<ClInclude Include="DXUT\Core\DXUT.h" />
<ClInclude Include="DXUT\Core\DXUTenum.h" />
<ClInclude Include="DXUT\Core\DXUTmisc.h" />
<ClCompile Include="Code\Demo.cpp" />
- <ClCompile Include="Code\MLAA.cpp" />
+ <ClCompile Include="Code\SMAA.cpp" />
<ClCompile Include="Code\Timer.cpp" />
<ClCompile Include="DXUT\Core\DXUT.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
@@ -159,13 +161,13 @@
<ClCompile Include="DXUT\Optional\SDKmisc.cpp" />
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="Shaders\MLAA.fx">
+ <CustomBuild Include="Shaders\SMAA.fx">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">fxc /Od /Zi /Tfx_2_0 /nologo /I ../.. /Fo"$(IntDir)%(Filename).fxo" /Fc"$(IntDir)%(Filename).asm" "%(FullPath)"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).fxo</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">fxc /Tfx_2_0 /nologo /I ../.. /Fo"$(IntDir)%(Filename).fxo" /Fc"$(IntDir)%(Filename).asm" "%(FullPath)"</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).fxo</Outputs>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\MLAA.h</AdditionalInputs>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\MLAA.h</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\SMAA.h</AdditionalInputs>
+ <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\SMAA.h</AdditionalInputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
View
18 Demo/DX9/Demo.vcxproj.filters
@@ -67,15 +67,21 @@
<ClCompile Include="DXUT\Optional\SDKmisc.cpp">
<Filter>DXUT</Filter>
</ClCompile>
- <ClInclude Include="Code\MLAA.h">
+ <ClInclude Include="Code\Timer.h">
<Filter>Code</Filter>
</ClInclude>
- <ClInclude Include="Code\Timer.h">
+ <ClInclude Include="..\..\Textures\AreaTex.h">
+ <Filter>Code</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\Textures\SearchTex.h">
<Filter>Code</Filter>
</ClInclude>
- <ClInclude Include="..\..\MLAA.h">
+ <ClInclude Include="..\..\SMAA.h">
<Filter>Shaders</Filter>
</ClInclude>
+ <ClInclude Include="Code\SMAA.h">
+ <Filter>Code</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Demo.rc" />
@@ -84,15 +90,15 @@
<ClCompile Include="Code\Demo.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="Code\MLAA.cpp">
+ <ClCompile Include="Code\Timer.cpp">
<Filter>Code</Filter>
</ClCompile>
- <ClCompile Include="Code\Timer.cpp">
+ <ClCompile Include="Code\SMAA.cpp">
<Filter>Code</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
- <CustomBuild Include="Shaders\MLAA.fx">
+ <CustomBuild Include="Shaders\SMAA.fx">
<Filter>Shaders</Filter>
</CustomBuild>
</ItemGroup>
View
84 Demo/DX9/Shaders/MLAA.fx → Demo/DX9/Shaders/SMAA.fx
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -44,21 +44,21 @@ float maxSearchSteps;
/**
* Setup mandatory defines. Use a real macro here for maximum performance!
*/
-#ifndef MLAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
-#define MLAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
+#ifndef SMAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
+#define SMAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
#endif
/**
* Setup optional defines.
*/
-#define MLAA_THRESHOLD threshold
-#define MLAA_MAX_SEARCH_STEPS maxSearchSteps
+#define SMAA_THRESHOLD threshold
+#define SMAA_MAX_SEARCH_STEPS maxSearchSteps
// Set the HLSL version:
-#define MLAA_HLSL_3 1
+#define SMAA_HLSL_3 1
// And include our header!
-#include "MLAA.h"
+#include "SMAA.h"
/**
@@ -129,63 +129,63 @@ sampler2D searchTex {
/**
* Function wrappers
*/
-void DX9_MLAAEdgeDetectionVS(inout float4 position : POSITION,
+void DX9_SMAAEdgeDetectionVS(inout float4 position : POSITION,
inout float2 texcoord : TEXCOORD0,
out float4 offset[2] : TEXCOORD1) {
- MLAAEdgeDetectionVS(position, position, texcoord, offset);
+ SMAAEdgeDetectionVS(position, position, texcoord, offset);
}
-void DX9_MLAABlendWeightCalculationVS(inout float4 position : POSITION,
+void DX9_SMAABlendWeightCalculationVS(inout float4 position : POSITION,
inout float2 texcoord : TEXCOORD0,
out float2 pixcoord : TEXCOORD1,
out float4 offset[3] : TEXCOORD2) {
- MLAABlendWeightCalculationVS(position, position, texcoord, pixcoord, offset);
+ SMAABlendWeightCalculationVS(position, position, texcoord, pixcoord, offset);
}
-void DX9_MLAANeighborhoodBlendingVS(inout float4 position : POSITION,
+void DX9_SMAANeighborhoodBlendingVS(inout float4 position : POSITION,
inout float2 texcoord : TEXCOORD0,
out float4 offset[2] : TEXCOORD1) {
- MLAANeighborhoodBlendingVS(position, position, texcoord, offset);
+ SMAANeighborhoodBlendingVS(position, position, texcoord, offset);
}
-float4 DX9_MLAALumaEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX9_SMAALumaEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorGammaTex) : COLOR {
- return MLAALumaEdgeDetectionPS(texcoord, offset, colorGammaTex);
+ uniform SMAATexture2D colorGammaTex) : COLOR {
+ return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaTex);
}
-float4 DX9_MLAAColorEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX9_SMAAColorEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorGammaTex) : COLOR {
- return MLAAColorEdgeDetectionPS(texcoord, offset, colorGammaTex);
+ uniform SMAATexture2D colorGammaTex) : COLOR {
+ return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaTex);
}
-float4 DX9_MLAADepthEdgeDetectionPS(float4 position : SV_POSITION,
+float4 DX9_SMAADepthEdgeDetectionPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D depthTex) : COLOR {
- return MLAADepthEdgeDetectionPS(texcoord, offset, depthTex);
+ uniform SMAATexture2D depthTex) : COLOR {
+ return SMAADepthEdgeDetectionPS(texcoord, offset, depthTex);
}
-float4 DX9_MLAABlendingWeightCalculationPS(float4 position : SV_POSITION,
+float4 DX9_SMAABlendingWeightCalculationPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float2 pixcoord : TEXCOORD1,
float4 offset[3] : TEXCOORD2,
- uniform MLAATexture2D edgesTex,
- uniform MLAATexture2D areaTex,
- uniform MLAATexture2D searchTex) : COLOR {
- return MLAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex);
+ uniform SMAATexture2D edgesTex,
+ uniform SMAATexture2D areaTex,
+ uniform SMAATexture2D searchTex) : COLOR {
+ return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex);
}
-float4 DX9_MLAANeighborhoodBlendingPS(float4 position : SV_POSITION,
+float4 DX9_SMAANeighborhoodBlendingPS(float4 position : SV_POSITION,
float2 texcoord : TEXCOORD0,
float4 offset[2] : TEXCOORD1,
- uniform MLAATexture2D colorTex,
- uniform MLAATexture2D blendTex) : COLOR {
- return MLAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
+ uniform SMAATexture2D colorTex,
+ uniform SMAATexture2D blendTex) : COLOR {
+ return SMAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
}
@@ -194,8 +194,8 @@ float4 DX9_MLAANeighborhoodBlendingPS(float4 position : SV_POSITION,
*/
technique LumaEdgeDetection {
pass LumaEdgeDetection {
- VertexShader = compile vs_3_0 DX9_MLAAEdgeDetectionVS();
- PixelShader = compile ps_3_0 DX9_MLAALumaEdgeDetectionPS(colorTexG);
+ VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+ PixelShader = compile ps_3_0 DX9_SMAALumaEdgeDetectionPS(colorTexG);
ZEnable = false;
SRGBWriteEnable = false;
AlphaBlendEnable = false;
@@ -209,8 +209,8 @@ technique LumaEdgeDetection {
technique ColorEdgeDetection {
pass ColorEdgeDetection {
- VertexShader = compile vs_3_0 DX9_MLAAEdgeDetectionVS();
- PixelShader = compile ps_3_0 DX9_MLAAColorEdgeDetectionPS(colorTexG);
+ VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+ PixelShader = compile ps_3_0 DX9_SMAAColorEdgeDetectionPS(colorTexG);
ZEnable = false;
SRGBWriteEnable = false;
AlphaBlendEnable = false;
@@ -224,8 +224,8 @@ technique ColorEdgeDetection {
technique DepthEdgeDetection {
pass DepthEdgeDetection {
- VertexShader = compile vs_3_0 DX9_MLAAEdgeDetectionVS();
- PixelShader = compile ps_3_0 DX9_MLAADepthEdgeDetectionPS(depthTex);
+ VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+ PixelShader = compile ps_3_0 DX9_SMAADepthEdgeDetectionPS(depthTex);
ZEnable = false;
SRGBWriteEnable = false;
AlphaBlendEnable = false;
@@ -239,8 +239,8 @@ technique DepthEdgeDetection {
technique BlendWeightCalculation {
pass BlendWeightCalculation {
- VertexShader = compile vs_3_0 DX9_MLAABlendWeightCalculationVS();
- PixelShader = compile ps_3_0 DX9_MLAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex);
+ VertexShader = compile vs_3_0 DX9_SMAABlendWeightCalculationVS();
+ PixelShader = compile ps_3_0 DX9_SMAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex);
ZEnable = false;
SRGBWriteEnable = false;
AlphaBlendEnable = false;
@@ -255,8 +255,8 @@ technique BlendWeightCalculation {
technique NeighborhoodBlending {
pass NeighborhoodBlending {
- VertexShader = compile vs_3_0 DX9_MLAANeighborhoodBlendingVS();
- PixelShader = compile ps_3_0 DX9_MLAANeighborhoodBlendingPS(colorTex, blendTex);
+ VertexShader = compile vs_3_0 DX9_SMAANeighborhoodBlendingVS();
+ PixelShader = compile ps_3_0 DX9_SMAANeighborhoodBlendingPS(colorTex, blendTex);
ZEnable = false;
SRGBWriteEnable = true;
AlphaBlendEnable = false;
View
4 LICENSE.txt
@@ -15,8 +15,8 @@ modification, are permitted provided that the following conditions are met:
in the documentation and/or other materials provided with the
distribution:
- "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ Belen Masia, Fernando Navarro and Diego Gutierrez."
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
View
18 README.md
@@ -1,15 +1,17 @@
-Jimenez's MLAA
-==============
+SMAA: Subpixel Morphological Antialiasing
+=========================================
-Jimenez's MLAA is a very efficient GPU-based MLAA implementation.
+**NOTE THAT SMAA DEVELOPMENT IS IN PROGRESS, WITH MOST FEATURES STILL MISSING.**
-Checkout http://www.iryoku.com/mlaa for more info!
+SMAA is a very efficient GPU-based MLAA implementation, capable of handling subpixel features seamlessly, and featuring an advanced pattern detection & handling mechanism.
+
+Checkout the [technical paper](http://www.iryoku.com/papers/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.pdf) for more info!
Usage
-----
-See [MLAA.h](https://github.com/iryoku/jimenez-mlaa/blob/master/MLAA.h) for integration info. You'll also need some precomputed textures, which can be found as C++ headers ([Textures/AreaTex.h](https://github.com/iryoku/jimenez-mlaa/blob/master/Textures/AreaTex.h) and [Textures/SearchTex.h](https://github.com/iryoku/jimenez-mlaa/blob/master/Textures/SearchTex.h)), or as regular DDS files (see [Textures](https://github.com/iryoku/jimenez-mlaa/blob/master/Textures)). The directories [DX9](https://github.com/iryoku/jimenez-mlaa/blob/master/Demo/DX9) and [DX10](https://github.com/iryoku/jimenez-mlaa/blob/master/Demo/DX10) contain integration examples for DirectX 9 and 10 respectively.
+See [SMAA.h](https://github.com/iryoku/smaa/blob/master/SMAA.h) for integration info. You'll also need some precomputed textures, which can be found as C++ headers ([Textures/AreaTex.h](https://github.com/iryoku/smaa/blob/master/Textures/AreaTex.h) and [Textures/SearchTex.h](https://github.com/iryoku/smaa/blob/master/Textures/SearchTex.h)), or as regular DDS files (see [Textures](https://github.com/iryoku/smaa/blob/master/Textures) directory). The directories [DX9](https://github.com/iryoku/smaa/blob/master/Demo/DX9) and [DX10](https://github.com/iryoku/smaa/blob/master/Demo/DX10) contain integration examples for DirectX 9 and 10 respectively.
Bug Tracker
@@ -17,7 +19,7 @@ Bug Tracker
Found a bug? Please create an issue here on GitHub!
-https://github.com/iryoku/jimenez-mlaa/issues
+https://github.com/iryoku/smaa/issues
Authors
@@ -65,8 +67,8 @@ modification, are permitted provided that the following conditions are met:
in the documentation and/or other materials provided with the
distribution:
- "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ Belen Masia, Fernando Navarro and Diego Gutierrez."
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
View
304 MLAA.h → SMAA.h
@@ -16,8 +16,8 @@
* in the documentation and/or other materials provided with the
* distribution:
*
- * "Uses Jimenez's MLAA. Copyright (C) 2011 by Jorge Jimenez, Belen Masia,
- * Jose I. Echevarria, Fernando Navarro and Diego Gutierrez."
+ * "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ * Belen Masia, Fernando Navarro and Diego Gutierrez."
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
@@ -47,15 +47,15 @@
*
* |input|------------------·
* v |
- * [ MLAA*EdgeDetection ] |
+ * [ SMAA*EdgeDetection ] |
* v |
* |edgesTex| |
* v |
- * [ MLAABlendingWeightCalculation ] |
+ * [ SMAABlendingWeightCalculation ] |
* v |
* |blendTex| |
* v |
- * [ MLAANeighborhoodBlending ] <------·
+ * [ SMAANeighborhoodBlending ] <------·
* v
* |output|
*
@@ -84,27 +84,27 @@
* - The next step is loading the two supporting precalculated textures,
* 'areaTex' and 'searchTex'. You'll find them in the 'Textures' folder as
* C++ headers and also as regular DDS files. They'll be needed for the
- * 'MLAABlendingWeightCalculation' pass.
+ * 'SMAABlendingWeightCalculation' pass.
*
* - In DX9, all samplers must be set to linear filtering and clamp, with the
* exception of 'searchTex', that must be set to point filtering.
*
* - All texture reads and buffer writes must be non-sRGB, with the exception
* of the input read and the output write of input in
- * 'MLAANeighborhoodBlending' (and only in this pass!). If sRGB reads in this
+ * 'SMAANeighborhoodBlending' (and only in this pass!). If sRGB reads in this
* last pass are not possible, the technique will work anyways, but will
* perform antialiasing in gamma space. Note that for best results the input
* read for the edge detection should *NOT* be sRGB.
*
- * - Before including MLAA.h you have to setup the framebuffer pixel size. For
+ * - Before including SMAA.h you have to setup the framebuffer pixel size. For
* example:
- * #define MLAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
+ * #define SMAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
*
- * - Also, you will have to set MLAA_HLSL_3 or MLAA_HLSL_4 to 1 depending on
+ * - Also, you will have to set SMAA_HLSL_3 or SMAA_HLSL_4 to 1 depending on
* the platform.
*
* - Then, you will have to setup the passes as indicated in the scheme above.
- * You can take a look into MLAA.fx, to see how we did it for our demo.
+ * You can take a look into SMAA.fx, to see how we did it for our demo.
* Checkout the function wrappers, you may want to copy-paste them!
*
* - It's recommended to validate the produced |edgesTex| and |blendTex|. It's
@@ -121,25 +121,25 @@
/**
- * MLAA_THRESHOLD specifices the threshold or sensivity to edges.
+ * SMAA_THRESHOLD specifices the threshold or sensivity to edges.
* Lowering this value you will be able to detect more edges at the expense of
* performance.
* 0.1 is a reasonable value, and allows to catch most visible edges.
* 0.05 is a rather overkill value, that allows to catch 'em all.
*/
-#ifndef MLAA_THRESHOLD
-#define MLAA_THRESHOLD 0.1
+#ifndef SMAA_THRESHOLD
+#define SMAA_THRESHOLD 0.1
#endif
/**
- * MLAA_MAX_SEARCH_STEPS specifies the maximum steps performed in the line
+ * SMAA_MAX_SEARCH_STEPS specifies the maximum steps performed in the line
* searchs, at each side. In number of pixels, it's actually the double.
* So the maximum line lengtly perfectly handled by, for example 16, is
* 64 (by perfectly, we meant that longer lines won't look as good, but
* still antialiased).
*/
-#ifndef MLAA_MAX_SEARCH_STEPS
-#define MLAA_MAX_SEARCH_STEPS 16
+#ifndef SMAA_MAX_SEARCH_STEPS
+#define SMAA_MAX_SEARCH_STEPS 16
#endif
/**
@@ -151,34 +151,34 @@
* So, if you are in DX9, under DX9 hardware, and do you want accurate linear
* blending, you must set this flag to 1.
*
- * It's ignored when using MLAA_HLSL_4, and of course, only has sense when
+ * It's ignored when using SMAA_HLSL_4, and of course, only has sense when
* using sRGB read and writes on the last pass.
*/
-#ifndef MLAA_DIRECTX9_LINEAR_BLEND
-#define MLAA_DIRECTX9_LINEAR_BLEND 0
+#ifndef SMAA_DIRECTX9_LINEAR_BLEND
+#define SMAA_DIRECTX9_LINEAR_BLEND 0
#endif
/**
* This is actually not configurable, it's the size of the precomputed areatex.
*/
-#ifndef MLAA_MAX_DISTANCE
-#define MLAA_MAX_DISTANCE 15
+#ifndef SMAA_MAX_DISTANCE
+#define SMAA_MAX_DISTANCE 15
#endif
-#define MLAA_AREATEX_PIXEL_SIZE (1.0 / (MLAA_MAX_DISTANCE * 5))
+#define SMAA_AREATEX_PIXEL_SIZE (1.0 / (SMAA_MAX_DISTANCE * 5))
/**
* Porting functions.
*/
-#if MLAA_HLSL_3 == 1
-#define MLAATexture2D sampler2D
-#define MLAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
-#define MLAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
-#define MLAASample(tex, coord) tex2D(tex, coord)
-#define MLAASampleLevelZeroOffset(tex, coord, off) tex2Dlod(tex, float4(coord + off * MLAA_PIXEL_SIZE, 0.0, 0.0))
-#define MLAASampleOffset(tex, coord, off) tex2D(tex, coord + off * MLAA_PIXEL_SIZE)
-#elif MLAA_HLSL_4 == 1
+#if SMAA_HLSL_3 == 1
+#define SMAATexture2D sampler2D
+#define SMAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
+#define SMAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
+#define SMAASample(tex, coord) tex2D(tex, coord)
+#define SMAASampleLevelZeroOffset(tex, coord, off) tex2Dlod(tex, float4(coord + off * SMAA_PIXEL_SIZE, 0.0, 0.0))
+#define SMAASampleOffset(tex, coord, off) tex2D(tex, coord + off * SMAA_PIXEL_SIZE)
+#elif SMAA_HLSL_4 == 1
SamplerState LinearSampler {
Filter = MIN_MAG_LINEAR_MIP_POINT;
AddressU = Clamp;
@@ -189,19 +189,19 @@ SamplerState PointSampler {
AddressU = Clamp;
AddressV = Clamp;
};
-#define MLAATexture2D Texture2D
-#define MLAASampleLevelZero(tex, coord) tex.SampleLevel(LinearSampler, coord, 0)
-#define MLAASampleLevelZeroPoint(tex, coord) tex.SampleLevel(PointSampler, coord, 0)
-#define MLAASample(tex, coord) MLAASampleLevelZero(tex, coord)
-#define MLAASampleLevelZeroOffset(tex, coord, off) tex.SampleLevel(LinearSampler, coord, 0, off)
-#define MLAASampleOffset(tex, coord, off) MLAASampleLevelZeroOffset(tex, coord, off)
+#define SMAATexture2D Texture2D
+#define SMAASampleLevelZero(tex, coord) tex.SampleLevel(LinearSampler, coord, 0)
+#define SMAASampleLevelZeroPoint(tex, coord) tex.SampleLevel(PointSampler, coord, 0)
+#define SMAASample(tex, coord) SMAASampleLevelZero(tex, coord)
+#define SMAASampleLevelZeroOffset(tex, coord, off) tex.SampleLevel(LinearSampler, coord, 0, off)
+#define SMAASampleOffset(tex, coord, off) SMAASampleLevelZeroOffset(tex, coord, off)
#endif
/**
* Typical Multiply-Add operation to ease translation to assembly code.
*/
-float4 MLAAMad(float4 m, float4 a, float4 b) {
+float4 SMAAMad(float4 m, float4 a, float4 b) {
return m * a + b;
}
@@ -209,78 +209,78 @@ float4 MLAAMad(float4 m, float4 a, float4 b) {
/**
* Edge Detection Vertex Shader
*/
-void MLAAEdgeDetectionVS(float4 position,
+void SMAAEdgeDetectionVS(float4 position,
out float4 svPosition,
inout float2 texcoord,
out float4 offset[2]) {
svPosition = position;
- offset[0] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
- offset[1] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0);
+ offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
+ offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0);
}
/**
* Blend Weight Calculation Vertex Shader
*/
-void MLAABlendWeightCalculationVS(float4 position,
+void SMAABlendWeightCalculationVS(float4 position,
out float4 svPosition,
inout float2 texcoord,
out float2 pixcoord,
out float4 offset[3]) {
svPosition = position;
- pixcoord = texcoord / MLAA_PIXEL_SIZE;
+ pixcoord = texcoord / SMAA_PIXEL_SIZE;
// We will use these offsets for the searchs later on (see @PSEUDO_GATHER4):
- offset[0] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4(-0.25, -0.125, 1.25, -0.125);
- offset[1] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4(-0.125, -0.25, -0.125, 1.25);
+ offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-0.25, -0.125, 1.25, -0.125);
+ offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-0.125, -0.25, -0.125, 1.25);
// And these for the searchs, they indicate the ends of the loops:
- offset[2] = float4(offset[0].xz, offset[1].yw) + float4(-2.0, 2.0, -2.0, 2.0) * MLAA_PIXEL_SIZE.xxyy * MLAA_MAX_SEARCH_STEPS;
+ offset[2] = float4(offset[0].xz, offset[1].yw) + float4(-2.0, 2.0, -2.0, 2.0) * SMAA_PIXEL_SIZE.xxyy * SMAA_MAX_SEARCH_STEPS;
}
/**
* Neighborhood Blending Vertex Shader
*/
-void MLAANeighborhoodBlendingVS(float4 position,
+void SMAANeighborhoodBlendingVS(float4 position,
out float4 svPosition,
inout float2 texcoord,
out float4 offset[2]) {
svPosition = position;
- offset[0] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
- offset[1] = texcoord.xyxy + MLAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0);
+ offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
+ offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0);
}
/**
* Luma Edge Detection
*/
-float4 MLAALumaEdgeDetectionPS(float2 texcoord,
+float4 SMAALumaEdgeDetectionPS(float2 texcoord,
float4 offset[2],
- MLAATexture2D colorGammaTex) {
+ SMAATexture2D colorGammaTex) {
float3 weights = float3(0.2126, 0.7152, 0.0722);
/**
* Luma calculation requires gamma-corrected colors, and thus 'colorGammaTex'
* should be a non-sRGB texture.
*/
- float L = dot(MLAASample(colorGammaTex, texcoord).rgb, weights);
- float Lleft = dot(MLAASample(colorGammaTex, offset[0].xy).rgb, weights);
- float Ltop = dot(MLAASample(colorGammaTex, offset[0].zw).rgb, weights);
+ float L = dot(SMAASample(colorGammaTex, texcoord).rgb, weights);
+ float Lleft = dot(SMAASample(colorGammaTex, offset[0].xy).rgb, weights);
+ float Ltop = dot(SMAASample(colorGammaTex, offset[0].zw).rgb, weights);
// We do the usual threshold
float4 delta;
delta.xy = abs(L.xx - float2(Lleft, Ltop));
- float2 edges = step(MLAA_THRESHOLD.xx, delta.xy);
+ float2 edges = step(SMAA_THRESHOLD.xx, delta.xy);
// Then discard if there is no edge
if (dot(edges, 1.0) == 0.0)
discard;
// Calculate right and bottom deltas:
- float Lright = dot(MLAASample(colorGammaTex, offset[1].xy).rgb, weights);
- float Lbottom = dot(MLAASample(colorGammaTex, offset[1].zw).rgb, weights);
+ float Lright = dot(SMAASample(colorGammaTex, offset[1].xy).rgb, weights);
+ float Lbottom = dot(SMAASample(colorGammaTex, offset[1].zw).rgb, weights);
delta.zw = abs(L.xx - float2(Lright, Lbottom));
/**
@@ -303,38 +303,38 @@ float4 MLAALumaEdgeDetectionPS(float2 texcoord,
/**
* Color Edge Detection
*/
-float4 MLAAColorEdgeDetectionPS(float2 texcoord,
+float4 SMAAColorEdgeDetectionPS(float2 texcoord,
float4 offset[2],
- MLAATexture2D colorGammaTex) {
+ SMAATexture2D colorGammaTex) {
float4 delta;
/**
* Just like the lumas edge detection, we prefer non-sRGB textures over
* here.
*/
- float3 C = MLAASample(colorGammaTex, texcoord).rgb;
+ float3 C = SMAASample(colorGammaTex, texcoord).rgb;
- float3 Cleft = MLAASample(colorGammaTex, offset[0].xy).rgb;
+ float3 Cleft = SMAASample(colorGammaTex, offset[0].xy).rgb;
float3 t = abs(C - Cleft);
delta.x = max(max(t.r, t.g), t.b);
- float3 Ctop = MLAASample(colorGammaTex, offset[0].zw).rgb;
+ float3 Ctop = SMAASample(colorGammaTex, offset[0].zw).rgb;
t = abs(C - Ctop);
delta.y = max(max(t.r, t.g), t.b);
// We do the usual threshold
- float2 edges = step(MLAA_THRESHOLD.xx, delta.xy);
+ float2 edges = step(SMAA_THRESHOLD.xx, delta.xy);
// Then discard if there is no edge
if (dot(edges, 1.0) == 0.0)
discard;
// Calculate right and bottom deltas:
- float3 Cright = MLAASample(colorGammaTex, offset[1].xy).rgb;
+ float3 Cright = SMAASample(colorGammaTex, offset[1].xy).rgb;
t = abs(C - Cright);
delta.z = max(max(t.r, t.g), t.b);
- float3 Cbottom = MLAASample(colorGammaTex, offset[1].zw).rgb;
+ float3 Cbottom = SMAASample(colorGammaTex, offset[1].zw).rgb;
t = abs(C - Cbottom);
delta.w = max(max(t.r, t.g), t.b);
@@ -358,16 +358,16 @@ float4 MLAAColorEdgeDetectionPS(float2 texcoord,
/**
* Depth Edge Detection
*/
-float4 MLAADepthEdgeDetectionPS(float2 texcoord,
+float4 SMAADepthEdgeDetectionPS(float2 texcoord,
float4 offset[2],
- MLAATexture2D depthTex) {
- float D = MLAASample(depthTex, texcoord).r;
- float Dleft = MLAASample(depthTex, offset[0].xy).r;
- float Dtop = MLAASample(depthTex, offset[0].zw).r;
+ SMAATexture2D depthTex) {
+ float D = SMAASample(depthTex, texcoord).r;
+ float Dleft = SMAASample(depthTex, offset[0].xy).r;
+ float Dtop = SMAASample(depthTex, offset[0].zw).r;
float2 delta = abs(D.xx - float2(Dleft, Dtop));
// Dividing by 10 give us results similar to the color-based detection, in our examples:
- float2 edges = step(MLAA_THRESHOLD.xx / 10.0, delta);
+ float2 edges = step(SMAA_THRESHOLD.xx / 10.0, delta);
if (dot(edges, 1.0) == 0.0)
discard;
@@ -382,19 +382,19 @@ float4 MLAADepthEdgeDetectionPS(float2 texcoord,
* @PSEUDO_GATHER4), and adds 0, 1 or 2, depending on which edges and
* crossing edges are active.
*/
-float MLAASearchLength(MLAATexture2D searchTex, float2 e, float bias, float scale) {
+float SMAASearchLength(SMAATexture2D searchTex, float2 e, float bias, float scale) {
// Not required if searchTex accesses are set to point:
// float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
// e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE + e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
e.r = bias + e.r * scale;
- return 255.0 * MLAASampleLevelZeroPoint(searchTex, e).r;
+ return 255.0 * SMAASampleLevelZeroPoint(searchTex, e).r;
}
/**
* Search functions for the 2nd pass.
*/
-float MLAASearchXLeft(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 texcoord, float end) {
+float SMAASearchXLeft(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
/**
* @PSEUDO_GATHER4
* This texcoord has been offset by (-0.25, -0.125) in the vertex shader to
@@ -406,68 +406,68 @@ float MLAASearchXLeft(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 te
while (texcoord.x > end &&
e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0) { // Or is there a crossing edge that breaks the line?
- e = MLAASampleLevelZero(edgesTex, texcoord).rg;
- texcoord -= float2(2.0, 0.0) * MLAA_PIXEL_SIZE;
+ e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+ texcoord -= float2(2.0, 0.0) * SMAA_PIXEL_SIZE;
}
// We correct the previous (-0.25, -0.125) offset we applied:
- texcoord.x += 0.25 * MLAA_PIXEL_SIZE.x;
+ texcoord.x += 0.25 * SMAA_PIXEL_SIZE.x;
// The searchs are bias by 1, so adjust the coords accordingly:
- texcoord.x += MLAA_PIXEL_SIZE.x;
+ texcoord.x += SMAA_PIXEL_SIZE.x;
// Disambiguate the length added by the last step:
- texcoord.x += 2.0 * MLAA_PIXEL_SIZE.x; // Undo last step
- texcoord.x -= MLAA_PIXEL_SIZE.x * MLAASearchLength(searchTex, e, 0.0, 0.5);
+ texcoord.x += 2.0 * SMAA_PIXEL_SIZE.x; // Undo last step
+ texcoord.x -= SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.0, 0.5);
return texcoord.x;
}
-float MLAASearchXRight(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 texcoord, float end) {
+float SMAASearchXRight(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
float2 e = float2(0.0, 1.0);
while (texcoord.x < end &&
e.g > 0.8281 && // Is there some edge not activated?
e.r == 0.0) { // Or is there a crossing edge that breaks the line?
- e = MLAASampleLevelZero(edgesTex, texcoord).rg;
- texcoord += float2(2.0, 0.0) * MLAA_PIXEL_SIZE;
+ e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+ texcoord += float2(2.0, 0.0) * SMAA_PIXEL_SIZE;
}
- texcoord.x -= 0.25 * MLAA_PIXEL_SIZE.x;
- texcoord.x -= MLAA_PIXEL_SIZE.x;
- texcoord.x -= 2.0 * MLAA_PIXEL_SIZE.x;
- texcoord.x += MLAA_PIXEL_SIZE.x * MLAASearchLength(searchTex, e, 0.5, 0.5);
+ texcoord.x -= 0.25 * SMAA_PIXEL_SIZE.x;
+ texcoord.x -= SMAA_PIXEL_SIZE.x;
+ texcoord.x -= 2.0 * SMAA_PIXEL_SIZE.x;
+ texcoord.x += SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.5, 0.5);
return texcoord.x;
}
-float MLAASearchYUp(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 texcoord, float end) {
+float SMAASearchYUp(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
float2 e = float2(1.0, 0.0);
while (texcoord.y > end &&
e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0) { // Or is there a crossing edge that breaks the line?
- e = MLAASampleLevelZero(edgesTex, texcoord).rg;
- texcoord -= float2(0.0, 2.0) * MLAA_PIXEL_SIZE;
+ e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+ texcoord -= float2(0.0, 2.0) * SMAA_PIXEL_SIZE;
}
- texcoord.y += 0.25 * MLAA_PIXEL_SIZE.y;
- texcoord.y += MLAA_PIXEL_SIZE.y;
- texcoord.y += 2.0 * MLAA_PIXEL_SIZE.y;
- texcoord.y -= MLAA_PIXEL_SIZE.y * MLAASearchLength(searchTex, e.gr, 0.0, 0.5);
+ texcoord.y += 0.25 * SMAA_PIXEL_SIZE.y;
+ texcoord.y += SMAA_PIXEL_SIZE.y;
+ texcoord.y += 2.0 * SMAA_PIXEL_SIZE.y;
+ texcoord.y -= SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5);
return texcoord.y;
}
-float MLAASearchYDown(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 texcoord, float end) {
+float SMAASearchYDown(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
float2 e = float2(1.0, 0.0);
while (texcoord.y < end &&
e.r > 0.8281 && // Is there some edge not activated?
e.g == 0.0) { // Or is there a crossing edge that breaks the line?
- e = MLAASampleLevelZero(edgesTex, texcoord).rg;
- texcoord += float2(0.0, 2.0) * MLAA_PIXEL_SIZE;
+ e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+ texcoord += float2(0.0, 2.0) * SMAA_PIXEL_SIZE;
}
- texcoord.y -= 0.25 * MLAA_PIXEL_SIZE.y;
- texcoord.y -= MLAA_PIXEL_SIZE.y;
- texcoord.y -= 2.0 * MLAA_PIXEL_SIZE.y;
- texcoord.y += MLAA_PIXEL_SIZE.y * MLAASearchLength(searchTex, e.gr, 0.5, 0.5);
+ texcoord.y -= 0.25 * SMAA_PIXEL_SIZE.y;
+ texcoord.y -= SMAA_PIXEL_SIZE.y;
+ texcoord.y -= 2.0 * SMAA_PIXEL_SIZE.y;
+ texcoord.y += SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5);
return texcoord.y;
}
@@ -476,18 +476,18 @@ float MLAASearchYDown(MLAATexture2D edgesTex, MLAATexture2D searchTex, float2 te
* Ok, we have the distance and both crossing edges. So, what are the areas
* at each side of current edge?
*/
-float2 MLAAArea(MLAATexture2D areaTex, float2 distance, float e1, float e2) {
+float2 SMAAArea(SMAATexture2D areaTex, float2 distance, float e1, float e2) {
// Rounding prevents precision errors of bilinear filtering:
- float2 texcoord = MLAA_MAX_DISTANCE * round(4.0 * float2(e1, e2)) + distance;
+ float2 texcoord = SMAA_MAX_DISTANCE * round(4.0 * float2(e1, e2)) + distance;
// We do a scale and bias for mapping to texel space:
- texcoord = MLAA_AREATEX_PIXEL_SIZE * texcoord + (0.5 * MLAA_AREATEX_PIXEL_SIZE);
+ texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);
// Do it!
- #if MLAA_HLSL_3 == 1
- return MLAASampleLevelZero(areaTex, texcoord).ra;
+ #if SMAA_HLSL_3 == 1
+ return SMAASampleLevelZero(areaTex, texcoord).ra;
#else
- return MLAASampleLevelZero(areaTex, texcoord).rg;
+ return SMAASampleLevelZero(areaTex, texcoord).rg;
#endif
}
@@ -495,15 +495,15 @@ float2 MLAAArea(MLAATexture2D areaTex, float2 distance, float e1, float e2) {
/**
* Blending Weight Calculation
*/
-float4 MLAABlendingWeightCalculationPS(float2 texcoord,
+float4 SMAABlendingWeightCalculationPS(float2 texcoord,
float2 pixcoord,
float4 offset[3],
- MLAATexture2D edgesTex,
- MLAATexture2D areaTex,
- MLAATexture2D searchTex) {
+ SMAATexture2D edgesTex,
+ SMAATexture2D areaTex,
+ SMAATexture2D searchTex) {
float4 weights = 0.0;
- float2 e = MLAASample(edgesTex, texcoord).rg;
+ float2 e = SMAASample(edgesTex, texcoord).rg;
[branch]
if (e.g) { // Edge at north
@@ -511,33 +511,33 @@ float4 MLAABlendingWeightCalculationPS(float2 texcoord,
// Find the distance to the left:
float2 coords;
- coords.x = MLAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x);
- coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * MLAA_PIXEL_SIZE.y (@CROSSING_OFFSET)
+ coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x);
+ coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * SMAA_PIXEL_SIZE.y (@CROSSING_OFFSET)
d.x = coords.x;
// Now fetch the left crossing edges, two at a time using bilinear
// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
// discern what value each edge has:
- float e1 = MLAASampleLevelZero(edgesTex, coords).r;
+ float e1 = SMAASampleLevelZero(edgesTex, coords).r;
// Find the distance to the right:
- coords.x = MLAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);
+ coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);
d.y = coords.x;
// We want the distances to be in pixel units (doing this here allow to
// better interleave arithmetic and memory accesses):
- d = d / MLAA_PIXEL_SIZE.x - pixcoord.x;
+ d = d / SMAA_PIXEL_SIZE.x - pixcoord.x;
- // MLAAArea below needs a sqrt, as the areas texture is compressed
+ // SMAAArea below needs a sqrt, as the areas texture is compressed
// quadratically:
d = sqrt(abs(d));
// Fetch the right crossing edges:
- float e2 = MLAASampleLevelZeroOffset(edgesTex, coords, int2(1, 0)).r;
+ float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, int2(1, 0)).r;
// Ok, we know how this pattern looks like, now it is time for getting
// the actual area:
- weights.rg = MLAAArea(areaTex, d, e1, e2);
+ weights.rg = SMAAArea(areaTex, d, e1, e2);
}
[branch]
@@ -546,29 +546,29 @@ float4 MLAABlendingWeightCalculationPS(float2 texcoord,
// Find the distance to the top:
float2 coords;
- coords.y = MLAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z);
- coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * MLAA_PIXEL_SIZE.x;
+ coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z);
+ coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * SMAA_PIXEL_SIZE.x;
d.x = coords.y;
// Fetch the top crossing edges:
- float e1 = MLAASampleLevelZero(edgesTex, coords).g;
+ float e1 = SMAASampleLevelZero(edgesTex, coords).g;
// Find the distance to the bottom:
- coords.y = MLAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);
+ coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);
d.y = coords.y;
// We want the distances to be in pixel units:
- d = d / MLAA_PIXEL_SIZE.y - pixcoord.y;
+ d = d / SMAA_PIXEL_SIZE.y - pixcoord.y;
- // MLAAArea below needs a sqrt, as the areas texture is compressed
+ // SMAAArea below needs a sqrt, as the areas texture is compressed
// quadratically:
d = sqrt(abs(d));
// Fetch the bottom crossing edges:
- float e2 = MLAASampleLevelZeroOffset(edgesTex, coords, int2(0, 1)).g;
+ float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, int2(0, 1)).g;
// Get the area for this direction:
- weights.ba = MLAAArea(areaTex, d, e1, e2);
+ weights.ba = SMAAArea(areaTex, d, e1, e2);
}
return weights;
@@ -578,14 +578,14 @@ float4 MLAABlendingWeightCalculationPS(float2 texcoord,
/**
* Neighborhood Blending
*/
-float4 MLAANeighborhoodBlendingPS(float2 texcoord,
+float4 SMAANeighborhoodBlendingPS(float2 texcoord,
float4 offset[2],
- MLAATexture2D colorTex,
- MLAATexture2D blendTex) {
+ SMAATexture2D colorTex,
+ SMAATexture2D blendTex) {
// Fetch the blending weights for current pixel:
- float4 topLeft = MLAASample(blendTex, texcoord);
- float bottom = MLAASample(blendTex, offset[1].zw).g;
- float right = MLAASample(blendTex, offset[1].xy).a;
+ float4 topLeft = SMAASample(blendTex, texcoord);
+ float bottom = SMAASample(blendTex, offset[1].zw).g;
+ float right = SMAASample(blendTex, offset[1].xy).a;
float4 a = float4(topLeft.r, bottom, topLeft.b, right);
// Up to 4 lines can be crossing a pixel (one in each edge). So, we perform
@@ -597,30 +597,30 @@ float4 MLAANeighborhoodBlendingPS(float2 texcoord,
float sum = dot(w, 1.0);
[branch]
if (sum < 1e-5)
- return MLAASampleLevelZero(colorTex, texcoord);
+ return SMAASampleLevelZero(colorTex, texcoord);
else {
float4 color = 0.0;
// Add the contributions of the 4 possible lines that can cross this
// pixel:
- #if MLAA_HLSL_4 == 1 || MLAA_DIRECTX9_LINEAR_BLEND == 0
- float4 coords = MLAAMad(float4( 0.0, -a.r, 0.0, a.g), MLAA_PIXEL_SIZE.yyyy, texcoord.xyxy);
- color = MLAAMad(MLAASampleLevelZero(colorTex, coords.xy), w.r, color);
- color = MLAAMad(MLAASampleLevelZero(colorTex, coords.zw), w.g, color);
-
- coords = MLAAMad(float4(-a.b, 0.0, a.a, 0.0), MLAA_PIXEL_SIZE.xxxx, texcoord.xyxy);
- color = MLAAMad(MLAASampleLevelZero(colorTex, coords.xy), w.b, color);
- color = MLAAMad(MLAASampleLevelZero(colorTex, coords.zw), w.a, color);
+ #if SMAA_HLSL_4 == 1 || SMAA_DIRECTX9_LINEAR_BLEND == 0
+ float4 coords = SMAAMad(float4( 0.0, -a.r, 0.0, a.g), SMAA_PIXEL_SIZE.yyyy, texcoord.xyxy);
+ color = SMAAMad(SMAASampleLevelZero(colorTex, coords.xy), w.r, color);
+ color = SMAAMad(SMAASampleLevelZero(colorTex, coords.zw), w.g, color);
+
+ coords = SMAAMad(float4(-a.b, 0.0, a.a, 0.0), SMAA_PIXEL_SIZE.xxxx, texcoord.xyxy);
+ color = SMAAMad(SMAASampleLevelZero(colorTex, coords.xy), w.b, color);
+ color = SMAAMad(SMAASampleLevelZero(colorTex, coords.zw), w.a, color);
#else
- float4 C = MLAASampleLevelZero(colorTex, texcoord);
- float4 Cleft = MLAASampleLevelZero(colorTex, offset[0].xy);
- float4 Ctop = MLAASampleLevelZero(colorTex, offset[0].zw);
- float4 Cright = MLAASampleLevelZero(colorTex, offset[1].xy);
- float4 Cbottom = MLAASampleLevelZero(colorTex, offset[1].zw);
- color = MLAAMad(lerp(C, Ctop, a.r), w.r, color);
- color = MLAAMad(lerp(C, Cbottom, a.g), w.g, color);
- color = MLAAMad(lerp(C, Cleft, a.b), w.b, color);
- color = MLAAMad(lerp(C, Cright, a.a), w.a, color);
+ float4 C = SMAASampleLevelZero(colorTex, texcoord);
+ float4 Cleft = SMAASampleLevelZero(colorTex, offset[0].xy);
+ float4 Ctop = SMAASampleLevelZero(colorTex, offset[0].zw);
+ float4 Cright = SMAASampleLevelZero(colorTex, offset[1].xy);
+ float4 Cbottom = SMAASampleLevelZero(colorTex, offset[1].zw);
+ color = SMAAMad(lerp(C, Ctop, a.r), w.r, color);
+ color = SMAAMad(lerp(C, Cbottom, a.g), w.g, color);
+ color = SMAAMad(lerp(C, Cleft, a.b), w.b, color);
+ color = SMAAMad(lerp(C, Cright, a.a), w.a, color);
#endif
// Normalize the resulting color and we are finished!
Please sign in to comment.
Something went wrong with that request. Please try again.