mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-04-13 05:43:18 -07:00
demos/gears: Recompile shaders with our compiler.
This commit is contained in:
committed by
Alexandre Julliard
parent
763f7dfa61
commit
3d85d77ced
Notes:
Alexandre Julliard
2022-10-18 00:13:00 +02:00
Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/23
56
demos/gears_hlsl.h
Normal file
56
demos/gears_hlsl.h
Normal file
@@ -0,0 +1,56 @@
|
||||
static const char gears_hlsl[] =
|
||||
"cbuffer gear_block : register(b0)\n"
|
||||
"{\n"
|
||||
" float4x4 mvp_matrix;\n"
|
||||
" float3x3 normal_matrix;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct vs_in\n"
|
||||
"{\n"
|
||||
" float4 position : POSITION;\n"
|
||||
" float3 normal : NORMAL;\n"
|
||||
" float3 diffuse : DIFFUSE;\n"
|
||||
" float4 transform : TRANSFORM;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct vs_out\n"
|
||||
"{\n"
|
||||
" float4 position : SV_POSITION;\n"
|
||||
" float4 colour : COLOR;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct vs_out vs_main(struct vs_in i)\n"
|
||||
"{\n"
|
||||
" const float3 l_pos = float3(5.0, 5.0, 10.0);\n"
|
||||
" float3 dir, normal;\n"
|
||||
" float4 position;\n"
|
||||
" struct vs_out o;\n"
|
||||
" float att;\n"
|
||||
"\n"
|
||||
" position.x = i.transform.x * i.position.x - i.transform.y * i.position.y + i.transform.z;\n"
|
||||
" position.y = i.transform.x * i.position.y + i.transform.y * i.position.x + i.transform.w;\n"
|
||||
" position.zw = i.position.zw;\n"
|
||||
"\n"
|
||||
" o.position = mul(mvp_matrix, position);\n"
|
||||
" dir = normalize(l_pos - o.position.xyz / o.position.w);\n"
|
||||
"\n"
|
||||
" normal.x = i.transform.x * i.normal.x - i.transform.y * i.normal.y;\n"
|
||||
" normal.y = i.transform.x * i.normal.y + i.transform.y * i.normal.x;\n"
|
||||
" normal.z = i.normal.z;\n"
|
||||
" att = 0.2 + dot(dir, normalize(mul(normal_matrix, normal)));\n"
|
||||
"\n"
|
||||
" o.colour.xyz = i.diffuse.xyz * att;\n"
|
||||
" o.colour.w = 1.0;\n"
|
||||
"\n"
|
||||
" return o;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"float4 ps_main_smooth(float4 position : SV_POSITION, float4 colour : COLOR) : SV_TARGET\n"
|
||||
"{\n"
|
||||
" return colour;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"float4 ps_main_flat(float4 position : SV_POSITION, nointerpolation float4 colour : COLOR) : SV_TARGET\n"
|
||||
"{\n"
|
||||
" return colour;\n"
|
||||
"}\n";
|
Reference in New Issue
Block a user