demos: Get rid of handwritten GLSL shaders.

This commit is contained in:
Józef Kucia
2017-07-28 15:26:09 +02:00
parent fec337a03c
commit aa5d48eec4
16 changed files with 606 additions and 204 deletions

View File

@@ -554,40 +554,3 @@ static inline HRESULT demo_create_root_signature(ID3D12Device *device,
return ID3D12Device_CreateRootSignature(device, 0, desc, ~(SIZE_T)0,
&IID_ID3D12RootSignature, (void **)signature);
}
static inline bool demo_load_shader(struct demo *demo, const wchar_t *hlsl_name, const char *entry_point,
const char *profile, const char *spv_name, D3D12_SHADER_BYTECODE *shader)
{
size_t data_size;
struct stat st;
ssize_t res;
void *data;
int fd;
if ((fd = open(spv_name, O_RDONLY)) == -1)
return false;
if (fstat(fd, &st) == -1)
goto fail;
data_size = st.st_size;
if (!(data = malloc(data_size)))
goto fail;
res = read(fd, data, data_size);
close(fd);
if (res != data_size)
{
free(data);
return false;
}
shader->pShaderBytecode = data;
shader->BytecodeLength = data_size;
return true;
fail:
close(fd);
return false;
}