Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,14 @@ Demo/DX10/Demo.vcxproj.user

Scripts/*.pyc
Scripts/*.tga

*~
*.d
*.o

mingw/dxsdkver.h
mingw/d3d*.h
mingw/D3DX10math.inl
mingw/dxerr.h
mingw/xinput.h
mingw/*.exe
23 changes: 13 additions & 10 deletions Demo/DX10/Code/Demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "DXUT.h"
#include "DXUTgui.h"
#include "DXUTsettingsDlg.h"
#include "DXUTsettingsdlg.h"
#include "SDKmesh.h"
#include "SDKmisc.h"

Expand Down Expand Up @@ -490,12 +490,12 @@ void initSMAA(ID3D10Device *device, const DXGI_SURFACE_DESC *desc) {
slider = hud.GetSlider(IDC_MAX_SEARCH_STEPS);
slider->GetRange(min, max);
scale = float(slider->GetValue()) / (max - min);
smaa->setMaxSearchSteps(int(round(112.0f * scale)));
smaa->setMaxSearchSteps(int(round(112.0 * scale)));

slider = hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG);
slider->GetRange(min, max);
scale = float(slider->GetValue()) / (max - min);
smaa->setMaxSearchStepsDiag(int(round(20.0f * scale)));
smaa->setMaxSearchStepsDiag(int(round(20.0 * scale)));

slider = hud.GetSlider(IDC_CORNER_ROUNDING);
slider->GetRange(min, max);
Expand Down Expand Up @@ -1183,10 +1183,10 @@ void CALLBACK onGUIEvent(UINT event, int id, CDXUTControl *control, void *contex
slider->GetRange(min, max);

float scale = float(slider->GetValue()) / (max - min);
smaa->setMaxSearchSteps(int(round(scale * 112.0f)));
smaa->setMaxSearchSteps(int(round(scale * 112.0)));

wstringstream s;
s << L"Max Search Steps: " << int(round(scale * 112.0f));
s << L"Max Search Steps: " << int(round(scale * 112.0));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetText(s.str().c_str());
}
break;
Expand All @@ -1197,10 +1197,10 @@ void CALLBACK onGUIEvent(UINT event, int id, CDXUTControl *control, void *contex
slider->GetRange(min, max);

float scale = float(slider->GetValue()) / (max - min);
smaa->setMaxSearchStepsDiag(int(round(scale * 20.0f)));
smaa->setMaxSearchStepsDiag(int(round(scale * 20.0)));

wstringstream s;
s << L"Max Diag. Search Steps: " << int(round(scale * 20.0f));
s << L"Max Diag. Search Steps: " << int(round(scale * 20.0));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetText(s.str().c_str());
}
break;
Expand Down Expand Up @@ -1296,21 +1296,24 @@ void initApp() {
hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(false);
hud.GetSlider(IDC_THRESHOLD)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Max Search Steps: " << commandlineOptions.searchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.searchSteps / 112.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Max Diag. Search Steps: " << commandlineOptions.diagSearchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS_DIAG, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.diagSearchSteps / 20.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Corner Rounding: " << commandlineOptions.cornerRounding;
hud.AddStatic(IDC_CORNER_ROUNDING_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_CORNER_ROUNDING, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.cornerRounding / 100.0f));
Expand Down
51 changes: 25 additions & 26 deletions Demo/DX10/Code/SMAA.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,31 @@

class SMAA {
public:
class ExternalStorage;
/**
* @EXTERNAL_STORAGE
*
* If you have one or two spare render targets of the same size as the
* backbuffer, you may want to pass them to SMAA::SMAA() using a
* ExternalStorage object. You may pass one or the two, depending on
* what you have available.
*
* A non-sRGB RG buffer (at least) is expected for storing edges.
* A non-sRGB RGBA buffer is expected for the blending weights.
*/
class ExternalStorage {
public:
ExternalStorage(ID3D10ShaderResourceView *edgesSRV=nullptr,
ID3D10RenderTargetView *edgesRTV=nullptr,
ID3D10ShaderResourceView *weightsSRV=nullptr,
ID3D10RenderTargetView *weightsRTV=nullptr)
: edgesSRV(edgesSRV),
edgesRTV(edgesRTV),
weightsSRV(weightsSRV),
weightsRTV(weightsRTV) {}

ID3D10ShaderResourceView *edgesSRV, *weightsSRV;
ID3D10RenderTargetView *edgesRTV, *weightsRTV;
};

enum Mode { MODE_SMAA_1X, MODE_SMAA_T2X, MODE_SMAA_S2X, MODE_SMAA_4X, MODE_SMAA_COUNT=MODE_SMAA_4X };
enum Preset { PRESET_LOW, PRESET_MEDIUM, PRESET_HIGH, PRESET_ULTRA, PRESET_CUSTOM, PRESET_COUNT=PRESET_CUSTOM };
Expand Down Expand Up @@ -169,31 +193,6 @@ class SMAA {
void nextFrame();
int getFrameIndex() const { return frameIndex; }

/**
* @EXTERNAL_STORAGE
*
* If you have one or two spare render targets of the same size as the
* backbuffer, you may want to pass them to SMAA::SMAA() using a
* ExternalStorage object. You may pass one or the two, depending on
* what you have available.
*
* A non-sRGB RG buffer (at least) is expected for storing edges.
* A non-sRGB RGBA buffer is expected for the blending weights.
*/
class ExternalStorage {
public:
ExternalStorage(ID3D10ShaderResourceView *edgesSRV=nullptr,
ID3D10RenderTargetView *edgesRTV=nullptr,
ID3D10ShaderResourceView *weightsSRV=nullptr,
ID3D10RenderTargetView *weightsRTV=nullptr)
: edgesSRV(edgesSRV),
edgesRTV(edgesRTV),
weightsSRV(weightsSRV),
weightsRTV(weightsRTV) {}

ID3D10ShaderResourceView *edgesSRV, *weightsSRV;
ID3D10RenderTargetView *edgesRTV, *weightsRTV;
};

private:
/**
Expand Down
37 changes: 37 additions & 0 deletions Demo/DX10/Code/module.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sp := $(sp).x
dirstack_$(sp) := $(d)
d := $(dir)


SUBDIRS:= \
# empty line

DIRS:=$(addprefix $(d)/,$(SUBDIRS))

$(eval $(foreach directory, $(DIRS), $(call directory-module,$(directory)) ))


FILES:= \
Demo.cpp \
SMAA.cpp \
# empty line


SRC_$(d):=$(addprefix $(d)/,$(FILES))



dx10demo_MODULES:=dxut Support


ifeq ($(DX10),y)

PROGRAMS+= \
dx10demo \
#empty line

endif


d := $(dirstack_$(sp))
sp := $(basename $(sp))
46 changes: 23 additions & 23 deletions Demo/DX10/Demo.rc
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
1 ICON "Icon.ico"

SMAA.fx RCDATA Shaders\SMAA.fx
SMAA.hlsl RCDATA "..\\..\\SMAA.hlsl"
Simple.fx RCDATA Shaders\Simple.fx
SMAA.fx RCDATA "Shaders/SMAA.fx"
SMAA.hlsl RCDATA "../../SMAA.hlsl"
Simple.fx RCDATA "Shaders/Simple.fx"

AreaTexDX10.dds RCDATA "..\\..\\Textures\\AreaTexDX10.dds"
SearchTex.dds RCDATA "..\\..\\Textures\\SearchTex.dds"
AreaTexDX10.dds RCDATA "../../Textures/AreaTexDX10.dds"
SearchTex.dds RCDATA "../../Textures/SearchTex.dds"

Unigine01.png RCDATA "..\\Media\\Unigine01.png"
Unigine02.png RCDATA "..\\Media\\Unigine02.png"
Unigine03.png RCDATA "..\\Media\\Unigine03.png"
Unigine04.png RCDATA "..\\Media\\Unigine04.png"
Unigine05.png RCDATA "..\\Media\\Unigine05.png"
Unigine06.png RCDATA "..\\Media\\Unigine06.png"
Unigine07.png RCDATA "..\\Media\\Unigine07.png"
Unigine01.png RCDATA "../Media/Unigine01.png"
Unigine02.png RCDATA "../Media/Unigine02.png"
Unigine03.png RCDATA "../Media/Unigine03.png"
Unigine04.png RCDATA "../Media/Unigine04.png"
Unigine05.png RCDATA "../Media/Unigine05.png"
Unigine06.png RCDATA "../Media/Unigine06.png"
Unigine07.png RCDATA "../Media/Unigine07.png"

Unigine01.dds RCDATA "..\\Media\\Unigine01.dds"
Unigine02.dds RCDATA "..\\Media\\Unigine02.dds"
Unigine03.dds RCDATA "..\\Media\\Unigine03.dds"
Unigine04.dds RCDATA "..\\Media\\Unigine04.dds"
Unigine05.dds RCDATA "..\\Media\\Unigine05.dds"
Unigine06.dds RCDATA "..\\Media\\Unigine06.dds"
Unigine07.dds RCDATA "..\\Media\\Unigine07.dds"
Unigine01.dds RCDATA "../Media/Unigine01.dds"
Unigine02.dds RCDATA "../Media/Unigine02.dds"
Unigine03.dds RCDATA "../Media/Unigine03.dds"
Unigine04.dds RCDATA "../Media/Unigine04.dds"
Unigine05.dds RCDATA "../Media/Unigine05.dds"
Unigine06.dds RCDATA "../Media/Unigine06.dds"
Unigine07.dds RCDATA "../Media/Unigine07.dds"

Fence.sdkmesh RCDATA "..\\Media\\Fence.sdkmesh"
DiffuseMap.dds RCDATA "..\\Media\\DiffuseMap.dds"
NormalMap.dds RCDATA "..\\Media\\NormalMap.dds"
EnvMap.dds RCDATA "..\\Media\\EnvMap.dds"
Fence.sdkmesh RCDATA "../Media/Fence.sdkmesh"
DiffuseMap.dds RCDATA "../Media/DiffuseMap.dds"
NormalMap.dds RCDATA "../Media/NormalMap.dds"
EnvMap.dds RCDATA "../Media/EnvMap.dds"
23 changes: 23 additions & 0 deletions Demo/DX10/module.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sp := $(sp).x
dirstack_$(sp) := $(d)
d := $(dir)


SUBDIRS:= \
Code \
# empty line

DIRS:=$(addprefix $(d)/,$(SUBDIRS))

$(eval $(foreach directory, $(DIRS), $(call directory-module,$(directory)) ))


FILES:= \
# empty line


SRC_$(d):=$(addprefix $(d)/,$(FILES))
dx10demo_SRC:=$(foreach directory, $(DIRS), $(SRC_$(directory)) ) $(d)/Demo.rc

d := $(dirstack_$(sp))
sp := $(basename $(sp))
11 changes: 7 additions & 4 deletions Demo/DX9/Code/Demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "DXUT.h"
#include "DXUTgui.h"
#include "DXUTmisc.h"
#include "DXUTSettingsDlg.h"
#include "DXUTsettingsdlg.h"
#include "SDKmisc.h"

#include "SMAA.h"
Expand Down Expand Up @@ -474,21 +474,24 @@ void initApp() {
hud.GetStatic(IDC_THRESHOLD_LABEL)->SetVisible(false);
hud.GetSlider(IDC_THRESHOLD)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Max Search Steps: " << commandlineOptions.searchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.searchSteps / 112.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Max Diag. Search Steps: " << commandlineOptions.diagSearchSteps;
hud.AddStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_MAX_SEARCH_STEPS_DIAG, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.diagSearchSteps / 20.0f));
hud.GetStatic(IDC_MAX_SEARCH_STEPS_DIAG_LABEL)->SetVisible(false);
hud.GetSlider(IDC_MAX_SEARCH_STEPS_DIAG)->SetVisible(false);

s = wstringstream();
s.clear();
s.str(L"");
s << L"Corner Rounding: " << commandlineOptions.cornerRounding;
hud.AddStatic(IDC_CORNER_ROUNDING_LABEL, s.str().c_str(), 35, iY += 24, HUD_WIDTH, 22);
hud.AddSlider(IDC_CORNER_ROUNDING, 35, iY += 24, HUD_WIDTH, 22, 0, 100, int(100.0f * commandlineOptions.cornerRounding / 100.0f));
Expand Down
35 changes: 17 additions & 18 deletions Demo/DX9/Code/SMAA.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,23 @@

class SMAA {
public:
class ExternalStorage;
/**
* This class allows to pass spare storage buffers to the SMAA class.
*/
class ExternalStorage {
public:
ExternalStorage(IDirect3DTexture9 *edgeTex=nullptr,
IDirect3DSurface9 *edgeSurface=nullptr,
IDirect3DTexture9 *blendTex=nullptr,
IDirect3DSurface9 *blendSurface=nullptr)
: edgeTex(edgeTex),
edgeSurface(edgeSurface),
blendTex(blendTex),
blendSurface(blendSurface) {}

IDirect3DTexture9 *edgeTex, *blendTex;
IDirect3DSurface9 *edgeSurface, *blendSurface;
};

enum Preset { PRESET_LOW, PRESET_MEDIUM, PRESET_HIGH, PRESET_ULTRA, PRESET_CUSTOM };
enum Input { INPUT_LUMA, INPUT_COLOR, INPUT_DEPTH };
Expand Down Expand Up @@ -109,23 +125,6 @@ class SMAA {
float getCornerRounding() const { return cornerRounding; }
void setCornerRounding(float cornerRounding) { this->cornerRounding = cornerRounding; }

/**
* This class allows to pass spare storage buffers to the SMAA class.
*/
class ExternalStorage {
public:
ExternalStorage(IDirect3DTexture9 *edgeTex=nullptr,
IDirect3DSurface9 *edgeSurface=nullptr,
IDirect3DTexture9 *blendTex=nullptr,
IDirect3DSurface9 *blendSurface=nullptr)
: edgeTex(edgeTex),
edgeSurface(edgeSurface),
blendTex(blendTex),
blendSurface(blendSurface) {}

IDirect3DTexture9 *edgeTex, *blendTex;
IDirect3DSurface9 *edgeSurface, *blendSurface;
};

private:
void loadAreaTex();
Expand Down
37 changes: 37 additions & 0 deletions Demo/DX9/Code/module.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
sp := $(sp).x
dirstack_$(sp) := $(d)
d := $(dir)


SUBDIRS:= \
# empty line

DIRS:=$(addprefix $(d)/,$(SUBDIRS))

$(eval $(foreach directory, $(DIRS), $(call directory-module,$(directory)) ))


FILES:= \
Demo.cpp \
SMAA.cpp \
# empty line


SRC_$(d):=$(addprefix $(d)/,$(FILES))



dx9demo_MODULES:=dxut Support


ifeq ($(DX9),y)

PROGRAMS+= \
dx9demo \
#empty line

endif


d := $(dirstack_$(sp))
sp := $(basename $(sp))
Loading