rename res/fx -> res/sh

This commit is contained in:
jacob 2025-06-08 20:22:24 -05:00
parent 012d0aaf07
commit 67335eaa85
6 changed files with 12 additions and 12 deletions

View File

@ -1,11 +1,11 @@
#include "fx/common.hlsl" #include "sh/common.hlsl"
struct fx_material_constant { struct sh_material_constant {
float4x4 projection; float4x4 projection;
uint instance_offset; uint instance_offset;
}; };
struct fx_material_instance { struct sh_material_instance {
float2x3 xf; float2x3 xf;
float2 uv0; float2 uv0;
float2 uv1; float2 uv1;
@ -24,10 +24,10 @@ struct fx_material_instance {
cbuffer cbuff : register(b0) cbuffer cbuff : register(b0)
{ {
struct fx_material_constant g_constant; struct sh_material_constant g_constant;
}; };
StructuredBuffer<struct fx_material_instance> g_instances : register(t0); StructuredBuffer<struct sh_material_instance> g_instances : register(t0);
Texture2D g_texture : register(t1); Texture2D g_texture : register(t1);
@ -58,9 +58,9 @@ struct vs_output {
}; };
[RootSignature(ROOTSIG)] [RootSignature(ROOTSIG)]
struct vs_output fx_material_vs(uint instance_id : SV_InstanceID, uint vertex_id : SV_VertexID) struct vs_output sh_material_vs(uint instance_id : SV_InstanceID, uint vertex_id : SV_VertexID)
{ {
struct fx_material_instance instance = g_instances[g_constant.instance_offset + instance_id]; struct sh_material_instance instance = g_instances[g_constant.instance_offset + instance_id];
float2 vert = g_quad_verts[vertex_id]; float2 vert = g_quad_verts[vertex_id];
float2 uv_factor = g_uv_factors[vertex_id]; float2 uv_factor = g_uv_factors[vertex_id];
float2 world_pos = mul(instance.xf, float3(vert, 1)).xy; float2 world_pos = mul(instance.xf, float3(vert, 1)).xy;
@ -78,7 +78,7 @@ struct vs_output fx_material_vs(uint instance_id : SV_InstanceID, uint vertex_id
* ========================== */ * ========================== */
[RootSignature(ROOTSIG)] [RootSignature(ROOTSIG)]
float4 fx_material_ps(struct vs_output input) : SV_TARGET float4 sh_material_ps(struct vs_output input) : SV_TARGET
{ {
float4 color = g_texture.Sample(g_sampler, input.uv) * input.tint_lin; float4 color = g_texture.Sample(g_sampler, input.uv) * input.tint_lin;
return color; return color;

View File

@ -27,7 +27,7 @@
#pragma comment(lib, "dxguid") #pragma comment(lib, "dxguid")
#pragma comment(lib, "d3dcompiler") #pragma comment(lib, "d3dcompiler")
#define FX_CPU 1 #define SH_CPU 1
#define DX12_WAIT_FRAME_LATENCY 1 #define DX12_WAIT_FRAME_LATENCY 1
#define DX12_ALLOW_TEARING 1 #define DX12_ALLOW_TEARING 1
@ -578,8 +578,8 @@ INTERNAL void dx12_init_pipelines(void)
/* Material pipeline */ /* Material pipeline */
{ {
.name = "material", .name = "material",
.vs = { "fx/material.hlsl", "fx_material_vs" }, .vs = { "sh/material.hlsl", "sh_material_vs" },
.ps = { "fx/material.hlsl", "fx_material_ps" } .ps = { "sh/material.hlsl", "sh_material_ps" }
} }
}; };
@ -741,7 +741,7 @@ INTERNAL WORK_TASK_FUNC_DEF(shader_compile_task, comp_arg_raw)
} break; } break;
} }
D3D_SHADER_MACRO defines[] = { D3D_SHADER_MACRO defines[] = {
{ "FX_CPU", "0" }, { "SH_CPU", "0" },
{ NULL, NULL } { NULL, NULL }
}; };
HRESULT hr = D3DCompile(shader_src.text, shader_src.len, friendly_name_cstr, defines, (ID3DInclude *)&include_handler, shader_desc.func, target, d3d_compile_flags, 0, &blob, &error_blob); HRESULT hr = D3DCompile(shader_src.text, shader_src.len, friendly_name_cstr, defines, (ID3DInclude *)&include_handler, shader_desc.func, target, d3d_compile_flags, 0, &blob, &error_blob);