Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/SPIRV-Cross.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-03-03Add relax_nan_checks options.Hans-Kristian Arntzen
Makes codegen from typical D3D emulation SPIR-V more readable. Also makes cross compilation with NotEqual more sensible. It's very rare to actually need the strict NaN-checks in practice. Also, glslang now emits UnordNotEqual by default it seems, so give up trying to assume OrdNotEqual. Harmonize for UnordNotEqual as the sane default.
2022-03-03MSL: Fix var names in test shaders to avoid reserved identifiers.Bill Hollings
2022-03-03MSL: Support input/output blocks containing nested struct arraysBill Hollings
Fixes numerous CTS tests of types dEQP-VK.pipeline.interface_matching.vector_length.member_of_*, passing complex nested structs between stages as stage I/O. - Make add_composite_member_variable_to_interface_block() recursive to allow struct members to contain nested structs, building up member names and access chains recursively, and only add the resulting flattened leaf members to the synthetic input and output interface blocks. - Recursively generate individual location numbers for the flattened members of the input/output block. - Replace to_qualified_member_name() with append_member_name(). - Update add_variable_to_interface_block() to support arrays as struct members, adding a member to input and output interface blocks for each element of the array. - Pass name qualifiers to add_plain_member_variable_to_interface_block() to allow struct members to be arrays of structs, building up member names and access chains, and adding multiple distinct flattened leaf members to the synthetic input and output interface blocks. - Generate individual location numbers for the individual array members of the input/output block. - SPIRVCrossDecorationInterfaceMemberIndex references the index of a member of a variable that is a struct type. The value is relative to the variable, and for structs nested within that top-level struct, the index value needs to take into consideration the members within those nested structs. - Pass var_mbr_idx to add_plain_member_variable_to_interface_block() and add_composite_member_variable_to_interface_block(), start at zero for each variable, and increment for each member or nested member within that variable. - Add unit test shaders-msl/vert/out-block-with-nested-struct-array.vert - Add unit test shaders-msl/vert/out-block-with-struct-array.vert - Add unit test shaders-msl/tese/in-block-with-nested-struct.tese
2022-01-18MSL: Rethink how opaque descriptors are passed to leaf functions.Hans-Kristian Arntzen
We were passing arrays by value which the compiler fails to optimize, causing abyssal performance. To fix this, we need to consider that descriptors can be in constant or const device address spaces. Also, lone descriptors are passed by value, so we explicitly remove address space qualifiers. One failure case is when shader passes a texture/sampler array as an argument. It's all UniformConstant in SPIR-V, but in MSL it might be thread, const device or constant, so that won't work ... Global variable use works fine though, and that should cover 99.9999999% of use cases.
2022-01-05Roll dependencies.Hans-Kristian Arntzen
2022-01-05MSL: Move float2->3 TessCoord fixup to a better location.Hans-Kristian Arntzen
2021-12-20Fix gl_TessCoord arguments presence. Update reference shaders.Nikita Fediuchin
* Added check for "gl_TessCoord" presence in the entry point arguments. * Updated reference tessellation evaluation shaders.
2021-11-26MSL: Add 64 bit switch supportSebastián Aedo
Add 64 bit switch support for MSL version 2.2. * Also fixes a wrong endianness conversion. Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-12MSL: Don't output depth and stencil values with explicit early fragment tests.Bill Hollings
Fragment shaders that require explicit early fragment tests are incompatible with specifying depth and stencil values within the shader. If explicit early fragment tests is specified, remove the depth and stencil outputs from the output structure, and replace them with dummy local variables. Add CompilerMSL:uses_explicit_early_fragment_test() function to consolidate testing for whether early fragment tests are required. Add two unit tests for depth-out with, and without, early fragment tests.
2021-11-08Separate (partially) the tracking of depth images from depth compare ops.Bill Hollings
SPIR-V allows an image to be marked as a depth image, but with a non-depth format. Such images should be read or sampled as vectors instead of scalars, except when they are subject to compare operations. Don't mark an OpSampledImage as using a compare operation just because the image contains a depth marker. Instead, require that a compare operation is actually used on that image. Compiler::image_is_comparison() was really testing whether an image is a depth image, since it incorporates the depth marker. Rename that function to is_depth_image(), to clarify what it is really testing. In Compiler::is_depth_image(), do not treat an image as a depth image if it has been explicitly marked with a color format, unless the image is subject to compare operations. In CompilerMSL::to_function_name(), test for compare operations specifically, rather than assuming them from the depth-image marker. CompilerGLSL and CompilerMSL still contain a number of internal tests that use is_depth_image() both for testing for a depth image, and for testing whether compare operations are being used. I've left these as they are for now, but these should be cleaned up at some point. Add unit tests for fetch/sample depth images with color formats and no compare ops.
2021-11-07Handle Modf/Frexp in more cases.Hans-Kristian Arntzen
Consider it a write to a variable, similar to OpStore.
2021-10-29MSL: Remove over-zealous check for struct packing compatibility.Bill Hollings
Previous test for SPIRVCrossDecorationPhysicalTypePacked on parent struct when unpacking member struct was too restrictive, and not needed as long as padding compensates.
2021-10-28MSL: Fix type redirection when struct members are reordered to align with ↵Bill Hollings
offsets. Populate member_type_index_redirection as reverse lookup, not forward lookup. Move use of member_type_index_redirection from CompilerMSL::to_member_reference() to CompilerGLSL::access_chain_internal() to access all redirected type info, not just name.
2021-10-25MSL: Workaround compiler crashes when using threadgroup bool.Hans-Kristian Arntzen
Promote to short instead and do simple casts on load/store instead. Not 100% complete fix since structs can contain booleans, but this is getting into pretty ridiculously complicated territory.
2021-10-21MSL: Never used templated array for RayQuery objects.Hans-Kristian Arntzen
Not supported and compiler derps out.
2021-10-21MSL: Fix some trivial bugs not caught by CI when adding ray query.Hans-Kristian Arntzen
2021-10-19Support Metal 2.4 Intersection Query, Implement GL_EXT_ray_query.丛越
2021-09-29MSL: Support synthetic functions in function constants.Bill Hollings
Emit synthetic functions before function constants. Support use of spvQuantizeToF16() in function constants for numerical behavior consistency with the op code. Ensure subnormal results from OpQuantizeToF16 are flushed to zero per SPIR-V spec. Adjust SPIRV-Cross unit test reference shaders to accommodate these changes. Any MSL reference shader that inclues a synthetic function is affected, since the location it is emitted has changed.
2021-09-25MSL: Use vec<T, n> in template SpvHalfTypeSelector for function ↵Bill Hollings
spvQuantizeToF16(). Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-24MSL: Consolidate spvQuantizeToF16() functions into a single template function.Bill Hollings
Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-24MSL: Honor infinities in OpQuantizeToF16 when compiling using fast-math.Bill Hollings
Add spvQuantizeToF16() family of synthetic functions to convert from float to half and back again, and add function attribute [[clang::optnone]] to honor infinities during conversions. Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-23MSL: Honor DecorationNoContraction when compiling using fast-math.Bill Hollings
Add [[clang::optnone]] attribute to spvF*() functions used for handling floating point operations decorated with DecorationNoContraction. Just using precise::fma() did not work. Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-23MSL: Selectively enable fast-math in MSL code to match Vulkan CTS results.Bill Hollings
Based on CTS testing, math optimizations between MSL and Vulkan are inconsistent. In some cases, enabling MSL's fast-math compilation option matches Vulkan's math results. In other cases, disabling it does. Broadly enabling or disabling fast-math across all shaders results in some CTS test failures either way. To fix this, selectively enable/disable fast-math optimizations in the MSL code, using metal::fast and metal::precise function namespaces, where supported, and the [[clang::optnone]] function attribute otherwise. Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-12MSL: Return fragment function value even when last SPIR-V Op is discard ↵Bill Hollings
(OpKill). Add test shader for new functionality. Add legacy test reference shader for unrelated buffer-bitcast test, that doesn't seem to have been added previously.
2021-09-05Add tests for OpSpecConstantOp ops OpQuantizeToF16 and OpSRem.Bill Hollings
Tests provided by @cdavis5e.
2021-08-23Merge pull request #1725 from billhollings/fix-duplicate-glpositionHans-Kristian Arntzen
MSL: Fix duplicate gl_Position outputs when gl_Position defined but unused.
2021-08-23Merge pull request #1722 from billhollings/row-maj-mtx-store-from-constHans-Kristian Arntzen
MSL: Support row-major transpose when storing matrix from constant RHS matrix.
2021-08-16MSL: Add test for fixes to MSL constant expression type down-casting.Bill Hollings
2021-08-16MSL: Fix duplicate gl_Position outputs when gl_Position defined but unused.Bill Hollings
When gl_Position is defined by SPIR-V, but neither used nor initialized, it appeared twice in the MSL output, as gl_Position and glPosition_1. The existing tests for whether an output is active check only that it is used by an op, or initialized. Adding the implicit gl_Position also marked the existing gl_Position as active, duplicating the output variable. Fix is that when checking for the need to add an implicit gl_Position output, also check if the var is already defined in the shader, and just needs to be marked as active. Add test shader.
2021-08-12MSL: Support row-major transpose when storing matrix from constant RHS matrix.Bill Hollings
Remove test and exception when storing row-major matrix from RHS that is not a SPIRExpression. Add test shaders.
2021-07-14MSL: Adjust gl_SampleMaskIn for sample-shading and/or fixed sample mask.Bill Hollings
Vulkan specifies that the Sample Mask Test occurs before fragment shading. This means gl_SampleMaskIn should be influenced by both sample-shading and VkPipelineMultisampleStateCreateInfo::pSampleMask. CTS tests dEQP-VK.pipeline.multisample_shader_builtin.* bear this out. For sample-shading, gl_SampleMaskIn should only have a single bit set, Since Metal does not filter for this, apply a bitmask based on gl_SampleID. For a fixed sample mask, since Metal is unaware of VkPipelineMultisampleStateCreateInfo::pSampleMask, we need to ensure that we apply it to both gl_SampleMaskIn and gl_SampleMask. This has the side effect of a redundant application of pSampleMask if the shader already includes gl_SampleMaskIn when setting gl_SampleMask, but I don't see an easy way around this. Also, simplify the logic for including the fixed sample mask in gl_ShaderMask, and print the fixed sample mask as a hex value for readability of bits.
2021-06-28Handle SPIR-V 1.4 selection constructs.Hans-Kristian Arntzen
Fix bug in to_trivial_mix_op, where we made a pre-1.4 assumption that component count of selector is equal to value component count.
2021-05-26Add comment after inf/nan float number for clarifying.xndcn
2021-05-21MSL: Handle array with component when we cannot rely on user() attrib.Hans-Kristian Arntzen
In these cases, we emit one variable per location, and so we must flatten stuff.
2021-05-07Honor NoContraction qualifier.Hans-Kristian Arntzen
We'll need to force a temporary and mark it as precise. MSL is a little weird here, but we can piggyback on top of the invariant float math option here to force fma() operations everywhere.
2021-04-29MSL: Fix '--msl-multi-patch-workgroup' out of bounds reads when dispatching ↵Lukas Taparauskas
more threads than control points (#1662) * Fix '--msl-multi-patch-workgroup' cases where thread count exceeds data bounds *Fix gl_PrimitiveID off by one error when computing last valid index *Point gl_out to the last patch's data when threads exceed input data bounds *Point patchOut to the last patch's data when threads exceed input data bounds * Update MSL test expectations. * Undo change to MSL multi-patch hull output bound checks * Update MSL multi-patch test expectations.
2021-04-23MSL: Use proper array for quad tess levels.Hans-Kristian Arntzen
We need to handle loads from array as well, so the float4 hack doesn't work.
2021-04-22Rewrite how non-uniform qualifiers are handled.Hans-Kristian Arntzen
Remove all shenanigans with propagation, and only consume nonuniform qualifiers exactly where needed (last minute).
2021-04-19MSL: Fix copy of arrays to/from stage IO variables.Hans-Kristian Arntzen
Need to take into account effective storage classes and whether or not we target stage IO blocks since native arrays are conditionally enabled.
2021-04-19MSL: Make builtin argument type declaration context sensitive.Hans-Kristian Arntzen
Sometimes we'll need array template, sometimes not :shrug:.
2021-04-19MSL: Use spvUnsafeArray for builtin arrays after all.Hans-Kristian Arntzen
It will get too messy to deal with constant initializers any other way, so just deal with complexity in argument_decl instead ...
2021-04-19MSL: Handle CullDistance better.Hans-Kristian Arntzen
2021-04-19MSL: Emit multiple threadgroup slices for multi-patch.Hans-Kristian Arntzen
Multiple patches can run in the same workgroup when using multi-patch mode, so we need to allocate enough storage to avoid false sharing.
2021-04-19MSL: Cleanup fallback IO block emission.Hans-Kristian Arntzen
Need to emit in add_variable_to_iface(). Unifies the code paths a fair bit.
2021-04-19MSL: Handle masking of TESC IO block members.Hans-Kristian Arntzen
2021-04-19MSL: Add test for complex control point outputs.Hans-Kristian Arntzen
2021-04-19MSL: Rewrite how IO blocks are emitted in multi-patch mode.Hans-Kristian Arntzen
Firstly, never flatten inputs or outputs in multi-patch mode. The main scenario where we do need to care is Block IO. In this case, we should only flatten the top-level member, and after that we use access chains as normal. Using structs in Input storage class is now possible as well. We don't need to consider per-location fixups at all here. In Vulkan, IO structs must match exactly. Only plain vectors can have smaller vector sizes as a special case.
2021-04-19MSL: Handle masking of builtin control points.Hans-Kristian Arntzen
2021-04-19MSL: Do not perform scalar fixups for control-point outputs.Hans-Kristian Arntzen
2021-04-19MSL: Always emit block variable for block types.Hans-Kristian Arntzen