Changeset 1215
- Timestamp:
- Apr 11, 2012, 1:41:55 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/debug/quad.cpp
r1208 r1215 74 74 Shader *shader[NUM_SHADERS]; 75 75 GLuint attr[NUM_ATTRS]; 76 GLuintuni[NUM_UNIFORMS];76 ShaderUniform uni[NUM_UNIFORMS]; 77 77 GLuint texture[NUM_TEXTURES]; 78 78 uint8_t image[1][TEX_SIZE * TEX_SIZE * 4]; … … 247 247 Shader **shader = data->shader; 248 248 GLuint *attr = data->attr; 249 GLuint*uni = data->uni;249 ShaderUniform *uni = data->uni; 250 250 251 251 /* These may be shared across calls */ -
trunk/src/gpu/shader.cpp
r1214 r1215 285 285 } 286 286 287 void Shader::SetUniform(ShaderUniform const &uni, int i) 288 { 289 #if defined USE_D3D9 || defined _XBOX 290 SetUniform(uni, ivec4(i, 0, 0, 0)); 291 #elif !defined __CELLOS_LV2__ 292 glUniform1i(uni.frag, i); 293 #else 294 /* FIXME: does this exist at all? */ 295 //cgGLSetParameter1i((CGparameter)uni.frag, i); 296 #endif 297 } 298 299 void Shader::SetUniform(ShaderUniform const &uni, ivec2 const &v) 300 { 301 #if defined USE_D3D9 || defined _XBOX 302 SetUniform(uni, ivec4(v, 0, 0)); 303 #elif !defined __CELLOS_LV2__ 304 glUniform2i(uni.frag, v.x, v.y); 305 #else 306 /* FIXME: does this exist at all? */ 307 #endif 308 } 309 310 void Shader::SetUniform(ShaderUniform const &uni, ivec3 const &v) 311 { 312 #if defined USE_D3D9 || defined _XBOX 313 SetUniform(uni, ivec4(v, 0)); 314 #elif !defined __CELLOS_LV2__ 315 glUniform3i(uni.frag, v.x, v.y, v.z); 316 #else 317 /* FIXME: does this exist at all? */ 318 #endif 319 } 320 321 void Shader::SetUniform(ShaderUniform const &uni, ivec4 const &v) 322 { 323 #if defined USE_D3D9 || defined _XBOX 324 SetUniform(uni, v); 325 #elif !defined __CELLOS_LV2__ 326 glUniform4i(uni.frag, v.x, v.y, v.z, v.w); 327 #else 328 /* FIXME: does this exist at all? */ 329 #endif 330 } 331 287 332 void Shader::SetUniform(ShaderUniform const &uni, float f) 288 333 { … … 336 381 g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &v[0], 1); 337 382 #elif !defined __CELLOS_LV2__ 338 glUniform4f(uni, v.x, v.y, v.z, v.w); 339 #else 340 cgGLSetParameter4f((CGparameter)uni, v.x, v.y, v.z, v.w); 383 glUniform4f(uni.frag, v.x, v.y, v.z, v.w); 384 #else 385 if (uni.frag) 386 cgGLSetParameter4f((CGparameter)uni.frag, v.x, v.y, v.z, v.w); 387 if (uni.vert) 388 cgGLSetParameter4f((CGparameter)uni.vert, v.x, v.y, v.z, v.w); 341 389 #endif 342 390 } … … 350 398 g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &m[0][0], 4); 351 399 #elif !defined __CELLOS_LV2__ 352 glUniformMatrix4fv(uni, 1, GL_FALSE, &m[0][0]); 353 #else 354 cgGLSetMatrixParameterfc((CGparameter)uni, &m[0][0]); 400 glUniformMatrix4fv(uni.frag, 1, GL_FALSE, &m[0][0]); 401 #else 402 if (uni.frag) 403 cgGLSetMatrixParameterfc((CGparameter)uni.frag, &m[0][0]); 404 if (uni.vert) 405 cgGLSetMatrixParameterfc((CGparameter)uni.vert, &m[0][0]); 355 406 #endif 356 407 } -
trunk/src/gpu/shader.h
r1214 r1215 46 46 47 47 ShaderUniform GetUniformLocation(char const *uni) const; 48 void SetUniform(ShaderUniform const &uni, int i); 49 void SetUniform(ShaderUniform const &uni, ivec2 const &v); 50 void SetUniform(ShaderUniform const &uni, ivec3 const &v); 51 void SetUniform(ShaderUniform const &uni, ivec4 const &v); 48 52 void SetUniform(ShaderUniform const &uni, float f); 49 53 void SetUniform(ShaderUniform const &uni, vec2 const &v); -
trunk/src/gradient.cpp
r1208 r1215 167 167 mat4 model_matrix = mat4(1.0f); 168 168 169 GLuint uni_mat, attr_pos, attr_col; 169 ShaderUniform uni_mat; 170 GLuint attr_pos, attr_col; 170 171 #if !defined __CELLOS_LV2__ 171 172 attr_pos = data->shader->GetAttribLocation("in_Vertex"); -
trunk/src/scene.cpp
r1212 r1215 325 325 // XXX: end of debug stuff 326 326 327 int uni_mat, uni_tex, attr_pos, attr_tex; 327 ShaderUniform uni_mat, uni_tex; 328 int attr_pos, attr_tex; 328 329 #if !defined __CELLOS_LV2__ 329 330 attr_pos = stdshader->GetAttribLocation("in_Position"); … … 340 341 stdshader->SetUniform(uni_mat, data->model_matrix); 341 342 342 #if defined USE_D3D9 || defined _XBOX343 /* TODO */344 #elif !defined __CELLOS_LV2__345 343 uni_tex = stdshader->GetUniformLocation("in_Texture"); 346 glUniform1i(uni_tex, 0); 347 #else 348 // WTF? this doesn't exist 349 //uni_tex = stdshader->GetUniformLocation("in_Texture"); 350 //cgGLSetParameter1i((CGparameter)(intptr_t)uni_tex, 0); 351 #endif 344 stdshader->SetUniform(uni_tex, 0); 352 345 353 346 #if defined USE_D3D9 || defined _XBOX -
trunk/test/tutorial/tut03.cpp
r1214 r1215 454 454 if (!m_ready) 455 455 { 456 #if !defined _ _CELLOS_LV2__ && !defined _XBOX && !defined USE_D3D9456 #if !defined _XBOX && !defined USE_D3D9 457 457 /* Create a texture of half the width and twice the height 458 458 * so that we can upload four different subimages each frame. */
Note: See TracChangeset
for help on using the changeset viewer.