pgraphnodes: Support missing texture types in shader generator:

- Cube arrays
- 1D texture arrays
- Buffer textures

Not to say that they are displayed meaningfully, but better than a cryptic error message.
This commit is contained in:
rdb 2023-01-31 17:40:25 +01:00
parent d69d393e4c
commit a20996d2aa

View File

@ -1293,15 +1293,20 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
text << "(tex_" << i << ", texcoord" << i << ".";
switch (tex._type) {
case Texture::TT_cube_map_array:
text << "xyzw";
break;
case Texture::TT_cube_map:
case Texture::TT_3d_texture:
case Texture::TT_2d_texture_array:
text << "xyz";
break;
case Texture::TT_2d_texture:
case Texture::TT_1d_texture_array:
text << "xy";
break;
case Texture::TT_1d_texture:
case Texture::TT_buffer_texture:
text << "x";
break;
default:
@ -1342,15 +1347,20 @@ synthesize_shader(const RenderState *rs, const GeomVertexAnimationSpec &anim) {
text << "\t float4 tex" << i << " = tex" << texture_type_as_string(tex._type);
text << "(tex_" << i << ", texcoord" << i << ".";
switch (tex._type) {
case Texture::TT_cube_map_array:
text << "xyzw";
break;
case Texture::TT_cube_map:
case Texture::TT_3d_texture:
case Texture::TT_2d_texture_array:
text << "xyz";
break;
case Texture::TT_2d_texture:
case Texture::TT_1d_texture_array:
text << "xy";
break;
case Texture::TT_1d_texture:
case Texture::TT_buffer_texture:
text << "x";
break;
default:
@ -1972,19 +1982,28 @@ texture_type_as_string(Texture::TextureType ttype) {
switch (ttype) {
case Texture::TT_1d_texture:
return "1D";
break;
case Texture::TT_2d_texture:
return "2D";
break;
case Texture::TT_3d_texture:
return "3D";
break;
case Texture::TT_cube_map:
return "CUBE";
break;
case Texture::TT_2d_texture_array:
return "2DARRAY";
break;
case Texture::TT_cube_map:
return "CUBE";
case Texture::TT_buffer_texture:
return "BUF";
case Texture::TT_cube_map_array:
return "CUBEARRAY";
case Texture::TT_1d_texture_array:
return "1DARRAY";
default:
pgraphnodes_cat.error() << "Unsupported texture type!\n";
return "2D";