Counter Strike : Global Offensive Source Code
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.

106 lines
4.7 KiB

  1. //===== Copyright � 1996-2007, 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. //-----------------------------------------------------------------------------
  19. // Commands used by the per-pass command buffers
  20. //-----------------------------------------------------------------------------
  21. enum CommandBufferCommand_t
  22. {
  23. // flow control commands.
  24. CBCMD_END = 0, // end of stream
  25. CBCMD_JUMP, // int cmd, void *adr. jump to another
  26. // stream. Can be used to implement
  27. // non-sequentially allocated storage
  28. CBCMD_JSR, // int cmd, void *adr. subroutine call to another stream.
  29. // constant setting commands
  30. CBCMD_SET_PIXEL_SHADER_FLOAT_CONST, // int cmd,int first_reg, int nregs, float values[nregs*4]
  31. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST, // int cmd,int first_reg, int nregs, float values[nregs*4]
  32. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST_REF, // int cmd,int first_reg, int nregs, &float values[nregs*4]
  33. CBCMD_SETPIXELSHADERFOGPARAMS, // int cmd, int regdest
  34. CBCMD_STORE_EYE_POS_IN_PSCONST, // int cmd, int regdest
  35. CBCMD_SET_DEPTH_FEATHERING_CONST, // int cmd, int constant register, float blend scale
  36. // texture binding
  37. CBCMD_BIND_STANDARD_TEXTURE, // cmd, sampler, texture id
  38. CBCMD_BIND_SHADERAPI_TEXTURE_HANDLE, // cmd, sampler, texture handle
  39. // shaders
  40. CBCMD_SET_PSHINDEX, // cmd, idx
  41. CBCMD_SET_VSHINDEX, // cmd, idx
  42. CBCMD_SET_VERTEX_SHADER_FLASHLIGHT_STATE, // cmd, int first_reg (for worldToTexture matrix)
  43. CBCMD_SET_PIXEL_SHADER_FLASHLIGHT_STATE, // cmd, int color reg, int atten reg, int origin reg, sampler (for flashlight texture)
  44. CBCMD_SET_PIXEL_SHADER_UBERLIGHT_STATE, // cmd
  45. CBCMD_SET_VERTEX_SHADER_NEARZFARZ_STATE, // cmd
  46. };
  47. //-----------------------------------------------------------------------------
  48. // Commands used by the per-instance command buffer
  49. // NOTE: If you add commands, you probably want to change the size of
  50. // CInstanceStorageBuffer and/or the choice of making it a fixed-size allocation
  51. // see shaderlib/baseshader.*
  52. //
  53. // FIXME!! NOTE that this whole scheme here generates a dependency of the
  54. // shaders on internal guts of shaderapidx8, since it's responsible for
  55. // setting various pixel shader + vertex shader constants based on the
  56. // commands below. We need to remove this dependency as it's way too restrictive
  57. // and puts the smarts in the wrong place (see CBICMD_SETPIXELSHADERGLINTDAMPING
  58. // as an example). Not going to solve this for l4d though, as I don't anticipate
  59. // a large amount of new shader writing for that product.
  60. //-----------------------------------------------------------------------------
  61. enum CommandBufferInstanceCommand_t
  62. {
  63. CBICMD_END = 0, // end of stream
  64. CBICMD_JUMP, // int cmd, void *adr. jump to another
  65. // stream. Can be used to implement
  66. // non-sequentially allocated storage
  67. CBICMD_JSR, // int cmd, void *adr. subroutine call to another stream.
  68. CBICMD_SETSKINNINGMATRICES, // int cmd
  69. CBICMD_SETVERTEXSHADERLOCALLIGHTING, // int cmd
  70. CBICMD_SETPIXELSHADERLOCALLIGHTING, // int cmd, int regdest
  71. CBICMD_SETVERTEXSHADERAMBIENTLIGHTCUBE, // int cmd
  72. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBE, // int cmd, int regdest
  73. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBELUMINANCE, // int cmd, int regdest
  74. CBICMD_SETPIXELSHADERGLINTDAMPING, // int cmd, int regdest
  75. CBICMD_BIND_ENV_CUBEMAP_TEXTURE, // cmd, sampler
  76. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE,
  77. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE_LINEARSCALE, // int cmd, int constant register, Vector color2
  78. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE, // int cmd, int constant register, Vector color2
  79. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector color2, float scale
  80. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE, // int cmd, int constant register, Vector color2
  81. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_IDENTITY, // int cmd, int constant register
  82. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector color2, float scale
  83. // This must be last
  84. CBICMD_COUNT,
  85. };
  86. #endif // COMMANDBUFFER_H