What does those D3DCOMPILE constants mean? - hlsl

In the D3DCompiler library there's these flags called "D3DCompile Constants", but the description that Microsoft give us about them is very brief and difficult to have proper understanding of what they do. I wish someone could be able to explain at least what those three mean:
D3DCOMPILE_PARTIAL_PRECISION, D3DCOMPILE_NO_PRESHADER, D3DCOMPILE_ALL_RESOURCES_BOUND

That doc page is pretty poor. It's just the content of D3DCompiler.h comments put into a Markdown page. I'll see about submitting some edits to help it at least a little. Most of these flags are aliases for older D3DX constants as listed on Microsoft Docs where they are better documented at the moment.
UPDATE: The Microsoft Docs page has been updated.
The D3DCOMPILE_PARTIAL_PRECISION flag is equivalent to FXC's /Gpp switch and is an alias for D3DXSHADER_PARTIALPRECISION. It basically treats float32 values as float16 in some cases and enable use of some approximation functions.
The D3DCOMPILE_NO_PRESHADER flag is equivalent to FXC's /Op switch and is an alias for D3DXSHADER_PARTIALPRECISION. This feature is deprecated and only applies to legacy Direct3D 9 era "Effects" (FX). See this Microsoft Docs page for what this was about.
D3DCOMPILE_RESOURCES_MAY_ALIAS, D3DCOMPILE_ENABLE_UNBOUNDED_DESCRIPTOR_TABLES, and D3DCOMPILE_ALL_RESOURCES_BOUND flags are HLSL options for informing the HLSL compiler some assumptions when performing optimizations for DirectX 12 Shader Model 5.1.
Note for DirectX 12, D3DCompile and FXC.EXE are legacy and only support Shader Model 5.1. For DirectX12, you should use Shader Model 6 via the DXIL compiler and DXC.EXE command-line tool. See GitHub.

Related

How to enable documentation comments for C++/Qt in VS Code?

Following these instructions, I have already managed to fix the IntelliSense suggestions for my C++ hello world program using Qt headers. So for instance, when I type QString::, the class methods append, arg, etc. are suggested correctly. However, when I choose any of them, I would expect to read a short documentation comment describing what the selected method does do. Unfortunately, this information is not available.
I have also followed this tip and installed qt5-doc on my Ubuntu system, but I have no idea how I can use the .qch documentation files in VS Code. Do you have any pointer for me?

How do I tell QtCreator to accept the `texture()` function like it did for the `texture*D()` functions?

I am using QtCreator 4.12 as a generic C++ IDE, installed from my distribution's package manager, so this is a generic question about QtCreator usage, not related to Qt in particular, nor building QtCreator from source.
Like any IDE, QtCreator highlights potential errors while writing code.
in a .cpp file, if I write int x = 0 and press enter, the 0 will be underlined in red, and there will be a tooltip telling me that I forgot the ; at the end of the line.
This is described in the QtCreator documentation, but I couldn't find anything in that documentation about GLSL.
My actual project is a C++ with openGl game, and I'm editing my GLSL shaders within QtCreator.
Reading the answer to this question, I've learned that all the texture*D() functions were deprecated since openGL 3.3, and have to be replaced with texture() which infers the texture dimension, so I decided to update my shaders.
Within QtCreator, when I use the texture() function, the whole line gets underlined with red color, with a tooltip saying expression too complex, whereas when I use texture2D() (or texture1D() or else), the line isn't underlined as shown in following pictures :
deprecated GLSL:
non-deprecated GLSL:
This doesn't prevent my shaders to work as designed at all, so there's no real problem here, but it's really disturbing.
I don't know anything about the syntax error checking mechanism more than what is written in the linked documentation page, and I'm looking for a way to change this mechanism to accept GLSL 3.3+. I would accept an answer telling me how to silence this specific false positive as a workaround, or a way to deactivate the syntax error checking for .glsl files, but I would really prefer to understand how I could tweak the error checking mechanism to accept modern glsl as it does for legacy glsl.
In the end I wrote a bug report : QTCREATORBUG-24068.
There's a patch addressing the issue, which I could test. It will be merged in QT Creator's source v4.14.

How can I configure Emacs to highlight C++ that violate a detailed code style?

I've been researching existing C++ code style tools and have yet to find any packages which will allow me to highlight sections of a file which break a detailed code style configuration. While there seem to be several options for basic code style settings (what should/shouldn't be indented, line length > some threshold, etc), other issues do not seem to be addressed. For context, I'm hoping to be able to recognize when I do the following:
{ on same line as function definition (should be next line)
{ on next line after if statement (should be same line)
no space between ) and {
no space between comparisons (should be a == b instead of a== b,a==b, etc)
consecutive new lines
type *var_name or type * var_name instead of type* var_name
and so on...
This style is heavily enforced on my team, and I am having difficulty minimizing inconsistencies. I'm looking for either an existing emacs tool which allow me to customize these settings extensively, or suggestions on how to create an emacs package myself identifies these errors.
As Noufal suggests, Flymake is one option.
Another is Flycheck. I switched from Flymake to Flycheck a few years ago and haven't looked back. Flycheck supports a large number of languages and tools, and seems to require less hand-holding than Flymake.
From its GitHub README:
Features
Supports over 30 programming and markup languages with more than 60 different syntax checking tools
Fully automatic, fail-safe, on-the-fly syntax checking in background
Nice error indication and highlighting
Optional error list popup
Many customization options
A comprehensive manual
A simple interface to define new syntax checkers
A “doesn't get in your way” guarantee
Many 3rd party extensions
For C and C++ code, Flycheck supports Clang and Cppcheck out of the box, and there is a plugin for Google's C++ style guide as well.
And of course you can add your own checkers if you wish.
If you can configure your tool to emit output in the format that can be understood by flymake, it should be able to do it.
Many tools such as gcc itself and others do this so that flymake works.

glXChooseFBConfig() setting for anti-aliasing?

According to this post, it is stated that
To request a visual with multisampling with XLib, use these two attributes in the list to glXChooseFBConfig():
GLX_SAMPLE_BUFFERS - its value should be True. This is an on/off
toggle.
GLX_SAMPLES - the number of samples.
These of which, according to the wiki on Multisampling section in opengl.org, glXChooseFBConfig() does accept these attributes. However, GLX_SAMPLE_BUFFERS/GLX_SAMPLES don't appeared to be specified in an SDK here. Do you might know why?
I suggest you download the GLX-1.4 specification PDF, which is the much better reference manual: http://www.opengl.org/registry/doc/glx1.4.pdf

Is there anything like GhostDoc for C++

When I'm developing in C#, I heavily use GhostDoc to speed up the process of commenting my code. I'm currently working on a C++ project and I haven't found an equivalent tool. I know about Doxygen, but from what I know it is used to create documentation outside the code, not comments in the code. Are there any good equivalent tools? I would prefer one that runs in VS, but I could handle one that works in any IDE.
(Before someone brings it up, I don't rely solely on GhostDoc to create comments. I just use it to create the starting point for my comments.)
I've written an add-in, Atomineer Pro Documentation, which is very similar to GhostDoc (it generates/updates documentation comments to save a lot of time and effort when documenting), but it parses the code directly for itself and thus is able to handle C, C++, C++/CLI, C#, Java and Visual Basic code, and doesn't require the surrounding code to be in a compiling state before it will work. It will also automatically add/update documentation for more tricky things such as exceptions thrown within the body of a method.
It runs under Visual Studio 11, 2010, 2008 and 2005, and supports Documentation-Xml, Doxygen, JavaDoc and Qt commenting formats, as well as the format/style of comment blocks and the auto-doc rules used being highly configurable. It has a number of other handy features such as aiding conversions of legacy doc-comments to the above formats, and word wrapping in doc-comments and normal block comments.
The above is just a summary of some key features - This comparison of features with other products serves as a more complete list of the many other features available.
Visual Assist helps by providing custom scripts executed while typing (or on other).
For example, you can have a script for comments like this :
/************************************************************************/
/* My comment : $end$ */
/************************************************************************/
That would be suggested (via a combo-box exactly like intellisense) when you start typing "/**" for example.
When you select this suggestion (via Enter/Space/Click - customizable), it will insert the script where your cursor is and just replace markers that are between '$' characters by special values (like the current file name for example).
Here the $end$ marker will make the cursor be at this position when the script is executed. This way, you continue typing smoothly. For example with the previous script set, typing exactly :
/** this is a test comment to show you one of the many features Visual Assit!
will simply give :
/************************************************************************/
/* My comment : this is a test comment to show you one of the many features Visual Assit! */
/************************************************************************/
It's really easy to customize and the behavior of the suggestion (read : intellisense++) system is customizable.
Visual Assist might do the job, though I'm not absolutely sure.