diff --git a/intern/cycles/blender/display_driver.cpp b/intern/cycles/blender/display_driver.cpp index 817f192ae78..e78f8c3df33 100644 --- a/intern/cycles/blender/display_driver.cpp +++ b/intern/cycles/blender/display_driver.cpp @@ -228,7 +228,7 @@ class DisplayGPUTexture { max(width, 1), max(height, 1), 1, - GPU_RGBA16F, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_GENERAL, nullptr); diff --git a/source/blender/blenfont/intern/blf_glyph.cc b/source/blender/blenfont/intern/blf_glyph.cc index a7eb3cacc47..53f1326a1da 100644 --- a/source/blender/blenfont/intern/blf_glyph.cc +++ b/source/blender/blenfont/intern/blf_glyph.cc @@ -1522,8 +1522,13 @@ void blf_glyph_draw(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, const int x, if (gc->texture) { GPU_texture_free(gc->texture); } - gc->texture = GPU_texture_create_2d( - __func__, w, h, 1, GPU_R8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + gc->texture = GPU_texture_create_2d(__func__, + w, + h, + 1, + blender::gpu::TextureFormat::UNORM_8, + GPU_TEXTURE_USAGE_SHADER_READ, + nullptr); gc->bitmap_len_landed = 0; } diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc index 62047bf967e..019e07c7536 100644 --- a/source/blender/blenkernel/intern/image_gpu.cc +++ b/source/blender/blenkernel/intern/image_gpu.cc @@ -111,7 +111,13 @@ static blender::gpu::Texture *gpu_texture_create_tile_mapping(Image *ima, const } blender::gpu::Texture *tex = GPU_texture_create_1d_array( - ima->id.name + 2, width, 2, 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_SHADER_READ, data); + ima->id.name + 2, + width, + 2, + 1, + blender::gpu::TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_SHADER_READ, + data); GPU_texture_mipmap_mode(tex, false, false); MEM_freeN(data); diff --git a/source/blender/blenkernel/intern/studiolight.cc b/source/blender/blenkernel/intern/studiolight.cc index 09debe836e9..65f476ad8f4 100644 --- a/source/blender/blenkernel/intern/studiolight.cc +++ b/source/blender/blenkernel/intern/studiolight.cc @@ -435,13 +435,14 @@ static void studiolight_create_equirect_radiance_gputexture(StudioLight *sl) BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EXTERNAL_IMAGE_LOADED); ImBuf *ibuf = sl->equirect_radiance_buffer; - sl->equirect_radiance_gputexture = GPU_texture_create_2d("studiolight_radiance", - ibuf->x, - ibuf->y, - 1, - GPU_RGBA16F, - GPU_TEXTURE_USAGE_SHADER_READ, - ibuf->float_buffer.data); + sl->equirect_radiance_gputexture = GPU_texture_create_2d( + "studiolight_radiance", + ibuf->x, + ibuf->y, + 1, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_SHADER_READ, + ibuf->float_buffer.data); blender::gpu::Texture *tex = sl->equirect_radiance_gputexture; GPU_texture_filter_mode(tex, true); GPU_texture_extend_mode(tex, GPU_SAMPLER_EXTEND_MODE_REPEAT); @@ -462,8 +463,13 @@ static void studiolight_create_matcap_gputexture(StudioLightImage *sli) copy_v3_v3(*offset3, *offset4); } - sli->gputexture = GPU_texture_create_2d( - "matcap", ibuf->x, ibuf->y, 1, GPU_R11F_G11F_B10F, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + sli->gputexture = GPU_texture_create_2d("matcap", + ibuf->x, + ibuf->y, + 1, + blender::gpu::TextureFormat::UFLOAT_11_11_10, + GPU_TEXTURE_USAGE_SHADER_READ, + nullptr); GPU_texture_update(sli->gputexture, GPU_DATA_FLOAT, gpu_matcap_3components); MEM_SAFE_FREE(gpu_matcap_3components); diff --git a/source/blender/blenlib/BLI_smaa_textures.h b/source/blender/blenlib/BLI_smaa_textures.h index 1c05e90fe24..94ed88513bb 100644 --- a/source/blender/blenlib/BLI_smaa_textures.h +++ b/source/blender/blenlib/BLI_smaa_textures.h @@ -20,7 +20,7 @@ /** * Stored in R8G8 format. Load it in the following format: * - DX10: DXGI_FORMAT_R8G8_UNORM - * - GPU: GPU_RG8 texture format and GPU_DATA_UBYTE data format. + * - GPU: blender::gpu::TextureFormat::UNORM_8_8 texture format and GPU_DATA_UBYTE data format. */ extern const unsigned char areaTexBytes[]; @@ -32,6 +32,6 @@ extern const unsigned char areaTexBytes[]; /** * Stored in R8 format. Load it in the following format: * - DX10: DXGI_FORMAT_R8_UNORM - * - GPU: GPU_R8 texture format and GPU_DATA_UBYTE data format. + * - GPU: blender::gpu::TextureFormat::UNORM_8 texture format and GPU_DATA_UBYTE data format. */ extern const unsigned char searchTexBytes[]; diff --git a/source/blender/compositor/COM_result.hh b/source/blender/compositor/COM_result.hh index 197729386a8..7d6f23e50ae 100644 --- a/source/blender/compositor/COM_result.hh +++ b/source/blender/compositor/COM_result.hh @@ -160,7 +160,7 @@ class Result { /* Construct a result of an appropriate type and precision based on the given GPU texture format * within the given context. */ - Result(Context &context, eGPUTextureFormat format); + Result(Context &context, blender::gpu::TextureFormat format); /* Returns true if the given type can only be used with single value results. Consequently, it is * always allocated on the CPU and GPU code paths needn't support the type. */ @@ -170,20 +170,22 @@ class Result { * special case is given to ResultType::Float3, because 3-component textures can't be used as * write targets in shaders, so we need to allocate 4-component textures for them, and ignore the * fourth channel during processing. */ - static eGPUTextureFormat gpu_texture_format(ResultType type, ResultPrecision precision); + static blender::gpu::TextureFormat gpu_texture_format(ResultType type, + ResultPrecision precision); /* Returns the GPU data format that corresponds to the give result type. */ static eGPUDataFormat gpu_data_format(const ResultType type); /* Returns the GPU texture format that corresponds to the give one, but whose precision is the * given precision. */ - static eGPUTextureFormat gpu_texture_format(eGPUTextureFormat format, ResultPrecision precision); + static blender::gpu::TextureFormat gpu_texture_format(blender::gpu::TextureFormat format, + ResultPrecision precision); /* Returns the precision of the given GPU texture format. */ - static ResultPrecision precision(eGPUTextureFormat format); + static ResultPrecision precision(blender::gpu::TextureFormat format); /* Returns the type of the given GPU texture format. */ - static ResultType type(eGPUTextureFormat format); + static ResultType type(blender::gpu::TextureFormat format); /* Returns the float type of the result given the channels count. */ static ResultType float_type(const int channels_count); @@ -205,7 +207,7 @@ class Result { * texture, with one exception. Results of type ResultType::Float3 that wrap external textures * might hold a 3-component texture as opposed to a 4-component one, which would have been * created by uploading data from CPU. */ - eGPUTextureFormat get_gpu_texture_format() const; + blender::gpu::TextureFormat get_gpu_texture_format() const; /* Identical to gpu_data_format but assumes the result's type. */ eGPUDataFormat get_gpu_data_format() const; diff --git a/source/blender/compositor/algorithms/intern/parallel_reduction.cc b/source/blender/compositor/algorithms/intern/parallel_reduction.cc index d09c2babe84..7f3437e50f9 100644 --- a/source/blender/compositor/algorithms/intern/parallel_reduction.cc +++ b/source/blender/compositor/algorithms/intern/parallel_reduction.cc @@ -37,7 +37,7 @@ namespace blender::compositor { * definitions. */ static float *parallel_reduction_dispatch(blender::gpu::Texture *texture, GPUShader *shader, - eGPUTextureFormat format) + blender::gpu::TextureFormat format) { GPU_shader_uniform_1b(shader, "is_initial_reduction", true); diff --git a/source/blender/compositor/cached_resources/intern/ocio_color_space_conversion_shader.cc b/source/blender/compositor/cached_resources/intern/ocio_color_space_conversion_shader.cc index 85fabff7a3c..4f9eb9f8baa 100644 --- a/source/blender/compositor/cached_resources/intern/ocio_color_space_conversion_shader.cc +++ b/source/blender/compositor/cached_resources/intern/ocio_color_space_conversion_shader.cc @@ -231,8 +231,11 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator { const std::string &resource_name = *resource_names_[resource_names_.size() - 1]; blender::gpu::Texture *texture; - const eGPUTextureFormat base_format = (channel == TEXTURE_RGB_CHANNEL) ? GPU_RGB32F : GPU_R32F; - const eGPUTextureFormat texture_format = Result::gpu_texture_format(base_format, precision_); + const blender::gpu::TextureFormat base_format = + (channel == TEXTURE_RGB_CHANNEL) ? blender::gpu::TextureFormat::SFLOAT_32_32_32 : + blender::gpu::TextureFormat::SFLOAT_32; + const blender::gpu::TextureFormat texture_format = Result::gpu_texture_format(base_format, + precision_); /* A height of 1 indicates a 1D texture according to the OCIO API. */ # if OCIO_VERSION_HEX >= 0x02030000 if (dimensions == OCIO::GpuShaderDesc::TEXTURE_1D) @@ -276,7 +279,7 @@ class GPUShaderCreator : public OCIO::GpuShaderCreator { size, size, 1, - Result::gpu_texture_format(GPU_RGB32F, precision_), + Result::gpu_texture_format(blender::gpu::TextureFormat::SFLOAT_32_32_32, precision_), GPU_TEXTURE_USAGE_SHADER_READ, values); GPU_texture_filter_mode(texture, interpolation != OCIO::INTERP_NEAREST); diff --git a/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc b/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc index 0b3703cb58c..05ae08d888b 100644 --- a/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc +++ b/source/blender/compositor/cached_resources/intern/smaa_precomputed_textures.cc @@ -69,7 +69,7 @@ void SMAAPrecomputedTextures::compute_gpu() SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT, 1, - GPU_R8, + blender::gpu::TextureFormat::UNORM_8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); GPU_texture_update(search_texture_, GPU_DATA_UBYTE, searchTexBytes); @@ -79,7 +79,7 @@ void SMAAPrecomputedTextures::compute_gpu() AREATEX_WIDTH, AREATEX_HEIGHT, 1, - GPU_RG8, + blender::gpu::TextureFormat::UNORM_8_8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); GPU_texture_update(area_texture_, GPU_DATA_UBYTE, areaTexBytes); diff --git a/source/blender/compositor/intern/result.cc b/source/blender/compositor/intern/result.cc index 2d8b445ab43..2bad4ecde1a 100644 --- a/source/blender/compositor/intern/result.cc +++ b/source/blender/compositor/intern/result.cc @@ -35,7 +35,7 @@ Result::Result(Context &context, ResultType type, ResultPrecision precision) { } -Result::Result(Context &context, eGPUTextureFormat format) +Result::Result(Context &context, blender::gpu::TextureFormat format) : context_(&context), type_(Result::type(format)), precision_(Result::precision(format)) { } @@ -60,29 +60,29 @@ bool Result::is_single_value_only_type(ResultType type) return true; } -eGPUTextureFormat Result::gpu_texture_format(ResultType type, ResultPrecision precision) +blender::gpu::TextureFormat Result::gpu_texture_format(ResultType type, ResultPrecision precision) { switch (precision) { case ResultPrecision::Half: switch (type) { case ResultType::Float: - return GPU_R16F; + return blender::gpu::TextureFormat::SFLOAT_16; case ResultType::Color: case ResultType::Float4: - return GPU_RGBA16F; + return blender::gpu::TextureFormat::SFLOAT_16_16_16_16; case ResultType::Float3: /* RGB textures are not fully supported by hardware, so we store Float3 results in RGBA * textures. */ - return GPU_RGBA16F; + return blender::gpu::TextureFormat::SFLOAT_16_16_16_16; case ResultType::Float2: - return GPU_RG16F; + return blender::gpu::TextureFormat::SFLOAT_16_16; case ResultType::Int: - return GPU_R16I; + return blender::gpu::TextureFormat::SINT_16; case ResultType::Int2: - return GPU_RG16I; + return blender::gpu::TextureFormat::SINT_16_16; case ResultType::Bool: /* No bool texture formats, so we store in an 8-bit integer. Precision doesn't matter. */ - return GPU_R8I; + return blender::gpu::TextureFormat::SINT_8; case ResultType::Menu: /* Single only types do not support GPU code path. */ BLI_assert(Result::is_single_value_only_type(type)); @@ -93,23 +93,23 @@ eGPUTextureFormat Result::gpu_texture_format(ResultType type, ResultPrecision pr case ResultPrecision::Full: switch (type) { case ResultType::Float: - return GPU_R32F; + return blender::gpu::TextureFormat::SFLOAT_32; case ResultType::Color: case ResultType::Float4: - return GPU_RGBA32F; + return blender::gpu::TextureFormat::SFLOAT_32_32_32_32; case ResultType::Float3: /* RGB textures are not fully supported by hardware, so we store Float3 results in RGBA * textures. */ - return GPU_RGBA32F; + return blender::gpu::TextureFormat::SFLOAT_32_32_32_32; case ResultType::Float2: - return GPU_RG32F; + return blender::gpu::TextureFormat::SFLOAT_32_32; case ResultType::Int: - return GPU_R32I; + return blender::gpu::TextureFormat::SINT_32; case ResultType::Int2: - return GPU_RG32I; + return blender::gpu::TextureFormat::SINT_32_32; case ResultType::Bool: /* No bool texture formats, so we store in an 8-bit integer. Precision doesn't matter. */ - return GPU_R8I; + return blender::gpu::TextureFormat::SINT_8; case ResultType::Menu: /* Single only types do not support GPU storage. */ BLI_assert(Result::is_single_value_only_type(type)); @@ -120,7 +120,7 @@ eGPUTextureFormat Result::gpu_texture_format(ResultType type, ResultPrecision pr } BLI_assert_unreachable(); - return GPU_RGBA32F; + return blender::gpu::TextureFormat::SFLOAT_32_32_32_32; } eGPUDataFormat Result::gpu_data_format(ResultType type) @@ -147,36 +147,37 @@ eGPUDataFormat Result::gpu_data_format(ResultType type) return GPU_DATA_FLOAT; } -eGPUTextureFormat Result::gpu_texture_format(eGPUTextureFormat format, ResultPrecision precision) +blender::gpu::TextureFormat Result::gpu_texture_format(blender::gpu::TextureFormat format, + ResultPrecision precision) { switch (precision) { case ResultPrecision::Half: switch (format) { /* Already half precision, return the input format. */ - case GPU_R16F: - case GPU_RG16F: - case GPU_RGB16F: - case GPU_RGBA16F: - case GPU_R16I: - case GPU_RG16I: + case blender::gpu::TextureFormat::SFLOAT_16: + case blender::gpu::TextureFormat::SFLOAT_16_16: + case blender::gpu::TextureFormat::SFLOAT_16_16_16: + case blender::gpu::TextureFormat::SFLOAT_16_16_16_16: + case blender::gpu::TextureFormat::SINT_16: + case blender::gpu::TextureFormat::SINT_16_16: return format; /* Used to store booleans where precision doesn't matter. */ - case GPU_R8I: + case blender::gpu::TextureFormat::SINT_8: return format; - case GPU_R32F: - return GPU_R16F; - case GPU_RG32F: - return GPU_RG16F; - case GPU_RGB32F: - return GPU_RGB16F; - case GPU_RGBA32F: - return GPU_RGBA16F; - case GPU_R32I: - return GPU_R16I; - case GPU_RG32I: - return GPU_RG16I; + case blender::gpu::TextureFormat::SFLOAT_32: + return blender::gpu::TextureFormat::SFLOAT_16; + case blender::gpu::TextureFormat::SFLOAT_32_32: + return blender::gpu::TextureFormat::SFLOAT_16_16; + case blender::gpu::TextureFormat::SFLOAT_32_32_32: + return blender::gpu::TextureFormat::SFLOAT_16_16_16; + case blender::gpu::TextureFormat::SFLOAT_32_32_32_32: + return blender::gpu::TextureFormat::SFLOAT_16_16_16_16; + case blender::gpu::TextureFormat::SINT_32: + return blender::gpu::TextureFormat::SINT_16; + case blender::gpu::TextureFormat::SINT_32_32: + return blender::gpu::TextureFormat::SINT_16_16; default: break; } @@ -184,30 +185,30 @@ eGPUTextureFormat Result::gpu_texture_format(eGPUTextureFormat format, ResultPre case ResultPrecision::Full: switch (format) { /* Already full precision, return the input format. */ - case GPU_R32F: - case GPU_RG32F: - case GPU_RGB32F: - case GPU_RGBA32F: - case GPU_R32I: - case GPU_RG32I: + case blender::gpu::TextureFormat::SFLOAT_32: + case blender::gpu::TextureFormat::SFLOAT_32_32: + case blender::gpu::TextureFormat::SFLOAT_32_32_32: + case blender::gpu::TextureFormat::SFLOAT_32_32_32_32: + case blender::gpu::TextureFormat::SINT_32: + case blender::gpu::TextureFormat::SINT_32_32: return format; /* Used to store booleans where precision doesn't matter. */ - case GPU_R8I: + case blender::gpu::TextureFormat::SINT_8: return format; - case GPU_R16F: - return GPU_R32F; - case GPU_RG16F: - return GPU_RG32F; - case GPU_RGB16F: - return GPU_RGB32F; - case GPU_RGBA16F: - return GPU_RGBA32F; - case GPU_R16I: - return GPU_R32I; - case GPU_RG16I: - return GPU_RG32I; + case blender::gpu::TextureFormat::SFLOAT_16: + return blender::gpu::TextureFormat::SFLOAT_32; + case blender::gpu::TextureFormat::SFLOAT_16_16: + return blender::gpu::TextureFormat::SFLOAT_32_32; + case blender::gpu::TextureFormat::SFLOAT_16_16_16: + return blender::gpu::TextureFormat::SFLOAT_32_32_32; + case blender::gpu::TextureFormat::SFLOAT_16_16_16_16: + return blender::gpu::TextureFormat::SFLOAT_32_32_32_32; + case blender::gpu::TextureFormat::SINT_16: + return blender::gpu::TextureFormat::SINT_32; + case blender::gpu::TextureFormat::SINT_16_16: + return blender::gpu::TextureFormat::SINT_32_32; default: break; } @@ -218,25 +219,25 @@ eGPUTextureFormat Result::gpu_texture_format(eGPUTextureFormat format, ResultPre return format; } -ResultPrecision Result::precision(eGPUTextureFormat format) +ResultPrecision Result::precision(blender::gpu::TextureFormat format) { switch (format) { - case GPU_R16F: - case GPU_RG16F: - case GPU_RGB16F: - case GPU_RGBA16F: - case GPU_R16I: - case GPU_RG16I: + case blender::gpu::TextureFormat::SFLOAT_16: + case blender::gpu::TextureFormat::SFLOAT_16_16: + case blender::gpu::TextureFormat::SFLOAT_16_16_16: + case blender::gpu::TextureFormat::SFLOAT_16_16_16_16: + case blender::gpu::TextureFormat::SINT_16: + case blender::gpu::TextureFormat::SINT_16_16: return ResultPrecision::Half; - case GPU_R32F: - case GPU_RG32F: - case GPU_RGB32F: - case GPU_RGBA32F: - case GPU_R32I: - case GPU_RG32I: + case blender::gpu::TextureFormat::SFLOAT_32: + case blender::gpu::TextureFormat::SFLOAT_32_32: + case blender::gpu::TextureFormat::SFLOAT_32_32_32: + case blender::gpu::TextureFormat::SFLOAT_32_32_32_32: + case blender::gpu::TextureFormat::SINT_32: + case blender::gpu::TextureFormat::SINT_32_32: return ResultPrecision::Full; /* Used to store booleans where precision doesn't matter. */ - case GPU_R8I: + case blender::gpu::TextureFormat::SINT_8: return ResultPrecision::Full; default: break; @@ -246,28 +247,28 @@ ResultPrecision Result::precision(eGPUTextureFormat format) return ResultPrecision::Full; } -ResultType Result::type(eGPUTextureFormat format) +ResultType Result::type(blender::gpu::TextureFormat format) { switch (format) { - case GPU_R16F: - case GPU_R32F: + case blender::gpu::TextureFormat::SFLOAT_16: + case blender::gpu::TextureFormat::SFLOAT_32: return ResultType::Float; - case GPU_RG16F: - case GPU_RG32F: + case blender::gpu::TextureFormat::SFLOAT_16_16: + case blender::gpu::TextureFormat::SFLOAT_32_32: return ResultType::Float2; - case GPU_RGB16F: - case GPU_RGB32F: + case blender::gpu::TextureFormat::SFLOAT_16_16_16: + case blender::gpu::TextureFormat::SFLOAT_32_32_32: return ResultType::Float3; - case GPU_RGBA16F: - case GPU_RGBA32F: + case blender::gpu::TextureFormat::SFLOAT_16_16_16_16: + case blender::gpu::TextureFormat::SFLOAT_32_32_32_32: return ResultType::Color; - case GPU_R16I: - case GPU_R32I: + case blender::gpu::TextureFormat::SINT_16: + case blender::gpu::TextureFormat::SINT_32: return ResultType::Int; - case GPU_RG16I: - case GPU_RG32I: + case blender::gpu::TextureFormat::SINT_16_16: + case blender::gpu::TextureFormat::SINT_32_32: return ResultType::Int2; - case GPU_R8I: + case blender::gpu::TextureFormat::SINT_8: return ResultType::Bool; default: break; @@ -360,7 +361,7 @@ const CPPType &Result::get_cpp_type() const return Result::cpp_type(this->type()); } -eGPUTextureFormat Result::get_gpu_texture_format() const +blender::gpu::TextureFormat Result::get_gpu_texture_format() const { return Result::gpu_texture_format(type_, precision_); } @@ -527,7 +528,9 @@ void Result::steal_data(Result &source) /* Float3 types are an exception, see the documentation on the get_gpu_texture_format method for * more information. */ if (result.type() == ResultType::Float3) { - if (GPU_texture_format(texture) == Result::gpu_texture_format(GPU_RGB32F, result.precision())) + if (GPU_texture_format(texture) == + Result::gpu_texture_format(blender::gpu::TextureFormat::SFLOAT_32_32_32, + result.precision())) { return true; } @@ -792,7 +795,7 @@ void Result::allocate_data(const int2 size, storage_type_ = ResultStorageType::GPU; is_from_pool_ = from_pool; - const eGPUTextureFormat format = this->get_gpu_texture_format(); + const blender::gpu::TextureFormat format = this->get_gpu_texture_format(); const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL; if (from_pool) { gpu_texture_ = gpu::TexturePool::get().acquire_texture(size.x, size.y, format, usage); diff --git a/source/blender/compositor/shaders/infos/compositor_alpha_crop_info.hh b/source/blender/compositor/shaders/infos/compositor_alpha_crop_info.hh index f3161a1124d..c20b3e7e54a 100644 --- a/source/blender/compositor/shaders/infos/compositor_alpha_crop_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_alpha_crop_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int2, lower_bound) PUSH_CONSTANT(int2, upper_bound) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_alpha_crop.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_bilateral_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_bilateral_blur_info.hh index 2ca9ed504ea..ae9c84896d5 100644 --- a/source/blender/compositor/shaders/infos/compositor_bilateral_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_bilateral_blur_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(int, radius) PUSH_CONSTANT(float, threshold) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, determinator_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_bilateral_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_bokeh_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_bokeh_blur_info.hh index bbf55dab44a..acd5e1dcbe4 100644 --- a/source/blender/compositor/shaders/infos/compositor_bokeh_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_bokeh_blur_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(int, radius) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, mask_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_bokeh_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh b/source/blender/compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh index 28e4f221626..384582e89f5 100644 --- a/source/blender/compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_bokeh_blur_variable_size_info.hh @@ -12,7 +12,7 @@ SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, size_tx) SAMPLER(3, sampler2D, mask_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_bokeh_blur_variable_size.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_bokeh_image_info.hh b/source/blender/compositor/shaders/infos/compositor_bokeh_image_info.hh index a62906fe2ce..a8e0dba5835 100644 --- a/source/blender/compositor/shaders/infos/compositor_bokeh_image_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_bokeh_image_info.hh @@ -11,7 +11,7 @@ PUSH_CONSTANT(float, rotation) PUSH_CONSTANT(float, roundness) PUSH_CONSTANT(float, catadioptric) PUSH_CONSTANT(float, lens_shift) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_bokeh_image.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_box_mask_info.hh b/source/blender/compositor/shaders/infos/compositor_box_mask_info.hh index 966321d635c..503ffd6e966 100644 --- a/source/blender/compositor/shaders/infos/compositor_box_mask_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_box_mask_info.hh @@ -13,7 +13,7 @@ PUSH_CONSTANT(float, cos_angle) PUSH_CONSTANT(float, sin_angle) SAMPLER(0, sampler2D, base_mask_tx) SAMPLER(1, sampler2D, mask_value_tx) -IMAGE(0, GPU_R16F, write, image2D, output_mask_img) +IMAGE(0, SFLOAT_16, write, image2D, output_mask_img) COMPUTE_SOURCE("compositor_box_mask.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_compute_preview_info.hh b/source/blender/compositor/shaders/infos/compositor_compute_preview_info.hh index a08b5864c35..ac45070dff6 100644 --- a/source/blender/compositor/shaders/infos/compositor_compute_preview_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_compute_preview_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_compute_preview) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, preview_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, preview_img) COMPUTE_SOURCE("compositor_compute_preview.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_convert_info.hh b/source/blender/compositor/shaders/infos/compositor_convert_info.hh index 4bd02a46b44..bb263200f6b 100644 --- a/source/blender/compositor/shaders/infos/compositor_convert_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_convert_info.hh @@ -26,49 +26,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_int) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float_to_int(value.x), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_int2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float_to_int2(value.x), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_to_float2(value.x), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float3) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_to_float3(value.x), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_color) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_to_color(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_float4) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float_to_float4(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float_to_bool) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float_to_bool(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -79,49 +79,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_int2) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(int_to_int2(value.x), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_float) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int_to_float(value.x), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_float2) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int_to_float2(value.x), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_float3) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int_to_float3(value.x), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_color) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int_to_color(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_float4) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int_to_float4(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int_to_bool) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(int_to_bool(value.x))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -132,49 +132,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_int) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(int2_to_int(value.xy), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_float) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int2_to_float(value.xy), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_float2) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int2_to_float2(value.xy), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_float3) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int2_to_float3(value.xy), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_color) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int2_to_color(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_float4) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(int2_to_float4(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_int2_to_bool) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(int2_to_bool(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -185,49 +185,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_float) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float2_to_float(value.xy), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_int) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float2_to_int(value.xy), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_int2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float2_to_int2(value.xy), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_float3) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float2_to_float3(value.xy), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_color) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float2_to_color(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_float4) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float2_to_float4(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float2_to_bool) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float2_to_bool(value.xy))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -238,49 +238,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_float) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float3_to_float(value.xyz), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_int) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float3_to_int(value.xyz), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_int2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float3_to_int2(value.xyz), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_float2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float3_to_float2(value.xyz), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_color) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float3_to_color(value.xyz))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_float4) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float3_to_float4(value.xyz))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float3_to_bool) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float3_to_bool(value.xyz))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -292,7 +292,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float) ADDITIONAL_INFO(compositor_convert_float_shared) PUSH_CONSTANT(float3, luminance_coefficients_u) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(color_to_float(value, luminance_coefficients_u), vec3(0.0f))") DO_STATIC_COMPILATION() @@ -301,7 +301,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_int) ADDITIONAL_INFO(compositor_convert_float_shared) PUSH_CONSTANT(float3, luminance_coefficients_u) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(color_to_int(value, luminance_coefficients_u), ivec3(0))") DO_STATIC_COMPILATION() @@ -309,28 +309,28 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_int2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(color_to_int2(value), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(color_to_float2(value), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float3) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(color_to_float3(value), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_float4) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(color_to_float4(value))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -338,7 +338,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_bool) ADDITIONAL_INFO(compositor_convert_float_shared) PUSH_CONSTANT(float3, luminance_coefficients_u) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(color_to_bool(value, luminance_coefficients_u))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -349,49 +349,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_float) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float4_to_float(value), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_int) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float4_to_int(value), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_int2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float4_to_int2(value), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_float2) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float4_to_float2(value), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_float3) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float4_to_float3(value), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_color) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(float4_to_color(value))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_float4_to_bool) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R8I, write, iimage2D, output_img) +IMAGE(0, SINT_8, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(float4_to_bool(value))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -402,49 +402,49 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_float) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(bool_to_float(bool(value.x)), vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_int) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_R16I, write, iimage2D, output_img) +IMAGE(0, SINT_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(bool_to_int(bool(value.x)), ivec3(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_int2) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "ivec4(bool_to_int2(bool(value.x)), ivec2(0))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_float2) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(bool_to_float2(bool(value.x)), vec2(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_float3) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(bool_to_float3(bool(value.x)), 0.0f)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_color) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(bool_to_color(bool(value.x)))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_bool_to_float4) ADDITIONAL_INFO(compositor_convert_int_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(bool_to_float4(bool(value.x)))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -455,7 +455,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_convert_color_to_alpha) ADDITIONAL_INFO(compositor_convert_float_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("CONVERT_EXPRESSION(value)", "vec4(value.a)") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh b/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh index 923084298de..06b92f30420 100644 --- a/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_cryptomatte_info.hh @@ -10,7 +10,7 @@ GPU_SHADER_CREATE_INFO(compositor_cryptomatte_pick) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int2, lower_bound) SAMPLER(0, sampler2D, first_layer_tx) -IMAGE(0, GPU_RGBA32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, output_img) COMPUTE_SOURCE("compositor_cryptomatte_pick.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -21,7 +21,7 @@ PUSH_CONSTANT(int2, lower_bound) PUSH_CONSTANT(int, identifiers_count) PUSH_CONSTANT_ARRAY(float, identifiers, 32) SAMPLER(0, sampler2D, layer_tx) -IMAGE(0, GPU_R16F, read_write, image2D, matte_img) +IMAGE(0, SFLOAT_16, read_write, image2D, matte_img) COMPUTE_SOURCE("compositor_cryptomatte_matte.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -30,7 +30,7 @@ GPU_SHADER_CREATE_INFO(compositor_cryptomatte_image) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, matte_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_cryptomatte_image.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_defocus_info.hh b/source/blender/compositor/shaders/infos/compositor_defocus_info.hh index 8c4c3b2b01c..de1aea54c92 100644 --- a/source/blender/compositor/shaders/infos/compositor_defocus_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_defocus_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, scale) PUSH_CONSTANT(float, max_radius) SAMPLER(0, sampler2D, radius_tx) -IMAGE(0, GPU_R16F, write, image2D, radius_img) +IMAGE(0, SFLOAT_16, write, image2D, radius_img) COMPUTE_SOURCE("compositor_defocus_radius_from_scale.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -22,7 +22,7 @@ PUSH_CONSTANT(float, focal_length) PUSH_CONSTANT(float, pixels_per_meter) PUSH_CONSTANT(float, distance_to_image_of_focus) SAMPLER(0, sampler2D, depth_tx) -IMAGE(0, GPU_R16F, write, image2D, radius_img) +IMAGE(0, SFLOAT_16, write, image2D, radius_img) COMPUTE_SOURCE("compositor_defocus_radius_from_depth.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -33,7 +33,7 @@ PUSH_CONSTANT(int, search_radius) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, radius_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_defocus_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh index ad388ea52c5..56ef1648f6f 100644 --- a/source/blender/compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_deriche_gaussian_blur_info.hh @@ -12,8 +12,8 @@ PUSH_CONSTANT(float4, feedback_coefficients) PUSH_CONSTANT(float, causal_boundary_coefficient) PUSH_CONSTANT(float, non_causal_boundary_coefficient) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, causal_output_img) -IMAGE(1, GPU_RGBA16F, write, image2D, non_causal_output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, causal_output_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2D, non_causal_output_img) COMPUTE_SOURCE("compositor_deriche_gaussian_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(compositor_deriche_gaussian_blur_sum) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, causal_input_tx) SAMPLER(1, sampler2D, non_causal_input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_deriche_gaussian_blur_sum.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_despeckle_info.hh b/source/blender/compositor/shaders/infos/compositor_despeckle_info.hh index ab72cf16b9d..5bc003d6233 100644 --- a/source/blender/compositor/shaders/infos/compositor_despeckle_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_despeckle_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(float, color_threshold) PUSH_CONSTANT(float, neighbor_threshold) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, factor_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_despeckle.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_directional_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_directional_blur_info.hh index 64296629a18..5a8ca0ffe23 100644 --- a/source/blender/compositor/shaders/infos/compositor_directional_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_directional_blur_info.hh @@ -13,7 +13,7 @@ PUSH_CONSTANT(float, delta_rotation_sin) PUSH_CONSTANT(float, delta_rotation_cos) PUSH_CONSTANT(float, delta_scale) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_directional_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_displace_info.hh b/source/blender/compositor/shaders/infos/compositor_displace_info.hh index cba862fb059..e7ded4ed916 100644 --- a/source/blender/compositor/shaders/infos/compositor_displace_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_displace_info.hh @@ -10,7 +10,7 @@ SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, displacement_tx) SAMPLER(2, sampler2D, x_scale_tx) SAMPLER(3, sampler2D, y_scale_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_displace) diff --git a/source/blender/compositor/shaders/infos/compositor_double_edge_mask_info.hh b/source/blender/compositor/shaders/infos/compositor_double_edge_mask_info.hh index a8ae9e6b89e..43e89168dc0 100644 --- a/source/blender/compositor/shaders/infos/compositor_double_edge_mask_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_double_edge_mask_info.hh @@ -10,8 +10,8 @@ PUSH_CONSTANT(bool, include_all_inner_edges) PUSH_CONSTANT(bool, include_edges_of_image) SAMPLER(0, sampler2D, inner_mask_tx) SAMPLER(1, sampler2D, outer_mask_tx) -IMAGE(0, GPU_RG16I, write, iimage2D, inner_boundary_img) -IMAGE(1, GPU_RG16I, write, iimage2D, outer_boundary_img) +IMAGE(0, SINT_16_16, write, iimage2D, inner_boundary_img) +IMAGE(1, SINT_16_16, write, iimage2D, outer_boundary_img) COMPUTE_SOURCE("compositor_double_edge_mask_compute_boundary.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -22,7 +22,7 @@ SAMPLER(0, sampler2D, inner_mask_tx) SAMPLER(1, sampler2D, outer_mask_tx) SAMPLER(2, isampler2D, flooded_inner_boundary_tx) SAMPLER(3, isampler2D, flooded_outer_boundary_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_double_edge_mask_compute_gradient.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_edge_filter_info.hh b/source/blender/compositor/shaders/infos/compositor_edge_filter_info.hh index babae7c32f9..da86d107ad3 100644 --- a/source/blender/compositor/shaders/infos/compositor_edge_filter_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_edge_filter_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float4x4, ukernel) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, factor_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_edge_filter.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_ellipse_mask_info.hh b/source/blender/compositor/shaders/infos/compositor_ellipse_mask_info.hh index 2c40c6bd60b..3df12df562e 100644 --- a/source/blender/compositor/shaders/infos/compositor_ellipse_mask_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_ellipse_mask_info.hh @@ -13,7 +13,7 @@ PUSH_CONSTANT(float, cos_angle) PUSH_CONSTANT(float, sin_angle) SAMPLER(0, sampler2D, base_mask_tx) SAMPLER(1, sampler2D, mask_value_tx) -IMAGE(0, GPU_R16F, write, image2D, output_mask_img) +IMAGE(0, SFLOAT_16, write, image2D, output_mask_img) COMPUTE_SOURCE("compositor_ellipse_mask.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_filter_info.hh b/source/blender/compositor/shaders/infos/compositor_filter_info.hh index 841c1a171a8..a45eeae56b8 100644 --- a/source/blender/compositor/shaders/infos/compositor_filter_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_filter_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float4x4, ukernel) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, factor_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_filter.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_flip_info.hh b/source/blender/compositor/shaders/infos/compositor_flip_info.hh index f6be297a33a..8391aeeae29 100644 --- a/source/blender/compositor/shaders/infos/compositor_flip_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_flip_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(bool, flip_x) PUSH_CONSTANT(bool, flip_y) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_flip.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_gamma_correct_info.hh b/source/blender/compositor/shaders/infos/compositor_gamma_correct_info.hh index 9bd15f11bfd..fc6abd9acdb 100644 --- a/source/blender/compositor/shaders/infos/compositor_gamma_correct_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_gamma_correct_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_gamma_correct_shared) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_gamma_correct.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_glare_info.hh b/source/blender/compositor/shaders/infos/compositor_glare_info.hh index e24e652a14e..fc7852e07ec 100644 --- a/source/blender/compositor/shaders/infos/compositor_glare_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_glare_info.hh @@ -15,7 +15,7 @@ PUSH_CONSTANT(float, highlights_smoothness) PUSH_CONSTANT(float, max_brightness) PUSH_CONSTANT(int, quality) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_highlights.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -26,7 +26,7 @@ PUSH_CONSTANT(float, saturation) PUSH_CONSTANT(float3, tint) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, glare_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_mix.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -36,7 +36,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, saturation) PUSH_CONSTANT(float3, tint) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_write_glare_output.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -44,7 +44,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_write_highlights_output) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_write_highlights_output.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -57,7 +57,7 @@ GPU_SHADER_CREATE_INFO(compositor_glare_ghost_base) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, small_ghost_tx) SAMPLER(1, sampler2D, big_ghost_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, combined_ghost_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, combined_ghost_img) COMPUTE_SOURCE("compositor_glare_ghost_base.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -67,7 +67,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float4, scales) PUSH_CONSTANT_ARRAY(float4, color_modulators, 4) SAMPLER(0, sampler2D, input_ghost_tx) -IMAGE(0, GPU_RGBA16F, read_write, image2D, accumulated_ghost_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, accumulated_ghost_img) COMPUTE_SOURCE("compositor_glare_ghost_accumulate.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -80,7 +80,7 @@ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_horizontal_pass) LOCAL_GROUP_SIZE(16) PUSH_CONSTANT(int, iterations) PUSH_CONSTANT(float, fade_factor) -IMAGE(0, GPU_RGBA16F, read_write, image2D, horizontal_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, horizontal_img) COMPUTE_SOURCE("compositor_glare_simple_star_horizontal_pass.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -90,7 +90,7 @@ LOCAL_GROUP_SIZE(16) PUSH_CONSTANT(int, iterations) PUSH_CONSTANT(float, fade_factor) SAMPLER(0, sampler2D, horizontal_tx) -IMAGE(0, GPU_RGBA16F, read_write, image2D, vertical_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, vertical_img) COMPUTE_SOURCE("compositor_glare_simple_star_vertical_pass.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -99,7 +99,7 @@ GPU_SHADER_CREATE_INFO(compositor_glare_simple_star_diagonal_pass) LOCAL_GROUP_SIZE(16) PUSH_CONSTANT(int, iterations) PUSH_CONSTANT(float, fade_factor) -IMAGE(0, GPU_RGBA16F, read_write, image2D, diagonal_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, diagonal_img) COMPUTE_SOURCE("compositor_glare_simple_star_diagonal_pass.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -109,7 +109,7 @@ LOCAL_GROUP_SIZE(16) PUSH_CONSTANT(int, iterations) PUSH_CONSTANT(float, fade_factor) SAMPLER(0, sampler2D, diagonal_tx) -IMAGE(0, GPU_RGBA16F, read_write, image2D, anti_diagonal_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, anti_diagonal_img) COMPUTE_SOURCE("compositor_glare_simple_star_anti_diagonal_pass.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -124,7 +124,7 @@ PUSH_CONSTANT(float, color_modulator) PUSH_CONSTANT(float3, fade_factors) PUSH_CONSTANT(float2, streak_vector) SAMPLER(0, sampler2D, input_streak_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_streak_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_streak_img) COMPUTE_SOURCE("compositor_glare_streaks_filter.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -133,7 +133,7 @@ GPU_SHADER_CREATE_INFO(compositor_glare_streaks_accumulate) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, attenuation_factor) SAMPLER(0, sampler2D, streak_tx) -IMAGE(0, GPU_RGBA16F, read_write, image2D, accumulated_streaks_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, accumulated_streaks_img) COMPUTE_SOURCE("compositor_glare_streaks_accumulate.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -145,7 +145,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_downsample_shared) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_bloom_downsample.glsl") GPU_SHADER_CREATE_END() @@ -164,7 +164,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_glare_bloom_upsample) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, read_write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, output_img) COMPUTE_SOURCE("compositor_glare_bloom_upsample.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_id_mask_info.hh b/source/blender/compositor/shaders/infos/compositor_id_mask_info.hh index b9a56914e08..4b58d3bce9b 100644 --- a/source/blender/compositor/shaders/infos/compositor_id_mask_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_id_mask_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_id_mask) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, index) SAMPLER(0, sampler2D, input_mask_tx) -IMAGE(0, GPU_R16F, write, image2D, output_mask_img) +IMAGE(0, SFLOAT_16, write, image2D, output_mask_img) COMPUTE_SOURCE("compositor_id_mask.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_image_coordinates_info.hh b/source/blender/compositor/shaders/infos/compositor_image_coordinates_info.hh index 2a6ce9cc6a1..86b9aa6c359 100644 --- a/source/blender/compositor/shaders/infos/compositor_image_coordinates_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_image_coordinates_info.hh @@ -6,21 +6,21 @@ GPU_SHADER_CREATE_INFO(compositor_image_coordinates_uniform) LOCAL_GROUP_SIZE(16, 16) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_image_coordinates_uniform.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_image_coordinates_normalized) LOCAL_GROUP_SIZE(16, 16) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_image_coordinates_normalized.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_image_coordinates_pixel) LOCAL_GROUP_SIZE(16, 16) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_image_coordinates_pixel.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_image_crop_info.hh b/source/blender/compositor/shaders/infos/compositor_image_crop_info.hh index e6e53013028..df1defb0286 100644 --- a/source/blender/compositor/shaders/infos/compositor_image_crop_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_image_crop_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_image_crop) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int2, lower_bound) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_image_crop.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_inpaint_info.hh b/source/blender/compositor/shaders/infos/compositor_inpaint_info.hh index 56dafe6ba48..d014bf4d6fc 100644 --- a/source/blender/compositor/shaders/infos/compositor_inpaint_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_inpaint_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_inpaint_compute_boundary) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RG16I, write, iimage2D, boundary_img) +IMAGE(0, SINT_16_16, write, iimage2D, boundary_img) COMPUTE_SOURCE("compositor_inpaint_compute_boundary.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -17,9 +17,9 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, max_distance) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, isampler2D, flooded_boundary_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, filled_region_img) -IMAGE(1, GPU_R16F, write, image2D, distance_to_boundary_img) -IMAGE(2, GPU_R16F, write, image2D, smoothing_radius_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, filled_region_img) +IMAGE(1, SFLOAT_16, write, image2D, distance_to_boundary_img) +IMAGE(2, SFLOAT_16, write, image2D, smoothing_radius_img) COMPUTE_SOURCE("compositor_inpaint_fill_region.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -30,7 +30,7 @@ PUSH_CONSTANT(int, max_distance) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, inpainted_region_tx) SAMPLER(2, sampler2D, distance_to_boundary_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_inpaint_compute_region.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_jump_flooding_info.hh b/source/blender/compositor/shaders/infos/compositor_jump_flooding_info.hh index 8fade73a9df..8204ece29cf 100644 --- a/source/blender/compositor/shaders/infos/compositor_jump_flooding_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_jump_flooding_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_jump_flooding) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, step_size) SAMPLER(0, isampler2D, input_tx) -IMAGE(0, GPU_RG16I, write, iimage2D, output_img) +IMAGE(0, SINT_16_16, write, iimage2D, output_img) COMPUTE_SOURCE("compositor_jump_flooding.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_keying_info.hh b/source/blender/compositor/shaders/infos/compositor_keying_info.hh index 35c8433cda2..3fdeec7659d 100644 --- a/source/blender/compositor/shaders/infos/compositor_keying_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_keying_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_keying_extract_chroma) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_keying_extract_chroma.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -16,7 +16,7 @@ GPU_SHADER_CREATE_INFO(compositor_keying_replace_chroma) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, new_chroma_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_keying_replace_chroma.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -26,7 +26,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, key_balance) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, key_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_keying_compute_matte.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -40,7 +40,7 @@ PUSH_CONSTANT(float, white_level) SAMPLER(0, sampler2D, input_matte_tx) SAMPLER(1, sampler2D, garbage_matte_tx) SAMPLER(2, sampler2D, core_matte_tx) -IMAGE(0, GPU_R16F, write, image2D, output_matte_img) +IMAGE(0, SFLOAT_16, write, image2D, output_matte_img) COMPUTE_SOURCE("compositor_keying_tweak_matte.glsl") GPU_SHADER_CREATE_END() @@ -52,7 +52,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_keying_tweak_matte_with_edges) ADDITIONAL_INFO(compositor_keying_tweak_matte_shared) DEFINE("COMPUTE_EDGES") -IMAGE(1, GPU_R16F, write, image2D, output_edges_img) +IMAGE(1, SFLOAT_16, write, image2D, output_edges_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -63,7 +63,7 @@ PUSH_CONSTANT(float, despill_balance) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, matte_tx) SAMPLER(2, sampler2D, key_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_keying_compute_image.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_keying_screen_info.hh b/source/blender/compositor/shaders/infos/compositor_keying_screen_info.hh index f74bfe7a2aa..4994c851420 100644 --- a/source/blender/compositor/shaders/infos/compositor_keying_screen_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_keying_screen_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(float, smoothness) PUSH_CONSTANT(int, number_of_markers) STORAGE_BUF(0, read, vec2, marker_positions[]) STORAGE_BUF(1, read, vec4, marker_colors[]) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_keying_screen.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_kuwahara_info.hh b/source/blender/compositor/shaders/infos/compositor_kuwahara_info.hh index 2da235b8d99..44342d0da32 100644 --- a/source/blender/compositor/shaders/infos/compositor_kuwahara_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_kuwahara_info.hh @@ -6,7 +6,7 @@ GPU_SHADER_CREATE_INFO(compositor_kuwahara_classic_shared) LOCAL_GROUP_SIZE(16, 16) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_kuwahara_classic.glsl") GPU_SHADER_CREATE_END() @@ -53,7 +53,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_kuwahara_anisotropic_compute_structure_tensor) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, structure_tensor_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, structure_tensor_img) COMPUTE_SOURCE("compositor_kuwahara_anisotropic_compute_structure_tensor.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -64,7 +64,7 @@ PUSH_CONSTANT(float, eccentricity) PUSH_CONSTANT(float, sharpness) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, structure_tensor_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_kuwahara_anisotropic.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_lens_distortion_info.hh b/source/blender/compositor/shaders/infos/compositor_lens_distortion_info.hh index b9522ac42a1..14caf007434 100644 --- a/source/blender/compositor/shaders/infos/compositor_lens_distortion_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_lens_distortion_info.hh @@ -11,7 +11,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float3, chromatic_distortion) PUSH_CONSTANT(float, scale) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_radial_lens_distortion.glsl") GPU_SHADER_CREATE_END() @@ -32,7 +32,7 @@ GPU_SHADER_CREATE_INFO(compositor_horizontal_lens_distortion) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, dispersion) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_horizontal_lens_distortion.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_map_uv_info.hh b/source/blender/compositor/shaders/infos/compositor_map_uv_info.hh index 0079b9801bc..356441bd63b 100644 --- a/source/blender/compositor/shaders/infos/compositor_map_uv_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_map_uv_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_map_uv_shared) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, uv_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_map_uv) diff --git a/source/blender/compositor/shaders/infos/compositor_morphological_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_morphological_blur_info.hh index 2c4bbe50943..daf9581ab30 100644 --- a/source/blender/compositor/shaders/infos/compositor_morphological_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_morphological_blur_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_morphological_blur_shared) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R16F, read_write, image2D, blurred_input_img) +IMAGE(0, SFLOAT_16, read_write, image2D, blurred_input_img) COMPUTE_SOURCE("compositor_morphological_blur.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_morphological_distance_feather_info.hh b/source/blender/compositor/shaders/infos/compositor_morphological_distance_feather_info.hh index 682cb4b8903..22af86714fc 100644 --- a/source/blender/compositor/shaders/infos/compositor_morphological_distance_feather_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_morphological_distance_feather_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, falloffs_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_morphological_distance_feather.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_morphological_distance_info.hh b/source/blender/compositor/shaders/infos/compositor_morphological_distance_info.hh index 2a6b01c8626..bbec3a821d3 100644 --- a/source/blender/compositor/shaders/infos/compositor_morphological_distance_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_morphological_distance_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_morphological_distance_shared) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, radius) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_morphological_distance.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh b/source/blender/compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh index a69dca79314..3c4e6caf145 100644 --- a/source/blender/compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_morphological_distance_threshold_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(int, radius) PUSH_CONSTANT(int, distance) PUSH_CONSTANT(float, inset) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_morphological_distance_threshold.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_morphological_step_info.hh b/source/blender/compositor/shaders/infos/compositor_morphological_step_info.hh index ee588a17587..2a22f51a19a 100644 --- a/source/blender/compositor/shaders/infos/compositor_morphological_step_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_morphological_step_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_morphological_step_shared) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, radius) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_morphological_step.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_motion_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_motion_blur_info.hh index 67d99477d7a..5ca45085a49 100644 --- a/source/blender/compositor/shaders/infos/compositor_motion_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_motion_blur_info.hh @@ -22,7 +22,7 @@ SAMPLER(1, sampler2D, depth_tx) SAMPLER(2, sampler2D, velocity_tx) SAMPLER(3, sampler2D, max_velocity_tx) STORAGE_BUF(0, read, uint, tile_indirection_buf[]) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_motion_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_movie_distortion_info.hh b/source/blender/compositor/shaders/infos/compositor_movie_distortion_info.hh index 2922e641b1b..15339382805 100644 --- a/source/blender/compositor/shaders/infos/compositor_movie_distortion_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_movie_distortion_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_movie_distortion) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, distortion_grid_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_movie_distortion.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_normalize_info.hh b/source/blender/compositor/shaders/infos/compositor_normalize_info.hh index 9e70cd016ca..dc9ebcf0e2a 100644 --- a/source/blender/compositor/shaders/infos/compositor_normalize_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_normalize_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float, minimum) PUSH_CONSTANT(float, scale) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_normalize.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_pad_info.hh b/source/blender/compositor/shaders/infos/compositor_pad_info.hh index 12703106987..ab96b99e2de 100644 --- a/source/blender/compositor/shaders/infos/compositor_pad_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_pad_info.hh @@ -14,20 +14,20 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_pad_zero_float4) ADDITIONAL_INFO(compositor_pad_shared) COMPILATION_CONSTANT(bool, zero_pad, true) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_pad_extend_float) ADDITIONAL_INFO(compositor_pad_shared) COMPILATION_CONSTANT(bool, zero_pad, false) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_pad_extend_float2) ADDITIONAL_INFO(compositor_pad_shared) COMPILATION_CONSTANT(bool, zero_pad, false) -IMAGE(0, GPU_RG16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_parallel_reduction_info.hh b/source/blender/compositor/shaders/infos/compositor_parallel_reduction_info.hh index 0f64d7703c9..6e84c706e5d 100644 --- a/source/blender/compositor/shaders/infos/compositor_parallel_reduction_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_parallel_reduction_info.hh @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_float_shared) ADDITIONAL_INFO(compositor_sum_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "0.0f") DEFINE_VALUE("LOAD(value)", "value.x") @@ -62,7 +62,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_color) ADDITIONAL_INFO(compositor_sum_shared) -IMAGE(0, GPU_RGBA32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "vec4") DEFINE_VALUE("IDENTITY", "vec4(0.0f)") DEFINE_VALUE("INITIALIZE(value)", "value") @@ -76,7 +76,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_sum_squared_difference_float_shared) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) PUSH_CONSTANT(float, subtrahend) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "0.0f") @@ -115,7 +115,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_luminance) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) PUSH_CONSTANT(float3, luminance_coefficients) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "FLT_MIN") @@ -127,7 +127,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_brightness) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "FLT_MIN") DEFINE_VALUE("INITIALIZE(value)", "reduce_max(value.rgb)") @@ -138,7 +138,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "FLT_MIN") DEFINE_VALUE("INITIALIZE(value)", "value.x") @@ -149,7 +149,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float2) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_RG32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "vec2") DEFINE_VALUE("IDENTITY", "vec2(FLT_MIN)") DEFINE_VALUE("INITIALIZE(value)", "value.xy") @@ -161,7 +161,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_maximum_float_in_range) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) PUSH_CONSTANT(float, lower_bound) PUSH_CONSTANT(float, upper_bound) DEFINE_VALUE("TYPE", "float") @@ -178,7 +178,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_luminance) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) PUSH_CONSTANT(float3, luminance_coefficients) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "FLT_MAX") @@ -190,7 +190,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) DEFINE_VALUE("TYPE", "float") DEFINE_VALUE("IDENTITY", "FLT_MAX") DEFINE_VALUE("INITIALIZE(value)", "value.x") @@ -201,7 +201,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_minimum_float_in_range) ADDITIONAL_INFO(compositor_parallel_reduction_shared) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) PUSH_CONSTANT(float, lower_bound) PUSH_CONSTANT(float, upper_bound) DEFINE_VALUE("TYPE", "float") @@ -220,7 +220,7 @@ GPU_SHADER_CREATE_INFO(compositor_max_velocity) LOCAL_GROUP_SIZE(32, 32) PUSH_CONSTANT(bool, is_initial_reduction) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("TYPE", "vec4") DEFINE_VALUE("IDENTITY", "vec4(0.0f)") DEFINE_VALUE("INITIALIZE(value)", "value") diff --git a/source/blender/compositor/shaders/infos/compositor_pixelate_info.hh b/source/blender/compositor/shaders/infos/compositor_pixelate_info.hh index e62cbc97b2d..c49ebd0c86a 100644 --- a/source/blender/compositor/shaders/infos/compositor_pixelate_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_pixelate_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_pixelate) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, pixel_size) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_pixelate.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_plane_deform_info.hh b/source/blender/compositor/shaders/infos/compositor_plane_deform_info.hh index f1c16c4db22..29baf4e7d56 100644 --- a/source/blender/compositor/shaders/infos/compositor_plane_deform_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_plane_deform_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_plane_deform_mask) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float4x4, homography_matrix) -IMAGE(0, GPU_R16F, write, image2D, mask_img) +IMAGE(0, SFLOAT_16, write, image2D, mask_img) COMPUTE_SOURCE("compositor_plane_deform_mask.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -17,7 +17,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float4x4, homography_matrix) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, mask_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_plane_deform) @@ -44,7 +44,7 @@ GPU_SHADER_CREATE_INFO(compositor_plane_deform_motion_blur_mask) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int, number_of_motion_blur_samples) UNIFORM_BUF(0, float4x4, homography_matrices[64]) -IMAGE(0, GPU_R16F, write, image2D, mask_img) +IMAGE(0, SFLOAT_16, write, image2D, mask_img) COMPUTE_SOURCE("compositor_plane_deform_motion_blur_mask.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -55,7 +55,7 @@ PUSH_CONSTANT(int, number_of_motion_blur_samples) UNIFORM_BUF(0, float4x4, homography_matrices[64]) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, mask_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_plane_deform_motion_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_premultiply_alpha_info.hh b/source/blender/compositor/shaders/infos/compositor_premultiply_alpha_info.hh index a629f8a1c63..0d4f43a0d57 100644 --- a/source/blender/compositor/shaders/infos/compositor_premultiply_alpha_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_premultiply_alpha_info.hh @@ -7,7 +7,7 @@ GPU_SHADER_CREATE_INFO(compositor_premultiply_alpha) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_premultiply_alpha.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_read_input_info.hh b/source/blender/compositor/shaders/infos/compositor_read_input_info.hh index 787d725275b..1fb52c3ed51 100644 --- a/source/blender/compositor/shaders/infos/compositor_read_input_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_read_input_info.hh @@ -13,21 +13,21 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_float) ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.r, vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_float4) ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DEFINE_VALUE("READ_EXPRESSION(input_color)", "input_color") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_read_input_alpha) ADDITIONAL_INFO(compositor_read_input_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DEFINE_VALUE("READ_EXPRESSION(input_color)", "vec4(input_color.a, vec3(0.0f))") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_realize_on_domain_info.hh b/source/blender/compositor/shaders/infos/compositor_realize_on_domain_info.hh index 76dff372315..6af5a66a021 100644 --- a/source/blender/compositor/shaders/infos/compositor_realize_on_domain_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_realize_on_domain_info.hh @@ -23,36 +23,36 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float4) ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float2) ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_RG16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_float) ADDITIONAL_INFO(compositor_realize_on_domain_standard_shared) -IMAGE(0, GPU_R16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float4) ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float2) ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_RG16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_realize_on_domain_bicubic_float) ADDITIONAL_INFO(compositor_realize_on_domain_bicubic_shared) -IMAGE(0, GPU_R16F, write, image2D, domain_img) +IMAGE(0, SFLOAT_16, write, image2D, domain_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_scale_variable_info.hh b/source/blender/compositor/shaders/infos/compositor_scale_variable_info.hh index 42736bee53b..191d6295865 100644 --- a/source/blender/compositor/shaders/infos/compositor_scale_variable_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_scale_variable_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, x_scale_tx) SAMPLER(2, sampler2D, y_scale_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_scale_variable.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_smaa_info.hh b/source/blender/compositor/shaders/infos/compositor_smaa_info.hh index 3fa49a11a4a..1a5731e43ca 100644 --- a/source/blender/compositor/shaders/infos/compositor_smaa_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_smaa_info.hh @@ -16,7 +16,7 @@ PUSH_CONSTANT(float3, luminance_coefficients) PUSH_CONSTANT(float, smaa_threshold) PUSH_CONSTANT(float, smaa_local_contrast_adaptation_factor) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, edges_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, edges_img) COMPUTE_SOURCE("compositor_smaa_edge_detection.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -31,7 +31,7 @@ PUSH_CONSTANT(int, smaa_corner_rounding) SAMPLER(0, sampler2D, edges_tx) SAMPLER(1, sampler2D, area_tx) SAMPLER(2, sampler2D, search_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, weights_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, weights_img) COMPUTE_SOURCE("compositor_smaa_blending_weight_calculation.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -48,12 +48,12 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float4) ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_smaa_neighborhood_blending_float) ADDITIONAL_INFO(compositor_smaa_neighborhood_blending_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_split_info.hh b/source/blender/compositor/shaders/infos/compositor_split_info.hh index 6f805ab5402..4a0e9594453 100644 --- a/source/blender/compositor/shaders/infos/compositor_split_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_split_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(float2, position) PUSH_CONSTANT(float2, normal) SAMPLER(0, sampler2D, first_image_tx) SAMPLER(1, sampler2D, second_image_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_split.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_summed_area_table_info.hh b/source/blender/compositor/shaders/infos/compositor_summed_area_table_info.hh index 0961840219f..fd2d50871f0 100644 --- a/source/blender/compositor/shaders/infos/compositor_summed_area_table_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_summed_area_table_info.hh @@ -7,8 +7,8 @@ GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_incomplete_prologues_shared) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA32F, write, image2D, incomplete_x_prologues_img) -IMAGE(1, GPU_RGBA32F, write, image2D, incomplete_y_prologues_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, incomplete_x_prologues_img) +IMAGE(1, SFLOAT_32_32_32_32, write, image2D, incomplete_y_prologues_img) COMPUTE_SOURCE("compositor_summed_area_table_compute_incomplete_prologues.glsl") GPU_SHADER_CREATE_END() @@ -27,8 +27,8 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_x_prologues) LOCAL_GROUP_SIZE(16) SAMPLER(0, sampler2D, incomplete_x_prologues_tx) -IMAGE(0, GPU_RGBA32F, write, image2D, complete_x_prologues_img) -IMAGE(1, GPU_RGBA32F, write, image2D, complete_x_prologues_sum_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, complete_x_prologues_img) +IMAGE(1, SFLOAT_32_32_32_32, write, image2D, complete_x_prologues_sum_img) COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_x_prologues.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -37,7 +37,7 @@ GPU_SHADER_CREATE_INFO(compositor_summed_area_table_compute_complete_y_prologues LOCAL_GROUP_SIZE(16) SAMPLER(0, sampler2D, incomplete_y_prologues_tx) SAMPLER(1, sampler2D, complete_x_prologues_sum_tx) -IMAGE(0, GPU_RGBA32F, write, image2D, complete_y_prologues_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, complete_y_prologues_img) COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_y_prologues.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -47,7 +47,7 @@ LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, complete_x_prologues_tx) SAMPLER(2, sampler2D, complete_y_prologues_tx) -IMAGE(0, GPU_RGBA32F, read_write, image2D, output_img) +IMAGE(0, SFLOAT_32_32_32_32, read_write, image2D, output_img) COMPUTE_SOURCE("compositor_summed_area_table_compute_complete_blocks.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_sun_beams_info.hh b/source/blender/compositor/shaders/infos/compositor_sun_beams_info.hh index 8f5560c35a2..77ae2ebbcd5 100644 --- a/source/blender/compositor/shaders/infos/compositor_sun_beams_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_sun_beams_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float2, source) PUSH_CONSTANT(int, max_steps) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_sun_beams.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_symmetric_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_symmetric_blur_info.hh index f25ea24c24e..80348b99d5d 100644 --- a/source/blender/compositor/shaders/infos/compositor_symmetric_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_symmetric_blur_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_symmetric_blur) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_symmetric_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh b/source/blender/compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh index c20ef79903d..941c9aa6ab0 100644 --- a/source/blender/compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_symmetric_blur_variable_size_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, size_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_symmetric_blur_variable_size.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh index 3273de60b85..160e45e8e62 100644 --- a/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_info.hh @@ -13,12 +13,12 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float) ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(compositor_symmetric_separable_blur_float4) ADDITIONAL_INFO(compositor_symmetric_separable_blur_shared) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh b/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh index c3b2e602864..84869d9891d 100644 --- a/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_symmetric_separable_blur_variable_size_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(bool, is_vertical_pass) SAMPLER(0, sampler2D, input_tx) SAMPLER(1, sampler2D, weights_tx) SAMPLER(2, sampler2D, radius_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_symmetric_separable_blur_variable_size.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh b/source/blender/compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh index c87c9dc082a..d9e961ec930 100644 --- a/source/blender/compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_tone_map_photoreceptor_info.hh @@ -13,7 +13,7 @@ PUSH_CONSTANT(float, chromatic_adaptation) PUSH_CONSTANT(float, light_adaptation) PUSH_CONSTANT(float3, luminance_coefficients) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_tone_map_photoreceptor.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_tone_map_simple_info.hh b/source/blender/compositor/shaders/infos/compositor_tone_map_simple_info.hh index d5dfbb713c2..1a665940022 100644 --- a/source/blender/compositor/shaders/infos/compositor_tone_map_simple_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_tone_map_simple_info.hh @@ -10,7 +10,7 @@ PUSH_CONSTANT(float, luminance_scale) PUSH_CONSTANT(float, luminance_scale_blend_factor) PUSH_CONSTANT(float, inverse_gamma) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_tone_map_simple.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh b/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh index 4c93c430e47..ad225113ed1 100644 --- a/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_translate_wrapped_info.hh @@ -8,7 +8,7 @@ GPU_SHADER_CREATE_INFO(compositor_translate_wrapped_shared) LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(float2, translation) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_translate_wrapped.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh b/source/blender/compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh index 6a7f27ca55d..d694df973dc 100644 --- a/source/blender/compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_van_vliet_gaussian_blur_info.hh @@ -17,10 +17,10 @@ PUSH_CONSTANT(float, first_non_causal_boundary_coefficient) PUSH_CONSTANT(float, second_causal_boundary_coefficient) PUSH_CONSTANT(float, second_non_causal_boundary_coefficient) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, first_causal_output_img) -IMAGE(1, GPU_RGBA16F, write, image2D, first_non_causal_output_img) -IMAGE(2, GPU_RGBA16F, write, image2D, second_causal_output_img) -IMAGE(3, GPU_RGBA16F, write, image2D, second_non_causal_output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, first_causal_output_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2D, first_non_causal_output_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, second_causal_output_img) +IMAGE(3, SFLOAT_16_16_16_16, write, image2D, second_non_causal_output_img) COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -31,7 +31,7 @@ SAMPLER(0, sampler2D, first_causal_input_tx) SAMPLER(1, sampler2D, first_non_causal_input_tx) SAMPLER(2, sampler2D, second_causal_input_tx) SAMPLER(3, sampler2D, second_non_causal_input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_van_vliet_gaussian_blur_sum.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_write_output_info.hh b/source/blender/compositor/shaders/infos/compositor_write_output_info.hh index df3606bb058..8a898a77aeb 100644 --- a/source/blender/compositor/shaders/infos/compositor_write_output_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_write_output_info.hh @@ -9,7 +9,7 @@ LOCAL_GROUP_SIZE(16, 16) PUSH_CONSTANT(int2, lower_bound) PUSH_CONSTANT(int2, upper_bound) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("compositor_write_output.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/compositor/shaders/infos/compositor_z_combine_info.hh b/source/blender/compositor/shaders/infos/compositor_z_combine_info.hh index 9b55a5d0ae0..1e7b57a21d8 100644 --- a/source/blender/compositor/shaders/infos/compositor_z_combine_info.hh +++ b/source/blender/compositor/shaders/infos/compositor_z_combine_info.hh @@ -11,7 +11,7 @@ SAMPLER(0, sampler2D, first_tx) SAMPLER(1, sampler2D, first_z_tx) SAMPLER(2, sampler2D, second_tx) SAMPLER(3, sampler2D, second_z_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, combined_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, combined_img) COMPUTE_SOURCE("compositor_z_combine_simple_image.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -20,7 +20,7 @@ GPU_SHADER_CREATE_INFO(compositor_z_combine_simple_depth) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, first_z_tx) SAMPLER(1, sampler2D, second_z_tx) -IMAGE(0, GPU_R16F, write, image2D, combined_z_img) +IMAGE(0, SFLOAT_16, write, image2D, combined_z_img) COMPUTE_SOURCE("compositor_z_combine_simple_depth.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(compositor_z_combine_compute_mask) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, first_z_tx) SAMPLER(1, sampler2D, second_z_tx) -IMAGE(0, GPU_R16F, write, image2D, mask_img) +IMAGE(0, SFLOAT_16, write, image2D, mask_img) COMPUTE_SOURCE("compositor_z_combine_compute_mask.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -40,7 +40,7 @@ PUSH_CONSTANT(bool, use_alpha) SAMPLER(0, sampler2D, first_tx) SAMPLER(2, sampler2D, second_tx) SAMPLER(4, sampler2D, mask_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, combined_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, combined_img) COMPUTE_SOURCE("compositor_z_combine_from_mask_image.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -49,7 +49,7 @@ GPU_SHADER_CREATE_INFO(compositor_z_combine_from_mask_depth) LOCAL_GROUP_SIZE(16, 16) SAMPLER(0, sampler2D, first_z_tx) SAMPLER(1, sampler2D, second_z_tx) -IMAGE(0, GPU_R16F, write, image2D, combined_z_img) +IMAGE(0, SFLOAT_16, write, image2D, combined_z_img) COMPUTE_SOURCE("compositor_z_combine_from_mask_depth.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/eevee_defines.hh b/source/blender/draw/engines/eevee/eevee_defines.hh index 874e8c97cec..ae194c2ec17 100644 --- a/source/blender/draw/engines/eevee/eevee_defines.hh +++ b/source/blender/draw/engines/eevee/eevee_defines.hh @@ -57,7 +57,7 @@ #define SPHERE_PROBE_MAX 128 /** NOTE: Runtime format only. */ -#define VOLUME_PROBE_FORMAT GPU_RGBA16F +#define VOLUME_PROBE_FORMAT SFLOAT_16_16_16_16 /** * Limited by the performance impact it can cause. @@ -131,21 +131,21 @@ #define GBUF_NORMAL_FB_LAYER_COUNT 1 /* Deferred Lighting. */ -#define DEFERRED_RADIANCE_FORMAT GPU_R32UI +#define DEFERRED_RADIANCE_FORMAT UINT_32 #define DEFERRED_GBUFFER_ROG_ID 0 /* Ray-tracing. */ #define RAYTRACE_GROUP_SIZE 8 /* Keep this as a define to avoid shader variations. */ -#define RAYTRACE_RADIANCE_FORMAT GPU_R11F_G11F_B10F -#define RAYTRACE_RAYTIME_FORMAT GPU_R32F -#define RAYTRACE_VARIANCE_FORMAT GPU_R16F -#define RAYTRACE_TILEMASK_FORMAT GPU_R8UI +#define RAYTRACE_RADIANCE_FORMAT UFLOAT_11_11_10 +#define RAYTRACE_RAYTIME_FORMAT SFLOAT_32 +#define RAYTRACE_VARIANCE_FORMAT SFLOAT_16 +#define RAYTRACE_TILEMASK_FORMAT UINT_8 /* Sub-Surface Scattering. */ #define SUBSURFACE_GROUP_SIZE RAYTRACE_GROUP_SIZE -#define SUBSURFACE_RADIANCE_FORMAT GPU_R11F_G11F_B10F -#define SUBSURFACE_OBJECT_ID_FORMAT GPU_R16UI +#define SUBSURFACE_RADIANCE_FORMAT UFLOAT_11_11_10 +#define SUBSURFACE_OBJECT_ID_FORMAT UINT_16 /* Film. */ #define FILM_GROUP_SIZE 16 diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee/eevee_depth_of_field.cc index e1d841d2b86..d9c57e61849 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.cc +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.cc @@ -165,8 +165,10 @@ void DepthOfField::sync() * explanation. Do not use texture pool because of needs mipmaps. */ eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_WRITE; - reduced_color_tx_.ensure_2d(GPU_RGBA16F, reduce_size, usage, nullptr, DOF_MIP_COUNT); - reduced_coc_tx_.ensure_2d(GPU_R16F, reduce_size, usage, nullptr, DOF_MIP_COUNT); + reduced_color_tx_.ensure_2d( + gpu::TextureFormat::SFLOAT_16_16_16_16, reduce_size, usage, nullptr, DOF_MIP_COUNT); + reduced_coc_tx_.ensure_2d( + gpu::TextureFormat::SFLOAT_16, reduce_size, usage, nullptr, DOF_MIP_COUNT); reduced_color_tx_.ensure_mip_views(); reduced_coc_tx_.ensure_mip_views(); @@ -585,24 +587,25 @@ void DepthOfField::render(View &view, { GPU_debug_group_begin("Setup"); { - bokeh_gather_lut_tx_.acquire(int2(DOF_BOKEH_LUT_SIZE), GPU_RG16F); - bokeh_scatter_lut_tx_.acquire(int2(DOF_BOKEH_LUT_SIZE), GPU_R16F); - bokeh_resolve_lut_tx_.acquire(int2(DOF_MAX_SLIGHT_FOCUS_RADIUS * 2 + 1), GPU_R16F); + bokeh_gather_lut_tx_.acquire(int2(DOF_BOKEH_LUT_SIZE), gpu::TextureFormat::SFLOAT_16_16); + bokeh_scatter_lut_tx_.acquire(int2(DOF_BOKEH_LUT_SIZE), gpu::TextureFormat::SFLOAT_16); + bokeh_resolve_lut_tx_.acquire(int2(DOF_MAX_SLIGHT_FOCUS_RADIUS * 2 + 1), + gpu::TextureFormat::SFLOAT_16); if (use_bokeh_lut_) { drw.submit(bokeh_lut_ps_, view); } } { - setup_color_tx_.acquire(half_res, GPU_RGBA16F, usage_readwrite); - setup_coc_tx_.acquire(half_res, GPU_R16F); + setup_color_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite); + setup_coc_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16); drw.submit(setup_ps_, view); } { - stabilize_output_tx_.acquire(half_res, GPU_RGBA16F); - stabilize_valid_history_ = !dof_buffer.stabilize_history_tx_.ensure_2d(GPU_RGBA16F, - half_res); + stabilize_output_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16_16_16_16); + stabilize_valid_history_ = !dof_buffer.stabilize_history_tx_.ensure_2d( + gpu::TextureFormat::SFLOAT_16_16_16_16, half_res); if (stabilize_valid_history_ == false) { /* Avoid uninitialized memory that can contain NaNs. */ @@ -625,10 +628,14 @@ void DepthOfField::render(View &view, GPU_debug_group_begin("Tile Prepare"); /* WARNING: If format changes, make sure dof_tile_* GLSL constants are properly encoded. */ - tiles_fg_tx_.previous().acquire(tile_res, GPU_R11F_G11F_B10F, usage_readwrite); - tiles_bg_tx_.previous().acquire(tile_res, GPU_R11F_G11F_B10F, usage_readwrite); - tiles_fg_tx_.current().acquire(tile_res, GPU_R11F_G11F_B10F, usage_readwrite); - tiles_bg_tx_.current().acquire(tile_res, GPU_R11F_G11F_B10F, usage_readwrite); + tiles_fg_tx_.previous().acquire( + tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite); + tiles_bg_tx_.previous().acquire( + tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite); + tiles_fg_tx_.current().acquire( + tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite); + tiles_bg_tx_.current().acquire( + tile_res, gpu::TextureFormat::UFLOAT_11_11_10, usage_readwrite); drw.submit(tiles_flatten_ps_, view); @@ -669,7 +676,7 @@ void DepthOfField::render(View &view, GPU_debug_group_end(); } - downsample_tx_.acquire(quarter_res, GPU_RGBA16F, usage_readwrite); + downsample_tx_.acquire(quarter_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite); drw.submit(downsample_ps_, view); @@ -694,9 +701,10 @@ void DepthOfField::render(View &view, PassSimple &filter_ps = is_background ? filter_bg_ps_ : filter_fg_ps_; PassSimple &scatter_ps = is_background ? scatter_bg_ps_ : scatter_fg_ps_; - color_tx.current().acquire(half_res, GPU_RGBA16F, usage_readwrite_attach); - weight_tx.current().acquire(half_res, GPU_R16F, usage_readwrite); - occlusion_tx_.acquire(half_res, GPU_RG16F); + color_tx.current().acquire( + half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite_attach); + weight_tx.current().acquire(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite); + occlusion_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16_16); drw.submit(gather_ps, view); @@ -705,8 +713,9 @@ void DepthOfField::render(View &view, color_tx.swap(); weight_tx.swap(); - color_tx.current().acquire(half_res, GPU_RGBA16F, usage_readwrite_attach); - weight_tx.current().acquire(half_res, GPU_R16F, usage_readwrite); + color_tx.current().acquire( + half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite_attach); + weight_tx.current().acquire(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite); drw.submit(filter_ps, view); @@ -732,8 +741,8 @@ void DepthOfField::render(View &view, bokeh_gather_lut_tx_.release(); bokeh_scatter_lut_tx_.release(); - hole_fill_color_tx_.acquire(half_res, GPU_RGBA16F, usage_readwrite); - hole_fill_weight_tx_.acquire(half_res, GPU_R16F, usage_readwrite); + hole_fill_color_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_readwrite); + hole_fill_weight_tx_.acquire(half_res, gpu::TextureFormat::SFLOAT_16, usage_readwrite); drw.submit(hole_fill_ps_, view); diff --git a/source/blender/draw/engines/eevee/eevee_film.cc b/source/blender/draw/engines/eevee/eevee_film.cc index 74502fff3ac..6132355b600 100644 --- a/source/blender/draw/engines/eevee/eevee_film.cc +++ b/source/blender/draw/engines/eevee/eevee_film.cc @@ -494,11 +494,11 @@ void Film::init(const int2 &extent, const rcti *output_rect) data_.extent : int2(1); - eGPUTextureFormat color_format = GPU_RGBA16F; - eGPUTextureFormat float_format = GPU_R16F; - eGPUTextureFormat weight_format = GPU_R32F; - eGPUTextureFormat depth_format = GPU_R32F; - eGPUTextureFormat cryptomatte_format = GPU_RGBA32F; + gpu::TextureFormat color_format = gpu::TextureFormat::SFLOAT_16_16_16_16; + gpu::TextureFormat float_format = gpu::TextureFormat::SFLOAT_16; + gpu::TextureFormat weight_format = gpu::TextureFormat::SFLOAT_32; + gpu::TextureFormat depth_format = gpu::TextureFormat::SFLOAT_32; + gpu::TextureFormat cryptomatte_format = gpu::TextureFormat::SFLOAT_32_32_32_32; int reset = 0; reset += depth_tx_.ensure_2d(depth_format, data_.extent); diff --git a/source/blender/draw/engines/eevee/eevee_gbuffer.hh b/source/blender/draw/engines/eevee/eevee_gbuffer.hh index 285c9d48bab..e001c1aec36 100644 --- a/source/blender/draw/engines/eevee/eevee_gbuffer.hh +++ b/source/blender/draw/engines/eevee/eevee_gbuffer.hh @@ -161,15 +161,18 @@ struct GBuffer { data_count = max_ii(closure_fb_layer_count, data_count); normal_count = max_ii(normal_fb_layer_count, normal_count); - dummy_header_tx_.ensure_2d_array(GPU_R32UI, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); - dummy_closure_tx_.ensure_2d_array(GPU_RGB10_A2, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); - dummy_normal_tx_.ensure_2d_array(GPU_RG16, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); + dummy_header_tx_.ensure_2d_array( + gpu::TextureFormat::UINT_32, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); + dummy_closure_tx_.ensure_2d_array( + gpu::TextureFormat::UNORM_10_10_10_2, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); + dummy_normal_tx_.ensure_2d_array( + gpu::TextureFormat::UNORM_16_16, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_WRITE); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATTACHMENT; - header_tx.ensure_2d_array(GPU_R32UI, extent, header_count, usage); - closure_tx.ensure_2d_array(GPU_RGB10_A2, extent, data_count, usage); - normal_tx.ensure_2d_array(GPU_RG16, extent, normal_count, usage); + header_tx.ensure_2d_array(gpu::TextureFormat::UINT_32, extent, header_count, usage); + closure_tx.ensure_2d_array(gpu::TextureFormat::UNORM_10_10_10_2, extent, data_count, usage); + normal_tx.ensure_2d_array(gpu::TextureFormat::UNORM_16_16, extent, normal_count, usage); /* Ensure layer view for frame-buffer attachment. */ header_tx.ensure_layer_views(); closure_tx.ensure_layer_views(); diff --git a/source/blender/draw/engines/eevee/eevee_hizbuffer.cc b/source/blender/draw/engines/eevee/eevee_hizbuffer.cc index 41bd999166a..10c7d42eb60 100644 --- a/source/blender/draw/engines/eevee/eevee_hizbuffer.cc +++ b/source/blender/draw/engines/eevee/eevee_hizbuffer.cc @@ -24,7 +24,8 @@ void HiZBuffer::sync() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; for ([[maybe_unused]] const int i : IndexRange(hiz_tx_.size())) { - hiz_tx_.current().ensure_2d(GPU_R32F, hiz_extent, usage, nullptr, HIZ_MIP_COUNT); + hiz_tx_.current().ensure_2d( + gpu::TextureFormat::SFLOAT_32, hiz_extent, usage, nullptr, HIZ_MIP_COUNT); hiz_tx_.current().ensure_mip_views(); GPU_texture_mipmap_mode(hiz_tx_.current(), true, false); hiz_tx_.swap(); diff --git a/source/blender/draw/engines/eevee/eevee_lightprobe_planar.cc b/source/blender/draw/engines/eevee/eevee_lightprobe_planar.cc index 41b0b2f89d9..6a83423213d 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobe_planar.cc +++ b/source/blender/draw/engines/eevee/eevee_lightprobe_planar.cc @@ -82,8 +82,8 @@ void PlanarProbeModule::set_view(const draw::View &main_view, int2 main_view_ext } eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ; - radiance_tx_.ensure_2d_array(GPU_R11F_G11F_B10F, extent, layer_count, usage); - depth_tx_.ensure_2d_array(GPU_DEPTH_COMPONENT32F, extent, layer_count, usage); + radiance_tx_.ensure_2d_array(gpu::TextureFormat::UFLOAT_11_11_10, extent, layer_count, usage); + depth_tx_.ensure_2d_array(gpu::TextureFormat::SFLOAT_32_DEPTH, extent, layer_count, usage); depth_tx_.ensure_layer_views(); do_display_draw_ = inst_.draw_overlays && num_probes > 0; diff --git a/source/blender/draw/engines/eevee/eevee_lightprobe_sphere.cc b/source/blender/draw/engines/eevee/eevee_lightprobe_sphere.cc index fe514c20253..82b1876b37f 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobe_sphere.cc +++ b/source/blender/draw/engines/eevee/eevee_lightprobe_sphere.cc @@ -106,7 +106,7 @@ bool SphereProbeModule::ensure_atlas() * the resource bindings. */ eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ; - if (probes_tx_.ensure_2d_array(GPU_RGBA16F, + if (probes_tx_.ensure_2d_array(gpu::TextureFormat::SFLOAT_16_16_16_16, int2(SPHERE_PROBE_ATLAS_RES), instance_.light_probes.sphere_layer_count(), usage, @@ -168,7 +168,7 @@ void SphereProbeModule::end_sync() void SphereProbeModule::ensure_cubemap_render_target(int resolution) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_SHADER_READ; - cubemap_tx_.ensure_cube(GPU_RGBA16F, resolution, usage); + cubemap_tx_.ensure_cube(gpu::TextureFormat::SFLOAT_16_16_16_16, resolution, usage); /* TODO(fclem): deallocate it. */ } diff --git a/source/blender/draw/engines/eevee/eevee_lightprobe_volume.cc b/source/blender/draw/engines/eevee/eevee_lightprobe_volume.cc index 54f9117f2b3..cd7dee908bc 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobe_volume.cc +++ b/source/blender/draw/engines/eevee/eevee_lightprobe_volume.cc @@ -30,8 +30,8 @@ void VolumeProbeModule::init() /* This might become an option in the future. */ bool use_l2_band = false; int sh_coef_len = use_l2_band ? 9 : 4; - BLI_assert(VOLUME_PROBE_FORMAT == GPU_RGBA16F); - int texel_byte_size = 8; /* Assumes GPU_RGBA16F. */ + BLI_assert(gpu::TextureFormat::VOLUME_PROBE_FORMAT == gpu::TextureFormat::SFLOAT_16_16_16_16); + int texel_byte_size = 8; /* Assumes gpu::TextureFormat::SFLOAT_16_16_16_16. */ uint atlas_col_count = 0; uint atlas_row_count = 0; @@ -67,7 +67,8 @@ void VolumeProbeModule::init() constexpr eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - irradiance_atlas_tx_.ensure_3d(VOLUME_PROBE_FORMAT, atlas_extent, usage); + irradiance_atlas_tx_.ensure_3d( + gpu::TextureFormat::VOLUME_PROBE_FORMAT, atlas_extent, usage); if (irradiance_atlas_tx_.is_valid()) { do_full_update_ = true; irradiance_pool_size_alloc_ = irradiance_pool_size; @@ -327,25 +328,47 @@ void VolumeProbeModule::set_view(View & /*view*/) eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ; int3 grid_size = int3(cache->size); if (cache->baking.L0) { - irradiance_a_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L0); - irradiance_b_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_a); - irradiance_c_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_b); - irradiance_d_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_c); - validity_tx.ensure_3d(GPU_R16F, grid_size, usage, cache->baking.validity); + irradiance_a_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L0); + irradiance_b_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_a); + irradiance_c_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_b); + irradiance_d_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_c); + validity_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, cache->baking.validity); if (cache->baking.validity == nullptr) { /* Avoid displaying garbage data. */ validity_tx.clear(float4(0.0)); } } else if (cache->irradiance.L0) { - irradiance_a_tx.ensure_3d(GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L0); - irradiance_b_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_a); - irradiance_c_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_b); - irradiance_d_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_c); - validity_tx.ensure_3d(GPU_R8, grid_size, usage); + irradiance_a_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L0); + irradiance_b_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_a); + irradiance_c_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_b); + irradiance_d_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_c); + validity_tx.ensure_3d(gpu::TextureFormat::UNORM_8, grid_size, usage); if (cache->connectivity.validity) { /* TODO(fclem): Make texture creation API work with different data types. */ GPU_texture_update_sub(validity_tx, @@ -369,11 +392,11 @@ void VolumeProbeModule::set_view(View & /*view*/) inst_.info_append_i18n("Error: Could not allocate irradiance staging texture"); /* Avoid undefined behavior with uninitialized values. Still load a clear texture. */ const float4 zero(0.0f); - irradiance_a_tx.ensure_3d(GPU_RGB16F, int3(1), usage, zero); - irradiance_b_tx.ensure_3d(GPU_RGB16F, int3(1), usage, zero); - irradiance_c_tx.ensure_3d(GPU_RGB16F, int3(1), usage, zero); - irradiance_d_tx.ensure_3d(GPU_RGB16F, int3(1), usage, zero); - validity_tx.ensure_3d(GPU_R16F, int3(1), usage, zero); + irradiance_a_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, int3(1), usage, zero); + irradiance_b_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, int3(1), usage, zero); + irradiance_c_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, int3(1), usage, zero); + irradiance_d_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, int3(1), usage, zero); + validity_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16, int3(1), usage, zero); } bool visibility_available = cache->visibility.L0 != nullptr; @@ -384,10 +407,14 @@ void VolumeProbeModule::set_view(View & /*view*/) draw::Texture visibility_c_tx = {"visibility_c_tx"}; draw::Texture visibility_d_tx = {"visibility_d_tx"}; if (visibility_available) { - visibility_a_tx.ensure_3d(GPU_R16F, grid_size, usage, (const float *)cache->visibility.L0); - visibility_b_tx.ensure_3d(GPU_R16F, grid_size, usage, (const float *)cache->visibility.L1_a); - visibility_c_tx.ensure_3d(GPU_R16F, grid_size, usage, (const float *)cache->visibility.L1_b); - visibility_d_tx.ensure_3d(GPU_R16F, grid_size, usage, (const float *)cache->visibility.L1_c); + visibility_a_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, (const float *)cache->visibility.L0); + visibility_b_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, (const float *)cache->visibility.L1_a); + visibility_c_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, (const float *)cache->visibility.L1_b); + visibility_d_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, (const float *)cache->visibility.L1_c); GPU_texture_swizzle_set(visibility_a_tx, "111r"); GPU_texture_swizzle_set(visibility_b_tx, "111r"); @@ -547,10 +574,10 @@ void VolumeProbeModule::debug_pass_draw(View &view, GPUFrameBuffer *view_fb) const float *data; if (cache->baking.validity) { data = cache->baking.validity; - debug_data_tx.ensure_3d(GPU_R16F, grid_size, usage, data); + debug_data_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16, grid_size, usage, data); } else if (cache->connectivity.validity) { - debug_data_tx.ensure_3d(GPU_R8, grid_size, usage); + debug_data_tx.ensure_3d(gpu::TextureFormat::UNORM_8, grid_size, usage); /* TODO(fclem): Make texture creation API work with different data types. */ GPU_texture_update_sub(debug_data_tx, GPU_DATA_UBYTE, @@ -570,7 +597,8 @@ void VolumeProbeModule::debug_pass_draw(View &view, GPUFrameBuffer *view_fb) else { if (cache->baking.virtual_offset) { const float *data = (const float *)cache->baking.virtual_offset; - debug_data_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, data); + debug_data_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16_16_16_16, grid_size, usage, data); } else { continue; @@ -615,25 +643,47 @@ void VolumeProbeModule::display_pass_draw(View &view, GPUFrameBuffer *view_fb) eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ; int3 grid_size = int3(cache->size); if (cache->baking.L0) { - irradiance_a_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L0); - irradiance_b_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_a); - irradiance_c_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_b); - irradiance_d_tx.ensure_3d(GPU_RGBA16F, grid_size, usage, (const float *)cache->baking.L1_c); - validity_tx.ensure_3d(GPU_R16F, grid_size, usage, (const float *)cache->baking.validity); + irradiance_a_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L0); + irradiance_b_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_a); + irradiance_c_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_b); + irradiance_d_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16_16, + grid_size, + usage, + (const float *)cache->baking.L1_c); + validity_tx.ensure_3d( + gpu::TextureFormat::SFLOAT_16, grid_size, usage, (const float *)cache->baking.validity); if (cache->baking.validity == nullptr) { /* Avoid displaying garbage data. */ validity_tx.clear(float4(0.0)); } } else if (cache->irradiance.L0) { - irradiance_a_tx.ensure_3d(GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L0); - irradiance_b_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_a); - irradiance_c_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_b); - irradiance_d_tx.ensure_3d( - GPU_RGB16F, grid_size, usage, (const float *)cache->irradiance.L1_c); - validity_tx.ensure_3d(GPU_R8, grid_size, usage); + irradiance_a_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L0); + irradiance_b_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_a); + irradiance_c_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_b); + irradiance_d_tx.ensure_3d(gpu::TextureFormat::SFLOAT_16_16_16, + grid_size, + usage, + (const float *)cache->irradiance.L1_c); + validity_tx.ensure_3d(gpu::TextureFormat::UNORM_8, grid_size, usage); if (cache->connectivity.validity) { /* TODO(fclem): Make texture creation API work with different data types. */ GPU_texture_update_sub(validity_tx, @@ -927,12 +977,17 @@ void IrradianceBake::surfels_create(const Object &probe_object) /* 32bit float is needed here otherwise we loose too much energy from rounding error during the * accumulation when the sample count is above 500. */ - irradiance_L0_tx_.ensure_3d(GPU_RGBA32F, grid_resolution, texture_usage); - irradiance_L1_a_tx_.ensure_3d(GPU_RGBA32F, grid_resolution, texture_usage); - irradiance_L1_b_tx_.ensure_3d(GPU_RGBA32F, grid_resolution, texture_usage); - irradiance_L1_c_tx_.ensure_3d(GPU_RGBA32F, grid_resolution, texture_usage); - validity_tx_.ensure_3d(GPU_R32F, grid_resolution, texture_usage); - virtual_offset_tx_.ensure_3d(GPU_RGBA16F, grid_resolution, texture_usage); + irradiance_L0_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_32_32_32_32, grid_resolution, texture_usage); + irradiance_L1_a_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_32_32_32_32, grid_resolution, texture_usage); + irradiance_L1_b_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_32_32_32_32, grid_resolution, texture_usage); + irradiance_L1_c_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_32_32_32_32, grid_resolution, texture_usage); + validity_tx_.ensure_3d(gpu::TextureFormat::SFLOAT_32, grid_resolution, texture_usage); + virtual_offset_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_16_16_16_16, grid_resolution, texture_usage); if (!irradiance_L0_tx_.is_valid() || !irradiance_L1_a_tx_.is_valid() || !irradiance_L1_b_tx_.is_valid() || !irradiance_L1_c_tx_.is_valid() || @@ -1147,7 +1202,8 @@ void IrradianceBake::clusters_build() eGPUTextureUsage texture_usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATOMIC; - cluster_list_tx_.ensure_3d(GPU_R32I, capture_info_buf_.irradiance_grid_size, texture_usage); + cluster_list_tx_.ensure_3d( + gpu::TextureFormat::SINT_32, capture_info_buf_.irradiance_grid_size, texture_usage); cluster_list_tx_.clear(int4(-1)); /* View is not important here. It is only for validation. */ inst_.manager->submit(surfel_cluster_build_ps_, view_z_); diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.cc b/source/blender/draw/engines/eevee/eevee_lookdev.cc index 4be21ff58e5..18c9bd75b53 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.cc +++ b/source/blender/draw/engines/eevee/eevee_lookdev.cc @@ -220,9 +220,10 @@ void LookdevModule::init(const rcti *visible_rect) const int2 extent_dummy(1); constexpr eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ; - dummy_cryptomatte_tx_.ensure_2d(GPU_RGBA32F, extent_dummy, usage); - dummy_aov_color_tx_.ensure_2d_array(GPU_RGBA16F, extent_dummy, 1, usage); - dummy_aov_value_tx_.ensure_2d_array(GPU_R16F, extent_dummy, 1, usage); + dummy_cryptomatte_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_32_32_32_32, extent_dummy, usage); + dummy_aov_color_tx_.ensure_2d_array( + gpu::TextureFormat::SFLOAT_16_16_16_16, extent_dummy, 1, usage); + dummy_aov_value_tx_.ensure_2d_array(gpu::TextureFormat::SFLOAT_16, extent_dummy, 1, usage); } } @@ -261,7 +262,7 @@ void LookdevModule::sync() const float viewport_scale = calc_viewport_scale(); const int2 extent = int2(calc_sphere_extent(viewport_scale)); - const eGPUTextureFormat color_format = GPU_RGBA16F; + const gpu::TextureFormat color_format = gpu::TextureFormat::SFLOAT_16_16_16_16; for (int index : IndexRange(num_spheres)) { if (spheres_[index].color_tx_.ensure_2d(color_format, extent)) { diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.cc b/source/blender/draw/engines/eevee/eevee_motion_blur.cc index 2b7dfeb74df..608bb8f9b55 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.cc +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.cc @@ -149,9 +149,10 @@ void MotionBlurModule::sync() { /* Create max velocity tiles. */ PassSimple::Sub &sub = motion_blur_ps_.sub("TilesFlatten"); - eGPUTextureFormat vector_tx_format = inst_.render_buffers.vector_tx_format(); - eShaderType shader = vector_tx_format == GPU_RG16F ? MOTION_BLUR_TILE_FLATTEN_RG : - MOTION_BLUR_TILE_FLATTEN_RGBA; + gpu::TextureFormat vector_tx_format = inst_.render_buffers.vector_tx_format(); + eShaderType shader = vector_tx_format == gpu::TextureFormat::SFLOAT_16_16 ? + MOTION_BLUR_TILE_FLATTEN_RG : + MOTION_BLUR_TILE_FLATTEN_RGBA; sub.shader_set(inst_.shaders.static_shader_get(shader)); sub.bind_ubo("motion_blur_buf", data_); sub.bind_texture("depth_tx", &render_buffers.depth_tx); @@ -237,7 +238,7 @@ void MotionBlurModule::render(View &view, gpu::Texture **input_tx, gpu::Texture GPU_debug_group_begin("Motion Blur"); - tiles_tx_.acquire(tiles_extent, GPU_RGBA16F); + tiles_tx_.acquire(tiles_extent, gpu::TextureFormat::SFLOAT_16_16_16_16); tile_indirection_buf_.clear_to_zero(); diff --git a/source/blender/draw/engines/eevee/eevee_pipeline.cc b/source/blender/draw/engines/eevee/eevee_pipeline.cc index f89d67a39d6..77c6f36f189 100644 --- a/source/blender/draw/engines/eevee/eevee_pipeline.cc +++ b/source/blender/draw/engines/eevee/eevee_pipeline.cc @@ -96,10 +96,10 @@ void WorldPipeline::sync(GPUMaterial *gpumat) const int2 extent(1); constexpr eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_SHADER_READ; - dummy_cryptomatte_tx_.ensure_2d(GPU_RGBA32F, extent, usage); - dummy_renderpass_tx_.ensure_2d(GPU_RGBA16F, extent, usage); - dummy_aov_color_tx_.ensure_2d_array(GPU_RGBA16F, extent, 1, usage); - dummy_aov_value_tx_.ensure_2d_array(GPU_R16F, extent, 1, usage); + dummy_cryptomatte_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_32_32_32_32, extent, usage); + dummy_renderpass_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_16_16_16_16, extent, usage); + dummy_aov_color_tx_.ensure_2d_array(gpu::TextureFormat::SFLOAT_16_16_16_16, extent, 1, usage); + dummy_aov_value_tx_.ensure_2d_array(gpu::TextureFormat::SFLOAT_16, extent, 1, usage); PassSimple &pass = cubemap_face_ps_; pass.init(); @@ -850,8 +850,9 @@ gpu::Texture *DeferredLayer::render(View &main_view, inst_.manager->submit(gbuffer_ps_, render_view); for (int i = 0; i < ARRAY_SIZE(direct_radiance_txs_); i++) { - direct_radiance_txs_[i].acquire( - (closure_count_ > i) ? extent : int2(1), DEFERRED_RADIANCE_FORMAT, usage_rw); + direct_radiance_txs_[i].acquire((closure_count_ > i) ? extent : int2(1), + gpu::TextureFormat::DEFERRED_RADIANCE_FORMAT, + usage_rw); } if (use_raytracing_) { diff --git a/source/blender/draw/engines/eevee/eevee_pipeline.hh b/source/blender/draw/engines/eevee/eevee_pipeline.hh index 3bdfe3be86d..9e10ffaacc5 100644 --- a/source/blender/draw/engines/eevee/eevee_pipeline.hh +++ b/source/blender/draw/engines/eevee/eevee_pipeline.hh @@ -315,7 +315,7 @@ class DeferredLayer : DeferredLayerBase { DeferredLayer(Instance &inst) : inst_(inst) { float4 data(0.0f); - dummy_black.ensure_2d(RAYTRACE_RADIANCE_FORMAT, + dummy_black.ensure_2d(gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, int2(1), GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE, data); @@ -648,7 +648,7 @@ class UtilityTexture : public Texture { public: UtilityTexture() : Texture("UtilityTx", - GPU_RGBA16F, + gpu::TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_SHADER_READ, int2(lut_size), layer_count, diff --git a/source/blender/draw/engines/eevee/eevee_precompute.cc b/source/blender/draw/engines/eevee/eevee_precompute.cc index 1788aad8f7d..53fa98cf4be 100644 --- a/source/blender/draw/engines/eevee/eevee_precompute.cc +++ b/source/blender/draw/engines/eevee/eevee_precompute.cc @@ -18,7 +18,7 @@ Precompute::Precompute(draw::Manager &manager, PrecomputeType type, int3 table_e eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_HOST_READ; Texture table_tx = {"Precompute"}; - table_tx.ensure_3d(GPU_RGBA32F, table_extent, usage); + table_tx.ensure_3d(gpu::TextureFormat::SFLOAT_32_32_32_32, table_extent, usage); GPUShader *shader = GPU_shader_create_from_info_name("eevee_lut"); diff --git a/source/blender/draw/engines/eevee/eevee_raytrace.cc b/source/blender/draw/engines/eevee/eevee_raytrace.cc index 19b38634f4c..bd74efe2dda 100644 --- a/source/blender/draw/engines/eevee/eevee_raytrace.cc +++ b/source/blender/draw/engines/eevee/eevee_raytrace.cc @@ -39,7 +39,7 @@ void RayTraceModule::init() float4 data(0.0f); radiance_dummy_black_tx_.ensure_2d( - RAYTRACE_RADIANCE_FORMAT, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, data); + gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, data); } void RayTraceModule::sync() @@ -434,7 +434,7 @@ RayTraceResult RayTraceModule::render(RayTraceBuffer &rt_buffer, /* TODO(fclem): Use real max closure count from shader. */ const int closure_count = 3; - eGPUTextureFormat format = RAYTRACE_TILEMASK_FORMAT; + gpu::TextureFormat format = gpu::TextureFormat::RAYTRACE_TILEMASK_FORMAT; eGPUTextureUsage usage_rw = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; tile_raytrace_denoise_tx_.ensure_2d_array(format, denoise_tiles, closure_count, usage_rw); tile_raytrace_tracing_tx_.ensure_2d_array(format, raytrace_tiles, closure_count, usage_rw); @@ -492,14 +492,20 @@ RayTraceResult RayTraceModule::render(RayTraceBuffer &rt_buffer, if (use_horizon_scan) { GPU_debug_group_begin("Horizon Scan"); - downsampled_in_radiance_tx_.acquire(tracing_res_horizon, RAYTRACE_RADIANCE_FORMAT, usage_rw); - downsampled_in_normal_tx_.acquire(tracing_res_horizon, GPU_RGB10_A2, usage_rw); + downsampled_in_radiance_tx_.acquire( + tracing_res_horizon, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, usage_rw); + downsampled_in_normal_tx_.acquire( + tracing_res_horizon, gpu::TextureFormat::UNORM_10_10_10_2, usage_rw); - horizon_radiance_tx_[0].acquire(tracing_res_horizon, GPU_RGBA16F, usage_rw); - horizon_radiance_denoised_tx_[0].acquire(tracing_res_horizon, GPU_RGBA16F, usage_rw); + horizon_radiance_tx_[0].acquire( + tracing_res_horizon, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_rw); + horizon_radiance_denoised_tx_[0].acquire( + tracing_res_horizon, gpu::TextureFormat::SFLOAT_16_16_16_16, usage_rw); for (int i : IndexRange(1, 3)) { - horizon_radiance_tx_[i].acquire(tracing_res_horizon, GPU_RGBA8, usage_rw); - horizon_radiance_denoised_tx_[i].acquire(tracing_res_horizon, GPU_RGBA8, usage_rw); + horizon_radiance_tx_[i].acquire( + tracing_res_horizon, gpu::TextureFormat::UNORM_8_8_8_8, usage_rw); + horizon_radiance_denoised_tx_[i].acquire( + tracing_res_horizon, gpu::TextureFormat::UNORM_8_8_8_8, usage_rw); } for (int i : IndexRange(3)) { horizon_scan_output_tx_[i] = result.closures[i]; @@ -545,7 +551,8 @@ RayTraceResultTexture RayTraceModule::trace( if (!active_layer) { /* Early out. Release persistent buffers. Still acquire one dummy resource for validation. */ - denoise_buf->denoised_spatial_tx.acquire(int2(1), RAYTRACE_RADIANCE_FORMAT); + denoise_buf->denoised_spatial_tx.acquire(int2(1), + gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT); denoise_buf->radiance_history_tx.free(); denoise_buf->variance_history_tx.free(); denoise_buf->tilemask_history_tx.free(); @@ -596,9 +603,9 @@ RayTraceResultTexture RayTraceModule::trace( { /* Tracing rays. */ - ray_data_tx_.acquire(tracing_res, GPU_RGBA16F); - ray_time_tx_.acquire(tracing_res, RAYTRACE_RAYTIME_FORMAT); - ray_radiance_tx_.acquire(tracing_res, RAYTRACE_RADIANCE_FORMAT); + ray_data_tx_.acquire(tracing_res, gpu::TextureFormat::SFLOAT_16_16_16_16); + ray_time_tx_.acquire(tracing_res, gpu::TextureFormat::RAYTRACE_RAYTIME_FORMAT); + ray_radiance_tx_.acquire(tracing_res, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT); inst_.manager->submit(generate_ps_, render_view); if (tracing_method_ == RAYTRACE_EEVEE_METHOD_SCREEN) { @@ -616,9 +623,10 @@ RayTraceResultTexture RayTraceModule::trace( /* Spatial denoise pass is required to resolve at least one ray per pixel. */ { - denoise_buf->denoised_spatial_tx.acquire(extent, RAYTRACE_RADIANCE_FORMAT); - hit_variance_tx_.acquire(use_temporal_denoise ? extent : int2(1), RAYTRACE_VARIANCE_FORMAT); - hit_depth_tx_.acquire(use_temporal_denoise ? extent : int2(1), GPU_R32F); + denoise_buf->denoised_spatial_tx.acquire(extent, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT); + hit_variance_tx_.acquire(use_temporal_denoise ? extent : int2(1), + gpu::TextureFormat::RAYTRACE_VARIANCE_FORMAT); + hit_depth_tx_.acquire(use_temporal_denoise ? extent : int2(1), gpu::TextureFormat::SFLOAT_32); denoised_spatial_tx_ = denoise_buf->denoised_spatial_tx; inst_.manager->submit(denoise_spatial_ps_, render_view); @@ -631,17 +639,21 @@ RayTraceResultTexture RayTraceModule::trace( ray_radiance_tx_.release(); if (use_temporal_denoise) { - denoise_buf->denoised_temporal_tx.acquire(extent, RAYTRACE_RADIANCE_FORMAT, usage_rw); - denoise_variance_tx_.acquire( - use_bilateral_denoise ? extent : int2(1), RAYTRACE_VARIANCE_FORMAT, usage_rw); - denoise_buf->variance_history_tx.ensure_2d( - RAYTRACE_VARIANCE_FORMAT, use_bilateral_denoise ? extent : int2(1), usage_rw); - denoise_buf->tilemask_history_tx.ensure_2d_array(RAYTRACE_TILEMASK_FORMAT, + denoise_buf->denoised_temporal_tx.acquire( + extent, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, usage_rw); + denoise_variance_tx_.acquire(use_bilateral_denoise ? extent : int2(1), + gpu::TextureFormat::RAYTRACE_VARIANCE_FORMAT, + usage_rw); + denoise_buf->variance_history_tx.ensure_2d(gpu::TextureFormat::RAYTRACE_VARIANCE_FORMAT, + use_bilateral_denoise ? extent : int2(1), + usage_rw); + denoise_buf->tilemask_history_tx.ensure_2d_array(gpu::TextureFormat::RAYTRACE_TILEMASK_FORMAT, tile_raytrace_denoise_tx_.size().xy(), tile_raytrace_denoise_tx_.size().z, usage_rw); - if (denoise_buf->radiance_history_tx.ensure_2d(RAYTRACE_RADIANCE_FORMAT, extent, usage_rw) || + if (denoise_buf->radiance_history_tx.ensure_2d( + gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, extent, usage_rw) || denoise_buf->valid_history == false) { /* If viewport resolution changes, do not try to use history. */ @@ -674,7 +686,8 @@ RayTraceResultTexture RayTraceModule::trace( hit_depth_tx_.release(); if (use_bilateral_denoise) { - denoise_buf->denoised_bilateral_tx.acquire(extent, RAYTRACE_RADIANCE_FORMAT, usage_rw); + denoise_buf->denoised_bilateral_tx.acquire( + extent, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, usage_rw); denoised_bilateral_tx_ = denoise_buf->denoised_bilateral_tx; inst_.manager->submit(denoise_bilateral_ps_, render_view); @@ -703,7 +716,8 @@ RayTraceResult RayTraceModule::alloc_only(RayTraceBuffer &rt_buffer) RayTraceResult result; for (int i = 0; i < 3; i++) { RayTraceBuffer::DenoiseBuffer *denoise_buf = &rt_buffer.closures[i]; - denoise_buf->denoised_bilateral_tx.acquire(extent, RAYTRACE_RADIANCE_FORMAT, usage_rw); + denoise_buf->denoised_bilateral_tx.acquire( + extent, gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, usage_rw); result.closures[i] = {denoise_buf->denoised_bilateral_tx}; } return result; @@ -716,7 +730,8 @@ RayTraceResult RayTraceModule::alloc_dummy(RayTraceBuffer &rt_buffer) RayTraceResult result; for (int i = 0; i < 3; i++) { RayTraceBuffer::DenoiseBuffer *denoise_buf = &rt_buffer.closures[i]; - denoise_buf->denoised_bilateral_tx.acquire(int2(1), RAYTRACE_RADIANCE_FORMAT, usage_rw); + denoise_buf->denoised_bilateral_tx.acquire( + int2(1), gpu::TextureFormat::RAYTRACE_RADIANCE_FORMAT, usage_rw); result.closures[i] = {denoise_buf->denoised_bilateral_tx}; } return result; diff --git a/source/blender/draw/engines/eevee/eevee_raytrace.hh b/source/blender/draw/engines/eevee/eevee_raytrace.hh index 6f36fdc2c14..8226d65938d 100644 --- a/source/blender/draw/engines/eevee/eevee_raytrace.hh +++ b/source/blender/draw/engines/eevee/eevee_raytrace.hh @@ -69,7 +69,9 @@ struct RayTraceBuffer { gpu::Texture *feedback_ensure(bool is_dummy, int2 extent) { eGPUTextureUsage usage_rw = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; - if (radiance_feedback_tx.ensure_2d(GPU_RGBA16F, is_dummy ? int2(1) : extent, usage_rw)) { + if (radiance_feedback_tx.ensure_2d( + gpu::TextureFormat::SFLOAT_16_16_16_16, is_dummy ? int2(1) : extent, usage_rw)) + { radiance_feedback_tx.clear(float4(0.0f)); } return radiance_feedback_tx; diff --git a/source/blender/draw/engines/eevee/eevee_renderbuffers.cc b/source/blender/draw/engines/eevee/eevee_renderbuffers.cc index e1cbec518e3..b4bf07ee82c 100644 --- a/source/blender/draw/engines/eevee/eevee_renderbuffers.cc +++ b/source/blender/draw/engines/eevee/eevee_renderbuffers.cc @@ -66,10 +66,10 @@ void RenderBuffers::acquire(int2 extent) eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; /* Depth and combined are always needed. */ - depth_tx.ensure_2d(GPU_DEPTH32F_STENCIL8, extent, usage); + depth_tx.ensure_2d(gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, extent, usage); /* TODO(fclem): depth_tx should ideally be a texture from pool but we need stencil_view * which is currently unsupported by pool textures. */ - // depth_tx.acquire(extent, GPU_DEPTH32F_STENCIL8); + // depth_tx.acquire(extent, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); combined_tx.acquire(extent, color_format); eGPUTextureUsage usage_attachment_read_write = GPU_TEXTURE_USAGE_ATTACHMENT | @@ -79,7 +79,7 @@ void RenderBuffers::acquire(int2 extent) /* TODO(fclem): Make vector pass allocation optional if no TAA or motion blur is needed. */ vector_tx.acquire(extent, vector_tx_format(), usage_attachment_read_write); - const bool do_motion_vectors_swizzle = vector_tx_format() == GPU_RG16F; + const bool do_motion_vectors_swizzle = vector_tx_format() == gpu::TextureFormat::SFLOAT_16_16; if (do_motion_vectors_swizzle) { /* Change texture swizzling to avoid complexity in shaders. */ GPU_texture_swizzle_set(vector_tx, "rgrg"); @@ -97,7 +97,7 @@ void RenderBuffers::acquire(int2 extent) math::max(1, value_len), usage_attachment_read_write); - const eGPUTextureFormat cryptomatte_format = GPU_RGBA32F; + const gpu::TextureFormat cryptomatte_format = gpu::TextureFormat::SFLOAT_32_32_32_32; cryptomatte_tx.acquire(pass_extent(EEVEE_RENDER_PASS_CRYPTOMATTE_OBJECT | EEVEE_RENDER_PASS_CRYPTOMATTE_ASSET | EEVEE_RENDER_PASS_CRYPTOMATTE_MATERIAL), @@ -112,7 +112,7 @@ void RenderBuffers::release() // depth_tx.release(); combined_tx.release(); - const bool do_motion_vectors_swizzle = vector_tx_format() == GPU_RG16F; + const bool do_motion_vectors_swizzle = vector_tx_format() == gpu::TextureFormat::SFLOAT_16_16; if (do_motion_vectors_swizzle) { /* Reset swizzle since this texture might be reused in other places. */ GPU_texture_swizzle_set(vector_tx, "rgba"); @@ -122,7 +122,7 @@ void RenderBuffers::release() cryptomatte_tx.release(); } -eGPUTextureFormat RenderBuffers::vector_tx_format() +gpu::TextureFormat RenderBuffers::vector_tx_format() { const eViewLayerEEVEEPassType enabled_passes = inst_.film.enabled_passes_get(); bool do_full_vector_render_pass = ((enabled_passes & EEVEE_RENDER_PASS_VECTOR) || @@ -130,7 +130,8 @@ eGPUTextureFormat RenderBuffers::vector_tx_format() !inst_.is_viewport(); /* Only RG16F (`motion.prev`) for the viewport. */ - return do_full_vector_render_pass ? GPU_RGBA16F : GPU_RG16F; + return do_full_vector_render_pass ? gpu::TextureFormat::SFLOAT_16_16_16_16 : + gpu::TextureFormat::SFLOAT_16_16; } } // namespace blender::eevee diff --git a/source/blender/draw/engines/eevee/eevee_renderbuffers.hh b/source/blender/draw/engines/eevee/eevee_renderbuffers.hh index 8b0879d8fef..7dab0762cc2 100644 --- a/source/blender/draw/engines/eevee/eevee_renderbuffers.hh +++ b/source/blender/draw/engines/eevee/eevee_renderbuffers.hh @@ -24,8 +24,8 @@ class RenderBuffers { public: RenderBuffersInfoData &data; - static constexpr eGPUTextureFormat color_format = GPU_RGBA16F; - static constexpr eGPUTextureFormat float_format = GPU_R16F; + static constexpr gpu::TextureFormat color_format = gpu::TextureFormat::SFLOAT_16_16_16_16; + static constexpr gpu::TextureFormat float_format = gpu::TextureFormat::SFLOAT_16; Texture depth_tx; TextureFromPool combined_tx; @@ -75,7 +75,7 @@ class RenderBuffers { return extent_; } - eGPUTextureFormat vector_tx_format(); + gpu::TextureFormat vector_tx_format(); }; } // namespace blender::eevee diff --git a/source/blender/draw/engines/eevee/eevee_shadow.cc b/source/blender/draw/engines/eevee/eevee_shadow.cc index 5b51a60dbd7..da24eca10a1 100644 --- a/source/blender/draw/engines/eevee/eevee_shadow.cc +++ b/source/blender/draw/engines/eevee/eevee_shadow.cc @@ -157,7 +157,7 @@ ShadowTileMapPool::ShadowTileMapPool() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATTACHMENT; - tilemap_tx.ensure_2d(GPU_R32UI, extent, usage); + tilemap_tx.ensure_2d(gpu::TextureFormat::UINT_32, extent, usage); tilemap_tx.clear(uint4(0)); } @@ -1301,8 +1301,10 @@ void ShadowModule::set_view(View &view, int2 extent) } else if (shadow_technique == ShadowTechnique::TILE_COPY) { /* Create memoryless depth attachment for on-tile surface depth accumulation. */ - shadow_depth_fb_tx_.ensure_2d_array(GPU_DEPTH_COMPONENT32F, fb_size, fb_layers, usage); - shadow_depth_accum_tx_.ensure_2d_array(GPU_R32F, fb_size, fb_layers, usage); + shadow_depth_fb_tx_.ensure_2d_array( + gpu::TextureFormat::SFLOAT_32_DEPTH, fb_size, fb_layers, usage); + shadow_depth_accum_tx_.ensure_2d_array( + gpu::TextureFormat::SFLOAT_32, fb_size, fb_layers, usage); render_fb_.ensure(GPU_ATTACHMENT_TEXTURE(shadow_depth_fb_tx_), GPU_ATTACHMENT_TEXTURE(shadow_depth_accum_tx_)); } diff --git a/source/blender/draw/engines/eevee/eevee_shadow.hh b/source/blender/draw/engines/eevee/eevee_shadow.hh index 386accd287d..75c871f9010 100644 --- a/source/blender/draw/engines/eevee/eevee_shadow.hh +++ b/source/blender/draw/engines/eevee/eevee_shadow.hh @@ -260,7 +260,7 @@ class ShadowModule { /** \name Page Management * \{ */ - static constexpr eGPUTextureFormat atlas_type = GPU_R32UI; + static constexpr gpu::TextureFormat atlas_type = gpu::TextureFormat::UINT_32; /** Atlas containing all physical pages. */ Texture atlas_tx_ = {"shadow_atlas_tx_"}; diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.cc b/source/blender/draw/engines/eevee/eevee_subsurface.cc index 2a21c92d937..d47c9450524 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.cc +++ b/source/blender/draw/engines/eevee/eevee_subsurface.cc @@ -89,8 +89,8 @@ void SubsurfaceModule::render(gpu::Texture *direct_diffuse_light_tx, indirect_light_tx_ = indirect_diffuse_light_tx; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; - object_id_tx_.acquire(render_extent, SUBSURFACE_OBJECT_ID_FORMAT, usage); - radiance_tx_.acquire(render_extent, SUBSURFACE_RADIANCE_FORMAT, usage); + object_id_tx_.acquire(render_extent, gpu::TextureFormat::SUBSURFACE_OBJECT_ID_FORMAT, usage); + radiance_tx_.acquire(render_extent, gpu::TextureFormat::SUBSURFACE_RADIANCE_FORMAT, usage); convolve_dispatch_buf_.clear_to_zero(); diff --git a/source/blender/draw/engines/eevee/eevee_view.cc b/source/blender/draw/engines/eevee/eevee_view.cc index a2b87e7baee..548529e6a8a 100644 --- a/source/blender/draw/engines/eevee/eevee_view.cc +++ b/source/blender/draw/engines/eevee/eevee_view.cc @@ -185,7 +185,7 @@ gpu::Texture *ShadingView::render_postfx(gpu::Texture *input_tx) if (!inst_.depth_of_field.postfx_enabled() && !inst_.motion_blur.postfx_enabled()) { return input_tx; } - postfx_tx_.acquire(extent_, GPU_RGBA16F); + postfx_tx_.acquire(extent_, gpu::TextureFormat::SFLOAT_16_16_16_16); /* Fix a sync bug on AMD + Mesa when volume + motion blur create artifacts * except if there is a clear event between them. */ diff --git a/source/blender/draw/engines/eevee/eevee_volume.cc b/source/blender/draw/engines/eevee/eevee_volume.cc index e300dd42623..272e65dcdf8 100644 --- a/source/blender/draw/engines/eevee/eevee_volume.cc +++ b/source/blender/draw/engines/eevee/eevee_volume.cc @@ -203,17 +203,18 @@ void VolumeModule::end_sync() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATTACHMENT; - prop_scattering_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - prop_extinction_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - prop_emission_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); + prop_scattering_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + prop_extinction_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + prop_emission_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); /* We need 2 separate images to prevent bugs in Nvidia drivers (See #122454). */ - prop_phase_tx_.ensure_3d(GPU_R16F, data_.tex_size, usage); - prop_phase_weight_tx_.ensure_3d(GPU_R16F, data_.tex_size, usage); + prop_phase_tx_.ensure_3d(gpu::TextureFormat::SFLOAT_16, data_.tex_size, usage); + prop_phase_weight_tx_.ensure_3d(gpu::TextureFormat::SFLOAT_16, data_.tex_size, usage); int occupancy_layers = divide_ceil_u(data_.tex_size.z, 32u); eGPUTextureUsage occupancy_usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATOMIC; - occupancy_tx_.ensure_3d(GPU_R32UI, int3(data_.tex_size.xy(), occupancy_layers), occupancy_usage); + occupancy_tx_.ensure_3d( + gpu::TextureFormat::UINT_32, int3(data_.tex_size.xy(), occupancy_layers), occupancy_usage); { eGPUTextureUsage hit_count_usage = GPU_TEXTURE_USAGE_SHADER_READ | @@ -226,29 +227,35 @@ void VolumeModule::end_sync() hit_list_layer = clamp_i(inst_.scene->eevee.volumetric_ray_depth, 1, 16); hit_list_size = data_.tex_size.xy(); } - hit_depth_tx_.ensure_3d(GPU_R32F, int3(hit_list_size, hit_list_layer), hit_depth_usage); - if (hit_count_tx_.ensure_2d(GPU_R32UI, hit_list_size, hit_count_usage)) { + hit_depth_tx_.ensure_3d( + gpu::TextureFormat::SFLOAT_32, int3(hit_list_size, hit_list_layer), hit_depth_usage); + if (hit_count_tx_.ensure_2d(gpu::TextureFormat::UINT_32, hit_list_size, hit_count_usage)) { hit_count_tx_.clear(uint4(0u)); } } eGPUTextureUsage front_depth_usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - front_depth_tx_.ensure_2d(GPU_DEPTH32F_STENCIL8, data_.tex_size.xy(), front_depth_usage); + front_depth_tx_.ensure_2d( + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, data_.tex_size.xy(), front_depth_usage); occupancy_fb_.ensure(GPU_ATTACHMENT_TEXTURE(front_depth_tx_)); bool created = false; - created |= scatter_tx_.current().ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - created |= extinction_tx_.current().ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - created |= scatter_tx_.previous().ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - created |= extinction_tx_.previous().ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); + created |= scatter_tx_.current().ensure_3d( + gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + created |= extinction_tx_.current().ensure_3d( + gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + created |= scatter_tx_.previous().ensure_3d( + gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + created |= extinction_tx_.previous().ensure_3d( + gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); if (created) { valid_history_ = false; } - integrated_scatter_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); - integrated_transmit_tx_.ensure_3d(GPU_R11F_G11F_B10F, data_.tex_size, usage); + integrated_scatter_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); + integrated_transmit_tx_.ensure_3d(gpu::TextureFormat::UFLOAT_11_11_10, data_.tex_size, usage); /* Update references for bindings. */ result.scattering_tx_ = integrated_scatter_tx_; diff --git a/source/blender/draw/engines/eevee/eevee_volume.hh b/source/blender/draw/engines/eevee/eevee_volume.hh index d21a3548628..0b9f59ed8cf 100644 --- a/source/blender/draw/engines/eevee/eevee_volume.hh +++ b/source/blender/draw/engines/eevee/eevee_volume.hh @@ -122,8 +122,10 @@ class VolumeModule { public: VolumeModule(Instance &inst, VolumesInfoData &data) : inst_(inst), data_(data) { - dummy_scatter_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0.0f)); - dummy_transmit_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1.0f)); + dummy_scatter_tx_.ensure_3d( + gpu::TextureFormat::UNORM_8_8_8_8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0.0f)); + dummy_transmit_tx_.ensure_3d( + gpu::TextureFormat::UNORM_8_8_8_8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1.0f)); }; ~VolumeModule() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_ambient_occlusion_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_ambient_occlusion_info.hh index 44d9ba87685..de8a5c1d9bc 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_ambient_occlusion_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_ambient_occlusion_info.hh @@ -19,9 +19,9 @@ GPU_SHADER_CREATE_INFO(eevee_ambient_occlusion_pass) DEFINE("HORIZON_OCCLUSION") COMPUTE_SOURCE("eevee_ambient_occlusion_pass_comp.glsl") LOCAL_GROUP_SIZE(AMBIENT_OCCLUSION_PASS_TILE_SIZE, AMBIENT_OCCLUSION_PASS_TILE_SIZE) -IMAGE(0, GPU_RGBA16F, read, image2DArray, in_normal_img) +IMAGE(0, SFLOAT_16_16_16_16, read, image2DArray, in_normal_img) PUSH_CONSTANT(int, in_normal_img_layer_index) -IMAGE(1, GPU_R16F, write, image2DArray, out_ao_img) +IMAGE(1, SFLOAT_16, write, image2DArray, out_ao_img) PUSH_CONSTANT(int, out_ao_img_layer_index) SPECIALIZATION_CONSTANT(int, ao_slice_count, 2) SPECIALIZATION_CONSTANT(int, ao_step_count, 8) diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_common_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_common_info.hh index 2e975982090..c0c8d19eb1e 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_common_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_common_info.hh @@ -129,11 +129,11 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_volume_properties_data) ADDITIONAL_INFO(eevee_global_ubo) -IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, read, image3D, in_scattering_img) -IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, read, image3D, in_extinction_img) -IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, read, image3D, in_emission_img) -IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, read, image3D, in_phase_img) -IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, read, image3D, in_phase_weight_img) +IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, UFLOAT_11_11_10, read, image3D, in_scattering_img) +IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, UFLOAT_11_11_10, read, image3D, in_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, UFLOAT_11_11_10, read, image3D, in_emission_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, SFLOAT_16, read, image3D, in_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, SFLOAT_16, read, image3D, in_phase_weight_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_gbuffer_data) @@ -146,13 +146,13 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_render_pass_out) DEFINE("MAT_RENDER_PASS_SUPPORT") ADDITIONAL_INFO(eevee_global_ubo) -IMAGE_FREQ(RBUFS_COLOR_SLOT, GPU_RGBA16F, write, image2DArray, rp_color_img, PASS) -IMAGE_FREQ(RBUFS_VALUE_SLOT, GPU_R16F, write, image2DArray, rp_value_img, PASS) +IMAGE_FREQ(RBUFS_COLOR_SLOT, SFLOAT_16_16_16_16, write, image2DArray, rp_color_img, PASS) +IMAGE_FREQ(RBUFS_VALUE_SLOT, SFLOAT_16, write, image2DArray, rp_value_img, PASS) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_cryptomatte_out) STORAGE_BUF(CRYPTOMATTE_BUF_SLOT, read, float2, cryptomatte_object_buf[]) -IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, GPU_RGBA32F, write, image2D, rp_cryptomatte_img, PASS) +IMAGE_FREQ(RBUFS_CRYPTOMATTE_SLOT, SFLOAT_32_32_32_32, write, image2D, rp_cryptomatte_img, PASS) GPU_SHADER_CREATE_END() /** \} */ diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_deferred_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_deferred_info.hh index 81adc49fe59..c15f91cb7e6 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_deferred_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_deferred_info.hh @@ -31,7 +31,7 @@ GPU_SHADER_CREATE_INFO(eevee_deferred_thickness_amend) DO_STATIC_COMPILATION() DEFINE("GBUFFER_LOAD") SAMPLER(0, usampler2DArray, gbuf_header_tx) -IMAGE(0, GPU_RG16, read_write, image2DArray, gbuf_normal_img) +IMAGE(0, UNORM_16_16, read_write, image2DArray, gbuf_normal_img) /* Early fragment test is needed to discard fragment that do not need this processing. */ EARLY_FRAGMENT_TEST(true) FRAGMENT_SOURCE("eevee_deferred_thickness_amend_frag.glsl") @@ -118,7 +118,7 @@ SAMPLER(4, usampler2D, direct_radiance_3_tx) SAMPLER(5, sampler2D, indirect_radiance_1_tx) SAMPLER(6, sampler2D, indirect_radiance_2_tx) SAMPLER(7, sampler2D, indirect_radiance_3_tx) -IMAGE(5, GPU_RGBA16F, read_write, image2D, radiance_feedback_img) +IMAGE(5, SFLOAT_16_16_16_16, read_write, image2D, radiance_feedback_img) FRAGMENT_OUT(0, float4, out_combined) ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(eevee_gbuffer_data) diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_depth_of_field_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_depth_of_field_info.hh index 457f1ae9621..10922557855 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_depth_of_field_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_depth_of_field_info.hh @@ -21,8 +21,8 @@ #include "gpu_shader_create_info.hh" GPU_SHADER_CREATE_INFO(eevee_depth_of_field_tiles_common) -IMAGE(0, GPU_R11F_G11F_B10F, read, image2D, in_tiles_fg_img) -IMAGE(1, GPU_R11F_G11F_B10F, read, image2D, in_tiles_bg_img) +IMAGE(0, UFLOAT_11_11_10, read, image2D, in_tiles_fg_img) +IMAGE(1, UFLOAT_11_11_10, read, image2D, in_tiles_bg_img) GPU_SHADER_CREATE_END() /* -------------------------------------------------------------------- */ @@ -35,9 +35,9 @@ LOCAL_GROUP_SIZE(DOF_BOKEH_LUT_SIZE, DOF_BOKEH_LUT_SIZE) ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(draw_view) UNIFORM_BUF(6, DepthOfFieldData, dof_buf) -IMAGE(0, GPU_RG16F, write, image2D, out_gather_lut_img) -IMAGE(1, GPU_R16F, write, image2D, out_scatter_lut_img) -IMAGE(2, GPU_R16F, write, image2D, out_resolve_lut_img) +IMAGE(0, SFLOAT_16_16, write, image2D, out_gather_lut_img) +IMAGE(1, SFLOAT_16, write, image2D, out_scatter_lut_img) +IMAGE(2, SFLOAT_16, write, image2D, out_resolve_lut_img) COMPUTE_SOURCE("eevee_depth_of_field_bokeh_lut_comp.glsl") GPU_SHADER_CREATE_END() @@ -49,8 +49,8 @@ ADDITIONAL_INFO(draw_view) UNIFORM_BUF(6, DepthOfFieldData, dof_buf) SAMPLER(0, sampler2D, color_tx) SAMPLER(1, sampler2DDepth, depth_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, out_color_img) -IMAGE(1, GPU_R16F, write, image2D, out_coc_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, out_color_img) +IMAGE(1, SFLOAT_16, write, image2D, out_coc_img) COMPUTE_SOURCE("eevee_depth_of_field_setup_comp.glsl") GPU_SHADER_CREATE_END() @@ -67,9 +67,9 @@ SAMPLER(2, sampler2D, velocity_tx) SAMPLER(3, sampler2D, in_history_tx) SAMPLER(4, sampler2DDepth, depth_tx) PUSH_CONSTANT(bool, u_use_history) -IMAGE(0, GPU_RGBA16F, write, image2D, out_color_img) -IMAGE(1, GPU_R16F, write, image2D, out_coc_img) -IMAGE(2, GPU_RGBA16F, write, image2D, out_history_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, out_color_img) +IMAGE(1, SFLOAT_16, write, image2D, out_coc_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, out_history_img) COMPUTE_SOURCE("eevee_depth_of_field_stabilize_comp.glsl") GPU_SHADER_CREATE_END() @@ -80,7 +80,7 @@ ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(draw_view) SAMPLER(0, sampler2D, color_tx) SAMPLER(1, sampler2D, coc_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, out_color_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, out_color_img) COMPUTE_SOURCE("eevee_depth_of_field_downsample_comp.glsl") GPU_SHADER_CREATE_END() @@ -95,14 +95,14 @@ STORAGE_BUF(0, write, ScatterRect, scatter_fg_list_buf[]) STORAGE_BUF(1, write, ScatterRect, scatter_bg_list_buf[]) STORAGE_BUF(2, read_write, DrawCommand, scatter_fg_indirect_buf) STORAGE_BUF(3, read_write, DrawCommand, scatter_bg_indirect_buf) -IMAGE(0, GPU_RGBA16F, read_write, image2D, inout_color_lod0_img) -IMAGE(1, GPU_RGBA16F, write, image2D, out_color_lod1_img) -IMAGE(2, GPU_RGBA16F, write, image2D, out_color_lod2_img) -IMAGE(3, GPU_RGBA16F, write, image2D, out_color_lod3_img) -IMAGE(4, GPU_R16F, read, image2D, in_coc_lod0_img) -IMAGE(5, GPU_R16F, write, image2D, out_coc_lod1_img) -IMAGE(6, GPU_R16F, write, image2D, out_coc_lod2_img) -IMAGE(7, GPU_R16F, write, image2D, out_coc_lod3_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, inout_color_lod0_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2D, out_color_lod1_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, out_color_lod2_img) +IMAGE(3, SFLOAT_16_16_16_16, write, image2D, out_color_lod3_img) +IMAGE(4, SFLOAT_16, read, image2D, in_coc_lod0_img) +IMAGE(5, SFLOAT_16, write, image2D, out_coc_lod1_img) +IMAGE(6, SFLOAT_16, write, image2D, out_coc_lod2_img) +IMAGE(7, SFLOAT_16, write, image2D, out_coc_lod3_img) COMPUTE_SOURCE("eevee_depth_of_field_reduce_comp.glsl") GPU_SHADER_CREATE_END() @@ -118,8 +118,8 @@ LOCAL_GROUP_SIZE(DOF_TILES_FLATTEN_GROUP_SIZE, DOF_TILES_FLATTEN_GROUP_SIZE) ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(draw_view) SAMPLER(0, sampler2D, coc_tx) -IMAGE(2, GPU_R11F_G11F_B10F, write, image2D, out_tiles_fg_img) -IMAGE(3, GPU_R11F_G11F_B10F, write, image2D, out_tiles_bg_img) +IMAGE(2, UFLOAT_11_11_10, write, image2D, out_tiles_fg_img) +IMAGE(3, UFLOAT_11_11_10, write, image2D, out_tiles_bg_img) COMPUTE_SOURCE("eevee_depth_of_field_tiles_flatten_comp.glsl") GPU_SHADER_CREATE_END() @@ -128,8 +128,8 @@ ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_depth_of_field_tiles_common) LOCAL_GROUP_SIZE(DOF_TILES_DILATE_GROUP_SIZE, DOF_TILES_DILATE_GROUP_SIZE) -IMAGE(2, GPU_R11F_G11F_B10F, write, image2D, out_tiles_fg_img) -IMAGE(3, GPU_R11F_G11F_B10F, write, image2D, out_tiles_bg_img) +IMAGE(2, UFLOAT_11_11_10, write, image2D, out_tiles_fg_img) +IMAGE(3, UFLOAT_11_11_10, write, image2D, out_tiles_bg_img) PUSH_CONSTANT(int, ring_count) PUSH_CONSTANT(int, ring_width_multiplier) COMPUTE_SOURCE("eevee_depth_of_field_tiles_dilate_comp.glsl") @@ -198,12 +198,12 @@ LOCAL_GROUP_SIZE(DOF_GATHER_GROUP_SIZE, DOF_GATHER_GROUP_SIZE) SAMPLER(0, sampler2D, color_tx) SAMPLER(1, sampler2D, color_bilinear_tx) SAMPLER(2, sampler2D, coc_tx) -IMAGE(2, GPU_RGBA16F, write, image2D, out_color_img) -IMAGE(3, GPU_R16F, write, image2D, out_weight_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, out_color_img) +IMAGE(3, SFLOAT_16, write, image2D, out_weight_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_depth_of_field_gather) -IMAGE(4, GPU_RG16F, write, image2D, out_occlusion_img) +IMAGE(4, SFLOAT_16_16, write, image2D, out_occlusion_img) COMPUTE_SOURCE("eevee_depth_of_field_gather_comp.glsl") ADDITIONAL_INFO(eevee_depth_of_field_gather_common) GPU_SHADER_CREATE_END() @@ -223,8 +223,8 @@ LOCAL_GROUP_SIZE(DOF_FILTER_GROUP_SIZE, DOF_FILTER_GROUP_SIZE) ADDITIONAL_INFO(eevee_shared) SAMPLER(0, sampler2D, color_tx) SAMPLER(1, sampler2D, weight_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, out_color_img) -IMAGE(1, GPU_R16F, write, image2D, out_weight_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, out_color_img) +IMAGE(1, SFLOAT_16, write, image2D, out_weight_img) COMPUTE_SOURCE("eevee_depth_of_field_filter_comp.glsl") GPU_SHADER_CREATE_END() @@ -292,7 +292,7 @@ SAMPLER(7, sampler2D, weight_bg_tx) SAMPLER(8, sampler2D, weight_fg_tx) SAMPLER(9, sampler2D, weight_hole_fill_tx) SAMPLER(10, sampler2D, stable_color_tx) -IMAGE(2, GPU_RGBA16F, write, image2D, out_color_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, out_color_img) COMPUTE_SOURCE("eevee_depth_of_field_resolve_comp.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_film_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_film_info.hh index c2000128224..006ccea1b09 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_film_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_film_info.hh @@ -25,8 +25,8 @@ SAMPLER(4, sampler2DArray, rp_value_tx) /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ SAMPLER(5, sampler2D, in_combined_tx) SAMPLER(6, sampler2D, cryptomatte_tx) -IMAGE(0, GPU_R32F, read, image2DArray, in_weight_img) -IMAGE(1, GPU_R32F, write, image2DArray, out_weight_img) +IMAGE(0, SFLOAT_32, read, image2DArray, in_weight_img) +IMAGE(1, SFLOAT_32, write, image2DArray, out_weight_img) SPECIALIZATION_CONSTANT(uint, enabled_categories, 1) SPECIALIZATION_CONSTANT(int, samples_len, 9) SPECIALIZATION_CONSTANT(bool, use_reprojection, true) @@ -42,12 +42,12 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film) /* Color History for TAA needs to be sampler to leverage bilinear sampling. */ -// IMAGE(2, GPU_RGBA16F, read, image2D, in_combined_img) -IMAGE(3, GPU_RGBA16F, write, image2D, out_combined_img) -IMAGE(4, GPU_R32F, read_write, image2D, depth_img) -IMAGE(5, GPU_RGBA16F, read_write, image2DArray, color_accum_img) -IMAGE(6, GPU_R16F, read_write, image2DArray, value_accum_img) -IMAGE(7, GPU_RGBA32F, read_write, image2DArray, cryptomatte_img) +// IMAGE(2, SFLOAT_16_16_16_16, read, image2D, in_combined_img) +IMAGE(3, SFLOAT_16_16_16_16, write, image2D, out_combined_img) +IMAGE(4, SFLOAT_32, read_write, image2D, depth_img) +IMAGE(5, SFLOAT_16_16_16_16, read_write, image2DArray, color_accum_img) +IMAGE(6, SFLOAT_16, read_write, image2DArray, value_accum_img) +IMAGE(7, SFLOAT_32_32_32_32, read_write, image2DArray, cryptomatte_img) ADDITIONAL_INFO(eevee_film_base) GPU_SHADER_CREATE_END() @@ -69,7 +69,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_cryptomatte_post) DO_STATIC_COMPILATION() -IMAGE(0, GPU_RGBA32F, read_write, image2DArray, cryptomatte_img) +IMAGE(0, SFLOAT_32_32_32_32, read_write, image2DArray, cryptomatte_img) PUSH_CONSTANT(int, cryptomatte_layer_len) PUSH_CONSTANT(int, cryptomatte_samples_per_layer) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) @@ -80,11 +80,11 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_film_copy_frag) DO_STATIC_COMPILATION() -IMAGE(3, GPU_RGBA16F, read, image2D, out_combined_img) -IMAGE(4, GPU_R32F, read, image2D, depth_img) -IMAGE(5, GPU_RGBA16F, read, image2DArray, color_accum_img) -IMAGE(6, GPU_R16F, read, image2DArray, value_accum_img) -IMAGE(7, GPU_RGBA32F, read, image2DArray, cryptomatte_img) +IMAGE(3, SFLOAT_16_16_16_16, read, image2D, out_combined_img) +IMAGE(4, SFLOAT_32, read, image2D, depth_img) +IMAGE(5, SFLOAT_16_16_16_16, read, image2DArray, color_accum_img) +IMAGE(6, SFLOAT_16, read, image2DArray, value_accum_img) +IMAGE(7, SFLOAT_32_32_32_32, read, image2DArray, cryptomatte_img) DEPTH_WRITE(DepthWrite::ANY) FRAGMENT_OUT(0, float4, out_color) FRAGMENT_SOURCE("eevee_film_copy_frag.glsl") @@ -93,55 +93,60 @@ ADDITIONAL_INFO(gpu_fullscreen) ADDITIONAL_INFO(eevee_film_base) GPU_SHADER_CREATE_END() -/* The combined pass is stored into its own 2D texture with a format of GPU_RGBA16F. */ +/* The combined pass is stored into its own 2D texture with a format of + * SFLOAT_16_16_16_16. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_combined) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) PUSH_CONSTANT(int2, offset) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() -/* The depth pass is stored into its own 2D texture with a format of GPU_R32F. */ +/* The depth pass is stored into its own 2D texture with a format of + * SFLOAT_32. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_depth) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) PUSH_CONSTANT(int2, offset) SAMPLER(0, sampler2D, input_tx) -IMAGE(0, GPU_R32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32, write, image2D, output_img) COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() -/* Value passes are stored in a slice of a 2D texture array with a format of GPU_R16F. */ +/* Value passes are stored in a slice of a 2D texture array with a format of + * SFLOAT_16. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_value) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) PUSH_CONSTANT(int2, offset) DEFINE("IS_ARRAY_INPUT") SAMPLER(0, sampler2DArray, input_tx) -IMAGE(0, GPU_R16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16, write, image2D, output_img) COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() -/* Color passes are stored in a slice of a 2D texture array with a format of GPU_RGBA16F. */ +/* Color passes are stored in a slice of a 2D texture array with a format of + * SFLOAT_16_16_16_16. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_color) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) PUSH_CONSTANT(int2, offset) DEFINE("IS_ARRAY_INPUT") SAMPLER(0, sampler2DArray, input_tx) -IMAGE(0, GPU_RGBA16F, write, image2D, output_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, output_img) COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() -/* Cryptomatte passes are stored in a slice of a 2D texture array with a format of GPU_RGBA32F. */ +/* Cryptomatte passes are stored in a slice of a 2D texture array with a format of + * SFLOAT_32_32_32_32. */ GPU_SHADER_CREATE_INFO(eevee_film_pass_convert_cryptomatte) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) PUSH_CONSTANT(int2, offset) DEFINE("IS_ARRAY_INPUT") SAMPLER(0, sampler2DArray, input_tx) -IMAGE(0, GPU_RGBA32F, write, image2D, output_img) +IMAGE(0, SFLOAT_32_32_32_32, write, image2D, output_img) COMPUTE_SOURCE("eevee_film_pass_convert_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_hiz_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_hiz_info.hh index ca6a6da0f43..6cfca0b2f1c 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_hiz_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_hiz_info.hh @@ -17,13 +17,13 @@ GPU_SHADER_CREATE_INFO(eevee_hiz_update_base) LOCAL_GROUP_SIZE(FILM_GROUP_SIZE, FILM_GROUP_SIZE) STORAGE_BUF(0, read_write, uint, finished_tile_counter) -IMAGE(0, GPU_R32F, write, image2D, out_mip_0) -IMAGE(1, GPU_R32F, write, image2D, out_mip_1) -IMAGE(2, GPU_R32F, write, image2D, out_mip_2) -IMAGE(3, GPU_R32F, write, image2D, out_mip_3) -IMAGE(4, GPU_R32F, write, image2D, out_mip_4) -IMAGE(5, GPU_R32F, read_write, image2D, out_mip_5) -IMAGE(6, GPU_R32F, write, image2D, out_mip_6) +IMAGE(0, SFLOAT_32, write, image2D, out_mip_0) +IMAGE(1, SFLOAT_32, write, image2D, out_mip_1) +IMAGE(2, SFLOAT_32, write, image2D, out_mip_2) +IMAGE(3, SFLOAT_32, write, image2D, out_mip_3) +IMAGE(4, SFLOAT_32, write, image2D, out_mip_4) +IMAGE(5, SFLOAT_32, read_write, image2D, out_mip_5) +IMAGE(6, SFLOAT_32, write, image2D, out_mip_6) SPECIALIZATION_CONSTANT(bool, update_mip_0, true) COMPUTE_SOURCE("eevee_hiz_update_comp.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_sphere_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_sphere_info.hh index 899d2036faf..25b9f63ecb1 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_sphere_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_sphere_info.hh @@ -30,7 +30,7 @@ SAMPLER(0, samplerCube, cubemap_tx) SAMPLER(1, sampler2DArray, atlas_tx) STORAGE_BUF(0, write, SphereProbeHarmonic, out_sh[]) STORAGE_BUF(1, write, SphereProbeSunLight, out_sun[]) -IMAGE(0, GPU_RGBA16F, write, image2DArray, atlas_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2DArray, atlas_img) COMPUTE_SOURCE("eevee_lightprobe_sphere_remap_comp.glsl") ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(eevee_global_ubo) @@ -78,7 +78,7 @@ PUSH_CONSTANT(int4, read_coord_packed) PUSH_CONSTANT(int, read_lod) SAMPLER(0, samplerCube, cubemap_tx) SAMPLER(1, sampler2DArray, in_atlas_mip_tx) -IMAGE(1, GPU_RGBA16F, write, image2DArray, out_atlas_mip_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2DArray, out_atlas_mip_img) COMPUTE_SOURCE("eevee_lightprobe_sphere_convolve_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_volume_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_volume_info.hh index c055cf24d7e..83357f9b3c9 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_volume_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_lightprobe_volume_info.hh @@ -112,7 +112,7 @@ BUILTINS(BuiltinBits::TEXTURE_ATOMIC) ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(eevee_surfel_common) ADDITIONAL_INFO(draw_view) -IMAGE(0, GPU_R32I, read_write, iimage3DAtomic, cluster_list_img) +IMAGE(0, SINT_32, read_write, iimage3DAtomic, cluster_list_img) COMPUTE_SOURCE("eevee_surfel_cluster_build_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -174,12 +174,12 @@ ADDITIONAL_INFO(draw_view) PUSH_CONSTANT(int, radiance_src) STORAGE_BUF(0, read, int, list_start_buf[]) STORAGE_BUF(6, read, SurfelListInfoData, list_info_buf) -IMAGE(0, GPU_RGBA32F, read_write, image3D, irradiance_L0_img) -IMAGE(1, GPU_RGBA32F, read_write, image3D, irradiance_L1_a_img) -IMAGE(2, GPU_RGBA32F, read_write, image3D, irradiance_L1_b_img) -IMAGE(3, GPU_RGBA32F, read_write, image3D, irradiance_L1_c_img) -IMAGE(4, GPU_RGBA16F, read, image3D, virtual_offset_img) -IMAGE(5, GPU_R32F, read_write, image3D, validity_img) +IMAGE(0, SFLOAT_32_32_32_32, read_write, image3D, irradiance_L0_img) +IMAGE(1, SFLOAT_32_32_32_32, read_write, image3D, irradiance_L1_a_img) +IMAGE(2, SFLOAT_32_32_32_32, read_write, image3D, irradiance_L1_b_img) +IMAGE(3, SFLOAT_32_32_32_32, read_write, image3D, irradiance_L1_c_img) +IMAGE(4, SFLOAT_16_16_16_16, read, image3D, virtual_offset_img) +IMAGE(5, SFLOAT_32, read_write, image3D, validity_img) COMPUTE_SOURCE("eevee_lightprobe_volume_ray_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -193,8 +193,8 @@ ADDITIONAL_INFO(eevee_surfel_common) ADDITIONAL_INFO(draw_view) STORAGE_BUF(0, read, int, list_start_buf[]) STORAGE_BUF(6, read, SurfelListInfoData, list_info_buf) -IMAGE(0, GPU_R32I, read, iimage3DAtomic, cluster_list_img) -IMAGE(1, GPU_RGBA16F, read_write, image3D, virtual_offset_img) +IMAGE(0, SINT_32, read, iimage3DAtomic, cluster_list_img) +IMAGE(1, SFLOAT_16_16_16_16, read_write, image3D, virtual_offset_img) COMPUTE_SOURCE("eevee_lightprobe_volume_offset_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_lut_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_lut_info.hh index 548e58ad7af..cc7f68889ae 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_lut_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_lut_info.hh @@ -16,7 +16,7 @@ GPU_SHADER_CREATE_INFO(eevee_lut) LOCAL_GROUP_SIZE(LUT_WORKGROUP_SIZE, LUT_WORKGROUP_SIZE, 1) PUSH_CONSTANT(int, table_type) PUSH_CONSTANT(int3, table_extent) -IMAGE(0, GPU_RGBA32F, read_write, image3D, table_img) +IMAGE(0, SFLOAT_32_32_32_32, read_write, image3D, table_img) ADDITIONAL_INFO(eevee_shared) COMPUTE_SOURCE("eevee_lut_comp.glsl") DO_STATIC_COMPILATION() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh index d2171631a5a..b58921d675a 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_material_info.hh @@ -164,10 +164,10 @@ FRAGMENT_OUT(3, float4, out_gbuf_closure1) FRAGMENT_OUT(4, float4, out_gbuf_closure2) /* Everything is stored inside a two layered target, one for each format. This is to fit the * limitation of the number of images we can bind on a single shader. */ -IMAGE_FREQ(GBUF_CLOSURE_SLOT, GPU_RGB10_A2, write, image2DArray, out_gbuf_closure_img, PASS) -IMAGE_FREQ(GBUF_NORMAL_SLOT, GPU_RG16, write, image2DArray, out_gbuf_normal_img, PASS) +IMAGE_FREQ(GBUF_CLOSURE_SLOT, UNORM_10_10_10_2, write, image2DArray, out_gbuf_closure_img, PASS) +IMAGE_FREQ(GBUF_NORMAL_SLOT, UNORM_16_16, write, image2DArray, out_gbuf_normal_img, PASS) /* Storage for additional infos that are shared across closures. */ -IMAGE_FREQ(GBUF_HEADER_SLOT, GPU_R32UI, write, uimage2DArray, out_gbuf_header_img, PASS) +IMAGE_FREQ(GBUF_HEADER_SLOT, UINT_32, write, uimage2DArray, out_gbuf_header_img, PASS) /* Added at runtime because of test shaders not having `node_tree`. */ // ADDITIONAL_INFO(eevee_render_pass_out) // ADDITIONAL_INFO(eevee_cryptomatte_out) @@ -284,7 +284,7 @@ DEFINE("SHADOW_UPDATE_ATOMIC_RASTER") BUILTINS(BuiltinBits::TEXTURE_ATOMIC) VERTEX_OUT(eevee_surf_shadow_atomic_iface) STORAGE_BUF(SHADOW_RENDER_MAP_BUF_SLOT, read, uint, render_map_buf[SHADOW_RENDER_MAP_SIZE]) -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, read_write, uimage2DArrayAtomic, shadow_atlas_img) +IMAGE(SHADOW_ATLAS_IMG_SLOT, UINT_32, read_write, uimage2DArrayAtomic, shadow_atlas_img) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_surf_shadow_tbdr) @@ -311,12 +311,12 @@ GPU_SHADER_CREATE_INFO(eevee_surf_volume) DEFINE("MAT_VOLUME") /* Only the front fragments have to be invoked. */ EARLY_FRAGMENT_TEST(true) -IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, GPU_R11F_G11F_B10F, read_write, image3D, out_scattering_img) -IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, GPU_R11F_G11F_B10F, read_write, image3D, out_extinction_img) -IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, GPU_R11F_G11F_B10F, read_write, image3D, out_emissive_img) -IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, GPU_R16F, read_write, image3D, out_phase_img) -IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, GPU_R16F, read_write, image3D, out_phase_weight_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, read, uimage3DAtomic, occupancy_img) +IMAGE(VOLUME_PROP_SCATTERING_IMG_SLOT, UFLOAT_11_11_10, read_write, image3D, out_scattering_img) +IMAGE(VOLUME_PROP_EXTINCTION_IMG_SLOT, UFLOAT_11_11_10, read_write, image3D, out_extinction_img) +IMAGE(VOLUME_PROP_EMISSION_IMG_SLOT, UFLOAT_11_11_10, read_write, image3D, out_emissive_img) +IMAGE(VOLUME_PROP_PHASE_IMG_SLOT, SFLOAT_16, read_write, image3D, out_phase_img) +IMAGE(VOLUME_PROP_PHASE_WEIGHT_IMG_SLOT, SFLOAT_16, read_write, image3D, out_phase_weight_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, UINT_32, read, uimage3DAtomic, occupancy_img) FRAGMENT_SOURCE("eevee_surf_volume_frag.glsl") ADDITIONAL_INFO(draw_modelmat_common) ADDITIONAL_INFO(draw_view) @@ -332,9 +332,9 @@ DEFINE("MAT_OCCUPANCY") EARLY_FRAGMENT_TEST(false) BUILTINS(BuiltinBits::TEXTURE_ATOMIC) PUSH_CONSTANT(bool, use_fast_method) -IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, write, image3D, hit_depth_img) -IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, read_write, uimage2DAtomic, hit_count_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, read_write, uimage3DAtomic, occupancy_img) +IMAGE(VOLUME_HIT_DEPTH_SLOT, SFLOAT_32, write, image3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, UINT_32, read_write, uimage2DAtomic, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, UINT_32, read_write, uimage3DAtomic, occupancy_img) FRAGMENT_SOURCE("eevee_surf_occupancy_frag.glsl") ADDITIONAL_INFO(eevee_global_ubo) ADDITIONAL_INFO(eevee_sampling_data) diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_motion_blur_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_motion_blur_info.hh index ee1b5807cf3..66a7af8047d 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_motion_blur_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_motion_blur_info.hh @@ -21,20 +21,20 @@ ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_velocity_camera) UNIFORM_BUF(6, MotionBlurData, motion_blur_buf) SAMPLER(0, sampler2DDepth, depth_tx) -IMAGE(1, GPU_RGBA16F, write, image2D, out_tiles_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2D, out_tiles_img) COMPUTE_SOURCE("eevee_motion_blur_flatten_comp.glsl") GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rg) DO_STATIC_COMPILATION() DEFINE("FLATTEN_RG") -IMAGE(0, GPU_RG16F, read_write, image2D, velocity_img) +IMAGE(0, SFLOAT_16_16, read_write, image2D, velocity_img) ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_motion_blur_tiles_flatten_rgba) DO_STATIC_COMPILATION() -IMAGE(0, GPU_RGBA16F, read_write, image2D, velocity_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, velocity_img) ADDITIONAL_INFO(eevee_motion_blur_tiles_flatten) GPU_SHADER_CREATE_END() @@ -44,7 +44,7 @@ LOCAL_GROUP_SIZE(MOTION_BLUR_GROUP_SIZE, MOTION_BLUR_GROUP_SIZE) ADDITIONAL_INFO(eevee_shared) /* NOTE: See MotionBlurTileIndirection. */ STORAGE_BUF(0, read_write, uint, tile_indirection_buf[]) -IMAGE(1, GPU_RGBA16F, read, image2D, in_tiles_img) +IMAGE(1, SFLOAT_16_16_16_16, read, image2D, in_tiles_img) COMPUTE_SOURCE("eevee_motion_blur_dilate_comp.glsl") GPU_SHADER_CREATE_END() @@ -60,7 +60,7 @@ SAMPLER(1, sampler2D, velocity_tx) SAMPLER(2, sampler2D, in_color_tx) /* NOTE: See MotionBlurTileIndirection. */ STORAGE_BUF(0, read, uint, tile_indirection_buf[]) -IMAGE(0, GPU_RGBA16F, read, image2D, in_tiles_img) -IMAGE(1, GPU_RGBA16F, write, image2D, out_color_img) +IMAGE(0, SFLOAT_16_16_16_16, read, image2D, in_tiles_img) +IMAGE(1, SFLOAT_16_16_16_16, write, image2D, out_color_img) COMPUTE_SOURCE("eevee_motion_blur_gather_comp.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_shadow_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_shadow_info.hh index 3ef2912cdc8..477a33a00c8 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_shadow_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_shadow_info.hh @@ -208,7 +208,7 @@ STORAGE_BUF(3, read_write, ShadowStatistics, statistics_buf) STORAGE_BUF(4, write, ViewMatrices, view_infos_buf[SHADOW_VIEW_MAX]) STORAGE_BUF(5, write, ShadowRenderView, render_view_buf[SHADOW_VIEW_MAX]) STORAGE_BUF(6, read, ShadowTileMapClip, tilemaps_clip_buf[]) -IMAGE(0, GPU_R32UI, write, uimage2D, tilemaps_img) +IMAGE(0, UINT_32, write, uimage2D, tilemaps_img) ADDITIONAL_INFO(eevee_shared) COMPUTE_SOURCE("eevee_shadow_tilemap_finalize_comp.glsl") GPU_SHADER_CREATE_END() @@ -232,7 +232,7 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(eevee_shadow_tilemap_amend) DO_STATIC_COMPILATION() LOCAL_GROUP_SIZE(SHADOW_TILEMAP_RES, SHADOW_TILEMAP_RES) -IMAGE(0, GPU_R32UI, read_write, uimage2D, tilemaps_img) +IMAGE(0, UINT_32, read_write, uimage2D, tilemaps_img) STORAGE_BUF(LIGHT_CULL_BUF_SLOT, read, LightCullingData, light_cull_buf) STORAGE_BUF(LIGHT_BUF_SLOT, read_write, LightData, light_buf[]) /* The call bind_resources(lights) also uses LIGHT_ZBIN_BUF_SLOT and LIGHT_TILE_BUF_SLOT. */ @@ -250,7 +250,7 @@ STORAGE_BUF(2, read, ShadowPagesInfoData, pages_infos_buf) STORAGE_BUF(6, read, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) ADDITIONAL_INFO(eevee_shared) COMPUTE_SOURCE("eevee_shadow_page_clear_comp.glsl") -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, read_write, uimage2DArrayAtomic, shadow_atlas_img) +IMAGE(SHADOW_ATLAS_IMG_SLOT, UINT_32, read_write, uimage2DArrayAtomic, shadow_atlas_img) GPU_SHADER_CREATE_END() /* TBDR clear implementation. */ @@ -288,7 +288,7 @@ BUILTINS(BuiltinBits::VIEWPORT_INDEX | BuiltinBits::LAYER) STORAGE_BUF(7, read, uint, dst_coord_buf[SHADOW_RENDER_MAP_SIZE]) STORAGE_BUF(8, read, uint, src_coord_buf[SHADOW_RENDER_MAP_SIZE]) SUBPASS_IN(0, float, Float2DArray, in_tile_depth, SHADOW_ROG_ID) -IMAGE(SHADOW_ATLAS_IMG_SLOT, GPU_R32UI, read_write, uimage2DArray, shadow_atlas_img) +IMAGE(SHADOW_ATLAS_IMG_SLOT, UINT_32, read_write, uimage2DArray, shadow_atlas_img) VERTEX_OUT(eevee_shadow_page_tile_store_noperspective_iface) VERTEX_OUT(eevee_shadow_page_tile_store_flat_iface) VERTEX_SOURCE("eevee_shadow_page_tile_vert.glsl") diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_tracing_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_tracing_info.hh index 824d413e7e0..083c5349735 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_tracing_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_tracing_info.hh @@ -65,7 +65,7 @@ ADDITIONAL_INFO(eevee_global_ubo) ADDITIONAL_INFO(eevee_sampling_data) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_utility_texture) -IMAGE(0, GPU_RGBA16F, write, image2D, out_ray_data_img) +IMAGE(0, SFLOAT_16_16_16_16, write, image2D, out_ray_data_img) STORAGE_BUF(4, read, uint, tiles_coord_buf[]) SPECIALIZATION_CONSTANT(int, closure_index, 0) COMPUTE_SOURCE("eevee_ray_generate_comp.glsl") @@ -80,7 +80,7 @@ ADDITIONAL_INFO(eevee_global_ubo) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_sampling_data) ADDITIONAL_INFO(eevee_lightprobe_data) -IMAGE(0, GPU_RGBA16F, read, image2D, ray_data_img) +IMAGE(0, SFLOAT_16_16_16_16, read, image2D, ray_data_img) IMAGE(1, RAYTRACE_RAYTIME_FORMAT, write, image2D, ray_time_img) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, write, image2D, ray_radiance_img) SAMPLER(1, sampler2DDepth, depth_tx) @@ -100,7 +100,7 @@ ADDITIONAL_INFO(eevee_gbuffer_data) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_lightprobe_data) ADDITIONAL_INFO(eevee_lightprobe_planar_data) -IMAGE(0, GPU_RGBA16F, read_write, image2D, ray_data_img) +IMAGE(0, SFLOAT_16_16_16_16, read_write, image2D, ray_data_img) IMAGE(1, RAYTRACE_RAYTIME_FORMAT, write, image2D, ray_time_img) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, write, image2D, ray_radiance_img) SAMPLER(2, sampler2DDepth, depth_tx) @@ -119,7 +119,7 @@ ADDITIONAL_INFO(eevee_gbuffer_data) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_hiz_data) ADDITIONAL_INFO(eevee_lightprobe_data) -IMAGE(0, GPU_RGBA16F, read, image2D, ray_data_img) +IMAGE(0, SFLOAT_16_16_16_16, read, image2D, ray_data_img) IMAGE(1, RAYTRACE_RAYTIME_FORMAT, write, image2D, ray_time_img) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, write, image2D, ray_radiance_img) SAMPLER(0, sampler2DDepth, depth_tx) @@ -146,12 +146,12 @@ ADDITIONAL_INFO(eevee_sampling_data) ADDITIONAL_INFO(draw_view) ADDITIONAL_INFO(eevee_utility_texture) SAMPLER(3, sampler2DDepth, depth_tx) -IMAGE(0, GPU_RGBA16F, read, image2D, ray_data_img) +IMAGE(0, SFLOAT_16_16_16_16, read, image2D, ray_data_img) IMAGE(1, RAYTRACE_RAYTIME_FORMAT, read, image2D, ray_time_img) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, read, image2D, ray_radiance_img) IMAGE(3, RAYTRACE_RADIANCE_FORMAT, write, image2D, out_radiance_img) IMAGE(4, RAYTRACE_VARIANCE_FORMAT, write, image2D, out_variance_img) -IMAGE(5, GPU_R32F, write, image2D, out_hit_depth_img) +IMAGE(5, SFLOAT_32, write, image2D, out_hit_depth_img) IMAGE(6, RAYTRACE_TILEMASK_FORMAT, read, uimage2DArray, tile_mask_img) STORAGE_BUF(4, read, uint, tiles_coord_buf[]) /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ @@ -172,7 +172,7 @@ SAMPLER(0, sampler2D, radiance_history_tx) SAMPLER(1, sampler2D, variance_history_tx) SAMPLER(2, usampler2DArray, tilemask_history_tx) SAMPLER(3, sampler2DDepth, depth_tx) -IMAGE(0, GPU_R32F, read, image2D, hit_depth_img) +IMAGE(0, SFLOAT_32, read, image2D, hit_depth_img) IMAGE(1, RAYTRACE_RADIANCE_FORMAT, read, image2D, in_radiance_img) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, write, image2D, out_radiance_img) IMAGE(3, RAYTRACE_VARIANCE_FORMAT, read, image2D, in_variance_img) @@ -213,7 +213,7 @@ ADDITIONAL_INFO(draw_view) SAMPLER(0, sampler2DDepth, depth_tx) SAMPLER(1, sampler2D, in_radiance_tx) IMAGE(2, RAYTRACE_RADIANCE_FORMAT, write, image2D, out_radiance_img) -IMAGE(3, GPU_RGB10_A2, write, image2D, out_normal_img) +IMAGE(3, UNORM_10_10_10_2, write, image2D, out_normal_img) COMPUTE_SOURCE("eevee_horizon_setup_comp.glsl") GPU_SHADER_CREATE_END() @@ -232,10 +232,10 @@ SPECIALIZATION_CONSTANT(int, fast_gi_step_count, 8) SPECIALIZATION_CONSTANT(bool, fast_gi_ao_only, false) SAMPLER(0, sampler2D, screen_radiance_tx) SAMPLER(1, sampler2D, screen_normal_tx) -IMAGE(2, GPU_RGBA16F, write, image2D, horizon_radiance_0_img) -IMAGE(3, GPU_RGBA8, write, image2D, horizon_radiance_1_img) -IMAGE(4, GPU_RGBA8, write, image2D, horizon_radiance_2_img) -IMAGE(5, GPU_RGBA8, write, image2D, horizon_radiance_3_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, horizon_radiance_0_img) +IMAGE(3, UNORM_8_8_8_8, write, image2D, horizon_radiance_1_img) +IMAGE(4, UNORM_8_8_8_8, write, image2D, horizon_radiance_2_img) +IMAGE(5, UNORM_8_8_8_8, write, image2D, horizon_radiance_3_img) STORAGE_BUF(7, read, uint, tiles_coord_buf[]) /* Metal: Provide compiler with hint to tune per-thread resource allocation. */ MTL_MAX_TOTAL_THREADS_PER_THREADGROUP(400) @@ -255,10 +255,10 @@ SAMPLER(4, sampler2D, in_sh_1_tx) SAMPLER(5, sampler2D, in_sh_2_tx) SAMPLER(6, sampler2D, in_sh_3_tx) SAMPLER(7, sampler2D, screen_normal_tx) -IMAGE(2, GPU_RGBA16F, write, image2D, out_sh_0_img) -IMAGE(3, GPU_RGBA8, write, image2D, out_sh_1_img) -IMAGE(4, GPU_RGBA8, write, image2D, out_sh_2_img) -IMAGE(5, GPU_RGBA8, write, image2D, out_sh_3_img) +IMAGE(2, SFLOAT_16_16_16_16, write, image2D, out_sh_0_img) +IMAGE(3, UNORM_8_8_8_8, write, image2D, out_sh_1_img) +IMAGE(4, UNORM_8_8_8_8, write, image2D, out_sh_2_img) +IMAGE(5, UNORM_8_8_8_8, write, image2D, out_sh_3_img) STORAGE_BUF(7, read, uint, tiles_coord_buf[]) COMPUTE_SOURCE("eevee_horizon_denoise_comp.glsl") GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/eevee/shaders/infos/eevee_volume_info.hh b/source/blender/draw/engines/eevee/shaders/infos/eevee_volume_info.hh index c4879753c36..c0116e604a9 100644 --- a/source/blender/draw/engines/eevee/shaders/infos/eevee_volume_info.hh +++ b/source/blender/draw/engines/eevee/shaders/infos/eevee_volume_info.hh @@ -42,8 +42,8 @@ ADDITIONAL_INFO(eevee_utility_texture) ADDITIONAL_INFO(eevee_volume_properties_data) SAMPLER(0, sampler3D, scattering_history_tx) SAMPLER(1, sampler3D, extinction_history_tx) -IMAGE(5, GPU_R11F_G11F_B10F, write, image3D, out_scattering_img) -IMAGE(6, GPU_R11F_G11F_B10F, write, image3D, out_extinction_img) +IMAGE(5, UFLOAT_11_11_10, write, image3D, out_scattering_img) +IMAGE(6, UFLOAT_11_11_10, write, image3D, out_extinction_img) COMPUTE_SOURCE("eevee_volume_scatter_comp.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -62,9 +62,9 @@ ADDITIONAL_INFO(eevee_shared) ADDITIONAL_INFO(eevee_global_ubo) ADDITIONAL_INFO(gpu_fullscreen) BUILTINS(BuiltinBits::TEXTURE_ATOMIC) -IMAGE(VOLUME_HIT_DEPTH_SLOT, GPU_R32F, read, image3D, hit_depth_img) -IMAGE(VOLUME_HIT_COUNT_SLOT, GPU_R32UI, read_write, uimage2D, hit_count_img) -IMAGE(VOLUME_OCCUPANCY_SLOT, GPU_R32UI, read_write, uimage3DAtomic, occupancy_img) +IMAGE(VOLUME_HIT_DEPTH_SLOT, SFLOAT_32, read, image3D, hit_depth_img) +IMAGE(VOLUME_HIT_COUNT_SLOT, UINT_32, read_write, uimage2D, hit_count_img) +IMAGE(VOLUME_OCCUPANCY_SLOT, UINT_32, read_write, uimage3DAtomic, occupancy_img) FRAGMENT_SOURCE("eevee_occupancy_convert_frag.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() @@ -80,8 +80,8 @@ LOCAL_GROUP_SIZE(VOLUME_INTEGRATION_GROUP_SIZE, VOLUME_INTEGRATION_GROUP_SIZE, 1 SAMPLER(0, sampler3D, in_scattering_tx) SAMPLER(1, sampler3D, in_extinction_tx) /* Outputs. */ -IMAGE(0, GPU_R11F_G11F_B10F, write, image3D, out_scattering_img) -IMAGE(1, GPU_R11F_G11F_B10F, write, image3D, out_transmittance_img) +IMAGE(0, UFLOAT_11_11_10, write, image3D, out_scattering_img) +IMAGE(1, UFLOAT_11_11_10, write, image3D, out_transmittance_img) DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/draw/engines/gpencil/gpencil_antialiasing.cc b/source/blender/draw/engines/gpencil/gpencil_antialiasing.cc index bc6bd209138..d35bf999828 100644 --- a/source/blender/draw/engines/gpencil/gpencil_antialiasing.cc +++ b/source/blender/draw/engines/gpencil/gpencil_antialiasing.cc @@ -40,10 +40,12 @@ void Instance::antialiasing_init() if (!this->smaa_search_tx.is_valid()) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ; - this->smaa_search_tx.ensure_2d(GPU_R8, int2(SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT), usage); + this->smaa_search_tx.ensure_2d( + gpu::TextureFormat::UNORM_8, int2(SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT), usage); GPU_texture_update(this->smaa_search_tx, GPU_DATA_UBYTE, searchTexBytes); - this->smaa_area_tx.ensure_2d(GPU_RG8, int2(AREATEX_WIDTH, AREATEX_HEIGHT), usage); + this->smaa_area_tx.ensure_2d( + gpu::TextureFormat::UNORM_8_8, int2(AREATEX_WIDTH, AREATEX_HEIGHT), usage); GPU_texture_update(this->smaa_area_tx, GPU_DATA_UBYTE, areaTexBytes); GPU_texture_filter_mode(this->smaa_search_tx, true); @@ -52,8 +54,8 @@ void Instance::antialiasing_init() { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - this->smaa_edge_tx.acquire(size, GPU_RG8, usage); - this->smaa_weight_tx.acquire(size, GPU_RGBA8, usage); + this->smaa_edge_tx.acquire(size, gpu::TextureFormat::UNORM_8_8, usage); + this->smaa_weight_tx.acquire(size, gpu::TextureFormat::UNORM_8_8_8_8, usage); this->smaa_edge_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(this->smaa_edge_tx)); this->smaa_weight_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(this->smaa_weight_tx)); @@ -193,7 +195,7 @@ void Instance::antialiasing_accumulate(Manager &manager, const float alpha) const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATTACHMENT; - accumulation_tx.ensure_2d(GPENCIL_ACCUM_FORMAT, size, usage); + accumulation_tx.ensure_2d(gpu::TextureFormat::GPENCIL_ACCUM_FORMAT, size, usage); { PassSimple &pass = this->accumulate_ps; diff --git a/source/blender/draw/engines/gpencil/gpencil_defines.hh b/source/blender/draw/engines/gpencil/gpencil_defines.hh index f489d5e4278..b7b34474454 100644 --- a/source/blender/draw/engines/gpencil/gpencil_defines.hh +++ b/source/blender/draw/engines/gpencil/gpencil_defines.hh @@ -22,5 +22,5 @@ /* UBOs */ #define GPENCIL_SCENE_SLOT 2 -#define GPENCIL_RENDER_FORMAT GPU_RGBA16F -#define GPENCIL_ACCUM_FORMAT GPU_RGBA16F +#define GPENCIL_RENDER_FORMAT SFLOAT_16_16_16_16 +#define GPENCIL_ACCUM_FORMAT SFLOAT_16_16_16_16 diff --git a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc index 7f2f06aa902..611313a6bb9 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine_c.cc +++ b/source/blender/draw/engines/gpencil/gpencil_engine_c.cc @@ -60,12 +60,13 @@ void Instance::init() if (!dummy_texture.is_valid()) { const float pixels[1][4] = {{1.0f, 0.0f, 1.0f, 1.0f}}; - dummy_texture.ensure_2d(GPU_RGBA8, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0][0]); + dummy_texture.ensure_2d( + gpu::TextureFormat::UNORM_8_8_8_8, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0][0]); } if (!dummy_depth.is_valid()) { const float pixels[1] = {1.0f}; dummy_depth.ensure_2d( - GPU_DEPTH_COMPONENT32F, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0]); + gpu::TextureFormat::SFLOAT_32_DEPTH, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, &pixels[0]); } /* Resize and reset memory-blocks. */ @@ -611,10 +612,14 @@ void Instance::acquire_resources() const int2 size = int2(draw_ctx->viewport_size_get()); - const eGPUTextureFormat format_color = this->use_signed_fb ? GPU_RGBA16F : GPU_R11F_G11F_B10F; - const eGPUTextureFormat format_reveal = this->use_signed_fb ? GPU_RGBA16F : GPU_RGB10_A2; + const gpu::TextureFormat format_color = this->use_signed_fb ? + gpu::TextureFormat::SFLOAT_16_16_16_16 : + gpu::TextureFormat::UFLOAT_11_11_10; + const gpu::TextureFormat format_reveal = this->use_signed_fb ? + gpu::TextureFormat::SFLOAT_16_16_16_16 : + gpu::TextureFormat::UNORM_10_10_10_2; - this->depth_tx.acquire(size, GPU_DEPTH32F_STENCIL8); + this->depth_tx.acquire(size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); this->color_tx.acquire(size, format_color); this->reveal_tx.acquire(size, format_reveal); @@ -642,11 +647,12 @@ void Instance::acquire_resources() if (this->use_mask_fb) { /* Use high quality format for render. */ - const eGPUTextureFormat mask_format = this->is_render ? GPU_R16 : GPU_R8; + const gpu::TextureFormat mask_format = this->is_render ? gpu::TextureFormat::UNORM_16 : + gpu::TextureFormat::UNORM_8; /* We need an extra depth to not disturb the normal drawing. */ - this->mask_depth_tx.acquire(size, GPU_DEPTH32F_STENCIL8); + this->mask_depth_tx.acquire(size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); /* The mask_color_tx is needed for frame-buffer completeness. */ - this->mask_color_tx.acquire(size, GPU_R8); + this->mask_color_tx.acquire(size, gpu::TextureFormat::UNORM_8); this->mask_tx.acquire(size, mask_format); this->mask_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->mask_depth_tx), @@ -657,7 +663,7 @@ void Instance::acquire_resources() if (this->use_separate_pass) { const int2 size = int2(draw_ctx->viewport_size_get()); draw::TextureFromPool &output_pass_texture = DRW_viewport_pass_texture_get("GreasePencil"); - output_pass_texture.acquire(size, GPU_RGBA16F); + output_pass_texture.acquire(size, gpu::TextureFormat::SFLOAT_16_16_16_16); this->gpencil_pass_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(output_pass_texture)); } } diff --git a/source/blender/draw/engines/gpencil/gpencil_render.cc b/source/blender/draw/engines/gpencil/gpencil_render.cc index 84031df597b..5ebf75749cd 100644 --- a/source/blender/draw/engines/gpencil/gpencil_render.cc +++ b/source/blender/draw/engines/gpencil/gpencil_render.cc @@ -110,7 +110,7 @@ static void render_init_buffers(const DRWContext *draw_ctx, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; inst.render_depth_tx.ensure_2d( - GPU_DEPTH_COMPONENT32F, int2(size), usage, do_region ? nullptr : pix_z); + gpu::TextureFormat::SFLOAT_32_DEPTH, int2(size), usage, do_region ? nullptr : pix_z); } if (inst.render_color_tx.is_valid() && !do_clear_col) { GPU_texture_update(inst.render_color_tx, GPU_DATA_FLOAT, pix_col); @@ -118,7 +118,8 @@ static void render_init_buffers(const DRWContext *draw_ctx, else { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; - inst.render_color_tx.ensure_2d(GPU_RGBA16F, int2(size), usage, do_region ? nullptr : pix_col); + inst.render_color_tx.ensure_2d( + gpu::TextureFormat::SFLOAT_16_16_16_16, int2(size), usage, do_region ? nullptr : pix_col); } inst.render_fb.ensure(GPU_ATTACHMENT_TEXTURE(inst.render_depth_tx), diff --git a/source/blender/draw/engines/image/image_texture_info.hh b/source/blender/draw/engines/image/image_texture_info.hh index 9ff462ff2c0..75e05fd9253 100644 --- a/source/blender/draw/engines/image/image_texture_info.hh +++ b/source/blender/draw/engines/image/image_texture_info.hh @@ -87,7 +87,8 @@ struct TextureInfo : NonCopyable { } if (should_be_created) { - texture.ensure_2d(GPU_RGBA16F, texture_size, GPU_TEXTURE_USAGE_SHADER_READ); + texture.ensure_2d( + gpu::TextureFormat::SFLOAT_16_16_16_16, texture_size, GPU_TEXTURE_USAGE_SHADER_READ); } need_full_update |= should_be_created; } diff --git a/source/blender/draw/engines/overlay/overlay_instance.cc b/source/blender/draw/engines/overlay/overlay_instance.cc index 8f79a139110..c9363f56df9 100644 --- a/source/blender/draw/engines/overlay/overlay_instance.cc +++ b/source/blender/draw/engines/overlay/overlay_instance.cc @@ -131,7 +131,8 @@ void Instance::init() { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ; - if (resources.dummy_depth_tx.ensure_2d(GPU_DEPTH_COMPONENT32F, int2(1, 1), usage)) { + if (resources.dummy_depth_tx.ensure_2d(gpu::TextureFormat::SFLOAT_32_DEPTH, int2(1, 1), usage)) + { float data = 1.0f; GPU_texture_update_sub(resources.dummy_depth_tx, GPU_DATA_FLOAT, &data, 0, 0, 0, 1, 1, 1); } @@ -210,7 +211,8 @@ void Instance::ensure_weight_ramp_texture() unit_float_to_uchar_clamp_v4(pixels_ubyte[i], pixels[i]); } - resources.weight_ramp_tx.ensure_1d(GPU_SRGB8_A8, res, GPU_TEXTURE_USAGE_SHADER_READ); + resources.weight_ramp_tx.ensure_1d( + gpu::TextureFormat::SRGBA_8_8_8_8, res, GPU_TEXTURE_USAGE_SHADER_READ); GPU_texture_update(resources.weight_ramp_tx, GPU_DATA_UBYTE, pixels_ubyte); } @@ -686,7 +688,7 @@ void Instance::end_sync() size.x, size.y, 1, - GPU_DEPTH32F_STENCIL8, + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, GPU_TEXTURE_USAGE_GENERAL, nullptr); } diff --git a/source/blender/draw/engines/overlay/overlay_mesh.hh b/source/blender/draw/engines/overlay/overlay_mesh.hh index 0709845c06e..c726b5ea1b6 100644 --- a/source/blender/draw/engines/overlay/overlay_mesh.hh +++ b/source/blender/draw/engines/overlay/overlay_mesh.hh @@ -1086,7 +1086,8 @@ class MeshUVs : Overlay { BKE_maskrasterize_handle_free(handle); mask_texture_.free(); - mask_texture_.ensure_2d(GPU_R16F, int2(width, height), GPU_TEXTURE_USAGE_SHADER_READ, buffer); + mask_texture_.ensure_2d( + gpu::TextureFormat::SFLOAT_16, int2(width, height), GPU_TEXTURE_USAGE_SHADER_READ, buffer); MEM_freeN(buffer); } diff --git a/source/blender/draw/engines/overlay/overlay_outline.hh b/source/blender/draw/engines/overlay/overlay_outline.hh index a220074a67c..54b5791e42e 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.hh +++ b/source/blender/draw/engines/overlay/overlay_outline.hh @@ -239,8 +239,8 @@ class Outline : Overlay { int2 render_size = int2(res.depth_tx.size()); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - tmp_depth_tx_.acquire(render_size, GPU_DEPTH32F_STENCIL8, usage); - object_id_tx_.acquire(render_size, GPU_R16UI, usage); + tmp_depth_tx_.acquire(render_size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, usage); + object_id_tx_.acquire(render_size, gpu::TextureFormat::UINT_16, usage); prepass_fb_.ensure(GPU_ATTACHMENT_TEXTURE(tmp_depth_tx_), GPU_ATTACHMENT_TEXTURE(object_id_tx_)); diff --git a/source/blender/draw/engines/overlay/overlay_private.hh b/source/blender/draw/engines/overlay/overlay_private.hh index 32f73b3cc62..8b5bfbabf8e 100644 --- a/source/blender/draw/engines/overlay/overlay_private.hh +++ b/source/blender/draw/engines/overlay/overlay_private.hh @@ -775,16 +775,18 @@ struct Resources : public select::SelectMap { if (state.xray_enabled) { /* For X-ray we render the scene to a separate depth buffer. */ - this->xray_depth_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); + this->xray_depth_tx.acquire(render_size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); this->depth_target_tx.wrap(this->xray_depth_tx); /* TODO(fclem): Remove mandatory allocation. */ - this->xray_depth_in_front_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); + this->xray_depth_in_front_tx.acquire(render_size, + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); this->depth_target_in_front_tx.wrap(this->xray_depth_in_front_tx); } else { /* TODO(fclem): Remove mandatory allocation. */ if (!this->depth_in_front_tx.is_valid()) { - this->depth_in_front_alloc_tx.acquire(render_size, GPU_DEPTH32F_STENCIL8); + this->depth_in_front_alloc_tx.acquire(render_size, + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); this->depth_in_front_tx.wrap(this->depth_in_front_alloc_tx); } this->depth_target_tx.wrap(this->depth_tx); @@ -794,14 +796,14 @@ struct Resources : public select::SelectMap { /* TODO: Better semantics using a switch? */ if (!this->color_overlay_tx.is_valid()) { /* Likely to be the selection case. Allocate dummy texture and bind only depth buffer. */ - this->color_overlay_alloc_tx.acquire(int2(1, 1), GPU_SRGB8_A8); - this->color_render_alloc_tx.acquire(int2(1, 1), GPU_SRGB8_A8); + this->color_overlay_alloc_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8); + this->color_render_alloc_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8); this->color_overlay_tx.wrap(this->color_overlay_alloc_tx); this->color_render_tx.wrap(this->color_render_alloc_tx); - this->line_tx.acquire(int2(1, 1), GPU_RGBA8); - this->overlay_tx.acquire(int2(1, 1), GPU_SRGB8_A8); + this->line_tx.acquire(int2(1, 1), gpu::TextureFormat::UNORM_8_8_8_8); + this->overlay_tx.acquire(int2(1, 1), gpu::TextureFormat::SRGBA_8_8_8_8); this->overlay_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx)); this->overlay_line_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx)); @@ -811,8 +813,8 @@ struct Resources : public select::SelectMap { else { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE | GPU_TEXTURE_USAGE_ATTACHMENT; - this->line_tx.acquire(render_size, GPU_RGBA8, usage); - this->overlay_tx.acquire(render_size, GPU_SRGB8_A8, usage); + this->line_tx.acquire(render_size, gpu::TextureFormat::UNORM_8_8_8_8, usage); + this->overlay_tx.acquire(render_size, gpu::TextureFormat::SRGBA_8_8_8_8, usage); this->overlay_fb.ensure(GPU_ATTACHMENT_TEXTURE(this->depth_target_tx), GPU_ATTACHMENT_TEXTURE(this->overlay_tx)); diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.hh b/source/blender/draw/engines/overlay/overlay_wireframe.hh index 50cf90884e2..50c1817866b 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.hh +++ b/source/blender/draw/engines/overlay/overlay_wireframe.hh @@ -260,7 +260,7 @@ class Wireframe : Overlay { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; int2 render_size = int2(depth_tx.size()); - tmp_depth_tx_.acquire(render_size, GPU_DEPTH32F_STENCIL8, usage); + tmp_depth_tx_.acquire(render_size, gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, usage); /* WORKAROUND: Nasty framebuffer copy. * We should find a way to have nice wireframe without this. */ diff --git a/source/blender/draw/engines/select/select_engine.cc b/source/blender/draw/engines/select/select_engine.cc index 55feef2a93d..f25d338984e 100644 --- a/source/blender/draw/engines/select/select_engine.cc +++ b/source/blender/draw/engines/select/select_engine.cc @@ -426,7 +426,7 @@ struct Instance : public DrawEngine { if (e_data.texture_u32 == nullptr) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; e_data.texture_u32 = GPU_texture_create_2d( - "select_buf_ids", size[0], size[1], 1, GPU_R32UI, usage, nullptr); + "select_buf_ids", size[0], size[1], 1, gpu::TextureFormat::UINT_32, usage, nullptr); GPU_framebuffer_texture_attach(e_data.framebuffer_select_id, e_data.texture_u32, 0, 0); GPU_framebuffer_check_valid(e_data.framebuffer_select_id, nullptr); diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc index 1ee777cb34d..45c65b5d72a 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.cc @@ -112,12 +112,15 @@ static void setup_taa_weights(const float2 offset, float r_weights[9], float &r_ AntiAliasingPass::AntiAliasingPass() { - smaa_search_tx_.ensure_2d( - GPU_R8, {SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}, GPU_TEXTURE_USAGE_SHADER_READ); + smaa_search_tx_.ensure_2d(gpu::TextureFormat::UNORM_8, + {SEARCHTEX_WIDTH, SEARCHTEX_HEIGHT}, + GPU_TEXTURE_USAGE_SHADER_READ); GPU_texture_update(smaa_search_tx_, GPU_DATA_UBYTE, searchTexBytes); GPU_texture_filter_mode(smaa_search_tx_, true); - smaa_area_tx_.ensure_2d(GPU_RG8, {AREATEX_WIDTH, AREATEX_HEIGHT}, GPU_TEXTURE_USAGE_SHADER_READ); + smaa_area_tx_.ensure_2d(gpu::TextureFormat::UNORM_8_8, + {AREATEX_WIDTH, AREATEX_HEIGHT}, + GPU_TEXTURE_USAGE_SHADER_READ); GPU_texture_update(smaa_area_tx_, GPU_DATA_UBYTE, areaTexBytes); GPU_texture_filter_mode(smaa_area_tx_, true); } @@ -146,10 +149,10 @@ void AntiAliasingPass::sync(const SceneState &scene_state, SceneResources &resou scene_state.resolution); smaa_mix_factor_ = 1.0f - clamp_f(scene_state.sample / 4.0f, 0.0f, 1.0f); - taa_accumulation_tx_.ensure_2d(GPU_RGBA16F, + taa_accumulation_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_16_16_16_16, scene_state.resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); - sample0_depth_tx_.ensure_2d(GPU_DEPTH32F_STENCIL8, + sample0_depth_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, scene_state.resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); @@ -259,8 +262,9 @@ void AntiAliasingPass::draw(const DRWContext *draw_ctx, if (scene_state.sample == 0) { GPU_texture_copy(sample0_depth_tx_, resources.depth_tx); if (resources.depth_in_front_tx.is_valid()) { - sample0_depth_in_front_tx_.ensure_2d( - GPU_DEPTH32F_STENCIL8, scene_state.resolution, GPU_TEXTURE_USAGE_ATTACHMENT); + sample0_depth_in_front_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, + scene_state.resolution, + GPU_TEXTURE_USAGE_ATTACHMENT); GPU_texture_copy(sample0_depth_in_front_tx_, resources.depth_in_front_tx); } else { @@ -295,10 +299,10 @@ void AntiAliasingPass::draw(const DRWContext *draw_ctx, /** Always acquire to avoid constant allocation/deallocation. */ smaa_weight_tx_.acquire(scene_state.resolution, - GPU_RGBA8, + gpu::TextureFormat::UNORM_8_8_8_8, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); smaa_edge_tx_.acquire(scene_state.resolution, - GPU_RG8, + gpu::TextureFormat::UNORM_8_8, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); if (!draw_ctx->is_image_render() || last_sample || taa_finished) { diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.cc b/source/blender/draw/engines/workbench/workbench_effect_dof.cc index ddff88e7cff..0d2663b4e11 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.cc +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.cc @@ -109,10 +109,10 @@ void DofPass::init(const SceneState &scene_state, const DRWContext *draw_ctx) half_res = {max_ii(half_res.x, 1), max_ii(half_res.y, 1)}; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - source_tx_.ensure_2d(GPU_RGBA16F, half_res, usage, nullptr, 3); + source_tx_.ensure_2d(gpu::TextureFormat::SFLOAT_16_16_16_16, half_res, usage, nullptr, 3); source_tx_.ensure_mip_views(); source_tx_.filter_mode(true); - coc_halfres_tx_.ensure_2d(GPU_RG8, half_res, usage, nullptr, 3); + coc_halfres_tx_.ensure_2d(gpu::TextureFormat::UNORM_8_8, half_res, usage, nullptr, 3); coc_halfres_tx_.ensure_mip_views(); coc_halfres_tx_.filter_mode(true); @@ -220,8 +220,9 @@ void DofPass::draw(Manager &manager, View &view, SceneResources &resources, int2 GPU_debug_group_begin("Depth Of Field"); int2 half_res = {max_ii(resolution.x / 2, 1), max_ii(resolution.y / 2, 1)}; - blur_tx_.acquire( - half_res, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + blur_tx_.acquire(half_res, + gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); downsample_fb_.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(source_tx_), diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc index eaf6f01ab6c..3bfe056d7d2 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.cc +++ b/source/blender/draw/engines/workbench/workbench_engine.cc @@ -466,8 +466,10 @@ class Instance : public DrawEngine { GPUAttachment id_attachment = GPU_ATTACHMENT_NONE; if (scene_state_.draw_object_id) { - resources_.object_id_tx.acquire( - resolution, GPU_R16UI, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + resources_.object_id_tx.acquire(resolution, + gpu::TextureFormat::UINT_16, + GPU_TEXTURE_USAGE_SHADER_READ | + GPU_TEXTURE_USAGE_ATTACHMENT); id_attachment = GPU_ATTACHMENT_TEXTURE(resources_.object_id_tx); } resources_.clear_fb.ensure(GPU_ATTACHMENT_TEXTURE(resources_.depth_tx), @@ -587,11 +589,21 @@ static bool workbench_render_framebuffers_init(const DRWContext *draw_ctx) BLI_assert(dtxl->depth == nullptr); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL; dtxl->color = GPU_texture_create_2d( - "txl.color", size.x, size.y, 1, GPU_RGBA16F, usage, nullptr); - dtxl->depth = GPU_texture_create_2d( - "txl.depth", size.x, size.y, 1, GPU_DEPTH32F_STENCIL8, usage, nullptr); - dtxl->depth_in_front = GPU_texture_create_2d( - "txl.depth_in_front", size.x, size.y, 1, GPU_DEPTH32F_STENCIL8, usage, nullptr); + "txl.color", size.x, size.y, 1, gpu::TextureFormat::SFLOAT_16_16_16_16, usage, nullptr); + dtxl->depth = GPU_texture_create_2d("txl.depth", + size.x, + size.y, + 1, + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, + usage, + nullptr); + dtxl->depth_in_front = GPU_texture_create_2d("txl.depth_in_front", + size.x, + size.y, + 1, + gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, + usage, + nullptr); } if (!(dtxl->depth && dtxl->color && dtxl->depth_in_front)) { diff --git a/source/blender/draw/engines/workbench/workbench_mesh_passes.cc b/source/blender/draw/engines/workbench/workbench_mesh_passes.cc index 8404c6eb7e1..2dce916b770 100644 --- a/source/blender/draw/engines/workbench/workbench_mesh_passes.cc +++ b/source/blender/draw/engines/workbench/workbench_mesh_passes.cc @@ -151,10 +151,12 @@ void OpaquePass::draw(Manager &manager, if (is_empty()) { return; } - gbuffer_material_tx.acquire( - resolution, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); - gbuffer_normal_tx.acquire( - resolution, GPU_RG16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + gbuffer_material_tx.acquire(resolution, + gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + gbuffer_normal_tx.acquire(resolution, + gpu::TextureFormat::SFLOAT_16_16, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); GPUAttachment object_id_attachment = GPU_ATTACHMENT_NONE; if (resources.object_id_tx.is_valid()) { @@ -186,7 +188,7 @@ void OpaquePass::draw(Manager &manager, } if (shadow_pass) { - shadow_depth_stencil_tx.ensure_2d(GPU_DEPTH32F_STENCIL8, + shadow_depth_stencil_tx.ensure_2d(gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, resolution, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT | @@ -263,10 +265,12 @@ void TransparentPass::draw(Manager &manager, if (is_empty()) { return; } - accumulation_tx.acquire( - resolution, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); - reveal_tx.acquire( - resolution, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + accumulation_tx.acquire(resolution, + gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); + reveal_tx.acquire(resolution, + gpu::TextureFormat::SFLOAT_16, + GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT); resolve_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(resources.color_tx)); diff --git a/source/blender/draw/engines/workbench/workbench_resources.cc b/source/blender/draw/engines/workbench/workbench_resources.cc index 8994edad27b..06619af9b0f 100644 --- a/source/blender/draw/engines/workbench/workbench_resources.cc +++ b/source/blender/draw/engines/workbench/workbench_resources.cc @@ -39,7 +39,7 @@ static bool get_matcap_tx(Texture &matcap_tx, StudioLight &studio_light) } matcap_tx = Texture(studio_light.name, - GPU_RGBA16F, + gpu::TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_SHADER_READ, int2(matcap_diffuse->x, matcap_diffuse->y), layers, @@ -101,8 +101,10 @@ void SceneResources::load_jitter_tx(int total_samples) } jitter_tx.free(); - jitter_tx.ensure_2d( - GPU_RGBA16F, int2(jitter_tx_size), GPU_TEXTURE_USAGE_SHADER_READ, jitter[0][0]); + jitter_tx.ensure_2d(gpu::TextureFormat::SFLOAT_16_16_16_16, + int2(jitter_tx_size), + GPU_TEXTURE_USAGE_SHADER_READ, + jitter[0][0]); } void SceneResources::init(const SceneState &scene_state, const DRWContext *ctx) @@ -136,7 +138,8 @@ void SceneResources::init(const SceneState &scene_state, const DRWContext *ctx) } } if (!matcap_tx.is_valid()) { - matcap_tx.ensure_2d_array(GPU_RGBA16F, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_READ); + matcap_tx.ensure_2d_array( + gpu::TextureFormat::SFLOAT_16_16_16_16, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_READ); } float4x4 world_shading_rotation = float4x4::identity(); @@ -181,17 +184,27 @@ void SceneResources::init(const SceneState &scene_state, const DRWContext *ctx) clip_planes_buf.push_update(); - missing_tx.ensure_2d( - GPU_RGBA8, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1.0f, 0.0f, 1.0f, 1.0f)); + missing_tx.ensure_2d(gpu::TextureFormat::UNORM_8_8_8_8, + int2(1), + GPU_TEXTURE_USAGE_SHADER_READ, + float4(1.0f, 0.0f, 1.0f, 1.0f)); missing_texture.gpu.texture = &missing_tx; missing_texture.name = "Missing Texture"; - dummy_texture_tx.ensure_2d( - GPU_RGBA8, int2(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0.0f, 0.0f, 0.0f, 0.0f)); - dummy_tile_array_tx.ensure_2d_array( - GPU_RGBA8, int2(1), 1, GPU_TEXTURE_USAGE_SHADER_READ, float4(0.0f, 0.0f, 0.0f, 0.0f)); - dummy_tile_data_tx.ensure_1d_array( - GPU_RGBA8, 1, 1, GPU_TEXTURE_USAGE_SHADER_READ, float4(0.0f, 0.0f, 0.0f, 0.0f)); + dummy_texture_tx.ensure_2d(gpu::TextureFormat::UNORM_8_8_8_8, + int2(1), + GPU_TEXTURE_USAGE_SHADER_READ, + float4(0.0f, 0.0f, 0.0f, 0.0f)); + dummy_tile_array_tx.ensure_2d_array(gpu::TextureFormat::UNORM_8_8_8_8, + int2(1), + 1, + GPU_TEXTURE_USAGE_SHADER_READ, + float4(0.0f, 0.0f, 0.0f, 0.0f)); + dummy_tile_data_tx.ensure_1d_array(gpu::TextureFormat::UNORM_8_8_8_8, + 1, + 1, + GPU_TEXTURE_USAGE_SHADER_READ, + float4(0.0f, 0.0f, 0.0f, 0.0f)); if (volume_cube_batch == nullptr) { volume_cube_batch = GPU_batch_unit_cube(); diff --git a/source/blender/draw/engines/workbench/workbench_volume.cc b/source/blender/draw/engines/workbench/workbench_volume.cc index 4d9f4ad6bbc..8a9b5916a15 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.cc +++ b/source/blender/draw/engines/workbench/workbench_volume.cc @@ -22,9 +22,12 @@ void VolumePass::sync(SceneResources &resources) ps_.init(); ps_.bind_ubo(WB_WORLD_SLOT, resources.world_buf); - dummy_shadow_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1)); - dummy_volume_tx_.ensure_3d(GPU_RGBA8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0)); - dummy_coba_tx_.ensure_1d(GPU_RGBA8, 1, GPU_TEXTURE_USAGE_SHADER_READ, float4(0)); + dummy_shadow_tx_.ensure_3d( + gpu::TextureFormat::UNORM_8_8_8_8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(1)); + dummy_volume_tx_.ensure_3d( + gpu::TextureFormat::UNORM_8_8_8_8, int3(1), GPU_TEXTURE_USAGE_SHADER_READ, float4(0)); + dummy_coba_tx_.ensure_1d( + gpu::TextureFormat::UNORM_8_8_8_8, 1, GPU_TEXTURE_USAGE_SHADER_READ, float4(0)); } void VolumePass::object_sync_volume(Manager &manager, diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh index e18933b90be..9862115df72 100644 --- a/source/blender/draw/intern/DRW_gpu_wrapper.hh +++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh @@ -535,7 +535,7 @@ class Texture : NonCopyable { Texture(const char *name = "gpu::Texture") : name_(name) {} Texture(const char *name, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, int extent, const float *data = nullptr, @@ -547,7 +547,7 @@ class Texture : NonCopyable { } Texture(const char *name, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, int extent, int layers, @@ -560,7 +560,7 @@ class Texture : NonCopyable { } Texture(const char *name, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, int2 extent, const float *data = nullptr, @@ -571,7 +571,7 @@ class Texture : NonCopyable { } Texture(const char *name, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, int2 extent, int layers, @@ -583,7 +583,7 @@ class Texture : NonCopyable { } Texture(const char *name, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, int3 extent, const float *data = nullptr, @@ -649,7 +649,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_1d(eGPUTextureFormat format, + bool ensure_1d(blender::gpu::TextureFormat format, int extent, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, const float *data = nullptr, @@ -662,7 +662,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_1d_array(eGPUTextureFormat format, + bool ensure_1d_array(blender::gpu::TextureFormat format, int extent, int layers, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, @@ -677,7 +677,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_2d(eGPUTextureFormat format, + bool ensure_2d(blender::gpu::TextureFormat format, int2 extent, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, const float *data = nullptr, @@ -690,7 +690,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_2d_array(eGPUTextureFormat format, + bool ensure_2d_array(blender::gpu::TextureFormat format, int2 extent, int layers, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, @@ -705,7 +705,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_3d(eGPUTextureFormat format, + bool ensure_3d(blender::gpu::TextureFormat format, int3 extent, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, const float *data = nullptr, @@ -718,7 +718,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_cube(eGPUTextureFormat format, + bool ensure_cube(blender::gpu::TextureFormat format, int extent, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, float *data = nullptr, @@ -731,7 +731,7 @@ class Texture : NonCopyable { * Ensure the texture has the correct properties. Recreating it if needed. * Return true if a texture has been created. */ - bool ensure_cube_array(eGPUTextureFormat format, + bool ensure_cube_array(blender::gpu::TextureFormat format, int extent, int layers, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, @@ -752,7 +752,7 @@ class Texture : NonCopyable { for (gpu::Texture *&view : mip_views_) { GPU_TEXTURE_FREE_SAFE(view); } - eGPUTextureFormat format = GPU_texture_format(tx_); + blender::gpu::TextureFormat format = GPU_texture_format(tx_); for (auto i : IndexRange(mip_len)) { mip_views_.append( GPU_texture_create_view(name_, tx_, format, i, 1, 0, 9999, cube_as_array, false)); @@ -787,7 +787,7 @@ class Texture : NonCopyable { for (gpu::Texture *&view : layer_views_) { GPU_TEXTURE_FREE_SAFE(view); } - eGPUTextureFormat format = GPU_texture_format(tx_); + blender::gpu::TextureFormat format = GPU_texture_format(tx_); for (auto i : IndexRange(layer_len)) { layer_views_.append( GPU_texture_create_view(name_, tx_, format, 0, 9999, i, 1, cube_as_array, false)); @@ -805,7 +805,7 @@ class Texture : NonCopyable { gpu::Texture *stencil_view(bool cube_as_array = false) { if (stencil_view_ == nullptr) { - eGPUTextureFormat format = GPU_texture_format(tx_); + blender::gpu::TextureFormat format = GPU_texture_format(tx_); stencil_view_ = GPU_texture_create_view( name_, tx_, format, 0, 9999, 0, 9999, cube_as_array, true); } @@ -832,7 +832,7 @@ class Texture : NonCopyable { int view_layer_len = (layer_range_view_) ? GPU_texture_layer_count(layer_range_view_) : -1; if (layer_len != view_layer_len) { GPU_TEXTURE_FREE_SAFE(layer_range_view_); - eGPUTextureFormat format = GPU_texture_format(tx_); + blender::gpu::TextureFormat format = GPU_texture_format(tx_); layer_range_view_ = GPU_texture_create_view( name_, tx_, format, 0, 9999, layer_start, layer_len, cube_as_array, false); } @@ -1003,7 +1003,7 @@ class Texture : NonCopyable { int h = 0, int d = 0, int mip_len = 1, - eGPUTextureFormat format = GPU_RGBA8, + blender::gpu::TextureFormat format = blender::gpu::TextureFormat::UNORM_8_8_8_8, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL, const float *data = nullptr, bool layered = false, @@ -1035,7 +1035,7 @@ class Texture : NonCopyable { int h, int d, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data, bool layered, @@ -1069,7 +1069,7 @@ class TextureFromPool : public Texture, NonMovable { /* Always use `release()` after rendering. */ void acquire(int2 extent, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL) { BLI_assert(this->tx_ == nullptr); @@ -1117,15 +1117,18 @@ class TextureFromPool : public Texture, NonMovable { } /** Remove methods that are forbidden with this type of textures. */ - bool ensure_1d(int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = delete; - bool ensure_1d_array(int, int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = delete; - bool ensure_2d(int, int, int, eGPUTextureFormat, eGPUTextureUsage, float *) = delete; - bool ensure_2d_array(int, int, int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = - delete; - bool ensure_3d(int, int, int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = delete; - bool ensure_cube(int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = delete; - bool ensure_cube_array(int, int, int, eGPUTextureFormat, eGPUTextureUsage, const float *) = + bool ensure_1d(int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; + bool ensure_1d_array( + int, int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; + bool ensure_2d(int, int, int, blender::gpu::TextureFormat, eGPUTextureUsage, float *) = delete; + bool ensure_2d_array( + int, int, int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; + bool ensure_3d( + int, int, int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; + bool ensure_cube(int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; + bool ensure_cube_array( + int, int, int, blender::gpu::TextureFormat, eGPUTextureUsage, const float *) = delete; void filter_mode(bool) = delete; void free() = delete; gpu::Texture *mip_view(int) = delete; @@ -1150,13 +1153,13 @@ class TextureRef : public Texture { } /** Remove methods that are forbidden with this type of textures. */ - bool ensure_1d(int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_1d_array(int, int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_2d(int, int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_2d_array(int, int, int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_3d(int, int, int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_cube(int, int, eGPUTextureFormat, const float *) = delete; - bool ensure_cube_array(int, int, int, eGPUTextureFormat, const float *) = delete; + bool ensure_1d(int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_1d_array(int, int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_2d(int, int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_2d_array(int, int, int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_3d(int, int, int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_cube(int, int, blender::gpu::TextureFormat, const float *) = delete; + bool ensure_cube_array(int, int, int, blender::gpu::TextureFormat, const float *) = delete; void filter_mode(bool) = delete; void free() = delete; gpu::Texture *mip_view(int) = delete; diff --git a/source/blender/draw/intern/draw_cache_impl_volume.cc b/source/blender/draw/intern/draw_cache_impl_volume.cc index 1475a74eb84..a9065fdb869 100644 --- a/source/blender/draw/intern/draw_cache_impl_volume.cc +++ b/source/blender/draw/intern/draw_cache_impl_volume.cc @@ -317,7 +317,9 @@ static DRWVolumeGrid *volume_grid_cache_get(const Volume *volume, cache_grid->object_to_texture = math::invert(cache_grid->texture_to_object); /* Create GPU texture. */ - eGPUTextureFormat format = (channels == 3) ? GPU_RGB16F : GPU_R16F; + blender::gpu::TextureFormat format = (channels == 3) ? + blender::gpu::TextureFormat::SFLOAT_16_16_16 : + blender::gpu::TextureFormat::SFLOAT_16; cache_grid->texture = GPU_texture_create_3d("volume_grid", UNPACK3(dense_grid.resolution), 1, diff --git a/source/blender/draw/intern/draw_context.cc b/source/blender/draw/intern/draw_context.cc index 34394814649..fa7e86b3cff 100644 --- a/source/blender/draw/intern/draw_context.cc +++ b/source/blender/draw/intern/draw_context.cc @@ -1597,7 +1597,13 @@ static void draw_select_framebuffer_depth_only_setup(const int size[2]) if (g_select_buffer.texture_depth == nullptr) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; g_select_buffer.texture_depth = GPU_texture_create_2d( - "select_depth", size[0], size[1], 1, GPU_DEPTH_COMPONENT32F, usage, nullptr); + "select_depth", + size[0], + size[1], + 1, + blender::gpu::TextureFormat::SFLOAT_32_DEPTH, + usage, + nullptr); GPU_framebuffer_texture_attach( g_select_buffer.framebuffer_depth_only, g_select_buffer.texture_depth, 0, 0); diff --git a/source/blender/draw/intern/draw_fluid.cc b/source/blender/draw/intern/draw_fluid.cc index d2860161044..f854911957a 100644 --- a/source/blender/draw/intern/draw_fluid.cc +++ b/source/blender/draw/intern/draw_fluid.cc @@ -105,8 +105,12 @@ static blender::gpu::Texture *create_transfer_function(int type, const ColorBand break; } - blender::gpu::Texture *tex = GPU_texture_create_1d( - "transf_func", TFUNC_WIDTH, 1, GPU_SRGB8_A8, GPU_TEXTURE_USAGE_SHADER_READ, data); + blender::gpu::Texture *tex = GPU_texture_create_1d("transf_func", + TFUNC_WIDTH, + 1, + blender::gpu::TextureFormat::SRGBA_8_8_8_8, + GPU_TEXTURE_USAGE_SHADER_READ, + data); MEM_freeN(data); @@ -166,7 +170,7 @@ static float *rescale_3d(const int dim[3], /* Will resize input to fit GL system limits. */ static blender::gpu::Texture *create_volume_texture(const int dim[3], - eGPUTextureFormat texture_format, + blender::gpu::TextureFormat texture_format, eGPUDataFormat data_format, const void *data) { @@ -208,7 +212,12 @@ static blender::gpu::Texture *create_volume_texture(const int dim[3], } else { /* We need to resize the input. */ - int channels = ELEM(texture_format, GPU_R8, GPU_R16F, GPU_R32F) ? 1 : 4; + int channels = ELEM(texture_format, + blender::gpu::TextureFormat::UNORM_8, + blender::gpu::TextureFormat::SFLOAT_16, + blender::gpu::TextureFormat::SFLOAT_32) ? + 1 : + 4; float *rescaled_data = rescale_3d(dim, final_dim, channels, static_cast(data)); if (rescaled_data) { GPU_texture_update_sub(tex, GPU_DATA_FLOAT, rescaled_data, 0, 0, 0, UNPACK3(final_dim)); @@ -227,10 +236,10 @@ static blender::gpu::Texture *create_field_texture(FluidDomainSettings *fds, boo { void *field = nullptr; eGPUDataFormat data_format = GPU_DATA_FLOAT; - eGPUTextureFormat texture_format = GPU_R8; + blender::gpu::TextureFormat texture_format = blender::gpu::TextureFormat::UNORM_8; if (single_precision) { - texture_format = GPU_R32F; + texture_format = blender::gpu::TextureFormat::SFLOAT_32; } switch (fds->coba_field) { @@ -278,28 +287,28 @@ static blender::gpu::Texture *create_field_texture(FluidDomainSettings *fds, boo break; case FLUID_DOMAIN_FIELD_PHI: field = manta_get_phi(fds->fluid); - texture_format = GPU_R16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16; break; case FLUID_DOMAIN_FIELD_PHI_IN: field = manta_get_phi_in(fds->fluid); - texture_format = GPU_R16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16; break; case FLUID_DOMAIN_FIELD_PHI_OUT: field = manta_get_phiout_in(fds->fluid); - texture_format = GPU_R16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16; break; case FLUID_DOMAIN_FIELD_PHI_OBSTACLE: field = manta_get_phiobs_in(fds->fluid); - texture_format = GPU_R16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16; break; case FLUID_DOMAIN_FIELD_FLAGS: field = manta_smoke_get_flags(fds->fluid); data_format = GPU_DATA_INT; - texture_format = GPU_R8UI; + texture_format = blender::gpu::TextureFormat::UINT_8; break; case FLUID_DOMAIN_FIELD_PRESSURE: field = manta_get_pressure(fds->fluid); - texture_format = GPU_R16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16; break; default: return nullptr; @@ -330,7 +339,8 @@ static blender::gpu::Texture *create_density_texture(FluidDomainSettings *fds, i return nullptr; } - blender::gpu::Texture *tex = create_volume_texture(dim, GPU_R8, GPU_DATA_FLOAT, data); + blender::gpu::Texture *tex = create_volume_texture( + dim, blender::gpu::TextureFormat::UNORM_8, GPU_DATA_FLOAT, data); swizzle_texture_channel_single(tex); return tex; } @@ -359,7 +369,8 @@ static blender::gpu::Texture *create_color_texture(FluidDomainSettings *fds, int manta_smoke_get_rgba(fds->fluid, data, 0); } - blender::gpu::Texture *tex = create_volume_texture(dim, GPU_RGBA8, GPU_DATA_FLOAT, data); + blender::gpu::Texture *tex = create_volume_texture( + dim, blender::gpu::TextureFormat::UNORM_8_8_8_8, GPU_DATA_FLOAT, data); MEM_freeN(data); @@ -384,7 +395,8 @@ static blender::gpu::Texture *create_flame_texture(FluidDomainSettings *fds, int source = manta_smoke_get_flame(fds->fluid); } - blender::gpu::Texture *tex = create_volume_texture(dim, GPU_R8, GPU_DATA_FLOAT, source); + blender::gpu::Texture *tex = create_volume_texture( + dim, blender::gpu::TextureFormat::UNORM_8, GPU_DATA_FLOAT, source); swizzle_texture_channel_single(tex); return tex; } @@ -476,8 +488,10 @@ void DRW_smoke_ensure(FluidModifierData *fmd, int highres) BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_flame_coba)); } if (!fds->tex_shadow) { - fds->tex_shadow = create_volume_texture( - fds->res, GPU_R8, GPU_DATA_FLOAT, manta_smoke_get_shadow(fds->fluid)); + fds->tex_shadow = create_volume_texture(fds->res, + blender::gpu::TextureFormat::UNORM_8, + GPU_DATA_FLOAT, + manta_smoke_get_shadow(fds->fluid)); BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_shadow)); } } @@ -503,12 +517,24 @@ void DRW_smoke_ensure_velocity(FluidModifierData *fmd) } if (!fds->tex_velocity_x) { - fds->tex_velocity_x = GPU_texture_create_3d( - "velx", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_x); - fds->tex_velocity_y = GPU_texture_create_3d( - "vely", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_y); - fds->tex_velocity_z = GPU_texture_create_3d( - "velz", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_z); + fds->tex_velocity_x = GPU_texture_create_3d("velx", + UNPACK3(fds->res), + 1, + blender::gpu::TextureFormat::SFLOAT_16, + GPU_TEXTURE_USAGE_SHADER_READ, + vel_x); + fds->tex_velocity_y = GPU_texture_create_3d("vely", + UNPACK3(fds->res), + 1, + blender::gpu::TextureFormat::SFLOAT_16, + GPU_TEXTURE_USAGE_SHADER_READ, + vel_y); + fds->tex_velocity_z = GPU_texture_create_3d("velz", + UNPACK3(fds->res), + 1, + blender::gpu::TextureFormat::SFLOAT_16, + GPU_TEXTURE_USAGE_SHADER_READ, + vel_z); BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_x)); BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_y)); BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_z)); @@ -525,8 +551,10 @@ void DRW_fluid_ensure_flags(FluidModifierData *fmd) if (fmd->type & MOD_FLUID_TYPE_DOMAIN) { FluidDomainSettings *fds = fmd->domain; if (!fds->tex_flags) { - fds->tex_flags = create_volume_texture( - fds->res, GPU_R8UI, GPU_DATA_INT, manta_smoke_get_flags(fds->fluid)); + fds->tex_flags = create_volume_texture(fds->res, + blender::gpu::TextureFormat::UINT_8, + GPU_DATA_INT, + manta_smoke_get_flags(fds->fluid)); BLI_addtail(&drw_get().data->smoke_textures, BLI_genericNodeN(&fds->tex_flags)); swizzle_texture_channel_single(fds->tex_flags); diff --git a/source/blender/draw/intern/draw_volume.cc b/source/blender/draw/intern/draw_volume.cc index 2a2d87fa4a4..152b209c2d5 100644 --- a/source/blender/draw/intern/draw_volume.cc +++ b/source/blender/draw/intern/draw_volume.cc @@ -71,8 +71,8 @@ struct VolumeModule { const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f}; const eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ; - dummy_zero.ensure_3d(GPU_RGBA32F, int3(1), usage, zero); - dummy_one.ensure_3d(GPU_RGBA32F, int3(1), usage, one); + dummy_zero.ensure_3d(blender::gpu::TextureFormat::SFLOAT_32_32_32_32, int3(1), usage, zero); + dummy_one.ensure_3d(blender::gpu::TextureFormat::SFLOAT_32_32_32_32, int3(1), usage, one); GPU_texture_extend_mode(dummy_zero, GPU_SAMPLER_EXTEND_MODE_REPEAT); GPU_texture_extend_mode(dummy_one, GPU_SAMPLER_EXTEND_MODE_REPEAT); } diff --git a/source/blender/draw/tests/draw_pass_test.cc b/source/blender/draw/tests/draw_pass_test.cc index b286a050bda..8a62179a41b 100644 --- a/source/blender/draw/tests/draw_pass_test.cc +++ b/source/blender/draw/tests/draw_pass_test.cc @@ -21,7 +21,7 @@ namespace blender::draw { static void test_draw_pass_all_commands() { Texture tex; - tex.ensure_2d(GPU_RGBA16, int2(1)); + tex.ensure_2d(blender::gpu::TextureFormat::UNORM_16_16_16_16, int2(1)); UniformBuffer ubo; ubo.push_update(); @@ -277,7 +277,7 @@ static void test_draw_resource_id_gen() GPU_render_begin(); Texture color_attachment; Framebuffer framebuffer; - color_attachment.ensure_2d(GPU_RGBA32F, int2(1)); + color_attachment.ensure_2d(blender::gpu::TextureFormat::SFLOAT_32_32_32_32, int2(1)); framebuffer.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(color_attachment)); framebuffer.bind(); @@ -364,7 +364,7 @@ static void test_draw_visibility() GPU_render_begin(); Texture color_attachment; Framebuffer framebuffer; - color_attachment.ensure_2d(GPU_RGBA32F, int2(1)); + color_attachment.ensure_2d(blender::gpu::TextureFormat::SFLOAT_32_32_32_32, int2(1)); framebuffer.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(color_attachment)); framebuffer.bind(); @@ -386,7 +386,7 @@ static void test_draw_visibility() drw.end_sync(); Texture tex; - tex.ensure_2d(GPU_RGBA16F, int2(1)); + tex.ensure_2d(blender::gpu::TextureFormat::SFLOAT_16_16_16_16, int2(1)); PassMain pass = {"test.visibility"}; pass.init(); @@ -507,7 +507,7 @@ static void test_draw_submit_only() Texture color_attachment; Framebuffer framebuffer; - color_attachment.ensure_2d(GPU_RGBA32F, int2(1)); + color_attachment.ensure_2d(blender::gpu::TextureFormat::SFLOAT_32_32_32_32, int2(1)); framebuffer.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(color_attachment)); framebuffer.bind(); diff --git a/source/blender/draw/tests/eevee_test.cc b/source/blender/draw/tests/eevee_test.cc index 2cf32ef5a70..337a282b06e 100644 --- a/source/blender/draw/tests/eevee_test.cc +++ b/source/blender/draw/tests/eevee_test.cc @@ -851,7 +851,7 @@ static void test_eevee_shadow_finalize() } Texture tilemap_tx = {"tilemap_tx"}; - tilemap_tx.ensure_2d(GPU_R32UI, + tilemap_tx.ensure_2d(blender::gpu::TextureFormat::UINT_32, int2(SHADOW_TILEMAP_RES), GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE); @@ -1248,7 +1248,7 @@ static void test_eevee_shadow_tilemap_amend() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; int2 tilemap_res(SHADOW_TILEMAP_RES * SHADOW_TILEMAP_PER_ROW, SHADOW_TILEMAP_RES); - tilemap_tx.ensure_2d(GPU_R32UI, tilemap_res, usage); + tilemap_tx.ensure_2d(blender::gpu::TextureFormat::UINT_32, tilemap_res, usage); GPU_texture_update_sub( tilemap_tx, GPU_DATA_UINT, tilemap_data.data(), 0, 0, 0, tilemap_res.x, tilemap_res.y, 0); diff --git a/source/blender/editors/grease_pencil/intern/grease_pencil_image_render.cc b/source/blender/editors/grease_pencil/intern/grease_pencil_image_render.cc index 5839e9d94e0..d6fe3b30078 100644 --- a/source/blender/editors/grease_pencil/intern/grease_pencil_image_render.cc +++ b/source/blender/editors/grease_pencil/intern/grease_pencil_image_render.cc @@ -81,8 +81,13 @@ GPUOffScreen *image_render_begin(const int2 &win_size) } char err_out[256] = "unknown"; - GPUOffScreen *offscreen = GPU_offscreen_create( - win_size.x, win_size.y, true, GPU_RGBA8, GPU_TEXTURE_USAGE_HOST_READ, false, err_out); + GPUOffScreen *offscreen = GPU_offscreen_create(win_size.x, + win_size.y, + true, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + GPU_TEXTURE_USAGE_HOST_READ, + false, + err_out); if (offscreen == nullptr) { return nullptr; } diff --git a/source/blender/editors/include/BIF_glutil.hh b/source/blender/editors/include/BIF_glutil.hh index 2d9f3b19fa7..6fb2ef0b914 100644 --- a/source/blender/editors/include/BIF_glutil.hh +++ b/source/blender/editors/include/BIF_glutil.hh @@ -57,7 +57,7 @@ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, @@ -85,7 +85,7 @@ void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, @@ -96,7 +96,7 @@ void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float clip_min_x, @@ -111,7 +111,7 @@ void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, @@ -138,7 +138,7 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, diff --git a/source/blender/editors/interface/interface_draw.cc b/source/blender/editors/interface/interface_draw.cc index 00022e93eec..d3d582a19d4 100644 --- a/source/blender/editors/interface/interface_draw.cc +++ b/source/blender/editors/interface/interface_draw.cc @@ -370,7 +370,7 @@ void ui_draw_but_IMAGE(ARegion * /*region*/, float(rect->ymin), ibuf->x, ibuf->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, false, ibuf->byte_buffer.data, 1.0f, @@ -2285,7 +2285,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *region, rect.ymin + 1, drawibuf->x, drawibuf->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, true, drawibuf->byte_buffer.data, 1.0f, diff --git a/source/blender/editors/interface/interface_icons.cc b/source/blender/editors/interface/interface_icons.cc index 30453b757e1..4fdac13bf63 100644 --- a/source/blender/editors/interface/interface_icons.cc +++ b/source/blender/editors/interface/interface_icons.cc @@ -1464,8 +1464,19 @@ static void icon_draw_rect(float x, immUniform1f("factor", desaturate); } - immDrawPixelsTexScaledFullSize( - &state, draw_x, draw_y, rw, rh, GPU_RGBA8, true, rect, scale_x, scale_y, 1.0f, 1.0f, col); + immDrawPixelsTexScaledFullSize(&state, + draw_x, + draw_y, + rw, + rh, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + true, + rect, + scale_x, + scale_y, + 1.0f, + 1.0f, + col); } /* Drawing size for preview images */ diff --git a/source/blender/editors/interface/regions/interface_region_tooltip.cc b/source/blender/editors/interface/regions/interface_region_tooltip.cc index 4bcb23ebda4..a14b1ba8440 100644 --- a/source/blender/editors/interface/regions/interface_region_tooltip.cc +++ b/source/blender/editors/interface/regions/interface_region_tooltip.cc @@ -308,7 +308,7 @@ static void ui_tooltip_region_draw_cb(const bContext * /*C*/, ARegion *region) bbox.ymax, field->image->ibuf->x, field->image->ibuf->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, true, field->image->ibuf->byte_buffer.data, 1.0f, diff --git a/source/blender/editors/mask/mask_draw.cc b/source/blender/editors/mask/mask_draw.cc index b4a446afe56..e55f58cc3f0 100644 --- a/source/blender/editors/mask/mask_draw.cc +++ b/source/blender/editors/mask/mask_draw.cc @@ -727,12 +727,30 @@ void ED_mask_draw_region( if (overlay_mode == MASK_OVERLAY_COMBINED) { const float blend_col[4] = {0.0f, 0.0f, 0.0f, blend_factor}; - immDrawPixelsTexTiled( - &state, 0.0f, 0.0f, width, height, GPU_R16F, false, buffer, 1.0f, 1.0f, blend_col); + immDrawPixelsTexTiled(&state, + 0.0f, + 0.0f, + width, + height, + blender::gpu::TextureFormat::SFLOAT_16, + false, + buffer, + 1.0f, + 1.0f, + blend_col); } else { - immDrawPixelsTexTiled( - &state, 0.0f, 0.0f, width, height, GPU_R16F, false, buffer, 1.0f, 1.0f, nullptr); + immDrawPixelsTexTiled(&state, + 0.0f, + 0.0f, + width, + height, + blender::gpu::TextureFormat::SFLOAT_16, + false, + buffer, + 1.0f, + 1.0f, + nullptr); } GPU_matrix_pop(); diff --git a/source/blender/editors/render/render_opengl.cc b/source/blender/editors/render/render_opengl.cc index 222d924e219..4c1e29c6e3e 100644 --- a/source/blender/editors/render/render_opengl.cc +++ b/source/blender/editors/render/render_opengl.cc @@ -771,7 +771,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) ofs = GPU_offscreen_create(sizex, sizey, true, - GPU_RGBA16F, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_HOST_READ, false, err_out); diff --git a/source/blender/editors/screen/glutil.cc b/source/blender/editors/screen/glutil.cc index 357d2ea7de8..23c44fc5b62 100644 --- a/source/blender/editors/screen/glutil.cc +++ b/source/blender/editors/screen/glutil.cc @@ -53,7 +53,7 @@ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, const float y, const int img_w, const int img_h, - const eGPUTextureFormat gpu_format, + const blender::gpu::TextureFormat gpu_format, const bool use_filter, const void *rect, const float scaleX, @@ -74,7 +74,10 @@ void immDrawPixelsTexScaledFullSize(const IMMDrawPixelsTexState *state, blender::gpu::Texture *tex = GPU_texture_create_2d( "immDrawPixels", img_w, img_h, mip_len, gpu_format, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); - const bool use_float_data = ELEM(gpu_format, GPU_RGBA16F, GPU_RGB16F, GPU_R16F); + const bool use_float_data = ELEM(gpu_format, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + blender::gpu::TextureFormat::SFLOAT_16_16_16, + blender::gpu::TextureFormat::SFLOAT_16); eGPUDataFormat gpu_data_format = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE; GPU_texture_update(tex, gpu_data_format, rect); @@ -124,7 +127,7 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, @@ -154,13 +157,19 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, const bool use_clipping = ((clip_min_x < clip_max_x) && (clip_min_y < clip_max_y)); const float white[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - if (ELEM(gpu_format, GPU_RGBA8, GPU_RGBA16F)) { + if (ELEM(gpu_format, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16)) + { components = 4; } - else if (ELEM(gpu_format, GPU_RGB16F)) { + else if (ELEM(gpu_format, blender::gpu::TextureFormat::SFLOAT_16_16_16)) { components = 3; } - else if (ELEM(gpu_format, GPU_R8, GPU_R16F)) { + else if (ELEM(gpu_format, + blender::gpu::TextureFormat::UNORM_8, + blender::gpu::TextureFormat::SFLOAT_16)) + { components = 1; } else { @@ -168,7 +177,10 @@ void immDrawPixelsTexTiled_scaling_clipping(IMMDrawPixelsTexState *state, return; } - const bool use_float_data = ELEM(gpu_format, GPU_RGBA16F, GPU_RGB16F, GPU_R16F); + const bool use_float_data = ELEM(gpu_format, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + blender::gpu::TextureFormat::SFLOAT_16_16_16, + blender::gpu::TextureFormat::SFLOAT_16); eGPUDataFormat gpu_data = (use_float_data) ? GPU_DATA_FLOAT : GPU_DATA_UBYTE; size_t stride = components * ((use_float_data) ? sizeof(float) : sizeof(uchar)); @@ -299,7 +311,7 @@ void immDrawPixelsTexTiled_scaling(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float scaleX, @@ -332,7 +344,7 @@ void immDrawPixelsTexTiled(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float xzoom, @@ -363,7 +375,7 @@ void immDrawPixelsTexTiled_clipping(IMMDrawPixelsTexState *state, float y, int img_w, int img_h, - eGPUTextureFormat gpu_format, + blender::gpu::TextureFormat gpu_format, bool use_filter, const void *rect, float clip_min_x, @@ -408,6 +420,8 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, float zoom_x, float zoom_y) { + using namespace blender::gpu; + bool force_fallback = false; bool need_fallback = true; @@ -456,19 +470,19 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, if (ok) { if (ibuf->float_buffer.data) { - eGPUTextureFormat format = eGPUTextureFormat(0); + TextureFormat format = TextureFormat::Invalid; if (ibuf->channels == 3) { - format = GPU_RGB16F; + format = TextureFormat::SFLOAT_16_16_16; } else if (ibuf->channels == 4) { - format = GPU_RGBA16F; + format = TextureFormat::SFLOAT_16_16_16_16; } else { BLI_assert_msg(0, "Incompatible number of channels for GLSL display"); } - if (format != 0) { + if (format != TextureFormat::Invalid) { immDrawPixelsTexTiled_clipping(&state, x, y, @@ -493,7 +507,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, y, ibuf->x, ibuf->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, use_filter, ibuf->byte_buffer.data, clip_min_x, @@ -526,7 +540,7 @@ void ED_draw_imbuf_clipping(ImBuf *ibuf, y, ibuf->x, ibuf->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, use_filter, display_buffer, clip_min_x, diff --git a/source/blender/editors/sculpt_paint/paint_cursor.cc b/source/blender/editors/sculpt_paint/paint_cursor.cc index 50deaefc277..979a77396bf 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.cc +++ b/source/blender/editors/sculpt_paint/paint_cursor.cc @@ -357,7 +357,8 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima } if (!target->overlay_texture) { - eGPUTextureFormat format = col ? GPU_RGBA8 : GPU_R8; + blender::gpu::TextureFormat format = col ? blender::gpu::TextureFormat::UNORM_8_8_8_8 : + blender::gpu::TextureFormat::UNORM_8; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; target->overlay_texture = GPU_texture_create_2d( "paint_cursor_overlay", size, size, 1, format, usage, nullptr); @@ -474,8 +475,13 @@ static int load_tex_cursor(Brush *br, ViewContext *vc, float zoom) if (!cursor_snap.overlay_texture) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; - cursor_snap.overlay_texture = GPU_texture_create_2d( - "cursor_snap_overaly", size, size, 1, GPU_R8, usage, nullptr); + cursor_snap.overlay_texture = GPU_texture_create_2d("cursor_snap_overaly", + size, + size, + 1, + blender::gpu::TextureFormat::UNORM_8, + usage, + nullptr); GPU_texture_update(cursor_snap.overlay_texture, GPU_DATA_UBYTE, buffer); GPU_texture_swizzle_set(cursor_snap.overlay_texture, "rrrr"); diff --git a/source/blender/editors/space_clip/clip_draw.cc b/source/blender/editors/space_clip/clip_draw.cc index de52aa30113..37a1314f63a 100644 --- a/source/blender/editors/space_clip/clip_draw.cc +++ b/source/blender/editors/space_clip/clip_draw.cc @@ -1223,13 +1223,14 @@ static void draw_plane_marker_image(Scene *scene, GPU_blend(GPU_BLEND_ALPHA); } - blender::gpu::Texture *texture = GPU_texture_create_2d("plane_marker_image", - ibuf->x, - ibuf->y, - 1, - GPU_RGBA8, - GPU_TEXTURE_USAGE_SHADER_READ, - nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d( + "plane_marker_image", + ibuf->x, + ibuf->y, + 1, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + GPU_TEXTURE_USAGE_SHADER_READ, + nullptr); GPU_texture_update(texture, GPU_DATA_UBYTE, display_buffer); GPU_texture_filter_mode(texture, false); diff --git a/source/blender/editors/space_file/file_draw.cc b/source/blender/editors/space_file/file_draw.cc index cc1af51bd0f..8bf32e68cf6 100644 --- a/source/blender/editors/space_file/file_draw.cc +++ b/source/blender/editors/space_file/file_draw.cc @@ -701,7 +701,7 @@ static void file_draw_preview(const FileDirEntry *file, float(ymin), imb->x, imb->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, true, imb->byte_buffer.data, scale, diff --git a/source/blender/editors/space_image/image_buttons.cc b/source/blender/editors/space_image/image_buttons.cc index 70b880133d7..53981f925c1 100644 --- a/source/blender/editors/space_image/image_buttons.cc +++ b/source/blender/editors/space_image/image_buttons.cc @@ -1233,7 +1233,7 @@ void uiTemplateImageInfo(uiLayout *layout, bContext *C, Image *ima, ImageUser *i } } - eGPUTextureFormat texture_format = IMB_gpu_get_texture_format( + blender::gpu::TextureFormat texture_format = IMB_gpu_get_texture_format( ibuf, ima->flag & IMA_HIGH_BITDEPTH, ibuf->planes >= 8); const char *texture_format_description = GPU_texture_format_name(texture_format); ofs += BLI_snprintf_rlen(str + ofs, len - ofs, RPT_(", %s"), texture_format_description); diff --git a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc index 0136cfa3a7f..1e4c3f01c28 100644 --- a/source/blender/editors/space_sequencer/sequencer_preview_draw.cc +++ b/source/blender/editors/space_sequencer/sequencer_preview_draw.cc @@ -736,7 +736,7 @@ static void sequencer_draw_scopes(const SpaceSeq &space_sequencer, ARegion ®i IMB_byte_from_float(scope_image); } - eGPUTextureFormat format = GPU_RGBA8; + blender::gpu::TextureFormat format = blender::gpu::TextureFormat::UNORM_8_8_8_8; eGPUDataFormat data = GPU_DATA_UBYTE; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; blender::gpu::Texture *texture = GPU_texture_create_2d( @@ -1390,16 +1390,16 @@ static blender::gpu::Texture *create_texture(const ImBuf &ibuf) blender::gpu::Texture *texture = nullptr; if (ibuf.float_buffer.data) { - eGPUTextureFormat texture_format; + blender::gpu::TextureFormat texture_format; switch (ibuf.channels) { case 1: - texture_format = GPU_R32F; + texture_format = blender::gpu::TextureFormat::SFLOAT_32; break; case 3: - texture_format = GPU_RGB32F; + texture_format = blender::gpu::TextureFormat::SFLOAT_32_32_32; break; case 4: - texture_format = GPU_RGBA32F; + texture_format = blender::gpu::TextureFormat::SFLOAT_32_32_32_32; break; default: BLI_assert_msg(0, "Incompatible number of channels for float buffer in sequencer"); @@ -1411,8 +1411,13 @@ static blender::gpu::Texture *create_texture(const ImBuf &ibuf) GPU_texture_update(texture, GPU_DATA_FLOAT, ibuf.float_buffer.data); } else if (ibuf.byte_buffer.data) { - texture = GPU_texture_create_2d( - "seq_display_buf", ibuf.x, ibuf.y, 1, GPU_RGBA8, texture_usage, nullptr); + texture = GPU_texture_create_2d("seq_display_buf", + ibuf.x, + ibuf.y, + 1, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + texture_usage, + nullptr); GPU_texture_update(texture, GPU_DATA_UBYTE, ibuf.byte_buffer.data); } diff --git a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc index efa371726be..f32f0f71747 100644 --- a/source/blender/editors/space_sequencer/sequencer_thumbnails.cc +++ b/source/blender/editors/space_sequencer/sequencer_thumbnails.cc @@ -373,8 +373,13 @@ void draw_strip_thumbnails(TimelineDrawContext *ctx, IMB_freeImBuf(info.ibuf); info.ibuf = nullptr; } - blender::gpu::Texture *atlas = GPU_texture_create_2d( - "thumb_atlas", tex_width, tex_height, 1, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + blender::gpu::Texture *atlas = GPU_texture_create_2d("thumb_atlas", + tex_width, + tex_height, + 1, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + GPU_TEXTURE_USAGE_SHADER_READ, + nullptr); GPU_texture_update(atlas, GPU_DATA_UBYTE, tex_data.data()); GPU_texture_filter_mode(atlas, true); GPU_texture_extend_mode(atlas, GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER); diff --git a/source/blender/editors/space_view3d/view3d_draw.cc b/source/blender/editors/space_view3d/view3d_draw.cc index dd2889509cb..9b2f17edb0f 100644 --- a/source/blender/editors/space_view3d/view3d_draw.cc +++ b/source/blender/editors/space_view3d/view3d_draw.cc @@ -2014,7 +2014,9 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, float winmat[4][4]; /* Guess format based on output buffer. */ - eGPUTextureFormat desired_format = (imbuf_flag & IB_float_data) ? GPU_RGBA16F : GPU_RGBA8; + blender::gpu::TextureFormat desired_format = + (imbuf_flag & IB_float_data) ? blender::gpu::TextureFormat::SFLOAT_16_16_16_16 : + blender::gpu::TextureFormat::UNORM_8_8_8_8; if (ofs && ((GPU_offscreen_width(ofs) != sizex) || (GPU_offscreen_height(ofs) != sizey))) { /* If offscreen has already been created, recreate with the same format. */ @@ -2857,8 +2859,13 @@ bool ViewportColorSampleSession::init(ARegion *region) * copy that back to the host. * Since color picking is a fairly rare operation, the inefficiency here doesn't really * matter, and it means the viewport doesn't need HOST_READ. */ - tex = GPU_texture_create_2d( - "copy_tex", tex_w, tex_h, 1, GPU_RGBA16F, GPU_TEXTURE_USAGE_HOST_READ, nullptr); + tex = GPU_texture_create_2d("copy_tex", + tex_w, + tex_h, + 1, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_HOST_READ, + nullptr); if (tex == nullptr) { return false; } diff --git a/source/blender/gpu/GPU_framebuffer.hh b/source/blender/gpu/GPU_framebuffer.hh index c8a560c24c4..27c45fe10d3 100644 --- a/source/blender/gpu/GPU_framebuffer.hh +++ b/source/blender/gpu/GPU_framebuffer.hh @@ -653,7 +653,7 @@ struct GPUOffScreen; GPUOffScreen *GPU_offscreen_create(int width, int height, bool with_depth_buffer, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256]); @@ -715,7 +715,7 @@ blender::gpu::Texture *GPU_offscreen_color_texture(const GPUOffScreen *offscreen /** * Return the texture format of a #GPUOffScreen. */ -eGPUTextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen); +blender::gpu::TextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen); /** * Return the internals of a #GPUOffScreen. Does not give ownership. diff --git a/source/blender/gpu/GPU_texture.hh b/source/blender/gpu/GPU_texture.hh index d1c58a91cff..49bc4ded0a5 100644 --- a/source/blender/gpu/GPU_texture.hh +++ b/source/blender/gpu/GPU_texture.hh @@ -647,103 +647,13 @@ struct GPUSamplerState { /** \name Enums * \{ */ -/** - * Types of texture internal storage. Defines how the data is stored inside the video memory. - * Be aware that some formats are not supported by render-buffers. - */ -enum eGPUTextureFormat { - /* Formats texture & render-buffer. */ - - GPU_RGBA8UI = uint8_t(blender::gpu::TextureFormat::UINT_8_8_8_8), - GPU_RGBA8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8_8_8), - GPU_RGBA8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8_8_8), - GPU_RGBA16UI = uint8_t(blender::gpu::TextureFormat::UINT_16_16_16_16), - GPU_RGBA16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16_16_16), - GPU_RGBA16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16_16_16), - GPU_RGBA16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16_16_16), - GPU_RGBA32UI = uint8_t(blender::gpu::TextureFormat::UINT_32_32_32_32), - GPU_RGBA32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32_32_32), - GPU_RGBA32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32_32_32), - - GPU_RG8UI = uint8_t(blender::gpu::TextureFormat::UINT_8_8), - GPU_RG8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8), - GPU_RG8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8), - GPU_RG16UI = uint8_t(blender::gpu::TextureFormat::UINT_16_16), - GPU_RG16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16), - GPU_RG16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16), - GPU_RG16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16), - GPU_RG32UI = uint8_t(blender::gpu::TextureFormat::UINT_32_32), - GPU_RG32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32), - GPU_RG32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32), - - GPU_R8UI = uint8_t(blender::gpu::TextureFormat::UINT_8), - GPU_R8I = uint8_t(blender::gpu::TextureFormat::SINT_8), - GPU_R8 = uint8_t(blender::gpu::TextureFormat::UNORM_8), - GPU_R16UI = uint8_t(blender::gpu::TextureFormat::UINT_16), - GPU_R16I = uint8_t(blender::gpu::TextureFormat::SINT_16), - GPU_R16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16), - GPU_R16 = uint8_t(blender::gpu::TextureFormat::UNORM_16), - GPU_R32UI = uint8_t(blender::gpu::TextureFormat::UINT_32), - GPU_R32I = uint8_t(blender::gpu::TextureFormat::SINT_32), - GPU_R32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32), - - /* Special formats texture & render-buffer. */ - - GPU_RGB10_A2 = uint8_t(blender::gpu::TextureFormat::UNORM_10_10_10_2), - GPU_RGB10_A2UI = uint8_t(blender::gpu::TextureFormat::UINT_10_10_10_2), - GPU_R11F_G11F_B10F = uint8_t(blender::gpu::TextureFormat::UFLOAT_11_11_10), - GPU_DEPTH32F_STENCIL8 = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8), - GPU_SRGB8_A8 = uint8_t(blender::gpu::TextureFormat::SRGBA_8_8_8_8), - - /* Texture only formats. */ - - GPU_RGBA8_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_8_8_8_8), - GPU_RGB8_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_8_8_8), - GPU_RG8_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_8_8), - GPU_R8_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_8), - GPU_RGBA16_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_16_16_16_16), - GPU_RGB16_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_16_16_16), - GPU_RG16_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_16_16), - GPU_R16_SNORM = uint8_t(blender::gpu::TextureFormat::SNORM_16), - - GPU_RGB8UI = uint8_t(blender::gpu::TextureFormat::UINT_8_8_8), - GPU_RGB8I = uint8_t(blender::gpu::TextureFormat::SINT_8_8_8), - GPU_RGB8 = uint8_t(blender::gpu::TextureFormat::UNORM_8_8_8), - GPU_RGB16UI = uint8_t(blender::gpu::TextureFormat::UINT_16_16_16), - GPU_RGB16I = uint8_t(blender::gpu::TextureFormat::SINT_16_16_16), - GPU_RGB16F = uint8_t(blender::gpu::TextureFormat::SFLOAT_16_16_16), - GPU_RGB16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_16_16), - GPU_RGB32UI = uint8_t(blender::gpu::TextureFormat::UINT_32_32_32), - GPU_RGB32I = uint8_t(blender::gpu::TextureFormat::SINT_32_32_32), - GPU_RGB32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_32_32), - - /* Special formats, texture only. */ - GPU_SRGB8_A8_DXT1 = uint8_t(blender::gpu::TextureFormat::SRGB_DXT1), - GPU_SRGB8_A8_DXT3 = uint8_t(blender::gpu::TextureFormat::SRGB_DXT3), - GPU_SRGB8_A8_DXT5 = uint8_t(blender::gpu::TextureFormat::SRGB_DXT5), - GPU_RGBA8_DXT1 = uint8_t(blender::gpu::TextureFormat::SNORM_DXT1), - GPU_RGBA8_DXT3 = uint8_t(blender::gpu::TextureFormat::SNORM_DXT3), - GPU_RGBA8_DXT5 = uint8_t(blender::gpu::TextureFormat::SNORM_DXT5), - GPU_SRGB8 = uint8_t(blender::gpu::TextureFormat::SRGBA_8_8_8), - GPU_RGB9_E5 = uint8_t(blender::gpu::TextureFormat::UFLOAT_9_9_9_EXP_5), -#if 0 /* TODO: Add support for them. */ - GPU_COMPRESSED_RG_RGTC2, - GPU_COMPRESSED_SIGNED_RG_RGTC2, - GPU_COMPRESSED_RED_RGTC1, - GPU_COMPRESSED_SIGNED_RED_RGTC1, -#endif - - /* Depth Formats. */ - GPU_DEPTH_COMPONENT32F = uint8_t(blender::gpu::TextureFormat::SFLOAT_32_DEPTH), - GPU_DEPTH_COMPONENT16 = uint8_t(blender::gpu::TextureFormat::UNORM_16_DEPTH), -}; - /** * Types of data for data specification. * Used for formatting upload and download of data. - * When used with textures, they need to match or be compatible with the `eGPUTextureFormat` used. - * Check `validate_data_format` for compatibility list. + * When used with textures, they need to match or be compatible with the + * `blender::gpu::TextureFormat` used. Check `validate_data_format` for compatibility list. */ +/* TODO(fclem): Replace by gpu::DataFormat. */ enum eGPUDataFormat { GPU_DATA_FLOAT, GPU_DATA_HALF_FLOAT, @@ -820,21 +730,21 @@ class Texture; blender::gpu::Texture *GPU_texture_create_1d(const char *name, int width, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); blender::gpu::Texture *GPU_texture_create_1d_array(const char *name, int width, int layer_len, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); blender::gpu::Texture *GPU_texture_create_2d(const char *name, int width, int height, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); blender::gpu::Texture *GPU_texture_create_2d_array(const char *name, @@ -842,7 +752,7 @@ blender::gpu::Texture *GPU_texture_create_2d_array(const char *name, int height, int layer_len, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); blender::gpu::Texture *GPU_texture_create_3d(const char *name, @@ -850,20 +760,20 @@ blender::gpu::Texture *GPU_texture_create_3d(const char *name, int height, int depth, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const void *data); blender::gpu::Texture *GPU_texture_create_cube(const char *name, int width, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); blender::gpu::Texture *GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const float *data); /** @@ -875,7 +785,7 @@ blender::gpu::Texture *GPU_texture_create_compressed_2d(const char *name, int width, int height, int mip_len, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, const void *data); @@ -954,7 +864,7 @@ void GPU_texture_free(blender::gpu::Texture *texture); */ blender::gpu::Texture *GPU_texture_create_view(const char *name, blender::gpu::Texture *source_texture, - eGPUTextureFormat view_format, + blender::gpu::TextureFormat view_format, int mip_start, int mip_len, int layer_start, @@ -1204,7 +1114,7 @@ int GPU_texture_mip_count(const blender::gpu::Texture *texture); /** * Return the texture format of \a tex. */ -eGPUTextureFormat GPU_texture_format(const blender::gpu::Texture *texture); +blender::gpu::TextureFormat GPU_texture_format(const blender::gpu::Texture *texture); /** * Return the usage flags of \a tex. @@ -1295,7 +1205,7 @@ void GPU_texture_py_reference_set(blender::gpu::Texture *texture, void **py_ref) /** * Returns the number of components in a texture format. */ -size_t GPU_texture_component_len(eGPUTextureFormat format); +size_t GPU_texture_component_len(blender::gpu::TextureFormat format); /** * Return the expected number of bytes for one pixel of \a data_format data. @@ -1304,9 +1214,9 @@ size_t GPU_texture_dataformat_size(eGPUDataFormat data_format); /** * Return the texture format as a string for display purpose. - * Example: `GPU_RGBA8` returns as `"RGBA8"`. + * Example: `blender::gpu::TextureFormat::UNORM_8_8_8_8` returns as `"RGBA8"`. */ -const char *GPU_texture_format_name(eGPUTextureFormat format); +const char *GPU_texture_format_name(blender::gpu::TextureFormat format); /** * Returns the memory usage of all currently allocated textures in bytes. diff --git a/source/blender/gpu/GPU_texture_pool.hh b/source/blender/gpu/GPU_texture_pool.hh index fa7eb48a87d..38a32d2121b 100644 --- a/source/blender/gpu/GPU_texture_pool.hh +++ b/source/blender/gpu/GPU_texture_pool.hh @@ -45,7 +45,7 @@ class TexturePool { /* Acquire a texture from the pool with the given characteristics. */ blender::gpu::Texture *acquire_texture(int width, int height, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage); /* Release the texture so that its memory can be reused at some other point. */ void release_texture(blender::gpu::Texture *tmp_tex); diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index c88ad7124d2..105ae0895a6 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -731,7 +731,7 @@ static GPUFrameBuffer *gpu_offscreen_fb_get(GPUOffScreen *ofs) GPUOffScreen *GPU_offscreen_create(int width, int height, bool with_depth_buffer, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage, bool clear, char err_out[256]) @@ -751,8 +751,13 @@ GPUOffScreen *GPU_offscreen_create(int width, if (with_depth_buffer) { /* Format view flag is needed by Workbench Volumes to read the stencil view. */ eGPUTextureUsage depth_usage = usage | GPU_TEXTURE_USAGE_FORMAT_VIEW; - ofs->depth = GPU_texture_create_2d( - "ofs_depth", width, height, 1, GPU_DEPTH32F_STENCIL8, depth_usage, nullptr); + ofs->depth = GPU_texture_create_2d("ofs_depth", + width, + height, + 1, + blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, + depth_usage, + nullptr); } if ((with_depth_buffer && !ofs->depth) || !ofs->color) { @@ -876,7 +881,7 @@ blender::gpu::Texture *GPU_offscreen_color_texture(const GPUOffScreen *offscreen return offscreen->color; } -eGPUTextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen) +blender::gpu::TextureFormat GPU_offscreen_format(const GPUOffScreen *offscreen) { return GPU_texture_format(offscreen->color); } diff --git a/source/blender/gpu/intern/gpu_material.cc b/source/blender/gpu/intern/gpu_material.cc index 223ad1c2485..657bce85fcd 100644 --- a/source/blender/gpu/intern/gpu_material.cc +++ b/source/blender/gpu/intern/gpu_material.cc @@ -479,7 +479,7 @@ static void gpu_material_ramp_texture_build(GPUMaterial *mat) CM_TABLE + 1, builder->current_layer, 1, - GPU_RGBA16F, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_SHADER_READ, (float *)builder->pixels); @@ -498,7 +498,7 @@ static void gpu_material_sky_texture_build(GPUMaterial *mat) GPU_SKY_HEIGHT, mat->sky_builder->current_layer, 1, - GPU_RGBA32F, + blender::gpu::TextureFormat::SFLOAT_32_32_32_32, GPU_TEXTURE_USAGE_SHADER_READ, (float *)mat->sky_builder->pixels); diff --git a/source/blender/gpu/intern/gpu_shader_create_info.hh b/source/blender/gpu/intern/gpu_shader_create_info.hh index 2527cd28f89..5e162576447 100644 --- a/source/blender/gpu/intern/gpu_shader_create_info.hh +++ b/source/blender/gpu/intern/gpu_shader_create_info.hh @@ -169,9 +169,18 @@ .sampler(slot, ImageType::type, #name, Frequency::freq) # define IMAGE(slot, format, qualifiers, type, name) \ - .image(slot, format, Qualifier::qualifiers, ImageReadWriteType::type, #name) + .image(slot, \ + blender::gpu::TextureFormat::format, \ + Qualifier::qualifiers, \ + ImageReadWriteType::type, \ + #name) # define IMAGE_FREQ(slot, format, qualifiers, type, name, freq) \ - .image(slot, format, Qualifier::qualifiers, ImageReadWriteType::type, #name, Frequency::freq) + .image(slot, \ + blender::gpu::TextureFormat::format, \ + Qualifier::qualifiers, \ + ImageReadWriteType::type, \ + #name, \ + Frequency::freq) # define BUILTINS(builtin) .builtins(builtin) @@ -812,7 +821,7 @@ struct ShaderCreateInfo { }; struct Image { - eGPUTextureFormat format; + TextureFormat format; ImageType type; Qualifier qualifiers; StringRefNull name; @@ -1174,7 +1183,7 @@ struct ShaderCreateInfo { } Self &image(int slot, - eGPUTextureFormat format, + TextureFormat format, Qualifier qualifiers, ImageReadWriteType type, StringRefNull name, diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 3149bd0ef0f..44c8a203c82 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -54,7 +54,7 @@ Texture::~Texture() #endif } -bool Texture::init_1D(int w, int layers, int mip_len, eGPUTextureFormat format) +bool Texture::init_1D(int w, int layers, int mip_len, TextureFormat format) { w_ = w; h_ = layers; @@ -70,7 +70,7 @@ bool Texture::init_1D(int w, int layers, int mip_len, eGPUTextureFormat format) return this->init_internal(); } -bool Texture::init_2D(int w, int h, int layers, int mip_len, eGPUTextureFormat format) +bool Texture::init_2D(int w, int h, int layers, int mip_len, TextureFormat format) { w_ = w; h_ = h; @@ -86,7 +86,7 @@ bool Texture::init_2D(int w, int h, int layers, int mip_len, eGPUTextureFormat f return this->init_internal(); } -bool Texture::init_3D(int w, int h, int d, int mip_len, eGPUTextureFormat format) +bool Texture::init_3D(int w, int h, int d, int mip_len, TextureFormat format) { w_ = w; h_ = h; @@ -102,7 +102,7 @@ bool Texture::init_3D(int w, int h, int d, int mip_len, eGPUTextureFormat format return this->init_internal(); } -bool Texture::init_cubemap(int w, int layers, int mip_len, eGPUTextureFormat format) +bool Texture::init_cubemap(int w, int layers, int mip_len, TextureFormat format) { w_ = w; h_ = w; @@ -118,7 +118,7 @@ bool Texture::init_cubemap(int w, int layers, int mip_len, eGPUTextureFormat for return this->init_internal(); } -bool Texture::init_buffer(VertBuf *vbo, eGPUTextureFormat format) +bool Texture::init_buffer(VertBuf *vbo, TextureFormat format) { /* See to_texture_format(). */ w_ = GPU_vertbuf_get_vertex_len(vbo); @@ -131,7 +131,7 @@ bool Texture::init_buffer(VertBuf *vbo, eGPUTextureFormat format) } bool Texture::init_view(Texture *src, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureType type, int mip_start, int mip_len, @@ -255,7 +255,7 @@ static inline gpu::Texture *gpu_texture_create(const char *name, const int d, const eGPUTextureType type, int mip_len, - eGPUTextureFormat tex_format, + TextureFormat tex_format, eGPUTextureUsage usage, const void *pixels, eGPUDataFormat data_format = GPU_DATA_FLOAT) @@ -298,7 +298,7 @@ static inline gpu::Texture *gpu_texture_create(const char *name, gpu::Texture *GPU_texture_create_1d(const char *name, int width, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -309,7 +309,7 @@ gpu::Texture *GPU_texture_create_1d_array(const char *name, int width, int layer_len, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -321,7 +321,7 @@ gpu::Texture *GPU_texture_create_2d(const char *name, int width, int height, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -333,7 +333,7 @@ gpu::Texture *GPU_texture_create_2d_array(const char *name, int height, int layer_len, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -346,7 +346,7 @@ gpu::Texture *GPU_texture_create_3d(const char *name, int height, int depth, int mip_len, - eGPUTextureFormat texture_format, + TextureFormat texture_format, eGPUTextureUsage usage, const void *data) { @@ -357,7 +357,7 @@ gpu::Texture *GPU_texture_create_3d(const char *name, gpu::Texture *GPU_texture_create_cube(const char *name, int width, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -368,7 +368,7 @@ gpu::Texture *GPU_texture_create_cube_array(const char *name, int width, int layer_len, int mip_len, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureUsage usage, const float *data) { @@ -380,7 +380,7 @@ gpu::Texture *GPU_texture_create_compressed_2d(const char *name, int width, int height, int mip_len, - eGPUTextureFormat tex_format, + TextureFormat tex_format, eGPUTextureUsage usage, const void *data) { @@ -399,7 +399,8 @@ gpu::Texture *GPU_texture_create_compressed_2d(const char *name, tex->mip_size_get(mip, extent); size_t size = ((extent[0] + 3) / 4) * ((extent[1] + 3) / 4) * to_block_size(tex_format); - tex->update_sub(mip, offset, extent, to_data_format(tex_format), (uchar *)data + ofs); + tex->update_sub( + mip, offset, extent, to_texture_data_format(tex_format), (uchar *)data + ofs); ofs += size; } @@ -416,7 +417,7 @@ gpu::Texture *GPU_texture_create_from_vertbuf(const char *name, gpu::VertBuf *ve "Vertex Buffers used for textures should have usage flag " "GPU_USAGE_FLAG_BUFFER_TEXTURE_ONLY."); #endif - eGPUTextureFormat tex_format = to_texture_format(GPU_vertbuf_get_format(vert)); + TextureFormat tex_format = to_texture_format(GPU_vertbuf_get_format(vert)); Texture *tex = GPUBackend::get()->texture_alloc(name); bool success = tex->init_buffer(vert, tex_format); @@ -438,13 +439,20 @@ gpu::Texture *GPU_texture_create_error(int dimension, bool is_array) type = (dimension == 2) ? (is_array ? GPU_TEXTURE_2D_ARRAY : GPU_TEXTURE_2D) : type; type = (dimension == 1) ? (is_array ? GPU_TEXTURE_1D_ARRAY : GPU_TEXTURE_1D) : type; - return gpu_texture_create( - "invalid_tex", w, h, d, type, 1, GPU_RGBA8, GPU_TEXTURE_USAGE_GENERAL, pixel); + return gpu_texture_create("invalid_tex", + w, + h, + d, + type, + 1, + TextureFormat::UNORM_8_8_8_8, + GPU_TEXTURE_USAGE_GENERAL, + pixel); } gpu::Texture *GPU_texture_create_view(const char *name, gpu::Texture *source_texture, - eGPUTextureFormat view_format, + TextureFormat view_format, int mip_start, int mip_len, int layer_start, @@ -741,145 +749,148 @@ void GPU_texture_original_size_set(gpu::Texture *texture, int w, int h) texture->src_h = h; } -eGPUTextureFormat GPU_texture_format(const gpu::Texture *texture) +TextureFormat GPU_texture_format(const gpu::Texture *texture) { return texture->format_get(); } -const char *GPU_texture_format_name(eGPUTextureFormat texture_format) +const char *GPU_texture_format_name(TextureFormat texture_format) { switch (texture_format) { /* Formats texture & render-buffer */ - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return "RGBA8UI"; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return "RGBA8I"; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return "RGBA8"; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return "RGBA32UI"; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return "RGBA32I"; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return "RGBA32F"; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return "RGBA16UI"; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return "RGBA16I"; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return "RGBA16F"; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return "RGBA16"; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return "RG8UI"; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return "RG8I"; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return "RG8"; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return "RG32UI"; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return "RG32I"; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return "RG32F"; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return "RG16UI"; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return "RG16I"; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return "RG16F"; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return "RG16"; - case GPU_R8UI: + case TextureFormat::UINT_8: return "R8UI"; - case GPU_R8I: + case TextureFormat::SINT_8: return "R8I"; - case GPU_R8: + case TextureFormat::UNORM_8: return "R8"; - case GPU_R32UI: + case TextureFormat::UINT_32: return "R32UI"; - case GPU_R32I: + case TextureFormat::SINT_32: return "R32I"; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return "R32F"; - case GPU_R16UI: + case TextureFormat::UINT_16: return "R16UI"; - case GPU_R16I: + case TextureFormat::SINT_16: return "R16I"; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return "R16F"; - case GPU_R16: + case TextureFormat::UNORM_16: return "R16"; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return "RGB10_A2"; - case GPU_RGB10_A2UI: + case TextureFormat::UINT_10_10_10_2: return "RGB10_A2UI"; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return "R11F_G11F_B10F"; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return "DEPTH32F_STENCIL8"; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return "SRGB8_A8"; /* Texture only formats. */ - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: return "RGB16F"; - case GPU_RGB16_SNORM: + case TextureFormat::SNORM_16_16_16: return "RGB16_SNORM"; - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: return "RGB16I"; - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: return "RGB16UI"; - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: return "RGB16"; - case GPU_RGBA16_SNORM: + case TextureFormat::SNORM_16_16_16_16: return "RGBA16_SNORM"; - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_8_8_8_8: return "RGBA8_SNORM"; - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: return "RGB32F"; - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: return "RGB32I"; - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: return "RGB32UI"; - case GPU_RGB8_SNORM: + case TextureFormat::SNORM_8_8_8: return "RGB8_SNORM"; - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: return "RGB8"; - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: return "RGB8I"; - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: return "RGB8UI"; - case GPU_RG16_SNORM: + case TextureFormat::SNORM_16_16: return "RG16_SNORM"; - case GPU_RG8_SNORM: + case TextureFormat::SNORM_8_8: return "RG8_SNORM"; - case GPU_R16_SNORM: + case TextureFormat::SNORM_16: return "R16_SNORM"; - case GPU_R8_SNORM: + case TextureFormat::SNORM_8: return "R8_SNORM"; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: + case TextureFormat::SRGB_DXT1: return "SRGB8_A8_DXT1"; - case GPU_SRGB8_A8_DXT3: + case TextureFormat::SRGB_DXT3: return "SRGB8_A8_DXT3"; - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT5: return "SRGB8_A8_DXT5"; - case GPU_RGBA8_DXT1: + case TextureFormat::SNORM_DXT1: return "RGBA8_DXT1"; - case GPU_RGBA8_DXT3: + case TextureFormat::SNORM_DXT3: return "RGBA8_DXT3"; - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT5: return "RGBA8_DXT5"; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return "SRGB8"; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return "RGB9_E5"; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_DEPTH: return "DEPTH_COMPONENT32F"; - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UNORM_16_DEPTH: return "DEPTH_COMPONENT16"; + + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return ""; @@ -1014,7 +1025,7 @@ void GPU_samplers_update() /** \name GPU texture utilities * \{ */ -size_t GPU_texture_component_len(eGPUTextureFormat tex_format) +size_t GPU_texture_component_len(TextureFormat tex_format) { return to_component_len(tex_format); } diff --git a/source/blender/gpu/intern/gpu_texture_pool.cc b/source/blender/gpu/intern/gpu_texture_pool.cc index 8cb3685b01b..372c396d24c 100644 --- a/source/blender/gpu/intern/gpu_texture_pool.cc +++ b/source/blender/gpu/intern/gpu_texture_pool.cc @@ -27,7 +27,7 @@ TexturePool::~TexturePool() blender::gpu::Texture *TexturePool::acquire_texture(int width, int height, - eGPUTextureFormat format, + blender::gpu::TextureFormat format, eGPUTextureUsage usage) { int64_t match_index = -1; diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index affd0fcb9d1..8c704aaedfa 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -101,7 +101,7 @@ class Texture { /** Width & Height & Depth. For cube-map arrays, d is number of face-layers. */ int w_, h_, d_; /** Internal data format. */ - eGPUTextureFormat format_; + TextureFormat format_; /** Format characteristics. */ eGPUTextureFormatFlag format_flag_; /** Texture type. */ @@ -127,13 +127,13 @@ class Texture { virtual ~Texture(); /* Return true on success. */ - bool init_1D(int w, int layers, int mip_len, eGPUTextureFormat format); - bool init_2D(int w, int h, int layers, int mip_len, eGPUTextureFormat format); - bool init_3D(int w, int h, int d, int mip_len, eGPUTextureFormat format); - bool init_cubemap(int w, int layers, int mip_len, eGPUTextureFormat format); - bool init_buffer(VertBuf *vbo, eGPUTextureFormat format); - bool init_view(blender::gpu::Texture *src, - eGPUTextureFormat format, + bool init_1D(int w, int layers, int mip_len, TextureFormat format); + bool init_2D(int w, int h, int layers, int mip_len, TextureFormat format); + bool init_3D(int w, int h, int d, int mip_len, TextureFormat format); + bool init_cubemap(int w, int layers, int mip_len, TextureFormat format); + bool init_buffer(VertBuf *vbo, TextureFormat format); + bool init_view(Texture *src, + TextureFormat format, eGPUTextureType type, int mip_start, int mip_len, @@ -251,7 +251,7 @@ class Texture { return mipmaps_; } - eGPUTextureFormat format_get() const + TextureFormat format_get() const { return format_; } @@ -266,43 +266,43 @@ class Texture { GPUAttachmentType attachment_type(int slot) const { switch (format_) { - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: BLI_assert(slot == 0); return GPU_FB_DEPTH_ATTACHMENT; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: BLI_assert(slot == 0); return GPU_FB_DEPTH_STENCIL_ATTACHMENT; default: /* Valid color attachment formats. */ return GPU_FB_COLOR_ATTACHMENT0 + slot; - case GPU_RGB16F: - case GPU_RGBA16_SNORM: - case GPU_RGBA8_SNORM: - case GPU_RGB32F: - case GPU_RGB32I: - case GPU_RGB32UI: - case GPU_RGB16_SNORM: - case GPU_RGB16I: - case GPU_RGB16UI: - case GPU_RGB16: - case GPU_RGB8_SNORM: - case GPU_RGB8: - case GPU_RGB8I: - case GPU_RGB8UI: - case GPU_RG16_SNORM: - case GPU_RG8_SNORM: - case GPU_R16_SNORM: - case GPU_R8_SNORM: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: BLI_assert_msg(0, "Texture cannot be attached to a framebuffer because of its type"); return GPU_FB_COLOR_ATTACHMENT0; } @@ -348,125 +348,127 @@ static inline const PixelBuffer *unwrap(const GPUPixelBuffer *pixbuf) #undef DEBUG_NAME_LEN -inline size_t to_bytesize(eGPUTextureFormat format) +inline size_t to_bytesize(TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA8: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: return (4 * 8) / 8; - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RGBA32F: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: return (4 * 32) / 8; - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA16F: - case GPU_RGBA16: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: return (4 * 16) / 8; - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG8: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UNORM_8_8: return (2 * 8) / 8; - case GPU_RG32UI: - case GPU_RG32I: - case GPU_RG32F: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SFLOAT_32_32: return (2 * 32) / 8; - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG16F: - case GPU_RG16: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::UNORM_16_16: return (2 * 16) / 8; - case GPU_R8UI: - case GPU_R8I: - case GPU_R8: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UNORM_8: return 8 / 8; - case GPU_R32UI: - case GPU_R32I: - case GPU_R32F: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::SFLOAT_32: return 32 / 8; - case GPU_R16UI: - case GPU_R16I: - case GPU_R16F: - case GPU_R16: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16: return 16 / 8; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: return (3 * 10 + 2) / 8; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return (11 + 11 + 10) / 8; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: /* 32-bit depth, 8 bits stencil, and 24 unused bits. */ return (32 + 8 + 24) / 8; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return (3 * 8 + 8) / 8; /* Texture only formats. */ - case GPU_RGB16F: - case GPU_RGB16_SNORM: - case GPU_RGB16I: - case GPU_RGB16UI: - case GPU_RGB16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UNORM_16_16_16: return (3 * 16) / 8; - case GPU_RGBA16_SNORM: + case TextureFormat::SNORM_16_16_16_16: return (4 * 16) / 8; - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_8_8_8_8: return (4 * 8) / 8; - case GPU_RGB32F: - case GPU_RGB32I: - case GPU_RGB32UI: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::UINT_32_32_32: return (3 * 32) / 8; - case GPU_RGB8_SNORM: - case GPU_RGB8: - case GPU_RGB8I: - case GPU_RGB8UI: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UINT_8_8_8: return (3 * 8) / 8; - case GPU_RG16_SNORM: + case TextureFormat::SNORM_16_16: return (2 * 16) / 8; - case GPU_RG8_SNORM: + case TextureFormat::SNORM_8_8: return (2 * 8) / 8; - case GPU_R16_SNORM: + case TextureFormat::SNORM_16: return (1 * 16) / 8; - case GPU_R8_SNORM: + case TextureFormat::SNORM_8: return (1 * 8) / 8; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: /* Incorrect but actual size is fractional. */ return 1; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return (3 * 8) / 8; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return (3 * 9 + 5) / 8; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_DEPTH: return 32 / 8; - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UNORM_16_DEPTH: return 16 / 8; + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return 0; } -inline size_t to_block_size(eGPUTextureFormat data_type) +inline size_t to_block_size(TextureFormat data_type) { switch (data_type) { - case GPU_SRGB8_A8_DXT1: - case GPU_RGBA8_DXT1: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SNORM_DXT1: return 8; - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: return 16; default: BLI_assert_msg(0, "Texture format is not a compressed format"); @@ -474,231 +476,237 @@ inline size_t to_block_size(eGPUTextureFormat data_type) } } -inline eGPUTextureFormatFlag to_format_flag(eGPUTextureFormat format) +inline eGPUTextureFormatFlag to_format_flag(TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return GPU_FORMAT_INTEGER; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return GPU_FORMAT_INTEGER; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return GPU_FORMAT_INTEGER; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return GPU_FORMAT_INTEGER; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return GPU_FORMAT_INTEGER; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return GPU_FORMAT_INTEGER; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_R8UI: + case TextureFormat::UINT_8: return GPU_FORMAT_INTEGER; - case GPU_R8I: + case TextureFormat::SINT_8: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_R8: + case TextureFormat::UNORM_8: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_R32UI: + case TextureFormat::UINT_32: return GPU_FORMAT_INTEGER; - case GPU_R32I: + case TextureFormat::SINT_32: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_R16UI: + case TextureFormat::UINT_16: return GPU_FORMAT_INTEGER; - case GPU_R16I: + case TextureFormat::SINT_16: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_R16: + case TextureFormat::UNORM_16: return GPU_FORMAT_NORMALIZED_INTEGER; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RGB10_A2UI: + case TextureFormat::UINT_10_10_10_2: return GPU_FORMAT_INTEGER; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return GPU_FORMAT_FLOAT; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return GPU_FORMAT_DEPTH_STENCIL; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SRGB; /* Texture only formats. */ - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RGB16_SNORM: + case TextureFormat::SNORM_16_16_16: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: return GPU_FORMAT_INTEGER; - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RGBA16_SNORM: - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_8_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: return GPU_FORMAT_FLOAT | GPU_FORMAT_SIGNED; - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: return GPU_FORMAT_INTEGER; - case GPU_RGB8_SNORM: + case TextureFormat::SNORM_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER; - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: return GPU_FORMAT_INTEGER | GPU_FORMAT_SIGNED; - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: return GPU_FORMAT_INTEGER; - case GPU_RG16_SNORM: - case GPU_RG8_SNORM: - case GPU_R16_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SIGNED; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_COMPRESSED | GPU_FORMAT_SRGB; - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_COMPRESSED; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return GPU_FORMAT_NORMALIZED_INTEGER | GPU_FORMAT_SRGB; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return GPU_FORMAT_FLOAT; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return GPU_FORMAT_DEPTH; + + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return GPU_FORMAT_FLOAT; } -inline int to_component_len(eGPUTextureFormat format) +inline int to_component_len(TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA8: - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RGBA32F: - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA16F: - case GPU_RGBA16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: return 4; - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG8: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_RG32F: - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG16F: - case GPU_RG16: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::UNORM_16_16: return 2; - case GPU_R8UI: - case GPU_R8I: - case GPU_R8: - case GPU_R32UI: - case GPU_R32I: - case GPU_R32F: - case GPU_R16UI: - case GPU_R16I: - case GPU_R16F: - case GPU_R16: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UNORM_8: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16: return 1; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: return 4; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return 3; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: /* Only count depth component. */ return 1; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return 4; /* Texture only formats. */ - case GPU_RGB16F: - case GPU_RGB16_SNORM: - case GPU_RGB16I: - case GPU_RGB16UI: - case GPU_RGB16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UNORM_16_16_16: return 3; - case GPU_RGBA16_SNORM: - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_8_8_8_8: return 4; - case GPU_RGB32F: - case GPU_RGB32I: - case GPU_RGB32UI: - case GPU_RGB8_SNORM: - case GPU_RGB8: - case GPU_RGB8I: - case GPU_RGB8UI: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UINT_8_8_8: return 3; - case GPU_RG16_SNORM: - case GPU_RG8_SNORM: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8_8: return 2; - case GPU_R16_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8: return 1; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: return 4; - case GPU_SRGB8: - case GPU_RGB9_E5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return 3; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return 1; + + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return 1; @@ -724,13 +732,14 @@ inline size_t to_bytesize(eGPUDataFormat data_format) return 0; } -inline size_t to_bytesize(eGPUTextureFormat tex_format, eGPUDataFormat data_format) +inline size_t to_bytesize(TextureFormat tex_format, eGPUDataFormat data_format) { /* Special case for compacted types. * Standard component len calculation does not apply, as the texture formats contain multiple * channels, but associated data format contains several compacted components. */ - if ((tex_format == GPU_R11F_G11F_B10F && data_format == GPU_DATA_10_11_11_REV) || - ((tex_format == GPU_RGB10_A2 || tex_format == GPU_RGB10_A2UI) && + if ((tex_format == TextureFormat::UFLOAT_11_11_10 && data_format == GPU_DATA_10_11_11_REV) || + ((tex_format == TextureFormat::UNORM_10_10_10_2 || + tex_format == TextureFormat::UINT_10_10_10_2) && data_format == GPU_DATA_2_10_10_10_REV)) { return 4; @@ -740,319 +749,327 @@ inline size_t to_bytesize(eGPUTextureFormat tex_format, eGPUDataFormat data_form } /* Definitely not complete, edit according to the gl specification. */ -constexpr bool validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format) +constexpr bool validate_data_format(TextureFormat tex_format, eGPUDataFormat data_format) { switch (tex_format) { /* Formats texture & render-buffer */ - case GPU_RGBA32UI: - case GPU_RG32UI: - case GPU_R32UI: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_32_32: + case TextureFormat::UINT_32: return ELEM(data_format, GPU_DATA_UINT); - case GPU_RGBA16UI: - case GPU_RG16UI: - case GPU_R16UI: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::UINT_16_16: + case TextureFormat::UINT_16: return ELEM(data_format, GPU_DATA_UINT); /* Also GPU_DATA_USHORT if needed. */ - case GPU_RGBA8UI: - case GPU_RG8UI: - case GPU_R8UI: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UINT_8: return ELEM(data_format, GPU_DATA_UINT, GPU_DATA_UBYTE); - case GPU_RGBA32I: - case GPU_RG32I: - case GPU_R32I: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_32: return ELEM(data_format, GPU_DATA_INT); - case GPU_RGBA16I: - case GPU_RG16I: - case GPU_R16I: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SINT_16: return ELEM(data_format, GPU_DATA_INT); /* Also GPU_DATA_SHORT if needed. */ - case GPU_RGBA8I: - case GPU_RG8I: - case GPU_R8I: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::SINT_8: return ELEM(data_format, GPU_DATA_INT); /* Also GPU_DATA_BYTE if needed. */ - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: return ELEM(data_format, GPU_DATA_FLOAT); - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_HALF_FLOAT); - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: return ELEM(data_format, GPU_DATA_FLOAT); /* Also GPU_DATA_USHORT if needed. */ - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UBYTE); /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_2_10_10_10_REV); - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_10_11_11_REV); - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: /* Should have its own type. For now, we rely on the backend to do the conversion. */ return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UINT_24_8_DEPRECATED, GPU_DATA_UINT); - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UBYTE); /* Texture only formats. */ - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: return ELEM(data_format, GPU_DATA_UINT); - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: return ELEM(data_format, GPU_DATA_UINT); /* Also GPU_DATA_SHORT if needed. */ - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: return ELEM(data_format, GPU_DATA_UINT); /* Also GPU_DATA_BYTE if needed. */ - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: return ELEM(data_format, GPU_DATA_INT); - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: return ELEM(data_format, GPU_DATA_INT); /* Also GPU_DATA_USHORT if needed. */ - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: return ELEM(data_format, GPU_DATA_INT, GPU_DATA_UBYTE); - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: return ELEM(data_format, GPU_DATA_FLOAT); /* Also GPU_DATA_USHORT if needed. */ - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UBYTE); - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: return ELEM(data_format, GPU_DATA_FLOAT); /* Also GPU_DATA_SHORT if needed. */ - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: return ELEM(data_format, GPU_DATA_FLOAT); /* Also GPU_DATA_BYTE if needed. */ - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: return ELEM(data_format, GPU_DATA_FLOAT); - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_HALF_FLOAT); /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: /* TODO(fclem): GPU_DATA_COMPRESSED for each compression? Wouldn't it be overkill? * For now, expect format to be set to float. */ return ELEM(data_format, GPU_DATA_FLOAT); - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UBYTE); - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return ELEM(data_format, GPU_DATA_FLOAT); /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return ELEM(data_format, GPU_DATA_FLOAT, GPU_DATA_UINT); + + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return data_format == GPU_DATA_FLOAT; } /* Return default data format for an internal texture format. */ -inline eGPUDataFormat to_data_format(eGPUTextureFormat tex_format) +inline eGPUDataFormat to_texture_data_format(TextureFormat tex_format) { switch (tex_format) { /* Formats texture & render-buffer */ - case GPU_RGBA32UI: - case GPU_RG32UI: - case GPU_R32UI: - case GPU_RGBA16UI: - case GPU_RG16UI: - case GPU_R16UI: - case GPU_RGBA8UI: - case GPU_RG8UI: - case GPU_R8UI: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_32_32: + case TextureFormat::UINT_32: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::UINT_16_16: + case TextureFormat::UINT_16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UINT_8: return GPU_DATA_UINT; - case GPU_RGBA32I: - case GPU_RG32I: - case GPU_R32I: - case GPU_RGBA16I: - case GPU_RG16I: - case GPU_R16I: - case GPU_RGBA8I: - case GPU_RG8I: - case GPU_R8I: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_32: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SINT_16: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::SINT_8: return GPU_DATA_INT; - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: return GPU_DATA_FLOAT; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: return GPU_DATA_2_10_10_10_REV; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return GPU_DATA_10_11_11_REV; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: /* Should have its own type. For now, we rely on the backend to do the conversion. */ return GPU_DATA_UINT_24_8_DEPRECATED; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return GPU_DATA_FLOAT; /* Texture only formats. */ - case GPU_RGB32UI: - case GPU_RGB16UI: - case GPU_RGB8UI: + case TextureFormat::UINT_32_32_32: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UINT_8_8_8: return GPU_DATA_UINT; - case GPU_RGB32I: - case GPU_RGB16I: - case GPU_RGB8I: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SINT_8_8_8: return GPU_DATA_INT; - case GPU_RGB16: - case GPU_RGB8: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::UNORM_8_8_8: return GPU_DATA_FLOAT; - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: return GPU_DATA_FLOAT; - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: return GPU_DATA_FLOAT; - case GPU_RGB32F: - case GPU_RGB16F: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SFLOAT_16_16_16: return GPU_DATA_FLOAT; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: /* TODO(fclem): GPU_DATA_COMPRESSED for each compression? Wouldn't it be overkill? * For now, expect format to be set to float. */ return GPU_DATA_FLOAT; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return GPU_DATA_FLOAT; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return GPU_DATA_FLOAT; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return GPU_DATA_FLOAT; + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return GPU_DATA_FLOAT; } -inline eGPUFrameBufferBits to_framebuffer_bits(eGPUTextureFormat tex_format) +inline eGPUFrameBufferBits to_framebuffer_bits(TextureFormat tex_format) { switch (tex_format) { /* Formats texture & render-buffer */ - case GPU_RGBA32UI: - case GPU_RG32UI: - case GPU_R32UI: - case GPU_RGBA16UI: - case GPU_RG16UI: - case GPU_R16UI: - case GPU_RGBA8UI: - case GPU_RG8UI: - case GPU_R8UI: - case GPU_RGBA32I: - case GPU_RG32I: - case GPU_R32I: - case GPU_RGBA16I: - case GPU_RG16I: - case GPU_R16I: - case GPU_RGBA8I: - case GPU_RG8I: - case GPU_R8I: - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_32_32: + case TextureFormat::UINT_32: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::UINT_16_16: + case TextureFormat::UINT_16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UINT_8: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_32: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SINT_16: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::SINT_8: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: return GPU_COLOR_BIT; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_SRGB8_A8: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SRGBA_8_8_8_8: return GPU_COLOR_BIT; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return GPU_DEPTH_BIT | GPU_STENCIL_BIT; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return GPU_DEPTH_BIT; /* Texture only formats. */ - case GPU_RGB32UI: - case GPU_RGB16UI: - case GPU_RGB8UI: - case GPU_RGB32I: - case GPU_RGB16I: - case GPU_RGB8I: - case GPU_RGB16: - case GPU_RGB8: - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: - case GPU_RGB32F: - case GPU_RGB16F: + case TextureFormat::UINT_32_32_32: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SFLOAT_16_16_16: BLI_assert_msg(0, "This texture format is not compatible with framebuffer attachment."); return GPU_COLOR_BIT; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: BLI_assert_msg(0, "This texture format is not compatible with framebuffer attachment."); return GPU_COLOR_BIT; + + case TextureFormat::Invalid: + BLI_assert_unreachable(); } BLI_assert_unreachable(); return GPU_COLOR_BIT; } -static inline eGPUTextureFormat to_texture_format(const GPUVertFormat *format) +static inline TextureFormat to_texture_format(const GPUVertFormat *format) { if (format->attr_len == 0) { BLI_assert_msg(0, "Incorrect vertex format for buffer texture"); - return eGPUTextureFormat(0); + return TextureFormat(0); } - return eGPUTextureFormat(format->attrs[0].type.format); + return TextureFormat(format->attrs[0].type.format); } } // namespace blender::gpu diff --git a/source/blender/gpu/intern/gpu_viewport.cc b/source/blender/gpu/intern/gpu_viewport.cc index 5767064caff..741054bdc9b 100644 --- a/source/blender/gpu/intern/gpu_viewport.cc +++ b/source/blender/gpu/intern/gpu_viewport.cc @@ -136,28 +136,40 @@ static void gpu_viewport_textures_create(GPUViewport *viewport) /* NOTE: dtxl_color texture requires write support as it may be written to by the viewport * compositor. */ - viewport->color_render_tx[0] = GPU_texture_create_2d("dtxl_color", - UNPACK2(size), - 1, - GPU_RGBA16F, - usage | GPU_TEXTURE_USAGE_SHADER_WRITE, - nullptr); + viewport->color_render_tx[0] = GPU_texture_create_2d( + "dtxl_color", + UNPACK2(size), + 1, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + usage | GPU_TEXTURE_USAGE_SHADER_WRITE, + nullptr); viewport->color_overlay_tx[0] = GPU_texture_create_2d( - "dtxl_color_overlay", UNPACK2(size), 1, GPU_SRGB8_A8, usage, nullptr); + "dtxl_color_overlay", + UNPACK2(size), + 1, + blender::gpu::TextureFormat::SRGBA_8_8_8_8, + usage, + nullptr); GPU_texture_clear(viewport->color_render_tx[0], GPU_DATA_FLOAT, empty_pixel); GPU_texture_clear(viewport->color_overlay_tx[0], GPU_DATA_FLOAT, empty_pixel); } if ((viewport->flag & GPU_VIEWPORT_STEREO) != 0 && viewport->color_render_tx[1] == nullptr) { - viewport->color_render_tx[1] = GPU_texture_create_2d("dtxl_color_stereo", - UNPACK2(size), - 1, - GPU_RGBA16F, - usage | GPU_TEXTURE_USAGE_SHADER_WRITE, - nullptr); + viewport->color_render_tx[1] = GPU_texture_create_2d( + "dtxl_color_stereo", + UNPACK2(size), + 1, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + usage | GPU_TEXTURE_USAGE_SHADER_WRITE, + nullptr); viewport->color_overlay_tx[1] = GPU_texture_create_2d( - "dtxl_color_overlay_stereo", UNPACK2(size), 1, GPU_SRGB8_A8, usage, nullptr); + "dtxl_color_overlay_stereo", + UNPACK2(size), + 1, + blender::gpu::TextureFormat::SRGBA_8_8_8_8, + usage, + nullptr); GPU_texture_clear(viewport->color_render_tx[1], GPU_DATA_FLOAT, empty_pixel); GPU_texture_clear(viewport->color_overlay_tx[1], GPU_DATA_FLOAT, empty_pixel); @@ -170,7 +182,7 @@ static void gpu_viewport_textures_create(GPUViewport *viewport) viewport->depth_tx = GPU_texture_create_2d("dtxl_depth", UNPACK2(size), 1, - GPU_DEPTH32F_STENCIL8, + blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8, usage | GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_FORMAT_VIEW, nullptr); diff --git a/source/blender/gpu/metal/mtl_context.mm b/source/blender/gpu/metal/mtl_context.mm index 5680fa28d0c..3503cb45f5e 100644 --- a/source/blender/gpu/metal/mtl_context.mm +++ b/source/blender/gpu/metal/mtl_context.mm @@ -124,8 +124,10 @@ void MTLContext::set_ghost_context(GHOST_ContextHandle ghostCtxHandle) /*** Create front and back-buffers ***/ /* Create gpu::MTLTexture objects */ - default_fbo_gputexture_ = new gpu::MTLTexture( - "MTL_BACKBUFFER", GPU_RGBA16F, GPU_TEXTURE_2D, default_fbo_mtltexture_); + default_fbo_gputexture_ = new gpu::MTLTexture("MTL_BACKBUFFER", + TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_2D, + default_fbo_mtltexture_); /* Update frame-buffers with new texture attachments. */ mtl_front_left->add_color_attachment(default_fbo_gputexture_, 0, 0, 0); @@ -138,8 +140,14 @@ void MTLContext::set_ghost_context(GHOST_ContextHandle ghostCtxHandle) /* Add default texture for cases where no other framebuffer is bound */ if (!default_fbo_gputexture_) { - default_fbo_gputexture_ = static_cast(GPU_texture_create_2d( - __func__, 16, 16, 1, GPU_RGBA16F, GPU_TEXTURE_USAGE_GENERAL, nullptr)); + default_fbo_gputexture_ = static_cast( + GPU_texture_create_2d(__func__, + 16, + 16, + 1, + TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_GENERAL, + nullptr)); } mtl_back_left->add_color_attachment(default_fbo_gputexture_, 0, 0, 0); @@ -611,19 +619,19 @@ gpu::MTLTexture *MTLContext::get_dummy_texture(eGPUTextureType type, return dummy_tex; } /* Determine format for dummy texture. */ - eGPUTextureFormat format = GPU_RGBA8; + TextureFormat format = TextureFormat::UNORM_8_8_8_8; switch (sampler_format) { case GPU_SAMPLER_TYPE_FLOAT: - format = GPU_RGBA8; + format = TextureFormat::UNORM_8_8_8_8; break; case GPU_SAMPLER_TYPE_INT: - format = GPU_RGBA8I; + format = TextureFormat::SINT_8_8_8_8; break; case GPU_SAMPLER_TYPE_UINT: - format = GPU_RGBA8UI; + format = TextureFormat::UINT_8_8_8_8; break; case GPU_SAMPLER_TYPE_DEPTH: - format = GPU_DEPTH32F_STENCIL8; + format = TextureFormat::SFLOAT_32_DEPTH_UINT_8; break; default: BLI_assert_unreachable(); diff --git a/source/blender/gpu/metal/mtl_framebuffer.mm b/source/blender/gpu/metal/mtl_framebuffer.mm index c41035be64a..42ee7f6fb0c 100644 --- a/source/blender/gpu/metal/mtl_framebuffer.mm +++ b/source/blender/gpu/metal/mtl_framebuffer.mm @@ -693,9 +693,9 @@ void MTLFrameBuffer::update_attachments(bool /*update_viewport*/) } /* Check stencil component -- if supplied texture format supports stencil. */ - eGPUTextureFormat format = GPU_texture_format(attach.tex); + TextureFormat format = GPU_texture_format(attach.tex); bool use_stencil = (type == GPU_FB_DEPTH_STENCIL_ATTACHMENT) && - (format == GPU_DEPTH32F_STENCIL8); + (format == TextureFormat::SFLOAT_32_DEPTH_UINT_8); if (use_stencil) { if (this->has_stencil_attachment()) { MTLAttachment stencil_attachment_prev = this->get_stencil_attachment(); @@ -782,7 +782,7 @@ void MTLFrameBuffer::update_attachments(bool /*update_viewport*/) int size[3]; GPU_texture_get_mipmap_size(attach.tex, attach.mip, size); this->size_set(size[0], size[1]); - srgb_ = (GPU_texture_format(attach.tex) == GPU_SRGB8_A8); + srgb_ = (GPU_texture_format(attach.tex) == TextureFormat::SRGBA_8_8_8_8); } /* We have now updated our internal structures. */ diff --git a/source/blender/gpu/metal/mtl_texture.hh b/source/blender/gpu/metal/mtl_texture.hh index dccb2910819..edebcf55494 100644 --- a/source/blender/gpu/metal/mtl_texture.hh +++ b/source/blender/gpu/metal/mtl_texture.hh @@ -267,7 +267,7 @@ class MTLTexture : public Texture { public: MTLTexture(const char *name); MTLTexture(const char *name, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureType type, id metal_texture); ~MTLTexture() override; @@ -500,7 +500,7 @@ class MTLPixelBuffer : public PixelBuffer { }; /* Utility */ -MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format); +MTLPixelFormat gpu_texture_format_to_metal(TextureFormat tex_format); size_t get_mtl_format_bytesize(MTLPixelFormat tex_format); int get_mtl_format_num_components(MTLPixelFormat tex_format); bool mtl_format_supports_blending(MTLPixelFormat format); diff --git a/source/blender/gpu/metal/mtl_texture.mm b/source/blender/gpu/metal/mtl_texture.mm index 547962338ee..54e3b89699e 100644 --- a/source/blender/gpu/metal/mtl_texture.mm +++ b/source/blender/gpu/metal/mtl_texture.mm @@ -71,7 +71,7 @@ gpu::MTLTexture::MTLTexture(const char *name) : Texture(name) } gpu::MTLTexture::MTLTexture(const char *name, - eGPUTextureFormat format, + TextureFormat format, eGPUTextureType type, id metal_texture) : Texture(name) @@ -616,7 +616,7 @@ void gpu::MTLTexture::update_sub( } } - if (format_ == GPU_SRGB8_A8 && !can_use_direct_blit) { + if (format_ == TextureFormat::SRGBA_8_8_8_8 && !can_use_direct_blit) { MTL_LOG_WARNING( "SRGB data upload does not work correctly using compute upload. " "texname '%s'", @@ -1253,8 +1253,8 @@ void gpu::MTLTexture::generate_mipmap() } /* Verify if we can perform mipmap generation. */ - if (format_ == GPU_DEPTH_COMPONENT32F || format_ == GPU_DEPTH_COMPONENT16 || - format_ == GPU_DEPTH32F_STENCIL8) + if (format_ == TextureFormat::SFLOAT_32_DEPTH || format_ == TextureFormat::UNORM_16_DEPTH || + format_ == TextureFormat::SFLOAT_32_DEPTH_UINT_8) { MTL_LOG_WARNING("Cannot generate mipmaps for textures using DEPTH formats"); return; @@ -1604,7 +1604,7 @@ void gpu::MTLTexture::read_internal(int mip, bool is_depth_format = (format_flag_ & GPU_FORMAT_DEPTH); /* Verify if we need to use compute read. */ - eGPUDataFormat data_format = to_data_format(this->format_get()); + eGPUDataFormat data_format = to_texture_data_format(this->format_get()); bool format_conversion_needed = (data_format != desired_output_format); bool can_use_simple_read = (desired_output_bpp == image_bpp) && (!format_conversion_needed) && (num_output_components == image_components); @@ -1621,13 +1621,15 @@ void gpu::MTLTexture::read_internal(int mip, BLI_assert(validate_data_format(format_, data_format)); } - /* SPECIAL Workaround for R11G11B10, GPU_RGB10_A2, GPU_RGB10_A2UI textures requesting a read - * using: GPU_DATA_10_11_11_REV. */ + /* SPECIAL Workaround for R11G11B10, TextureFormat::UNORM_10_10_10_2, + * TextureFormat::UINT_10_10_10_2 textures requesting a read using: + * GPU_DATA_10_11_11_REV. */ if (desired_output_format == GPU_DATA_10_11_11_REV || desired_output_format == GPU_DATA_2_10_10_10_REV) { - BLI_assert(format_ == GPU_R11F_G11F_B10F || format_ == GPU_RGB10_A2 || - format_ == GPU_RGB10_A2UI); + BLI_assert(format_ == TextureFormat::UFLOAT_11_11_10 || + format_ == TextureFormat::UNORM_10_10_10_2 || + format_ == TextureFormat::UINT_10_10_10_2); /* override parameters - we'll be able to use simple copy, as bpp will match at 4 bytes. */ image_bpp = sizeof(int); @@ -1707,7 +1709,7 @@ void gpu::MTLTexture::read_internal(int mip, read_texture = this->get_metal_handle(); } /* Create Texture View for SRGB special case to bypass internal type conversion. */ - if (format_ == GPU_SRGB8_A8) { + if (format_ == TextureFormat::SRGBA_8_8_8_8) { BLI_assert(internal_gpu_image_usage_flags_ & GPU_TEXTURE_USAGE_FORMAT_VIEW); read_texture = [read_texture newTextureViewWithPixelFormat:MTLPixelFormatRGBA8Unorm]; } @@ -2182,7 +2184,7 @@ bool gpu::MTLTexture::init_internal(gpu::Texture *src, /* Stencil view support. */ texture_view_stencil_ = false; if (use_stencil) { - BLI_assert(ELEM(format_, GPU_DEPTH32F_STENCIL8)); + BLI_assert(ELEM(format_, TextureFormat::SFLOAT_32_DEPTH_UINT_8)); texture_view_stencil_ = true; } @@ -2263,7 +2265,7 @@ void gpu::MTLTexture::ensure_baked() /* SRGB textures require a texture view for reading data and when rendering with SRGB * disabled. Enabling the texture_view or texture_read usage flags disables lossless * compression, so the situations in which it is used should be limited. */ - if (format_ == GPU_SRGB8_A8) { + if (format_ == TextureFormat::SRGBA_8_8_8_8) { internal_gpu_image_usage_flags_ |= GPU_TEXTURE_USAGE_FORMAT_VIEW; } @@ -2571,7 +2573,7 @@ MTLStorageBuf *gpu::MTLTexture::get_storagebuf() * \{ */ bool MTLTexture::is_format_srgb() { - return (format_ == GPU_SRGB8_A8); + return (format_ == TextureFormat::SRGBA_8_8_8_8); } id MTLTexture::get_non_srgb_handle() diff --git a/source/blender/gpu/metal/mtl_texture_util.mm b/source/blender/gpu/metal/mtl_texture_util.mm index 3cbb56c0d77..91ac95dfe42 100644 --- a/source/blender/gpu/metal/mtl_texture_util.mm +++ b/source/blender/gpu/metal/mtl_texture_util.mm @@ -32,153 +32,155 @@ namespace blender::gpu { /** \name Texture Utility Functions * \{ */ -MTLPixelFormat gpu_texture_format_to_metal(eGPUTextureFormat tex_format) +MTLPixelFormat gpu_texture_format_to_metal(TextureFormat tex_format) { switch (tex_format) { /* Texture & Render-Buffer Formats. */ - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return MTLPixelFormatRGBA8Uint; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return MTLPixelFormatRGBA8Sint; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return MTLPixelFormatRGBA8Unorm; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return MTLPixelFormatRGBA32Uint; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return MTLPixelFormatRGBA32Sint; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return MTLPixelFormatRGBA32Float; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return MTLPixelFormatRGBA16Uint; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return MTLPixelFormatRGBA16Sint; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return MTLPixelFormatRGBA16Float; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return MTLPixelFormatRGBA16Unorm; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return MTLPixelFormatRG8Uint; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return MTLPixelFormatRG8Sint; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return MTLPixelFormatRG8Unorm; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return MTLPixelFormatRG32Uint; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return MTLPixelFormatRG32Sint; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return MTLPixelFormatRG32Float; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return MTLPixelFormatRG16Uint; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return MTLPixelFormatRG16Sint; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return MTLPixelFormatRG16Float; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return MTLPixelFormatRG16Unorm; - case GPU_R8UI: + case TextureFormat::UINT_8: return MTLPixelFormatR8Uint; - case GPU_R8I: + case TextureFormat::SINT_8: return MTLPixelFormatR8Sint; - case GPU_R8: + case TextureFormat::UNORM_8: return MTLPixelFormatR8Unorm; - case GPU_R32UI: + case TextureFormat::UINT_32: return MTLPixelFormatR32Uint; - case GPU_R32I: + case TextureFormat::SINT_32: return MTLPixelFormatR32Sint; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return MTLPixelFormatR32Float; - case GPU_R16UI: + case TextureFormat::UINT_16: return MTLPixelFormatR16Uint; - case GPU_R16I: + case TextureFormat::SINT_16: return MTLPixelFormatR16Sint; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return MTLPixelFormatR16Float; - case GPU_R16: + case TextureFormat::UNORM_16: return MTLPixelFormatR16Unorm; /* Special formats texture & render-buffer. */ - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return MTLPixelFormatRGB10A2Unorm; - case GPU_RGB10_A2UI: + case TextureFormat::UINT_10_10_10_2: return MTLPixelFormatRGB10A2Uint; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return MTLPixelFormatRG11B10Float; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return MTLPixelFormatDepth32Float_Stencil8; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return MTLPixelFormatRGBA8Unorm_sRGB; /* Texture only formats. */ - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: /* 48-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA16Float; - case GPU_RGBA16_SNORM: + case TextureFormat::SNORM_16_16_16_16: return MTLPixelFormatRGBA16Snorm; - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_8_8_8_8: return MTLPixelFormatRGBA8Snorm; - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: /* 96-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA32Float; - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: /* 96-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA32Sint; - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: /* 96-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA32Uint; - case GPU_RGB16_SNORM: + case TextureFormat::SNORM_16_16_16: /* 48-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA16Snorm; - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: /* 48-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA16Sint; - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: /* 48-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA16Uint; - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: /* 48-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA16Unorm; - case GPU_RGB8_SNORM: + case TextureFormat::SNORM_8_8_8: /* 24-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA8Snorm; - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: /* 24-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA8Unorm; - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: /* 24-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA8Sint; - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: /* 24-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA8Uint; - case GPU_RG16_SNORM: + case TextureFormat::SNORM_16_16: return MTLPixelFormatRG16Snorm; - case GPU_RG8_SNORM: + case TextureFormat::SNORM_8_8: return MTLPixelFormatRG8Snorm; - case GPU_R16_SNORM: + case TextureFormat::SNORM_16: return MTLPixelFormatR16Snorm; - case GPU_R8_SNORM: + case TextureFormat::SNORM_8: return MTLPixelFormatR8Snorm; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: + case TextureFormat::SRGB_DXT1: return MTLPixelFormatBC1_RGBA_sRGB; - case GPU_SRGB8_A8_DXT3: + case TextureFormat::SRGB_DXT3: return MTLPixelFormatBC2_RGBA_sRGB; - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT5: return MTLPixelFormatBC3_RGBA_sRGB; - case GPU_RGBA8_DXT1: + case TextureFormat::SNORM_DXT1: return MTLPixelFormatBC1_RGBA; - case GPU_RGBA8_DXT3: + case TextureFormat::SNORM_DXT3: return MTLPixelFormatBC2_RGBA; - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT5: return MTLPixelFormatBC3_RGBA; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: /* 24-Bit pixel format are not supported. Emulate using a padded type with alpha. */ return MTLPixelFormatRGBA8Unorm_sRGB; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return MTLPixelFormatRGB9E5Float; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_DEPTH: return MTLPixelFormatDepth32Float; - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UNORM_16_DEPTH: return MTLPixelFormatDepth16Unorm; + case TextureFormat::Invalid: + BLI_assert_msg(false, "Unrecognised GPU pixel format!\n"); } BLI_assert_msg(false, "Unrecognised GPU pixel format!\n"); return MTLPixelFormatRGBA8Unorm; @@ -577,13 +579,16 @@ void gpu::MTLTexture::update_sub_depth_2d( int mip, int offset[3], int extent[3], eGPUDataFormat type, const void *data) { /* Verify we are in a valid configuration. */ - BLI_assert(ELEM(format_, GPU_DEPTH_COMPONENT32F, GPU_DEPTH_COMPONENT16, GPU_DEPTH32F_STENCIL8)); + BLI_assert(ELEM(format_, + TextureFormat::SFLOAT_32_DEPTH, + TextureFormat::UNORM_16_DEPTH, + TextureFormat::SFLOAT_32_DEPTH_UINT_8)); BLI_assert(validate_data_format(format_, type)); BLI_assert(ELEM(type, GPU_DATA_FLOAT, GPU_DATA_UINT_24_8_DEPRECATED, GPU_DATA_UINT)); /* Determine whether we are in GPU_DATA_UINT_24_8_DEPRECATED or GPU_DATA_FLOAT mode. */ bool is_float = (type == GPU_DATA_FLOAT); - eGPUTextureFormat format = (is_float) ? GPU_R32F : GPU_R32I; + TextureFormat format = (is_float) ? TextureFormat::SFLOAT_32 : TextureFormat::SINT_32; /* Shader key - Add parameters here for different configurations. */ DepthTextureUpdateRoutineSpecialisation specialization; diff --git a/source/blender/gpu/opengl/gl_backend.cc b/source/blender/gpu/opengl/gl_backend.cc index abec6e1e519..c3b34a11e95 100644 --- a/source/blender/gpu/opengl/gl_backend.cc +++ b/source/blender/gpu/opengl/gl_backend.cc @@ -474,8 +474,8 @@ static void detect_workarounds() } /* See #82856: AMD drivers since 20.11 running on a polaris architecture doesn't support the * `GL_INT_2_10_10_10_REV` data type correctly. This data type is used to pack normals and flags. - * The work around uses `GPU_RGBA16I`. In 22.?.? drivers this has been fixed for - * polaris platform. Keeping legacy platforms around just in case. + * The work around uses `TextureFormat::SINT_16_16_16_16`. In 22.?.? drivers this + * has been fixed for polaris platform. Keeping legacy platforms around just in case. */ if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_ANY, GPU_DRIVER_OFFICIAL)) { /* Check for AMD legacy driver. Assuming that when these drivers are used this bug is present. diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 9323a38c884..9d49a8c19e1 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -210,7 +210,7 @@ void GLFrameBuffer::update_attachments() int size[3]; GPU_texture_get_mipmap_size(attach.tex, attach.mip, size); this->size_set(size[0], size[1]); - srgb_ = (GPU_texture_format(attach.tex) == GPU_SRGB8_A8); + srgb_ = (GPU_texture_format(attach.tex) == TextureFormat::SRGBA_8_8_8_8); } else { /* Empty frame-buffer. */ diff --git a/source/blender/gpu/opengl/gl_framebuffer.hh b/source/blender/gpu/opengl/gl_framebuffer.hh index 1b3d1c275dc..e839367ea04 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.hh +++ b/source/blender/gpu/opengl/gl_framebuffer.hh @@ -38,7 +38,8 @@ class GLFrameBuffer : public FrameBuffer { GPUAttachment tmp_detached_[GPU_FB_MAX_ATTACHMENT]; /** Internal frame-buffers are immutable. */ bool immutable_ = false; - /** True is the frame-buffer has its first color target using the GPU_SRGB8_A8 format. */ + /** True is the frame-buffer has its first color target using the + * TextureFormat::SRGBA_8_8_8_8 format. */ bool srgb_ = false; /** True is the frame-buffer has been bound using the GL_FRAMEBUFFER_SRGB feature. */ bool enabled_srgb_ = false; diff --git a/source/blender/gpu/opengl/gl_shader.cc b/source/blender/gpu/opengl/gl_shader.cc index d1870406f5a..b9c31015720 100644 --- a/source/blender/gpu/opengl/gl_shader.cc +++ b/source/blender/gpu/opengl/gl_shader.cc @@ -231,72 +231,72 @@ static Type UNUSED_FUNCTION(to_component_type)(const Type &type) return Type::float_t; } -static const char *to_string(const eGPUTextureFormat &type) +static const char *to_string(const TextureFormat &type) { switch (type) { - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return "rgba8ui"; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return "rgba8i"; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return "rgba8"; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return "rgba32ui"; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return "rgba32i"; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return "rgba32f"; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return "rgba16ui"; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return "rgba16i"; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return "rgba16f"; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return "rgba16"; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return "rg8ui"; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return "rg8i"; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return "rg8"; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return "rg32ui"; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return "rg32i"; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return "rg32f"; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return "rg16ui"; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return "rg16i"; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return "rg16f"; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return "rg16"; - case GPU_R8UI: + case TextureFormat::UINT_8: return "r8ui"; - case GPU_R8I: + case TextureFormat::SINT_8: return "r8i"; - case GPU_R8: + case TextureFormat::UNORM_8: return "r8"; - case GPU_R32UI: + case TextureFormat::UINT_32: return "r32ui"; - case GPU_R32I: + case TextureFormat::SINT_32: return "r32i"; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return "r32f"; - case GPU_R16UI: + case TextureFormat::UINT_16: return "r16ui"; - case GPU_R16I: + case TextureFormat::SINT_16: return "r16i"; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return "r16f"; - case GPU_R16: + case TextureFormat::UNORM_16: return "r16"; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return "r11f_g11f_b10f"; - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return "rgb10_a2"; default: return "unknown"; diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index 6e7ccc9e8dd..748c4d53b9f 100644 --- a/source/blender/gpu/opengl/gl_texture.cc +++ b/source/blender/gpu/opengl/gl_texture.cc @@ -135,7 +135,7 @@ bool GLTexture::init_internal(gpu::Texture *src, debug::object_label(GL_TEXTURE, tex_id_, name_); /* Stencil view support. */ - if (ELEM(format_, GPU_DEPTH32F_STENCIL8)) { + if (ELEM(format_, TextureFormat::SFLOAT_32_DEPTH_UINT_8)) { stencil_texture_mode_set(use_stencil); } @@ -378,8 +378,8 @@ void *GLTexture::read(int mip, eGPUDataFormat type) * if the texture is big. (see #66573) */ void *data = MEM_mallocN(texture_size + 8, "GPU_texture_read"); - GLenum gl_format = to_gl_data_format(format_ == GPU_DEPTH32F_STENCIL8 ? GPU_DEPTH_COMPONENT32F : - format_); + GLenum gl_format = to_gl_data_format( + format_ == TextureFormat::SFLOAT_32_DEPTH_UINT_8 ? TextureFormat::SFLOAT_32_DEPTH : format_); GLenum gl_type = to_gl(type); if (GLContext::direct_state_access_support) { @@ -672,7 +672,7 @@ bool GLTexture::proxy_check(int mip) GLenum gl_proxy = to_gl_proxy(type_); GLenum internal_format = to_gl_internal_format(format_); GLenum gl_format = to_gl_data_format(format_); - GLenum gl_type = to_gl(to_data_format(format_)); + GLenum gl_type = to_gl(to_texture_data_format(format_)); /* Small exception. */ int dimensions = (type_ == GPU_TEXTURE_CUBE) ? 2 : this->dimensions_count(); diff --git a/source/blender/gpu/opengl/gl_texture.hh b/source/blender/gpu/opengl/gl_texture.hh index c667710d55e..833624be01c 100644 --- a/source/blender/gpu/opengl/gl_texture.hh +++ b/source/blender/gpu/opengl/gl_texture.hh @@ -146,139 +146,139 @@ class GLPixelBuffer : public PixelBuffer { MEM_CXX_CLASS_ALLOC_FUNCS("GLPixelBuffer") }; -inline GLenum to_gl_internal_format(eGPUTextureFormat format) +inline GLenum to_gl_internal_format(TextureFormat format) { switch (format) { /* Texture & Render-Buffer Formats. */ - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return GL_RGBA8UI; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return GL_RGBA8I; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return GL_RGBA8; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return GL_RGBA32UI; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return GL_RGBA32I; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return GL_RGBA32F; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return GL_RGBA16UI; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return GL_RGBA16I; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return GL_RGBA16F; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return GL_RGBA16; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return GL_RG8UI; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return GL_RG8I; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return GL_RG8; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return GL_RG32UI; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return GL_RG32I; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return GL_RG32F; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return GL_RG16UI; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return GL_RG16I; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return GL_RG16F; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return GL_RG16; - case GPU_R8UI: + case TextureFormat::UINT_8: return GL_R8UI; - case GPU_R8I: + case TextureFormat::SINT_8: return GL_R8I; - case GPU_R8: + case TextureFormat::UNORM_8: return GL_R8; - case GPU_R32UI: + case TextureFormat::UINT_32: return GL_R32UI; - case GPU_R32I: + case TextureFormat::SINT_32: return GL_R32I; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return GL_R32F; - case GPU_R16UI: + case TextureFormat::UINT_16: return GL_R16UI; - case GPU_R16I: + case TextureFormat::SINT_16: return GL_R16I; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return GL_R16F; - case GPU_R16: + case TextureFormat::UNORM_16: return GL_R16; /* Special formats texture & render-buffer. */ - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return GL_RGB10_A2; - case GPU_RGB10_A2UI: + case TextureFormat::UINT_10_10_10_2: return GL_RGB10_A2UI; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return GL_R11F_G11F_B10F; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return GL_DEPTH32F_STENCIL8; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return GL_SRGB8_ALPHA8; /* Texture only formats. */ - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: return GL_RGB16F; - case GPU_RGBA16_SNORM: + case TextureFormat::SNORM_16_16_16_16: return GL_RGBA16_SNORM; - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_8_8_8_8: return GL_RGBA8_SNORM; - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: return GL_RGB32F; - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: return GL_RGB32I; - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: return GL_RGB32UI; - case GPU_RGB16_SNORM: + case TextureFormat::SNORM_16_16_16: return GL_RGB16_SNORM; - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: return GL_RGB16I; - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: return GL_RGB16UI; - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: return GL_RGB16; - case GPU_RGB8_SNORM: + case TextureFormat::SNORM_8_8_8: return GL_RGB8_SNORM; - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: return GL_RGB8; - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: return GL_RGB8I; - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: return GL_RGB8UI; - case GPU_RG16_SNORM: + case TextureFormat::SNORM_16_16: return GL_RG16_SNORM; - case GPU_RG8_SNORM: + case TextureFormat::SNORM_8_8: return GL_RG8_SNORM; - case GPU_R16_SNORM: + case TextureFormat::SNORM_16: return GL_R16_SNORM; - case GPU_R8_SNORM: + case TextureFormat::SNORM_8: return GL_R8_SNORM; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: + case TextureFormat::SRGB_DXT1: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - case GPU_SRGB8_A8_DXT3: + case TextureFormat::SRGB_DXT3: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT5: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - case GPU_RGBA8_DXT1: + case TextureFormat::SNORM_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - case GPU_RGBA8_DXT3: + case TextureFormat::SNORM_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return GL_SRGB8; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return GL_RGB9_E5; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_DEPTH: return GL_DEPTH_COMPONENT32F; - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UNORM_16_DEPTH: return GL_DEPTH_COMPONENT16; } BLI_assert_msg(0, "Texture format incorrect or unsupported"); @@ -382,97 +382,97 @@ inline GLenum to_gl(eGPUDataFormat format) } } -inline GLenum to_gl_data_format(eGPUTextureFormat format) +inline GLenum to_gl_data_format(TextureFormat format) { switch (format) { /* Texture & Render-Buffer Formats. */ - case GPU_RGBA8: - case GPU_RGBA32F: - case GPU_RGBA16F: - case GPU_RGBA16: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: return GL_RGBA; - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA32I: - case GPU_RGBA32UI: - case GPU_RGBA16UI: - case GPU_RGBA16I: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: return GL_RGBA_INTEGER; - case GPU_RG8: - case GPU_RG32F: - case GPU_RG16F: - case GPU_RG16: + case TextureFormat::UNORM_8_8: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::UNORM_16_16: return GL_RG; - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_RG16I: - case GPU_RG16UI: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_16_16: + case TextureFormat::UINT_16_16: return GL_RG_INTEGER; - case GPU_R8: - case GPU_R32F: - case GPU_R16F: - case GPU_R16: + case TextureFormat::UNORM_8: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16: return GL_RED; - case GPU_R8UI: - case GPU_R8I: - case GPU_R32UI: - case GPU_R32I: - case GPU_R16UI: - case GPU_R16I: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: return GL_RED_INTEGER; /* Special formats texture & render-buffer. */ - case GPU_RGB10_A2UI: - case GPU_RGB10_A2: - case GPU_SRGB8_A8: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::SRGBA_8_8_8_8: return GL_RGBA; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return GL_RGB; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return GL_DEPTH_STENCIL; /* Texture only formats. */ - case GPU_RGBA16_SNORM: - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_8_8_8_8: return GL_RGBA; - case GPU_RGB16F: - case GPU_RGB32F: - case GPU_RGB32I: - case GPU_RGB32UI: - case GPU_RGB16_SNORM: - case GPU_RGB16I: - case GPU_RGB16UI: - case GPU_RGB16: - case GPU_RGB8_SNORM: - case GPU_RGB8: - case GPU_RGB8I: - case GPU_RGB8UI: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UINT_8_8_8: return GL_RGB; - case GPU_RG16_SNORM: - case GPU_RG8_SNORM: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8_8: return GL_RG; - case GPU_R16_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8: return GL_RED; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: + case TextureFormat::SRGB_DXT1: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; - case GPU_SRGB8_A8_DXT3: + case TextureFormat::SRGB_DXT3: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT5: return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - case GPU_RGBA8_DXT1: + case TextureFormat::SNORM_DXT1: return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - case GPU_RGBA8_DXT3: + case TextureFormat::SNORM_DXT3: return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT5: return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - case GPU_SRGB8: - case GPU_RGB9_E5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return GL_RGB; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return GL_DEPTH_COMPONENT; } BLI_assert_msg(0, "Texture format incorrect or unsupported\n"); diff --git a/source/blender/gpu/opengl/gl_uniform_buffer.cc b/source/blender/gpu/opengl/gl_uniform_buffer.cc index 903c7bc6592..1d826471437 100644 --- a/source/blender/gpu/opengl/gl_uniform_buffer.cc +++ b/source/blender/gpu/opengl/gl_uniform_buffer.cc @@ -65,7 +65,7 @@ void GLUniformBuf::clear_to_zero() } uint32_t data = 0; - eGPUTextureFormat internal_format = GPU_R32UI; + TextureFormat internal_format = TextureFormat::UINT_32; eGPUDataFormat data_format = GPU_DATA_UINT; if (GLContext::direct_state_access_support) { diff --git a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh index 8b40c987d3c..0c97f3315d2 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_test_info.hh @@ -30,14 +30,14 @@ GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_1d_test) LOCAL_GROUP_SIZE(1) -IMAGE(1, GPU_RGBA32F, write, image1D, img_output) +IMAGE(1, SFLOAT_32_32_32_32, write, image1D, img_output) COMPUTE_SOURCE("gpu_compute_1d_test.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() GPU_SHADER_CREATE_INFO(gpu_compute_2d_test) LOCAL_GROUP_SIZE(1, 1) -IMAGE(1, GPU_RGBA32F, write, image2D, img_output) +IMAGE(1, SFLOAT_32_32_32_32, write, image2D, img_output) COMPUTE_SOURCE("gpu_compute_2d_test.glsl") DO_STATIC_COMPILATION() GPU_SHADER_CREATE_END() diff --git a/source/blender/gpu/tests/compute_test.cc b/source/blender/gpu/tests/compute_test.cc index 84a624d6c85..eeb9a2f02e7 100644 --- a/source/blender/gpu/tests/compute_test.cc +++ b/source/blender/gpu/tests/compute_test.cc @@ -24,8 +24,13 @@ static void test_compute_direct() EXPECT_NE(shader, nullptr); /* Create texture to store result and attach to shader. */ - blender::gpu::Texture *texture = GPU_texture_create_2d( - "gpu_shader_compute_2d", SIZE, SIZE, 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d("gpu_shader_compute_2d", + SIZE, + SIZE, + 1, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); EXPECT_NE(texture, nullptr); GPU_shader_bind(shader); @@ -61,8 +66,13 @@ static void test_compute_indirect() EXPECT_NE(shader, nullptr); /* Create texture to store result and attach to shader. */ - blender::gpu::Texture *texture = GPU_texture_create_2d( - "gpu_shader_compute_2d", SIZE, SIZE, 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d("gpu_shader_compute_2d", + SIZE, + SIZE, + 1, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); EXPECT_NE(texture, nullptr); GPU_texture_clear(texture, GPU_DATA_FLOAT, float4(0.0f)); diff --git a/source/blender/gpu/tests/framebuffer_test.cc b/source/blender/gpu/tests/framebuffer_test.cc index cca58a578d2..ca07f501671 100644 --- a/source/blender/gpu/tests/framebuffer_test.cc +++ b/source/blender/gpu/tests/framebuffer_test.cc @@ -25,7 +25,7 @@ static void test_framebuffer_clear_color_single_attachment() const int2 size(1, 1); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config(&framebuffer, @@ -52,9 +52,9 @@ static void test_framebuffer_clear_color_multiple_attachments() const int2 size(1, 1); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture1 = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); blender::gpu::Texture *texture2 = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32UI, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::UINT_32_32_32_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config( @@ -93,9 +93,9 @@ static void test_framebuffer_clear_multiple_color_multiple_attachments() const int2 size(1, 1); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture1 = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); blender::gpu::Texture *texture2 = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config( @@ -131,7 +131,7 @@ static void test_framebuffer_clear_depth() const int2 size(1, 1); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_DEPTH_COMPONENT32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_DEPTH, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config(&framebuffer, {GPU_ATTACHMENT_TEXTURE(texture)}); @@ -159,7 +159,7 @@ static void test_framebuffer_scissor_test() const int2 size(2, 2); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_RGBA32F, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config(&framebuffer, @@ -202,7 +202,7 @@ static void test_framebuffer_cube() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_cube( - "tex", SIZE, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); const float4 clear_colors[6] = { {0.5f, 0.0f, 0.0f, 1.0f}, @@ -261,7 +261,7 @@ static void test_framebuffer_multi_viewport() const int layers = 256; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture = GPU_texture_create_2d_array( - __func__, UNPACK2(size), layers, 1, GPU_RG32I, usage, nullptr); + __func__, UNPACK2(size), layers, 1, TextureFormat::SINT_32_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config(&framebuffer, @@ -338,9 +338,9 @@ static void test_framebuffer_subpass_input() const int2 size(1, 1); eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *texture_a = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_R32I, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SINT_32, usage, nullptr); blender::gpu::Texture *texture_b = GPU_texture_create_2d( - __func__, UNPACK2(size), 1, GPU_R32I, usage, nullptr); + __func__, UNPACK2(size), 1, TextureFormat::SINT_32, usage, nullptr); GPUFrameBuffer *framebuffer = GPU_framebuffer_create(__func__); GPU_framebuffer_ensure_config( diff --git a/source/blender/gpu/tests/immediate_test.cc b/source/blender/gpu/tests/immediate_test.cc index c8300bc5150..27a4dff57e8 100644 --- a/source/blender/gpu/tests/immediate_test.cc +++ b/source/blender/gpu/tests/immediate_test.cc @@ -21,7 +21,7 @@ static void test_immediate_one_plane() GPUOffScreen *offscreen = GPU_offscreen_create(Size, Size, false, - GPU_RGBA16F, + TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ, false, @@ -70,7 +70,7 @@ static void test_immediate_two_planes() GPUOffScreen *offscreen = GPU_offscreen_create(Size, Size, false, - GPU_RGBA16F, + TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ, false, diff --git a/source/blender/gpu/tests/shader_test.cc b/source/blender/gpu/tests/shader_test.cc index 62ef39f25b7..b31def4f923 100644 --- a/source/blender/gpu/tests/shader_test.cc +++ b/source/blender/gpu/tests/shader_test.cc @@ -41,8 +41,13 @@ static void test_shader_compute_2d() EXPECT_NE(shader, nullptr); /* Create texture to store result and attach to shader. */ - blender::gpu::Texture *texture = GPU_texture_create_2d( - "gpu_shader_compute_2d", SIZE, SIZE, 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d("gpu_shader_compute_2d", + SIZE, + SIZE, + 1, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); EXPECT_NE(texture, nullptr); GPU_shader_bind(shader); @@ -80,8 +85,12 @@ static void test_shader_compute_1d() EXPECT_NE(shader, nullptr); /* Construct Texture. */ - blender::gpu::Texture *texture = GPU_texture_create_1d( - "gpu_shader_compute_1d", SIZE, 1, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_1d("gpu_shader_compute_1d", + SIZE, + 1, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); EXPECT_NE(texture, nullptr); GPU_shader_bind(shader); @@ -360,7 +369,7 @@ static void gpu_shader_lib_test(const char *test_src_name, const char *additiona eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_2d( - "tx", test_output_px_len, test_count, 1, GPU_RGBA32UI, usage, nullptr); + "tx", test_output_px_len, test_count, 1, TextureFormat::UINT_32_32_32_32, usage, nullptr); GPUFrameBuffer *fb = GPU_framebuffer_create("test_fb"); GPU_framebuffer_ensure_config(&fb, {GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(tex)}); GPU_framebuffer_bind(fb); diff --git a/source/blender/gpu/tests/state_blend_test.cc b/source/blender/gpu/tests/state_blend_test.cc index 41c3b2ec4b3..cfd5bbc70c7 100644 --- a/source/blender/gpu/tests/state_blend_test.cc +++ b/source/blender/gpu/tests/state_blend_test.cc @@ -24,7 +24,7 @@ void blend_test(float4 source_a, float4 source_b, float4 expected_result) GPUOffScreen *offscreen = GPU_offscreen_create(1, 1, false, - GPU_RGBA16F, + TextureFormat::SFLOAT_16_16_16_16, GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ, false, diff --git a/source/blender/gpu/tests/texture_test.cc b/source/blender/gpu/tests/texture_test.cc index 0d6053b84cc..d96da49c213 100644 --- a/source/blender/gpu/tests/texture_test.cc +++ b/source/blender/gpu/tests/texture_test.cc @@ -33,11 +33,11 @@ static void test_texture_read() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *rgba32u = GPU_texture_create_2d( - "rgba32u", 1, 1, 1, GPU_RGBA32UI, usage, nullptr); + "rgba32u", 1, 1, 1, TextureFormat::UINT_32_32_32_32, usage, nullptr); blender::gpu::Texture *rgba16u = GPU_texture_create_2d( - "rgba16u", 1, 1, 1, GPU_RGBA16UI, usage, nullptr); + "rgba16u", 1, 1, 1, TextureFormat::UINT_16_16_16_16, usage, nullptr); blender::gpu::Texture *rgba32f = GPU_texture_create_2d( - "rgba32f", 1, 1, 1, GPU_RGBA32F, usage, nullptr); + "rgba32f", 1, 1, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); const float4 fcol = {0.0f, 1.3f, -231.0f, 1000.0f}; const uint4 ucol = {0, 1, 2, 12223}; @@ -77,7 +77,8 @@ static void test_texture_1d() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; - blender::gpu::Texture *tex = GPU_texture_create_1d("tex", SIZE, 1, GPU_RGBA32F, usage, nullptr); + blender::gpu::Texture *tex = GPU_texture_create_1d( + "tex", SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(0.9f, 0.7f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -107,7 +108,7 @@ static void test_texture_1d_array() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ | GPU_TEXTURE_USAGE_SHADER_WRITE; blender::gpu::Texture *tex = GPU_texture_create_1d_array( - "tex", SIZE, LAYERS, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, LAYERS, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -139,7 +140,7 @@ static void test_texture_1d_array_upload() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_1d_array( - "tex", SIZE, LAYERS, 1, GPU_RGBA32F, usage, data_in); + "tex", SIZE, LAYERS, 1, TextureFormat::SFLOAT_32_32_32_32, usage, data_in); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); @@ -162,7 +163,7 @@ static void test_texture_2d_array() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_2d_array( - "tex", SIZE, SIZE, LAYERS, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, SIZE, LAYERS, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -191,7 +192,7 @@ static void test_texture_2d_array_upload() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_2d_array( - "tex", SIZE, SIZE, LAYERS, 1, GPU_RGBA32F, usage, data_in); + "tex", SIZE, SIZE, LAYERS, 1, TextureFormat::SFLOAT_32_32_32_32, usage, data_in); GPU_memory_barrier(GPU_BARRIER_TEXTURE_UPDATE); @@ -213,7 +214,7 @@ static void test_texture_cube() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_cube( - "tex", SIZE, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -239,7 +240,7 @@ static void test_texture_cube_array() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_cube_array( - "tex", SIZE, LAYERS, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, LAYERS, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -262,7 +263,7 @@ static void test_texture_3d() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *tex = GPU_texture_create_3d( - "tex", SIZE, SIZE, SIZE, 1, GPU_RGBA32F, usage, nullptr); + "tex", SIZE, SIZE, SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); float4 clear_color(1.0f, 0.5f, 0.2f, 1.0f); GPU_texture_clear(tex, GPU_DATA_FLOAT, clear_color); @@ -287,9 +288,9 @@ static void test_texture_copy() eGPUTextureUsage usage = GPU_TEXTURE_USAGE_HOST_READ; blender::gpu::Texture *src_tx = GPU_texture_create_2d( - "src", SIZE, SIZE, 1, GPU_RGBA32F, usage, nullptr); + "src", SIZE, SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); blender::gpu::Texture *dst_tx = GPU_texture_create_2d( - "dst", SIZE, SIZE, 1, GPU_RGBA32F, usage, nullptr); + "dst", SIZE, SIZE, 1, TextureFormat::SFLOAT_32_32_32_32, usage, nullptr); const float4 color(0.0, 1.0f, 2.0f, 123.0f); const float4 clear_color(0.0f); @@ -327,10 +328,7 @@ template static DataType *generate_test_data(size_t data_len) return data; } -template +template static void texture_create_upload_read() { static_assert(!std::is_same()); @@ -364,7 +362,7 @@ static void texture_create_upload_read() GPU_texture_free(texture); } -template +template static void texture_create_upload_read_with_bias(float max_allowed_bias) { static_assert(validate_data_format(DeviceFormat, HostFormat)); @@ -395,7 +393,7 @@ static void texture_create_upload_read_with_bias(float max_allowed_bias) /* Derivative of texture_create_upload_read_pixels that doesn't test each component, but a pixel at * a time. This is needed to check the R11G11B10 and similar types. */ -template +template static void texture_create_upload_read_pixel() { using DataType = uint32_t; @@ -428,209 +426,209 @@ static void texture_create_upload_read_pixel() * \{ */ static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16F() { - texture_create_upload_read_with_bias(0.9f); + texture_create_upload_read_with_bias(0.9f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA32F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA32F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG8() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG8); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16F() { - texture_create_upload_read_with_bias(0.9f); + texture_create_upload_read_with_bias(0.9f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG32F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG32F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R8() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R8); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R16F() { - texture_create_upload_read_with_bias(0.9f); + texture_create_upload_read_with_bias(0.9f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R16F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R16() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R16); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R32F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R32F); #if RUN_NON_STANDARD_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB10_A2() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB10_A2); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB10_A2UI() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB10_A2UI); #endif static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R11F_G11F_B10F() { - texture_create_upload_read_with_bias(0.0009f); + texture_create_upload_read_with_bias(0.0009f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R11F_G11F_B10F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8() { - texture_create_upload_read_with_bias(0.003f); + texture_create_upload_read_with_bias(0.003f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_SNORM() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16_SNORM() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA16_SNORM); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB8() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB8); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB8_SNORM() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB8_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16F); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16_SNORM() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB16_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB32F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB32F); #endif static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG8_SNORM() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG8_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16_SNORM() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RG16_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R8_SNORM() { - texture_create_upload_read_with_bias(0.004f); + texture_create_upload_read_with_bias(0.004f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R8_SNORM); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_R16_SNORM() { - texture_create_upload_read_with_bias(0.00002f); + texture_create_upload_read_with_bias(0.00002f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_R16_SNORM); #if RUN_NON_STANDARD_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT1() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT1); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT3() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT3); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT5() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8_A8_DXT5); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT1() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT1); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT3() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT3); static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT5() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT5); #endif @@ -638,7 +636,7 @@ GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGBA8_DXT5); #if RUN_SRGB_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8); #endif @@ -646,14 +644,14 @@ GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_SRGB8); #if RUN_NON_STANDARD_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB9_E5() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_RGB9_E5); #endif static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH_COMPONENT32F() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH_COMPONENT32F); @@ -662,14 +660,15 @@ static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH32F_STENCIL8() if (GPU_backend_get_type() == GPU_BACKEND_OPENGL) { GTEST_SKIP() << "Float based texture readback not supported on OpenGL"; } - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias( + 0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH32F_STENCIL8); #if RUN_COMPONENT_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH_COMPONENT16() { - texture_create_upload_read_with_bias(0.0f); + texture_create_upload_read_with_bias(0.0f); } GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH_COMPONENT16); #endif @@ -682,26 +681,26 @@ GPU_TEST(texture_roundtrip__GPU_DATA_FLOAT__GPU_DEPTH_COMPONENT16); static void test_texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RGBA16F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RGBA16F); static void test_texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RG16F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RG16F); static void test_texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_R16F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_R16F); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RGB16F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RGB16F); #endif @@ -714,76 +713,76 @@ GPU_TEST(texture_roundtrip__GPU_DATA_HALF_FLOAT__GPU_RGB16F); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGBA8I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGBA8I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGBA16I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGBA16I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGBA32I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGBA32I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RG8I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RG8I); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_INT__GPU_RG16I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RG16I); #endif static void test_texture_roundtrip__GPU_DATA_INT__GPU_RG32I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RG32I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_R8I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_R8I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_R16I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_R16I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_R32I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_R32I); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGB8I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGB8I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGB16I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGB16I); static void test_texture_roundtrip__GPU_DATA_INT__GPU_RGB32I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGB32I); #endif @@ -796,86 +795,86 @@ GPU_TEST(texture_roundtrip__GPU_DATA_INT__GPU_RGB32I); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGBA8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGBA8UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGBA16UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGBA16UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGBA32UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGBA32UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RG8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RG8UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RG16UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RG16UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RG32UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RG32UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_R8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_R8UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_R16UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_R16UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_R32UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_R32UI); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH32F_STENCIL8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH32F_STENCIL8); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGB8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGB8UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGB16UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGB16UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_RGB32UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_RGB32UI); static void test_texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT32F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT32F); #endif @@ -883,7 +882,7 @@ GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT32F); #if RUN_COMPONENT_UNIMPLEMENTED static void test_texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT16() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT16); #endif @@ -896,62 +895,62 @@ GPU_TEST(texture_roundtrip__GPU_DATA_UINT__GPU_DEPTH_COMPONENT16); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RGBA8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RGBA8UI); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RGBA8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RGBA8); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RG8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RG8UI); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RG8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RG8); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_R8UI() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_R8UI); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_R8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_R8); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_SRGB8_A8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_SRGB8_A8); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RGB8I() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RGB8I); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_RGB8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_RGB8); static void test_texture_roundtrip__GPU_DATA_UBYTE__GPU_SRGB8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_SRGB8); #endif @@ -964,7 +963,9 @@ GPU_TEST(texture_roundtrip__GPU_DATA_UBYTE__GPU_SRGB8); #if RUN_UNSUPPORTED static void test_texture_roundtrip__GPU_DATA_UINT_24_8__GPU_DEPTH32F_STENCIL8() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_UINT_24_8__GPU_DEPTH32F_STENCIL8); #endif @@ -977,7 +978,7 @@ GPU_TEST(texture_roundtrip__GPU_DATA_UINT_24_8__GPU_DEPTH32F_STENCIL8); static void test_texture_roundtrip__GPU_DATA_10_11_11_REV__GPU_R11F_G11F_B10F() { - texture_create_upload_read(); + texture_create_upload_read(); } GPU_TEST(texture_roundtrip__GPU_DATA_10_11_11_REV__GPU_R11F_G11F_B10F); @@ -989,7 +990,7 @@ GPU_TEST(texture_roundtrip__GPU_DATA_10_11_11_REV__GPU_R11F_G11F_B10F); static void test_texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2() { - texture_create_upload_read_pixel(); + texture_create_upload_read_pixel(); } GPU_TEST(texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2); @@ -998,7 +999,7 @@ static void test_texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI() if (GPU_backend_get_type() == GPU_BACKEND_OPENGL) { GTEST_SKIP() << "Texture readback not supported on OpenGL"; } - texture_create_upload_read_pixel(); + texture_create_upload_read_pixel(); } GPU_TEST(texture_roundtrip__GPU_DATA_2_10_10_10_REV__GPU_RGB10_A2UI); @@ -1014,8 +1015,12 @@ static void test_texture_update_sub_no_unpack_row_length() const int2 sub_size(256); const int2 sub_offset(256); - blender::gpu::Texture *texture = GPU_texture_create_2d( - __func__, UNPACK2(size), 2, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d(__func__, + UNPACK2(size), + 2, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); const float4 clear_color(0.0f, 0.0f, 0.0f, 0.0f); GPU_texture_clear(texture, GPU_DATA_FLOAT, &clear_color); @@ -1068,8 +1073,12 @@ static void test_texture_update_sub_unpack_row_length() const int2 sub_size(256); const int2 sub_offset(256); - blender::gpu::Texture *texture = GPU_texture_create_2d( - __func__, UNPACK2(size), 2, GPU_RGBA32F, GPU_TEXTURE_USAGE_GENERAL, nullptr); + blender::gpu::Texture *texture = GPU_texture_create_2d(__func__, + UNPACK2(size), + 2, + TextureFormat::SFLOAT_32_32_32_32, + GPU_TEXTURE_USAGE_GENERAL, + nullptr); const float4 clear_color(0.0f, 0.0f, 0.0f, 0.0f); GPU_texture_clear(texture, GPU_DATA_FLOAT, &clear_color); @@ -1134,14 +1143,14 @@ static void test_texture_pool() TexturePool &pool = TexturePool::get(); - eGPUTextureFormat format1 = GPU_RGBA8; - eGPUTextureFormat format2 = GPU_RGBA16F; - eGPUTextureFormat format3 = GPU_RGBA32F; + TextureFormat format1 = TextureFormat::UNORM_8_8_8_8; + TextureFormat format2 = TextureFormat::SFLOAT_16_16_16_16; + TextureFormat format3 = TextureFormat::SFLOAT_32_32_32_32; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_ATTACHMENT; auto test_acquire = - [&](int2 size, eGPUTextureFormat format, eGPUTextureUsage usage) -> blender::gpu::Texture * { + [&](int2 size, TextureFormat format, eGPUTextureUsage usage) -> blender::gpu::Texture * { blender::gpu::Texture *tex = pool.acquire_texture(size.x, size.y, format, usage); EXPECT_EQ(GPU_texture_format(tex), format); EXPECT_EQ(GPU_texture_width(tex), size.x); diff --git a/source/blender/gpu/tests/vertex_buffer_test.cc b/source/blender/gpu/tests/vertex_buffer_test.cc index 523312a52d1..9880dc099d3 100644 --- a/source/blender/gpu/tests/vertex_buffer_test.cc +++ b/source/blender/gpu/tests/vertex_buffer_test.cc @@ -26,7 +26,7 @@ static void vertex_buffer_fetch_mode(ColorType color) { eGPUTextureUsage usage = GPU_TEXTURE_USAGE_ATTACHMENT | GPU_TEXTURE_USAGE_HOST_READ; GPUOffScreen *offscreen = GPU_offscreen_create( - Size, Size, false, GPU_RGBA32F, usage, false, nullptr); + Size, Size, false, TextureFormat::SFLOAT_32_32_32_32, usage, false, nullptr); BLI_assert(offscreen != nullptr); GPU_offscreen_bind(offscreen, false); blender::gpu::Texture *color_texture = GPU_offscreen_color_texture(offscreen); diff --git a/source/blender/gpu/vulkan/tests/vk_data_conversion_test.cc b/source/blender/gpu/vulkan/tests/vk_data_conversion_test.cc index 1bbe65cc5f2..c31cd583a12 100644 --- a/source/blender/gpu/vulkan/tests/vk_data_conversion_test.cc +++ b/source/blender/gpu/vulkan/tests/vk_data_conversion_test.cc @@ -82,10 +82,20 @@ TEST(VulkanDataConversion, texture_rgb16f_as_floats_to_rgba16f) }; uint64_t device[num_pixels]; - convert_host_to_device(device, input, num_pixels, GPU_DATA_FLOAT, GPU_RGB16F, GPU_RGBA16F); + convert_host_to_device(device, + input, + num_pixels, + GPU_DATA_FLOAT, + TextureFormat::SFLOAT_16_16_16, + TextureFormat::SFLOAT_16_16_16_16); float read_back[num_pixels * 3]; - convert_device_to_host(read_back, device, num_pixels, GPU_DATA_FLOAT, GPU_RGB16F, GPU_RGBA16F); + convert_device_to_host(read_back, + device, + num_pixels, + GPU_DATA_FLOAT, + TextureFormat::SFLOAT_16_16_16, + TextureFormat::SFLOAT_16_16_16_16); for (int i : IndexRange(num_pixels * 3)) { EXPECT_NEAR(input[i], read_back[i], 0.01); @@ -114,10 +124,20 @@ TEST(VulkanDataConversion, texture_rgb32f_as_floats_to_rgba32f) }; float device[num_pixels * 4]; - convert_host_to_device(device, input, num_pixels, GPU_DATA_FLOAT, GPU_RGB32F, GPU_RGBA32F); + convert_host_to_device(device, + input, + num_pixels, + GPU_DATA_FLOAT, + TextureFormat::SFLOAT_32_32_32, + TextureFormat::SFLOAT_32_32_32_32); float read_back[num_pixels * 3]; - convert_device_to_host(read_back, device, num_pixels, GPU_DATA_FLOAT, GPU_RGB32F, GPU_RGBA32F); + convert_device_to_host(read_back, + device, + num_pixels, + GPU_DATA_FLOAT, + TextureFormat::SFLOAT_32_32_32, + TextureFormat::SFLOAT_32_32_32_32); for (int i : IndexRange(num_pixels * 3)) { EXPECT_NEAR(input[i], read_back[i], 0.01); diff --git a/source/blender/gpu/vulkan/vk_common.cc b/source/blender/gpu/vulkan/vk_common.cc index 3899ffb580f..8b69ab1fdfa 100644 --- a/source/blender/gpu/vulkan/vk_common.cc +++ b/source/blender/gpu/vulkan/vk_common.cc @@ -11,87 +11,87 @@ #include "vk_common.hh" namespace blender::gpu { -VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUTextureFormat format) +VkImageAspectFlags to_vk_image_aspect_flag_bits(const TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ - case GPU_RGBA32UI: - case GPU_RG32UI: - case GPU_R32UI: - case GPU_RGBA16UI: - case GPU_RG16UI: - case GPU_R16UI: - case GPU_RGBA8UI: - case GPU_RG8UI: - case GPU_R8UI: - case GPU_RGBA32I: - case GPU_RG32I: - case GPU_R32I: - case GPU_RGBA16I: - case GPU_RG16I: - case GPU_R16I: - case GPU_RGBA8I: - case GPU_RG8I: - case GPU_R8I: - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_32_32: + case TextureFormat::UINT_32: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::UINT_16_16: + case TextureFormat::UINT_16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UINT_8: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_32: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SINT_16: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::SINT_8: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: return VK_IMAGE_ASPECT_COLOR_BIT; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_SRGB8_A8: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SRGBA_8_8_8_8: return VK_IMAGE_ASPECT_COLOR_BIT; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return VK_IMAGE_ASPECT_DEPTH_BIT; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT; /* Texture only formats. */ - case GPU_RGB32UI: - case GPU_RGB16UI: - case GPU_RGB8UI: - case GPU_RGB32I: - case GPU_RGB16I: - case GPU_RGB8I: - case GPU_RGB16: - case GPU_RGB8: - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: - case GPU_RGB32F: - case GPU_RGB16F: + case TextureFormat::UINT_32_32_32: + case TextureFormat::UINT_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SFLOAT_16_16_16: return VK_IMAGE_ASPECT_COLOR_BIT; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return VK_IMAGE_ASPECT_COLOR_BIT; } BLI_assert_unreachable(); @@ -113,159 +113,159 @@ VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUFrameBufferBits buffer return result; } -eGPUTextureFormat to_gpu_format(const VkFormat format) +TextureFormat to_gpu_format(const VkFormat format) { switch (format) { case VK_FORMAT_R8G8B8A8_UNORM: case VK_FORMAT_B8G8R8A8_UNORM: - return GPU_RGBA8; + return TextureFormat::UNORM_8_8_8_8; case VK_FORMAT_R16G16B16A16_SFLOAT: - return GPU_RGBA16F; + return TextureFormat::SFLOAT_16_16_16_16; default: BLI_assert_unreachable(); } - return GPU_RGBA32F; + return TextureFormat::SFLOAT_32_32_32_32; } -VkFormat to_vk_format(const eGPUTextureFormat format) +VkFormat to_vk_format(const TextureFormat format) { switch (format) { /* Formats texture & render-buffer */ - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return VK_FORMAT_R32G32B32A32_UINT; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return VK_FORMAT_R32G32_UINT; - case GPU_R32UI: + case TextureFormat::UINT_32: return VK_FORMAT_R32_UINT; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return VK_FORMAT_R16G16B16A16_UINT; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return VK_FORMAT_R16G16_UINT; - case GPU_R16UI: + case TextureFormat::UINT_16: return VK_FORMAT_R16_UINT; - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return VK_FORMAT_R8G8B8A8_UINT; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return VK_FORMAT_R8G8_UINT; - case GPU_R8UI: + case TextureFormat::UINT_8: return VK_FORMAT_R8_UINT; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return VK_FORMAT_R32G32B32A32_SINT; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return VK_FORMAT_R32G32_SINT; - case GPU_R32I: + case TextureFormat::SINT_32: return VK_FORMAT_R32_SINT; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return VK_FORMAT_R16G16B16A16_SINT; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return VK_FORMAT_R16G16_SINT; - case GPU_R16I: + case TextureFormat::SINT_16: return VK_FORMAT_R16_SINT; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return VK_FORMAT_R8G8B8A8_SINT; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return VK_FORMAT_R8G8_SINT; - case GPU_R8I: + case TextureFormat::SINT_8: return VK_FORMAT_R8_SINT; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return VK_FORMAT_R32G32B32A32_SFLOAT; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return VK_FORMAT_R32G32_SFLOAT; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return VK_FORMAT_R32_SFLOAT; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return VK_FORMAT_R16G16B16A16_SFLOAT; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return VK_FORMAT_R16G16_SFLOAT; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return VK_FORMAT_R16_SFLOAT; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return VK_FORMAT_R16G16B16A16_UNORM; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return VK_FORMAT_R16G16_UNORM; - case GPU_R16: + case TextureFormat::UNORM_16: return VK_FORMAT_R16_UNORM; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return VK_FORMAT_R8G8B8A8_UNORM; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return VK_FORMAT_R8G8_UNORM; - case GPU_R8: + case TextureFormat::UNORM_8: return VK_FORMAT_R8_UNORM; /* Special formats texture & render-buffer */ - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return VK_FORMAT_A2B10G10R10_UNORM_PACK32; - case GPU_RGB10_A2UI: + case TextureFormat::UINT_10_10_10_2: return VK_FORMAT_A2B10G10R10_UINT_PACK32; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return VK_FORMAT_B10G11R11_UFLOAT_PACK32; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return VK_FORMAT_R8G8B8A8_SRGB; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return VK_FORMAT_D32_SFLOAT_S8_UINT; /* Depth Formats. */ - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_DEPTH: return VK_FORMAT_D32_SFLOAT; - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UNORM_16_DEPTH: return VK_FORMAT_D16_UNORM; /* Texture only formats. */ - case GPU_RGB32UI: + case TextureFormat::UINT_32_32_32: return VK_FORMAT_R32G32B32_UINT; - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16: return VK_FORMAT_R16G16B16_UINT; - case GPU_RGB8UI: + case TextureFormat::UINT_8_8_8: return VK_FORMAT_R8G8B8_UINT; - case GPU_RGB32I: + case TextureFormat::SINT_32_32_32: return VK_FORMAT_R32G32B32_SINT; - case GPU_RGB16I: + case TextureFormat::SINT_16_16_16: return VK_FORMAT_R16G16B16_SINT; - case GPU_RGB8I: + case TextureFormat::SINT_8_8_8: return VK_FORMAT_R8G8B8_SINT; - case GPU_RGB16: + case TextureFormat::UNORM_16_16_16: return VK_FORMAT_R16G16B16_UNORM; - case GPU_RGB8: + case TextureFormat::UNORM_8_8_8: return VK_FORMAT_R8G8B8_UNORM; - case GPU_RGBA16_SNORM: + case TextureFormat::SNORM_16_16_16_16: return VK_FORMAT_R16G16B16A16_SNORM; - case GPU_RGB16_SNORM: + case TextureFormat::SNORM_16_16_16: return VK_FORMAT_R16G16B16_SNORM; - case GPU_RG16_SNORM: + case TextureFormat::SNORM_16_16: return VK_FORMAT_R16G16_SNORM; - case GPU_R16_SNORM: + case TextureFormat::SNORM_16: return VK_FORMAT_R16_SNORM; - case GPU_RGBA8_SNORM: + case TextureFormat::SNORM_8_8_8_8: return VK_FORMAT_R8G8B8A8_SNORM; - case GPU_RGB8_SNORM: + case TextureFormat::SNORM_8_8_8: return VK_FORMAT_R8G8B8_SNORM; - case GPU_RG8_SNORM: + case TextureFormat::SNORM_8_8: return VK_FORMAT_R8G8_SNORM; - case GPU_R8_SNORM: + case TextureFormat::SNORM_8: return VK_FORMAT_R8_SNORM; - case GPU_RGB32F: + case TextureFormat::SFLOAT_32_32_32: return VK_FORMAT_R32G32B32_SFLOAT; - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16: return VK_FORMAT_R16G16B16_SFLOAT; /* Special formats, texture only. */ - case GPU_SRGB8_A8_DXT1: + case TextureFormat::SRGB_DXT1: return VK_FORMAT_BC1_RGBA_SRGB_BLOCK; - case GPU_SRGB8_A8_DXT3: + case TextureFormat::SRGB_DXT3: return VK_FORMAT_BC2_SRGB_BLOCK; - case GPU_SRGB8_A8_DXT5: + case TextureFormat::SRGB_DXT5: return VK_FORMAT_BC3_SRGB_BLOCK; - case GPU_RGBA8_DXT1: + case TextureFormat::SNORM_DXT1: return VK_FORMAT_BC1_RGBA_UNORM_BLOCK; - case GPU_RGBA8_DXT3: + case TextureFormat::SNORM_DXT3: return VK_FORMAT_BC2_UNORM_BLOCK; - case GPU_RGBA8_DXT5: + case TextureFormat::SNORM_DXT5: return VK_FORMAT_BC3_UNORM_BLOCK; - case GPU_SRGB8: + case TextureFormat::SRGBA_8_8_8: return VK_FORMAT_R8G8B8_SRGB; - case GPU_RGB9_E5: + case TextureFormat::UFLOAT_9_9_9_EXP_5: return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; } return VK_FORMAT_UNDEFINED; diff --git a/source/blender/gpu/vulkan/vk_common.hh b/source/blender/gpu/vulkan/vk_common.hh index f89edd1b0a7..e18b2506d6a 100644 --- a/source/blender/gpu/vulkan/vk_common.hh +++ b/source/blender/gpu/vulkan/vk_common.hh @@ -55,10 +55,10 @@ enum class VKImageViewArrayed { ARRAYED, }; -VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUTextureFormat format); +VkImageAspectFlags to_vk_image_aspect_flag_bits(const TextureFormat format); VkImageAspectFlags to_vk_image_aspect_flag_bits(const eGPUFrameBufferBits buffers); -VkFormat to_vk_format(const eGPUTextureFormat format); -eGPUTextureFormat to_gpu_format(const VkFormat format); +VkFormat to_vk_format(const TextureFormat format); +TextureFormat to_gpu_format(const VkFormat format); VkFormat to_vk_format(const GPUVertCompType type, const uint32_t size, const GPUVertFetchMode fetch_mode); diff --git a/source/blender/gpu/vulkan/vk_context.cc b/source/blender/gpu/vulkan/vk_context.cc index 39104973158..a7a9a99a671 100644 --- a/source/blender/gpu/vulkan/vk_context.cc +++ b/source/blender/gpu/vulkan/vk_context.cc @@ -466,9 +466,9 @@ void VKContext::openxr_acquire_framebuffer_image_handler(GHOST_VulkanOpenXRData openxr_data.extent.height = color_attachment->height_get(); /* Determine the data format for data transfer. */ - const eGPUTextureFormat device_format = color_attachment->device_format_get(); + const TextureFormat device_format = color_attachment->device_format_get(); eGPUDataFormat data_format = GPU_DATA_HALF_FLOAT; - if (ELEM(device_format, GPU_RGBA8)) { + if (ELEM(device_format, TextureFormat::UNORM_8_8_8_8)) { data_format = GPU_DATA_UBYTE; } diff --git a/source/blender/gpu/vulkan/vk_data_conversion.cc b/source/blender/gpu/vulkan/vk_data_conversion.cc index 62dab0ab05a..958fd03bc5e 100644 --- a/source/blender/gpu/vulkan/vk_data_conversion.cc +++ b/source/blender/gpu/vulkan/vk_data_conversion.cc @@ -79,14 +79,18 @@ enum class ConversionType { UNSUPPORTED, }; -static ConversionType type_of_conversion_float(const eGPUTextureFormat host_format, - const eGPUTextureFormat device_format) +static ConversionType type_of_conversion_float(const TextureFormat host_format, + const TextureFormat device_format) { if (host_format != device_format) { - if (host_format == GPU_RGB16F && device_format == GPU_RGBA16F) { + if (host_format == TextureFormat::SFLOAT_16_16_16 && + device_format == TextureFormat::SFLOAT_16_16_16_16) + { return ConversionType::FLOAT3_TO_HALF4; } - if (host_format == GPU_RGB32F && device_format == GPU_RGBA32F) { + if (host_format == TextureFormat::SFLOAT_32_32_32 && + device_format == TextureFormat::SFLOAT_32_32_32_32) + { return ConversionType::FLOAT3_TO_FLOAT4; } @@ -94,493 +98,495 @@ static ConversionType type_of_conversion_float(const eGPUTextureFormat host_form } switch (device_format) { - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: - case GPU_DEPTH_COMPONENT32F: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_32_DEPTH: return ConversionType::PASS_THROUGH; - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return ConversionType::PASS_THROUGH_D32F_S8; - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: - case GPU_RGB16F: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::SFLOAT_16_16_16: return ConversionType::FLOAT_TO_HALF; - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: return ConversionType::FLOAT_TO_UNORM8; - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: return ConversionType::FLOAT_TO_SNORM8; - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: return ConversionType::FLOAT_TO_UNORM16; - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: return ConversionType::FLOAT_TO_SNORM16; - case GPU_SRGB8_A8: + case TextureFormat::SRGBA_8_8_8_8: return ConversionType::FLOAT_TO_SRGBA8; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return ConversionType::FLOAT_TO_B10F_G11F_R11F; - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: /* Not an actual "conversion", but compressed texture upload code * pretends that host data is a float. It is actually raw BCn bits. */ return ConversionType::PASS_THROUGH; - case GPU_RGB32F: /* GPU_RGB32F Not supported by vendors. */ - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_R8UI: - case GPU_R8I: - case GPU_R16UI: - case GPU_R16I: - case GPU_R32UI: - case GPU_R32I: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB16UI: - case GPU_RGB16I: - case GPU_RGB16: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_32_32: /* TextureFormat::SFLOAT_32_32_32 + Not supported by vendors. */ + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::UINT_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_int(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_int(TextureFormat device_format) { switch (device_format) { - case GPU_RGBA32I: - case GPU_RG32I: - case GPU_R32I: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SINT_32: return ConversionType::PASS_THROUGH; - case GPU_RGBA16I: - case GPU_RG16I: - case GPU_R16I: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::SINT_16: return ConversionType::I32_TO_I16; - case GPU_RGBA8I: - case GPU_RG8I: - case GPU_R8I: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::SINT_8: return ConversionType::I32_TO_I8; - case GPU_RGBA8UI: - case GPU_RGBA8: - case GPU_RGBA16UI: - case GPU_RGBA16F: - case GPU_RGBA16: - case GPU_RGBA32UI: - case GPU_RGBA32F: - case GPU_RG8UI: - case GPU_RG8: - case GPU_RG16UI: - case GPU_RG16F: - case GPU_RG32UI: - case GPU_RG32F: - case GPU_RG16: - case GPU_R8UI: - case GPU_R8: - case GPU_R16UI: - case GPU_R16F: - case GPU_R16: - case GPU_R32UI: - case GPU_R32F: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_DEPTH32F_STENCIL8: - case GPU_SRGB8_A8: - case GPU_RGBA8_SNORM: - case GPU_RGBA16_SNORM: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB8_SNORM: - case GPU_RGB16UI: - case GPU_RGB16I: - case GPU_RGB16F: - case GPU_RGB16: - case GPU_RGB16_SNORM: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_RGB32F: - case GPU_RG8_SNORM: - case GPU_RG16_SNORM: - case GPU_R8_SNORM: - case GPU_R16_SNORM: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::UINT_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UINT_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::UINT_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::UNORM_16_16: + case TextureFormat::UINT_8: + case TextureFormat::UNORM_8: + case TextureFormat::UINT_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16: + case TextureFormat::UINT_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: + case TextureFormat::SRGBA_8_8_8_8: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UINT_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8: + case TextureFormat::SNORM_16: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_uint(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_uint(TextureFormat device_format) { switch (device_format) { - case GPU_RGBA32UI: - case GPU_RG32UI: - case GPU_R32UI: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::UINT_32_32: + case TextureFormat::UINT_32: return ConversionType::PASS_THROUGH; - case GPU_RGBA16UI: - case GPU_RG16UI: - case GPU_R16UI: - case GPU_RGB16UI: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::UINT_16_16: + case TextureFormat::UINT_16: + case TextureFormat::UINT_16_16_16: return ConversionType::UI32_TO_UI16; - case GPU_RGBA8UI: - case GPU_RG8UI: - case GPU_R8UI: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UINT_8: return ConversionType::UI32_TO_UI8; - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return ConversionType::UNORM32_TO_FLOAT; - case GPU_RGBA8I: - case GPU_RGBA8: - case GPU_RGBA16I: - case GPU_RGBA16F: - case GPU_RGBA16: - case GPU_RGBA32I: - case GPU_RGBA32F: - case GPU_RG8I: - case GPU_RG8: - case GPU_RG16I: - case GPU_RG16F: - case GPU_RG16: - case GPU_RG32I: - case GPU_RG32F: - case GPU_R8I: - case GPU_R8: - case GPU_R16I: - case GPU_R16F: - case GPU_R16: - case GPU_R32I: - case GPU_R32F: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_SRGB8_A8: - case GPU_RGBA8_SNORM: - case GPU_RGBA16_SNORM: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB8_SNORM: - case GPU_RGB16I: - case GPU_RGB16F: - case GPU_RGB16: - case GPU_RGB16_SNORM: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_RGB32F: - case GPU_RG8_SNORM: - case GPU_RG16_SNORM: - case GPU_R8_SNORM: - case GPU_R16_SNORM: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SINT_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::SINT_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::SINT_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SINT_8: + case TextureFormat::UNORM_8: + case TextureFormat::SINT_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::UNORM_16: + case TextureFormat::SINT_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SRGBA_8_8_8_8: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8: + case TextureFormat::SNORM_16: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_half(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_half(TextureFormat device_format) { switch (device_format) { - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: return ConversionType::PASS_THROUGH; - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA8: - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA16: - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RGBA32F: - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG8: - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG16: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_RG32F: - case GPU_R8UI: - case GPU_R8I: - case GPU_R8: - case GPU_R16UI: - case GPU_R16I: - case GPU_R16: - case GPU_R32UI: - case GPU_R32I: - case GPU_R32F: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_DEPTH32F_STENCIL8: - case GPU_SRGB8_A8: - case GPU_RGBA8_SNORM: - case GPU_RGBA16_SNORM: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB8_SNORM: - case GPU_RGB16UI: - case GPU_RGB16I: - case GPU_RGB16F: - case GPU_RGB16: - case GPU_RGB16_SNORM: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_RGB32F: - case GPU_RG8_SNORM: - case GPU_RG16_SNORM: - case GPU_R8_SNORM: - case GPU_R16_SNORM: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UNORM_8: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::UNORM_16: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: + case TextureFormat::SRGBA_8_8_8_8: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UINT_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8: + case TextureFormat::SNORM_16: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_ubyte(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_ubyte(TextureFormat device_format) { switch (device_format) { - case GPU_RGBA8UI: - case GPU_RGBA8: - case GPU_RG8UI: - case GPU_RG8: - case GPU_R8UI: - case GPU_R8: - case GPU_SRGB8_A8: + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UINT_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UINT_8: + case TextureFormat::UNORM_8: + case TextureFormat::SRGBA_8_8_8_8: return ConversionType::PASS_THROUGH; - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: return ConversionType::UI8_TO_HALF; - case GPU_RGBA8I: - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA16: - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RGBA32F: - case GPU_RG8I: - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG16: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_RG32F: - case GPU_R8I: - case GPU_R16UI: - case GPU_R16I: - case GPU_R16: - case GPU_R32UI: - case GPU_R32I: - case GPU_R32F: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_R11F_G11F_B10F: - case GPU_DEPTH32F_STENCIL8: - case GPU_RGBA8_SNORM: - case GPU_RGBA16_SNORM: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB8_SNORM: - case GPU_RGB16UI: - case GPU_RGB16I: - case GPU_RGB16F: - case GPU_RGB16: - case GPU_RGB16_SNORM: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_RGB32F: - case GPU_RG8_SNORM: - case GPU_RG16_SNORM: - case GPU_R8_SNORM: - case GPU_R16_SNORM: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SINT_8_8: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SINT_8: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::UNORM_16: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::UINT_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SFLOAT_32_32_32: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_8: + case TextureFormat::SNORM_16: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_uint248(const eGPUTextureFormat device_format) +static ConversionType type_of_conversion_uint248(const TextureFormat device_format) { switch (device_format) { - case GPU_DEPTH32F_STENCIL8: + case TextureFormat::SFLOAT_32_DEPTH_UINT_8: return ConversionType::UINT_TO_DEPTH32F_STENCIL8; - case GPU_RGBA32F: - case GPU_RG32F: - case GPU_R32F: - case GPU_RGBA16F: - case GPU_RG16F: - case GPU_R16F: - case GPU_RGB16F: - case GPU_RGBA8: - case GPU_RG8: - case GPU_R8: - case GPU_RGBA8_SNORM: - case GPU_RGB8_SNORM: - case GPU_RG8_SNORM: - case GPU_R8_SNORM: - case GPU_RGBA16: - case GPU_RG16: - case GPU_R16: - case GPU_RGBA16_SNORM: - case GPU_RGB16_SNORM: - case GPU_RG16_SNORM: - case GPU_R16_SNORM: - case GPU_SRGB8_A8: - case GPU_DEPTH_COMPONENT32F: - case GPU_R11F_G11F_B10F: - case GPU_SRGB8_A8_DXT1: - case GPU_SRGB8_A8_DXT3: - case GPU_SRGB8_A8_DXT5: - case GPU_RGBA8_DXT1: - case GPU_RGBA8_DXT3: - case GPU_RGBA8_DXT5: + case TextureFormat::SFLOAT_32_32_32_32: + case TextureFormat::SFLOAT_32_32: + case TextureFormat::SFLOAT_32: + case TextureFormat::SFLOAT_16_16_16_16: + case TextureFormat::SFLOAT_16_16: + case TextureFormat::SFLOAT_16: + case TextureFormat::SFLOAT_16_16_16: + case TextureFormat::UNORM_8_8_8_8: + case TextureFormat::UNORM_8_8: + case TextureFormat::UNORM_8: + case TextureFormat::SNORM_8_8_8_8: + case TextureFormat::SNORM_8_8_8: + case TextureFormat::SNORM_8_8: + case TextureFormat::SNORM_8: + case TextureFormat::UNORM_16_16_16_16: + case TextureFormat::UNORM_16_16: + case TextureFormat::UNORM_16: + case TextureFormat::SNORM_16_16_16_16: + case TextureFormat::SNORM_16_16_16: + case TextureFormat::SNORM_16_16: + case TextureFormat::SNORM_16: + case TextureFormat::SRGBA_8_8_8_8: + case TextureFormat::SFLOAT_32_DEPTH: + case TextureFormat::UFLOAT_11_11_10: + case TextureFormat::SRGB_DXT1: + case TextureFormat::SRGB_DXT3: + case TextureFormat::SRGB_DXT5: + case TextureFormat::SNORM_DXT1: + case TextureFormat::SNORM_DXT3: + case TextureFormat::SNORM_DXT5: - case GPU_RGB32F: /* GPU_RGB32F Not supported by vendors. */ - case GPU_RGBA8UI: - case GPU_RGBA8I: - case GPU_RGBA16UI: - case GPU_RGBA16I: - case GPU_RGBA32UI: - case GPU_RGBA32I: - case GPU_RG8UI: - case GPU_RG8I: - case GPU_RG16UI: - case GPU_RG16I: - case GPU_RG32UI: - case GPU_RG32I: - case GPU_R8UI: - case GPU_R8I: - case GPU_R16UI: - case GPU_R16I: - case GPU_R32UI: - case GPU_R32I: - case GPU_RGB10_A2: - case GPU_RGB10_A2UI: - case GPU_RGB8UI: - case GPU_RGB8I: - case GPU_RGB8: - case GPU_RGB16UI: - case GPU_RGB16I: - case GPU_RGB16: - case GPU_RGB32UI: - case GPU_RGB32I: - case GPU_SRGB8: - case GPU_RGB9_E5: - case GPU_DEPTH_COMPONENT16: + case TextureFormat::SFLOAT_32_32_32: /* TextureFormat::SFLOAT_32_32_32 + Not supported by vendors. */ + case TextureFormat::UINT_8_8_8_8: + case TextureFormat::SINT_8_8_8_8: + case TextureFormat::UINT_16_16_16_16: + case TextureFormat::SINT_16_16_16_16: + case TextureFormat::UINT_32_32_32_32: + case TextureFormat::SINT_32_32_32_32: + case TextureFormat::UINT_8_8: + case TextureFormat::SINT_8_8: + case TextureFormat::UINT_16_16: + case TextureFormat::SINT_16_16: + case TextureFormat::UINT_32_32: + case TextureFormat::SINT_32_32: + case TextureFormat::UINT_8: + case TextureFormat::SINT_8: + case TextureFormat::UINT_16: + case TextureFormat::SINT_16: + case TextureFormat::UINT_32: + case TextureFormat::SINT_32: + case TextureFormat::UNORM_10_10_10_2: + case TextureFormat::UINT_10_10_10_2: + case TextureFormat::UINT_8_8_8: + case TextureFormat::SINT_8_8_8: + case TextureFormat::UNORM_8_8_8: + case TextureFormat::UINT_16_16_16: + case TextureFormat::SINT_16_16_16: + case TextureFormat::UNORM_16_16_16: + case TextureFormat::UINT_32_32_32: + case TextureFormat::SINT_32_32_32: + case TextureFormat::SRGBA_8_8_8: + case TextureFormat::UFLOAT_9_9_9_EXP_5: + case TextureFormat::UNORM_16_DEPTH: return ConversionType::UNSUPPORTED; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_r11g11b10(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_r11g11b10(TextureFormat device_format) { - if (device_format == GPU_R11F_G11F_B10F) { + if (device_format == TextureFormat::UFLOAT_11_11_10) { return ConversionType::PASS_THROUGH; } return ConversionType::UNSUPPORTED; } -static ConversionType type_of_conversion_r10g10b10a2(eGPUTextureFormat device_format) +static ConversionType type_of_conversion_r10g10b10a2(TextureFormat device_format) { - if (ELEM(device_format, GPU_RGB10_A2, GPU_RGB10_A2UI)) { + if (ELEM(device_format, TextureFormat::UNORM_10_10_10_2, TextureFormat::UINT_10_10_10_2)) { return ConversionType::PASS_THROUGH; } return ConversionType::UNSUPPORTED; } static ConversionType host_to_device(const eGPUDataFormat host_format, - const eGPUTextureFormat host_texture_format, - const eGPUTextureFormat device_format) + const TextureFormat host_texture_format, + const TextureFormat device_format) { switch (host_format) { case GPU_DATA_FLOAT: @@ -940,7 +946,7 @@ template void convert_per_component(void *dst_memory, const void *src_memory, size_t buffer_size, - eGPUTextureFormat device_format) + TextureFormat device_format) { size_t total_components = to_component_len(device_format) * buffer_size; Span src = Span(static_cast(src_memory), @@ -963,7 +969,7 @@ void convert_per_pixel(void *dst_memory, const void *src_memory, size_t buffer_s static void convert_buffer(void *dst_memory, const void *src_memory, size_t buffer_size, - eGPUTextureFormat device_format, + TextureFormat device_format, ConversionType type) { switch (type) { @@ -975,7 +981,7 @@ static void convert_buffer(void *dst_memory, return; case ConversionType::PASS_THROUGH_D32F_S8: - memcpy(dst_memory, src_memory, buffer_size * to_bytesize(GPU_DEPTH_COMPONENT32F)); + memcpy(dst_memory, src_memory, buffer_size * to_bytesize(TextureFormat::SFLOAT_32_DEPTH)); return; case ConversionType::UI32_TO_UI16: @@ -1119,8 +1125,8 @@ void convert_host_to_device(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, - eGPUTextureFormat host_texture_format, - eGPUTextureFormat device_format) + TextureFormat host_texture_format, + TextureFormat device_format) { ConversionType conversion_type = host_to_device(host_format, host_texture_format, device_format); BLI_assert(conversion_type != ConversionType::UNSUPPORTED); @@ -1131,8 +1137,8 @@ void convert_device_to_host(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, - eGPUTextureFormat host_texture_format, - eGPUTextureFormat device_format) + TextureFormat host_texture_format, + TextureFormat device_format) { ConversionType conversion_type = reversed( host_to_device(host_format, host_texture_format, device_format)); diff --git a/source/blender/gpu/vulkan/vk_data_conversion.hh b/source/blender/gpu/vulkan/vk_data_conversion.hh index 064c815f0bb..243470f13ed 100644 --- a/source/blender/gpu/vulkan/vk_data_conversion.hh +++ b/source/blender/gpu/vulkan/vk_data_conversion.hh @@ -35,8 +35,8 @@ void convert_host_to_device(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, - eGPUTextureFormat host_texture_format, - eGPUTextureFormat device_format); + TextureFormat host_texture_format, + TextureFormat device_format); /** * Convert device buffer to host buffer. @@ -56,8 +56,8 @@ void convert_device_to_host(void *dst_buffer, const void *src_buffer, size_t buffer_size, eGPUDataFormat host_format, - eGPUTextureFormat host_texture_format, - eGPUTextureFormat device_format); + TextureFormat host_texture_format, + TextureFormat device_format); /* -------------------------------------------------------------------- */ /** \name Floating point conversions diff --git a/source/blender/gpu/vulkan/vk_framebuffer.cc b/source/blender/gpu/vulkan/vk_framebuffer.cc index f1d2dc4ed42..f823b6e34ee 100644 --- a/source/blender/gpu/vulkan/vk_framebuffer.cc +++ b/source/blender/gpu/vulkan/vk_framebuffer.cc @@ -188,7 +188,7 @@ void VKFrameBuffer::build_clear_attachments_color( clear_attachments.attachments[clear_attachments.attachment_count++]; clear_attachment.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; clear_attachment.colorAttachment = color_slot; - eGPUDataFormat data_format = to_data_format(GPU_texture_format(attachment.tex)); + eGPUDataFormat data_format = to_texture_data_format(GPU_texture_format(attachment.tex)); clear_attachment.clearValue.color = to_vk_clear_color_value(data_format, &clear_colors[color_index]); diff --git a/source/blender/gpu/vulkan/vk_image_view.cc b/source/blender/gpu/vulkan/vk_image_view.cc index b8ea0de5849..e3b322d03a8 100644 --- a/source/blender/gpu/vulkan/vk_image_view.cc +++ b/source/blender/gpu/vulkan/vk_image_view.cc @@ -34,7 +34,7 @@ VKImageView::VKImageView(VKTexture &texture, const VKImageViewInfo &info, String const VkImageAspectFlags allowed_bits = VK_IMAGE_ASPECT_COLOR_BIT | (info.use_stencil ? VK_IMAGE_ASPECT_STENCIL_BIT : VK_IMAGE_ASPECT_DEPTH_BIT); - eGPUTextureFormat device_format = texture.device_format_get(); + TextureFormat device_format = texture.device_format_get(); VkImageAspectFlags image_aspect = to_vk_image_aspect_flag_bits(device_format) & allowed_bits; vk_format_ = to_vk_format(device_format); diff --git a/source/blender/gpu/vulkan/vk_shader.cc b/source/blender/gpu/vulkan/vk_shader.cc index c8c6716a095..ad2ef3993f5 100644 --- a/source/blender/gpu/vulkan/vk_shader.cc +++ b/source/blender/gpu/vulkan/vk_shader.cc @@ -86,72 +86,72 @@ static const char *to_string(const Type &type) } } -static const char *to_string(const eGPUTextureFormat &type) +static const char *to_string(const TextureFormat &type) { switch (type) { - case GPU_RGBA8UI: + case TextureFormat::UINT_8_8_8_8: return "rgba8ui"; - case GPU_RGBA8I: + case TextureFormat::SINT_8_8_8_8: return "rgba8i"; - case GPU_RGBA8: + case TextureFormat::UNORM_8_8_8_8: return "rgba8"; - case GPU_RGBA32UI: + case TextureFormat::UINT_32_32_32_32: return "rgba32ui"; - case GPU_RGBA32I: + case TextureFormat::SINT_32_32_32_32: return "rgba32i"; - case GPU_RGBA32F: + case TextureFormat::SFLOAT_32_32_32_32: return "rgba32f"; - case GPU_RGBA16UI: + case TextureFormat::UINT_16_16_16_16: return "rgba16ui"; - case GPU_RGBA16I: + case TextureFormat::SINT_16_16_16_16: return "rgba16i"; - case GPU_RGBA16F: + case TextureFormat::SFLOAT_16_16_16_16: return "rgba16f"; - case GPU_RGBA16: + case TextureFormat::UNORM_16_16_16_16: return "rgba16"; - case GPU_RG8UI: + case TextureFormat::UINT_8_8: return "rg8ui"; - case GPU_RG8I: + case TextureFormat::SINT_8_8: return "rg8i"; - case GPU_RG8: + case TextureFormat::UNORM_8_8: return "rg8"; - case GPU_RG32UI: + case TextureFormat::UINT_32_32: return "rg32ui"; - case GPU_RG32I: + case TextureFormat::SINT_32_32: return "rg32i"; - case GPU_RG32F: + case TextureFormat::SFLOAT_32_32: return "rg32f"; - case GPU_RG16UI: + case TextureFormat::UINT_16_16: return "rg16ui"; - case GPU_RG16I: + case TextureFormat::SINT_16_16: return "rg16i"; - case GPU_RG16F: + case TextureFormat::SFLOAT_16_16: return "rg16f"; - case GPU_RG16: + case TextureFormat::UNORM_16_16: return "rg16"; - case GPU_R8UI: + case TextureFormat::UINT_8: return "r8ui"; - case GPU_R8I: + case TextureFormat::SINT_8: return "r8i"; - case GPU_R8: + case TextureFormat::UNORM_8: return "r8"; - case GPU_R32UI: + case TextureFormat::UINT_32: return "r32ui"; - case GPU_R32I: + case TextureFormat::SINT_32: return "r32i"; - case GPU_R32F: + case TextureFormat::SFLOAT_32: return "r32f"; - case GPU_R16UI: + case TextureFormat::UINT_16: return "r16ui"; - case GPU_R16I: + case TextureFormat::SINT_16: return "r16i"; - case GPU_R16F: + case TextureFormat::SFLOAT_16: return "r16f"; - case GPU_R16: + case TextureFormat::UNORM_16: return "r16"; - case GPU_R11F_G11F_B10F: + case TextureFormat::UFLOAT_11_11_10: return "r11f_g11f_b10f"; - case GPU_RGB10_A2: + case TextureFormat::UNORM_10_10_10_2: return "rgb10_a2"; default: return "unknown"; diff --git a/source/blender/gpu/vulkan/vk_texture.cc b/source/blender/gpu/vulkan/vk_texture.cc index e4d509bd7a0..66bbfca2ac2 100644 --- a/source/blender/gpu/vulkan/vk_texture.cc +++ b/source/blender/gpu/vulkan/vk_texture.cc @@ -116,8 +116,12 @@ void VKTexture::clear(eGPUDataFormat format, const void *data) { if (format == GPU_DATA_UINT_24_8_DEPRECATED) { float clear_depth = 0.0f; - convert_host_to_device( - &clear_depth, data, 1, format, GPU_DEPTH32F_STENCIL8, GPU_DEPTH32F_STENCIL8); + convert_host_to_device(&clear_depth, + data, + 1, + format, + TextureFormat::SFLOAT_32_DEPTH_UINT_8, + TextureFormat::SFLOAT_32_DEPTH_UINT_8); clear_depth_stencil(GPU_DEPTH_BIT | GPU_STENCIL_BIT, clear_depth, 0u); return; } @@ -429,11 +433,11 @@ bool VKTexture::init_internal() { device_format_ = format_; /* R16G16F16 formats are typically not supported (<1%). */ - if (device_format_ == GPU_RGB16F) { - device_format_ = GPU_RGBA16F; + if (device_format_ == TextureFormat::SFLOAT_16_16_16) { + device_format_ = TextureFormat::SFLOAT_16_16_16_16; } - if (device_format_ == GPU_RGB32F) { - device_format_ = GPU_RGBA32F; + if (device_format_ == TextureFormat::SFLOAT_32_32_32) { + device_format_ = TextureFormat::SFLOAT_32_32_32_32; } if (!allocate()) { diff --git a/source/blender/gpu/vulkan/vk_texture.hh b/source/blender/gpu/vulkan/vk_texture.hh index ad440d1fa3c..ae2a3e10aaa 100644 --- a/source/blender/gpu/vulkan/vk_texture.hh +++ b/source/blender/gpu/vulkan/vk_texture.hh @@ -37,7 +37,7 @@ class VKTexture : public Texture { * This can be a different format then #Texture.format_ in case the texture format isn't natively * supported by the device. */ - eGPUTextureFormat device_format_ = (eGPUTextureFormat)-1; + TextureFormat device_format_ = TextureFormat::Invalid; /** When set the instance is considered to be a texture view from `source_texture_` */ VKTexture *source_texture_ = nullptr; @@ -125,7 +125,7 @@ class VKTexture : public Texture { /** * Get the texture format how the texture is stored on the device. */ - eGPUTextureFormat device_format_get() const + TextureFormat device_format_get() const { return device_format_; } diff --git a/source/blender/imbuf/IMB_imbuf.hh b/source/blender/imbuf/IMB_imbuf.hh index 3d9a18d28dc..92b35241747 100644 --- a/source/blender/imbuf/IMB_imbuf.hh +++ b/source/blender/imbuf/IMB_imbuf.hh @@ -602,9 +602,9 @@ blender::gpu::Texture *IMB_create_gpu_texture(const char *name, bool use_high_bitdepth, bool use_premult); -eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, - bool high_bitdepth, - bool use_grayscale); +blender::gpu::TextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, + bool high_bitdepth, + bool use_grayscale); /** * Ensures that values stored in the float rect can safely loaded into half float gpu textures. diff --git a/source/blender/imbuf/intern/util_gpu.cc b/source/blender/imbuf/intern/util_gpu.cc index 516e8c64115..970ed12c823 100644 --- a/source/blender/imbuf/intern/util_gpu.cc +++ b/source/blender/imbuf/intern/util_gpu.cc @@ -52,7 +52,7 @@ static bool imb_is_grayscale_texture_format_compatible(const ImBuf *ibuf) static void imb_gpu_get_format(const ImBuf *ibuf, bool high_bitdepth, bool use_grayscale, - eGPUTextureFormat *r_texture_format) + blender::gpu::TextureFormat *r_texture_format) { const bool float_rect = (ibuf->float_buffer.data != nullptr); const bool is_grayscale = use_grayscale && imb_is_grayscale_texture_format_compatible(ibuf); @@ -60,23 +60,29 @@ static void imb_gpu_get_format(const ImBuf *ibuf, if (float_rect) { /* Float. */ const bool use_high_bitdepth = (!(ibuf->foptions.flag & OPENEXR_HALF) && high_bitdepth); - *r_texture_format = is_grayscale ? (use_high_bitdepth ? GPU_R32F : GPU_R16F) : - (use_high_bitdepth ? GPU_RGBA32F : GPU_RGBA16F); + *r_texture_format = is_grayscale ? + (use_high_bitdepth ? blender::gpu::TextureFormat::SFLOAT_32 : + blender::gpu::TextureFormat::SFLOAT_16) : + (use_high_bitdepth ? blender::gpu::TextureFormat::SFLOAT_32_32_32_32 : + blender::gpu::TextureFormat::SFLOAT_16_16_16_16); } else { if (IMB_colormanagement_space_is_data(ibuf->byte_buffer.colorspace) || IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace)) { /* Non-color data or scene linear, just store buffer as is. */ - *r_texture_format = (is_grayscale) ? GPU_R8 : GPU_RGBA8; + *r_texture_format = (is_grayscale) ? blender::gpu::TextureFormat::UNORM_8 : + blender::gpu::TextureFormat::UNORM_8_8_8_8; } else if (IMB_colormanagement_space_is_srgb(ibuf->byte_buffer.colorspace)) { /* sRGB, store as byte texture that the GPU can decode directly. */ - *r_texture_format = (is_grayscale) ? GPU_R16F : GPU_SRGB8_A8; + *r_texture_format = (is_grayscale) ? blender::gpu::TextureFormat::SFLOAT_16 : + blender::gpu::TextureFormat::SRGBA_8_8_8_8; } else { /* Other colorspace, store as half float texture to avoid precision loss. */ - *r_texture_format = (is_grayscale) ? GPU_R16F : GPU_RGBA16F; + *r_texture_format = (is_grayscale) ? blender::gpu::TextureFormat::SFLOAT_16 : + blender::gpu::TextureFormat::SFLOAT_16_16_16_16; } } } @@ -87,7 +93,8 @@ static const char *imb_gpu_get_swizzle(const ImBuf *ibuf) } /* Return false if no suitable format was found. */ -static bool IMB_gpu_get_compressed_format(const ImBuf *ibuf, eGPUTextureFormat *r_texture_format) +static bool IMB_gpu_get_compressed_format(const ImBuf *ibuf, + blender::gpu::TextureFormat *r_texture_format) { /* For DDS we only support data, scene linear and sRGB. Converting to * different colorspace would break the compression. */ @@ -95,13 +102,16 @@ static bool IMB_gpu_get_compressed_format(const ImBuf *ibuf, eGPUTextureFormat * !IMB_colormanagement_space_is_scene_linear(ibuf->byte_buffer.colorspace)); if (ibuf->dds_data.fourcc == FOURCC_DXT1) { - *r_texture_format = (use_srgb) ? GPU_SRGB8_A8_DXT1 : GPU_RGBA8_DXT1; + *r_texture_format = (use_srgb) ? blender::gpu::TextureFormat::SRGB_DXT1 : + blender::gpu::TextureFormat::SNORM_DXT1; } else if (ibuf->dds_data.fourcc == FOURCC_DXT3) { - *r_texture_format = (use_srgb) ? GPU_SRGB8_A8_DXT3 : GPU_RGBA8_DXT3; + *r_texture_format = (use_srgb) ? blender::gpu::TextureFormat::SRGB_DXT3 : + blender::gpu::TextureFormat::SNORM_DXT3; } else if (ibuf->dds_data.fourcc == FOURCC_DXT5) { - *r_texture_format = (use_srgb) ? GPU_SRGB8_A8_DXT5 : GPU_RGBA8_DXT5; + *r_texture_format = (use_srgb) ? blender::gpu::TextureFormat::SRGB_DXT5 : + blender::gpu::TextureFormat::SNORM_DXT5; } else { return false; @@ -260,7 +270,7 @@ blender::gpu::Texture *IMB_touch_gpu_texture(const char *name, bool use_high_bitdepth, bool use_grayscale) { - eGPUTextureFormat tex_format; + blender::gpu::TextureFormat tex_format; imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &tex_format); blender::gpu::Texture *tex; @@ -292,7 +302,7 @@ void IMB_update_gpu_texture_sub(blender::gpu::Texture *tex, const bool do_rescale = (ibuf->x != w || ibuf->y != h); const int size[2] = {w, h}; - eGPUTextureFormat tex_format; + blender::gpu::TextureFormat tex_format; imb_gpu_get_format(ibuf, use_high_bitdepth, use_grayscale, &tex_format); bool freebuf = false; @@ -329,7 +339,7 @@ blender::gpu::Texture *IMB_create_gpu_texture(const char *name, } if (ibuf->ftype == IMB_FTYPE_DDS) { - eGPUTextureFormat compressed_format; + blender::gpu::TextureFormat compressed_format; if (!IMB_gpu_get_compressed_format(ibuf, &compressed_format)) { fprintf(stderr, "Unable to find a suitable DXT compression,"); } @@ -362,7 +372,7 @@ blender::gpu::Texture *IMB_create_gpu_texture(const char *name, fprintf(stderr, " falling back to uncompressed (%s, %ix%i).\n", name, ibuf->x, ibuf->y); } - eGPUTextureFormat tex_format; + blender::gpu::TextureFormat tex_format; imb_gpu_get_format(ibuf, use_high_bitdepth, true, &tex_format); bool freebuf = false; @@ -392,11 +402,11 @@ blender::gpu::Texture *IMB_create_gpu_texture(const char *name, return tex; } -eGPUTextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, - bool high_bitdepth, - bool use_grayscale) +blender::gpu::TextureFormat IMB_gpu_get_texture_format(const ImBuf *ibuf, + bool high_bitdepth, + bool use_grayscale) { - eGPUTextureFormat gpu_texture_format; + blender::gpu::TextureFormat gpu_texture_format; imb_gpu_get_format(ibuf, high_bitdepth, use_grayscale, &gpu_texture_format); return gpu_texture_format; } diff --git a/source/blender/imbuf/opencolorio/intern/gpu_shader_binder.cc b/source/blender/imbuf/opencolorio/intern/gpu_shader_binder.cc index 880ca1d4979..b5c1bf64709 100644 --- a/source/blender/imbuf/opencolorio/intern/gpu_shader_binder.cc +++ b/source/blender/imbuf/opencolorio/intern/gpu_shader_binder.cc @@ -94,8 +94,12 @@ bool GPUCurveMappping::initialize_common(const bool use_curve_mapping) return true; } - texture = GPU_texture_create_1d( - "OCIOCurveMap", lut_size, 1, GPU_RGBA16F, GPU_TEXTURE_USAGE_SHADER_READ, nullptr); + texture = GPU_texture_create_1d("OCIOCurveMap", + lut_size, + 1, + blender::gpu::TextureFormat::SFLOAT_16_16_16_16, + GPU_TEXTURE_USAGE_SHADER_READ, + nullptr); GPU_texture_filter_mode(texture, false); GPU_texture_extend_mode(texture, GPU_SAMPLER_EXTEND_MODE_EXTEND); diff --git a/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc b/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc index 629d084895e..3f551cd3665 100644 --- a/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc +++ b/source/blender/imbuf/opencolorio/intern/libocio/libocio_gpu_shader_binder.cc @@ -79,8 +79,9 @@ static bool add_gpu_lut_1D2D(internal::GPUTextures &textures, return false; } - eGPUTextureFormat format = (channel == GpuShaderCreator::TEXTURE_RGB_CHANNEL) ? GPU_RGB16F : - GPU_R16F; + blender::gpu::TextureFormat format = (channel == GpuShaderCreator::TEXTURE_RGB_CHANNEL) ? + blender::gpu::TextureFormat::SFLOAT_16_16_16 : + blender::gpu::TextureFormat::SFLOAT_16; internal::GPULutTexture lut; /* There does not appear to be an explicit way to check if a texture is 1D or 2D. @@ -132,7 +133,7 @@ static bool add_gpu_lut_3D(internal::GPUTextures &textures, edgelen, edgelen, 1, - GPU_RGB16F, + blender::gpu::TextureFormat::SFLOAT_16_16_16, GPU_TEXTURE_USAGE_SHADER_READ, values); if (lut.texture == nullptr) { diff --git a/source/blender/python/gpu/gpu_py_framebuffer.cc b/source/blender/python/gpu/gpu_py_framebuffer.cc index 65ac70aa425..e5514304d76 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.cc +++ b/source/blender/python/gpu/gpu_py_framebuffer.cc @@ -563,7 +563,8 @@ static PyObject *pygpu_framebuffer_read_color(BPyGPUFrameBuffer *self, PYGPU_FRAMEBUFFER_CHECK_OBJ(self); int x, y, w, h, channels; uint slot; - PyC_StringEnum pygpu_dataformat = {bpygpu_dataformat_items, GPU_RGBA8}; + PyC_StringEnum pygpu_dataformat = {bpygpu_dataformat_items, + int(blender::gpu::TextureFormat::UNORM_8_8_8_8)}; BPyGPUBuffer *py_buffer = nullptr; static const char *_keywords[] = { diff --git a/source/blender/python/gpu/gpu_py_offscreen.cc b/source/blender/python/gpu/gpu_py_offscreen.cc index d2fe3f84aef..8d843837f8c 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.cc +++ b/source/blender/python/gpu/gpu_py_offscreen.cc @@ -48,10 +48,10 @@ * \{ */ static const PyC_StringEnumItems pygpu_framebuffer_color_texture_formats[] = { - {GPU_RGBA8, "RGBA8"}, - {GPU_RGBA16, "RGBA16"}, - {GPU_RGBA16F, "RGBA16F"}, - {GPU_RGBA32F, "RGBA32F"}, + {int(blender::gpu::TextureFormat::UNORM_8_8_8_8), "RGBA8"}, + {int(blender::gpu::TextureFormat::UNORM_16_16_16_16), "RGBA16"}, + {int(blender::gpu::TextureFormat::SFLOAT_16_16_16_16), "RGBA16F"}, + {int(blender::gpu::TextureFormat::SFLOAT_32_32_32_32), "RGBA32F"}, {0, nullptr}, }; @@ -284,7 +284,8 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject * /*self*/, PyObject *args GPUOffScreen *ofs = nullptr; int width, height; - PyC_StringEnum pygpu_textureformat = {pygpu_framebuffer_color_texture_formats, GPU_RGBA8}; + PyC_StringEnum pygpu_textureformat = {pygpu_framebuffer_color_texture_formats, + int(blender::gpu::TextureFormat::UNORM_8_8_8_8)}; char err_out[256]; static const char *_keywords[] = {"width", "height", "format", nullptr}; @@ -308,7 +309,7 @@ static PyObject *pygpu_offscreen__tp_new(PyTypeObject * /*self*/, PyObject *args ofs = GPU_offscreen_create(width, height, true, - eGPUTextureFormat(pygpu_textureformat.value_found), + blender::gpu::TextureFormat(pygpu_textureformat.value_found), GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_HOST_READ, false, err_out); diff --git a/source/blender/python/gpu/gpu_py_shader_create_info.cc b/source/blender/python/gpu/gpu_py_shader_create_info.cc index 73fa2cf2cf4..80f68d435da 100644 --- a/source/blender/python/gpu/gpu_py_shader_create_info.cc +++ b/source/blender/python/gpu/gpu_py_shader_create_info.cc @@ -792,12 +792,12 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, } if (pygpu_texformat.value_found == GPU_DEPTH24_STENCIL8_DEPRECATED) { - pygpu_texformat.value_found = GPU_DEPTH32F_STENCIL8; + pygpu_texformat.value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); PyErr_WarnEx( PyExc_DeprecationWarning, "'DEPTH24_STENCIL8' is deprecated. Use 'DEPTH32F_STENCIL8'.", 1); } if (pygpu_texformat.value_found == GPU_DEPTH_COMPONENT24_DEPRECATED) { - pygpu_texformat.value_found = GPU_DEPTH_COMPONENT32F; + pygpu_texformat.value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH); PyErr_WarnEx(PyExc_DeprecationWarning, "'DEPTH_COMPONENT24' is deprecated. Use 'DEPTH_COMPONENT32F'.", 1); @@ -809,7 +809,7 @@ static PyObject *pygpu_shader_info_image(BPyGPUShaderCreateInfo *self, ShaderCreateInfo *info = reinterpret_cast(self->info); info->image(slot, - (eGPUTextureFormat)pygpu_texformat.value_found, + (blender::gpu::TextureFormat)pygpu_texformat.value_found, qualifier, blender::gpu::shader::ImageReadWriteType(pygpu_imagetype.value_found), name); diff --git a/source/blender/python/gpu/gpu_py_texture.cc b/source/blender/python/gpu/gpu_py_texture.cc index e1be706e654..de61da9f585 100644 --- a/source/blender/python/gpu/gpu_py_texture.cc +++ b/source/blender/python/gpu/gpu_py_texture.cc @@ -36,50 +36,50 @@ * \{ */ const PyC_StringEnumItems pygpu_textureformat_items[] = { - {GPU_RGBA8UI, "RGBA8UI"}, - {GPU_RGBA8I, "RGBA8I"}, - {GPU_RGBA8, "RGBA8"}, - {GPU_RGBA32UI, "RGBA32UI"}, - {GPU_RGBA32I, "RGBA32I"}, - {GPU_RGBA32F, "RGBA32F"}, - {GPU_RGBA16UI, "RGBA16UI"}, - {GPU_RGBA16I, "RGBA16I"}, - {GPU_RGBA16F, "RGBA16F"}, - {GPU_RGBA16, "RGBA16"}, - {GPU_RG8UI, "RG8UI"}, - {GPU_RG8I, "RG8I"}, - {GPU_RG8, "RG8"}, - {GPU_RG32UI, "RG32UI"}, - {GPU_RG32I, "RG32I"}, - {GPU_RG32F, "RG32F"}, - {GPU_RG16UI, "RG16UI"}, - {GPU_RG16I, "RG16I"}, - {GPU_RG16F, "RG16F"}, - {GPU_RG16, "RG16"}, - {GPU_R8UI, "R8UI"}, - {GPU_R8I, "R8I"}, - {GPU_R8, "R8"}, - {GPU_R32UI, "R32UI"}, - {GPU_R32I, "R32I"}, - {GPU_R32F, "R32F"}, - {GPU_R16UI, "R16UI"}, - {GPU_R16I, "R16I"}, - {GPU_R16F, "R16F"}, - {GPU_R16, "R16"}, - {GPU_R11F_G11F_B10F, "R11F_G11F_B10F"}, - {GPU_DEPTH32F_STENCIL8, "DEPTH32F_STENCIL8"}, + {int(blender::gpu::TextureFormat::UINT_8_8_8_8), "RGBA8UI"}, + {int(blender::gpu::TextureFormat::SINT_8_8_8_8), "RGBA8I"}, + {int(blender::gpu::TextureFormat::UNORM_8_8_8_8), "RGBA8"}, + {int(blender::gpu::TextureFormat::UINT_32_32_32_32), "RGBA32UI"}, + {int(blender::gpu::TextureFormat::SINT_32_32_32_32), "RGBA32I"}, + {int(blender::gpu::TextureFormat::SFLOAT_32_32_32_32), "RGBA32F"}, + {int(blender::gpu::TextureFormat::UINT_16_16_16_16), "RGBA16UI"}, + {int(blender::gpu::TextureFormat::SINT_16_16_16_16), "RGBA16I"}, + {int(blender::gpu::TextureFormat::SFLOAT_16_16_16_16), "RGBA16F"}, + {int(blender::gpu::TextureFormat::UNORM_16_16_16_16), "RGBA16"}, + {int(blender::gpu::TextureFormat::UINT_8_8), "RG8UI"}, + {int(blender::gpu::TextureFormat::SINT_8_8), "RG8I"}, + {int(blender::gpu::TextureFormat::UNORM_8_8), "RG8"}, + {int(blender::gpu::TextureFormat::UINT_32_32), "RG32UI"}, + {int(blender::gpu::TextureFormat::SINT_32_32), "RG32I"}, + {int(blender::gpu::TextureFormat::SFLOAT_32_32), "RG32F"}, + {int(blender::gpu::TextureFormat::UINT_16_16), "RG16UI"}, + {int(blender::gpu::TextureFormat::SINT_16_16), "RG16I"}, + {int(blender::gpu::TextureFormat::SFLOAT_16_16), "RG16F"}, + {int(blender::gpu::TextureFormat::UNORM_16_16), "RG16"}, + {int(blender::gpu::TextureFormat::UINT_8), "R8UI"}, + {int(blender::gpu::TextureFormat::SINT_8), "R8I"}, + {int(blender::gpu::TextureFormat::UNORM_8), "R8"}, + {int(blender::gpu::TextureFormat::UINT_32), "R32UI"}, + {int(blender::gpu::TextureFormat::SINT_32), "R32I"}, + {int(blender::gpu::TextureFormat::SFLOAT_32), "R32F"}, + {int(blender::gpu::TextureFormat::UINT_16), "R16UI"}, + {int(blender::gpu::TextureFormat::SINT_16), "R16I"}, + {int(blender::gpu::TextureFormat::SFLOAT_16), "R16F"}, + {int(blender::gpu::TextureFormat::UNORM_16), "R16"}, + {int(blender::gpu::TextureFormat::UFLOAT_11_11_10), "R11F_G11F_B10F"}, + {int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8), "DEPTH32F_STENCIL8"}, {GPU_DEPTH24_STENCIL8_DEPRECATED, "DEPTH24_STENCIL8"}, - {GPU_SRGB8_A8, "SRGB8_A8"}, - {GPU_RGB16F, "RGB16F"}, - {GPU_SRGB8_A8_DXT1, "SRGB8_A8_DXT1"}, - {GPU_SRGB8_A8_DXT3, "SRGB8_A8_DXT3"}, - {GPU_SRGB8_A8_DXT5, "SRGB8_A8_DXT5"}, - {GPU_RGBA8_DXT1, "RGBA8_DXT1"}, - {GPU_RGBA8_DXT3, "RGBA8_DXT3"}, - {GPU_RGBA8_DXT5, "RGBA8_DXT5"}, - {GPU_DEPTH_COMPONENT32F, "DEPTH_COMPONENT32F"}, + {int(blender::gpu::TextureFormat::SRGBA_8_8_8_8), "SRGB8_A8"}, + {int(blender::gpu::TextureFormat::SFLOAT_16_16_16), "RGB16F"}, + {int(blender::gpu::TextureFormat::SRGB_DXT1), "SRGB8_A8_DXT1"}, + {int(blender::gpu::TextureFormat::SRGB_DXT3), "SRGB8_A8_DXT3"}, + {int(blender::gpu::TextureFormat::SRGB_DXT5), "SRGB8_A8_DXT5"}, + {int(blender::gpu::TextureFormat::SNORM_DXT1), "RGBA8_DXT1"}, + {int(blender::gpu::TextureFormat::SNORM_DXT3), "RGBA8_DXT3"}, + {int(blender::gpu::TextureFormat::SNORM_DXT5), "RGBA8_DXT5"}, + {int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH), "DEPTH_COMPONENT32F"}, {GPU_DEPTH_COMPONENT24_DEPRECATED, "DEPTH_COMPONENT24"}, - {GPU_DEPTH_COMPONENT16, "DEPTH_COMPONENT16"}, + {int(blender::gpu::TextureFormat::UNORM_16_DEPTH), "DEPTH_COMPONENT16"}, {0, nullptr}, }; @@ -121,7 +121,8 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, int size[3] = {1, 1, 1}; int layers = 0; int is_cubemap = false; - PyC_StringEnum pygpu_textureformat = {pygpu_textureformat_items, GPU_RGBA8}; + PyC_StringEnum pygpu_textureformat = {pygpu_textureformat_items, + int(blender::gpu::TextureFormat::UNORM_8_8_8_8)}; BPyGPUBuffer *pybuffer_obj = nullptr; char err_out[256] = "unknown error. See console"; @@ -153,12 +154,12 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, } if (pygpu_textureformat.value_found == GPU_DEPTH24_STENCIL8_DEPRECATED) { - pygpu_textureformat.value_found = GPU_DEPTH32F_STENCIL8; + pygpu_textureformat.value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8); PyErr_WarnEx( PyExc_DeprecationWarning, "'DEPTH24_STENCIL8' is deprecated. Use 'DEPTH32F_STENCIL8'.", 1); } if (pygpu_textureformat.value_found == GPU_DEPTH_COMPONENT24_DEPRECATED) { - pygpu_textureformat.value_found = GPU_DEPTH_COMPONENT32F; + pygpu_textureformat.value_found = int(blender::gpu::TextureFormat::SFLOAT_32_DEPTH); PyErr_WarnEx(PyExc_DeprecationWarning, "'DEPTH_COMPONENT24' is deprecated. Use 'DEPTH_COMPONENT32F'.", 1); @@ -200,7 +201,7 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, } int component_len = GPU_texture_component_len( - eGPUTextureFormat(pygpu_textureformat.value_found)); + blender::gpu::TextureFormat(pygpu_textureformat.value_found)); int component_size_expected = sizeof(float); size_t data_space_expected = size_t(size[0]) * size[1] * size[2] * max_ii(1, layers) * component_len * component_size_expected; @@ -235,42 +236,45 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL; if (is_cubemap) { if (layers) { - tex = GPU_texture_create_cube_array(name, - size[0], - layers, - 1, - eGPUTextureFormat(pygpu_textureformat.value_found), - usage, - static_cast(data)); + tex = GPU_texture_create_cube_array( + name, + size[0], + layers, + 1, + blender::gpu::TextureFormat(pygpu_textureformat.value_found), + usage, + static_cast(data)); } else { tex = GPU_texture_create_cube(name, size[0], 1, - eGPUTextureFormat(pygpu_textureformat.value_found), + blender::gpu::TextureFormat(pygpu_textureformat.value_found), usage, static_cast(data)); } } else if (layers) { if (len == 2) { - tex = GPU_texture_create_2d_array(name, - size[0], - size[1], - layers, - 1, - eGPUTextureFormat(pygpu_textureformat.value_found), - usage, - static_cast(data)); + tex = GPU_texture_create_2d_array( + name, + size[0], + size[1], + layers, + 1, + blender::gpu::TextureFormat(pygpu_textureformat.value_found), + usage, + static_cast(data)); } else { - tex = GPU_texture_create_1d_array(name, - size[0], - layers, - 1, - eGPUTextureFormat(pygpu_textureformat.value_found), - usage, - static_cast(data)); + tex = GPU_texture_create_1d_array( + name, + size[0], + layers, + 1, + blender::gpu::TextureFormat(pygpu_textureformat.value_found), + usage, + static_cast(data)); } } else if (len == 3) { @@ -279,7 +283,7 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, size[1], size[2], 1, - eGPUTextureFormat(pygpu_textureformat.value_found), + blender::gpu::TextureFormat(pygpu_textureformat.value_found), usage, data); } @@ -288,7 +292,7 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, size[0], size[1], 1, - eGPUTextureFormat(pygpu_textureformat.value_found), + blender::gpu::TextureFormat(pygpu_textureformat.value_found), usage, static_cast(data)); } @@ -296,7 +300,7 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject * /*self*/, PyObject *args, tex = GPU_texture_create_1d(name, size[0], 1, - eGPUTextureFormat(pygpu_textureformat.value_found), + blender::gpu::TextureFormat(pygpu_textureformat.value_found), usage, static_cast(data)); } @@ -343,8 +347,9 @@ PyDoc_STRVAR( static PyObject *pygpu_texture_format_get(BPyGPUTexture *self, void * /*type*/) { BPYGPU_TEXTURE_CHECK_OBJ(self); - eGPUTextureFormat format = GPU_texture_format(self->tex); - return PyUnicode_FromString(PyC_StringEnum_FindIDFromValue(pygpu_textureformat_items, format)); + blender::gpu::TextureFormat format = GPU_texture_format(self->tex); + return PyUnicode_FromString( + PyC_StringEnum_FindIDFromValue(pygpu_textureformat_items, int(format))); } PyDoc_STRVAR( @@ -443,35 +448,35 @@ PyDoc_STRVAR( static PyObject *pygpu_texture_read(BPyGPUTexture *self) { BPYGPU_TEXTURE_CHECK_OBJ(self); - eGPUTextureFormat tex_format = GPU_texture_format(self->tex); + blender::gpu::TextureFormat tex_format = GPU_texture_format(self->tex); /* #GPU_texture_read is restricted in combining 'data_format' with 'tex_format'. * So choose data_format here. */ eGPUDataFormat best_data_format; switch (tex_format) { - case GPU_DEPTH_COMPONENT16: - case GPU_DEPTH_COMPONENT32F: - case GPU_DEPTH32F_STENCIL8: + case blender::gpu::TextureFormat::UNORM_16_DEPTH: + case blender::gpu::TextureFormat::SFLOAT_32_DEPTH: + case blender::gpu::TextureFormat::SFLOAT_32_DEPTH_UINT_8: best_data_format = GPU_DATA_FLOAT; break; - case GPU_R8UI: - case GPU_R16UI: - case GPU_RG16UI: - case GPU_R32UI: + case blender::gpu::TextureFormat::UINT_8: + case blender::gpu::TextureFormat::UINT_16: + case blender::gpu::TextureFormat::UINT_16_16: + case blender::gpu::TextureFormat::UINT_32: best_data_format = GPU_DATA_UINT; break; - case GPU_RG16I: - case GPU_R16I: + case blender::gpu::TextureFormat::SINT_16_16: + case blender::gpu::TextureFormat::SINT_16: best_data_format = GPU_DATA_INT; break; - case GPU_R8: - case GPU_RG8: - case GPU_RGBA8: - case GPU_RGBA8UI: - case GPU_SRGB8_A8: + case blender::gpu::TextureFormat::UNORM_8: + case blender::gpu::TextureFormat::UNORM_8_8: + case blender::gpu::TextureFormat::UNORM_8_8_8_8: + case blender::gpu::TextureFormat::UINT_8_8_8_8: + case blender::gpu::TextureFormat::SRGBA_8_8_8_8: best_data_format = GPU_DATA_UBYTE; break; - case GPU_R11F_G11F_B10F: + case blender::gpu::TextureFormat::UFLOAT_11_11_10: best_data_format = GPU_DATA_10_11_11_REV; break; default: diff --git a/source/blender/render/hydra/render_task_delegate.cc b/source/blender/render/hydra/render_task_delegate.cc index 5077e70ba5c..b60e2581cda 100644 --- a/source/blender/render/hydra/render_task_delegate.cc +++ b/source/blender/render/hydra/render_task_delegate.cc @@ -220,14 +220,14 @@ void GPURenderTaskDelegate::set_viewport(pxr::GfVec4d const &viewport) void GPURenderTaskDelegate::add_aov(pxr::TfToken const &aov_key) { - eGPUTextureFormat format; + blender::gpu::TextureFormat format; blender::gpu::Texture **tex; if (aov_key == pxr::HdAovTokens->color) { - format = GPU_RGBA32F; + format = blender::gpu::TextureFormat::SFLOAT_32_32_32_32; tex = &tex_color_; } else if (aov_key == pxr::HdAovTokens->depth) { - format = GPU_DEPTH_COMPONENT32F; + format = blender::gpu::TextureFormat::SFLOAT_32_DEPTH; tex = &tex_depth_; } else { diff --git a/source/blender/render/hydra/viewport_engine.cc b/source/blender/render/hydra/viewport_engine.cc index 6a29e1c0448..e38601f3ba9 100644 --- a/source/blender/render/hydra/viewport_engine.cc +++ b/source/blender/render/hydra/viewport_engine.cc @@ -163,15 +163,15 @@ void DrawTexture::create_from_buffer(pxr::HdRenderBuffer *buffer) return; } - eGPUTextureFormat texture_format; + blender::gpu::TextureFormat texture_format; eGPUDataFormat data_format; if (buffer->GetFormat() == pxr::HdFormat::HdFormatFloat16Vec4) { - texture_format = GPU_RGBA16F; + texture_format = blender::gpu::TextureFormat::SFLOAT_16_16_16_16; data_format = GPU_DATA_HALF_FLOAT; } else { - texture_format = GPU_RGBA32F; + texture_format = blender::gpu::TextureFormat::SFLOAT_32_32_32_32; data_format = GPU_DATA_FLOAT; } diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc index 136694a6c78..69ad27d1a41 100644 --- a/source/blender/render/intern/render_result.cc +++ b/source/blender/render/intern/render_result.cc @@ -481,9 +481,11 @@ blender::gpu::Texture *RE_pass_ensure_gpu_texture_cache(Render *re, RenderPass * return nullptr; } - const eGPUTextureFormat format = (rpass->channels == 1) ? GPU_R32F : - (rpass->channels == 3) ? GPU_RGB32F : - GPU_RGBA32F; + const blender::gpu::TextureFormat format = (rpass->channels == 1) ? + blender::gpu::TextureFormat::SFLOAT_32 : + (rpass->channels == 3) ? + blender::gpu::TextureFormat::SFLOAT_32_32_32 : + blender::gpu::TextureFormat::SFLOAT_32_32_32_32; /* TODO(sergey): Use utility to assign the texture. */ ibuf->gpu.texture = GPU_texture_create_2d("RenderBuffer.gpu_texture", diff --git a/source/blender/windowmanager/intern/wm_dragdrop.cc b/source/blender/windowmanager/intern/wm_dragdrop.cc index 82d87498aa3..d9c27edf678 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.cc +++ b/source/blender/windowmanager/intern/wm_dragdrop.cc @@ -1090,7 +1090,7 @@ static void wm_drag_draw_icon(bContext * /*C*/, wmWindow * /*win*/, wmDrag *drag y, drag->imb->x, drag->imb->y, - GPU_RGBA8, + blender::gpu::TextureFormat::UNORM_8_8_8_8, false, drag->imb->byte_buffer.data, drag->imbuf_scale, diff --git a/source/blender/windowmanager/intern/wm_draw.cc b/source/blender/windowmanager/intern/wm_draw.cc index 021eee7d07e..c1f6a672379 100644 --- a/source/blender/windowmanager/intern/wm_draw.cc +++ b/source/blender/windowmanager/intern/wm_draw.cc @@ -250,7 +250,13 @@ static void wm_software_cursor_draw_bitmap(const float system_scale, float gl_matrix[4][4]; eGPUTextureUsage usage = GPU_TEXTURE_USAGE_GENERAL; blender::gpu::Texture *texture = GPU_texture_create_2d( - "software_cursor", bitmap->data_size[0], bitmap->data_size[1], 1, GPU_RGBA8, usage, nullptr); + "software_cursor", + bitmap->data_size[0], + bitmap->data_size[1], + 1, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + usage, + nullptr); GPU_texture_update(texture, GPU_DATA_UBYTE, bitmap->data); GPU_texture_filter_mode(texture, false); @@ -688,13 +694,15 @@ static void wm_draw_offscreen_texture_parameters(GPUOffScreen *offscreen) GPU_texture_mipmap_mode(texture, false, false); } -static eGPUTextureFormat get_hdr_framebuffer_format(const Scene *scene) +static blender::gpu::TextureFormat get_hdr_framebuffer_format(const Scene *scene) { bool use_hdr = false; if (scene && ((scene->view_settings.flag & COLORMANAGE_VIEW_USE_HDR) != 0)) { use_hdr = GPU_hdr_support(); } - eGPUTextureFormat desired_format = (use_hdr) ? GPU_RGBA16F : GPU_RGBA8; + blender::gpu::TextureFormat desired_format = + (use_hdr) ? blender::gpu::TextureFormat::SFLOAT_16_16_16_16 : + blender::gpu::TextureFormat::UNORM_8_8_8_8; return desired_format; } @@ -705,7 +713,7 @@ static void wm_draw_region_buffer_create(Scene *scene, { /* Determine desired offscreen format depending on HDR availability. */ - eGPUTextureFormat desired_format = get_hdr_framebuffer_format(scene); + blender::gpu::TextureFormat desired_format = get_hdr_framebuffer_format(scene); if (region->runtime->draw_buffer) { if (region->runtime->draw_buffer->stereo != stereo) { @@ -1232,7 +1240,8 @@ static void wm_draw_window(bContext *C, wmWindow *win) } else { /* Determine desired offscreen format depending on HDR availability. */ - eGPUTextureFormat desired_format = get_hdr_framebuffer_format(WM_window_get_active_scene(win)); + blender::gpu::TextureFormat desired_format = get_hdr_framebuffer_format( + WM_window_get_active_scene(win)); /* For side-by-side and top-bottom, we need to render each view to an * an off-screen texture and then draw it. This used to happen for all @@ -1405,7 +1414,8 @@ uint8_t *WM_window_pixels_read_from_offscreen(bContext *C, wmWindow *win, int r_ const blender::int2 win_size = WM_window_native_pixel_size(win); /* Determine desired offscreen format depending on HDR availability. */ - eGPUTextureFormat desired_format = get_hdr_framebuffer_format(WM_window_get_active_scene(win)); + blender::gpu::TextureFormat desired_format = get_hdr_framebuffer_format( + WM_window_get_active_scene(win)); GPUOffScreen *offscreen = GPU_offscreen_create(win_size[0], win_size[1], @@ -1446,8 +1456,13 @@ bool WM_window_pixels_read_sample_from_offscreen(bContext *C, return false; } - GPUOffScreen *offscreen = GPU_offscreen_create( - win_size[0], win_size[1], false, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, false, nullptr); + GPUOffScreen *offscreen = GPU_offscreen_create(win_size[0], + win_size[1], + false, + blender::gpu::TextureFormat::UNORM_8_8_8_8, + GPU_TEXTURE_USAGE_SHADER_READ, + false, + nullptr); if (UNLIKELY(!offscreen)) { return false; } diff --git a/source/blender/windowmanager/intern/wm_gesture.cc b/source/blender/windowmanager/intern/wm_gesture.cc index cdf06c139c3..5ad01260ca5 100644 --- a/source/blender/windowmanager/intern/wm_gesture.cc +++ b/source/blender/windowmanager/intern/wm_gesture.cc @@ -357,8 +357,17 @@ static void draw_filled_lasso(wmGesture *gt, const blender::int2 *lasso_pt_extra GPU_shader_uniform_float_ex( state.shader, GPU_shader_get_uniform(state.shader, "shuffle"), 4, 1, red); - immDrawPixelsTexTiled( - &state, rect.xmin, rect.ymin, w, h, GPU_R8, false, pixel_buf, 1.0f, 1.0f, nullptr); + immDrawPixelsTexTiled(&state, + rect.xmin, + rect.ymin, + w, + h, + blender::gpu::TextureFormat::UNORM_8, + false, + pixel_buf, + 1.0f, + 1.0f, + nullptr); GPU_shader_unbind(); diff --git a/source/blender/windowmanager/intern/wm_operators.cc b/source/blender/windowmanager/intern/wm_operators.cc index 2a1b15736a3..9bb629a8658 100644 --- a/source/blender/windowmanager/intern/wm_operators.cc +++ b/source/blender/windowmanager/intern/wm_operators.cc @@ -2665,7 +2665,7 @@ static void radial_control_set_tex(RadialControl *rc) ibuf->x, ibuf->y, 1, - GPU_R8, + blender::gpu::TextureFormat::UNORM_8, GPU_TEXTURE_USAGE_SHADER_READ, ibuf->float_buffer.data); diff --git a/source/blender/windowmanager/intern/wm_playanim.cc b/source/blender/windowmanager/intern/wm_playanim.cc index 14a4102aa7a..69f124431fa 100644 --- a/source/blender/windowmanager/intern/wm_playanim.cc +++ b/source/blender/windowmanager/intern/wm_playanim.cc @@ -507,7 +507,7 @@ static int pupdate_time() static void *ocio_transform_ibuf(const PlayDisplayContext &display_ctx, ImBuf *ibuf, bool *r_glsl_used, - eGPUTextureFormat *r_format, + blender::gpu::TextureFormat *r_format, eGPUDataFormat *r_data, void **r_buffer_cache_handle) { @@ -518,7 +518,7 @@ static void *ocio_transform_ibuf(const PlayDisplayContext &display_ctx, force_fallback |= (ibuf->dither != 0.0f); /* Default. */ - *r_format = GPU_RGBA8; + *r_format = blender::gpu::TextureFormat::UNORM_8_8_8_8; *r_data = GPU_DATA_UBYTE; /* Fallback to CPU based color space conversion. */ @@ -531,11 +531,11 @@ static void *ocio_transform_ibuf(const PlayDisplayContext &display_ctx, *r_data = GPU_DATA_FLOAT; if (ibuf->channels == 4) { - *r_format = GPU_RGBA16F; + *r_format = blender::gpu::TextureFormat::SFLOAT_16_16_16_16; } else if (ibuf->channels == 3) { /* Alpha is implicitly 1. */ - *r_format = GPU_RGB16F; + *r_format = blender::gpu::TextureFormat::SFLOAT_16_16_16; } if (ibuf->float_buffer.colorspace) { @@ -569,7 +569,7 @@ static void *ocio_transform_ibuf(const PlayDisplayContext &display_ctx, if ((ibuf->byte_buffer.data || ibuf->float_buffer.data) && !*r_glsl_used) { display_buffer = IMB_display_buffer_acquire( ibuf, &display_ctx.view_settings, &display_ctx.display_settings, r_buffer_cache_handle); - *r_format = GPU_RGBA8; + *r_format = blender::gpu::TextureFormat::UNORM_8_8_8_8; *r_data = GPU_DATA_UBYTE; } @@ -583,7 +583,7 @@ static void draw_display_buffer(const PlayDisplayContext &display_ctx, { /* Format needs to be created prior to any #immBindShader call. * Do it here because OCIO binds its own shader. */ - eGPUTextureFormat format; + blender::gpu::TextureFormat format; eGPUDataFormat data; bool glsl_used = false; GPUVertFormat *imm_format = immVertexFormat(); diff --git a/source/blender/windowmanager/xr/intern/wm_xr_session.cc b/source/blender/windowmanager/xr/intern/wm_xr_session.cc index 1b09495efbf..847c26e2fd1 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_session.cc +++ b/source/blender/windowmanager/xr/intern/wm_xr_session.cc @@ -1390,23 +1390,23 @@ bool wm_xr_session_surface_offscreen_ensure(wmXrSurfaceData *surface_data, bool failure = false; /* Initialize with some unsupported format to check following switch statement. */ - eGPUTextureFormat format = GPU_R8; + blender::gpu::TextureFormat format = blender::gpu::TextureFormat::UNORM_8; switch (draw_view->swapchain_format) { case GHOST_kXrSwapchainFormatRGBA8: - format = GPU_RGBA8; + format = blender::gpu::TextureFormat::UNORM_8_8_8_8; break; case GHOST_kXrSwapchainFormatRGBA16: - format = GPU_RGBA16; + format = blender::gpu::TextureFormat::UNORM_16_16_16_16; break; case GHOST_kXrSwapchainFormatRGBA16F: - format = GPU_RGBA16F; + format = blender::gpu::TextureFormat::SFLOAT_16_16_16_16; break; case GHOST_kXrSwapchainFormatRGB10_A2: - format = GPU_RGB10_A2; + format = blender::gpu::TextureFormat::UNORM_10_10_10_2; break; } - BLI_assert(format != GPU_R8); + BLI_assert(format != blender::gpu::TextureFormat::UNORM_8); offscreen = vp->offscreen = GPU_offscreen_create(draw_view->width, draw_view->height,