]> git.tdb.fi Git - libs/gl.git/commitdiff
Declare capability for extended storage image formats if required
authorMikko Rasa <tdb@tdb.fi>
Tue, 6 Sep 2022 11:54:35 +0000 (14:54 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 6 Sep 2022 11:54:35 +0000 (14:54 +0300)
source/glsl/spirv.cpp
source/glsl/spirvconstants.h

index 1fc9799ff6418ee7b153610f47c71465fb53c876..b263fe87dcdb38dd76f037a5e189d344d5e6c960 100644 (file)
@@ -1605,6 +1605,7 @@ void SpirVGenerator::visit(ImageTypeDeclaration &image)
                return;
 
        Id type_id = allocate_id(image, 0);
+       SpirVFormat format = get_format(image.format);
 
        Id image_id = (image.sampled ? next_id++ : type_id);
        writer.begin_op(content.globals, OP_TYPE_IMAGE, 9);
@@ -1615,7 +1616,7 @@ void SpirVGenerator::visit(ImageTypeDeclaration &image)
        writer.write(image.array);
        writer.write(image.multisample);
        writer.write(image.sampled ? 1 : 2);
-       writer.write(get_format(image.format));
+       writer.write(format);
        writer.end_op(OP_TYPE_IMAGE);
 
        if(image.sampled)
@@ -1632,6 +1633,9 @@ void SpirVGenerator::visit(ImageTypeDeclaration &image)
 
        if(image.multisample && !image.sampled)
                use_capability(CAP_STORAGE_IMAGE_MULTISAMPLE);
+
+       if(format>=FORMAT_RG32F && format<=FORMAT_R8_SNORM)
+               use_capability(CAP_STORAGE_IMAGE_EXTENDED_FORMATS);
 }
 
 void SpirVGenerator::visit(StructDeclaration &strct)
index e3c245fb7e75abb59e469be5e5727f0a33eda191..2e952e058bde58b4cc21eca56e745244666959b6 100644 (file)
@@ -168,6 +168,7 @@ enum SpirVCapability
        CAP_SAMPLED_1D = 43,
        CAP_IMAGE_1D = 44,
        CAP_SAMPLED_CUBE_ARRAY = 45,
+       CAP_STORAGE_IMAGE_EXTENDED_FORMATS = 49,
        CAP_IMAGE_QUERY = 50,
        CAP_DERIVATIVE_CONTROL = 51,
        CAP_INTERPOLATION_FUNCTION = 52