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.

120 lines
5.5 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. #ifdef _PS3
  19. #define CBCMD_MAX_PS3TEX 8 // Max PS3 textures set in an ECB
  20. #endif
  21. //-----------------------------------------------------------------------------
  22. // Commands used by the per-pass command buffers
  23. //-----------------------------------------------------------------------------
  24. enum CommandBufferCommand_t
  25. {
  26. // flow control commands.
  27. CBCMD_END = 0, // end of stream
  28. CBCMD_JUMP, // int cmd, void *adr. jump to another
  29. // stream. Can be used to implement
  30. // non-sequentially allocated storage
  31. CBCMD_JSR, // int cmd, void *adr. subroutine call to another stream.
  32. #ifdef _PS3
  33. CBCMD_PS3TEX, // Textures. This command stores pointers to the BIND_TEXTURE commands
  34. // Will fill in the Bind Texture commands just before issueing the ECB to the SPU
  35. // This better emulates what happens on DX platforms, and so allows the weaponcache to function
  36. // whilst still allowing the VRAM defrag feature om PS3
  37. CBCMD_LENGTH, // Length of command buffer
  38. #endif
  39. // constant setting commands
  40. CBCMD_SET_PIXEL_SHADER_FLOAT_CONST, // int cmd,int first_reg, int nregs, float values[nregs*4]
  41. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST, // int cmd,int first_reg, int nregs, float values[nregs*4]
  42. CBCMD_SET_VERTEX_SHADER_FLOAT_CONST_REF, // int cmd,int first_reg, int nregs, &float values[nregs*4]
  43. CBCMD_SETPIXELSHADERFOGPARAMS, // int cmd, int regdest
  44. CBCMD_STORE_EYE_POS_IN_PSCONST, // int cmd, int regdest
  45. CBCMD_SET_DEPTH_FEATHERING_CONST, // int cmd, int constant register, float blend scale
  46. // texture binding. sampler indices have TEXTURECMD_BINDFLAGS_xxx flags OR'd into them.
  47. CBCMD_BIND_STANDARD_TEXTURE, // cmd, sampler, texture id
  48. CBCMD_BIND_SHADERAPI_TEXTURE_HANDLE, // cmd, sampler, texture handle
  49. #ifdef _PS3
  50. CBCMD_BIND_PS3_TEXTURE, // cmd, CPs3BindTexture_t
  51. CBCMD_BIND_PS3_STANDARD_TEXTURE, // cmd, idx
  52. #endif
  53. // shaders
  54. CBCMD_SET_PSHINDEX, // cmd, idx
  55. CBCMD_SET_VSHINDEX, // cmd, idx
  56. CBCMD_SET_VERTEX_SHADER_FLASHLIGHT_STATE, // cmd, int first_reg (for worldToTexture matrix)
  57. CBCMD_SET_PIXEL_SHADER_FLASHLIGHT_STATE, // cmd, int color reg, int atten reg, int origin reg, sampler (for flashlight texture)
  58. CBCMD_SET_PIXEL_SHADER_UBERLIGHT_STATE, // cmd
  59. CBCMD_SET_VERTEX_SHADER_NEARZFARZ_STATE, // cmd
  60. };
  61. //-----------------------------------------------------------------------------
  62. // Commands used by the per-instance command buffer
  63. // NOTE: If you add commands, you probably want to change the size of
  64. // CInstanceStorageBuffer and/or the choice of making it a fixed-size allocation
  65. // see shaderlib/baseshader.*
  66. //
  67. // FIXME!! NOTE that this whole scheme here generates a dependency of the
  68. // shaders on internal guts of shaderapidx8, since it's responsible for
  69. // setting various pixel shader + vertex shader constants based on the
  70. // commands below. We need to remove this dependency as it's way too restrictive
  71. // and puts the smarts in the wrong place (see CBICMD_SETPIXELSHADERGLINTDAMPING
  72. // as an example). Not going to solve this for l4d though, as I don't anticipate
  73. // a large amount of new shader writing for that product.
  74. //-----------------------------------------------------------------------------
  75. enum CommandBufferInstanceCommand_t
  76. {
  77. CBICMD_END = 0, // end of stream
  78. CBICMD_JUMP, // int cmd, void *adr. jump to another
  79. // stream. Can be used to implement
  80. // non-sequentially allocated storage
  81. CBICMD_JSR, // int cmd, void *adr. subroutine call to another stream.
  82. CBICMD_SETSKINNINGMATRICES, // int cmd
  83. CBICMD_SETVERTEXSHADERLOCALLIGHTING, // int cmd
  84. CBICMD_SETPIXELSHADERLOCALLIGHTING, // int cmd, int regdest
  85. CBICMD_SETVERTEXSHADERAMBIENTLIGHTCUBE, // int cmd
  86. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBE, // int cmd, int regdest
  87. CBICMD_SETPIXELSHADERAMBIENTLIGHTCUBELUMINANCE, // int cmd, int regdest
  88. CBICMD_SETPIXELSHADERGLINTDAMPING, // int cmd, int regdest
  89. CBICMD_BIND_ENV_CUBEMAP_TEXTURE, // cmd, sampler
  90. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE,
  91. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE_LINEARSCALE, // int cmd, int constant register, Vector color2, scale
  92. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARCOLORSPACE, // int cmd, int constant register, Vector4d( color2, 1.0 )
  93. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector4d( color2, 1.0 ) float scale
  94. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_LINEARSCALE_SCALEINW, // int cmd, int constant register, Vector color2, float scale
  95. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE, // int cmd, int constant register, Vector color2
  96. CBICMD_SETMODULATIONPIXELSHADERDYNAMICSTATE_IDENTITY, // int cmd, int constant register
  97. CBICMD_SETMODULATIONVERTEXSHADERDYNAMICSTATE_LINEARSCALE, // int cmd, int constant register, Vector color2, float scale
  98. // This must be last
  99. CBICMD_COUNT,
  100. };
  101. #endif // COMMANDBUFFER_H