Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fragment_stage={"module": fshader, "entry_point": "main"},
primitive_topology=wgpu.PrimitiveTopology.triangle_strip,
rasterization_state={
"front_face": wgpu.FrontFace.ccw,
"cull_mode": wgpu.CullMode.none,
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": wgpu.TextureFormat.bgra8unorm_srgb,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"write_mask": wgpu.ColorWrite.ALL,
}
],
vertex_state={"index_format": wgpu.IndexFormat.uint32, "vertex_buffers": [],},
sample_count=1,
sample_mask=0xFFFFFFFF,
alpha_to_coverage_enabled=False,
)
swap_chain = device.configure_swap_chain(
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": texture_format,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"write_mask": wgpu.ColorWrite.ALL,
}
],
depth_stencil_state=depth_stencil_state,
vertex_state={
"index_format": wgpu.IndexFormat.uint32,
"vertex_buffers": vbo_views,
},
sample_count=1,
sample_mask=0xFFFFFFFF,
alpha_to_coverage_enabled=False,
)
command_encoder = device.create_command_encoder()
fragment_stage={"module": fshader, "entry_point": "main"},
primitive_topology=topology,
rasterization_state={
"front_face": wgpu.FrontFace.ccw,
"cull_mode": wgpu.CullMode.none,
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": wgpu.TextureFormat.bgra8unorm_srgb,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"write_mask": wgpu.ColorWrite.ALL,
}
],
depth_stencil_state=depth_stencil_state,
vertex_state={
"index_format": wgpu.IndexFormat.uint32,
"vertex_buffers": vbo_views,
},
sample_count=1,
sample_mask=0xFFFFFFFF,
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": wgpu.TextureFormat.bgra8unorm_srgb,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
}
],
vertex_state={
"index_format": wgpu.IndexFormat.uint32,
"vertex_buffers": [
{
"array_stride": 4 * 6,
"step_mode": wgpu.InputStepMode.vertex,
"attributes": [
{
"format": wgpu.VertexFormat.float4,
"offset": 0,
"shader_location": 0,
},
{
fragment_stage={"module": fshader, "entry_point": "main"},
primitive_topology=wgpu.PrimitiveTopology.triangle_list,
rasterization_state={
"front_face": wgpu.FrontFace.ccw,
"cull_mode": wgpu.CullMode.back,
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": wgpu.TextureFormat.bgra8unorm_srgb,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
}
],
vertex_state={
"index_format": wgpu.IndexFormat.uint32,
"vertex_buffers": [
{
"array_stride": 4 * 6,
"step_mode": wgpu.InputStepMode.vertex,
"attributes": [
{
"depth_bias": 0,
"depth_bias_slope_scale": 0.0,
"depth_bias_clamp": 0.0,
},
color_states=[
{
"format": wgpu.TextureFormat.bgra8unorm_srgb,
"alpha_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
"color_blend": (
wgpu.BlendFactor.one,
wgpu.BlendFactor.zero,
wgpu.BlendOperation.add,
),
}
],
vertex_state={"index_format": wgpu.IndexFormat.uint32, "vertex_buffers": []},
sample_count=1,
sample_mask=0xFFFFFFFF,
alpha_to_coverage_enabled=False,
)
swap_chain = device.configure_swap_chain(
canvas,
device.get_swap_chain_preferred_format(canvas),
wgpu.TextureUsage.OUTPUT_ATTACHMENT,
)
def draw_frame():