mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[image] Add support for float rgba for vulkan
This commit is contained in:
parent
82889a2c52
commit
2de1c02f61
4 changed files with 18 additions and 0 deletions
|
@ -38,6 +38,7 @@ typedef enum QFFormat {
|
|||
tex_la = 2,
|
||||
tex_rgb = 3,
|
||||
tex_rgba = 4,
|
||||
tex_frgba = 5,
|
||||
} QFFormat;
|
||||
|
||||
// could not use texture_t as that is used for models.
|
||||
|
|
|
@ -130,6 +130,15 @@ convert_tex (tex_t *tex)
|
|||
for (i = 0; i < pixels; i++)
|
||||
new->data[i] = convert_color (tex->data + i * bpp);
|
||||
break;
|
||||
case tex_frgba:
|
||||
for (i = 0; i < pixels; i++) {
|
||||
byte col[3];
|
||||
col[0] = ((float *)tex->data)[i * 4 + 0] * 255;
|
||||
col[1] = ((float *)tex->data)[i * 4 + 1] * 255;
|
||||
col[2] = ((float *)tex->data)[i * 4 + 2] * 255;
|
||||
new->data[i] = convert_color (col);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -100,6 +100,10 @@ QFV_CreateScrap (qfv_device_t *device, int size, QFFormat format)
|
|||
bpp = 4;
|
||||
fmt = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
break;
|
||||
case tex_frgba:
|
||||
bpp = 16;
|
||||
fmt = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
break;
|
||||
}
|
||||
|
||||
scrap_t *scrap = malloc (sizeof (scrap_t));
|
||||
|
|
|
@ -118,6 +118,10 @@ Vulkan_LoadTex (vulkan_ctx_t *ctx, tex_t *tex, int mip)
|
|||
format = VK_FORMAT_R8G8B8A8_UNORM;
|
||||
bpp = 4;
|
||||
break;
|
||||
case tex_frgba:
|
||||
format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
bpp = 16;
|
||||
break;
|
||||
}
|
||||
if (format == VK_FORMAT_UNDEFINED) {
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue