remove vertex and index buffer from world shader
This commit is contained in:
+5
-28
@@ -1037,34 +1037,15 @@ static bool recreate_graphics_pipelines() {
|
||||
|
||||
WGPUShaderModule world_shader = wgpuDeviceCreateShaderModule(device, &world_shader_descriptor);
|
||||
|
||||
WGPUVertexAttribute vertex_buffer_attributes[] = {
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x3,
|
||||
.offset = offsetof(Vertex, pos),
|
||||
.shaderLocation = 0,
|
||||
},
|
||||
{
|
||||
.format = WGPUVertexFormat_Float32x2,
|
||||
.offset = offsetof(Vertex, uv),
|
||||
.shaderLocation = 1,
|
||||
},
|
||||
};
|
||||
|
||||
WGPUVertexAttribute instance_buffer_attributes[] = {
|
||||
{
|
||||
.format = WGPUVertexFormat_Uint32,
|
||||
.offset = 0,
|
||||
.shaderLocation = 2,
|
||||
.shaderLocation = 0,
|
||||
},
|
||||
};
|
||||
|
||||
WGPUVertexBufferLayout vertex_buffer_layouts[] = {
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Vertex,
|
||||
.arrayStride = sizeof(Vertex),
|
||||
.attributeCount = SDL_arraysize(vertex_buffer_attributes),
|
||||
.attributes = vertex_buffer_attributes,
|
||||
},
|
||||
{
|
||||
.stepMode = WGPUVertexStepMode_Instance,
|
||||
.arrayStride = sizeof(Uint32),
|
||||
@@ -2111,11 +2092,9 @@ static void render_editor(WGPURenderPassColorAttachment framebuffer) {
|
||||
{ // Draw Map
|
||||
ZoneScopedN("Draw Map");
|
||||
wgpuRenderPassEncoderSetPipeline(render_pass_encoder, world_render_pipeline);
|
||||
wgpuRenderPassEncoderSetIndexBuffer(render_pass_encoder, index_buffer, WGPUIndexFormat_Uint16, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 0, vertex_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 1, current_map.gpu_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 0, current_map.gpu_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetBindGroup(render_pass_encoder, 1, world_bind_group, 0, NULL);
|
||||
wgpuRenderPassEncoderDrawIndexed(render_pass_encoder, 6, current_map.size.y * current_map.size.x, 0, 0, 0);
|
||||
wgpuRenderPassEncoderDraw(render_pass_encoder, 6, current_map.size.y * current_map.size.x, 0, 0);
|
||||
}
|
||||
|
||||
if (show_grid) { // Draw Grid
|
||||
@@ -2280,11 +2259,9 @@ static void render_game(WGPURenderPassColorAttachment framebuffer) {
|
||||
{ // Draw Map
|
||||
ZoneScopedN("Draw Map");
|
||||
wgpuRenderPassEncoderSetPipeline(render_pass_encoder, world_render_pipeline);
|
||||
wgpuRenderPassEncoderSetIndexBuffer(render_pass_encoder, index_buffer, WGPUIndexFormat_Uint16, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 0, vertex_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 1, current_map.gpu_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetVertexBuffer(render_pass_encoder, 0, current_map.gpu_buffer, 0, WGPU_WHOLE_SIZE);
|
||||
wgpuRenderPassEncoderSetBindGroup(render_pass_encoder, 1, world_bind_group, 0, NULL);
|
||||
wgpuRenderPassEncoderDrawIndexed(render_pass_encoder, 6, current_map.size.y * current_map.size.x, 0, 0, 0);
|
||||
wgpuRenderPassEncoderDraw(render_pass_encoder, 6, current_map.size.y * current_map.size.x, 0, 0);
|
||||
}
|
||||
|
||||
{ // Draw Player
|
||||
|
||||
Reference in New Issue
Block a user