|
@@ -1561,7 +1561,7 @@
|
|
|
as soon as the vertex format shows up in webgpu.h, sokol_gfx.h will add support.
|
|
|
|
|
|
- Likewise, the following sokol-gfx vertex formats are not supported in WebGPU:
|
|
|
- R16, R16SN, RG16, RG16SN, RGBA16, RGBA16SN and all PVRTC compressed format.
|
|
|
+ R16, R16SN, RG16, RG16SN, RGBA16, RGBA16SN.
|
|
|
Unlike unsupported vertex formats, unsupported pixel formats can be queried
|
|
|
in cross-backend code via sg_query_pixel_format() though.
|
|
|
|
|
@@ -1827,10 +1827,6 @@ typedef enum sg_pixel_format {
|
|
|
SG_PIXELFORMAT_BC6H_RGBUF,
|
|
|
SG_PIXELFORMAT_BC7_RGBA,
|
|
|
SG_PIXELFORMAT_BC7_SRGBA,
|
|
|
- SG_PIXELFORMAT_PVRTC_RGB_2BPP, // FIXME: deprecated
|
|
|
- SG_PIXELFORMAT_PVRTC_RGB_4BPP, // FIXME: deprecated
|
|
|
- SG_PIXELFORMAT_PVRTC_RGBA_2BPP, // FIXME: deprecated
|
|
|
- SG_PIXELFORMAT_PVRTC_RGBA_4BPP, // FIXME: deprecated
|
|
|
SG_PIXELFORMAT_ETC2_RGB8,
|
|
|
SG_PIXELFORMAT_ETC2_SRGB8,
|
|
|
SG_PIXELFORMAT_ETC2_RGB8A1,
|
|
@@ -2409,7 +2405,9 @@ typedef enum sg_stencil_op {
|
|
|
.dst_factor_alpha
|
|
|
|
|
|
The default value is SG_BLENDFACTOR_ONE for source
|
|
|
- factors, and SG_BLENDFACTOR_ZERO for destination factors.
|
|
|
+ factors, and for the destination SG_BLENDFACTOR_ZERO if the associated
|
|
|
+ blend-op is ADD, SUBTRACT or REVERSE_SUBTRACT or SG_BLENDFACTOR_ONE
|
|
|
+ if the associated blend-op is MIN or MAX.
|
|
|
*/
|
|
|
typedef enum sg_blend_factor {
|
|
|
_SG_BLENDFACTOR_DEFAULT, // value 0 reserved for default-init
|
|
@@ -2452,6 +2450,8 @@ typedef enum sg_blend_op {
|
|
|
SG_BLENDOP_ADD,
|
|
|
SG_BLENDOP_SUBTRACT,
|
|
|
SG_BLENDOP_REVERSE_SUBTRACT,
|
|
|
+ SG_BLENDOP_MIN,
|
|
|
+ SG_BLENDOP_MAX,
|
|
|
_SG_BLENDOP_NUM,
|
|
|
_SG_BLENDOP_FORCE_U32 = 0x7FFFFFFF
|
|
|
} sg_blend_op;
|
|
@@ -3909,6 +3909,7 @@ typedef struct sg_frame_stats {
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_LAYOUT_STRIDE4, "sg_pipeline_desc.layout.buffers[].stride must be multiple of 4") \
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_ATTR_SEMANTICS, "D3D11 missing vertex attribute semantics in shader") \
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_SHADER_READONLY_STORAGEBUFFERS, "sg_pipeline_desc.shader: only readonly storage buffer bindings allowed in render pipelines") \
|
|
|
+ _SG_LOGITEM_XMACRO(VALIDATE_PIPELINEDESC_BLENDOP_MINMAX_REQUIRES_BLENDFACTOR_ONE, "SG_BLENDOP_MIN/MAX requires all blend factors to be SG_BLENDFACTOR_ONE") \
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_ATTACHMENTSDESC_CANARY, "sg_attachments_desc not initialized") \
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_ATTACHMENTSDESC_NO_ATTACHMENTS, "sg_attachments_desc no color or depth-stencil attachments") \
|
|
|
_SG_LOGITEM_XMACRO(VALIDATE_ATTACHMENTSDESC_NO_CONT_COLOR_ATTS, "color attachments must occupy continuous slots") \
|
|
@@ -5024,6 +5025,8 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_
|
|
|
#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
|
|
|
#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
|
|
|
#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000
|
|
|
+ #define GL_MIN 0x8007
|
|
|
+ #define GL_MAX 0x8008
|
|
|
#endif
|
|
|
|
|
|
#ifndef GL_UNSIGNED_INT_2_10_10_10_REV
|
|
@@ -5074,18 +5077,6 @@ inline int sg_append_buffer(sg_buffer buf_id, const sg_range& data) { return sg_
|
|
|
#ifndef GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
|
|
|
#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
|
|
|
#endif
|
|
|
- #ifndef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
|
|
|
- #define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
|
|
|
- #endif
|
|
|
- #ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
|
|
|
- #define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
|
|
|
- #endif
|
|
|
- #ifndef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
|
|
|
- #define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
|
|
|
- #endif
|
|
|
- #ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
|
|
|
- #define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
|
|
|
- #endif
|
|
|
#ifndef GL_COMPRESSED_RGB8_ETC2
|
|
|
#define GL_COMPRESSED_RGB8_ETC2 0x9274
|
|
|
#endif
|
|
@@ -6548,10 +6539,6 @@ _SOKOL_PRIVATE bool _sg_is_compressed_pixel_format(sg_pixel_format fmt) {
|
|
|
case SG_PIXELFORMAT_BC6H_RGBUF:
|
|
|
case SG_PIXELFORMAT_BC7_RGBA:
|
|
|
case SG_PIXELFORMAT_BC7_SRGBA:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8:
|
|
|
case SG_PIXELFORMAT_ETC2_SRGB8:
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8A1:
|
|
@@ -6665,19 +6652,6 @@ _SOKOL_PRIVATE bool _sg_multiple_u64(uint64_t val, uint64_t of) {
|
|
|
/* return row pitch for an image
|
|
|
|
|
|
see ComputePitch in https://github.com/microsoft/DirectXTex/blob/master/DirectXTex/DirectXTexUtil.cpp
|
|
|
-
|
|
|
- For the special PVRTC pitch computation, see:
|
|
|
- GL extension requirement (https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt)
|
|
|
-
|
|
|
- Quote:
|
|
|
-
|
|
|
- 6) How is the imageSize argument calculated for the CompressedTexImage2D
|
|
|
- and CompressedTexSubImage2D functions.
|
|
|
-
|
|
|
- Resolution: For PVRTC 4BPP formats the imageSize is calculated as:
|
|
|
- ( max(width, 8) * max(height, 8) * 4 + 7) / 8
|
|
|
- For PVRTC 2BPP formats the imageSize is calculated as:
|
|
|
- ( max(width, 16) * max(height, 8) * 2 + 7) / 8
|
|
|
*/
|
|
|
_SOKOL_PRIVATE int _sg_row_pitch(sg_pixel_format fmt, int width, int row_align) {
|
|
|
int pitch;
|
|
@@ -6711,14 +6685,6 @@ _SOKOL_PRIVATE int _sg_row_pitch(sg_pixel_format fmt, int width, int row_align)
|
|
|
pitch = ((width + 3) / 4) * 16;
|
|
|
pitch = pitch < 16 ? 16 : pitch;
|
|
|
break;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
- pitch = (_sg_max(width, 8) * 4 + 7) / 8;
|
|
|
- break;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- pitch = (_sg_max(width, 16) * 2 + 7) / 8;
|
|
|
- break;
|
|
|
default:
|
|
|
pitch = width * _sg_pixelformat_bytesize(fmt);
|
|
|
break;
|
|
@@ -6756,18 +6722,6 @@ _SOKOL_PRIVATE int _sg_num_rows(sg_pixel_format fmt, int height) {
|
|
|
case SG_PIXELFORMAT_ASTC_4x4_SRGBA:
|
|
|
num_rows = ((height + 3) / 4);
|
|
|
break;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- /* NOTE: this is most likely not correct because it ignores any
|
|
|
- PVCRTC block size, but multiplied with _sg_row_pitch()
|
|
|
- it gives the correct surface pitch.
|
|
|
-
|
|
|
- See: https://www.khronos.org/registry/OpenGL/extensions/IMG/IMG_texture_compression_pvrtc.txt
|
|
|
- */
|
|
|
- num_rows = ((_sg_max(height, 8) + 7) / 8) * 8;
|
|
|
- break;
|
|
|
default:
|
|
|
num_rows = height;
|
|
|
break;
|
|
@@ -7483,6 +7437,8 @@ _SOKOL_PRIVATE GLenum _sg_gl_blend_op(sg_blend_op op) {
|
|
|
case SG_BLENDOP_ADD: return GL_FUNC_ADD;
|
|
|
case SG_BLENDOP_SUBTRACT: return GL_FUNC_SUBTRACT;
|
|
|
case SG_BLENDOP_REVERSE_SUBTRACT: return GL_FUNC_REVERSE_SUBTRACT;
|
|
|
+ case SG_BLENDOP_MIN: return GL_MIN;
|
|
|
+ case SG_BLENDOP_MAX: return GL_MAX;
|
|
|
default: SOKOL_UNREACHABLE; return 0;
|
|
|
}
|
|
|
}
|
|
@@ -7667,14 +7623,6 @@ _SOKOL_PRIVATE GLenum _sg_gl_teximage_format(sg_pixel_format fmt) {
|
|
|
return GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
|
|
case SG_PIXELFORMAT_BC7_SRGBA:
|
|
|
return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- return GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
- return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8:
|
|
|
return GL_COMPRESSED_RGB8_ETC2;
|
|
|
case SG_PIXELFORMAT_ETC2_SRGB8:
|
|
@@ -7764,10 +7712,6 @@ _SOKOL_PRIVATE GLenum _sg_gl_teximage_internal_format(sg_pixel_format fmt) {
|
|
|
case SG_PIXELFORMAT_BC6H_RGBUF: return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB;
|
|
|
case SG_PIXELFORMAT_BC7_RGBA: return GL_COMPRESSED_RGBA_BPTC_UNORM_ARB;
|
|
|
case SG_PIXELFORMAT_BC7_SRGBA: return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP: return GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP: return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP: return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP: return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8: return GL_COMPRESSED_RGB8_ETC2;
|
|
|
case SG_PIXELFORMAT_ETC2_SRGB8: return GL_COMPRESSED_SRGB8_ETC2;
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8A1: return GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
|
|
@@ -7911,13 +7855,6 @@ _SOKOL_PRIVATE void _sg_gl_init_pixelformats_bptc(void) {
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_SRGBA]);
|
|
|
}
|
|
|
|
|
|
-_SOKOL_PRIVATE void _sg_gl_init_pixelformats_pvrtc(void) {
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGB_2BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGB_4BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGBA_2BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGBA_4BPP]);
|
|
|
-}
|
|
|
-
|
|
|
_SOKOL_PRIVATE void _sg_gl_init_pixelformats_etc2(void) {
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGB8]);
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_SRGB8]);
|
|
@@ -7996,7 +7933,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_glcore(void) {
|
|
|
bool has_s3tc = false; // BC1..BC3
|
|
|
bool has_rgtc = false; // BC4 and BC5
|
|
|
bool has_bptc = false; // BC6H and BC7
|
|
|
- bool has_pvrtc = false;
|
|
|
bool has_etc2 = false;
|
|
|
bool has_astc = false;
|
|
|
GLint num_ext = 0;
|
|
@@ -8010,8 +7946,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_glcore(void) {
|
|
|
has_rgtc = true;
|
|
|
} else if (strstr(ext, "_texture_compression_bptc")) {
|
|
|
has_bptc = true;
|
|
|
- } else if (strstr(ext, "_texture_compression_pvrtc")) {
|
|
|
- has_pvrtc = true;
|
|
|
} else if (strstr(ext, "_ES3_compatibility")) {
|
|
|
has_etc2 = true;
|
|
|
} else if (strstr(ext, "_texture_filter_anisotropic")) {
|
|
@@ -8043,9 +7977,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_glcore(void) {
|
|
|
if (has_bptc) {
|
|
|
_sg_gl_init_pixelformats_bptc();
|
|
|
}
|
|
|
- if (has_pvrtc) {
|
|
|
- _sg_gl_init_pixelformats_pvrtc();
|
|
|
- }
|
|
|
if (has_etc2) {
|
|
|
_sg_gl_init_pixelformats_etc2();
|
|
|
}
|
|
@@ -8069,7 +8000,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) {
|
|
|
bool has_s3tc = false; // BC1..BC3
|
|
|
bool has_rgtc = false; // BC4 and BC5
|
|
|
bool has_bptc = false; // BC6H and BC7
|
|
|
- bool has_pvrtc = false;
|
|
|
#if defined(__EMSCRIPTEN__)
|
|
|
bool has_etc2 = false;
|
|
|
#else
|
|
@@ -8093,10 +8023,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) {
|
|
|
has_rgtc = true;
|
|
|
} else if (strstr(ext, "_texture_compression_bptc")) {
|
|
|
has_bptc = true;
|
|
|
- } else if (strstr(ext, "_texture_compression_pvrtc")) {
|
|
|
- has_pvrtc = true;
|
|
|
- } else if (strstr(ext, "_compressed_texture_pvrtc")) {
|
|
|
- has_pvrtc = true;
|
|
|
} else if (strstr(ext, "_compressed_texture_etc")) {
|
|
|
has_etc2 = true;
|
|
|
} else if (strstr(ext, "_compressed_texture_astc")) {
|
|
@@ -8141,9 +8067,6 @@ _SOKOL_PRIVATE void _sg_gl_init_caps_gles3(void) {
|
|
|
if (has_bptc) {
|
|
|
_sg_gl_init_pixelformats_bptc();
|
|
|
}
|
|
|
- if (has_pvrtc) {
|
|
|
- _sg_gl_init_pixelformats_pvrtc();
|
|
|
- }
|
|
|
if (has_etc2) {
|
|
|
_sg_gl_init_pixelformats_etc2();
|
|
|
}
|
|
@@ -10831,6 +10754,8 @@ _SOKOL_PRIVATE D3D11_BLEND_OP _sg_d3d11_blend_op(sg_blend_op op) {
|
|
|
case SG_BLENDOP_ADD: return D3D11_BLEND_OP_ADD;
|
|
|
case SG_BLENDOP_SUBTRACT: return D3D11_BLEND_OP_SUBTRACT;
|
|
|
case SG_BLENDOP_REVERSE_SUBTRACT: return D3D11_BLEND_OP_REV_SUBTRACT;
|
|
|
+ case SG_BLENDOP_MIN: return D3D11_BLEND_OP_MIN;
|
|
|
+ case SG_BLENDOP_MAX: return D3D11_BLEND_OP_MAX;
|
|
|
default: SOKOL_UNREACHABLE; return (D3D11_BLEND_OP) 0;
|
|
|
}
|
|
|
}
|
|
@@ -12484,10 +12409,6 @@ _SOKOL_PRIVATE MTLPixelFormat _sg_mtl_pixel_format(sg_pixel_format fmt) {
|
|
|
case SG_PIXELFORMAT_BC7_RGBA: return MTLPixelFormatBC7_RGBAUnorm;
|
|
|
case SG_PIXELFORMAT_BC7_SRGBA: return MTLPixelFormatBC7_RGBAUnorm_sRGB;
|
|
|
#else
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP: return MTLPixelFormatPVRTC_RGB_2BPP;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP: return MTLPixelFormatPVRTC_RGB_4BPP;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP: return MTLPixelFormatPVRTC_RGBA_2BPP;
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP: return MTLPixelFormatPVRTC_RGBA_4BPP;
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8: return MTLPixelFormatETC2_RGB8;
|
|
|
case SG_PIXELFORMAT_ETC2_SRGB8: return MTLPixelFormatETC2_RGB8_sRGB;
|
|
|
case SG_PIXELFORMAT_ETC2_RGB8A1: return MTLPixelFormatETC2_RGB8A1;
|
|
@@ -12526,6 +12447,8 @@ _SOKOL_PRIVATE MTLBlendOperation _sg_mtl_blend_op(sg_blend_op op) {
|
|
|
case SG_BLENDOP_ADD: return MTLBlendOperationAdd;
|
|
|
case SG_BLENDOP_SUBTRACT: return MTLBlendOperationSubtract;
|
|
|
case SG_BLENDOP_REVERSE_SUBTRACT: return MTLBlendOperationReverseSubtract;
|
|
|
+ case SG_BLENDOP_MIN: return MTLBlendOperationMin;
|
|
|
+ case SG_BLENDOP_MAX: return MTLBlendOperationMax;
|
|
|
default: SOKOL_UNREACHABLE; return (MTLBlendOperation)0;
|
|
|
}
|
|
|
}
|
|
@@ -12623,18 +12546,6 @@ _SOKOL_PRIVATE MTLTextureType _sg_mtl_texture_type(sg_image_type t) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-_SOKOL_PRIVATE bool _sg_mtl_is_pvrtc(sg_pixel_format fmt) {
|
|
|
- switch (fmt) {
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
- return true;
|
|
|
- default:
|
|
|
- return false;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
_SOKOL_PRIVATE MTLSamplerAddressMode _sg_mtl_address_mode(sg_wrap w) {
|
|
|
if (_sg.features.image_clamp_to_border) {
|
|
|
if (@available(macOS 12.0, iOS 14.0, *)) {
|
|
@@ -12964,10 +12875,6 @@ _SOKOL_PRIVATE void _sg_mtl_init_caps(void) {
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_RGBA]);
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_BC7_SRGBA]);
|
|
|
#else
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGB_2BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGB_4BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGBA_2BPP]);
|
|
|
- _sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_PVRTC_RGBA_4BPP]);
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGB8]);
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_SRGB8]);
|
|
|
_sg_pixelformat_sf(&_sg.formats[SG_PIXELFORMAT_ETC2_RGB8A1]);
|
|
@@ -13110,13 +13017,8 @@ _SOKOL_PRIVATE void _sg_mtl_copy_image_data(const _sg_image_t* img, __unsafe_unr
|
|
|
const uint8_t* data_ptr = (const uint8_t*)data->subimage[face_index][mip_index].ptr;
|
|
|
const int mip_width = _sg_miplevel_dim(img->cmn.width, mip_index);
|
|
|
const int mip_height = _sg_miplevel_dim(img->cmn.height, mip_index);
|
|
|
- // special case PVRTC formats: bytePerRow and bytesPerImage must be 0
|
|
|
- int bytes_per_row = 0;
|
|
|
- int bytes_per_slice = 0;
|
|
|
- if (!_sg_mtl_is_pvrtc(img->cmn.pixel_format)) {
|
|
|
- bytes_per_row = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1);
|
|
|
- bytes_per_slice = _sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, 1);
|
|
|
- }
|
|
|
+ int bytes_per_row = _sg_row_pitch(img->cmn.pixel_format, mip_width, 1);
|
|
|
+ int bytes_per_slice = _sg_surface_pitch(img->cmn.pixel_format, mip_width, mip_height, 1);
|
|
|
/* bytesPerImage special case: https://developer.apple.com/documentation/metal/mtltexture/1515679-replaceregion
|
|
|
|
|
|
"Supply a nonzero value only when you copy data to a MTLTextureType3D type texture"
|
|
@@ -14655,10 +14557,6 @@ _SOKOL_PRIVATE WGPUTextureFormat _sg_wgpu_textureformat(sg_pixel_format p) {
|
|
|
case SG_PIXELFORMAT_RG16SN:
|
|
|
case SG_PIXELFORMAT_RGBA16:
|
|
|
case SG_PIXELFORMAT_RGBA16SN:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGB_4BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_2BPP:
|
|
|
- case SG_PIXELFORMAT_PVRTC_RGBA_4BPP:
|
|
|
return WGPUTextureFormat_Undefined;
|
|
|
|
|
|
default:
|
|
@@ -14704,6 +14602,8 @@ _SOKOL_PRIVATE WGPUBlendOperation _sg_wgpu_blendop(sg_blend_op op) {
|
|
|
case SG_BLENDOP_ADD: return WGPUBlendOperation_Add;
|
|
|
case SG_BLENDOP_SUBTRACT: return WGPUBlendOperation_Subtract;
|
|
|
case SG_BLENDOP_REVERSE_SUBTRACT: return WGPUBlendOperation_ReverseSubtract;
|
|
|
+ case SG_BLENDOP_MIN: return WGPUBlendOperation_Min;
|
|
|
+ case SG_BLENDOP_MAX: return WGPUBlendOperation_Max;
|
|
|
default:
|
|
|
SOKOL_UNREACHABLE;
|
|
|
return WGPUBlendOperation_Force32;
|
|
@@ -17965,6 +17865,15 @@ _SOKOL_PRIVATE bool _sg_validate_pipeline_desc(const sg_pipeline_desc* desc) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ for (size_t color_index = 0; color_index < (size_t)desc->color_count; color_index++) {
|
|
|
+ const sg_blend_state* bs = &desc->colors[color_index].blend;
|
|
|
+ if ((bs->op_rgb == SG_BLENDOP_MIN) || (bs->op_rgb == SG_BLENDOP_MAX)) {
|
|
|
+ _SG_VALIDATE((bs->src_factor_rgb == SG_BLENDFACTOR_ONE) && (bs->dst_factor_rgb == SG_BLENDFACTOR_ONE), VALIDATE_PIPELINEDESC_BLENDOP_MINMAX_REQUIRES_BLENDFACTOR_ONE);
|
|
|
+ }
|
|
|
+ if ((bs->op_alpha == SG_BLENDOP_MIN) || (bs->op_alpha == SG_BLENDOP_MAX)) {
|
|
|
+ _SG_VALIDATE((bs->src_factor_alpha == SG_BLENDFACTOR_ONE) && (bs->dst_factor_alpha == SG_BLENDFACTOR_ONE), VALIDATE_PIPELINEDESC_BLENDOP_MINMAX_REQUIRES_BLENDFACTOR_ONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
return _sg_validate_end();
|
|
|
#endif
|
|
|
}
|
|
@@ -18685,12 +18594,20 @@ _SOKOL_PRIVATE sg_pipeline_desc _sg_pipeline_desc_defaults(const sg_pipeline_des
|
|
|
cs->pixel_format = _sg_def(cs->pixel_format, _sg.desc.environment.defaults.color_format);
|
|
|
cs->write_mask = _sg_def(cs->write_mask, SG_COLORMASK_RGBA);
|
|
|
sg_blend_state* bs = &def.colors[i].blend;
|
|
|
- bs->src_factor_rgb = _sg_def(bs->src_factor_rgb, SG_BLENDFACTOR_ONE);
|
|
|
- bs->dst_factor_rgb = _sg_def(bs->dst_factor_rgb, SG_BLENDFACTOR_ZERO);
|
|
|
bs->op_rgb = _sg_def(bs->op_rgb, SG_BLENDOP_ADD);
|
|
|
- bs->src_factor_alpha = _sg_def(bs->src_factor_alpha, SG_BLENDFACTOR_ONE);
|
|
|
- bs->dst_factor_alpha = _sg_def(bs->dst_factor_alpha, SG_BLENDFACTOR_ZERO);
|
|
|
+ bs->src_factor_rgb = _sg_def(bs->src_factor_rgb, SG_BLENDFACTOR_ONE);
|
|
|
+ if ((bs->op_rgb == SG_BLENDOP_MIN) || (bs->op_rgb == SG_BLENDOP_MAX)) {
|
|
|
+ bs->dst_factor_rgb = _sg_def(bs->dst_factor_rgb, SG_BLENDFACTOR_ONE);
|
|
|
+ } else {
|
|
|
+ bs->dst_factor_rgb = _sg_def(bs->dst_factor_rgb, SG_BLENDFACTOR_ZERO);
|
|
|
+ }
|
|
|
bs->op_alpha = _sg_def(bs->op_alpha, SG_BLENDOP_ADD);
|
|
|
+ bs->src_factor_alpha = _sg_def(bs->src_factor_alpha, SG_BLENDFACTOR_ONE);
|
|
|
+ if ((bs->op_alpha == SG_BLENDOP_MIN) || (bs->op_alpha == SG_BLENDOP_MAX)) {
|
|
|
+ bs->dst_factor_alpha = _sg_def(bs->dst_factor_alpha, SG_BLENDFACTOR_ONE);
|
|
|
+ } else {
|
|
|
+ bs->dst_factor_alpha = _sg_def(bs->dst_factor_alpha, SG_BLENDFACTOR_ZERO);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
for (int attr_index = 0; attr_index < SG_MAX_VERTEX_ATTRIBUTES; attr_index++) {
|