Comments (2)
I don't think we will be able to match the code generated by slang. Our primary concern is to generate SPIR-V for Vulkan, and supporting other APIs through spirv-cross or other tools is a secondary. In this case, slang generates invalid spir-v.
%13 = OpTypeImage %float 2D 0 0 0 1 Unknown ; Not a depth image
%19 = OpTypeImage %float 2D 1 0 0 1 Unknown ; a depth image
%20 = OpTypeSampledImage %19
%29 = OpLoad %13 %tex_0 ; tex_0 is not a depth image.
%31 = OpSampledImage %20 %29 %30 ; The type of %29 implicitly changes to a depth image. The type of %29 is %13, but the image type in %20 is %19.
The spir-v spec for OpSampledImage says:
Result Type must be the OpTypeSampledImage type whose Image Type operand is the type of Image.
I'm double checking with people who know the Vulkan spec better than I do that this is not overridden by the Vulkan specification.
In general, DXC cannot tell if an image is a depth image or not, so it is best to use 2
for the depth in the type. If we started changing the type based on how the variable is used, we could easily run into problem keeping track of the type. For example, Slang is generating what I believe to be invalid code because of this problem.
I view this more as a spirv-cross problem. They are the ones that have to worry about metal, and doing the correct analysis to get the right types for metal. That is not DXC's job.
from directxshadercompiler.
Tint has a SPIR-V to WGSL conversion path, and faces similar translation challenges as spirv-cross.
Tint tracks usages by operations rather than types, to infer the resulting type for the target language (WGSL).
from directxshadercompiler.
Related Issues (20)
- Disable the clang-format checks when building DXC HOT 2
- What happened to -fvk-disable-depth-hint ? HOT 3
- [Feature Request] Distinguish row vs column major matrices in debug info. HOT 1
- [SPIR-V] asuint fails on bit cast HOT 1
- [SPIR-V] asdouble has invalid return type and failes to compile when targeting SPIRV HOT 1
- [SPIR-V] Fails to add linkage capability to module HOT 1
- [SPIR-V] unexpected builtin `RayTmaxKHR` for `RayTCurrent` when `HitTKHR` was expected HOT 1
- [SPIR-V] Potential invalid OpKill when using HLSL clip api HOT 1
- DxilConfTest::UnaryHalfOpTest#HtanHalf is failing on recent 24H2 build
- [SPIR-V] Global defined struct { Texture2D; SamplerState } causes irrelevant texture array to be compiled incorrectly HOT 2
- [SPIR-V] Seg fault where source hlsl contains entry point forward declaration HOT 1
- [SPIR-V] A different thing to `ext_instruction` for GLSL.std.450 extended instruction set HOT 4
- Release 1.8.2407
- [SPIR-V] integral_constant doesn't work with enum values HOT 1
- DXIL Validator Hash HOT 1
- llvm::errs() dopesm HOT 1
- llvm::errs() doesn't do anything in release builds on Linux, in libdxcompiler.so HOT 4
- [SPIR-V] Invalid SPIR-V with function returning bigger size vector out variable than caller vector/sclar argument variable HOT 1
- [SPIR-V] DXC crashes when sampling float1 texture HOT 1
- [SPIR-V] FP classification functions generate spir-v with the incorrect return type.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directxshadercompiler.