Jump to content

  • Log In with Google      Sign In   
  • Create Account

Let's say 3 2D Textures and a TextureCube walk into a bar?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 SIC Games   Members   -  Reputation: 617

Like
0Likes
Like

Posted 07 April 2014 - 09:38 AM

Well they don't actually walk in to a bar. However, sorry to disappoint but there's a small tiny issue. I have let's say 3 textures for now that are being set up in the rendering pipeline. They are 2D Textures and they are in a vector array.

unsigned int arraySize = TextureArrays.size(); //-- Obtain Vector Size.
devcon->PSSetShaderResources(0,arraySize ,&TextureArrays);

Great and dandy! However, I now have a TextureCube that I want to use for reflection purposes from the already existing cubemap. So, I grabbed the shader resource view from the cube map and bring it to the main rendering for the meshes. So, the three textures I was talking about : DIffuse, Normal, Specular. I want to add the Texture Cube to that. Would it go like this?

unsigned int arraySize = textureArray.size(); //-- Obtain three textures inside the vector.
devcontext->PSSetShaderResource(0,arraySize,&textureArray); //-- Diffuse, Normal, Specular.
if(cubemapShaderResourceView) ///-- Check to see if it's even loaded inside as ID3D11ShaderResourceView.
devcon->PSSetShaderResource(1,0,&cubemapShaderResourceView);


Or would it be just fine to be added inside the vector along with the Diffuse, Normal, Specular and whatnot. I was thinking because of how inside the shader the Diffuse, Normal, Specular are all Texture2D and the texturemap is TextureCube; so I didn't know how I should go about this...

 

I hope I kept it sweet and short and thanks for reading. Any feedback would be most appreciated.


Game Engine's WIP Videos - http://www.youtube.com/sicgames88


Sponsor:

#2 xycsoscyx   GDNet+   -  Reputation: 318

Like
2Likes
Like

Posted 07 April 2014 - 12:44 PM

Since you're not setting textures, but instead shader resource views, it would be fine to add it as part of your array.  I assume you already create a shader resource view for all textures (2d and cube)?  If you did want to separate it then your second call isn't correct though.  The first parameter is the starting stage to set, the second is the number of resources, and the third is the array of resources.  In your second call you are setting 0 resources in the first stage.  It should really be more like this:

 

devcon->PSSetShaderResource(arraySize,1,&cubemapShaderResourceView);

 

This will set the next stage after the array, and set 1 resource.  Again though, as long as you create resources views for all textures, then you can set them all in the array and call PSSetShaderResource only once.



#3 SIC Games   Members   -  Reputation: 617

Like
0Likes
Like

Posted 07 April 2014 - 08:05 PM

Now, I understand what the second parameter of the whole PSSetShaderResources are. So, instance:

deviceContext->PSSetShaderResources(0,3,&myShaderResources); //-- Diffuse, Normal Speclar Mapping inside array. 

deviceContext->PSSetShaderResrouces(3,1,&myTextureCube); //-- TextureCube.

So, I think I'm understanding that the number of views are how many resources are inside that slot. So, in Slot 0 there would 3 number shader views. In the 3 slot there is only 1 number shader view...Am I understanding this correctly?


Game Engine's WIP Videos - http://www.youtube.com/sicgames88





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS