nir/spirv: add some error checking to open()
CovID: 1373369 Signed-off-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
913e0296f2
commit
23519a9de2
|
@ -37,10 +37,17 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int fd = open(argv[1], O_RDONLY);
|
int fd = open(argv[1], O_RDONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to open %s\n", argv[1]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
off_t len = lseek(fd, 0, SEEK_END);
|
off_t len = lseek(fd, 0, SEEK_END);
|
||||||
|
|
||||||
assert(len % 4 == 0);
|
assert(len % 4 == 0);
|
||||||
|
@ -52,4 +59,6 @@ int main(int argc, char **argv)
|
||||||
nir_function *func = spirv_to_nir(map, word_count, NULL, 0,
|
nir_function *func = spirv_to_nir(map, word_count, NULL, 0,
|
||||||
MESA_SHADER_FRAGMENT, "main", NULL);
|
MESA_SHADER_FRAGMENT, "main", NULL);
|
||||||
nir_print_shader(func->shader, stderr);
|
nir_print_shader(func->shader, stderr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue