Results 1 to 2 of 2

Thread: Modifying SaschaWillems demo's uniforms?

  1. #1

    Modifying SaschaWillems demo's uniforms?

    I'm trying to modify uniform blocks:
    c++
    Code :
    struct {
    		glm::mat4 projection;
    		glm::mat4 model;
    		glm::mat4 view;
    		glm::vec4 instancePos[3];
    		int layer;
    	} uboVS, uboOffscreenVS;
     
    	// This UBO stores the shadow matrices for all of the light sources
    	// The matrices are indexed using geometry shader instancing
    	// The instancePos is used to place the models using instanced draws
    	struct {
    		glm::mat4 mvp[LIGHT_COUNT];
    		glm::vec4 instancePos[3];
    	} uboShadowGS;

    to: (just adding uint32_t totalInstances = 1)
    Code :
    struct {
    		glm::mat4 projection;
    		glm::mat4 model;
    		glm::mat4 view;
    		uint32_t totalInstances = 1;
    		glm::vec4 instancePos[3];
    		int layer;
    	} uboVS, uboOffscreenVS;
     
    	// This UBO stores the shadow matrices for all of the light sources
    	// The matrices are indexed using geometry shader instancing
    	// The instancePos is used to place the models using instanced draws
    	struct {
    		glm::mat4 mvp[LIGHT_COUNT];
    		uint32_t totalInstances = 1;
    		glm::vec4 instancePos[3];
    	} uboShadowGS;

    And in the 2 shaders from:
    Code :
    layout (binding = 0) uniform UBO 
    {
    	mat4 mvp[LIGHT_COUNT];
    	vec4 instancePos[3];
    } ubo;
     
    layout (binding = 0) uniform UBO 
    {
    	mat4 projection;
    	mat4 model;
    	mat4 view;
    	vec4 instancePos[3];
    } ubo;

    to:
    Code :
    layout (binding = 0) uniform UBO 
    {
    	mat4 mvp[LIGHT_COUNT];
    	int totalInstances;
    	vec4 instancePos[3];
    } ubo;
     
    layout (binding = 0) uniform UBO 
    {
    	mat4 projection;
    	mat4 model;
    	mat4 view;
    	int totalInstances;
    	vec4 instancePos[3];
    } ubo;

    Not working, anything else to do?
    Thanks.
    Last edited by paul.g.griffiths; 10-19-2017 at 08:20 AM.

  2. #2
    Senior Member
    Join Date
    Mar 2016
    Posts
    232
    I don't really see the C++ code match the shaders. The structs are probably further processed down the road.
    Can you link the exact example?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean