Skip to content

Commit

Permalink
Revert "Revert "tbd""
Browse files Browse the repository at this point in the history
This reverts commit db86499.
  • Loading branch information
rdw-software committed Mar 14, 2024
1 parent db86499 commit cc40380
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Core/NativeClient/WebGPU/GPU.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function GPU:RequestLogicalDevice(adapter, options)
maxBindGroups = 3, -- Camera, material, transforms
maxUniformBuffersPerShaderStage = 1, -- Camera properties (increase for material, soon?)
maxSampledTexturesPerShaderStage = GPU.MAX_TEXTURE_ARRAY_SIZE,
maxSamplersPerShaderStage = GPU.MAX_TEXTURE_ARRAY_SIZE,
maxSamplersPerShaderStage = 4, -- GPU.MAX_TEXTURE_ARRAY_SIZE,
maxUniformBufferBindingSize = GPU.MAX_UNIFORM_BUFFER_BINDING_SIZE,
maxBindingsPerBindGroup = 2, -- Max. allowed binding index
maxDynamicUniformBuffersPerPipelineLayout = 1,
Expand Down
9 changes: 4 additions & 5 deletions Core/NativeClient/WebGPU/Materials/WaterSurfaceMaterial.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ function WaterSurfaceMaterial:CreateMaterialPropertiesBindGroup(textureArray)
sType = ffi.C.WGPUSType_BindGroupEntryExtras,
},
})
local textureSamplers = ffi.new("WGPUSampler[?]", GPU.MAX_TEXTURE_ARRAY_SIZE)
local textureSamplers = ffi.new("WGPUSampler[?]", 1)
-- There's no reason to use different samplers here, nor to allocate more than one (wasteful)
for index = 1, GPU.MAX_TEXTURE_ARRAY_SIZE, 1 do
textureSamplers[index - 1] = Texture.sharedTrilinearSampler
end
textureSamplers[0] = Texture.sharedTrilinearSampler

local textureSamplerExtras = new("WGPUBindGroupEntryExtras", {
samplerCount = GPU.MAX_TEXTURE_ARRAY_SIZE,
samplerCount = 1,
samplers = textureSamplers,
chain = {
sType = ffi.C.WGPUSType_BindGroupEntryExtras,
Expand Down
3 changes: 1 addition & 2 deletions Core/NativeClient/WebGPU/UniformBuffer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,8 @@ function UniformBuffer:CreateMaterialBindGroupLayouts(wgpuDevice)
}),
})

-- Texture arrays (wgpu extension) for water surface textures should be added here
local extras = new("WGPUBindGroupLayoutEntryExtras", {
count = GPU.MAX_TEXTURE_ARRAY_SIZE,
count = 1,
chain = {
sType = ffi.C.WGPUSType_BindGroupLayoutEntryExtras,
},
Expand Down

0 comments on commit cc40380

Please sign in to comment.