Files
OpenRA3/shaders/dx_scene.hlsl
T
EnderTheCoder 3caf18409b v0.4.0: Direct3D 11/12 backends, in-game renderer selection, per-run logging
- ra3.dx: D3D11 and D3D12 presentation backends (runtime HLSL via d3dcompiler);
  2D image blit and the GPU heightfield terrain raymarch, with the corner
  minimap/FPS overlays. Non-Windows builds link a null fallback.
- ra3.display: preferred backend plus ordered fallback (Vulkan/D3D11/D3D12/SDL);
  menu gains a Renderer option and the CLI gains --dx11/--dx12/--sdl, which the
  render command now honours too.
- vendor libenderlog (MIT): every run writes openra3.log next to the exe and
  archives the previous run's log; records at warn and above carry a call stack
  (native fallback, since libc++ has no <stacktrace>).
- Windows crash reporter writes openra3_crash.log (faulting module + backtrace);
  D3D/DXGI diagnostics are routed through the logger.
2026-09-28 13:03:37 +08:00

35 lines
1.2 KiB
HLSL

// 2D image blit for the Direct3D backends (the D3D port of scene.vert/scene.frag).
//
// The scene image is drawn as a single fullscreen triangle sampling the
// software-rendered `ra3::render::image`. The constant buffer carries the
// destination rectangle in window-normalized coordinates (y down), so the map
// is letterboxed rather than stretched. D3D clip space has +Y up, so the vertex
// position flips Y relative to the Vulkan shader (which relies on Vulkan's
// +Y-down clip space); the sampled UVs and the image's top-left origin are
// unchanged.
cbuffer RectCB : register(b0) {
float4 rect; // xy = top-left (0..1), zw = size (0..1)
};
Texture2D scene_tex : register(t0);
SamplerState scene_smp : register(s0);
struct VSOut {
float4 pos : SV_Position;
float2 uv : TEXCOORD0;
};
VSOut VSMain(uint vertex_id : SV_VertexID) {
float2 p = float2((vertex_id << 1) & 2, vertex_id & 2);
VSOut o;
o.uv = (p - rect.xy) / rect.zw;
o.pos = float4(p.x * 2.0 - 1.0, 1.0 - p.y * 2.0, 0.0, 1.0);
return o;
}
float4 PSMain(VSOut input) : SV_Target {
if (input.uv.x < 0.0 || input.uv.x > 1.0 || input.uv.y < 0.0 || input.uv.y > 1.0) discard;
return scene_tex.Sample(scene_smp, input.uv);
}