Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
5.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. // This file defines a number of constants and structured which are used to build up a command
  8. // buffer to pass to ShaderAPI for state setting and other operations. Since the prupose of these
  9. // command buffers is to minimize and optimize calls into shaderapi, their structure is not
  10. // abstract - they are built out by the calling process.
  11. //
  12. //===========================================================================//
  13. #ifndef COMMANDBUFFER_H
  14. #define COMMANDBUFFER_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. // all commands defined with their struct
  19. enum CommandBufferCommand_t
  20. {
  21. // flow control commands.
  22. CBCMD_END = 0, // end of stream
  23. CBCMD_JUMP = 1, // int cmd, void *adr. jump to another
  24. // stream. Can be used to implement
  25. // non-sequentially allocated storage
  26. CBCMD_JSR = 2, // int cmd, void *adr. subroutine call to another stream.
  27. // constant setting commands
  28. CBCMD_SET_PIXEL_SHADER_FLOAT_CONST = 256, // int cmd,int first_reg, int nregs, float values[nregs*4]
  29. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST = 257, // int cmd,int first_reg, int nregs, float values[nregs*4]
  30. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST_REF = 258, // int cmd,int first_reg, int nregs, &float values[nregs*4]
  31. CBCMD_SETPIXELSHADERFOGPARAMS = 259, // int cmd, int regdest
  32. CBCMD_STORE_EYE_POS_IN_PSCONST = 260, // int cmd, int regdest
  33. CBCMD_COMMITPIXELSHADERLIGHTING = 261, // int cmd, int regdest
  34. CBCMD_SETPIXELSHADERSTATEAMBIENTLIGHTCUBE = 262, // int cmd, int regdest
  35. CBCMD_SETAMBIENTCUBEDYNAMICSTATEVERTEXSHADER = 263, // int cmd
  36. CBCMD_SET_DEPTH_FEATHERING_CONST = 264, // int cmd, int constant register, float blend scale
  37. // texture binding
  38. CBCMD_BIND_STANDARD_TEXTURE = 512, // cmd, sampler, texture id
  39. CBCMD_BIND_SHADERAPI_TEXTURE_HANDLE = 513, // cmd, sampler, texture handle
  40. // shaders
  41. CBCMD_SET_PSHINDEX = 1024, // cmd, idx
  42. CBCMD_SET_VSHINDEX = 1025, // cmd, idx
  43. // commands from mainline. In mainline commands no longer have
  44. // command id's specified like this. So I make up numbers...
  45. CBCMD_SET_VERTEX_SHADER_FLASHLIGHT_STATE = 2000, // cmd, int first_reg (for worldToTexture matrix)
  46. CBCMD_SET_PIXEL_SHADER_FLASHLIGHT_STATE = 2001, // cmd, int color reg, int atten reg, int origin reg, sampler (for flashlight texture)
  47. CBCMD_SET_PIXEL_SHADER_UBERLIGHT_STATE = 2002, // cmd
  48. CBCMD_SET_VERTEX_SHADER_NEARZFARZ_STATE = 2003, // cmd
  49. };
  50. //-----------------------------------------------------------------------------
  51. // Commands used by the per-instance command buffer
  52. // NOTE: If you add commands, you probably want to change the size of
  53. // CInstanceStorageBuffer and/or the choice of making it a fixed-size allocation
  54. // see shaderlib/baseshader.*
  55. //
  56. // FIXME!! NOTE that this whole scheme here generates a dependency of the
  57. // shaders on internal guts of shaderapidx8, since it's responsible for
  58. // setting various pixel shader + vertex shader constants based on the
  59. // commands below. We need to remove this dependency as it's way too restrictive
  60. // and puts the smarts in the wrong place (see CBICMD_SETPIXELSHADERGLINTDAMPING
  61. // as an example). Not going to solve this for l4d though, as I don't anticipate
  62. // a large amount of new shader writing for that product.
  63. //-----------------------------------------------------------------------------
  64. enum CommandBufferInstanceCommand_t
  65. {
  66. CBICMD_END = 0, // end of stream
  67. CBICMD_JUMP, // int cmd, void *adr. jump to another
  68. // stream. Can be used to implement
  69. // non-sequentially allocated storage
  70. CBICMD_JSR, // int cmd, void *adr. subroutine call to another stream.
  71. CBICMD_SETSKINNINGMATRICES, // int cmd
  72. CBICMD_SETVERTEXSHADERLOCALLIGHTING, // int cmd
  73. CBICMD_SETPIXELSHADERLOCALLIGHTING, // int cmd, int regdest
  74. CBICMD_SETVERTEXSHADERAMBIENTLIGHTCUBE, // int cmd
  75. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBE, // int cmd, int regdest
  76. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBELUMINANCE, // int cmd, int regdest
  77. CBICMD_SETPIXELSHADERGLINTDAMPING, // int cmd, int regdest
  78. CBICMD_BIND_ENV_CUBEMAP_TEXTURE, // cmd, sampler
  79. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE,
  80. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE_LINEARSCALE, // int cmd, int constant register, Vector color2
  81. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE, // int cmd, int constant register, Vector color2
  82. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector color2, float scale
  83. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE, // int cmd, int constant register, Vector color2
  84. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_IDENTITY, // int cmd, int constant register
  85. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector color2, float scale
  86. // This must be last
  87. CBICMD_COUNT,
  88. };
  89. #endif // commandbuffer_h