Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_texture_private.hh
| Show First 20 Lines • Show All 425 Lines • ▼ Show 20 Lines | |||||
| /* Definitely not complete, edit according to the gl specification. */ | /* Definitely not complete, edit according to the gl specification. */ | ||||
| inline bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format) | inline bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format) | ||||
| { | { | ||||
| switch (tex_format) { | switch (tex_format) { | ||||
| case GPU_DEPTH_COMPONENT24: | case GPU_DEPTH_COMPONENT24: | ||||
| case GPU_DEPTH_COMPONENT16: | case GPU_DEPTH_COMPONENT16: | ||||
| case GPU_DEPTH_COMPONENT32F: | case GPU_DEPTH_COMPONENT32F: | ||||
| return data_format == GPU_DATA_FLOAT; | return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UINT); | ||||
jbakker: Use `ELEM` macro for better readability. | |||||
| case GPU_DEPTH24_STENCIL8: | case GPU_DEPTH24_STENCIL8: | ||||
| case GPU_DEPTH32F_STENCIL8: | case GPU_DEPTH32F_STENCIL8: | ||||
| return data_format == GPU_DATA_UINT_24_8; | return ELEM(data_format, GPU_DATA_UINT_24_8, GPU_DATA_UINT); | ||||
Not Done Inline ActionsUse ELEM macro for better readability. jbakker: Use `ELEM` macro for better readability. | |||||
| case GPU_R8UI: | case GPU_R8UI: | ||||
| case GPU_R16UI: | case GPU_R16UI: | ||||
| case GPU_RG16UI: | case GPU_RG16UI: | ||||
| case GPU_R32UI: | case GPU_R32UI: | ||||
| return data_format == GPU_DATA_UINT; | return data_format == GPU_DATA_UINT; | ||||
| case GPU_R32I: | |||||
| case GPU_RG16I: | case GPU_RG16I: | ||||
| case GPU_R16I: | case GPU_R16I: | ||||
| return data_format == GPU_DATA_INT; | return data_format == GPU_DATA_INT; | ||||
| case GPU_R8: | case GPU_R8: | ||||
| case GPU_RG8: | case GPU_RG8: | ||||
| case GPU_RGBA8: | case GPU_RGBA8: | ||||
| case GPU_RGBA8UI: | case GPU_RGBA8UI: | ||||
| case GPU_SRGB8_A8: | case GPU_SRGB8_A8: | ||||
| return ELEM(data_format, GPU_DATA_UBYTE, GPU_DATA_FLOAT); | return ELEM(data_format, GPU_DATA_UBYTE, GPU_DATA_FLOAT); | ||||
| case GPU_RGB10_A2: | case GPU_RGB10_A2: | ||||
| return ELEM(data_format, GPU_DATA_2_10_10_10_REV, GPU_DATA_FLOAT); | return ELEM(data_format, GPU_DATA_2_10_10_10_REV, GPU_DATA_FLOAT); | ||||
| case GPU_R11F_G11F_B10F: | case GPU_R11F_G11F_B10F: | ||||
| return ELEM(data_format, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT); | return ELEM(data_format, GPU_DATA_10_11_11_REV, GPU_DATA_FLOAT); | ||||
| case GPU_RGBA16F: | |||||
| return ELEM(data_format, GPU_DATA_HALF_FLOAT, GPU_DATA_FLOAT); | |||||
| default: | default: | ||||
| return data_format == GPU_DATA_FLOAT; | return data_format == GPU_DATA_FLOAT; | ||||
| } | } | ||||
| } | } | ||||
| /* Ensure valid upload formats. With format conversion support, certain types can be extended to | /* Ensure valid upload formats. With format conversion support, certain types can be extended to | ||||
| * allow upload from differing source formats. If these cases are added, amend accordingly. */ | * allow upload from differing source formats. If these cases are added, amend accordingly. */ | ||||
| inline bool validate_data_format_mtl(eGPUTextureFormat tex_format, eGPUDataFormat data_format) | inline bool validate_data_format_mtl(eGPUTextureFormat tex_format, eGPUDataFormat data_format) | ||||
| ▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines | |||||
Use ELEM macro for better readability.