Create d3d_shaders

This commit is contained in:
twinaphex 2016-04-17 00:16:32 +02:00
parent 02e0be55a8
commit e9d16655f0
4 changed files with 66 additions and 65 deletions

View File

@ -86,30 +86,7 @@ typedef struct cg_renderchain
CGcontext cgCtx; CGcontext cgCtx;
} cg_renderchain_t; } cg_renderchain_t;
#include "../drivers/d3d_shaders/opaque.cg.d3d9.h"
static const char *stock_cg_d3d9_program =
"void main_vertex"
"("
" float4 position : POSITION,"
" float2 texCoord : TEXCOORD0,"
" float4 color : COLOR,"
""
" uniform float4x4 modelViewProj,"
""
" out float4 oPosition : POSITION,"
" out float2 otexCoord : TEXCOORD0,"
" out float4 oColor : COLOR"
")"
"{"
" oPosition = mul(modelViewProj, position);"
" otexCoord = texCoord;"
" oColor = color;"
"}"
""
"float4 main_fragment(in float4 color : COLOR, float2 tex : TEXCOORD0, uniform sampler2D s0 : TEXUNIT0) : COLOR"
"{"
" return color * tex2D(s0, tex);"
"}";
static INLINE bool validate_param_name(const char *name) static INLINE bool validate_param_name(const char *name)
{ {

View File

@ -0,0 +1,23 @@
static const char *stock_cg_d3d9_program =
"void main_vertex"
"("
" float4 position : POSITION,"
" float2 texCoord : TEXCOORD0,"
" float4 color : COLOR,"
""
" uniform float4x4 modelViewProj,"
""
" out float4 oPosition : POSITION,"
" out float2 otexCoord : TEXCOORD0,"
" out float4 oColor : COLOR"
")"
"{"
" oPosition = mul(modelViewProj, position);"
" otexCoord = texCoord;"
" oColor = color;"
"}"
""
"float4 main_fragment(in float4 color : COLOR, float2 tex : TEXCOORD0, uniform sampler2D s0 : TEXUNIT0) : COLOR"
"{"
" return color * tex2D(s0, tex);"
"}";

View File

@ -0,0 +1,41 @@
static const char *stock_hlsl_program =
"void main_vertex\n"
"(\n"
" float4 position : POSITION,\n"
" float4 color : COLOR,\n"
"\n"
" uniform float4x4 modelViewProj,\n"
"\n"
" float4 texCoord : TEXCOORD0,\n"
" out float4 oPosition : POSITION,\n"
" out float4 oColor : COLOR,\n"
" out float2 otexCoord : TEXCOORD\n"
")\n"
"{\n"
" oPosition = mul(modelViewProj, position);\n"
" oColor = color;\n"
" otexCoord = texCoord;\n"
"}\n"
"\n"
"struct output\n"
"{\n"
" float4 color: COLOR;\n"
"};\n"
"\n"
"struct input\n"
"{\n"
" float2 video_size;\n"
" float2 texture_size;\n"
" float2 output_size;\n"
" float frame_count;\n"
" float frame_direction;\n"
" float frame_rotation;\n"
"};\n"
"\n"
"output main_fragment(float2 texCoord : TEXCOORD0,\n"
"uniform sampler2D decal : TEXUNIT0, uniform input IN)\n"
"{\n"
" output OUT;\n"
" OUT.color = tex2D(decal, texCoord);\n"
" return OUT;\n"
"}\n";

View File

@ -22,47 +22,7 @@
#include "../d3d/d3d.h" #include "../d3d/d3d.h"
#include "../../rewind.h" #include "../../rewind.h"
static const char *stock_hlsl_program = #include "../drivers/d3d_shaders/opaque.hlsl.d3d9.h"
"void main_vertex\n"
"(\n"
" float4 position : POSITION,\n"
" float4 color : COLOR,\n"
"\n"
" uniform float4x4 modelViewProj,\n"
"\n"
" float4 texCoord : TEXCOORD0,\n"
" out float4 oPosition : POSITION,\n"
" out float4 oColor : COLOR,\n"
" out float2 otexCoord : TEXCOORD\n"
")\n"
"{\n"
" oPosition = mul(modelViewProj, position);\n"
" oColor = color;\n"
" otexCoord = texCoord;\n"
"}\n"
"\n"
"struct output\n"
"{\n"
" float4 color: COLOR;\n"
"};\n"
"\n"
"struct input\n"
"{\n"
" float2 video_size;\n"
" float2 texture_size;\n"
" float2 output_size;\n"
" float frame_count;\n"
" float frame_direction;\n"
" float frame_rotation;\n"
"};\n"
"\n"
"output main_fragment(float2 texCoord : TEXCOORD0,\n"
"uniform sampler2D decal : TEXUNIT0, uniform input IN)\n"
"{\n"
" output OUT;\n"
" OUT.color = tex2D(decal, texCoord);\n"
" return OUT;\n"
"}\n";
struct shader_program_hlsl_data struct shader_program_hlsl_data
{ {