const struct svga_geometry_shader *gs,
const struct svga_compile_key *key)
{
- if (svga_have_vgpu10(svga)) {
- return svga_tgsi_vgpu10_translate(svga, &gs->base, key,
- PIPE_SHADER_GEOMETRY);
- }
- else {
- return svga_tgsi_vgpu9_translate(&gs->base, key, PIPE_SHADER_GEOMETRY);
- }
+ assert(svga_have_vgpu10(svga));
+ return svga_tgsi_vgpu10_translate(svga, &gs->base, key,
+ PIPE_SHADER_GEOMETRY);
}
enum pipe_error ret = PIPE_ERROR;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
/* some problem during translation, try the dummy shader */
const struct tgsi_token *dummy = get_dummy_geometry_shader();
if (!dummy) {
FREE((void *) gs->base.tokens);
gs->base.tokens = dummy;
variant = translate_geometry_program(svga, gs, key);
- if (variant == NULL) {
+ if (!variant) {
return PIPE_ERROR;
}
}
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;
enum pipe_error ret = PIPE_OK;
struct svga_compile_key key;
+ SVGA_STATS_TIME_PUSH(svga_sws(svga), SVGA_STATS_TIME_EMITGS);
+
/* If there's a user-defined GS, we should have a pointer to a derived
* GS. This should have been resolved in update_tgsi_transform().
*/
if (svga->curr.user_gs)
assert(svga->curr.gs);
- if (gs == NULL) {
+ if (!gs) {
if (svga->state.hw_draw.gs != NULL) {
/** The previous geometry shader is made inactive.
* Needs to unbind the geometry shader.
*/
ret = svga_set_shader(svga, SVGA3D_SHADERTYPE_GS, NULL);
+ if (ret != PIPE_OK)
+ goto done;
svga->state.hw_draw.gs = NULL;
}
- return ret;
+ goto done;
}
/* If there is stream output info for this geometry shader, then use
* it instead of the one from the vertex shader.
*/
if (svga_have_gs_streamout(svga)) {
- svga_set_stream_output(svga, gs->base.stream_output);
+ ret = svga_set_stream_output(svga, gs->base.stream_output);
+ if (ret != PIPE_OK) {
+ goto done;
+ }
}
else if (!svga_have_vs_streamout(svga)) {
/* turn off stream out */
- svga_set_stream_output(svga, NULL);
+ ret = svga_set_stream_output(svga, NULL);
+ if (ret != PIPE_OK) {
+ goto done;
+ }
}
/* SVGA_NEW_NEED_SWTNL */
if (!variant) {
ret = compile_gs(svga, gs, &key, &variant);
if (ret != PIPE_OK)
- return ret;
+ goto done;
/* insert the new variant at head of linked list */
assert(variant);
/* Bind the new variant */
ret = svga_set_shader(svga, SVGA3D_SHADERTYPE_GS, variant);
if (ret != PIPE_OK)
- return ret;
+ goto done;
svga->rebind.flags.gs = FALSE;
svga->dirty |= SVGA_NEW_GS_VARIANT;
svga->state.hw_draw.gs = variant;
}
- return PIPE_OK;
+done:
+ SVGA_STATS_TIME_POP(svga_sws(svga));
+ return ret;
}
struct svga_tracked_state svga_hw_gs =