GPUTexture: Remove data_format from 3D texture creation function

For every other texture types this is expected to be implicitly
`GPU_DATA_FLOAT`. There is only one case where this is not the case.

I believe this was previously needed because the data type was
conditionning the texture creation. This is not the case anymore.
This commit is contained in:
2023-02-25 01:19:44 +01:00
committed by Gitea
parent 75e3371aef
commit e01b140fb2
11 changed files with 17 additions and 47 deletions

View File

@@ -380,7 +380,6 @@ static bool addGPULut3D(OCIO_GPUTextures &textures,
edgelen,
1,
GPU_RGB16F,
GPU_DATA_FLOAT,
GPU_TEXTURE_USAGE_SHADER_READ,
values);
if (lut.texture == nullptr) {

View File

@@ -33,9 +33,9 @@ void workbench_volume_engine_init(WORKBENCH_Data *vedata)
const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f};
txl->dummy_volume_tx = GPU_texture_create_3d_ex(
"dummy_volume", 1, 1, 1, 1, GPU_RGBA8, GPU_DATA_FLOAT, usage, zero);
"dummy_volume", 1, 1, 1, 1, GPU_RGBA8, usage, zero);
txl->dummy_shadow_tx = GPU_texture_create_3d_ex(
"dummy_shadow", 1, 1, 1, 1, GPU_RGBA8, GPU_DATA_FLOAT, usage, one);
"dummy_shadow", 1, 1, 1, 1, GPU_RGBA8, usage, one);
txl->dummy_coba_tx = GPU_texture_create_1d_ex("dummy_coba", 1, 1, GPU_RGBA8, usage, zero);
}
}

View File

@@ -931,8 +931,7 @@ class Texture : NonCopyable {
return GPU_texture_create_2d_array_ex(name_, w, h, d, mip_len, format, usage, data);
}
else {
return GPU_texture_create_3d_ex(
name_, w, h, d, mip_len, format, GPU_DATA_FLOAT, usage, data);
return GPU_texture_create_3d_ex(name_, w, h, d, mip_len, format, usage, data);
}
}
}

View File

@@ -311,7 +311,6 @@ static DRWVolumeGrid *volume_grid_cache_get(const Volume *volume,
UNPACK3(dense_grid.resolution),
1,
format,
GPU_DATA_FLOAT,
GPU_TEXTURE_USAGE_SHADER_READ |
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW,
dense_grid.voxels);

View File

@@ -183,7 +183,6 @@ static GPUTexture *create_volume_texture(const int dim[3],
UNPACK3(final_dim),
1,
texture_format,
data_format,
GPU_TEXTURE_USAGE_SHADER_READ |
GPU_TEXTURE_USAGE_MIP_SWIZZLE_VIEW,
NULL);
@@ -509,27 +508,12 @@ void DRW_smoke_ensure_velocity(FluidModifierData *fmd)
}
if (!fds->tex_velocity_x) {
fds->tex_velocity_x = GPU_texture_create_3d_ex("velx",
UNPACK3(fds->res),
1,
GPU_R16F,
GPU_DATA_FLOAT,
GPU_TEXTURE_USAGE_SHADER_READ,
vel_x);
fds->tex_velocity_y = GPU_texture_create_3d_ex("vely",
UNPACK3(fds->res),
1,
GPU_R16F,
GPU_DATA_FLOAT,
GPU_TEXTURE_USAGE_SHADER_READ,
vel_y);
fds->tex_velocity_z = GPU_texture_create_3d_ex("velz",
UNPACK3(fds->res),
1,
GPU_R16F,
GPU_DATA_FLOAT,
GPU_TEXTURE_USAGE_SHADER_READ,
vel_z);
fds->tex_velocity_x = GPU_texture_create_3d_ex(
"velx", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_x);
fds->tex_velocity_y = GPU_texture_create_3d_ex(
"vely", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_y);
fds->tex_velocity_z = GPU_texture_create_3d_ex(
"velz", UNPACK3(fds->res), 1, GPU_R16F, GPU_TEXTURE_USAGE_SHADER_READ, vel_z);
BLI_addtail(&DST.vmempool->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_x));
BLI_addtail(&DST.vmempool->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_y));
BLI_addtail(&DST.vmempool->smoke_textures, BLI_genericNodeN(&fds->tex_velocity_z));

View File

@@ -137,8 +137,7 @@ GPUTexture *DRW_texture_create_3d_ex(int w,
const float *fpixels)
{
int mip_len = (flags & DRW_TEX_MIPMAP) ? 9999 : 1;
GPUTexture *tex = GPU_texture_create_3d_ex(
__func__, w, h, d, mip_len, format, GPU_DATA_FLOAT, usage, fpixels);
GPUTexture *tex = GPU_texture_create_3d_ex(__func__, w, h, d, mip_len, format, usage, fpixels);
drw_texture_set_parameters(tex, flags);
return tex;

View File

@@ -71,9 +71,9 @@ static void drw_volume_globals_init()
const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f};
g_data.dummy_zero = GPU_texture_create_3d_ex(
"dummy_zero", 1, 1, 1, 1, GPU_RGBA8, GPU_DATA_FLOAT, GPU_TEXTURE_USAGE_SHADER_READ, zero);
"dummy_zero", 1, 1, 1, 1, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, zero);
g_data.dummy_one = GPU_texture_create_3d_ex(
"dummy_one", 1, 1, 1, 1, GPU_RGBA8, GPU_DATA_FLOAT, GPU_TEXTURE_USAGE_SHADER_READ, one);
"dummy_one", 1, 1, 1, 1, GPU_RGBA8, GPU_TEXTURE_USAGE_SHADER_READ, one);
GPU_texture_wrap_mode(g_data.dummy_zero, true, true);
GPU_texture_wrap_mode(g_data.dummy_one, true, true);

View File

@@ -307,7 +307,6 @@ GPUTexture *GPU_texture_create_3d_ex(const char *name,
int depth,
int mip_len,
eGPUTextureFormat format,
eGPUDataFormat data_format,
eGPUTextureUsage usage,
const void *data);
GPUTexture *GPU_texture_create_cube_ex(const char *name,
@@ -363,7 +362,6 @@ GPUTexture *GPU_texture_create_3d(const char *name,
int depth,
int mip_len,
eGPUTextureFormat format,
eGPUDataFormat data_format,
const void *data);
GPUTexture *GPU_texture_create_cube(
const char *name, int width, int mip_len, eGPUTextureFormat format, const float *data);

View File

@@ -340,12 +340,11 @@ GPUTexture *GPU_texture_create_3d_ex(const char *name,
int d,
int mip_len,
eGPUTextureFormat texture_format,
eGPUDataFormat data_format,
eGPUTextureUsage usage,
const void *data)
{
return gpu_texture_create(
name, w, h, d, GPU_TEXTURE_3D, mip_len, texture_format, data_format, usage, data);
name, w, h, d, GPU_TEXTURE_3D, mip_len, texture_format, GPU_DATA_FLOAT, usage, data);
}
GPUTexture *GPU_texture_create_cube_ex(const char *name,
@@ -441,11 +440,10 @@ GPUTexture *GPU_texture_create_3d(const char *name,
int d,
int mip_len,
eGPUTextureFormat texture_format,
eGPUDataFormat data_format,
const void *data)
{
return GPU_texture_create_3d_ex(
name, w, h, d, mip_len, texture_format, data_format, GPU_TEXTURE_USAGE_GENERAL, data);
name, w, h, d, mip_len, texture_format, GPU_TEXTURE_USAGE_GENERAL, data);
}
GPUTexture *GPU_texture_create_cube(

View File

@@ -562,7 +562,7 @@ gpu::MTLTexture *MTLContext::get_dummy_texture(eGPUTextureType type,
tex = GPU_texture_create_2d_array("Dummy 2DArray", 128, 128, 1, 1, format, nullptr);
break;
case GPU_TEXTURE_3D:
tex = GPU_texture_create_3d("Dummy 3D", 128, 128, 1, 1, format, GPU_DATA_UBYTE, nullptr);
tex = GPU_texture_create_3d("Dummy 3D", 128, 128, 1, 1, format, nullptr);
break;
case GPU_TEXTURE_CUBE:
tex = GPU_texture_create_cube("Dummy Cube", 128, 1, format, nullptr);

View File

@@ -224,14 +224,8 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject *UNUSED(self), PyObject *arg
}
}
else if (len == 3) {
tex = GPU_texture_create_3d(name,
size[0],
size[1],
size[2],
1,
pygpu_textureformat.value_found,
GPU_DATA_FLOAT,
data);
tex = GPU_texture_create_3d(
name, size[0], size[1], size[2], 1, pygpu_textureformat.value_found, data);
}
else if (len == 2) {
tex = GPU_texture_create_2d(