Comments (2)
With DEPTH_RANGE_ZERO_TO_ONE
, did you mean that would be a C# #define
?
A more discoverable API might be to have it as a property on the [VertexShader]
attribute? It could be a DepthRangeTransform
enum, defaulting to the current behaviour.
I'm trying to think of other intrinsic functions that could make use of this and coming up blank. That's probably just because it's late :) It does seem like a useful piece of metadata to have.
from shadergen.
With DEPTH_RANGE_ZERO_TO_ONE, did you mean that would be a C# #define?
In my mind, it would be a preprocessor condition that is used but not defined in the shader code, e.g.:
gl_Position = output_.Position;
#if !DEPTH_RANGE_ZERO_TO_ONE
gl_Position.z = gl_Position.z * 2.0 - gl_Position.w;
#endif
By default, nothing would be change, but you could do something like this on the C# side:
string defines = string.Empty;
if (GraphicsDevice.IsDepthRangeZeroToOne)
{
defines = "DEPTH_RANGE_ZERO_TO_ONE";
}
byte[] shaderBytes = LoadShader("myShader.vert", defines); // Add defines into the text and return bytes
(Prototype of that API in this Veldrid branch)
A more discoverable API might be to have it as a property on the [VertexShader] attribute? It could be a DepthRangeTransform enum, defaulting to the current behaviour.
I'm trying to think of a way that you can write your shader in a "portable" way, such that it will work under both depth range schemes. If we had a more robust "configuration system", perhaps you could just tell ShaderGen to spit out both versions of the shader -- but that's much more complicated.
I'm trying to think of other intrinsic functions that could make use of this and coming up blank.
I think there might need to be some kind of builtin function that does depth comparisons for you, based on whether or not that define is set.
from shadergen.
Related Issues (20)
- [Enhancement] Upgrade Shader.App to .Net Core 2.2
- ShaderGen.Build does not generate any shader HOT 1
- Double precision support?
- About findFXC
- embedding generated shaders as part of the compilation process.
- Converting ShaderGen to work as a Roslyn Source Generator
- [SUGGESTION] Control compatibility level for method implementations. HOT 3
- [Suggestion] Add JetBrains.Annotations HOT 4
- NuGet packages out of order
- How do you normalize? HOT 3
- I can't output some file. HOT 6
- Who can give me a basic only demo project?
- When I use ShaderGen.Build ,I con't do with ComplexCompute.cs and SimpleCompute.cs .
- [Bug] Hlsl.bytes no longer produced. HOT 3
- [Bug] Tests fail on computers without OpenGLES
- [Enhancement] Add more options to ShaderGen.App to require shader compilations
- [Enhancement] Use a C# wrapper library for GLSLangValidator
- [Enhancement] Use GLSLangValidator to validate OpenGL Shaders
- [Enhancement] Add tests for ShaderGen.App
- [Enhancement] Asynchronously compile shaders
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 shadergen.