Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actuallipsryme

Posted 01 April 2013 - 10:53 AM

So..I've created the buffer like this:

	D3D11_BUFFER_DESC instanceBufferDesc = {};
	
	instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	instanceBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
	instanceBufferDesc.ByteWidth = sizeof(XMFLOAT4);
	instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	instanceBufferDesc.MiscFlags = 0;
	instanceBufferDesc.StructureByteStride = 0;

	hr = this->device->CreateBuffer(&instanceBufferDesc, NULL, &this->instanceTransformBuffer);

 

is that correct so far ?

 

 
Now I'm a little clueless on how to create the shader resource view from this.
Any ideas ? Do I set the shader resource view description to NULL ?
 
This seems to work without errors:
	D3D11_SHADER_RESOURCE_VIEW_DESC shaderResourceDesc;
	shaderResourceDesc.Format = DXGI_FORMAT_R32_FLOAT;
	shaderResourceDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
	shaderResourceDesc.Buffer.FirstElement = 0;
	shaderResourceDesc.Buffer.ElementWidth = 4;
	shaderResourceDesc.Buffer.ElementOffset = 0;

	hr = this->device->CreateShaderResourceView(this->instanceTransformBuffer, &shaderResourceDesc, &this->instanceTransformBuffer_SRV);

 

 

Now if the above is correct, how can I basically push float4's onto the buffer ?


#11lipsryme

Posted 01 April 2013 - 10:13 AM

So..I've created the buffer like this:

	D3D11_BUFFER_DESC instanceBufferDesc = {};
	
	instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	instanceBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
	instanceBufferDesc.ByteWidth = sizeof(XMFLOAT4);
	instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	instanceBufferDesc.MiscFlags = 0;
	instanceBufferDesc.StructureByteStride = 0;

	hr = this->device->CreateBuffer(&instanceBufferDesc, NULL, &this->instanceTransformBuffer);

 

is that correct so far ?

 

 
Now I'm a little clueless on how to create the shader resource view from this.
Any ideas ? Do I set the shader resource view description to NULL ?
 
This seems to fail with invalid arguments:
hr = this->device->CreateShaderResourceView(this->instanceTransformBuffer, NULL, &this->instanceTransformBuffer_SRV);

 

 


#10lipsryme

Posted 01 April 2013 - 10:11 AM

So..I've created the buffer like this:

	D3D11_BUFFER_DESC instanceBufferDesc = {};
	
	instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	instanceBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
	instanceBufferDesc.ByteWidth = sizeof(XMFLOAT4);
	instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	instanceBufferDesc.MiscFlags = 0;
	instanceBufferDesc.StructureByteStride = 0;

	hr = this->device->CreateBuffer(&instanceBufferDesc, NULL, &this->instanceTransformBuffer);

 

is that correct so far ?

 

 
Now I'm a little clueless on how to create the shader resource view from this.
Any ideas ? Do I set the shader resource view description to NULL ?

#9lipsryme

Posted 01 April 2013 - 10:09 AM

So..I've created the buffer like this:

	D3D11_BUFFER_DESC instanceBufferDesc = {};
	
	instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	instanceBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
	instanceBufferDesc.ByteWidth = sizeof(XMFLOAT4);
	instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	instanceBufferDesc.MiscFlags = 0;
	instanceBufferDesc.StructureByteStride = 0;

	hr = this->device->CreateBuffer(&instanceBufferDesc, NULL, &this->instanceTransformBuffer);

 

is that correct so far ?

 

 
Now I'm a little clueless on how to create the shader resource view from this.
Any ideas ?

#8lipsryme

Posted 01 April 2013 - 10:09 AM

So..I've created the buffer like this:

	D3D11_BUFFER_DESC instanceBufferDesc = {};
	
	instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
	instanceBufferDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
	instanceBufferDesc.ByteWidth = sizeof(XMFLOAT4);
	instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
	instanceBufferDesc.MiscFlags = 0;
	instanceBufferDesc.StructureByteStride = 0;

	hr = this->device->CreateBuffer(&instanceBufferDesc, NULL, &this->instanceTransformBuffer);

 

is that correct so far ?

 

 
Now I'm a little clueless on how to create the shader resource view from this ?

#7lipsryme

Posted 01 April 2013 - 09:44 AM

nevermind got it.


PARTNERS