VertexShaderGen.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "VideoCommon/LightingShaderGen.h"
  6. #include "VideoCommon/ShaderGenCommon.h"
  7. #include "VideoCommon/VideoCommon.h"
  8. // TODO should be reordered
  9. #define SHADER_POSITION_ATTRIB 0
  10. #define SHADER_POSMTX_ATTRIB 1
  11. #define SHADER_NORM0_ATTRIB 2
  12. #define SHADER_NORM1_ATTRIB 3
  13. #define SHADER_NORM2_ATTRIB 4
  14. #define SHADER_COLOR0_ATTRIB 5
  15. #define SHADER_COLOR1_ATTRIB 6
  16. #define SHADER_TEXTURE0_ATTRIB 8
  17. #define SHADER_TEXTURE1_ATTRIB 9
  18. #define SHADER_TEXTURE2_ATTRIB 10
  19. #define SHADER_TEXTURE3_ATTRIB 11
  20. #define SHADER_TEXTURE4_ATTRIB 12
  21. #define SHADER_TEXTURE5_ATTRIB 13
  22. #define SHADER_TEXTURE6_ATTRIB 14
  23. #define SHADER_TEXTURE7_ATTRIB 15
  24. #pragma pack(1)
  25. struct vertex_shader_uid_data
  26. {
  27. u32 NumValues() const { return sizeof(vertex_shader_uid_data); }
  28. u32 components : 23;
  29. u32 numTexGens : 4;
  30. u32 numColorChans : 2;
  31. u32 dualTexTrans_enabled : 1;
  32. u32 pixel_lighting : 1;
  33. u32 pad : 1;
  34. u32 texMtxInfo_n_projection : 16; // Stored separately to guarantee that the texMtxInfo struct is 8 bits wide
  35. struct {
  36. u32 inputform : 2;
  37. u32 texgentype : 3;
  38. u32 sourcerow : 5;
  39. u32 embosssourceshift : 3;
  40. u32 embosslightshift : 3;
  41. } texMtxInfo[8];
  42. struct {
  43. u32 index : 6;
  44. u32 normalize : 1;
  45. u32 pad : 1;
  46. } postMtxInfo[8];
  47. LightingUidData lighting;
  48. };
  49. #pragma pack()
  50. typedef ShaderUid<vertex_shader_uid_data> VertexShaderUid;
  51. typedef ShaderCode VertexShaderCode; // TODO: Obsolete..
  52. void GetVertexShaderUid(VertexShaderUid& object, u32 components, API_TYPE api_type);
  53. void GenerateVertexShaderCode(VertexShaderCode& object, u32 components, API_TYPE api_type);