mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-27 21:38:34 +00:00
Cleanup
This commit is contained in:
parent
fdc8a6a4e2
commit
e89375b39a
@ -34,6 +34,9 @@ mod hlsl_build {
|
|||||||
|
|
||||||
let src_data = fs::read_to_string(&source_path).unwrap();
|
let src_data = fs::read_to_string(&source_path).unwrap();
|
||||||
|
|
||||||
|
if vertex_destination.exists() {
|
||||||
|
fs::remove_file(vertex_destination).unwrap();
|
||||||
|
}
|
||||||
fs::write(
|
fs::write(
|
||||||
vertex_destination,
|
vertex_destination,
|
||||||
compile_shader(&src_data, &source_path, "VertexMain", "vs_4_0").unwrap_or_else(
|
compile_shader(&src_data, &source_path, "VertexMain", "vs_4_0").unwrap_or_else(
|
||||||
@ -45,6 +48,9 @@ mod hlsl_build {
|
|||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
if pixel_destination.exists() {
|
||||||
|
fs::remove_file(pixel_destination).unwrap();
|
||||||
|
}
|
||||||
fs::write(
|
fs::write(
|
||||||
pixel_destination,
|
pixel_destination,
|
||||||
compile_shader(&src_data, &source_path, "PixelMain", "ps_4_0").unwrap_or_else(
|
compile_shader(&src_data, &source_path, "PixelMain", "ps_4_0").unwrap_or_else(
|
||||||
|
|||||||
@ -168,8 +168,8 @@ impl Shaders {
|
|||||||
include_bytes!("shader/glsles_100.frag"),
|
include_bytes!("shader/glsles_100.frag"),
|
||||||
),
|
),
|
||||||
HlslSm40 => (
|
HlslSm40 => (
|
||||||
include_bytes!("data/pixel.fx"),
|
|
||||||
include_bytes!("data/vertex.fx"),
|
include_bytes!("data/vertex.fx"),
|
||||||
|
include_bytes!("data/pixel.fx"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,34 +1,34 @@
|
|||||||
cbuffer Constants : register(b0) {
|
cbuffer Constants : register(b0) {
|
||||||
float4x4 matrix_;
|
float4x4 matrix_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Texture2D tex;
|
Texture2D tex;
|
||||||
SamplerState tex_;
|
SamplerState tex_;
|
||||||
|
|
||||||
struct VIn {
|
struct VIn {
|
||||||
float2 position : pos;
|
float2 position : pos;
|
||||||
float2 uv : uv;
|
float2 uv : uv;
|
||||||
float4 color : col;
|
float4 color : col;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct VOut
|
struct VOut
|
||||||
{
|
{
|
||||||
float4 position : SV_POSITION;
|
float4 position : SV_POSITION;
|
||||||
float2 uv : TEXCOORD0;
|
float2 uv : TEXCOORD0;
|
||||||
float4 color : COLOR;
|
float4 color : COLOR;
|
||||||
};
|
};
|
||||||
|
|
||||||
VOut VertexMain(VIn vertex)
|
VOut VertexMain(VIn vertex)
|
||||||
{
|
{
|
||||||
VOut output;
|
VOut output;
|
||||||
output.position = mul(matrix_, float4(vertex.position, 0.0, 1.0));
|
output.position = mul(matrix_, float4(vertex.position, 0.0, 1.0));
|
||||||
output.uv = vertex.uv;
|
output.uv = vertex.uv;
|
||||||
output.color = vertex.color;
|
output.color = vertex.color;
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 PixelMain(VOut vout) : SV_TARGET
|
float4 PixelMain(VOut vout) : SV_TARGET
|
||||||
{
|
{
|
||||||
return vout.color * tex.Sample(tex_, vout.uv);
|
return vout.color * tex.Sample(tex_, vout.uv);
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user