Name | Syntax | Description |
---|---|---|
unbind | unbind [Key] | This command removes any bind bound to the specified key. |
bind | bind [Bind Key] ['Bind Command'] | This command will bind a command, or list of commands, to a key on your keyboard or button on your mouse. Binds can make your CS:GO experience much more convenient, and is a very important command in the game. |
bind_osx | bind_osx [Bind Key] ['Bind Command'] | This command will bind a command, or list of commands, to a key on your keyboard or button on your mouse. This command is for OSX (Mac). |
key_listboundkeys | key_listboundkeys | This console command lists all of the keys and buttons you have that have a specific action bound to them (e.g. the space bar being bound to jump). |
BindToggle | BindToggle [Bind Key] ['Bind Command'] | This command assigns a hotkey (key on your keyboard, or button on your mouse) to switch through the various values a specified console command has (when pressed or clicked). This is useful for setting up binds that toggle a certain feature. For example,'voice_enable' would be toggled between 0 and 1 (disabled and enabled). |
+use | +use | This command will prompt you to perform the 'use' action on an item or object if its applicable. For example, this command will make you plant the bomb if you're on a bombsite carrying the bomb when you use it. It can also open doors if you're in front of one. It acts in a similar way to the E key on a default keyboard setup. Use the -use command afterwards, as otherwise you will not be able to use this command again. |
-use | -use | If you have previously used the +use command, you must run this command after (to deactivate it), so that you can use the +use command again. |
cl_scoreboard_mouse_enable_binding | cl_scoreboard_mouse_enable_binding [Bind Key] | This command allows you to change what key turns mouse selection on while you have the scoreboard open . This is defaulted to +attack2 (usually right-click), and is what lets you use your mouse to click on people's names when you toggle open the scoreboard. |
invnext | invnext | This command switches to the next item in your inventory. If you have your rifle equipped it will swap to your pistol, and if you have your pistol equipped it will swap you to your knife. |
invnextgrenade | invnextgrenade | This command switches what you have equipped to the next grenade in your inventory. That means if your rifle is drawn you will switch to a grenade, and then using the command again will cycle you through to the next available grenade on you. |
invnextitem | invnextitem | This command switches to the next item in your inventory. This does not include guns, so will move between items such as your knife and grenades only. |
invnextnongrenade | invnextnongrenade | This command equips the next item in your inventory that isn't a grenade. It also ignores knives, so will only switch between the guns you have in your inventory. |
invprev | invprev | This command works backwards through your inventory, equipping you with the item that is the previous selection of what you currently have out. That means that using this command when you have your knife out equips your pistol, and using it with your pistol out equips your rifle (if you have one). |
+showscores | +showscores | This command will make the in game scoreboard appear. Unlike holding TAB, it will stay on your screen without you needing to press anything. Disable it with the -showscores command. |
+zoom | +zoom | This command will make make your AWP, or any other weapon with a scope (e.g. scout) scope in. The weapon will continue to be scoped in/out until the command -zoom is used. The command may activate the 'zoom' feature of other weapons like the stab of a knife or the burst fire switch of the glock. |
-score | -score | This command hides the CS:GO scoreboard if you brought it up with a command like +score. |
-showscores | -showscores | This command dismisses the scoreboard if you've brought up it permanently through a command like +showscores or +score. |
callvote | callvote | This command brings up the option to call a vote in game, either to kick a player or to change map. You can select which vote you're calling after entering the command, and if the vote you call then receives a large majority of player votes to one side or another that decision is forced (e.g. the player you're voting to kick would be kicked if the large majority of players voted yes). |
key_findbinding | key_findbinding [Bind Key] | This console command produces a list in your developer console of what certain keys are bound to, such as the B key on your keyboard being bound to opening the buy menu. |
unbindall | unbindall | This command removes all binds from all keys. Note that this will remove binds from keys like W, A, S and D, so you won't be able to move until re-binding. |
+alt1 | +alt1 | This command activates the ALT1 (left ALT) key on your keyboard (the same as holding down the ALT key). Use -alt1 to deactivate. |
+alt2 | +alt2 | This command activates the ALT2 (right ALT) key on your keyboard (the same as holding down the ALT key). Use -alt2 to deactivate. |
+attack | +attack | This console command causes you to attack repeatedly. Use the command -attack to stop this. If you have a gun equipped while using this command it will make you fire until you need to reload. |
+attack2 | +attack2 | This command will activate your secondary attack repeatedly. To stop this, use the -attack2 command. For example, this command makes you scope in with an AWP, or stab if you have your knife out. |
+back | +back | This command will make your character move backwards continuously. Type -back into your console to disable this. |
+duck | +duck | This movement console command will make your character crouch, similarly to how holding the left CTRL key on a keyboard works. -duck will make you stand up again. |
+forward | +forward | This movement command makes your character move forward infinitely. Use -forward to disable this. |
+jump | +jump | This movement command causes your character to jump once into the air. It will also unbind your jump key, so enter -jump into your console to fix this. |
+movedown | +movedown | This command only works in noclip mode and in demos: this command will make you (or your free-roam camera in demos) move downwards. Use -movedown to stop moving downwards. |
+moveleft | +moveleft | This command will make your character move to the left. The -moveleft console command will stop your character from moving to the left after running this command. |
+moveright | +moveright | This command will make your character move to the right. The -moveright console command will stop your character from moving to the left after running this command. |
+moveup | +moveup | This command only works in noclip mode and in demos: this command will make you (or your free-roam camera in demos) move upwards. Use -moveup to stop moving upwards. |
+reload | +reload | This command will prompt your character to reload their weapon if any bullets have been fired, and if not deactivated, will cause your character to reload instantly after firing a single bullet. Deactivate this command with the -reload command. |
+right | +right | This command makes your camera spin endlessly to the right. Using the command -right will stop this effect. |
-alt1 | -alt1 | This command will deactivate the alt1 key, which is usually activated with the +alt1 command. |
-alt2 | -alt2 | This console command stops the action that the command +alt2 commands. |
-attack | -attack | This is the command needed to stop firing or attacking if you've the +attack command. |
-attack2 | -attack2 | This is the command you need to stop the infinite attack cycle that +attack2 causes, such as repeatedly stabbing if you have your knife equipped. |
-back | -back | Using this console command stops your character walking backwards if you previously used the +back command. |
-duck | -duck | If you're crouched, this cheat command will make you stand back up. |
-forward | -forward | This is the command to use to stop your character walking forward if you've got them in an endless movement cycle. |
-graph | -graph | This cheat command will dismiss the statistics graph that can be summoned by using the +graph command. |
-movedown | -movedown | This command will deactivate the +movedown command (will stop you or your camera from moving downwards). |
-moveleft | -moveleft | This cheat command stops your character from moving if they've been set to move endlessly to the left. |
-moveright | -moveright | This command prevents your character from moving any further if they've been set to move endlessly to the right. |
-moveup | -moveup | This command will deactivate the +moveup command (will stop you or your camera from moving upwards). |
-reload | -reload | This command will deactivate the +reload command (as after using the +reload command, you will instantly reload after firing any bullets). |
-right | -right | This console command stops your camera from spinning in circles if you've set it to rotate endlessly to the right. |
-speed | -speed | This command will return the speed of your character back to running speed/normal if you've slowed it down with a command like +speed. |
-strafe | -strafe | This command disables the effect from the +strafe command, where your mouse will move your character sideways rather than look around with the camera. |
-zoom | -zoom | This command breaks the infinite loop cycle of scoping in and out on a scoped weapon like the AWP or stabbing with your knife that +zoom causes. |
+speed | +speed | This console command will slow down the movement speed of your character. Type the command -speed to return your movement speed back to normal. |
+strafe | +strafe | This command prevents your mouse from being able to adjust where your player model is looking. Instead, your mouse will cause you to move to the side, or strafe. Turn this off with the -strafe command. |
+voicerecord | +voicerecord | This a useful console command that, when activated, will start continuously transmitting what you say to your teammates in game, meaning you don't need to hold down a mic hotkey. The command -voicerecord disables this command and stops transmitting what you say to your team. Check our examples for a way to bind this to a key. |
-voicerecord | -voicerecord | This console command will stop transmitting voice communication if you've used a command that lets you communicate without holding down a hotkey. Check the examples for a bind to toggle between transmitting voice and not doing so. |
slot0 | slot0 | This command switches your active slot (what you are holding in your hand) to slot 0. |
slot1 | slot1 | This command switches your active slot (what you are holding in your hand) to slot 1. |
slot10 | slot10 | This command switches your active slot (what you are holding in your hand) to slot 10. |
slot11 | slot11 | This command switches your active slot (what you are holding in your hand) to slot 11. |
slot2 | slot2 | This command switches your active slot (what you are holding in your hand) to slot 2. |
slot3 | slot3 | This command switches your active slot (what you are holding in your hand) to slot 3. |
slot4 | slot4 | This command switches your active slot (what you are holding in your hand) to slot 4. |
slot5 | slot5 | This command switches your active slot (what you are holding in your hand) to slot 5. |
slot6 | slot6 | This command switches your active slot (what you are holding in your hand) to slot 6. |
slot7 | slot7 | This command switches your active slot (what you are holding in your hand) to slot 7. |
slot8 | slot8 | This command switches your active slot (what you are holding in your hand) to slot 8. |
slot9 | slot9 | This command switches your active slot (what you are holding in your hand) to slot 9. |
+jlook | +jlook | This console command allows you to use a joystick to move your camera. |
+klook | +klook | This command prevents you from being able to move forward with your keyboard. Use the -klook command to disable it. |
+left | +left | This command causes your camera to endlessly rotate in a left direction. Using the -left command will end the cycle. |
autobuy | autobuy | If you have set up an autobuy command with the cl_autobuy command then this command will attempt to purchase those items. |
+walk | +walk | This command was removed from the game as it allowed players to move up ladders at full speed silently. |
forcebind | forcebind [Command] [Desired Key] | This command doesn't work as intended. It should bind a specified command to a random (but unused key). Use with caution. |
Bind Bind Key 'Bind Command' This command will bind a command, or list of commands, to a key on your keyboard or button on your mouse. Binds can make your CS:GO experience much more convenient, and is a very important command in the game. All you need to use a pro player's config is a downloadable file of their config file. We've got the configs of a whole bunch of professional CS:GO players ready to download, so if you want to use (for example) s1mple's settings, just go to his player page and click ‘config' and your download should begin automatically.
This topic describes some specific features of using High Level Shader Language (HLSL) Shader Model 5.1 with Direct3D 12. All Direct3D 12 hardware supports Shader Model 5.1, so support for this model does not depend on what the hardware feature level is.
Resource types and arrays
Shader Model 5 (SM5.0) resource syntax uses the register
keyword to relay important information about the resource to the HLSL compiler. For example, the following statement declares an array of four textures bound at slots t3, t4, t5, and t6. t3 is the only register slot appearing in the statement, simply being the first in the array of four.
Shader Model 5.1 (SM5.1) resource syntax in HLSL is based on existing register resource syntax, to allow easier porting. Direct3D 12 resources in HLSL are bound to virtual registers within logical register spaces:
- t – for shader resource views (SRV)
- s – for samplers
- u – for unordered access views (UAV)
- b – for constant buffer views (CBV)
The root signature referencing the shader must be compatible with the declared register slots. For example, the following portion of a root signature would be compatible with the use of texture slots t3 through t6, as it describes a descriptor table with slots t0 through t98.
A resource declaration may be a scalar, a 1D array, or a multidimensional array:
SM5.1 uses the same resource types and element types as SM5.0 does. SM5.1 declaration limits are more flexible, and constrained only by the runtime/hardware limits. The space
keyword specifies to which logical register space the declared variable is bound. If the space
keyword is omitted, then the default space index of 0 is implicitly assigned to the range (so the tex2
range above resides in space0
). register(t3, space0)
will never conflict with register(t3, space1)
, nor with any array in another space that might include t3.
An array resource may have an unbounded size, which is declared by specifying the very first dimension to be empty, or 0:
The matching descriptor table could be:
An unbounded array in HLSL does match a fixed number set with numDescriptors
in the descriptor table, and a fixed size in the HLSL does match an unbounded declaration in the descriptor table.
Multi-dimensional arrays are allowed, including of an unbounded size. These multidimensional arrays are flattened out in register space.
Aliasing of resource ranges is not allowed. In other words, for each resource type (t, s, u, b), declared register ranges mustn't overlap. That includes unbounded ranges, too. Ranges declared in different register spaces never overlap. Note that unbounded tex2
(above) resides in space0
, while unbounded tex3
resides in space1
, such that they don't overlap.
Accessing resources that have been declared as arrays is as simple as indexing them.
There's an important default restriction on the use of the indices (myMaterialID
and samplerID
in the code above) in that they're not allowed to vary within a wave. Even changing the index based on instancing counts as varying.
If varying the index is required then specify the NonUniformResourceIndex
qualifier on the index, for example:
On some hardware the use of this qualifier generates additional code to enforce correctness (including across threads) but at a minor performance cost. If an index is changed without this qualifier and within a draw/dispatch the results are undefined.
Descriptor arrays and texture arrays
Texture arrays have been available since DirectX 10. Texture arrays require one descriptor, however all the array slices must share the same format, width, height and mip count. Also, the array must occupy a contiguous range in virtual address space. The following code shows an example of accessing a texture array from a shader.
In a texture array, the index can be varied freely, without any need for qualifiers such as NonUniformResourceIndex
.
The equivalent descriptor array would be:
Note the awkward use of a float for the array index is replaced with myTex2D[2]
. Also descriptor arrays offer more flexibility with the dimensions. The type, Texture2D
is this example, cannot vary, but the format, width, height, and mip count can all vary with each descriptor.
It is legitimate to have a descriptor array of texture arrays:
It is not legitimate to declare an array of structures, each structure containing descriptors, for example the following code is not supported.
This would have allowed the memory layout abcabcabc.., but is a language limitation and is not supported. One supported method of doing this would be as follows, though the memory layout in this case is aaa..bbb..ccc...
To achieve the abcabcabc.. memory layout, use a descriptor table without use of the myStruct
structure.
Resource aliasing
The resource ranges specified in the HLSL shaders are logical ranges. They are be bound to concrete heap ranges at runtime via the root signature mechanism. Normally, a logical range maps to a heap range that does not overlap with other heap ranges. However, the root signature mechanism makes it possible to alias (overlap) heap ranges of compatible types. For example, tex2
and tex3
ranges from the above example may be mapped to the same (or overlapping) heap range, which has the effect of aliasing textures in the HLSL program. If such aliasing is desired, the shader must be compiled with D3D10_SHADER_RESOURCES_MAY_ALIAS option, which is set by using the /res_may_alias option for the Effect-Compiler Tool (FXC). The option makes the compiler produce correct code by preventing certain load/store optimizations under the assumption that resources may alias.
Divergence and derivatives
SM5.1 does not impose limitations on the resource index; i.e., tex2[idx].Sample(…)
– the index idx can be a literal constant, a cbuffer constant, or an interpolated value. While the programming model provides such great flexibility, there are issues to be aware of:
- If index diverges across a quad, the hardware-computed derivative and derived quantities such as LOD may be undefined. The HLSL compiler makes the best effort to issue a warning in this case, but will not prevent a shader from compiling. This behavior is similar to computing derivatives in divergent control flow.
- If the resource index is divergent, the performance is diminished compared to the case of a uniform index, because the hardware needs to perform operations on several resources. Resource indexes that may be divergent must be marked with the
NonUniformResourceIndex
function in HLSL code. Otherwise results are undefined.
Cs Go Bind Slot 360
UAVs in pixel shaders
SM5.1 does not impose constraints on UAV ranges in pixel shaders as was the case for SM5.0.
Constant Buffers
SM5.1 constant buffers (cbuffer) syntax has changed from SM5.0 to enable developers to index constant buffers. To enable indexable constant buffers, SM5.1 introduces the ConstantBuffer
'template' construct:
The preceding code declares constant buffer variable myCB1
of type Foo
and size 6, and a scalar, constant buffer variable myCB2
. A constant buffer variable can now be indexed in the shader as:
Cs Go Bind Slot 3.0
Fields ‘a' and ‘b' do not become global variables, but rather must be treated as fields. For backward compatibility, SM5.1 supports the old cbuffer concept for scalar cbuffers. The following statement makes ‘a' and ‘b' global, read-only variables as in SM5.0. However, such an old-style cbuffer cannot be indexable.
Currently, the shader compiler supports the ConstantBuffer
template for user-defined structures only.
For compatibility reasons, the HLSL compiler may automatically assign resource registers for ranges declared in space0
. If ‘space' is omitted in the register clause, the default space0
is used. The compiler uses the first-hole-fits heuristic to assign the registers. The assignment can be retrieved via the reflection API, which has been extended to add the Space field for space, while the BindPoint field indicates the lower bound of the resource register range.
Bytecode changes in SM5.1
SM5.1 changes how resource registers are declared and referenced in instructions. The syntax involves declaring a register 'variable', similar to how it is done for group shared memory registers:
This will disassemble to:
Each shader resource range now has an ID (a name) that is unique to the shader bytecode. For example, tex1 (t10) texture array becomes ‘T1' in the shader bytecode. Giving unique IDs to each resource range allows two things:
- Unambiguously identify which resource range (see dcl_resource_texture2d) is being indexed in an instruction (see sample instruction).
- Attaching a set of attributes to the declaration, e.g., element type, stride size, raster operation mode, etc.
Multi-dimensional arrays are allowed, including of an unbounded size. These multidimensional arrays are flattened out in register space.
Aliasing of resource ranges is not allowed. In other words, for each resource type (t, s, u, b), declared register ranges mustn't overlap. That includes unbounded ranges, too. Ranges declared in different register spaces never overlap. Note that unbounded tex2
(above) resides in space0
, while unbounded tex3
resides in space1
, such that they don't overlap.
Accessing resources that have been declared as arrays is as simple as indexing them.
There's an important default restriction on the use of the indices (myMaterialID
and samplerID
in the code above) in that they're not allowed to vary within a wave. Even changing the index based on instancing counts as varying.
If varying the index is required then specify the NonUniformResourceIndex
qualifier on the index, for example:
On some hardware the use of this qualifier generates additional code to enforce correctness (including across threads) but at a minor performance cost. If an index is changed without this qualifier and within a draw/dispatch the results are undefined.
Descriptor arrays and texture arrays
Texture arrays have been available since DirectX 10. Texture arrays require one descriptor, however all the array slices must share the same format, width, height and mip count. Also, the array must occupy a contiguous range in virtual address space. The following code shows an example of accessing a texture array from a shader.
In a texture array, the index can be varied freely, without any need for qualifiers such as NonUniformResourceIndex
.
The equivalent descriptor array would be:
Note the awkward use of a float for the array index is replaced with myTex2D[2]
. Also descriptor arrays offer more flexibility with the dimensions. The type, Texture2D
is this example, cannot vary, but the format, width, height, and mip count can all vary with each descriptor.
It is legitimate to have a descriptor array of texture arrays:
It is not legitimate to declare an array of structures, each structure containing descriptors, for example the following code is not supported.
This would have allowed the memory layout abcabcabc.., but is a language limitation and is not supported. One supported method of doing this would be as follows, though the memory layout in this case is aaa..bbb..ccc...
To achieve the abcabcabc.. memory layout, use a descriptor table without use of the myStruct
structure.
Resource aliasing
The resource ranges specified in the HLSL shaders are logical ranges. They are be bound to concrete heap ranges at runtime via the root signature mechanism. Normally, a logical range maps to a heap range that does not overlap with other heap ranges. However, the root signature mechanism makes it possible to alias (overlap) heap ranges of compatible types. For example, tex2
and tex3
ranges from the above example may be mapped to the same (or overlapping) heap range, which has the effect of aliasing textures in the HLSL program. If such aliasing is desired, the shader must be compiled with D3D10_SHADER_RESOURCES_MAY_ALIAS option, which is set by using the /res_may_alias option for the Effect-Compiler Tool (FXC). The option makes the compiler produce correct code by preventing certain load/store optimizations under the assumption that resources may alias.
Divergence and derivatives
SM5.1 does not impose limitations on the resource index; i.e., tex2[idx].Sample(…)
– the index idx can be a literal constant, a cbuffer constant, or an interpolated value. While the programming model provides such great flexibility, there are issues to be aware of:
- If index diverges across a quad, the hardware-computed derivative and derived quantities such as LOD may be undefined. The HLSL compiler makes the best effort to issue a warning in this case, but will not prevent a shader from compiling. This behavior is similar to computing derivatives in divergent control flow.
- If the resource index is divergent, the performance is diminished compared to the case of a uniform index, because the hardware needs to perform operations on several resources. Resource indexes that may be divergent must be marked with the
NonUniformResourceIndex
function in HLSL code. Otherwise results are undefined.
Cs Go Bind Slot 360
UAVs in pixel shaders
SM5.1 does not impose constraints on UAV ranges in pixel shaders as was the case for SM5.0.
Constant Buffers
SM5.1 constant buffers (cbuffer) syntax has changed from SM5.0 to enable developers to index constant buffers. To enable indexable constant buffers, SM5.1 introduces the ConstantBuffer
'template' construct:
The preceding code declares constant buffer variable myCB1
of type Foo
and size 6, and a scalar, constant buffer variable myCB2
. A constant buffer variable can now be indexed in the shader as:
Cs Go Bind Slot 3.0
Fields ‘a' and ‘b' do not become global variables, but rather must be treated as fields. For backward compatibility, SM5.1 supports the old cbuffer concept for scalar cbuffers. The following statement makes ‘a' and ‘b' global, read-only variables as in SM5.0. However, such an old-style cbuffer cannot be indexable.
Currently, the shader compiler supports the ConstantBuffer
template for user-defined structures only.
For compatibility reasons, the HLSL compiler may automatically assign resource registers for ranges declared in space0
. If ‘space' is omitted in the register clause, the default space0
is used. The compiler uses the first-hole-fits heuristic to assign the registers. The assignment can be retrieved via the reflection API, which has been extended to add the Space field for space, while the BindPoint field indicates the lower bound of the resource register range.
Bytecode changes in SM5.1
SM5.1 changes how resource registers are declared and referenced in instructions. The syntax involves declaring a register 'variable', similar to how it is done for group shared memory registers:
This will disassemble to:
Each shader resource range now has an ID (a name) that is unique to the shader bytecode. For example, tex1 (t10) texture array becomes ‘T1' in the shader bytecode. Giving unique IDs to each resource range allows two things:
- Unambiguously identify which resource range (see dcl_resource_texture2d) is being indexed in an instruction (see sample instruction).
- Attaching a set of attributes to the declaration, e.g., element type, stride size, raster operation mode, etc.
Note that the ID of the range is not related to the HLSL lower bound declaration.
The order of reflection resource bindings (listing at the top) and shader declaration instructions (dcl_*) is the same to aid in identifying the correspondence between HLSL variables and bytecode IDs.
Each declaration instruction in SM5.1 uses a 3D operand to define: range ID, lower and upper bounds. An additional token is emitted to specify the register space. Other tokens may be emitted as well to convey additional properties of the range, e.g., cbuffer or structured buffer declaration instruction emits the size of the cbuffer or structure. The exact details of encoding can be found in d3d12TokenizedProgramFormat.h and D3D10ShaderBinary::CShaderCodeParser.
SM5.1 instructions will not emit additional resource operand information as part of the instruction (as in SM5.0). This information is now in the declaration instructions. In SM5.0, instructions indexing resources required resource attributes to be described in extended opcode tokens, since indexing obfuscated the association to the declaration. In SM5.1, each ID (such as ‘t1') is unambiguously associated with a single declaration that describes the required resource information. Therefore, the extended opcode tokens used on instructions to describe resource information are no longer emitted.
In non-declaration instructions, a resource operand for samplers, SRVs, and UAVs is a 2D operand. The first index is a literal constant that specifies the range ID. The second index represents the linearized value of the index. The value is computed relative to the beginning of the corresponding register space (not relative to the beginning of the logical range) to better correlate with the root signature and to reduce the driver compiler burden of adjusting the index.
A resource operand for CBVs is a 3D operand, containing: literal ID of the range, index of the constant buffer, offset into the particular instance of constant buffer.
Example HLSL Declarations
HLSL programs do not need to know anything about root signatures. They can assign bindings to the virtual 'register' binding space, t# for SRVs, u# for UAVs, b# for CBVs, s# for samplers, or rely on the compiler to pick assignments (and query the resulting mappings using shader reflection afterwards). Sands casino bethlehem pa restaurants. The root signature maps descriptor tables, root descriptors, and root constants to this virtual register space.
The following are some example declarations an HLSL shader might have. Note that there are no references to root signatures or descriptor tables.