   Basic Vertex Shader help
  Ok im trying to create a basic vertex shader, but i get the following error when i try to compile:error: read of uninitialized component( * ) in v0: *x/0 *y/1 z/2 w/3the code i use is as followsconst char env_shader_transform[] ="vs.1.1 \n""add oPos.xy, v0.xy, c0.xy \n";//assemble the vertex shaderHRESULT hr = D3DXAssembleShader( env_shader_transform , sizeof(env_shader_transform), 0,0 , NULL , &mpShaderBuff , &pBuff );////// FAILS HERE////if(FAILED(hr)){DisplayError(DXGetErrorString9(hr));DisplayError((char*)pBuff->GetBufferPointer());}//create the vertex shader from the assembled bufferpDevice->getDevicePtr()->CreateVertexShader( (DWORD*)mpShaderBuff->GetBufferPointer(),   &pEnvShader);//when rendering    //set the vertex constantsfloat positionConstants[2];positionConstants[0] = this->mOffsetX;positionConstants[1] = this->mOffsetY;//update the positionpDevice->getDevicePtr()->SetVertexShaderConstantF(0, (float*)&positionConstants, 2);Thanks all.   
  Try putting after the vs.1.1 and before the add."dcl_position v0"Without that, the compiler doesn't know whether the vertex you're passing in actually puts anything into v0   ;  syntax error unexpexted token "oPos"hmm...   ;  Woo got it to compile, but its not working how i expected..   ;  Positions written from a vertex shader should be in homogenous clip space (i.e. x and y range from -1 to +1 and z from 0 to 1)   ;  Yeah but it isnt changing the positions of the vertices at all...   ;  nobody can help?   ;Quote:Original post by Ashehnobody can help?Things like "but its not working how i expected.." and "Yeah but it isnt changing the positions of the vertices at all... don't provide anyone with enough information to determine what problem you're seeing or where you may have gone wrong:- What input data is in your vertex buffer?, what range are the positions in?- Does anything display at all? or is it just that your offsets aren't having any affect on the position?- What offsets are you passing in?, where do you update them?- have you tried putting a breakpoint on the line with the "SetVertexShaderConstantF" on to confirm that the values being passed in are what you expect them to be?  (for example are they being converted to integer somewhere, because the vertices output from the shader need to be in the range of -1 to 1, that means your offsets are - 0.25f cast to an integer is 0, thus no movement).- is the vertex shader actually being used to render the data ?Without more details, all people can do is make *guesses* - the [fixed version of the] code you've provided seems correct to me - the issue is extremely likely to be in some code you haven't supplied.