[Mesa-dev] [PATCH] svga: replace gotos with else clauses
Brian Paul
brianp at vmware.com
Thu Feb 15 16:31:12 UTC 2018
Simple clean-up.
---
src/gallium/drivers/svga/svga_state_fs.c | 19 +++++++++----------
src/gallium/drivers/svga/svga_state_gs.c | 9 ++++-----
src/gallium/drivers/svga/svga_state_vs.c | 15 +++++++--------
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c
index eeb1ba6..5190542 100644
--- a/src/gallium/drivers/svga/svga_state_fs.c
+++ b/src/gallium/drivers/svga/svga_state_fs.c
@@ -383,18 +383,17 @@ svga_reemit_fs_bindings(struct svga_context *svga)
ret = svga->swc->resource_rebind(svga->swc, NULL,
svga->state.hw_draw.fs->gb_shader,
SVGA_RELOC_READ);
- goto out;
+ }
+ else {
+ if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+ svga->state.hw_draw.fs->gb_shader,
+ svga->state.hw_draw.fs->id);
+ else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
+ svga->state.hw_draw.fs->gb_shader);
}
- if (svga_have_vgpu10(svga))
- ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_PS,
- svga->state.hw_draw.fs->gb_shader,
- svga->state.hw_draw.fs->id);
- else
- ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_PS,
- svga->state.hw_draw.fs->gb_shader);
-
- out:
if (ret != PIPE_OK)
return ret;
diff --git a/src/gallium/drivers/svga/svga_state_gs.c b/src/gallium/drivers/svga/svga_state_gs.c
index 19f0887..38d85f0 100644
--- a/src/gallium/drivers/svga/svga_state_gs.c
+++ b/src/gallium/drivers/svga/svga_state_gs.c
@@ -153,13 +153,12 @@ svga_reemit_gs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
ret = svga->swc->resource_rebind(svga->swc, NULL, gbshader,
SVGA_RELOC_READ);
- goto out;
+ }
+ else {
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
+ gbshader, shaderId);
}
- ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_GS,
- gbshader, shaderId);
-
- out:
if (ret != PIPE_OK)
return ret;
diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c
index 3dfc9f4..ad93f60 100644
--- a/src/gallium/drivers/svga/svga_state_vs.c
+++ b/src/gallium/drivers/svga/svga_state_vs.c
@@ -227,16 +227,15 @@ svga_reemit_vs_bindings(struct svga_context *svga)
if (!svga_need_to_rebind_resources(svga)) {
ret = svga->swc->resource_rebind(svga->swc, NULL, gbshader,
SVGA_RELOC_READ);
- goto out;
+ }
+ else {
+ if (svga_have_vgpu10(svga))
+ ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
+ gbshader, shaderId);
+ else
+ ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
}
- if (svga_have_vgpu10(svga))
- ret = SVGA3D_vgpu10_SetShader(svga->swc, SVGA3D_SHADERTYPE_VS,
- gbshader, shaderId);
- else
- ret = SVGA3D_SetGBShader(svga->swc, SVGA3D_SHADERTYPE_VS, gbshader);
-
- out:
if (ret != PIPE_OK)
return ret;
--
2.7.4
More information about the mesa-dev
mailing list