diff --git a/360/media/shaders/stock.cg b/360/media/shaders/stock.cg
new file mode 100644
index 0000000000..8460b6cf0f
--- /dev/null
+++ b/360/media/shaders/stock.cg
@@ -0,0 +1,32 @@
+sampler2D tex : register(s0);
+
+struct PS_IN
+{
+ float2 coord : TEXCOORD0;
+};
+
+struct VS_IN
+{
+ float2 pos : POSITION;
+ float2 coord : TEXCOORD0;
+};
+
+struct VS_OUT
+{
+ float4 pos : POSITION;
+ float2 coord : TEXCOORD0;
+};
+
+float4 main_fragment(PS_IN input) : COLOR
+{
+ return tex2D(tex, input.coord);
+}
+
+VS_OUT main_vertex(VS_IN input)
+{
+ VS_OUT output;
+ output.pos = float4(input.pos, 0.0, 1.0);
+ output.coord = input.coord;
+ return output;
+}
+
diff --git a/360/xdk360_video.cpp b/360/xdk360_video.cpp
index f6a0d391d5..4f1ce11d79 100644
--- a/360/xdk360_video.cpp
+++ b/360/xdk360_video.cpp
@@ -29,40 +29,6 @@
#include "config.h"
#endif
-static const char* g_strPixelShaderProgram =
- " sampler2D tex : register(s0); "
- " struct PS_IN "
- " { "
- " float2 coord : TEXCOORD0; "
- " }; "
- " "
- " float4 main(PS_IN input) : COLOR "
- " { "
- " return tex2D(tex, input.coord); "
- " } ";
-
-static const char* g_strVertexShaderProgram =
- " struct VS_IN "
- " "
- " { "
- " float2 pos : POSITION; "
- " float2 coord : TEXCOORD0; "
- " }; "
- " "
- " struct VS_OUT "
- " { "
- " float4 pos : POSITION; "
- " float2 coord : TEXCOORD0; "
- " }; "
- " "
- " VS_OUT main(VS_IN input) "
- " { "
- " VS_OUT output; "
- " output.pos = float4(input.pos, 0.0, 1.0); "
- " output.coord = input.coord; "
- " return output; "
- " } ";
-
static bool g_quitting;
static bool g_first_msg;
unsigned g_frame_count;
@@ -263,13 +229,30 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
ID3DXBuffer* pShaderCodeP = NULL;
ID3DXBuffer* pErrorMsg = NULL;
- HRESULT hr = D3DXCompileShader(g_strVertexShaderProgram, (UINT)strlen(g_strVertexShaderProgram),
- NULL, NULL, "main", "vs_2_0", 0, &pShaderCodeV, &pErrorMsg, NULL);
+ HRESULT hr = D3DXCompileShaderFromFile(
+ "game:\\media\\shaders\\stock.cg", //filepath
+ NULL, //macros
+ NULL, //includes
+ "main_vertex", // main function
+ "vs_2_0", // shader profile
+ 0, // flags
+ &pShaderCodeV, // compiled operations
+ &pErrorMsg, // errors
+ NULL); // constants
if (SUCCEEDED(hr))
{
- hr = D3DXCompileShader(g_strPixelShaderProgram, (UINT)strlen(g_strPixelShaderProgram),
- NULL, NULL, "main", "ps_2_0", 0, &pShaderCodeP, &pErrorMsg, NULL);
+ SSNES_LOG("Vertex shader program from [%s] successfully compiled.\n", "game:\\media\\shaders\\stock.cg");
+ HRESULT hr = D3DXCompileShaderFromFile(
+ "game:\\media\\shaders\\stock.cg", //filepath
+ NULL, //macros
+ NULL, //includes
+ "main_fragment", // main function
+ "ps_2_0", // shader profile
+ 0, // flags
+ &pShaderCodeP, // compiled operations
+ &pErrorMsg, // errors
+ NULL); // constants
}
if (FAILED(hr))
@@ -280,6 +263,10 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
free(vid);
return NULL;
}
+ else
+ {
+ SSNES_LOG("Pixel shader program from [%s] successfully compiled.\n", "game:\\media\\shaders\\stock.cg");
+ }
vid->pVertexShader = D3DDevice_CreateVertexShader((const DWORD*)pShaderCodeV->GetBufferPointer());
vid->pPixelShader = D3DDevice_CreatePixelShader((const DWORD*)pShaderCodeP->GetBufferPointer());
diff --git a/msvc-360/SSNES-360/SSNES-360.vcxproj b/msvc-360/SSNES-360/SSNES-360.vcxproj
index 9066849531..d72413f7f4 100644
--- a/msvc-360/SSNES-360/SSNES-360.vcxproj
+++ b/msvc-360/SSNES-360/SSNES-360.vcxproj
@@ -122,7 +122,7 @@
CopyToHardDrive
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
true
@@ -158,7 +158,7 @@
xapilibd.lib;d3d9d.lib;d3dx9d.lib;xgraphicsd.lib;xboxkrnl.lib;xnetd.lib;xaudiod2.lib;xactd3.lib;x3daudiod.lib;xmcored.lib;xbdm.lib;vcompd.lib;%(AdditionalDependencies)
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
true
CopyToHardDrive
@@ -200,7 +200,7 @@
xapilibi.lib;d3d9i.lib;d3dx9.lib;xgraphics.lib;xboxkrnl.lib;xnet.lib;xaudio2.lib;xact3i.lib;x3daudioi.lib;xmcorei.lib;xbdm.lib;vcomp.lib;$(TargetDir)libsnes.lib;%(AdditionalDependencies)
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
true
CopyToHardDrive
@@ -241,7 +241,7 @@
xapilib.lib;d3d9.lib;d3dx9.lib;xgraphics.lib;xboxkrnl.lib;xnet.lib;xaudio2.lib;xact3.lib;x3daudio.lib;xmcore.lib;vcomp.lib;xbdm.lib;%(AdditionalDependencies)
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
true
CopyToHardDrive
@@ -282,7 +282,7 @@
CopyToHardDrive
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
true
@@ -324,7 +324,7 @@
true
- $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg
+ $(RemoteRoot)=$(ImagePath);$(RemoteRoot)\media=$(OutDir)media;$(RemoteRoot)=$(OutDir)cfg;$(RemoteRoot)\media\shaders=$(OutDir)media\shaders
CopyToHardDrive
@@ -601,6 +601,23 @@
$(OutDir)media\ssnes_libsnescore_browser.xur;
+
+
+ Document
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ $(OutDir)media\shaders\stock.cg;%(Outputs)
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+ copy %(FullPath) $(OutDir)media\shaders\stock.cg
+
+
diff --git a/msvc-360/SSNES-360/SSNES-360.vcxproj.filters b/msvc-360/SSNES-360/SSNES-360.vcxproj.filters
index deef0c3a1f..0997ebc135 100644
--- a/msvc-360/SSNES-360/SSNES-360.vcxproj.filters
+++ b/msvc-360/SSNES-360/SSNES-360.vcxproj.filters
@@ -39,6 +39,9 @@
{b19dc1de-69d4-4501-87ef-b8ee4a7795c5}
+
+ {3a05047b-b9ec-4821-bb28-d1b0e9e3e8bb}
+
@@ -273,5 +276,8 @@
Source Files\media
+
+ Source Files\media\shader
+
\ No newline at end of file