Kaynağa Gözat

Update DX shader to where the GL shader is.

aignacio_sf 20 yıl önce
ebeveyn
işleme
0cc4c2918f

+ 4 - 7
panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx

@@ -813,7 +813,7 @@ prepare_display_region(DisplayRegion *dr, Lens::StereoChannel stereo_channel) {
 }
 
 ////////////////////////////////////////////////////////////////////
-//     Function: DXGraphicsStateGuardian8::calc_projection_mat
+//     Function: DXGraphicsStateGuardian9::calc_projection_mat
 //       Access: Public, Virtual
 //  Description: Given a lens, calculates the appropriate projection
 //               matrix for use with this gsg.  Note that the
@@ -2784,7 +2784,8 @@ do_issue_transform() {
   DO_PSTATS_STUFF(_transform_state_pcollector.add_level(1));
 
   if (_current_shader_context) {
-    _current_shader_context->issue_transform(this);
+//    _current_shader_context->issue_transform(this);
+    _current_shader_context->issue_parameters(this, false);
 
 // ??? NO NEED TO SET THE D3D TRANSFORM VIA SetTransform SINCE THE TRANSFORM IS ONLY USED IN THE SHADER
     const D3DMATRIX *d3d_mat = (const D3DMATRIX *)transform->get_mat().get_data();
@@ -2885,7 +2886,7 @@ do_issue_shader() {
     }
   } else {
     // Use the same shader as before, but with new input arguments.
-    context->issue_parameters(this);
+    context->issue_parameters(this, true);
   }
 }
 
@@ -4972,7 +4973,3 @@ check_dx_allocation (HRESULT result, int allocation_size, int attempts)
 
   return retry;
 }
-
-
-
-

Dosya farkı çok büyük olduğundan ihmal edildi
+ 194 - 1135
panda/src/dxgsg9/dxShaderContext9.cxx


+ 4 - 50
panda/src/dxgsg9/dxShaderContext9.h

@@ -79,7 +79,8 @@ public:
   INLINE bool valid(GSG *gsg);
   void bind(GSG *gsg);
   void unbind(GSG *gsg);
-  void issue_parameters(GSG *gsg);
+
+  void issue_parameters(GSG *gsg, bool altered);
   void issue_transform(GSG *gsg);
   void disable_shader_vertex_arrays(GSG *gsg);
   void update_shader_vertex_arrays(CLP(ShaderContext) *prev, GSG *gsg);
@@ -99,30 +100,6 @@ public:
 private:
 
 #ifdef HAVE_CGDX9
-  enum ShaderAutoValue {
-    // This first batch of constants cleverly lines up
-    // with the Cg constant values.  Don't insert anything.
-    SIC_mat_modelview,
-    SIC_inv_modelview,
-    SIC_tps_modelview,
-    SIC_itp_modelview,
-    SIC_mat_projection,
-    SIC_inv_projection,
-    SIC_tps_projection,
-    SIC_itp_projection,
-    SIC_mat_texture,
-    SIC_inv_texture,
-    SIC_tps_texture,
-    SIC_itp_texture,
-    SIC_mat_modelproj,
-    SIC_inv_modelproj,
-    SIC_tps_modelproj,
-    SIC_itp_modelproj,
-    // From this point forward, it's okay to insert stuff.
-    SIC_sys_windowsize,
-    SIC_sys_pixelsize,
-    SIC_sys_cardcenter,
-  };
   struct ShaderAutoBind {
     CGparameter parameter;
     int value;
@@ -158,35 +135,12 @@ private:
 //  CGcontext _cg_context;
   CGprofile _cg_profile[2];
   CGprogram _cg_program[2];
-  string    _cg_errors;
-
-  // These arrays contain lists of "bindings." They
-  // tell us how to fill the shader's input parameters.
-  vector <ShaderAutoBind> _cg_auto_trans;
-  vector <ShaderAutoBind> _cg_auto_param;
-  vector <ShaderArgBind> _cg_fbind;
-  vector <ShaderArgBind> _cg_npbind;
-  vector <ShaderTexBind> _cg_texbind;
-  vector <ShaderTransBind> _cg_transform_bind;
-  vector <ShaderTransBind> _cg_parameter_bind;
-  vector <ShaderVarying> _cg_varying;
+
+  void report_cg_compile_errors(const string &file, CGcontext ctx);
 
   bool try_cg_compile(ShaderExpansion *s, GSG *gsg);
-  void bind_cg_transform(const ShaderTransBind &stb,
-                         CLP(GraphicsStateGuardian) *gsg);
   void suggest_cg_profile(const string &vpro, const string &fpro);
   CGprofile parse_cg_profile(const string &id, bool vertex);
-  void issue_cg_auto_bind(const ShaderAutoBind &bind, GSG *gsg);
-  bool compile_cg_parameter(CGparameter p, DX_PARAMETER *dx_parameter);
-  bool errchk_cg_parameter_words(CGparameter p, int len);
-  bool errchk_cg_parameter_direction(CGparameter p, CGenum dir);
-  bool errchk_cg_parameter_variance(CGparameter p, CGenum var);
-  bool errchk_cg_parameter_prog(CGparameter p, CGprogram prog, const string &msg);
-  bool errchk_cg_parameter_type(CGparameter p, CGtype dt);
-  bool errchk_cg_parameter_float(CGparameter p);
-  bool errchk_cg_parameter_sampler(CGparameter p);
-  void errchk_cg_output(CGparameter p, const string &msg);
-  void print_cg_compile_errors(const string &file, CGcontext ctx);
 #endif
 
 public:

Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor