diff options
author | 3gg <3gg@shellblade.net> | 2023-02-04 11:16:37 -0800 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2023-02-04 11:16:37 -0800 |
commit | f319f0bb59f5e05bd06dcd160699f2b0f2f14e8a (patch) | |
tree | 9f04e0aa4dfa9144c90ff2a87fd85d954ec13002 | |
parent | e9013f5cc95eb4cf0cb621e130a9024382b5b041 (diff) |
Rename cstring -> cstr.
-rw-r--r-- | gfx/src/error.c | 2 | ||||
-rw-r--r-- | gfx/src/render/shader.c | 6 | ||||
-rw-r--r-- | gfx/src/util/texture.c | 18 |
3 files changed, 13 insertions, 13 deletions
diff --git a/gfx/src/error.c b/gfx/src/error.c index 3f11747..4370097 100644 --- a/gfx/src/error.c +++ b/gfx/src/error.c | |||
@@ -2,4 +2,4 @@ | |||
2 | 2 | ||
3 | xlstring gfx_error; | 3 | xlstring gfx_error; |
4 | 4 | ||
5 | const char* gfx_get_error(void) { return xlstring_cstring(&gfx_error); } | 5 | const char* gfx_get_error(void) { return xlstring_cstr(&gfx_error); } |
diff --git a/gfx/src/render/shader.c b/gfx/src/render/shader.c index c8e02fd..d4778a2 100644 --- a/gfx/src/render/shader.c +++ b/gfx/src/render/shader.c | |||
@@ -26,9 +26,9 @@ static lstring make_defines_string(const ShaderDesc* desc) { | |||
26 | for (size_t i = 0; i < desc->num_defines; ++i) { | 26 | for (size_t i = 0; i < desc->num_defines; ++i) { |
27 | const ShaderCompilerDefine* define = &desc->defines[i]; | 27 | const ShaderCompilerDefine* define = &desc->defines[i]; |
28 | lstring_append_cstr(&defines, "#define "); | 28 | lstring_append_cstr(&defines, "#define "); |
29 | lstring_append_cstr(&defines, sstring_cstring(&define->name)); | 29 | lstring_append_cstr(&defines, sstring_cstr(&define->name)); |
30 | lstring_append_cstr(&defines, " "); | 30 | lstring_append_cstr(&defines, " "); |
31 | lstring_append_cstr(&defines, sstring_cstring(&define->value)); | 31 | lstring_append_cstr(&defines, sstring_cstr(&define->value)); |
32 | lstring_append_cstr(&defines, "\n"); | 32 | lstring_append_cstr(&defines, "\n"); |
33 | } | 33 | } |
34 | return defines; | 34 | return defines; |
@@ -50,7 +50,7 @@ static GLuint create_shader(const ShaderDesc* desc) { | |||
50 | 50 | ||
51 | lstring defines = make_defines_string(desc); | 51 | lstring defines = make_defines_string(desc); |
52 | 52 | ||
53 | const char* source_bits[] = {header, lstring_cstring(&defines), desc->code}; | 53 | const char* source_bits[] = {header, lstring_cstr(&defines), desc->code}; |
54 | const GLint source_lengths[] = { | 54 | const GLint source_lengths[] = { |
55 | strlen(header), lstring_length(defines), strlen(desc->code)}; | 55 | strlen(header), lstring_length(defines), strlen(desc->code)}; |
56 | 56 | ||
diff --git a/gfx/src/util/texture.c b/gfx/src/util/texture.c index dae5bd2..99241f4 100644 --- a/gfx/src/util/texture.c +++ b/gfx/src/util/texture.c | |||
@@ -6,21 +6,21 @@ | |||
6 | #define STB_IMAGE_IMPLEMENTATION | 6 | #define STB_IMAGE_IMPLEMENTATION |
7 | #include <stb_image.h> | 7 | #include <stb_image.h> |
8 | 8 | ||
9 | Texture* gfx_load_texture(RenderBackend* render_backend, | 9 | Texture* gfx_load_texture( |
10 | const LoadTextureCmd* cmd) { | 10 | RenderBackend* render_backend, const LoadTextureCmd* cmd) { |
11 | assert(render_backend); | 11 | assert(render_backend); |
12 | assert(cmd); | 12 | assert(cmd); |
13 | assert(cmd->origin == TextureFromFile || cmd->origin == TextureFromMemory); | 13 | assert(cmd->origin == TextureFromFile || cmd->origin == TextureFromMemory); |
14 | assert(cmd->type == LoadTexture || cmd->type == LoadCubemap); | 14 | assert(cmd->type == LoadTexture || cmd->type == LoadCubemap); |
15 | 15 | ||
16 | int width, height, components, old_components; | 16 | int width, height, components, old_components; |
17 | unsigned char* pixels[6] = {0}; | 17 | unsigned char* pixels[6] = {0}; |
18 | 18 | ||
19 | switch (cmd->origin) { | 19 | switch (cmd->origin) { |
20 | case TextureFromFile: | 20 | case TextureFromFile: |
21 | switch (cmd->type) { | 21 | switch (cmd->type) { |
22 | case LoadTexture: { | 22 | case LoadTexture: { |
23 | const char* filepath = mstring_cstring(&cmd->data.texture.filepath); | 23 | const char* filepath = mstring_cstr(&cmd->data.texture.filepath); |
24 | pixels[0] = stbi_load(filepath, &width, &height, &components, 0); | 24 | pixels[0] = stbi_load(filepath, &width, &height, &components, 0); |
25 | if (!pixels[0]) { | 25 | if (!pixels[0]) { |
26 | gfx_set_error("Failed to load texture file: %s", filepath); | 26 | gfx_set_error("Failed to load texture file: %s", filepath); |
@@ -30,7 +30,7 @@ Texture* gfx_load_texture(RenderBackend* render_backend, | |||
30 | case LoadCubemap: | 30 | case LoadCubemap: |
31 | for (int i = 0; i < 6; ++i) { | 31 | for (int i = 0; i < 6; ++i) { |
32 | const char* filepath = | 32 | const char* filepath = |
33 | mstring_cstring(&cmd->data.cubemap.filepaths.filepath_pos_x + i); | 33 | mstring_cstr(&cmd->data.cubemap.filepaths.filepath_pos_x + i); |
34 | stbi_uc* image_pixels = | 34 | stbi_uc* image_pixels = |
35 | stbi_load(filepath, &width, &height, &components, 0); | 35 | stbi_load(filepath, &width, &height, &components, 0); |
36 | if (!image_pixels) { | 36 | if (!image_pixels) { |
@@ -43,7 +43,7 @@ Texture* gfx_load_texture(RenderBackend* render_backend, | |||
43 | "components"); | 43 | "components"); |
44 | break; | 44 | break; |
45 | } | 45 | } |
46 | pixels[i] = image_pixels; | 46 | pixels[i] = image_pixels; |
47 | old_components = components; | 47 | old_components = components; |
48 | } | 48 | } |
49 | break; | 49 | break; |
@@ -68,8 +68,8 @@ Texture* gfx_load_texture(RenderBackend* render_backend, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | TextureDesc desc = (TextureDesc){0}; | 70 | TextureDesc desc = (TextureDesc){0}; |
71 | desc.width = width; | 71 | desc.width = width; |
72 | desc.height = height; | 72 | desc.height = height; |
73 | 73 | ||
74 | switch (cmd->type) { | 74 | switch (cmd->type) { |
75 | case LoadTexture: | 75 | case LoadTexture: |
@@ -113,7 +113,7 @@ Texture* gfx_load_texture(RenderBackend* render_backend, | |||
113 | } | 113 | } |
114 | 114 | ||
115 | desc.filtering = cmd->filtering; | 115 | desc.filtering = cmd->filtering; |
116 | desc.mipmaps = cmd->mipmaps; | 116 | desc.mipmaps = cmd->mipmaps; |
117 | 117 | ||
118 | switch (cmd->type) { | 118 | switch (cmd->type) { |
119 | case LoadTexture: | 119 | case LoadTexture: |