distinguish pipeline warnings from errors
This commit is contained in:
parent
5db37a9486
commit
762a7d83fe
@ -25,26 +25,18 @@ struct cs_input {
|
|||||||
* Lighting
|
* Lighting
|
||||||
* ========================== */
|
* ========================== */
|
||||||
|
|
||||||
#define SAMPLES 2
|
#define SAMPLES 4
|
||||||
#define MARCHES 16
|
#define MARCHES 16
|
||||||
#define AMBIENT float4(0, 0, 0, 0)
|
#define AMBIENT float4(0, 0, 0, 0)
|
||||||
|
|
||||||
float rand_angle(uint2 pos, uint ray_index) {
|
float rand_angle(int2 pos, uint ray_index) {
|
||||||
Texture3D<uint> noise_tex = g_noise_textures[SH_BLUE_NOISE_TEX_ID];
|
Texture3D<uint> noise_tex = g_noise_textures[SH_BLUE_NOISE_TEX_ID];
|
||||||
|
|
||||||
// pos += uint2(g_constants.frame_seed.x % g_constants.tex_width, g_constants.frame_seed.x % g_constants.tex_height);
|
uint3 noise_coord = uint3(abs(pos.xy), ray_index);
|
||||||
|
noise_coord += g_constants.frame_seed;
|
||||||
|
// noise_coord.xy += g_constants.frame_seed.xy;
|
||||||
|
|
||||||
// pos -= g_constants.camera_offset;
|
uint noise = noise_tex[noise_coord % uint3(SH_BLUE_NOISE_TEX_WIDTH, SH_BLUE_NOISE_TEX_HEIGHT, SH_BLUE_NOISE_TEX_DEPTH)];
|
||||||
|
|
||||||
uint3 noise_coord = uint3(pos.xy, 0);
|
|
||||||
// noise_coord.xy *= g_constants.frame_seed.xy;
|
|
||||||
noise_coord.z += ray_index;
|
|
||||||
// noise_coord.z += ray_index * noise_coord.x ;
|
|
||||||
// noise_coord.z += g_constants.frame_seed.x;
|
|
||||||
// noise_coord.z += g_constants.frame_index;
|
|
||||||
|
|
||||||
uint3 noise_size = uint3(SH_BLUE_NOISE_TEX_WIDTH, SH_BLUE_NOISE_TEX_HEIGHT, SH_BLUE_NOISE_TEX_DEPTH);
|
|
||||||
uint noise = noise_tex[noise_coord % noise_size];
|
|
||||||
return ((float)noise / (float)0xFFFF) * TAU;
|
return ((float)noise / (float)0xFFFF) * TAU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,10 +64,11 @@ INLINE float4 get_light_in_dir(uint2 ray_start, float2 ray_dir)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE float4 get_light_at_pos(uint2 pos)
|
INLINE float4 get_light_at_pos(int2 pos)
|
||||||
{
|
{
|
||||||
float4 result = 0;
|
float4 result = 0;
|
||||||
for (uint i = 0; i < SAMPLES; ++i) {
|
for (uint i = 0; i < SAMPLES; ++i) {
|
||||||
|
|||||||
@ -793,7 +793,13 @@ INTERNAL void dx12_init_pipelines(void)
|
|||||||
}
|
}
|
||||||
for (u32 i = 0; i < num_pipelines; ++i) {
|
for (u32 i = 0; i < num_pipelines; ++i) {
|
||||||
struct pipeline *pipeline = pipelines[i];
|
struct pipeline *pipeline = pipelines[i];
|
||||||
if (!pipeline->success) {
|
if (pipeline->success) {
|
||||||
|
logf_success("Successfully compiled pipeline \"%F\" in %F seconds", FMT_STR(pipeline->name), FMT_FLOAT(SECONDS_FROM_NS(pipeline->compilation_time_ns)));
|
||||||
|
if (pipeline->first_error) {
|
||||||
|
struct string msg = string_format(scratch.arena, LIT("Warning while compiling pipeline \"%F\":\n%F"), FMT_STR(pipeline->name), FMT_STR(pipeline->first_error->msg));
|
||||||
|
log_warning(msg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
struct string error = pipeline->first_error ? pipeline->first_error->msg : LIT("Unknown error");
|
struct string error = pipeline->first_error ? pipeline->first_error->msg : LIT("Unknown error");
|
||||||
struct string msg = string_format(scratch.arena, LIT("Error initializing pipeline \"%F\":\n\n%F"), FMT_STR(pipeline->name), FMT_STR(error));
|
struct string msg = string_format(scratch.arena, LIT("Error initializing pipeline \"%F\":\n\n%F"), FMT_STR(pipeline->name), FMT_STR(error));
|
||||||
log_error(msg);
|
log_error(msg);
|
||||||
@ -1034,7 +1040,7 @@ INTERNAL SYS_JOB_DEF(shader_compile_job, job)
|
|||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
HRESULT hr = D3DCompile(shader_src.text, shader_src.len, friendly_name_cstr, defines, (ID3DInclude *)include_handler, func_cstr, target, d3d_compile_flags, 0, &blob, &error_blob);
|
HRESULT hr = D3DCompile(shader_src.text, shader_src.len, friendly_name_cstr, defines, (ID3DInclude *)include_handler, func_cstr, target, d3d_compile_flags, 0, &blob, &error_blob);
|
||||||
success = SUCCEEDED(hr) && !error_blob;
|
success = SUCCEEDED(hr);
|
||||||
}
|
}
|
||||||
|
|
||||||
dx12_include_handler_release(include_handler);
|
dx12_include_handler_release(include_handler);
|
||||||
@ -1054,6 +1060,50 @@ INTERNAL SYS_JOB_DEF(shader_compile_job, job)
|
|||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========================== *
|
||||||
|
* Shader error parser
|
||||||
|
* ========================== */
|
||||||
|
|
||||||
|
INTERNAL void parse_pipeline_errors(struct pipeline *pipeline, ID3D10Blob *error_blob)
|
||||||
|
{
|
||||||
|
struct string ignored[] = {
|
||||||
|
LIT("warning X3557") /* Disabled forced loop unrolling warning */
|
||||||
|
};
|
||||||
|
|
||||||
|
if (error_blob) {
|
||||||
|
struct arena_temp scratch = scratch_begin_no_conflict();
|
||||||
|
{
|
||||||
|
u64 error_blob_cstr_len = ID3D10Blob_GetBufferSize(error_blob);
|
||||||
|
char *error_blob_cstr = (char *)ID3D10Blob_GetBufferPointer(error_blob);
|
||||||
|
struct string error_str = string_copy(scratch.arena, string_from_cstr(error_blob_cstr, error_blob_cstr_len));
|
||||||
|
if (string_ends_with(error_str, LIT("\n"))) {
|
||||||
|
/* Remove trailing newline */
|
||||||
|
error_str.len -= 1;
|
||||||
|
}
|
||||||
|
if (error_str.len > 0) {
|
||||||
|
b32 is_ignored = 0;
|
||||||
|
for (u32 i = 0; i < countof(ignored); ++i) {
|
||||||
|
if (string_contains(error_str, ignored[i])) {
|
||||||
|
is_ignored = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!is_ignored) {
|
||||||
|
struct pipeline_error *error = arena_push(pipeline->arena, struct pipeline_error);
|
||||||
|
error->msg = string_copy(pipeline->arena, error_str);
|
||||||
|
if (pipeline->last_error) {
|
||||||
|
pipeline->last_error->next = error;
|
||||||
|
} else {
|
||||||
|
pipeline->first_error = error;
|
||||||
|
}
|
||||||
|
pipeline->last_error = error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scratch_end(scratch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ========================== *
|
/* ========================== *
|
||||||
* Pipeline
|
* Pipeline
|
||||||
* ========================== */
|
* ========================== */
|
||||||
@ -1085,7 +1135,7 @@ INTERNAL SYS_JOB_DEF(pipeline_alloc_job, job)
|
|||||||
b32 success = 1;
|
b32 success = 1;
|
||||||
HRESULT hr = 0;
|
HRESULT hr = 0;
|
||||||
|
|
||||||
struct string error_str = LIT("Unknown error");
|
struct string error_str = ZI;
|
||||||
|
|
||||||
b32 has_cs = desc->cs.file.len > 0;
|
b32 has_cs = desc->cs.file.len > 0;
|
||||||
b32 ps_res_is_shared = string_eq(desc->vs.file, desc->ps.file);
|
b32 ps_res_is_shared = string_eq(desc->vs.file, desc->ps.file);
|
||||||
@ -1347,27 +1397,20 @@ INTERNAL SYS_JOB_DEF(pipeline_alloc_job, job)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy error */
|
/* Parse errors */
|
||||||
if (!success) {
|
parse_pipeline_errors(pipeline, cs.error_blob);
|
||||||
ID3D10Blob *error_blob = cs.error_blob ? cs.error_blob : (vs.error_blob ? vs.error_blob : ps.error_blob);
|
parse_pipeline_errors(pipeline, vs.error_blob);
|
||||||
if (error_blob) {
|
parse_pipeline_errors(pipeline, ps.error_blob);
|
||||||
u64 error_blob_cstr_len = ID3D10Blob_GetBufferSize(error_blob);
|
if (!success && pipeline->first_error == 0 && error_str.len == 0) {
|
||||||
char *error_blob_cstr = (char *)ID3D10Blob_GetBufferPointer(error_blob);
|
error_str = LIT("Unknown error");
|
||||||
struct string error_blob_str = string_copy(scratch.arena, string_from_cstr(error_blob_cstr, error_blob_cstr_len));
|
}
|
||||||
if (string_ends_with(error_blob_str, LIT("\n"))) {
|
if (error_str.len > 0) {
|
||||||
/* Remove trailing newline */
|
|
||||||
error_blob_str.len -= 1;
|
|
||||||
}
|
|
||||||
if (error_blob_str.len > 0) {
|
|
||||||
error_str = error_blob_str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
struct pipeline_error *error = arena_push(pipeline->arena, struct pipeline_error);
|
struct pipeline_error *error = arena_push(pipeline->arena, struct pipeline_error);
|
||||||
error->msg = string_copy(pipeline->arena, error_str);
|
error->msg = string_copy(pipeline->arena, error_str);
|
||||||
if (pipeline->last_error) {
|
if (pipeline->last_error) {
|
||||||
pipeline->last_error->next = error;
|
pipeline->last_error->next = error;
|
||||||
} else {
|
} else {
|
||||||
pipeline->first_error = error;
|
pipeline->first_error = error;
|
||||||
}
|
}
|
||||||
pipeline->last_error = error;
|
pipeline->last_error = error;
|
||||||
}
|
}
|
||||||
@ -1559,6 +1602,10 @@ INTERNAL RESOURCE_WATCH_CALLBACK_FUNC_DEF(pipeline_resource_watch_callback, name
|
|||||||
struct pipeline *pipeline = pipelines[i];
|
struct pipeline *pipeline = pipelines[i];
|
||||||
if (pipeline->success) {
|
if (pipeline->success) {
|
||||||
logf_success("Successfully compiled pipeline \"%F\" in %F seconds", FMT_STR(pipeline->name), FMT_FLOAT(SECONDS_FROM_NS(pipeline->compilation_time_ns)));
|
logf_success("Successfully compiled pipeline \"%F\" in %F seconds", FMT_STR(pipeline->name), FMT_FLOAT(SECONDS_FROM_NS(pipeline->compilation_time_ns)));
|
||||||
|
if (pipeline->first_error) {
|
||||||
|
struct string msg = string_format(scratch.arena, LIT("Warning while compiling pipeline \"%F\":\n%F"), FMT_STR(pipeline->name), FMT_STR(pipeline->first_error->msg));
|
||||||
|
log_warning(msg);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
{
|
{
|
||||||
struct string error = pipeline->first_error ? pipeline->first_error->msg : LIT("Unknown error");
|
struct string error = pipeline->first_error ? pipeline->first_error->msg : LIT("Unknown error");
|
||||||
|
|||||||
@ -255,7 +255,7 @@ INTERNAL void test_spawn_entities2(struct sim_ent *parent, struct v2 pos)
|
|||||||
struct sim_ent *e = sim_ent_alloc_sync_src(parent);
|
struct sim_ent *e = sim_ent_alloc_sync_src(parent);
|
||||||
|
|
||||||
f32 rot = 0;
|
f32 rot = 0;
|
||||||
struct v2 size = V2(1, 1);
|
struct v2 size = V2(0.1, 0.1);
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = rot, .s = size);
|
struct xform xf = XFORM_TRS(.t = pos, .r = rot, .s = size);
|
||||||
sim_ent_set_xform(e, xf);
|
sim_ent_set_xform(e, xf);
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ INTERNAL void test_spawn_entities2(struct sim_ent *parent, struct v2 pos)
|
|||||||
e->layer = SIM_LAYER_SHOULDERS;
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
//e->sprite_tint = ALPHA32_F(COLOR_BLUE, 0.75);
|
//e->sprite_tint = ALPHA32_F(COLOR_BLUE, 0.75);
|
||||||
e->sprite_tint = ALPHA32_F(COLOR_WHITE, 1);
|
//e->sprite_tint = ALPHA32_F(COLOR_WHITE, 1);
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SEPROP_SOLID);
|
sim_ent_enable_prop(e, SEPROP_SOLID);
|
||||||
struct quad collider_quad = quad_from_rect(RECT(-0.5, -0.5, 1, 1));
|
struct quad collider_quad = quad_from_rect(RECT(-0.5, -0.5, 1, 1));
|
||||||
@ -278,6 +278,7 @@ INTERNAL void test_spawn_entities2(struct sim_ent *parent, struct v2 pos)
|
|||||||
f32 g = rand_f64_from_state(&rand, 1, 5);
|
f32 g = rand_f64_from_state(&rand, 1, 5);
|
||||||
f32 b = rand_f64_from_state(&rand, 1, 5);
|
f32 b = rand_f64_from_state(&rand, 1, 5);
|
||||||
e->sprite_emittance = V3(r, g, b);
|
e->sprite_emittance = V3(r, g, b);
|
||||||
|
e->sprite_tint = RGBA32_F(r / 5, g / 5, b / 5, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SEPROP_DYNAMIC);
|
sim_ent_enable_prop(e, SEPROP_DYNAMIC);
|
||||||
@ -351,12 +352,14 @@ INTERNAL void test_spawn_entities4(struct sim_ent *parent, struct v2 pos)
|
|||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
sim_ent_set_xform(e, xf);
|
sim_ent_set_xform(e, xf);
|
||||||
|
|
||||||
e->sprite = sprite_tag_from_path(LIT("sprite/box.ase"));
|
//e->sprite = sprite_tag_from_path(LIT("sprite/box.ase"));
|
||||||
|
e->sprite = sprite_tag_from_path(LIT("sprite/tile.ase"));
|
||||||
e->layer = SIM_LAYER_SHOULDERS;
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SEPROP_LIGHT_TEST);
|
sim_ent_enable_prop(e, SEPROP_LIGHT_TEST);
|
||||||
|
e->sprite_emittance = V3(2, 2, 2);
|
||||||
|
|
||||||
e->sprite_tint = RGB32_F(1, 0, 1);
|
e->sprite_tint = RGB32_F(1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL void test_spawn_tile(struct sim_snapshot *world, struct v2 world_pos)
|
INTERNAL void test_spawn_tile(struct sim_snapshot *world, struct v2 world_pos)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user